@office-open/core 0.12.3 → 0.13.1
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-DEIF3VZn.mjs → chart-Bn_McAo-.mjs} +4 -4
- package/dist/chart-Bn_McAo-.mjs.map +1 -0
- package/dist/drawing/index.d.mts +2 -2
- package/dist/drawing/index.mjs +1 -1
- package/dist/{drawing-BVwCkNXB.mjs → drawing-DJ363Awy.mjs} +102 -108
- package/dist/drawing-DJ363Awy.mjs.map +1 -0
- package/dist/{ext-uri-BHBcIrW7.mjs → ext-uri-BR1ouCh3.mjs} +6 -11
- package/dist/ext-uri-BR1ouCh3.mjs.map +1 -0
- package/dist/{index-DRggxtp7.d.mts → index-6_MYd0cg.d.mts} +3 -3
- package/dist/{index-DRggxtp7.d.mts.map → index-6_MYd0cg.d.mts.map} +1 -1
- package/dist/{index-DPkf_CtG.d.mts → index-BDeoFmTS.d.mts} +146 -149
- package/dist/index-BDeoFmTS.d.mts.map +1 -0
- package/dist/{index-DfFszyH1.d.mts → index-Cd0lFS5x.d.mts} +9 -17
- package/dist/index-Cd0lFS5x.d.mts.map +1 -0
- package/dist/{index-DcukVskh.d.mts → index-DOtPArpl.d.mts} +2 -2
- package/dist/{index-DcukVskh.d.mts.map → index-DOtPArpl.d.mts.map} +1 -1
- package/dist/{index-BwRtWyaP.d.mts → index-Dg0nIw2S.d.mts} +7 -7
- package/dist/{index-BwRtWyaP.d.mts.map → index-Dg0nIw2S.d.mts.map} +1 -1
- package/dist/{index-L6AXewfV.d.mts → index-DkJrkIVp.d.mts} +2 -3
- package/dist/index-DkJrkIVp.d.mts.map +1 -0
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +30 -10
- package/dist/index.mjs.map +1 -1
- package/dist/patch-AkQY17CD.mjs.map +1 -1
- package/dist/smartart/index.d.mts +1 -1
- package/dist/smartart/index.mjs +1 -1
- package/dist/{smartart-YH87Emca.mjs → smartart-D-8KBdQ_.mjs} +4 -4
- package/dist/{smartart-YH87Emca.mjs.map → smartart-D-8KBdQ_.mjs.map} +1 -1
- package/dist/{style-matrix-DjhMuuQg.mjs → style-matrix-B6YSVw6a.mjs} +2 -2
- package/dist/{style-matrix-DjhMuuQg.mjs.map → style-matrix-B6YSVw6a.mjs.map} +1 -1
- package/dist/theme/index.d.mts +3 -3
- package/dist/theme/index.mjs +2 -2
- package/dist/{theme-Dx0Db9bX.mjs → theme-BdqG5lmO.mjs} +3 -3
- package/dist/theme-BdqG5lmO.mjs.map +1 -0
- package/dist/{theme-options-kO89NUEX.d.mts → theme-options-wZX4i_xx.d.mts} +2 -2
- package/dist/{theme-options-kO89NUEX.d.mts.map → theme-options-wZX4i_xx.d.mts.map} +1 -1
- package/dist/util/index.d.mts +2 -2
- package/dist/util/index.mjs +3 -3
- package/dist/{util-iHHKF2Rx.mjs → util-BGfk-gE0.mjs} +2 -2
- package/dist/{util-iHHKF2Rx.mjs.map → util-BGfk-gE0.mjs.map} +1 -1
- package/dist/vector/index.d.mts +2 -2
- package/dist/vector/index.mjs +2 -2
- package/dist/{vector-DZ_OteHJ.mjs → vector-BhETDAdp.mjs} +2 -9
- package/dist/vector-BhETDAdp.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/chart-DEIF3VZn.mjs.map +0 -1
- package/dist/drawing-BVwCkNXB.mjs.map +0 -1
- package/dist/ext-uri-BHBcIrW7.mjs.map +0 -1
- package/dist/index-DPkf_CtG.d.mts.map +0 -1
- package/dist/index-DfFszyH1.d.mts.map +0 -1
- package/dist/index-L6AXewfV.d.mts.map +0 -1
- package/dist/theme-Dx0Db9bX.mjs.map +0 -1
- package/dist/vector-DZ_OteHJ.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smartart-YH87Emca.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). */\n type?: \"node\" | \"asst\" | \"doc\" | \"pres\" | \"parTrans\" | \"sibTrans\";\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). */\n type?: \"parOf\" | \"presOf\" | \"presParOf\" | \"unknownRelationship\";\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 as ModelPointOptions[\"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 as ModelConnectionOptions[\"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 type { ShapeType } from \"../drawing/geometry/preset-geometry\";\nimport {\n xsdAnimLevel,\n xsdDiagramDirection,\n xsdHierBranch,\n xsdResizeHandles,\n} from \"../util/mappings\";\nimport { parseOnOff } from \"../util/values\";\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/**\n * ST_ParameterId (dgm:param `@type`) — 55 transitional layout-parameter ids\n * verbatim, plus the numCol/animBg extension ids Office 2010+ layoutDefs use\n * (dgm14, outside the transitional XSD).\n */\nexport type AlgorithmParameterType =\n | \"horzAlign\"\n | \"vertAlign\"\n | \"chDir\"\n | \"chAlign\"\n | \"secChAlign\"\n | \"linDir\"\n | \"secLinDir\"\n | \"stElem\"\n | \"bendPt\"\n | \"connRout\"\n | \"begSty\"\n | \"endSty\"\n | \"dim\"\n | \"rotPath\"\n | \"ctrShpMap\"\n | \"nodeHorzAlign\"\n | \"nodeVertAlign\"\n | \"fallback\"\n | \"txDir\"\n | \"pyraAcctPos\"\n | \"pyraAcctTxMar\"\n | \"txBlDir\"\n | \"txAnchorHorz\"\n | \"txAnchorVert\"\n | \"txAnchorHorzCh\"\n | \"txAnchorVertCh\"\n | \"parTxLTRAlign\"\n | \"parTxRTLAlign\"\n | \"shpTxLTRAlignCh\"\n | \"shpTxRTLAlignCh\"\n | \"autoTxRot\"\n | \"grDir\"\n | \"flowDir\"\n | \"contDir\"\n | \"bkpt\"\n | \"off\"\n | \"hierAlign\"\n | \"bkPtFixedVal\"\n | \"stBulletLvl\"\n | \"stAng\"\n | \"spanAng\"\n | \"ar\"\n | \"lnSpPar\"\n | \"lnSpAfParP\"\n | \"lnSpCh\"\n | \"lnSpAfChP\"\n | \"rtShortDist\"\n | \"alignTx\"\n | \"pyraLvlNode\"\n | \"pyraAcctBkgdNode\"\n | \"pyraAcctTxNode\"\n | \"srcNode\"\n | \"dstNode\"\n | \"begPts\"\n | \"endPts\"\n | \"numCol\"\n | \"animBg\";\n\n/** ST_Direction (dgm:dir `@val`). */\nexport type DiagramDirection = \"normal\" | \"reversed\";\n\n/** ST_ResizeHandlesStr (dgm:resizeHandles `@val`). */\nexport type ResizeHandles = \"exact\" | \"relative\";\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 — those stay plain string by design.\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: AlgorithmParameterType;\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?: ShapeType | \"none\" | \"conn\";\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 dgm: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 dgm: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 !== undefined ? xsdDiagramDirection.to(o.direction) : undefined) +\n emit(\n \"hierBranch\",\n o.hierarchyBranchStyle !== undefined ? xsdHierBranch.to(o.hierarchyBranchStyle) : undefined,\n ) +\n emit(\"animOne\", o.animateOne) +\n emit(\"animLvl\", o.animateLevel !== undefined ? xsdAnimLevel.to(o.animateLevel) : undefined) +\n emit(\n \"resizeHandles\",\n o.resizeHandles !== undefined ? xsdResizeHandles.to(o.resizeHandles) : undefined,\n ) +\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 // CT_LayoutNode declares extLst locally — the element is dgm-namespaced\n const body = stringifyChildren(o.children) + (o.ext ? `<dgm:extLst>${o.ext}</dgm: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 ? `<dgm:extLst>${o.ext}</dgm: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\";\nconst R_NS = \"http://schemas.openxmlformats.org/officeDocument/2006/relationships\";\n\n/**\n * Inject the part-level dgm/a namespace declarations into the root element of\n * a serialized layoutDef/styleDef/colorsDef body; r joins only when the body\n * actually uses the prefix (dgm:shape @r:blip preview references).\n */\nexport function withDiagramNamespaces(xml: string): string {\n const r = xml.includes(\"xmlns:r=\") ? \"\" : /\\sr:[\\w]+=/.test(xml) ? ` xmlns:r=\"${R_NS}\"` : \"\";\n return xml.replace(\n /^<dgm:(layoutDef|styleDef|colorsDef)/,\n `<dgm:$1 xmlns:dgm=\"${DGM_NS}\" xmlns:a=\"${A_NS}\"${r}`,\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\") ?? \"\") as AlgorithmParameterType,\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 as LayoutShapeOptions[\"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 = parseOnOff(hideGeom) ?? false;\n const lkTxEntry = attr(el, \"lkTxEntry\");\n if (lkTxEntry !== undefined) result.lockTextEntry = parseOnOff(lkTxEntry) ?? false;\n const blipPhldr = attr(el, \"blipPhldr\");\n if (blipPhldr !== undefined) result.blipPlaceholder = parseOnOff(blipPhldr) ?? false;\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 parseOnOff(v) ?? false;\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 = xsdDiagramDirection.from(direction) as DiagramDirection;\n const hierBranch = readEnum(\"hierBranch\");\n if (hierBranch) result.hierarchyBranchStyle = xsdHierBranch.from(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 = xsdAnimLevel.from(animLvl) as AnimationLevel;\n const resizeHandles = readEnum(\"resizeHandles\");\n if (resizeHandles) result.resizeHandles = xsdResizeHandles.from(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, \"dgm: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 = parseOnOff(useDef) ?? false;\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, \"dgm: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 dgm: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 // CT_ColorTransform declares extLst locally — the element is dgm-namespaced\n (o.ext ? `<dgm:extLst>${o.ext}</dgm: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, \"dgm: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 dgm: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 dgm: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 // CT_StyleLabel declares extLst locally — the element is dgm-namespaced\n if (o.ext) body += `<dgm:extLst>${o.ext}</dgm: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 ? `<dgm:extLst>${o.ext}</dgm: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, \"dgm: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, \"dgm: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 type { Scene3DOptions } from \"../drawing/three-d/scene-3d\";\nimport { COLOR_CATEGORIES, LAYOUT_CATEGORIES, STYLE_CATEGORIES } from \"./categories\";\nimport { stringifyColorDefinitionPart, type ColorDefinitionOptions } from \"./color-definition\";\nimport type { ModelPointOptions } from \"./data-model/data-model\";\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: ModelPointOptions[] = [\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: \"normal\", 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: Scene3DOptions = {\n camera: { preset: \"orthographicFront\" },\n lightRig: { rig: \"threePt\", direction: \"top\" },\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 { DataType } from \"../util/data-type\";\nimport type { ColorDefinitionOptions } from \"./color-definition\";\nimport type { LayoutDefinitionOptions } from \"./layout-definition\";\nimport type { StyleDefinitionOptions } from \"./style-definition\";\n\n/**\n * Verbatim source parts for byte-exact SmartArt round-trip. When set on a\n * `SmartArtData` entry, the compiler re-emits these bytes under the\n * diagram part names instead of rebuilding from the modeled XML.\n */\nexport interface SmartArtRawParts {\n /** word/diagrams/dataN.xml source bytes. */\n data?: DataType;\n /** word/diagrams/layoutN.xml source bytes. */\n layout?: DataType;\n /** word/diagrams/quickStyleN.xml source bytes. */\n style?: DataType;\n /** word/diagrams/colorsN.xml source bytes. */\n color?: DataType;\n /**\n * word/diagrams/drawingN.xml source bytes — the pre-rendered dsp:drawing\n * snapshot (MS-ODRAWXML 2008 extension) Word caches beside the data model.\n * Falls back to an empty spTree shell when absent.\n */\n drawing?: DataType;\n /** Images referenced by the data part's own rels (dgm:pt blipFill art). */\n media?: { fileName: string; data: DataType }[];\n /** Verbatim rels XML of the data part (its rIds resolve against media). */\n dataRels?: DataType;\n}\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 * Round-trip verbatim parts; emitted in place of the modeled XML. The\n * modeled fields stay populated so the Options remain readable and dropping\n * raw rebuilds from them.\n */\n raw?: SmartArtRawParts;\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 /** Cached `array` snapshot — invalidated on add. */\n private cachedArray: SmartArtData[] | undefined;\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 this.cachedArray = undefined;\n }\n\n public get array(): SmartArtData[] {\n if (this.cachedArray === undefined) this.cachedArray = [...this.map.values()];\n return this.cachedArray;\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,W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ACzE,MAAM,WAAW,KAAK;GACtB,MAAM,eAAe,KAAK;GAC1B,MAAM,eAAe,KAAK;GAC1B,MAAM,UAAU,KAAK;GAErB,UAAU,KAAK,oBAAoB,cAAc,YAAY,OAAO,CAAC;GACrE,UAAU,KAAK,oBAAoB,cAAc,YAAY,OAAO,CAAC;GACrE,UAAU,KAAK,eAAe,UAAU,KAAK,IAAI,CAAC;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
|
+
{"version":3,"file":"smartart-D-8KBdQ_.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). */\n type?: \"node\" | \"asst\" | \"doc\" | \"pres\" | \"parTrans\" | \"sibTrans\";\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). */\n type?: \"parOf\" | \"presOf\" | \"presParOf\" | \"unknownRelationship\";\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 as ModelPointOptions[\"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 as ModelConnectionOptions[\"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 type { ShapeType } from \"../drawing/geometry/preset-geometry\";\nimport {\n xsdAnimLevel,\n xsdDiagramDirection,\n xsdHierBranch,\n xsdResizeHandles,\n} from \"../util/mappings\";\nimport { parseOnOff } from \"../util/values\";\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/**\n * ST_ParameterId (dgm:param `@type`) — 55 transitional layout-parameter ids\n * verbatim, plus the numCol/animBg extension ids Office 2010+ layoutDefs use\n * (dgm14, outside the transitional XSD).\n */\nexport type AlgorithmParameterType =\n | \"horzAlign\"\n | \"vertAlign\"\n | \"chDir\"\n | \"chAlign\"\n | \"secChAlign\"\n | \"linDir\"\n | \"secLinDir\"\n | \"stElem\"\n | \"bendPt\"\n | \"connRout\"\n | \"begSty\"\n | \"endSty\"\n | \"dim\"\n | \"rotPath\"\n | \"ctrShpMap\"\n | \"nodeHorzAlign\"\n | \"nodeVertAlign\"\n | \"fallback\"\n | \"txDir\"\n | \"pyraAcctPos\"\n | \"pyraAcctTxMar\"\n | \"txBlDir\"\n | \"txAnchorHorz\"\n | \"txAnchorVert\"\n | \"txAnchorHorzCh\"\n | \"txAnchorVertCh\"\n | \"parTxLTRAlign\"\n | \"parTxRTLAlign\"\n | \"shpTxLTRAlignCh\"\n | \"shpTxRTLAlignCh\"\n | \"autoTxRot\"\n | \"grDir\"\n | \"flowDir\"\n | \"contDir\"\n | \"bkpt\"\n | \"off\"\n | \"hierAlign\"\n | \"bkPtFixedVal\"\n | \"stBulletLvl\"\n | \"stAng\"\n | \"spanAng\"\n | \"ar\"\n | \"lnSpPar\"\n | \"lnSpAfParP\"\n | \"lnSpCh\"\n | \"lnSpAfChP\"\n | \"rtShortDist\"\n | \"alignTx\"\n | \"pyraLvlNode\"\n | \"pyraAcctBkgdNode\"\n | \"pyraAcctTxNode\"\n | \"srcNode\"\n | \"dstNode\"\n | \"begPts\"\n | \"endPts\"\n | \"numCol\"\n | \"animBg\";\n\n/** ST_Direction (dgm:dir `@val`). */\nexport type DiagramDirection = \"normal\" | \"reversed\";\n\n/** ST_ResizeHandlesStr (dgm:resizeHandles `@val`). */\nexport type ResizeHandles = \"exact\" | \"relative\";\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 — those stay plain string by design.\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: AlgorithmParameterType;\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?: ShapeType | \"none\" | \"conn\";\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 dgm: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 dgm: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 !== undefined ? xsdDiagramDirection.to(o.direction) : undefined) +\n emit(\n \"hierBranch\",\n o.hierarchyBranchStyle !== undefined ? xsdHierBranch.to(o.hierarchyBranchStyle) : undefined,\n ) +\n emit(\"animOne\", o.animateOne) +\n emit(\"animLvl\", o.animateLevel !== undefined ? xsdAnimLevel.to(o.animateLevel) : undefined) +\n emit(\n \"resizeHandles\",\n o.resizeHandles !== undefined ? xsdResizeHandles.to(o.resizeHandles) : undefined,\n ) +\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 // CT_LayoutNode declares extLst locally — the element is dgm-namespaced\n const body = stringifyChildren(o.children) + (o.ext ? `<dgm:extLst>${o.ext}</dgm: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 ? `<dgm:extLst>${o.ext}</dgm: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\";\nconst R_NS = \"http://schemas.openxmlformats.org/officeDocument/2006/relationships\";\n\n/**\n * Inject the part-level dgm/a namespace declarations into the root element of\n * a serialized layoutDef/styleDef/colorsDef body; r joins only when the body\n * actually uses the prefix (dgm:shape @r:blip preview references).\n */\nexport function withDiagramNamespaces(xml: string): string {\n const r = xml.includes(\"xmlns:r=\") ? \"\" : /\\sr:[\\w]+=/.test(xml) ? ` xmlns:r=\"${R_NS}\"` : \"\";\n return xml.replace(\n /^<dgm:(layoutDef|styleDef|colorsDef)/,\n `<dgm:$1 xmlns:dgm=\"${DGM_NS}\" xmlns:a=\"${A_NS}\"${r}`,\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\") ?? \"\") as AlgorithmParameterType,\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 as LayoutShapeOptions[\"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 = parseOnOff(hideGeom) ?? false;\n const lkTxEntry = attr(el, \"lkTxEntry\");\n if (lkTxEntry !== undefined) result.lockTextEntry = parseOnOff(lkTxEntry) ?? false;\n const blipPhldr = attr(el, \"blipPhldr\");\n if (blipPhldr !== undefined) result.blipPlaceholder = parseOnOff(blipPhldr) ?? false;\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 parseOnOff(v) ?? false;\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 = xsdDiagramDirection.from(direction) as DiagramDirection;\n const hierBranch = readEnum(\"hierBranch\");\n if (hierBranch) result.hierarchyBranchStyle = xsdHierBranch.from(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 = xsdAnimLevel.from(animLvl) as AnimationLevel;\n const resizeHandles = readEnum(\"resizeHandles\");\n if (resizeHandles) result.resizeHandles = xsdResizeHandles.from(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, \"dgm: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 = parseOnOff(useDef) ?? false;\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, \"dgm: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 dgm: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 // CT_ColorTransform declares extLst locally — the element is dgm-namespaced\n (o.ext ? `<dgm:extLst>${o.ext}</dgm: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, \"dgm: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 dgm: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 dgm: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 // CT_StyleLabel declares extLst locally — the element is dgm-namespaced\n if (o.ext) body += `<dgm:extLst>${o.ext}</dgm: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 ? `<dgm:extLst>${o.ext}</dgm: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, \"dgm: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, \"dgm: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 type { Scene3DOptions } from \"../drawing/three-d/scene-3d\";\nimport { COLOR_CATEGORIES, LAYOUT_CATEGORIES, STYLE_CATEGORIES } from \"./categories\";\nimport { stringifyColorDefinitionPart, type ColorDefinitionOptions } from \"./color-definition\";\nimport type { ModelPointOptions } from \"./data-model/data-model\";\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: ModelPointOptions[] = [\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: \"normal\", 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: Scene3DOptions = {\n camera: { preset: \"orthographicFront\" },\n lightRig: { rig: \"threePt\", direction: \"top\" },\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 { DataType } from \"../util/data-type\";\nimport type { ColorDefinitionOptions } from \"./color-definition\";\nimport type { LayoutDefinitionOptions } from \"./layout-definition\";\nimport type { StyleDefinitionOptions } from \"./style-definition\";\n\n/**\n * Verbatim source parts for byte-exact SmartArt round-trip. When set on a\n * `SmartArtData` entry, the compiler re-emits these bytes under the\n * diagram part names instead of rebuilding from the modeled XML.\n */\nexport interface SmartArtRawParts {\n /** word/diagrams/dataN.xml source bytes. */\n data?: DataType;\n /** word/diagrams/layoutN.xml source bytes. */\n layout?: DataType;\n /** word/diagrams/quickStyleN.xml source bytes. */\n style?: DataType;\n /** word/diagrams/colorsN.xml source bytes. */\n color?: DataType;\n /**\n * word/diagrams/drawingN.xml source bytes — the pre-rendered dsp:drawing\n * snapshot (MS-ODRAWXML 2008 extension) Word caches beside the data model.\n * Falls back to an empty spTree shell when absent.\n */\n drawing?: DataType;\n /** Images referenced by the data part's own rels (dgm:pt blipFill art). */\n media?: { fileName: string; data: DataType }[];\n /** Verbatim rels XML of the data part (its rIds resolve against media). */\n dataRels?: DataType;\n}\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 * Round-trip verbatim parts; emitted in place of the modeled XML. The\n * modeled fields stay populated so the Options remain readable and dropping\n * raw rebuilds from them.\n */\n raw?: SmartArtRawParts;\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 /** Cached `array` snapshot — invalidated on add. */\n private cachedArray: SmartArtData[] | undefined;\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 this.cachedArray = undefined;\n }\n\n public get array(): SmartArtData[] {\n if (this.cachedArray === undefined) this.cachedArray = [...this.map.values()];\n return this.cachedArray;\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;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