@office-open/core 0.10.14 → 0.11.0

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 (83) hide show
  1. package/README.md +2 -1
  2. package/dist/chart/index.d.mts +2 -2
  3. package/dist/chart/index.mjs +2 -2
  4. package/dist/chart-Kf_utasF.mjs +1780 -0
  5. package/dist/chart-Kf_utasF.mjs.map +1 -0
  6. package/dist/color-mapping-CFF0vRSe.mjs +117 -0
  7. package/dist/color-mapping-CFF0vRSe.mjs.map +1 -0
  8. package/dist/descriptor/index.d.mts +2 -2
  9. package/dist/descriptor/index.mjs +1 -1
  10. package/dist/{descriptor-BjNkn5jo.mjs → descriptor-BX8xW8na.mjs} +6 -2
  11. package/dist/{descriptor-BjNkn5jo.mjs.map → descriptor-BX8xW8na.mjs.map} +1 -1
  12. package/dist/drawing/index.d.mts +2 -0
  13. package/dist/drawing/index.mjs +2 -0
  14. package/dist/{drawingml-sj1J3lb0.mjs → drawing-FBzd2I0m.mjs} +2596 -1518
  15. package/dist/drawing-FBzd2I0m.mjs.map +1 -0
  16. package/dist/{converters-C_Y2QX1w.mjs → generators-CElPsAhd.mjs} +699 -258
  17. package/dist/generators-CElPsAhd.mjs.map +1 -0
  18. package/dist/index-BsTUn4K1.d.mts +28 -0
  19. package/dist/index-BsTUn4K1.d.mts.map +1 -0
  20. package/dist/index-C0ClOhmZ.d.mts +869 -0
  21. package/dist/index-C0ClOhmZ.d.mts.map +1 -0
  22. package/dist/{index-BVK2dv6C.d.mts → index-CLX7gU9J.d.mts} +8 -3
  23. package/dist/index-CLX7gU9J.d.mts.map +1 -0
  24. package/dist/index-Cgz88FU0.d.mts +308 -0
  25. package/dist/index-Cgz88FU0.d.mts.map +1 -0
  26. package/dist/{index-CE53SwpZ.d.mts → index-CnjCK-lF.d.mts} +497 -351
  27. package/dist/index-CnjCK-lF.d.mts.map +1 -0
  28. package/dist/{index-BfHfKuKy.d.mts → index-DpPeyf5f.d.mts} +61 -20
  29. package/dist/index-DpPeyf5f.d.mts.map +1 -0
  30. package/dist/index-DxwLMnBF.d.mts +384 -0
  31. package/dist/index-DxwLMnBF.d.mts.map +1 -0
  32. package/dist/index.d.mts +175 -22
  33. package/dist/index.d.mts.map +1 -1
  34. package/dist/index.mjs +523 -70
  35. package/dist/index.mjs.map +1 -1
  36. package/dist/patch/index.mjs +1 -1
  37. package/dist/{patch-BmRfghOo.mjs → patch-3KLx2yEP.mjs} +4 -4
  38. package/dist/patch-3KLx2yEP.mjs.map +1 -0
  39. package/dist/smartart/index.d.mts +2 -2
  40. package/dist/smartart/index.mjs +2 -2
  41. package/dist/smartart-BxnkROOp.mjs +1649 -0
  42. package/dist/smartart-BxnkROOp.mjs.map +1 -0
  43. package/dist/style-matrix-DAP6XrLv.mjs +123 -0
  44. package/dist/style-matrix-DAP6XrLv.mjs.map +1 -0
  45. package/dist/theme/index.d.mts +4 -2
  46. package/dist/theme/index.mjs +3 -2
  47. package/dist/theme-OAuRcA9_.mjs +460 -0
  48. package/dist/theme-OAuRcA9_.mjs.map +1 -0
  49. package/dist/theme-options-BbWccl85.d.mts +109 -0
  50. package/dist/theme-options-BbWccl85.d.mts.map +1 -0
  51. package/dist/util/index.d.mts +3 -3
  52. package/dist/util/index.mjs +3 -3
  53. package/dist/{util-Tq9PSjK0.mjs → util-C94-JKtp.mjs} +175 -429
  54. package/dist/util-C94-JKtp.mjs.map +1 -0
  55. package/dist/{values-8di32lIe.d.mts → values-aVoirbWB.d.mts} +4 -2
  56. package/dist/values-aVoirbWB.d.mts.map +1 -0
  57. package/dist/vector/index.d.mts +2 -0
  58. package/dist/vector/index.mjs +2 -0
  59. package/dist/vector-TpjW6ZSc.mjs +3092 -0
  60. package/dist/vector-TpjW6ZSc.mjs.map +1 -0
  61. package/package.json +15 -7
  62. package/dist/chart-DIGJna_6.mjs +0 -582
  63. package/dist/chart-DIGJna_6.mjs.map +0 -1
  64. package/dist/converters-C_Y2QX1w.mjs.map +0 -1
  65. package/dist/drawingml/index.d.mts +0 -2
  66. package/dist/drawingml/index.mjs +0 -2
  67. package/dist/drawingml-sj1J3lb0.mjs.map +0 -1
  68. package/dist/index-BVK2dv6C.d.mts.map +0 -1
  69. package/dist/index-BfHfKuKy.d.mts.map +0 -1
  70. package/dist/index-CE53SwpZ.d.mts.map +0 -1
  71. package/dist/index-D6VE-MnJ.d.mts +0 -43
  72. package/dist/index-D6VE-MnJ.d.mts.map +0 -1
  73. package/dist/index-DE4CLElr.d.mts +0 -145
  74. package/dist/index-DE4CLElr.d.mts.map +0 -1
  75. package/dist/index-DlPA26cw.d.mts +0 -91
  76. package/dist/index-DlPA26cw.d.mts.map +0 -1
  77. package/dist/patch-BmRfghOo.mjs.map +0 -1
  78. package/dist/smartart-B7ukZ-Tw.mjs +0 -305
  79. package/dist/smartart-B7ukZ-Tw.mjs.map +0 -1
  80. package/dist/theme-CiNzdl-9.mjs +0 -177
  81. package/dist/theme-CiNzdl-9.mjs.map +0 -1
  82. package/dist/util-Tq9PSjK0.mjs.map +0 -1
  83. package/dist/values-8di32lIe.d.mts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawing-FBzd2I0m.mjs","names":["parsePercent","SYSTEM_COLOR_VALUES","PRESET_COLOR_VALUES","SCHEME_COLOR_VALUES","stringify","stringify","parse","createBlurEffect","stringifyDesc","parseDesc","stringify","parse","parsePercent","stringify","parse","stringify","parse","parsePercent","parse","stringify","parse","parse","parse","stringify","parse","stringifyBullet","parsePercent","parsePercent"],"sources":["../src/drawing/color/color-transform.ts","../src/drawing/color/preset-color.ts","../src/drawing/color/scheme-color.ts","../src/drawing/color/system-color.ts","../src/drawing/color/color-descriptors.ts","../src/drawing/color/hsl-color.ts","../src/drawing/color/rgb-color.ts","../src/drawing/color/sc-rgb-color.ts","../src/drawing/color/solid-fill.ts","../src/drawing/diagram/diagram-style.ts","../src/drawing/three-d/three-d-descriptors.ts","../src/drawing/blip/blip-effects.ts","../src/drawing/blip/source-rectangle.ts","../src/drawing/blip/tile.ts","../src/drawing/fill/gradient-fill.ts","../src/drawing/fill/pattern-fill.ts","../src/drawing/fill/fill-options.ts","../src/drawing/fill/no-fill.ts","../src/drawing/fill/group-fill.ts","../src/drawing/outline/custom-dash.ts","../src/drawing/outline/line-end.ts","../src/drawing/outline/outline.ts","../src/drawing/effects/fill-overlay.ts","../src/drawing/effects/glow.ts","../src/drawing/effects/inner-shadow.ts","../src/drawing/effects/outer-shadow.ts","../src/drawing/effects/preset-shadow.ts","../src/drawing/effects/reflection.ts","../src/drawing/effects/soft-edge.ts","../src/drawing/effects/effect-list.ts","../src/drawing/effects/effect-dag.ts","../src/drawing/three-d/scene-3d.ts","../src/drawing/three-d/bevel.ts","../src/drawing/three-d/shape-3d.ts","../src/drawing/geometry/adjustment-values.ts","../src/drawing/geometry/preset-geometry.ts","../src/drawing/geometry/custom-geometry.ts","../src/drawing/blip/blip-extensions.ts","../src/drawing/blip/blip.ts","../src/drawing/blip/blip-fill.ts","../src/drawing/blip/stretch.ts","../src/drawing/transform.ts","../src/drawing/table-style.ts","../src/drawing/locking/locking.ts","../src/drawing/connection.ts","../src/drawing/non-visual/drawing-properties.ts","../src/drawing/non-visual/content-part-properties.ts","../src/drawing/diagram/layout-vars.ts","../src/drawing/diagram/headers.ts","../src/drawing/diagram/diagram-rel.ts","../src/drawing/diagram/diagram-props.ts","../src/drawing/blip/blip-descriptors.ts","../src/drawing/fill/fill-descriptors.ts","../src/drawing/outline/outline-descriptors.ts","../src/drawing/effects/effect-descriptors.ts","../src/drawing/locking/locking-descriptors.ts","../src/drawing/geometry/geometry-descriptors.ts","../src/drawing/transform-descriptors.ts","../src/drawing/shape-properties-desc.ts","../src/drawing/group-shape-properties-desc.ts","../src/drawing/text/types.ts","../src/drawing/text/body-properties.ts","../src/drawing/text/run-properties.ts","../src/drawing/text/run.ts","../src/drawing/text/paragraph.ts","../src/drawing/text/list-style.ts","../src/drawing/text/text-body.ts","../src/drawing/diagram/diagram-descriptors.ts"],"sourcesContent":["/**\n * Color transform elements for DrawingML colors.\n *\n * This module provides color transformation elements defined in EG_ColorTransform,\n * which can be applied as child elements to any color type (srgbClr, schemeClr, etc.).\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, EG_ColorTransform\n *\n * @module\n */\n\nimport { emitAngle, emitPercent } from \"../../util/converters\";\n\n/**\n * Options for color transforms.\n *\n * Percent fields take integer percent (e.g., `40` = 40%); the library scales\n * to the XSD 1/1000th-of-a-percent unit. Angle fields (`hue`/`hueOff`) take\n * degrees; the library scales to the XSD 1/60000th-of-a-degree unit. Boolean\n * fields emit value-less switch elements.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, EG_ColorTransform\n */\nexport interface ColorTransformOptions {\n /** Tint: moves color toward white (0-100, where 100 = full white) */\n tint?: number;\n /** Shade: moves color toward black (0-100, where 100 = full black) */\n shade?: number;\n /** Complement: inverts the color (no value) */\n comp?: boolean;\n /** Inverse: inverts the color (no value) */\n inv?: boolean;\n /** Grayscale: converts to grayscale (no value) */\n gray?: boolean;\n /** Alpha: sets transparency (0-100, where 0 = transparent) */\n alpha?: number;\n /** Alpha offset: adjusts alpha by fixed percent (-100 to 100) */\n alphaOff?: number;\n /** Alpha modulation: scales alpha by percent (0-100) */\n alphaMod?: number;\n /** Hue: sets hue angle in degrees (0-360). */\n hue?: number;\n /** Hue offset: adjusts hue angle in degrees (-90 to 90). */\n hueOff?: number;\n /** Hue modulation: scales hue by percent (0-100) */\n hueMod?: number;\n /** Saturation: sets saturation (-100 to 100) */\n sat?: number;\n /** Saturation offset: adjusts saturation (-100 to 100) */\n satOff?: number;\n /** Saturation modulation: scales saturation (0-100) */\n satMod?: number;\n /** Luminance: sets luminance (-100 to 100) */\n lum?: number;\n /** Luminance offset: adjusts luminance (-100 to 100) */\n lumOff?: number;\n /** Luminance modulation: scales luminance (0-100) */\n lumMod?: number;\n /** Red: sets red channel (-100 to 100) */\n red?: number;\n /** Red offset: adjusts red channel (-100 to 100) */\n redOff?: number;\n /** Red modulation: scales red channel (0-100) */\n redMod?: number;\n /** Green: sets green channel (-100 to 100) */\n green?: number;\n /** Green offset: adjusts green channel (-100 to 100) */\n greenOff?: number;\n /** Green modulation: scales green channel (0-100) */\n greenMod?: number;\n /** Blue: sets blue channel (-100 to 100) */\n blue?: number;\n /** Blue offset: adjusts blue channel (-100 to 100) */\n blueOff?: number;\n /** Blue modulation: scales blue channel (0-100) */\n blueMod?: number;\n /** Gamma correction (no value) */\n gamma?: boolean;\n /** Inverse gamma correction (no value) */\n invGamma?: boolean;\n}\n\ntype TransformKey = keyof ColorTransformOptions & string;\n\n/**\n * Transform keys classified by XSD unit — the single source of truth shared by\n * stringify and parse. Percent keys take integer percent (e.g. `50` = 50%,\n * scaled ×1000); angle keys take degrees (scaled ×60000); value-less boolean\n * keys (comp/inv/gray/gamma/invGamma) belong to neither set.\n */\nexport const PERCENT_TRANSFORMS: ReadonlySet<TransformKey> = new Set<TransformKey>([\n \"tint\",\n \"shade\",\n \"alpha\",\n \"alphaOff\",\n \"alphaMod\",\n \"hueMod\",\n \"sat\",\n \"satOff\",\n \"satMod\",\n \"lum\",\n \"lumOff\",\n \"lumMod\",\n \"red\",\n \"redOff\",\n \"redMod\",\n \"green\",\n \"greenOff\",\n \"greenMod\",\n \"blue\",\n \"blueOff\",\n \"blueMod\",\n]);\n\nexport const ANGLE_TRANSFORMS: ReadonlySet<TransformKey> = new Set<TransformKey>([\"hue\", \"hueOff\"]);\n\n/** Value-less switch transforms (empty elements — presence is the semantics). */\nexport const BOOLEAN_TRANSFORMS: ReadonlySet<TransformKey> = new Set<TransformKey>([\n \"comp\",\n \"inv\",\n \"gray\",\n \"gamma\",\n \"invGamma\",\n]);\n\n/** Scale a transform value to its XSD unit; non-percent/angle keys pass through. */\nexport function emitTransformValue(key: TransformKey, value: number): number {\n if (PERCENT_TRANSFORMS.has(key)) return emitPercent(value);\n if (ANGLE_TRANSFORMS.has(key)) return emitAngle(value);\n return value;\n}\n\n/**\n * Serialize color transforms, preserving the key order of the options object.\n *\n * EG_ColorTransform is an unordered XSD choice, but the sequence is\n * semantically significant (transforms compose left to right), so the caller's\n * key order is the emission order and round-trips come back in source order —\n * plain JS objects preserve insertion order.\n *\n * @example\n * ```typescript\n * // Lighten accent1 by 40%\n * createColorTransforms({ tint: 40 });\n * // Semi-transparent red with 50% alpha\n * createColorTransforms({ alpha: 50 });\n * ```\n */\nexport const createColorTransforms = (options: ColorTransformOptions): readonly string[] => {\n const t: string[] = [];\n\n for (const [name, value] of Object.entries(options)) {\n const key = name as TransformKey;\n if (value === undefined || value === false) continue;\n if (value === true) {\n t.push(`<a:${key}/>`);\n continue;\n }\n t.push(`<a:${key} val=\"${emitTransformValue(key, value)}\"/>`);\n }\n\n return t;\n};\n","/**\n * Preset color element for DrawingML.\n *\n * This module provides named preset colors (CSS named colors).\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PresetColor / ST_PresetColorVal\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport type { ColorTransformOptions } from \"./color-transform\";\nimport { createColorTransforms } from \"./color-transform\";\n\n/**\n * Preset color values (CSS named colors).\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_PresetColorVal\">\n * <xsd:restriction base=\"xsd:token\">\n * <xsd:enumeration value=\"aliceBlue\"/>\n * ...\n * <xsd:enumeration value=\"yellowGreen\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n */\nexport const PresetColor = {\n ALICE_BLUE: \"aliceBlue\",\n ANTIQUE_WHITE: \"antiqueWhite\",\n AQUA: \"aqua\",\n AQUAMARINE: \"aquamarine\",\n AZURE: \"azure\",\n BEIGE: \"beige\",\n BISQUE: \"bisque\",\n BLACK: \"black\",\n BLANCHED_ALMOND: \"blanchedAlmond\",\n BLUE: \"blue\",\n BLUE_VIOLET: \"blueViolet\",\n BROWN: \"brown\",\n BURLY_WOOD: \"burlyWood\",\n CADET_BLUE: \"cadetBlue\",\n CHARTREUSE: \"chartreuse\",\n CHOCOLATE: \"chocolate\",\n CORAL: \"coral\",\n CORNFLOWER_BLUE: \"cornflowerBlue\",\n CORNSILK: \"cornsilk\",\n CRIMSON: \"crimson\",\n CYAN: \"cyan\",\n DARK_BLUE: \"darkBlue\",\n DARK_CYAN: \"darkCyan\",\n DARK_GOLDENROD: \"darkGoldenrod\",\n DARK_GRAY: \"darkGray\",\n DARK_GREY: \"darkGrey\",\n DARK_GREEN: \"darkGreen\",\n DARK_KHAKI: \"darkKhaki\",\n DARK_MAGENTA: \"darkMagenta\",\n DARK_OLIVE_GREEN: \"darkOliveGreen\",\n DARK_ORANGE: \"darkOrange\",\n DARK_ORCHID: \"darkOrchid\",\n DARK_RED: \"darkRed\",\n DARK_SALMON: \"darkSalmon\",\n DARK_SEA_GREEN: \"darkSeaGreen\",\n DARK_SLATE_BLUE: \"darkSlateBlue\",\n DARK_SLATE_GRAY: \"darkSlateGray\",\n DARK_SLATE_GREY: \"darkSlateGrey\",\n DARK_TURQUOISE: \"darkTurquoise\",\n DARK_VIOLET: \"darkViolet\",\n DEEP_PINK: \"deepPink\",\n DEEP_SKY_BLUE: \"deepSkyBlue\",\n DIM_GRAY: \"dimGray\",\n DIM_GREY: \"dimGrey\",\n DODGER_BLUE: \"dodgerBlue\",\n FIREBRICK: \"firebrick\",\n FLORAL_WHITE: \"floralWhite\",\n FOREST_GREEN: \"forestGreen\",\n FUCHSIA: \"fuchsia\",\n GAINSBORO: \"gainsboro\",\n GHOST_WHITE: \"ghostWhite\",\n GOLD: \"gold\",\n GOLDENROD: \"goldenrod\",\n GRAY: \"gray\",\n GREY: \"grey\",\n GREEN: \"green\",\n GREEN_YELLOW: \"greenYellow\",\n HONEYDEW: \"honeydew\",\n HOT_PINK: \"hotPink\",\n INDIAN_RED: \"indianRed\",\n INDIGO: \"indigo\",\n IVORY: \"ivory\",\n KHAKI: \"khaki\",\n LAVENDER: \"lavender\",\n LAVENDER_BLUSH: \"lavenderBlush\",\n LAWN_GREEN: \"lawnGreen\",\n LEMON_CHIFFON: \"lemonChiffon\",\n LIGHT_BLUE: \"lightBlue\",\n LIGHT_CORAL: \"lightCoral\",\n LIGHT_CYAN: \"lightCyan\",\n LIGHT_GOLDENROD_YELLOW: \"lightGoldenrodYellow\",\n LIGHT_GRAY: \"lightGray\",\n LIGHT_GREY: \"lightGrey\",\n LIGHT_GREEN: \"lightGreen\",\n LIGHT_PINK: \"lightPink\",\n LIGHT_SALMON: \"lightSalmon\",\n LIGHT_SEA_GREEN: \"lightSeaGreen\",\n LIGHT_SKY_BLUE: \"lightSkyBlue\",\n LIGHT_SLATE_GRAY: \"lightSlateGray\",\n LIGHT_SLATE_GREY: \"lightSlateGrey\",\n LIGHT_STEEL_BLUE: \"lightSteelBlue\",\n LIGHT_YELLOW: \"lightYellow\",\n LIME: \"lime\",\n LIME_GREEN: \"limeGreen\",\n LINEN: \"linen\",\n MAGENTA: \"magenta\",\n MAROON: \"maroon\",\n MEDIUM_AQUAMARINE: \"mediumAquamarine\",\n MEDIUM_BLUE: \"mediumBlue\",\n MEDIUM_ORCHID: \"mediumOrchid\",\n MEDIUM_PURPLE: \"mediumPurple\",\n MEDIUM_SEA_GREEN: \"mediumSeaGreen\",\n MEDIUM_SLATE_BLUE: \"mediumSlateBlue\",\n MEDIUM_SPRING_GREEN: \"mediumSpringGreen\",\n MEDIUM_TURQUOISE: \"mediumTurquoise\",\n MEDIUM_VIOLET_RED: \"mediumVioletRed\",\n MIDNIGHT_BLUE: \"midnightBlue\",\n MINT_CREAM: \"mintCream\",\n MISTY_ROSE: \"mistyRose\",\n MOCCASIN: \"moccasin\",\n NAVAJO_WHITE: \"navajoWhite\",\n NAVY: \"navy\",\n OLD_LACE: \"oldLace\",\n OLIVE: \"olive\",\n OLIVE_DRAB: \"oliveDrab\",\n ORANGE: \"orange\",\n ORANGE_RED: \"orangeRed\",\n ORCHID: \"orchid\",\n PALE_GOLDENROD: \"paleGoldenrod\",\n PALE_GREEN: \"paleGreen\",\n PALE_TURQUOISE: \"paleTurquoise\",\n PALE_VIOLET_RED: \"paleVioletRed\",\n PAPAYA_WHIP: \"papayaWhip\",\n PEACH_PUFF: \"peachPuff\",\n PERU: \"peru\",\n PINK: \"pink\",\n PLUM: \"plum\",\n POWDER_BLUE: \"powderBlue\",\n PURPLE: \"purple\",\n RED: \"red\",\n ROSY_BROWN: \"rosyBrown\",\n ROYAL_BLUE: \"royalBlue\",\n SADDLE_BROWN: \"saddleBrown\",\n SALMON: \"salmon\",\n SANDY_BROWN: \"sandyBrown\",\n SEA_GREEN: \"seaGreen\",\n SEA_SHELL: \"seaShell\",\n SIENNA: \"sienna\",\n SILVER: \"silver\",\n SKY_BLUE: \"skyBlue\",\n SLATE_BLUE: \"slateBlue\",\n SLATE_GRAY: \"slateGray\",\n SLATE_GREY: \"slateGrey\",\n SNOW: \"snow\",\n SPRING_GREEN: \"springGreen\",\n STEEL_BLUE: \"steelBlue\",\n TAN: \"tan\",\n TEAL: \"teal\",\n THISTLE: \"thistle\",\n TOMATO: \"tomato\",\n TURQUOISE: \"turquoise\",\n VIOLET: \"violet\",\n WHEAT: \"wheat\",\n WHITE: \"white\",\n WHITE_SMOKE: \"whiteSmoke\",\n YELLOW: \"yellow\",\n YELLOW_GREEN: \"yellowGreen\",\n} as const;\n\n/**\n * Options for preset color.\n */\nexport interface PresetColorOptions {\n /** Preset color value */\n value: (typeof PresetColor)[keyof typeof PresetColor];\n /** Optional color transforms */\n transforms?: ColorTransformOptions;\n}\n\n/**\n * Creates a preset color element as an XML string.\n *\n * Specifies a color using a named preset (CSS named color).\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_PresetColor\">\n * <xsd:sequence>\n * <xsd:group ref=\"EG_ColorTransform\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"val\" type=\"ST_PresetColorVal\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createPresetColor = (options: PresetColorOptions): string => {\n const transforms = options.transforms ? createColorTransforms(options.transforms) : [];\n return element(\"a:prstClr\", { val: options.value }, transforms);\n};\n","/**\n * Scheme color element for DrawingML shapes.\n *\n * This module provides scheme-based color support for solid fills,\n * allowing colors to be defined using theme color schemes.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SchemeColor / ST_SchemeColorVal\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport type { ColorTransformOptions } from \"./color-transform\";\nimport { createColorTransforms } from \"./color-transform\";\n\n/**\n * Options for scheme color.\n */\nexport interface SchemeColorOptions {\n /** Scheme color value */\n value: (typeof SchemeColor)[keyof typeof SchemeColor];\n /** Optional color transforms */\n transforms?: ColorTransformOptions;\n}\n\n// <xsd:simpleType name=\"ST_SchemeColorVal\">\n// <xsd:restriction base=\"xsd:string\">\n// <xsd:enumeration value=\"bg1\"/>\n// <xsd:enumeration value=\"tx1\"/>\n// <xsd:enumeration value=\"bg2\"/>\n// <xsd:enumeration value=\"tx2\"/>\n// <xsd:enumeration value=\"accent1\"/>\n// <xsd:enumeration value=\"accent2\"/>\n// <xsd:enumeration value=\"accent3\"/>\n// <xsd:enumeration value=\"accent4\"/>\n// <xsd:enumeration value=\"accent5\"/>\n// <xsd:enumeration value=\"accent6\"/>\n// <xsd:enumeration value=\"hlink\"/>\n// <xsd:enumeration value=\"folHlink\"/>\n// <xsd:enumeration value=\"dk1\"/>\n// <xsd:enumeration value=\"lt1\"/>\n// <xsd:enumeration value=\"dk2\"/>\n// <xsd:enumeration value=\"lt2\"/>\n// <xsd:enumeration value=\"phClr\"/>\n// </xsd:restriction>\n// </xsd:simpleType>\n\n// Cspell:ignore folHlink, phClr, hlink\n\n/**\n * Scheme color values for theme-based colors.\n *\n * These values reference colors defined in the document's color scheme/theme.\n */\nexport const SchemeColor = {\n /** Background color 1 */\n BG1: \"bg1\",\n /** Text color 1 */\n TX1: \"tx1\",\n /** Background color 2 */\n BG2: \"bg2\",\n /** Text color 2 */\n TX2: \"tx2\",\n /** Accent color 1 */\n ACCENT1: \"accent1\",\n /** Accent color 2 */\n ACCENT2: \"accent2\",\n /** Accent color 3 */\n ACCENT3: \"accent3\",\n /** Accent color 4 */\n ACCENT4: \"accent4\",\n /** Accent color 5 */\n ACCENT5: \"accent5\",\n /** Accent color 6 */\n ACCENT6: \"accent6\",\n /** Hyperlink color */\n HLINK: \"hlink\",\n /** Followed hyperlink color */\n FOLHLINK: \"folHlink\",\n /** Dark color 1 */\n DK1: \"dk1\",\n /** Light color 1 */\n LT1: \"lt1\",\n /** Dark color 2 */\n DK2: \"dk2\",\n /** Light color 2 */\n LT2: \"lt2\",\n /** Placeholder color */\n PHCLR: \"phClr\",\n} as const;\n\n/**\n * Creates a scheme color element as an XML string.\n *\n * Specifies a color using a theme color scheme reference.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_SchemeColor\">\n * <xsd:sequence>\n * <xsd:group ref=\"EG_ColorTransform\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"val\" type=\"ST_SchemeColorVal\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * const accentColor = createSchemeColor({ value: SchemeColor.ACCENT1 });\n * // With tint transform\n * const lightAccent = createSchemeColor({\n * value: SchemeColor.ACCENT1,\n * transforms: { tint: 40 },\n * });\n * ```\n */\nexport const createSchemeColor = (options: SchemeColorOptions): string => {\n const transforms = options.transforms ? createColorTransforms(options.transforms) : [];\n return element(\"a:schemeClr\", { val: options.value }, transforms);\n};\n","/**\n * System color element for DrawingML.\n *\n * This module provides system color support, referencing OS-level UI colors.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SystemColor / ST_SystemColorVal\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport type { ColorTransformOptions } from \"./color-transform\";\nimport { createColorTransforms } from \"./color-transform\";\n\n/**\n * System color values referencing OS UI colors.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_SystemColorVal\">\n * <xsd:restriction base=\"xsd:token\">\n * <xsd:enumeration value=\"scrollBar\"/>\n * <xsd:enumeration value=\"background\"/>\n * ...\n * <xsd:enumeration value=\"menuBar\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n */\nexport const SystemColor = {\n SCROLL_BAR: \"scrollBar\",\n BACKGROUND: \"background\",\n ACTIVE_CAPTION: \"activeCaption\",\n INACTIVE_CAPTION: \"inactiveCaption\",\n MENU: \"menu\",\n WINDOW: \"window\",\n WINDOW_FRAME: \"windowFrame\",\n MENU_TEXT: \"menuText\",\n WINDOW_TEXT: \"windowText\",\n CAPTION_TEXT: \"captionText\",\n ACTIVE_BORDER: \"activeBorder\",\n INACTIVE_BORDER: \"inactiveBorder\",\n APP_WORKSPACE: \"appWorkspace\",\n HIGHLIGHT: \"highlight\",\n HIGHLIGHT_TEXT: \"highlightText\",\n BTN_FACE: \"btnFace\",\n BTN_SHADOW: \"btnShadow\",\n GRAY_TEXT: \"grayText\",\n BTN_TEXT: \"btnText\",\n INACTIVE_CAPTION_TEXT: \"inactiveCaptionText\",\n BTN_HIGHLIGHT: \"btnHighlight\",\n THREE_D_DK_SHADOW: \"3dDkShadow\",\n THREE_D_LIGHT: \"3dLight\",\n INFO_TEXT: \"infoText\",\n INFO_BK: \"infoBk\",\n HOT_LIGHT: \"hotLight\",\n GRADIENT_ACTIVE_CAPTION: \"gradientActiveCaption\",\n GRADIENT_INACTIVE_CAPTION: \"gradientInactiveCaption\",\n MENU_HIGHLIGHT: \"menuHighlight\",\n MENU_BAR: \"menuBar\",\n} as const;\n\n/**\n * Options for system color.\n */\nexport interface SystemColorOptions {\n /** System color value */\n value: (typeof SystemColor)[keyof typeof SystemColor];\n /** Last known RGB color value (optional fallback) */\n lastClr?: string;\n /** Optional color transforms */\n transforms?: ColorTransformOptions;\n}\n\n/**\n * Creates a system color element as an XML string.\n *\n * References a system-defined UI color (e.g., window background, button face).\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_SystemColor\">\n * <xsd:sequence>\n * <xsd:group ref=\"EG_ColorTransform\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"val\" type=\"ST_SystemColorVal\" use=\"required\"/>\n * <xsd:attribute name=\"lastClr\" type=\"s:ST_HexColorRGB\" use=\"optional\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createSystemColor = (options: SystemColorOptions): string => {\n const transforms = options.transforms ? createColorTransforms(options.transforms) : [];\n return element(\"a:sysClr\", { val: options.value, lastClr: options.lastClr }, transforms);\n};\n","/**\n * Color descriptors for DrawingML.\n *\n * @module\n */\n\nimport { escapeXml } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\n\nimport type { CustomDescriptor, ReadContext, WriteContext } from \"../../descriptor\";\nimport { stringify } from \"../../descriptor\";\nimport { emitAngle, emitPercent, parseAngle, parsePercent } from \"../../util/converters\";\nimport {\n ANGLE_TRANSFORMS,\n BOOLEAN_TRANSFORMS,\n createColorTransforms,\n PERCENT_TRANSFORMS,\n} from \"./color-transform\";\nimport type { ColorTransformOptions } from \"./color-transform\";\nimport type { HslColorOptions } from \"./hsl-color\";\nimport type { PresetColorOptions } from \"./preset-color\";\nimport { PresetColor } from \"./preset-color\";\nimport type { RgbColorOptions } from \"./rgb-color\";\nimport type { ScRgbColorOptions } from \"./sc-rgb-color\";\nimport type { SchemeColorOptions } from \"./scheme-color\";\nimport { SchemeColor } from \"./scheme-color\";\nimport type { SolidFillOptions } from \"./solid-fill\";\nimport type { SystemColorOptions } from \"./system-color\";\nimport { SystemColor } from \"./system-color\";\n\n// ── Color transform helpers ──\n\n// The parse whitelist is the union of the three unit classes — the Sets in\n// color-transform.ts are the single source of truth for the full key space.\nconst TRANSFORM_KEYS: readonly (keyof ColorTransformOptions & string)[] = [\n ...PERCENT_TRANSFORMS,\n ...ANGLE_TRANSFORMS,\n ...BOOLEAN_TRANSFORMS,\n];\n\n// Transform key classification (percent vs angle) lives in color-transform.ts\n// so stringify and parse share one source of truth.\n\n// Parse an ST_Percentage channel that may arrive as either a 1/1000th integer\n// (\"50000\" = 50%) or a percent literal (\"50%\"); both are XSD-valid. Returns\n// the caller-facing integer percent.\nfunction parsePercentChannel(raw: string | number | undefined): number {\n if (raw === undefined) return 0;\n const s = typeof raw === \"number\" ? String(raw) : raw;\n if (s.endsWith(\"%\")) return Number(s.slice(0, -1));\n return Number(s) / 1000;\n}\n\nfunction stringifyTransforms(opts: ColorTransformOptions): string {\n // Delegates to createColorTransforms so both paths emit in the caller's key\n // order (XSD transforms compose left to right — order is fidelity).\n return createColorTransforms(opts).join(\"\");\n}\n\nfunction readTransforms(el: XmlElement): ColorTransformOptions | undefined {\n if (!el.elements || el.elements.length === 0) return undefined;\n const result: ColorTransformOptions = {};\n for (const child of el.elements) {\n if (!child.name || !child.name.startsWith(\"a:\")) continue;\n const key = child.name.slice(2) as keyof ColorTransformOptions & string;\n if (!TRANSFORM_KEYS.includes(key)) continue;\n const val = child.attributes?.[\"val\"];\n if (val !== undefined) {\n const raw = Number(val);\n // Percent → integer percent (÷1000); angle → degrees (÷60000); else raw.\n (result as Record<string, unknown>)[key] = PERCENT_TRANSFORMS.has(key)\n ? parsePercent(raw)\n : ANGLE_TRANSFORMS.has(key)\n ? parseAngle(raw)\n : raw;\n } else {\n (result as Record<string, unknown>)[key] = true;\n }\n }\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n// ── RgbColor descriptor ──\n\nexport const rgbColorDesc: CustomDescriptor<RgbColorOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const transforms = opts.transforms ? stringifyTransforms(opts.transforms) : \"\";\n if (transforms) {\n return `<a:srgbClr val=\"${escapeXml(opts.value)}\">${transforms}</a:srgbClr>`;\n }\n return `<a:srgbClr val=\"${escapeXml(opts.value)}\"/>`;\n },\n parse(el, _ctx) {\n const result: RgbColorOptions = { value: String(el.attributes?.[\"val\"] ?? \"\") };\n const transforms = readTransforms(el);\n if (transforms) result.transforms = transforms;\n return result;\n },\n};\n\n// ── SchemeColor descriptor ──\n\nexport const schemeColorDesc: CustomDescriptor<SchemeColorOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const transforms = opts.transforms ? stringifyTransforms(opts.transforms) : \"\";\n if (transforms) {\n return `<a:schemeClr val=\"${escapeXml(opts.value)}\">${transforms}</a:schemeClr>`;\n }\n return `<a:schemeClr val=\"${escapeXml(opts.value)}\"/>`;\n },\n parse(el, _ctx) {\n const result: SchemeColorOptions = {\n value: String(el.attributes?.[\"val\"] ?? \"\") as SchemeColorOptions[\"value\"],\n };\n const transforms = readTransforms(el);\n if (transforms) result.transforms = transforms;\n return result;\n },\n};\n\n// ── HslColor descriptor ──\n\nexport const hslColorDesc: CustomDescriptor<HslColorOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const transforms = opts.transforms ? stringifyTransforms(opts.transforms) : \"\";\n const sat = emitPercent(opts.saturation);\n const lum = emitPercent(opts.luminance);\n const hue = emitAngle(opts.hue);\n if (transforms) {\n return `<a:hslClr hue=\"${hue}\" sat=\"${sat}\" lum=\"${lum}\">${transforms}</a:hslClr>`;\n }\n return `<a:hslClr hue=\"${hue}\" sat=\"${sat}\" lum=\"${lum}\"/>`;\n },\n parse(el, _ctx) {\n const result: HslColorOptions = {\n hue: parseAngle(Number(el.attributes?.[\"hue\"] ?? 0)),\n saturation: parsePercent(Number(el.attributes?.[\"sat\"] ?? 0)),\n luminance: parsePercent(Number(el.attributes?.[\"lum\"] ?? 0)),\n };\n const transforms = readTransforms(el);\n if (transforms) result.transforms = transforms;\n return result;\n },\n};\n\n// ── SystemColor descriptor ──\n\nexport const systemColorDesc: CustomDescriptor<SystemColorOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const transforms = opts.transforms ? stringifyTransforms(opts.transforms) : \"\";\n const attrParts: string[] = [`val=\"${escapeXml(opts.value)}\"`];\n if (opts.lastClr) attrParts.push(`lastClr=\"${escapeXml(opts.lastClr)}\"`);\n const attrStr = attrParts.join(\" \");\n if (transforms) {\n return `<a:sysClr ${attrStr}>${transforms}</a:sysClr>`;\n }\n return `<a:sysClr ${attrStr}/>`;\n },\n parse(el, _ctx) {\n const result: SystemColorOptions = {\n value: String(el.attributes?.[\"val\"] ?? \"\") as SystemColorOptions[\"value\"],\n };\n const lastClr = el.attributes?.[\"lastClr\"];\n if (lastClr) result.lastClr = String(lastClr);\n const transforms = readTransforms(el);\n if (transforms) result.transforms = transforms;\n return result;\n },\n};\n\n// ── PresetColor descriptor ──\n\nexport const presetColorDesc: CustomDescriptor<PresetColorOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const transforms = opts.transforms ? stringifyTransforms(opts.transforms) : \"\";\n if (transforms) {\n return `<a:prstClr val=\"${escapeXml(opts.value)}\">${transforms}</a:prstClr>`;\n }\n return `<a:prstClr val=\"${escapeXml(opts.value)}\"/>`;\n },\n parse(el, _ctx) {\n const result: PresetColorOptions = {\n value: String(el.attributes?.[\"val\"] ?? \"\") as PresetColorOptions[\"value\"],\n };\n const transforms = readTransforms(el);\n if (transforms) result.transforms = transforms;\n return result;\n },\n};\n\n// ── ScRgbColor descriptor ──\n\nexport const scRgbColorDesc: CustomDescriptor<ScRgbColorOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const transforms = opts.transforms ? stringifyTransforms(opts.transforms) : \"\";\n const r = emitPercent(opts.r);\n const g = emitPercent(opts.g);\n const b = emitPercent(opts.b);\n if (transforms) {\n return `<a:scrgbClr r=\"${r}\" g=\"${g}\" b=\"${b}\">${transforms}</a:scrgbClr>`;\n }\n return `<a:scrgbClr r=\"${r}\" g=\"${g}\" b=\"${b}\"/>`;\n },\n parse(el, _ctx) {\n const result: ScRgbColorOptions = {\n r: parsePercentChannel(el.attributes?.[\"r\"]),\n g: parsePercentChannel(el.attributes?.[\"g\"]),\n b: parsePercentChannel(el.attributes?.[\"b\"]),\n };\n const transforms = readTransforms(el);\n if (transforms) result.transforms = transforms;\n return result;\n },\n};\n\n// ── Color discrimination (SolidFillOptions) ──\n\nconst SYSTEM_COLOR_VALUES: ReadonlySet<string> = new Set(Object.values(SystemColor));\nconst PRESET_COLOR_VALUES: ReadonlySet<string> = new Set(Object.values(PresetColor));\nconst SCHEME_COLOR_VALUES: ReadonlySet<string> = new Set(Object.values(SchemeColor));\n\n/** Stringify an EG_ColorChoice (direct color element, no `a:solidFill` wrapper).\n * Used for gradient stops, fg/bg clr, and effect colors. Replaces the former\n * `getColorDescriptor` which returned a polymorphic `CustomDescriptor<any>`. */\nexport function stringifyColorChoice(color: SolidFillOptions, ctx: WriteContext): string {\n if (\"hue\" in color) return stringify(hslColorDesc, color, ctx) ?? \"\";\n if (\"r\" in color) return stringify(scRgbColorDesc, color, ctx) ?? \"\";\n // Remaining variants (rgb/scheme/system/preset) share a `value` key.\n const colorValue = (color as { value: string }).value;\n if (SYSTEM_COLOR_VALUES.has(colorValue))\n return stringify(systemColorDesc, color as SystemColorOptions, ctx) ?? \"\";\n if (PRESET_COLOR_VALUES.has(colorValue))\n return stringify(presetColorDesc, color as PresetColorOptions, ctx) ?? \"\";\n if (SCHEME_COLOR_VALUES.has(colorValue))\n return stringify(schemeColorDesc, color as SchemeColorOptions, ctx) ?? \"\";\n return stringify(rgbColorDesc, color as RgbColorOptions, ctx) ?? \"\";\n}\n\n/**\n * Parse a single EG_ColorChoice element (a:srgbClr, a:schemeClr, …) into\n * options; returns undefined for any other element.\n */\nexport function parseColorChoiceElement(\n el: XmlElement,\n ctx: ReadContext,\n): SolidFillOptions | undefined {\n switch (el.name) {\n case \"a:srgbClr\":\n return rgbColorDesc.parse(el, ctx);\n case \"a:schemeClr\":\n return schemeColorDesc.parse(el, ctx);\n case \"a:hslClr\":\n return hslColorDesc.parse(el, ctx);\n case \"a:sysClr\":\n return systemColorDesc.parse(el, ctx);\n case \"a:prstClr\":\n return presetColorDesc.parse(el, ctx);\n case \"a:scrgbClr\":\n return scRgbColorDesc.parse(el, ctx);\n default:\n return undefined;\n }\n}\n\n/**\n * Parse an EG_ColorChoice from an element's direct children. Handles all six\n * color element kinds (srgbClr/schemeClr/hslClr/sysClr/prstClr/scrgbClr) —\n * used both by {@link solidFillDesc} (under a:solidFill) and by fill\n * descriptors reading direct colors under a:gs / a:fgClr / a:bgClr.\n */\nexport function parseColorChoice(el: XmlElement, ctx: ReadContext): SolidFillOptions {\n if (!el.elements) return {} as SolidFillOptions;\n for (const child of el.elements) {\n const color = parseColorChoiceElement(child, ctx);\n if (color) return color;\n }\n return {} as SolidFillOptions;\n}\n\n// ── SolidFill descriptor ──\n\nexport const solidFillDesc: CustomDescriptor<SolidFillOptions> = {\n kind: \"custom\",\n stringify(color, ctx) {\n const inner = stringifyColorChoice(color, ctx);\n if (!inner) return undefined;\n return `<a:solidFill>${inner}</a:solidFill>`;\n },\n parse(el, _ctx) {\n return parseColorChoice(el, _ctx);\n },\n};\n","/**\n * HSL color element for DrawingML.\n *\n * This module provides HSL (Hue, Saturation, Luminance) color support.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_HslColor\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport type { ColorTransformOptions } from \"./color-transform\";\nimport { createColorTransforms } from \"./color-transform\";\n\n/**\n * Options for HSL color.\n */\nexport interface HslColorOptions {\n /** Hue angle in degrees (0-360). */\n hue: number;\n /** Saturation as integer percent (0-100) */\n saturation: number;\n /** Luminance as integer percent (0-100) */\n luminance: number;\n /** Optional color transforms */\n transforms?: ColorTransformOptions;\n}\n\n/**\n * Creates an HSL color element as an XML string.\n *\n * Specifies a color using Hue, Saturation, and Luminance values.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_HslColor\">\n * <xsd:sequence>\n * <xsd:group ref=\"EG_ColorTransform\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"hue\" type=\"ST_PositiveFixedAngle\" use=\"required\"/>\n * <xsd:attribute name=\"sat\" type=\"ST_Percentage\" use=\"required\"/>\n * <xsd:attribute name=\"lum\" type=\"ST_Percentage\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createHslColor = (options: HslColorOptions): string => {\n const transforms = options.transforms ? createColorTransforms(options.transforms) : [];\n return element(\n \"a:hslClr\",\n {\n hue: Math.round(options.hue * 60000),\n sat: Math.round(options.saturation * 1000),\n lum: Math.round(options.luminance * 1000),\n },\n transforms,\n );\n};\n","/**\n * RGB color element for DrawingML shapes.\n *\n * This module provides RGB color support for solid fills.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SRgbColor\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport type { ColorTransformOptions } from \"./color-transform\";\nimport { createColorTransforms } from \"./color-transform\";\n\n/**\n * Options for RGB color.\n */\nexport interface RgbColorOptions {\n /** Hex color value (e.g., \"FF0000\" for red) */\n value: string;\n /** Optional color transforms */\n transforms?: ColorTransformOptions;\n}\n\n/**\n * Creates an sRGB color element as an XML string.\n *\n * Specifies a color using RGB hex values.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_SRgbColor\">\n * <xsd:sequence>\n * <xsd:group ref=\"EG_ColorTransform\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"val\" type=\"s:ST_HexColorRGB\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * const redColor = createRgbColor({ value: \"FF0000\" });\n * // With alpha transform\n * const semiRed = createRgbColor({ value: \"FF0000\", transforms: { alpha: 50 } });\n * ```\n */\nexport const createRgbColor = (options: RgbColorOptions): string => {\n const transforms = options.transforms ? createColorTransforms(options.transforms) : [];\n return element(\"a:srgbClr\", { val: options.value }, transforms);\n};\n","/**\n * ScRGB color element for DrawingML shapes.\n *\n * This module provides scRGB color support using percentage-based RGB values.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_ScRgbColor\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport type { ColorTransformOptions } from \"./color-transform\";\nimport { createColorTransforms } from \"./color-transform\";\n\n/**\n * Options for scRGB color.\n */\nexport interface ScRgbColorOptions {\n /** Red as integer percent (0-100) */\n r: number;\n /** Green as integer percent (0-100) */\n g: number;\n /** Blue as integer percent (0-100) */\n b: number;\n /** Optional color transforms */\n transforms?: ColorTransformOptions;\n}\n\n/**\n * Creates an scRGB color element as an XML string.\n *\n * Specifies a color using percentage-based RGB values.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_ScRgbColor\">\n * <xsd:sequence>\n * <xsd:group ref=\"EG_ColorTransform\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"r\" type=\"ST_Percentage\" use=\"required\"/>\n * <xsd:attribute name=\"g\" type=\"ST_Percentage\" use=\"required\"/>\n * <xsd:attribute name=\"b\" type=\"ST_Percentage\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * const redColor = createScRgbColor({ r: 100, g: 0, b: 0 });\n * // With alpha transform\n * const semiRed = createScRgbColor({ r: 100, g: 0, b: 0, transforms: { alpha: 50 } });\n * ```\n */\nexport const createScRgbColor = (options: ScRgbColorOptions): string => {\n const transforms = options.transforms ? createColorTransforms(options.transforms) : [];\n return element(\n \"a:scrgbClr\",\n {\n r: Math.round(options.r * 1000),\n g: Math.round(options.g * 1000),\n b: Math.round(options.b * 1000),\n },\n transforms,\n );\n};\n","/**\n * Solid fill element for DrawingML shapes.\n *\n * This module provides solid fill support for outlines and shapes,\n * supporting RGB, scheme, HSL, system, and preset colors.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SolidColorFillProperties\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { createHslColor } from \"./hsl-color\";\nimport type { HslColorOptions } from \"./hsl-color\";\nimport { createPresetColor, PresetColor } from \"./preset-color\";\nimport type { PresetColorOptions } from \"./preset-color\";\nimport { createRgbColor } from \"./rgb-color\";\nimport type { RgbColorOptions } from \"./rgb-color\";\nimport { createScRgbColor } from \"./sc-rgb-color\";\nimport type { ScRgbColorOptions } from \"./sc-rgb-color\";\nimport { createSchemeColor, SchemeColor } from \"./scheme-color\";\nimport type { SchemeColorOptions } from \"./scheme-color\";\nimport { createSystemColor, SystemColor } from \"./system-color\";\nimport type { SystemColorOptions } from \"./system-color\";\n\n/**\n * Union type for all color options supported by solid fill.\n *\n * Extends the original pattern with additional color types:\n * RGB, scheme, HSL, system, and preset colors.\n */\nexport type SolidFillOptions =\n | ScRgbColorOptions\n | RgbColorOptions\n | SchemeColorOptions\n | HslColorOptions\n | SystemColorOptions\n | PresetColorOptions;\n\n/**\n * Creates the color child element for a solid fill based on the color type.\n */\nconst SYSTEM_COLOR_VALUES: ReadonlySet<string> = new Set(Object.values(SystemColor));\nconst PRESET_COLOR_VALUES: ReadonlySet<string> = new Set(Object.values(PresetColor));\nconst SCHEME_COLOR_VALUES: ReadonlySet<string> = new Set(Object.values(SchemeColor));\n\nexport const createColorElement = (color: SolidFillOptions): string => {\n if (\"hue\" in color && \"saturation\" in color && \"luminance\" in color) {\n return createHslColor(color);\n }\n if (\"r\" in color && \"g\" in color && \"b\" in color) {\n return createScRgbColor(color);\n }\n // At this point, color is guaranteed to have a string value property\n const colorValue = (color as { readonly value: string }).value;\n if (SYSTEM_COLOR_VALUES.has(colorValue)) {\n return createSystemColor(color as SystemColorOptions);\n }\n if (PRESET_COLOR_VALUES.has(colorValue)) {\n return createPresetColor(color as PresetColorOptions);\n }\n if (SCHEME_COLOR_VALUES.has(colorValue)) {\n return createSchemeColor(color as SchemeColorOptions);\n }\n return createRgbColor(color as RgbColorOptions);\n};\n\n/**\n * Creates a solid fill element as an XML string.\n *\n * Specifies a solid color fill using any supported color type.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_SolidColorFillProperties\">\n * <xsd:sequence>\n * <xsd:group ref=\"EG_ColorChoice\" minOccurs=\"0\"/>\n * <xsd:group ref=\"EG_EffectProperties\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * // RGB solid fill\n * const fill = createSolidFill({ value: \"FF0000\" });\n * // Scheme solid fill with tint\n * const schemeFill = createSolidFill({\n * value: SchemeColor.ACCENT1, transforms: { tint: 40 },\n * });\n * // HSL solid fill\n * const hslFill = createSolidFill({ hue: 120, saturation: 100, luminance: 50 });\n * ```\n */\nexport const createSolidFill = (options: SolidFillOptions): string =>\n element(\"a:solidFill\", undefined, [createColorElement(options)]);\n","/**\n * Diagram style, color list, and style label elements.\n *\n * Reference: ISO/IEC 29500-4, dml-diagram.xsd\n * CT_Style, CT_StyleLabel, CT_Colors, CT_CTStyleLabel\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\n\nimport { parseColorChoiceElement } from \"../color/color-descriptors\";\nimport { SchemeColor } from \"../color/scheme-color\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\nimport { createColorElement } from \"../color/solid-fill\";\n\n// ---------------------------------------------------------------------------\n// dgm:style — diagram style (CT_ShapeStyle from dml-main.xsd)\n// ---------------------------------------------------------------------------\n\nexport type StyleMatrixIndex = \"subtle\" | \"moderate\" | \"intense\";\n\nexport const FontCollectionIndex = {\n MAJOR: \"major\",\n MINOR: \"minor\",\n NONE: \"none\",\n} as const;\n\n/** Reference into the theme style matrix (a:lnRef/fillRef/effectRef). */\nexport interface DiagramStyleReferenceOptions {\n /** Index into the theme style matrix (a:*Ref @idx) */\n idx: number;\n}\n\n/** Font reference (a:fontRef) — idx is a FontCollectionIndex (major/minor/none). */\nexport interface DiagramFontReferenceOptions {\n /** Font collection index (FontCollectionIndex.MAJOR/MINOR/NONE) */\n idx: string;\n}\n\nexport interface DiagramStyleOptions {\n /** Line reference (a:lnRef) */\n lineReference?: DiagramStyleReferenceOptions;\n /** Fill reference (a:fillRef) */\n fillReference?: DiagramStyleReferenceOptions;\n /** Effect reference (a:effectRef) */\n effectReference?: DiagramStyleReferenceOptions;\n /** Font reference (a:fontRef) */\n fontReference?: DiagramFontReferenceOptions;\n}\n\n/**\n * Creates a dgm:style element (a:CT_ShapeStyle).\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_ShapeStyle\">\n * <xsd:sequence>\n * <xsd:element name=\"lnRef\" type=\"CT_StyleMatrixReference\"/>\n * <xsd:element name=\"fillRef\" type=\"CT_StyleMatrixReference\"/>\n * <xsd:element name=\"effectRef\" type=\"CT_StyleMatrixReference\"/>\n * <xsd:element name=\"fontRef\" type=\"CT_FontReference\"/>\n * </xsd:sequence>\n * </xsd:complexType>\n * ```\n */\nexport const createDiagramStyle = (options?: DiagramStyleOptions): string => {\n const children: string[] = [];\n\n children.push(\n element(\"a:lnRef\", { idx: options?.lineReference?.idx ?? 1 }, [\n createColorElement({ value: SchemeColor.ACCENT1 }),\n ]),\n );\n children.push(\n element(\"a:fillRef\", { idx: options?.fillReference?.idx ?? 1 }, [\n createColorElement({ value: SchemeColor.ACCENT1 }),\n ]),\n );\n children.push(\n element(\"a:effectRef\", { idx: options?.effectReference?.idx ?? 0 }, [\n createColorElement({ value: SchemeColor.ACCENT1 }),\n ]),\n );\n children.push(\n element(\"a:fontRef\", { idx: options?.fontReference?.idx ?? \"minor\" }, [\n createColorElement({ value: SchemeColor.TX1 }),\n ]),\n );\n\n return element(\"dgm:style\", undefined, children);\n};\n\n// ---------------------------------------------------------------------------\n// Color list elements (CT_Colors) — used for fillClrLst, linClrLst, etc.\n// ---------------------------------------------------------------------------\n\nexport type ColorMethod = \"span\" | \"cycle\" | \"repeat\";\n\nexport type HueDirection = \"cw\" | \"ccw\";\n\nexport interface ColorListOptions {\n /** Color method (default: span) */\n meth?: ColorMethod;\n /** Hue direction (default: cw) */\n hueDir?: HueDirection;\n /** Colors (EG_ColorChoice items) */\n colors?: readonly SolidFillOptions[];\n}\n\n/** Creates a generic CT_Colors element with the given tag. */\nexport const createColorList = (tag: string, options?: ColorListOptions): string => {\n const children: string[] = [];\n if (options?.colors) {\n for (const c of options.colors) {\n children.push(createColorElement(c));\n }\n }\n\n const hasAttrs = options?.meth !== undefined || options?.hueDir !== undefined;\n const attrs: Record<string, string> = {};\n if (options?.meth) attrs.meth = options.meth;\n if (options?.hueDir) attrs.hueDir = options.hueDir;\n\n return element(tag, hasAttrs ? attrs : undefined, children.length > 0 ? children : undefined);\n};\n\n/**\n * Parses a CT_Colors element (fillClrLst/linClrLst/…) back into options.\n * Colors parse in document order.\n */\nexport const parseColorList = (el: Element): ColorListOptions => {\n const result: ColorListOptions = {};\n if (el.attributes?.meth !== undefined) result.meth = el.attributes.meth as ColorMethod;\n if (el.attributes?.hueDir !== undefined) result.hueDir = el.attributes.hueDir as HueDirection;\n const colors: SolidFillOptions[] = [];\n for (const child of el.elements ?? []) {\n const color = parseColorChoiceElement(child, NOOP_READ_CTX);\n if (color) colors.push(color);\n }\n if (colors.length) result.colors = colors;\n return result;\n};\n\n// Noop context: color elements never resolve relationships or parts.\nconst NOOP_READ_CTX = {\n resolveRelationship: () => undefined,\n getPart: () => undefined,\n getRaw: () => undefined,\n};\n\n// ---------------------------------------------------------------------------\n// dgm:fillClrLst / dgm:linClrLst / dgm:effectClrLst (used in CT_CTStyleLabel)\n// ---------------------------------------------------------------------------\n\nexport const createFillColorList = (options?: ColorListOptions): string =>\n createColorList(\"dgm:fillClrLst\", options);\nexport const createLineColorList = (options?: ColorListOptions): string =>\n createColorList(\"dgm:linClrLst\", options);\nexport const createEffectColorList = (options?: ColorListOptions): string =>\n createColorList(\"dgm:effectClrLst\", options);\n\n// ---------------------------------------------------------------------------\n// dgm:txFillClrLst / dgm:txLinClrLst / dgm:txEffectClrLst (text color lists)\n// ---------------------------------------------------------------------------\n\nexport const createTextFillColorList = (options?: ColorListOptions): string =>\n createColorList(\"dgm:txFillClrLst\", options);\n\nexport const createTextLineColorList = (options?: ColorListOptions): string =>\n createColorList(\"dgm:txLinClrLst\", options);\n\nexport const createTextEffectColorList = (options?: ColorListOptions): string =>\n createColorList(\"dgm:txEffectClrLst\", options);\n\n// ---------------------------------------------------------------------------\n// dgm:styleLbl — color-transform style label (CT_CTStyleLabel)\n// ---------------------------------------------------------------------------\n\nexport interface ColorStyleLabelOptions {\n /** Label name referenced by dgm:layoutNode @styleLbl (required) */\n name: string;\n fillColorList?: ColorListOptions;\n lineColorList?: ColorListOptions;\n effectColorList?: ColorListOptions;\n textFillColorList?: ColorListOptions;\n textLineColorList?: ColorListOptions;\n textEffectColorList?: ColorListOptions;\n}\n\n/**\n * Creates a dgm:styleLbl element (CT_StyleLabel or CT_CTStyleLabel).\n *\n * ## XSD Schema (CT_CTStyleLabel, for color transforms)\n * ```xml\n * <xsd:complexType name=\"CT_CTStyleLabel\">\n * <xsd:sequence>\n * <xsd:element name=\"fillClrLst\" type=\"CT_Colors\" minOccurs=\"0\"/>\n * <xsd:element name=\"linClrLst\" type=\"CT_Colors\" minOccurs=\"0\"/>\n * <xsd:element name=\"effectClrLst\" type=\"CT_Colors\" minOccurs=\"0\"/>\n * <xsd:element name=\"txLinClrLst\" type=\"CT_Colors\" minOccurs=\"0\"/>\n * <xsd:element name=\"txFillClrLst\" type=\"CT_Colors\" minOccurs=\"0\"/>\n * <xsd:element name=\"txEffectClrLst\" type=\"CT_Colors\" minOccurs=\"0\"/>\n * <xsd:element name=\"extLst\" type=\"a:CT_OfficeArtExtensionList\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n *\n * ## XSD Schema (CT_StyleLabel, for quick styles)\n * ```xml\n * <xsd:complexType name=\"CT_StyleLabel\">\n * <xsd:sequence>\n * <xsd:element name=\"scene3d\" type=\"a:CT_Scene3D\" minOccurs=\"0\"/>\n * <xsd:element name=\"sp3d\" type=\"a:CT_Shape3D\" minOccurs=\"0\"/>\n * <xsd:element name=\"txPr\" type=\"CT_TextProps\" minOccurs=\"0\"/>\n * <xsd:element name=\"style\" type=\"a:CT_ShapeStyle\" minOccurs=\"0\"/>\n * <xsd:element name=\"extLst\" type=\"a:CT_OfficeArtExtensionList\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createStyleLabel = (options: ColorStyleLabelOptions): string => {\n const children: string[] = [];\n if (options.fillColorList) children.push(createFillColorList(options.fillColorList));\n if (options.lineColorList) children.push(createLineColorList(options.lineColorList));\n if (options.effectColorList) children.push(createEffectColorList(options.effectColorList));\n if (options.textFillColorList) children.push(createTextFillColorList(options.textFillColorList));\n if (options.textLineColorList) children.push(createTextLineColorList(options.textLineColorList));\n if (options.textEffectColorList)\n children.push(createTextEffectColorList(options.textEffectColorList));\n\n return element(\"dgm:styleLbl\", { name: options.name }, children);\n};\n","/**\n * 3D descriptor for DrawingML shapes.\n *\n * @module\n */\n\nimport { escapeXml } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\nimport { findChild } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../../descriptor\";\nimport { stringify, parse } from \"../../descriptor\";\nimport { emitAngle, parseAngle } from \"../../util/converters\";\nimport { xsdMaterialType } from \"../../util/mappings\";\nimport { parseColorChoice, stringifyColorChoice } from \"../color/color-descriptors\";\nimport type { BevelOptions } from \"./bevel\";\nimport type {\n Scene3DOptions,\n CameraOptions,\n LightRigOptions,\n SphereCoords,\n BackdropOptions,\n Point3D,\n Vector3D,\n} from \"./scene-3d\";\nimport type { Shape3DOptions } from \"./shape-3d\";\nimport type { PresetMaterial } from \"./shape-3d\";\n\n// ── SphereCoords helper ──\n\nfunction stringifySphereCoords(coords: SphereCoords): string {\n const lat = emitAngle(coords.lat);\n const lon = emitAngle(coords.lon);\n const rev = emitAngle(coords.rev);\n return `<a:rot lat=\"${lat}\" lon=\"${lon}\" rev=\"${rev}\"/>`;\n}\n\nfunction readSphereCoords(el: XmlElement): SphereCoords | undefined {\n const lat = el.attributes?.[\"lat\"];\n const lon = el.attributes?.[\"lon\"];\n const rev = el.attributes?.[\"rev\"];\n if (lat === undefined || lon === undefined || rev === undefined) return undefined;\n return {\n lat: parseAngle(Number(lat)),\n lon: parseAngle(Number(lon)),\n rev: parseAngle(Number(rev)),\n };\n}\n\n// ── Bevel descriptor (a:bevelT / a:bevelB) ──\n\nexport const bevelDesc: CustomDescriptor<BevelOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const attrParts: string[] = [];\n if (opts.w !== undefined) attrParts.push(`w=\"${opts.w}\"`);\n if (opts.h !== undefined) attrParts.push(`h=\"${opts.h}\"`);\n if (opts.prst !== undefined) attrParts.push(`prst=\"${escapeXml(opts.prst)}\"`);\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n return `<a:bevel${attrStr}/>`;\n },\n parse(el, _ctx) {\n const result: BevelOptions = {};\n if (el.attributes?.[\"w\"] !== undefined) result.w = Number(el.attributes[\"w\"]);\n if (el.attributes?.[\"h\"] !== undefined) result.h = Number(el.attributes[\"h\"]);\n if (el.attributes?.[\"prst\"] !== undefined)\n result.prst = String(el.attributes[\"prst\"]) as BevelOptions[\"prst\"];\n return result;\n },\n};\n\n// ── Shape3D descriptor (a:sp3d) ──\n\nexport const shape3DDesc: CustomDescriptor<Shape3DOptions> = {\n kind: \"custom\",\n stringify(opts, ctx) {\n const parts: string[] = [];\n\n // Children\n if (opts.bevelT) {\n const bevelXml = stringify(bevelDesc, opts.bevelT, ctx);\n if (bevelXml) parts.push(bevelXml.replace(\"<a:bevel\", \"<a:bevelT\"));\n }\n if (opts.bevelB) {\n const bevelXml = stringify(bevelDesc, opts.bevelB, ctx);\n if (bevelXml) parts.push(bevelXml.replace(\"<a:bevel\", \"<a:bevelB\"));\n }\n if (opts.extrusionColor) {\n const colorXml = stringifyColorChoice(opts.extrusionColor, ctx);\n if (colorXml) parts.push(`<a:extrusionClr>${colorXml}</a:extrusionClr>`);\n }\n if (opts.contourColor) {\n const colorXml = stringifyColorChoice(opts.contourColor, ctx);\n if (colorXml) parts.push(`<a:contourClr>${colorXml}</a:contourClr>`);\n }\n\n // Attributes\n const attrParts: string[] = [];\n if (opts.z !== undefined) attrParts.push(`z=\"${opts.z}\"`);\n if (opts.extrusionH !== undefined) attrParts.push(`extrusionH=\"${opts.extrusionH}\"`);\n if (opts.contourW !== undefined) attrParts.push(`contourW=\"${opts.contourW}\"`);\n if (opts.prstMaterial !== undefined) {\n attrParts.push(`prstMaterial=\"${escapeXml(xsdMaterialType.to(opts.prstMaterial))}\"`);\n }\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n\n const content = parts.join(\"\");\n if (!attrStr && !content) return undefined;\n if (!content) return `<a:sp3d${attrStr}/>`;\n return `<a:sp3d${attrStr}>${content}</a:sp3d>`;\n },\n parse(el, ctx) {\n const result: Shape3DOptions = {};\n\n // Attributes\n if (el.attributes?.[\"z\"] !== undefined) result.z = Number(el.attributes[\"z\"]);\n if (el.attributes?.[\"extrusionH\"] !== undefined)\n result.extrusionH = Number(el.attributes[\"extrusionH\"]);\n if (el.attributes?.[\"contourW\"] !== undefined)\n result.contourW = Number(el.attributes[\"contourW\"]);\n if (el.attributes?.[\"prstMaterial\"] !== undefined) {\n result.prstMaterial = xsdMaterialType.from(\n String(el.attributes[\"prstMaterial\"]),\n ) as Shape3DOptions[\"prstMaterial\"];\n }\n\n // Children\n const bevelT = findChild(el, \"a:bevelT\");\n if (bevelT) result.bevelT = parse(bevelDesc, bevelT, ctx);\n\n const bevelB = findChild(el, \"a:bevelB\");\n if (bevelB) result.bevelB = parse(bevelDesc, bevelB, ctx);\n\n const extrusionClr = findChild(el, \"a:extrusionClr\");\n if (extrusionClr) {\n const color = parseColorChoice(extrusionClr, ctx);\n if (color && Object.keys(color).length) result.extrusionColor = color;\n }\n\n const contourClr = findChild(el, \"a:contourClr\");\n if (contourClr) {\n const color = parseColorChoice(contourClr, ctx);\n if (color && Object.keys(color).length) result.contourColor = color;\n }\n\n return result;\n },\n};\n\n// ── Camera descriptor ──\n\nconst cameraDesc: CustomDescriptor<CameraOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const attrParts: string[] = [];\n attrParts.push(`prst=\"${escapeXml(opts.preset)}\"`);\n if (opts.fov !== undefined) attrParts.push(`fov=\"${emitAngle(opts.fov)}\"`);\n if (opts.zoom !== undefined) attrParts.push(`zoom=\"${escapeXml(opts.zoom)}\"`);\n const attrStr = \" \" + attrParts.join(\" \");\n\n const parts: string[] = [];\n if (opts.rotation) parts.push(stringifySphereCoords(opts.rotation));\n\n const content = parts.join(\"\");\n if (!content) return `<a:camera${attrStr}/>`;\n return `<a:camera${attrStr}>${content}</a:camera>`;\n },\n parse(el, _ctx) {\n const result: Partial<CameraOptions> = {};\n if (el.attributes?.[\"prst\"] !== undefined) result.preset = String(el.attributes[\"prst\"]);\n if (el.attributes?.[\"fov\"] !== undefined) result.fov = parseAngle(Number(el.attributes[\"fov\"]));\n if (el.attributes?.[\"zoom\"] !== undefined) result.zoom = String(el.attributes[\"zoom\"]);\n const rot = findChild(el, \"a:rot\");\n if (rot) result.rotation = readSphereCoords(rot);\n return result as CameraOptions;\n },\n};\n\n// ── LightRig descriptor ──\n\nconst lightRigDesc: CustomDescriptor<LightRigOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const attrParts: string[] = [];\n attrParts.push(`rig=\"${escapeXml(opts.rig)}\"`);\n attrParts.push(`dir=\"${escapeXml(opts.direction)}\"`);\n const attrStr = \" \" + attrParts.join(\" \");\n\n const parts: string[] = [];\n if (opts.rotation) parts.push(stringifySphereCoords(opts.rotation));\n\n const content = parts.join(\"\");\n if (!content) return `<a:lightRig${attrStr}/>`;\n return `<a:lightRig${attrStr}>${content}</a:lightRig>`;\n },\n parse(el, _ctx) {\n const result: Partial<LightRigOptions> = {};\n if (el.attributes?.[\"rig\"] !== undefined) result.rig = String(el.attributes[\"rig\"]);\n if (el.attributes?.[\"dir\"] !== undefined) result.direction = String(el.attributes[\"dir\"]);\n const rot = findChild(el, \"a:rot\");\n if (rot) result.rotation = readSphereCoords(rot);\n return result as LightRigOptions;\n },\n};\n\n// ── Cell3D descriptor (a:cell3D — table cell bevel) ──\n\nexport interface Cell3DOptions {\n /** Cell bevel (required CT_Bevel) */\n bevel: BevelOptions;\n /** Light rig (CT_LightRig) */\n lightRig?: LightRigOptions;\n /** Preset material (@prstMaterial, default \"plastic\") */\n prstMaterial?: PresetMaterial;\n}\n\nexport const cell3DDesc: CustomDescriptor<Cell3DOptions> = {\n kind: \"custom\",\n stringify(opts, ctx) {\n const attrParts: string[] = [];\n if (opts.prstMaterial !== undefined) attrParts.push(`prstMaterial=\"${opts.prstMaterial}\"`);\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n\n const parts: string[] = [];\n const bevelXml = stringify(bevelDesc, opts.bevel, ctx);\n if (bevelXml) parts.push(bevelXml);\n if (opts.lightRig) {\n const lightRigXml = stringify(lightRigDesc, opts.lightRig, ctx);\n if (lightRigXml) parts.push(lightRigXml);\n }\n return `<a:cell3D${attrStr}>${parts.join(\"\")}</a:cell3D>`;\n },\n parse(el, ctx) {\n const result: Partial<Cell3DOptions> = {};\n if (el.attributes?.[\"prstMaterial\"] !== undefined) {\n result.prstMaterial = String(el.attributes[\"prstMaterial\"]) as PresetMaterial;\n }\n const bevel = findChild(el, \"a:bevel\");\n if (bevel) result.bevel = parse(bevelDesc, bevel, ctx);\n const lightRig = findChild(el, \"a:lightRig\");\n if (lightRig) result.lightRig = parse(lightRigDesc, lightRig, ctx);\n return result as Cell3DOptions;\n },\n};\n\n// ── Scene3D descriptor (a:scene3d) ──\n\nexport const scene3DDesc: CustomDescriptor<Scene3DOptions> = {\n kind: \"custom\",\n stringify(opts, ctx) {\n const parts: string[] = [];\n\n // Camera (required)\n const cameraXml = stringify(cameraDesc, opts.camera, ctx);\n if (cameraXml) parts.push(cameraXml);\n\n // Light rig (required)\n const lightRigXml = stringify(lightRigDesc, opts.lightRig, ctx);\n if (lightRigXml) parts.push(lightRigXml);\n\n // Backdrop (optional)\n if (opts.backdrop) {\n parts.push(stringifyBackdrop(opts.backdrop));\n }\n\n const content = parts.join(\"\");\n if (!content) return undefined;\n return `<a:scene3d>${content}</a:scene3d>`;\n },\n parse(el, ctx) {\n const result: Partial<Scene3DOptions> = {};\n\n const camera = findChild(el, \"a:camera\");\n if (camera) result.camera = parse(cameraDesc, camera, ctx);\n\n const lightRig = findChild(el, \"a:lightRig\");\n if (lightRig) result.lightRig = parse(lightRigDesc, lightRig, ctx);\n\n const backdrop = findChild(el, \"a:backdrop\");\n if (backdrop) result.backdrop = readBackdrop(backdrop);\n\n return result as Scene3DOptions;\n },\n};\n\n// ── Backdrop helpers ──\n\nfunction stringifyPoint3D(name: string, point: Point3D): string {\n return `<${name} x=\"${point.x}\" y=\"${point.y}\" z=\"${point.z}\"/>`;\n}\n\nfunction stringifyVector3D(name: string, vector: Vector3D): string {\n return `<${name} dx=\"${vector.dx}\" dy=\"${vector.dy}\" dz=\"${vector.dz}\"/>`;\n}\n\nfunction stringifyBackdrop(opts: BackdropOptions): string {\n const content =\n stringifyPoint3D(\"a:anchor\", opts.anchor) +\n stringifyVector3D(\"a:norm\", opts.normal) +\n stringifyVector3D(\"a:up\", opts.up);\n return `<a:backdrop>${content}</a:backdrop>`;\n}\n\nfunction readPoint3D(el: XmlElement): Point3D | undefined {\n const x = el.attributes?.[\"x\"];\n const y = el.attributes?.[\"y\"];\n const z = el.attributes?.[\"z\"];\n if (x === undefined || y === undefined || z === undefined) return undefined;\n return { x: Number(x), y: Number(y), z: Number(z) };\n}\n\nfunction readVector3D(el: XmlElement): Vector3D | undefined {\n const dx = el.attributes?.[\"dx\"];\n const dy = el.attributes?.[\"dy\"];\n const dz = el.attributes?.[\"dz\"];\n if (dx === undefined || dy === undefined || dz === undefined) return undefined;\n return { dx: Number(dx), dy: Number(dy), dz: Number(dz) };\n}\n\nfunction readBackdrop(el: XmlElement): BackdropOptions | undefined {\n const anchor = findChild(el, \"a:anchor\");\n const norm = findChild(el, \"a:norm\");\n const up = findChild(el, \"a:up\");\n if (!anchor || !norm || !up) return undefined;\n const anchorPt = readPoint3D(anchor);\n const normVec = readVector3D(norm);\n const upVec = readVector3D(up);\n if (!anchorPt || !normVec || !upVec) return undefined;\n return { anchor: anchorPt, normal: normVec, up: upVec };\n}\n","/**\n * Blip image adjustment effects for DrawingML.\n *\n * These effects are applied directly to the image data within the `<a:blip>` element,\n * corresponding to Word's \"Picture Format > Adjust\" features (brightness, contrast,\n * grayscale, tint, duotone, etc.).\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Blip children\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { createColorElement } from \"../color/solid-fill\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\n\n// ─── Effect option interfaces ────────────────────────────────────────\n\n/**\n * Options for luminance (brightness/contrast) effect.\n *\n * ## XSD: CT_LuminanceEffect\n * ```xml\n * <xsd:attribute name=\"bright\" type=\"ST_FixedPercentage\" default=\"0%\"/>\n * <xsd:attribute name=\"contrast\" type=\"ST_FixedPercentage\" default=\"0%\"/>\n * ```\n */\nexport interface LuminanceEffectOptions {\n /** Brightness adjustment in percentage points (-100 to 100). Default 0. */\n bright?: number;\n /** Contrast adjustment in percentage points (-100 to 100). Default 0. */\n contrast?: number;\n}\n\n/**\n * Options for HSL effect.\n *\n * ## XSD: CT_HSLEffect\n * ```xml\n * <xsd:attribute name=\"hue\" type=\"ST_PositiveFixedAngle\" default=\"0\"/>\n * <xsd:attribute name=\"sat\" type=\"ST_FixedPercentage\" default=\"0%\"/>\n * <xsd:attribute name=\"lum\" type=\"ST_FixedPercentage\" default=\"0%\"/>\n * ```\n */\nexport interface HSLEffectOptions {\n /** Hue rotation in degrees. Default 0. */\n hue?: number;\n /** Saturation adjustment in percentage points (-100 to 100). Default 0. */\n saturation?: number;\n /** Luminance adjustment in percentage points (-100 to 100). Default 0. */\n luminance?: number;\n}\n\n/**\n * Options for tint effect.\n *\n * ## XSD: CT_TintEffect\n * ```xml\n * <xsd:attribute name=\"hue\" type=\"ST_PositiveFixedAngle\" default=\"0\"/>\n * <xsd:attribute name=\"amt\" type=\"ST_FixedPercentage\" default=\"0%\"/>\n * ```\n */\nexport interface TintEffectOptions {\n /** Hue in degrees. Default 0. */\n hue?: number;\n /** Amount in percentage points (0 to 100). Default 0. */\n amount?: number;\n}\n\n/**\n * Options for duotone effect.\n *\n * ## XSD: CT_DuotoneEffect\n * ```xml\n * <xsd:group ref=\"EG_ColorChoice\" minOccurs=\"2\" maxOccurs=\"2\"/>\n * ```\n */\nexport interface DuotoneEffectOptions {\n /** First color (dark). */\n color1: SolidFillOptions;\n /** Second color (light). */\n color2: SolidFillOptions;\n}\n\n/**\n * Options for biLevel (black & white threshold) effect.\n *\n * ## XSD: CT_BiLevelEffect\n * ```xml\n * <xsd:attribute name=\"thresh\" type=\"ST_PositiveFixedPercentage\" use=\"required\"/>\n * ```\n */\nexport interface BiLevelEffectOptions {\n /** Threshold percentage (0 to 100). Pixels above are white, below are black. */\n threshold: number;\n}\n\n/**\n * Options for alpha replace effect.\n *\n * ## XSD: CT_AlphaReplaceEffect\n * ```xml\n * <xsd:attribute name=\"a\" type=\"ST_PositiveFixedPercentage\" use=\"required\"/>\n * ```\n */\nexport interface AlphaReplaceEffectOptions {\n /** Alpha percentage (0 = fully transparent, 100 = fully opaque). Maps to @a. */\n alpha: number;\n}\n\n/**\n * Options for alpha bi-level effect.\n *\n * ## XSD: CT_AlphaBiLevelEffect\n * ```xml\n * <xsd:attribute name=\"thresh\" type=\"ST_PositiveFixedPercentage\" use=\"required\"/>\n * ```\n */\nexport interface AlphaBiLevelEffectOptions {\n /** Threshold percentage (0 to 100). Alpha above is fully opaque, below is fully transparent. */\n threshold: number;\n}\n\n/**\n * Options for alpha modulate fixed effect.\n *\n * ## XSD: CT_AlphaModulateFixedEffect\n * ```xml\n * <xsd:attribute name=\"amt\" type=\"ST_PositivePercentage\" default=\"100%\"/>\n * ```\n */\nexport interface AlphaModulateFixedEffectOptions {\n /** Alpha amount in percentage (0 to 100). Default 100. */\n amount?: number;\n}\n\n/**\n * Options for color change effect.\n *\n * ## XSD: CT_ColorChangeEffect\n * ```xml\n * <xsd:element name=\"clrFrom\" type=\"CT_Color\"/>\n * <xsd:element name=\"clrTo\" type=\"CT_Color\"/>\n * <xsd:attribute name=\"useA\" type=\"xsd:boolean\" default=\"true\"/>\n * ```\n */\nexport interface ColorChangeEffectOptions {\n /** Source color to change from. */\n from: SolidFillOptions;\n /** Target color to change to. */\n to: SolidFillOptions;\n /** Whether to use alpha channel. Default true. */\n useAlpha?: boolean;\n}\n\n/**\n * Options for color replace effect.\n *\n * ## XSD: CT_ColorReplaceEffect\n * ```xml\n * <xsd:group ref=\"EG_ColorChoice\" minOccurs=\"1\" maxOccurs=\"1\"/>\n * ```\n */\nexport interface ColorReplaceEffectOptions {\n /** Replacement color. */\n color: SolidFillOptions;\n}\n\n/**\n * Options for blur effect on blip.\n *\n * ## XSD: CT_BlurEffect\n * ```xml\n * <xsd:attribute name=\"rad\" type=\"ST_PositiveCoordinate\" default=\"0\"/>\n * <xsd:attribute name=\"grow\" type=\"xsd:boolean\" default=\"true\"/>\n * ```\n */\nexport interface BlipBlurEffectOptions {\n /** Blur radius in EMUs. Default 0. */\n radius?: number;\n /** Whether to grow the blur boundary. Default true. */\n grow?: boolean;\n}\n\n/**\n * All blip image adjustment effects.\n */\nexport interface BlipEffectsOptions {\n /** Grayscale effect (no options needed). */\n grayscale?: boolean;\n /** Luminance (brightness/contrast) effect. */\n luminance?: LuminanceEffectOptions;\n /** HSL adjustment effect. */\n hsl?: HSLEffectOptions;\n /** Tint effect. */\n tint?: TintEffectOptions;\n /** Duotone effect (two-color mapping). */\n duotone?: DuotoneEffectOptions;\n /** Black & white threshold effect. */\n biLevel?: BiLevelEffectOptions;\n /** Alpha ceiling effect (no options needed). */\n alphaCeiling?: boolean;\n /** Alpha floor effect (no options needed). */\n alphaFloor?: boolean;\n /** Alpha inverse effect (with optional color). */\n alphaInverse?: SolidFillOptions;\n /** Alpha modulate fixed effect. */\n alphaModulateFixed?: AlphaModulateFixedEffectOptions;\n /** Alpha replace effect. */\n alphaReplace?: AlphaReplaceEffectOptions;\n /** Alpha bi-level effect. */\n alphaBiLevel?: AlphaBiLevelEffectOptions;\n /** Color change effect. */\n colorChange?: ColorChangeEffectOptions;\n /** Color replace effect. */\n colorReplace?: ColorReplaceEffectOptions;\n /** Blur effect on blip. */\n blur?: BlipBlurEffectOptions;\n}\n\n// ─── Factory functions ───────────────────────────────────────────────\n\n/**\n * Creates blip effect elements from BlipEffectsOptions.\n *\n * @returns Array of XML strings representing blip effects\n */\nexport const createBlipEffects = (options: BlipEffectsOptions): string[] => {\n const children: string[] = [];\n\n if (options.grayscale) {\n children.push(`<a:grayscl/>`);\n }\n\n if (options.luminance) {\n const attrs: Record<string, string | number | undefined> = {};\n if (options.luminance.bright !== undefined) {\n attrs.bright = `${options.luminance.bright}`;\n }\n if (options.luminance.contrast !== undefined) {\n attrs.contrast = `${options.luminance.contrast}`;\n }\n children.push(element(\"a:lum\", attrs));\n }\n\n if (options.hsl) {\n const attrs: Record<string, string | number | undefined> = {};\n if (options.hsl.hue !== undefined) {\n attrs.hue = String(options.hsl.hue);\n }\n if (options.hsl.saturation !== undefined) {\n attrs.sat = `${options.hsl.saturation}`;\n }\n if (options.hsl.luminance !== undefined) {\n attrs.lum = `${options.hsl.luminance}`;\n }\n children.push(element(\"a:hsl\", attrs));\n }\n\n if (options.tint) {\n const attrs: Record<string, string | number | undefined> = {};\n if (options.tint.hue !== undefined) {\n attrs.hue = String(options.tint.hue);\n }\n if (options.tint.amount !== undefined) {\n attrs.amt = `${options.tint.amount}`;\n }\n children.push(element(\"a:tint\", attrs));\n }\n\n if (options.duotone) {\n children.push(\n element(\"a:duotone\", undefined, [\n createColorElement(options.duotone.color1),\n createColorElement(options.duotone.color2),\n ]),\n );\n }\n\n if (options.biLevel) {\n children.push(`<a:biLevel thresh=\"${options.biLevel.threshold}\"/>`);\n }\n\n if (options.alphaCeiling) {\n children.push(`<a:alphaCeiling/>`);\n }\n\n if (options.alphaFloor) {\n children.push(`<a:alphaFloor/>`);\n }\n\n if (options.alphaInverse !== undefined) {\n if (typeof options.alphaInverse === \"boolean\") {\n children.push(`<a:alphaInv/>`);\n } else {\n children.push(element(\"a:alphaInv\", undefined, [createColorElement(options.alphaInverse)]));\n }\n }\n\n if (options.alphaModulateFixed) {\n const amt = options.alphaModulateFixed.amount ?? 100;\n children.push(`<a:alphaModFix amt=\"${amt}\"/>`);\n }\n\n if (options.alphaReplace) {\n children.push(`<a:alphaRepl a=\"${options.alphaReplace.alpha}\"/>`);\n }\n\n if (options.alphaBiLevel) {\n children.push(`<a:alphaBiLevel thresh=\"${options.alphaBiLevel.threshold}\"/>`);\n }\n\n if (options.colorChange) {\n const attrs: Record<string, string | number | undefined> = {};\n if (options.colorChange.useAlpha === false) {\n attrs.useA = \"0\";\n }\n children.push(\n element(\"a:clrChange\", attrs, [\n element(\"a:clrFrom\", undefined, [createColorElement(options.colorChange.from)]),\n element(\"a:clrTo\", undefined, [createColorElement(options.colorChange.to)]),\n ]),\n );\n }\n\n if (options.colorReplace) {\n children.push(\n element(\"a:clrRepl\", undefined, [createColorElement(options.colorReplace.color)]),\n );\n }\n\n if (options.blur) {\n const attrs: Record<string, string | number | undefined> = {};\n if (options.blur.radius !== undefined) {\n attrs.rad = options.blur.radius;\n }\n if (options.blur.grow === false) {\n attrs.grow = 0;\n }\n children.push(element(\"a:blur\", attrs));\n }\n\n return children;\n};\n","/**\n * Source rectangle module for blip fills.\n *\n * This module defines the portion of an image to use when filling a shape.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_RelativeRect\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\n/**\n * Options for source rectangle cropping.\n *\n * Each value is integer percent (10 = 10% crop from that edge of the image).\n */\nexport interface SourceRectangleOptions {\n /** Left inset as integer percent (10 = 10% crop from left) */\n left?: number;\n /** Top inset as integer percent (10 = 10% crop from top) */\n top?: number;\n /** Right inset as integer percent (10 = 10% crop from right) */\n right?: number;\n /** Bottom inset as integer percent (10 = 10% crop from bottom) */\n bottom?: number;\n}\n\n/**\n * Creates a source rectangle element for blip fill cropping.\n *\n * This element specifies a portion of the blip (image) to use as the fill.\n * When no options are provided, the entire blip is used.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_RelativeRect\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_RelativeRect\">\n * <xsd:attribute name=\"l\" type=\"ST_Percentage\" use=\"optional\" default=\"0\"/>\n * <xsd:attribute name=\"t\" type=\"ST_Percentage\" use=\"optional\" default=\"0\"/>\n * <xsd:attribute name=\"r\" type=\"ST_Percentage\" use=\"optional\" default=\"0\"/>\n * <xsd:attribute name=\"b\" type=\"ST_Percentage\" use=\"optional\" default=\"0\"/>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * // Crop 10% from left and right\n * createSourceRectangle({ left: 10, right: 10 });\n * ```\n */\nexport const createSourceRectangle = (options?: SourceRectangleOptions): string => {\n if (!options) {\n return element(\"a:srcRect\");\n }\n\n const attrs: Record<string, string | number | undefined> = {};\n if (options.left !== undefined) attrs.l = Math.round(options.left * 1000);\n if (options.top !== undefined) attrs.t = Math.round(options.top * 1000);\n if (options.right !== undefined) attrs.r = Math.round(options.right * 1000);\n if (options.bottom !== undefined) attrs.b = Math.round(options.bottom * 1000);\n\n return element(\"a:srcRect\", attrs);\n};\n","/**\n * Tile fill module for blip fills.\n *\n * This module defines how images are tiled (repeated) to fill shapes.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_TileInfoProperties\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { convertToEmu } from \"../../util/converters\";\nimport { xsdRectAlignment } from \"../../util/mappings\";\nimport type { UniversalMeasure } from \"../../util/values\";\n\n/**\n * Tile flip mode for tiling images.\n *\n * Specifies whether the image is flipped along the x-axis, y-axis,\n * both axes, or not at all when tiling.\n */\nexport type TileFlipMode = \"none\" | \"x\" | \"y\" | \"xy\";\n\n/**\n * Tile alignment within the shape.\n *\n * Specifies the anchor position of the first tile relative to the shape.\n */\nexport type TileAlignment =\n | \"topLeft\"\n | \"top\"\n | \"topRight\"\n | \"left\"\n | \"center\"\n | \"right\"\n | \"bottomLeft\"\n | \"bottom\"\n | \"bottomRight\";\n\n/**\n * Options for tile fill mode.\n *\n * Configures how an image is tiled (repeated) to fill a shape.\n */\nexport interface TileOptions {\n /** Horizontal offset for the tile origin in EMUs (number) or UniversalMeasure. */\n tx?: number | UniversalMeasure;\n /** Vertical offset for the tile origin in EMUs (number) or UniversalMeasure. */\n ty?: number | UniversalMeasure;\n /** Horizontal scale as integer percent (100 = 100%) */\n sx?: number;\n /** Vertical scale as integer percent (100 = 100%) */\n sy?: number;\n /** Flip mode for alternating tiles */\n flip?: TileFlipMode;\n /** Alignment of the first tile within the shape */\n alignment?: TileAlignment;\n}\n\n/**\n * Creates a tile fill mode element for blip fills.\n *\n * When a blip fill uses tile mode, the image is repeated (tiled) to fill\n * the shape instead of being stretched. This element controls the tiling\n * parameters such as offset, scale, flip, and alignment.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_TileInfoProperties\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_TileInfoProperties\">\n * <xsd:attribute name=\"tx\" type=\"ST_Coordinate\" use=\"optional\"/>\n * <xsd:attribute name=\"ty\" type=\"ST_Coordinate\" use=\"optional\"/>\n * <xsd:attribute name=\"sx\" type=\"ST_Percentage\" use=\"optional\"/>\n * <xsd:attribute name=\"sy\" type=\"ST_Percentage\" use=\"optional\"/>\n * <xsd:attribute name=\"flip\" type=\"ST_TileFlipMode\" default=\"none\"/>\n * <xsd:attribute name=\"algn\" type=\"ST_RectAlignment\" use=\"optional\"/>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * // Tile with 50% scale\n * createTileInfo({ sx: 50, sy: 50 });\n * // Tile with flip and alignment\n * createTileInfo({ flip: \"xy\", alignment: \"center\" });\n * ```\n */\nexport const createTileInfo = (options?: TileOptions): string => {\n if (!options) {\n return `<a:tile/>`;\n }\n\n const attrs: Record<string, string | number | undefined> = {};\n if (options.tx !== undefined) attrs.tx = convertToEmu(options.tx);\n if (options.ty !== undefined) attrs.ty = convertToEmu(options.ty);\n if (options.sx !== undefined) attrs.sx = Math.round(options.sx * 1000);\n if (options.sy !== undefined) attrs.sy = Math.round(options.sy * 1000);\n if (options.flip !== undefined) attrs.flip = options.flip;\n if (options.alignment !== undefined) attrs.algn = xsdRectAlignment.to(options.alignment);\n\n return element(\"a:tile\", attrs);\n};\n","/**\n * Gradient fill element for DrawingML shapes.\n *\n * This module provides gradient fill support with linear and path shading.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GradientFillProperties\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport type { TileFlipMode } from \"../blip/tile\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\nimport { createColorElement } from \"../color/solid-fill\";\n\n// Single home for the shared ST_TileFlipMode token set is blip/tile.ts;\n// re-exported here for gradient-fill consumers.\nexport type { TileFlipMode } from \"../blip/tile\";\n\n/**\n * Gradient stop position as integer percent (0-100).\n */\nexport interface GradientStop {\n /** Position of the color stop as integer percent (0-100). */\n position: number;\n /** Color at this stop */\n color: SolidFillOptions;\n}\n\n/**\n * Path shade type for radial gradients.\n */\nexport type PathShade = \"shape\" | \"circle\" | \"rect\";\n\n/**\n * Options for linear gradient shading.\n */\nexport interface LinearShadeOptions {\n /** Angle in degrees (e.g., 90 = 90°). */\n angle?: number;\n /** Whether the angle scales with the shape */\n scaled?: boolean;\n}\n\n/**\n * Relative rectangle (CT_RelativeRect) with percentage offsets.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_RelativeRect\">\n * <xsd:attribute name=\"l\" type=\"ST_Percentage\" default=\"0%\"/>\n * <xsd:attribute name=\"t\" type=\"ST_Percentage\" default=\"0%\"/>\n * <xsd:attribute name=\"r\" type=\"ST_Percentage\" default=\"0%\"/>\n * <xsd:attribute name=\"b\" type=\"ST_Percentage\" default=\"0%\"/>\n * </xsd:complexType>\n * ```\n */\nexport interface RelativeRect {\n /** Left offset percentage (e.g., \"0%\") */\n left?: string;\n /** Top offset percentage (e.g., \"0%\") */\n top?: string;\n /** Right offset percentage (e.g., \"0%\") */\n right?: string;\n /** Bottom offset percentage (e.g., \"0%\") */\n bottom?: string;\n}\n\n/**\n * Options for path (radial) gradient shading.\n */\nexport interface PathShadeOptions {\n /** Path type */\n path?: PathShade;\n /**\n * Fill-to rectangle for path gradient.\n *\n * Defines the rectangle to which the gradient fills.\n */\n fillToRectangle?: RelativeRect;\n}\n\n/**\n * Gradient shade options (linear or path).\n */\nexport type GradientShadeOptions = LinearShadeOptions | PathShadeOptions;\n\n/**\n * Options for gradient fill.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_GradientFillProperties\">\n * <xsd:sequence>\n * <xsd:element name=\"gsLst\" type=\"CT_GradientStopList\" minOccurs=\"0\"/>\n * <xsd:group ref=\"EG_ShadeProperties\" minOccurs=\"0\"/>\n * <xsd:element name=\"tileRect\" type=\"CT_RelativeRect\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"flip\" type=\"ST_TileFlipMode\" use=\"optional\"/>\n * <xsd:attribute name=\"rotWithShape\" type=\"xsd:boolean\" use=\"optional\"/>\n * </xsd:complexType>\n * ```\n */\nexport interface GradientFillOptions {\n /** Gradient color stops (minimum 2) */\n stops: readonly GradientStop[];\n /** Shade type (linear or path) */\n shade?: GradientShadeOptions;\n /**\n * Tile flip mode.\n *\n * Controls how the gradient is flipped when tiled.\n */\n flip?: TileFlipMode;\n /**\n * Tile rectangle for gradient tiling.\n *\n * Defines the rectangle used for gradient tiling.\n */\n tileRectangle?: RelativeRect;\n /** Whether gradient rotates with the shape */\n rotateWithShape?: boolean;\n}\n\n/**\n * Creates a gradient stop element (a:gs).\n *\n * @example\n * ```typescript\n * createGradientStop({ position: 0, color: { value: \"FF0000\" } });\n * createGradientStop({ position: 100, color: { value: \"0000FF\" } });\n * ```\n */\nexport const createGradientStop = (stop: GradientStop): string =>\n element(\"a:gs\", { pos: Math.round(stop.position * 1000) }, [createColorElement(stop.color)]);\n\n/**\n * Creates a relative rect element.\n */\nconst createRelativeRect = (name: string, rect?: RelativeRect): string =>\n element(name, {\n l: rect?.left,\n t: rect?.top,\n r: rect?.right,\n b: rect?.bottom,\n });\n\n/**\n * Creates the shade element (a:lin or a:path).\n */\nconst createShadeElement = (shade: GradientShadeOptions): string => {\n if (\"angle\" in shade) {\n return element(\"a:lin\", {\n ang: shade.angle !== undefined ? Math.round(shade.angle * 60000) : undefined,\n scaled: shade.scaled,\n });\n }\n const pathShade = shade as PathShadeOptions;\n const children: string[] = [];\n\n if (pathShade.fillToRectangle) {\n children.push(createRelativeRect(\"a:fillToRect\", pathShade.fillToRectangle));\n }\n\n return element(\"a:path\", { path: pathShade.path }, children);\n};\n\n/**\n * Creates a gradient fill element.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_GradientFillProperties\">\n * <xsd:sequence>\n * <xsd:element name=\"gsLst\" type=\"CT_GradientStopList\" minOccurs=\"0\"/>\n * <xsd:group ref=\"EG_ShadeProperties\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"rotWithShape\" type=\"xsd:boolean\" use=\"optional\"/>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * // Linear gradient from red to blue\n * createGradientFill({\n * stops: [\n * { position: 0, color: { value: \"FF0000\" } },\n * { position: 100, color: { value: \"0000FF\" } },\n * ],\n * shade: { angle: 90 },\n * });\n * ```\n */\nexport const createGradientFill = (options: GradientFillOptions): string => {\n const children: string[] = [];\n\n // Gradient stop list\n const stopElements = options.stops.map(createGradientStop);\n children.push(element(\"a:gsLst\", undefined, stopElements));\n\n // Shade properties (a:lin or a:path)\n if (options.shade) {\n children.push(createShadeElement(options.shade));\n }\n\n // Tile rectangle\n if (options.tileRectangle) {\n children.push(createRelativeRect(\"a:tileRect\", options.tileRectangle));\n }\n\n return element(\n \"a:gradFill\",\n {\n flip: options.flip,\n rotWithShape: options.rotateWithShape,\n },\n children,\n );\n};\n","/**\n * Pattern fill element for DrawingML shapes.\n *\n * This module provides pattern fill support with preset patterns and\n * optional foreground/background colors.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PatternFillProperties\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { xsdPattern } from \"../../util/mappings\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\nimport { createColorElement } from \"../color/solid-fill\";\n\n/**\n * Preset pattern values for pattern fill.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_PresetPatternVal\">\n * <xsd:restriction base=\"xsd:token\">\n * <xsd:enumeration value=\"pct5\"/> ... <xsd:enumeration value=\"zigZag\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @publicApi\n */\nexport const PresetPattern = {\n /** 5% pattern */\n PCT5: \"percent5\",\n /** 10% pattern */\n PCT10: \"percent10\",\n /** 20% pattern */\n PCT20: \"percent20\",\n /** 25% pattern */\n PCT25: \"percent25\",\n /** 30% pattern */\n PCT30: \"percent30\",\n /** 40% pattern */\n PCT40: \"percent40\",\n /** 50% pattern */\n PCT50: \"percent50\",\n /** 60% pattern */\n PCT60: \"percent60\",\n /** 70% pattern */\n PCT70: \"percent70\",\n /** 75% pattern */\n PCT75: \"percent75\",\n /** 80% pattern */\n PCT80: \"percent80\",\n /** 90% pattern */\n PCT90: \"percent90\",\n /** Horizontal lines */\n HORZ: \"horizontal\",\n /** Vertical lines */\n VERT: \"vertical\",\n /** Light horizontal lines */\n LT_HORZ: \"lightHorizontal\",\n /** Light vertical lines */\n LT_VERT: \"lightVertical\",\n /** Dark horizontal lines */\n DK_HORZ: \"darkHorizontal\",\n /** Dark vertical lines */\n DK_VERT: \"darkVertical\",\n /** Narrow horizontal lines */\n NAR_HORZ: \"narrowHorizontal\",\n /** Narrow vertical lines */\n NAR_VERT: \"narrowVertical\",\n /** Dashed horizontal lines */\n DASH_HORZ: \"dashedHorizontal\",\n /** Dashed vertical lines */\n DASH_VERT: \"dashedVertical\",\n /** Cross pattern (+) */\n CROSS: \"cross\",\n /** Downward diagonal lines (\\) */\n DN_DIAG: \"downDiagonal\",\n /** Upward diagonal lines (/) */\n UP_DIAG: \"upDiagonal\",\n /** Light downward diagonal lines */\n LT_DN_DIAG: \"lightDownDiagonal\",\n /** Light upward diagonal lines */\n LT_UP_DIAG: \"lightUpDiagonal\",\n /** Dark downward diagonal lines */\n DK_DN_DIAG: \"darkDownDiagonal\",\n /** Dark upward diagonal lines */\n DK_UP_DIAG: \"darkUpDiagonal\",\n /** Wide downward diagonal lines */\n WD_DN_DIAG: \"wideDownDiagonal\",\n /** Wide upward diagonal lines */\n WD_UP_DIAG: \"wideUpDiagonal\",\n /** Dashed downward diagonal lines */\n DASH_DN_DIAG: \"dashedDownDiagonal\",\n /** Dashed upward diagonal lines */\n DASH_UP_DIAG: \"dashedUpDiagonal\",\n /** Diagonal cross pattern (X) */\n DIAG_CROSS: \"diagonalCross\",\n /** Small checkerboard */\n SM_CHECK: \"smallChecker\",\n /** Large checkerboard */\n LG_CHECK: \"largeChecker\",\n /** Small grid */\n SM_GRID: \"smallGrid\",\n /** Large grid */\n LG_GRID: \"largeGrid\",\n /** Dot grid */\n DOT_GRID: \"dotGrid\",\n /** Small confetti */\n SM_CONFETTI: \"smallConfetti\",\n /** Large confetti */\n LG_CONFETTI: \"largeConfetti\",\n /** Horizontal brick pattern */\n HORZ_BRICK: \"horizontalBrick\",\n /** Diagonal brick pattern */\n DIAG_BRICK: \"diagonalBrick\",\n /** Solid diamond */\n SOLID_DMND: \"solidDiamond\",\n /** Open diamond */\n OPEN_DMND: \"openDiamond\",\n /** Dotted diamond */\n DOT_DMND: \"dottedDiamond\",\n /** Plaid pattern */\n PLAID: \"plaid\",\n /** Sphere pattern */\n SPHERE: \"sphere\",\n /** Weave pattern */\n WEAVE: \"weave\",\n /** Divot pattern */\n DIVOT: \"divot\",\n /** Shingle pattern */\n SHINGLE: \"shingle\",\n /** Wave pattern */\n WAVE: \"wave\",\n /** Trellis pattern */\n TRELLIS: \"trellis\",\n /** Zigzag pattern */\n ZIG_ZAG: \"zigZag\",\n} as const;\n\n/**\n * Options for pattern fill.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_PatternFillProperties\">\n * <xsd:sequence>\n * <xsd:element name=\"fgClr\" type=\"CT_Color\" minOccurs=\"0\"/>\n * <xsd:element name=\"bgClr\" type=\"CT_Color\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"prst\" type=\"ST_PresetPatternVal\" use=\"optional\"/>\n * </xsd:complexType>\n * ```\n */\nexport interface PatternFillOptions {\n /** Preset pattern type */\n pattern: (typeof PresetPattern)[keyof typeof PresetPattern];\n /** Foreground color */\n foregroundColor?: SolidFillOptions;\n /** Background color */\n backgroundColor?: SolidFillOptions;\n}\n\n/**\n * Creates a pattern fill element (a:pattFill).\n *\n * Specifies a pattern fill using preset patterns with optional\n * foreground and background colors.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_PatternFillProperties\">\n * <xsd:sequence>\n * <xsd:element name=\"fgClr\" type=\"CT_Color\" minOccurs=\"0\"/>\n * <xsd:element name=\"bgClr\" type=\"CT_Color\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"prst\" type=\"ST_PresetPatternVal\" use=\"optional\"/>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * // Simple crosshatch pattern\n * createPatternFill({ pattern: PresetPattern.CROSS });\n * // Pattern with foreground color\n * createPatternFill({\n * pattern: PresetPattern.DIAG_CROSS,\n * foregroundColor: { value: \"FF0000\" },\n * });\n * // Pattern with foreground and background colors\n * createPatternFill({\n * pattern: PresetPattern.HORZ,\n * foregroundColor: { value: \"0000FF\" },\n * backgroundColor: { value: \"FFFF00\" },\n * });\n * ```\n */\nexport const createPatternFill = (options: PatternFillOptions): string => {\n const children: string[] = [];\n\n if (options.foregroundColor) {\n children.push(element(\"a:fgClr\", undefined, [createColorElement(options.foregroundColor)]));\n }\n\n if (options.backgroundColor) {\n children.push(element(\"a:bgClr\", undefined, [createColorElement(options.backgroundColor)]));\n }\n\n return element(\"a:pattFill\", { prst: xsdPattern.to(options.pattern) }, children);\n};\n","import { element } from \"@office-open/xml\";\n\nimport { toUint8Array } from \"../../util/data-type\";\nimport type { DataType } from \"../../util/data-type\";\nimport { uniqueId } from \"../../util/generators\";\nimport { stripColorHashPrefix } from \"../../util/values\";\nimport { createBlipEffects } from \"../blip/blip-effects\";\nimport type { BlipEffectsOptions } from \"../blip/blip-effects\";\nimport { createSourceRectangle } from \"../blip/source-rectangle\";\nimport type { SourceRectangleOptions } from \"../blip/source-rectangle\";\nimport { createTileInfo } from \"../blip/tile\";\nimport type { TileOptions } from \"../blip/tile\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\nimport { createSolidFill } from \"../color/solid-fill\";\nimport { createGradientFill } from \"./gradient-fill\";\nimport type { GradientFillOptions } from \"./gradient-fill\";\nimport type { PatternFillOptions } from \"./pattern-fill\";\nimport { createPatternFill } from \"./pattern-fill\";\n\n/**\n * Gradient stop options (simplified API).\n * Position is 0-100 (percentage), color is a hex string or SolidFillOptions.\n */\nexport interface GradientStopOptions {\n position: number;\n color: string | SolidFillOptions;\n}\n\n/**\n * Blip fill options (image fill) for DrawingML shapes.\n */\nexport interface BlipFillConfigOptions {\n /** Image data: raw bytes, ArrayBuffer, or a base64 data URL string. */\n data: DataType;\n /** Image type */\n imageType: \"png\" | \"jpg\" | \"gif\" | \"bmp\" | \"tif\" | \"ico\" | \"emf\" | \"wmf\";\n /** DPI of the image */\n dpi?: number;\n /** Whether the fill rotates with the shape */\n rotWithShape?: boolean;\n /** Image adjustment effects (brightness, contrast, grayscale, etc.) */\n blipEffects?: BlipEffectsOptions;\n /** Source rectangle for cropping */\n sourceRectangle?: SourceRectangleOptions;\n /** Tile fill mode (if omitted, defaults to stretch) */\n tile?: TileOptions;\n}\n\n/**\n * Media data extracted from a blip fill, for registration with the document's media store.\n */\nexport interface BlipFillMediaData {\n fileName: string;\n data: Uint8Array;\n type: string;\n}\n\n/**\n * Fill options — discriminated union for DrawingML EG_FillProperties.\n *\n * Supports string shorthand for solid fill (most common case).\n * Color fields accept hex strings or advanced SolidFillOptions\n * (scheme color, HSL, etc.).\n *\n * @example\n * // Solid fill (shorthand)\n * fill: \"4472C4\"\n * // Solid fill with scheme color\n * fill: { type: \"solid\", color: { value: \"accent1\" } }\n * // No fill\n * fill: { type: \"none\" }\n * // Gradient fill — linear\n * fill: { type: \"gradient\", angle: 90, stops: [{ position: 0, color: \"4472C4\" }, { position: 100, color: \"ED7D31\" }] }\n * // Gradient fill — path (radial)\n * fill: { type: \"gradient\", path: \"circle\", stops: [{ position: 0, color: \"FFFFFF\" }, { position: 100, color: \"4472C4\" }] }\n * // Gradient fill (core API for advanced options)\n * fill: { type: \"gradient\", options: { stops: [...], shade: { angle: 90 } } }\n * // Blip fill (image)\n * fill: { type: \"blip\", data: imageBuffer, imageType: \"png\" }\n * // Pattern fill\n * fill: { type: \"pattern\", pattern: \"cross\", foregroundColor: \"FF0000\" }\n * // Group fill\n * fill: { type: \"group\" }\n */\nexport type FillOptions =\n | string\n | { type: \"solid\"; color: string | SolidFillOptions }\n | { type: \"none\" }\n | {\n type: \"gradient\";\n angle?: number;\n scaled?: boolean;\n path?: \"shape\" | \"circle\" | \"rect\";\n stops: readonly GradientStopOptions[];\n }\n | { type: \"gradient\"; options: GradientFillOptions }\n | ({ type: \"blip\" } & BlipFillConfigOptions)\n | {\n type: \"pattern\";\n pattern: string;\n foregroundColor?: string | SolidFillOptions;\n backgroundColor?: string | SolidFillOptions;\n }\n | { type: \"group\" };\n\nfunction normalizeColor(color: string | SolidFillOptions): SolidFillOptions {\n return typeof color === \"string\" ? { value: stripColorHashPrefix(color) } : color;\n}\n\n/**\n * Extracts media data from a blip fill option, if present.\n * Returns undefined for non-blip fills.\n *\n * The returned data should be registered with the document's media store\n * during serialization so the packer can resolve the `{fileName}` placeholder.\n *\n * @param fill - Fill options to inspect\n * @param nameAllocator - Optional sequential name provider (e.g. a format\n * package's media counter). When omitted, falls back to a random id so the\n * function stays usable from contexts without a shared counter.\n */\nexport const extractBlipFillMedia = (\n fill: FillOptions,\n nameAllocator?: (type: string) => string,\n): BlipFillMediaData | undefined => {\n if (typeof fill === \"string\" || fill.type !== \"blip\") return undefined;\n const raw = toUint8Array(fill.data);\n const fileName = nameAllocator\n ? nameAllocator(fill.imageType)\n : `${uniqueId()}.${fill.imageType}`;\n return { data: raw, fileName, type: fill.imageType };\n};\n\n/**\n * Builds a DrawingML fill XML string from a FillOptions config.\n */\nexport const buildFill = (options: FillOptions, embedPlaceholder?: string): string => {\n if (typeof options === \"string\") {\n return createSolidFill({ value: stripColorHashPrefix(options) });\n }\n\n switch (options.type) {\n case \"solid\":\n return createSolidFill(normalizeColor(options.color));\n case \"none\":\n return \"<a:noFill/>\";\n case \"gradient\":\n if (\"options\" in options) {\n return createGradientFill(options.options);\n }\n return createGradientFill({\n stops: options.stops.map((stop) => ({\n position: stop.position,\n color: normalizeColor(stop.color),\n })),\n ...(!options.path &&\n options.angle !== undefined && {\n shade: { angle: options.angle, scaled: options.scaled ?? true },\n }),\n ...(options.path && {\n shade: { path: options.path as \"shape\" | \"circle\" | \"rect\" },\n }),\n });\n case \"blip\": {\n const fileName = `${uniqueId()}.${options.imageType}`;\n\n // Build a:blip with {fileName} placeholder — the packer's ImageReplacer\n // will replace `{fileName}` with `rId{N}` and create the relationship.\n // We do NOT use createBlip here because it prefixes \"rId\" to the value,\n // which would produce \"rIdrId{N}\" after replacement. When the caller\n // supplies embedPlaceholder (a media reference already registered with\n // the write context, e.g. `{image1.png}`), use it verbatim instead of\n // minting a fresh id so the emitted reference matches the registration.\n const embed = embedPlaceholder ?? `{${fileName}}`;\n const blipChildren: string[] = [];\n if (options.blipEffects) {\n blipChildren.push(...createBlipEffects(options.blipEffects));\n }\n const blip = element(\n \"a:blip\",\n { cstate: \"none\", \"r:embed\": embed },\n blipChildren.length > 0 ? blipChildren : undefined,\n );\n\n const children: string[] = [blip, createSourceRectangle(options.sourceRectangle)];\n if (options.tile) {\n children.push(createTileInfo(options.tile));\n } else {\n children.push(\"<a:stretch><a:fillRect/></a:stretch>\");\n }\n const attrs: Record<string, string | number | undefined> = {};\n if (options.dpi !== undefined) attrs.dpi = options.dpi;\n if (options.rotWithShape !== undefined) attrs.rotWithShape = options.rotWithShape ? 1 : 0;\n return element(\"a:blipFill\", attrs, children);\n }\n case \"pattern\": {\n const coreOpts: PatternFillOptions = {\n pattern: options.pattern as PatternFillOptions[\"pattern\"],\n ...(options.foregroundColor && {\n foregroundColor: normalizeColor(options.foregroundColor),\n }),\n ...(options.backgroundColor && {\n backgroundColor: normalizeColor(options.backgroundColor),\n }),\n };\n return createPatternFill(coreOpts);\n }\n case \"group\":\n return \"<a:grpFill/>\";\n }\n};\n","/**\n * No fill element for DrawingML shapes.\n *\n * This module provides the no-fill option for outline and shape fills.\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\n/**\n * Creates a no-fill element.\n *\n * Specifies that the outline or shape should have no fill applied.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:element name=\"noFill\" type=\"CT_Empty\"/>\n * ```\n *\n * @example\n * ```typescript\n * const noFill = createNoFill();\n * ```\n */\nexport const createNoFill = (): string => element(\"a:noFill\");\n","/**\n * Group fill element for DrawingML shapes.\n *\n * This module provides group fill support which inherits the fill\n * from the parent group shape.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GroupFillProperties\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\n/**\n * Creates a group fill element (a:grpFill).\n *\n * This element specifies that the shape should inherit its fill\n * from the parent group shape. This is useful when shapes are\n * grouped together and should share the same fill.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_GroupFillProperties\"/>\n * ```\n *\n * @example\n * ```typescript\n * // Shape inherits fill from parent group\n * createGroupFill();\n * ```\n */\nexport const createGroupFill = (): string => element(\"a:grpFill\");\n","/**\n * Custom dash pattern for DrawingML outlines.\n *\n * This module provides support for custom dash patterns defined by\n * a list of dash stops, each specifying dash and space lengths as\n * percentages relative to line width.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_DashStopList, CT_DashStop\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\n/**\n * A single dash stop in a custom dash pattern.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_DashStop\">\n * <xsd:attribute name=\"d\" type=\"ST_PositivePercentage\" use=\"required\"/>\n * <xsd:attribute name=\"sp\" type=\"ST_PositivePercentage\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n *\n * `ST_PositivePercentage` is a string matching `[0-9]+(\\.[0-9]+)?%`\n * (e.g., `\"100%\"`, `\"500%\"`, `\"50.5%\"`).\n *\n * @example\n * ```typescript\n * // A dash stop with 500% dash length and 200% space length\n * { d: \"500%\", sp: \"200%\" }\n * ```\n */\nexport interface DashStop {\n /** Dash length as a percentage of line width (e.g., \"500%\") */\n d: string;\n /** Space length as a percentage of line width (e.g., \"200%\") */\n sp: string;\n}\n\n/**\n * Creates a custom dash element (a:custDash) for outlines.\n *\n * The custom dash element specifies a repeating pattern of dash and space\n * segments. Each segment is defined by a `DashStop` with dash (`d`) and\n * space (`sp`) lengths as positive percentages of the line width.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_DashStopList\">\n * <xsd:sequence>\n * <xsd:element name=\"ds\" type=\"CT_DashStop\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n * </xsd:sequence>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * // Simple dash pattern\n * createCustomDash([\n * { d: \"500%\", sp: \"200%\" },\n * ]);\n *\n * // Complex alternating pattern\n * createCustomDash([\n * { d: \"500%\", sp: \"200%\" },\n * { d: \"100%\", sp: \"200%\" },\n * ]);\n * ```\n */\nexport const createCustomDash = (stops: readonly DashStop[]): string => {\n const children: string[] = [];\n\n for (const stop of stops) {\n children.push(`<a:ds d=\"${stop.d}\" sp=\"${stop.sp}\"/>`);\n }\n\n return element(\"a:custDash\", undefined, children);\n};\n","/**\n * Line end (arrow) properties for DrawingML outlines.\n *\n * This module provides support for line end markers (arrows) on shape outlines.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_LineEndProperties\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { xsdLineEndSize } from \"../../util/mappings\";\n\n/**\n * Line end types (arrow head styles).\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_LineEndType\">\n * <xsd:restriction base=\"xsd:token\">\n * <xsd:enumeration value=\"none\"/>\n * <xsd:enumeration value=\"triangle\"/>\n * <xsd:enumeration value=\"stealth\"/>\n * <xsd:enumeration value=\"diamond\"/>\n * <xsd:enumeration value=\"oval\"/>\n * <xsd:enumeration value=\"arrow\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @publicApi\n */\nexport type LineEndType = \"none\" | \"triangle\" | \"stealth\" | \"diamond\" | \"oval\" | \"arrow\";\n\n/**\n * Line end width options.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_LineEndWidth\">\n * <xsd:restriction base=\"xsd:token\">\n * <xsd:enumeration value=\"sm\"/>\n * <xsd:enumeration value=\"med\"/>\n * <xsd:enumeration value=\"lg\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @publicApi\n */\nexport type LineEndWidth = \"small\" | \"medium\" | \"large\";\n\n/**\n * Line end length options.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_LineEndLength\">\n * <xsd:restriction base=\"xsd:token\">\n * <xsd:enumeration value=\"sm\"/>\n * <xsd:enumeration value=\"med\"/>\n * <xsd:enumeration value=\"lg\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @publicApi\n */\nexport type LineEndLength = \"small\" | \"medium\" | \"large\";\n\n/**\n * Options for line end (arrow) properties.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_LineEndProperties\">\n * <xsd:attribute name=\"type\" type=\"ST_LineEndType\" use=\"optional\" default=\"none\"/>\n * <xsd:attribute name=\"w\" type=\"ST_LineEndWidth\" use=\"optional\"/>\n * <xsd:attribute name=\"len\" type=\"ST_LineEndLength\" use=\"optional\"/>\n * </xsd:complexType>\n * ```\n */\nexport interface LineEndOptions {\n /** Arrow/head type */\n type: LineEndType;\n /** Arrow width */\n width?: LineEndWidth;\n /** Arrow length */\n length?: LineEndLength;\n}\n\n/**\n * Creates a line end element (a:headEnd or a:tailEnd).\n *\n * @example\n * ```typescript\n * // Stealth arrow at start, medium size\n * createLineEnd(\"a:headEnd\", { type: \"stealth\", width: \"medium\", length: \"medium\" });\n * // Triangle arrow at end\n * createLineEnd(\"a:tailEnd\", { type: \"triangle\" });\n * ```\n */\nexport const createLineEnd = (name: string, options: LineEndOptions): string =>\n element(name, {\n type: options.type,\n w: options.width ? xsdLineEndSize.to(options.width) : undefined,\n len: options.length ? xsdLineEndSize.to(options.length) : undefined,\n });\n","import { element } from \"@office-open/xml\";\n\nimport { convertToEmu } from \"../../util/converters\";\nimport { xsdCompoundLine, xsdLineCap, xsdPenAlignment } from \"../../util/mappings\";\nimport { stripColorHashPrefix } from \"../../util/values\";\n/**\n * Outline (line) properties for DrawingML shapes.\n *\n * This module provides support for configuring outline properties including\n * width, cap style, compound line types, fill properties, dash, and join.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_LineProperties\n *\n * @module\n */\nimport type { UniversalMeasure } from \"../../util/values\";\nimport { createSolidFill } from \"../color/solid-fill\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\nimport { createGradientFill } from \"../fill/gradient-fill\";\nimport type { GradientFillOptions } from \"../fill/gradient-fill\";\nimport { createNoFill } from \"../fill/no-fill\";\nimport { createPatternFill } from \"../fill/pattern-fill\";\nimport type { PatternFillOptions } from \"../fill/pattern-fill\";\nimport { createCustomDash } from \"./custom-dash\";\nimport type { DashStop } from \"./custom-dash\";\nimport { createLineEnd } from \"./line-end\";\nimport type { LineEndOptions } from \"./line-end\";\n\n// <xsd:complexType name=\"CT_LineProperties\">\n// <xsd:sequence>\n// <xsd:group ref=\"EG_LineFillProperties\" minOccurs=\"0\"/>\n// <xsd:group ref=\"EG_LineDashProperties\" minOccurs=\"0\"/>\n// <xsd:group ref=\"EG_LineJoinProperties\" minOccurs=\"0\"/>\n// </xsd:sequence>\n// <xsd:attribute name=\"w\" use=\"optional\" type=\"a:ST_LineWidth\"/>\n// <xsd:attribute name=\"cap\" use=\"optional\" type=\"ST_LineCap\"/>\n// <xsd:attribute name=\"cmpd\" use=\"optional\" type=\"ST_CompoundLine\"/>\n// <xsd:attribute name=\"algn\" use=\"optional\" type=\"ST_PenAlignment\"/>\n// </xsd:complexType>\n\n// <xsd:simpleType name=\"ST_LineCap\">\n// <xsd:restriction base=\"xsd:string\">\n// <xsd:enumeration value=\"rnd\"/>\n// <xsd:enumeration value=\"sq\"/>\n// <xsd:enumeration value=\"flat\"/>\n// </xsd:restriction>\n// </xsd:simpleType>\n\n/**\n * Line cap styles for outline endpoints.\n *\n * Defines how the ends of a line are rendered.\n */\nexport type LineCap = \"round\" | \"square\" | \"flat\";\n\n// <xsd:simpleType name=\"ST_CompoundLine\">\n// <xsd:restriction base=\"xsd:string\">\n// <xsd:enumeration value=\"sng\"/>\n// <xsd:enumeration value=\"dbl\"/>\n// <xsd:enumeration value=\"thickThin\"/>\n// <xsd:enumeration value=\"thinThick\"/>\n// <xsd:enumeration value=\"tri\"/>\n// </xsd:restriction>\n// </xsd:simpleType>\n\n/**\n * Compound line types for outlines.\n *\n * Defines the structure of compound lines (single, double, etc.).\n */\nexport type CompoundLine = \"single\" | \"double\" | \"thickThin\" | \"thinThick\" | \"triple\";\n\n// <xsd:simpleType name=\"ST_PenAlignment\">\n// <xsd:restriction base=\"xsd:string\">\n// <xsd:enumeration value=\"ctr\"/>\n// <xsd:enumeration value=\"in\"/>\n// </xsd:restriction>\n// </xsd:simpleType>\n\n/**\n * Pen alignment options for outline positioning.\n *\n * Defines how the outline is aligned relative to the shape edge.\n */\nexport type PenAlignment = \"center\" | \"inside\";\n\n/**\n * Preset dash styles for outlines.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_PresetLineDashVal\">\n * <xsd:restriction base=\"xsd:token\">\n * <xsd:enumeration value=\"solid\"/>\n * <xsd:enumeration value=\"dot\"/>\n * <xsd:enumeration value=\"dash\"/>\n * <xsd:enumeration value=\"lgDash\"/>\n * <xsd:enumeration value=\"dashDot\"/>\n * <xsd:enumeration value=\"lgDashDot\"/>\n * <xsd:enumeration value=\"lgDashDotDot\"/>\n * <xsd:enumeration value=\"sysDash\"/>\n * <xsd:enumeration value=\"sysDot\"/>\n * <xsd:enumeration value=\"sysDashDot\"/>\n * <xsd:enumeration value=\"sysDashDotDot\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n */\nexport type PresetDash =\n | \"solid\"\n | \"dot\"\n | \"dash\"\n | \"lgDash\"\n | \"dashDot\"\n | \"lgDashDot\"\n | \"lgDashDotDot\"\n | \"sysDash\"\n | \"sysDot\"\n | \"sysDashDot\"\n | \"sysDashDotDot\";\n\n/**\n * Line join styles.\n */\nexport type LineJoin = \"round\" | \"bevel\" | \"miter\";\n\n/**\n * Attributes for configuring outline properties.\n */\nexport interface OutlineProperties {\n /** Line width in EMUs (English Metric Units) or universal measure (e.g., \"1pt\", \"2mm\") */\n width?: number | UniversalMeasure;\n /** Line cap style */\n cap?: LineCap;\n /** Compound line type */\n compoundLine?: CompoundLine;\n /** Pen alignment */\n alignment?: PenAlignment;\n /**\n * Preset dash style.\n *\n * Mutually exclusive with `customDash` — only one can be specified.\n */\n dash?: PresetDash;\n /**\n * Custom dash pattern (list of dash/space stops).\n *\n * Mutually exclusive with `dash` — only one can be specified.\n */\n customDash?: readonly DashStop[];\n /** Line join style */\n join?: LineJoin;\n /** Miter limit (only when join is MITER) */\n miterLimit?: number;\n /** Line start arrow/head */\n headEnd?: LineEndOptions;\n /** Line end arrow/tail */\n tailEnd?: LineEndOptions;\n}\n\n/**\n * Fill properties for outline (EG_LineFillProperties).\n *\n * Supports noFill, solidFill, gradFill, and pattFill per XSD.\n * blipFill and grpFill are not applicable to lines.\n */\nexport interface OutlineFillProperties {\n /** Fill type */\n type?: \"noFill\" | \"solidFill\" | \"gradFill\" | \"pattFill\";\n /**\n * Color definition (required when type is \"solidFill\"). A bare string is an\n * sRGB hex convenience sugar (e.g. `\"FF0000\"`); stringify coerces it to\n * `{ value }` and infers `type: \"solidFill\"` when `type` is omitted. Parse\n * always emits the normalized `{ value }` form.\n */\n color?: SolidFillOptions | string;\n /** Gradient fill options (required when type is \"gradFill\") */\n gradientFill?: GradientFillOptions;\n /** Pattern fill options (required when type is \"pattFill\") */\n patternFill?: PatternFillOptions;\n}\n\n/**\n * Complete outline configuration options.\n *\n * Combines outline attributes with fill properties.\n */\nexport type OutlineOptions = OutlineProperties & OutlineFillProperties;\n\n/**\n * Creates the fill child element for an outline.\n *\n * Returns null when no fill type is specified (OOXML allows outline without fill).\n */\nconst createOutlineFill = (options: OutlineOptions): string | null => {\n if (options.type === \"noFill\") {\n return createNoFill();\n }\n // Bare-string color is an sRGB hex sugar; coerce and infer solidFill.\n const resolvedColor =\n typeof options.color === \"string\"\n ? { value: stripColorHashPrefix(options.color) }\n : options.color;\n const fillType = options.type ?? (resolvedColor ? \"solidFill\" : undefined);\n if (fillType === \"solidFill\" && resolvedColor) {\n return createSolidFill(resolvedColor);\n }\n if (fillType === \"gradFill\" && options.gradientFill) {\n return createGradientFill(options.gradientFill);\n }\n if (fillType === \"pattFill\" && options.patternFill) {\n return createPatternFill(options.patternFill);\n }\n return null;\n};\n\n/**\n * Creates an outline element for DrawingML shapes.\n *\n * The outline element specifies the line properties for the shape border,\n * including width, cap style, compound line type, alignment, dash, join, and fill.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_LineProperties\">\n * <xsd:sequence>\n * <xsd:group ref=\"EG_FillProperties\" minOccurs=\"0\"/>\n * <xsd:group ref=\"EG_LineDashProperties\" minOccurs=\"0\"/>\n * <xsd:group ref=\"EG_LineJoinProperties\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"w\" use=\"optional\" type=\"a:ST_LineWidth\"/>\n * <xsd:attribute name=\"cap\" use=\"optional\" type=\"ST_LineCap\"/>\n * <xsd:attribute name=\"cmpd\" use=\"optional\" type=\"ST_CompoundLine\"/>\n * <xsd:attribute name=\"algn\" use=\"optional\" type=\"ST_PenAlignment\"/>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * // Outline with RGB color and dash\n * const outline = createOutline({\n * width: 9525,\n * type: \"solidFill\",\n * color: { value: \"FF0000\" },\n * dash: \"dash\",\n * });\n * ```\n */\nexport const createOutline = (options: OutlineOptions): string => {\n const children: string[] = [];\n\n // Fill (optional per OOXML spec)\n const fill = createOutlineFill(options);\n if (fill) {\n children.push(fill);\n }\n\n // Dash (prstDash and custDash are mutually exclusive per XSD choice)\n if (options.customDash !== undefined) {\n children.push(createCustomDash(options.customDash));\n } else if (options.dash !== undefined) {\n children.push(`<a:prstDash val=\"${options.dash}\"/>`);\n }\n\n // Join\n if (options.join !== undefined) {\n if (options.join === \"miter\" && options.miterLimit !== undefined) {\n children.push(`<a:miter lim=\"${options.miterLimit}\"/>`);\n } else {\n children.push(`<a:${options.join}/>`);\n }\n }\n\n // Line end markers (arrows)\n if (options.headEnd) {\n children.push(createLineEnd(\"a:headEnd\", options.headEnd));\n }\n if (options.tailEnd) {\n children.push(createLineEnd(\"a:tailEnd\", options.tailEnd));\n }\n\n return element(\n \"a:ln\",\n {\n algn: options.alignment ? xsdPenAlignment.to(options.alignment) : undefined,\n cap: options.cap ? xsdLineCap.to(options.cap) : undefined,\n cmpd: options.compoundLine ? xsdCompoundLine.to(options.compoundLine) : undefined,\n w: options.width !== undefined ? convertToEmu(options.width) : undefined,\n },\n children,\n );\n};\n","/**\n * Fill overlay effect for DrawingML shapes.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_FillOverlayEffect\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { xsdBlendMode } from \"../../util/mappings\";\nimport { createSolidFill } from \"../color/solid-fill\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\nimport { createGradientFill } from \"../fill/gradient-fill\";\nimport type { GradientFillOptions } from \"../fill/gradient-fill\";\nimport { createGroupFill } from \"../fill/group-fill\";\nimport { createNoFill } from \"../fill/no-fill\";\nimport { createPatternFill } from \"../fill/pattern-fill\";\nimport type { PatternFillOptions } from \"../fill/pattern-fill\";\n\n/**\n * Blend modes for fill overlay effect.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_BlendMode\">\n * <xsd:restriction base=\"xsd:token\">\n * <xsd:enumeration value=\"over\"/>\n * <xsd:enumeration value=\"mult\"/>\n * <xsd:enumeration value=\"screen\"/>\n * <xsd:enumeration value=\"darken\"/>\n * <xsd:enumeration value=\"lighten\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n */\nexport const BlendMode = {\n /** Over blend mode */\n OVER: \"over\",\n /** Multiply blend mode */\n MULTIPLY: \"multiply\",\n /** Screen blend mode */\n SCREEN: \"screen\",\n /** Darken blend mode */\n DARKEN: \"darken\",\n /** Lighten blend mode */\n LIGHTEN: \"lighten\",\n} as const;\n\n/**\n * Options for fill overlay effect.\n */\nexport interface FillOverlayEffectOptions {\n /** Blend mode (required) */\n blend: (typeof BlendMode)[keyof typeof BlendMode];\n /** Solid fill color */\n solidFill?: SolidFillOptions;\n /** Gradient fill */\n gradientFill?: GradientFillOptions;\n /** Pattern fill */\n patternFill?: PatternFillOptions;\n /** Group fill (inherit from parent) */\n groupFill?: boolean;\n /** No fill */\n noFill?: boolean;\n}\n\n/**\n * Creates a fill overlay effect element.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_FillOverlayEffect\">\n * <xsd:sequence>\n * <xsd:group ref=\"EG_FillProperties\" minOccurs=\"1\" maxOccurs=\"1\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"blend\" type=\"ST_BlendMode\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * // Solid fill overlay\n * const fillOverlay = createFillOverlayEffect({\n * blend: BlendMode.MULTIPLY,\n * solidFill: { value: \"FF0000\" },\n * });\n *\n * // Gradient fill overlay\n * const fillOverlay = createFillOverlayEffect({\n * blend: BlendMode.SCREEN,\n * gradientFill: { type: \"linear\", stops: [...] },\n * });\n * ```\n */\nexport const createFillOverlayEffect = (options: FillOverlayEffectOptions): string => {\n let fillElement: string;\n\n if (options.noFill) {\n fillElement = createNoFill();\n } else if (options.solidFill) {\n fillElement = createSolidFill(options.solidFill);\n } else if (options.gradientFill) {\n fillElement = createGradientFill(options.gradientFill);\n } else if (options.patternFill) {\n fillElement = createPatternFill(options.patternFill);\n } else if (options.groupFill) {\n fillElement = createGroupFill();\n } else {\n // Default to solid fill if nothing specified\n fillElement = createSolidFill({ value: \"000000\" });\n }\n\n return element(\"a:fillOverlay\", { blend: xsdBlendMode.to(options.blend) }, [fillElement]);\n};\n","/**\n * Glow effect for DrawingML shapes.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GlowEffect\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { convertToEmu } from \"../../util/converters\";\nimport type { UniversalMeasure } from \"../../util/values\";\nimport { createColorElement } from \"../color/solid-fill\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\n\n/**\n * Options for glow effect.\n */\nexport interface GlowEffectOptions {\n /** Glow radius in EMUs (number) or UniversalMeasure (mm/cm/in/pt/pc/pi/px). */\n radius?: number | UniversalMeasure;\n /** Glow color */\n color: SolidFillOptions;\n}\n\n/**\n * Creates a glow effect element.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_GlowEffect\">\n * <xsd:sequence>\n * <xsd:group ref=\"EG_ColorChoice\" minOccurs=\"1\" maxOccurs=\"1\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"rad\" type=\"ST_PositiveCoordinate\" use=\"optional\" default=\"0\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createGlowEffect = (options: GlowEffectOptions): string => {\n const colorChild = createColorElement(options.color);\n if (options.radius === undefined) {\n return element(\"a:glow\", undefined, [colorChild]);\n }\n\n return element(\"a:glow\", { rad: convertToEmu(options.radius) }, [colorChild]);\n};\n","/**\n * Inner shadow effect for DrawingML shapes.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_InnerShadowEffect\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { convertToEmu } from \"../../util/converters\";\nimport type { UniversalMeasure } from \"../../util/values\";\nimport { createColorElement } from \"../color/solid-fill\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\n\n/**\n * Options for inner shadow effect.\n */\nexport interface InnerShadowEffectOptions {\n /** Blur radius in EMUs (number) or UniversalMeasure (mm/cm/in/pt/pc/pi/px). */\n blurRadius?: number | UniversalMeasure;\n /** Distance from shape edge in EMUs (number) or UniversalMeasure. */\n distance?: number | UniversalMeasure;\n /** Direction angle in degrees (0–360). */\n direction?: number;\n /** Shadow color */\n color: SolidFillOptions;\n}\n\n/**\n * Creates an inner shadow effect element.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_InnerShadowEffect\">\n * <xsd:sequence>\n * <xsd:group ref=\"EG_ColorChoice\" minOccurs=\"1\" maxOccurs=\"1\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"blurRad\" type=\"ST_PositiveCoordinate\" default=\"0\"/>\n * <xsd:attribute name=\"dist\" type=\"ST_PositiveCoordinate\" default=\"0\"/>\n * <xsd:attribute name=\"dir\" type=\"ST_PositiveFixedAngle\" default=\"0\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createInnerShadowEffect = (options: InnerShadowEffectOptions): string => {\n const colorChild = createColorElement(options.color);\n\n const attrs: Record<string, number> = {};\n if (options.blurRadius !== undefined) attrs.blurRad = convertToEmu(options.blurRadius);\n if (options.distance !== undefined) attrs.dist = convertToEmu(options.distance);\n if (options.direction !== undefined) attrs.dir = Math.round(options.direction * 60000);\n\n const hasAttributes = Object.keys(attrs).length > 0;\n\n return element(\"a:innerShdw\", hasAttributes ? attrs : undefined, [colorChild]);\n};\n","/**\n * Outer shadow effect for DrawingML shapes.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_OuterShadowEffect\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { convertToEmu } from \"../../util/converters\";\nimport { xsdRectAlignment } from \"../../util/mappings\";\nimport type { UniversalMeasure } from \"../../util/values\";\nimport { createColorElement } from \"../color/solid-fill\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\n\n/**\n * Rectangle alignment for shadow positioning.\n */\nexport type RectAlignment =\n | \"topLeft\"\n | \"top\"\n | \"topRight\"\n | \"left\"\n | \"center\"\n | \"right\"\n | \"bottomLeft\"\n | \"bottom\"\n | \"bottomRight\";\n\n/**\n * Options for outer shadow effect.\n */\nexport interface OuterShadowEffectOptions {\n /** Blur radius in EMUs (number) or UniversalMeasure (mm/cm/in/pt/pc/pi/px). */\n blurRadius?: number | UniversalMeasure;\n /** Distance from shape in EMUs (number) or UniversalMeasure. */\n distance?: number | UniversalMeasure;\n /** Direction angle in degrees (0–360). */\n direction?: number;\n /** Horizontal scale as integer percent (100 = 100%) */\n scaleX?: number;\n /** Vertical scale as integer percent */\n scaleY?: number;\n /** Horizontal skew angle in degrees. */\n skewX?: number;\n /** Vertical skew angle in degrees. */\n skewY?: number;\n /** Shadow alignment */\n alignment?: RectAlignment;\n /** Whether shadow rotates with shape */\n rotWithShape?: boolean;\n /** Shadow color */\n color: SolidFillOptions;\n}\n\n/**\n * Creates an outer shadow effect element.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_OuterShadowEffect\">\n * <xsd:sequence>\n * <xsd:group ref=\"EG_ColorChoice\" minOccurs=\"1\" maxOccurs=\"1\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"blurRad\" type=\"ST_PositiveCoordinate\" default=\"0\"/>\n * <xsd:attribute name=\"dist\" type=\"ST_PositiveCoordinate\" default=\"0\"/>\n * <xsd:attribute name=\"dir\" type=\"ST_PositiveFixedAngle\" default=\"0\"/>\n * <xsd:attribute name=\"sx\" type=\"ST_Percentage\" default=\"100%\"/>\n * <xsd:attribute name=\"sy\" type=\"ST_Percentage\" default=\"100%\"/>\n * <xsd:attribute name=\"kx\" type=\"ST_FixedAngle\" default=\"0\"/>\n * <xsd:attribute name=\"ky\" type=\"ST_FixedAngle\" default=\"0\"/>\n * <xsd:attribute name=\"algn\" type=\"ST_RectAlignment\" default=\"b\"/>\n * <xsd:attribute name=\"rotWithShape\" type=\"xsd:boolean\" default=\"true\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createOuterShadowEffect = (options: OuterShadowEffectOptions): string => {\n const attrs: Record<string, string | number> = {};\n\n if (options.blurRadius !== undefined) attrs.blurRad = convertToEmu(options.blurRadius);\n if (options.distance !== undefined) attrs.dist = convertToEmu(options.distance);\n if (options.direction !== undefined) attrs.dir = Math.round(options.direction * 60000);\n if (options.scaleX !== undefined) attrs.sx = Math.round(options.scaleX * 1000);\n if (options.scaleY !== undefined) attrs.sy = Math.round(options.scaleY * 1000);\n if (options.skewX !== undefined) attrs.kx = Math.round(options.skewX * 60000);\n if (options.skewY !== undefined) attrs.ky = Math.round(options.skewY * 60000);\n if (options.alignment !== undefined) attrs.algn = xsdRectAlignment.to(options.alignment);\n if (options.rotWithShape === false) attrs.rotWithShape = 0;\n\n return element(\"a:outerShdw\", attrs, [createColorElement(options.color)]);\n};\n","/**\n * Preset shadow effect for DrawingML shapes.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PresetShadowEffect\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { convertToEmu } from \"../../util/converters\";\nimport { xsdPresetShadow } from \"../../util/mappings\";\nimport type { UniversalMeasure } from \"../../util/values\";\nimport { createColorElement } from \"../color/solid-fill\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\n\n/**\n * Preset shadow types (20 variations).\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, ST_PresetShadowVal\n */\nexport type PresetShadow =\n | \"shadow1\"\n | \"shadow2\"\n | \"shadow3\"\n | \"shadow4\"\n | \"shadow5\"\n | \"shadow6\"\n | \"shadow7\"\n | \"shadow8\"\n | \"shadow9\"\n | \"shadow10\"\n | \"shadow11\"\n | \"shadow12\"\n | \"shadow13\"\n | \"shadow14\"\n | \"shadow15\"\n | \"shadow16\"\n | \"shadow17\"\n | \"shadow18\"\n | \"shadow19\"\n | \"shadow20\";\n\n/**\n * Options for preset shadow effect.\n */\nexport interface PresetShadowEffectOptions {\n /** Preset shadow type (required) */\n preset: PresetShadow;\n /** Distance from shape in EMUs (number) or UniversalMeasure. */\n distance?: number | UniversalMeasure;\n /** Direction angle in degrees (0–360). */\n direction?: number;\n /** Shadow color */\n color: SolidFillOptions;\n}\n\n/**\n * Creates a preset shadow effect element.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_PresetShadowEffect\">\n * <xsd:sequence>\n * <xsd:group ref=\"EG_ColorChoice\" minOccurs=\"1\" maxOccurs=\"1\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"prst\" type=\"ST_PresetShadowVal\" use=\"required\"/>\n * <xsd:attribute name=\"dist\" type=\"ST_PositiveCoordinate\" default=\"0\"/>\n * <xsd:attribute name=\"dir\" type=\"ST_PositiveFixedAngle\" default=\"0\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createPresetShadowEffect = (options: PresetShadowEffectOptions): string => {\n const attrs: Record<string, string | number> = {\n prst: xsdPresetShadow.to(options.preset),\n };\n\n if (options.distance !== undefined) attrs.dist = convertToEmu(options.distance);\n if (options.direction !== undefined) attrs.dir = Math.round(options.direction * 60000);\n\n return element(\"a:prstShdw\", attrs, [createColorElement(options.color)]);\n};\n","/**\n * Reflection effect for DrawingML shapes.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_ReflectionEffect\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { convertToEmu } from \"../../util/converters\";\nimport { xsdRectAlignment } from \"../../util/mappings\";\nimport type { UniversalMeasure } from \"../../util/values\";\n\n/**\n * Options for reflection effect.\n *\n * All properties are optional with XSD defaults.\n */\nexport interface ReflectionEffectOptions {\n /** Blur radius in EMUs (number) or UniversalMeasure (mm/cm/in/pt/pc/pi/px). */\n blurRadius?: number | UniversalMeasure;\n /** Start opacity as integer percent (100 = fully opaque) */\n startAlpha?: number;\n /** Start position as integer percent (0-100) */\n startPosition?: number;\n /** End opacity as integer percent */\n endAlpha?: number;\n /** End position as integer percent (0-100) */\n endPosition?: number;\n /** Distance from shape in EMUs (number) or UniversalMeasure. */\n distance?: number | UniversalMeasure;\n /** Direction angle in degrees (0–360). */\n direction?: number;\n /** Fade direction angle in degrees (0–360). */\n fadeDirection?: number;\n /** Horizontal scale as integer percent (100 = 100%) */\n scaleX?: number;\n /** Vertical scale as integer percent */\n scaleY?: number;\n /** Horizontal skew angle in degrees. */\n skewX?: number;\n /** Vertical skew angle in degrees. */\n skewY?: number;\n /** Alignment */\n alignment?: string;\n /** Whether reflection rotates with shape */\n rotWithShape?: boolean;\n}\n\n/**\n * Creates a reflection effect element.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_ReflectionEffect\">\n * <xsd:attribute name=\"blurRad\" type=\"ST_PositiveCoordinate\" default=\"0\"/>\n * <xsd:attribute name=\"stA\" type=\"ST_PositiveFixedPercentage\" default=\"100%\"/>\n * <xsd:attribute name=\"stPos\" type=\"ST_PositiveFixedPercentage\" default=\"0%\"/>\n * <xsd:attribute name=\"endA\" type=\"ST_PositiveFixedPercentage\" default=\"0%\"/>\n * <xsd:attribute name=\"endPos\" type=\"ST_PositiveFixedPercentage\" default=\"100%\"/>\n * <xsd:attribute name=\"dist\" type=\"ST_PositiveCoordinate\" default=\"0\"/>\n * <xsd:attribute name=\"dir\" type=\"ST_PositiveFixedAngle\" default=\"0\"/>\n * <xsd:attribute name=\"fadeDir\" type=\"ST_PositiveFixedAngle\" default=\"5400000\"/>\n * <xsd:attribute name=\"sx\" type=\"ST_Percentage\" default=\"100%\"/>\n * <xsd:attribute name=\"sy\" type=\"ST_Percentage\" default=\"100%\"/>\n * <xsd:attribute name=\"kx\" type=\"ST_FixedAngle\" default=\"0\"/>\n * <xsd:attribute name=\"ky\" type=\"ST_FixedAngle\" default=\"0\"/>\n * <xsd:attribute name=\"algn\" type=\"ST_RectAlignment\" default=\"b\"/>\n * <xsd:attribute name=\"rotWithShape\" type=\"xsd:boolean\" default=\"true\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createReflectionEffect = (options?: ReflectionEffectOptions): string => {\n if (!options) {\n return \"<a:reflection/>\";\n }\n\n const attrs: Record<string, string | number> = {};\n\n if (options.blurRadius !== undefined) attrs.blurRad = convertToEmu(options.blurRadius);\n if (options.startAlpha !== undefined) attrs.stA = Math.round(options.startAlpha * 1000);\n if (options.startPosition !== undefined) attrs.stPos = Math.round(options.startPosition * 1000);\n if (options.endAlpha !== undefined) attrs.endA = Math.round(options.endAlpha * 1000);\n if (options.endPosition !== undefined) attrs.endPos = Math.round(options.endPosition * 1000);\n if (options.distance !== undefined) attrs.dist = convertToEmu(options.distance);\n if (options.direction !== undefined) attrs.dir = Math.round(options.direction * 60000);\n if (options.fadeDirection !== undefined)\n attrs.fadeDir = Math.round(options.fadeDirection * 60000);\n if (options.scaleX !== undefined) attrs.sx = Math.round(options.scaleX * 1000);\n if (options.scaleY !== undefined) attrs.sy = Math.round(options.scaleY * 1000);\n if (options.skewX !== undefined) attrs.kx = Math.round(options.skewX * 60000);\n if (options.skewY !== undefined) attrs.ky = Math.round(options.skewY * 60000);\n if (options.alignment !== undefined) attrs.algn = xsdRectAlignment.to(options.alignment);\n if (options.rotWithShape === false) attrs.rotWithShape = 0;\n\n return element(\"a:reflection\", attrs);\n};\n","/**\n * Soft edge effect for DrawingML shapes.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SoftEdgesEffect\n *\n * @module\n */\nimport { convertToEmu } from \"../../util/converters\";\nimport type { UniversalMeasure } from \"../../util/values\";\n\n/**\n * Creates a soft edge effect element.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_SoftEdgesEffect\">\n * <xsd:attribute name=\"rad\" type=\"ST_PositiveCoordinate\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n *\n * @param rad - Soft edge radius in EMUs (number) or UniversalMeasure (required)\n */\nexport const createSoftEdgeEffect = (rad: number | UniversalMeasure): string =>\n `<a:softEdge rad=\"${convertToEmu(rad)}\"/>`;\n","/**\n * Effect list container for DrawingML shapes.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_EffectList, EG_EffectProperties\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { convertToEmu } from \"../../util/converters\";\nimport type { UniversalMeasure } from \"../../util/values\";\nimport type { FillOverlayEffectOptions } from \"./fill-overlay\";\nimport { createFillOverlayEffect } from \"./fill-overlay\";\nimport type { GlowEffectOptions } from \"./glow\";\nimport { createGlowEffect } from \"./glow\";\nimport type { InnerShadowEffectOptions } from \"./inner-shadow\";\nimport { createInnerShadowEffect } from \"./inner-shadow\";\nimport type { OuterShadowEffectOptions } from \"./outer-shadow\";\nimport { createOuterShadowEffect } from \"./outer-shadow\";\nimport type { PresetShadowEffectOptions } from \"./preset-shadow\";\nimport { createPresetShadowEffect } from \"./preset-shadow\";\nimport type { ReflectionEffectOptions } from \"./reflection\";\nimport { createReflectionEffect } from \"./reflection\";\nimport { createSoftEdgeEffect } from \"./soft-edge\";\n\n/**\n * Effect extent calculation result.\n * Represents the additional space needed on each edge (in EMUs).\n */\nexport interface EffectExtent {\n /** Left edge extension */\n l: number;\n /** Top edge extension */\n t: number;\n /** Right edge extension */\n r: number;\n /** Bottom edge extension */\n b: number;\n}\n\n/**\n * Calculates the effect extent for a given set of effects.\n *\n * The effectExtent specifies the additional extent which shall be added to each edge\n * of the image (top, bottom, left, right) in order to compensate for any drawing effects\n * applied to the DrawingML object.\n *\n * Reference: CT_EffectExtent in dml-wordprocessingDrawing.xsd\n *\n * @param options - Effect list options\n * @returns The calculated effect extent in EMUs\n */\nexport const calculateEffectExtent = (options?: EffectListOptions): EffectExtent => {\n if (!options) {\n return { l: 0, t: 0, r: 0, b: 0 };\n }\n\n let l = 0,\n t = 0,\n r = 0,\n b = 0;\n\n // Outer shadow: distance + blurRadius extends in the shadow direction\n if (options.outerShadow) {\n const dist = convertToEmu(options.outerShadow.distance ?? 0);\n const blur = convertToEmu(options.outerShadow.blurRadius ?? 0);\n const dir = options.outerShadow.direction ?? 0;\n\n // Direction is in degrees, convert to radians\n const radians = dir * (Math.PI / 180);\n const dx = Math.cos(radians) * dist;\n const dy = Math.sin(radians) * dist;\n\n // Shadow extends in direction + blur radius in all directions\n const extend = Math.abs(dx) + blur;\n const extendY = Math.abs(dy) + blur;\n\n if (dx > 0) r = Math.max(r, extend);\n else l = Math.max(l, extend);\n\n if (dy > 0) b = Math.max(b, extendY);\n else t = Math.max(t, extendY);\n }\n\n // Glow: radius extends equally in all directions\n if (options.glow) {\n const radius = convertToEmu(options.glow.radius ?? 0);\n l = Math.max(l, radius);\n t = Math.max(t, radius);\n r = Math.max(r, radius);\n b = Math.max(b, radius);\n }\n\n // Reflection: typically extends downward\n if (options.reflection && options.reflection !== true) {\n const dist = convertToEmu(options.reflection.distance ?? 0);\n const blur = convertToEmu(options.reflection.blurRadius ?? 0);\n // Reflection typically extends downward\n b = Math.max(b, dist + blur);\n }\n\n // Soft edge: radius extends equally in all directions\n if (options.softEdge !== undefined) {\n const softRad = convertToEmu(options.softEdge);\n l = Math.max(l, softRad);\n t = Math.max(t, softRad);\n r = Math.max(r, softRad);\n b = Math.max(b, softRad);\n }\n\n // EMU coordinates must be integers (ST_Coordinate); the cos/sin projections\n // above produce floats, so round before emitting.\n return { l: Math.round(l), t: Math.round(t), r: Math.round(r), b: Math.round(b) };\n};\n\n/**\n * Blur effect options.\n */\nexport interface BlurEffectOptions {\n /** Blur radius in EMUs */\n radius?: number;\n /** Whether to grow the shape boundary */\n grow?: boolean;\n}\n\n/**\n * Options for the effect list container.\n *\n * Each property corresponds to an optional child effect element.\n * Only specified effects will be included in the output.\n */\nexport interface EffectListOptions {\n /** Blur effect */\n blur?: BlurEffectOptions;\n /** Fill overlay effect */\n fillOverlay?: FillOverlayEffectOptions;\n /** Glow effect */\n glow?: GlowEffectOptions;\n /** Inner shadow effect */\n innerShadow?: InnerShadowEffectOptions;\n /** Outer shadow effect */\n outerShadow?: OuterShadowEffectOptions;\n /** Preset shadow effect */\n presetShadow?: PresetShadowEffectOptions;\n /** Reflection effect (pass object for attributes, or true for defaults) */\n reflection?: ReflectionEffectOptions | true;\n /** Soft edge radius in EMUs */\n softEdge?: number | UniversalMeasure;\n}\n\n/**\n * Creates a blur effect element.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_BlurEffect\">\n * <xsd:attribute name=\"rad\" type=\"ST_PositiveCoordinate\" default=\"0\"/>\n * <xsd:attribute name=\"grow\" type=\"xsd:boolean\" default=\"true\"/>\n * </xsd:complexType>\n * ```\n */\nconst createBlurEffect = (options: BlurEffectOptions): string => {\n const attrs: Record<string, number> = {};\n if (options.radius !== undefined) attrs.rad = options.radius;\n if (options.grow === false) attrs.grow = 0;\n\n return Object.keys(attrs).length > 0 ? element(\"a:blur\", attrs) : element(\"a:blur\");\n};\n\n/**\n * Creates an effect list element (a:effectLst).\n *\n * This is the EG_EffectProperties choice for a flat list of effects.\n * Effects are emitted in XSD order: blur, glow, innerShdw, outerShdw, prstShdw, reflection, softEdge.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_EffectList\">\n * <xsd:sequence>\n * <xsd:element name=\"blur\" type=\"CT_BlurEffect\" minOccurs=\"0\"/>\n * <xsd:element name=\"fillOverlay\" type=\"CT_FillOverlayEffect\" minOccurs=\"0\"/>\n * <xsd:element name=\"glow\" type=\"CT_GlowEffect\" minOccurs=\"0\"/>\n * <xsd:element name=\"innerShdw\" type=\"CT_InnerShadowEffect\" minOccurs=\"0\"/>\n * <xsd:element name=\"outerShdw\" type=\"CT_OuterShadowEffect\" minOccurs=\"0\"/>\n * <xsd:element name=\"prstShdw\" type=\"CT_PresetShadowEffect\" minOccurs=\"0\"/>\n * <xsd:element name=\"reflection\" type=\"CT_ReflectionEffect\" minOccurs=\"0\"/>\n * <xsd:element name=\"softEdge\" type=\"CT_SoftEdgesEffect\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * </xsd:complexType>\n * ```\n */\nexport const createEffectList = (options: EffectListOptions): string => {\n const children: string[] = [];\n\n if (options.blur) {\n children.push(createBlurEffect(options.blur));\n }\n if (options.fillOverlay) {\n children.push(createFillOverlayEffect(options.fillOverlay));\n }\n if (options.glow) {\n children.push(createGlowEffect(options.glow));\n }\n if (options.innerShadow) {\n children.push(createInnerShadowEffect(options.innerShadow));\n }\n if (options.outerShadow) {\n children.push(createOuterShadowEffect(options.outerShadow));\n }\n if (options.presetShadow) {\n children.push(createPresetShadowEffect(options.presetShadow));\n }\n if (options.reflection) {\n children.push(\n createReflectionEffect(options.reflection === true ? undefined : options.reflection),\n );\n }\n if (options.softEdge !== undefined) {\n children.push(createSoftEdgeEffect(options.softEdge));\n }\n\n return element(\"a:effectLst\", undefined, children);\n};\n","/**\n * Effect container (effectDag) for DrawingML shapes.\n *\n * Provides CT_EffectContainer — a directed acyclic graph (DAG) of effects\n * supporting 28 effect types including alpha/color operations, nested containers,\n * and all effects from CT_EffectList.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_EffectContainer, EG_Effect\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { xsdBlendMode, xsdEffectContainer } from \"../../util/mappings\";\nimport { createSolidFill } from \"../color/solid-fill\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\nimport { createColorElement } from \"../color/solid-fill\";\nimport { createGradientFill } from \"../fill/gradient-fill\";\nimport type { GradientFillOptions } from \"../fill/gradient-fill\";\nimport { createGroupFill } from \"../fill/group-fill\";\nimport { createNoFill } from \"../fill/no-fill\";\nimport { createPatternFill } from \"../fill/pattern-fill\";\nimport type { PatternFillOptions } from \"../fill/pattern-fill\";\nimport type { BlurEffectOptions } from \"./effect-list\";\nimport type { FillOverlayEffectOptions } from \"./fill-overlay\";\nimport { BlendMode } from \"./fill-overlay\";\nimport { createFillOverlayEffect } from \"./fill-overlay\";\nimport type { GlowEffectOptions } from \"./glow\";\nimport { createGlowEffect } from \"./glow\";\nimport type { InnerShadowEffectOptions } from \"./inner-shadow\";\nimport { createInnerShadowEffect } from \"./inner-shadow\";\nimport type { OuterShadowEffectOptions } from \"./outer-shadow\";\nimport { createOuterShadowEffect } from \"./outer-shadow\";\nimport type { PresetShadowEffectOptions } from \"./preset-shadow\";\nimport { createPresetShadowEffect } from \"./preset-shadow\";\nimport type { ReflectionEffectOptions } from \"./reflection\";\nimport { createReflectionEffect } from \"./reflection\";\nimport { createSoftEdgeEffect } from \"./soft-edge\";\n\n// ─── Effect Container Type ──────────────────────────────────────────────────\n\n/**\n * Effect container type (ST_EffectContainerType).\n *\n * Controls how child effects are combined:\n * - `sib`: sibling effects are applied in parallel\n * - `tree`: effects are applied sequentially in tree order\n *\n * Note: the `sib` token maps to the `\"sibling\"` value accepted here.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_EffectContainerType\">\n * <xsd:restriction base=\"xsd:token\">\n * <xsd:enumeration value=\"sib\"/>\n * <xsd:enumeration value=\"tree\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n */\nexport type EffectContainer = \"sibling\" | \"tree\";\n\n// ─── Effect Options ─────────────────────────────────────────────────────────\n// Shared CT_* effect option types live in blip-effects.ts (single home);\n// this module re-exports them for the effect-DAG path.\n\nimport type {\n AlphaBiLevelEffectOptions,\n AlphaModulateFixedEffectOptions,\n AlphaReplaceEffectOptions,\n ColorChangeEffectOptions,\n DuotoneEffectOptions,\n HSLEffectOptions,\n LuminanceEffectOptions,\n TintEffectOptions,\n} from \"../blip/blip-effects\";\n\nexport type {\n AlphaBiLevelEffectOptions,\n AlphaModulateFixedEffectOptions,\n AlphaReplaceEffectOptions,\n ColorChangeEffectOptions,\n DuotoneEffectOptions,\n HSLEffectOptions,\n LuminanceEffectOptions,\n TintEffectOptions,\n} from \"../blip/blip-effects\";\n\n/** Alpha inverse effect — inverts alpha, optionally with color (CT_AlphaInverseEffect). */\nexport interface AlphaInverseEffectOptions {\n /** Optional color to apply inverse to */\n color?: SolidFillOptions;\n}\n\n/** Alpha outset effect (CT_AlphaOutsetEffect). */\nexport interface AlphaOutsetEffectOptions {\n /** Outset radius */\n radius?: number;\n}\n\n/** Blend effect — blends with nested container (CT_BlendEffect). */\nexport interface BlendEffectOptions {\n /** Blend mode (required) */\n blend: (typeof BlendMode)[keyof typeof BlendMode];\n /** Nested effect container */\n container: EffectDagOptions;\n}\n\n/** Fill effect — applies a fill as an effect (CT_FillEffect). */\nexport interface FillEffectOptions {\n /** Solid fill */\n solidFill?: SolidFillOptions;\n /** Gradient fill */\n gradientFill?: GradientFillOptions;\n /** Pattern fill */\n patternFill?: PatternFillOptions;\n /** Group fill (inherit from parent) */\n groupFill?: boolean;\n /** No fill */\n noFill?: boolean;\n}\n\n/** Relative offset effect (CT_RelativeOffsetEffect). */\nexport interface RelativeOffsetEffectOptions {\n /** Horizontal offset percentage (default 0%) */\n translateX?: number;\n /** Vertical offset percentage (default 0%) */\n translateY?: number;\n}\n\n/** Transform effect — scale, skew, translate (CT_TransformEffect). */\nexport interface TransformEffectOptions {\n /** Horizontal scale percentage (default 100%) */\n scaleX?: number;\n /** Vertical scale percentage (default 100%) */\n scaleY?: number;\n /** Horizontal skew angle in degrees (default 0). */\n skewX?: number;\n /** Vertical skew angle in degrees (default 0). */\n skewY?: number;\n /** Horizontal translation */\n translateX?: number;\n /** Vertical translation */\n translateY?: number;\n}\n\n/** Effect reference — references an effect by ID (CT_EffectReference). */\nexport interface EffectReferenceOptions {\n /** Reference ID (required) */\n ref: string;\n}\n\n// ─── Effect Container Options ───────────────────────────────────────────────\n\n/**\n * Options for an effect container (CT_EffectContainer).\n *\n * Supports all 28 effect types from EG_Effect, including recursive nesting.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_EffectContainer\">\n * <xsd:group ref=\"EG_Effect\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n * <xsd:attribute name=\"type\" type=\"ST_EffectContainerType\" default=\"sib\"/>\n * <xsd:attribute name=\"name\" type=\"xsd:token\"/>\n * </xsd:complexType>\n * ```\n */\nexport interface EffectDagOptions {\n /** Container type: \"sib\" (parallel) or \"tree\" (sequential) */\n type?: EffectContainer;\n /** Container name */\n name?: string;\n\n // ── Existing effects (also in CT_EffectList) ──\n blur?: BlurEffectOptions;\n fillOverlay?: FillOverlayEffectOptions;\n glow?: GlowEffectOptions;\n innerShadow?: InnerShadowEffectOptions;\n outerShadow?: OuterShadowEffectOptions;\n presetShadow?: PresetShadowEffectOptions;\n reflection?: ReflectionEffectOptions | true;\n softEdge?: number;\n\n // ── New effects for CT_EffectContainer ──\n /** Nested effect containers */\n containers?: readonly EffectDagOptions[];\n /** Effect references */\n effectRefs?: readonly EffectReferenceOptions[];\n /** Alpha bi-level effect */\n alphaBiLevel?: AlphaBiLevelEffectOptions;\n /** Alpha ceiling effect (empty element) */\n alphaCeiling?: boolean;\n /** Alpha floor effect (empty element) */\n alphaFloor?: boolean;\n /** Alpha inverse effect */\n alphaInverse?: AlphaInverseEffectOptions;\n /** Alpha modulate effect (requires nested container) */\n alphaModulate?: EffectDagOptions;\n /** Alpha modulate fixed effect */\n alphaModulateFixed?: AlphaModulateFixedEffectOptions;\n /** Alpha outset effect */\n alphaOutset?: AlphaOutsetEffectOptions;\n /** Alpha replace effect */\n alphaReplace?: AlphaReplaceEffectOptions;\n /** Bi-level effect (threshold) */\n biLevel?: { threshold: number };\n /** Blend effect (requires nested container) */\n blend?: BlendEffectOptions;\n /** Color change effect */\n colorChange?: ColorChangeEffectOptions;\n /** Color replace effect */\n colorReplace?: SolidFillOptions;\n /** Duotone effect */\n duotone?: DuotoneEffectOptions;\n /** Fill effect */\n fill?: FillEffectOptions;\n /** Grayscale effect (empty element) */\n grayscale?: boolean;\n /** HSL effect */\n hsl?: HSLEffectOptions;\n /** Luminance effect */\n luminance?: LuminanceEffectOptions;\n /** Tint effect */\n tint?: TintEffectOptions;\n /** Relative offset effect */\n relativeOffset?: RelativeOffsetEffectOptions;\n /** Transform effect */\n transform?: TransformEffectOptions;\n}\n\n// ─── New Effect Factories ───────────────────────────────────────────────────\n\nconst createAlphaBiLevelEffect = (options: AlphaBiLevelEffectOptions): string =>\n `<a:alphaBiLevel thresh=\"${options.threshold}\"/>`;\n\nconst createAlphaCeilingEffect = (): string => \"<a:alphaCeiling/>\";\n\nconst createAlphaFloorEffect = (): string => \"<a:alphaFloor/>\";\n\nconst createAlphaInverseEffect = (options?: AlphaInverseEffectOptions): string =>\n element(\n \"a:alphaInv\",\n undefined,\n options?.color ? [createColorElement(options.color)] : undefined,\n );\n\nconst createAlphaModulateFixedEffect = (options?: AlphaModulateFixedEffectOptions): string =>\n options?.amount === undefined\n ? \"<a:alphaModFix/>\"\n : `<a:alphaModFix amt=\"${Math.round(options.amount * 1000)}\"/>`;\n\nconst createAlphaOutsetEffect = (options?: AlphaOutsetEffectOptions): string =>\n options?.radius === undefined ? \"<a:alphaOutset/>\" : `<a:alphaOutset rad=\"${options.radius}\"/>`;\n\nconst createAlphaReplaceEffect = (options: AlphaReplaceEffectOptions): string =>\n `<a:alphaRepl a=\"${Math.round(options.alpha * 1000)}\"/>`;\n\nconst createBiLevelEffect = (thresh: number): string =>\n `<a:biLevel thresh=\"${Math.round(thresh * 1000)}\"/>`;\n\nconst createBlendEffect = (options: BlendEffectOptions): string =>\n element(\"a:blend\", { blend: xsdBlendMode.to(options.blend) }, [\n createEffectContainer(options.container),\n ]);\n\nconst createColorChangeEffect = (options: ColorChangeEffectOptions): string => {\n const children: string[] = [\n element(\"a:clrFrom\", undefined, [createColorElement(options.from)]),\n element(\"a:clrTo\", undefined, [createColorElement(options.to)]),\n ];\n\n if (options.useAlpha === false) {\n return element(\"a:clrChange\", { useA: 0 }, children);\n }\n\n return element(\"a:clrChange\", undefined, children);\n};\n\nconst createColorReplaceEffect = (color: SolidFillOptions): string =>\n element(\"a:clrRepl\", undefined, [createColorElement(color)]);\n\nconst createDuotoneEffect = (options: DuotoneEffectOptions): string =>\n element(\"a:duotone\", undefined, [\n createColorElement(options.color1),\n createColorElement(options.color2),\n ]);\n\nconst createFillEffect = (options: FillEffectOptions): string => {\n let fillElement: string;\n\n if (options.noFill) {\n fillElement = createNoFill();\n } else if (options.solidFill) {\n fillElement = createSolidFill(options.solidFill);\n } else if (options.gradientFill) {\n fillElement = createGradientFill(options.gradientFill);\n } else if (options.patternFill) {\n fillElement = createPatternFill(options.patternFill);\n } else if (options.groupFill) {\n fillElement = createGroupFill();\n } else {\n fillElement = createNoFill();\n }\n\n return element(\"a:fill\", undefined, [fillElement]);\n};\n\nconst createGrayscaleEffect = (): string => \"<a:grayscl/>\";\n\nconst createHSLEffect = (options?: HSLEffectOptions): string => {\n const attrs: Record<string, number> = {};\n if (options?.hue !== undefined) attrs.hue = Math.round(options.hue * 60000);\n if (options?.saturation !== undefined) attrs.sat = options.saturation;\n if (options?.luminance !== undefined) attrs.lum = options.luminance;\n return element(\"a:hsl\", Object.keys(attrs).length > 0 ? attrs : undefined);\n};\n\nconst createLuminanceEffect = (options?: LuminanceEffectOptions): string => {\n const attrs: Record<string, number> = {};\n if (options?.bright !== undefined) attrs.bright = Math.round(options.bright * 1000);\n if (options?.contrast !== undefined) attrs.contrast = Math.round(options.contrast * 1000);\n return element(\"a:lum\", Object.keys(attrs).length > 0 ? attrs : undefined);\n};\n\nconst createTintEffect = (options?: TintEffectOptions): string => {\n const attrs: Record<string, number> = {};\n if (options?.hue !== undefined) attrs.hue = Math.round(options.hue * 60000);\n if (options?.amount !== undefined) attrs.amt = Math.round(options.amount * 1000);\n return element(\"a:tint\", Object.keys(attrs).length > 0 ? attrs : undefined);\n};\n\nconst createRelativeOffsetEffect = (options?: RelativeOffsetEffectOptions): string => {\n const attrs: Record<string, number> = {};\n if (options?.translateX !== undefined) attrs.tx = Math.round(options.translateX * 1000);\n if (options?.translateY !== undefined) attrs.ty = Math.round(options.translateY * 1000);\n return element(\"a:relOff\", Object.keys(attrs).length > 0 ? attrs : undefined);\n};\n\nconst createTransformEffect = (options?: TransformEffectOptions): string => {\n const attrs: Record<string, number> = {};\n if (options?.scaleX !== undefined) attrs.sx = Math.round(options.scaleX * 1000);\n if (options?.scaleY !== undefined) attrs.sy = Math.round(options.scaleY * 1000);\n if (options?.skewX !== undefined) attrs.kx = Math.round(options.skewX * 60000);\n if (options?.skewY !== undefined) attrs.ky = Math.round(options.skewY * 60000);\n if (options?.translateX !== undefined) attrs.tx = options.translateX;\n if (options?.translateY !== undefined) attrs.ty = options.translateY;\n return element(\"a:xfrm\", Object.keys(attrs).length > 0 ? attrs : undefined);\n};\n\nconst createEffectReference = (options: EffectReferenceOptions): string =>\n `<a:effect ref=\"${options.ref}\"/>`;\n\n// ─── Blur Effect (from effect-list, re-implemented for DAG) ─────────────────\n\nconst createBlurEffect = (options: BlurEffectOptions): string => {\n const attrs: Record<string, number> = {};\n if (options.radius !== undefined) attrs.rad = options.radius;\n if (options.grow === false) attrs.grow = 0;\n return element(\"a:blur\", Object.keys(attrs).length > 0 ? attrs : undefined);\n};\n\n// ─── Effect Container ───────────────────────────────────────────────────────\n\n/**\n * Creates an effect container element (a:effectDag or a:cont).\n *\n * This is the CT_EffectContainer type — a recursive DAG of effects.\n * All 28 EG_Effect types are supported.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_EffectContainer\">\n * <xsd:group ref=\"EG_Effect\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n * <xsd:attribute name=\"type\" type=\"ST_EffectContainerType\" default=\"sib\"/>\n * <xsd:attribute name=\"name\" type=\"xsd:token\" use=\"optional\"/>\n * </xsd:complexType>\n * ```\n *\n * @param options - Container options with effects\n * @param elementName - Element name, defaults to \"a:cont\" for top-level\n */\nconst createEffectContainer = (options: EffectDagOptions, elementName = \"a:cont\"): string => {\n const attrs: Record<string, string | number> = {};\n if (options.type) attrs.type = xsdEffectContainer.to(options.type);\n if (options.name) attrs.name = options.name;\n\n const children: string[] = [];\n\n // ── Existing effects (also in CT_EffectList) ──\n if (options.blur) {\n children.push(createBlurEffect(options.blur));\n }\n if (options.fillOverlay) {\n children.push(createFillOverlayEffect(options.fillOverlay));\n }\n if (options.glow) {\n children.push(createGlowEffect(options.glow));\n }\n if (options.innerShadow) {\n children.push(createInnerShadowEffect(options.innerShadow));\n }\n if (options.outerShadow) {\n children.push(createOuterShadowEffect(options.outerShadow));\n }\n if (options.presetShadow) {\n children.push(createPresetShadowEffect(options.presetShadow));\n }\n if (options.reflection) {\n children.push(\n createReflectionEffect(options.reflection === true ? undefined : options.reflection),\n );\n }\n if (options.softEdge !== undefined) {\n children.push(createSoftEdgeEffect(options.softEdge));\n }\n\n // ── New effects for CT_EffectContainer ──\n if (options.containers) {\n for (const nested of options.containers) {\n children.push(createEffectContainer(nested));\n }\n }\n if (options.effectRefs) {\n for (const ref of options.effectRefs) {\n children.push(createEffectReference(ref));\n }\n }\n if (options.alphaBiLevel) {\n children.push(createAlphaBiLevelEffect(options.alphaBiLevel));\n }\n if (options.alphaCeiling) {\n children.push(createAlphaCeilingEffect());\n }\n if (options.alphaFloor) {\n children.push(createAlphaFloorEffect());\n }\n if (options.alphaInverse) {\n children.push(createAlphaInverseEffect(options.alphaInverse));\n }\n if (options.alphaModulate) {\n children.push(element(\"a:alphaMod\", undefined, [createEffectContainer(options.alphaModulate)]));\n }\n if (options.alphaModulateFixed) {\n children.push(createAlphaModulateFixedEffect(options.alphaModulateFixed));\n }\n if (options.alphaOutset) {\n children.push(createAlphaOutsetEffect(options.alphaOutset));\n }\n if (options.alphaReplace) {\n children.push(createAlphaReplaceEffect(options.alphaReplace));\n }\n if (options.biLevel) {\n children.push(createBiLevelEffect(options.biLevel.threshold));\n }\n if (options.blend) {\n children.push(createBlendEffect(options.blend));\n }\n if (options.colorChange) {\n children.push(createColorChangeEffect(options.colorChange));\n }\n if (options.colorReplace) {\n children.push(createColorReplaceEffect(options.colorReplace));\n }\n if (options.duotone) {\n children.push(createDuotoneEffect(options.duotone));\n }\n if (options.fill) {\n children.push(createFillEffect(options.fill));\n }\n if (options.grayscale) {\n children.push(createGrayscaleEffect());\n }\n if (options.hsl) {\n children.push(createHSLEffect(options.hsl));\n }\n if (options.luminance) {\n children.push(createLuminanceEffect(options.luminance));\n }\n if (options.tint) {\n children.push(createTintEffect(options.tint));\n }\n if (options.relativeOffset) {\n children.push(createRelativeOffsetEffect(options.relativeOffset));\n }\n if (options.transform) {\n children.push(createTransformEffect(options.transform));\n }\n\n return element(\n elementName,\n Object.keys(attrs).length > 0 ? attrs : undefined,\n children.length > 0 ? children : undefined,\n );\n};\n\n/**\n * Creates an effect DAG element (a:effectDag).\n *\n * This is the EG_EffectProperties choice alternative to effectLst,\n * supporting all 28 effect types with recursive nesting.\n *\n * @example\n * ```typescript\n * // Simple effect DAG with glow and outer shadow\n * createEffectDag({\n * glow: { radius: 50800, color: { value: \"FF0000\" } },\n * outerShadow: { color: { value: \"000000\" }, blurRadius: 76200 },\n * });\n *\n * // DAG with alpha effects and nested container\n * createEffectDag({\n * type: \"tree\",\n * alphaBiLevel: { threshold: 50 },\n * containers: [{\n * glow: { color: { value: \"FF0000\" } },\n * }],\n * });\n * ```\n */\nexport const createEffectDag = (options: EffectDagOptions): string =>\n createEffectContainer(options, \"a:effectDag\");\n","/**\n * 3D scene module for DrawingML shapes.\n *\n * Provides CT_Scene3D — the 3D scene properties including camera, light rig,\n * and optional backdrop that define how a 3D shape is rendered.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Scene3D\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\n// ─── Sphere Coordinates ─────────────────────────────────────────────────────\n\n/**\n * Sphere coordinates (CT_SphereCoords).\n *\n * Used for camera and light rig rotation. All angles are in degrees.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_SphereCoords\">\n * <xsd:attribute name=\"lat\" type=\"ST_PositiveFixedAngle\" use=\"required\"/>\n * <xsd:attribute name=\"lon\" type=\"ST_PositiveFixedAngle\" use=\"required\"/>\n * <xsd:attribute name=\"rev\" type=\"ST_PositiveFixedAngle\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n */\nexport interface SphereCoords {\n /** Latitude angle in degrees (0–360). */\n lat: number;\n /** Longitude angle in degrees (0–360). */\n lon: number;\n /** Revolution angle in degrees (0–360). */\n rev: number;\n}\n\nconst createSphereCoords = (coords: SphereCoords): string => {\n const lat = Math.round(coords.lat * 60000);\n const lon = Math.round(coords.lon * 60000);\n const rev = Math.round(coords.rev * 60000);\n return `<a:rot lat=\"${lat}\" lon=\"${lon}\" rev=\"${rev}\"/>`;\n};\n\n// ─── Camera ─────────────────────────────────────────────────────────────────\n\n/**\n * Camera options (CT_Camera).\n *\n * Defines the camera type and optional rotation for the 3D scene.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_Camera\">\n * <xsd:sequence>\n * <xsd:element name=\"rot\" type=\"CT_SphereCoords\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"prst\" type=\"ST_PresetCameraType\" use=\"required\"/>\n * <xsd:attribute name=\"fov\" type=\"ST_FOVAngle\" use=\"optional\"/>\n * <xsd:attribute name=\"zoom\" type=\"ST_PositivePercentage\" use=\"optional\" default=\"100%\"/>\n * </xsd:complexType>\n * ```\n */\nexport interface CameraOptions {\n /** Preset camera type (e.g., \"perspectiveFront\", \"isometricTopUp\") */\n preset: string;\n /** Field of view angle in degrees (0–180). */\n fov?: number;\n /** Zoom percentage (e.g., \"100%\") */\n zoom?: string;\n /** Camera rotation */\n rotation?: SphereCoords;\n}\n\nconst createCamera = (options: CameraOptions): string => {\n const children: string[] = [];\n if (options.rotation) {\n children.push(createSphereCoords(options.rotation));\n }\n\n return element(\n \"a:camera\",\n {\n prst: options.preset,\n fov: options.fov !== undefined ? Math.round(options.fov * 60000) : undefined,\n zoom: options.zoom,\n },\n children,\n );\n};\n\n// ─── Light Rig ──────────────────────────────────────────────────────────────\n\n/**\n * Light rig options (CT_LightRig).\n *\n * Defines the lighting setup for the 3D scene.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_LightRig\">\n * <xsd:sequence>\n * <xsd:element name=\"rot\" type=\"CT_SphereCoords\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"rig\" type=\"ST_LightRigType\" use=\"required\"/>\n * <xsd:attribute name=\"dir\" type=\"ST_LightRigDirection\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n */\nexport interface LightRigOptions {\n /** Light rig type (e.g., \"threePt\", \"balanced\", \"soft\") */\n rig: string;\n /** Light direction (e.g., \"tl\", \"t\", \"tr\", \"l\", \"r\", \"bl\", \"b\", \"br\") */\n direction: string;\n /** Light rig rotation */\n rotation?: SphereCoords;\n}\n\nconst createLightRig = (options: LightRigOptions): string => {\n const children: string[] = [];\n if (options.rotation) {\n children.push(createSphereCoords(options.rotation));\n }\n\n return element(\"a:lightRig\", { rig: options.rig, dir: options.direction }, children);\n};\n\n// ─── Backdrop ───────────────────────────────────────────────────────────────\n\n/**\n * 3D point (CT_Point3D).\n */\nexport interface Point3D {\n x: number;\n y: number;\n z: number;\n}\n\n/**\n * 3D vector (CT_Vector3D).\n */\nexport interface Vector3D {\n dx: number;\n dy: number;\n dz: number;\n}\n\n/**\n * Backdrop options (CT_Backdrop).\n *\n * Defines the backdrop plane for the 3D scene.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_Backdrop\">\n * <xsd:sequence>\n * <xsd:element name=\"anchor\" type=\"CT_Point3D\" use=\"required\"/>\n * <xsd:element name=\"norm\" type=\"CT_Vector3D\" use=\"required\"/>\n * <xsd:element name=\"up\" type=\"CT_Vector3D\" use=\"required\"/>\n * </xsd:sequence>\n * </xsd:complexType>\n * ```\n */\nexport interface BackdropOptions {\n /** Anchor point */\n anchor: Point3D;\n /** Normal vector */\n normal: Vector3D;\n /** Up vector */\n up: Vector3D;\n}\n\nconst createPoint3D = (name: string, point: Point3D): string =>\n `<${name} x=\"${point.x}\" y=\"${point.y}\" z=\"${point.z}\"/>`;\n\nconst createVector3D = (name: string, vector: Vector3D): string =>\n `<${name} dx=\"${vector.dx}\" dy=\"${vector.dy}\" dz=\"${vector.dz}\"/>`;\n\nconst createBackdrop = (options: BackdropOptions): string =>\n element(\"a:backdrop\", undefined, [\n createPoint3D(\"a:anchor\", options.anchor),\n createVector3D(\"a:norm\", options.normal),\n createVector3D(\"a:up\", options.up),\n ]);\n\n// ─── Scene 3D ───────────────────────────────────────────────────────────────\n\n/**\n * Options for a 3D scene (CT_Scene3D).\n *\n * Both `camera` and `lightRig` are required. `backdrop` is optional.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_Scene3D\">\n * <xsd:sequence>\n * <xsd:element name=\"camera\" type=\"CT_Camera\" minOccurs=\"1\"/>\n * <xsd:element name=\"lightRig\" type=\"CT_LightRig\" minOccurs=\"1\"/>\n * <xsd:element name=\"backdrop\" type=\"CT_Backdrop\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * createScene3D({\n * camera: { preset: \"perspectiveFront\" },\n * lightRig: { rig: \"threePt\", direction: \"t\" },\n * });\n * ```\n */\nexport interface Scene3DOptions {\n /** Camera settings (required) */\n camera: CameraOptions;\n /** Light rig settings (required) */\n lightRig: LightRigOptions;\n /** Backdrop settings (optional) */\n backdrop?: BackdropOptions;\n}\n\n/**\n * Creates a 3D scene element (a:scene3d).\n *\n * @example\n * ```typescript\n * // Simple scene with default camera and lighting\n * createScene3D({\n * camera: { preset: \"perspectiveFront\" },\n * lightRig: { rig: \"threePt\", direction: \"t\" },\n * });\n *\n * // Scene with rotated camera and backdrop\n * createScene3D({\n * camera: {\n * preset: \"isometricTopUp\",\n * rotation: { lat: 0, lon: 0, rev: 90 },\n * },\n * lightRig: { rig: \"balanced\", direction: \"tl\" },\n * backdrop: {\n * anchor: { x: 0, y: 0, z: 0 },\n * normal: { dx: 0, dy: 0, dz: 1 },\n * up: { dx: 0, dy: 1, dz: 0 },\n * },\n * });\n * ```\n */\nexport const createScene3D = (options: Scene3DOptions): string => {\n const children: string[] = [createCamera(options.camera), createLightRig(options.lightRig)];\n\n if (options.backdrop) {\n children.push(createBackdrop(options.backdrop));\n }\n\n return element(\"a:scene3d\", undefined, children);\n};\n","/**\n * Bevel element for DrawingML 3D shapes.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Bevel\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\n/**\n * Bevel preset types (12 variations).\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, ST_BevelPresetType\n */\nexport type BevelPreset =\n | \"relaxedInset\"\n | \"circle\"\n | \"slope\"\n | \"cross\"\n | \"angle\"\n | \"softRound\"\n | \"convex\"\n | \"coolSlant\"\n | \"divot\"\n | \"riblet\"\n | \"hardEdge\"\n | \"artDeco\";\n\n/**\n * Options for a bevel element.\n */\nexport interface BevelOptions {\n /** Bevel width in EMUs (default 76200) */\n w?: number;\n /** Bevel height in EMUs (default 76200) */\n h?: number;\n /** Bevel preset type */\n prst?: BevelPreset;\n}\n\n/**\n * Creates a bevel element.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_Bevel\">\n * <xsd:attribute name=\"w\" type=\"ST_PositiveCoordinate\" default=\"76200\"/>\n * <xsd:attribute name=\"h\" type=\"ST_PositiveCoordinate\" default=\"76200\"/>\n * <xsd:attribute name=\"prst\" type=\"ST_BevelPresetType\" default=\"circle\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createBevel = (options?: BevelOptions): string => {\n if (!options) {\n return `<a:bevelT/>`;\n }\n\n const attrs: Record<string, string | number> = {};\n\n if (options.w !== undefined) {\n attrs.w = options.w;\n }\n if (options.h !== undefined) {\n attrs.h = options.h;\n }\n if (options.prst !== undefined) {\n attrs.prst = options.prst;\n }\n\n return element(\"a:bevelT\", attrs);\n};\n\n/**\n * Creates a bottom bevel element (a:bevelB).\n */\nexport const createBottomBevel = (options?: BevelOptions): string => {\n if (!options) {\n return `<a:bevelB/>`;\n }\n\n const attrs: Record<string, string | number> = {};\n\n if (options.w !== undefined) {\n attrs.w = options.w;\n }\n if (options.h !== undefined) {\n attrs.h = options.h;\n }\n if (options.prst !== undefined) {\n attrs.prst = options.prst;\n }\n\n return element(\"a:bevelB\", attrs);\n};\n","/**\n * 3D shape properties for DrawingML.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Shape3D\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { xsdMaterialType } from \"../../util/mappings\";\nimport { createColorElement } from \"../color/solid-fill\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\nimport { createBevel, createBottomBevel } from \"./bevel\";\nimport type { BevelOptions } from \"./bevel\";\n\n/**\n * Preset material types for 3D shapes (15 variations).\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, ST_PresetMaterialType\n */\nexport type PresetMaterial =\n | \"legacyMatte\"\n | \"legacyPlastic\"\n | \"legacyMetal\"\n | \"legacyWireframe\"\n | \"matte\"\n | \"plastic\"\n | \"metal\"\n | \"warmMatte\"\n | \"translucentPowder\"\n | \"powder\"\n | \"darkEdge\"\n | \"softEdge\"\n | \"clear\"\n | \"flat\"\n | \"softMetal\";\n\n/**\n * Options for 3D shape properties.\n */\nexport interface Shape3DOptions {\n /** Top bevel options */\n bevelT?: BevelOptions;\n /** Bottom bevel options */\n bevelB?: BevelOptions;\n /** Extrusion color (CT_Color / EG_ColorChoice) */\n extrusionColor?: SolidFillOptions;\n /** Contour color (CT_Color / EG_ColorChoice) */\n contourColor?: SolidFillOptions;\n /** Depth in EMUs (default 0) */\n z?: number;\n /** Extrusion height in EMUs (default 0) */\n extrusionH?: number;\n /** Contour width in EMUs (default 0) */\n contourW?: number;\n /** Material preset type */\n prstMaterial?: PresetMaterial;\n}\n\n/**\n * Creates a 3D shape properties element (a:sp3d).\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_Shape3D\">\n * <xsd:sequence>\n * <xsd:element name=\"bevelT\" type=\"CT_Bevel\" minOccurs=\"0\"/>\n * <xsd:element name=\"bevelB\" type=\"CT_Bevel\" minOccurs=\"0\"/>\n * <xsd:element name=\"extrusionClr\" type=\"CT_Color\" minOccurs=\"0\"/>\n * <xsd:element name=\"contourClr\" type=\"CT_Color\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"z\" type=\"ST_Coordinate\" default=\"0\"/>\n * <xsd:attribute name=\"extrusionH\" type=\"ST_PositiveCoordinate\" default=\"0\"/>\n * <xsd:attribute name=\"contourW\" type=\"ST_PositiveCoordinate\" default=\"0\"/>\n * <xsd:attribute name=\"prstMaterial\" type=\"ST_PresetMaterialType\" default=\"warmMatte\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createShape3D = (options: Shape3DOptions): string => {\n const children: string[] = [];\n\n if (options.bevelT) {\n children.push(createBevel(options.bevelT));\n }\n if (options.bevelB) {\n children.push(createBottomBevel(options.bevelB));\n }\n if (options.extrusionColor) {\n children.push(\n element(\"a:extrusionClr\", undefined, [createColorElement(options.extrusionColor)]),\n );\n }\n if (options.contourColor) {\n children.push(element(\"a:contourClr\", undefined, [createColorElement(options.contourColor)]));\n }\n\n const attrs: Record<string, string | number> = {};\n if (options.z !== undefined) attrs.z = options.z;\n if (options.extrusionH !== undefined) attrs.extrusionH = options.extrusionH;\n if (options.contourW !== undefined) attrs.contourW = options.contourW;\n if (options.prstMaterial !== undefined)\n attrs.prstMaterial = xsdMaterialType.to(options.prstMaterial);\n\n return element(\"a:sp3d\", attrs, children);\n};\n","/**\n * Adjustment values module for preset geometries.\n *\n * @module\n */\n\nimport { escapeXml } from \"@office-open/xml\";\n\n/**\n * A single geometry guide that defines an adjustment value.\n */\nexport interface GeometryGuide {\n /** Guide name (identifier) */\n name: string;\n /** Guide formula (e.g., \"val 16667\") */\n formula: string;\n}\n\n/**\n * Build a:avLst XML string from geometry guides.\n */\nexport function stringifyAdjustmentValues(guides?: readonly GeometryGuide[]): string {\n if (!guides || guides.length === 0) return \"<a:avLst/>\";\n const inner = guides\n .map((g) => `<a:gd name=\"${escapeXml(g.name)}\" fmla=\"${escapeXml(g.formula)}\"/>`)\n .join(\"\");\n return `<a:avLst>${inner}</a:avLst>`;\n}\n","/**\n * Preset geometry stringifier for DrawingML shapes.\n *\n * @module\n */\n\nimport type { GeometryGuide } from \"./adjustment-values\";\nimport { stringifyAdjustmentValues } from \"./adjustment-values\";\n\nexport interface PresetGeometryOptions {\n preset?: string;\n adjustmentValues?: readonly GeometryGuide[];\n}\n\n/**\n * Build a:prstGeom XML string.\n */\nexport function stringifyPresetGeometry(options?: PresetGeometryOptions): string {\n const prst = options?.preset ?? \"rect\";\n const avLst = stringifyAdjustmentValues(options?.adjustmentValues);\n return `<a:prstGeom prst=\"${prst}\">${avLst}</a:prstGeom>`;\n}\n","/**\n * Custom geometry module for DrawingML shapes.\n *\n * Provides CT_CustomGeometry2D — user-defined 2D geometry with paths,\n * guides, adjust handles, connection sites, and a text insertion rectangle.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_CustomGeometry2D\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { xsdPathFillMode } from \"../../util/mappings\";\nimport type { GeometryGuide } from \"./adjustment-values\";\n\n/**\n * Creates a geometry guide list element (a:avLst or a:gdLst).\n *\n * Both CT_GeomGuideList types share the same structure — a list of `a:gd` children.\n * The only difference is the wrapper element name.\n */\nconst createGuideList = (name: string, guides: readonly GeometryGuide[]): string => {\n const children = guides.map((guide) => `<a:gd name=\"${guide.name}\" fmla=\"${guide.formula}\"/>`);\n return element(name, undefined, children);\n};\n\n// ─── Path Fill Mode ─────────────────────────────────────────────────────────\n\n/**\n * Path fill mode (ST_PathFillMode).\n *\n * Note: the `\"normal\"` value here maps to the XSD `norm` token.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_PathFillMode\">\n * <xsd:restriction base=\"xsd:token\">\n * <xsd:enumeration value=\"none\"/>\n * <xsd:enumeration value=\"norm\"/>\n * <xsd:enumeration value=\"lighten\"/>\n * <xsd:enumeration value=\"lightenLess\"/>\n * <xsd:enumeration value=\"darken\"/>\n * <xsd:enumeration value=\"darkenLess\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n */\nexport type PathFillMode = \"none\" | \"normal\" | \"lighten\" | \"lightenLess\" | \"darken\" | \"darkenLess\";\n\n// ─── Point ──────────────────────────────────────────────────────────────────\n\n/**\n * An adjustable point (CT_AdjPoint2D).\n *\n * Coordinates can be absolute values or references to geometry guide names.\n */\nexport interface AdjustPoint {\n /** X coordinate (absolute value or guide name) */\n x: string;\n /** Y coordinate (absolute value or guide name) */\n y: string;\n}\n\nconst createAdjustPoint = (name: string, point: AdjustPoint): string =>\n element(name, undefined, [`<a:pt x=\"${point.x}\" y=\"${point.y}\"/>`]);\n\n// ─── Path Commands ──────────────────────────────────────────────────────────\n\n/** Move-to path command (CT_Path2DMoveTo). */\nexport interface PathMoveTo {\n command: \"moveTo\";\n point: AdjustPoint;\n}\n\n/** Line-to path command (CT_Path2DLineTo). */\nexport interface PathLineTo {\n command: \"lineTo\";\n point: AdjustPoint;\n}\n\n/** Arc-to path command (CT_Path2DArcTo). */\nexport interface PathArcTo {\n command: \"arcTo\";\n widthRadius: string;\n heightRadius: string;\n startAngle: string;\n sweepAngle: string;\n}\n\n/** Quadratic Bezier-to path command (CT_Path2DQuadBezierTo). */\nexport interface PathQuadBezTo {\n command: \"quadBezTo\";\n points: readonly [AdjustPoint, AdjustPoint];\n}\n\n/** Cubic Bezier-to path command (CT_Path2DCubicBezierTo). */\nexport interface PathCubicBezTo {\n command: \"cubicBezTo\";\n points: readonly [AdjustPoint, AdjustPoint, AdjustPoint];\n}\n\n/** Close path command (CT_Path2DClose). */\nexport interface PathClose {\n command: \"close\";\n}\n\n/** A path command within a custom geometry path. */\nexport type PathCommand =\n | PathMoveTo\n | PathLineTo\n | PathArcTo\n | PathQuadBezTo\n | PathCubicBezTo\n | PathClose;\n\nconst createPathCommand = (cmd: PathCommand): string => {\n switch (cmd.command) {\n case \"moveTo\":\n return createAdjustPoint(\"a:moveTo\", cmd.point);\n case \"lineTo\":\n return createAdjustPoint(\"a:lnTo\", cmd.point);\n case \"arcTo\":\n return `<a:arcTo wR=\"${cmd.widthRadius}\" hR=\"${cmd.heightRadius}\" stAng=\"${cmd.startAngle}\" swAng=\"${cmd.sweepAngle}\"/>`;\n case \"quadBezTo\":\n return element(\n \"a:quadBezTo\",\n undefined,\n cmd.points.map((pt) => `<a:pt x=\"${pt.x}\" y=\"${pt.y}\"/>`),\n );\n case \"cubicBezTo\":\n return element(\n \"a:cubicBezTo\",\n undefined,\n cmd.points.map((pt) => `<a:pt x=\"${pt.x}\" y=\"${pt.y}\"/>`),\n );\n case \"close\":\n return \"<a:close/>\";\n }\n};\n\n// ─── Path ───────────────────────────────────────────────────────────────────\n\n/**\n * Options for a 2D path (CT_Path2D).\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_Path2D\">\n * <xsd:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n * <xsd:element name=\"close\" type=\"CT_Path2DClose\"/>\n * <xsd:element name=\"moveTo\" type=\"CT_Path2DMoveTo\"/>\n * <xsd:element name=\"lnTo\" type=\"CT_Path2DLineTo\"/>\n * <xsd:element name=\"arcTo\" type=\"CT_Path2DArcTo\"/>\n * <xsd:element name=\"quadBezTo\" type=\"CT_Path2DQuadBezierTo\"/>\n * <xsd:element name=\"cubicBezTo\" type=\"CT_Path2DCubicBezierTo\"/>\n * </xsd:choice>\n * <xsd:attribute name=\"w\" type=\"ST_PositiveCoordinate\" default=\"0\"/>\n * <xsd:attribute name=\"h\" type=\"ST_PositiveCoordinate\" default=\"0\"/>\n * <xsd:attribute name=\"fill\" type=\"ST_PathFillMode\" default=\"norm\"/>\n * <xsd:attribute name=\"stroke\" type=\"xsd:boolean\" default=\"true\"/>\n * <xsd:attribute name=\"extrusionOk\" type=\"xsd:boolean\" default=\"true\"/>\n * </xsd:complexType>\n * ```\n */\nexport interface PathOptions {\n /** Path width (coordinate value, default 0 = use shape width) */\n w?: number;\n /** Path height (coordinate value, default 0 = use shape height) */\n h?: number;\n /** Fill mode for this path */\n fill?: PathFillMode;\n /** Whether to stroke the path */\n stroke?: boolean;\n /** Whether extrusion is allowed */\n extrusionOk?: boolean;\n /** Path commands (moveTo, lineTo, arcTo, etc.) */\n commands: readonly PathCommand[];\n}\n\nconst createPath = (options: PathOptions): string => {\n const attrs: Record<string, string | number | boolean | undefined> = {};\n if (options.w !== undefined) attrs.w = options.w;\n if (options.h !== undefined) attrs.h = options.h;\n if (options.fill !== undefined) attrs.fill = xsdPathFillMode.to(options.fill);\n if (options.stroke !== undefined) attrs.stroke = options.stroke;\n if (options.extrusionOk !== undefined) attrs.extrusionOk = options.extrusionOk;\n\n return element(\"a:path\", attrs, options.commands.map(createPathCommand));\n};\n\n// ─── Adjust Handle ──────────────────────────────────────────────────────────\n\n/**\n * A position reference for adjust handles and connection sites.\n */\nexport interface AdjustHandlePosition {\n x: string;\n y: string;\n}\n\n/**\n * XY adjust handle (CT_XYAdjustHandle).\n *\n * Allows the user to drag a handle in X/Y directions.\n */\nexport interface XYAdjustHandle {\n type: \"xy\";\n guideRefX?: string;\n minX?: string;\n maxX?: string;\n guideRefY?: string;\n minY?: string;\n maxY?: string;\n position: AdjustHandlePosition;\n}\n\n/**\n * Polar adjust handle (CT_PolarAdjustHandle).\n *\n * Allows the user to drag a handle in radius/angle directions.\n */\nexport interface PolarAdjustHandle {\n type: \"polar\";\n guideRefRadius?: string;\n minRadius?: string;\n maxRadius?: string;\n guideRefAngle?: string;\n minAngle?: string;\n maxAngle?: string;\n position: AdjustHandlePosition;\n}\n\n/** An adjust handle (XY or Polar). */\nexport type AdjustHandle = XYAdjustHandle | PolarAdjustHandle;\n\nconst createAdjustHandlePos = (position: AdjustHandlePosition): string =>\n `<a:pos x=\"${position.x}\" y=\"${position.y}\"/>`;\n\nconst createXYAdjustHandle = (handle: XYAdjustHandle): string => {\n const attrs: Record<string, string | undefined> = {};\n if (handle.guideRefX !== undefined) attrs.gdRefX = handle.guideRefX;\n if (handle.minX !== undefined) attrs.minX = handle.minX;\n if (handle.maxX !== undefined) attrs.maxX = handle.maxX;\n if (handle.guideRefY !== undefined) attrs.gdRefY = handle.guideRefY;\n if (handle.minY !== undefined) attrs.minY = handle.minY;\n if (handle.maxY !== undefined) attrs.maxY = handle.maxY;\n\n return element(\"a:ahXY\", attrs, [createAdjustHandlePos(handle.position)]);\n};\n\nconst createPolarAdjustHandle = (handle: PolarAdjustHandle): string => {\n const attrs: Record<string, string | undefined> = {};\n if (handle.guideRefRadius !== undefined) attrs.gdRefR = handle.guideRefRadius;\n if (handle.minRadius !== undefined) attrs.minR = handle.minRadius;\n if (handle.maxRadius !== undefined) attrs.maxR = handle.maxRadius;\n if (handle.guideRefAngle !== undefined) attrs.gdRefAng = handle.guideRefAngle;\n if (handle.minAngle !== undefined) attrs.minAng = handle.minAngle;\n if (handle.maxAngle !== undefined) attrs.maxAng = handle.maxAngle;\n\n return element(\"a:ahPolar\", attrs, [createAdjustHandlePos(handle.position)]);\n};\n\n// ─── Connection Site ────────────────────────────────────────────────────────\n\n/**\n * Connection site (CT_ConnectionSite).\n *\n * Defines a point on the shape boundary where connectors can attach.\n */\nexport interface ConnectionSite {\n /** Angle (absolute value or guide name) */\n angle: string;\n /** Position */\n position: AdjustHandlePosition;\n}\n\nconst createConnectionSite = (site: ConnectionSite): string =>\n element(\"a:cxn\", { ang: site.angle }, [createAdjustHandlePos(site.position)]);\n\n// ─── Geometry Rectangle ─────────────────────────────────────────────────────\n\n/**\n * Text insertion rectangle (CT_GeomRect).\n *\n * Defines the rectangle within the shape where text is placed.\n * Coordinates can be absolute values or references to geometry guide names.\n */\nexport interface GeomRect {\n left: string;\n top: string;\n right: string;\n bottom: string;\n}\n\nconst createGeomRect = (rect: GeomRect): string =>\n `<a:rect l=\"${rect.left}\" t=\"${rect.top}\" r=\"${rect.right}\" b=\"${rect.bottom}\"/>`;\n\n// ─── Custom Geometry ────────────────────────────────────────────────────────\n\n/**\n * Options for a custom 2D geometry (CT_CustomGeometry2D).\n *\n * Only `pathList` is required. All other sub-elements are optional.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_CustomGeometry2D\">\n * <xsd:sequence>\n * <xsd:element name=\"avLst\" type=\"CT_GeomGuideList\" minOccurs=\"0\"/>\n * <xsd:element name=\"gdLst\" type=\"CT_GeomGuideList\" minOccurs=\"0\"/>\n * <xsd:element name=\"ahLst\" type=\"CT_AdjustHandleList\" minOccurs=\"0\"/>\n * <xsd:element name=\"cxnLst\" type=\"CT_ConnectionSiteList\" minOccurs=\"0\"/>\n * <xsd:element name=\"rect\" type=\"CT_GeomRect\" minOccurs=\"0\"/>\n * <xsd:element name=\"pathLst\" type=\"CT_Path2DList\" minOccurs=\"1\"/>\n * </xsd:sequence>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * // Simple triangle\n * createCustomGeometry({\n * pathList: [{\n * commands: [\n * { command: \"moveTo\", point: { x: \"0\", y: \"0\" } },\n * { command: \"lineTo\", point: { x: \"10000000\", y: \"0\" } },\n * { command: \"lineTo\", point: { x: \"5000000\", y: \"10000000\" } },\n * { command: \"close\" },\n * ],\n * }],\n * });\n * ```\n */\nexport interface CustomGeometryOptions {\n /** Adjustment value guides (a:avLst) */\n adjustmentValues?: readonly GeometryGuide[];\n /** Geometry guide formulas (a:gdLst) */\n guides?: readonly GeometryGuide[];\n /** Adjust handles (a:ahLst) */\n adjustHandles?: readonly AdjustHandle[];\n /** Connection sites (a:cxnLst) */\n connectionSites?: readonly ConnectionSite[];\n /** Text insertion rectangle (a:rect) */\n textRectangle?: GeomRect;\n /** Path definitions (a:pathLst) — required */\n pathList: readonly PathOptions[];\n}\n\n/**\n * Creates a custom 2D geometry element as an XML string (a:custGeom).\n *\n * @example\n * ```typescript\n * // Diamond shape\n * const geom = createCustomGeometry({\n * pathList: [{\n * commands: [\n * { command: \"moveTo\", point: { x: \"5000000\", y: \"0\" } },\n * { command: \"lineTo\", point: { x: \"10000000\", y: \"5000000\" } },\n * { command: \"lineTo\", point: { x: \"5000000\", y: \"10000000\" } },\n * { command: \"lineTo\", point: { x: \"0\", y: \"5000000\" } },\n * { command: \"close\" },\n * ],\n * }],\n * textRectangle: { left: \"2000000\", top: \"2000000\", right: \"8000000\", bottom: \"8000000\" },\n * });\n * ```\n */\nexport const createCustomGeometry = (options: CustomGeometryOptions): string => {\n const children: string[] = [];\n\n // a:avLst\n if (options.adjustmentValues) {\n children.push(createGuideList(\"a:avLst\", options.adjustmentValues));\n }\n\n // a:gdLst\n if (options.guides) {\n children.push(createGuideList(\"a:gdLst\", options.guides));\n }\n\n // a:ahLst\n if (options.adjustHandles && options.adjustHandles.length > 0) {\n children.push(\n element(\n \"a:ahLst\",\n undefined,\n options.adjustHandles.map((h) =>\n h.type === \"xy\" ? createXYAdjustHandle(h) : createPolarAdjustHandle(h),\n ),\n ),\n );\n }\n\n // a:cxnLst\n if (options.connectionSites && options.connectionSites.length > 0) {\n children.push(\n element(\"a:cxnLst\", undefined, options.connectionSites.map(createConnectionSite)),\n );\n }\n\n // a:rect\n if (options.textRectangle) {\n children.push(createGeomRect(options.textRectangle));\n }\n\n // a:pathLst (required)\n children.push(element(\"a:pathLst\", undefined, options.pathList.map(createPath)));\n\n return element(\"a:custGeom\", undefined, children);\n};\n","/**\n * Blip extensions module for SVG support.\n *\n * This module provides extension elements that enable SVG image support\n * within blip elements using Office-specific extensions.\n *\n * Reference: http://officeopenxml.com/drwPic.php\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\n/**\n * Creates an SVG blip element for embedding SVG images.\n *\n * This element is a Microsoft Office extension that allows SVG images\n * to be referenced within a blip.\n *\n * @param svgReferenceId - The reference ID for the SVG image\n * @returns An XML string representing the SVG blip element\n * @internal\n */\nconst createSvgBlip = (svgReferenceId: string): string =>\n `<asvg:svgBlip xmlns:asvg=\"http://schemas.microsoft.com/office/drawing/2016/SVG/main\" r:embed=\"{${svgReferenceId}}\"/>`;\n\n/**\n * Creates an extension element for SVG support.\n *\n * This element wraps the SVG blip extension with the appropriate URI\n * to identify it as an SVG extension.\n *\n * @param svgReferenceId - The reference ID for the SVG image\n * @returns An XML string representing the extension element\n * @internal\n */\nconst createExtension = (svgReferenceId: string): string =>\n element(\"a:ext\", { uri: \"{96DAC541-7B7A-43D3-8B79-37D633B846F1}\" }, [\n createSvgBlip(svgReferenceId),\n ]);\n\n/**\n * Creates an extension list for SVG images.\n *\n * This element contains the extensions needed to embed SVG images\n * within a blip. It wraps the SVG-specific extension elements.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_OfficeArtExtensionList\">\n * <xsd:sequence>\n * <xsd:element name=\"ext\" type=\"CT_OfficeArtExtension\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n * </xsd:sequence>\n * </xsd:complexType>\n * ```\n *\n * @param svgReferenceId - The reference ID for the SVG image\n * @returns An XML string representing the extension list\n */\nexport const createExtensionList = (svgReferenceId: string): string =>\n element(\"a:extLst\", undefined, [createExtension(svgReferenceId)]);\n","/**\n * Blip (Binary Large Image or Picture) module for DrawingML.\n *\n * This module provides the blip element that references the actual\n * image data within a picture.\n *\n * Reference: http://officeopenxml.com/drwPic.php\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { createBlipEffects } from \"./blip-effects\";\nimport type { BlipEffectsOptions } from \"./blip-effects\";\nimport { createExtensionList } from \"./blip-extensions\";\n\n/**\n * Options for creating a blip element.\n */\nexport interface BlipOptions {\n /** File name used as placeholder; the packer's ImageReplacer replaces `{referenceId}` with `rId{N}` */\n referenceId: string;\n /** Image type for SVG detection */\n type?: \"svg\" | string;\n /** For SVG images, the fallback image file name */\n fallbackFileName?: string;\n}\n\n/**\n * Creates a blip element for an image.\n *\n * A blip references the actual image data stored in the document package\n * through a relationship ID. For SVG images, it includes extensions that\n * reference the SVG data.\n *\n * Reference: http://officeopenxml.com/drwPic.php\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_Blip\">\n * <xsd:sequence>\n * <xsd:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n * <xsd:element name=\"alphaBiLevel\" type=\"CT_AlphaBiLevelEffect\"/>\n * <xsd:element name=\"alphaCeiling\" type=\"CT_AlphaCeilingEffect\"/>\n * <xsd:element name=\"alphaFloor\" type=\"CT_AlphaFloorEffect\"/>\n * <xsd:element name=\"alphaInv\" type=\"CT_AlphaInverseEffect\"/>\n * <xsd:element name=\"alphaMod\" type=\"CT_AlphaModulateEffect\"/>\n * <xsd:element name=\"alphaModFix\" type=\"CT_AlphaModulateFixedEffect\"/>\n * <xsd:element name=\"alphaRepl\" type=\"CT_AlphaReplaceEffect\"/>\n * <xsd:element name=\"biLevel\" type=\"CT_BiLevelEffect\"/>\n * <xsd:element name=\"blur\" type=\"CT_BlurEffect\"/>\n * <xsd:element name=\"clrChange\" type=\"CT_ColorChangeEffect\"/>\n * <xsd:element name=\"clrRepl\" type=\"CT_ColorReplaceEffect\"/>\n * <xsd:element name=\"duotone\" type=\"CT_DuotoneEffect\"/>\n * <xsd:element name=\"fillOverlay\" type=\"CT_FillOverlayEffect\"/>\n * <xsd:element name=\"grayscl\" type=\"CT_GrayscaleEffect\"/>\n * <xsd:element name=\"hsl\" type=\"CT_HSLEffect\"/>\n * <xsd:element name=\"lum\" type=\"CT_LuminanceEffect\"/>\n * <xsd:element name=\"tint\" type=\"CT_TintEffect\"/>\n * </xsd:choice>\n * <xsd:element name=\"extLst\" type=\"CT_OfficeArtExtensionList\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * <xsd:attribute ref=\"r:embed\"/>\n * <xsd:attribute ref=\"r:link\"/>\n * <xsd:attribute name=\"cstate\" type=\"ST_BlipCompression\"/>\n * </xsd:complexType>\n * ```\n *\n * @param options - Blip options including referenceId and type\n * @param blipEffects - Optional blip effects (brightness, contrast, etc.)\n * @returns An XML string representing the blip element\n */\nexport const createBlip = (options: BlipOptions, blipEffects?: BlipEffectsOptions): string => {\n const children: string[] = [];\n\n if (blipEffects) {\n children.push(...createBlipEffects(blipEffects));\n }\n\n if (options.type === \"svg\" && options.fallbackFileName) {\n children.push(createExtensionList(options.referenceId));\n }\n\n return element(\n \"a:blip\",\n {\n cstate: \"none\",\n \"r:embed\": `{${options.type === \"svg\" && options.fallbackFileName ? options.fallbackFileName : options.referenceId}}`,\n },\n children.length > 0 ? children : undefined,\n );\n};\n","/**\n * Blip fill module for DrawingML pictures.\n *\n * This module defines how an image (blip) fills a picture shape,\n * including stretching and cropping options.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_BlipFillProperties\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport { createBlip } from \"./blip\";\nimport type { BlipOptions } from \"./blip\";\nimport type { BlipEffectsOptions } from \"./blip-effects\";\nimport { createSourceRectangle } from \"./source-rectangle\";\nimport type { SourceRectangleOptions } from \"./source-rectangle\";\nimport { createTileInfo } from \"./tile\";\nimport type { TileOptions } from \"./tile\";\n\n/**\n * Options for blip fill properties.\n */\nexport interface BlipFillOptions {\n /** DPI of the image */\n dpi?: number;\n /** Whether the fill rotates with the shape */\n rotWithShape?: boolean;\n /** Image adjustment effects (brightness, contrast, grayscale, etc.) */\n blipEffects?: BlipEffectsOptions;\n /** Source rectangle for cropping */\n sourceRectangle?: SourceRectangleOptions;\n /** Tile fill mode (if omitted, defaults to stretch) */\n tile?: TileOptions;\n}\n\n/**\n * Creates a blip fill element.\n *\n * This element specifies the type of fill used for a picture. It contains the blip (image)\n * reference, an optional source rectangle for cropping, and the fill mode (typically stretch).\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_BlipFillProperties\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_BlipFillProperties\">\n * <xsd:sequence>\n * <xsd:element name=\"blip\" type=\"CT_Blip\" minOccurs=\"0\" maxOccurs=\"1\"/>\n * <xsd:element name=\"srcRect\" type=\"CT_RelativeRect\" minOccurs=\"0\" maxOccurs=\"1\"/>\n * <xsd:group ref=\"EG_FillModeProperties\" minOccurs=\"0\" maxOccurs=\"1\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"dpi\" type=\"xsd:unsignedInt\" use=\"optional\"/>\n * <xsd:attribute name=\"rotWithShape\" type=\"xsd:boolean\" use=\"optional\"/>\n * </xsd:complexType>\n * ```\n *\n * @param blipOptions - Blip options including referenceId and type\n * @param fillOptions - Optional blip fill options\n * @returns An XML string representing the blip fill element\n */\nexport const createBlipFill = (blipOptions: BlipOptions, fillOptions?: BlipFillOptions): string => {\n const children: string[] = [];\n\n children.push(createBlip(blipOptions, fillOptions?.blipEffects));\n children.push(createSourceRectangle(fillOptions?.sourceRectangle));\n\n if (fillOptions?.tile) {\n children.push(createTileInfo(fillOptions.tile));\n } else {\n children.push(\"<a:stretch><a:fillRect/></a:stretch>\");\n }\n\n const attrs: Record<string, string | number | undefined> = {};\n if (fillOptions?.dpi !== undefined) {\n attrs.dpi = fillOptions.dpi;\n }\n if (fillOptions?.rotWithShape !== undefined) {\n attrs.rotWithShape = fillOptions.rotWithShape ? 1 : 0;\n }\n\n return element(\"pic:blipFill\", attrs, children);\n};\n","/**\n * Stretch fill stringifier for blip fills.\n *\n * @module\n */\n\n/**\n * Build a:stretch XML string with a:fillRect child.\n */\nexport function stringifyStretch(): string {\n return \"<a:stretch><a:fillRect/></a:stretch>\";\n}\n","import { element } from \"@office-open/xml\";\n\nimport { convertToEmu } from \"../util/converters\";\n/**\n * 2D transform for DrawingML shapes.\n *\n * This module provides factory functions for creating transform elements\n * (a:xfrm) used in shape properties, picture properties, and group shapes.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Transform2D / CT_GroupTransform2D\n *\n * @module\n */\nimport type { UniversalMeasure } from \"../util/values\";\n\n// <xsd:complexType name=\"CT_Transform2D\">\n// <xsd:sequence>\n// <xsd:element name=\"off\" type=\"CT_Point2D\" minOccurs=\"0\"/>\n// <xsd:element name=\"ext\" type=\"CT_PositiveSize2D\" minOccurs=\"0\"/>\n// </xsd:sequence>\n// <xsd:attribute name=\"rot\" type=\"ST_Angle\" use=\"optional\"/>\n// <xsd:attribute name=\"flipH\" type=\"xsd:boolean\" use=\"optional\"/>\n// <xsd:attribute name=\"flipV\" type=\"xsd:boolean\" use=\"optional\"/>\n// </xsd:complexType>\n\nexport interface Transform2DOptions {\n x?: number | UniversalMeasure;\n y?: number | UniversalMeasure;\n width?: number | UniversalMeasure;\n height?: number | UniversalMeasure;\n flipHorizontal?: boolean;\n flipVertical?: boolean;\n /** Rotation angle in degrees (e.g., 45 = 45°). */\n rotation?: number;\n}\n\n// <xsd:complexType name=\"CT_GroupTransform2D\">\n// <xsd:complexContent>\n// <xsd:extension base=\"CT_Transform2D\">\n// <xsd:sequence>\n// <xsd:element name=\"chOff\" type=\"CT_Point2D\" minOccurs=\"0\"/>\n// <xsd:element name=\"chExt\" type=\"CT_PositiveSize2D\" minOccurs=\"0\"/>\n// </xsd:sequence>\n// </xsd:extension>\n// </xsd:complexContent>\n// </xsd:complexType>\n\nexport interface GroupTransform2DOptions extends Transform2DOptions {\n childOffsetX?: number | UniversalMeasure;\n childOffsetY?: number | UniversalMeasure;\n childExtentWidth?: number | UniversalMeasure;\n childExtentHeight?: number | UniversalMeasure;\n}\n\nfunction buildXfrmAttrs(\n options: Transform2DOptions,\n): Record<string, string | number | boolean> | undefined {\n const attrs: Record<string, string | number | boolean> = {};\n if (options.flipHorizontal !== undefined) attrs.flipH = options.flipHorizontal;\n if (options.flipVertical !== undefined) attrs.flipV = options.flipVertical;\n if (options.rotation !== undefined) attrs.rot = Math.round(options.rotation * 60000);\n return Object.keys(attrs).length > 0 ? attrs : undefined;\n}\n\n/**\n * Creates a 2D transform element (a:xfrm).\n *\n * @param options - Transform options including position, size, rotation, and flip.\n * @param elementName - Element name, defaults to \"a:xfrm\".\n */\nexport const createTransform2D = (\n options: Transform2DOptions,\n elementName: string = \"a:xfrm\",\n): string => {\n const children: string[] = [];\n\n if (options.x !== undefined || options.y !== undefined) {\n const x = options.x !== undefined ? convertToEmu(options.x) : 0;\n const y = options.y !== undefined ? convertToEmu(options.y) : 0;\n children.push(`<a:off x=\"${x}\" y=\"${y}\"/>`);\n }\n\n if (options.width !== undefined || options.height !== undefined) {\n const cx = options.width !== undefined ? convertToEmu(options.width) : 0;\n const cy = options.height !== undefined ? convertToEmu(options.height) : 0;\n children.push(`<a:ext cx=\"${cx}\" cy=\"${cy}\"/>`);\n }\n\n return element(elementName, buildXfrmAttrs(options), children);\n};\n\n/**\n * Creates a group transform element (a:xfrm with chOff/chExt children).\n */\nexport const createGroupTransform2D = (\n options: GroupTransform2DOptions,\n elementName: string = \"a:xfrm\",\n): string => {\n const children: string[] = [];\n\n if (options.x !== undefined || options.y !== undefined) {\n const x = options.x !== undefined ? convertToEmu(options.x) : 0;\n const y = options.y !== undefined ? convertToEmu(options.y) : 0;\n children.push(`<a:off x=\"${x}\" y=\"${y}\"/>`);\n }\n\n if (options.width !== undefined || options.height !== undefined) {\n const cx = options.width !== undefined ? convertToEmu(options.width) : 0;\n const cy = options.height !== undefined ? convertToEmu(options.height) : 0;\n children.push(`<a:ext cx=\"${cx}\" cy=\"${cy}\"/>`);\n }\n\n const chOffX = options.childOffsetX !== undefined ? convertToEmu(options.childOffsetX) : 0;\n const chOffY = options.childOffsetY !== undefined ? convertToEmu(options.childOffsetY) : 0;\n children.push(`<a:chOff x=\"${chOffX}\" y=\"${chOffY}\"/>`);\n\n const chExtCx =\n options.childExtentWidth !== undefined ? convertToEmu(options.childExtentWidth) : 0;\n const chExtCy =\n options.childExtentHeight !== undefined ? convertToEmu(options.childExtentHeight) : 0;\n children.push(`<a:chExt cx=\"${chExtCx}\" cy=\"${chExtCy}\"/>`);\n\n return element(elementName, buildXfrmAttrs(options), children);\n};\n","/**\n * Table Style system for DrawingML.\n *\n * Generates CT_TableStyle and CT_TableStyleList XML for custom table styles\n * in presentations (PPTX) and documents.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_TableStyle / CT_TableStyleList\n *\n * @module\n */\nimport { attr, attrNum, element, findChild, stringify } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\n\nimport type { ReadContext, WriteContext } from \"../descriptor\";\nimport { parse as parseDesc, stringify as stringifyDesc } from \"../descriptor\";\nimport { parseColorChoice, stringifyColorChoice } from \"./color/color-descriptors\";\nimport type { StyleMatrixReferenceOptions } from \"./style-reference\";\nimport { cell3DDesc } from \"./three-d/three-d-descriptors\";\nimport type { Cell3DOptions } from \"./three-d/three-d-descriptors\";\n\nexport type { StyleMatrixReferenceOptions } from \"./style-reference\";\n\n// cell3DDesc's stringify/parse never touch the context (bevel/lightRig are\n// pure attribute emitters), so bare stubs satisfy the descriptor signature.\nconst EMPTY_WRITE_CTX = {} as WriteContext;\nconst EMPTY_READ_CTX = {} as ReadContext;\n\n// ── Options ──\n\nexport type TableStyleRegion =\n | \"tblBg\"\n | \"wholeTbl\"\n | \"band1H\"\n | \"band2H\"\n | \"band1V\"\n | \"band2V\"\n | \"lastCol\"\n | \"firstCol\"\n | \"lastRow\"\n | \"seCell\"\n | \"swCell\"\n | \"firstRow\"\n | \"neCell\"\n | \"nwCell\";\n\nexport type OnOffStyleType = \"on\" | \"off\" | \"def\";\n\nexport interface TablePartStyleOptions {\n /** Cell text style */\n text?: TableTextStyleOptions;\n /** Cell style (fill, borders, 3D) */\n cell?: TableCellStyleOptions;\n}\n\nexport interface TableTextStyleOptions {\n /** Bold style */\n bold?: OnOffStyleType;\n /** Italic style */\n italic?: OnOffStyleType;\n /** Font reference (themeable) */\n fontReference?: StyleMatrixReferenceOptions;\n /** Color element */\n color?: string;\n}\n\nexport interface TableCellStyleOptions {\n /** Cell borders */\n borders?: TableCellBorderOptions;\n /** Fill reference (themeable) */\n fillReference?: StyleMatrixReferenceOptions;\n /** Direct fill */\n fill?: string;\n /** Cell bevel (CT_Cell3D) */\n cell3D?: Cell3DOptions;\n}\n\nexport interface TableCellBorderOptions {\n left?: ThemeableLineStyleOptions;\n right?: ThemeableLineStyleOptions;\n top?: ThemeableLineStyleOptions;\n bottom?: ThemeableLineStyleOptions;\n insideH?: ThemeableLineStyleOptions;\n insideV?: ThemeableLineStyleOptions;\n}\n\nexport interface ThemeableLineStyleOptions {\n /** Line width in EMUs */\n width?: number;\n /** Fill color component */\n color?: string;\n /** Line reference (a:lnRef) into the theme style matrix */\n lineReference?: StyleMatrixReferenceOptions;\n}\n\nexport interface TableStyleOptions {\n /** Unique GUID for this style */\n styleId: string;\n /** Display name */\n styleName: string;\n /** Style regions */\n regions?: Partial<Record<TableStyleRegion, TablePartStyleOptions>>;\n}\n\nexport interface TableStyleListOptions {\n /** Default style GUID */\n defaultStyleId: string;\n /** Custom table styles */\n styles?: readonly TableStyleOptions[];\n}\n\n// ── Helpers ──\n\n/** Pass through a string value (all color/fill factories now return string). */\nfunction toStr(el: string): string {\n return el;\n}\n\n/** Create a:styleMatrixReference (fillRef, lnRef, effectRef, fontRef) */\nfunction createStyleMatrixRef(elementName: string, opts: StyleMatrixReferenceOptions): string {\n const children: string[] = [];\n if (opts.color) children.push(stringifyColorChoice(opts.color, EMPTY_WRITE_CTX));\n return element(\n `a:${elementName}`,\n { idx: String(opts.index) },\n children.length > 0 ? children : undefined,\n );\n}\n\n/** Create border line element (a:ln with color) or a:lnRef */\nfunction createThemeableLine(opts: ThemeableLineStyleOptions): string {\n if (opts.lineReference !== undefined) {\n const children: string[] = [];\n if (opts.color) children.push(toStr(opts.color));\n return element(\n \"a:lnRef\",\n { idx: String(opts.lineReference.index) },\n children.length > 0 ? children : undefined,\n );\n }\n const children: string[] = [];\n if (opts.color) children.push(toStr(opts.color));\n const attrs: Record<string, string> = {};\n if (opts.width !== undefined) attrs.w = String(opts.width);\n return element(\"a:ln\", attrs, children.length > 0 ? children : undefined);\n}\n\n// ── Part builders ──\n\n/** Each cell-border side: Options key → a:tcBdr child element name. */\nconst BORDER_SIDES: ReadonlyArray<[keyof TableCellBorderOptions, string]> = [\n [\"left\", \"a:left\"],\n [\"right\", \"a:right\"],\n [\"top\", \"a:top\"],\n [\"bottom\", \"a:bottom\"],\n [\"insideH\", \"a:insideH\"],\n [\"insideV\", \"a:insideV\"],\n];\n\n/** CT_TableCellBorderStyle: each side wraps an EG_ThemeableLineStyle choice. */\nfunction buildCellBorders(opts: TableCellBorderOptions): string {\n const children: string[] = [];\n for (const [key, name] of BORDER_SIDES) {\n const line = opts[key];\n if (line) children.push(element(name, undefined, [createThemeableLine(line)]));\n }\n return element(\"a:tcBdr\", undefined, children);\n}\n\nfunction buildTextStyle(opts: TableTextStyleOptions): string {\n const children: string[] = [];\n if (opts.fontReference) children.push(createStyleMatrixRef(\"fontRef\", opts.fontReference));\n if (opts.color) children.push(toStr(opts.color));\n const attrs: Record<string, string> = {};\n if (opts.bold && opts.bold !== \"def\") attrs.b = opts.bold;\n if (opts.italic && opts.italic !== \"def\") attrs.i = opts.italic;\n return element(\"a:tcTxStyle\", attrs, children.length > 0 ? children : undefined);\n}\n\nfunction buildCellStyle(opts: TableCellStyleOptions): string {\n const children: string[] = [];\n if (opts.borders) children.push(buildCellBorders(opts.borders));\n if (opts.fillReference) children.push(createStyleMatrixRef(\"fillRef\", opts.fillReference));\n else if (opts.fill) children.push(toStr(opts.fill));\n if (opts.cell3D) children.push(stringifyDesc(cell3DDesc, opts.cell3D, EMPTY_WRITE_CTX) ?? \"\");\n return element(\"a:tcStyle\", undefined, children);\n}\n\nfunction buildPartStyle(elementName: string, opts: TablePartStyleOptions): string {\n const children: string[] = [];\n if (opts.text) children.push(buildTextStyle(opts.text));\n if (opts.cell) children.push(buildCellStyle(opts.cell));\n return element(elementName, undefined, children);\n}\n\n// ── Public API ──\n\n/** XSD ordering for CT_TableStyle children */\nconst REGION_ORDER: readonly TableStyleRegion[] = [\n \"tblBg\",\n \"wholeTbl\",\n \"band1H\",\n \"band2H\",\n \"band1V\",\n \"band2V\",\n \"lastCol\",\n \"firstCol\",\n \"lastRow\",\n \"seCell\",\n \"swCell\",\n \"firstRow\",\n \"neCell\",\n \"nwCell\",\n];\n\n/** XML element name for each region */\nconst REGION_ELEMENTS: Record<TableStyleRegion, string> = {\n tblBg: \"a:tblBg\",\n wholeTbl: \"a:wholeTbl\",\n band1H: \"a:band1H\",\n band2H: \"a:band2H\",\n band1V: \"a:band1V\",\n band2V: \"a:band2V\",\n lastCol: \"a:lastCol\",\n firstCol: \"a:firstCol\",\n lastRow: \"a:lastRow\",\n seCell: \"a:seCell\",\n swCell: \"a:swCell\",\n firstRow: \"a:firstRow\",\n neCell: \"a:neCell\",\n nwCell: \"a:nwCell\",\n};\n\n/** Create a single table style (CT_TableStyle). `elementName` covers the part-list form (a:tblStyle) and the inline a:tblPr form (a:tableStyle). */\nexport function createTableStyle(opts: TableStyleOptions, elementName = \"a:tblStyle\"): string {\n const children: string[] = [];\n if (opts.regions) {\n for (const region of REGION_ORDER) {\n const part = opts.regions[region];\n if (!part) continue;\n children.push(buildPartStyle(REGION_ELEMENTS[region], part));\n }\n }\n return element(\n elementName,\n { styleId: opts.styleId, styleName: opts.styleName },\n children.length > 0 ? children : undefined,\n );\n}\n\n/** Create table style list (CT_TableStyleList) */\nexport function createTableStyleList(opts: TableStyleListOptions): string {\n const children: string[] = [];\n if (opts.styles) {\n for (const style of opts.styles) {\n children.push(createTableStyle(style));\n }\n }\n return element(\n \"a:tblStyleLst\",\n {\n \"xmlns:a\": \"http://schemas.openxmlformats.org/drawingml/2006/main\",\n def: opts.defaultStyleId,\n },\n children.length > 0 ? children : undefined,\n );\n}\n\n// ── Parse (Element → TableStyleListOptions) ──\n\n/**\n * Serialize a single parsed element. `stringify` treats its argument as a\n * document root and serializes the `elements` array, so wrap the child to\n * serialize the child itself (round-trips raw color/fill child elements).\n */\nfunction serializeChild(child: Element): string {\n return stringify({ elements: [child] });\n}\n\n/** Reverse of REGION_ELEMENTS: XML element name → region key. */\nconst ELEMENT_TO_REGION = Object.fromEntries(\n Object.entries(REGION_ELEMENTS).map(([region, name]) => [name, region]),\n) as Record<string, TableStyleRegion>;\n\n/** Parse a:tblStyleLst → TableStyleListOptions (reverse of createTableStyleList). */\nexport function parseTableStyleList(el: Element): TableStyleListOptions {\n const defaultStyleId = attr(el, \"def\") ?? \"\";\n const styles: TableStyleOptions[] = [];\n for (const child of el.elements ?? []) {\n if (child.name !== \"a:tblStyle\") continue;\n const style = parseTableStyle(child);\n if (style) styles.push(style);\n }\n return { defaultStyleId, ...(styles.length > 0 ? { styles } : {}) };\n}\n\nexport function parseTableStyle(el: Element): TableStyleOptions | undefined {\n const styleId = attr(el, \"styleId\");\n const styleName = attr(el, \"styleName\");\n if (styleId === undefined || styleName === undefined) return undefined;\n const regions: Partial<Record<TableStyleRegion, TablePartStyleOptions>> = {};\n for (const child of el.elements ?? []) {\n if (!child.name) continue;\n const region = ELEMENT_TO_REGION[child.name];\n if (!region) continue;\n const part = parsePartStyle(child);\n if (part) regions[region] = part;\n }\n return { styleId, styleName, ...(Object.keys(regions).length > 0 ? { regions } : {}) };\n}\n\nfunction parsePartStyle(el: Element): TablePartStyleOptions | undefined {\n const part: TablePartStyleOptions = {};\n const txStyle = findChild(el, \"a:tcTxStyle\");\n if (txStyle) {\n const text = parseTableTextStyle(txStyle);\n if (text) part.text = text;\n }\n const cellStyle = findChild(el, \"a:tcStyle\");\n if (cellStyle) {\n const cell = parseTableCellStyle(cellStyle);\n if (cell) part.cell = cell;\n }\n return Object.keys(part).length > 0 ? part : undefined;\n}\n\nfunction parseTableTextStyle(el: Element): TableTextStyleOptions | undefined {\n const opts: TableTextStyleOptions = {};\n const b = attr(el, \"b\");\n if (b === \"on\" || b === \"off\") opts.bold = b;\n const i = attr(el, \"i\");\n if (i === \"on\" || i === \"off\") opts.italic = i;\n const fontRefEl = findChild(el, \"a:fontRef\");\n if (fontRefEl) opts.fontReference = parseStyleMatrixRef(fontRefEl);\n // color: first non-fontRef child element, serialized back to the raw string\n // buildTextStyle stores (it pushes opts.color verbatim).\n for (const child of el.elements ?? []) {\n if (child.name === \"a:fontRef\") continue;\n opts.color = serializeChild(child);\n break;\n }\n return Object.keys(opts).length > 0 ? opts : undefined;\n}\n\nfunction parseTableCellStyle(el: Element): TableCellStyleOptions | undefined {\n const opts: TableCellStyleOptions = {};\n const tcBdr = findChild(el, \"a:tcBdr\");\n if (tcBdr) {\n const borders = parseCellBorders(tcBdr);\n if (borders) opts.borders = borders;\n }\n const fillRefEl = findChild(el, \"a:fillRef\");\n if (fillRefEl) {\n opts.fillReference = parseStyleMatrixRef(fillRefEl);\n } else {\n // fill: first non-tcBdr/non-cell3D child element, serialized\n // (buildCellStyle pushes opts.fill verbatim).\n for (const child of el.elements ?? []) {\n if (child.name === \"a:tcBdr\" || child.name === \"a:cell3D\") continue;\n opts.fill = serializeChild(child);\n break;\n }\n }\n const cell3DEl = findChild(el, \"a:cell3D\");\n if (cell3DEl) opts.cell3D = parseDesc(cell3DDesc, cell3DEl, EMPTY_READ_CTX);\n return Object.keys(opts).length > 0 ? opts : undefined;\n}\n\nfunction parseCellBorders(el: Element): TableCellBorderOptions | undefined {\n const borders: TableCellBorderOptions = {};\n for (const [key, name] of BORDER_SIDES) {\n const borderEl = findChild(el, name);\n if (!borderEl) continue;\n // Each side wraps an EG_ThemeableLineStyle choice (a:ln or a:lnRef).\n const lineEl = borderEl.elements?.find((c) => c.type === \"element\");\n if (!lineEl) continue;\n const line = parseThemeableLine(lineEl);\n if (line) borders[key] = line;\n }\n return Object.keys(borders).length > 0 ? borders : undefined;\n}\n\nfunction parseThemeableLine(el: Element): ThemeableLineStyleOptions | undefined {\n const opts: ThemeableLineStyleOptions = {};\n if (el.name === \"a:lnRef\") {\n const idx = attrNum(el, \"idx\");\n if (idx !== undefined) opts.lineReference = { index: idx };\n } else {\n const w = attrNum(el, \"w\");\n if (w !== undefined) opts.width = w;\n }\n for (const child of el.elements ?? []) {\n opts.color = serializeChild(child);\n break;\n }\n return Object.keys(opts).length > 0 ? opts : undefined;\n}\n\nfunction parseStyleMatrixRef(el: Element): StyleMatrixReferenceOptions {\n const idx = attrNum(el, \"idx\") ?? 0;\n const color = parseColorChoice(el, EMPTY_READ_CTX);\n const opts: StyleMatrixReferenceOptions =\n color && Object.keys(color).length > 0 ? { index: idx, color } : { index: idx };\n return opts;\n}\n","/**\n * DrawingML shape locking properties.\n *\n * Controls which aspects of a shape can be modified by users.\n *\n * Reference: OOXML transitional, dml-main.xsd, AG_Locking / CT_ShapeLocking / CT_PictureLocking / CT_GroupLocking\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\n// ── Common locking attributes (AG_Locking) ──\n\nexport interface BaseLockingOptions {\n /** Prevent grouping */\n noGrp?: boolean;\n /** Prevent selection */\n noSelect?: boolean;\n /** Prevent rotation */\n noRot?: boolean;\n /** Prevent aspect ratio change */\n noChangeAspect?: boolean;\n /** Prevent moving */\n noMove?: boolean;\n /** Prevent resizing */\n noResize?: boolean;\n /** Prevent edit points */\n noEditPoints?: boolean;\n /** Prevent adjust handles */\n noAdjustHandles?: boolean;\n /** Prevent changing arrowheads */\n noChangeArrowheads?: boolean;\n /** Prevent changing shape type */\n noChangeShapeType?: boolean;\n}\n\n// ── Shape locking (CT_ShapeLocking) ──\n\nexport interface ShapeLockingOptions extends BaseLockingOptions {\n /** Prevent text editing */\n noTextEdit?: boolean;\n}\n\n// ── Picture locking (CT_PictureLocking) ──\n\nexport interface PictureLockingOptions extends BaseLockingOptions {\n /** Prevent cropping */\n noCrop?: boolean;\n}\n\n// ── Group locking (CT_GroupLocking) ──\n\nexport interface GroupLockingOptions {\n noGrp?: boolean;\n noUngrp?: boolean;\n noSelect?: boolean;\n noRot?: boolean;\n noChangeAspect?: boolean;\n noMove?: boolean;\n noResize?: boolean;\n}\n\n// ── Graphic frame locking (CT_GraphicalObjectFrameLocking) ──\n\nexport interface GraphicFrameLockingOptions {\n noGrp?: boolean;\n noDrilldown?: boolean;\n noSelect?: boolean;\n noChangeAspect?: boolean;\n noMove?: boolean;\n noResize?: boolean;\n}\n\n// ── Connector locking (CT_ConnectorLocking = AG_Locking, no extras) ──\n\nexport type ConnectorLockingOptions = BaseLockingOptions;\n\n// ── Content part locking (CT_ContentPartLocking = AG_Locking, no extras) ──\n\nexport type ContentPartLockingOptions = BaseLockingOptions;\n\n// ── Factory functions ──\n\nfunction toFlatAttrs(opts: Readonly<Record<string, boolean | undefined>>): Record<string, boolean> {\n const result: Record<string, boolean> = {};\n for (const key of Object.keys(opts)) {\n if (opts[key] !== undefined) {\n result[key] = opts[key]!;\n }\n }\n return result;\n}\n\nexport function createShapeLocking(opts: ShapeLockingOptions): string {\n return element(\"a:spLocks\", toFlatAttrs(opts as Record<string, boolean | undefined>));\n}\n\nexport function createPictureLocking(opts: PictureLockingOptions): string {\n return element(\"a:picLocks\", toFlatAttrs(opts as Record<string, boolean | undefined>));\n}\n\nexport function createGroupLocking(opts: GroupLockingOptions): string {\n return element(\"a:grpSpLocks\", toFlatAttrs(opts as Record<string, boolean | undefined>));\n}\n\nexport function createGraphicFrameLocking(opts: GraphicFrameLockingOptions): string {\n return element(\"a:graphicFrameLocks\", toFlatAttrs(opts as Record<string, boolean | undefined>));\n}\n\nexport function createConnectorLocking(opts: ConnectorLockingOptions): string {\n return element(\"a:cxnSpLocks\", toFlatAttrs(opts as Record<string, boolean | undefined>));\n}\n\nexport function createContentPartLocking(opts: ContentPartLockingOptions): string {\n return element(\"a:cpLocks\", toFlatAttrs(opts as Record<string, boolean | undefined>));\n}\n","/**\n * Connector endpoint connection (a:stCxn / a:endCxn / CT_Connection).\n *\n * Glues a connector endpoint to a specific connection site on a target shape,\n * so the endpoint follows the shape when it moves. Used inside cNvCxnSpPr.\n *\n * @module\n */\n\nimport type { Element as XmlElement } from \"@office-open/xml\";\n\n/** a:stCxn / a:endCxn — a connector endpoint glued to a shape connection site. */\nexport interface EndpointConnectionOptions {\n /** Target shape cNvPr id (ST_DrawingElementId). */\n id: number;\n /** Connection site index on the target shape. */\n index: number;\n}\n\n/** Stringify an a:stCxn or a:endCxn element. */\nexport function stringifyEndpointConnection(\n tag: \"stCxn\" | \"endCxn\",\n conn: EndpointConnectionOptions,\n): string {\n return `<a:${tag} id=\"${conn.id}\" idx=\"${conn.index}\"/>`;\n}\n\n/** Parse an a:stCxn or a:endCxn element. */\nexport function parseEndpointConnection(el: XmlElement): EndpointConnectionOptions | undefined {\n const id = el.attributes?.[\"id\"];\n const idx = el.attributes?.[\"idx\"];\n if (id === undefined || idx === undefined) return undefined;\n return { id: Number(id), index: Number(idx) };\n}\n","/**\n * Non-visual drawing properties (a:CT_NonVisualDrawingProps).\n *\n * The shared XSD type behind every drawing object's cNvPr (pic:/p:/xdr:/a:) and\n * docx's wp:docPr — picture, shape, connector, group, graphicFrame, chart, ole,\n * smartart each carry one. This module is the single source of truth for its\n * four user-facing attributes (name/descr/title/hidden). The runtime id is\n * allocated by each descriptor's nextId counter, and hlinkClick/hlinkHover stay\n * package-side (relationship wiring differs per format).\n *\n * @module\n */\n\nimport { escapeXml } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\n\nimport { parseOnOff } from \"../../util/values\";\n\n/** Mirrors a:CT_NonVisualDrawingProps — name/descr/title/hidden. id is runtime; hyperlinks stay package-side. */\nexport interface NonVisualDrawingPropertiesOptions {\n /** XSD @name (required in XML); API-optional, the descriptor synthesizes a fallback. */\n name?: string;\n /** XSD @descr — alt text for accessibility; emitted only when present. */\n description?: string;\n /** XSD @title. */\n title?: string;\n /** XSD @hidden (default false); emitted as \"1\" only when true. */\n hidden?: boolean;\n}\n\n/**\n * Stringify a cNvPr/docPr opening tag (a:CT_NonVisualDrawingProps attributes).\n *\n * `tag` is the fully-qualified element name (\"p:cNvPr\", \"pic:cNvPr\", \"wp:docPr\",\n * …) since the same XSD type is serialized under several element names across\n * the format packages. `innerXml` carries caller-built hlinkClick/hlinkHover.\n */\nexport function stringifyNonVisualDrawingProperties(\n tag: string,\n id: number | string,\n opts: NonVisualDrawingPropertiesOptions | undefined,\n fallbackName: string,\n innerXml?: string,\n): string {\n const name = opts?.name ?? fallbackName;\n let attrs = `id=\"${id}\" name=\"${escapeXml(name)}\"`;\n if (opts?.description) attrs += ` descr=\"${escapeXml(opts.description)}\"`;\n if (opts?.title) attrs += ` title=\"${escapeXml(opts.title)}\"`;\n if (opts?.hidden) attrs += ` hidden=\"1\"`;\n return innerXml ? `<${tag} ${attrs}>${innerXml}</${tag}>` : `<${tag} ${attrs}/>`;\n}\n\n/**\n * Parse cNvPr/docPr attributes into NonVisualDrawingPropertiesOptions.\n * Empty descr/title are dropped (Word never round-trips them empty).\n */\nexport function parseNonVisualDrawingProperties(\n el: XmlElement | undefined,\n): Partial<NonVisualDrawingPropertiesOptions> {\n if (!el?.attributes) return {};\n const a = el.attributes;\n const result: Partial<NonVisualDrawingPropertiesOptions> = {};\n if (a[\"name\"] !== undefined) result.name = String(a[\"name\"]);\n const descr = a[\"descr\"];\n if (descr !== undefined && descr !== \"\") result.description = String(descr);\n const title = a[\"title\"];\n if (title !== undefined && title !== \"\") result.title = String(title);\n const hidden = a[\"hidden\"];\n if (hidden !== undefined) result.hidden = parseOnOff(hidden) ?? false;\n return result;\n}\n\n/**\n * Pick the cNvPr attributes (name/description/title/hidden) actually set on\n * `opts`, dropping undefined. Used when bridging a package's options onto a\n * descriptor that carries the same fields — spreads only what was authored so\n * the descriptor's fallbacks (e.g. synthesized name) still apply for the rest.\n */\nexport function pickNonVisualDrawingProperties(\n opts: NonVisualDrawingPropertiesOptions | undefined,\n): Partial<NonVisualDrawingPropertiesOptions> {\n if (!opts) return {};\n const picked: Partial<NonVisualDrawingPropertiesOptions> = {};\n if (opts.name !== undefined) picked.name = opts.name;\n if (opts.description !== undefined) picked.description = opts.description;\n if (opts.title !== undefined) picked.title = opts.title;\n if (opts.hidden !== undefined) picked.hidden = opts.hidden;\n return picked;\n}\n","/**\n * Non-visual content part properties (a:CT_NonVisualContentPartProperties).\n *\n * Carries the cpLocks locking set and the isComment flag for wp:contentPart\n * wrappers (CT_WordprocessingContentPart). The cNvContentPartPr element itself\n * is host-namespaced (wp:/wpg:/wpc:), so the tag is caller-supplied.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_NonVisualContentPartProperties\n *\n * @module\n */\n\nimport type { Element as XmlElement } from \"@office-open/xml\";\nimport { findChild } from \"@office-open/xml\";\n\nimport { parseOnOff } from \"../../util/values\";\nimport { createContentPartLocking } from \"../locking/locking\";\nimport type { ContentPartLockingOptions } from \"../locking/locking\";\n\nexport interface NonVisualContentPartPropertiesOptions {\n /** Locking flags (a:cpLocks — CT_ContentPartLocking) */\n locks?: ContentPartLockingOptions;\n /**\n * Whether the content part hosts a comment (@isComment, default true).\n * Only `false` deviates from the default and is emitted explicitly.\n */\n isComment?: boolean;\n}\n\n/** Locking attribute keys shared by stringify/parse. */\nconst LOCKING_KEYS: readonly (keyof ContentPartLockingOptions & string)[] = [\n \"noGrp\",\n \"noSelect\",\n \"noRot\",\n \"noChangeAspect\",\n \"noMove\",\n \"noResize\",\n \"noEditPoints\",\n \"noAdjustHandles\",\n \"noChangeArrowheads\",\n \"noChangeShapeType\",\n];\n\n/**\n * Stringify a cNvContentPartPr element (CT_NonVisualContentPartProperties).\n * The `isComment` default is true, so only `false` is written.\n */\nexport function stringifyNonVisualContentPartProperties(\n tag: string,\n opts: NonVisualContentPartPropertiesOptions | undefined,\n): string {\n if (!opts) return `<${tag}/>`;\n let inner = \"\";\n if (opts.locks) inner += createContentPartLocking(opts.locks);\n const attr = opts.isComment === false ? ' isComment=\"0\"' : \"\";\n return inner ? `<${tag}${attr}>${inner}</${tag}>` : `<${tag}${attr}/>`;\n}\n\n/** Parse a cNvContentPartPr element into its options form. */\nexport function parseNonVisualContentPartProperties(\n el: XmlElement | undefined,\n): NonVisualContentPartPropertiesOptions | undefined {\n if (!el) return undefined;\n const result: NonVisualContentPartPropertiesOptions = {};\n const locks = findChild(el, \"a:cpLocks\");\n if (locks) {\n const flags: Record<string, boolean> = {};\n for (const key of LOCKING_KEYS) {\n const raw = locks.attributes?.[key];\n if (raw !== undefined) flags[key] = parseOnOff(raw) ?? false;\n }\n if (Object.keys(flags).length > 0) result.locks = flags as ContentPartLockingOptions;\n }\n const isComment = el.attributes?.[\"isComment\"];\n if (isComment !== undefined) result.isComment = parseOnOff(isComment) ?? true;\n return Object.keys(result).length > 0 ? result : undefined;\n}\n","/**\n * Diagram layout variable property set elements.\n *\n * Reference: ISO/IEC 29500-4, dml-diagram.xsd\n * CT_LayoutVariablePropertySet and its child elements.\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\n// ---------------------------------------------------------------------------\n// dgm:adj — adjustment handle (CT_Adj)\n// ---------------------------------------------------------------------------\n\nexport interface AdjustOptions {\n /** 1-based index (required) */\n idx: number;\n /** Adjustment value (required) */\n val: number;\n}\n\n/** Creates a dgm:adj element. */\nexport const createAdjust = (options: AdjustOptions): string =>\n `<dgm:adj idx=\"${options.idx}\" val=\"${options.val}\"/>`;\n\n// ---------------------------------------------------------------------------\n// dgm:animLvl — animation level (CT_AnimLvl)\n// ---------------------------------------------------------------------------\n\nexport type AnimationLevel = \"none\" | \"lvl\" | \"ctr\";\n\nexport interface AnimationLevelOptions {\n val?: AnimationLevel;\n}\n\n/** Creates a dgm:animLvl element. */\nexport const createAnimationLevel = (options?: AnimationLevelOptions): string =>\n options?.val !== undefined ? `<dgm:animLvl val=\"${options.val}\"/>` : \"<dgm:animLvl/>\";\n\n// ---------------------------------------------------------------------------\n// dgm:animOne — animation one-by-one (CT_AnimOne)\n// ---------------------------------------------------------------------------\n\nexport type AnimateOneByOne = \"none\" | \"one\" | \"branch\";\n\nexport interface AnimateOneByOneOptions {\n val?: AnimateOneByOne;\n}\n\n/** Creates a dgm:animOne element. */\nexport const createAnimateOneByOne = (options?: AnimateOneByOneOptions): string =>\n options?.val !== undefined ? `<dgm:animOne val=\"${options.val}\"/>` : \"<dgm:animOne/>\";\n\n// ---------------------------------------------------------------------------\n// dgm:chMax — max children constraint (CT_ChildMax)\n// ---------------------------------------------------------------------------\n\nexport interface MaxChildrenOptions {\n val?: number;\n}\n\n/** Creates a dgm:chMax element. */\nexport const createMaxChildren = (options?: MaxChildrenOptions): string =>\n options?.val !== undefined ? `<dgm:chMax val=\"${options.val}\"/>` : \"<dgm:chMax/>\";\n\n// ---------------------------------------------------------------------------\n// dgm:chPref — preferred children count (CT_ChildPref)\n// ---------------------------------------------------------------------------\n\nexport interface PreferredChildrenOptions {\n val?: number;\n}\n\n/** Creates a dgm:chPref element. */\nexport const createPreferredChildren = (options?: PreferredChildrenOptions): string =>\n options?.val !== undefined ? `<dgm:chPref val=\"${options.val}\"/>` : \"<dgm:chPref/>\";\n\n// ---------------------------------------------------------------------------\n// dgm:orgChart — organization chart flag (CT_OrgChart)\n// ---------------------------------------------------------------------------\n\nexport interface OrgChartOptions {\n val?: boolean;\n}\n\n/** Creates a dgm:orgChart element. */\nexport const createOrgChart = (options?: OrgChartOptions): string =>\n options?.val !== undefined ? `<dgm:orgChart val=\"${options.val}\"/>` : \"<dgm:orgChart/>\";\n\n// ---------------------------------------------------------------------------\n// dgm:hierBranch — hierarchy branch style (CT_HierBranchStyle)\n// ---------------------------------------------------------------------------\n\nexport type HierBranch = \"l\" | \"r\" | \"hang\" | \"std\" | \"init\";\n\nexport interface HierBranchOptions {\n val?: HierBranch;\n}\n\n/** Creates a dgm:hierBranch element. */\nexport const createHierBranch = (options?: HierBranchOptions): string =>\n options?.val !== undefined ? `<dgm:hierBranch val=\"${options.val}\"/>` : \"<dgm:hierBranch/>\";\n\n// ---------------------------------------------------------------------------\n// dgm:presLayoutVars — presentation layout variables (CT_LayoutVariablePropertySet)\n// ---------------------------------------------------------------------------\n\nexport interface PresentationLayoutVariablesOptions {\n orgChart?: OrgChartOptions;\n maxChildren?: MaxChildrenOptions;\n preferredChildren?: PreferredChildrenOptions;\n animateOneByOne?: AnimateOneByOneOptions;\n animationLevel?: AnimationLevelOptions;\n hierBranch?: HierBranchOptions;\n}\n\n/**\n * Creates a dgm:presLayoutVars element (CT_LayoutVariablePropertySet).\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_LayoutVariablePropertySet\">\n * <xsd:sequence>\n * <xsd:element name=\"orgChart\" type=\"CT_OrgChart\" minOccurs=\"0\"/>\n * <xsd:element name=\"chMax\" type=\"CT_ChildMax\" minOccurs=\"0\"/>\n * <xsd:element name=\"chPref\" type=\"CT_ChildPref\" minOccurs=\"0\"/>\n * <xsd:element name=\"bulletEnabled\" type=\"CT_BulletEnabled\" minOccurs=\"0\"/>\n * <xsd:element name=\"dir\" type=\"CT_Direction\" minOccurs=\"0\"/>\n * <xsd:element name=\"hierBranch\" type=\"CT_HierBranchStyle\" minOccurs=\"0\"/>\n * <xsd:element name=\"animOne\" type=\"CT_AnimOne\" minOccurs=\"0\"/>\n * <xsd:element name=\"animLvl\" type=\"CT_AnimLvl\" minOccurs=\"0\"/>\n * <xsd:element name=\"resizeHandles\" type=\"CT_ResizeHandles\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * </xsd:complexType>\n * ```\n */\nexport const createPresentationLayoutVariables = (\n options?: PresentationLayoutVariablesOptions,\n): string => {\n const children: string[] = [];\n if (options?.orgChart) children.push(createOrgChart(options.orgChart));\n if (options?.maxChildren) children.push(createMaxChildren(options.maxChildren));\n if (options?.preferredChildren) children.push(createPreferredChildren(options.preferredChildren));\n if (options?.animateOneByOne) children.push(createAnimateOneByOne(options.animateOneByOne));\n if (options?.animationLevel) children.push(createAnimationLevel(options.animationLevel));\n if (options?.hierBranch) children.push(createHierBranch(options.hierBranch));\n\n return element(\"dgm:presLayoutVars\", undefined, children);\n};\n\n// ---------------------------------------------------------------------------\n// dgm:adjLst — adjustment list (CT_AdjLst)\n// ---------------------------------------------------------------------------\n\nexport interface AdjustListOptions {\n adjustments?: readonly AdjustOptions[];\n}\n\n/** Creates a dgm:adjLst element containing dgm:adj children. */\nexport const createAdjustList = (options?: AdjustListOptions): string => {\n const children: string[] = [];\n if (options?.adjustments) {\n for (const a of options.adjustments) {\n children.push(createAdjust(a));\n }\n }\n return element(\"dgm:adjLst\", undefined, children);\n};\n","/**\n * Diagram definition header elements.\n *\n * Reference: ISO/IEC 29500-4, dml-diagram.xsd\n * CT_ColorTransformHeader, CT_DiagramDefinitionHeader, CT_StyleDefinitionHeader\n * and their list containers.\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\n// ---------------------------------------------------------------------------\n// Shared name/description/category types\n// ---------------------------------------------------------------------------\n\nexport interface DiagramNameOptions {\n lang?: string;\n val: string;\n}\n\nexport interface DiagramDescriptionOptions {\n lang?: string;\n val: string;\n}\n\nexport interface DiagramCategoryOptions {\n type: string;\n pri: number;\n}\n\nconst createNameEl = (tag: string, options: DiagramNameOptions): string => {\n const attrs: Record<string, string> = { val: options.val };\n if (options.lang) attrs.lang = options.lang;\n return element(tag, attrs);\n};\n\nconst createDescEl = (tag: string, options: DiagramDescriptionOptions): string => {\n const attrs: Record<string, string> = { val: options.val };\n if (options.lang) attrs.lang = options.lang;\n return element(tag, attrs);\n};\n\nconst createCatEl = (options: DiagramCategoryOptions): string =>\n `<dgm:cat type=\"${options.type}\" pri=\"${options.pri}\"/>`;\n\nconst createCatLst = (categories?: readonly DiagramCategoryOptions[]): string => {\n const children: string[] = [];\n if (categories) {\n for (const cat of categories) {\n children.push(createCatEl(cat));\n }\n }\n return element(\"dgm:catLst\", undefined, children);\n};\n\n// ---------------------------------------------------------------------------\n// dgm:colorsDefHdr — color definition header (CT_ColorTransformHeader)\n// ---------------------------------------------------------------------------\n\nexport interface ColorsDefinitionHeaderOptions {\n uniqueId: string;\n minVer?: string;\n resId?: number;\n title: readonly DiagramNameOptions[];\n desc: readonly DiagramDescriptionOptions[];\n categories?: readonly DiagramCategoryOptions[];\n}\n\n/**\n * Creates a dgm:colorsDefHdr element (CT_ColorTransformHeader).\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_ColorTransformHeader\">\n * <xsd:sequence>\n * <xsd:element name=\"title\" type=\"CT_CTName\" minOccurs=\"1\" maxOccurs=\"unbounded\"/>\n * <xsd:element name=\"desc\" type=\"CT_CTDescription\" minOccurs=\"1\" maxOccurs=\"unbounded\"/>\n * <xsd:element name=\"catLst\" type=\"CT_CTCategories\" minOccurs=\"0\"/>\n * <xsd:element name=\"extLst\" type=\"a:CT_OfficeArtExtensionList\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"uniqueId\" type=\"xsd:string\" use=\"required\"/>\n * <xsd:attribute name=\"minVer\" type=\"xsd:string\" use=\"optional\"/>\n * <xsd:attribute name=\"resId\" type=\"xsd:int\" use=\"optional\" default=\"0\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createColorsDefinitionHeader = (options: ColorsDefinitionHeaderOptions): string => {\n const children: string[] = [];\n for (const t of options.title) children.push(createNameEl(\"dgm:title\", t));\n for (const d of options.desc) children.push(createDescEl(\"dgm:desc\", d));\n if (options.categories?.length) children.push(createCatLst(options.categories));\n\n const attrs: Record<string, string | number> = { uniqueId: options.uniqueId };\n if (options.minVer !== undefined) attrs.minVer = options.minVer;\n if (options.resId !== undefined) attrs.resId = options.resId;\n\n return element(\"dgm:colorsDefHdr\", attrs, children);\n};\n\n// ---------------------------------------------------------------------------\n// dgm:colorsDefHdrLst — list of color definition headers (CT_ColorTransformHeaderLst)\n// ---------------------------------------------------------------------------\n\nexport interface ColorsDefinitionHeaderListOptions {\n headers?: readonly ColorsDefinitionHeaderOptions[];\n}\n\n/** Creates a dgm:colorsDefHdrLst element. */\nexport const createColorsDefinitionHeaderList = (\n options?: ColorsDefinitionHeaderListOptions,\n): string => {\n const children: string[] = [];\n if (options?.headers) {\n for (const hdr of options.headers) {\n children.push(createColorsDefinitionHeader(hdr));\n }\n }\n return element(\"dgm:colorsDefHdrLst\", undefined, children);\n};\n\n// ---------------------------------------------------------------------------\n// dgm:layoutDefHdr — layout definition header (CT_DiagramDefinitionHeader)\n// ---------------------------------------------------------------------------\n\nexport interface LayoutDefinitionHeaderOptions {\n uniqueId: string;\n minVer?: string;\n defStyle?: string;\n resId?: number;\n title: readonly DiagramNameOptions[];\n desc: readonly DiagramDescriptionOptions[];\n categories?: readonly DiagramCategoryOptions[];\n}\n\n/**\n * Creates a dgm:layoutDefHdr element (CT_DiagramDefinitionHeader).\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_DiagramDefinitionHeader\">\n * <xsd:sequence>\n * <xsd:element name=\"title\" type=\"CT_Name\" minOccurs=\"1\" maxOccurs=\"unbounded\"/>\n * <xsd:element name=\"desc\" type=\"CT_Description\" minOccurs=\"1\" maxOccurs=\"unbounded\"/>\n * <xsd:element name=\"catLst\" type=\"CT_Categories\" minOccurs=\"0\"/>\n * <xsd:element name=\"extLst\" type=\"a:CT_OfficeArtExtensionList\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"uniqueId\" type=\"xsd:string\" use=\"required\"/>\n * <xsd:attribute name=\"minVer\" type=\"xsd:string\" use=\"optional\"/>\n * <xsd:attribute name=\"defStyle\" type=\"xsd:string\" use=\"optional\" default=\"\"/>\n * <xsd:attribute name=\"resId\" type=\"xsd:int\" use=\"optional\" default=\"0\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createLayoutDefinitionHeader = (options: LayoutDefinitionHeaderOptions): string => {\n const children: string[] = [];\n for (const t of options.title) children.push(createNameEl(\"dgm:title\", t));\n for (const d of options.desc) children.push(createDescEl(\"dgm:desc\", d));\n if (options.categories?.length) children.push(createCatLst(options.categories));\n\n const attrs: Record<string, string | number> = { uniqueId: options.uniqueId };\n if (options.minVer !== undefined) attrs.minVer = options.minVer;\n if (options.defStyle !== undefined) attrs.defStyle = options.defStyle;\n if (options.resId !== undefined) attrs.resId = options.resId;\n\n return element(\"dgm:layoutDefHdr\", attrs, children);\n};\n\n// ---------------------------------------------------------------------------\n// dgm:layoutDefHdrLst — list of layout definition headers (CT_DiagramDefinitionHeaderLst)\n// ---------------------------------------------------------------------------\n\nexport interface LayoutDefinitionHeaderListOptions {\n headers?: readonly LayoutDefinitionHeaderOptions[];\n}\n\n/** Creates a dgm:layoutDefHdrLst element. */\nexport const createLayoutDefinitionHeaderList = (\n options?: LayoutDefinitionHeaderListOptions,\n): string => {\n const children: string[] = [];\n if (options?.headers) {\n for (const hdr of options.headers) {\n children.push(createLayoutDefinitionHeader(hdr));\n }\n }\n return element(\"dgm:layoutDefHdrLst\", undefined, children);\n};\n\n// ---------------------------------------------------------------------------\n// dgm:styleDefHdr — style definition header (CT_StyleDefinitionHeader)\n// ---------------------------------------------------------------------------\n\nexport interface StyleDefinitionHeaderOptions {\n uniqueId: string;\n minVer?: string;\n resId?: number;\n title: readonly DiagramNameOptions[];\n desc: readonly DiagramDescriptionOptions[];\n categories?: readonly DiagramCategoryOptions[];\n}\n\n/**\n * Creates a dgm:styleDefHdr element (CT_StyleDefinitionHeader).\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_StyleDefinitionHeader\">\n * <xsd:sequence>\n * <xsd:element name=\"title\" type=\"CT_SDName\" minOccurs=\"1\" maxOccurs=\"unbounded\"/>\n * <xsd:element name=\"desc\" type=\"CT_SDDescription\" minOccurs=\"1\" maxOccurs=\"unbounded\"/>\n * <xsd:element name=\"catLst\" type=\"CT_SDCategories\" minOccurs=\"0\"/>\n * <xsd:element name=\"extLst\" type=\"a:CT_OfficeArtExtensionList\" minOccurs=\"0\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"uniqueId\" type=\"xsd:string\" use=\"required\"/>\n * <xsd:attribute name=\"minVer\" type=\"xsd:string\" use=\"optional\"/>\n * <xsd:attribute name=\"resId\" type=\"xsd:int\" use=\"optional\" default=\"0\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createStyleDefinitionHeader = (options: StyleDefinitionHeaderOptions): string => {\n const children: string[] = [];\n for (const t of options.title) children.push(createNameEl(\"dgm:title\", t));\n for (const d of options.desc) children.push(createDescEl(\"dgm:desc\", d));\n if (options.categories?.length) children.push(createCatLst(options.categories));\n\n const attrs: Record<string, string | number> = { uniqueId: options.uniqueId };\n if (options.minVer !== undefined) attrs.minVer = options.minVer;\n if (options.resId !== undefined) attrs.resId = options.resId;\n\n return element(\"dgm:styleDefHdr\", attrs, children);\n};\n\n// ---------------------------------------------------------------------------\n// dgm:styleDefHdrLst — list of style definition headers (CT_StyleDefinitionHeaderLst)\n// ---------------------------------------------------------------------------\n\nexport interface StyleDefinitionHeaderListOptions {\n headers?: readonly StyleDefinitionHeaderOptions[];\n}\n\n/** Creates a dgm:styleDefHdrLst element. */\nexport const createStyleDefinitionHeaderList = (\n options?: StyleDefinitionHeaderListOptions,\n): string => {\n const children: string[] = [];\n if (options?.headers) {\n for (const hdr of options.headers) {\n children.push(createStyleDefinitionHeader(hdr));\n }\n }\n return element(\"dgm:styleDefHdrLst\", undefined, children);\n};\n","/**\n * Diagram relationship IDs element.\n *\n * Reference: ISO/IEC 29500-4, dml-diagram.xsd, CT_RelIds\n *\n * @module\n */\n\n// ---------------------------------------------------------------------------\n// dgm:relIds — relationship IDs (CT_RelIds)\n// ---------------------------------------------------------------------------\n\nexport interface DiagramRelationshipIdsOptions {\n /** Relationship to data model part (@r:dm) */\n dataModel: string;\n /** Relationship to layout definition part (@r:lo) */\n layout: string;\n /** Relationship to quick style part (@r:qs) */\n quickStyle: string;\n /** Relationship to color transform part (@r:cs) */\n colorStyle: string;\n}\n\n/**\n * Creates a dgm:relIds element (CT_RelIds).\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_RelIds\">\n * <xsd:attribute ref=\"r:dm\" use=\"required\"/>\n * <xsd:attribute ref=\"r:lo\" use=\"required\"/>\n * <xsd:attribute ref=\"r:qs\" use=\"required\"/>\n * <xsd:attribute ref=\"r:cs\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createDiagramRelationshipIds = (options: DiagramRelationshipIdsOptions): string =>\n `<dgm:relIds r:dm=\"${options.dataModel}\" r:lo=\"${options.layout}\" r:qs=\"${options.quickStyle}\" r:cs=\"${options.colorStyle}\"/>`;\n","/**\n * Diagram extension list, 3D shape, and text properties.\n *\n * Reference: ISO/IEC 29500-4, dml-diagram.xsd, dml-main.xsd\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport type { Shape3DOptions } from \"../three-d/shape-3d\";\nimport { createShape3D } from \"../three-d/shape-3d\";\n\n// ---------------------------------------------------------------------------\n// dgm:extLst — extension list (a:CT_OfficeArtExtensionList)\n// ---------------------------------------------------------------------------\n\nexport interface DiagramExtensionListOptions {\n /** Extension URIs */\n extensions?: readonly DiagramExtensionOptions[];\n}\n\nexport interface DiagramExtensionOptions {\n uri: string;\n}\n\n/**\n * Creates a dgm:extLst element (a:CT_OfficeArtExtensionList).\n *\n * Generic extension list pattern used across OOXML.\n */\nexport const createDiagramExtensionList = (options?: DiagramExtensionListOptions): string => {\n const children: string[] = [];\n if (options?.extensions) {\n for (const ext of options.extensions) {\n children.push(`<a:ext uri=\"${ext.uri}\"/>`);\n }\n }\n return element(\"dgm:extLst\", undefined, children);\n};\n\n// ---------------------------------------------------------------------------\n// dgm:sp3d — 3D shape properties (a:CT_Shape3D)\n// ---------------------------------------------------------------------------\n\n/**\n * Creates a dgm:sp3d element wrapping a:CT_Shape3D.\n *\n * Delegates to the shared createShape3D factory but wraps in dgm: namespace context.\n */\nexport const createDiagramShape3D = (options: Shape3DOptions): string => createShape3D(options);\n\n// ---------------------------------------------------------------------------\n// dgm:txPr — text properties (CT_TextProps)\n// ---------------------------------------------------------------------------\n\nexport interface DiagramTextPropertiesOptions {\n /** Flat text (a:flatTx, the no-3D member of EG_Text3D) — empty marker element */\n flat?: boolean;\n}\n\n/**\n * Creates a dgm:txPr element (CT_TextProps).\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_TextProps\">\n * <xsd:sequence>\n * <xsd:group ref=\"a:EG_Text3D\" minOccurs=\"0\" maxOccurs=\"1\"/>\n * </xsd:sequence>\n * </xsd:complexType>\n * ```\n */\nexport const createDiagramTextProperties = (options?: DiagramTextPropertiesOptions): string =>\n options?.flat ? \"<dgm:txPr><a:flatTx/></dgm:txPr>\" : \"<dgm:txPr/>\";\n","/**\n * Blip descriptor for DrawingML pictures.\n *\n * @module\n */\n\nimport { escapeXml } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\nimport { findChild } from \"@office-open/xml\";\n\nimport type { CustomDescriptor, ReadContext, WriteContext } from \"../../descriptor\";\nimport { stringify, parse } from \"../../descriptor\";\nimport { emitAngle, emitPercent, parseAngle } from \"../../util/converters\";\nimport { xsdRectAlignment } from \"../../util/mappings\";\nimport { parseOnOff } from \"../../util/values\";\nimport { solidFillDesc } from \"../color/color-descriptors\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\nimport type { BlipOptions } from \"./blip\";\nimport type {\n BlipEffectsOptions,\n LuminanceEffectOptions,\n HSLEffectOptions,\n TintEffectOptions,\n AlphaModulateFixedEffectOptions,\n ColorChangeEffectOptions,\n BlipBlurEffectOptions,\n} from \"./blip-effects\";\nimport type { BlipFillOptions } from \"./blip-fill\";\nimport type { SourceRectangleOptions } from \"./source-rectangle\";\nimport type { TileOptions } from \"./tile\";\n\n// ── Tile descriptor (a:tile) ──\n\nexport const tileDesc: CustomDescriptor<TileOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const attrParts: string[] = [];\n if (opts.tx !== undefined) attrParts.push(`tx=\"${opts.tx}\"`);\n if (opts.ty !== undefined) attrParts.push(`ty=\"${opts.ty}\"`);\n if (opts.sx !== undefined) attrParts.push(`sx=\"${emitPercent(opts.sx)}\"`);\n if (opts.sy !== undefined) attrParts.push(`sy=\"${emitPercent(opts.sy)}\"`);\n if (opts.flip !== undefined) attrParts.push(`flip=\"${escapeXml(opts.flip)}\"`);\n if (opts.alignment !== undefined)\n attrParts.push(`algn=\"${escapeXml(xsdRectAlignment.to(opts.alignment))}\"`);\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n return `<a:tile${attrStr}/>`;\n },\n parse(el, _ctx) {\n const result: TileOptions = {};\n if (el.attributes?.[\"tx\"] !== undefined) result.tx = Number(el.attributes[\"tx\"]);\n if (el.attributes?.[\"ty\"] !== undefined) result.ty = Number(el.attributes[\"ty\"]);\n if (el.attributes?.[\"sx\"] !== undefined) result.sx = parsePercent(el.attributes[\"sx\"])!;\n if (el.attributes?.[\"sy\"] !== undefined) result.sy = parsePercent(el.attributes[\"sy\"])!;\n if (el.attributes?.[\"flip\"] !== undefined)\n result.flip = String(el.attributes[\"flip\"]) as TileOptions[\"flip\"];\n if (el.attributes?.[\"algn\"] !== undefined)\n result.alignment = xsdRectAlignment.from(\n String(el.attributes[\"algn\"]),\n ) as TileOptions[\"alignment\"];\n return result;\n },\n};\n\n// ── SourceRectangle descriptor (a:srcRect) ──\n\nexport const sourceRectangleDesc: CustomDescriptor<SourceRectangleOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const attrParts: string[] = [];\n if (opts.left !== undefined) attrParts.push(`l=\"${emitPercent(opts.left)}\"`);\n if (opts.top !== undefined) attrParts.push(`t=\"${emitPercent(opts.top)}\"`);\n if (opts.right !== undefined) attrParts.push(`r=\"${emitPercent(opts.right)}\"`);\n if (opts.bottom !== undefined) attrParts.push(`b=\"${emitPercent(opts.bottom)}\"`);\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n return `<a:srcRect${attrStr}/>`;\n },\n parse(el, _ctx) {\n const result: SourceRectangleOptions = {};\n if (el.attributes?.[\"l\"] !== undefined) result.left = parsePercent(el.attributes[\"l\"])!;\n if (el.attributes?.[\"t\"] !== undefined) result.top = parsePercent(el.attributes[\"t\"])!;\n if (el.attributes?.[\"r\"] !== undefined) result.right = parsePercent(el.attributes[\"r\"])!;\n if (el.attributes?.[\"b\"] !== undefined) result.bottom = parsePercent(el.attributes[\"b\"])!;\n return result;\n },\n};\n\n// ── Stretch descriptor (a:stretch) ──\n\nexport const stretchDesc: CustomDescriptor<SourceRectangleOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const attrParts: string[] = [];\n if (opts.left !== undefined) attrParts.push(`l=\"${opts.left}\"`);\n if (opts.top !== undefined) attrParts.push(`t=\"${opts.top}\"`);\n if (opts.right !== undefined) attrParts.push(`r=\"${opts.right}\"`);\n if (opts.bottom !== undefined) attrParts.push(`b=\"${opts.bottom}\"`);\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n return `<a:stretch><a:fillRect${attrStr}/></a:stretch>`;\n },\n parse(el, _ctx) {\n const fillRect = findChild(el, \"a:fillRect\");\n if (!fillRect) return {};\n const result: SourceRectangleOptions = {};\n if (fillRect.attributes?.[\"l\"] !== undefined) result.left = Number(fillRect.attributes[\"l\"]);\n if (fillRect.attributes?.[\"t\"] !== undefined) result.top = Number(fillRect.attributes[\"t\"]);\n if (fillRect.attributes?.[\"r\"] !== undefined) result.right = Number(fillRect.attributes[\"r\"]);\n if (fillRect.attributes?.[\"b\"] !== undefined) result.bottom = Number(fillRect.attributes[\"b\"]);\n return result;\n },\n};\n\n// ── Blip effects helpers ──\n\nfunction stringifyBlipEffects(opts: BlipEffectsOptions, ctx: WriteContext): string {\n const parts: string[] = [];\n\n if (opts.grayscale) {\n parts.push(\"<a:grayscl/>\");\n }\n\n if (opts.luminance) {\n const attrParts: string[] = [];\n if (opts.luminance.bright !== undefined)\n attrParts.push(`bright=\"${emitPercent(opts.luminance.bright)}\"`);\n if (opts.luminance.contrast !== undefined)\n attrParts.push(`contrast=\"${emitPercent(opts.luminance.contrast)}\"`);\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n parts.push(`<a:lum${attrStr}/>`);\n }\n\n if (opts.hsl) {\n const attrParts: string[] = [];\n if (opts.hsl.hue !== undefined) attrParts.push(`hue=\"${emitAngle(opts.hsl.hue)}\"`);\n if (opts.hsl.saturation !== undefined)\n attrParts.push(`sat=\"${emitPercent(opts.hsl.saturation)}\"`);\n if (opts.hsl.luminance !== undefined)\n attrParts.push(`lum=\"${emitPercent(opts.hsl.luminance)}\"`);\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n parts.push(`<a:hsl${attrStr}/>`);\n }\n\n if (opts.tint) {\n const attrParts: string[] = [];\n if (opts.tint.hue !== undefined) attrParts.push(`hue=\"${emitAngle(opts.tint.hue)}\"`);\n if (opts.tint.amount !== undefined) attrParts.push(`amt=\"${emitPercent(opts.tint.amount)}\"`);\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n parts.push(`<a:tint${attrStr}/>`);\n }\n\n if (opts.duotone) {\n const c1 = stringify(solidFillDesc, opts.duotone.color1, ctx);\n const c2 = stringify(solidFillDesc, opts.duotone.color2, ctx);\n parts.push(`<a:duotone>${c1 ?? \"\"}${c2 ?? \"\"}</a:duotone>`);\n }\n\n if (opts.biLevel) {\n parts.push(`<a:biLevel thresh=\"${emitPercent(opts.biLevel.threshold)}\"/>`);\n }\n\n if (opts.alphaCeiling) {\n parts.push(\"<a:alphaCeiling/>\");\n }\n\n if (opts.alphaFloor) {\n parts.push(\"<a:alphaFloor/>\");\n }\n\n if (opts.alphaInverse !== undefined) {\n if (typeof opts.alphaInverse === \"boolean\") {\n parts.push(\"<a:alphaInv/>\");\n } else {\n const colorXml = stringify(solidFillDesc, opts.alphaInverse, ctx);\n parts.push(`<a:alphaInv>${colorXml ?? \"\"}</a:alphaInv>`);\n }\n }\n\n if (opts.alphaModulateFixed) {\n const amt = emitPercent(opts.alphaModulateFixed.amount ?? 100);\n parts.push(`<a:alphaModFix amt=\"${amt}\"/>`);\n }\n\n if (opts.alphaReplace) {\n parts.push(`<a:alphaRepl a=\"${emitPercent(opts.alphaReplace.alpha)}\"/>`);\n }\n\n if (opts.alphaBiLevel) {\n parts.push(`<a:alphaBiLevel thresh=\"${emitPercent(opts.alphaBiLevel.threshold)}\"/>`);\n }\n\n if (opts.colorChange) {\n const fromXml = stringify(solidFillDesc, opts.colorChange.from, ctx);\n const toXml = stringify(solidFillDesc, opts.colorChange.to, ctx);\n const attrParts: string[] = [];\n if (opts.colorChange.useAlpha === false) attrParts.push('useA=\"0\"');\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n parts.push(\n `<a:clrChange${attrStr}><a:clrFrom>${fromXml ?? \"\"}</a:clrFrom><a:clrTo>${toXml ?? \"\"}</a:clrTo></a:clrChange>`,\n );\n }\n\n if (opts.colorReplace) {\n const colorXml = stringify(solidFillDesc, opts.colorReplace.color, ctx);\n parts.push(`<a:clrRepl>${colorXml ?? \"\"}</a:clrRepl>`);\n }\n\n if (opts.blur) {\n const attrParts: string[] = [];\n if (opts.blur.radius !== undefined) attrParts.push(`rad=\"${opts.blur.radius}\"`);\n if (opts.blur.grow === false) attrParts.push('grow=\"0\"');\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n parts.push(`<a:blur${attrStr}/>`);\n }\n\n return parts.join(\"\");\n}\n\n// Parse an ST_Percentage attribute that may be a 1/1000th integer (\"50000\")\n// or a percent literal (\"50%\"); both are XSD-valid. Returns integer percent.\nfunction parsePercent(raw: string | number | undefined): number | undefined {\n if (raw === undefined) return undefined;\n const s = typeof raw === \"number\" ? String(raw) : raw;\n if (s.endsWith(\"%\")) return Number(s.slice(0, -1));\n return Number(s) / 1000;\n}\n\nfunction readBlipEffects(el: XmlElement, ctx: ReadContext): BlipEffectsOptions | undefined {\n const result: BlipEffectsOptions = {};\n\n if (findChild(el, \"a:grayscl\")) result.grayscale = true;\n\n const lum = findChild(el, \"a:lum\");\n if (lum) {\n const opts: LuminanceEffectOptions = {};\n const bright = parsePercent(lum.attributes?.[\"bright\"]);\n if (bright !== undefined) opts.bright = bright;\n const contrast = parsePercent(lum.attributes?.[\"contrast\"]);\n if (contrast !== undefined) opts.contrast = contrast;\n result.luminance = opts;\n }\n\n const hsl = findChild(el, \"a:hsl\");\n if (hsl) {\n const opts: HSLEffectOptions = {};\n if (hsl.attributes?.[\"hue\"] !== undefined) opts.hue = parseAngle(Number(hsl.attributes[\"hue\"]));\n const sat = parsePercent(hsl.attributes?.[\"sat\"]);\n if (sat !== undefined) opts.saturation = sat;\n const l = parsePercent(hsl.attributes?.[\"lum\"]);\n if (l !== undefined) opts.luminance = l;\n result.hsl = opts;\n }\n\n const tint = findChild(el, \"a:tint\");\n if (tint) {\n const opts: TintEffectOptions = {};\n if (tint.attributes?.[\"hue\"] !== undefined)\n opts.hue = parseAngle(Number(tint.attributes[\"hue\"]));\n const amt = parsePercent(tint.attributes?.[\"amt\"]);\n if (amt !== undefined) opts.amount = amt;\n result.tint = opts;\n }\n\n const biLevel = findChild(el, \"a:biLevel\");\n if (biLevel?.attributes?.[\"thresh\"] !== undefined) {\n result.biLevel = { threshold: parsePercent(biLevel.attributes[\"thresh\"])! };\n }\n\n if (findChild(el, \"a:alphaCeiling\")) result.alphaCeiling = true;\n if (findChild(el, \"a:alphaFloor\")) result.alphaFloor = true;\n\n const alphaInv = findChild(el, \"a:alphaInv\");\n if (alphaInv) {\n const solidFill = findChild(alphaInv, \"a:solidFill\");\n if (solidFill) {\n result.alphaInverse = parse(solidFillDesc, solidFill, ctx);\n } else {\n result.alphaInverse = {} as SolidFillOptions;\n }\n }\n\n const alphaModFix = findChild(el, \"a:alphaModFix\");\n if (alphaModFix) {\n const opts: AlphaModulateFixedEffectOptions = {};\n const amt = parsePercent(alphaModFix.attributes?.[\"amt\"]);\n if (amt !== undefined) opts.amount = amt;\n result.alphaModulateFixed = opts;\n }\n\n const alphaRepl = findChild(el, \"a:alphaRepl\");\n if (alphaRepl?.attributes?.[\"a\"] !== undefined) {\n result.alphaReplace = { alpha: parsePercent(alphaRepl.attributes[\"a\"])! };\n }\n\n const alphaBiLevel = findChild(el, \"a:alphaBiLevel\");\n if (alphaBiLevel?.attributes?.[\"thresh\"] !== undefined) {\n result.alphaBiLevel = { threshold: parsePercent(alphaBiLevel.attributes[\"thresh\"])! };\n }\n\n const clrChange = findChild(el, \"a:clrChange\");\n if (clrChange) {\n const opts: Partial<ColorChangeEffectOptions> = {};\n if (clrChange.attributes?.[\"useA\"] !== undefined)\n opts.useAlpha = parseOnOff(clrChange.attributes[\"useA\"]) ?? true;\n const clrFrom = findChild(clrChange, \"a:clrFrom\");\n if (clrFrom) {\n const fromFill = findChild(clrFrom, \"a:solidFill\");\n if (fromFill) opts.from = parse(solidFillDesc, fromFill, ctx);\n }\n const clrTo = findChild(clrChange, \"a:clrTo\");\n if (clrTo) {\n const toFill = findChild(clrTo, \"a:solidFill\");\n if (toFill) opts.to = parse(solidFillDesc, toFill, ctx);\n }\n result.colorChange = opts as ColorChangeEffectOptions;\n }\n\n const clrRepl = findChild(el, \"a:clrRepl\");\n if (clrRepl) {\n const solidFill = findChild(clrRepl, \"a:solidFill\");\n if (solidFill)\n result.colorReplace = { color: parse(solidFillDesc, solidFill, ctx) as SolidFillOptions };\n }\n\n const blur = findChild(el, \"a:blur\");\n if (blur) {\n const opts: BlipBlurEffectOptions = {};\n if (blur.attributes?.[\"rad\"] !== undefined) opts.radius = Number(blur.attributes[\"rad\"]);\n if (blur.attributes?.[\"grow\"] !== undefined)\n opts.grow = parseOnOff(blur.attributes[\"grow\"]) ?? true;\n result.blur = opts;\n }\n\n const duotone = findChild(el, \"a:duotone\");\n if (duotone?.elements) {\n // Try to read two solidFill children\n const fills: SolidFillOptions[] = [];\n for (const child of duotone.elements) {\n const sf = findChild(child, \"a:solidFill\");\n if (sf) fills.push(parse(solidFillDesc, sf, ctx) as SolidFillOptions);\n }\n const [color1, color2] = fills;\n if (color1 && color2) {\n result.duotone = { color1, color2 };\n }\n }\n\n return Object.keys(result).length > 0 ? (result as BlipEffectsOptions) : undefined;\n}\n\n// ── Blip descriptor (a:blip) ──\n\nexport const blipDesc: CustomDescriptor<BlipOptions & { blipEffects?: BlipEffectsOptions }> = {\n kind: \"custom\",\n stringify(opts, ctx) {\n const attrParts: string[] = [];\n const embedValue = `{${opts.referenceId}}`;\n attrParts.push(`r:embed=\"${escapeXml(embedValue)}\"`);\n attrParts.push('cstate=\"none\"');\n const attrStr = \" \" + attrParts.join(\" \");\n\n const parts: string[] = [];\n if (opts.blipEffects) {\n parts.push(stringifyBlipEffects(opts.blipEffects, ctx));\n }\n\n const content = parts.join(\"\");\n if (!content) return `<a:blip${attrStr}/>`;\n return `<a:blip${attrStr}>${content}</a:blip>`;\n },\n parse(el, ctx) {\n const result: Partial<BlipOptions & { blipEffects?: BlipEffectsOptions }> = {};\n const embed = el.attributes?.[\"r:embed\"];\n if (embed !== undefined) {\n // Strip { and } wrapper if present\n result.referenceId = String(embed).replace(/^\\{(.+)\\}$/, \"$1\");\n }\n const link = el.attributes?.[\"r:link\"];\n if (link !== undefined) {\n result.referenceId = String(link).replace(/^\\{(.+)\\}$/, \"$1\");\n }\n const effects = readBlipEffects(el, ctx);\n if (effects) result.blipEffects = effects;\n return result as BlipOptions & { blipEffects?: BlipEffectsOptions };\n },\n};\n\n// ── BlipFill descriptor (pic:blipFill / a:blipFill) ──\n\nexport const blipFillDesc: CustomDescriptor<\n BlipFillOptions & { referenceId?: string; blipEffects?: BlipEffectsOptions }\n> = {\n kind: \"custom\",\n stringify(opts, ctx) {\n const attrParts: string[] = [];\n if (opts.dpi !== undefined) attrParts.push(`dpi=\"${opts.dpi}\"`);\n if (opts.rotWithShape !== undefined)\n attrParts.push(`rotWithShape=\"${opts.rotWithShape ? 1 : 0}\"`);\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n\n const parts: string[] = [];\n\n // Blip child (uses referenceId from parent)\n if (opts.referenceId) {\n const blipOpts = { referenceId: opts.referenceId, blipEffects: opts.blipEffects };\n const blipXml = stringify(blipDesc, blipOpts, ctx);\n if (blipXml) parts.push(blipXml);\n }\n\n // Source rectangle\n if (opts.sourceRectangle) {\n const srcRectXml = stringify(sourceRectangleDesc, opts.sourceRectangle, ctx);\n if (srcRectXml) parts.push(srcRectXml);\n }\n\n // Tile or stretch\n if (opts.tile) {\n const tileXml = stringify(tileDesc, opts.tile, ctx);\n if (tileXml) parts.push(tileXml);\n } else {\n parts.push(\"<a:stretch><a:fillRect/></a:stretch>\");\n }\n\n const content = parts.join(\"\");\n if (!attrStr && !content) return undefined;\n if (!content) return `<pic:blipFill${attrStr}/>`;\n return `<pic:blipFill${attrStr}>${content}</pic:blipFill>`;\n },\n parse(el, ctx) {\n const result: Partial<\n BlipFillOptions & { referenceId?: string; blipEffects?: BlipEffectsOptions }\n > = {};\n\n // Attributes\n if (el.attributes?.[\"dpi\"] !== undefined) result.dpi = Number(el.attributes[\"dpi\"]);\n if (el.attributes?.[\"rotWithShape\"] !== undefined)\n result.rotWithShape = parseOnOff(el.attributes[\"rotWithShape\"]) ?? true;\n\n // Blip child\n const blip = findChild(el, \"a:blip\");\n if (blip) {\n const blipResult = parse(blipDesc, blip, ctx);\n if (blipResult.referenceId) result.referenceId = blipResult.referenceId;\n if (blipResult.blipEffects) result.blipEffects = blipResult.blipEffects;\n }\n\n // Source rectangle\n const srcRect = findChild(el, \"a:srcRect\");\n if (srcRect) result.sourceRectangle = parse(sourceRectangleDesc, srcRect, ctx);\n\n // Tile\n const tile = findChild(el, \"a:tile\");\n if (tile) result.tile = parse(tileDesc, tile, ctx);\n\n return result as BlipFillOptions & { referenceId?: string; blipEffects?: BlipEffectsOptions };\n },\n};\n","/**\n * Fill descriptors for DrawingML EG_FillProperties.\n *\n * @module\n */\n\nimport { escapeXml } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\nimport { findChild } from \"@office-open/xml\";\n\nimport type { CustomDescriptor, ReadContext } from \"../../descriptor\";\nimport { stringify, parse } from \"../../descriptor\";\nimport { emitAngle, emitPercent, parseAngle, parsePercent } from \"../../util/converters\";\nimport { toUint8Array } from \"../../util/data-type\";\nimport { xsdPattern } from \"../../util/mappings\";\nimport { parseOnOff, stripColorHashPrefix } from \"../../util/values\";\nimport { blipFillDesc } from \"../blip/blip-descriptors\";\nimport { solidFillDesc, parseColorChoice, stringifyColorChoice } from \"../color/color-descriptors\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\nimport { buildFill, type BlipFillConfigOptions, type FillOptions } from \"./fill-options\";\nimport type {\n GradientFillOptions,\n GradientShadeOptions,\n LinearShadeOptions,\n PathShadeOptions,\n RelativeRect,\n} from \"./gradient-fill\";\nimport type { PatternFillOptions } from \"./pattern-fill\";\n\n// ── Gradient fill helpers ──\n\nfunction stringifyRelativeRect(tag: string, rect: RelativeRect): string {\n const parts: string[] = [];\n if (rect.left) parts.push(`l=\"${escapeXml(rect.left)}\"`);\n if (rect.top) parts.push(`t=\"${escapeXml(rect.top)}\"`);\n if (rect.right) parts.push(`r=\"${escapeXml(rect.right)}\"`);\n if (rect.bottom) parts.push(`b=\"${escapeXml(rect.bottom)}\"`);\n const attrStr = parts.length ? \" \" + parts.join(\" \") : \"\";\n return `<${tag}${attrStr}/>`;\n}\n\nfunction readRelativeRect(el: XmlElement): RelativeRect {\n const result: RelativeRect = {};\n if (el.attributes?.[\"l\"]) result.left = String(el.attributes[\"l\"]);\n if (el.attributes?.[\"t\"]) result.top = String(el.attributes[\"t\"]);\n if (el.attributes?.[\"r\"]) result.right = String(el.attributes[\"r\"]);\n if (el.attributes?.[\"b\"]) result.bottom = String(el.attributes[\"b\"]);\n return result as RelativeRect;\n}\n\nfunction stringifyShade(shade: GradientShadeOptions): string {\n if (\"angle\" in shade) {\n const parts: string[] = [];\n if (shade.angle !== undefined) parts.push(`ang=\"${emitAngle(shade.angle)}\"`);\n if (shade.scaled !== undefined) parts.push(`scaled=\"${shade.scaled ? 1 : 0}\"`);\n const attrStr = parts.length ? \" \" + parts.join(\" \") : \"\";\n return `<a:lin${attrStr}/>`;\n }\n const pathShade = shade as PathShadeOptions;\n const parts: string[] = [];\n if (pathShade.path) parts.push(`path=\"${escapeXml(pathShade.path)}\"`);\n const attrStr = parts.length ? \" \" + parts.join(\" \") : \"\";\n if (pathShade.fillToRectangle) {\n return `<a:path${attrStr}>${stringifyRelativeRect(\"a:fillToRect\", pathShade.fillToRectangle)}</a:path>`;\n }\n return `<a:path${attrStr}/>`;\n}\n\n// ── GradientFill descriptor ──\n\nexport const gradientFillDesc: CustomDescriptor<GradientFillOptions> = {\n kind: \"custom\",\n stringify(opts, ctx) {\n const parts: string[] = [];\n\n // Gradient stop list — a:gs expects EG_ColorChoice (direct color), NOT solidFill\n const stopsXml = opts.stops\n .map((stop) => {\n const colorXml = stringifyColorChoice(stop.color, ctx);\n if (!colorXml) return `<a:gs pos=\"${emitPercent(stop.position)}\"/>`;\n return `<a:gs pos=\"${emitPercent(stop.position)}\">${colorXml}</a:gs>`;\n })\n .join(\"\");\n parts.push(`<a:gsLst>${stopsXml}</a:gsLst>`);\n\n // Shade\n if (opts.shade) parts.push(stringifyShade(opts.shade));\n\n // Tile rect\n if (opts.tileRectangle) parts.push(stringifyRelativeRect(\"a:tileRect\", opts.tileRectangle));\n\n // Attributes\n const attrParts: string[] = [];\n if (opts.flip) attrParts.push(`flip=\"${escapeXml(opts.flip)}\"`);\n if (opts.rotateWithShape !== undefined)\n attrParts.push(`rotWithShape=\"${opts.rotateWithShape ? 1 : 0}\"`);\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n\n return `<a:gradFill${attrStr}>${parts.join(\"\")}</a:gradFill>`;\n },\n parse(el, ctx) {\n const result: Partial<GradientFillOptions> = {};\n\n // Stops — a:gs contains EG_ColorChoice directly (no solidFill wrapper)\n const gsLst = findChild(el, \"a:gsLst\");\n if (gsLst?.elements) {\n result.stops = gsLst.elements\n .filter((c) => c.name === \"a:gs\")\n .map((gs) => {\n const pos = Number(gs.attributes?.[\"pos\"] ?? 0);\n const color = readDirectColor(gs, ctx);\n return { position: parsePercent(pos), color };\n });\n }\n\n // Shade (a:lin or a:path)\n const lin = findChild(el, \"a:lin\");\n if (lin) {\n const shade: LinearShadeOptions = {};\n if (lin.attributes?.[\"ang\"] !== undefined)\n shade.angle = parseAngle(Number(lin.attributes[\"ang\"]));\n if (lin.attributes?.[\"scaled\"] !== undefined)\n shade.scaled = parseOnOff(lin.attributes[\"scaled\"]) ?? true;\n result.shade = shade;\n } else {\n const path = findChild(el, \"a:path\");\n if (path) {\n const shade: PathShadeOptions = {};\n if (path.attributes?.[\"path\"] !== undefined)\n shade.path = String(path.attributes[\"path\"]) as PathShadeOptions[\"path\"];\n const fillToRectangle = findChild(path, \"a:fillToRect\");\n if (fillToRectangle) shade.fillToRectangle = readRelativeRect(fillToRectangle);\n result.shade = shade;\n }\n }\n\n // Flip\n if (el.attributes?.[\"flip\"] !== undefined)\n result.flip = String(el.attributes[\"flip\"]) as GradientFillOptions[\"flip\"];\n\n // Rotate with shape\n if (el.attributes?.[\"rotWithShape\"] !== undefined)\n result.rotateWithShape = parseOnOff(el.attributes[\"rotWithShape\"]) ?? true;\n\n // Tile rect\n const tileRectangle = findChild(el, \"a:tileRect\");\n if (tileRectangle) result.tileRectangle = readRelativeRect(tileRectangle);\n\n return result as GradientFillOptions;\n },\n};\n\n// ── PatternFill descriptor ──\n\nexport const patternFillDesc: CustomDescriptor<PatternFillOptions> = {\n kind: \"custom\",\n stringify(opts, ctx) {\n const parts: string[] = [];\n const prst = xsdPattern.to(opts.pattern);\n\n // a:fgClr/a:bgClr expect EG_ColorChoice (direct color), NOT solidFill\n if (opts.foregroundColor) {\n const colorXml = stringifyColorChoice(opts.foregroundColor, ctx);\n if (colorXml) parts.push(`<a:fgClr>${colorXml}</a:fgClr>`);\n }\n if (opts.backgroundColor) {\n const colorXml = stringifyColorChoice(opts.backgroundColor, ctx);\n if (colorXml) parts.push(`<a:bgClr>${colorXml}</a:bgClr>`);\n }\n\n const inner = parts.join(\"\");\n return `<a:pattFill prst=\"${escapeXml(prst)}\">${inner}</a:pattFill>`;\n },\n parse(el, ctx) {\n const result: Partial<PatternFillOptions> = {};\n\n const prst = el.attributes?.[\"prst\"];\n if (prst) result.pattern = xsdPattern.from(String(prst)) as PatternFillOptions[\"pattern\"];\n\n const fgClr = findChild(el, \"a:fgClr\");\n if (fgClr) {\n result.foregroundColor = readDirectColor(fgClr, ctx);\n }\n\n const bgClr = findChild(el, \"a:bgClr\");\n if (bgClr) {\n result.backgroundColor = readDirectColor(bgClr, ctx);\n }\n\n return result as PatternFillOptions;\n },\n};\n\n// ── Fill (EG_FillProperties) descriptor ──\n\n// Infer the image-type token from a media path's file extension. Mirrors the\n// docx imageTypeFromPath helper; kept local to avoid a cross-package import.\nfunction imageTypeFromPath(\n path: string,\n): \"png\" | \"jpg\" | \"gif\" | \"bmp\" | \"tif\" | \"ico\" | \"emf\" | \"wmf\" {\n const ext = path.split(\".\").pop()?.toLowerCase() ?? \"\";\n switch (ext) {\n case \"png\":\n return \"png\";\n case \"jpg\":\n case \"jpeg\":\n return \"jpg\";\n case \"gif\":\n return \"gif\";\n case \"bmp\":\n return \"bmp\";\n case \"tif\":\n case \"tiff\":\n return \"tif\";\n case \"ico\":\n return \"ico\";\n case \"emf\":\n return \"emf\";\n case \"wmf\":\n return \"wmf\";\n default:\n return \"png\";\n }\n}\n\nexport const fillDesc: CustomDescriptor<FillOptions> = {\n kind: \"custom\",\n stringify(opts, ctx) {\n // String shorthand → solid fill\n if (typeof opts === \"string\") {\n return stringify(\n solidFillDesc,\n { value: stripColorHashPrefix(opts) } as SolidFillOptions,\n ctx,\n );\n }\n\n switch (opts.type) {\n case \"none\":\n return \"<a:noFill/>\";\n\n case \"solid\": {\n const color =\n typeof opts.color === \"string\"\n ? ({ value: stripColorHashPrefix(opts.color) } as SolidFillOptions)\n : opts.color;\n return stringify(solidFillDesc, color, ctx);\n }\n\n case \"gradient\": {\n // Core API variant\n if (\"options\" in opts) {\n return stringify(gradientFillDesc, opts.options, ctx);\n }\n // Simplified API variant\n const gradOpts: GradientFillOptions = {\n stops: opts.stops.map((stop) => ({\n position: stop.position,\n color:\n typeof stop.color === \"string\"\n ? ({ value: stripColorHashPrefix(stop.color) } as SolidFillOptions)\n : stop.color,\n })),\n };\n if (!opts.path && opts.angle !== undefined) {\n gradOpts.shade = { angle: opts.angle, scaled: opts.scaled ?? true };\n }\n if (opts.path) {\n gradOpts.shade = { path: opts.path };\n }\n return stringify(gradientFillDesc, gradOpts, ctx);\n }\n\n case \"blip\": {\n // Register the image media via the write context, then emit a:blipFill\n // with the returned {fileName} placeholder. The format-package compiler\n // replaces the placeholder with a relationship rId at pack time.\n const placeholder = ctx.addMedia(\n toUint8Array(opts.data, { encoding: \"base64\" }),\n opts.imageType,\n );\n return buildFill(opts, placeholder);\n }\n\n case \"pattern\": {\n const patternOpts: PatternFillOptions = {\n pattern: opts.pattern as PatternFillOptions[\"pattern\"],\n ...(opts.foregroundColor && {\n foregroundColor:\n typeof opts.foregroundColor === \"string\"\n ? ({ value: stripColorHashPrefix(opts.foregroundColor) } as SolidFillOptions)\n : opts.foregroundColor,\n }),\n ...(opts.backgroundColor && {\n backgroundColor:\n typeof opts.backgroundColor === \"string\"\n ? ({ value: stripColorHashPrefix(opts.backgroundColor) } as SolidFillOptions)\n : opts.backgroundColor,\n }),\n };\n return stringify(patternFillDesc, patternOpts, ctx);\n }\n\n case \"group\":\n return \"<a:grpFill/>\";\n }\n },\n parse(el, ctx) {\n // Resolve fill element — either el itself or a child\n const resolve = (tag: string): XmlElement | undefined =>\n el.name === tag ? el : findChild(el, tag);\n\n const noFill = resolve(\"a:noFill\");\n if (noFill) {\n return { type: \"none\" };\n }\n\n const solidFill = resolve(\"a:solidFill\");\n if (solidFill) {\n const color = parse(solidFillDesc, solidFill, ctx);\n return { type: \"solid\", color };\n }\n\n const gradFill = resolve(\"a:gradFill\");\n if (gradFill) {\n const gradOpts = parse(gradientFillDesc, gradFill, ctx);\n return { type: \"gradient\", options: gradOpts as GradientFillOptions };\n }\n\n const pattFill = resolve(\"a:pattFill\");\n if (pattFill) {\n const pattOpts = parse(patternFillDesc, pattFill, ctx);\n return { type: \"pattern\", ...(pattOpts as PatternFillOptions) };\n }\n\n const grpFill = resolve(\"a:grpFill\");\n if (grpFill) {\n return { type: \"group\" };\n }\n\n // Blip fill (image) — resolve r:embed to binary media via the read context\n const blipFill = resolve(\"a:blipFill\");\n if (blipFill) {\n const blipOpts = parse(blipFillDesc, blipFill, ctx);\n const mediaPath = blipOpts.referenceId\n ? ctx.resolveRelationship(blipOpts.referenceId)\n : undefined;\n const data = mediaPath ? ctx.getRaw(mediaPath) : undefined;\n if (mediaPath && data) {\n const blip: BlipFillConfigOptions & { type: \"blip\" } = {\n type: \"blip\",\n data,\n imageType: imageTypeFromPath(mediaPath),\n };\n if (blipOpts.dpi !== undefined) blip.dpi = blipOpts.dpi;\n if (blipOpts.rotWithShape !== undefined) blip.rotWithShape = blipOpts.rotWithShape;\n if (blipOpts.blipEffects) blip.blipEffects = blipOpts.blipEffects;\n if (blipOpts.sourceRectangle) blip.sourceRectangle = blipOpts.sourceRectangle;\n if (blipOpts.tile) blip.tile = blipOpts.tile;\n return blip;\n }\n }\n\n return { type: \"none\" };\n },\n};\n\n// ── Helper: read EG_ColorChoice directly from an element ──\n\nfunction readDirectColor(el: XmlElement, ctx: ReadContext): SolidFillOptions {\n // Handles all six color kinds (srgbClr/schemeClr/hslClr/sysClr/prstClr/scrgbClr).\n const color = parseColorChoice(el, ctx);\n if (Object.keys(color).length > 0) return color;\n // Fallback: try solidFill wrapper (for backward compat with old-generated XML)\n const solidFill = findChild(el, \"a:solidFill\");\n if (solidFill) return parse(solidFillDesc, solidFill, ctx);\n return { value: \"\" };\n}\n","/**\n * Outline descriptor for DrawingML shapes.\n *\n * @module\n */\n\nimport { escapeXml } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\nimport { findChild } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../../descriptor\";\nimport { stringify, parse } from \"../../descriptor\";\nimport { convertToEmu } from \"../../util/converters\";\nimport { xsdCompoundLine, xsdLineCap, xsdLineEndSize, xsdPenAlignment } from \"../../util/mappings\";\nimport { stripColorHashPrefix } from \"../../util/values\";\nimport { solidFillDesc } from \"../color/color-descriptors\";\nimport { gradientFillDesc, patternFillDesc } from \"../fill/fill-descriptors\";\nimport type { DashStop } from \"./custom-dash\";\nimport type { LineEndOptions } from \"./line-end\";\nimport type { OutlineOptions } from \"./outline\";\n\n// ── LineEnd helpers ──\n\nfunction stringifyLineEnd(tag: string, opts: LineEndOptions): string {\n const parts: string[] = [];\n if (opts.type) parts.push(`type=\"${escapeXml(opts.type)}\"`);\n if (opts.width) parts.push(`w=\"${escapeXml(xsdLineEndSize.to(opts.width))}\"`);\n if (opts.length) parts.push(`len=\"${escapeXml(xsdLineEndSize.to(opts.length))}\"`);\n const attrStr = parts.length ? \" \" + parts.join(\" \") : \"\";\n return `<${tag}${attrStr}/>`;\n}\n\nfunction readLineEnd(el: XmlElement): LineEndOptions {\n const result: Partial<LineEndOptions> = {};\n if (el.attributes?.[\"type\"])\n result.type = String(el.attributes[\"type\"]) as LineEndOptions[\"type\"];\n if (el.attributes?.[\"w\"])\n result.width = xsdLineEndSize.from(String(el.attributes[\"w\"])) as LineEndOptions[\"width\"];\n if (el.attributes?.[\"len\"])\n result.length = xsdLineEndSize.from(String(el.attributes[\"len\"])) as LineEndOptions[\"length\"];\n return result as LineEndOptions;\n}\n\n// ── Custom dash helper ──\n\nfunction stringifyCustomDash(stops: readonly DashStop[]): string {\n const inner = stops.map((s) => `<a:ds d=\"${escapeXml(s.d)}\" sp=\"${escapeXml(s.sp)}\"/>`).join(\"\");\n return `<a:custDash>${inner}</a:custDash>`;\n}\n\n// ── Outline descriptor ──\n\n/**\n * Serialize CT_LineProperties content under an arbitrary root tag. Shared by\n * a:ln and the text-underline line element a:uLn (same complex type).\n */\nexport function stringifyLineProperties(\n tag: string,\n opts: OutlineOptions,\n ctx: Parameters<CustomDescriptor<OutlineOptions>[\"stringify\"]>[1],\n): string | undefined {\n const parts: string[] = [];\n\n // Attributes\n const attrParts: string[] = [];\n // ST_LineWidth is EMU (integer) or a universal measure; normalize so the\n // descriptor path matches createOutline (outline.ts) and stays XSD-valid.\n if (opts.width !== undefined) attrParts.push(`w=\"${convertToEmu(opts.width)}\"`);\n // Map full-word enums to XSD tokens (rnd/sng/ctr), matching createOutline.\n if (opts.cap !== undefined) attrParts.push(`cap=\"${escapeXml(xsdLineCap.to(opts.cap))}\"`);\n if (opts.compoundLine !== undefined)\n attrParts.push(`cmpd=\"${escapeXml(xsdCompoundLine.to(opts.compoundLine))}\"`);\n if (opts.alignment !== undefined)\n attrParts.push(`algn=\"${escapeXml(xsdPenAlignment.to(opts.alignment))}\"`);\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n\n // Fill. A bare-string color is an sRGB hex sugar; coerce to { value } and\n // infer \"solidFill\" when type is omitted (mirrors the fill descriptor's\n // own string-sugar handling).\n const resolvedColor =\n typeof opts.color === \"string\" ? { value: stripColorHashPrefix(opts.color) } : opts.color;\n const fillType = opts.type ?? (resolvedColor ? \"solidFill\" : undefined);\n if (fillType === \"noFill\") {\n parts.push(\"<a:noFill/>\");\n } else if (fillType === \"solidFill\" && resolvedColor) {\n const fillXml = stringify(solidFillDesc, resolvedColor, ctx);\n if (fillXml) parts.push(fillXml);\n } else if (fillType === \"gradFill\" && opts.gradientFill) {\n const gradXml = stringify(gradientFillDesc, opts.gradientFill, ctx);\n if (gradXml) parts.push(gradXml);\n } else if (fillType === \"pattFill\" && opts.patternFill) {\n const pattXml = stringify(patternFillDesc, opts.patternFill, ctx);\n if (pattXml) parts.push(pattXml);\n }\n\n // Dash\n if (opts.customDash) {\n parts.push(stringifyCustomDash(opts.customDash));\n } else if (opts.dash) {\n parts.push(`<a:prstDash val=\"${escapeXml(opts.dash)}\"/>`);\n }\n\n // Join\n if (opts.join) {\n if (opts.join === \"miter\" && opts.miterLimit !== undefined) {\n parts.push(`<a:miter lim=\"${opts.miterLimit}\"/>`);\n } else {\n parts.push(`<a:${opts.join}/>`);\n }\n }\n\n // Line ends\n if (opts.headEnd) parts.push(stringifyLineEnd(\"a:headEnd\", opts.headEnd));\n if (opts.tailEnd) parts.push(stringifyLineEnd(\"a:tailEnd\", opts.tailEnd));\n\n if (parts.length === 0 && !attrStr) return undefined;\n if (parts.length === 0) return `<${tag}${attrStr}/>`;\n return `<${tag}${attrStr}>${parts.join(\"\")}</${tag}>`;\n}\n\nexport const outlineDesc: CustomDescriptor<OutlineOptions> = {\n kind: \"custom\",\n stringify(opts, ctx) {\n return stringifyLineProperties(\"a:ln\", opts, ctx);\n },\n parse(el, _ctx) {\n const result: OutlineOptions = {};\n\n // Attributes\n if (el.attributes) {\n if (el.attributes[\"w\"] !== undefined) result.width = Number(el.attributes[\"w\"]);\n // Reverse-map XSD tokens back to full-word enums so the parsed Options\n // match the user-facing type (round/single/center), not raw tokens.\n if (el.attributes[\"cap\"] !== undefined)\n result.cap = xsdLineCap.from(String(el.attributes[\"cap\"])) as OutlineOptions[\"cap\"];\n if (el.attributes[\"cmpd\"] !== undefined)\n result.compoundLine = xsdCompoundLine.from(\n String(el.attributes[\"cmpd\"]),\n ) as OutlineOptions[\"compoundLine\"];\n if (el.attributes[\"algn\"] !== undefined)\n result.alignment = xsdPenAlignment.from(\n String(el.attributes[\"algn\"]),\n ) as OutlineOptions[\"alignment\"];\n }\n\n // Fill\n const solidFill = findChild(el, \"a:solidFill\");\n if (solidFill) {\n result.type = \"solidFill\";\n result.color = parse(solidFillDesc, solidFill, _ctx);\n }\n if (findChild(el, \"a:noFill\")) {\n result.type = \"noFill\";\n }\n if (findChild(el, \"a:gradFill\")) {\n result.type = \"gradFill\";\n const gradFill = findChild(el, \"a:gradFill\")!;\n result.gradientFill = parse(gradientFillDesc, gradFill, _ctx);\n }\n if (findChild(el, \"a:pattFill\")) {\n result.type = \"pattFill\";\n const pattFill = findChild(el, \"a:pattFill\")!;\n result.patternFill = parse(patternFillDesc, pattFill, _ctx);\n }\n\n // Dash\n const prstDash = findChild(el, \"a:prstDash\");\n if (prstDash?.attributes?.[\"val\"])\n result.dash = String(prstDash.attributes[\"val\"]) as OutlineOptions[\"dash\"];\n const custDash = findChild(el, \"a:custDash\");\n if (custDash?.elements) {\n result.customDash = custDash.elements\n .filter((c) => c.name === \"a:ds\")\n .map((c) => ({\n d: String(c.attributes?.[\"d\"] ?? \"\"),\n sp: String(c.attributes?.[\"sp\"] ?? \"\"),\n }));\n }\n\n // Join\n if (findChild(el, \"a:round\")) result.join = \"round\";\n else if (findChild(el, \"a:bevel\")) result.join = \"bevel\";\n else {\n const miter = findChild(el, \"a:miter\");\n if (miter) {\n result.join = \"miter\";\n if (miter.attributes?.[\"lim\"]) result.miterLimit = Number(miter.attributes[\"lim\"]);\n }\n }\n\n // Line ends\n const headEnd = findChild(el, \"a:headEnd\");\n if (headEnd) result.headEnd = readLineEnd(headEnd);\n const tailEnd = findChild(el, \"a:tailEnd\");\n if (tailEnd) result.tailEnd = readLineEnd(tailEnd);\n\n return result;\n },\n};\n","/**\n * Effect list descriptor for DrawingML shapes.\n *\n * @module\n */\n\nimport { escapeXml } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\nimport { findChild } from \"@office-open/xml\";\n\nimport type { CustomDescriptor, ReadContext, WriteContext } from \"../../descriptor\";\nimport { parse } from \"../../descriptor\";\nimport {\n convertToEmu,\n emitAngle,\n emitPercent,\n mapOptional,\n parseAngle,\n parsePercent,\n} from \"../../util/converters\";\nimport { xsdBlendMode, xsdPresetShadow, xsdRectAlignment } from \"../../util/mappings\";\nimport { parseOnOff } from \"../../util/values\";\nimport { parseColorChoice, solidFillDesc, stringifyColorChoice } from \"../color/color-descriptors\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\nimport { gradientFillDesc, patternFillDesc } from \"../fill/fill-descriptors\";\nimport type { BlurEffectOptions, EffectListOptions } from \"./effect-list\";\nimport { createFillOverlayEffect } from \"./fill-overlay\";\nimport type { FillOverlayEffectOptions } from \"./fill-overlay\";\nimport type { GlowEffectOptions } from \"./glow\";\nimport type { InnerShadowEffectOptions } from \"./inner-shadow\";\nimport type { OuterShadowEffectOptions } from \"./outer-shadow\";\nimport type { PresetShadowEffectOptions } from \"./preset-shadow\";\nimport type { ReflectionEffectOptions } from \"./reflection\";\n\n// Parse an ST_Percentage attr that may be a numeric scalar or \"50%\" literal.\nfunction parsePercentAttr(raw: string | number | undefined): number | undefined {\n if (raw === undefined) return undefined;\n const s = typeof raw === \"number\" ? String(raw) : raw;\n if (s.endsWith(\"%\")) return Number(s.slice(0, -1));\n return parsePercent(Number(s));\n}\n\n// ── Helper: stringify a color into an effect element ──\n\nfunction stringifyEffectColor(\n color: SolidFillOptions | undefined,\n ctx: WriteContext,\n): string | undefined {\n if (!color) return undefined;\n // Effect elements expect EG_ColorChoice (direct color), NOT wrapped in solidFill\n return stringifyColorChoice(color, ctx);\n}\n\nfunction stringifyColorEffect(\n tag: string,\n attrs: Record<string, string | number | undefined>,\n color: SolidFillOptions | undefined,\n ctx: WriteContext,\n): string | undefined {\n const attrParts: string[] = [];\n for (const [key, val] of Object.entries(attrs)) {\n if (val !== undefined) attrParts.push(`${key}=\"${escapeXml(String(val as number | string))}\"`);\n }\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n\n const colorXml = stringifyEffectColor(color, ctx);\n if (!colorXml && !attrStr) return undefined;\n\n if (!colorXml) return `<${tag}${attrStr}/>`;\n return `<${tag}${attrStr}>${colorXml}</${tag}>`;\n}\n\nfunction readColorFromElement(el: XmlElement, ctx: ReadContext): SolidFillOptions | undefined {\n // Effect elements contain EG_ColorChoice directly (not wrapped in solidFill).\n // Reuse parseColorChoice for full coverage (srgb/scheme/hsl/sys/prst/scrgb + transforms).\n const color = parseColorChoice(el, ctx);\n if (!color || Object.keys(color).length === 0) return undefined;\n return color;\n}\n\n// ── EffectList descriptor ──\n\nexport const effectListDesc: CustomDescriptor<EffectListOptions> = {\n kind: \"custom\",\n stringify(opts, ctx) {\n const parts: string[] = [];\n\n // Blur\n if (opts.blur) {\n const attrParts: string[] = [];\n if (opts.blur.radius !== undefined) attrParts.push(`rad=\"${opts.blur.radius}\"`);\n if (opts.blur.grow === false) attrParts.push('grow=\"0\"');\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n parts.push(`<a:blur${attrStr}/>`);\n }\n\n // Fill overlay — CT_FillOverlayEffect requires an EG_FillProperties child.\n if (opts.fillOverlay) {\n parts.push(createFillOverlayEffect(opts.fillOverlay));\n }\n\n // Glow\n if (opts.glow) {\n parts.push(\n stringifyColorEffect(\n \"a:glow\",\n { rad: mapOptional(opts.glow.radius, convertToEmu) },\n opts.glow.color,\n ctx,\n ) ?? \"\",\n );\n }\n\n // Inner shadow\n if (opts.innerShadow) {\n parts.push(\n stringifyColorEffect(\n \"a:innerShdw\",\n {\n blurRad: mapOptional(opts.innerShadow.blurRadius, convertToEmu),\n dist: mapOptional(opts.innerShadow.distance, convertToEmu),\n dir:\n opts.innerShadow.direction !== undefined\n ? emitAngle(opts.innerShadow.direction)\n : undefined,\n },\n opts.innerShadow.color,\n ctx,\n ) ?? \"\",\n );\n }\n\n // Outer shadow\n if (opts.outerShadow) {\n parts.push(\n stringifyColorEffect(\n \"a:outerShdw\",\n {\n blurRad: mapOptional(opts.outerShadow.blurRadius, convertToEmu),\n dist: mapOptional(opts.outerShadow.distance, convertToEmu),\n dir:\n opts.outerShadow.direction !== undefined\n ? emitAngle(opts.outerShadow.direction)\n : undefined,\n sx:\n opts.outerShadow.scaleX !== undefined\n ? emitPercent(opts.outerShadow.scaleX)\n : undefined,\n sy:\n opts.outerShadow.scaleY !== undefined\n ? emitPercent(opts.outerShadow.scaleY)\n : undefined,\n kx:\n opts.outerShadow.skewX !== undefined ? emitAngle(opts.outerShadow.skewX) : undefined,\n ky:\n opts.outerShadow.skewY !== undefined ? emitAngle(opts.outerShadow.skewY) : undefined,\n algn:\n opts.outerShadow.alignment !== undefined\n ? xsdRectAlignment.to(opts.outerShadow.alignment)\n : undefined,\n rotWithShape: opts.outerShadow.rotWithShape === false ? 0 : undefined,\n },\n opts.outerShadow.color,\n ctx,\n ) ?? \"\",\n );\n }\n\n // Preset shadow\n if (opts.presetShadow) {\n parts.push(\n stringifyColorEffect(\n \"a:prstShdw\",\n {\n prst: xsdPresetShadow.to(opts.presetShadow.preset),\n dist: mapOptional(opts.presetShadow.distance, convertToEmu),\n dir:\n opts.presetShadow.direction !== undefined\n ? emitAngle(opts.presetShadow.direction)\n : undefined,\n },\n opts.presetShadow.color,\n ctx,\n ) ?? \"\",\n );\n }\n\n // Reflection\n if (opts.reflection) {\n const refOpts = opts.reflection === true ? ({} as ReflectionEffectOptions) : opts.reflection;\n const attrParts: string[] = [];\n if (refOpts.blurRadius !== undefined)\n attrParts.push(`blurRad=\"${convertToEmu(refOpts.blurRadius)}\"`);\n if (refOpts.startAlpha !== undefined)\n attrParts.push(`stA=\"${emitPercent(refOpts.startAlpha)}\"`);\n if (refOpts.startPosition !== undefined)\n attrParts.push(`stPos=\"${emitPercent(refOpts.startPosition)}\"`);\n if (refOpts.endAlpha !== undefined) attrParts.push(`endA=\"${emitPercent(refOpts.endAlpha)}\"`);\n if (refOpts.endPosition !== undefined)\n attrParts.push(`endPos=\"${emitPercent(refOpts.endPosition)}\"`);\n if (refOpts.distance !== undefined)\n attrParts.push(`dist=\"${convertToEmu(refOpts.distance)}\"`);\n if (refOpts.direction !== undefined) attrParts.push(`dir=\"${emitAngle(refOpts.direction)}\"`);\n if (refOpts.fadeDirection !== undefined)\n attrParts.push(`fadeDir=\"${emitAngle(refOpts.fadeDirection)}\"`);\n if (refOpts.scaleX !== undefined) attrParts.push(`sx=\"${emitPercent(refOpts.scaleX)}\"`);\n if (refOpts.scaleY !== undefined) attrParts.push(`sy=\"${emitPercent(refOpts.scaleY)}\"`);\n if (refOpts.skewX !== undefined) attrParts.push(`kx=\"${emitAngle(refOpts.skewX)}\"`);\n if (refOpts.skewY !== undefined) attrParts.push(`ky=\"${emitAngle(refOpts.skewY)}\"`);\n if (refOpts.alignment !== undefined)\n attrParts.push(`algn=\"${escapeXml(xsdRectAlignment.to(refOpts.alignment))}\"`);\n if (refOpts.rotWithShape !== undefined)\n attrParts.push(`rotWithShape=\"${refOpts.rotWithShape ? 1 : 0}\"`);\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n parts.push(`<a:reflection${attrStr}/>`);\n }\n\n // Soft edge\n if (opts.softEdge !== undefined) {\n parts.push(`<a:softEdge rad=\"${convertToEmu(opts.softEdge)}\"/>`);\n }\n\n // Filter empty strings\n const content = parts.filter(Boolean).join(\"\");\n if (!content) return undefined;\n return `<a:effectLst>${content}</a:effectLst>`;\n },\n parse(el, ctx) {\n const result: EffectListOptions = {};\n\n // Blur\n const blur = findChild(el, \"a:blur\");\n if (blur) {\n const blurOpts: BlurEffectOptions = {};\n if (blur.attributes?.[\"rad\"] !== undefined) blurOpts.radius = Number(blur.attributes[\"rad\"]);\n if (blur.attributes?.[\"grow\"] !== undefined)\n blurOpts.grow = parseOnOff(blur.attributes[\"grow\"]) ?? true;\n result.blur = blurOpts;\n }\n\n // Glow\n const glow = findChild(el, \"a:glow\");\n if (glow) {\n const glowOpts: Partial<GlowEffectOptions> = {};\n if (glow.attributes?.[\"rad\"] !== undefined) glowOpts.radius = Number(glow.attributes[\"rad\"]);\n const color = readColorFromElement(glow, ctx);\n if (color) glowOpts.color = color;\n result.glow = glowOpts as GlowEffectOptions;\n }\n\n // Inner shadow\n const innerShdw = findChild(el, \"a:innerShdw\");\n if (innerShdw) {\n const innerOpts: Partial<InnerShadowEffectOptions> = {};\n if (innerShdw.attributes?.[\"blurRad\"] !== undefined)\n innerOpts.blurRadius = Number(innerShdw.attributes[\"blurRad\"]);\n if (innerShdw.attributes?.[\"dist\"] !== undefined)\n innerOpts.distance = Number(innerShdw.attributes[\"dist\"]);\n if (innerShdw.attributes?.[\"dir\"] !== undefined)\n innerOpts.direction = parseAngle(Number(innerShdw.attributes[\"dir\"]));\n const color = readColorFromElement(innerShdw, ctx);\n if (color) innerOpts.color = color;\n result.innerShadow = innerOpts as InnerShadowEffectOptions;\n }\n\n // Outer shadow\n const outerShdw = findChild(el, \"a:outerShdw\");\n if (outerShdw) {\n const outerOpts: Partial<OuterShadowEffectOptions> = {};\n if (outerShdw.attributes?.[\"blurRad\"] !== undefined)\n outerOpts.blurRadius = Number(outerShdw.attributes[\"blurRad\"]);\n if (outerShdw.attributes?.[\"dist\"] !== undefined)\n outerOpts.distance = Number(outerShdw.attributes[\"dist\"]);\n if (outerShdw.attributes?.[\"dir\"] !== undefined)\n outerOpts.direction = parseAngle(Number(outerShdw.attributes[\"dir\"]));\n if (outerShdw.attributes?.[\"sx\"] !== undefined)\n outerOpts.scaleX = parsePercentAttr(outerShdw.attributes[\"sx\"]);\n if (outerShdw.attributes?.[\"sy\"] !== undefined)\n outerOpts.scaleY = parsePercentAttr(outerShdw.attributes[\"sy\"]);\n if (outerShdw.attributes?.[\"kx\"] !== undefined)\n outerOpts.skewX = parseAngle(Number(outerShdw.attributes[\"kx\"]));\n if (outerShdw.attributes?.[\"ky\"] !== undefined)\n outerOpts.skewY = parseAngle(Number(outerShdw.attributes[\"ky\"]));\n if (outerShdw.attributes?.[\"algn\"] !== undefined)\n outerOpts.alignment = xsdRectAlignment.from(\n String(outerShdw.attributes[\"algn\"]),\n ) as OuterShadowEffectOptions[\"alignment\"];\n if (outerShdw.attributes?.[\"rotWithShape\"] !== undefined)\n outerOpts.rotWithShape = parseOnOff(outerShdw.attributes[\"rotWithShape\"]) ?? true;\n const color = readColorFromElement(outerShdw, ctx);\n if (color) outerOpts.color = color;\n result.outerShadow = outerOpts as OuterShadowEffectOptions;\n }\n\n // Fill overlay\n const fillOverlay = findChild(el, \"a:fillOverlay\");\n if (fillOverlay) {\n const overlayOpts: Partial<FillOverlayEffectOptions> = {};\n if (fillOverlay.attributes?.[\"blend\"] !== undefined)\n overlayOpts.blend = xsdBlendMode.from(\n String(fillOverlay.attributes[\"blend\"]),\n ) as FillOverlayEffectOptions[\"blend\"];\n const foSolid = findChild(fillOverlay, \"a:solidFill\");\n if (foSolid) overlayOpts.solidFill = parse(solidFillDesc, foSolid, ctx) as SolidFillOptions;\n const foGrad = findChild(fillOverlay, \"a:gradFill\");\n if (foGrad) overlayOpts.gradientFill = parse(gradientFillDesc, foGrad, ctx);\n const foPatt = findChild(fillOverlay, \"a:pattFill\");\n if (foPatt) overlayOpts.patternFill = parse(patternFillDesc, foPatt, ctx);\n if (findChild(fillOverlay, \"a:noFill\")) overlayOpts.noFill = true;\n if (findChild(fillOverlay, \"a:grpFill\")) overlayOpts.groupFill = true;\n result.fillOverlay = overlayOpts as FillOverlayEffectOptions;\n }\n\n // Preset shadow\n const prstShdw = findChild(el, \"a:prstShdw\");\n if (prstShdw) {\n const prstOpts: Partial<PresetShadowEffectOptions> = {};\n if (prstShdw.attributes?.[\"prst\"] !== undefined)\n prstOpts.preset = xsdPresetShadow.from(\n String(prstShdw.attributes[\"prst\"]),\n ) as PresetShadowEffectOptions[\"preset\"];\n if (prstShdw.attributes?.[\"dist\"] !== undefined)\n prstOpts.distance = Number(prstShdw.attributes[\"dist\"]);\n if (prstShdw.attributes?.[\"dir\"] !== undefined)\n prstOpts.direction = parseAngle(Number(prstShdw.attributes[\"dir\"]));\n const color = readColorFromElement(prstShdw, ctx);\n if (color) prstOpts.color = color;\n result.presetShadow = prstOpts as PresetShadowEffectOptions;\n }\n\n // Reflection\n const reflection = findChild(el, \"a:reflection\");\n if (reflection) {\n const refOpts: ReflectionEffectOptions = {};\n if (reflection.attributes?.[\"blurRad\"] !== undefined)\n refOpts.blurRadius = Number(reflection.attributes[\"blurRad\"]);\n if (reflection.attributes?.[\"stA\"] !== undefined)\n refOpts.startAlpha = parsePercentAttr(reflection.attributes[\"stA\"]);\n if (reflection.attributes?.[\"stPos\"] !== undefined)\n refOpts.startPosition = parsePercentAttr(reflection.attributes[\"stPos\"]);\n if (reflection.attributes?.[\"endA\"] !== undefined)\n refOpts.endAlpha = parsePercentAttr(reflection.attributes[\"endA\"]);\n if (reflection.attributes?.[\"endPos\"] !== undefined)\n refOpts.endPosition = parsePercentAttr(reflection.attributes[\"endPos\"]);\n if (reflection.attributes?.[\"dist\"] !== undefined)\n refOpts.distance = Number(reflection.attributes[\"dist\"]);\n if (reflection.attributes?.[\"dir\"] !== undefined)\n refOpts.direction = parseAngle(Number(reflection.attributes[\"dir\"]));\n if (reflection.attributes?.[\"fadeDir\"] !== undefined)\n refOpts.fadeDirection = parseAngle(Number(reflection.attributes[\"fadeDir\"]));\n if (reflection.attributes?.[\"sx\"] !== undefined)\n refOpts.scaleX = parsePercentAttr(reflection.attributes[\"sx\"]);\n if (reflection.attributes?.[\"sy\"] !== undefined)\n refOpts.scaleY = parsePercentAttr(reflection.attributes[\"sy\"]);\n if (reflection.attributes?.[\"kx\"] !== undefined)\n refOpts.skewX = parseAngle(Number(reflection.attributes[\"kx\"]));\n if (reflection.attributes?.[\"ky\"] !== undefined)\n refOpts.skewY = parseAngle(Number(reflection.attributes[\"ky\"]));\n if (reflection.attributes?.[\"algn\"] !== undefined)\n refOpts.alignment = xsdRectAlignment.from(String(reflection.attributes[\"algn\"]));\n if (reflection.attributes?.[\"rotWithShape\"] !== undefined)\n refOpts.rotWithShape = parseOnOff(reflection.attributes[\"rotWithShape\"]) ?? true;\n result.reflection = refOpts;\n }\n\n // Soft edge\n const softEdge = findChild(el, \"a:softEdge\");\n if (softEdge?.attributes?.[\"rad\"] !== undefined) {\n result.softEdge = Number(softEdge.attributes[\"rad\"]);\n }\n\n return result;\n },\n};\n","/**\n * Locking descriptor for DrawingML shapes.\n *\n * @module\n */\n\nimport type { Element as XmlElement } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../../descriptor\";\nimport { parseOnOff } from \"../../util/values\";\nimport type {\n BaseLockingOptions,\n ConnectorLockingOptions,\n GraphicFrameLockingOptions,\n GroupLockingOptions,\n PictureLockingOptions,\n ShapeLockingOptions,\n} from \"./locking\";\n\n// ── Common locking attribute keys ──\n\nconst BASE_LOCKING_KEYS: readonly (keyof BaseLockingOptions & string)[] = [\n \"noGrp\",\n \"noSelect\",\n \"noRot\",\n \"noChangeAspect\",\n \"noMove\",\n \"noResize\",\n \"noEditPoints\",\n \"noAdjustHandles\",\n \"noChangeArrowheads\",\n \"noChangeShapeType\",\n];\n\nconst SHAPE_EXTRA_KEYS: readonly (keyof ShapeLockingOptions & string)[] = [\"noTextEdit\"];\nconst PICTURE_EXTRA_KEYS: readonly (keyof PictureLockingOptions & string)[] = [\"noCrop\"];\nconst GROUP_EXTRA_KEYS: readonly (keyof GroupLockingOptions & string)[] = [\"noUngrp\"];\nconst FRAME_EXTRA_KEYS: readonly (keyof GraphicFrameLockingOptions & string)[] = [\"noDrilldown\"];\n\n// ── Helper: stringify boolean attributes ──\n\nfunction stringifyLockingAttrs(\n opts: Readonly<Record<string, boolean | undefined>>,\n keys: readonly string[],\n): string {\n const parts: string[] = [];\n for (const key of keys) {\n if (opts[key] !== undefined) {\n parts.push(`${key}=\"${opts[key] ? 1 : 0}\"`);\n }\n }\n return parts.length ? \" \" + parts.join(\" \") : \"\";\n}\n\nfunction readLockingAttrs(el: XmlElement, keys: readonly string[]): Record<string, boolean> {\n const result: Record<string, boolean> = {};\n if (!el.attributes) return result;\n for (const key of keys) {\n const val = el.attributes[key];\n if (val !== undefined) result[key] = parseOnOff(val) ?? false;\n }\n return result;\n}\n\n// ── Shape locking descriptor ──\n\nexport const shapeLockingDesc: CustomDescriptor<ShapeLockingOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const allKeys = [...BASE_LOCKING_KEYS, ...SHAPE_EXTRA_KEYS];\n const attrStr = stringifyLockingAttrs(opts as Record<string, boolean | undefined>, allKeys);\n if (!attrStr) return undefined;\n return `<a:spLocks${attrStr}/>`;\n },\n parse(el, _ctx) {\n const allKeys = [...BASE_LOCKING_KEYS, ...SHAPE_EXTRA_KEYS];\n return readLockingAttrs(el, allKeys);\n },\n};\n\n// ── Picture locking descriptor ──\n\nexport const pictureLockingDesc: CustomDescriptor<PictureLockingOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const allKeys = [...BASE_LOCKING_KEYS, ...PICTURE_EXTRA_KEYS];\n const attrStr = stringifyLockingAttrs(opts as Record<string, boolean | undefined>, allKeys);\n if (!attrStr) return undefined;\n return `<a:picLocks${attrStr}/>`;\n },\n parse(el, _ctx) {\n const allKeys = [...BASE_LOCKING_KEYS, ...PICTURE_EXTRA_KEYS];\n return readLockingAttrs(el, allKeys);\n },\n};\n\n// ── Group locking descriptor ──\n\nexport const groupLockingDesc: CustomDescriptor<GroupLockingOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const allKeys = [...BASE_LOCKING_KEYS, ...GROUP_EXTRA_KEYS];\n const attrStr = stringifyLockingAttrs(opts as Record<string, boolean | undefined>, allKeys);\n if (!attrStr) return undefined;\n return `<a:grpSpLocks${attrStr}/>`;\n },\n parse(el, _ctx) {\n const allKeys = [...BASE_LOCKING_KEYS, ...GROUP_EXTRA_KEYS];\n return readLockingAttrs(el, allKeys);\n },\n};\n\n// ── Graphic frame locking descriptor ──\n\nexport const graphicFrameLockingDesc: CustomDescriptor<GraphicFrameLockingOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const allKeys = [...BASE_LOCKING_KEYS, ...FRAME_EXTRA_KEYS];\n const attrStr = stringifyLockingAttrs(opts as Record<string, boolean | undefined>, allKeys);\n if (!attrStr) return undefined;\n return `<a:graphicFrameLocks${attrStr}/>`;\n },\n parse(el, _ctx) {\n const allKeys = [...BASE_LOCKING_KEYS, ...FRAME_EXTRA_KEYS];\n return readLockingAttrs(el, allKeys);\n },\n};\n\n// ── Connector locking descriptor (CT_ConnectorLocking = AG_Locking) ──\n\nexport const connectorLockingDesc: CustomDescriptor<ConnectorLockingOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const attrStr = stringifyLockingAttrs(\n opts as Record<string, boolean | undefined>,\n BASE_LOCKING_KEYS,\n );\n if (!attrStr) return undefined;\n return `<a:cxnSpLocks${attrStr}/>`;\n },\n parse(el, _ctx) {\n return readLockingAttrs(el, BASE_LOCKING_KEYS) as ConnectorLockingOptions;\n },\n};\n","/**\n * Geometry descriptors for DrawingML shapes.\n *\n * @module\n */\n\nimport { escapeXml, findChild } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../../descriptor\";\nimport { stringify, parse } from \"../../descriptor\";\nimport { parseOnOff } from \"../../util/values\";\nimport type { GeometryGuide } from \"./adjustment-values\";\nimport type {\n CustomGeometryOptions,\n PathOptions,\n PathCommand,\n AdjustPoint,\n AdjustHandle,\n XYAdjustHandle,\n PolarAdjustHandle,\n ConnectionSite,\n GeomRect,\n} from \"./custom-geometry\";\nimport type { PresetGeometryOptions } from \"./preset-geometry\";\n\n// ── Adjustment values helper ──\n\nconst adjustmentValuesDesc: CustomDescriptor<readonly GeometryGuide[]> = {\n kind: \"custom\",\n stringify(guides, _ctx) {\n if (!guides || guides.length === 0) return \"<a:avLst/>\";\n const inner = guides\n .map((g) => `<a:gd name=\"${escapeXml(g.name)}\" fmla=\"${escapeXml(g.formula)}\"/>`)\n .join(\"\");\n return `<a:avLst>${inner}</a:avLst>`;\n },\n parse(el, _ctx) {\n const result: GeometryGuide[] = [];\n if (el.elements) {\n for (const child of el.elements) {\n if (child.name === \"a:gd\" && child.attributes) {\n const name = child.attributes[\"name\"];\n const fmla = child.attributes[\"fmla\"];\n if (name !== undefined && fmla !== undefined) {\n result.push({ name: String(name), formula: String(fmla) });\n }\n }\n }\n }\n return result as readonly GeometryGuide[];\n },\n};\n\n// ── Preset geometry descriptor ──\n\nexport const presetGeometryDesc: CustomDescriptor<PresetGeometryOptions> = {\n kind: \"custom\",\n stringify(opts, ctx) {\n const prst = opts.preset ?? \"rect\";\n let avXml = \"\";\n if (opts.adjustmentValues) {\n avXml = stringify(adjustmentValuesDesc, opts.adjustmentValues, ctx) ?? \"<a:avLst/>\";\n } else {\n avXml = \"<a:avLst/>\";\n }\n return `<a:prstGeom prst=\"${escapeXml(prst)}\">${avXml}</a:prstGeom>`;\n },\n parse(el, ctx) {\n const result: PresetGeometryOptions = {};\n if (el.attributes?.[\"prst\"] !== undefined) {\n result.preset = String(el.attributes[\"prst\"]);\n }\n const avLst = findChild(el, \"a:avLst\");\n if (avLst) {\n const guides = parse(adjustmentValuesDesc, avLst, ctx);\n if (guides.length > 0) {\n result.adjustmentValues = guides;\n }\n }\n return result;\n },\n};\n\n// ── Path command helpers ──\n\nfunction stringifyAdjustPoint(pt: AdjustPoint): string {\n return `<a:pt x=\"${escapeXml(pt.x)}\" y=\"${escapeXml(pt.y)}\"/>`;\n}\n\nfunction stringifyPathCommand(cmd: PathCommand): string {\n switch (cmd.command) {\n case \"moveTo\":\n return `<a:moveTo>${stringifyAdjustPoint(cmd.point)}</a:moveTo>`;\n case \"lineTo\":\n return `<a:lnTo>${stringifyAdjustPoint(cmd.point)}</a:lnTo>`;\n case \"arcTo\":\n return (\n `<a:arcTo wR=\"${escapeXml(cmd.widthRadius)}\" hR=\"${escapeXml(cmd.heightRadius)}\"` +\n ` stAng=\"${escapeXml(cmd.startAngle)}\" swAng=\"${escapeXml(cmd.sweepAngle)}\"/>`\n );\n case \"quadBezTo\": {\n const pts = cmd.points.map(stringifyAdjustPoint).join(\"\");\n return `<a:quadBezTo>${pts}</a:quadBezTo>`;\n }\n case \"cubicBezTo\": {\n const pts = cmd.points.map(stringifyAdjustPoint).join(\"\");\n return `<a:cubicBezTo>${pts}</a:cubicBezTo>`;\n }\n case \"close\":\n return \"<a:close/>\";\n }\n}\n\nfunction stringifyPath(path: PathOptions): string {\n const attrs: string[] = [];\n if (path.w !== undefined) attrs.push(`w=\"${path.w}\"`);\n if (path.h !== undefined) attrs.push(`h=\"${path.h}\"`);\n if (path.fill !== undefined) attrs.push(`fill=\"${escapeXml(path.fill)}\"`);\n if (path.stroke !== undefined) attrs.push(`stroke=\"${path.stroke}\"`);\n if (path.extrusionOk !== undefined) attrs.push(`extrusionOk=\"${path.extrusionOk}\"`);\n const attrStr = attrs.length ? \" \" + attrs.join(\" \") : \"\";\n const cmds = path.commands.map(stringifyPathCommand).join(\"\");\n if (!cmds && !attrStr) return \"<a:path/>\";\n return `<a:path${attrStr}>${cmds}</a:path>`;\n}\n\nfunction readAdjustPoint(el: XmlElement): AdjustPoint | undefined {\n if (!el.attributes) return undefined;\n const x = el.attributes[\"x\"];\n const y = el.attributes[\"y\"];\n if (x === undefined || y === undefined) return undefined;\n return { x: String(x), y: String(y) };\n}\n\nfunction readPathCommand(tag: string, el: XmlElement): PathCommand | undefined {\n switch (tag) {\n case \"a:moveTo\": {\n const pt = el.elements?.find((c) => c.name === \"a:pt\");\n if (!pt) return undefined;\n const point = readAdjustPoint(pt);\n if (!point) return undefined;\n return { command: \"moveTo\", point };\n }\n case \"a:lnTo\": {\n const pt = el.elements?.find((c) => c.name === \"a:pt\");\n if (!pt) return undefined;\n const point = readAdjustPoint(pt);\n if (!point) return undefined;\n return { command: \"lineTo\", point };\n }\n case \"a:arcTo\": {\n const a = el.attributes;\n if (!a) return undefined;\n return {\n command: \"arcTo\",\n widthRadius: String(a[\"wR\"] ?? \"\"),\n heightRadius: String(a[\"hR\"] ?? \"\"),\n startAngle: String(a[\"stAng\"] ?? \"\"),\n sweepAngle: String(a[\"swAng\"] ?? \"\"),\n };\n }\n case \"a:quadBezTo\": {\n const points = (el.elements ?? [])\n .filter((c) => c.name === \"a:pt\")\n .map(readAdjustPoint)\n .filter((p): p is AdjustPoint => p !== undefined);\n const [p0, p1] = points;\n if (!p0 || !p1) return undefined;\n return { command: \"quadBezTo\", points: [p0, p1] };\n }\n case \"a:cubicBezTo\": {\n const points = (el.elements ?? [])\n .filter((c) => c.name === \"a:pt\")\n .map(readAdjustPoint)\n .filter((p): p is AdjustPoint => p !== undefined);\n const [p0, p1, p2] = points;\n if (!p0 || !p1 || !p2) return undefined;\n return { command: \"cubicBezTo\", points: [p0, p1, p2] };\n }\n case \"a:close\":\n return { command: \"close\" };\n default:\n return undefined;\n }\n}\n\nfunction readPath(el: XmlElement): Partial<PathOptions> {\n const result: Partial<PathOptions> = {};\n if (el.attributes) {\n if (el.attributes[\"w\"] !== undefined) result.w = Number(el.attributes[\"w\"]);\n if (el.attributes[\"h\"] !== undefined) result.h = Number(el.attributes[\"h\"]);\n if (el.attributes[\"fill\"] !== undefined)\n result.fill = String(el.attributes[\"fill\"]) as PathOptions[\"fill\"];\n if (el.attributes[\"stroke\"] !== undefined)\n result.stroke = parseOnOff(el.attributes[\"stroke\"]) ?? true;\n if (el.attributes[\"extrusionOk\"] !== undefined)\n result.extrusionOk = parseOnOff(el.attributes[\"extrusionOk\"]) ?? true;\n }\n const commands: PathCommand[] = [];\n if (el.elements) {\n for (const child of el.elements) {\n if (child.name) {\n const cmd = readPathCommand(child.name, child);\n if (cmd) commands.push(cmd);\n }\n }\n }\n if (commands.length > 0) result.commands = commands;\n return result as PathOptions;\n}\n\n// ── Guide list helper (avLst / gdLst) ──\n\nfunction stringifyGuideList(tag: string, guides: readonly GeometryGuide[]): string {\n if (!guides || guides.length === 0) return `<${tag}/>`;\n const inner = guides\n .map((g) => `<a:gd name=\"${escapeXml(g.name)}\" fmla=\"${escapeXml(g.formula)}\"/>`)\n .join(\"\");\n return `<${tag}>${inner}</${tag}>`;\n}\n\nfunction readGuideList(el: XmlElement): GeometryGuide[] {\n const result: GeometryGuide[] = [];\n if (el.elements) {\n for (const child of el.elements) {\n if (child.name === \"a:gd\" && child.attributes) {\n const name = child.attributes[\"name\"];\n const fmla = child.attributes[\"fmla\"];\n if (name !== undefined && fmla !== undefined) {\n result.push({ name: String(name), formula: String(fmla) });\n }\n }\n }\n }\n return result;\n}\n\n// ── Adjust handle helpers ──\n\nfunction stringifyAdjustHandlePos(pos: { x: string; y: string }): string {\n return `<a:pos x=\"${escapeXml(pos.x)}\" y=\"${escapeXml(pos.y)}\"/>`;\n}\n\nfunction stringifyXYAdjustHandle(h: XYAdjustHandle): string {\n const attrs: string[] = [];\n if (h.guideRefX !== undefined) attrs.push(`gdRefX=\"${escapeXml(h.guideRefX)}\"`);\n if (h.minX !== undefined) attrs.push(`minX=\"${escapeXml(h.minX)}\"`);\n if (h.maxX !== undefined) attrs.push(`maxX=\"${escapeXml(h.maxX)}\"`);\n if (h.guideRefY !== undefined) attrs.push(`gdRefY=\"${escapeXml(h.guideRefY)}\"`);\n if (h.minY !== undefined) attrs.push(`minY=\"${escapeXml(h.minY)}\"`);\n if (h.maxY !== undefined) attrs.push(`maxY=\"${escapeXml(h.maxY)}\"`);\n const attrStr = attrs.length ? \" \" + attrs.join(\" \") : \"\";\n return `<a:ahXY${attrStr}>${stringifyAdjustHandlePos(h.position)}</a:ahXY>`;\n}\n\nfunction stringifyPolarAdjustHandle(h: PolarAdjustHandle): string {\n const attrs: string[] = [];\n if (h.guideRefRadius !== undefined) attrs.push(`gdRefR=\"${escapeXml(h.guideRefRadius)}\"`);\n if (h.minRadius !== undefined) attrs.push(`minR=\"${escapeXml(h.minRadius)}\"`);\n if (h.maxRadius !== undefined) attrs.push(`maxR=\"${escapeXml(h.maxRadius)}\"`);\n if (h.guideRefAngle !== undefined) attrs.push(`gdRefAng=\"${escapeXml(h.guideRefAngle)}\"`);\n if (h.minAngle !== undefined) attrs.push(`minAng=\"${escapeXml(h.minAngle)}\"`);\n if (h.maxAngle !== undefined) attrs.push(`maxAng=\"${escapeXml(h.maxAngle)}\"`);\n const attrStr = attrs.length ? \" \" + attrs.join(\" \") : \"\";\n return `<a:ahPolar${attrStr}>${stringifyAdjustHandlePos(h.position)}</a:ahPolar>`;\n}\n\nfunction stringifyAdjustHandle(h: AdjustHandle): string {\n return h.type === \"xy\" ? stringifyXYAdjustHandle(h) : stringifyPolarAdjustHandle(h);\n}\n\nfunction readAdjustHandlePos(el: XmlElement): { x: string; y: string } | undefined {\n const pos = el.elements?.find((c) => c.name === \"a:pos\");\n if (!pos?.attributes) return undefined;\n const x = pos.attributes[\"x\"];\n const y = pos.attributes[\"y\"];\n if (x === undefined || y === undefined) return undefined;\n return { x: String(x), y: String(y) };\n}\n\nfunction readXYAdjustHandle(el: XmlElement): XYAdjustHandle | undefined {\n const position = readAdjustHandlePos(el);\n if (!position) return undefined;\n const result: XYAdjustHandle = { type: \"xy\", position };\n if (el.attributes?.[\"gdRefX\"] !== undefined) result.guideRefX = String(el.attributes[\"gdRefX\"]);\n if (el.attributes?.[\"minX\"] !== undefined) result.minX = String(el.attributes[\"minX\"]);\n if (el.attributes?.[\"maxX\"] !== undefined) result.maxX = String(el.attributes[\"maxX\"]);\n if (el.attributes?.[\"gdRefY\"] !== undefined) result.guideRefY = String(el.attributes[\"gdRefY\"]);\n if (el.attributes?.[\"minY\"] !== undefined) result.minY = String(el.attributes[\"minY\"]);\n if (el.attributes?.[\"maxY\"] !== undefined) result.maxY = String(el.attributes[\"maxY\"]);\n return result;\n}\n\nfunction readPolarAdjustHandle(el: XmlElement): PolarAdjustHandle | undefined {\n const position = readAdjustHandlePos(el);\n if (!position) return undefined;\n const result: PolarAdjustHandle = { type: \"polar\", position };\n if (el.attributes?.[\"gdRefR\"] !== undefined)\n result.guideRefRadius = String(el.attributes[\"gdRefR\"]);\n if (el.attributes?.[\"minR\"] !== undefined) result.minRadius = String(el.attributes[\"minR\"]);\n if (el.attributes?.[\"maxR\"] !== undefined) result.maxRadius = String(el.attributes[\"maxR\"]);\n if (el.attributes?.[\"gdRefAng\"] !== undefined)\n result.guideRefAngle = String(el.attributes[\"gdRefAng\"]);\n if (el.attributes?.[\"minAng\"] !== undefined) result.minAngle = String(el.attributes[\"minAng\"]);\n if (el.attributes?.[\"maxAng\"] !== undefined) result.maxAngle = String(el.attributes[\"maxAng\"]);\n return result;\n}\n\n// ── Connection site helpers ──\n\nfunction stringifyConnectionSite(site: ConnectionSite): string {\n return `<a:cxn ang=\"${escapeXml(site.angle)}\">${stringifyAdjustHandlePos(site.position)}</a:cxn>`;\n}\n\nfunction readConnectionSite(el: XmlElement): ConnectionSite | undefined {\n const ang = el.attributes?.[\"ang\"];\n if (ang === undefined) return undefined;\n const position = readAdjustHandlePos(el);\n if (!position) return undefined;\n return { angle: String(ang), position };\n}\n\n// ── Geom rect helpers ──\n\nfunction stringifyGeomRect(rect: GeomRect): string {\n return (\n `<a:rect l=\"${escapeXml(rect.left)}\" t=\"${escapeXml(rect.top)}\"` +\n ` r=\"${escapeXml(rect.right)}\" b=\"${escapeXml(rect.bottom)}\"/>`\n );\n}\n\nfunction readGeomRect(el: XmlElement): GeomRect | undefined {\n const a = el.attributes;\n if (!a) return undefined;\n const l = a[\"l\"];\n const t = a[\"t\"];\n const r = a[\"r\"];\n const b = a[\"b\"];\n if (l === undefined || t === undefined || r === undefined || b === undefined) return undefined;\n return { left: String(l), top: String(t), right: String(r), bottom: String(b) };\n}\n\n// ── Custom geometry descriptor ──\n\nexport const customGeometryDesc: CustomDescriptor<CustomGeometryOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const parts: string[] = [];\n\n // a:avLst\n if (opts.adjustmentValues && opts.adjustmentValues.length > 0) {\n parts.push(stringifyGuideList(\"a:avLst\", opts.adjustmentValues));\n } else {\n parts.push(\"<a:avLst/>\");\n }\n\n // a:gdLst\n if (opts.guides && opts.guides.length > 0) {\n parts.push(stringifyGuideList(\"a:gdLst\", opts.guides));\n }\n\n // a:ahLst\n if (opts.adjustHandles && opts.adjustHandles.length > 0) {\n const inner = opts.adjustHandles.map(stringifyAdjustHandle).join(\"\");\n parts.push(`<a:ahLst>${inner}</a:ahLst>`);\n }\n\n // a:cxnLst\n if (opts.connectionSites && opts.connectionSites.length > 0) {\n const inner = opts.connectionSites.map(stringifyConnectionSite).join(\"\");\n parts.push(`<a:cxnLst>${inner}</a:cxnLst>`);\n }\n\n // a:rect\n if (opts.textRectangle) {\n parts.push(stringifyGeomRect(opts.textRectangle));\n }\n\n // a:pathLst (required)\n const pathsXml = opts.pathList.map(stringifyPath).join(\"\");\n parts.push(`<a:pathLst>${pathsXml}</a:pathLst>`);\n\n return `<a:custGeom>${parts.join(\"\")}</a:custGeom>`;\n },\n parse(el, _ctx) {\n const result: Partial<CustomGeometryOptions> = {};\n\n // a:avLst\n const avLst = findChild(el, \"a:avLst\");\n if (avLst) {\n const guides = readGuideList(avLst);\n if (guides.length > 0) result.adjustmentValues = guides;\n }\n\n // a:gdLst\n const gdLst = findChild(el, \"a:gdLst\");\n if (gdLst) {\n const guides = readGuideList(gdLst);\n if (guides.length > 0) result.guides = guides;\n }\n\n // a:ahLst\n const ahLst = findChild(el, \"a:ahLst\");\n if (ahLst?.elements) {\n const handles: AdjustHandle[] = [];\n for (const child of ahLst.elements) {\n if (child.name === \"a:ahXY\") {\n const h = readXYAdjustHandle(child);\n if (h) handles.push(h);\n } else if (child.name === \"a:ahPolar\") {\n const h = readPolarAdjustHandle(child);\n if (h) handles.push(h);\n }\n }\n if (handles.length > 0) result.adjustHandles = handles;\n }\n\n // a:cxnLst\n const cxnLst = findChild(el, \"a:cxnLst\");\n if (cxnLst?.elements) {\n const sites: ConnectionSite[] = [];\n for (const child of cxnLst.elements) {\n if (child.name === \"a:cxn\") {\n const site = readConnectionSite(child);\n if (site) sites.push(site);\n }\n }\n if (sites.length > 0) result.connectionSites = sites;\n }\n\n // a:rect\n const rect = findChild(el, \"a:rect\");\n if (rect) {\n const textRectangle = readGeomRect(rect);\n if (textRectangle) result.textRectangle = textRectangle;\n }\n\n // a:pathLst (required)\n const pathLst = findChild(el, \"a:pathLst\");\n if (pathLst?.elements) {\n const paths: PathOptions[] = [];\n for (const child of pathLst.elements) {\n if (child.name === \"a:path\") {\n const p = readPath(child);\n if (p.commands && p.commands.length > 0) {\n paths.push(p as PathOptions);\n }\n }\n }\n if (paths.length > 0) result.pathList = paths;\n }\n\n return result as CustomGeometryOptions;\n },\n};\n","/**\n * Transform 2D descriptor for DrawingML shapes.\n *\n * @module\n */\n\nimport { attrMeasure, findChild } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../descriptor\";\nimport { convertToEmu, emitAngle, parseAngle } from \"../util/converters\";\nimport { parseOnOff } from \"../util/values\";\nimport type { GroupTransform2DOptions, Transform2DOptions } from \"./transform\";\n\n// ── Transform2D descriptor ──\n// x, y, width, height: number (EMU) | string (UniversalMeasure)\n\nexport const transform2DDesc: CustomDescriptor<Transform2DOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const parts: string[] = [];\n\n // Attributes\n const attrParts: string[] = [];\n if (opts.flipHorizontal !== undefined) attrParts.push(`flipH=\"${opts.flipHorizontal ? 1 : 0}\"`);\n if (opts.flipVertical !== undefined) attrParts.push(`flipV=\"${opts.flipVertical ? 1 : 0}\"`);\n if (opts.rotation !== undefined) attrParts.push(`rot=\"${emitAngle(opts.rotation)}\"`);\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n\n // Child elements: off, ext\n if (opts.x !== undefined || opts.y !== undefined) {\n const x = opts.x !== undefined ? convertToEmu(opts.x) : 0;\n const y = opts.y !== undefined ? convertToEmu(opts.y) : 0;\n parts.push(`<a:off x=\"${x}\" y=\"${y}\"/>`);\n }\n if (opts.width !== undefined || opts.height !== undefined) {\n const cx = opts.width !== undefined ? convertToEmu(opts.width) : 0;\n const cy = opts.height !== undefined ? convertToEmu(opts.height) : 0;\n parts.push(`<a:ext cx=\"${cx}\" cy=\"${cy}\"/>`);\n }\n\n if (parts.length === 0 && !attrStr) return undefined;\n if (parts.length === 0) return `<a:xfrm${attrStr}/>`;\n return `<a:xfrm${attrStr}>${parts.join(\"\")}</a:xfrm>`;\n },\n parse(el, _ctx) {\n const result: Record<string, unknown> = {};\n\n // Attributes\n if (el.attributes) {\n if (el.attributes[\"flipH\"] !== undefined)\n result.flipHorizontal = parseOnOff(el.attributes[\"flipH\"]) ?? false;\n if (el.attributes[\"flipV\"] !== undefined)\n result.flipVertical = parseOnOff(el.attributes[\"flipV\"]) ?? false;\n if (el.attributes[\"rot\"] !== undefined)\n result.rotation = parseAngle(Number(el.attributes[\"rot\"]));\n }\n\n // Child: off — a:off x/y are ST_Coordinate (number EMU | UniversalMeasure)\n const off = findChild(el, \"a:off\");\n if (off?.attributes) {\n const xv = attrMeasure(off, \"x\");\n result.x = xv ?? 0;\n const yv = attrMeasure(off, \"y\");\n result.y = yv ?? 0;\n }\n\n // Child: ext\n const ext = findChild(el, \"a:ext\");\n if (ext?.attributes) {\n const cxv = attrMeasure(ext, \"cx\");\n result.width = cxv ?? 0;\n const cyv = attrMeasure(ext, \"cy\");\n result.height = cyv ?? 0;\n }\n\n return result as Transform2DOptions;\n },\n};\n\n// ── GroupTransform2D descriptor ──\n\nexport const groupTransform2DDesc: CustomDescriptor<GroupTransform2DOptions> = {\n kind: \"custom\",\n stringify(opts, ctx) {\n const base = transform2DDesc.stringify(opts, ctx) ?? \"<a:xfrm/>\";\n\n // Append chOff and chExt children before closing tag (values are already in EMU)\n const chOff = `<a:chOff x=\"${opts.childOffsetX ?? 0}\" y=\"${opts.childOffsetY ?? 0}\"/>`;\n const chExt = `<a:chExt cx=\"${opts.childExtentWidth ?? 0}\" cy=\"${opts.childExtentHeight ?? 0}\"/>`;\n\n if (base.endsWith(\"/>\")) {\n return `<a:xfrm>${chOff}${chExt}</a:xfrm>`;\n }\n return base.replace(/<\\/a:xfrm>$/, `${chOff}${chExt}</a:xfrm>`);\n },\n parse(el, ctx) {\n const result = transform2DDesc.parse(el, ctx) as Record<string, unknown>;\n\n const chOff = findChild(el, \"a:chOff\");\n if (chOff?.attributes) {\n const cx = attrMeasure(chOff, \"x\");\n result.childOffsetX = cx ?? 0;\n const cy = attrMeasure(chOff, \"y\");\n result.childOffsetY = cy ?? 0;\n }\n\n const chExt = findChild(el, \"a:chExt\");\n if (chExt?.attributes) {\n const ccx = attrMeasure(chExt, \"cx\");\n result.childExtentWidth = ccx ?? 0;\n const ccy = attrMeasure(chExt, \"cy\");\n result.childExtentHeight = ccy ?? 0;\n }\n\n return result as GroupTransform2DOptions;\n },\n};\n","/**\n * Shape properties descriptor for DrawingML CT_ShapeProperties.\n *\n * Assembles the XSD-ordered children of a shape/picture/group properties\n * element (a:xfrm → geometry → fill → a:ln → effects → a:scene3d → a:sp3d).\n * Returns the inner content only; the caller wraps the container tag\n * (p:spPr / wps:spPr / pic:spPr / xdr:spPr) and any container-only attributes\n * such as bwMode.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_ShapeProperties / EG_ShapeProperties\n *\n * @module\n */\n\nimport { findChild, stringify } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../descriptor\";\nimport { parse } from \"../descriptor\";\nimport type { UniversalMeasure } from \"../util/values\";\nimport { createEffectDag } from \"./effects/effect-dag\";\nimport type { EffectDagOptions } from \"./effects/effect-dag\";\nimport { effectListDesc } from \"./effects/effect-descriptors\";\nimport type { EffectListOptions } from \"./effects/effect-list\";\nimport { fillDesc } from \"./fill/fill-descriptors\";\nimport type { FillOptions } from \"./fill/fill-options\";\nimport type { CustomGeometryOptions } from \"./geometry/custom-geometry\";\nimport { presetGeometryDesc, customGeometryDesc } from \"./geometry/geometry-descriptors\";\nimport type { PresetGeometryOptions } from \"./geometry/preset-geometry\";\nimport type { OutlineOptions } from \"./outline/outline\";\nimport { outlineDesc } from \"./outline/outline-descriptors\";\nimport type { Scene3DOptions } from \"./three-d/scene-3d\";\nimport type { Shape3DOptions } from \"./three-d/shape-3d\";\nimport { scene3DDesc, shape3DDesc } from \"./three-d/three-d-descriptors\";\nimport type { Transform2DOptions, GroupTransform2DOptions } from \"./transform\";\nimport { transform2DDesc, groupTransform2DDesc } from \"./transform-descriptors\";\n\n// ── Types ──\n\n/**\n * Shape properties (CT_ShapeProperties children). Field order follows the XSD\n * content model; the serializer emits in that order. Container-only attributes\n * (bwMode, rotWithShape) and the wrapping tag are the caller's responsibility.\n */\nexport interface ShapePropertiesOptions {\n // CT_Transform2D (a:xfrm)\n x?: number | UniversalMeasure;\n y?: number | UniversalMeasure;\n width?: number | UniversalMeasure;\n height?: number | UniversalMeasure;\n flipHorizontal?: boolean;\n flipVertical?: boolean;\n /** Rotation angle in degrees (e.g., 45 = 45°). */\n rotation?: number;\n // CT_GroupTransform2D extras (a:chOff / a:chExt). When any is set, the\n // descriptor emits a group transform (groupTransform2DDesc) instead of a\n // plain CT_Transform2D.\n childOffsetX?: number | UniversalMeasure;\n childOffsetY?: number | UniversalMeasure;\n childExtentWidth?: number | UniversalMeasure;\n childExtentHeight?: number | UniversalMeasure;\n // EG_Geometry (choice: a:custGeom | a:prstGeom). customGeometry wins; a bare\n // string geometry is shorthand for { preset: \"<name>\" }.\n geometry?: string | PresetGeometryOptions;\n customGeometry?: CustomGeometryOptions;\n // EG_FillProperties\n fill?: FillOptions;\n // a:ln\n outline?: OutlineOptions;\n // EG_EffectProperties (choice: a:effectDag | a:effectLst)\n effects?: EffectListOptions;\n effectDag?: EffectDagOptions;\n // 3D\n scene3d?: Scene3DOptions;\n shape3d?: Shape3DOptions;\n /** Raw a:extLst inner XML — verbatim round-trip for unmodeled extensions. */\n ext?: string;\n}\n\n// ── Descriptor ──\n\nexport const shapePropertiesDesc: CustomDescriptor<ShapePropertiesOptions> = {\n kind: \"custom\",\n\n stringify(opts, ctx) {\n const parts: string[] = [];\n\n // a:xfrm — emit only when any transform field is set. Group-only child\n // fields (chOff/chExt) trigger a group transform.\n const hasGroupChild =\n opts.childOffsetX !== undefined ||\n opts.childOffsetY !== undefined ||\n opts.childExtentWidth !== undefined ||\n opts.childExtentHeight !== undefined;\n const hasTransform =\n opts.x !== undefined ||\n opts.y !== undefined ||\n opts.width !== undefined ||\n opts.height !== undefined ||\n opts.flipHorizontal !== undefined ||\n opts.flipVertical !== undefined ||\n opts.rotation !== undefined ||\n hasGroupChild;\n if (hasTransform) {\n const transformOpts = {\n x: opts.x,\n y: opts.y,\n width: opts.width,\n height: opts.height,\n flipHorizontal: opts.flipHorizontal,\n flipVertical: opts.flipVertical,\n rotation: opts.rotation,\n childOffsetX: opts.childOffsetX,\n childOffsetY: opts.childOffsetY,\n childExtentWidth: opts.childExtentWidth,\n childExtentHeight: opts.childExtentHeight,\n };\n const xfrm = hasGroupChild\n ? groupTransform2DDesc.stringify(transformOpts as GroupTransform2DOptions, ctx)\n : transform2DDesc.stringify(transformOpts as Transform2DOptions, ctx);\n if (xfrm) parts.push(xfrm);\n }\n\n // EG_Geometry: customGeometry takes precedence (matches pptx/docx).\n if (opts.customGeometry) {\n const g = customGeometryDesc.stringify(opts.customGeometry, ctx);\n if (g) parts.push(g);\n } else if (opts.geometry !== undefined) {\n const geom: PresetGeometryOptions =\n typeof opts.geometry === \"string\" ? { preset: opts.geometry } : opts.geometry;\n const g = presetGeometryDesc.stringify(geom, ctx);\n if (g) parts.push(g);\n }\n\n // EG_FillProperties\n if (opts.fill !== undefined) {\n const f = fillDesc.stringify(opts.fill, ctx);\n if (f) parts.push(f);\n }\n\n // a:ln\n if (opts.outline) {\n const ln = outlineDesc.stringify(opts.outline, ctx);\n if (ln) parts.push(ln);\n }\n\n // EG_EffectProperties: effectDag | effectLst (mutually exclusive).\n if (opts.effectDag) {\n parts.push(createEffectDag(opts.effectDag));\n } else if (opts.effects) {\n const e = effectListDesc.stringify(opts.effects, ctx);\n if (e) parts.push(e);\n }\n\n // a:scene3d\n if (opts.scene3d) {\n const s = scene3DDesc.stringify(opts.scene3d, ctx);\n if (s) parts.push(s);\n }\n\n // a:sp3d\n if (opts.shape3d) {\n const sp = shape3DDesc.stringify(opts.shape3d, ctx);\n if (sp) parts.push(sp);\n }\n\n // a:extLst — verbatim round-trip (last child per CT_ShapeProperties sequence).\n if (opts.ext) parts.push(`<a:extLst>${opts.ext}</a:extLst>`);\n\n return parts.length > 0 ? parts.join(\"\") : undefined;\n },\n\n parse(el, ctx) {\n const result: Partial<ShapePropertiesOptions> = {};\n\n // a:xfrm — group transform when chOff/chExt present, else plain transform.\n const xfrm = findChild(el, \"a:xfrm\");\n if (xfrm) {\n const hasGroupChild = !!(findChild(xfrm, \"a:chOff\") ?? findChild(xfrm, \"a:chExt\"));\n Object.assign(\n result,\n hasGroupChild ? groupTransform2DDesc.parse(xfrm, ctx) : transform2DDesc.parse(xfrm, ctx),\n );\n }\n\n // EG_Geometry\n const custGeom = findChild(el, \"a:custGeom\");\n if (custGeom) {\n result.customGeometry = customGeometryDesc.parse(custGeom, ctx);\n } else {\n const prstGeom = findChild(el, \"a:prstGeom\");\n if (prstGeom) result.geometry = presetGeometryDesc.parse(prstGeom, ctx);\n }\n\n // EG_FillProperties — fillDesc always returns a value (defaults to none),\n // so probe for a fill child first to avoid synthesizing a spurious fill.\n const fillChild =\n findChild(el, \"a:noFill\") ??\n findChild(el, \"a:solidFill\") ??\n findChild(el, \"a:gradFill\") ??\n findChild(el, \"a:pattFill\") ??\n findChild(el, \"a:grpFill\") ??\n findChild(el, \"a:blipFill\");\n if (fillChild) {\n result.fill = parse(fillDesc, el, ctx);\n }\n\n // a:ln\n const ln = findChild(el, \"a:ln\");\n if (ln) result.outline = outlineDesc.parse(ln, ctx);\n\n // EG_EffectProperties — effectLst. (effectDag parse is not modeled here;\n // matches current per-package behavior. effectDag still round-trips via\n // stringify when the caller supplies it.)\n const effectLst = findChild(el, \"a:effectLst\");\n if (effectLst) result.effects = effectListDesc.parse(effectLst, ctx);\n\n // a:scene3d\n const scene3d = findChild(el, \"a:scene3d\");\n if (scene3d) result.scene3d = scene3DDesc.parse(scene3d, ctx);\n\n // a:sp3d\n const sp3d = findChild(el, \"a:sp3d\");\n if (sp3d) result.shape3d = shape3DDesc.parse(sp3d, ctx);\n\n // a:extLst — verbatim inner XML for unmodeled extensions.\n const extLst = findChild(el, \"a:extLst\");\n if (extLst) {\n const inner = stringify(extLst);\n if (inner) result.ext = inner;\n }\n\n return result as ShapePropertiesOptions;\n },\n};\n","/**\n * Group shape properties descriptor for DrawingML CT_GroupShapeProperties.\n *\n * Assembles the XSD-ordered children of a group's properties element\n * (a:xfrm → EG_FillProperties → EG_EffectProperties → a:scene3d). Returns the\n * inner content only; the caller wraps the container tag (p:grpSpPr /\n * wpg:grpSpPr / xdr:grpSpPr / a:grpSpPr) and any container-only attributes\n * such as bwMode.\n *\n * Unlike CT_ShapeProperties, a group carries no geometry (prstGeom/custGeom),\n * no outline (a:ln), and no shape 3D (a:sp3d) — only the transform, fill,\n * effects, and scene 3D that apply to the group as a whole. The transform is\n * always a group transform (CT_GroupTransform2D), so the fields flatten in\n * directly via `extends GroupTransform2DOptions` (mirroring the flat style of\n * ShapePropertiesOptions, without its geometry/outline/shape3d extras).\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GroupShapeProperties\n *\n * @module\n */\n\nimport { findChild } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../descriptor\";\nimport { parse } from \"../descriptor\";\nimport { createEffectDag } from \"./effects/effect-dag\";\nimport type { EffectDagOptions } from \"./effects/effect-dag\";\nimport { effectListDesc } from \"./effects/effect-descriptors\";\nimport type { EffectListOptions } from \"./effects/effect-list\";\nimport { fillDesc } from \"./fill/fill-descriptors\";\nimport type { FillOptions } from \"./fill/fill-options\";\nimport type { Scene3DOptions } from \"./three-d/scene-3d\";\nimport { scene3DDesc } from \"./three-d/three-d-descriptors\";\nimport type { GroupTransform2DOptions } from \"./transform\";\nimport { groupTransform2DDesc } from \"./transform-descriptors\";\n\n// ── Types ──\n\n/**\n * Group shape properties (CT_GroupShapeProperties). Field order follows the XSD\n * content model. The transform fields come from {@link GroupTransform2DOptions}\n * (flat x/y/width/height/flip/rotation/childOffset/childExtent); the serializer\n * emits them as a single a:xfrm group transform. The container-only @bwMode\n * attribute and the wrapping tag are the caller's responsibility (mirrors\n * shapePropertiesDesc).\n */\nexport interface GroupShapePropertiesOptions extends GroupTransform2DOptions {\n /** EG_FillProperties. */\n fill?: FillOptions;\n /** EG_EffectProperties (choice: a:effectDag | a:effectLst). */\n effects?: EffectListOptions;\n effectDag?: EffectDagOptions;\n /** a:scene3d. */\n scene3d?: Scene3DOptions;\n}\n\n// ── Descriptor ──\n\nexport const groupShapePropertiesDesc: CustomDescriptor<GroupShapePropertiesOptions> = {\n kind: \"custom\",\n\n stringify(opts, ctx) {\n const parts: string[] = [];\n\n // a:xfrm — group transform (CT_GroupTransform2D). Emit when any transform\n // field is set. A group always uses a group transform (no plain/sp transform).\n const hasTransform =\n opts.x !== undefined ||\n opts.y !== undefined ||\n opts.width !== undefined ||\n opts.height !== undefined ||\n opts.flipHorizontal !== undefined ||\n opts.flipVertical !== undefined ||\n opts.rotation !== undefined ||\n opts.childOffsetX !== undefined ||\n opts.childOffsetY !== undefined ||\n opts.childExtentWidth !== undefined ||\n opts.childExtentHeight !== undefined;\n if (hasTransform) {\n const xfrm = groupTransform2DDesc.stringify(opts, ctx);\n if (xfrm) parts.push(xfrm);\n }\n\n // EG_FillProperties\n if (opts.fill !== undefined) {\n const f = fillDesc.stringify(opts.fill, ctx);\n if (f) parts.push(f);\n }\n\n // EG_EffectProperties: effectDag | effectLst (mutually exclusive).\n if (opts.effectDag) {\n parts.push(createEffectDag(opts.effectDag));\n } else if (opts.effects) {\n const e = effectListDesc.stringify(opts.effects, ctx);\n if (e) parts.push(e);\n }\n\n // a:scene3d\n if (opts.scene3d) {\n const s = scene3DDesc.stringify(opts.scene3d, ctx);\n if (s) parts.push(s);\n }\n\n return parts.length > 0 ? parts.join(\"\") : undefined;\n },\n\n parse(el, ctx) {\n const result: Partial<GroupShapePropertiesOptions> = {};\n\n // a:xfrm — group transform.\n const xfrm = findChild(el, \"a:xfrm\");\n if (xfrm) {\n Object.assign(result, groupTransform2DDesc.parse(xfrm, ctx));\n }\n\n // EG_FillProperties — fillDesc always returns a value (defaults to none),\n // so probe for a fill child first to avoid synthesizing a spurious fill.\n const fillChild =\n findChild(el, \"a:noFill\") ??\n findChild(el, \"a:solidFill\") ??\n findChild(el, \"a:gradFill\") ??\n findChild(el, \"a:pattFill\") ??\n findChild(el, \"a:grpFill\") ??\n findChild(el, \"a:blipFill\");\n if (fillChild) {\n result.fill = parse(fillDesc, el, ctx);\n }\n\n // EG_EffectProperties — effectLst. (effectDag parse is not modeled here;\n // matches shapePropertiesDesc behavior. effectDag still round-trips via\n // stringify when the caller supplies it.)\n const effectLst = findChild(el, \"a:effectLst\");\n if (effectLst) result.effects = effectListDesc.parse(effectLst, ctx);\n\n // a:scene3d\n const scene3d = findChild(el, \"a:scene3d\");\n if (scene3d) result.scene3d = scene3DDesc.parse(scene3d, ctx);\n\n return result as GroupShapePropertiesOptions;\n },\n};\n","/**\n * Shared DrawingML text option types, enums, and constants.\n *\n * Promoted from per-format implementations so DOCX/PPTX/XLSX share one text\n * model for runs, paragraphs, fields, and bullets. DOCX still uses\n * WordprocessingML (w:p) inside text boxes, but its DrawingML run/paragraph\n * options align with these types where they overlap.\n *\n * @module\n */\n\nimport type { SolidFillOptions } from \"../color/solid-fill\";\nimport type { EffectListOptions } from \"../effects/effect-list\";\nimport type { FillOptions } from \"../fill/fill-options\";\nimport type { OutlineOptions } from \"../outline/outline\";\n\n// ── Run style enums ──\n\nexport type UnderlineStyle = \"single\" | \"double\" | \"none\";\n\n// Friendly spellings; xsdStrikeStyle maps them to ST_TextStrikeType tokens.\nexport type StrikeStyle = \"singleStrike\" | \"doubleStrike\" | \"noStrike\";\n\nexport type TextCapitalization = \"none\" | \"all\" | \"small\";\n\n// ── Paragraph alignment ──\n\nexport type TextAlignment = \"left\" | \"center\" | \"right\" | \"justify\";\n\n// ── Hyperlink (a:hlinkClick) ──\n\nexport interface TextHyperlinkOptions {\n /** External URL target (mutually exclusive with slide). */\n url?: string;\n /**\n * Internal slide target, 1-based slide number (mutually exclusive with url).\n * Emitted as r:id → slideN.xml + action=\"ppaction://hlinksldjump\".\n *\n * PPTX only — slides exist in no other format. Formats without slides\n * reject the field at generate time instead of silently dropping it.\n */\n slide?: number;\n /** Internal placeholder key (\"{hlink:N}\" → \"N\"); preserved across parse → stringify. */\n referenceId?: string;\n tooltip?: string;\n action?: string;\n highlightClick?: boolean;\n endSound?: boolean;\n invalidUrl?: boolean;\n}\n\n// ── Text fonts (CT_TextFont: a:latin / a:ea / a:cs / a:sym) ──\n\n/**\n * A script typeface (CT_TextFont). A bare string is the typeface only; the\n * full object carries panose/pitchFamily/charset for embedded font metrics.\n */\nexport type TextFont =\n | string\n | {\n typeface: string;\n /** ST_Panose — 10-byte hex panose classification. */\n panose?: string;\n pitchFamily?: number;\n charset?: number;\n };\n\n/**\n * Run font scripts. A bare string sets latin + ea to the same typeface (the\n * common case); the object form sets each script independently.\n */\nexport type RunFont =\n | string\n | {\n latin?: TextFont;\n eastAsia?: TextFont;\n complexScript?: TextFont;\n symbol?: TextFont;\n };\n\n// ── Run properties (CT_TextCharacterProperties) ──\n\nexport interface RunPropertiesOptions {\n /** Font size in points. Serialized as OOXML a:sz (hundredths of a point). */\n size?: number;\n bold?: boolean;\n italic?: boolean;\n underline?: UnderlineStyle;\n font?: RunFont;\n lang?: string;\n fill?: FillOptions;\n hyperlink?: TextHyperlinkOptions;\n /** a:hlinkMouseOver — hover hyperlink (CT_Hyperlink). */\n mouseoverHyperlink?: TextHyperlinkOptions;\n strike?: StrikeStyle;\n /** Baseline offset as integer percent (positive = superscript, negative = subscript). */\n baseline?: number;\n /** Character spacing in points (a:spc). */\n spacing?: number;\n capitalization?: TextCapitalization;\n /** a:highlight (CT_Color) — text highlight color. */\n highlight?: SolidFillOptions;\n /** EG_TextUnderlineLine — underline line. `true` = a:uLnTx (follow the text line); an OutlineOptions = a:uLn. */\n underlineLine?: true | OutlineOptions;\n /** EG_TextUnderlineFill — underline fill. `true` = a:uFillTx (follow the text fill); a FillOptions = a:uFill. */\n underlineFill?: true | FillOptions;\n /** @kern — kerning threshold in points (ST_TextNonNegativePoint). */\n kern?: number;\n /** a:ln (CT_LineProperties). `true` emits a sane default; a full OutlineOptions round-trips. */\n outline?: true | OutlineOptions;\n /** a:effectLst (EG_EffectProperties). `true` emits a default outer shadow; a full EffectListOptions round-trips. */\n shadow?: true | EffectListOptions;\n rightToLeft?: boolean;\n noProof?: boolean;\n dirty?: boolean;\n kumimoji?: boolean;\n alternateLanguage?: string;\n normalizeHeight?: boolean;\n bookmarkMark?: string;\n smartTagId?: string;\n /** @err — spelling error flag. */\n err?: boolean;\n /** @smtClean — smart tag clean flag (XSD default true). */\n smtClean?: boolean;\n}\n\n// ── Run (a:r) ──\n\nexport interface RunOptions extends RunPropertiesOptions {\n text?: string;\n}\n\n// ── Bullets ──\n\n/** Shared bullet color/size/font styling (EG_TextBulletColorSizeFont). Each\n * dimension is a choice: an explicit value, a \"follows text\" toggle, or unset. */\nexport type BulletStyleOptions = {\n /** a:buClr > a:srgbClr — explicit bullet color (hex, no #). */\n color?: string;\n /** a:buClrTx — bullet color follows the text run color. */\n colorFollowsText?: boolean;\n /** a:buSzPct @val — bullet size as a percentage of the text size. */\n size?: number;\n /** a:buSzTx — bullet size follows the text run size. */\n sizeFollowsText?: boolean;\n /** a:buSzPts @val — bullet size in points. */\n sizePoints?: number;\n /** a:buFont @typeface — bullet font (defaults to Arial on fresh char/autoNum). */\n font?: string;\n /** a:buFontTx — bullet font follows the text run font. */\n fontFollowsText?: boolean;\n};\n\nexport type BulletCharOptions = BulletStyleOptions & {\n type: \"char\";\n char?: string;\n};\n\nexport type BulletAutoNumOptions = BulletStyleOptions & {\n type: \"autoNum\";\n format?: string;\n startAt?: number;\n};\n\n/** Picture bullet (a:buBlip r:embed). `embed` is the image relationship id. */\nexport type BulletPictureOptions = BulletStyleOptions & {\n type: \"picture\";\n embed: string;\n};\n\nexport type BulletNoneOption = { type: \"none\" };\n\nexport type BulletOptions =\n | BulletCharOptions\n | BulletAutoNumOptions\n | BulletPictureOptions\n | BulletNoneOption;\n\n// ── Tab stops (a:tabLst) ──\n\nexport type TextTabAlignment = \"l\" | \"ctr\" | \"r\" | \"dec\";\n\nexport interface TabStopOptions {\n /** a:tab @pos — tab stop position in EMU. */\n position?: number;\n /** a:tab @algn — tab alignment (l/ctr/r/dec). */\n alignment?: TextTabAlignment;\n}\n\n// ── Paragraph properties (a:pPr) ──\n\nexport interface ParagraphPropertiesOptions {\n alignment?: TextAlignment;\n indentLevel?: number;\n /** Space after a paragraph in points (a:spcAft/a:spcPts). */\n spaceAfter?: number;\n /** Space before a paragraph in points (a:spcBef/a:spcPts). */\n spaceBefore?: number;\n bullet?: BulletOptions;\n /** Line spacing as a percentage (100 = single). */\n lineSpacingPercent?: number;\n /** Line spacing in exact points (a:lnSpc/a:spcPts). */\n lineSpacingPoints?: number;\n marginIndent?: number;\n marginRight?: number;\n defTabSize?: number;\n /** @indent — first-line indent (ST_TextIndent, EMU). */\n indent?: number;\n /** a:tabLst — explicit tab stops (emitted after bullets, before defRPr). */\n tabStops?: TabStopOptions[];\n /** a:defRPr — default run properties for the paragraph (CT_TextCharacterProperties). */\n defaultRunProperties?: RunPropertiesOptions;\n fontAlignment?: \"auto\" | \"t\" | \"ctr\" | \"b\" | \"base\";\n /** @rtl — paragraph right-to-left. */\n rightToLeft?: boolean;\n /** @eaLnBrk — East Asian line break. */\n eastAsianLineBreak?: boolean;\n /** @latinLnBrk — Latin line break. */\n latinLineBreak?: boolean;\n}\n\n// ── Text field (a:fld) ──\n\nexport interface TextFieldOptions {\n /** a:fld @type — field type token (e.g. \"datetimeFigureOut\", \"slidenum\"). */\n type: string;\n /** a:fld @id — GUID identifier. */\n id?: string;\n /** a:t — display text (often a placeholder such as \"‹#›\" or \"1/27/13\"). */\n text?: string;\n /** a:rPr — run properties. */\n properties?: RunPropertiesOptions;\n}\n\n// ── Soft line break (a:br) ──\n\nexport interface BreakOptions {\n /** Marks a soft line break (a:br) within a paragraph's children. */\n break: true;\n properties?: RunPropertiesOptions;\n}\n\n// ── Defaults ──\n\n/** Default outline width: 1pt = 12700 EMU. */\nexport const DEFAULT_OUTLINE_WIDTH = 12700;\n/** Default shadow blur radius: ~4pt = 50800 EMU. */\nexport const DEFAULT_SHADOW_BLUR_RADIUS = 50800;\n/** Default shadow distance: ~3pt = 38100 EMU. */\nexport const DEFAULT_SHADOW_DISTANCE = 38100;\n/** Default shadow direction: 270° (degrees). */\nexport const DEFAULT_SHADOW_DIRECTION = 270;\n/** Default shadow alpha: 40% (integer percent). */\nexport const DEFAULT_SHADOW_ALPHA = 40;\n","/**\n * Text body properties for DrawingML shapes (CT_TextBodyProperties).\n *\n * Defines how text is laid out within a shape: margins, alignment, autofit,\n * vertical text, overflow, columns, and 3D. The factory + parser cover all 19\n * CT_TextBodyProperties attributes and child elements (prstTxWarp, EG_TextAutofit,\n * scene3d, EG_Text3D).\n *\n * The container tag is parameterized: PPTX/XLSX emit a:bodyPr, DOCX emits\n * wps:bodyPr. `createBodyProperties` takes an optional tagName (default a:bodyPr);\n * `bodyPropertiesDesc` is the a:bodyPr descriptor instance.\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_TextBodyProperties\n *\n * @module\n */\n\nimport { attr, attrBool, attrMeasure, attrNum, element, findChild } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\n\nimport type { ReadContext, WriteContext, CustomDescriptor } from \"../../descriptor\";\nimport { convertToEmu } from \"../../util/converters\";\nimport type { UniversalMeasure } from \"../../util/values\";\nimport { createScene3D } from \"../three-d/scene-3d\";\nimport type { Scene3DOptions } from \"../three-d/scene-3d\";\nimport { createShape3D } from \"../three-d/shape-3d\";\nimport type { Shape3DOptions } from \"../three-d/shape-3d\";\nimport { scene3DDesc, shape3DDesc } from \"../three-d/three-d-descriptors\";\n\n// ── Enumerations ──\n\n/** Text anchoring type (ST_TextAnchoringType). */\nexport type VerticalAnchor = \"t\" | \"ctr\" | \"b\" | \"just\" | \"dist\";\n\n/** Text vertical overflow type (ST_TextVertOverflowType). */\nexport type TextVertOverflow = \"overflow\" | \"ellipsis\" | \"clip\";\n\n/** Text horizontal overflow type (ST_TextHorzOverflowType). */\nexport type TextHorzOverflow = \"overflow\" | \"clip\";\n\n/** Text vertical type (ST_TextVerticalType). */\nexport type TextVertical =\n | \"horz\"\n | \"vert\"\n | \"vert270\"\n | \"wordArtVert\"\n | \"eaVert\"\n | \"mongolianVert\"\n | \"wordArtVertRtl\";\n\n/** Text body wrapping type (ST_TextWrappingType). */\nexport type TextBodyWrapping = \"none\" | \"square\";\n\n// ── Sub-element Options ──\n\n/** Normal autofit options (CT_TextNormalAutofit). */\nexport interface NormalAutofitOptions {\n /** Font scale percentage (e.g., 100000 = 100%). */\n fontScale?: number;\n /** Line spacing reduction percentage. */\n lnSpcReduction?: number;\n}\n\n/** Preset text warp options (CT_PresetTextShape). */\nexport interface PresetTextShapeOptions {\n /** Preset shape type (e.g. \"textArchUp\", \"textCircle\"). */\n preset: string;\n /** Optional adjustment values. */\n adjustments?: { name: string; formula: string }[];\n}\n\n/** Flat text options (CT_FlatText). */\nexport interface FlatTextOptions {\n /** Z-offset in EMUs. */\n z?: number;\n}\n\n// ── Main Options ──\n\n/**\n * Options for text body properties (CT_TextBodyProperties).\n *\n * XSD content model:\n * prstTxWarp?, EG_TextAutofit?, scene3d?, EG_Text3D?\n * followed by 19 attributes.\n */\nexport interface BodyPropertiesOptions {\n rotation?: number;\n spcFirstLastPara?: boolean;\n vertOverflow?: TextVertOverflow;\n horzOverflow?: TextHorzOverflow;\n vertical?: TextVertical;\n wrap?: TextBodyWrapping;\n lIns?: number | UniversalMeasure;\n tIns?: number | UniversalMeasure;\n rIns?: number | UniversalMeasure;\n bIns?: number | UniversalMeasure;\n numCol?: number;\n spcCol?: number | UniversalMeasure;\n rtlCol?: boolean;\n fromWordArt?: boolean;\n anchor?: VerticalAnchor;\n anchorCtr?: boolean;\n forceAA?: boolean;\n upright?: boolean;\n compatLnSpc?: boolean;\n\n /** Margins shorthand. */\n margins?: {\n top?: number | UniversalMeasure;\n bottom?: number | UniversalMeasure;\n left?: number | UniversalMeasure;\n right?: number | UniversalMeasure;\n };\n\n prstTxWarp?: PresetTextShapeOptions;\n /** Disable autofit (EG_TextAutofit choice). */\n noAutoFit?: boolean;\n /** Normal autofit (EG_TextAutofit choice). */\n normAutofit?: NormalAutofitOptions;\n /** Shape autofit (EG_TextAutofit choice). */\n spAutoFit?: boolean;\n scene3d?: Scene3DOptions;\n sp3d?: Shape3DOptions;\n flatTx?: FlatTextOptions;\n}\n\n// ── Helpers ──\n\nconst filterAttrs = (\n options: Record<string, unknown>,\n): Record<string, string | number | boolean> | undefined => {\n const attrs: Record<string, string | number | boolean> = {};\n for (const [key, value] of Object.entries(options)) {\n if (value !== undefined) {\n attrs[key] = value as string | number | boolean;\n }\n }\n return Object.keys(attrs).length > 0 ? attrs : undefined;\n};\n\nconst createPresetTextShape = (options: PresetTextShapeOptions): string => {\n const adjChildren: string[] = [];\n if (options.adjustments) {\n for (const adj of options.adjustments) {\n adjChildren.push(`<a:gd name=\"${adj.name}\" fmla=\"${adj.formula}\"/>`);\n }\n }\n return element(\n \"a:prstTxWarp\",\n { prst: options.preset },\n adjChildren.length > 0 ? [element(\"a:avLst\", undefined, adjChildren)] : undefined,\n );\n};\n\n// ── Factory ──\n\n/**\n * Create a text body properties element. tagName defaults to a:bodyPr (PPTX/XLSX);\n * DOCX passes \"wps:bodyPr\".\n */\nexport const createBodyProperties = (\n options: BodyPropertiesOptions = {},\n tagName = \"a:bodyPr\",\n): string => {\n const anchor = options.anchor;\n const lIns = options.lIns ?? options.margins?.left;\n const tIns = options.tIns ?? options.margins?.top;\n const rIns = options.rIns ?? options.margins?.right;\n const bIns = options.bIns ?? options.margins?.bottom;\n\n const attrs = filterAttrs({\n rot: options.rotation,\n spcFirstLastPara: options.spcFirstLastPara,\n vertOverflow: options.vertOverflow,\n horzOverflow: options.horzOverflow,\n vert: options.vertical,\n wrap: options.wrap,\n lIns: lIns !== undefined ? convertToEmu(lIns) : undefined,\n tIns: tIns !== undefined ? convertToEmu(tIns) : undefined,\n rIns: rIns !== undefined ? convertToEmu(rIns) : undefined,\n bIns: bIns !== undefined ? convertToEmu(bIns) : undefined,\n numCol: options.numCol,\n spcCol: options.spcCol !== undefined ? convertToEmu(options.spcCol) : undefined,\n rtlCol: options.rtlCol,\n fromWordArt: options.fromWordArt,\n anchor,\n anchorCtr: options.anchorCtr,\n forceAA: options.forceAA,\n upright: options.upright,\n compatLnSpc: options.compatLnSpc,\n });\n\n const children: string[] = [];\n if (options.prstTxWarp) children.push(createPresetTextShape(options.prstTxWarp));\n\n // EG_TextAutofit (mutually exclusive)\n if (options.noAutoFit) {\n children.push(`<a:noAutofit/>`);\n } else if (options.normAutofit) {\n const normAttrs = filterAttrs({\n fontScale: options.normAutofit.fontScale,\n lnSpcReduction: options.normAutofit.lnSpcReduction,\n });\n children.push(element(\"a:normAutofit\", normAttrs));\n } else if (options.spAutoFit) {\n children.push(`<a:spAutoFit/>`);\n }\n\n if (options.scene3d) children.push(createScene3D(options.scene3d));\n\n // EG_Text3D (mutually exclusive)\n if (options.sp3d) {\n children.push(createShape3D(options.sp3d));\n } else if (options.flatTx) {\n const flatAttrs = filterAttrs({ z: options.flatTx.z });\n children.push(element(\"a:flatTx\", flatAttrs));\n }\n\n return element(tagName, attrs, children.length > 0 ? children : undefined);\n};\n\n// ── Parse ──\n\n/** Parse a bodyPr element into BodyPropertiesOptions. */\nexport const parseBodyProperties = (el: Element, ctx: ReadContext): BodyPropertiesOptions => {\n const result: BodyPropertiesOptions = {};\n\n const rotation = attrNum(el, \"rot\");\n if (rotation !== undefined) result.rotation = rotation;\n const spcFirstLastPara = attrBool(el, \"spcFirstLastPara\");\n if (spcFirstLastPara !== undefined) result.spcFirstLastPara = spcFirstLastPara;\n const vertOverflow = attr(el, \"vertOverflow\");\n if (vertOverflow !== undefined)\n result.vertOverflow = vertOverflow as BodyPropertiesOptions[\"vertOverflow\"];\n const horzOverflow = attr(el, \"horzOverflow\");\n if (horzOverflow !== undefined)\n result.horzOverflow = horzOverflow as BodyPropertiesOptions[\"horzOverflow\"];\n const vert = attr(el, \"vert\");\n if (vert !== undefined) result.vertical = vert as BodyPropertiesOptions[\"vertical\"];\n const wrap = attr(el, \"wrap\");\n if (wrap !== undefined) result.wrap = wrap as BodyPropertiesOptions[\"wrap\"];\n const lIns = attrMeasure(el, \"lIns\");\n if (lIns !== undefined) result.lIns = lIns as number | UniversalMeasure;\n const tIns = attrMeasure(el, \"tIns\");\n if (tIns !== undefined) result.tIns = tIns as number | UniversalMeasure;\n const rIns = attrMeasure(el, \"rIns\");\n if (rIns !== undefined) result.rIns = rIns as number | UniversalMeasure;\n const bIns = attrMeasure(el, \"bIns\");\n if (bIns !== undefined) result.bIns = bIns as number | UniversalMeasure;\n const numCol = attrNum(el, \"numCol\");\n if (numCol !== undefined) result.numCol = numCol;\n const spcCol = attrNum(el, \"spcCol\");\n if (spcCol !== undefined) result.spcCol = spcCol;\n const rtlCol = attrBool(el, \"rtlCol\");\n if (rtlCol !== undefined) result.rtlCol = rtlCol;\n const fromWordArt = attrBool(el, \"fromWordArt\");\n if (fromWordArt !== undefined) result.fromWordArt = fromWordArt;\n const anchor = attr(el, \"anchor\");\n if (anchor !== undefined) result.anchor = anchor as BodyPropertiesOptions[\"anchor\"];\n const anchorCtr = attrBool(el, \"anchorCtr\");\n if (anchorCtr !== undefined) result.anchorCtr = anchorCtr;\n const forceAA = attrBool(el, \"forceAA\");\n if (forceAA !== undefined) result.forceAA = forceAA;\n const upright = attrBool(el, \"upright\");\n if (upright !== undefined) result.upright = upright;\n const compatLnSpc = attrBool(el, \"compatLnSpc\");\n if (compatLnSpc !== undefined) result.compatLnSpc = compatLnSpc;\n\n // EG_TextAutofit (mutually exclusive)\n if (findChild(el, \"a:noAutofit\")) {\n result.noAutoFit = true;\n } else {\n const norm = findChild(el, \"a:normAutofit\");\n if (norm) {\n const normOpts: NormalAutofitOptions = {};\n const fontScale = attrNum(norm, \"fontScale\");\n if (fontScale !== undefined) normOpts.fontScale = fontScale;\n const lnSpcReduction = attrNum(norm, \"lnSpcReduction\");\n if (lnSpcReduction !== undefined) normOpts.lnSpcReduction = lnSpcReduction;\n result.normAutofit = normOpts;\n } else if (findChild(el, \"a:spAutoFit\")) {\n result.spAutoFit = true;\n }\n }\n\n // a:prstTxWarp (CT_PresetTextShape)\n const prstTxWarp = findChild(el, \"a:prstTxWarp\");\n if (prstTxWarp) {\n const preset = attr(prstTxWarp, \"prst\") ?? \"\";\n const avLst = findChild(prstTxWarp, \"a:avLst\");\n const adjustments: { name: string; formula: string }[] = [];\n for (const gd of avLst?.elements ?? []) {\n if (gd.type === \"element\" && gd.name === \"a:gd\") {\n adjustments.push({ name: attr(gd, \"name\") ?? \"\", formula: attr(gd, \"fmla\") ?? \"\" });\n }\n }\n result.prstTxWarp = { preset, ...(adjustments.length > 0 ? { adjustments } : {}) };\n }\n\n // a:scene3d\n const scene3d = findChild(el, \"a:scene3d\");\n if (scene3d) result.scene3d = scene3DDesc.parse(scene3d, ctx);\n\n // EG_Text3D (mutually exclusive: sp3d | flatTx)\n const sp3d = findChild(el, \"a:sp3d\");\n if (sp3d) {\n result.sp3d = shape3DDesc.parse(sp3d, ctx);\n } else {\n const flatTx = findChild(el, \"a:flatTx\");\n if (flatTx) {\n const z = attrNum(flatTx, \"z\");\n result.flatTx = z !== undefined ? { z } : {};\n }\n }\n\n return result as BodyPropertiesOptions;\n};\n\n// ── Descriptor (a:bodyPr instance) ──\n\nexport const bodyPropertiesDesc: CustomDescriptor<\n BodyPropertiesOptions,\n WriteContext,\n BodyPropertiesOptions\n> = {\n kind: \"custom\",\n stringify(opts) {\n return createBodyProperties(opts);\n },\n parse(el, ctx) {\n return parseBodyProperties(el, ctx);\n },\n};\n","/**\n * RunProperties descriptor (a:rPr / CT_TextCharacterProperties).\n *\n * Promoted from PPTX so all formats share one run-properties model. The\n * hyperlink side-effect uses the core WriteContext.addHyperlink hook — no\n * format-specific cast.\n *\n * @module\n */\n\nimport { escapeXml, findChild } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\n\nimport type { CustomDescriptor, ReadContext } from \"../../descriptor\";\nimport { parse, stringify } from \"../../descriptor\";\nimport { emitPercent } from \"../../util/converters\";\nimport { xsdStrikeStyle, xsdTextCaps, xsdUnderlineStyle } from \"../../util/mappings\";\nimport { parseOnOff } from \"../../util/values\";\nimport { parseColorChoice, stringifyColorChoice } from \"../color/color-descriptors\";\nimport type { SolidFillOptions } from \"../color/solid-fill\";\nimport { effectListDesc } from \"../effects/effect-descriptors\";\nimport type { EffectListOptions } from \"../effects/effect-list\";\nimport { fillDesc } from \"../fill/fill-descriptors\";\nimport type { FillOptions } from \"../fill/fill-options\";\nimport type { OutlineOptions } from \"../outline/outline\";\nimport { outlineDesc, stringifyLineProperties } from \"../outline/outline-descriptors\";\nimport {\n DEFAULT_OUTLINE_WIDTH,\n DEFAULT_SHADOW_ALPHA,\n DEFAULT_SHADOW_BLUR_RADIUS,\n DEFAULT_SHADOW_DIRECTION,\n DEFAULT_SHADOW_DISTANCE,\n} from \"./types\";\nimport type { TextHyperlinkOptions, RunPropertiesOptions, TextFont } from \"./types\";\n\n/** Strip `readonly` from all properties. */\nexport type Mutable<T> = { -readonly [K in keyof T]?: T[K] };\n\n// ── Hyperlink ID counter (module-scoped) ──\n\nlet nextHyperlinkId = 1;\n\nfunction buildHyperlinkElement(\n tag: string,\n hl: TextHyperlinkOptions,\n key: string | undefined,\n): string {\n const attrs: string[] = [];\n // CT_Hyperlink r:id is optional — emit it only for relational targets\n // (external url or internal slide). Action-only tokens (nextslide/endshow/\n // macro/program/...) carry no r:id.\n if ((hl.url !== undefined || hl.slide !== undefined) && key !== undefined) {\n attrs.push(`r:id=\"{hlink:${key}}\"`);\n }\n // Internal slide jump takes precedence over an explicit action token.\n if (hl.slide !== undefined) {\n attrs.push('action=\"ppaction://hlinksldjump\"');\n } else if (hl.action) {\n attrs.push(`action=\"${escapeXml(hl.action)}\"`);\n }\n if (hl.tooltip) attrs.push(`tooltip=\"${escapeXml(hl.tooltip)}\"`);\n if (hl.highlightClick) attrs.push('highlightClick=\"1\"');\n if (hl.endSound) attrs.push('endSnd=\"1\"');\n if (hl.invalidUrl) attrs.push('invalidUrl=\"1\"');\n return attrs.length ? `<${tag} ${attrs.join(\" \")}/>` : `<${tag}/>`;\n}\n\nfunction readHyperlink(el: XmlElement, ctx: ReadContext): TextHyperlinkOptions {\n const hl: Mutable<TextHyperlinkOptions> = {};\n const rId = el.attributes?.[\"r:id\"];\n const action =\n el.attributes?.[\"action\"] !== undefined ? String(el.attributes[\"action\"]) : undefined;\n if (rId) {\n const ridStr = String(rId);\n const target = ctx.resolveRelationship(ridStr);\n if (target) {\n // Internal slide jump: r:id resolves to slides/slideN.xml.\n const slideMatch = target.match(/slide(\\d+)\\.xml$/);\n if (slideMatch && action === \"ppaction://hlinksldjump\") {\n hl.slide = Number(slideMatch[1]);\n } else {\n hl.url = target;\n }\n }\n const m = ridStr.match(/^\\{hlink:(.+)\\}$/);\n if (m) hl.referenceId = m[1];\n }\n if (el.attributes?.[\"tooltip\"]) hl.tooltip = String(el.attributes[\"tooltip\"]);\n // Preserve explicit action only when it isn't the synthesized slide-jump token\n // (slide already captures that intent).\n if (action && action !== \"ppaction://hlinksldjump\") hl.action = action;\n if (el.attributes?.[\"highlightClick\"]) hl.highlightClick = true;\n if (el.attributes?.[\"endSnd\"]) hl.endSound = true;\n if (el.attributes?.[\"invalidUrl\"]) hl.invalidUrl = true;\n return hl as TextHyperlinkOptions;\n}\n\n// ── CT_TextFont helpers (a:latin / a:ea / a:cs / a:sym) ──\n\nfunction stringifyFontElement(tag: string, font: TextFont): string {\n if (typeof font === \"string\") return `<${tag} typeface=\"${escapeXml(font)}\"/>`;\n const attrs = [`typeface=\"${escapeXml(font.typeface)}\"`];\n if (font.panose) attrs.push(`panose=\"${font.panose}\"`);\n if (font.pitchFamily !== undefined) attrs.push(`pitchFamily=\"${font.pitchFamily}\"`);\n if (font.charset !== undefined) attrs.push(`charset=\"${font.charset}\"`);\n return `<${tag} ${attrs.join(\" \")}/>`;\n}\n\nfunction parseFontElement(el: XmlElement | undefined): TextFont | undefined {\n if (!el) return undefined;\n const tf = el.attributes?.[\"typeface\"];\n if (tf === undefined) return undefined;\n const typeface = String(tf);\n const panose = el.attributes?.[\"panose\"];\n const pitchFamily = el.attributes?.[\"pitchFamily\"];\n const charset = el.attributes?.[\"charset\"];\n if (panose === undefined && pitchFamily === undefined && charset === undefined) {\n return typeface;\n }\n const font: { typeface: string; panose?: string; pitchFamily?: number; charset?: number } = {\n typeface,\n };\n if (panose !== undefined) font.panose = String(panose);\n if (pitchFamily !== undefined) font.pitchFamily = Number(pitchFamily);\n if (charset !== undefined) font.charset = Number(charset);\n return font;\n}\n\nexport const runPropertiesDesc: CustomDescriptor<RunPropertiesOptions> = {\n kind: \"custom\",\n\n stringify(opts, ctx) {\n // Side-effect: register hyperlinks (click + hover). Only relational targets\n // (url/slide) need a relationship; action-only hyperlinks carry no r:id.\n let hyperlinkKey: string | undefined;\n if (opts.hyperlink) {\n const hl = opts.hyperlink;\n if (hl.url !== undefined || hl.slide !== undefined) {\n hyperlinkKey = hl.referenceId ?? `hlink_${nextHyperlinkId++}`;\n ctx.addHyperlink(hyperlinkKey, { url: hl.url, slide: hl.slide, tooltip: hl.tooltip });\n }\n }\n let mouseoverKey: string | undefined;\n if (opts.mouseoverHyperlink) {\n const mhl = opts.mouseoverHyperlink;\n if (mhl.url !== undefined || mhl.slide !== undefined) {\n mouseoverKey = mhl.referenceId ?? `hlink_${nextHyperlinkId++}`;\n ctx.addHyperlink(mouseoverKey, { url: mhl.url, slide: mhl.slide, tooltip: mhl.tooltip });\n }\n }\n\n const attrParts: string[] = [];\n if (opts.size) attrParts.push(`sz=\"${Math.round(opts.size * 100)}\"`);\n if (opts.bold !== undefined) attrParts.push(`b=\"${opts.bold ? 1 : 0}\"`);\n if (opts.italic !== undefined) attrParts.push(`i=\"${opts.italic ? 1 : 0}\"`);\n if (opts.underline) attrParts.push(`u=\"${xsdUnderlineStyle.to(opts.underline)}\"`);\n if (opts.lang) attrParts.push(`lang=\"${opts.lang}\"`);\n if (opts.strike) attrParts.push(`strike=\"${xsdStrikeStyle.to(opts.strike)}\"`);\n if (opts.baseline !== undefined) attrParts.push(`baseline=\"${emitPercent(opts.baseline)}\"`);\n if (opts.capitalization) attrParts.push(`cap=\"${xsdTextCaps.to(opts.capitalization)}\"`);\n if (opts.spacing !== undefined) attrParts.push(`spc=\"${Math.round(opts.spacing * 100)}\"`);\n if (opts.kern !== undefined) attrParts.push(`kern=\"${Math.round(opts.kern * 100)}\"`);\n if (opts.noProof !== undefined) attrParts.push(`noProof=\"${opts.noProof ? 1 : 0}\"`);\n if (opts.dirty !== undefined) attrParts.push(`dirty=\"${opts.dirty ? 1 : 0}\"`);\n if (opts.kumimoji !== undefined) attrParts.push(`kumimoji=\"${opts.kumimoji ? 1 : 0}\"`);\n if (opts.alternateLanguage) attrParts.push(`altLang=\"${opts.alternateLanguage}\"`);\n if (opts.normalizeHeight !== undefined)\n attrParts.push(`normalizeH=\"${opts.normalizeHeight ? 1 : 0}\"`);\n if (opts.bookmarkMark) attrParts.push(`bmk=\"${opts.bookmarkMark}\"`);\n if (opts.smartTagId) attrParts.push(`smtId=\"${opts.smartTagId}\"`);\n if (opts.err !== undefined) attrParts.push(`err=\"${opts.err ? 1 : 0}\"`);\n if (opts.smtClean !== undefined) attrParts.push(`smtClean=\"${opts.smtClean ? 1 : 0}\"`);\n\n const attrStr = attrParts.length ? \" \" + attrParts.join(\" \") : \"\";\n\n const parts: string[] = [];\n\n // XSD order: ln -> fill -> effect -> latin/ea/cs/sym -> hlinkClick -> rtl\n if (opts.outline !== undefined) {\n const outlineOpts: OutlineOptions =\n opts.outline === true\n ? { width: DEFAULT_OUTLINE_WIDTH, type: \"solidFill\", color: { value: \"000000\" } }\n : opts.outline;\n const outlineXml = stringify(outlineDesc, outlineOpts, ctx);\n if (outlineXml) parts.push(outlineXml);\n }\n\n if (opts.fill !== undefined) {\n const fillXml = stringify(fillDesc, opts.fill, ctx);\n if (fillXml) parts.push(fillXml);\n }\n\n if (opts.shadow !== undefined) {\n const effectOpts: EffectListOptions =\n opts.shadow === true\n ? {\n outerShadow: {\n blurRadius: DEFAULT_SHADOW_BLUR_RADIUS,\n distance: DEFAULT_SHADOW_DISTANCE,\n direction: DEFAULT_SHADOW_DIRECTION,\n color: { value: \"000000\", transforms: { alpha: DEFAULT_SHADOW_ALPHA } },\n },\n }\n : opts.shadow;\n const effectXml = stringify(effectListDesc, effectOpts, ctx);\n if (effectXml) parts.push(effectXml);\n }\n\n // XSD order: highlight (CT_Color) comes after effects, before fonts.\n if (opts.highlight !== undefined) {\n const hlXml = stringifyColorChoice(opts.highlight, ctx);\n if (hlXml) parts.push(`<a:highlight>${hlXml}</a:highlight>`);\n }\n\n // EG_TextUnderlineLine / EG_TextUnderlineFill — after highlight, before fonts.\n if (opts.underlineLine !== undefined) {\n if (opts.underlineLine === true) {\n parts.push(\"<a:uLnTx/>\");\n } else {\n // a:uLn is itself a CT_LineProperties — same content, different root tag.\n const uLnXml = stringifyLineProperties(\"a:uLn\", opts.underlineLine, ctx);\n if (uLnXml) parts.push(uLnXml);\n }\n }\n if (opts.underlineFill !== undefined) {\n if (opts.underlineFill === true) {\n parts.push(\"<a:uFillTx/>\");\n } else {\n const uFillXml = stringify(fillDesc, opts.underlineFill, ctx);\n if (uFillXml) parts.push(`<a:uFill>${uFillXml}</a:uFill>`);\n }\n }\n\n if (opts.font !== undefined) {\n const scripts: {\n latin?: TextFont;\n eastAsia?: TextFont;\n complexScript?: TextFont;\n symbol?: TextFont;\n } = typeof opts.font === \"string\" ? { latin: opts.font, eastAsia: opts.font } : opts.font;\n if (scripts.latin) parts.push(stringifyFontElement(\"a:latin\", scripts.latin));\n if (scripts.eastAsia) parts.push(stringifyFontElement(\"a:ea\", scripts.eastAsia));\n if (scripts.complexScript) parts.push(stringifyFontElement(\"a:cs\", scripts.complexScript));\n if (scripts.symbol) parts.push(stringifyFontElement(\"a:sym\", scripts.symbol));\n }\n\n if (opts.hyperlink) {\n parts.push(buildHyperlinkElement(\"a:hlinkClick\", opts.hyperlink, hyperlinkKey));\n }\n if (opts.mouseoverHyperlink) {\n parts.push(buildHyperlinkElement(\"a:hlinkMouseOver\", opts.mouseoverHyperlink, mouseoverKey));\n }\n\n if (opts.rightToLeft !== undefined) {\n parts.push(`<a:rtl val=\"${opts.rightToLeft ? 1 : 0}\"/>`);\n }\n\n if (attrParts.length === 0 && parts.length === 0) return \"\";\n\n if (parts.length === 0) return `<a:rPr${attrStr}/>`;\n return `<a:rPr${attrStr}>${parts.join(\"\")}</a:rPr>`;\n },\n\n parse(el, _ctx) {\n const result: Mutable<RunPropertiesOptions> = {};\n\n // nativeTypeAttributes (opc parser) coerces boolean attribute values between\n // string/number/boolean forms; parseOnOff accepts all of them.\n const isOn = (raw: string | number | boolean | undefined): boolean => parseOnOff(raw) ?? false;\n\n if (el.attributes) {\n if (el.attributes[\"sz\"] !== undefined) result.size = Number(el.attributes[\"sz\"]) / 100;\n if (el.attributes[\"b\"] !== undefined) result.bold = isOn(el.attributes[\"b\"]);\n if (el.attributes[\"i\"] !== undefined) result.italic = isOn(el.attributes[\"i\"]);\n if (el.attributes[\"u\"] !== undefined)\n result.underline = xsdUnderlineStyle.from(\n String(el.attributes[\"u\"]),\n ) as RunPropertiesOptions[\"underline\"];\n if (el.attributes[\"lang\"] !== undefined) result.lang = String(el.attributes[\"lang\"]);\n if (el.attributes[\"strike\"] !== undefined)\n result.strike = xsdStrikeStyle.from(\n String(el.attributes[\"strike\"]),\n ) as RunPropertiesOptions[\"strike\"];\n if (el.attributes[\"baseline\"] !== undefined) {\n const raw = el.attributes[\"baseline\"];\n const s = typeof raw === \"number\" ? String(raw) : raw;\n result.baseline = s.endsWith(\"%\") ? Number(s.slice(0, -1)) : Number(s) / 1000;\n }\n if (el.attributes[\"cap\"] !== undefined)\n result.capitalization = xsdTextCaps.from(\n String(el.attributes[\"cap\"]),\n ) as RunPropertiesOptions[\"capitalization\"];\n if (el.attributes[\"spc\"] !== undefined) result.spacing = Number(el.attributes[\"spc\"]) / 100;\n if (el.attributes[\"noProof\"] !== undefined) result.noProof = isOn(el.attributes[\"noProof\"]);\n if (el.attributes[\"dirty\"] !== undefined) result.dirty = isOn(el.attributes[\"dirty\"]);\n if (el.attributes[\"kumimoji\"] !== undefined)\n result.kumimoji = isOn(el.attributes[\"kumimoji\"]);\n if (el.attributes[\"altLang\"] !== undefined)\n result.alternateLanguage = String(el.attributes[\"altLang\"]);\n if (el.attributes[\"normalizeH\"] !== undefined)\n result.normalizeHeight = isOn(el.attributes[\"normalizeH\"]);\n if (el.attributes[\"bmk\"] !== undefined) result.bookmarkMark = String(el.attributes[\"bmk\"]);\n if (el.attributes[\"smtId\"] !== undefined) result.smartTagId = String(el.attributes[\"smtId\"]);\n if (el.attributes[\"kern\"] !== undefined) result.kern = Number(el.attributes[\"kern\"]) / 100;\n if (el.attributes[\"err\"] !== undefined) result.err = isOn(el.attributes[\"err\"]);\n if (el.attributes[\"smtClean\"] !== undefined)\n result.smtClean = isOn(el.attributes[\"smtClean\"]);\n }\n\n // Outline — full CT_LineProperties round-trip\n const ln = findChild(el, \"a:ln\");\n if (ln) result.outline = parse(outlineDesc, ln, _ctx) as OutlineOptions;\n\n // Fill\n if (\n findChild(el, \"a:solidFill\") ||\n findChild(el, \"a:noFill\") ||\n findChild(el, \"a:gradFill\") ||\n findChild(el, \"a:pattFill\")\n ) {\n const fillResult = parse(fillDesc, el, _ctx);\n result.fill = fillResult as FillOptions;\n }\n\n // Shadow — full EG_EffectProperties round-trip\n const effectLst = findChild(el, \"a:effectLst\");\n if (effectLst) result.shadow = parse(effectListDesc, effectLst, _ctx) as EffectListOptions;\n\n // Highlight (CT_Color)\n const highlight = findChild(el, \"a:highlight\");\n if (highlight) result.highlight = parseColorChoice(highlight, _ctx) as SolidFillOptions;\n\n // Underline line/fill (EG_TextUnderlineLine / EG_TextUnderlineFill)\n const uLnTx = findChild(el, \"a:uLnTx\");\n if (uLnTx) result.underlineLine = true;\n else {\n const uLn = findChild(el, \"a:uLn\");\n if (uLn) result.underlineLine = parse(outlineDesc, uLn, _ctx) as OutlineOptions;\n }\n const uFillTx = findChild(el, \"a:uFillTx\");\n if (uFillTx) result.underlineFill = true;\n else {\n const uFill = findChild(el, \"a:uFill\");\n if (uFill) result.underlineFill = parse(fillDesc, uFill, _ctx) as FillOptions;\n }\n\n // Font — latin/ea/cs/sym (CT_TextFont). Collapse to a string when only latin\n // and ea share the same typeface (the common case); otherwise the full object.\n const latinFont = parseFontElement(findChild(el, \"a:latin\"));\n const eaFont = parseFontElement(findChild(el, \"a:ea\"));\n const csFont = parseFontElement(findChild(el, \"a:cs\"));\n const symFont = parseFontElement(findChild(el, \"a:sym\"));\n if (\n latinFont &&\n eaFont &&\n !csFont &&\n !symFont &&\n typeof latinFont === \"string\" &&\n typeof eaFont === \"string\" &&\n latinFont === eaFont\n ) {\n result.font = latinFont;\n } else if (latinFont || eaFont || csFont || symFont) {\n const font: {\n latin?: TextFont;\n eastAsia?: TextFont;\n complexScript?: TextFont;\n symbol?: TextFont;\n } = {};\n if (latinFont) font.latin = latinFont;\n if (eaFont) font.eastAsia = eaFont;\n if (csFont) font.complexScript = csFont;\n if (symFont) font.symbol = symFont;\n result.font = font;\n }\n\n // Hyperlinks (click + hover)\n const hlinkClick = findChild(el, \"a:hlinkClick\");\n if (hlinkClick) result.hyperlink = readHyperlink(hlinkClick, _ctx);\n const hlinkMouseOver = findChild(el, \"a:hlinkMouseOver\");\n if (hlinkMouseOver) result.mouseoverHyperlink = readHyperlink(hlinkMouseOver, _ctx);\n\n // RTL\n const rtl = findChild(el, \"a:rtl\");\n if (rtl) result.rightToLeft = isOn(rtl.attributes?.[\"val\"]);\n\n return result as RunPropertiesOptions;\n },\n};\n","/**\n * TextRun descriptor (a:r / CT_RegularTextRun).\n *\n * @module\n */\n\nimport { findChild, escapeXml } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../../descriptor\";\nimport { runPropertiesDesc } from \"./run-properties\";\nimport type { Mutable } from \"./run-properties\";\nimport type { RunOptions } from \"./types\";\n\n/**\n * Stringify a text-only run — `<a:r><a:t>…</a:t></a:r>` with no `a:rPr`.\n * Shared with the paragraph descriptor, whose string-children shorthand\n * expands to exactly this and would otherwise pay a full run-properties\n * scan plus a throwaway `{ text }` object per child.\n */\nexport function stringifyTextRun(text: string): string {\n return `<a:r><a:t>${escapeXml(text)}</a:t></a:r>`;\n}\n\nexport const textRunDesc: CustomDescriptor<RunOptions> = {\n kind: \"custom\",\n\n stringify(opts, ctx) {\n const body = runPropertiesDesc.stringify(opts, ctx) ?? \"\";\n if (opts.text) {\n return body\n ? `<a:r>${body}<a:t>${escapeXml(opts.text)}</a:t></a:r>`\n : stringifyTextRun(opts.text);\n }\n return body ? `<a:r>${body}</a:r>` : \"<a:r/>\";\n },\n\n parse(el, _ctx) {\n const result: Mutable<RunOptions> = {};\n\n const rPr = findChild(el, \"a:rPr\");\n if (rPr) {\n Object.assign(result, runPropertiesDesc.parse(rPr, _ctx));\n }\n\n const t = findChild(el, \"a:t\");\n if (t) {\n result.text = (t.elements ?? [])\n .filter((e) => e.type === \"text\")\n .map((e) => e.text ?? \"\")\n .join(\"\");\n }\n\n return result as RunOptions;\n },\n};\n","/**\n * Paragraph descriptor (a:p / CT_TextParagraph) plus paragraph-properties,\n * text-field, and line-break helpers.\n *\n * Promoted verbatim from PPTX — the fresh-paragraph default lang marker,\n * a:lstStyle-always-emit, and single-run text shorthand behaviors are\n * load-bearing for round-trip fidelity and must carry over unchanged.\n *\n * @module\n */\n\nimport { findChild, escapeXml } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\n\nimport type { CustomDescriptor, ReadContext, WriteContext } from \"../../descriptor\";\nimport { emitPercent, parsePercent } from \"../../util/converters\";\nimport { xsdTextAlign } from \"../../util/mappings\";\nimport { parseOnOff, stripColorHashPrefix } from \"../../util/values\";\nimport { stringifyTextRun, textRunDesc } from \"./run\";\nimport { runPropertiesDesc } from \"./run-properties\";\nimport type { Mutable } from \"./run-properties\";\nimport type {\n BulletAutoNumOptions,\n BulletCharOptions,\n BulletOptions,\n BulletPictureOptions,\n BulletStyleOptions,\n ParagraphPropertiesOptions,\n RunOptions,\n RunPropertiesOptions,\n TabStopOptions,\n TextAlignment,\n TextTabAlignment,\n TextFieldOptions,\n BreakOptions,\n} from \"./types\";\n\n/** Descriptor-layer paragraph accumulator (a:p). */\nexport interface ParagraphDescriptorOptions {\n text?: string;\n properties?: ParagraphPropertiesOptions;\n children?: (RunOptions | TextFieldOptions | BreakOptions | string)[];\n /**\n * End-paragraph run properties (a:endParaRPr). Fresh paragraphs emit a\n * default lang marker; a parsed source preserves its value; false omits it.\n */\n endParagraphProperties?: RunPropertiesOptions | false;\n}\n\n// ── Paragraph properties helper (a:pPr) ──\n\nfunction stringifyParagraphProperties(\n options: ParagraphPropertiesOptions,\n ctx: WriteContext,\n): string {\n const children: string[] = [];\n\n const attrs: string[] = [];\n if (options.alignment) attrs.push(`algn=\"${xsdTextAlign.to(options.alignment)}\"`);\n if (options.indentLevel !== undefined) attrs.push(`lvl=\"${options.indentLevel}\"`);\n if (options.marginIndent !== undefined) attrs.push(`marL=\"${options.marginIndent}\"`);\n if (options.marginRight !== undefined) attrs.push(`marR=\"${options.marginRight}\"`);\n if (options.indent !== undefined) attrs.push(`indent=\"${options.indent}\"`);\n if (options.defTabSize !== undefined) attrs.push(`defTabSz=\"${options.defTabSize}\"`);\n if (options.fontAlignment) attrs.push(`fontAlgn=\"${options.fontAlignment}\"`);\n if (options.rightToLeft !== undefined) attrs.push(`rtl=\"${options.rightToLeft ? 1 : 0}\"`);\n if (options.eastAsianLineBreak !== undefined)\n attrs.push(`eaLnBrk=\"${options.eastAsianLineBreak ? 1 : 0}\"`);\n if (options.latinLineBreak !== undefined)\n attrs.push(`latinLnBrk=\"${options.latinLineBreak ? 1 : 0}\"`);\n\n // Line spacing\n if (options.lineSpacingPercent !== undefined) {\n children.push(\n `<a:lnSpc><a:spcPct val=\"${emitPercent(options.lineSpacingPercent)}\"/></a:lnSpc>`,\n );\n }\n if (options.lineSpacingPoints !== undefined) {\n children.push(\n `<a:lnSpc><a:spcPts val=\"${Math.round(options.lineSpacingPoints * 100)}\"/></a:lnSpc>`,\n );\n }\n\n // Spacing before/after (XSD CT_TextParagraphProperties order: spcBef, spcAft)\n if (options.spaceBefore !== undefined) {\n children.push(\n `<a:spcBef><a:spcPts val=\"${Math.round(options.spaceBefore * 100)}\"/></a:spcBef>`,\n );\n }\n if (options.spaceAfter !== undefined) {\n children.push(`<a:spcAft><a:spcPts val=\"${Math.round(options.spaceAfter * 100)}\"/></a:spcAft>`);\n }\n\n // Bullets\n if (options.bullet) {\n children.push(...stringifyBullet(options.bullet));\n }\n\n // Tab stops (after bullets, before defRPr)\n if (options.tabStops && options.tabStops.length > 0) {\n children.push(stringifyTabStops(options.tabStops));\n }\n\n // Default run properties — last child of a:pPr (CT_TextParagraphProperties).\n if (options.defaultRunProperties) {\n const rPr = runPropertiesDesc.stringify(options.defaultRunProperties, ctx) ?? \"\";\n children.push(rPr.replaceAll(\"<a:rPr\", \"<a:defRPr\").replaceAll(\"</a:rPr>\", \"</a:defRPr>\"));\n }\n\n if (attrs.length === 0 && children.length === 0) return \"\";\n\n const attrStr = attrs.length ? \" \" + attrs.join(\" \") : \"\";\n if (children.length === 0) return `<a:pPr${attrStr}/>`;\n return `<a:pPr${attrStr}>${children.join(\"\")}</a:pPr>`;\n}\n\nfunction stringifyBullet(options: BulletOptions): string[] {\n const parts: string[] = [];\n\n if (options.type === \"none\") {\n parts.push(\"<a:buNone/>\");\n return parts;\n }\n\n // Color: buClrTx | buClr\n if (options.colorFollowsText) {\n parts.push(\"<a:buClrTx/>\");\n } else if (options.color) {\n parts.push(`<a:buClr><a:srgbClr val=\"${stripColorHashPrefix(options.color)}\"/></a:buClr>`);\n }\n\n // Size: buSzTx | buSzPts | buSzPct\n if (options.sizeFollowsText) {\n parts.push(\"<a:buSzTx/>\");\n } else if (options.sizePoints !== undefined) {\n parts.push(`<a:buSzPts val=\"${Math.round(options.sizePoints * 100)}\"/>`);\n } else if (options.size !== undefined) {\n parts.push(`<a:buSzPct val=\"${options.size}%\"/>`);\n }\n\n // Font: buFontTx | buFont. Fresh char/autoNum bullets default to Arial.\n if (options.fontFollowsText) {\n parts.push(\"<a:buFontTx/>\");\n } else if (options.font !== undefined) {\n parts.push(\n `<a:buFont typeface=\"${options.font}\" panose=\"020B0604020202020204\" pitchFamily=\"34\" charset=\"0\"/>`,\n );\n } else if (options.type === \"char\" || options.type === \"autoNum\") {\n parts.push(\n `<a:buFont typeface=\"Arial\" panose=\"020B0604020202020204\" pitchFamily=\"34\" charset=\"0\"/>`,\n );\n }\n\n // Bullet type: buChar | buAutoNum | buBlip\n if (options.type === \"char\") {\n parts.push(`<a:buChar char=\"${escapeXml(options.char ?? \"•\")}\"/>`);\n } else if (options.type === \"autoNum\") {\n const buAttrs: string[] = [`type=\"${options.format ?? \"arabicPeriod\"}\"`];\n if (options.startAt !== undefined) buAttrs.push(`startAt=\"${options.startAt}\"`);\n parts.push(`<a:buAutoNum ${buAttrs.join(\" \")}/>`);\n } else if (options.type === \"picture\") {\n parts.push(`<a:buBlip><a:blip r:embed=\"${options.embed}\"/></a:buBlip>`);\n }\n\n return parts;\n}\n\nfunction stringifyTabStops(stops: TabStopOptions[]): string {\n const tabs = stops.map((t) => {\n const attrs: string[] = [];\n if (t.position !== undefined) attrs.push(`pos=\"${t.position}\"`);\n if (t.alignment) attrs.push(`algn=\"${t.alignment}\"`);\n return `<a:tab${attrs.length ? \" \" + attrs.join(\" \") : \"\"}/>`;\n });\n return `<a:tabLst>${tabs.join(\"\")}</a:tabLst>`;\n}\n\nfunction readParagraphProperties(\n el: XmlElement,\n ctx: ReadContext,\n): Mutable<ParagraphPropertiesOptions> {\n const result: Mutable<ParagraphPropertiesOptions> = {};\n\n if (el.attributes) {\n if (el.attributes[\"algn\"] !== undefined)\n result.alignment = xsdTextAlign.from(String(el.attributes[\"algn\"])) as TextAlignment;\n if (el.attributes[\"lvl\"] !== undefined) result.indentLevel = Number(el.attributes[\"lvl\"]);\n if (el.attributes[\"marL\"] !== undefined) result.marginIndent = Number(el.attributes[\"marL\"]);\n if (el.attributes[\"marR\"] !== undefined) result.marginRight = Number(el.attributes[\"marR\"]);\n if (el.attributes[\"indent\"] !== undefined) result.indent = Number(el.attributes[\"indent\"]);\n if (el.attributes[\"defTabSz\"] !== undefined)\n result.defTabSize = Number(el.attributes[\"defTabSz\"]);\n if (el.attributes[\"fontAlgn\"] !== undefined)\n result.fontAlignment = String(\n el.attributes[\"fontAlgn\"],\n ) as ParagraphPropertiesOptions[\"fontAlignment\"];\n if (el.attributes[\"rtl\"] !== undefined)\n result.rightToLeft = parseOnOff(el.attributes[\"rtl\"]) ?? false;\n if (el.attributes[\"eaLnBrk\"] !== undefined)\n result.eastAsianLineBreak = parseOnOff(el.attributes[\"eaLnBrk\"]) ?? false;\n if (el.attributes[\"latinLnBrk\"] !== undefined)\n result.latinLineBreak = parseOnOff(el.attributes[\"latinLnBrk\"]) ?? false;\n }\n\n // Line spacing\n const lnSpc = findChild(el, \"a:lnSpc\");\n if (lnSpc) {\n const spcPct = findChild(lnSpc, \"a:spcPct\");\n if (spcPct?.attributes?.[\"val\"] !== undefined) {\n result.lineSpacingPercent = parsePercent(Number(spcPct.attributes[\"val\"]));\n }\n const spcPts = findChild(lnSpc, \"a:spcPts\");\n if (spcPts?.attributes?.[\"val\"] !== undefined) {\n result.lineSpacingPoints = Number(spcPts.attributes[\"val\"]) / 100;\n }\n }\n\n // Spacing after/before\n const spcAft = findChild(el, \"a:spcAft\");\n if (spcAft) {\n const pts = findChild(spcAft, \"a:spcPts\");\n if (pts?.attributes?.[\"val\"] !== undefined)\n result.spaceAfter = Number(pts.attributes[\"val\"]) / 100;\n }\n\n const spcBef = findChild(el, \"a:spcBef\");\n if (spcBef) {\n const pts = findChild(spcBef, \"a:spcPts\");\n if (pts?.attributes?.[\"val\"] !== undefined)\n result.spaceBefore = Number(pts.attributes[\"val\"]) / 100;\n }\n\n // Bullets\n if (findChild(el, \"a:buNone\")) {\n result.bullet = { type: \"none\" };\n } else {\n const buChar = findChild(el, \"a:buChar\");\n const buAutoNum = findChild(el, \"a:buAutoNum\");\n const buBlip = findChild(el, \"a:buBlip\");\n if (buChar || buAutoNum || buBlip) {\n // Shared color/size/font style — each dimension is a choice.\n const style: Mutable<BulletStyleOptions> = {};\n if (findChild(el, \"a:buClrTx\")) {\n style.colorFollowsText = true;\n } else {\n const buClr = findChild(el, \"a:buClr\");\n if (buClr) {\n const srgb = findChild(buClr, \"a:srgbClr\");\n if (srgb?.attributes?.[\"val\"]) style.color = String(srgb.attributes[\"val\"]);\n }\n }\n if (findChild(el, \"a:buSzTx\")) {\n style.sizeFollowsText = true;\n } else {\n const buSzPts = findChild(el, \"a:buSzPts\");\n if (buSzPts?.attributes?.[\"val\"]) {\n style.sizePoints = Number(buSzPts.attributes[\"val\"]) / 100;\n } else {\n const buSzPct = findChild(el, \"a:buSzPct\");\n if (buSzPct?.attributes?.[\"val\"])\n style.size = Number(String(buSzPct.attributes[\"val\"]).replace(\"%\", \"\"));\n }\n }\n if (findChild(el, \"a:buFontTx\")) {\n style.fontFollowsText = true;\n } else {\n const buFont = findChild(el, \"a:buFont\");\n if (buFont?.attributes?.[\"typeface\"]) style.font = String(buFont.attributes[\"typeface\"]);\n }\n\n if (buBlip) {\n const blip = findChild(buBlip, \"a:blip\");\n result.bullet = {\n type: \"picture\",\n embed: String(blip?.attributes?.[\"r:embed\"] ?? \"\"),\n ...style,\n } as BulletPictureOptions;\n } else if (buChar) {\n const bullet: Mutable<BulletCharOptions> = { type: \"char\", ...style };\n if (buChar.attributes?.[\"char\"]) bullet.char = String(buChar.attributes[\"char\"]);\n result.bullet = bullet as BulletCharOptions;\n } else {\n const bullet: Mutable<BulletAutoNumOptions> = { type: \"autoNum\", ...style };\n if (buAutoNum!.attributes?.[\"type\"]) bullet.format = String(buAutoNum!.attributes[\"type\"]);\n if (buAutoNum!.attributes?.[\"startAt\"] !== undefined)\n bullet.startAt = Number(buAutoNum!.attributes[\"startAt\"]);\n result.bullet = bullet as BulletAutoNumOptions;\n }\n }\n }\n\n // Tab stops (after bullets, before defRPr)\n const tabLst = findChild(el, \"a:tabLst\");\n if (tabLst) {\n const tabs: TabStopOptions[] = [];\n for (const child of tabLst.elements ?? []) {\n if (child.name === \"a:tab\") {\n const tab: Mutable<TabStopOptions> = {};\n if (child.attributes?.[\"pos\"] !== undefined) tab.position = Number(child.attributes[\"pos\"]);\n if (child.attributes?.[\"algn\"] !== undefined)\n tab.alignment = child.attributes[\"algn\"] as TextTabAlignment;\n tabs.push(tab);\n }\n }\n if (tabs.length > 0) result.tabStops = tabs;\n }\n\n // Default run properties — last child of a:pPr (CT_TextParagraphProperties).\n const defRPr = findChild(el, \"a:defRPr\");\n if (defRPr) {\n result.defaultRunProperties = runPropertiesDesc.parse(defRPr, ctx) as RunPropertiesOptions;\n }\n\n return result as ParagraphPropertiesOptions;\n}\n\n// ── Paragraph (a:p) ──\n\nexport const paragraphDesc: CustomDescriptor<ParagraphDescriptorOptions> = {\n kind: \"custom\",\n\n stringify(opts, ctx) {\n const parts: string[] = [];\n\n // Paragraph properties\n if (opts.properties) {\n const pPrXml = stringifyParagraphProperties(opts.properties, ctx);\n if (pPrXml) parts.push(pPrXml);\n }\n\n // Simple text shorthand\n if (opts.text) {\n parts.push(stringifyTextRun(opts.text));\n }\n\n // Children (text runs + fields + line breaks; a bare string is shorthand\n // for a single text-only run).\n if (opts.children) {\n for (const child of opts.children) {\n if (typeof child === \"string\") {\n parts.push(stringifyTextRun(child));\n } else if (isTextField(child)) {\n parts.push(stringifyTextField(child, ctx));\n } else if (isBreak(child)) {\n parts.push(stringifyBreak(child, ctx));\n } else {\n parts.push(textRunDesc.stringify(child, ctx) ?? \"\");\n }\n }\n }\n\n // End-paragraph run properties — fresh emits a default lang marker; a\n // parsed source preserves its value; false omits the element.\n if (opts.endParagraphProperties === false) {\n // omit\n } else {\n const epr = opts.endParagraphProperties ?? { lang: \"en-US\" };\n parts.push(stringifyEndParaRPr(epr, ctx));\n }\n\n const body = parts.join(\"\");\n return body ? `<a:p>${body}</a:p>` : \"<a:p/>\";\n },\n\n parse(el, ctx) {\n const result: ParagraphDescriptorOptions = {};\n\n // Paragraph properties\n const pPr = findChild(el, \"a:pPr\");\n if (pPr) {\n result.properties = readParagraphProperties(pPr, ctx) as ParagraphPropertiesOptions;\n }\n\n // Collect runs, fields, and breaks in document order.\n const children: (RunOptions | TextFieldOptions | BreakOptions)[] = [];\n for (const child of el.elements ?? []) {\n if (child.name === \"a:r\") {\n children.push(textRunDesc.parse(child, ctx) as RunOptions);\n } else if (child.name === \"a:fld\") {\n children.push(readTextField(child, ctx));\n } else if (child.name === \"a:br\") {\n children.push(readBreak(child, ctx));\n }\n }\n\n const [onlyRun] = children;\n if (\n onlyRun !== undefined &&\n !isTextField(onlyRun) &&\n !isBreak(onlyRun) &&\n children.length === 1 &&\n !result.properties &&\n onlyRun.text !== undefined &&\n Object.keys(onlyRun).length === 1\n ) {\n // Single run with no paragraph properties and only text -> use text shorthand\n result.text = onlyRun.text;\n } else if (children.length > 0) {\n result.children = children;\n }\n\n // End-paragraph run properties — preserve source value, or mark false so\n // stringify omits it (fresh paragraphs re-emit the default lang marker).\n const endParaRPr = findChild(el, \"a:endParaRPr\");\n if (endParaRPr) {\n result.endParagraphProperties = runPropertiesDesc.parse(\n endParaRPr,\n ctx,\n ) as RunPropertiesOptions;\n } else {\n result.endParagraphProperties = false;\n }\n\n return result as ParagraphDescriptorOptions;\n },\n};\n\n// ── Text field (a:fld) + break (a:br) helpers ──\n\nfunction isTextField(\n child: RunOptions | TextFieldOptions | BreakOptions,\n): child is TextFieldOptions {\n return typeof (child as TextFieldOptions).type === \"string\";\n}\n\nfunction isBreak(child: RunOptions | TextFieldOptions | BreakOptions): child is BreakOptions {\n return (child as BreakOptions).break === true;\n}\n\nfunction stringifyBreak(opts: BreakOptions, ctx: WriteContext): string {\n const rPr = opts.properties ? (runPropertiesDesc.stringify(opts.properties, ctx) ?? \"\") : \"\";\n return rPr ? `<a:br>${rPr}</a:br>` : \"<a:br/>\";\n}\n\nfunction readBreak(el: XmlElement, ctx: ReadContext): BreakOptions {\n const result = { break: true } as Mutable<BreakOptions>;\n const rPr = findChild(el, \"a:rPr\");\n if (rPr) result.properties = runPropertiesDesc.parse(rPr, ctx) as RunPropertiesOptions;\n return result as BreakOptions;\n}\n\n// a:endParaRPr has the same CT_TextCharacterProperties shape as a:rPr; reuse\n// runPropertiesDesc and relabel the emitted tag.\nfunction stringifyEndParaRPr(opts: RunPropertiesOptions, ctx: WriteContext): string {\n const rPr = runPropertiesDesc.stringify(opts, ctx) ?? \"\";\n if (!rPr) return \"<a:endParaRPr/>\";\n return rPr.replaceAll(\"<a:rPr\", \"<a:endParaRPr\").replaceAll(\"</a:rPr>\", \"</a:endParaRPr>\");\n}\n\nfunction stringifyTextField(opts: TextFieldOptions, ctx: WriteContext): string {\n // id is a required GUID on CT_TextField; fall back to a nil UUID so a\n // user-authored field still produces valid OOXML.\n const id = opts.id ?? \"{00000000-0000-0000-0000-000000000000}\";\n const rPr = opts.properties ? (runPropertiesDesc.stringify(opts.properties, ctx) ?? \"\") : \"\";\n const t = opts.text !== undefined ? `<a:t>${escapeXml(opts.text)}</a:t>` : \"\";\n return `<a:fld id=\"${id}\" type=\"${opts.type}\">${rPr}${t}</a:fld>`;\n}\n\nfunction readTextField(el: XmlElement, ctx: ReadContext): TextFieldOptions {\n const result: TextFieldOptions = { type: String(el.attributes?.[\"type\"] ?? \"\") };\n const id = el.attributes?.[\"id\"];\n if (id !== undefined) result.id = String(id);\n const rPr = findChild(el, \"a:rPr\");\n if (rPr) result.properties = runPropertiesDesc.parse(rPr, ctx) as RunPropertiesOptions;\n const t = findChild(el, \"a:t\");\n if (t) {\n result.text = (t.elements ?? [])\n .filter((e) => e.type === \"text\")\n .map((e) => e.text ?? \"\")\n .join(\"\");\n }\n return result;\n}\n","/**\n * Text list style (CT_TextListStyle) descriptor.\n *\n * CT_TextListStyle is the deeply-nested structure behind p:defaultTextStyle\n * (presentation) and p:txStyles titleStyle/bodyStyle/otherStyle (slide master):\n * up to 9 outline levels (lvl1pPr..lvl9pPr), each a CT_TextParagraphProperties\n * carrying alignment, indent, spacing, bullet, and a default-run (defRPr) block.\n *\n * Stringify models MS Office's byte layout exactly so the structured default\n * reproduces the prior verbatim block bit-for-bit. Parse is the inverse.\n *\n * @module\n */\n\nimport type { Element } from \"@office-open/xml\";\nimport { escapeXml, findChild } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../../descriptor\";\nimport { emitPercent, parsePercent } from \"../../util/converters\";\nimport { parseOnOff } from \"../../util/values\";\n\n// ── Types ──\n\nexport interface TextListStyleRunOptions {\n /** Font size in points (e.g., 44 = 44pt). */\n size?: number;\n /** Character kerning in points (e.g., 12 = 12pt). */\n kern?: number;\n /** Solid fill as a theme color token (e.g. \"tx1\"). */\n schemeColor?: string;\n /** Latin script typeface (e.g. \"+mj-lt\"). */\n latin?: string;\n /** East-Asian script typeface (e.g. \"+mj-ea\"). */\n eastAsia?: string;\n /** Complex-script typeface (e.g. \"+mj-cs\"). */\n complexScript?: string;\n}\n\nexport interface TextListStyleBulletOptions {\n type: \"none\" | \"char\";\n /** Bullet glyph (type=\"char\"); defaults to \"•\". */\n char?: string;\n /** Bullet font typeface (type=\"char\"); defaults to \"Arial\". */\n font?: string;\n}\n\nexport interface TextListStyleLevelOptions {\n alignment?: string;\n marginIndent?: number;\n indent?: number;\n defaultTabSize?: number;\n rtl?: boolean;\n /** East-Asian line breaking (default true in MS Office). */\n eastAsianLineBreak?: boolean;\n /** Latin line breaking (default false). */\n latinLineBreak?: boolean;\n hangingPunctuation?: boolean;\n /** Line spacing as a percentage (e.g., 90 = 90%). */\n lineSpacingPercent?: number;\n /** Space before as a percentage (e.g., 0 = 0%). */\n spaceBeforePercent?: number;\n /** Space before in points (e.g., 5 = 5pt). */\n spaceBeforePoints?: number;\n bullet?: TextListStyleBulletOptions;\n defaultRun?: TextListStyleRunOptions;\n}\n\n/** A title/body/other group: an optional empty defPPr plus up to 9 levels. */\nexport interface TextListStyleGroupOptions {\n /** Emit an empty <a:defPPr><a:defRPr/></a:defPPr> (otherStyle carries one). */\n emptyDefaultParagraph?: boolean;\n /** Levels 1-9; index 0 = lvl1pPr. `null` omits the level (JSON form of\n * an undefined array slot — the position still pins the level number). */\n levels?: (TextListStyleLevelOptions | null)[];\n}\n\nexport interface TextListStyleOptions {\n title?: TextListStyleGroupOptions;\n body?: TextListStyleGroupOptions;\n other?: TextListStyleGroupOptions;\n}\n\n// ── Stringify ──\n\nfunction stringifyRun(run: TextListStyleRunOptions | undefined): string {\n if (!run) return \"\";\n const attrs: string[] = [];\n if (run.size !== undefined) attrs.push(`sz=\"${Math.round(run.size * 100)}\"`);\n if (run.kern !== undefined) attrs.push(`kern=\"${Math.round(run.kern * 100)}\"`);\n const fillXml = run.schemeColor\n ? `<a:solidFill><a:schemeClr val=\"${run.schemeColor}\"/></a:solidFill>`\n : \"\";\n const latinXml = run.latin ? `<a:latin typeface=\"${run.latin}\"/>` : \"\";\n const eaXml = run.eastAsia ? `<a:ea typeface=\"${run.eastAsia}\"/>` : \"\";\n const csXml = run.complexScript ? `<a:cs typeface=\"${run.complexScript}\"/>` : \"\";\n const inner = `${fillXml}${latinXml}${eaXml}${csXml}`;\n const attrStr = attrs.length ? \" \" + attrs.join(\" \") : \"\";\n return `<a:defRPr${attrStr}>${inner}</a:defRPr>`;\n}\n\nfunction stringifyBullet(b: TextListStyleBulletOptions): string {\n if (b.type === \"none\") return \"<a:buNone/>\";\n const typeface = b.font ?? \"Arial\";\n const char = escapeXml(b.char ?? \"•\");\n return `<a:buFont typeface=\"${typeface}\" panose=\"020B0604020202020204\" pitchFamily=\"34\" charset=\"0\"/><a:buChar char=\"${char}\"/>`;\n}\n\n/** Emit one <a:lvlNpPr>. Byte layout matches MS Office's txStyles output. */\nfunction stringifyLevel(level: number, opts: TextListStyleLevelOptions): string {\n const attrs: string[] = [];\n // Attribute order: marL, indent, algn, defTabSz, rtl, eaLnBrk, latinLnBrk, hangingPunct\n if (opts.marginIndent !== undefined) attrs.push(`marL=\"${opts.marginIndent}\"`);\n if (opts.indent !== undefined) attrs.push(`indent=\"${opts.indent}\"`);\n if (opts.alignment) attrs.push(`algn=\"${opts.alignment}\"`);\n if (opts.defaultTabSize !== undefined) attrs.push(`defTabSz=\"${opts.defaultTabSize}\"`);\n if (opts.rtl !== undefined) attrs.push(`rtl=\"${opts.rtl ? 1 : 0}\"`);\n if (opts.eastAsianLineBreak !== undefined)\n attrs.push(`eaLnBrk=\"${opts.eastAsianLineBreak ? 1 : 0}\"`);\n if (opts.latinLineBreak !== undefined) attrs.push(`latinLnBrk=\"${opts.latinLineBreak ? 1 : 0}\"`);\n if (opts.hangingPunctuation !== undefined)\n attrs.push(`hangingPunct=\"${opts.hangingPunctuation ? 1 : 0}\"`);\n\n const children: string[] = [];\n // Child order: lnSpc, spcBef, bullet, defRPr\n if (opts.lineSpacingPercent !== undefined)\n children.push(`<a:lnSpc><a:spcPct val=\"${emitPercent(opts.lineSpacingPercent)}\"/></a:lnSpc>`);\n if (opts.spaceBeforePercent !== undefined)\n children.push(`<a:spcBef><a:spcPct val=\"${emitPercent(opts.spaceBeforePercent)}\"/></a:spcBef>`);\n else if (opts.spaceBeforePoints !== undefined)\n children.push(\n `<a:spcBef><a:spcPts val=\"${Math.round(opts.spaceBeforePoints * 100)}\"/></a:spcBef>`,\n );\n if (opts.bullet) children.push(stringifyBullet(opts.bullet));\n const runXml = stringifyRun(opts.defaultRun);\n if (runXml) children.push(runXml);\n\n const attrStr = attrs.length ? \" \" + attrs.join(\" \") : \"\";\n if (children.length === 0) return `<a:lvl${level}pPr${attrStr}/>`;\n return `<a:lvl${level}pPr${attrStr}>${children.join(\"\")}</a:lvl${level}pPr>`;\n}\n\nfunction stringifyGroup(tag: string, group: TextListStyleGroupOptions | undefined): string {\n if (!group) return \"\";\n const parts: string[] = [];\n if (group.emptyDefaultParagraph) parts.push(\"<a:defPPr><a:defRPr/></a:defPPr>\");\n const levels = group.levels ?? [];\n for (let i = 0; i < Math.min(levels.length, 9); i++) {\n const lvl = levels[i];\n if (lvl) parts.push(stringifyLevel(i + 1, lvl));\n }\n return `<${tag}>${parts.join(\"\")}</${tag}>`;\n}\n\n/**\n * Stringify the three text-style groups (CT_SlideMasterTextStyles). Group tags\n * use the p: prefix (PML); level tags inside are a: (DrawingML). Caller wraps\n * with `<p:txStyles>…</p:txStyles>`.\n */\nexport function stringifyTextListStyle(opts: TextListStyleOptions): string {\n return `${stringifyGroup(\"p:titleStyle\", opts.title)}${stringifyGroup(\"p:bodyStyle\", opts.body)}${stringifyGroup(\"p:otherStyle\", opts.other)}`;\n}\n\n// ── Parse ──\n\nfunction parseRun(el: Element | undefined): TextListStyleRunOptions | undefined {\n if (!el) return undefined;\n const run: TextListStyleRunOptions = {};\n if (el.attributes) {\n if (el.attributes[\"sz\"] !== undefined) run.size = Number(el.attributes[\"sz\"]) / 100;\n if (el.attributes[\"kern\"] !== undefined) run.kern = Number(el.attributes[\"kern\"]) / 100;\n }\n const solidFill = findChild(el, \"a:solidFill\");\n if (solidFill) {\n const schemeClr = findChild(solidFill, \"a:schemeClr\");\n if (schemeClr?.attributes?.[\"val\"]) run.schemeColor = String(schemeClr.attributes[\"val\"]);\n }\n const latin = findChild(el, \"a:latin\");\n if (latin?.attributes?.[\"typeface\"]) run.latin = String(latin.attributes[\"typeface\"]);\n const ea = findChild(el, \"a:ea\");\n if (ea?.attributes?.[\"typeface\"]) run.eastAsia = String(ea.attributes[\"typeface\"]);\n const cs = findChild(el, \"a:cs\");\n if (cs?.attributes?.[\"typeface\"]) run.complexScript = String(cs.attributes[\"typeface\"]);\n return Object.keys(run).length > 0 ? run : undefined;\n}\n\nfunction parseLevel(el: Element): TextListStyleLevelOptions {\n const lvl: TextListStyleLevelOptions = {};\n // nativeTypeAttributes (opc parser) coerces boolean attribute values between\n // string/number/boolean forms; parseOnOff accepts all of them.\n const isOn = (raw: string | number | boolean | undefined): boolean => parseOnOff(raw) ?? false;\n if (el.attributes) {\n const a = el.attributes;\n if (a[\"algn\"] !== undefined) lvl.alignment = String(a[\"algn\"]);\n if (a[\"marL\"] !== undefined) lvl.marginIndent = Number(a[\"marL\"]);\n if (a[\"indent\"] !== undefined) lvl.indent = Number(a[\"indent\"]);\n if (a[\"defTabSz\"] !== undefined) lvl.defaultTabSize = Number(a[\"defTabSz\"]);\n if (a[\"rtl\"] !== undefined) lvl.rtl = isOn(a[\"rtl\"]);\n if (a[\"eaLnBrk\"] !== undefined) lvl.eastAsianLineBreak = isOn(a[\"eaLnBrk\"]);\n if (a[\"latinLnBrk\"] !== undefined) lvl.latinLineBreak = isOn(a[\"latinLnBrk\"]);\n if (a[\"hangingPunct\"] !== undefined) lvl.hangingPunctuation = isOn(a[\"hangingPunct\"]);\n }\n const lnSpc = findChild(el, \"a:lnSpc\");\n if (lnSpc) {\n const spcPct = findChild(lnSpc, \"a:spcPct\");\n if (spcPct?.attributes?.[\"val\"] !== undefined)\n lvl.lineSpacingPercent = parsePercent(Number(spcPct.attributes[\"val\"]));\n }\n const spcBef = findChild(el, \"a:spcBef\");\n if (spcBef) {\n const spcPct = findChild(spcBef, \"a:spcPct\");\n if (spcPct?.attributes?.[\"val\"] !== undefined)\n lvl.spaceBeforePercent = parsePercent(Number(spcPct.attributes[\"val\"]));\n const spcPts = findChild(spcBef, \"a:spcPts\");\n if (spcPts?.attributes?.[\"val\"] !== undefined)\n lvl.spaceBeforePoints = Number(spcPts.attributes[\"val\"]) / 100;\n }\n if (findChild(el, \"a:buNone\")) {\n lvl.bullet = { type: \"none\" };\n } else {\n const buChar = findChild(el, \"a:buChar\");\n if (buChar) {\n const buFont = findChild(el, \"a:buFont\");\n lvl.bullet = {\n type: \"char\",\n char: buChar.attributes?.[\"char\"] ? String(buChar.attributes[\"char\"]) : undefined,\n font: buFont?.attributes?.[\"typeface\"] ? String(buFont.attributes[\"typeface\"]) : undefined,\n };\n }\n }\n const defRPr = findChild(el, \"a:defRPr\");\n const run = parseRun(defRPr);\n if (run) lvl.defaultRun = run;\n return lvl;\n}\n\nfunction parseGroup(el: Element | undefined): TextListStyleGroupOptions | undefined {\n if (!el) return undefined;\n const group: TextListStyleGroupOptions = { levels: [] };\n const defPPr = findChild(el, \"a:defPPr\");\n if (defPPr) group.emptyDefaultParagraph = true;\n for (let i = 1; i <= 9; i++) {\n const lvlEl = findChild(el, `a:lvl${i}pPr`);\n group.levels!.push(lvlEl ? parseLevel(lvlEl) : null);\n }\n const hasContent = group.emptyDefaultParagraph || group.levels!.some((l) => l !== null);\n return hasContent ? group : undefined;\n}\n\n/** Parse CT_SlideMasterTextStyles (the three p:titleStyle/p:bodyStyle/p:otherStyle groups). */\nexport function parseTextListStyle(el: Element): TextListStyleOptions {\n return {\n title: parseGroup(findChild(el, \"p:titleStyle\")),\n body: parseGroup(findChild(el, \"p:bodyStyle\")),\n other: parseGroup(findChild(el, \"p:otherStyle\")),\n };\n}\n\n// ── Descriptor ──\n\nexport const textListStyleDesc: CustomDescriptor<TextListStyleOptions> = {\n kind: \"custom\",\n stringify(opts) {\n return stringifyTextListStyle(opts);\n },\n parse(el) {\n return parseTextListStyle(el);\n },\n};\n\n// ── MS Office standard master text styles (structured form) ──\n\nconst MJ_RUN = {\n schemeColor: \"tx1\",\n latin: \"+mj-lt\",\n eastAsia: \"+mj-ea\",\n complexScript: \"+mj-cs\",\n} as const;\nconst MN_RUN = {\n schemeColor: \"tx1\",\n latin: \"+mn-lt\",\n eastAsia: \"+mn-ea\",\n complexScript: \"+mn-cs\",\n} as const;\nconst BASE_ATTRS = {\n alignment: \"l\",\n defaultTabSize: 914400,\n rtl: false,\n eastAsianLineBreak: true,\n latinLineBreak: false,\n hangingPunctuation: true,\n} as const;\n\nconst BODY_MARL = [228600, 685800, 1143000, 1600200, 2057400, 2514600, 2971800, 3429000, 3886200];\nconst BODY_SZ = [28, 24, 20, 18, 18, 18, 18, 18, 18];\nconst OTHER_MARL = [0, 457200, 914400, 1371600, 1828800, 2286000, 2743200, 3200400, 3657600];\n\n/** MS Office's default p:txStyles — title/body/other, 9 outline levels. */\nexport const DEFAULT_TEXT_LIST_STYLE: TextListStyleOptions = {\n title: {\n levels: [\n {\n ...BASE_ATTRS,\n lineSpacingPercent: 90,\n spaceBeforePercent: 0,\n bullet: { type: \"none\" },\n defaultRun: { size: 44, kern: 12, ...MJ_RUN },\n },\n ],\n },\n body: {\n levels: BODY_MARL.map((marL, i) => ({\n ...BASE_ATTRS,\n marginIndent: marL,\n indent: -228600,\n lineSpacingPercent: 90,\n spaceBeforePoints: i === 0 ? undefined : 5,\n spaceBeforePercent: i === 0 ? 0 : undefined,\n bullet: { type: \"char\", char: \"•\", font: \"Arial\" },\n defaultRun: { size: BODY_SZ[i]!, kern: 12, ...MN_RUN },\n })),\n },\n other: {\n emptyDefaultParagraph: true,\n levels: OTHER_MARL.map((marL, i) => ({\n ...BASE_ATTRS,\n marginIndent: marL,\n indent: i === 8 ? -228600 : undefined,\n defaultRun: { size: 18, kern: 12, ...MN_RUN },\n })),\n },\n};\n","/**\n * Text body descriptor — assembles the inner content of a DrawingML text body\n * (a:bodyPr + a:lstStyle + a:p[]). The caller wraps the container tag\n * (p:txBody / xdr:txBody / a:txBody); DOCX text boxes use wps:txbx (not txBody).\n *\n * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_TextBody\n *\n * @module\n */\n\nimport { findChild } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../../descriptor\";\nimport { createBodyProperties, parseBodyProperties } from \"./body-properties\";\nimport type { BodyPropertiesOptions } from \"./body-properties\";\nimport { textListStyleDesc } from \"./list-style\";\nimport type { TextListStyleOptions } from \"./list-style\";\nimport { paragraphDesc } from \"./paragraph\";\nimport type { ParagraphDescriptorOptions } from \"./paragraph\";\n\nexport interface TextBodyOptions {\n bodyProperties?: BodyPropertiesOptions;\n listStyle?: TextListStyleOptions;\n /** Single-paragraph shorthand; expands to one paragraph on stringify. */\n text?: string;\n /** Paragraph list; string entries expand to a one-run paragraph. */\n paragraphs?: (ParagraphDescriptorOptions | string)[];\n\n /**\n * Convenience sugar — merged into {@link bodyProperties} on stringify (explicit\n * `bodyProperties` fields take precedence). Input-only: parse always emits\n * the normalized `bodyProperties` form. Mirrors the `fill` descriptor's\n * string-sugar convention.\n */\n anchor?: BodyPropertiesOptions[\"anchor\"];\n /** Sugar → `bodyProperties.normAutofit` (`\"normal\"`) / `spAutoFit` (`\"shape\"`). */\n autoFit?: \"normal\" | \"shape\";\n /** Sugar → `bodyProperties.numCol`. */\n columns?: BodyPropertiesOptions[\"numCol\"];\n /** Sugar → `bodyProperties.spcCol`. */\n columnSpacing?: BodyPropertiesOptions[\"spcCol\"];\n /** Sugar → `bodyProperties.margins`. */\n margins?: BodyPropertiesOptions[\"margins\"];\n /** Sugar → `bodyProperties.wrap`. */\n wrap?: BodyPropertiesOptions[\"wrap\"];\n /** Sugar → `bodyProperties.vertical`. */\n vertical?: BodyPropertiesOptions[\"vertical\"];\n}\n\n/**\n * Collect top-level TextBodyOptions sugar into a partial BodyPropertiesOptions.\n * Returns undefined when no sugar field is set — textBodyDesc runs once per\n * shape and the common case has no sugar, so the guard avoids allocating the\n * collector object (and the caller's emptiness check) on that path.\n */\nfunction bodyPropertiesSugar(opts: TextBodyOptions): Partial<BodyPropertiesOptions> | undefined {\n if (\n opts.anchor === undefined &&\n opts.autoFit === undefined &&\n opts.columns === undefined &&\n opts.columnSpacing === undefined &&\n opts.margins === undefined &&\n opts.wrap === undefined &&\n opts.vertical === undefined\n ) {\n return undefined;\n }\n const sugar: Partial<BodyPropertiesOptions> = {};\n if (opts.anchor !== undefined) sugar.anchor = opts.anchor;\n if (opts.autoFit === \"normal\") sugar.normAutofit = {};\n else if (opts.autoFit === \"shape\") sugar.spAutoFit = true;\n if (opts.columns !== undefined) sugar.numCol = opts.columns;\n if (opts.columnSpacing !== undefined) sugar.spcCol = opts.columnSpacing;\n if (opts.margins !== undefined) sugar.margins = opts.margins;\n if (opts.wrap !== undefined) sugar.wrap = opts.wrap;\n if (opts.vertical !== undefined) sugar.vertical = opts.vertical;\n return sugar;\n}\n\nexport const textBodyDesc: CustomDescriptor<TextBodyOptions> = {\n kind: \"custom\",\n\n stringify(opts, ctx) {\n const parts: string[] = [];\n\n // a:bodyPr — always present in CT_TextBody. Top-level sugar (anchor/\n // autoFit/columns/...) merges into bodyProperties; explicit bodyProperties\n // fields win.\n const sugar = bodyPropertiesSugar(opts);\n if (opts.bodyProperties || sugar !== undefined) {\n parts.push(createBodyProperties({ ...sugar, ...opts.bodyProperties }));\n } else {\n parts.push(\"<a:bodyPr/>\");\n }\n\n // a:lstStyle — always emit (matches MS Office byte layout).\n parts.push(\n opts.listStyle\n ? `<a:lstStyle>${textListStyleDesc.stringify(opts.listStyle, ctx) ?? \"\"}</a:lstStyle>`\n : \"<a:lstStyle/>\",\n );\n\n // a:p[] — CT_TextBody requires at least one paragraph. `text` is a\n // single-paragraph shorthand; `paragraphs` accepts string entries that\n // each expand to a one-run paragraph.\n const paragraphs = opts.paragraphs ?? (opts.text !== undefined ? [{ text: opts.text }] : []);\n if (paragraphs.length > 0) {\n for (const p of paragraphs) {\n const para = typeof p === \"string\" ? { children: [p] } : p;\n parts.push(paragraphDesc.stringify(para, ctx) ?? \"<a:p/>\");\n }\n } else {\n parts.push(\"<a:p/>\");\n }\n\n return parts.join(\"\");\n },\n\n parse(el, ctx) {\n const result: TextBodyOptions = {};\n\n const bodyPr = findChild(el, \"a:bodyPr\");\n if (bodyPr) result.bodyProperties = parseBodyProperties(bodyPr, ctx);\n\n const lstStyle = findChild(el, \"a:lstStyle\");\n if (lstStyle) {\n const parsed = textListStyleDesc.parse(lstStyle, ctx);\n // An empty <a:lstStyle/> parses to all-undefined groups; skip it so\n // stringify re-emits the self-closing form (matches MS Office byte layout\n // for bare text bodies).\n if (parsed.title || parsed.body || parsed.other) result.listStyle = parsed;\n }\n\n const paragraphs: ParagraphDescriptorOptions[] = [];\n for (const child of el.elements ?? []) {\n if (child.name === \"a:p\") {\n paragraphs.push(paragraphDesc.parse(child, ctx) as ParagraphDescriptorOptions);\n }\n }\n if (paragraphs.length > 0) result.paragraphs = paragraphs;\n\n return result;\n },\n};\n","/**\n * Diagram descriptors for declarative XML read/write.\n *\n * @module\n */\n\nimport { escapeXml, findChild } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../../descriptor\";\nimport { parseOnOff } from \"../../util/values\";\nimport type { DiagramExtensionListOptions } from \"./diagram-props\";\nimport type { DiagramRelationshipIdsOptions } from \"./diagram-rel\";\nimport type { DiagramStyleOptions } from \"./diagram-style\";\nimport type { PresentationLayoutVariablesOptions } from \"./layout-vars\";\n\n// ── dgm:relIds descriptor ──\n\nexport const diagramRelationshipIdsDesc: CustomDescriptor<DiagramRelationshipIdsOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n return `<dgm:relIds r:dm=\"${escapeXml(opts.dataModel)}\" r:lo=\"${escapeXml(opts.layout)}\" r:qs=\"${escapeXml(opts.quickStyle)}\" r:cs=\"${escapeXml(opts.colorStyle)}\"/>`;\n },\n parse(el, _ctx) {\n const result: Partial<DiagramRelationshipIdsOptions> = {};\n if (el.attributes) {\n if (el.attributes[\"r:dm\"] !== undefined) result.dataModel = String(el.attributes[\"r:dm\"]);\n if (el.attributes[\"r:lo\"] !== undefined) result.layout = String(el.attributes[\"r:lo\"]);\n if (el.attributes[\"r:qs\"] !== undefined) result.quickStyle = String(el.attributes[\"r:qs\"]);\n if (el.attributes[\"r:cs\"] !== undefined) result.colorStyle = String(el.attributes[\"r:cs\"]);\n }\n return result as DiagramRelationshipIdsOptions;\n },\n};\n\n// ── dgm:style descriptor ──\n\nexport const diagramStyleDesc: CustomDescriptor<DiagramStyleOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const lineIdx = opts.lineReference?.idx ?? 1;\n const fillIdx = opts.fillReference?.idx ?? 1;\n const effectIdx = opts.effectReference?.idx ?? 0;\n const fontIdx = opts.fontReference?.idx ?? \"minor\";\n\n return (\n `<dgm:style>` +\n `<a:lnRef idx=\"${lineIdx}\"><a:schemeClr val=\"accent1\"/></a:lnRef>` +\n `<a:fillRef idx=\"${fillIdx}\"><a:schemeClr val=\"accent1\"/></a:fillRef>` +\n `<a:effectRef idx=\"${effectIdx}\"><a:schemeClr val=\"accent1\"/></a:effectRef>` +\n `<a:fontRef idx=\"${escapeXml(fontIdx)}\"><a:schemeClr val=\"tx1\"/></a:fontRef>` +\n `</dgm:style>`\n );\n },\n parse(el, _ctx) {\n const result: DiagramStyleOptions = {};\n\n const lnRef = findChild(el, \"a:lnRef\");\n if (lnRef?.attributes?.[\"idx\"] !== undefined)\n result.lineReference = { idx: Number(lnRef.attributes[\"idx\"]) };\n\n const fillRef = findChild(el, \"a:fillRef\");\n if (fillRef?.attributes?.[\"idx\"] !== undefined)\n result.fillReference = { idx: Number(fillRef.attributes[\"idx\"]) };\n\n const effectRef = findChild(el, \"a:effectRef\");\n if (effectRef?.attributes?.[\"idx\"] !== undefined)\n result.effectReference = { idx: Number(effectRef.attributes[\"idx\"]) };\n\n const fontRef = findChild(el, \"a:fontRef\");\n if (fontRef?.attributes?.[\"idx\"] !== undefined)\n result.fontReference = { idx: String(fontRef.attributes[\"idx\"]) };\n\n return result;\n },\n};\n\n// ── dgm:presLayoutVars descriptor ──\n\nexport const presentationLayoutVariablesDesc: CustomDescriptor<PresentationLayoutVariablesOptions> =\n {\n kind: \"custom\",\n stringify(opts, _ctx) {\n const parts: string[] = [];\n\n if (opts.orgChart?.val !== undefined)\n parts.push(`<dgm:orgChart val=\"${opts.orgChart.val ? 1 : 0}\"/>`);\n\n if (opts.maxChildren?.val !== undefined)\n parts.push(`<dgm:chMax val=\"${opts.maxChildren.val}\"/>`);\n\n if (opts.preferredChildren?.val !== undefined)\n parts.push(`<dgm:chPref val=\"${opts.preferredChildren.val}\"/>`);\n\n if (opts.animateOneByOne?.val !== undefined)\n parts.push(`<dgm:animOne val=\"${escapeXml(opts.animateOneByOne.val)}\"/>`);\n\n if (opts.animationLevel?.val !== undefined)\n parts.push(`<dgm:animLvl val=\"${escapeXml(opts.animationLevel.val)}\"/>`);\n\n if (opts.hierBranch?.val !== undefined)\n parts.push(`<dgm:hierBranch val=\"${escapeXml(opts.hierBranch.val)}\"/>`);\n\n if (parts.length === 0) return `<dgm:presLayoutVars/>`;\n return `<dgm:presLayoutVars>${parts.join(\"\")}</dgm:presLayoutVars>`;\n },\n parse(el, _ctx) {\n const result: PresentationLayoutVariablesOptions = {};\n\n const orgChart = findChild(el, \"dgm:orgChart\");\n if (orgChart?.attributes?.[\"val\"] !== undefined)\n result.orgChart = {\n val: parseOnOff(orgChart.attributes[\"val\"]) ?? false,\n };\n\n const chMax = findChild(el, \"dgm:chMax\");\n if (chMax?.attributes?.[\"val\"] !== undefined)\n result.maxChildren = { val: Number(chMax.attributes[\"val\"]) };\n\n const chPref = findChild(el, \"dgm:chPref\");\n if (chPref?.attributes?.[\"val\"] !== undefined)\n result.preferredChildren = { val: Number(chPref.attributes[\"val\"]) };\n\n const animOne = findChild(el, \"dgm:animOne\");\n if (animOne?.attributes?.[\"val\"] !== undefined)\n result.animateOneByOne = {\n val: String(\n animOne.attributes[\"val\"],\n ) as PresentationLayoutVariablesOptions[\"animateOneByOne\"] extends\n | { val?: infer V }\n | undefined\n ? V\n : never,\n };\n\n const animLvl = findChild(el, \"dgm:animLvl\");\n if (animLvl?.attributes?.[\"val\"] !== undefined)\n result.animationLevel = {\n val: String(\n animLvl.attributes[\"val\"],\n ) as PresentationLayoutVariablesOptions[\"animationLevel\"] extends\n | { val?: infer V }\n | undefined\n ? V\n : never,\n };\n\n const hierBranch = findChild(el, \"dgm:hierBranch\");\n if (hierBranch?.attributes?.[\"val\"] !== undefined)\n result.hierBranch = {\n val: String(\n hierBranch.attributes[\"val\"],\n ) as PresentationLayoutVariablesOptions[\"hierBranch\"] extends\n | { val?: infer V }\n | undefined\n ? V\n : never,\n };\n\n return result;\n },\n };\n\n// ── dgm:extLst descriptor ──\n\nexport const diagramExtensionListDesc: CustomDescriptor<DiagramExtensionListOptions> = {\n kind: \"custom\",\n stringify(opts, _ctx) {\n if (!opts.extensions?.length) return undefined;\n\n const inner = opts.extensions.map((ext) => `<a:ext uri=\"${escapeXml(ext.uri)}\"/>`).join(\"\");\n\n return `<dgm:extLst>${inner}</dgm:extLst>`;\n },\n parse(el, _ctx) {\n const result: DiagramExtensionListOptions = {};\n\n if (el.elements) {\n const extensions = el.elements\n .filter((c) => c.name === \"a:ext\")\n .map((c) => ({ uri: String(c.attributes?.[\"uri\"] ?? \"\") }));\n if (extensions.length) result.extensions = extensions;\n }\n\n return result;\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0FA,MAAa,qBAAgD,IAAI,IAAkB;CACjF;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAa,mBAA8C,IAAI,IAAkB,CAAC,OAAO,QAAQ,CAAC;;AAGlG,MAAa,qBAAgD,IAAI,IAAkB;CACjF;CACA;CACA;CACA;CACA;AACF,CAAC;;AAGD,SAAgB,mBAAmB,KAAmB,OAAuB;CAC3E,IAAI,mBAAmB,IAAI,GAAG,GAAG,OAAO,YAAY,KAAK;CACzD,IAAI,iBAAiB,IAAI,GAAG,GAAG,OAAO,UAAU,KAAK;CACrD,OAAO;AACT;;;;;;;;;;;;;;;;;AAkBA,MAAa,yBAAyB,YAAsD;CAC1F,MAAM,IAAc,CAAC;CAErB,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,OAAO,GAAG;EACnD,MAAM,MAAM;EACZ,IAAI,UAAU,KAAA,KAAa,UAAU,OAAO;EAC5C,IAAI,UAAU,MAAM;GAClB,EAAE,KAAK,MAAM,IAAI,GAAG;GACpB;EACF;EACA,EAAE,KAAK,MAAM,IAAI,QAAQ,mBAAmB,KAAK,KAAK,EAAE,IAAI;CAC9D;CAEA,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;ACtIA,MAAa,cAAc;CACzB,YAAY;CACZ,eAAe;CACf,MAAM;CACN,YAAY;CACZ,OAAO;CACP,OAAO;CACP,QAAQ;CACR,OAAO;CACP,iBAAiB;CACjB,MAAM;CACN,aAAa;CACb,OAAO;CACP,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,WAAW;CACX,OAAO;CACP,iBAAiB;CACjB,UAAU;CACV,SAAS;CACT,MAAM;CACN,WAAW;CACX,WAAW;CACX,gBAAgB;CAChB,WAAW;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