@office-open/core 0.11.0 → 0.12.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.
- package/dist/chart/index.d.mts +2 -2
- package/dist/chart/index.mjs +1 -1
- package/dist/{chart-Kf_utasF.mjs → chart-DED4tXC9.mjs} +828 -283
- package/dist/chart-DED4tXC9.mjs.map +1 -0
- package/dist/data-type-CZMKVaaT.d.mts.map +1 -1
- package/dist/descriptor/index.d.mts +1 -1
- package/dist/descriptor/index.mjs +1 -1
- package/dist/{descriptor-BX8xW8na.mjs → descriptor-BqaNZrrZ.mjs} +38 -10
- package/dist/{descriptor-BX8xW8na.mjs.map → descriptor-BqaNZrrZ.mjs.map} +1 -1
- package/dist/drawing/index.d.mts +2 -2
- package/dist/drawing/index.mjs +2 -2
- package/dist/{drawing-FBzd2I0m.mjs → drawing-BCAyrCCw.mjs} +3056 -3130
- package/dist/drawing-BCAyrCCw.mjs.map +1 -0
- package/dist/{generators-CElPsAhd.mjs → ext-uri-BHBcIrW7.mjs} +599 -343
- package/dist/ext-uri-BHBcIrW7.mjs.map +1 -0
- package/dist/index-BAxlDUQ1.d.mts +590 -0
- package/dist/index-BAxlDUQ1.d.mts.map +1 -0
- package/dist/{index-DxwLMnBF.d.mts → index-BP541uS-.d.mts} +136 -31
- package/dist/index-BP541uS-.d.mts.map +1 -0
- package/dist/{index-CLX7gU9J.d.mts → index-BQLIofaF.d.mts} +3 -2
- package/dist/index-BQLIofaF.d.mts.map +1 -0
- package/dist/{index-k8WKLXnA.d.mts → index-CaNwM5_e.d.mts} +19 -20
- package/dist/index-CaNwM5_e.d.mts.map +1 -0
- package/dist/{index-CnjCK-lF.d.mts → index-DPkf_CtG.d.mts} +566 -597
- package/dist/index-DPkf_CtG.d.mts.map +1 -0
- package/dist/{index-BsTUn4K1.d.mts → index-DcukVskh.d.mts} +9 -6
- package/dist/index-DcukVskh.d.mts.map +1 -0
- package/dist/{index-Cgz88FU0.d.mts → index-Di6XPdGl.d.mts} +26 -12
- package/dist/index-Di6XPdGl.d.mts.map +1 -0
- package/dist/{index-C0ClOhmZ.d.mts → index-L6AXewfV.d.mts} +11 -8
- package/dist/index-L6AXewfV.d.mts.map +1 -0
- package/dist/index.d.mts +140 -29
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +849 -87
- package/dist/index.mjs.map +1 -1
- package/dist/{output-D_G_JR_8.d.mts → output-yyxdkG0C.d.mts} +2 -3
- package/dist/output-yyxdkG0C.d.mts.map +1 -0
- package/dist/patch/index.d.mts +2 -2
- package/dist/patch/index.mjs +2 -2
- package/dist/{patch-3KLx2yEP.mjs → patch-AkQY17CD.mjs} +71 -26
- package/dist/patch-AkQY17CD.mjs.map +1 -0
- package/dist/smartart/index.d.mts +2 -2
- package/dist/smartart/index.mjs +1 -1
- package/dist/{smartart-BxnkROOp.mjs → smartart-n1kYJ6Jg.mjs} +27 -26
- package/dist/smartart-n1kYJ6Jg.mjs.map +1 -0
- package/dist/{style-matrix-DAP6XrLv.mjs → style-matrix-B6jhPAT3.mjs} +4 -4
- package/dist/style-matrix-B6jhPAT3.mjs.map +1 -0
- package/dist/theme/index.d.mts +4 -4
- package/dist/theme/index.mjs +3 -2
- package/dist/{theme-OAuRcA9_.mjs → theme-BKnXRmvn.mjs} +37 -71
- package/dist/theme-BKnXRmvn.mjs.map +1 -0
- package/dist/{theme-options-BbWccl85.d.mts → theme-options-kO89NUEX.d.mts} +17 -17
- package/dist/theme-options-kO89NUEX.d.mts.map +1 -0
- package/dist/util/index.d.mts +3 -3
- package/dist/util/index.mjs +3 -3
- package/dist/{util-C94-JKtp.mjs → util-ptE16MEk.mjs} +69 -37
- package/dist/util-ptE16MEk.mjs.map +1 -0
- package/dist/{values-aVoirbWB.d.mts → values-BECDm4zr.d.mts} +15 -31
- package/dist/values-BECDm4zr.d.mts.map +1 -0
- package/dist/vector/index.d.mts +2 -2
- package/dist/vector/index.mjs +2 -2
- package/dist/{vector-TpjW6ZSc.mjs → vector-DhLGZjP5.mjs} +104 -147
- package/dist/vector-DhLGZjP5.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/chart-Kf_utasF.mjs.map +0 -1
- package/dist/drawing-FBzd2I0m.mjs.map +0 -1
- package/dist/generators-CElPsAhd.mjs.map +0 -1
- package/dist/index-BsTUn4K1.d.mts.map +0 -1
- package/dist/index-C0ClOhmZ.d.mts.map +0 -1
- package/dist/index-CLX7gU9J.d.mts.map +0 -1
- package/dist/index-Cgz88FU0.d.mts.map +0 -1
- package/dist/index-CnjCK-lF.d.mts.map +0 -1
- package/dist/index-DpPeyf5f.d.mts +0 -316
- package/dist/index-DpPeyf5f.d.mts.map +0 -1
- package/dist/index-DxwLMnBF.d.mts.map +0 -1
- package/dist/index-k8WKLXnA.d.mts.map +0 -1
- package/dist/output-D_G_JR_8.d.mts.map +0 -1
- package/dist/patch-3KLx2yEP.mjs.map +0 -1
- package/dist/smartart-BxnkROOp.mjs.map +0 -1
- package/dist/style-matrix-DAP6XrLv.mjs.map +0 -1
- package/dist/theme-OAuRcA9_.mjs.map +0 -1
- package/dist/theme-options-BbWccl85.d.mts.map +0 -1
- package/dist/util-C94-JKtp.mjs.map +0 -1
- package/dist/values-aVoirbWB.d.mts.map +0 -1
- package/dist/vector-TpjW6ZSc.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"smartart-BxnkROOp.mjs","names":["stringifyInnerXml","stringifyLocalized","parseLocalized","stringifyInnerXml","stringifyInnerXml"],"sources":["../src/smartart/categories.ts","../src/smartart/data-model/connection.ts","../src/smartart/data-model/point.ts","../src/smartart/data-model/data-model.ts","../src/smartart/layout-definition.ts","../src/smartart/color-definition.ts","../src/smartart/style-definition.ts","../src/smartart/built-in-definitions.ts","../src/smartart/smartart-collection.ts","../src/smartart/tree-to-model.ts"],"sourcesContent":["/** Layout ID → OOXML category type */\nexport const LAYOUT_CATEGORIES: Record<string, string> = {\n default: \"list\",\n list1: \"list\",\n list2: \"list\",\n vList2: \"list\",\n hList1: \"list\",\n pList1: \"list\",\n process1: \"process\",\n process2: \"process\",\n process3: \"process\",\n process4: \"process\",\n chevron1: \"process\",\n chevron2: \"process\",\n arrow1: \"process\",\n arrow2: \"process\",\n cycle1: \"cycle\",\n cycle2: \"cycle\",\n cycle3: \"cycle\",\n cycle4: \"cycle\",\n cycle5: \"cycle\",\n hierarchy1: \"hier\",\n hierarchy2: \"hier\",\n hierarchy3: \"hier\",\n hierarchy4: \"hier\",\n orgChart1: \"hier\",\n pyramid1: \"pyramid\",\n pyramid2: \"pyramid\",\n pyramid3: \"pyramid\",\n matrix1: \"matrix\",\n matrix2: \"matrix\",\n matrix3: \"matrix\",\n radial1: \"rel\",\n radial2: \"rel\",\n radial3: \"rel\",\n venn1: \"rel\",\n funnel1: \"rel\",\n balance1: \"rel\",\n gear1: \"rel\",\n constOrg1: \"rel\",\n oppId1: \"rel\",\n};\n\n/** Style ID → OOXML category type */\nexport const STYLE_CATEGORIES: Record<string, string> = {\n simple1: \"simple\",\n simple2: \"simple\",\n simple3: \"simple\",\n simple4: \"simple\",\n simple5: \"simple\",\n moderate1: \"moderate\",\n moderate2: \"moderate\",\n moderate3: \"moderate\",\n moderate4: \"moderate\",\n polished1: \"polished\",\n polished2: \"polished\",\n polished3: \"polished\",\n polished4: \"polished\",\n professional1: \"professional\",\n professional2: \"professional\",\n professional3: \"professional\",\n professional4: \"professional\",\n cartoon1: \"cartoon\",\n cartoon2: \"cartoon\",\n cartoon3: \"cartoon\",\n cartoon4: \"cartoon\",\n powdery1: \"powdery\",\n powdery2: \"powdery\",\n powdery3: \"powdery\",\n powdery4: \"powdery\",\n burnt1: \"burnt\",\n burnt2: \"burnt\",\n burnt3: \"burnt\",\n burnt4: \"burnt\",\n};\n\n/** Color ID → OOXML category type */\nexport const COLOR_CATEGORIES: Record<string, string> = {\n accent1_2: \"accent1\",\n accent2_2: \"accent2\",\n accent3_2: \"accent3\",\n accent4_2: \"accent4\",\n accent5_2: \"accent5\",\n accent6_2: \"accent6\",\n colorful1: \"colorful\",\n colorful2: \"colorful\",\n colorful3: \"colorful\",\n colorful4: \"colorful\",\n dark1: \"dark\",\n dark2: \"dark\",\n primary1: \"primary\",\n primary2: \"primary\",\n gray1: \"gray\",\n gray2: \"gray\",\n};\n","import { escapeXml } from \"@office-open/xml\";\n\n/**\n * dgm:cxn — SmartArt data model connection (edge) XML stringifier.\n */\nexport function stringifyConnection(opts: {\n modelId: string | number;\n srcId: string | number;\n destId: string | number;\n type?: string;\n srcOrd?: number;\n destOrd?: number;\n parTransId?: string;\n sibTransId?: string;\n presId?: string;\n}): string {\n const attrs: string[] = [\n `modelId=\"${escapeXml(String(opts.modelId))}\"`,\n `srcId=\"${escapeXml(String(opts.srcId))}\"`,\n `destId=\"${escapeXml(String(opts.destId))}\"`,\n `srcOrd=\"${opts.srcOrd ?? 0}\"`,\n `destOrd=\"${opts.destOrd ?? 0}\"`,\n ];\n if (opts.type) attrs.push(`type=\"${escapeXml(opts.type)}\"`);\n if (opts.parTransId) attrs.push(`parTransId=\"${escapeXml(opts.parTransId)}\"`);\n if (opts.sibTransId) attrs.push(`sibTransId=\"${escapeXml(opts.sibTransId)}\"`);\n if (opts.presId) attrs.push(`presId=\"${escapeXml(opts.presId)}\"`);\n return `<dgm:cxn ${attrs.join(\" \")}/>`;\n}\n","import { escapeXml } from \"@office-open/xml\";\n\nexport interface PointPropertySetOptions {\n presentationAssociationId?: string;\n presentationName?: string;\n presentationStyleLabel?: string;\n presentationStyleIndex?: number;\n presentationStyleCount?: number;\n placeholderText?: string;\n placeholder?: boolean;\n customAngle?: number;\n customFlipVertical?: boolean;\n customFlipHorizontal?: boolean;\n customSizeX?: number;\n customSizeY?: number;\n customScaleX?: number;\n customScaleY?: number;\n customText?: boolean;\n customLinearFactorX?: number;\n customLinearFactorY?: number;\n customLinearFactorNeighborX?: number;\n customLinearFactorNeighborY?: number;\n customRadialScaleRadius?: number;\n customRadialScaleIncrement?: number;\n coherent3DOffset?: boolean;\n hideGeometry?: boolean;\n hideLastTransition?: boolean;\n lockTextEntry?: boolean;\n moveWith?: string;\n useDefault?: boolean;\n zOrderOffset?: number;\n layoutTypeId?: string;\n layoutCategoryId?: string;\n quickStyleTypeId?: string;\n quickStyleCategoryId?: string;\n colorStyleTypeId?: string;\n colorStyleCategoryId?: string;\n}\n\n/**\n * dgm:pt — SmartArt data model point (node) XML stringifier.\n */\nexport function stringifyPoint(\n modelId: string | number,\n text: string,\n type: string = \"node\",\n propertySet?: PointPropertySetOptions,\n connectionId?: string,\n): string {\n const cxnAttr = connectionId ? ` cxnId=\"${escapeXml(connectionId)}\"` : \"\";\n const parts: string[] = [];\n parts.push(\n `<dgm:pt modelId=\"${escapeXml(String(modelId))}\"${cxnAttr} type=\"${escapeXml(type)}\">`,\n );\n if (propertySet) {\n parts.push(stringifyPropertySet(propertySet));\n }\n parts.push(stringifyPointText(text));\n parts.push(\"</dgm:pt>\");\n return parts.join(\"\");\n}\n\n/**\n * dgm:pt — transition point (parTrans or sibTrans) XML stringifier.\n */\nexport function stringifyTransPoint(modelId: string, type: string, cxnId: string): string {\n return `<dgm:pt modelId=\"${escapeXml(modelId)}\" type=\"${escapeXml(type)}\" cxnId=\"${escapeXml(cxnId)}\"><dgm:spPr/></dgm:pt>`;\n}\n\nfunction stringifyPropertySet(opts: PointPropertySetOptions): string {\n const attr: string[] = [];\n if (opts.presentationAssociationId !== undefined)\n attr.push(`presAssocID=\"${escapeXml(opts.presentationAssociationId)}\"`);\n if (opts.presentationName !== undefined)\n attr.push(`presName=\"${escapeXml(opts.presentationName)}\"`);\n if (opts.presentationStyleLabel !== undefined)\n attr.push(`presStyleLbl=\"${escapeXml(opts.presentationStyleLabel)}\"`);\n if (opts.presentationStyleIndex !== undefined)\n attr.push(`presStyleIdx=\"${opts.presentationStyleIndex}\"`);\n if (opts.presentationStyleCount !== undefined)\n attr.push(`presStyleCnt=\"${opts.presentationStyleCount}\"`);\n if (opts.placeholderText !== undefined) attr.push(`phldrT=\"${escapeXml(opts.placeholderText)}\"`);\n if (opts.placeholder !== undefined) attr.push(`phldr=\"${opts.placeholder ? 1 : 0}\"`);\n if (opts.customAngle !== undefined) attr.push(`custAng=\"${opts.customAngle}\"`);\n if (opts.customFlipVertical !== undefined)\n attr.push(`custFlipVert=\"${opts.customFlipVertical ? 1 : 0}\"`);\n if (opts.customFlipHorizontal !== undefined)\n attr.push(`custFlipHor=\"${opts.customFlipHorizontal ? 1 : 0}\"`);\n if (opts.customSizeX !== undefined) attr.push(`custSzX=\"${opts.customSizeX}\"`);\n if (opts.customSizeY !== undefined) attr.push(`custSzY=\"${opts.customSizeY}\"`);\n if (opts.customScaleX !== undefined) attr.push(`custScaleX=\"${opts.customScaleX}\"`);\n if (opts.customScaleY !== undefined) attr.push(`custScaleY=\"${opts.customScaleY}\"`);\n if (opts.customText !== undefined) attr.push(`custT=\"${opts.customText ? 1 : 0}\"`);\n if (opts.customLinearFactorX !== undefined)\n attr.push(`custLinFactX=\"${opts.customLinearFactorX}\"`);\n if (opts.customLinearFactorY !== undefined)\n attr.push(`custLinFactY=\"${opts.customLinearFactorY}\"`);\n if (opts.customLinearFactorNeighborX !== undefined)\n attr.push(`custLinFactNeighborX=\"${opts.customLinearFactorNeighborX}\"`);\n if (opts.customLinearFactorNeighborY !== undefined)\n attr.push(`custLinFactNeighborY=\"${opts.customLinearFactorNeighborY}\"`);\n if (opts.customRadialScaleRadius !== undefined)\n attr.push(`custRadScaleRad=\"${opts.customRadialScaleRadius}\"`);\n if (opts.customRadialScaleIncrement !== undefined)\n attr.push(`custRadScaleInc=\"${opts.customRadialScaleIncrement}\"`);\n if (opts.coherent3DOffset !== undefined)\n attr.push(`coherent3DOff=\"${opts.coherent3DOffset ? 1 : 0}\"`);\n if (opts.hideGeometry !== undefined) attr.push(`hideGeom=\"${opts.hideGeometry ? 1 : 0}\"`);\n if (opts.hideLastTransition !== undefined)\n attr.push(`hideLastTrans=\"${opts.hideLastTransition ? 1 : 0}\"`);\n if (opts.lockTextEntry !== undefined) attr.push(`lkTxEntry=\"${opts.lockTextEntry ? 1 : 0}\"`);\n if (opts.moveWith !== undefined) attr.push(`moveWith=\"${escapeXml(opts.moveWith)}\"`);\n if (opts.useDefault !== undefined) attr.push(`useDef=\"${opts.useDefault ? 1 : 0}\"`);\n if (opts.zOrderOffset !== undefined) attr.push(`zOrderOff=\"${opts.zOrderOffset}\"`);\n if (opts.layoutTypeId !== undefined) attr.push(`loTypeId=\"${escapeXml(opts.layoutTypeId)}\"`);\n if (opts.layoutCategoryId !== undefined)\n attr.push(`loCatId=\"${escapeXml(opts.layoutCategoryId)}\"`);\n if (opts.quickStyleTypeId !== undefined)\n attr.push(`qsTypeId=\"${escapeXml(opts.quickStyleTypeId)}\"`);\n if (opts.quickStyleCategoryId !== undefined)\n attr.push(`qsCatId=\"${escapeXml(opts.quickStyleCategoryId)}\"`);\n if (opts.colorStyleTypeId !== undefined)\n attr.push(`csTypeId=\"${escapeXml(opts.colorStyleTypeId)}\"`);\n if (opts.colorStyleCategoryId !== undefined)\n attr.push(`csCatId=\"${escapeXml(opts.colorStyleCategoryId)}\"`);\n\n if (attr.length === 0) return \"\";\n return `<dgm:prSet ${attr.join(\" \")}/>`;\n}\n\nfunction stringifyPointText(text: string): string {\n const body = text ? `<a:r><a:t>${escapeXml(text)}</a:t></a:r>` : \"\";\n return `<dgm:t><a:bodyPr/><a:lstStyle/><a:p>${body}</a:p></dgm:t>`;\n}\n","/**\n * CT_DataModel XML stringifier — assembles complete SmartArt data model XML.\n *\n * @module\n */\n\nimport { attr, attrBool, attrNum, findChild } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\n\nimport { stringifyConnection } from \"./connection\";\nimport { stringifyPoint } from \"./point\";\nimport type { PointPropertySetOptions } from \"./point\";\n\n/**\n * Build the complete dgm:dataModel XML from pre-serialized point and connection strings.\n */\nexport function stringifyDataModel(\n points: readonly string[],\n connections: readonly string[],\n): string {\n return [\n '<dgm:dataModel xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:dgm=\"http://schemas.openxmlformats.org/drawingml/2006/diagram\">',\n `<dgm:ptLst>${points.join(\"\")}</dgm:ptLst>`,\n `<dgm:cxnLst>${connections.join(\"\")}</dgm:cxnLst>`,\n \"<dgm:bg/>\",\n \"<dgm:whole/>\",\n \"</dgm:dataModel>\",\n ].join(\"\");\n}\n\n/** dgm:pt — one data-model point (dgm:pt, CT_Pt). */\nexport interface ModelPointOptions {\n /** Point identity (dgm:pt @modelId). */\n modelId: string;\n /** Point kind (dgm:pt @type, ST_PtType: node | doc | asst | parTrans | sibTrans). */\n type?: string;\n /** Transition point owning connection (dgm:pt @cxnId, transition points only). */\n connectionId?: string;\n /** Point text (dgm:t). */\n text?: string;\n propertySet?: PointPropertySetOptions;\n}\n\n/** dgm:cxn — one data-model connection (CT_Cxn). */\nexport interface ModelConnectionOptions {\n modelId: string;\n sourceId: string;\n destinationId: string;\n /** Connection kind (dgm:cxn @type, ST_CxnType: parOf | presOf | unknownRelationship). */\n type?: string;\n sourceOrder?: number;\n destinationOrder?: number;\n parentTransitionId?: string;\n siblingTransitionId?: string;\n presentationId?: string;\n}\n\n/** dgm:dataModel — structured point/connection model (CT_DataModel). */\nexport interface DataModelOptions {\n points?: ModelPointOptions[];\n connections?: ModelConnectionOptions[];\n}\n\n/**\n * Serialize a structured data model (dgm:dataModel). Inside a layoutDef the\n * part-level namespaces are already declared, so this emits the bare element.\n */\nexport function stringifyDataModelOptions(model: DataModelOptions): string {\n const points = (model.points ?? []).map((p) =>\n stringifyPoint(p.modelId, p.text ?? \"\", p.type ?? \"node\", p.propertySet, p.connectionId),\n );\n const connections = (model.connections ?? []).map((c) =>\n stringifyConnection({\n modelId: c.modelId,\n srcId: c.sourceId,\n destId: c.destinationId,\n type: c.type,\n srcOrd: c.sourceOrder,\n destOrd: c.destinationOrder,\n parTransId: c.parentTransitionId,\n sibTransId: c.siblingTransitionId,\n presId: c.presentationId,\n }),\n );\n return (\n \"<dgm:dataModel>\" +\n `<dgm:ptLst>${points.join(\"\")}</dgm:ptLst>` +\n `<dgm:cxnLst>${connections.join(\"\")}</dgm:cxnLst>` +\n \"<dgm:bg/>\" +\n \"<dgm:whole/>\" +\n \"</dgm:dataModel>\"\n );\n}\n\n/** Parse dgm:dataModel into the structured model. */\nexport function parseDataModelOptions(el: Element | undefined): DataModelOptions | undefined {\n if (!el) return undefined;\n const result: DataModelOptions = {};\n\n const ptLst = findChild(el, \"dgm:ptLst\");\n if (ptLst) {\n const points: ModelPointOptions[] = [];\n for (const pt of ptLst.elements ?? []) {\n if (pt.name !== \"dgm:pt\") continue;\n const point: ModelPointOptions = { modelId: attr(pt, \"modelId\") ?? \"\" };\n const type = attr(pt, \"type\");\n if (type) point.type = type;\n const cxnId = attr(pt, \"cxnId\");\n if (cxnId) point.connectionId = cxnId;\n const t = findChild(pt, \"dgm:t\");\n if (t) point.text = extractPointText(t);\n const prSet = findChild(pt, \"dgm:prSet\");\n if (prSet) point.propertySet = parsePointPropertySet(prSet);\n points.push(point);\n }\n result.points = points;\n }\n\n const cxnLst = findChild(el, \"dgm:cxnLst\");\n if (cxnLst) {\n const connections: ModelConnectionOptions[] = [];\n for (const cxn of cxnLst.elements ?? []) {\n if (cxn.name !== \"dgm:cxn\") continue;\n const connection: ModelConnectionOptions = {\n modelId: attr(cxn, \"modelId\") ?? \"\",\n sourceId: attr(cxn, \"srcId\") ?? \"\",\n destinationId: attr(cxn, \"destId\") ?? \"\",\n };\n const type = attr(cxn, \"type\");\n if (type) connection.type = type;\n const srcOrd = attrNum(cxn, \"srcOrd\");\n if (srcOrd !== undefined) connection.sourceOrder = srcOrd;\n const destOrd = attrNum(cxn, \"destOrd\");\n if (destOrd !== undefined) connection.destinationOrder = destOrd;\n const parTransId = attr(cxn, \"parTransId\");\n if (parTransId) connection.parentTransitionId = parTransId;\n const sibTransId = attr(cxn, \"sibTransId\");\n if (sibTransId) connection.siblingTransitionId = sibTransId;\n const presId = attr(cxn, \"presId\");\n if (presId) connection.presentationId = presId;\n connections.push(connection);\n }\n result.connections = connections;\n }\n\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n/** dgm:t holds an a:p paragraph tree; flatten its text runs. */\nfunction extractPointText(t: Element): string {\n let out = \"\";\n const walk = (node: Element) => {\n for (const child of node.elements ?? []) {\n if (child.type === \"text\") out += String(child.text ?? \"\");\n else walk(child);\n }\n };\n walk(t);\n return out;\n}\n\n/** Attribute names of dgm:prSet keyed by PointPropertySetOptions field. */\nconst PRSET_ATTRS: readonly (readonly [string, string, \"string\" | \"number\" | \"boolean\"])[] = [\n [\"presentationAssociationId\", \"presAssocID\", \"string\"],\n [\"presentationName\", \"presName\", \"string\"],\n [\"presentationStyleLabel\", \"presStyleLbl\", \"string\"],\n [\"presentationStyleIndex\", \"presStyleIdx\", \"number\"],\n [\"presentationStyleCount\", \"presStyleCnt\", \"number\"],\n [\"placeholderText\", \"phldrT\", \"string\"],\n [\"placeholder\", \"phldr\", \"boolean\"],\n [\"customAngle\", \"custAng\", \"number\"],\n [\"customFlipVertical\", \"custFlipVert\", \"boolean\"],\n [\"customFlipHorizontal\", \"custFlipHor\", \"boolean\"],\n [\"customSizeX\", \"custSzX\", \"number\"],\n [\"customSizeY\", \"custSzY\", \"number\"],\n [\"customScaleX\", \"custScaleX\", \"number\"],\n [\"customScaleY\", \"custScaleY\", \"number\"],\n [\"customText\", \"custT\", \"boolean\"],\n [\"customLinearFactorX\", \"custLinFactX\", \"number\"],\n [\"customLinearFactorY\", \"custLinFactY\", \"number\"],\n [\"customLinearFactorNeighborX\", \"custLinFactNeighborX\", \"number\"],\n [\"customLinearFactorNeighborY\", \"custLinFactNeighborY\", \"number\"],\n [\"customRadialScaleRadius\", \"custRadScaleRad\", \"number\"],\n [\"customRadialScaleIncrement\", \"custRadScaleInc\", \"number\"],\n [\"coherent3DOffset\", \"coherent3DOff\", \"boolean\"],\n [\"hideGeometry\", \"hideGeom\", \"boolean\"],\n [\"hideLastTransition\", \"hideLastTrans\", \"boolean\"],\n [\"lockTextEntry\", \"lkTxEntry\", \"boolean\"],\n [\"moveWith\", \"moveWith\", \"string\"],\n [\"useDefault\", \"useDef\", \"boolean\"],\n [\"zOrderOffset\", \"zOrderOff\", \"number\"],\n [\"layoutTypeId\", \"loTypeId\", \"string\"],\n [\"layoutCategoryId\", \"loCatId\", \"string\"],\n [\"quickStyleTypeId\", \"qsTypeId\", \"string\"],\n [\"quickStyleCategoryId\", \"qsCatId\", \"string\"],\n [\"colorStyleTypeId\", \"csTypeId\", \"string\"],\n [\"colorStyleCategoryId\", \"csCatId\", \"string\"],\n];\n\nfunction parsePointPropertySet(prSet: Element): PointPropertySetOptions {\n const result: Record<string, unknown> = {};\n for (const [field, xmlName, kind] of PRSET_ATTRS) {\n if (kind === \"number\") {\n const v = attrNum(prSet, xmlName);\n if (v !== undefined) result[field] = v;\n } else if (kind === \"boolean\") {\n const v = attrBool(prSet, xmlName);\n if (v !== undefined) result[field] = v;\n } else {\n const v = attr(prSet, xmlName);\n if (v !== undefined && v !== \"\") result[field] = v;\n }\n }\n return result as PointPropertySetOptions;\n}\n","/**\n * SmartArt layout definition (dgm:layoutDef, CT_DiagramDefinition) — the\n * authoring-layer model describing how a diagram arranges its shapes.\n *\n * Bidirectional: stringify builds the layoutDef part body, parse reads one\n * back into the same options shape, so custom layouts round-trip intact.\n *\n * Reference: ISO/IEC 29500-4, dml-diagram.xsd (CT_DiagramDefinition and the\n * CT_LayoutNode tree it contains).\n *\n * @module\n */\n\nimport { attr, attrNum, attrs, findChild } from \"@office-open/xml\";\nimport { OOXML_XML_DECLARATION } from \"@office-open/xml\";\nimport { stringify as stringifyInnerXml } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../descriptor\";\nimport type {\n DiagramCategoryOptions,\n DiagramDescriptionOptions,\n DiagramNameOptions,\n} from \"../drawing/diagram/headers\";\nimport type {\n AdjustOptions,\n AnimateOneByOne,\n AnimationLevel,\n HierBranch,\n} from \"../drawing/diagram/layout-vars\";\nimport { parseDataModelOptions, stringifyDataModelOptions } from \"./data-model\";\nimport type { DataModelOptions } from \"./data-model\";\n\n// ── Enumerations (ST_* from dml-diagram.xsd, verbatim token values) ──\n\n/** ST_AlgorithmType (dgm:alg @type). */\nexport type AlgorithmType =\n | \"composite\"\n | \"conn\"\n | \"cycle\"\n | \"hierChild\"\n | \"hierRoot\"\n | \"pyra\"\n | \"lin\"\n | \"sp\"\n | \"tx\"\n | \"snake\";\n\n/** ST_ConstraintRelationship (dgm:constr @for/@refFor). */\nexport type ConstraintRelationship = \"self\" | \"ch\" | \"des\";\n\n/** ST_ConstraintType (dgm:constr/@type/@refType, dgm:rule @type). */\nexport type ConstraintType =\n | \"none\"\n | \"alignOff\"\n | \"begMarg\"\n | \"bendDist\"\n | \"begPad\"\n | \"b\"\n | \"bMarg\"\n | \"bOff\"\n | \"ctrX\"\n | \"ctrXOff\"\n | \"ctrY\"\n | \"ctrYOff\"\n | \"connDist\"\n | \"diam\"\n | \"endMarg\"\n | \"endPad\"\n | \"h\"\n | \"hArH\"\n | \"hOff\"\n | \"l\"\n | \"lMarg\"\n | \"lOff\"\n | \"r\"\n | \"rMarg\"\n | \"rOff\"\n | \"primFontSz\"\n | \"pyraAcctRatio\"\n | \"secFontSz\"\n | \"sibSp\"\n | \"secSibSp\"\n | \"sp\"\n | \"stemThick\"\n | \"t\"\n | \"tMarg\"\n | \"tOff\"\n | \"userA\"\n | \"userB\"\n | \"userC\"\n | \"userD\"\n | \"userE\"\n | \"userF\"\n | \"userG\"\n | \"userH\"\n | \"userI\"\n | \"userJ\"\n | \"userK\"\n | \"userL\"\n | \"userM\"\n | \"userN\"\n | \"userO\"\n | \"userP\"\n | \"userQ\"\n | \"userR\"\n | \"userS\"\n | \"userT\"\n | \"userU\"\n | \"userV\"\n | \"userW\"\n | \"userX\"\n | \"userY\"\n | \"userZ\"\n | \"w\"\n | \"wArH\"\n | \"wOff\";\n\n/** ST_BoolOperator (dgm:constr @op). */\nexport type ConstraintOperator = \"none\" | \"equ\" | \"gte\" | \"lte\";\n\n/** ST_ChildOrderType (dgm:layoutNode @chOrder). */\nexport type ChildOrder = \"b\" | \"t\";\n\n/** ST_FunctionType (dgm:if @func). */\nexport type ConditionFunction =\n | \"cnt\"\n | \"pos\"\n | \"revPos\"\n | \"posEven\"\n | \"posOdd\"\n | \"var\"\n | \"depth\"\n | \"maxDepth\";\n\n/** ST_FunctionOperator (dgm:if @op). */\nexport type ConditionOperator = \"equ\" | \"neq\" | \"gt\" | \"lt\" | \"gte\" | \"lte\";\n\n/** ST_Direction (dgm:dir @val). */\nexport type DiagramDirection = \"norm\" | \"rev\";\n\n/** ST_ResizeHandlesStr (dgm:resizeHandles @val). */\nexport type ResizeHandles = \"exact\" | \"rel\";\n\n// ST_FunctionArgument / ST_FunctionValue are unions of every layout-parameter\n// enum plus numbers; ST_AxisTypes / ST_ElementTypes / ST_Booleans / ST_Ints are\n// space-separated lists — all surface as plain string.\n\n// dgm:title / dgm:desc reuse DiagramNameOptions / DiagramDescriptionOptions\n// (same CT_Name shape as the headers), dgm:cat reuses DiagramCategoryOptions,\n// and dgm:adjLst reuses AdjustOptions — all from drawing/diagram.\n\n// ── Shared building blocks ──\n\n/** dgm:sampData / dgm:styleData / dgm:clrData (CT_SampleData). */\nexport interface SampleDataOptions {\n /** Use the data model of the containing layout as sample (dgm:@useDef). */\n useDefault?: boolean;\n dataModel?: DataModelOptions;\n}\n\n/**\n * AG_IteratorAttributes — the traversal selector shared by presOf, forEach,\n * and when-branches. List-typed XSD attributes (axis, ptType, hideLastTrans,\n * st, cnt, step) surface as strings; single values read fine too.\n */\nexport interface DiagramIterationOptions {\n /** Selection axes, space-separated (dgm:@axis, ST_AxisTypes). */\n axis?: string;\n /** Selected point kinds, space-separated (dgm:@ptType, ST_ElementTypes). */\n pointType?: string;\n /** Hide the last transition point (dgm:@hideLastTrans, ST_Booleans). */\n hideLastTransition?: string;\n /** Start index (dgm:@st, ST_Ints). */\n start?: string;\n /** Iteration count (dgm:@cnt, ST_UnsignedInts). */\n count?: string;\n /** Index step (dgm:@step, ST_Ints). */\n step?: string;\n}\n\n/** dgm:alg (CT_Algorithm). */\nexport interface AlgorithmOptions {\n /** Layout algorithm (dgm:alg @type). */\n type: AlgorithmType;\n /** Revision counter (dgm:alg @rev). */\n revision?: number;\n /** Algorithm parameters (dgm:param*). */\n parameters?: AlgorithmParameterOptions[];\n}\n\n/** dgm:param (CT_Parameter) — inlined in AlgorithmOptions.parameters. */\nexport interface AlgorithmParameterOptions {\n /** Parameter name (dgm:param @type, ST_ParameterId). */\n type: string;\n /**\n * Parameter value (dgm:param @val, ST_ParameterVal — a union of direction\n * tokens, numbers, and booleans, so it stays polymorphic).\n */\n value: string | number | boolean;\n}\n\n/** dgm:shape (CT_Shape) — the geometry template a layout node renders as. */\nexport interface LayoutShapeOptions {\n /** Shape rotation as a raw double (dgm:shape @rot). */\n rotation?: number;\n /** Preset geometry name or \"none\"/\"conn\" (dgm:shape @type, ST_LayoutShapeType). */\n type?: string;\n /** Preview picture relationship id (dgm:shape @r:blip). */\n blip?: string;\n /** Z-order offset (dgm:shape @zOrderOff). */\n zOrderOffset?: number;\n /** Hide the shape geometry, keep the text (dgm:shape @hideGeom). */\n hideGeometry?: boolean;\n /** Lock text entry (dgm:shape @lkTxEntry). */\n lockTextEntry?: boolean;\n /** Use the picture placeholder (dgm:shape @blipPhldr). */\n blipPlaceholder?: boolean;\n /** Geometry adjustment values (dgm:adjLst). */\n adjustments?: AdjustOptions[];\n}\n\n/** dgm:constr (CT_Constraint). */\nexport interface ConstraintOptions {\n /** Constrained dimension (dgm:constr @type). */\n type: ConstraintType;\n /** Related point the constraint applies to (dgm:constr @for). */\n for?: ConstraintRelationship;\n /** Layout-node name the constraint applies to (dgm:constr @forName). */\n forName?: string;\n /** Point kinds the constraint applies to (dgm:constr @ptType). */\n pointType?: string;\n /** Referenced dimension (dgm:constr @refType). */\n referenceType?: ConstraintType;\n /** Relationship of the referenced point (dgm:constr @refFor). */\n referenceFor?: ConstraintRelationship;\n /** Layout-node name of the referenced point (dgm:constr @refForName). */\n referenceForName?: string;\n /** Point kinds of the referenced point (dgm:constr @refPtType). */\n referencePointType?: string;\n /** How the reference combines with val (dgm:constr @op). */\n operation?: ConstraintOperator;\n /** Absolute value (dgm:constr @val). */\n value?: number;\n /** Factor applied to the reference (dgm:constr @fact). */\n factor?: number;\n}\n\n/** dgm:rule (CT_NumericRule). */\nexport interface LayoutRuleOptions {\n /** Rule dimension (dgm:rule @type). */\n type: ConstraintType;\n for?: ConstraintRelationship;\n forName?: string;\n pointType?: string;\n /** Preferred value (dgm:rule @val). */\n value?: number;\n /** Multiplied factor (dgm:rule @fact). */\n factor?: number;\n /** Upper bound (dgm:rule @max). */\n maximum?: number;\n}\n\n/** dgm:varLst (CT_LayoutVariablePropertySet). */\nexport interface VariableListOptions {\n /** This is an organization chart (dgm:orgChart @val). */\n organizationChart?: boolean;\n /** Maximum children per parent (dgm:chMax @val). */\n childMaximum?: number;\n /** Preferred children per parent (dgm:chPref @val). */\n childPreferred?: number;\n /** Bullets enabled on text nodes (dgm:bulletEnabled @val). */\n bulletEnabled?: boolean;\n /** Reading direction (dgm:dir @val). */\n direction?: DiagramDirection;\n /** Branch style for hierarchy layouts (dgm:hierBranch @val). */\n hierarchyBranchStyle?: HierBranch;\n /** Animate siblings one by one or as a branch (dgm:animOne @val). */\n animateOne?: AnimateOneByOne;\n /** Animate by level or from center (dgm:animLvl @val). */\n animateLevel?: AnimationLevel;\n /** Resize-handle behavior (dgm:resizeHandles @val). */\n resizeHandles?: ResizeHandles;\n}\n\n/** One alternative inside a choose — dgm:if (CT_When); `if` is a reserved word. */\nexport interface WhenOptions extends DiagramIterationOptions {\n name?: string;\n /** Selection function (dgm:if @func). */\n function: ConditionFunction;\n /** Function argument, usually a variable name (dgm:if @arg). */\n argument?: string;\n /** Comparison operator (dgm:if @op). */\n operator: ConditionOperator;\n /** Comparison value (dgm:if @val, ST_FunctionValue union). */\n value: string;\n children?: LayoutNodeChild[];\n}\n\n/** dgm:else (CT_Otherwise). */\nexport interface OtherwiseOptions {\n name?: string;\n children?: LayoutNodeChild[];\n}\n\n/** dgm:choose (CT_Choose): pick the first matching condition. */\nexport interface ChooseOptions {\n name?: string;\n /** Alternatives in priority order (dgm:if*, CT_When). */\n conditions: WhenOptions[];\n /** Fallback branch (dgm:else, CT_Otherwise). */\n otherwise?: OtherwiseOptions;\n}\n\n/**\n * The unordered, repeatable choice content of dgm:layoutNode / dgm:forEach /\n * dgm:if / dgm:else, as single-key objects so both order and repetition\n * round-trip (same pattern as paragraph children in the format packages).\n */\nexport type LayoutNodeChild =\n | { algorithm: AlgorithmOptions }\n | { shape: LayoutShapeOptions }\n | { presentationOf: DiagramIterationOptions }\n | { constraints: ConstraintOptions[] }\n | { rules: LayoutRuleOptions[] }\n | { variables: VariableListOptions }\n | { forEach: ForEachOptions }\n | { layoutNode: LayoutNodeOptions }\n | { choose: ChooseOptions };\n\n/** dgm:layoutNode (CT_LayoutNode) — one node of the layout tree. */\nexport interface LayoutNodeOptions {\n /** Unique name referenced by constraints and moveWith (dgm:@name). */\n name?: string;\n /** Formatting slot from styleDef/colorsDef (dgm:@styleLbl). */\n styleLabel?: string;\n /** Child ordering: bottom-first \"b\" or top-first \"t\" (dgm:@chOrder). */\n childOrder?: ChildOrder;\n /** Move with another named layout node (dgm:@moveWith). */\n moveWith?: string;\n children?: LayoutNodeChild[];\n /** Raw a:extLst inner XML — verbatim round-trip. */\n ext?: string;\n}\n\n/** dgm:forEach (CT_ForEach) — apply children to each selected point. */\nexport interface ForEachOptions extends DiagramIterationOptions {\n name?: string;\n /** Reference to a named layout node instead of inline children (dgm:@ref). */\n reference?: string;\n children?: LayoutNodeChild[];\n}\n\n/** dgm:layoutDef (CT_DiagramDefinition) — the layoutDef part root. */\nexport interface LayoutDefinitionOptions {\n /** Layout identity URI (dgm:layoutDef @uniqueId). */\n uniqueId?: string;\n /** Minimum Office version (dgm:layoutDef @minVer). */\n minVer?: string;\n /** Default quick-style label (dgm:layoutDef @defStyle). */\n defaultStyle?: string;\n /** Localized titles (dgm:title*). */\n titles?: DiagramNameOptions[];\n /** Localized descriptions (dgm:desc*). */\n descriptions?: DiagramDescriptionOptions[];\n /** Gallery categories (dgm:catLst). */\n categories?: DiagramCategoryOptions[];\n /** Sample data shown in the picker (dgm:sampData). */\n sampleData?: SampleDataOptions;\n /** Sample data styled for the quick style preview (dgm:styleData). */\n styleData?: SampleDataOptions;\n /** Sample data colored for the colors preview (dgm:clrData). */\n colorData?: SampleDataOptions;\n /** The layout tree (dgm:layoutNode, required). */\n layoutNode: LayoutNodeOptions;\n /** Raw a:extLst inner XML — verbatim round-trip. */\n ext?: string;\n}\n\n// ── Stringify ──\n\nfunction emitParameterValue(value: string | number | boolean): string {\n return typeof value === \"boolean\" ? (value ? \"1\" : \"0\") : String(value);\n}\n\nfunction stringifyAlgorithm(o: AlgorithmOptions): string {\n const params = (o.parameters ?? [])\n .map((p) => attrs({ type: p.type, val: emitParameterValue(p.value) }))\n .map((a) => `<dgm:param${a}/>`)\n .join(\"\");\n return `<dgm:alg${attrs({ type: o.type, rev: o.revision })}>${params}</dgm:alg>`;\n}\n\nfunction stringifyShape(o: LayoutShapeOptions): string {\n const adjustments = (o.adjustments ?? [])\n .map((a) => `<dgm:adj${attrs({ idx: a.idx, val: a.val })}/>`)\n .join(\"\");\n const adjLst = o.adjustments ? `<dgm:adjLst>${adjustments}</dgm:adjLst>` : \"\";\n const attrStr = attrs({\n rot: o.rotation,\n type: o.type,\n \"r:blip\": o.blip,\n zOrderOff: o.zOrderOffset,\n hideGeom: booleanAttr(o.hideGeometry),\n lkTxEntry: booleanAttr(o.lockTextEntry),\n blipPhldr: booleanAttr(o.blipPlaceholder),\n });\n return `<dgm:shape${attrStr}>${adjLst}</dgm:shape>`;\n}\n\nfunction stringifyConstraints(list: readonly ConstraintOptions[]): string {\n const items = list\n .map((c) => {\n const base = attrs({\n type: c.type,\n for: c.for,\n forName: c.forName,\n ptType: c.pointType,\n refType: c.referenceType,\n refFor: c.referenceFor,\n refForName: c.referenceForName,\n refPtType: c.referencePointType,\n op: c.operation,\n val: c.value,\n });\n const fact = c.factor !== undefined ? ` fact=\"${c.factor}\"` : \"\";\n return `<dgm:constr${base}${fact}/>`;\n })\n .join(\"\");\n return `<dgm:constrLst>${items}</dgm:constrLst>`;\n}\n\nfunction stringifyRules(list: readonly LayoutRuleOptions[]): string {\n const items = list\n .map((r) => {\n const base = attrs({\n type: r.type,\n for: r.for,\n forName: r.forName,\n ptType: r.pointType,\n val: r.value,\n max: r.maximum,\n });\n const fact = r.factor !== undefined ? ` fact=\"${r.factor}\"` : \"\";\n return `<dgm:rule${base}${fact}/>`;\n })\n .join(\"\");\n return `<dgm:ruleLst>${items}</dgm:ruleLst>`;\n}\n\nfunction stringifyVariables(o: VariableListOptions): string {\n const emit = (tag: string, value: string | number | boolean | undefined) =>\n value === undefined ? \"\" : `<dgm:${tag}${attrs({ val: value })}/>`;\n return (\n \"<dgm:varLst>\" +\n emit(\"orgChart\", booleanAttr(o.organizationChart)) +\n emit(\"chMax\", o.childMaximum) +\n emit(\"chPref\", o.childPreferred) +\n emit(\"bulletEnabled\", booleanAttr(o.bulletEnabled)) +\n emit(\"dir\", o.direction) +\n emit(\"hierBranch\", o.hierarchyBranchStyle) +\n emit(\"animOne\", o.animateOne) +\n emit(\"animLvl\", o.animateLevel) +\n emit(\"resizeHandles\", o.resizeHandles) +\n \"</dgm:varLst>\"\n );\n}\n\n/** Boolean options emit \"1\"/\"0\" when set; undefined stays absent. */\nfunction booleanAttr(value: boolean | undefined): string | number | undefined {\n return value === undefined ? undefined : value ? \"1\" : \"0\";\n}\n\nfunction selfClose(tag: string, record: Record<string, string | number | undefined>): string {\n return `<${tag}${attrs(record)}/>`;\n}\n\nfunction stringifyChildren(children: readonly LayoutNodeChild[] | undefined): string {\n let out = \"\";\n for (const child of children ?? []) {\n if (\"algorithm\" in child) out += stringifyAlgorithm(child.algorithm);\n else if (\"shape\" in child) out += stringifyShape(child.shape);\n else if (\"presentationOf\" in child)\n out += selfClose(\"dgm:presOf\", {\n axis: child.presentationOf.axis,\n ptType: child.presentationOf.pointType,\n hideLastTrans: child.presentationOf.hideLastTransition,\n st: child.presentationOf.start,\n cnt: child.presentationOf.count,\n step: child.presentationOf.step,\n });\n else if (\"constraints\" in child) out += stringifyConstraints(child.constraints);\n else if (\"rules\" in child) out += stringifyRules(child.rules);\n else if (\"variables\" in child) out += stringifyVariables(child.variables);\n else if (\"forEach\" in child) out += stringifyForEach(child.forEach);\n else if (\"layoutNode\" in child) out += stringifyLayoutNode(child.layoutNode);\n else if (\"choose\" in child) out += stringifyChoose(child.choose);\n }\n return out;\n}\n\nfunction stringifyLayoutNode(o: LayoutNodeOptions): string {\n const body = stringifyChildren(o.children) + (o.ext ? `<a:extLst>${o.ext}</a:extLst>` : \"\");\n return `<dgm:layoutNode${attrs({\n name: o.name,\n styleLbl: o.styleLabel,\n chOrder: o.childOrder,\n moveWith: o.moveWith,\n })}>${body}</dgm:layoutNode>`;\n}\n\nfunction stringifyForEach(o: ForEachOptions): string {\n const attrStr = attrs({ name: o.name, ref: o.reference, ...iterationRecord(o) });\n return `<dgm:forEach${attrStr}>${stringifyChildren(o.children)}</dgm:forEach>`;\n}\n\nfunction stringifyWhen(o: WhenOptions): string {\n const attrStr = attrs({\n name: o.name,\n ...iterationRecord(o),\n func: o.function,\n arg: o.argument,\n op: o.operator,\n val: o.value,\n });\n return `<dgm:if${attrStr}>${stringifyChildren(o.children)}</dgm:if>`;\n}\n\nfunction stringifyOtherwise(o: OtherwiseOptions): string {\n return `<dgm:else${attrs({ name: o.name })}>${stringifyChildren(o.children)}</dgm:else>`;\n}\n\nfunction stringifyChoose(o: ChooseOptions): string {\n const body =\n o.conditions.map(stringifyWhen).join(\"\") + (o.otherwise ? stringifyOtherwise(o.otherwise) : \"\");\n return `<dgm:choose${attrs({ name: o.name })}>${body}</dgm:choose>`;\n}\n\nfunction iterationRecord(o: DiagramIterationOptions): Record<string, string | undefined> {\n return {\n axis: o.axis,\n ptType: o.pointType,\n hideLastTrans: o.hideLastTransition,\n st: o.start,\n cnt: o.count,\n step: o.step,\n };\n}\n\nfunction stringifyLocalizedString(\n tag: string,\n o: DiagramNameOptions | DiagramDescriptionOptions,\n): string {\n return `<dgm:${tag}${attrs({ lang: o.lang, val: o.val })}/>`;\n}\n\nfunction stringifySampleData(tag: string, o: SampleDataOptions | undefined): string {\n if (!o) return \"\";\n const body = o.dataModel ? stringifyDataModelOptions(o.dataModel) : \"\";\n return `<dgm:${tag}${attrs({ useDef: booleanAttr(o.useDefault) })}>${body}</dgm:${tag}>`;\n}\n\n/**\n * Serialize a layout definition to the dgm:layoutDef element (no XML\n * declaration, no namespace declarations — the part wrapper adds both).\n */\nexport function stringifyLayoutDefinition(o: LayoutDefinitionOptions): string {\n const body =\n (o.titles ?? []).map((t) => stringifyLocalizedString(\"title\", t)).join(\"\") +\n (o.descriptions ?? []).map((d) => stringifyLocalizedString(\"desc\", d)).join(\"\") +\n (o.categories?.length\n ? `<dgm:catLst>${o.categories\n .map((c) => selfClose(\"dgm:cat\", { type: c.type, pri: c.pri }))\n .join(\"\")}</dgm:catLst>`\n : \"\") +\n stringifySampleData(\"sampData\", o.sampleData) +\n stringifySampleData(\"styleData\", o.styleData) +\n stringifySampleData(\"clrData\", o.colorData) +\n stringifyLayoutNode(o.layoutNode) +\n (o.ext ? `<a:extLst>${o.ext}</a:extLst>` : \"\");\n return `<dgm:layoutDef${attrs({\n uniqueId: o.uniqueId,\n minVer: o.minVer,\n defStyle: o.defaultStyle,\n })}>${body}</dgm:layoutDef>`;\n}\n\nconst DGM_NS = \"http://schemas.openxmlformats.org/drawingml/2006/diagram\";\nconst A_NS = \"http://schemas.openxmlformats.org/drawingml/2006/main\";\n\n/**\n * Inject the part-level dgm/a namespace declarations into the root element of\n * a serialized layoutDef/styleDef/colorsDef body.\n */\nexport function withDiagramNamespaces(xml: string): string {\n return xml.replace(\n /^<dgm:(layoutDef|styleDef|colorsDef)/,\n `<dgm:$1 xmlns:dgm=\"${DGM_NS}\" xmlns:a=\"${A_NS}\"`,\n );\n}\n\n// ── Parse ──\n\nfunction readIteration(el: Element): DiagramIterationOptions {\n const result: Partial<DiagramIterationOptions> = {};\n const axis = attr(el, \"axis\");\n if (axis !== undefined) result.axis = axis;\n const ptType = attr(el, \"ptType\");\n if (ptType !== undefined) result.pointType = ptType;\n const hideLastTrans = attr(el, \"hideLastTrans\");\n if (hideLastTrans !== undefined) result.hideLastTransition = hideLastTrans;\n const st = attr(el, \"st\");\n if (st !== undefined) result.start = st;\n const cnt = attr(el, \"cnt\");\n if (cnt !== undefined) result.count = cnt;\n const step = attr(el, \"step\");\n if (step !== undefined) result.step = step;\n return result as DiagramIterationOptions;\n}\n\nfunction parseAlgorithm(el: Element): AlgorithmOptions {\n const result: Partial<AlgorithmOptions> = {\n type: (attr(el, \"type\") ?? \"composite\") as AlgorithmType,\n };\n const rev = attrNum(el, \"rev\");\n if (rev !== undefined) result.revision = rev;\n const parameters: AlgorithmParameterOptions[] = [];\n for (const child of el.elements ?? []) {\n if (child.name !== \"dgm:param\") continue;\n const raw = attr(child, \"val\") ?? \"\";\n const numeric = Number(raw);\n parameters.push({\n type: attr(child, \"type\") ?? \"\",\n value:\n raw === \"1\" || raw === \"0\"\n ? raw === \"1\"\n : Number.isFinite(numeric) && raw.trim() !== \"\"\n ? numeric\n : raw,\n });\n }\n if (parameters.length) result.parameters = parameters;\n return result as AlgorithmOptions;\n}\n\nfunction parseShape(el: Element): LayoutShapeOptions {\n const result: Partial<LayoutShapeOptions> = {};\n const rot = attrNum(el, \"rot\");\n if (rot !== undefined) result.rotation = rot;\n const type = attr(el, \"type\");\n if (type !== undefined && type !== \"none\") result.type = type;\n const blip = attr(el, \"r:blip\");\n if (blip) result.blip = blip;\n const zOrderOff = attrNum(el, \"zOrderOff\");\n if (zOrderOff !== undefined) result.zOrderOffset = zOrderOff;\n const hideGeom = attr(el, \"hideGeom\");\n if (hideGeom !== undefined) result.hideGeometry = hideGeom === \"1\" || hideGeom === \"true\";\n const lkTxEntry = attr(el, \"lkTxEntry\");\n if (lkTxEntry !== undefined) result.lockTextEntry = lkTxEntry === \"1\" || lkTxEntry === \"true\";\n const blipPhldr = attr(el, \"blipPhldr\");\n if (blipPhldr !== undefined) result.blipPlaceholder = blipPhldr === \"1\" || blipPhldr === \"true\";\n const adjLst = findChild(el, \"dgm:adjLst\");\n if (adjLst) {\n const adjustments: AdjustOptions[] = [];\n for (const adj of adjLst.elements ?? []) {\n if (adj.name !== \"dgm:adj\") continue;\n const idx = attrNum(adj, \"idx\");\n const val = attrNum(adj, \"val\");\n if (idx !== undefined && val !== undefined) adjustments.push({ idx, val });\n }\n if (adjustments.length) result.adjustments = adjustments;\n }\n return result as LayoutShapeOptions;\n}\n\nfunction parseConstraint(el: Element): ConstraintOptions {\n const result: Partial<ConstraintOptions> = {\n type: (attr(el, \"type\") ?? \"none\") as ConstraintType,\n };\n const forRel = attr(el, \"for\");\n if (forRel !== undefined) result.for = forRel as ConstraintRelationship;\n const forName = attr(el, \"forName\");\n if (forName !== undefined && forName !== \"\") result.forName = forName;\n const ptType = attr(el, \"ptType\");\n if (ptType !== undefined && ptType !== \"all\") result.pointType = ptType;\n const refType = attr(el, \"refType\");\n if (refType !== undefined && refType !== \"none\") result.referenceType = refType as ConstraintType;\n const refFor = attr(el, \"refFor\");\n if (refFor !== undefined && refFor !== \"self\")\n result.referenceFor = refFor as ConstraintRelationship;\n const refForName = attr(el, \"refForName\");\n if (refForName !== undefined && refForName !== \"\") result.referenceForName = refForName;\n const refPtType = attr(el, \"refPtType\");\n if (refPtType !== undefined && refPtType !== \"all\") result.referencePointType = refPtType;\n const op = attr(el, \"op\");\n if (op !== undefined && op !== \"none\") result.operation = op as ConstraintOperator;\n const val = finiteAttr(el, \"val\");\n if (val !== undefined) result.value = val;\n const fact = finiteAttr(el, \"fact\");\n if (fact !== undefined && fact !== 1) result.factor = fact;\n return result as ConstraintOptions;\n}\n\nfunction parseRule(el: Element): LayoutRuleOptions {\n const result: Partial<LayoutRuleOptions> = {\n type: (attr(el, \"type\") ?? \"none\") as ConstraintType,\n };\n const forRel = attr(el, \"for\");\n if (forRel !== undefined && forRel !== \"self\") result.for = forRel as ConstraintRelationship;\n const forName = attr(el, \"forName\");\n if (forName !== undefined && forName !== \"\") result.forName = forName;\n const ptType = attr(el, \"ptType\");\n if (ptType !== undefined && ptType !== \"all\") result.pointType = ptType;\n const val = finiteAttr(el, \"val\");\n if (val !== undefined) result.value = val;\n const fact = finiteAttr(el, \"fact\");\n if (fact !== undefined) result.factor = fact;\n const max = finiteAttr(el, \"max\");\n if (max !== undefined) result.maximum = max;\n return result as LayoutRuleOptions;\n}\n\n/** Numeric attribute read; the XSD NaN default comes back as undefined. */\nfunction finiteAttr(el: Element, name: string): number | undefined {\n const raw = attr(el, name);\n if (raw === undefined) return undefined;\n const n = Number(raw);\n return Number.isFinite(n) ? n : undefined;\n}\n\nfunction parseVariables(el: Element): VariableListOptions {\n const result: Partial<VariableListOptions> = {};\n const readBool = (tag: string) => {\n for (const child of el.elements ?? []) {\n if (child.name !== `dgm:${tag}`) continue;\n const v = attr(child, \"val\") ?? \"1\";\n return v === \"1\" || v === \"true\";\n }\n return undefined;\n };\n const readEnum = (tag: string) => {\n for (const child of el.elements ?? []) {\n if (child.name !== `dgm:${tag}`) continue;\n return attr(child, \"val\") ?? \"\";\n }\n return undefined;\n };\n const readNumber = (tag: string) => {\n for (const child of el.elements ?? []) {\n if (child.name !== `dgm:${tag}`) continue;\n const v = attrNum(child, \"val\");\n return v === -1 ? undefined : v;\n }\n return undefined;\n };\n const orgChart = readBool(\"orgChart\");\n if (orgChart !== undefined) result.organizationChart = orgChart;\n const chMax = readNumber(\"chMax\");\n if (chMax !== undefined) result.childMaximum = chMax;\n const chPref = readNumber(\"chPref\");\n if (chPref !== undefined) result.childPreferred = chPref;\n const bulletEnabled = readBool(\"bulletEnabled\");\n if (bulletEnabled !== undefined) result.bulletEnabled = bulletEnabled;\n const direction = readEnum(\"dir\");\n if (direction) result.direction = direction as DiagramDirection;\n const hierBranch = readEnum(\"hierBranch\");\n if (hierBranch) result.hierarchyBranchStyle = hierBranch as HierBranch;\n const animOne = readEnum(\"animOne\");\n if (animOne) result.animateOne = animOne as AnimateOneByOne;\n const animLvl = readEnum(\"animLvl\");\n if (animLvl) result.animateLevel = animLvl as AnimationLevel;\n const resizeHandles = readEnum(\"resizeHandles\");\n if (resizeHandles) result.resizeHandles = resizeHandles as ResizeHandles;\n return result as VariableListOptions;\n}\n\nfunction parseChildren(el: Element): LayoutNodeChild[] | undefined {\n const children: LayoutNodeChild[] = [];\n for (const child of el.elements ?? []) {\n switch (child.name) {\n case \"dgm:alg\":\n children.push({ algorithm: parseAlgorithm(child) });\n break;\n case \"dgm:shape\":\n children.push({ shape: parseShape(child) });\n break;\n case \"dgm:presOf\":\n children.push({ presentationOf: readIteration(child) });\n break;\n case \"dgm:constrLst\":\n children.push({\n constraints: (child.elements ?? [])\n .filter((c) => c.name === \"dgm:constr\")\n .map(parseConstraint),\n });\n break;\n case \"dgm:ruleLst\":\n children.push({\n rules: (child.elements ?? []).filter((c) => c.name === \"dgm:rule\").map(parseRule),\n });\n break;\n case \"dgm:varLst\":\n children.push({ variables: parseVariables(child) });\n break;\n case \"dgm:forEach\":\n children.push({ forEach: parseForEach(child) });\n break;\n case \"dgm:layoutNode\":\n children.push({ layoutNode: parseLayoutNode(child) });\n break;\n case \"dgm:choose\":\n children.push({ choose: parseChoose(child) });\n break;\n default:\n break;\n }\n }\n return children.length ? children : undefined;\n}\n\nfunction parseLayoutNode(el: Element): LayoutNodeOptions {\n const result: Partial<LayoutNodeOptions> = {};\n const name = attr(el, \"name\");\n if (name) result.name = name;\n const styleLbl = attr(el, \"styleLbl\");\n if (styleLbl) result.styleLabel = styleLbl;\n const chOrder = attr(el, \"chOrder\");\n if (chOrder !== undefined && chOrder !== \"b\") result.childOrder = chOrder as ChildOrder;\n const moveWith = attr(el, \"moveWith\");\n if (moveWith) result.moveWith = moveWith;\n const children = parseChildren(el);\n if (children) result.children = children;\n const extLst = findChild(el, \"a:extLst\");\n if (extLst) result.ext = stringifyInnerXml(extLst);\n return result as LayoutNodeOptions;\n}\n\nfunction parseForEach(el: Element): ForEachOptions {\n const result: Partial<ForEachOptions> = readIteration(el);\n const name = attr(el, \"name\");\n if (name) result.name = name;\n const ref = attr(el, \"ref\");\n if (ref) result.reference = ref;\n const children = parseChildren(el);\n if (children) result.children = children;\n return result as ForEachOptions;\n}\n\nfunction parseWhen(el: Element): WhenOptions {\n const result: Partial<WhenOptions> = {\n ...readIteration(el),\n function: (attr(el, \"func\") ?? \"cnt\") as ConditionFunction,\n operator: (attr(el, \"op\") ?? \"equ\") as ConditionOperator,\n value: attr(el, \"val\") ?? \"\",\n };\n const name = attr(el, \"name\");\n if (name) result.name = name;\n const arg = attr(el, \"arg\");\n if (arg !== undefined && arg !== \"none\") result.argument = arg;\n const children = parseChildren(el);\n if (children) result.children = children;\n return result as WhenOptions;\n}\n\nfunction parseChoose(el: Element): ChooseOptions {\n const conditions: WhenOptions[] = [];\n let otherwise: OtherwiseOptions | undefined;\n for (const child of el.elements ?? []) {\n if (child.name === \"dgm:if\") conditions.push(parseWhen(child));\n else if (child.name === \"dgm:else\") otherwise = parseOtherwise(child);\n }\n const result: Partial<ChooseOptions> = { conditions };\n const name = attr(el, \"name\");\n if (name) result.name = name;\n if (otherwise) result.otherwise = otherwise;\n return result as ChooseOptions;\n}\n\nfunction parseOtherwise(el: Element): OtherwiseOptions {\n const result: Partial<OtherwiseOptions> = {};\n const name = attr(el, \"name\");\n if (name) result.name = name;\n const children = parseChildren(el);\n if (children) result.children = children;\n return result as OtherwiseOptions;\n}\n\nfunction parseLocalizedStrings(\n el: Element,\n tag: string,\n): DiagramNameOptions[] | DiagramDescriptionOptions[] | undefined {\n const out: (DiagramNameOptions | DiagramDescriptionOptions)[] = [];\n for (const child of el.elements ?? []) {\n if (child.name !== `dgm:${tag}`) continue;\n const val = attr(child, \"val\") ?? \"\";\n const lang = attr(child, \"lang\");\n out.push(lang ? { lang, val } : { val });\n }\n return out.length ? (out as DiagramNameOptions[]) : undefined;\n}\n\nfunction parseSampleData(el: Element | undefined): SampleDataOptions | undefined {\n if (!el) return undefined;\n const result: Partial<SampleDataOptions> = {};\n const useDef = attr(el, \"useDef\");\n if (useDef !== undefined) result.useDefault = useDef === \"1\" || useDef === \"true\";\n const dataModel = parseDataModelOptions(findChild(el, \"dgm:dataModel\"));\n if (dataModel) result.dataModel = dataModel;\n return Object.keys(result).length ? (result as SampleDataOptions) : {};\n}\n\n/** Parse a dgm:layoutDef element into options. */\nexport function parseLayoutDefinition(el: Element): LayoutDefinitionOptions {\n const root = el.name === \"dgm:layoutDef\" ? el : (findChild(el, \"dgm:layoutDef\") ?? el);\n const result: Partial<LayoutDefinitionOptions> = {};\n const uniqueId = attr(root, \"uniqueId\");\n if (uniqueId) result.uniqueId = uniqueId;\n const minVer = attr(root, \"minVer\");\n if (minVer) result.minVer = minVer;\n const defStyle = attr(root, \"defStyle\");\n if (defStyle) result.defaultStyle = defStyle;\n const titles = parseLocalizedStrings(root, \"title\");\n if (titles) result.titles = titles;\n const descriptions = parseLocalizedStrings(root, \"desc\");\n if (descriptions) result.descriptions = descriptions;\n const catLst = findChild(root, \"dgm:catLst\");\n if (catLst) {\n const categories = (catLst.elements ?? [])\n .filter((c) => c.name === \"dgm:cat\")\n .map((c) => ({ type: attr(c, \"type\") ?? \"\", pri: attrNum(c, \"pri\") ?? 0 }));\n if (categories.length) result.categories = categories;\n }\n const sampleData = parseSampleData(findChild(root, \"dgm:sampData\"));\n if (sampleData) result.sampleData = sampleData;\n const styleData = parseSampleData(findChild(root, \"dgm:styleData\"));\n if (styleData) result.styleData = styleData;\n const colorData = parseSampleData(findChild(root, \"dgm:clrData\"));\n if (colorData) result.colorData = colorData;\n const layoutNode = findChild(root, \"dgm:layoutNode\");\n if (layoutNode) result.layoutNode = parseLayoutNode(layoutNode);\n const extLst = findChild(root, \"a:extLst\");\n if (extLst) result.ext = stringifyInnerXml(extLst);\n return result as LayoutDefinitionOptions;\n}\n\n/** layoutDef part descriptor — stringify emits the element, parse reads it. */\nexport const layoutDefDesc: CustomDescriptor<LayoutDefinitionOptions> = {\n kind: \"custom\",\n stringify: (opts: LayoutDefinitionOptions) => stringifyLayoutDefinition(opts),\n parse: (el: Element) => parseLayoutDefinition(el),\n};\n\n/** Full layoutDef part body: XML declaration + namespaces + the element. */\nexport function stringifyLayoutDefinitionPart(o: LayoutDefinitionOptions): string {\n return OOXML_XML_DECLARATION + withDiagramNamespaces(stringifyLayoutDefinition(o));\n}\n","/**\n * SmartArt color-transform definition (dgm:colorsDef, CT_ColorTransform) —\n * the authoring-layer model mapping style labels to color lists.\n *\n * Bidirectional: stringify builds the colors part body, parse reads one back\n * into the same options shape, so custom color transforms round-trip intact.\n *\n * Reference: ISO/IEC 29500-4, dml-diagram.xsd (CT_ColorTransform,\n * CT_CTStyleLabel, CT_Colors with its EG_ColorChoice children).\n *\n * @module\n */\n\nimport { attr, attrs, findChild } from \"@office-open/xml\";\nimport { OOXML_XML_DECLARATION } from \"@office-open/xml\";\nimport { stringify as stringifyInnerXml } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../descriptor\";\nimport { createColorList, parseColorList } from \"../drawing/diagram/diagram-style\";\nimport type { ColorListOptions, ColorStyleLabelOptions } from \"../drawing/diagram/diagram-style\";\nimport type {\n DiagramCategoryOptions,\n DiagramDescriptionOptions,\n DiagramNameOptions,\n} from \"../drawing/diagram/headers\";\nimport { withDiagramNamespaces } from \"./layout-definition\";\n\n/** dgm:colorsDef (CT_ColorTransform) — the colors part root. */\nexport interface ColorDefinitionOptions {\n /** Color-transform identity URI (dgm:colorsDef @uniqueId). */\n uniqueId?: string;\n /** Minimum Office version (dgm:colorsDef @minVer). */\n minVer?: string;\n /** Localized titles (dgm:title*). */\n titles?: DiagramNameOptions[];\n /** Localized descriptions (dgm:desc*). */\n descriptions?: DiagramDescriptionOptions[];\n /** Gallery categories (dgm:catLst). */\n categories?: DiagramCategoryOptions[];\n /** Color slots, at least one in a real part (dgm:styleLbl*). */\n styleLabels?: ColorStyleLabelOptions[];\n /** Raw a:extLst inner XML — verbatim round-trip. */\n ext?: string;\n}\n\n// CT_CTStyleLabel color lists in schema order: fill, line, effect, text line,\n// text fill, text effect.\nconst COLOR_LIST_FIELDS: readonly (readonly [string, keyof ColorStyleLabelOptions])[] = [\n [\"fillClrLst\", \"fillColorList\"],\n [\"linClrLst\", \"lineColorList\"],\n [\"effectClrLst\", \"effectColorList\"],\n [\"txLinClrLst\", \"textLineColorList\"],\n [\"txFillClrLst\", \"textFillColorList\"],\n [\"txEffectClrLst\", \"textEffectColorList\"],\n];\n\n// ── Stringify ──\n\nfunction stringifyLocalized(\n tag: string,\n o: DiagramNameOptions | DiagramDescriptionOptions,\n): string {\n return `<dgm:${tag}${attrs({ lang: o.lang, val: o.val })}/>`;\n}\n\nfunction stringifyColorStyleLabel(o: ColorStyleLabelOptions): string {\n let body = \"\";\n for (const [tag, field] of COLOR_LIST_FIELDS) {\n const list = o[field] as ColorListOptions | undefined;\n if (list) body += createColorList(`dgm:${tag}`, list);\n }\n return `<dgm:styleLbl${attrs({ name: o.name })}>${body}</dgm:styleLbl>`;\n}\n\n/**\n * Serialize a color-transform definition to the dgm:colorsDef element (no XML\n * declaration, no namespace declarations — the part wrapper adds both).\n */\nexport function stringifyColorDefinition(o: ColorDefinitionOptions): string {\n const body =\n (o.titles ?? []).map((t) => stringifyLocalized(\"title\", t)).join(\"\") +\n (o.descriptions ?? []).map((d) => stringifyLocalized(\"desc\", d)).join(\"\") +\n (o.categories?.length\n ? `<dgm:catLst>${o.categories\n .map((c) => `<dgm:cat${attrs({ type: c.type, pri: c.pri })}/>`)\n .join(\"\")}</dgm:catLst>`\n : \"\") +\n (o.styleLabels ?? []).map(stringifyColorStyleLabel).join(\"\") +\n (o.ext ? `<a:extLst>${o.ext}</a:extLst>` : \"\");\n return `<dgm:colorsDef${attrs({ uniqueId: o.uniqueId, minVer: o.minVer })}>${body}</dgm:colorsDef>`;\n}\n\n// ── Parse ──\n\nfunction parseColorStyleLabel(el: Element): ColorStyleLabelOptions {\n const result: Partial<ColorStyleLabelOptions> = { name: attr(el, \"name\") ?? \"\" };\n for (const [tag, field] of COLOR_LIST_FIELDS) {\n const listEl = findChild(el, `dgm:${tag}`);\n if (listEl) (result as Record<string, unknown>)[field] = parseColorList(listEl);\n }\n return result as ColorStyleLabelOptions;\n}\n\nfunction parseLocalized(\n el: Element,\n tag: string,\n): DiagramNameOptions[] | DiagramDescriptionOptions[] | undefined {\n const out: (DiagramNameOptions | DiagramDescriptionOptions)[] = [];\n for (const child of el.elements ?? []) {\n if (child.name !== `dgm:${tag}`) continue;\n const val = attr(child, \"val\") ?? \"\";\n const lang = attr(child, \"lang\");\n out.push(lang ? { lang, val } : { val });\n }\n return out.length ? (out as DiagramNameOptions[]) : undefined;\n}\n\n/** Parse a dgm:colorsDef element into options. */\nexport function parseColorDefinition(el: Element): ColorDefinitionOptions {\n const root = el.name === \"dgm:colorsDef\" ? el : (findChild(el, \"dgm:colorsDef\") ?? el);\n const result: Partial<ColorDefinitionOptions> = {};\n const uniqueId = attr(root, \"uniqueId\");\n if (uniqueId) result.uniqueId = uniqueId;\n const minVer = attr(root, \"minVer\");\n if (minVer) result.minVer = minVer;\n const titles = parseLocalized(root, \"title\");\n if (titles) result.titles = titles;\n const descriptions = parseLocalized(root, \"desc\");\n if (descriptions) result.descriptions = descriptions;\n const catLst = findChild(root, \"dgm:catLst\");\n if (catLst) {\n const categories = (catLst.elements ?? [])\n .filter((c) => c.name === \"dgm:cat\")\n .map((c) => ({ type: attr(c, \"type\") ?? \"\", pri: Number(attr(c, \"pri\") ?? 0) }));\n if (categories.length) result.categories = categories;\n }\n const styleLabels: ColorStyleLabelOptions[] = [];\n for (const child of root.elements ?? []) {\n if (child.name === \"dgm:styleLbl\") styleLabels.push(parseColorStyleLabel(child));\n }\n if (styleLabels.length) result.styleLabels = styleLabels;\n const extLst = findChild(root, \"a:extLst\");\n if (extLst) result.ext = stringifyInnerXml(extLst);\n return result as ColorDefinitionOptions;\n}\n\n/** colors part descriptor — stringify emits the element, parse reads it. */\nexport const colorsDefDesc: CustomDescriptor<ColorDefinitionOptions> = {\n kind: \"custom\",\n stringify: (opts) => stringifyColorDefinition(opts),\n parse: (el) => parseColorDefinition(el),\n};\n\n/** Full colors part body: XML declaration + namespaces + the element. */\nexport function stringifyColorDefinitionPart(o: ColorDefinitionOptions): string {\n return OOXML_XML_DECLARATION + withDiagramNamespaces(stringifyColorDefinition(o));\n}\n","/**\n * SmartArt quick-style definition (dgm:styleDef, CT_StyleDefinition) — the\n * authoring-layer model describing how a diagram's style labels are formatted.\n *\n * Bidirectional: stringify builds the quickStyle part body, parse reads one\n * back into the same options shape, so custom styles round-trip intact.\n *\n * Reference: ISO/IEC 29500-4, dml-diagram.xsd (CT_StyleDefinition,\n * CT_StyleLabel, CT_TextProps and the EG_Text3D group from dml-main.xsd).\n *\n * @module\n */\n\nimport { attr, attrs, findChild } from \"@office-open/xml\";\nimport { OOXML_XML_DECLARATION } from \"@office-open/xml\";\nimport { stringify as stringifyInnerXml } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../descriptor\";\nimport type { ReadContext, WriteContext } from \"../descriptor/context\";\nimport type {\n DiagramCategoryOptions,\n DiagramDescriptionOptions,\n DiagramNameOptions,\n} from \"../drawing/diagram/headers\";\nimport type { Scene3DOptions } from \"../drawing/three-d/scene-3d\";\nimport type { Shape3DOptions } from \"../drawing/three-d/shape-3d\";\nimport { scene3DDesc, shape3DDesc } from \"../drawing/three-d/three-d-descriptors\";\nimport { parseShapeStyle, stringifyShapeStyle } from \"../theme/style-matrix\";\nimport type { DefaultShapeStyleOptions } from \"../theme/theme-options\";\nimport { withDiagramNamespaces } from \"./layout-definition\";\n\n/** dgm:txPr (CT_TextProps) — a choice of 3D text treatments (EG_Text3D). */\nexport interface TextProperties3DOptions {\n /** 3D shape properties for the label text (a:sp3d). */\n shape3d?: Shape3DOptions;\n /** Flatten text to a plane at this z coordinate, EMU (a:flatTx @z). */\n flatText?: number;\n}\n\n/** dgm:styleLbl (CT_StyleLabel) — formatting for one style slot. */\nexport interface StyleLabelOptions {\n /** Slot name referenced by dgm:layoutNode @styleLbl (required). */\n name: string;\n /** Shared 3D scene for this label (dgm:scene3d). */\n scene3d?: Scene3DOptions;\n /** 3D shape properties (dgm:sp3d). */\n shape3d?: Shape3DOptions;\n /** 3D text properties (dgm:txPr). */\n textProperties?: TextProperties3DOptions;\n /** Theme style-matrix references (dgm:style, a:CT_ShapeStyle). */\n style?: DefaultShapeStyleOptions;\n /** Raw a:extLst inner XML — verbatim round-trip. */\n ext?: string;\n}\n\n/** dgm:styleDef (CT_StyleDefinition) — the quickStyle part root. */\nexport interface StyleDefinitionOptions {\n /** Style identity URI (dgm:styleDef @uniqueId). */\n uniqueId?: string;\n /** Minimum Office version (dgm:styleDef @minVer). */\n minVer?: string;\n /** Localized titles (dgm:title*). */\n titles?: DiagramNameOptions[];\n /** Localized descriptions (dgm:desc*). */\n descriptions?: DiagramDescriptionOptions[];\n /** Gallery categories (dgm:catLst). */\n categories?: DiagramCategoryOptions[];\n /** Shared 3D scene for the whole style (dgm:scene3d). */\n scene3d?: Scene3DOptions;\n /** Style slots, at least one in a real part (dgm:styleLbl*). */\n styleLabels?: StyleLabelOptions[];\n /** Raw a:extLst inner XML — verbatim round-trip. */\n ext?: string;\n}\n\n// Noop contexts: style definitions hold theme references and plain colors,\n// never media or relationships of their own.\nconst DIRECT_WRITE_CTX: WriteContext = {\n addRelationship: () => \"\",\n addMedia: () => \"\",\n addHyperlink: () => {},\n};\n\nconst DIRECT_READ_CTX: ReadContext = {\n resolveRelationship: () => undefined,\n getPart: () => undefined,\n getRaw: () => undefined,\n};\n\n// ── Stringify ──\n\n// CT_StyleLabel declares scene3d/sp3d/style as local dgm-namespace elements\n// wrapping dml-main content, so only the outer tag switches prefix; the\n// dml-main children (a:camera, a:lnRef, …) keep theirs.\nfunction renamespaceTag(tag: string, xml: string): string {\n return xml.replace(`<a:${tag}`, `<dgm:${tag}`).replace(`</a:${tag}>`, `</dgm:${tag}>`);\n}\n\nfunction stringifyTextProperties(o: TextProperties3DOptions, ctx: WriteContext): string {\n const body = o.shape3d\n ? (shape3DDesc.stringify(o.shape3d, ctx) ?? \"\")\n : o.flatText !== undefined\n ? `<a:flatTx${attrs({ z: o.flatText })}/>`\n : \"\";\n return body ? `<dgm:txPr>${body}</dgm:txPr>` : \"\";\n}\n\nfunction stringifyStyleLabel(o: StyleLabelOptions, ctx: WriteContext): string {\n let body = \"\";\n if (o.scene3d) body += renamespaceTag(\"scene3d\", scene3DDesc.stringify(o.scene3d, ctx) ?? \"\");\n if (o.shape3d) body += renamespaceTag(\"sp3d\", shape3DDesc.stringify(o.shape3d, ctx) ?? \"\");\n if (o.textProperties) body += stringifyTextProperties(o.textProperties, ctx);\n if (o.style) body += renamespaceTag(\"style\", stringifyShapeStyle(o.style, ctx));\n if (o.ext) body += `<a:extLst>${o.ext}</a:extLst>`;\n return `<dgm:styleLbl${attrs({ name: o.name })}>${body}</dgm:styleLbl>`;\n}\n\nfunction stringifyLocalized(\n tag: string,\n o: DiagramNameOptions | DiagramDescriptionOptions,\n): string {\n return `<dgm:${tag}${attrs({ lang: o.lang, val: o.val })}/>`;\n}\n\n/**\n * Serialize a style definition to the dgm:styleDef element (no XML\n * declaration, no namespace declarations — the part wrapper adds both).\n */\nexport function stringifyStyleDefinition(o: StyleDefinitionOptions): string {\n const body =\n (o.titles ?? []).map((t) => stringifyLocalized(\"title\", t)).join(\"\") +\n (o.descriptions ?? []).map((d) => stringifyLocalized(\"desc\", d)).join(\"\") +\n (o.categories?.length\n ? `<dgm:catLst>${o.categories\n .map((c) => `<dgm:cat${attrs({ type: c.type, pri: c.pri })}/>`)\n .join(\"\")}</dgm:catLst>`\n : \"\") +\n (o.scene3d\n ? renamespaceTag(\"scene3d\", scene3DDesc.stringify(o.scene3d, DIRECT_WRITE_CTX) ?? \"\")\n : \"\") +\n (o.styleLabels ?? []).map((l) => stringifyStyleLabel(l, DIRECT_WRITE_CTX)).join(\"\") +\n (o.ext ? `<a:extLst>${o.ext}</a:extLst>` : \"\");\n return `<dgm:styleDef${attrs({ uniqueId: o.uniqueId, minVer: o.minVer })}>${body}</dgm:styleDef>`;\n}\n\n// ── Parse ──\n\nfunction parseTextProperties(el: Element): TextProperties3DOptions {\n const result: Partial<TextProperties3DOptions> = {};\n const sp3d = findChild(el, \"a:sp3d\");\n if (sp3d) result.shape3d = shape3DDesc.parse(sp3d, DIRECT_READ_CTX);\n const flatTx = findChild(el, \"a:flatTx\");\n if (flatTx) {\n const z = attr(flatTx, \"z\");\n result.flatText = z !== undefined ? Number(z) : 0;\n }\n return result as TextProperties3DOptions;\n}\n\nfunction parseStyleLabel(el: Element): StyleLabelOptions {\n const result: Partial<StyleLabelOptions> = { name: attr(el, \"name\") ?? \"\" };\n const scene3d = findChild(el, \"dgm:scene3d\");\n if (scene3d) result.scene3d = scene3DDesc.parse(scene3d, DIRECT_READ_CTX);\n const sp3d = findChild(el, \"dgm:sp3d\");\n if (sp3d) result.shape3d = shape3DDesc.parse(sp3d, DIRECT_READ_CTX);\n const txPr = findChild(el, \"dgm:txPr\");\n if (txPr) result.textProperties = parseTextProperties(txPr);\n const style = findChild(el, \"dgm:style\");\n if (style) result.style = parseShapeStyle(style, DIRECT_READ_CTX);\n const extLst = findChild(el, \"a:extLst\");\n if (extLst) result.ext = stringifyInnerXml(extLst);\n return result as StyleLabelOptions;\n}\n\nfunction parseLocalized(\n el: Element,\n tag: string,\n): DiagramNameOptions[] | DiagramDescriptionOptions[] | undefined {\n const out: (DiagramNameOptions | DiagramDescriptionOptions)[] = [];\n for (const child of el.elements ?? []) {\n if (child.name !== `dgm:${tag}`) continue;\n const val = attr(child, \"val\") ?? \"\";\n const lang = attr(child, \"lang\");\n out.push(lang ? { lang, val } : { val });\n }\n return out.length ? (out as DiagramNameOptions[]) : undefined;\n}\n\n/** Parse a dgm:styleDef element into options. */\nexport function parseStyleDefinition(el: Element): StyleDefinitionOptions {\n const root = el.name === \"dgm:styleDef\" ? el : (findChild(el, \"dgm:styleDef\") ?? el);\n const result: Partial<StyleDefinitionOptions> = {};\n const uniqueId = attr(root, \"uniqueId\");\n if (uniqueId) result.uniqueId = uniqueId;\n const minVer = attr(root, \"minVer\");\n if (minVer) result.minVer = minVer;\n const titles = parseLocalized(root, \"title\");\n if (titles) result.titles = titles;\n const descriptions = parseLocalized(root, \"desc\");\n if (descriptions) result.descriptions = descriptions;\n const catLst = findChild(root, \"dgm:catLst\");\n if (catLst) {\n const categories = (catLst.elements ?? [])\n .filter((c) => c.name === \"dgm:cat\")\n .map((c) => ({ type: attr(c, \"type\") ?? \"\", pri: Number(attr(c, \"pri\") ?? 0) }));\n if (categories.length) result.categories = categories;\n }\n const scene3d = findChild(root, \"dgm:scene3d\");\n if (scene3d) result.scene3d = scene3DDesc.parse(scene3d, DIRECT_READ_CTX);\n const styleLabels: StyleLabelOptions[] = [];\n for (const child of root.elements ?? []) {\n if (child.name === \"dgm:styleLbl\") styleLabels.push(parseStyleLabel(child));\n }\n if (styleLabels.length) result.styleLabels = styleLabels;\n const extLst = findChild(root, \"a:extLst\");\n if (extLst) result.ext = stringifyInnerXml(extLst);\n return result as StyleDefinitionOptions;\n}\n\n/** quickStyle part descriptor — stringify emits the element, parse reads it. */\nexport const styleDefDesc: CustomDescriptor<StyleDefinitionOptions> = {\n kind: \"custom\",\n stringify: (opts) => stringifyStyleDefinition(opts),\n parse: (el) => parseStyleDefinition(el),\n};\n\n/** Full quickStyle part body: XML declaration + namespaces + the element. */\nexport function stringifyStyleDefinitionPart(o: StyleDefinitionOptions): string {\n return OOXML_XML_DECLARATION + withDiagramNamespaces(stringifyStyleDefinition(o));\n}\n","/**\n * SmartArt built-in definitions — layout, quick style, and color transforms.\n *\n * Emits layoutDef, styleDef, and colorsDef parts from typed constants through\n * the structured descriptors. All entries carry only the uniqueId plus a\n * schema-valid minimal body — Office applications resolve these to built-in\n * definitions; the \"default\" layout ships its full layout tree.\n *\n * @module\n */\n\nexport { COLOR_CATEGORIES, LAYOUT_CATEGORIES, STYLE_CATEGORIES } from \"./categories\";\n\nimport type { ColorListOptions } from \"../drawing/diagram/diagram-style\";\nimport { COLOR_CATEGORIES, LAYOUT_CATEGORIES, STYLE_CATEGORIES } from \"./categories\";\nimport { stringifyColorDefinitionPart, type ColorDefinitionOptions } from \"./color-definition\";\nimport { stringifyLayoutDefinitionPart, type LayoutDefinitionOptions } from \"./layout-definition\";\nimport { stringifyStyleDefinitionPart, type StyleDefinitionOptions } from \"./style-definition\";\n\n// ---------------------------------------------------------------------------\n// Layout XML — full for \"default\", stubs for everything else\n// ---------------------------------------------------------------------------\n\nconst BUILTIN_ACCENTS = [\"accent1\", \"accent2\", \"accent3\", \"accent4\", \"accent5\", \"accent6\"] as const;\n\n/** Sample-model point list shared by the layout stubs: a doc point plus placeholders. */\nfunction samplePoints(count: number): LayoutDefinitionOptions[\"sampleData\"] {\n const points = [\n { modelId: \"0\", type: \"doc\" },\n ...Array.from({ length: count }, (_, i) => ({\n modelId: String(i + 1),\n propertySet: { placeholder: true },\n })),\n ];\n const connections = Array.from({ length: count }, (_, i) => ({\n modelId: String(count + 1 + i),\n sourceId: \"0\",\n destinationId: String(i + 1),\n sourceOrder: i,\n destinationOrder: 0,\n }));\n return { dataModel: { points, connections } };\n}\n\n/**\n * Full default list layout (urn:microsoft.com/office/officeart/2005/8/layout/default).\n */\nconst DEFAULT_LAYOUT: LayoutDefinitionOptions = {\n uniqueId: \"urn:microsoft.com/office/officeart/2005/8/layout/default\",\n titles: [{ val: \"\" }],\n descriptions: [{ val: \"\" }],\n categories: [{ type: \"list\", pri: 400 }],\n sampleData: samplePoints(5),\n styleData: {\n dataModel: {\n points: [{ modelId: \"0\", type: \"doc\" }, { modelId: \"1\" }, { modelId: \"2\" }],\n connections: [\n { modelId: \"3\", sourceId: \"0\", destinationId: \"1\", sourceOrder: 0, destinationOrder: 0 },\n { modelId: \"4\", sourceId: \"0\", destinationId: \"2\", sourceOrder: 1, destinationOrder: 0 },\n ],\n },\n },\n colorData: {\n dataModel: {\n points: [\n { modelId: \"0\", type: \"doc\" },\n ...Array.from({ length: 6 }, (_, i) => ({ modelId: String(i + 1) })),\n ],\n connections: Array.from({ length: 6 }, (_, i) => ({\n modelId: String(7 + i),\n sourceId: \"0\",\n destinationId: String(i + 1),\n sourceOrder: i,\n destinationOrder: 0,\n })),\n },\n },\n layoutNode: {\n name: \"diagram\",\n childOrder: \"b\",\n children: [\n { variables: { direction: \"norm\", resizeHandles: \"exact\" } },\n {\n choose: {\n name: \"Name0\",\n conditions: [\n {\n name: \"Name1\",\n function: \"var\",\n argument: \"dir\",\n operator: \"equ\",\n value: \"norm\",\n children: [\n {\n algorithm: {\n type: \"snake\",\n parameters: [\n { type: \"grDir\", value: \"tL\" },\n { type: \"flowDir\", value: \"row\" },\n { type: \"contDir\", value: \"sameDir\" },\n { type: \"off\", value: \"ctr\" },\n ],\n },\n },\n ],\n },\n ],\n otherwise: {\n name: \"Name2\",\n children: [\n {\n algorithm: {\n type: \"snake\",\n parameters: [\n { type: \"grDir\", value: \"tR\" },\n { type: \"flowDir\", value: \"row\" },\n { type: \"contDir\", value: \"sameDir\" },\n { type: \"off\", value: \"ctr\" },\n ],\n },\n },\n ],\n },\n },\n },\n { shape: { blipPlaceholder: false, adjustments: [] } },\n { presentationOf: {} },\n {\n constraints: [\n { type: \"w\", for: \"ch\", forName: \"node\", referenceType: \"w\", referencePointType: \"all\" },\n {\n type: \"h\",\n for: \"ch\",\n forName: \"node\",\n referenceType: \"w\",\n referenceFor: \"ch\",\n referenceForName: \"node\",\n factor: 0.6,\n },\n {\n type: \"w\",\n for: \"ch\",\n forName: \"sibTrans\",\n referenceType: \"w\",\n referenceFor: \"ch\",\n referenceForName: \"node\",\n factor: 0.1,\n },\n {\n type: \"sp\",\n referenceType: \"w\",\n referenceFor: \"ch\",\n referenceForName: \"sibTrans\",\n },\n { type: \"primFontSz\", for: \"ch\", forName: \"node\", operation: \"equ\", value: 65 },\n ],\n },\n { rules: [] },\n {\n forEach: {\n name: \"Name3\",\n axis: \"ch\",\n pointType: \"node\",\n start: \"1\",\n children: [\n {\n layoutNode: {\n name: \"node\",\n children: [\n { variables: { bulletEnabled: true } },\n { algorithm: { type: \"tx\" } },\n { shape: { type: \"rect\", adjustments: [] } },\n { presentationOf: { axis: \"desOrSelf\", pointType: \"node\" } },\n {\n constraints: [\n { type: \"lMarg\", referenceType: \"primFontSz\", factor: 0.3 },\n { type: \"rMarg\", referenceType: \"primFontSz\", factor: 0.3 },\n { type: \"tMarg\", referenceType: \"primFontSz\", factor: 0.3 },\n { type: \"bMarg\", referenceType: \"primFontSz\", factor: 0.3 },\n ],\n },\n // rule @fact/@max default to NaN in the XSD, so omitting them\n // means \"unbounded\" — same as the explicit NaN in Office's copy.\n { rules: [{ type: \"primFontSz\", value: 5 }] },\n ],\n },\n },\n {\n forEach: {\n name: \"Name4\",\n axis: \"followSib\",\n pointType: \"sibTrans\",\n count: \"1\",\n children: [\n {\n layoutNode: {\n name: \"sibTrans\",\n children: [\n { algorithm: { type: \"sp\" } },\n { shape: { adjustments: [] } },\n { presentationOf: {} },\n { constraints: [] },\n { rules: [] },\n ],\n },\n },\n ],\n },\n },\n ],\n },\n },\n ],\n },\n};\n\n/**\n * Returns layout XML. Full layout tree for \"default\", minimal stub for others.\n * Stubs keep a schema-required empty layoutNode; PowerPoint resolves built-in\n * definitions from the uniqueId / loTypeId in the data model.\n */\nexport function getLayoutXml(layoutId: string): string {\n if (layoutId === \"default\") return stringifyLayoutDefinitionPart(DEFAULT_LAYOUT);\n const layout: LayoutDefinitionOptions = {\n uniqueId: `urn:microsoft.com/office/officeart/2005/8/layout/${layoutId}`,\n titles: [{ val: \"\" }],\n descriptions: [{ val: \"\" }],\n categories: [{ type: LAYOUT_CATEGORIES[layoutId] ?? \"list\", pri: 400 }],\n sampleData: samplePoints(2),\n layoutNode: {},\n };\n return stringifyLayoutDefinitionPart(layout);\n}\n\n// ---------------------------------------------------------------------------\n// Style XML\n// ---------------------------------------------------------------------------\n\nconst STYLE_SCENE_3D = {\n camera: { preset: \"orthographicFront\" },\n lightRig: { rig: \"threePt\", direction: \"t\" },\n};\n\n/**\n * Returns style XML. Each label node0…node5 ties one accent color into the\n * theme style matrix (line in tx1, fill in the accent), so PowerPoint renders\n * SmartArt shapes with themed fills and effects.\n */\nexport function getStyleXml(styleId: string): string {\n const style: StyleDefinitionOptions = {\n uniqueId: `urn:microsoft.com/office/officeart/2005/8/quickstyle/${styleId}`,\n titles: [{ val: \"\" }],\n descriptions: [{ val: \"\" }],\n categories: [{ type: STYLE_CATEGORIES[styleId] ?? \"simple\", pri: 10100 }],\n scene3d: STYLE_SCENE_3D,\n styleLabels: BUILTIN_ACCENTS.map((accent, i) => ({\n name: `node${i}`,\n style: {\n lineReference: { index: 2, color: { value: \"tx1\" } },\n fillReference: { index: 1, color: { value: accent } },\n effectReference: { index: 0, color: { value: \"tx1\" } },\n fontReference: { collection: \"minor\" as const, color: { value: \"tx1\" } },\n },\n })),\n };\n return stringifyStyleDefinitionPart(style);\n}\n\n// ---------------------------------------------------------------------------\n// Color XML\n// ---------------------------------------------------------------------------\n\nconst TINTED_TEXT = { value: \"tx1\", transforms: { tint: 75 } };\n\n/**\n * Returns color XML mapping the node0 label to color lists for the requested\n * color scheme (accent / colorful / dark / fallback).\n */\nexport function getColorXml(colorId: string): string {\n const accent = colorId.match(/^(accent\\d)/)?.[1] ?? \"accent1\";\n\n let fillColorList: ColorListOptions;\n let lineColorList: ColorListOptions;\n let textFillColorList: ColorListOptions;\n if (colorId.startsWith(\"colorful\")) {\n fillColorList = { colors: BUILTIN_ACCENTS.slice(0, 5).map((a) => ({ value: a })) };\n lineColorList = { colors: [{ value: \"lt1\" }] };\n textFillColorList = { colors: [{ value: \"tx1\" }] };\n } else if (colorId.startsWith(\"dark\")) {\n fillColorList = { colors: [{ value: \"dk1\" }, { value: \"dk2\" }] };\n lineColorList = { colors: [{ value: \"lt1\" }] };\n textFillColorList = { colors: [{ value: \"lt1\" }] };\n } else if (colorId.startsWith(\"accent\")) {\n fillColorList = { colors: [{ value: accent }] };\n lineColorList = { colors: [TINTED_TEXT] };\n textFillColorList = { colors: [{ value: \"tx1\" }] };\n } else {\n fillColorList = { colors: [{ value: \"accent1\" }] };\n lineColorList = { colors: [{ value: \"tx1\" }] };\n textFillColorList = { colors: [{ value: \"tx1\" }] };\n }\n\n const colors: ColorDefinitionOptions = {\n uniqueId: `urn:microsoft.com/office/officeart/2005/8/colors/${colorId}`,\n titles: [{ val: \"\" }],\n descriptions: [{ val: \"\" }],\n categories: [{ type: COLOR_CATEGORIES[colorId] ?? \"accent1\", pri: 11200 }],\n styleLabels: [\n {\n name: \"node0\",\n fillColorList,\n lineColorList,\n effectColorList: lineColorList,\n textFillColorList,\n textLineColorList: colorId.startsWith(\"accent\")\n ? { colors: [TINTED_TEXT] }\n : { colors: [] },\n textEffectColorList: textFillColorList,\n },\n ],\n };\n return stringifyColorDefinitionPart(colors);\n}\n\n/** Minimal drawing cache for SmartArt (Office apps auto-regenerate this on open) */\nexport const DEFAULT_DRAWING_XML =\n '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>' +\n '<dsp:drawing xmlns:dgm=\"http://schemas.openxmlformats.org/drawingml/2006/diagram\" xmlns:dsp=\"http://schemas.microsoft.com/office/drawing/2008/diagram\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">' +\n \"<dsp:spTree>\" +\n '<dsp:nvGrpSpPr><dsp:cNvPr id=\"0\" name=\"\"/><dsp:cNvGrpSpPr/></dsp:nvGrpSpPr>' +\n \"<dsp:grpSpPr/>\" +\n \"</dsp:spTree>\" +\n \"</dsp:drawing>\";\n","/**\n * SmartArt data and collection for document generation.\n *\n * @module\n */\n\nimport type { ColorDefinitionOptions } from \"./color-definition\";\nimport type { LayoutDefinitionOptions } from \"./layout-definition\";\nimport type { StyleDefinitionOptions } from \"./style-definition\";\n\nexport interface SmartArtData {\n key: string;\n dataModelXml: string;\n /** Built-in layout id (\"process1\") or a full custom layout definition. */\n layout: string | LayoutDefinitionOptions;\n /** Built-in quick-style id (\"simple1\") or a full custom style definition. */\n style: string | StyleDefinitionOptions;\n /** Built-in color-transform id (\"accent1_2\") or a full custom definition. */\n color: string | ColorDefinitionOptions;\n}\n\n/**\n * Last URN segment of a custom definition's uniqueId — the id embedded in the\n * data model's doc-point type ids. Falls back to \"custom\" when unset.\n */\nexport function definitionId(definition: { uniqueId?: string }): string {\n return definition.uniqueId?.split(\"/\").pop() || \"custom\";\n}\n\n/**\n * Manages SmartArt parts in a document.\n */\nexport class SmartArtCollection {\n private map: Map<string, SmartArtData>;\n\n public constructor() {\n this.map = new Map<string, SmartArtData>();\n }\n\n public addSmartArt(key: string, data: SmartArtData): void {\n this.map.set(key, data);\n }\n\n public get array(): SmartArtData[] {\n return [...this.map.values()];\n }\n}\n","import { escapeXml } from \"@office-open/xml\";\n\nimport { COLOR_CATEGORIES, LAYOUT_CATEGORIES, STYLE_CATEGORIES } from \"./categories\";\nimport { stringifyConnection } from \"./data-model/connection\";\nimport { stringifyDataModel } from \"./data-model/data-model\";\nimport { stringifyPoint, stringifyTransPoint } from \"./data-model/point\";\n\nexport interface TreeNode {\n text: string;\n children?: readonly TreeNode[];\n}\n\nfunction stringifyDocPoint(layout: string, style: string, color: string): string {\n const loTypeId = `urn:microsoft.com/office/officeart/2005/8/layout/${layout}`;\n const loCatId = LAYOUT_CATEGORIES[layout] ?? \"list\";\n const qsTypeId = `urn:microsoft.com/office/officeart/2005/8/quickstyle/${style}`;\n const qsCatId = STYLE_CATEGORIES[style] ?? \"simple\";\n const csTypeId = `urn:microsoft.com/office/officeart/2005/8/colors/${color}`;\n const csCatId = COLOR_CATEGORIES[color] ?? \"accent1\";\n\n return [\n '<dgm:pt modelId=\"0\" type=\"doc\">',\n `<dgm:prSet loTypeId=\"${escapeXml(loTypeId)}\" loCatId=\"${escapeXml(loCatId)}\" qsTypeId=\"${escapeXml(qsTypeId)}\" qsCatId=\"${escapeXml(qsCatId)}\" csTypeId=\"${escapeXml(csTypeId)}\" csCatId=\"${escapeXml(csCatId)}\" phldr=\"0\"/>`,\n \"<dgm:spPr/>\",\n \"<dgm:t><a:bodyPr/><a:lstStyle/><a:p/></dgm:t>\",\n \"</dgm:pt>\",\n ].join(\"\");\n}\n\nfunction uuid(): string {\n return `{${crypto.randomUUID().toUpperCase()}}`;\n}\n\n/**\n * Creates SmartArt data model XML from tree nodes with layout/style/color settings.\n * Returns the XML string body (no XML declaration).\n */\nexport const createDataModel = (\n nodes: readonly TreeNode[],\n layout: string = \"default\",\n style: string = \"simple1\",\n color: string = \"accent1_2\",\n): string => {\n const pointStrs: string[] = [];\n const connectionStrs: string[] = [];\n\n pointStrs.push(stringifyDocPoint(layout, style, color));\n\n for (const [i, node] of nodes.entries()) {\n const walk = (node: TreeNode, parentUuid: string, srcOrd: number): void => {\n const nodeUuid = uuid();\n const parTransUuid = uuid();\n const sibTransUuid = uuid();\n const cxnUuid = uuid();\n\n pointStrs.push(stringifyTransPoint(parTransUuid, \"parTrans\", cxnUuid));\n pointStrs.push(stringifyTransPoint(sibTransUuid, \"sibTrans\", cxnUuid));\n pointStrs.push(stringifyPoint(nodeUuid, node.text));\n\n connectionStrs.push(\n stringifyConnection({\n modelId: parTransUuid,\n srcId: parentUuid,\n destId: nodeUuid,\n srcOrd,\n destOrd: 0,\n parTransId: parTransUuid,\n sibTransId: sibTransUuid,\n }),\n );\n\n if (node.children) {\n for (const [j, child] of node.children.entries()) {\n walk(child, nodeUuid, j);\n }\n }\n };\n walk(node, \"0\", i);\n }\n\n return stringifyDataModel(pointStrs, connectionStrs);\n};\n"],"mappings":";;;;;AACA,MAAa,oBAA4C;CACvD,SAAS;CACT,OAAO;CACP,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,WAAW;CACX,UAAU;CACV,UAAU;CACV,UAAU;CACV,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,OAAO;CACP,SAAS;CACT,UAAU;CACV,OAAO;CACP,WAAW;CACX,QAAQ;AACV;;AAGA,MAAa,mBAA2C;CACtD,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,eAAe;CACf,eAAe;CACf,eAAe;CACf,eAAe;CACf,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;AACV;;AAGA,MAAa,mBAA2C;CACtD,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,OAAO;CACP,OAAO;CACP,UAAU;CACV,UAAU;CACV,OAAO;CACP,OAAO;AACT;;;;;;ACzFA,SAAgB,oBAAoB,MAUzB;CACT,MAAM,QAAkB;EACtB,YAAY,UAAU,OAAO,KAAK,OAAO,CAAC,EAAE;EAC5C,UAAU,UAAU,OAAO,KAAK,KAAK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GAElD,eAAe,KACb,oBAAoB;IAClB,SAAS;IACT,OAAO;IACP,QAAQ;IACR;IACA,SAAS;IACT,YAAY;IACZ,YAAY;GACd,CAAC,CACH;GAEA,IAAI,KAAK,UACP,KAAK,MAAM,CAAC,GAAG,UAAU,KAAK,SAAS,QAAQ,GAC7C,KAAK,OAAO,UAAU,CAAC;EAG7B;EACA,KAAK,MAAM,KAAK,CAAC;CACnB;CAEA,OAAO,mBAAmB,WAAW,cAAc;AACrD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"style-matrix-DAP6XrLv.mjs","names":[],"sources":["../src/theme/style-matrix.ts"],"sourcesContent":["/**\n * Format scheme / style matrix (a:fmtScheme / CT_StyleMatrix) and shape style\n * (a:style / CT_ShapeStyle) stringify + parse.\n *\n * Reuses core fill/outline/effect/3d descriptors so the style matrix round-trips\n * through the same machinery as shape properties.\n *\n * @module\n */\nimport { findChild } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\n\nimport type { ReadContext, WriteContext } from \"../descriptor\";\nimport {\n effectListDesc,\n fillDesc,\n outlineDesc,\n parseColorChoice,\n scene3DDesc,\n shape3DDesc,\n stringifyColorChoice,\n} from \"../drawing\";\nimport type { SolidFillOptions } from \"../drawing\";\nimport type {\n EffectStyleOptions,\n FontReferenceOptions,\n FormatSchemeOptions,\n DefaultShapeStyleOptions,\n StyleMatrixReferenceOptions,\n} from \"./theme-options\";\n\n// ── Style matrix reference (a:lnRef / a:fillRef / a:effectRef) ──\n\nfunction stringifyStyleMatrixReference(\n tag: string,\n opts: StyleMatrixReferenceOptions,\n ctx: WriteContext,\n): string {\n const color = opts.color ? stringifyColorChoice(opts.color, ctx) : \"\";\n return `<${tag} idx=\"${opts.index}\">${color}</${tag}>`;\n}\n\nfunction parseStyleMatrixReference(\n el: XmlElement | undefined,\n ctx: ReadContext,\n): StyleMatrixReferenceOptions | undefined {\n if (!el?.attributes) return undefined;\n const idx = el.attributes[\"idx\"];\n if (idx === undefined) return undefined;\n const parsedColor = parseColorChoice(el, ctx);\n const color = parsedColor && Object.keys(parsedColor).length > 0 ? parsedColor : undefined;\n return color ? { index: Number(idx), color } : { index: Number(idx) };\n}\n\n// ── Font reference (a:fontRef) ──\n\nfunction stringifyFontReference(opts: FontReferenceOptions, ctx: WriteContext): string {\n const color = opts.color ? stringifyColorChoice(opts.color, ctx) : \"\";\n return `<a:fontRef idx=\"${opts.collection}\">${color}</a:fontRef>`;\n}\n\nfunction parseFontReference(\n el: XmlElement | undefined,\n ctx: ReadContext,\n): FontReferenceOptions | undefined {\n if (!el?.attributes) return undefined;\n const idx = el.attributes[\"idx\"];\n if (idx !== \"major\" && idx !== \"minor\" && idx !== \"none\") return undefined;\n const parsedColor = parseColorChoice(el, ctx);\n const color: SolidFillOptions | undefined =\n parsedColor && Object.keys(parsedColor).length > 0 ? parsedColor : undefined;\n return color ? { collection: idx, color } : { collection: idx };\n}\n\n// ── Shape style (a:style / CT_ShapeStyle) ──\n\nexport function stringifyShapeStyle(opts: DefaultShapeStyleOptions, ctx: WriteContext): string {\n const lnRef = stringifyStyleMatrixReference(\"a:lnRef\", opts.lineReference, ctx);\n const fillRef = stringifyStyleMatrixReference(\"a:fillRef\", opts.fillReference, ctx);\n const effectRef = stringifyStyleMatrixReference(\"a:effectRef\", opts.effectReference, ctx);\n const fontRef = stringifyFontReference(opts.fontReference, ctx);\n return `<a:style>${lnRef}${fillRef}${effectRef}${fontRef}</a:style>`;\n}\n\nexport function parseShapeStyle(\n el: XmlElement | undefined,\n ctx: ReadContext,\n): DefaultShapeStyleOptions | undefined {\n if (!el) return undefined;\n const lineReference = parseStyleMatrixReference(findChild(el, \"a:lnRef\"), ctx);\n const fillReference = parseStyleMatrixReference(findChild(el, \"a:fillRef\"), ctx);\n const effectReference = parseStyleMatrixReference(findChild(el, \"a:effectRef\"), ctx);\n const fontReference = parseFontReference(findChild(el, \"a:fontRef\"), ctx);\n if (!lineReference || !fillReference || !effectReference || !fontReference) return undefined;\n return { lineReference, fillReference, effectReference, fontReference };\n}\n\n// ── Effect style (a:effectStyle / CT_EffectStyleItem) ──\n\nfunction stringifyEffectStyle(opts: EffectStyleOptions, ctx: WriteContext): string {\n const effectLst = opts.effects\n ? (effectListDesc.stringify(opts.effects, ctx) ?? \"\")\n : \"<a:effectLst/>\";\n const scene3d = opts.scene3d ? (scene3DDesc.stringify(opts.scene3d, ctx) ?? \"\") : \"\";\n const shape3d = opts.shape3d ? (shape3DDesc.stringify(opts.shape3d, ctx) ?? \"\") : \"\";\n return `<a:effectStyle>${effectLst}${scene3d}${shape3d}</a:effectStyle>`;\n}\n\nfunction parseEffectStyle(\n el: XmlElement | undefined,\n ctx: ReadContext,\n): EffectStyleOptions | undefined {\n if (!el) return undefined;\n const result: Partial<EffectStyleOptions> = {};\n const effectLst = findChild(el, \"a:effectLst\");\n if (effectLst) {\n const effects = effectListDesc.parse(effectLst, ctx);\n if (effects && Object.keys(effects).length > 0) result.effects = effects;\n }\n const scene3dEl = findChild(el, \"a:scene3d\");\n if (scene3dEl) result.scene3d = scene3DDesc.parse(scene3dEl, ctx);\n const shape3dEl = findChild(el, \"a:sp3d\");\n if (shape3dEl) result.shape3d = shape3DDesc.parse(shape3dEl, ctx);\n return result as EffectStyleOptions | undefined;\n}\n\n// ── Format scheme (a:fmtScheme / CT_StyleMatrix) ──\n\n/** Serialize a:fmtScheme. */\nexport function stringifyFormatScheme(opts: FormatSchemeOptions, ctx: WriteContext): string {\n const fillStyles = opts.fillStyles.map((f) => fillDesc.stringify(f, ctx) ?? \"\").join(\"\");\n const lineStyles = opts.lineStyles.map((l) => outlineDesc.stringify(l, ctx) ?? \"\").join(\"\");\n const effectStyles = opts.effectStyles.map((e) => stringifyEffectStyle(e, ctx)).join(\"\");\n const backgroundFillStyles = opts.backgroundFillStyles\n .map((f) => fillDesc.stringify(f, ctx) ?? \"\")\n .join(\"\");\n const name = opts.name ?? \"Office\";\n return `<a:fmtScheme name=\"${name}\"><a:fillStyleLst>${fillStyles}</a:fillStyleLst><a:lnStyleLst>${lineStyles}</a:lnStyleLst><a:effectStyleLst>${effectStyles}</a:effectStyleLst><a:bgFillStyleLst>${backgroundFillStyles}</a:bgFillStyleLst></a:fmtScheme>`;\n}\n\n/** Parse a:fmtScheme. */\nexport function parseFormatScheme(\n el: XmlElement | undefined,\n ctx: ReadContext,\n): FormatSchemeOptions | undefined {\n if (!el) return undefined;\n const result: FormatSchemeOptions = {\n fillStyles: [],\n lineStyles: [],\n effectStyles: [],\n backgroundFillStyles: [],\n };\n const name = el.attributes?.[\"name\"];\n if (name) result.name = String(name);\n\n const fillStyleLst = findChild(el, \"a:fillStyleLst\");\n if (fillStyleLst) {\n for (const child of fillStyleLst.elements ?? []) {\n const fill = fillDesc.parse(child, ctx);\n if (fill) result.fillStyles.push(fill);\n }\n }\n const lnStyleLst = findChild(el, \"a:lnStyleLst\");\n if (lnStyleLst) {\n for (const child of lnStyleLst.elements ?? []) {\n if (child.name !== \"a:ln\") continue;\n const line = outlineDesc.parse(child, ctx);\n if (line) result.lineStyles.push(line);\n }\n }\n const effectStyleLst = findChild(el, \"a:effectStyleLst\");\n if (effectStyleLst) {\n for (const child of effectStyleLst.elements ?? []) {\n if (child.name !== \"a:effectStyle\") continue;\n const effect = parseEffectStyle(child, ctx);\n if (effect) result.effectStyles.push(effect);\n }\n }\n const bgFillStyleLst = findChild(el, \"a:bgFillStyleLst\");\n if (bgFillStyleLst) {\n for (const child of bgFillStyleLst.elements ?? []) {\n const fill = fillDesc.parse(child, ctx);\n if (fill) result.backgroundFillStyles.push(fill);\n }\n }\n return result;\n}\n"],"mappings":";;;;;;;;;;;;AAiCA,SAAS,8BACP,KACA,MACA,KACQ;CACR,MAAM,QAAQ,KAAK,QAAQ,qBAAqB,KAAK,OAAO,GAAG,IAAI;CACnE,OAAO,IAAI,IAAI,QAAQ,KAAK,MAAM,IAAI,MAAM,IAAI,IAAI;AACtD;AAEA,SAAS,0BACP,IACA,KACyC;CACzC,I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,YAAY,CAAC,GAAG;EACjD,MAAM,OAAO,SAAS,MAAM,OAAO,GAAG;EACtC,IAAI,MAAM,OAAO,qBAAqB,KAAK,IAAI;CACjD;CAEF,OAAO;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"theme-OAuRcA9_.mjs","names":[],"sources":["../src/theme/default-colors.ts","../src/theme/color-scheme.ts","../src/theme/custom-color.ts","../src/theme/extra-color-scheme.ts","../src/theme/font-scheme.ts","../src/theme/object-defaults.ts","../src/theme/build-theme-xml.ts","../src/theme/default-theme.ts","../src/theme/theme-descriptors.ts","../src/theme/theme-override.ts"],"sourcesContent":["/**\n * Default Office 2016+ theme colors.\n *\n * @module\n */\nimport type { ColorSchemeOptions } from \"./theme-options\";\n\n/** Office 2016+ default theme colors (hex without #). */\nexport const DEFAULT_COLORS: Required<Omit<ColorSchemeOptions, \"name\">> = {\n dark1: \"000000\",\n light1: \"FFFFFF\",\n dark2: \"44546A\",\n light2: \"E7E6E6\",\n accent1: \"4472C4\",\n accent2: \"ED7D31\",\n accent3: \"A5A5A5\",\n accent4: \"FFC000\",\n accent5: \"5B9BD5\",\n accent6: \"70AD47\",\n hyperlink: \"0563C1\",\n followedHyperlink: \"954F72\",\n};\n","/**\n * Color scheme (a:clrScheme / CT_ColorScheme) stringify + parse.\n *\n * dk1/lt1 use a:sysClr (windowText/window) by Office convention; only when the\n * caller explicitly supplies a value do they switch to a:srgbClr. parse reads\n * back the effective color value (srgbClr val or sysClr lastClr).\n *\n * @module\n */\nimport { findChild } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\n\nimport { DEFAULT_COLORS } from \"./default-colors\";\nimport type { ColorSchemeOptions } from \"./theme-options\";\n\n/** Color keys excluding the clrScheme/@name attribute. */\ntype ColorKey = Exclude<keyof ColorSchemeOptions, \"name\">;\n\n/** clrScheme child tag → ColorSchemeOptions key, in schema order. */\nconst COLOR_TAGS: ReadonlyArray<{ tag: string; key: ColorKey }> = [\n { tag: \"a:dk1\", key: \"dark1\" },\n { tag: \"a:lt1\", key: \"light1\" },\n { tag: \"a:dk2\", key: \"dark2\" },\n { tag: \"a:lt2\", key: \"light2\" },\n { tag: \"a:accent1\", key: \"accent1\" },\n { tag: \"a:accent2\", key: \"accent2\" },\n { tag: \"a:accent3\", key: \"accent3\" },\n { tag: \"a:accent4\", key: \"accent4\" },\n { tag: \"a:accent5\", key: \"accent5\" },\n { tag: \"a:accent6\", key: \"accent6\" },\n { tag: \"a:hlink\", key: \"hyperlink\" },\n { tag: \"a:folHlink\", key: \"followedHyperlink\" },\n];\n\n/** Read the effective hex color from a color element (srgbClr val or sysClr lastClr). */\nfunction readColorValue(el: XmlElement | undefined): string | undefined {\n if (!el) return undefined;\n const srgb = findChild(el, \"a:srgbClr\");\n if (srgb) return String(srgb.attributes?.[\"val\"] ?? \"\");\n const sysClr = findChild(el, \"a:sysClr\");\n if (sysClr) return String(sysClr.attributes?.[\"lastClr\"] ?? \"\");\n return undefined;\n}\n\n/**\n * Whether the color element carries the conventional default sysClr form\n * (dk1 = windowText, lt1 = window). These parse to \"not explicitly set\" so\n * stringify re-emits the same sysClr spelling and Office-default themes\n * round-trip byte-identically instead of degrading sysClr to srgbClr.\n */\nfunction isDefaultSysClr(el: XmlElement | undefined, val: string): boolean {\n const sysClr = findChild(el, \"a:sysClr\");\n return sysClr !== undefined && String(sysClr.attributes?.[\"val\"] ?? \"\") === val;\n}\n\n/** dk1/lt1 emit sysClr by default, srgbClr when explicitly supplied. */\nfunction stringifyColorTag(\n tag: string,\n key: ColorKey,\n opts: ColorSchemeOptions | undefined,\n): string {\n const userValue = opts?.[key];\n const defaultValue = DEFAULT_COLORS[key];\n if (key === \"dark1\") {\n return userValue !== undefined\n ? `<${tag}><a:srgbClr val=\"${userValue}\"/></${tag}>`\n : `<${tag}><a:sysClr val=\"windowText\" lastClr=\"${defaultValue}\"/></${tag}>`;\n }\n if (key === \"light1\") {\n return userValue !== undefined\n ? `<${tag}><a:srgbClr val=\"${userValue}\"/></${tag}>`\n : `<${tag}><a:sysClr val=\"window\" lastClr=\"${defaultValue}\"/></${tag}>`;\n }\n const value = userValue ?? defaultValue;\n return `<${tag}><a:srgbClr val=\"${value}\"/></${tag}>`;\n}\n\n/** Serialize a:clrScheme. Undefined options emit the full default scheme. */\nexport function stringifyColorScheme(\n opts: ColorSchemeOptions | undefined,\n fallbackName: string,\n): string {\n const name = opts?.name ?? fallbackName;\n const tags = COLOR_TAGS.map(({ tag, key }) => stringifyColorTag(tag, key, opts)).join(\"\");\n return `<a:clrScheme name=\"${name}\">${tags}</a:clrScheme>`;\n}\n\n/** Parse a:clrScheme into the subset of colors explicitly present. */\nexport function parseColorScheme(el: XmlElement | undefined): ColorSchemeOptions | undefined {\n if (!el) return undefined;\n const result: Partial<ColorSchemeOptions> = {};\n const name = el.attributes?.[\"name\"];\n if (name) result.name = String(name);\n for (const { tag, key } of COLOR_TAGS) {\n const colorEl = findChild(el, tag);\n // Conventional-default sysClr (windowText/window) parses to \"unset\" so\n // stringify re-emits the sysClr form — see isDefaultSysClr.\n if (\n (key === \"dark1\" && isDefaultSysClr(colorEl, \"windowText\")) ||\n (key === \"light1\" && isDefaultSysClr(colorEl, \"window\"))\n ) {\n continue;\n }\n const value = readColorValue(colorEl);\n if (value) result[key] = value;\n }\n return result;\n}\n","/**\n * Custom colors (a:custClr / CT_CustomColor) stringify + parse.\n *\n * Each entry is a named color choice; the list wrapper (a:custClrLst /\n * CT_CustomColorList) sits after extraClrSchemeLst in a theme.\n *\n * @module\n */\nimport type { Element as XmlElement } from \"@office-open/xml\";\n\nimport type { ReadContext, WriteContext } from \"../descriptor\";\nimport { parseColorChoice, stringifyColorChoice } from \"../drawing\";\nimport type { SolidFillOptions } from \"../drawing\";\nimport type { CustomColorOptions } from \"./theme-options\";\n\n/** Serialize a:custClrLst. Returns \"\" when no custom colors set (optional element). */\nexport function stringifyCustomColors(\n opts: CustomColorOptions[] | undefined,\n ctx: WriteContext,\n): string {\n if (!opts || opts.length === 0) return \"\";\n const items = opts\n .map((c) => {\n const name = c.name ? ` name=\"${c.name}\"` : \"\";\n return `<a:custClr${name}>${stringifyColorChoice(c.color, ctx)}</a:custClr>`;\n })\n .join(\"\");\n return `<a:custClrLst>${items}</a:custClrLst>`;\n}\n\n/** Parse a:custClrLst. */\nexport function parseCustomColors(\n el: XmlElement | undefined,\n ctx: ReadContext,\n): CustomColorOptions[] | undefined {\n if (!el) return undefined;\n const result: CustomColorOptions[] = [];\n for (const child of el.elements ?? []) {\n if (child.name !== \"a:custClr\") continue;\n const color: SolidFillOptions | undefined = parseColorChoice(child, ctx);\n if (!color) continue;\n const name = child.attributes?.[\"name\"];\n result.push(name !== undefined ? { name: String(name), color } : { color });\n }\n return result.length > 0 ? result : undefined;\n}\n","/**\n * Extra color scheme (a:extraClrScheme / CT_ExtraColorScheme) stringify + parse.\n *\n * Each entry pairs a color scheme with an optional color mapping. The list\n * wrapper (a:extraClrSchemeLst / CT_ColorSchemeList) holds zero or more entries.\n *\n * @module\n */\nimport { findChild } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\n\nimport { parseColorMapping, stringifyColorMapping } from \"./color-mapping\";\nimport { parseColorScheme, stringifyColorScheme } from \"./color-scheme\";\nimport type { ExtraColorSchemeOptions } from \"./theme-options\";\n\n/** Serialize a:extraClrSchemeLst. Returns an empty element when no schemes set. */\nexport function stringifyExtraColorSchemes(\n opts: ExtraColorSchemeOptions[] | undefined,\n fallbackName: string,\n): string {\n if (!opts || opts.length === 0) return \"<a:extraClrSchemeLst/>\";\n const items = opts\n .map((scheme) => {\n const clrScheme = stringifyColorScheme(\n scheme.colorScheme,\n scheme.colorScheme.name ?? fallbackName,\n );\n const clrMap = scheme.colorMapping ? stringifyColorMapping(scheme.colorMapping) : \"\";\n return `<a:extraClrScheme>${clrScheme}${clrMap}</a:extraClrScheme>`;\n })\n .join(\"\");\n return `<a:extraClrSchemeLst>${items}</a:extraClrSchemeLst>`;\n}\n\n/** Parse a:extraClrSchemeLst. */\nexport function parseExtraColorSchemes(\n el: XmlElement | undefined,\n): ExtraColorSchemeOptions[] | undefined {\n if (!el) return undefined;\n const result: ExtraColorSchemeOptions[] = [];\n for (const child of el.elements ?? []) {\n if (child.name !== \"a:extraClrScheme\") continue;\n const colorScheme = parseColorScheme(findChild(child, \"a:clrScheme\"));\n if (!colorScheme) continue;\n const colorMapping = parseColorMapping(findChild(child, \"a:clrMap\"));\n result.push(colorMapping ? { colorScheme, colorMapping } : { colorScheme });\n }\n return result.length > 0 ? result : undefined;\n}\n","/**\n * Font scheme (a:fontScheme / CT_FontScheme) stringify + parse.\n *\n * CT_FontCollection order: latin → ea → cs → sym → font[] (supplemental).\n *\n * @module\n */\nimport { escapeXml } from \"@office-open/xml\";\nimport { findChild } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\n\nimport type {\n FontCollectionOptions,\n FontSchemeOptions,\n SupplementalFontOptions,\n TextFontOptions,\n} from \"./theme-options\";\n\n// ── TextFont (a:latin / a:ea / a:cs / a:sym) ──\n\nfunction stringifyTextFont(tag: string, opts: TextFontOptions | undefined): string {\n if (!opts) return \"\";\n const attrs = [`typeface=\"${escapeXml(opts.typeface)}\"`];\n if (opts.panose !== undefined) attrs.push(`panose=\"${escapeXml(opts.panose)}\"`);\n if (opts.pitchFamily !== undefined) attrs.push(`pitchFamily=\"${opts.pitchFamily}\"`);\n if (opts.charset !== undefined) attrs.push(`charset=\"${opts.charset}\"`);\n return `<${tag} ${attrs.join(\" \")}/>`;\n}\n\nfunction parseTextFont(el: XmlElement | undefined): TextFontOptions | undefined {\n if (!el?.attributes) return undefined;\n const typeface = el.attributes[\"typeface\"];\n if (typeface === undefined) return undefined;\n const result: TextFontOptions = { typeface: String(typeface) };\n if (el.attributes[\"panose\"] !== undefined) result.panose = String(el.attributes[\"panose\"]);\n if (el.attributes[\"pitchFamily\"] !== undefined)\n result.pitchFamily = Number(el.attributes[\"pitchFamily\"]);\n if (el.attributes[\"charset\"] !== undefined) result.charset = Number(el.attributes[\"charset\"]);\n return result;\n}\n\n// ── Font collection (a:majorFont / a:minorFont) ──\n\nfunction stringifyFontCollection(tag: string, opts: FontCollectionOptions | undefined): string {\n const latin = stringifyTextFont(\"a:latin\", opts?.latin);\n const eastAsian = stringifyTextFont(\"a:ea\", opts?.eastAsian);\n const complexScript = stringifyTextFont(\"a:cs\", opts?.complexScript);\n const symbol = stringifyTextFont(\"a:sym\", opts?.symbol);\n const supplemental = (opts?.supplementalFonts ?? [])\n .map((f) => `<a:font script=\"${escapeXml(f.script)}\" typeface=\"${escapeXml(f.typeface)}\"/>`)\n .join(\"\");\n return `<${tag}>${latin}${eastAsian}${complexScript}${symbol}${supplemental}</${tag}>`;\n}\n\nfunction parseFontCollection(el: XmlElement | undefined): FontCollectionOptions | undefined {\n if (!el) return undefined;\n const result: FontCollectionOptions = {};\n const latin = parseTextFont(findChild(el, \"a:latin\"));\n if (latin) result.latin = latin;\n const eastAsian = parseTextFont(findChild(el, \"a:ea\"));\n if (eastAsian) result.eastAsian = eastAsian;\n const complexScript = parseTextFont(findChild(el, \"a:cs\"));\n if (complexScript) result.complexScript = complexScript;\n const symbol = parseTextFont(findChild(el, \"a:sym\"));\n if (symbol) result.symbol = symbol;\n const supplementalFonts = (el.elements ?? [])\n .filter((c) => c.name === \"a:font\")\n .map((c): SupplementalFontOptions | undefined => {\n const script = c.attributes?.[\"script\"];\n const typeface = c.attributes?.[\"typeface\"];\n if (script === undefined || typeface === undefined) return undefined;\n return { script: String(script), typeface: String(typeface) };\n })\n .filter((v): v is SupplementalFontOptions => v !== undefined);\n if (supplementalFonts.length > 0) result.supplementalFonts = supplementalFonts;\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n// ── Fresh defaults (Office theme major/minor fonts) ──\n\nexport const DEFAULT_MAJOR_FONT: FontCollectionOptions = {\n latin: { typeface: \"Calibri Light\", panose: \"020F0302020204030204\" },\n eastAsian: { typeface: \"\" },\n complexScript: { typeface: \"\" },\n};\n\nexport const DEFAULT_MINOR_FONT: FontCollectionOptions = {\n latin: { typeface: \"Calibri\", panose: \"020F0502020204030204\" },\n eastAsian: { typeface: \"\" },\n complexScript: { typeface: \"\" },\n};\n\n// ── Font scheme (a:fontScheme) ──\n\n/** Serialize a:fontScheme. Undefined options emit the Office default scheme. */\nexport function stringifyFontScheme(\n opts: FontSchemeOptions | undefined,\n fallbackName: string,\n): string {\n // Merge defaults so the XSD-required latin/ea/cs slots are always present,\n // even when the caller only customizes one font (e.g. latin typeface).\n const majorFont = stringifyFontCollection(\n \"a:majorFont\",\n opts?.majorFont ? { ...DEFAULT_MAJOR_FONT, ...opts.majorFont } : DEFAULT_MAJOR_FONT,\n );\n const minorFont = stringifyFontCollection(\n \"a:minorFont\",\n opts?.minorFont ? { ...DEFAULT_MINOR_FONT, ...opts.minorFont } : DEFAULT_MINOR_FONT,\n );\n const name = opts?.name ?? fallbackName;\n return `<a:fontScheme name=\"${name}\">${majorFont}${minorFont}</a:fontScheme>`;\n}\n\n/** Parse a:fontScheme. Returns undefined only when neither major nor minor font is present. */\nexport function parseFontScheme(el: XmlElement | undefined): FontSchemeOptions | undefined {\n if (!el) return undefined;\n const result: FontSchemeOptions = {};\n const name = el.attributes?.[\"name\"];\n if (name) result.name = String(name);\n const majorFont = parseFontCollection(findChild(el, \"a:majorFont\"));\n if (majorFont) result.majorFont = majorFont;\n const minorFont = parseFontCollection(findChild(el, \"a:minorFont\"));\n if (minorFont) result.minorFont = minorFont;\n return Object.keys(result).length > 0 ? result : undefined;\n}\n","/**\n * Object defaults (a:objectDefaults / CT_ObjectStyleDefaults) stringify + parse.\n *\n * Each default definition (spDef/lnDef/txDef) holds shape properties, body\n * properties, list style, and an optional shape style. Reuses core descriptors\n * so defaults round-trip through the same machinery as shapes.\n *\n * @module\n */\nimport { findChild } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\n\nimport type { ReadContext, WriteContext } from \"../descriptor\";\nimport { bodyPropertiesDesc, shapePropertiesDesc, textListStyleDesc } from \"../drawing\";\nimport { parseShapeStyle, stringifyShapeStyle } from \"./style-matrix\";\nimport type { DefaultShapeDefinitionOptions, ObjectDefaultsOptions } from \"./theme-options\";\n\nfunction stringifyDefaultShapeDefinition(\n tag: string,\n opts: DefaultShapeDefinitionOptions,\n ctx: WriteContext,\n): string {\n const spPrInner = opts.shapeProperties\n ? (shapePropertiesDesc.stringify(opts.shapeProperties, ctx) ?? \"\")\n : \"\";\n const spPr = spPrInner ? `<a:spPr>${spPrInner}</a:spPr>` : \"\";\n const bodyPr = opts.bodyProperties\n ? (bodyPropertiesDesc.stringify(opts.bodyProperties, ctx) ?? \"\")\n : \"\";\n const lstStyle = opts.listStyle ? (textListStyleDesc.stringify(opts.listStyle, ctx) ?? \"\") : \"\";\n const style = opts.shapeStyle ? stringifyShapeStyle(opts.shapeStyle, ctx) : \"\";\n return `<${tag}>${spPr}${bodyPr}${lstStyle}${style}</${tag}>`;\n}\n\nfunction parseDefaultShapeDefinition(\n el: XmlElement | undefined,\n ctx: ReadContext,\n): DefaultShapeDefinitionOptions | undefined {\n if (!el) return undefined;\n const result: Partial<DefaultShapeDefinitionOptions> = {};\n const spPr = findChild(el, \"a:spPr\");\n if (spPr) {\n const shapeProperties = shapePropertiesDesc.parse(spPr, ctx);\n if (shapeProperties) result.shapeProperties = shapeProperties;\n }\n const bodyPr = findChild(el, \"a:bodyPr\");\n if (bodyPr) {\n const bodyProperties = bodyPropertiesDesc.parse(bodyPr, ctx);\n if (bodyProperties) result.bodyProperties = bodyProperties;\n }\n const lstStyle = findChild(el, \"a:lstStyle\");\n if (lstStyle) {\n const listStyle = textListStyleDesc.parse(lstStyle, ctx);\n if (listStyle) result.listStyle = listStyle;\n }\n const style = findChild(el, \"a:style\");\n if (style) {\n const shapeStyle = parseShapeStyle(style, ctx);\n if (shapeStyle) result.shapeStyle = shapeStyle;\n }\n return Object.keys(result).length > 0 ? (result as DefaultShapeDefinitionOptions) : undefined;\n}\n\n/** Serialize a:objectDefaults. Returns an empty element when no defaults set. */\nexport function stringifyObjectDefaults(\n opts: ObjectDefaultsOptions | undefined,\n ctx: WriteContext,\n): string {\n if (!opts) return \"<a:objectDefaults/>\";\n const spDef = opts.shapeDefault\n ? stringifyDefaultShapeDefinition(\"a:spDef\", opts.shapeDefault, ctx)\n : \"\";\n const lnDef = opts.lineDefault\n ? stringifyDefaultShapeDefinition(\"a:lnDef\", opts.lineDefault, ctx)\n : \"\";\n const txDef = opts.textDefault\n ? stringifyDefaultShapeDefinition(\"a:txDef\", opts.textDefault, ctx)\n : \"\";\n if (!spDef && !lnDef && !txDef) return \"<a:objectDefaults/>\";\n return `<a:objectDefaults>${spDef}${lnDef}${txDef}</a:objectDefaults>`;\n}\n\n/** Parse a:objectDefaults. */\nexport function parseObjectDefaults(\n el: XmlElement | undefined,\n ctx: ReadContext,\n): ObjectDefaultsOptions | undefined {\n if (!el) return undefined;\n const result: Partial<ObjectDefaultsOptions> = {};\n const shapeDefault = parseDefaultShapeDefinition(findChild(el, \"a:spDef\"), ctx);\n if (shapeDefault) result.shapeDefault = shapeDefault;\n const lineDefault = parseDefaultShapeDefinition(findChild(el, \"a:lnDef\"), ctx);\n if (lineDefault) result.lineDefault = lineDefault;\n const textDefault = parseDefaultShapeDefinition(findChild(el, \"a:txDef\"), ctx);\n if (textDefault) result.textDefault = textDefault;\n return Object.keys(result).length > 0 ? (result as ObjectDefaultsOptions) : undefined;\n}\n","/**\n * Build theme XML string — structured driver over the CT_BaseStyles parts.\n *\n * Fresh output stays byte-identical to Office by reusing a pre-extracted\n * default fmtScheme fragment (O(1) fast path) unless the caller supplies a\n * structured formatScheme / objectDefaults / extraColorSchemes, in which case\n * the relevant descriptor serializes them.\n *\n * @module\n */\nimport type { WriteContext } from \"../descriptor\";\nimport { stringifyColorScheme } from \"./color-scheme\";\nimport { stringifyCustomColors } from \"./custom-color\";\nimport { stringifyExtraColorSchemes } from \"./extra-color-scheme\";\nimport { stringifyFontScheme } from \"./font-scheme\";\nimport { stringifyObjectDefaults } from \"./object-defaults\";\nimport { stringifyFormatScheme } from \"./style-matrix\";\nimport type { ThemeOptions } from \"./theme-options\";\n\n// Default Office fmtScheme — byte-identical to fresh output, keeps the common\n// path O(1) without running fill/line/effect descriptors.\nconst DEFAULT_FORMAT_SCHEME_XML =\n '<a:fmtScheme name=\"Office\"><a:fillStyleLst><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill>' +\n '<a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"110000\"/>' +\n '<a:satMod val=\"105000\"/><a:tint val=\"67000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\">' +\n '<a:lumMod val=\"105000\"/><a:satMod val=\"103000\"/><a:tint val=\"73000\"/></a:schemeClr></a:gs>' +\n '<a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"105000\"/><a:satMod val=\"109000\"/><a:tint val=\"81000\"/>' +\n '</a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill><a:gradFill rotWithShape=\"1\">' +\n '<a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"102000\"/><a:satMod val=\"103000\"/><a:tint val=\"94000\"/>' +\n '</a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"100000\"/><a:satMod val=\"110000\"/>' +\n '<a:shade val=\"100000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"99000\"/>' +\n '<a:satMod val=\"120000\"/><a:shade val=\"78000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/>' +\n '</a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w=\"6350\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill>' +\n '<a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln>' +\n '<a:ln w=\"12700\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill>' +\n '<a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln><a:ln w=\"19050\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\">' +\n '<a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln>' +\n \"</a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/>\" +\n '</a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad=\"57150\" dist=\"19050\" dir=\"5400000\" algn=\"ctr\" ' +\n 'rotWithShape=\"0\"><a:srgbClr val=\"000000\"><a:alpha val=\"63000\"/></a:srgbClr></a:outerShdw></a:effectLst>' +\n '</a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill>' +\n '<a:solidFill><a:schemeClr val=\"phClr\"><a:tint val=\"95000\"/><a:satMod val=\"170000\"/></a:schemeClr></a:solidFill>' +\n '<a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"102000\"/>' +\n '<a:satMod val=\"150000\"/><a:tint val=\"93000\"/><a:shade val=\"98000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\">' +\n '<a:schemeClr val=\"phClr\"><a:lumMod val=\"103000\"/><a:satMod val=\"130000\"/><a:tint val=\"98000\"/><a:shade val=\"90000\"/>' +\n '</a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:satMod val=\"120000\"/><a:shade val=\"63000\"/>' +\n '</a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill></a:bgFillStyleLst></a:fmtScheme>';\n\nfunction requireCtx(ctx: WriteContext | undefined, field: string): WriteContext {\n if (!ctx) throw new Error(`buildThemeXml: ${field} requires a WriteContext`);\n return ctx;\n}\n\nexport function buildThemeXml(options?: ThemeOptions, ctx?: WriteContext): string {\n const opts = options ?? {};\n const name = opts.name ?? \"Office Theme\";\n\n const clrScheme = stringifyColorScheme(opts.colorScheme, name);\n const fontScheme = stringifyFontScheme(opts.fontScheme, name);\n const fmtScheme = opts.formatScheme\n ? stringifyFormatScheme(opts.formatScheme, requireCtx(ctx, \"formatScheme\"))\n : DEFAULT_FORMAT_SCHEME_XML;\n const objectDefaults = opts.objectDefaults\n ? stringifyObjectDefaults(opts.objectDefaults, requireCtx(ctx, \"objectDefaults\"))\n : \"<a:objectDefaults/>\";\n const extraClrSchemeLst = stringifyExtraColorSchemes(opts.extraColorSchemes, name);\n const custClrLst = opts.customColors\n ? stringifyCustomColors(opts.customColors, requireCtx(ctx, \"customColors\"))\n : \"\";\n\n return (\n `<a:theme xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" name=\"${name}\">` +\n `<a:themeElements>${clrScheme}${fontScheme}${fmtScheme}</a:themeElements>` +\n `${objectDefaults}${extraClrSchemeLst}${custClrLst}</a:theme>`\n );\n}\n","/**\n * Theme XML generation — pure function with caching.\n *\n * Fresh output (no options) returns a pre-computed default. Simple customizations\n * (colorScheme / fontScheme only) are cached by serialized key. Complex\n * customizations (formatScheme / objectDefaults / extraColorSchemes) bypass the\n * cache — they are rare (round-trip produces a different theme each time) and\n * require a WriteContext for nested descriptors.\n *\n * @module\n */\nimport type { WriteContext } from \"../descriptor\";\nimport { buildThemeXml } from \"./build-theme-xml\";\nimport type { ThemeOptions } from \"./theme-options\";\n\n// Pre-computed default theme XML — zero allocation for the common case.\nconst DEFAULT_XML = buildThemeXml();\n\n// Cache for simple customizations, keyed by serialized options.\nconst customCache = new Map<string, string>();\n\nfunction isSimpleCustomization(opts: ThemeOptions): boolean {\n return !opts.formatScheme && !opts.objectDefaults && !opts.extraColorSchemes;\n}\n\nfunction simpleKey(o: ThemeOptions): string {\n return `${o.name ?? \"\"}|${JSON.stringify(o.colorScheme)}|${JSON.stringify(o.fontScheme)}`;\n}\n\n/**\n * Generate theme XML string from options.\n * Returns the cached default when no options are provided.\n */\nexport function createThemeXml(options?: ThemeOptions, ctx?: WriteContext): string {\n if (!options) return DEFAULT_XML;\n if (isSimpleCustomization(options)) {\n const key = simpleKey(options);\n const cached = customCache.get(key);\n if (cached) return cached;\n const built = buildThemeXml(options);\n customCache.set(key, built);\n return built;\n }\n return buildThemeXml(options, ctx);\n}\n","/**\n * Theme descriptor — bidirectional mapping between ThemeOptions and theme XML.\n *\n * stringify delegates to buildThemeXml (structured driver). parse reads the full\n * CT_BaseStyles surface: colorScheme, fontScheme, formatScheme, objectDefaults,\n * and extraClrSchemeLst — so every part round-trips.\n *\n * @module\n */\n\nimport { findChild } from \"@office-open/xml\";\nimport type { Element as XmlElement } from \"@office-open/xml\";\n\nimport type { CustomDescriptor, ReadContext, WriteContext } from \"../descriptor\";\nimport { buildThemeXml } from \"./build-theme-xml\";\nimport { parseColorScheme } from \"./color-scheme\";\nimport { parseCustomColors } from \"./custom-color\";\nimport { parseExtraColorSchemes } from \"./extra-color-scheme\";\nimport { parseFontScheme } from \"./font-scheme\";\nimport { parseObjectDefaults } from \"./object-defaults\";\nimport { parseFormatScheme } from \"./style-matrix\";\nimport type { ThemeOptions } from \"./theme-options\";\n\nexport const themeDesc: CustomDescriptor<ThemeOptions, WriteContext, ThemeOptions> = {\n kind: \"custom\",\n\n stringify(opts: ThemeOptions, ctx: WriteContext): string | undefined {\n return buildThemeXml(opts, ctx);\n },\n\n parse(el: XmlElement, ctx: ReadContext): ThemeOptions {\n const result: Partial<ThemeOptions> = {};\n\n const name = el.attributes?.[\"name\"];\n if (name) result.name = String(name);\n\n const themeElements = findChild(el, \"a:themeElements\");\n if (themeElements) {\n const colorScheme = parseColorScheme(findChild(themeElements, \"a:clrScheme\"));\n if (colorScheme) result.colorScheme = colorScheme;\n const fontScheme = parseFontScheme(findChild(themeElements, \"a:fontScheme\"));\n if (fontScheme) result.fontScheme = fontScheme;\n const formatScheme = parseFormatScheme(findChild(themeElements, \"a:fmtScheme\"), ctx);\n if (formatScheme) result.formatScheme = formatScheme;\n }\n\n const objectDefaults = parseObjectDefaults(findChild(el, \"a:objectDefaults\"), ctx);\n if (objectDefaults) result.objectDefaults = objectDefaults;\n\n const extraColorSchemes = parseExtraColorSchemes(findChild(el, \"a:extraClrSchemeLst\"));\n if (extraColorSchemes) result.extraColorSchemes = extraColorSchemes;\n\n const customColors = parseCustomColors(findChild(el, \"a:custClrLst\"), ctx);\n if (customColors) result.customColors = customColors;\n\n return result as ThemeOptions;\n },\n};\n","/**\n * Theme override and theme manager descriptors.\n *\n * a:themeOverride (CT_BaseStylesOverride) is the root of a themeOverride{n}.xml\n * part — an optional subset of the base styles that a slide/layout/master can\n * reference to deviate from its owning theme. a:themeManager (CT_EmptyElement)\n * is the root of the legacy themeManager part; it carries no content.\n *\n * @module\n */\n\nimport { findChild } from \"@office-open/xml\";\n\nimport type { CustomDescriptor, WriteContext } from \"../descriptor\";\nimport { parseColorScheme, stringifyColorScheme } from \"./color-scheme\";\nimport { parseFontScheme, stringifyFontScheme } from \"./font-scheme\";\nimport { parseFormatScheme, stringifyFormatScheme } from \"./style-matrix\";\nimport type { ThemeOverrideOptions } from \"./theme-options\";\n\nconst THEME_NS = 'xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"';\n\nexport const themeOverrideDesc: CustomDescriptor<\n ThemeOverrideOptions,\n WriteContext,\n ThemeOverrideOptions\n> = {\n kind: \"custom\",\n\n stringify(opts, ctx) {\n let content = \"\";\n if (opts.colorScheme) {\n content += stringifyColorScheme(opts.colorScheme, opts.colorScheme.name ?? \"Override\");\n }\n if (opts.fontScheme) {\n content += stringifyFontScheme(opts.fontScheme, opts.fontScheme.name ?? \"Override\");\n }\n if (opts.formatScheme) content += stringifyFormatScheme(opts.formatScheme, ctx);\n return `<a:themeOverride ${THEME_NS}>${content}</a:themeOverride>`;\n },\n\n parse(el, ctx) {\n const result: Partial<ThemeOverrideOptions> = {};\n const colorScheme = parseColorScheme(findChild(el, \"a:clrScheme\"));\n if (colorScheme) result.colorScheme = colorScheme;\n const fontScheme = parseFontScheme(findChild(el, \"a:fontScheme\"));\n if (fontScheme) result.fontScheme = fontScheme;\n const formatScheme = parseFormatScheme(findChild(el, \"a:fmtScheme\"), ctx);\n if (formatScheme) result.formatScheme = formatScheme;\n return result as ThemeOverrideOptions;\n },\n};\n\n/** Options for a themeManager part — CT_EmptyElement has no content or attributes. */\nexport type ThemeManagerOptions = Record<never, never>;\n\nexport const themeManagerDesc: CustomDescriptor<\n ThemeManagerOptions,\n WriteContext,\n ThemeManagerOptions\n> = {\n kind: \"custom\",\n\n stringify(_opts, _ctx) {\n return `<a:themeManager ${THEME_NS}/>`;\n },\n\n parse(_el, _ctx) {\n return {};\n },\n};\n"],"mappings":";;;;;;AAQA,MAAa,iBAA6D;CACxE,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,WAAW;CACX,mBAAmB;AACrB;;;;;;;;;;;;;ACFA,MAAM,aAA4D;CAChE;EAAE,KAAK;EAAS,KAAK;CAAQ;CAC7B;EAAE,KAAK;EAAS,KAAK;CAAS;CAC9B;EAAE,KAAK;EAAS,KAAK;CAAQ;CAC7B;EAAE,KAAK;EAAS,KAAK;CAAS;CAC9B;EAAE,KAAK;EAAa,KAAK;CAAU;CACnC;EAAE,KAAK;EAAa,KAAK;CAAU;CACnC;EAAE,KAAK;EAAa,KAAK;CAAU;CACnC;EAAE,KAAK;EAAa,KAAK;CAAU;CACnC;EAAE,KAAK;EAAa,KAAK;CAAU;CACnC;EAAE,KAAK;EAAa,K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