pptx-ts 0.0.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -269
- package/dist/autopage-odPz7zZO.js +536 -0
- package/dist/autopage-odPz7zZO.js.map +1 -0
- package/dist/binary-string-CKVAYI3M.js +24 -0
- package/dist/binary-string-CKVAYI3M.js.map +1 -0
- package/dist/body-insets-Dw_BeWD_.js +54 -0
- package/dist/body-insets-Dw_BeWD_.js.map +1 -0
- package/dist/browser.d.ts +29 -9
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +41 -14
- package/dist/browser.js.map +1 -1
- package/dist/clip-Bl01BPcN.d.ts +67 -0
- package/dist/clip-Bl01BPcN.d.ts.map +1 -0
- package/dist/diagnostics-D8ot4Ei7.d.ts +244 -0
- package/dist/diagnostics-D8ot4Ei7.d.ts.map +1 -0
- package/dist/embedded-fonts-DarT9aoa.d.ts +20 -0
- package/dist/embedded-fonts-DarT9aoa.d.ts.map +1 -0
- package/dist/entry-compose-DCnvBZz2.d.ts +1046 -0
- package/dist/entry-compose-DCnvBZz2.d.ts.map +1 -0
- package/dist/{enums-CvRYniUA.d.ts → enums-BUKTUB6V.d.ts} +21 -13
- package/dist/{enums-CvRYniUA.d.ts.map → enums-BUKTUB6V.d.ts.map} +1 -1
- package/dist/{errors-Bvln0H-7.js → errors-C4oENPcu.js} +92 -2
- package/dist/errors-C4oENPcu.js.map +1 -0
- package/dist/families.d.ts +260 -0
- package/dist/families.d.ts.map +1 -0
- package/dist/families.js +57 -0
- package/dist/families.js.map +1 -0
- package/dist/{fit-BKs0zxMI.js → fit-Cb7naFj6.js} +249 -167
- package/dist/fit-Cb7naFj6.js.map +1 -0
- package/dist/font-metrics-v5fn7s7e.d.ts +613 -0
- package/dist/font-metrics-v5fn7s7e.d.ts.map +1 -0
- package/dist/grid-DikTjFey.js +187 -0
- package/dist/grid-DikTjFey.js.map +1 -0
- package/dist/{html-dom-B0I0QSbU.js → html-dom-Iuog2wdK.js} +121 -91
- package/dist/html-dom-Iuog2wdK.js.map +1 -0
- package/dist/html.d.ts +6 -6
- package/dist/html.d.ts.map +1 -1
- package/dist/html.js +7 -6
- package/dist/html.js.map +1 -1
- package/dist/image-size-CvN2iCA4.js +1611 -0
- package/dist/image-size-CvN2iCA4.js.map +1 -0
- package/dist/index.d.ts +24 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -11
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +40 -31
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +40 -48
- package/dist/inspect.js.map +1 -1
- package/dist/math.d.ts +7 -5
- package/dist/math.d.ts.map +1 -1
- package/dist/math.js +16 -7
- package/dist/math.js.map +1 -1
- package/dist/measure.d.ts +12 -225
- package/dist/measure.d.ts.map +1 -1
- package/dist/measure.js +3 -3
- package/dist/node.d.ts +22 -8
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +27 -7
- package/dist/node.js.map +1 -1
- package/dist/notes-Dh12JAbn.js +3264 -0
- package/dist/notes-Dh12JAbn.js.map +1 -0
- package/dist/options-internal-WqgMf720.js +43 -0
- package/dist/options-internal-WqgMf720.js.map +1 -0
- package/dist/{package-CaOLXSNi.d.ts → package-J49Ck6S2.d.ts} +27 -12
- package/dist/package-J49Ck6S2.d.ts.map +1 -0
- package/dist/playbtn-CUqQdoDf.js +22 -0
- package/dist/playbtn-CUqQdoDf.js.map +1 -0
- package/dist/{slide-js0QpRV-.d.ts → pres-C6qgOFAa.d.ts} +1021 -1370
- package/dist/pres-C6qgOFAa.d.ts.map +1 -0
- package/dist/{presentation-Cp7vzlAw.js → presentation-DGYlAWhl.js} +3208 -2727
- package/dist/presentation-DGYlAWhl.js.map +1 -0
- package/dist/{presentation-types-DP_8jog7.d.ts → presentation-types-8jLQHI4M.d.ts} +1070 -683
- package/dist/presentation-types-8jLQHI4M.d.ts.map +1 -0
- package/dist/read.d.ts +9 -9
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +4 -4
- package/dist/script.d.ts +80 -66
- package/dist/script.d.ts.map +1 -1
- package/dist/script.js +2399 -1139
- package/dist/script.js.map +1 -1
- package/dist/{shapes-BemroU-z.js → shapes-re0KyQk_.js} +2807 -1609
- package/dist/shapes-re0KyQk_.js.map +1 -0
- package/dist/slide-Dx2ZeVZ6.d.ts +1256 -0
- package/dist/slide-Dx2ZeVZ6.d.ts.map +1 -0
- package/dist/slide-size-BalTjFuv.js +88 -0
- package/dist/slide-size-BalTjFuv.js.map +1 -0
- package/dist/{units-internal-Dg95w_YD.js → table-cell-margins-EVg0EwxT.js} +235 -273
- package/dist/table-cell-margins-EVg0EwxT.js.map +1 -0
- package/dist/table-dom-BTDP3lEP.js +21 -0
- package/dist/table-dom-BTDP3lEP.js.map +1 -0
- package/dist/text-KnLOtEEu.js +3980 -0
- package/dist/text-KnLOtEEu.js.map +1 -0
- package/dist/text-anchor-CrYXAfUu.js +176 -0
- package/dist/text-anchor-CrYXAfUu.js.map +1 -0
- package/dist/transition-speed-kUEWDWTx.js +14 -0
- package/dist/transition-speed-kUEWDWTx.js.map +1 -0
- package/dist/units-internal-XJlf-hOl.js +649 -0
- package/dist/units-internal-XJlf-hOl.js.map +1 -0
- package/dist/zip-C0leZZMj.d.ts +67 -0
- package/dist/zip-C0leZZMj.d.ts.map +1 -0
- package/dist/zip-CKd8ihcf.js +177 -0
- package/dist/zip-CKd8ihcf.js.map +1 -0
- package/dist/zip.d.ts +3 -68
- package/dist/zip.js +3 -163
- package/dist/zoom-cX9sllpH.js +8865 -0
- package/dist/zoom-cX9sllpH.js.map +1 -0
- package/package.json +106 -19
- package/skills/ts-pptx-upstream/SKILL.md +58 -57
- package/dist/autopage-DkjYZUFD.js +0 -423
- package/dist/autopage-DkjYZUFD.js.map +0 -1
- package/dist/diagnostics-Du_s75MT.d.ts +0 -829
- package/dist/diagnostics-Du_s75MT.d.ts.map +0 -1
- package/dist/errors-Bvln0H-7.js.map +0 -1
- package/dist/errors-PflMPWBn.d.ts +0 -182
- package/dist/errors-PflMPWBn.d.ts.map +0 -1
- package/dist/fit-BKs0zxMI.js.map +0 -1
- package/dist/html-dom-B0I0QSbU.js.map +0 -1
- package/dist/namespaces-BVnNu7sg.js +0 -666
- package/dist/namespaces-BVnNu7sg.js.map +0 -1
- package/dist/notes-RLCwdlTE.js +0 -1703
- package/dist/notes-RLCwdlTE.js.map +0 -1
- package/dist/package-CaOLXSNi.d.ts.map +0 -1
- package/dist/pres-C5__xkDh.d.ts +0 -202
- package/dist/pres-C5__xkDh.d.ts.map +0 -1
- package/dist/presentation-Cp7vzlAw.js.map +0 -1
- package/dist/presentation-types-DP_8jog7.d.ts.map +0 -1
- package/dist/shapes-BemroU-z.js.map +0 -1
- package/dist/slide-js0QpRV-.d.ts.map +0 -1
- package/dist/text-CyetbF6p.js +0 -11278
- package/dist/text-CyetbF6p.js.map +0 -1
- package/dist/units-1kRzYShk.js +0 -231
- package/dist/units-1kRzYShk.js.map +0 -1
- package/dist/units-internal-Dg95w_YD.js.map +0 -1
- package/dist/zip.d.ts.map +0 -1
- package/dist/zip.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-KnLOtEEu.js","names":["extractSlidesFrom"],"sources":["../src/gen/define/background.ts","../src/slide.ts","../src/font-source.ts","../src/gen/define/master.ts","../src/gen/define/placeholder.ts","../src/media/placeholders.ts","../src/gen/media.ts","../src/gen/prepare.ts","../src/gen/anim/animation.ts","../src/gen/anim/timing.ts","../src/gen/anim/transition.ts","../src/gen/slide/object.ts","../src/gen/slide/slide.ts","../src/gen/pres/theme.ts","../src/gen/extract-slides.ts","../src/gen/opc/app.ts","../src/gen/opc/content-types.ts","../src/gen/opc/custom-props.ts","../src/gen/opc/root-rels.ts","../src/gen/pres/presentation-rels.ts","../src/gen/pres/presentation.ts","../src/gen/pres/table-styles.ts","../src/gen/slide/layout.ts","../src/gen/slide/master.ts","../src/package/parts/shared.ts","../src/package/assemble.ts","../src/presentation.ts","../src/families/core.ts","../src/entry-compose.ts","../src/entry-families.ts","../src/runtime/fetch-media.ts","../src/clip.ts","../src/types/text.ts"],"sourcesContent":["/**\n * ts-pptx: Background Definition\n *\n * Registers an `addBackground()` image as a slide media rel (color backgrounds carry no rel);\n * the `<p:bg>` XML is emitted later at slide / layout serialize time.\n */\nimport { warn } from '../../diagnostics.js'\nimport type { BackgroundOption } from '../../types/index.js'\nimport type { PresSlideInternal, SlideLayoutInternal } from '../../types/internal.js'\nimport { imageContentType } from '../../media/content-type.js'\nimport { getNewRelId, preencodedPath } from '../utils.js'\nimport { pushMediaRel, resolveImageSource } from './image-rel.js'\n\n/**\n * Adds a background image or color to a slide definition.\n *\n * Only an image background does anything here: it is the one that needs a media relationship.\n * A colour — object or the bare-string shorthand — carries no rel and is emitted straight from\n * `slide.background` at serialize time.\n *\n * The rel id and the part name come from the shared allocators. This used to take the id as\n * `_relsMedia.length + 1`, which a hyperlink or chart rel could already hold, and to name the part\n * after the slide or layout title. Titles are caller-supplied and different ones sanitize alike,\n * so \"A B\" and \"A-B\", or a layout titled \"Slide 1\" beside slide 1, wrote one part that both\n * backgrounds pointed at. `nextMediaTarget` keys the name by slide, layout or master, never\n * by title, so it is unique and needs no sanitizing.\n *\n * Called on every assignment, so it replaces what an earlier one registered. A new image takes\n * over the earlier background's rel in place, keeping its id and its part name, rather than\n * pushing a second one; replacing it by removal would shift the media count every later part name\n * is read from. A colour clears the image rel id, which `slideBackgroundXml` checks before it looks\n * at a colour, so an image replaced by a colour stops painting.\n *\n * The image's rel stays in `_relsMedia` for the same reason, so a package whose image background\n * was replaced by a colour still carries the image part and an `image` relationship nothing\n * references. That is valid OPC, only unused bytes. Dropping it would need either a tombstone the\n * rel and part emitters skip, or media part names that do not depend on the count.\n *\n * An image whose `data` has no base64 header is dropped with a warning, as an image fill's is,\n * and leaves any colour the background states to paint. It used to be written as a part holding\n * the caller's text.\n * @param {BackgroundOption} props - a bare colour, or an object with a colour or image definition\n * @param {SlideLayoutInternal} target - slide or layout that the background is set on\n */\nexport function addBackgroundDefinition(props: BackgroundOption | undefined, target: SlideLayoutInternal): void {\n\tif (!(props && typeof props === 'object' && (props.path || props.data))) {\n\t\tdelete target._bkgdImgRid\n\t\treturn\n\t}\n\n\t// The `data:` mime wins over `path`, as it does for `addImage()`: a background supplied as\n\t// bytes alone used to fall back on a PNG placeholder path and declare `image/png` no matter\n\t// what it actually carried, so `{ data: 'data:image/svg+xml;…' }` shipped SVG bytes in a part\n\t// the package announced as PNG.\n\tconst source = resolveImageSource(props)\n\tif (typeof source === 'string') {\n\t\twarn(\n\t\t\t'background/missing-base64-header',\n\t\t\t\"background `data` value lacks a base64 header (ex: 'image/png;base64,...'); ignoring the background image.\"\n\t\t)\n\t\tdelete target._bkgdImgRid\n\t\treturn\n\t}\n\tlet strImgExtn = source.extn\n\tif (strImgExtn === 'jpg') strImgExtn = 'jpeg' // base64-encoded jpg's come out as \"data:image/jpeg;base64,/9j/[...]\", so correct exttnesion to avoid content warnings at PPT startup\n\tconst type = imageContentType(strImgExtn)\n\n\tconst previous = target._relsMedia.findIndex((rel) => rel.rId === target._bkgdImgRid)\n\tconst replaced = target._relsMedia[previous]\n\tif (replaced) {\n\t\t// The record `pushMediaRel` would write, on the rel and part the earlier background holds.\n\t\t// Kept local: `props` is the caller's own object on the `slide.background =` path, not a clone.\n\t\ttarget._relsMedia[previous] = {\n\t\t\tpath: source.path || preencodedPath(strImgExtn),\n\t\t\ttype,\n\t\t\textn: strImgExtn,\n\t\t\tdata: source.data,\n\t\t\trId: replaced.rId,\n\t\t\tTarget: replaced.Target.replace(/\\.[^./]+$/, `.${strImgExtn}`),\n\t\t}\n\t\treturn\n\t}\n\n\t// The allocators take a slide. A layout carries the same rel lists and a slide number of its\n\t// own, which is all they read, and `master.ts` passes one the same way.\n\tconst slide = target as PresSlideInternal\n\tconst rId = getNewRelId(slide)\n\tpushMediaRel(slide, { kind: 'image', extn: strImgExtn, type, path: source.path, data: source.data, rId })\n\ttarget._bkgdImgRid = rId\n}\n","/**\n * ts-pptx: SlideBuilder — write-side implementation of the public `Slide` interface\n *\n * What a slide is, and nothing about what can go on one. Every `add*` method comes from the\n * construct family that owns it, bound onto the instance from the list the presentation was\n * composed with (`families/shared.ts`); this class owns the slide's own state — its rels, its\n * objects, its number, its background — and the geometry accessors over it.\n *\n * The methods are bound rather than written here because a class method body is never shaken: one\n * that called `addChartDefinition` would put every plot module under `gen/chart/` in the graph of\n * any program that can make a slide, which is all of them.\n */\n\nimport type {\n\tAnimationProps,\n\tBackgroundOption,\n\tHexColor,\n\tSlideComment,\n\tPresLayout,\n\tSlideNumberProps,\n\tSlideObjectInfo,\n\tTransitionProps,\n} from './types/index.js'\nimport type { Slide } from './types/slide.js'\nimport type {\n\tSlideObject,\n\tSlideRel,\n\tSlideRelChart,\n\tSlideRelMedia,\n\tPresSlideInternal,\n\tSlideLayoutInternal,\n\tSectionInternalProps,\n} from './types/internal.js'\nimport { emuToInches } from './units.js'\nimport { addBackgroundDefinition } from './gen/define/background.js'\nimport { isGroupableObject } from './gen/define/group.js'\nimport { renderedSlideObjects } from './gen/slide/shape-ids.js'\nimport {\n\tfamilyMethodUnavailable,\n\tSLIDE_METHOD_FAMILIES,\n\ttype ChildAuthors,\n\ttype SlideAuthorMethod,\n\ttype SlideAuthors,\n} from './families/shared.js'\n\n/**\n * Project one authored render-object onto the public {@link SlideObjectInfo}, recursing into a\n * group's children.\n *\n * The name is the stored one, which is the caller's own spelling: only `cNvPrOpen` escapes it. So\n * a name read here resolves when it is handed back to `groupObjects()`.\n *\n * Every `add*Definition` also *generates* a name when the caller passed none, so the fallback below\n * is unreachable through the public API. It is there because the field is typed non-optional\n * internally only by convention, and an empty name would otherwise read back as `undefined` from a\n * surface that promises a string.\n */\nfunction toSlideObjectInfo(obj: SlideObject): SlideObjectInfo {\n\tconst stored = obj.options?.objectName\n\treturn {\n\t\ttype: obj._type,\n\t\tobjectName: typeof stored === 'string' && stored.length > 0 ? stored : '',\n\t\tisPlaceholder: !!obj.options?.placeholder,\n\t\tcanGroup: isGroupableObject(obj),\n\t\tchildren: (obj._groupObjects ?? []).map(toSlideObjectInfo),\n\t}\n}\n\nexport default class SlideBuilder {\n\tprivate readonly _setSlideNum: (value: SlideNumberProps) => void\n\n\tpublic addSlide: (layout: SlideLayoutInternal | null) => PresSlideInternal\n\tpublic getSlide: (slideNum: number) => PresSlideInternal | undefined\n\tpublic getSections: () => SectionInternalProps[]\n\tpublic _name: string\n\tpublic _presLayout: PresLayout\n\tpublic _rels: SlideRel[]\n\tpublic _relsChart: SlideRelChart[]\n\tpublic _relsMedia: SlideRelMedia[]\n\tpublic _rId: number\n\tpublic _slideId: number\n\tpublic _slideLayout: SlideLayoutInternal | null\n\tpublic _slideNum: number\n\tpublic _slideNumberProps: SlideNumberProps | null\n\tpublic _slideObjects: SlideObject[]\n\tpublic _comments: SlideComment[] = []\n\tpublic _newAutoPagedSlides: PresSlideInternal[] = []\n\tpublic _animations: AnimationProps[] = []\n\n\t/**\n\t * The child-descriptor authors this presentation was composed with, for the group family: a\n\t * group's children resolve through the same table a slide master's `objects` do, so a group can\n\t * hold exactly the kinds this presentation can author.\n\t */\n\tpublic readonly _childAuthors: ChildAuthors\n\n\t/**\n\t * The authoring methods, one per construct family, bound in the constructor.\n\t *\n\t * Declared here and assigned there: the signature each one keeps is the public one on\n\t * {@link Slide}, and a method the presentation was not composed with still answers — with the\n\t * name of the family it needs, rather than `undefined is not a function`.\n\t */\n\tdeclare public addAnimation: Slide['addAnimation']\n\tdeclare public addChart: Slide['addChart']\n\tdeclare public addComment: Slide['addComment']\n\tdeclare public addConnector: Slide['addConnector']\n\tdeclare public addGroup: Slide['addGroup']\n\tdeclare public addImage: Slide['addImage']\n\tdeclare public addMedia: Slide['addMedia']\n\tdeclare public addModel3d: Slide['addModel3d']\n\tdeclare public addNotes: Slide['addNotes']\n\tdeclare public addOleObject: Slide['addOleObject']\n\tdeclare public addSectionZoom: Slide['addSectionZoom']\n\tdeclare public addShape: Slide['addShape']\n\tdeclare public addSlideZoom: Slide['addSlideZoom']\n\tdeclare public addSummaryZoom: Slide['addSummaryZoom']\n\tdeclare public addTable: Slide['addTable']\n\tdeclare public addText: Slide['addText']\n\tdeclare public groupObjects: Slide['groupObjects']\n\n\tconstructor(params: {\n\t\taddSlide: (layout: SlideLayoutInternal | null) => PresSlideInternal\n\t\tgetSlide: (slideNum: number) => PresSlideInternal | undefined\n\t\tgetSections?: () => SectionInternalProps[]\n\t\tpresLayout: PresLayout\n\t\tsetSlideNum: (value: SlideNumberProps) => void\n\t\tslideId: number\n\t\tslideRId: number\n\t\tslideNumber: number\n\t\tslideLayout?: SlideLayoutInternal\n\t\tauthors: SlideAuthors\n\t\tchildAuthors: ChildAuthors\n\t}) {\n\t\tthis.addSlide = params.addSlide\n\t\tthis.getSlide = params.getSlide\n\t\tthis.getSections = params.getSections ?? (() => [])\n\t\tthis._name = `Slide ${params.slideNumber}`\n\t\tthis._presLayout = params.presLayout\n\t\tthis._rId = params.slideRId\n\t\tthis._rels = []\n\t\tthis._relsChart = []\n\t\tthis._relsMedia = []\n\t\tthis._setSlideNum = params.setSlideNum\n\t\tthis._slideId = params.slideId\n\t\tthis._slideLayout = params.slideLayout || null\n\t\tthis._slideNum = params.slideNumber\n\t\tthis._slideObjects = []\n\t\tthis._childAuthors = params.childAuthors\n\t\tthis.#bindFamilyMethods(params.authors)\n\t\t/** NOTE: Slide Numbers: In order for Slide Numbers to function they need to be in all 3 files: master/layout/slide\n\t\t * `defineSlideMaster` and `addNewSlide.slideNumber` will add {slideNumber} to `this.masterSlide` and `this.slideLayouts`\n\t\t * so, lastly, add to the Slide now.\n\t\t */\n\t\tthis._slideNumberProps = this._slideLayout?._slideNumberProps ? this._slideLayout._slideNumberProps : null\n\t}\n\n\t/**\n\t * Put this presentation's family methods on the slide.\n\t *\n\t * Per instance rather than on the prototype: the family set belongs to the presentation, not to\n\t * the class, and two presentations composed differently in one process each get their own. A\n\t * slide count is small enough that per-instance function properties are not a memory question.\n\t *\n\t * Chaining is applied here, once, rather than by each author: every `add*` answers the slide, so\n\t * an author has nothing to say about the return value and cannot get it wrong.\n\t */\n\t#bindFamilyMethods(authors: SlideAuthors): void {\n\t\tconst slide = this as unknown as Record<SlideAuthorMethod, unknown>\n\t\tfor (const method of Object.keys(SLIDE_METHOD_FAMILIES) as SlideAuthorMethod[]) {\n\t\t\tconst author = authors[method] as ((target: SlideBuilder, ...args: never[]) => void) | undefined\n\t\t\tslide[method] = author\n\t\t\t\t? (...args: never[]): SlideBuilder => {\n\t\t\t\t\t\tauthor(this, ...args)\n\t\t\t\t\t\treturn this\n\t\t\t\t\t}\n\t\t\t\t: (): never => familyMethodUnavailable(`slide.${method}`, SLIDE_METHOD_FAMILIES[method])\n\t\t}\n\t}\n\n\t/**\n\t * Background color or image\n\t * @type {BackgroundProps}\n\t * @example solid color `background: { color:'FF0000' }`\n\t * @example color+trans `background: { color:'FF0000', transparency:0.5 }`\n\t * @example base64 `background: { data:'image/png;base64,ABC[...]123' }`\n\t * @example url `background: { path:'https://some.url/image.jpg'}`\n\t */\n\tprivate _background?: BackgroundOption | undefined\n\tpublic set background(props: BackgroundOption | undefined) {\n\t\tthis._background = props\n\t\t// Every assignment reaches the definer, `undefined` included: it is what drops an image an\n\t\t// earlier assignment registered. Skipping it left `background = undefined` reading back as\n\t\t// no background while the slide still painted the image. (Image data/path must be captured\n\t\t// before the package is built.)\n\t\taddBackgroundDefinition(props, this)\n\t}\n\n\tpublic get background(): BackgroundOption | undefined {\n\t\treturn this._background\n\t}\n\n\t/**\n\t * Default font color\n\t * @type {HexColor}\n\t */\n\tprivate _color?: HexColor\n\tpublic set color(value: HexColor) {\n\t\tthis._color = value\n\t}\n\n\tpublic get color(): HexColor | undefined {\n\t\treturn this._color\n\t}\n\n\t/**\n\t * @type {boolean}\n\t */\n\tprivate _hidden = false\n\tpublic set hidden(value: boolean) {\n\t\tthis._hidden = value\n\t}\n\n\tpublic get hidden(): boolean {\n\t\treturn this._hidden\n\t}\n\n\t/**\n\t * Slide-show transition (`p:transition`) played when advancing to this slide.\n\t * @type {TransitionProps}\n\t */\n\t// `| undefined` because the setter takes one: `slide.transition = undefined` is how a\n\t// transition is removed, and the backing field has to be able to hold what the setter accepts.\n\tprivate _transition?: TransitionProps | undefined\n\tpublic set transition(value: TransitionProps | undefined) {\n\t\tthis._transition = value\n\t}\n\n\tpublic get transition(): TransitionProps | undefined {\n\t\treturn this._transition\n\t}\n\n\t/**\n\t * @type {SlideNumberProps}\n\t */\n\tpublic set slideNumber(value: SlideNumberProps) {\n\t\t// NOTE: Slide Numbers: In order for Slide Numbers to function they need to be in all 3 files: master/layout/slide\n\t\tthis._slideNumberProps = value\n\t\tthis._setSlideNum(value)\n\t}\n\n\tpublic get slideNumber(): SlideNumberProps | undefined {\n\t\treturn this._slideNumberProps ?? undefined\n\t}\n\n\t/**\n\t * Every continuation slide this slide's tables have spilled onto, in call order, each once.\n\t *\n\t * Across calls, not per call: a slide can carry more than one `addTable`, and each auto-paging\n\t * one appends whatever it spilled onto. The list was assigned rather than appended, so a second\n\t * table erased the first table's report while its slides stayed in the deck. \"Spilled onto\"\n\t * rather than \"created\" because a later table lands on the earlier one's continuations instead\n\t * of making its own, and those are reported once.\n\t */\n\tpublic get newAutoPagedSlides(): Slide[] {\n\t\treturn this._newAutoPagedSlides\n\t}\n\n\t/**\n\t * The objects authored on this slide so far, bottom-to-top in z-order.\n\t *\n\t * Built fresh on every access rather than cached: the underlying list is mutated in place by\n\t * `addGroup`/`groupObjects` as well as appended to, so a cache would have to be invalidated from\n\t * every authoring path and would go stale the first time one was added without remembering.\n\t * Building it costs a walk of a list a slide-sized deck keeps in the dozens.\n\t */\n\tpublic get objects(): readonly SlideObjectInfo[] {\n\t\t// Only what draws on the slide. Speaker notes and the other list members that render nothing\n\t\t// have no name `groupObjects()` accepts.\n\t\treturn renderedSlideObjects(this._slideObjects).map(toSlideObjectInfo)\n\t}\n\n\t/** Slide width in inches (resolved from the active presentation layout). */\n\tpublic get width(): number {\n\t\treturn emuToInches(this._presLayout.width)\n\t}\n\n\t/** Slide height in inches (resolved from the active presentation layout). */\n\tpublic get height(): number {\n\t\treturn emuToInches(this._presLayout.height)\n\t}\n}\n","/**\n * ts-pptx: getting font bytes out of whatever the caller handed over.\n *\n * `registerFontMetrics` and `embedFont` are two public methods on one class, forty lines apart,\n * and each resolved its source itself. They agreed on `Uint8Array` and `ArrayBuffer` and\n * disagreed about what a `string` means: `registerFontMetrics('X', someBase64)` handed the\n * base64 to the runtime's file loader and failed to open it, while\n * `embedFont({ data: someBase64 })` decoded it. Neither doc said which, because each was only\n * describing its own half.\n *\n * The two really do want different string semantics -- `embedFont` names its path in `path` and\n * its bytes in `data`, so a string in `data` cannot be a filename -- so the answer is one\n * resolver with the difference stated as a flag rather than two resolvers with the difference\n * left implicit.\n */\n\nimport { InvalidOptionError } from './errors.js'\nimport { decodeBase64ToBytes } from './media/base64.js'\nimport type { RuntimeAdapter } from './runtime/types.js'\n\n/** Anything a caller may hand a font-taking method: a path/URL, raw bytes, or base64 text. */\ntype FontSource = string | Uint8Array | ArrayBuffer\n\n/**\n * Resolve a caller's font source to bytes.\n *\n * A `Uint8Array` is used as it stands, an `ArrayBuffer` is wrapped, and a `string` is read\n * according to `base64`: **false or absent** means a path or URL for the runtime's loader (what\n * `registerFontMetrics(face, source)` and `embedFont({ path })` take), **true** means base64\n * text (what `embedFont({ data })` takes, with or without a `data:` prefix).\n * @param source - the caller's value\n * @param runtime - the entry point's adapter, for the path/URL case\n * @param opts - `base64: true` to read a string as base64 rather than as a path\n * @param opts.base64 - see above\n * @param label - how to name the offending argument if the source is unusable\n */\nexport async function resolveFontBytes(\n\tsource: FontSource | undefined,\n\truntime: RuntimeAdapter,\n\topts: { base64?: boolean } | undefined,\n\tlabel: string\n): Promise<Uint8Array> {\n\tif (source instanceof Uint8Array) return source\n\tif (source instanceof ArrayBuffer) return new Uint8Array(source)\n\tif (typeof source === 'string') {\n\t\tif (!opts?.base64) return await runtime.loadFontData(source)\n\t\t// A caller may paste either a bare base64 body or a whole data URL, and the decoder takes both.\n\t\tconst decoded = decodeBase64ToBytes(source)\n\t\tif (!decoded) throw new InvalidOptionError('font/invalid-base64', `${label} is not valid base64`)\n\t\treturn decoded\n\t}\n\tthrow new InvalidOptionError('font/missing-source', `${label} must be a font path, raw bytes, or base64 data`)\n}\n","/**\n * ts-pptx: Slide-Master Definition\n *\n * `createSlideMaster` walks a `SlideMasterProps` definition onto a layout target: shared\n * chart / image / shape / text children via `addChildDefinition`, plus master-specific text\n * placeholders (which need the object index for `_placeholderIdx`).\n */\nimport type { SlideMasterProps, TextProps, TextPropsOptions } from '../../types/index.js'\nimport type { ObjectOptionsInternal, PresSlideInternal, SlideLayoutInternal } from '../../types/internal.js'\nimport { addChildDefinition, warnUnauthoredChild } from './group.js'\nimport type { ChildAuthors } from '../../families/shared.js'\nimport { addTextDefinition } from './text.js'\n\n/**\n * Transforms a slide definition to a slide object that is then passed to the XML transformation process.\n * @param {SlideMasterProps} props - slide definition\n * @param {PresSlideInternal|SlideLayoutInternal} target - empty slide object that should be updated by the passed definition\n * @param {ChildAuthors} children - the child-descriptor authors this presentation was composed with\n */\nexport function createSlideMaster(props: SlideMasterProps, target: SlideLayoutInternal, children: ChildAuthors): void {\n\t// STEP 1: Add all Slide Master objects in the order they were given\n\tif (props.objects && Array.isArray(props.objects) && props.objects.length > 0) {\n\t\tprops.objects.forEach((object, idx) => {\n\t\t\tconst tgt = target as PresSlideInternal\n\t\t\tif (addChildDefinition(tgt, object, children)) {\n\t\t\t\t// handled by the shared chart/image/shape/text dispatch\n\t\t\t} else if ('placeholder' in object) {\n\t\t\t\tconst placeholder = object.placeholder\n\t\t\t\tconst { name, type, ...rawPlaceholderOptions } = placeholder.options\n\t\t\t\tconst placeholderOptions = rawPlaceholderOptions as TextPropsOptions & ObjectOptionsInternal\n\t\t\t\tplaceholderOptions.placeholder = name\n\t\t\t\tplaceholderOptions._placeholderType = type\n\t\t\t\tplaceholderOptions._placeholderIdx = 100 + idx\n\t\t\t\t// An empty placeholder is spelled as a run with no `text` key at all — `TextProps.text`\n\t\t\t\t// is optional and the emitters read it with `||`, so a key holding `undefined` would\n\t\t\t\t// be a second spelling of the same thing.\n\t\t\t\tconst placeholderRun: TextProps = placeholder.text === undefined ? {} : { text: placeholder.text }\n\t\t\t\taddTextDefinition(tgt, [placeholderRun], placeholderOptions, true)\n\t\t\t\t// NOTE: only text placeholders are supported (image/other placeholder kinds are not emitted)\n\t\t\t} else {\n\t\t\t\t// A descriptor nothing composed can author used to fall out of this walk without a word.\n\t\t\t\t// That was harmless only while the recognised set was fixed, because a descriptor matching\n\t\t\t\t// nothing could not type-check; on a presentation composed without the chart family,\n\t\t\t\t// `{ chart: … }` here type-checks and would otherwise vanish from the deck.\n\t\t\t\twarnUnauthoredChild(object, 'defineSlideMaster()')\n\t\t\t}\n\t\t})\n\t}\n\n\t// STEP 2: Add Slide Numbers (NOTE: Do this last so numbers are not covered by objects!)\n\tif (props.slideNumber && typeof props.slideNumber === 'object') target._slideNumberProps = props.slideNumber\n}\n","/**\n * ts-pptx: Placeholder Definition\n *\n * `addPlaceholdersToSlideLayouts` seeds a slide with any layout placeholders it has not already\n * populated, so every inherited placeholder is present as an (empty) text object.\n */\nimport { SlideObjectType } from '../../enums.js'\nimport type { PresSlideInternal } from '../../types/internal.js'\nimport { addTextDefinition, placeholderOptionsForSlide } from './text.js'\n\n/**\n * Adds placeholder objects to slide\n * @param {PresSlideInternal} slide - slide object containing layouts\n */\nexport function addPlaceholdersToSlideLayouts(slide: PresSlideInternal): void {\n\tif (!slide._slideLayout) return // Add all placeholders on this Slide that dont already exist\n\t;(slide._slideLayout._slideObjects || []).forEach((slideLayoutObj) => {\n\t\tif (slideLayoutObj._type === SlideObjectType.placeholder) {\n\t\t\tconst slideLayoutOptions = slideLayoutObj.options || {}\n\t\t\t// A: Search for this placeholder on Slide before we add\n\t\t\t// NOTE: Check to ensure a placeholder does not already exist on the Slide\n\t\t\t// They are created when they have been populated with text (ex: `slide.addText('Hi', { placeholder:'title' });`)\n\t\t\tif (\n\t\t\t\t!slide._slideObjects.some(\n\t\t\t\t\t(slideObj) => slideObj.options && slideObj.options.placeholder === slideLayoutOptions.placeholder\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// A copy whose rel-bearing options are the slide's own, not the layout placeholder's.\n\t\t\t\taddTextDefinition(slide, [{ text: '' }], placeholderOptionsForSlide(slideLayoutOptions), true)\n\t\t\t}\n\t\t}\n\t})\n}\n","/**\n * The base64 placeholder images the library falls back to when a real asset is unavailable.\n *\n * Their own module because of where the bundler puts them, not because they group naturally.\n * The chunker splits by module, so a constant is pulled into every chunk that reaches the module\n * declaring it — and these lived in `constants-internal.ts` beside `XML_DECL`, `DEF_FONT_SIZE`\n * and the rest of the vocabulary all of `src/gen/` imports. The rule that follows: a payload\n * measured in kilobytes does not share a module with vocabulary, however tidy that grouping reads.\n *\n * The default video poster obeys the same rule one size up. At 14 kB it does not share a module\n * with these two either: it lives alone in `src/media/playbtn.ts`, which is what lets the media\n * pass reach it dynamically instead of linking it into every consumer's entry chunk.\n */\n\n/** Shown in place of media that failed to load, under `onMediaError: 'placeholder'`. */\nexport const IMG_BROKEN =\n\t'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAB3CAYAAAD1oOVhAAAGAUlEQVR4Xu2dT0xcRRzHf7tAYSsc0EBSIq2xEg8mtTGebVzEqOVIolz0siRE4gGTStqKwdpWsXoyGhMuyAVJOHBgqyvLNgonDkabeCBYW/8kTUr0wsJC+Wfm0bfuvn37Znbem9mR9303mJnf/Pb7ed95M7PDI5JIJPYJV5EC7e3t1N/fT62trdqViQCIu+bVgpIHEo/Hqbe3V/sdYVKHyWSSZmZm8ilVA0oeyNjYmEnaVC2Xvr6+qg5fAOJAz4DU1dURGzFSqZRVqtMpAFIGyMjICC0vL9PExIRWKADiAYTNshYWFrRCARAOEFZcCKWt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2iNfi0Q8UACkAIgrDbrJ385eDxaPLLrEsFAB5oG6lMPJQPLZZZKAACBGVhcG2Q+bmuLu2nk55e4jqPv1IeEoceiBeX7s2zCa5MAqdstl91vfXwaEGsv/rb5TtOFk6tWXOuJGh6KmnhO9sayrMninPx103JBtXblHkice58cINZP4Hyr5wpkgkdiChEmc4FWazLzenNKa/p0jncwDiqcD6BuWePk07t1asatZGoYQzSqA4nFJ7soNiP/+EUyfc25GI2GG53dHPrKo1g/1Cw4pIXLrzO+1c+/wg7tBbFDle/EbQcjFCPWQJCau5EoBoFpzXHYDwFNJcDiCaBed1ByA8hTSXA4hmwXndAQhPIc3lAKJZcF53AMJTSHM5gGgWnNcdgPAU0lwOIJoF53UHIDyFNJcfSiCdnZ0Ui8U0SxlMd7lcjubn561gh+Y1scFIU/0o/3sgeLO12E2k7UXKYumgFoAYdg8ACIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6ZQ4JB6PKzviYthnNy4d9h+1M5mMlVckkUjsG5dhiBMCEMPg/wuOfrZZ/RSywQAAAABJRU5ErkJggg=='\n\n/** 1x1 transparent PNG, standing in for an SVG the runtime could not rasterize. */\nexport const IMG_SVG_PLACEHOLDER =\n\t'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=='\n","/**\n * ts-pptx: Media Methods\n */\n\nimport { IMG_BROKEN } from '../media/placeholders.js'\nimport type { PresSlideInternal, SlideLayoutInternal, SlideMasterInternal, SlideRelMedia } from '../types/internal.js'\nimport type { RuntimeAdapter } from '../runtime/types.js'\nimport { toMediaDataUri } from '../media/base64.js'\nimport { warn } from '../diagnostics.js'\nimport { MediaError } from '../errors.js'\nimport { isPreencodedPath } from './utils.js'\n\ntype SlideMediaRelWithPath = SlideRelMedia & { path: string }\n\nfunction hasEncodingPath(rel: SlideRelMedia): rel is SlideMediaRelWithPath {\n\treturn typeof rel.path === 'string' && rel.path.length > 0 && !isPreencodedPath(rel.path)\n}\n\n/**\n * Write an SVG rel's PNG fallback, applying `onMediaError` to a preview that fails.\n *\n * The one place that policy is applied to a preview. The adapter has already stamped the\n * placeholder and resolved with the failure, so only the PNG fallback is ever the placeholder:\n * the SVG part keeps its bytes under either policy. A preview used to reject instead, and an SVG\n * given inline then failed the whole write whatever `onMediaError` said, while one given by path\n * was reported as `media/load-failed` and had its SVG bytes replaced with a broken image.\n */\nasync function writeSvgPreview(\n\trel: SlideRelMedia,\n\truntime: RuntimeAdapter,\n\tonMediaError: 'throw' | 'placeholder'\n): Promise<string> {\n\tconst failure = await runtime.createSvgPngPreview(rel)\n\tif (failure === null) return 'done'\n\tif (onMediaError === 'placeholder') {\n\t\twarn('media/svg-preview-failed', `${failure.message}; the SVG is kept and its PNG fallback is a placeholder.`)\n\t\treturn 'done'\n\t}\n\tthrow failure\n}\n\n/**\n * Encode Image/Audio/Video into base64\n * @param {PresSlideInternal | SlideLayoutInternal | SlideMasterInternal} layout - slide, layout or master\n * @param {RuntimeAdapter} runtime - runtime adapter (Node/browser media loader)\n * @param {'throw' | 'placeholder'} onMediaError - failure policy: reject the export (default) or substitute a placeholder and warn\n * @return {Promise} promise\n */\nexport function encodeSlideMediaRels(\n\tlayout: PresSlideInternal | SlideLayoutInternal | SlideMasterInternal,\n\truntime: RuntimeAdapter,\n\tonMediaError: 'throw' | 'placeholder' = 'throw'\n): Array<Promise<string>> {\n\tconst imageProms: Array<Promise<string>> = []\n\n\t// STEP 0: The default video poster, resolved here rather than where `addMedia` runs. A class\n\t// method body is never tree-shaken, so naming the artwork in `addMediaDefinition` charged its\n\t// whole base64 payload to every consumer, including one who only ever wrote text boxes. The\n\t// import is dynamic on purpose: a static one would pull `media/playbtn.ts` back into this\n\t// chunk, which the write path always reaches.\n\tconst defaultCoverRels = layout._relsMedia.filter((rel) => rel.isDefaultCover && !rel.data)\n\tif (defaultCoverRels.length > 0)\n\t\timageProms.push(\n\t\t\t(async () => {\n\t\t\t\tconst { IMG_PLAYBTN } = await import('../media/playbtn.js')\n\t\t\t\tfor (const rel of defaultCoverRels) rel.data = IMG_PLAYBTN\n\t\t\t\treturn 'done'\n\t\t\t})()\n\t\t)\n\n\t// A: Capture all audio/image/video candidates for encoding (filtering online/pre-encoded)\n\tconst candidateRels = layout._relsMedia.filter(\n\t\t(rel): rel is SlideMediaRelWithPath => rel.type !== 'online' && !rel.data && hasEncodingPath(rel)\n\t)\n\n\t// B: PERF: Mark dupes (same `path`) to avoid loading the same media over-and-over!\n\tconst unqPaths: string[] = []\n\tcandidateRels.forEach((rel) => {\n\t\tif (!unqPaths.includes(rel.path)) {\n\t\t\trel.isDuplicate = false\n\t\t\tunqPaths.push(rel.path)\n\t\t} else {\n\t\t\trel.isDuplicate = true\n\t\t}\n\t})\n\n\t// STEP 4: Read/Encode each unique media item\n\tcandidateRels\n\t\t.filter((rel) => !rel.isDuplicate)\n\t\t.forEach((rel) => {\n\t\t\timageProms.push(\n\t\t\t\t(async () => {\n\t\t\t\t\t// The rels that point at this one's package part. Resolved before the load so both\n\t\t\t\t\t// the success and the placeholder arm below hand them the same bytes.\n\t\t\t\t\tconst dupes = candidateRels.filter((dupe) => dupe.isDuplicate && dupe.path === rel.path)\n\t\t\t\t\tlet data: string\n\t\t\t\t\ttry {\n\t\t\t\t\t\tdata = toMediaDataUri(await runtime.loadMedia(rel), rel.type)\n\t\t\t\t\t} catch (ex) {\n\t\t\t\t\t\t// An OLE object's or a 3D model's payload is another application's file, and a PNG\n\t\t\t\t\t\t// written into its `.xlsx`, `.docx` or `.glb` part is a part PowerPoint cannot open.\n\t\t\t\t\t\tconst embeddedPayload = Boolean(rel.oleRelType || rel.model3dRelType)\n\t\t\t\t\t\tif (embeddedPayload) {\n\t\t\t\t\t\t\tthrow new MediaError(\n\t\t\t\t\t\t\t\t'media/load-failed',\n\t\t\t\t\t\t\t\t`Failed to load the embedded payload \"${rel.path}\" during export; a placeholder picture cannot stand in for an OLE object or a 3D model.`,\n\t\t\t\t\t\t\t\t{ cause: ex }\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (onMediaError === 'placeholder') {\n\t\t\t\t\t\t\twarn(\n\t\t\t\t\t\t\t\t'media/load-failed',\n\t\t\t\t\t\t\t\t`Failed to load media \"${rel.path}\"; embedding a broken-image placeholder. (${String(ex)})`\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\trel.data = IMG_BROKEN\n\t\t\t\t\t\t\tdupes.forEach((dupe) => (dupe.data = IMG_BROKEN))\n\t\t\t\t\t\t\treturn 'done'\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Default: fail-fast with an actionable error that names the failing asset and\n\t\t\t\t\t\t// chains the original cause (the raw fs/network error alone does not say which\n\t\t\t\t\t\t// media path broke). Pass `onMediaError: 'placeholder'` to degrade gracefully.\n\t\t\t\t\t\tthrow new MediaError('media/load-failed', `Failed to load media \"${rel.path}\" during export.`, {\n\t\t\t\t\t\t\tcause: ex,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\trel.data = data\n\t\t\t\t\tdupes.forEach((dupe) => (dupe.data = data))\n\t\t\t\t\t// Outside the load's `try`: the load succeeded, so a preview that fails is not a load\n\t\t\t\t\t// failure, and must not replace the SVG's own bytes with a broken image.\n\t\t\t\t\tif (rel.isSvgPng) await writeSvgPreview(rel, runtime, onMediaError)\n\t\t\t\t\t// A path-deduped rel can itself be an SVG-PNG preview (the same SVG *file*\n\t\t\t\t\t// placed 2+ times on one slide: each placement pushes its own fallback rel).\n\t\t\t\t\t// Such dupes are skipped by STEP 5 — its `rel.data` filter runs synchronously,\n\t\t\t\t\t// before this async load populates `dupe.data` — so convert them here, or the\n\t\t\t\t\t// fallback keeps raw SVG bytes in a `.png` part and corrupts the deck.\n\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\tdupes.filter((dupe) => dupe.isSvgPng).map((dupe) => writeSvgPreview(dupe, runtime, onMediaError))\n\t\t\t\t\t)\n\t\t\t\t\treturn 'done'\n\t\t\t\t})()\n\t\t\t)\n\t\t})\n\n\t// STEP 5: SVG-PNG previews\n\t// ......: \"SVG:\" base64 data still requires a png to be generated\n\t// ......: (`isSvgPng` flag this as the preview image, not the SVG itself)\n\tlayout._relsMedia\n\t\t.filter((rel) => rel.isSvgPng && rel.data)\n\t\t.forEach((rel) => {\n\t\t\timageProms.push(writeSvgPreview(rel, runtime, onMediaError))\n\t\t})\n\n\treturn imageProms\n}\n","/**\n * ts-pptx: the pre-serialization pass\n *\n * Everything that must happen to authored slide state *before* any XML is built. Two callers\n * reach serialization and both need it:\n *\n * - `package/assemble.ts` — the normal `write`/`stream`/`writeFile` path, building a\n * complete `.pptx`.\n * - `PresentationCore.extractSlides()` — serializes slide bodies only, for splicing into\n * an already-loaded deck via `Presentation.appendSlides()` (`pptx-ts/read`).\n *\n * The second used to reimplement the first inline, kept in step by a comment that said\n * \"exactly as ... does\". Nothing failed when they drifted: `extractSlides` would simply emit\n * slides that did not match what a normal write produces, and no test compares the two.\n *\n * Three steps rather than one combined pass, because the package path has work of its own that\n * must land between the last two: it de-duplicates identical media across the deck (which needs\n * the encoded bytes {@link encodeMediaForTargets} produces) and assigns package-unique chart part\n * filenames, both before any text is measured. Exposing the steps lets `assemble` keep that work\n * in place while still sharing the code.\n *\n * The order is load-bearing:\n *\n * 1. **Backfill placeholders first**, so a slide carries its layout's placeholder objects before\n * anything reads its media. A seeded placeholder can register media of its own, an image fill,\n * and when backfill ran after encoding that image was never loaded and its rel named a part\n * that was never written.\n * 2. **Media.** It is the only asynchronous step, and the sync XML pass reads the `rel.data` it\n * populates.\n * 3. **Bake measured fit last**, because it measures the text step 1 may have just added and\n * writes the `fontScale` the sync XML pass then reads. The caller undoes it once that pass is\n * done, so the next write measures from the authored values.\n *\n * The functions take different target sets on purpose: media lives on layouts and the master as\n * well as on slides, while placeholder backfill and measured fit apply only to slides.\n * `extractSlides` passes only its slides to all three, because it emits no layout or master\n * parts.\n */\n\nimport { InvalidOptionError } from '../errors.js'\nimport { applyMeasuredFit } from '../measure/fit.js'\nimport type { FontMetricsRegistry } from '../measure/font-metrics.js'\nimport type { RuntimeAdapter } from '../runtime/types.js'\nimport type { PresSlideInternal, SlideLayoutInternal, SlideMasterInternal } from '../types/internal.js'\nimport { addPlaceholdersToSlideLayouts } from './define/placeholder.js'\nimport { encodeSlideMediaRels } from './media.js'\nimport { isHyperlinkRel } from './utils.js'\n\n/**\n * Before any step: refuse a link to a slide the deck does not have.\n *\n * A `hyperlink: { slide }` and a Slide Zoom's numeric `target` are checked for being slide numbers\n * when they are authored, but whether the slide exists is only known once the deck is complete: a\n * link to slide 3 can be authored before slide 3 is added. Both serializing callers check here,\n * before anything is built. Otherwise the link is written as a relationship to a part the package\n * never has.\n *\n * A layout and the master carry objects too, and an object given to `defineSlideLayout({ objects })`\n * or `defineSlideMaster({ objects })` takes the same `hyperlink: { slide }`. This used to read the\n * slides' relationships only, so a layout's number went unchecked and a link past the last slide\n * reached the package from there. `extractSlides` emits no layout or master part and so passes\n * neither, the same way it passes only slides to the three preparation steps below.\n * @param slides - every slide in the deck, in order\n * @param layouts - every slide layout, in order; omitted when no layout part is written\n * @param master - the deck's slide master; omitted when no master part is written\n */\nexport function requireSlideLinksInDeck(\n\tslides: readonly PresSlideInternal[],\n\tlayouts: readonly SlideLayoutInternal[] = [],\n\tmaster?: SlideMasterInternal\n): void {\n\tconst sources: Array<{ label: string; part: { _rels: PresSlideInternal['_rels'] } }> = [\n\t\t...slides.map((slide) => ({ label: `Slide ${slide._slideNum}`, part: slide })),\n\t\t...layouts.map((layout, idx) => ({ label: `Slide layout ${idx + 1}`, part: layout })),\n\t\t...(master ? [{ label: 'The slide master', part: master }] : []),\n\t]\n\tfor (const { label, part } of sources) {\n\t\tfor (const rel of part._rels) {\n\t\t\tif (!isHyperlinkRel(rel) || rel.data !== 'slide') continue\n\t\t\t// Negated so a target that is not a number at all passes on to the internal assertion\n\t\t\t// `extractSlides` makes, rather than being blamed on the caller here.\n\t\t\tif (!(Number(rel.Target) > slides.length)) continue\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'slide/link-past-last-slide',\n\t\t\t\t`${label} links to slide ${String(rel.Target)}, but the deck has ${slides.length} slide${slides.length === 1 ? '' : 's'}.`\n\t\t\t)\n\t\t}\n\t}\n}\n\n/**\n * Step 2: load and base64-encode every media rel on the given targets, populating `rel.data`.\n * @param {ReadonlyArray<PresSlideInternal | SlideLayoutInternal | SlideMasterInternal>} targets - media-bearing targets (slides, layouts, master)\n * @param {RuntimeAdapter} runtime - runtime adapter used to load media\n * @param {'throw' | 'placeholder'} onMediaError - failure policy for unloadable media\n */\nexport async function encodeMediaForTargets(\n\ttargets: ReadonlyArray<PresSlideInternal | SlideLayoutInternal | SlideMasterInternal>,\n\truntime: RuntimeAdapter,\n\tonMediaError: 'throw' | 'placeholder'\n): Promise<void> {\n\tconst promises: Array<Promise<string>> = []\n\tfor (const target of targets) {\n\t\tpromises.push(...encodeSlideMediaRels(target, runtime, onMediaError))\n\t}\n\tawait Promise.all(promises)\n}\n\n/**\n * Step 1: seed each slide with the layout placeholders it leaves empty.\n * @param {PresSlideInternal[]} slides - the slides to prepare\n */\nexport function backfillPlaceholders(slides: PresSlideInternal[]): void {\n\tfor (const slide of slides) {\n\t\tif (slide._slideLayout) addPlaceholdersToSlideLayouts(slide)\n\t}\n}\n\n/**\n * Step 3: bake measured text fit.\n * @param {PresSlideInternal[]} slides - the slides to prepare\n * @param {FontMetricsRegistry} fontMetrics - registered font metrics; an empty registry skips the fit bake\n * @returns the step that restores the authored values; call it once the slide XML is built\n */\nexport function bakeMeasuredFit(slides: PresSlideInternal[], fontMetrics: FontMetricsRegistry): () => void {\n\treturn applyMeasuredFit(slides, fontMetrics)\n}\n","/**\n * ts-pptx: slide build animations\n *\n * Resolve preset build animations to their target shape ids and assemble the\n * `mainSeq` / `bldLst` trees that PowerPoint reads for click-triggered entrance,\n * emphasis and exit effects. Consumed by the slide `<p:timing>` builder.\n */\n\nimport type { AnimationProps } from '../../types/index.js'\nimport type { SlideObject } from '../../types/internal.js'\nimport { warn } from '../../diagnostics.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { renderedSlideObjects, resolveObjectNameToId } from '../slide/shape-ids.js'\n\n/**\n * Resolved animation target's shape id (`spid`), or `null` when it cannot be resolved — in which\n * case the effect is dropped, so every `null` warns rather than leaving the animation silently\n * missing from the deck.\n *\n * `objectName` resolves through `shapeIds`, which covers group children: they are `<p:cNvPr>`-named\n * on the slide and animate like any other shape, but are not in `_slideObjects`, so the old lookup\n * there dropped every animation targeting one. The name goes in raw, and `resolveObjectNameToId`\n * compares it with the raw name the slide object stores, so the warning below quotes the same\n * spelling the caller passed.\n *\n * `shapeIndex` is a 0-based index into the top-level objects that RENDER, which is the same\n * sequence `collectSlideShapeIds` allocates along; group children take ids past that range. It\n * counted `_slideObjects` itself, and four of that array's members draw nothing — so `addNotes`\n * before the first shape shifted every index by one and `shapeIndex: 0` addressed the notes.\n * An index outside `[0, renderedCount)` would emit a `<p:spTgt spid>` naming no shape on the\n * slide — a dangling spid PowerPoint reports as a repair (0x80070570) — so it warns and drops,\n * exactly like an unresolvable `objectName` does.\n * @param shapeIds - the slide's shape ids, from `collectSlideShapeIds`\n * @param slideObjects - the slide's top-level objects, which a `shapeIndex` addresses\n * @param anim - the animation to resolve\n * @returns the target's `<p:cNvPr>` id, or `null`\n */\nexport function resolveAnimationSpid(\n\tshapeIds: Map<SlideObject, number>,\n\tslideObjects: SlideObject[],\n\tanim: AnimationProps\n): number | null {\n\tif (typeof anim.shapeIndex === 'number') {\n\t\t// Through the map, not `shapeIndex + 2`: the id basis belongs to one allocator.\n\t\tconst targets = renderedSlideObjects(slideObjects)\n\t\tconst target = targets[anim.shapeIndex]\n\t\tif (target) return shapeIds.get(target) ?? null\n\t\twarn(\n\t\t\t'animation/target-index-out-of-range',\n\t\t\t`addAnimation: shapeIndex ${anim.shapeIndex} is out of range (slide has ${targets.length} top-level shape(s)), so its \"${anim.preset}\" effect was dropped.`\n\t\t)\n\t\treturn null\n\t}\n\tif (anim.objectName) {\n\t\tconst id = resolveObjectNameToId(shapeIds, anim.objectName)\n\t\tif (id !== null) return id\n\t\twarn(\n\t\t\t'animation/target-not-found',\n\t\t\t`addAnimation: no object named \"${anim.objectName}\" on the slide, so its \"${anim.preset}\" effect was dropped.`\n\t\t)\n\t\treturn null\n\t}\n\twarn(\n\t\t'animation/target-missing',\n\t\t`addAnimation: the \"${anim.preset}\" effect names no target (pass shapeIndex or objectName), so it was dropped.`\n\t)\n\treturn null\n}\n\n/**\n * Whether the effect names a preset this module has a template for. The `preset` type admits only\n * those, but a JavaScript caller can pass any string, so an unknown one warns and the effect is\n * dropped before its target is resolved, like an effect whose target cannot be found.\n * @param anim - the animation to check\n * @returns `true` when the preset can be written\n */\nexport function hasKnownAnimationPreset(anim: AnimationProps): boolean {\n\tif (Object.hasOwn(ANIM_PRESETS, anim.preset)) return true\n\twarn(\n\t\t'animation/unknown-preset',\n\t\t`addAnimation: \"${String(anim.preset)}\" is not a preset this library writes (${Object.keys(ANIM_PRESETS).join(', ')}), so the effect was dropped.`\n\t)\n\treturn false\n}\n\ninterface AnimPresetMeta {\n\tpresetID: number\n\tpresetClass: 'entr' | 'emph' | 'exit'\n\tpresetSubtype: number\n\tdefaultDurationMs: number\n\t/** Emit the effect's behavior nodes (each `<p:cTn>` consumes one id via `next`). */\n\tbehaviors: (spid: number, dur: number, next: () => number) => string\n}\n\nconst ANIM_SET_VISIBLE = (spid: number, next: () => number): string =>\n\tel('p:set', null, [\n\t\traw(\n\t\t\tel('p:cBhvr', null, [\n\t\t\t\traw(\n\t\t\t\t\tel(\n\t\t\t\t\t\t'p:cTn',\n\t\t\t\t\t\t{ id: next(), dur: 1, fill: 'hold' },\n\t\t\t\t\t\traw(el('p:stCondLst', null, raw(voidEl('p:cond', { delay: 0 }))))\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\traw(el('p:tgtEl', null, raw(voidEl('p:spTgt', { spid })))),\n\t\t\t\traw(el('p:attrNameLst', null, raw(el('p:attrName', null, 'style.visibility')))),\n\t\t\t])\n\t\t),\n\t\traw(el('p:to', null, raw(voidEl('p:strVal', { val: 'visible' })))),\n\t])\n\nconst ANIM_SET_HIDDEN = (spid: number, dur: number, next: () => number): string =>\n\tel('p:set', null, [\n\t\traw(\n\t\t\tel('p:cBhvr', null, [\n\t\t\t\traw(\n\t\t\t\t\tel(\n\t\t\t\t\t\t'p:cTn',\n\t\t\t\t\t\t{ id: next(), dur: 1, fill: 'hold' },\n\t\t\t\t\t\traw(el('p:stCondLst', null, raw(voidEl('p:cond', { delay: Math.max(0, dur - 1) }))))\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\traw(el('p:tgtEl', null, raw(voidEl('p:spTgt', { spid })))),\n\t\t\t\traw(el('p:attrNameLst', null, raw(el('p:attrName', null, 'style.visibility')))),\n\t\t\t])\n\t\t),\n\t\traw(el('p:to', null, raw(voidEl('p:strVal', { val: 'hidden' })))),\n\t])\n\n/** `p:animEffect` filter transition (fade/wipe(down)/…), shared by entrance and exit presets. */\nconst ANIM_EFFECT = (transition: 'in' | 'out', filter: string, spid: number, dur: number, next: () => number): string =>\n\tel(\n\t\t'p:animEffect',\n\t\t{ transition, filter },\n\t\traw(\n\t\t\tel('p:cBhvr', null, [\n\t\t\t\traw(voidEl('p:cTn', { id: next(), dur })),\n\t\t\t\traw(el('p:tgtEl', null, raw(voidEl('p:spTgt', { spid })))),\n\t\t\t])\n\t\t)\n\t)\n\nconst ANIM_FADE = (transition: 'in' | 'out', spid: number, dur: number, next: () => number): string =>\n\tANIM_EFFECT(transition, 'fade', spid, dur, next)\n\n/**\n * One `ppt_x`/`ppt_y` motion `<p:anim>` for Fly In (entrance) / Fly Out (exit).\n * PowerPoint authors the two directions differently (captured in\n * `slide-animation-presets.oracle.json`): the entrance form references the\n * hashed run-time variables (`#ppt_x`) and holds (`fill=\"hold\"`) starting\n * off-screen and ending in place; the exit form uses the bare variables\n * (`ppt_x`, no `#`), omits `fill=\"hold\"`, and ends off-screen.\n */\nconst ANIM_FLY_AXIS = (\n\tdirection: 'in' | 'out',\n\taxis: 'x' | 'y',\n\tspid: number,\n\tdur: number,\n\tnext: () => number\n): string => {\n\tconst h = direction === 'in' ? '#' : ''\n\tlet from: string\n\tlet to: string\n\tif (axis === 'x') {\n\t\tfrom = `${h}ppt_x`\n\t\tto = `${h}ppt_x`\n\t} else if (direction === 'in') {\n\t\tfrom = `1+${h}ppt_h/2`\n\t\tto = `${h}ppt_y`\n\t} else {\n\t\tfrom = `${h}ppt_y`\n\t\tto = `1+${h}ppt_h/2`\n\t}\n\tconst fill = direction === 'in' ? 'hold' : null\n\treturn el('p:anim', { calcmode: 'lin', valueType: 'num' }, [\n\t\traw(\n\t\t\tel('p:cBhvr', { additive: 'base' }, [\n\t\t\t\traw(voidEl('p:cTn', { id: next(), dur, fill })),\n\t\t\t\traw(el('p:tgtEl', null, raw(voidEl('p:spTgt', { spid })))),\n\t\t\t\traw(el('p:attrNameLst', null, raw(el('p:attrName', null, `ppt_${axis}`)))),\n\t\t\t])\n\t\t),\n\t\traw(\n\t\t\tel('p:tavLst', null, [\n\t\t\t\traw(el('p:tav', { tm: 0 }, raw(el('p:val', null, raw(voidEl('p:strVal', { val: from })))))),\n\t\t\t\traw(el('p:tav', { tm: 100000 }, raw(el('p:val', null, raw(voidEl('p:strVal', { val: to })))))),\n\t\t\t])\n\t\t),\n\t])\n}\n\nconst ANIM_PRESETS: Record<string, AnimPresetMeta> = {\n\tfadeIn: {\n\t\tpresetID: 10,\n\t\tpresetClass: 'entr',\n\t\tpresetSubtype: 0,\n\t\tdefaultDurationMs: 500,\n\t\tbehaviors: (spid, dur, next) => ANIM_SET_VISIBLE(spid, next) + ANIM_FADE('in', spid, dur, next),\n\t},\n\tflyIn: {\n\t\tpresetID: 2,\n\t\tpresetClass: 'entr',\n\t\tpresetSubtype: 4,\n\t\tdefaultDurationMs: 500,\n\t\tbehaviors: (spid, dur, next) =>\n\t\t\tANIM_SET_VISIBLE(spid, next) +\n\t\t\tANIM_FLY_AXIS('in', 'x', spid, dur, next) +\n\t\t\tANIM_FLY_AXIS('in', 'y', spid, dur, next),\n\t},\n\tappear: {\n\t\tpresetID: 1,\n\t\tpresetClass: 'entr',\n\t\tpresetSubtype: 0,\n\t\tdefaultDurationMs: 500,\n\t\tbehaviors: (spid, _dur, next) => ANIM_SET_VISIBLE(spid, next),\n\t},\n\twipe: {\n\t\tpresetID: 22,\n\t\tpresetClass: 'entr',\n\t\tpresetSubtype: 4,\n\t\tdefaultDurationMs: 500,\n\t\tbehaviors: (spid, dur, next) => ANIM_SET_VISIBLE(spid, next) + ANIM_EFFECT('in', 'wipe(down)', spid, dur, next),\n\t},\n\tgrow: {\n\t\tpresetID: 6,\n\t\tpresetClass: 'emph',\n\t\tpresetSubtype: 0,\n\t\tdefaultDurationMs: 2000,\n\t\tbehaviors: (spid, dur, next) =>\n\t\t\tel('p:animScale', null, [\n\t\t\t\traw(\n\t\t\t\t\tel('p:cBhvr', null, [\n\t\t\t\t\t\traw(voidEl('p:cTn', { id: next(), dur, fill: 'hold' })),\n\t\t\t\t\t\traw(el('p:tgtEl', null, raw(voidEl('p:spTgt', { spid })))),\n\t\t\t\t\t])\n\t\t\t\t),\n\t\t\t\traw(voidEl('p:by', { x: 150000, y: 150000 })),\n\t\t\t]),\n\t},\n\tspin: {\n\t\tpresetID: 8,\n\t\tpresetClass: 'emph',\n\t\tpresetSubtype: 0,\n\t\tdefaultDurationMs: 2000,\n\t\tbehaviors: (spid, dur, next) =>\n\t\t\tel('p:animRot', { by: 21600000 }, [\n\t\t\t\traw(\n\t\t\t\t\tel('p:cBhvr', null, [\n\t\t\t\t\t\traw(voidEl('p:cTn', { id: next(), dur, fill: 'hold' })),\n\t\t\t\t\t\traw(el('p:tgtEl', null, raw(voidEl('p:spTgt', { spid })))),\n\t\t\t\t\t\traw(el('p:attrNameLst', null, raw(el('p:attrName', null, 'r')))),\n\t\t\t\t\t])\n\t\t\t\t),\n\t\t\t]),\n\t},\n\tfadeOut: {\n\t\tpresetID: 10,\n\t\tpresetClass: 'exit',\n\t\tpresetSubtype: 0,\n\t\tdefaultDurationMs: 500,\n\t\tbehaviors: (spid, dur, next) => ANIM_FADE('out', spid, dur, next) + ANIM_SET_HIDDEN(spid, dur, next),\n\t},\n\tflyOut: {\n\t\tpresetID: 2,\n\t\tpresetClass: 'exit',\n\t\tpresetSubtype: 4,\n\t\tdefaultDurationMs: 500,\n\t\tbehaviors: (spid, dur, next) =>\n\t\t\tANIM_FLY_AXIS('out', 'x', spid, dur, next) +\n\t\t\tANIM_FLY_AXIS('out', 'y', spid, dur, next) +\n\t\t\tANIM_SET_HIDDEN(spid, dur, next),\n\t},\n}\n\nconst ANIM_NODE_TYPE: Record<string, string> = {\n\tonClick: 'clickEffect',\n\twithPrevious: 'withEffect',\n\tafterPrevious: 'afterEffect',\n}\n\ntype ResolvedAnimation = { anim: AnimationProps; spid: number }\n\n/**\n * Assemble the `mainSeq` from preset effects. Effects are grouped into click\n * steps: an `onClick` effect opens a new click group; `afterPrevious` opens a new\n * sub-step within it, starting when the sub-step before it ends; `withPrevious`\n * joins the current sub-step. This reproduces PowerPoint's interactive build tree.\n *\n * A sub-step's delay counts from the click, not from the sub-step before it, and that sub-step\n * ends with its longest effect: PowerPoint writes 0, 500, 1250 and 3250 ms for effects of 500,\n * 750 and 1000 ms, a 2000 ms `withPrevious` beside the third, then a fourth.\n */\nexport function buildAnimationSeq(animations: ResolvedAnimation[], next: () => number): string {\n\tinterface SubGroup {\n\t\tdelay: number\n\t\t/** The longest effect's duration, which is when the next `afterPrevious` sub-step starts. */\n\t\tlongest: number\n\t\teffects: ResolvedAnimation[]\n\t}\n\tinterface ClickGroup {\n\t\tsubs: SubGroup[]\n\t}\n\tconst groups: ClickGroup[] = []\n\tfor (const entry of animations) {\n\t\tconst meta = ANIM_PRESETS[entry.anim.preset]\n\t\tif (!meta) continue\n\t\tconst trigger = entry.anim.trigger ?? 'onClick'\n\t\tconst duration = typeof entry.anim.durationMs === 'number' ? entry.anim.durationMs : meta.defaultDurationMs\n\t\tconst subs = groups[groups.length - 1]?.subs\n\t\tconst lastSub = subs?.[subs.length - 1]\n\t\tif (trigger === 'onClick' || !subs || !lastSub) {\n\t\t\tgroups.push({ subs: [{ delay: 0, longest: duration, effects: [entry] }] })\n\t\t} else if (trigger === 'afterPrevious') {\n\t\t\tsubs.push({ delay: lastSub.delay + lastSub.longest, longest: duration, effects: [entry] })\n\t\t} else {\n\t\t\t// withPrevious — join the current sub-step\n\t\t\tlastSub.effects.push(entry)\n\t\t\tlastSub.longest = Math.max(lastSub.longest, duration)\n\t\t}\n\t}\n\n\tconst emitEffect = (entry: ResolvedAnimation): string => {\n\t\tconst meta = ANIM_PRESETS[entry.anim.preset]\n\t\tif (!meta) return ''\n\t\tconst nodeType = ANIM_NODE_TYPE[entry.anim.trigger ?? 'onClick']\n\t\tconst duration = typeof entry.anim.durationMs === 'number' ? entry.anim.durationMs : meta.defaultDurationMs\n\t\tconst effectId = next()\n\t\tconst behaviors = meta.behaviors(entry.spid, duration, next)\n\t\treturn el(\n\t\t\t'p:par',\n\t\t\tnull,\n\t\t\traw(\n\t\t\t\tel(\n\t\t\t\t\t'p:cTn',\n\t\t\t\t\t{\n\t\t\t\t\t\tid: effectId,\n\t\t\t\t\t\tpresetID: meta.presetID,\n\t\t\t\t\t\tpresetClass: meta.presetClass,\n\t\t\t\t\t\tpresetSubtype: meta.presetSubtype,\n\t\t\t\t\t\tfill: 'hold',\n\t\t\t\t\t\tgrpId: 0,\n\t\t\t\t\t\tnodeType,\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\traw(el('p:stCondLst', null, raw(voidEl('p:cond', { delay: 0 })))),\n\t\t\t\t\t\traw(el('p:childTnLst', null, raw(behaviors))),\n\t\t\t\t\t]\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t}\n\n\tconst emitSub = (sub: SubGroup): string => {\n\t\tconst subId = next()\n\t\tconst effects = sub.effects.map(emitEffect).join('')\n\t\treturn el(\n\t\t\t'p:par',\n\t\t\tnull,\n\t\t\traw(\n\t\t\t\tel('p:cTn', { id: subId, fill: 'hold' }, [\n\t\t\t\t\traw(el('p:stCondLst', null, raw(voidEl('p:cond', { delay: sub.delay })))),\n\t\t\t\t\traw(el('p:childTnLst', null, raw(effects))),\n\t\t\t\t])\n\t\t\t)\n\t\t)\n\t}\n\n\tconst emitGroup = (group: ClickGroup): string => {\n\t\tconst groupId = next()\n\t\tconst subs = group.subs.map(emitSub).join('')\n\t\treturn el(\n\t\t\t'p:par',\n\t\t\tnull,\n\t\t\traw(\n\t\t\t\tel('p:cTn', { id: groupId, fill: 'hold' }, [\n\t\t\t\t\traw(el('p:stCondLst', null, raw(voidEl('p:cond', { delay: 'indefinite' })))),\n\t\t\t\t\traw(el('p:childTnLst', null, raw(subs))),\n\t\t\t\t])\n\t\t\t)\n\t\t)\n\t}\n\n\tconst clickGroups = groups.map(emitGroup).join('')\n\treturn el('p:seq', { concurrent: 1, nextAc: 'seek' }, [\n\t\traw(\n\t\t\tel('p:cTn', { id: 2, dur: 'indefinite', nodeType: 'mainSeq' }, raw(el('p:childTnLst', null, raw(clickGroups))))\n\t\t),\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:prevCondLst',\n\t\t\t\tnull,\n\t\t\t\traw(el('p:cond', { evt: 'onPrev', delay: 0 }, raw(el('p:tgtEl', null, raw(voidEl('p:sldTgt'))))))\n\t\t\t)\n\t\t),\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:nextCondLst',\n\t\t\t\tnull,\n\t\t\t\traw(el('p:cond', { evt: 'onNext', delay: 0 }, raw(el('p:tgtEl', null, raw(voidEl('p:sldTgt'))))))\n\t\t\t)\n\t\t),\n\t])\n}\n\n/** One `<p:bldP>` per animated shape, in order of first appearance. */\nexport function buildBldList(animations: ResolvedAnimation[]): string {\n\tconst seen = new Set<number>()\n\tconst bldPs: string[] = []\n\tfor (const { spid } of animations) {\n\t\tif (seen.has(spid)) continue\n\t\tseen.add(spid)\n\t\tbldPs.push(voidEl('p:bldP', { spid, grpId: 0 }))\n\t}\n\treturn el('p:bldLst', null, raw(bldPs.join('')))\n}\n","/**\n * ts-pptx: slide `<p:timing>` tree\n *\n * Build the slide-level timing tree that drives looping embedded media and the\n * preset build-animation `mainSeq`. A slide has at most one `<p:timing>`; all\n * looping media and animation effects share its `tmRoot` node.\n */\n\nimport { SlideObjectType } from '../../enums.js'\nimport type { AnimationProps } from '../../types/index.js'\nimport type { PresSlideInternal, SlideObject } from '../../types/internal.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { collectSlideShapeIds } from '../slide/shape-ids.js'\nimport { buildAnimationSeq, buildBldList, hasKnownAnimationPreset, resolveAnimationSpid } from './animation.js'\n\n/**\n * Build the slide-level `<p:timing>` tree that makes embedded media loop.\n * - PowerPoint stores playback looping as `repeatCount` on the media node's `<p:cTn>`\n * (`indefinite` for \"Loop until Stopped\", or `N*1000` for a finite N plays), inside\n * the slide timing tree rather than on the `<p:pic>` itself.\n * - A slide has at most one `<p:timing>`; all looping media share its `tmRoot` node.\n * - Audio loops via `<p:audio>`, video via `<p:video>` (both `CT_TLCommonMediaNodeData`).\n * - The media node targets the picture by `spid` (its `<p:cNvPr>` id = slide-object index + 2).\n * @param {PresSlideInternal} slide - the slide to inspect for looping media\n * @returns {string} the `<p:timing>` XML, or `''` when no media loops\n */\nexport function slideTimingToXml(slide: PresSlideInternal): string {\n\tconst loopMedia = slide._slideObjects.filter(\n\t\t(obj) =>\n\t\t\tobj._type === SlideObjectType.media &&\n\t\t\tobj.mtype !== 'online' &&\n\t\t\ttypeof obj.mediaRid === 'number' &&\n\t\t\t(obj.loop === true || (typeof obj.loopCount === 'number' && obj.loopCount > 0))\n\t)\n\n\t// Resolve preset build animations to their target shape ids. `collectSlideShapeIds` covers group\n\t// children as well as top-level objects, so `objectName` addresses any shape on the slide.\n\tconst shapeIds = collectSlideShapeIds(slide._slideObjects)\n\tconst animations = (slide._animations ?? [])\n\t\t.filter((anim) => hasKnownAnimationPreset(anim))\n\t\t.map((anim) => ({ anim, spid: resolveAnimationSpid(shapeIds, slide._slideObjects, anim) }))\n\t\t.filter((entry): entry is { anim: AnimationProps; spid: number } => entry.spid !== null)\n\n\tconst mediaNode = (obj: SlideObject, nodeId: number): string => {\n\t\t// spid must equal the picture's own `<p:cNvPr>` id, so it comes from the same map the\n\t\t// animation spids above do. Using `mediaRid + 2` here desyncs from the shape id and\n\t\t// targets the wrong/nonexistent shape => PowerPoint reports the file corrupt.\n\t\tconst spid = shapeIds.get(obj) ?? 2\n\t\tconst repeatCount = obj.loop === true ? 'indefinite' : String(Math.round((obj.loopCount as number) * 1000))\n\t\t// EG_TimeNodeChoice: audio loops via <p:audio>, video via <p:video> (both CT_TLCommonMediaNodeData)\n\t\tconst mediaTag = obj.mtype === 'audio' ? 'p:audio' : 'p:video'\n\t\treturn el(\n\t\t\tmediaTag,\n\t\t\tnull,\n\t\t\traw(\n\t\t\t\tel('p:cMediaNode', null, [\n\t\t\t\t\traw(\n\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t'p:cTn',\n\t\t\t\t\t\t\t{ id: nodeId, repeatCount, fill: 'hold', display: 0 },\n\t\t\t\t\t\t\traw(el('p:stCondLst', null, raw(voidEl('p:cond', { delay: 'indefinite' }))))\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\traw(el('p:tgtEl', null, raw(voidEl('p:spTgt', { spid })))),\n\t\t\t\t])\n\t\t\t)\n\t\t)\n\t}\n\n\t// Media-only path: unchanged legacy output (`<p:cTn id=\"1\">` tmRoot, media nodes follow).\n\tif (animations.length === 0) {\n\t\tif (loopMedia.length === 0) return ''\n\t\tlet nodeId = 1\n\t\tconst mediaNodes = loopMedia.map((obj) => mediaNode(obj, (nodeId += 1))).join('')\n\t\treturn el(\n\t\t\t'p:timing',\n\t\t\tnull,\n\t\t\traw(\n\t\t\t\tel(\n\t\t\t\t\t'p:tnLst',\n\t\t\t\t\tnull,\n\t\t\t\t\traw(\n\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t'p:par',\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t\t\t'p:cTn',\n\t\t\t\t\t\t\t\t\t{ id: 1, dur: 'indefinite', restart: 'never', nodeType: 'tmRoot' },\n\t\t\t\t\t\t\t\t\traw(el('p:childTnLst', null, raw(mediaNodes)))\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t}\n\n\t// Animation path: a `mainSeq` of preset effects (plus any looping media as sibling nodes).\n\t// A monotonically increasing id is assigned to every `<p:cTn>` in document order, matching\n\t// how PowerPoint numbers the tree (tmRoot=1, mainSeq=2, then wrappers/effects/behaviors).\n\tlet id = 2 // tmRoot=1, mainSeq=2 are fixed\n\tconst next = (): number => (id += 1)\n\n\tconst seq = buildAnimationSeq(animations, next)\n\tconst mediaNodes = loopMedia.map((obj) => mediaNode(obj, next())).join('')\n\tconst bldLst = buildBldList(animations)\n\n\treturn el('p:timing', null, [\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:tnLst',\n\t\t\t\tnull,\n\t\t\t\traw(\n\t\t\t\t\tel(\n\t\t\t\t\t\t'p:par',\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\traw(\n\t\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t\t'p:cTn',\n\t\t\t\t\t\t\t\t{ id: 1, dur: 'indefinite', restart: 'never', nodeType: 'tmRoot' },\n\t\t\t\t\t\t\t\traw(el('p:childTnLst', null, raw(seq + mediaNodes)))\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t),\n\t\traw(bldLst),\n\t])\n}\n","/**\n * ts-pptx: slide-show transitions\n *\n * Build the `<p:transition>` tree (positioned in CT_Slide between `p:clrMapOvr`\n * and `p:timing`): the transition-type element, its optional sound action, and\n * the `mc:AlternateContent` envelope that carries an exact `p14:dur`.\n */\n\nimport type { TransitionProps, TransitionType } from '../../types/index.js'\nimport type { PresSlideInternal } from '../../types/internal.js'\nimport { el, raw, voidEl, type XmlAttrs } from '../oxml/el.js'\nimport { alternateContentEl } from '../oxml/alternate-content.js'\nimport { OOXML_NS } from '../../ooxml/namespaces.js'\nimport { xsdBoolIfTrue } from '../../ooxml/xsd-boolean.js'\nimport { checkEnumOrWarn } from '../../ooxml/check-enum.js'\nimport { TRANSITION_TYPES, TRANSITION_VARIANT_ATTRIBUTES } from '../../ooxml/st-enums.js'\nimport { transitionSpeedForDuration } from '../../ooxml/transition-speed.js'\nimport { warnOnce } from '../../diagnostics.js'\n\n/**\n * The attributes of a transition's type element, from the caller's `variant`.\n *\n * Each `variant` key is written as an attribute name, so a key the element does not declare would\n * be an attribute the schema does not allow there, and a key that is not a name at all would be\n * markup. Only the attributes the element declares are written, and the rest warn.\n */\nfunction transitionVariantAttrs(type: TransitionType, variant: Record<string, string> | undefined): XmlAttrs | null {\n\tif (!variant) return null\n\tconst allowed: readonly string[] = TRANSITION_VARIANT_ATTRIBUTES[type]\n\tconst attrs: XmlAttrs = {}\n\tfor (const [name, value] of Object.entries(variant)) {\n\t\tif (allowed.includes(name)) {\n\t\t\tattrs[name] = value\n\t\t\tcontinue\n\t\t}\n\t\twarnOnce(\n\t\t\t'transition/unknown-variant',\n\t\t\t`slide transition \\`${type}\\` variant \\`${name}\\` is not an attribute of <p:${type}> and is ignored — ${allowed.length > 0 ? `use ${allowed.join(', ')}` : 'it takes none'}.`,\n\t\t\t{ received: name, valid: allowed }\n\t\t)\n\t}\n\treturn attrs\n}\n\n/**\n * Build the `p:sndAc` sound-action child of `p:transition` (positioned after the\n * transition-type element). A start sound is `<p:stSnd [loop=\"1\"]><p:snd r:embed\n * name/></p:stSnd>` referencing the embedded audio by `soundRId`; the stop-previous form is\n * `<p:endSnd/>` (no rel). Returns `''` when the transition has no sound, or a start sound was\n * registered under no relationship on this slide.\n */\nfunction transitionSoundToXml(transition: TransitionProps, soundRId: number | undefined): string {\n\tconst sound = transition.sound\n\tif (!sound) return ''\n\tif (sound.stopPrevious) return el('p:sndAc', null, raw(voidEl('p:endSnd')))\n\tif (soundRId === undefined) return '' // no embedded part registered\n\treturn el(\n\t\t'p:sndAc',\n\t\tnull,\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:stSnd',\n\t\t\t\t{ loop: xsdBoolIfTrue(sound.loop) },\n\t\t\t\traw(voidEl('p:snd', { 'r:embed': `rId${soundRId}`, name: sound.name || null }))\n\t\t\t)\n\t\t)\n\t)\n}\n\n/**\n * Build the slide-show transition tree (`p:transition`), positioned in `CT_Slide`\n * between `p:clrMapOvr` and `p:timing`. Emits PowerPoint's `mc:AlternateContent`\n * form (a `p14` Choice carrying the exact `p14:dur`, plus a base `mc:Fallback`)\n * when `durationMs` is set, and the bare `<p:transition>` otherwise. See\n * `docs/contributing/design/animations.md`.\n * @param slide - the slide whose transition is emitted\n * @param soundRId - the relationship id this slide's start sound was registered under, if one was.\n * It is the slide's, not the transition's: one transition object can sit on several slides, each\n * declaring the sound under an id of its own.\n * @returns {string} the transition XML, or `''` when the slide has no transition the writer can emit\n */\nexport function slideTransitionToXml(slide: PresSlideInternal, soundRId?: number): string {\n\tconst transition = slide.transition\n\tif (!transition?.type) return ''\n\n\t// The type is written as the element's name, so one that is not a transition this writer knows\n\t// warns and the slide is written with no transition at all.\n\tconst type = checkEnumOrWarn(transition.type, TRANSITION_TYPES, 'transition/unknown-type', 'slide transition `type`')\n\tif (!type) return ''\n\n\tconst typeEl = voidEl(`p:${type}`, transitionVariantAttrs(type, transition.variant))\n\tconst sndAc = transitionSoundToXml(transition, soundRId)\n\n\tconst hasDuration = typeof transition.durationMs === 'number' && Number.isFinite(transition.durationMs)\n\tconst speed = transition.speed ?? (hasDuration ? transitionSpeedForDuration(transition.durationMs as number) : null)\n\tconst baseAttrs: XmlAttrs = {\n\t\tspd: speed || null,\n\t\tadvClick: transition.advanceOnClick === false ? '0' : null,\n\t\tadvTm: typeof transition.advanceAfterMs === 'number' ? Math.round(transition.advanceAfterMs) : null,\n\t}\n\n\tif (!hasDuration) return el('p:transition', baseAttrs, [raw(typeEl), raw(sndAc)])\n\n\tconst dur = Math.round(transition.durationMs as number)\n\treturn alternateContentEl({\n\t\trequires: { prefix: 'p14', uri: OOXML_NS.p14 },\n\t\tchoice: el('p:transition', { ...baseAttrs, 'p14:dur': dur }, [raw(typeEl), raw(sndAc)]),\n\t\tfallback: el('p:transition', baseAttrs, [raw(typeEl), raw(sndAc)]),\n\t})\n}\n","/**\n * ts-pptx: slide object serialization\n *\n * The per-shape `<p:spTree>` builder: `slideObjectToXml` walks a slide/layout's objects\n * (recursing into groups, allocating `<p:cNvPr>` ids as it goes) and looks each one up in the\n * renderer table its caller supplied. This module knows which object kinds are shapes; it does\n * not know what any of their XML looks like, and importing a renderer here would undo that — see\n * `RendererTable` in `objects/shared.ts`. The group render and the slide-number placeholder stay\n * here because both consume the slide-wide child-id counter the walk maintains.\n * `slideObjectRelationsToXml` emits the matching `.rels` targets.\n */\n\nimport { SlideObjectType } from '../../enums.js'\nimport { STRETCH_FILL_RECT } from '../drawingml/src-rect.js'\nimport { prstGeomRect } from '../drawingml/geometry.js'\nimport { DEF_PRES_LAYOUT_NAME, SLDNUM_PLACEHOLDER_TEXT, SLDNUMFLDID } from '../../constants-internal.js'\nimport type { ObjectOptions, SlideNumberProps } from '../../types/index.js'\nimport type {\n\tPresSlideInternal,\n\tSlideLayoutInternal,\n\tSlideMasterInternal,\n\tSlideObject,\n\tSlideRel,\n\tSlideRelChart,\n\tSlideRelMedia,\n} from '../../types/internal.js'\nimport { encodeXmlAttrValue, getDuplicateObjectNames, isHyperlinkRel } from '../utils.js'\nimport { fillNamesPaint, genXmlColorSelection } from '../drawingml/fill.js'\nimport { rejectEmptyColor } from '../drawingml/color.js'\nimport { convertRotationDegrees, getSmartParseNumber, mapStated, resolveInsetsEmu } from '../../units-internal.js'\nimport { warn } from '../../diagnostics.js'\nimport { clampFontSizeSz } from '../drawingml/clamp.js'\nimport { resolveTextAnchor } from '../drawingml/text-body.js'\nimport { genXmlObjectLock, GROUP_SHAPE_LOCK_ATTRS } from '../drawingml/locks.js'\nimport { el, elOrVoid, raw, voidEl, type XmlAttrs } from '../oxml/el.js'\nimport { cNvPrEl, grpXfrmEl, spTreeEl, type RenderContext, type RendererTable } from './objects/shared.js'\n// Not a renderer: it measures the box an image is drawn in, which a group's bounds need, and emits no XML.\nimport { resolveImageExtent } from './objects/image-extent.js'\nimport { findLayoutPlaceholder } from '../define/layout-placeholder.js'\nimport { collectSlideShapeIds, shapeIdCount } from './shape-ids.js'\nimport { InternalError } from '../../errors.js'\nimport { slidePath, targetBetweenPptSubparts } from '../opc/part-paths.js'\nimport {\n\tAUDIO_REL,\n\tCHART_REL,\n\tCHARTEX_REL,\n\tIMAGE_REL,\n\tMS_MEDIA_REL,\n\tSLIDE_REL,\n\tVIDEO_REL,\n} from '../../ooxml/rel-types.js'\nimport { externalHyperlinkRel, relationshipEl, relationshipsPart } from '../opc/rels.js'\nimport { xsdBool, xsdBoolIfTrue } from '../../ooxml/xsd-boolean.js'\n\n/** The four axes that make up an explicit group frame. All or nothing — see `givenGroupFrameAxes`. */\nconst GROUP_FRAME_AXES = ['x', 'y', 'w', 'h'] as const\n\n/**\n * Which of `x`/`y`/`w`/`h` a group's caller actually supplied.\n *\n * A group frame is explicit only when **all four** are given; anything less falls back to\n * auto-bounds on every axis. Partial frames used to be honoured per-axis, which let the unset ones\n * take the shared per-object defaults (`x=0`, `y=0`, `cx=75%` of the layout width, `cy=0`) — so\n * `addGroup([rect], { x: 5, y: 2 })` emitted a zero-height group whose width was a silent\n * slide-width fraction, and every child of it then re-read as `null` through the read path's\n * degenerate-`chExt` guard.\n *\n * Per-axis fallback was the other candidate, but it cannot mean what it reads like: the writer keeps\n * an identity child space (`chOff/chExt == off/ext`), so a group's frame never moves or scales its\n * children — it only places the selection handle and the rotate pivot. `{ x: 5 }` would leave the\n * children where they were and put the group's box somewhere they are not. Falling back whole, with\n * a warning, keeps the group box around its content and says so out loud.\n * @param options - the group object's options\n * @returns the supplied axis names, in `x`/`y`/`w`/`h` order\n */\nconst givenGroupFrameAxes = (options: ObjectOptions): Array<(typeof GROUP_FRAME_AXES)[number]> =>\n\tGROUP_FRAME_AXES.filter((axis) => typeof options[axis] !== 'undefined')\n\n/**\n * Whether a group's frame is fully explicit (all four of `x`/`y`/`w`/`h`), and so should be used\n * verbatim instead of the children's bounding box. See `givenGroupFrameAxes`.\n * @param options - the group object's options\n * @returns true when every axis is supplied\n */\nconst hasCompleteGroupFrame = (options: ObjectOptions): boolean =>\n\tgivenGroupFrameAxes(options).length === GROUP_FRAME_AXES.length\n\n/**\n * Normalize one axis of a placement box so its extent is never negative.\n *\n * `<a:ext cx>`/`<a:ext cy>` are `ST_PositiveCoordinate` (ECMA-376 Part 1, `CT_PositiveSize2D`), so a\n * negative extent is schema-invalid. PowerPoint rejects the *whole* presentation with \"The file or\n * directory is corrupted and unreadable\" (0x80070570) and names no shape, part, or slide, while\n * LibreOffice renders the same package happily — so the defect is invisible until the deck reaches\n * PowerPoint.\n *\n * A signed delta is the natural way to write \"draw from A to B\" (`{ x: x0, y: y0, w: x1 - x0, h: y1 - y0 }`),\n * and it goes negative the moment the line runs leftward or upward. The correct encoding is the\n * normalized bounding box plus a flip, which is what `addConnector` already derives from its own\n * endpoints (`src/gen/define/connector.ts`); this gives every other shape kind the same treatment at\n * the one point where every `Coord` form ('50%', '2in', a number) has been resolved to EMU.\n *\n * The caller composes `flip` onto any `flipH`/`flipV` the author set, so an explicit flip plus a\n * negative extent cancel out rather than double-applying.\n * @param off - the axis origin in EMU (`a:off` `x` or `y`)\n * @param ext - the axis extent in EMU (`a:ext` `cx` or `cy`), possibly negative\n * @returns the min-corner origin, the absolute extent, and whether the axis was mirrored\n */\nconst normalizeAxisExtent = (off: number, ext: number): { off: number; ext: number; flip: boolean } =>\n\text < 0 ? { off: off + ext, ext: -ext, flip: true } : { off, ext, flip: false }\n\n/** The frame a slide object is drawn in. */\ninterface ObjectFrame {\n\t/** the min-corner placement box, in EMU */\n\tx: number\n\ty: number\n\tcx: number\n\tcy: number\n\t/** whether normalization mirrored an axis, which composes onto the author's own flip */\n\tflipX: boolean\n\tflipY: boolean\n\t/** the layout placeholder the object names, which it inherits unstated axes from */\n\tplaceholder: SlideObject | null\n}\n\n/**\n * Resolve the frame a slide object is drawn in.\n *\n * The render pass and a group's bounding box both need it, and they used to resolve it apart. The\n * bounds pass defaulted a missing `w` or `h` to 0 and skipped placeholder inheritance, while the\n * render pass defaulted `cx` to 75% of the slide width and inherited the placeholder's frame, so a\n * group holding a text box with no `w` came out narrower than the text box.\n *\n * Each axis, most specific source first: what the caller stated on this object, else what the\n * layout placeholder it names states, else the default (`x`, `y` and `cy` 0, `cx` 75% of the slide\n * width). An explicit option beats an inherited one everywhere else in this library, and a\n * placeholder is an inherited one: applying it after the object's own values used to throw away a\n * stated frame with no diagnostic.\n *\n * Inheritance happens before normalization. A negative `w`/`h` becomes a min-corner origin, an\n * absolute extent and a flip, never a negative `<a:ext>`, which is out of range for\n * `ST_PositiveCoordinate` and costs the whole package (see `normalizeAxisExtent`). Doing it after\n * every `Coord` form has resolved to EMU means `'-2in'` and `'-25%'` normalize like a plain\n * negative number, and a placeholder's extents normalize with the object's own.\n * @param obj - the slide object\n * @param slide - the slide or layout holding it\n * @returns the object's frame\n */\nfunction resolveObjectFrame(\n\tobj: SlideObject,\n\tslide: PresSlideInternal | SlideLayoutInternal | SlideMasterInternal\n): ObjectFrame {\n\tconst itemOpts = obj.options ?? {}\n\tconst layout = slide._presLayout\n\t// The same lookup the definers use, so the frame and `<p:ph>` come from the placeholder the\n\t// object's options were inherited from.\n\tconst placeholder = findLayoutPlaceholder((slide as PresSlideInternal)._slideLayout, itemOpts.placeholder)\n\n\tconst phOpts = placeholder?.options ?? {}\n\tconst inherited = <T>(own: T | undefined, ph: T | undefined): T | undefined =>\n\t\town !== undefined ? own : (ph ?? undefined)\n\tconst ownX = inherited(itemOpts.x, phOpts.x)\n\tconst ownY = inherited(itemOpts.y, phOpts.y)\n\tconst ownW = inherited(itemOpts.w, phOpts.w)\n\tconst ownH = inherited(itemOpts.h, phOpts.h)\n\tconst normX = normalizeAxisExtent(\n\t\townX !== undefined ? getSmartParseNumber(ownX, 'X', layout) : 0,\n\t\townW !== undefined ? getSmartParseNumber(ownW, 'X', layout) : getSmartParseNumber('75%', 'X', layout)\n\t)\n\tconst normY = normalizeAxisExtent(\n\t\townY !== undefined ? getSmartParseNumber(ownY, 'Y', layout) : 0,\n\t\townH !== undefined ? getSmartParseNumber(ownH, 'Y', layout) : 0\n\t)\n\treturn {\n\t\tx: normX.off,\n\t\ty: normY.off,\n\t\tcx: normX.ext,\n\t\tcy: normY.ext,\n\t\tflipX: normX.flip,\n\t\tflipY: normY.flip,\n\t\tplaceholder,\n\t}\n}\n\n/**\n * Whether this part has a real slide number to cache in a `slidenum` field.\n *\n * Only a slide does. A master leaves `_slideNum` null and a layout carries the internal 1000+\n * counter that keeps layout media keys from colliding with slide media — neither is a page\n * number, and neither belongs in the field's cached text.\n */\nfunction hasRealSlideNumber(slide: PresSlideInternal | SlideLayoutInternal | SlideMasterInternal): boolean {\n\treturn slide._slideNum != null && slide._slideNum < 1000\n}\n\n/**\n * Warn about duplicate Selection Pane identities on this slide.\n *\n * Unique `objectName` values are what consumers (e.g. semantic manifests) rely on, so\n * collisions are flagged loudly. Deliberately NOT `warnOnce`: this runs per emit, and two\n * `write()` calls are two separate exports — a caller capturing diagnostics around the second\n * would otherwise be told its deck is clean because the first one had already said otherwise. Groups are recursed into: a group's children are\n * `<p:cNvPr>`-named on this same slide, so a child colliding with a top-level object (or with a\n * child of another group) is a collision the Selection Pane shows, and checking only the top\n * level cannot see it.\n */\nfunction warnDuplicateObjectNames(slide: PresSlideInternal | SlideLayoutInternal | SlideMasterInternal): void {\n\tconst collectObjectNames = (objects: SlideObject[]): string[] =>\n\t\tobjects.flatMap((obj) => [\n\t\t\t...(typeof obj.options?.objectName === 'string' ? [obj.options.objectName] : []),\n\t\t\t...collectObjectNames(obj._groupObjects || []),\n\t\t])\n\tconst duplicateObjectNames = getDuplicateObjectNames(collectObjectNames(slide._slideObjects))\n\tif (duplicateObjectNames.length > 0) {\n\t\twarn(\n\t\t\t'object-name/duplicate',\n\t\t\t`duplicate objectName value(s) emitted on a single slide: ${duplicateObjectNames.join(', ')}. Selection Pane identities should be unique.`\n\t\t)\n\t}\n}\n\n/**\n * The slide's `<p:bg>`, or `''` when it has none.\n *\n * Exactly one of the three forms is emitted: an image background (a rel the media pass resolved),\n * a colour or gradient, or the white default that only the built-in layout gets. They are\n * mutually exclusive because a master carrying both a `color` and a `path` must still produce a\n * single `<p:bg>`.\n */\nfunction slideBackgroundXml(slide: PresSlideInternal | SlideLayoutInternal | SlideMasterInternal): string {\n\tlet strSlideXml = ''\n\tif (slide._bkgdImgRid) {\n\t\tstrSlideXml += el(\n\t\t\t'p:bg',\n\t\t\tnull,\n\t\t\traw(\n\t\t\t\tel('p:bgPr', null, [\n\t\t\t\t\traw(\n\t\t\t\t\t\tel('a:blipFill', { dpi: '0', rotWithShape: '1' }, [\n\t\t\t\t\t\t\traw(el('a:blip', { 'r:embed': `rId${slide._bkgdImgRid}` }, raw(voidEl('a:lum')))),\n\t\t\t\t\t\t\traw(voidEl('a:srcRect')),\n\t\t\t\t\t\t\traw(STRETCH_FILL_RECT),\n\t\t\t\t\t\t])\n\t\t\t\t\t),\n\t\t\t\t\traw(voidEl('a:effectLst')),\n\t\t\t\t])\n\t\t\t)\n\t\t)\n\t\t// A background paints whenever it names one — `fillNamesPaint`, the same test the stroke\n\t\t// side uses. This gate used to accept a `color` or the literal `type: 'gradient'`, so a\n\t\t// background authored as `{ gradient }`, `{ pattern }` or `{ type: 'pattern', … }` was\n\t\t// dropped without a word and the slide came out inheriting the master.\n\t} else if (fillNamesPaint(slide.background)) {\n\t\tstrSlideXml += el(\n\t\t\t'p:bg',\n\t\t\tnull,\n\t\t\traw(el('p:bgPr', null, [raw(genXmlColorSelection(slide.background)), raw(voidEl('a:effectLst'))]))\n\t\t)\n\t} else if (!slide.background && slide._name && slide._name === DEF_PRES_LAYOUT_NAME) {\n\t\t// NOTE: Default [white] background is needed on slideMaster1.xml to avoid gray background in Keynote (and Finder previews)\n\t\tstrSlideXml += el('p:bg', null, raw(el('p:bgRef', { idx: '1001' }, raw(voidEl('a:schemeClr', { val: 'bg1' })))))\n\t}\n\treturn strSlideXml\n}\n\n/**\n * The slide-number placeholder shape.\n *\n * Emitted after every authored object, so its `<p:cNvPr>` id can come from the same monotonic\n * counter the walk has been advancing — the caller allocates it and passes it in.\n *\n * @param slide - the slide, layout or master being emitted\n * @param snProps - the part's slide-number properties, read but never written: a serializer\n * does not normalize the authored model (see the contract on `RenderContext.itemOpts`)\n * @param slideNumberId - the `<p:cNvPr>` id to use, already allocated by the caller\n */\nfunction slideNumberPlaceholderXml(\n\tslide: PresSlideInternal | SlideLayoutInternal | SlideMasterInternal,\n\tsnProps: SlideNumberProps,\n\tslideNumberId: number\n): string {\n\tlet strSlideXml = ''\n\tstrSlideXml += '<p:sp>'\n\tstrSlideXml += ' <p:nvSpPr>'\n\tstrSlideXml +=\n\t\tvoidEl('p:cNvPr', { id: slideNumberId, name: 'Slide Number Placeholder 0' }, { openPrefix: ' ' }) +\n\t\tel('p:cNvSpPr', null, raw(voidEl('a:spLocks', { noGrp: '1' })))\n\tstrSlideXml += el('p:nvPr', null, raw(voidEl('p:ph', { type: 'sldNum', sz: 'quarter', idx: '4294967295' })), {\n\t\topenPrefix: ' ',\n\t})\n\tstrSlideXml += ' </p:nvSpPr>'\n\tstrSlideXml += ' <p:spPr>'\n\tstrSlideXml +=\n\t\tel('a:xfrm', null, [\n\t\t\traw(\n\t\t\t\tvoidEl('a:off', {\n\t\t\t\t\tx: getSmartParseNumber(snProps.x, 'X', slide._presLayout),\n\t\t\t\t\ty: getSmartParseNumber(snProps.y, 'Y', slide._presLayout),\n\t\t\t\t})\n\t\t\t),\n\t\t\traw(\n\t\t\t\tvoidEl('a:ext', {\n\t\t\t\t\tcx: snProps.w ? getSmartParseNumber(snProps.w, 'X', slide._presLayout) : '800000',\n\t\t\t\t\tcy: snProps.h ? getSmartParseNumber(snProps.h, 'Y', slide._presLayout) : '300000',\n\t\t\t\t})\n\t\t\t),\n\t\t]) +\n\t\tprstGeomRect({ openPrefix: ' ' }) +\n\t\tel(\n\t\t\t'a:extLst',\n\t\t\tnull,\n\t\t\traw(\n\t\t\t\tel(\n\t\t\t\t\t'a:ext',\n\t\t\t\t\t{ uri: '{C572A759-6A51-4108-AA02-DFA0A04FC94B}' },\n\t\t\t\t\traw(\n\t\t\t\t\t\tvoidEl('ma14:wrappingTextBoxFlag', {\n\t\t\t\t\t\t\tval: '0',\n\t\t\t\t\t\t\t'xmlns:ma14': 'http://schemas.microsoft.com/office/mac/drawingml/2011/main',\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t),\n\t\t\t{ openPrefix: ' ' }\n\t\t) +\n\t\t'</p:spPr>'\n\tstrSlideXml += '<p:txBody>'\n\t// Margins are inches (see `marginToEmu`), matching text-box and cell margins.\n\t// NOTE: attribute ORDER is byte-significant; `resolveInsetsEmu` owns the array's own\n\t// [Top, Right, Bottom, Left] order.\n\tconst snInsets = resolveInsetsEmu(snProps.margin)\n\tstrSlideXml += voidEl('a:bodyPr', {\n\t\tlIns: snInsets?.l ?? null,\n\t\ttIns: snInsets?.t ?? null,\n\t\trIns: snInsets?.r ?? null,\n\t\tbIns: snInsets?.b ?? null,\n\t\tanchor: resolveTextAnchor(snProps.valign),\n\t})\n\tlet defRPr = ''\n\trejectEmptyColor(snProps.color, 'slideNumber color')\n\tif (snProps.fontFace || snProps.fontSize || snProps.color) {\n\t\t// The typeface is caller-supplied via `slide.slideNumber({ fontFace })`; the element builder\n\t\t// escapes it, so a `\"`/`&` in the name cannot close the attribute early.\n\t\tconst face = snProps.fontFace\n\t\tdefRPr = el('a:defRPr', { sz: clampFontSizeSz(snProps.fontSize || 12) }, [\n\t\t\tsnProps.color ? raw(genXmlColorSelection(snProps.color)) : null,\n\t\t\tface ? raw(voidEl('a:latin', { typeface: face })) : null,\n\t\t\tface ? raw(voidEl('a:ea', { typeface: face })) : null,\n\t\t\tface ? raw(voidEl('a:cs', { typeface: face })) : null,\n\t\t])\n\t}\n\tstrSlideXml += el('a:lstStyle', null, raw(el('a:lvl1pPr', null, raw(defRPr))), { openPrefix: ' ' })\n\n\t// Anything not starting c/r falls back to 'l'. This used to be preceded by a write of\n\t// `'left'` back onto `snProps`, justified as \"other readers rely on it\" — the only other\n\t// reader is this line, and it already defaults.\n\tconst snAlignRaw = snProps.align ?? 'left'\n\tconst snAlign = snAlignRaw.startsWith('c') ? 'ctr' : snAlignRaw.startsWith('r') ? 'r' : 'l'\n\tstrSlideXml += el('a:p', null, [\n\t\traw(voidEl('a:pPr', { algn: snAlign })),\n\t\traw(\n\t\t\tel('a:fld', { id: SLDNUMFLDID, type: 'slidenum' }, [\n\t\t\t\t// NOTE: `b` is emitted as \"0\" when unset, unlike the run properties elsewhere which omit it.\n\t\t\t\traw(voidEl('a:rPr', { b: xsdBool(snProps.bold), lang: 'en-US' })),\n\t\t\t\t// `<a:t>` inside an `a:fld` is the *cached* rendering of the field, so it is only a\n\t\t\t\t// slide number where there is a slide number to cache. A master has none\n\t\t\t\t// (`_slideNum` is null) and a layout carries the internal 1000+ counter, so this\n\t\t\t\t// used to ship `<a:t>null</a:t>` in every master and `<a:t>1004</a:t>` in a layout —\n\t\t\t\t// invisible in PowerPoint, which recomputes the field on open, but read straight\n\t\t\t\t// out by anything that takes the cache at face value (a text extractor, a search\n\t\t\t\t// indexer, this library's own read path). What PowerPoint itself caches on a master\n\t\t\t\t// or layout is the placeholder glyph, so emit that.\n\t\t\t\t//\n\t\t\t\t// The child must stay non-null: `el()` drops a null child entirely, and an `a:fld`\n\t\t\t\t// with no `a:t` is a different construct from one with placeholder text.\n\t\t\t\traw(el('a:t', null, hasRealSlideNumber(slide) ? String(slide._slideNum) : SLDNUM_PLACEHOLDER_TEXT)),\n\t\t\t])\n\t\t),\n\t\traw(voidEl('a:endParaRPr', { lang: 'en-US' })),\n\t])\n\tstrSlideXml += '</p:txBody></p:sp>'\n\treturn strSlideXml\n}\n\n/**\n * Transforms a slide or slideLayout to resulting XML string - Creates `ppt/slide*.xml`\n * @param slide - slide object created within createSlideObject\n * @param renderers - which renderer emits each shape family; see {@link RendererTable} for why\n * this arrives as an argument rather than being imported here\n * @return XML string with `<p:cSld>` as the root\n */\nexport function slideObjectToXml(\n\tslide: PresSlideInternal | SlideLayoutInternal | SlideMasterInternal,\n\trenderers: RendererTable\n): string {\n\t// `_name` is escaped here, at emission, as `objectName` is in `cNvPrOpen`: `_name` doubles as the\n\t// raw lookup key `addSlide({masterTitle})` matches\n\t// against the caller's `title` string (presentation.ts, `layout._name === masterTitle`), so it\n\t// must stay unescaped until the last possible moment or that match breaks for any title\n\t// containing `&`/`<`/`\"`. Plain slides' default `_name` (\"Slide N\", slide.ts) never contains\n\t// XML metacharacters, so escaping it here is a no-op for that path.\n\t// The element stays a template because it wraps the entire slide, built by append below.\n\tlet strSlideXml: string = slide._name ? '<p:cSld name=\"' + encodeXmlAttrValue(slide._name) + '\">' : '<p:cSld>'\n\n\twarnDuplicateObjectNames(slide)\n\n\t// STEP 1: Add the background, if this part defines one\n\tstrSlideXml += slideBackgroundXml(slide)\n\n\t// STEP 2: The shapes of the tree, wrapped by `spTreeEl` once they are all rendered\n\tconst spTreeChildren: string[] = []\n\n\t// Every object's <p:cNvPr> id, allocated once, up front. It has to be up front for the\n\t// references that cannot wait for the walk below to reach their target (connector shape\n\t// bindings, animation spids), and it is the ONLY allocation: the walk reads this map rather\n\t// than recomputing the same arithmetic, so there is nothing left to keep in step.\n\tconst shapeIds = collectSlideShapeIds(slide._slideObjects)\n\n\t// Resolve an object's bounds in EMU. For an auto-sized group (a `group` object with no explicit\n\t// x/y/w/h) this recurses into `_groupObjects` and returns their bounding box — so a parent group\n\t// can size around a nested auto-sized child group. The group rendering below uses the same helper\n\t// for both a child's bounds and a group's own off/ext, keeping every level consistent.\n\tconst resolveObjBounds = (obj: SlideObject): { x: number; y: number; cx: number; cy: number } => {\n\t\tconst o = obj.options || {}\n\t\t// Shares `hasCompleteGroupFrame` with the group renderer below, so a partial frame resolves to\n\t\t// the same auto-bounds here (where a parent group sizes around this one) as it does there.\n\t\tif (obj._type === SlideObjectType.group && !hasCompleteGroupFrame(o)) {\n\t\t\tconst kids = (obj._groupObjects || []).map(resolveObjBounds)\n\t\t\tif (kids.length === 0) return { x: 0, y: 0, cx: 0, cy: 0 }\n\t\t\tconst minX = Math.min(...kids.map((b) => b.x))\n\t\t\tconst minY = Math.min(...kids.map((b) => b.y))\n\t\t\tconst maxX = Math.max(...kids.map((b) => b.x + b.cx))\n\t\t\tconst maxY = Math.max(...kids.map((b) => b.y + b.cy))\n\t\t\treturn { x: minX, y: minY, cx: maxX - minX, cy: maxY - minY }\n\t\t}\n\t\t// The frame the render pass draws the object in, so a child with a defaulted, inherited or\n\t\t// negative extent contributes the box it is actually emitted with. An image is drawn at the\n\t\t// extent its natural size and `sizing` box give it, which can differ from its frame.\n\t\tconst frame = resolveObjectFrame(obj, slide)\n\t\tif (obj._type === SlideObjectType.image) {\n\t\t\tconst { drawnW, drawnH } = resolveImageExtent(obj, slide, frame)\n\t\t\treturn { x: frame.x, y: frame.y, cx: drawnW, cy: drawnH }\n\t\t}\n\t\treturn { x: frame.x, y: frame.y, cx: frame.cx, cy: frame.cy }\n\t}\n\n\t// Render one slide object — and, for a group, its children recursively — to an XML fragment.\n\t// Closes over `slide` and `childIdxAlloc`. Uses a local\n\t// `strSlideXml` accumulator (shadowing the slide-level one) so the existing per-object\n\t// `strSlideXml +=` appends compose into the returned fragment unchanged.\n\tconst renderSlideObjectXml = (slideItemObj: SlideObject): string => {\n\t\t// The one allocator's answer. Every renderer used to recompute `idx + 2` and the group walk\n\t\t// kept a second counter; a `p:cNvPr` id is now read from the same map the forward\n\t\t// references resolve through, so the two cannot drift.\n\t\tconst shapeId = shapeIds.get(slideItemObj) ?? 2\n\t\tlet strSlideXml = ''\n\n\t\t// A: Set option vars. Resolved to a LOCAL, never assigned back: a serializer does not\n\t\t// normalize the authored model, which is the contract `RenderContext.itemOpts` and\n\t\t// `slideNumberPlaceholderXml` both state, and these were the last two writes against it.\n\t\tconst itemOpts = slideItemObj.options ?? {}\n\t\t// The same frame a parent group's bounding box is taken over (`resolveObjBounds` above).\n\t\tconst { x, y, cx, cy, flipX, flipY, placeholder: placeholderObj } = resolveObjectFrame(slideItemObj, slide)\n\n\t\t// The `<a:xfrm>` placement attributes, shared by every shape kind that has a transform.\n\t\t// NOTE: order is byte-significant (flipH, flipV, rot), and `null` means omitted — `rotate: 0`\n\t\t// stays absent, and any other rotation, `NaN` included, goes to the converter.\n\t\t// A flip derived from a negative extent XORs with the author's own: `{ w: -2, flipH: true }`\n\t\t// is a box mirrored twice, i.e. not mirrored at all.\n\t\tconst locationAttrs: XmlAttrs = {\n\t\t\tflipH: xsdBoolIfTrue(Boolean(itemOpts.flipH) !== flipX),\n\t\t\tflipV: xsdBoolIfTrue(Boolean(itemOpts.flipV) !== flipY),\n\t\t\trot: mapStated(itemOpts.rotate, convertRotationDegrees) ?? null,\n\t\t}\n\n\t\t// B: Add OBJECT to the current Slide.\n\t\t// Each renderer below is called from here and nowhere else, so everything resolved above\n\t\t// travels as one `RenderContext` — including `itemOpts`, already normalized in step A. Six\n\t\t// of them used to take the whole `slideItemObj` and re-run `options = options || {}` as\n\t\t// their first statement, on an argument their only caller had already fixed; that\n\t\t// assignment existed to re-narrow the type, and threading the narrowed value in does the\n\t\t// same job without a mutation in the middle of an emit pass. If one of them ever gains a\n\t\t// second call site, normalizing is that caller's job — a contract stated once at the\n\t\t// boundary beats a defensive copy of it in every callee.\n\t\tconst ctx: RenderContext = {\n\t\t\tobj: slideItemObj,\n\t\t\tshapeId,\n\t\t\tshapeIds,\n\t\t\tslide,\n\t\t\tframe: { x, y, cx, cy },\n\t\t\tplaceholder: placeholderObj,\n\t\t\tlocationAttrs,\n\t\t\titemOpts,\n\t\t}\n\n\t\tswitch (slideItemObj._type) {\n\t\t\t// The ten shape families, all routed the same way. The arms are still spelled out —\n\t\t\t// `_type` is what tells a shape family from a group or from a non-shape member, and the\n\t\t\t// `never` at the bottom only holds while every member is named — but the *code* each one\n\t\t\t// reaches is `renderers`', not this module's. That is the whole point of the indirection:\n\t\t\t// a program that writes text boxes should not link the chart emitter, and a named import\n\t\t\t// in a reachable function body is retained whether the branch runs or not.\n\t\t\tcase SlideObjectType.chart:\n\t\t\tcase SlideObjectType.connector:\n\t\t\tcase SlideObjectType.image:\n\t\t\tcase SlideObjectType.media:\n\t\t\tcase SlideObjectType.model3d:\n\t\t\tcase SlideObjectType.oleObject:\n\t\t\tcase SlideObjectType.placeholder:\n\t\t\tcase SlideObjectType.table:\n\t\t\tcase SlideObjectType.text:\n\t\t\tcase SlideObjectType.zoom: {\n\t\t\t\tconst render = renderers[slideItemObj._type]\n\t\t\t\t// A family with no renderer is a routing bug, not an empty shape. The object was\n\t\t\t\t// authored, so it has already reserved a `<p:cNvPr>` id, and anything that referred to\n\t\t\t\t// it — a connector binding, an animation target, a group's bounding box — is emitted\n\t\t\t\t// against a shape that would silently not be there.\n\t\t\t\tif (!render)\n\t\t\t\t\tthrow new InternalError(\n\t\t\t\t\t\t'slide/object-type-not-routed',\n\t\t\t\t\t\t`slideObjectToXml: no renderer registered for slide object type \"${slideItemObj._type}\"`\n\t\t\t\t\t)\n\t\t\t\tstrSlideXml += render(ctx)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tcase SlideObjectType.group: {\n\t\t\t\tconst groupChildren = slideItemObj._groupObjects || []\n\n\t\t\t\t// Render children (recursively for nested groups). Each child gets a unique id via\n\t\t\t\t// `childIdxAlloc` (children are not in `_slideObjects`); the shared counter keeps ids\n\t\t\t\t// collision-free across nesting depth.\n\t\t\t\tlet innerXml = ''\n\t\t\t\t// No `child.options = child.options || {}` here: `renderSlideObjectXml` resolves its\n\t\t\t\t// own options on entry, so the parent has nothing to prepare for the child.\n\t\t\t\tgroupChildren.forEach((child) => {\n\t\t\t\t\tinnerXml += renderSlideObjectXml(child)\n\t\t\t\t})\n\n\t\t\t\t// Identity child coordinate space (chOff/chExt == off/ext) at every depth, so children\n\t\t\t\t// keep their slide-absolute coordinates. Use explicit x/y/w/h when all four are given,\n\t\t\t\t// else the bounding box of the children (recursing into nested auto-sized groups).\n\t\t\t\t// A partial frame warns and falls back whole rather than letting the unset axes take the\n\t\t\t\t// per-object defaults above (`cy` = 0 among them) and emit a degenerate group.\n\t\t\t\tconst givenAxes = givenGroupFrameAxes(itemOpts)\n\t\t\t\tif (givenAxes.length > 0 && givenAxes.length < GROUP_FRAME_AXES.length) {\n\t\t\t\t\tconst missingAxes = GROUP_FRAME_AXES.filter((axis) => !givenAxes.includes(axis))\n\t\t\t\t\twarn(\n\t\t\t\t\t\t'group/partial-frame',\n\t\t\t\t\t\t`addGroup: group \"${itemOpts.objectName ?? ''}\" has a partial frame (${givenAxes.join('/')} given, ${missingAxes.join('/')} missing); using auto-bounds (the bounding box of its children) instead. Pass all of x/y/w/h, or none.`\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tconst gb = hasCompleteGroupFrame(itemOpts) ? { x, y, cx, cy } : resolveObjBounds(slideItemObj)\n\t\t\t\tconst gx: number = gb.x\n\t\t\t\tconst gy: number = gb.y\n\t\t\t\tconst gcx: number = gb.cx\n\t\t\t\tconst gcy: number = gb.cy\n\n\t\t\t\tconst grpLockXml = genXmlObjectLock(\n\t\t\t\t\t'a:grpSpLocks',\n\t\t\t\t\tGROUP_SHAPE_LOCK_ATTRS,\n\t\t\t\t\titemOpts.objectLock,\n\t\t\t\t\titemOpts.objectName\n\t\t\t\t)\n\t\t\t\tstrSlideXml += '<p:grpSp>'\n\t\t\t\tstrSlideXml += el('p:nvGrpSpPr', null, [\n\t\t\t\t\traw(cNvPrEl(shapeId, itemOpts.objectName, itemOpts.altText || '')),\n\t\t\t\t\t// Paired only when there are locks to carry; otherwise self-closing.\n\t\t\t\t\traw(elOrVoid('p:cNvGrpSpPr', null, grpLockXml)),\n\t\t\t\t\traw(voidEl('p:nvPr')),\n\t\t\t\t])\n\t\t\t\tstrSlideXml += el('p:grpSpPr', null, raw(grpXfrmEl({ x: gx, y: gy, cx: gcx, cy: gcy }, locationAttrs)))\n\t\t\t\tstrSlideXml += innerXml\n\t\t\t\tstrSlideXml += '</p:grpSp>'\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// The four `SlideObjectType` members that are not slide shapes, spelled out so adding a\n\t\t\t// member to the enum fails to compile here rather than silently emitting nothing.\n\t\t\tcase SlideObjectType.notes:\n\t\t\t\t// Speaker notes live in `_slideObjects` but belong to the notes part, which\n\t\t\t\t// `gen/slide/notes.ts` builds from the same entry. Emitting nothing here is\n\t\t\t\t// load-bearing, not a gap.\n\t\t\t\tbreak\n\t\t\tcase SlideObjectType.tablecell:\n\t\t\t\t// Rendered by its owning table, through `renderTableObject` above.\n\t\t\t\tbreak\n\t\t\tcase SlideObjectType.hyperlink:\n\t\t\t\t// A relationship type, not a shape — it reaches the shape tree only as the `a:hlinkClick`\n\t\t\t\t// carried by whatever shape owns the link.\n\t\t\t\tbreak\n\t\t\tcase SlideObjectType.online:\n\t\t\t\t// Unused anywhere in `src/`; online video is `SlideObjectType.media` with `mtype: 'online'`.\n\t\t\t\tbreak\n\t\t\tdefault: {\n\t\t\t\t// Compile-time only: with every member routed above, this arm's type is `never`, so a new\n\t\t\t\t// `SlideObjectType` fails to typecheck here until it is either rendered or listed as one\n\t\t\t\t// of the non-shape members. Nothing is emitted, which is what the old bare default did.\n\t\t\t\tconst unrouted: never = slideItemObj._type\n\t\t\t\tvoid unrouted\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn strSlideXml\n\t}\n\n\tslide._slideObjects.forEach((slideItemObj: SlideObject) => {\n\t\tspTreeChildren.push(renderSlideObjectXml(slideItemObj))\n\t})\n\n\t// STEP 4: Add slide numbers (if any) last.\n\t// One past the highest id the allocator handed out — the same slot the group-child counter\n\t// used to reach. A hardcoded id here (formerly 25) aliases a shape or group-child id once a\n\t// slide holds enough objects, which PowerPoint repairs. Resolved here rather than inside the\n\t// emitter so a part with no slide number does not consume an id. The highest id is the last one\n\t// an object holds, which for a Summary Zoom is its last fallback picture's (`shapeIdCount`).\n\t//\n\t// A loop rather than `Math.max(1, ...shapeIds.values())`: spreading a collection as arguments\n\t// is an argument-count ceiling written as arithmetic, and `shapeIds` is sized by the slide.\n\tif (slide._slideNumberProps) {\n\t\tlet maxShapeId = 1\n\t\tfor (const [obj, id] of shapeIds) {\n\t\t\tconst lastId = id + shapeIdCount(obj) - 1\n\t\t\tif (lastId > maxShapeId) maxShapeId = lastId\n\t\t}\n\t\tspTreeChildren.push(slideNumberPlaceholderXml(slide, slide._slideNumberProps, maxShapeId + 1))\n\t}\n\n\t// STEP 5: The tree, then close the slide\n\tstrSlideXml += spTreeEl(spTreeChildren)\n\tstrSlideXml += '</p:cSld>'\n\n\t// LAST: Return\n\treturn strSlideXml\n}\n\n/**\n * The relationship id a part's default relationships are numbered from: one past the highest id\n * among its hyperlink, chart and media relationships.\n *\n * Exported because the master's `<p:sldLayoutId r:id>` values have to name the ids its `.rels` part\n * gives the layouts, and `makeXmlMaster` derived them as `_rels.length + idx + 1`. The two agreed\n * only while nothing registered a chart or media relationship on the master, since that count\n * ignores both.\n * @param slide - the slide, layout or master whose relationships are numbered\n */\nexport function defaultRelIdStart(slide: PresSlideInternal | SlideLayoutInternal | SlideMasterInternal): number {\n\tlet lastRid = 0\n\tfor (const rel of slide._rels) lastRid = Math.max(lastRid, rel.rId)\n\tfor (const rel of slide._relsChart || []) lastRid = Math.max(lastRid, rel.rId)\n\tfor (const rel of slide._relsMedia || []) lastRid = Math.max(lastRid, rel.rId)\n\treturn lastRid + 1\n}\n\n/**\n * Transforms slide relations to XML string.\n * Extra relations that are not dynamic can be passed using the 2nd arg (e.g. theme relation in master file).\n * These relations are numbered from {@link defaultRelIdStart}.\n * `selfPath` is the emitting part's own path, and it is required because a relationship target\n * resolves against the part that states it. An internal slide link used to be written\n * `slide${n}.xml` whatever the part, which is right from `ppt/slides/` and names nothing from\n * `ppt/slideLayouts/` or `ppt/slideMasters/` — so a `hyperlink: { slide }` on an object given to\n * `defineSlideMaster({ objects })` wrote a dangling relationship.\n * @param {PresSlideInternal | SlideLayoutInternal | SlideMasterInternal} slide - slide, layout or master whose relations are being transformed\n * @param {{ target: string; type: string }[]} defaultRels - array of default relations\n * @param {string} selfPath - the emitting part's own path, e.g. `ppt/slideLayouts/slideLayout2.xml`\n * @return {string} XML\n */\nexport function slideObjectRelationsToXml(\n\tslide: PresSlideInternal | SlideLayoutInternal | SlideMasterInternal,\n\tdefaultRels: Array<{ target: string; type: string }>,\n\tselfPath: string\n): string {\n\tconst rels: string[] = []\n\n\t/**\n\t * The Targets emitted so far *from the media loop below*, which is the only place the\n\t * question is asked: a media item produces TWO rels sharing one Target, and the second is\n\t * told from the first by the first already being there.\n\t *\n\t * Two things about the shape. It holds raw Targets rather than escaped ones, because this\n\t * asks about the model and not about markup — the probe used to substring-scan the emitted\n\t * XML for ` Target=\"…\"`, which forced the caller to escape by hand with the same escaper the\n\t * builder uses or the two drifted apart, and cost O(rels squared) in string scanning.\n\t *\n\t * And it is scoped to the media loop rather than to every rel. Scanning all of them meant a\n\t * hyperlink could answer a question about media, which is not a hypothetical: an online video\n\t * and a hyperlink to the same URL is an ordinary thing to author, and the hyperlink came\n\t * first, so the video pair came out as two MS-media rels with no ECMA `video` rel at all and\n\t * `<a:videoFile r:link>` pointing at the wrong type.\n\t */\n\tconst mediaTargets = new Set<string>()\n\n\t// STEP 1: Add all rels for this Slide\n\tslide._rels.forEach((rel: SlideRel) => {\n\t\tif (isHyperlinkRel(rel)) {\n\t\t\tif (rel.data === 'slide') {\n\t\t\t\trels.push(relationshipEl(rel.rId, SLIDE_REL, targetBetweenPptSubparts(selfPath, slidePath(Number(rel.Target)))))\n\t\t\t} else {\n\t\t\t\trels.push(externalHyperlinkRel(rel.rId, rel.Target))\n\t\t\t}\n\t\t}\n\t\t// NOTE: there is no `else` here on purpose. `_rels` only ever holds hyperlinks —\n\t\t// it is initialized empty (`slide.ts`) and the three sites that append to it\n\t\t// (`define/hyperlinks.ts` ×2, `define/image.ts`) all push `SlideObjectType.hyperlink`.\n\t\t// The notesSlide rel every slide needs comes from `defaultRels` in `makeXmlSlideRel`.\n\t})\n\t;(slide._relsChart || []).forEach((rel: SlideRelChart) => {\n\t\t// chartEx parts use the MS chartEx rel type; classic charts use the ECMA `chart` rel.\n\t\trels.push(relationshipEl(rel.rId, rel.isChartEx ? CHARTEX_REL : CHART_REL, rel.Target))\n\t})\n\t;(slide._relsMedia || []).forEach((rel: SlideRelMedia) => {\n\t\tconst relType = rel.type.toLowerCase()\n\t\t// Recorded at the point of emission, never earlier: \"first one wins the ECMA type, second\n\t\t// gets the MS type\" is the whole pairing rule for audio, video and online video, so the\n\t\t// probe must see only what is already out.\n\t\tconst seen = mediaTargets.has(rel.Target)\n\t\tmediaTargets.add(rel.Target)\n\t\tconst media = (type: string, targetMode?: string): string =>\n\t\t\trelationshipEl(rel.rId, type, rel.Target, { targetMode })\n\t\tif (rel.oleRelType) {\n\t\t\t// An OLE payload part carries its rel type verbatim (`.../package` or `.../oleObject`);\n\t\t\t// its `type` is the part's content type, which the sniffing below would misread.\n\t\t\trels.push(media(rel.oleRelType))\n\t\t} else if (rel.model3dRelType) {\n\t\t\t// Likewise a 3D model payload: its content type is `model/gltf.binary`, which matches none\n\t\t\t// of the sniffs below — and they have no `else`, so without this branch the rel would be\n\t\t\t// silently dropped and the slide would carry a dangling `r:embed`.\n\t\t\trels.push(media(rel.model3dRelType))\n\t\t} else if (relType.includes('image')) {\n\t\t\trels.push(media(IMAGE_REL))\n\t\t} else if (relType.includes('audio')) {\n\t\t\trels.push(seen ? media(MS_MEDIA_REL) : media(AUDIO_REL))\n\t\t} else if (relType.includes('video')) {\n\t\t\trels.push(seen ? media(MS_MEDIA_REL) : media(VIDEO_REL))\n\t\t} else if (relType.includes('online')) {\n\t\t\t// Online video has *TWO* external rels sharing the link Target: the ECMA video\n\t\t\t// rel (first) and the MS-2007 media rel (second). Both TargetMode=\"External\",\n\t\t\t// no media binary part.\n\t\t\trels.push(seen ? media(MS_MEDIA_REL, 'External') : media(VIDEO_REL, 'External'))\n\t\t}\n\t})\n\n\t// STEP 2: Add default rels\n\tconst start = defaultRelIdStart(slide)\n\tdefaultRels.forEach((rel, idx) => {\n\t\trels.push(relationshipEl(start + idx, rel.type, rel.target))\n\t})\n\n\treturn relationshipsPart(rels)\n}\n","/**\n * ts-pptx: slide part + slide/layout rels\n *\n * Emit a slide (`ppt/slides/slideN.xml`) and the relationship files for slides\n * and layouts (`slideN.xml.rels`, `slideLayoutN.xml.rels`).\n */\n\nimport { CRLF, XML_DECL } from '../../constants-internal.js'\nimport type { PresSlideInternal, SlideLayoutInternal } from '../../types/internal.js'\nimport { slideTimingToXml } from '../anim/timing.js'\nimport { slideTransitionToXml } from '../anim/transition.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { slideObjectRelationsToXml, slideObjectToXml } from './object.js'\nimport type { RendererTable } from './objects/shared.js'\nimport { InternalError } from '../../errors.js'\nimport { PML_ROOT_NS } from '../../ooxml/namespaces.js'\nimport { COMMENTS_REL, NOTES_SLIDE_REL, SLIDE_LAYOUT_REL, SLIDE_MASTER_REL } from '../../ooxml/rel-types.js'\nimport { commentPath, notesSlidePath, slideLayoutPath, slidePath, targetFromPptSubpart } from '../opc/part-paths.js'\n\n/**\n * Generates XML for the slide file (`ppt/slides/slide1.xml`)\n * @param slide - the slide object to transform into XML\n * @param renderers - which renderer emits each shape family, passed through to the shape walk\n * @param transitionSoundRId - the relationship id package assembly registered this slide's transition\n * start sound under, if it registered one\n * @return XML\n */\nexport function makeXmlSlide(slide: PresSlideInternal, renderers: RendererTable, transitionSoundRId?: number): string {\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tel(\n\t\t\t'p:sld',\n\t\t\t{\n\t\t\t\t...PML_ROOT_NS,\n\t\t\t\tshow: slide?.hidden ? '0' : null,\n\t\t\t},\n\t\t\t[\n\t\t\t\traw(slideObjectToXml(slide, renderers)),\n\t\t\t\traw(el('p:clrMapOvr', null, raw(voidEl('a:masterClrMapping')))),\n\t\t\t\traw(slideTransitionToXml(slide, transitionSoundRId)),\n\t\t\t\traw(slideTimingToXml(slide)),\n\t\t\t]\n\t\t)\n\t)\n}\n\n/**\n * Generates XML string for a slide layout relation file\n * @param {number} layoutNumber - 1-indexed number of a layout that relations are generated for\n * @param {SlideLayoutInternal[]} slideLayouts - Slide Layouts\n * @return {string} XML\n */\nexport function makeXmlSlideLayoutRel(layoutNumber: number, slideLayouts: SlideLayoutInternal[]): string {\n\tconst slideLayout = slideLayouts[layoutNumber - 1]\n\tif (!slideLayout)\n\t\tthrow new InternalError(\n\t\t\t'slide/rel-index-out-of-range',\n\t\t\t`makeXmlSlideLayoutRel: no slide layout at index ${layoutNumber - 1}`\n\t\t)\n\treturn slideObjectRelationsToXml(\n\t\tslideLayout,\n\t\t[\n\t\t\t{\n\t\t\t\ttarget: '../slideMasters/slideMaster1.xml',\n\t\t\t\ttype: SLIDE_MASTER_REL,\n\t\t\t},\n\t\t],\n\t\tslideLayoutPath(layoutNumber)\n\t)\n}\n\n/**\n * Creates `ppt/_rels/slide*.xml.rels`\n * @param {PresSlideInternal[]} slides\n * @param {SlideLayoutInternal[]} slideLayouts - Slide Layout(s)\n * @param {number} `slideNumber` 1-indexed number of a layout that relations are generated for\n * @return {string} XML\n */\nexport function makeXmlSlideRel(\n\tslides: PresSlideInternal[],\n\tslideLayouts: SlideLayoutInternal[],\n\tslideNumber: number\n): string {\n\tconst slide = slides[slideNumber - 1]\n\tif (!slide)\n\t\tthrow new InternalError('slide/rel-index-out-of-range', `makeXmlSlideRel: no slide at index ${slideNumber - 1}`)\n\tconst defaultRels = [\n\t\t{\n\t\t\ttarget: targetFromPptSubpart(slideLayoutPath(getLayoutIdxForSlide(slides, slideLayouts, slideNumber))),\n\t\t\ttype: SLIDE_LAYOUT_REL,\n\t\t},\n\t\t{\n\t\t\ttarget: targetFromPptSubpart(notesSlidePath(slideNumber)),\n\t\t\ttype: NOTES_SLIDE_REL,\n\t\t},\n\t]\n\t// Only emit the comments rel for slides that actually carry comments (the comment part\n\t// is likewise only written for those slides); the rId is assigned after slideLayout/notesSlide.\n\tif ((slide._comments || []).length > 0) {\n\t\tdefaultRels.push({\n\t\t\ttarget: targetFromPptSubpart(commentPath(slideNumber)),\n\t\t\ttype: COMMENTS_REL,\n\t\t})\n\t}\n\treturn slideObjectRelationsToXml(slide, defaultRels, slidePath(slideNumber))\n}\n\n/**\n * For the passed slide number, resolves name of a layout that is used for.\n * @param {PresSlideInternal[]} slides - srray of slides\n * @param {SlideLayoutInternal[]} slideLayouts - array of slideLayouts\n * @param {number} slideNumber\n * @return {number} slide number\n */\nfunction getLayoutIdxForSlide(\n\tslides: PresSlideInternal[],\n\tslideLayouts: SlideLayoutInternal[],\n\tslideNumber: number\n): number {\n\tfor (let i = 0; i < slideLayouts.length; i++) {\n\t\tif (slideLayouts[i]?._name === slides[slideNumber - 1]?._slideLayout?._name) {\n\t\t\treturn i + 1\n\t\t}\n\t}\n\n\t// IMPORTANT: Return 1 (for `slideLayout1.xml`) when no def is found\n\t// So all objects are in Layout1 and every slide that references it uses this layout.\n\treturn 1\n}\n","/**\n * ts-pptx: `ppt/theme/theme1.xml`\n *\n * Emit the Office theme: the `<a:clrScheme>` (with any caller color overrides\n * over the default Office scheme) plus the fixed font/format schemes.\n */\n\nimport { XML_DECL } from '../../constants-internal.js'\nimport { isHexColor, stripHash } from '../../hex-color.js'\nimport type { ThemeColorScheme } from '../../types/index.js'\nimport type { PresentationPropsInternal } from '../../types/internal.js'\nimport { warn } from '../../diagnostics.js'\nimport { el, raw, voidEl, type RawXml } from '../oxml/el.js'\nimport { OOXML_NS } from '../../ooxml/namespaces.js'\nimport { FMT_SCHEME_XML } from '../oxml/fmt-scheme.js'\n\n/**\n * Theme `<a:clrScheme>` slots in OOXML document order, with their default Office color child.\n * `dk1`/`lt1` default to `sysClr` (windowText/window); the rest are `srgbClr`. A user override\n * for any slot is emitted as `<a:srgbClr>` (see `buildThemeClrScheme`).\n */\nconst THEME_CLR_SCHEME_DEFAULTS: ReadonlyArray<[keyof ThemeColorScheme, RawXml]> = [\n\t['dk1', raw(voidEl('a:sysClr', { val: 'windowText', lastClr: '000000' }))],\n\t['lt1', raw(voidEl('a:sysClr', { val: 'window', lastClr: 'FFFFFF' }))],\n\t['dk2', raw(voidEl('a:srgbClr', { val: '44546A' }))],\n\t['lt2', raw(voidEl('a:srgbClr', { val: 'E7E6E6' }))],\n\t['accent1', raw(voidEl('a:srgbClr', { val: '4472C4' }))],\n\t['accent2', raw(voidEl('a:srgbClr', { val: 'ED7D31' }))],\n\t['accent3', raw(voidEl('a:srgbClr', { val: 'A5A5A5' }))],\n\t['accent4', raw(voidEl('a:srgbClr', { val: 'FFC000' }))],\n\t['accent5', raw(voidEl('a:srgbClr', { val: '5B9BD5' }))],\n\t['accent6', raw(voidEl('a:srgbClr', { val: '70AD47' }))],\n\t['hlink', raw(voidEl('a:srgbClr', { val: '0563C1' }))],\n\t['folHlink', raw(voidEl('a:srgbClr', { val: '954F72' }))],\n]\n\n/**\n * Build the theme `<a:clrScheme>` block, applying any caller-supplied color overrides over the\n * default Office scheme. Invalid (non 6-digit-hex) overrides warn and keep the default rather\n * than emitting a degenerate color.\n * @param {ThemeColorScheme} [scheme] - per-slot hex overrides\n * @return {string} the `<a:clrScheme>...</a:clrScheme>` XML\n */\nfunction buildThemeClrScheme(scheme?: ThemeColorScheme): string {\n\treturn el(\n\t\t'a:clrScheme',\n\t\t{ name: 'Office' },\n\t\tTHEME_CLR_SCHEME_DEFAULTS.map(([slot, defaultChild]) => {\n\t\t\tconst override = scheme?.[slot]\n\t\t\tlet child = defaultChild\n\t\t\tif (typeof override === 'string' && override.length > 0) {\n\t\t\t\tconst hex = stripHash(override)\n\t\t\t\tif (isHexColor(hex)) child = raw(voidEl('a:srgbClr', { val: hex.toUpperCase() }))\n\t\t\t\telse\n\t\t\t\t\twarn(\n\t\t\t\t\t\t'theme/invalid-color-override',\n\t\t\t\t\t\t`makeXmlTheme: colorScheme.${slot} \"${override}\" is not a 6-digit hex color; keeping the Office default.`\n\t\t\t\t\t)\n\t\t\t}\n\t\t\treturn raw(el(`a:${slot}`, null, child))\n\t\t})\n\t)\n}\n\n/**\n * The per-script theme font fallback table (`a:fontScheme`'s CT_TextFont lists), in OOXML\n * document order. Static Office defaults — no caller data, no escaping risk — unlike the\n * `<a:latin>`/`<a:ea>`/`<a:cs>` slots above.\n *\n * Forty-one of the forty-seven scripts take the same face in the major and minor lists, so the\n * shared table below is the whole thing and the two override maps hold the six-odd rows that\n * actually differ. Written out twice, ninety-four lines said less than these do, and one row\n * mistyped in one copy produces a theme that opens fine and paints a script in the wrong face —\n * a difference nobody reviewing a diff of two 47-row tables would see.\n */\nconst THEME_FONT_LIST: ReadonlyArray<readonly [string, string]> = [\n\t['Jpan', '游ゴシック'],\n\t['Hang', '맑은 고딕'],\n\t['Hans', '等线'],\n\t['Hant', '新細明體'],\n\t['Arab', 'Arial'],\n\t['Hebr', 'Arial'],\n\t['Thai', 'Cordia New'],\n\t['Ethi', 'Nyala'],\n\t['Beng', 'Vrinda'],\n\t['Gujr', 'Shruti'],\n\t['Khmr', 'DaunPenh'],\n\t['Knda', 'Tunga'],\n\t['Guru', 'Raavi'],\n\t['Cans', 'Euphemia'],\n\t['Cher', 'Plantagenet Cherokee'],\n\t['Yiii', 'Microsoft Yi Baiti'],\n\t['Tibt', 'Microsoft Himalaya'],\n\t['Thaa', 'MV Boli'],\n\t['Deva', 'Mangal'],\n\t['Telu', 'Gautami'],\n\t['Taml', 'Latha'],\n\t['Syrc', 'Estrangelo Edessa'],\n\t['Orya', 'Kalinga'],\n\t['Mlym', 'Kartika'],\n\t['Laoo', 'DokChampa'],\n\t['Sinh', 'Iskoola Pota'],\n\t['Mong', 'Mongolian Baiti'],\n\t['Viet', 'Arial'],\n\t['Uigh', 'Microsoft Uighur'],\n\t['Geor', 'Sylfaen'],\n\t['Armn', 'Arial'],\n\t['Bugi', 'Leelawadee UI'],\n\t['Bopo', 'Microsoft JhengHei'],\n\t['Java', 'Javanese Text'],\n\t['Lisu', 'Segoe UI'],\n\t['Mymr', 'Myanmar Text'],\n\t['Nkoo', 'Ebrima'],\n\t['Olck', 'Nirmala UI'],\n\t['Osma', 'Ebrima'],\n\t['Phag', 'Phagspa'],\n\t['Syrn', 'Estrangelo Edessa'],\n\t['Syrj', 'Estrangelo Edessa'],\n\t['Syre', 'Estrangelo Edessa'],\n\t['Sora', 'Nirmala UI'],\n\t['Tale', 'Microsoft Tai Le'],\n\t['Talu', 'Microsoft New Tai Lue'],\n\t['Tfng', 'Ebrima'],\n]\n\n/**\n * The seven scripts whose *heading* face differs from the body one. Latin and CJK headings take\n * the Light weight; the scripts with no Light cut take a serif (or, for Khmer, a different face\n * entirely) where the body takes a sans. Every other script in {@link THEME_FONT_LIST} uses one\n * face for both.\n */\nconst MAJOR_FONT_OVERRIDES: Readonly<Record<string, string>> = {\n\tJpan: '游ゴシック Light',\n\tHans: '等线 Light',\n\tArab: 'Times New Roman',\n\tHebr: 'Times New Roman',\n\tThai: 'Angsana New',\n\tKhmr: 'MoolBoran',\n\tViet: 'Times New Roman',\n}\n\n/** The major (heading) and minor (body) lists, both derived from the one table. */\nconst MAJOR_FONT_LIST: ReadonlyArray<readonly [string, string]> = THEME_FONT_LIST.map(\n\t([script, face]) => [script, MAJOR_FONT_OVERRIDES[script] ?? face] as const\n)\nconst MINOR_FONT_LIST = THEME_FONT_LIST\n\nfunction fontListChildren(scriptFaces: ReadonlyArray<readonly [string, string]>): RawXml[] {\n\treturn scriptFaces.map(([script, typeface]) => raw(voidEl('a:font', { script, typeface })))\n}\n\n/**\n * Creates `ppt/theme/theme1.xml`\n * @return {string} XML\n */\nexport function makeXmlTheme(pres: PresentationPropsInternal): string {\n\t// Theme font faces are caller-supplied strings (`ThemeProps`). el()'s attrs escape by\n\t// construction: an unescaped `\"` or `&` in a font name would close the attribute early and\n\t// emit non-parseable `theme1.xml`, which PowerPoint reports as a file needing repair.\n\tconst majorLatin = pres.theme?.headFontFace\n\t\t? raw(voidEl('a:latin', { typeface: pres.theme.headFontFace }))\n\t\t: raw(voidEl('a:latin', { typeface: 'Calibri Light', panose: '020F0302020204030204' }))\n\tconst minorLatin = pres.theme?.bodyFontFace\n\t\t? raw(voidEl('a:latin', { typeface: pres.theme.bodyFontFace }))\n\t\t: raw(voidEl('a:latin', { typeface: 'Calibri', panose: '020F0502020204030204' }))\n\t// East Asian (`<a:ea>`) and complex-script (`<a:cs>`) theme font slots. PowerPoint emits these\n\t// empty by default and resolves per-script via the `<a:font>` list that follows; setting them\n\t// lets CJK / complex-script runs fall back to a caller-chosen theme font.\n\tconst majorEa = raw(voidEl('a:ea', { typeface: pres.theme?.headFontFaceEA ?? '' }))\n\tconst minorEa = raw(voidEl('a:ea', { typeface: pres.theme?.bodyFontFaceEA ?? '' }))\n\tconst majorCs = raw(voidEl('a:cs', { typeface: pres.theme?.headFontFaceCS ?? '' }))\n\tconst minorCs = raw(voidEl('a:cs', { typeface: pres.theme?.bodyFontFaceCS ?? '' }))\n\n\tconst fontScheme = el('a:fontScheme', { name: 'Office' }, [\n\t\traw(el('a:majorFont', null, [majorLatin, majorEa, majorCs, ...fontListChildren(MAJOR_FONT_LIST)])),\n\t\traw(el('a:minorFont', null, [minorLatin, minorEa, minorCs, ...fontListChildren(MINOR_FONT_LIST)])),\n\t])\n\n\tconst themeElements = el('a:themeElements', null, [\n\t\traw(buildThemeClrScheme(pres.theme?.colorScheme)),\n\t\traw(fontScheme),\n\t\traw(FMT_SCHEME_XML),\n\t])\n\n\tconst extLst = el(\n\t\t'a:extLst',\n\t\tnull,\n\t\traw(\n\t\t\tel(\n\t\t\t\t'a:ext',\n\t\t\t\t{ uri: '{05A4C25C-085E-4340-85A3-A5531E510DB2}' },\n\t\t\t\traw(\n\t\t\t\t\tvoidEl('thm15:themeFamily', {\n\t\t\t\t\t\t'xmlns:thm15': 'http://schemas.microsoft.com/office/thememl/2012/main',\n\t\t\t\t\t\tname: 'Office Theme',\n\t\t\t\t\t\tid: '{62F939B6-93AF-4DB8-9C6B-D6C7DFDC589F}',\n\t\t\t\t\t\tvid: '{4A3C46E8-61CC-4603-A589-7422A47A8E4A}',\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t)\n\n\treturn (\n\t\tXML_DECL +\n\t\tel('a:theme', { 'xmlns:a': OOXML_NS.a, name: 'Office Theme' }, [\n\t\t\traw(themeElements),\n\t\t\traw(voidEl('a:objectDefaults')),\n\t\t\traw(voidEl('a:extraClrSchemeLst')),\n\t\t\traw(extLst),\n\t\t])\n\t)\n}\n","/**\n * ts-pptx: authored slides as injectable descriptors\n *\n * The serialization pass behind `Presentation.extractSlides()`: it runs the same\n * pre-serialization work a write does (`./prepare`), serializes each slide body, and resolves\n * everything the body *references* — image media, audio/video, online video, hyperlinks,\n * charts, notes — into descriptors the read side's `appendSlides` can splice into a loaded\n * deck without touching that deck's masters, layouts or theme.\n *\n * Nothing here resolves a descriptor into a package part. Reserving parts and rebuilding the\n * rel graph is the append path's job, on the destination deck's own numbering; this side only\n * says what each body refers to and by which `rId`.\n */\n\nimport { SlideObjectType } from '../enums.js'\nimport type { PresentationPropsInternal, PresSlideInternal } from '../types/internal.js'\nimport type { ExtractedSlide, ExtractedSlides } from '../read/api/presentation-types.js'\nimport type { RuntimeAdapter } from '../runtime/types.js'\nimport type { FontMetricsRegistry } from '../measure/font-metrics.js'\nimport { InternalError } from '../errors.js'\nimport { isHyperlinkRel } from './utils.js'\nimport { msMediaRid, previewRid } from './define/media.js'\nimport { decodeBase64ToBytes } from '../media/base64.js'\nimport { avContentType, imageContentType } from '../media/content-type.js'\nimport { backfillPlaceholders, bakeMeasuredFit, encodeMediaForTargets, requireSlideLinksInDeck } from './prepare.js'\nimport { makeXmlSlide } from './slide/slide.js'\nimport type { RendererTable } from './slide/objects/shared.js'\nimport type { SlideExtractors } from '../families/shared.js'\nimport { buildNotesSlideRels, makeXmlNotesMaster, makeXmlNotesSlide } from './slide/notes.js'\nimport { makeXmlTheme } from './pres/theme.js'\n\n/**\n * The slice of a deck's state an extraction reads — the same fields `PackageSource` carries for a\n * write, minus the custom properties, which reach no slide. `presentation` supplies the slides,\n * the canvas size and the embedded fonts, and is what the notes master's theme is built from.\n */\ninterface ExtractSource {\n\treadonly runtime: RuntimeAdapter\n\treadonly presentation: PresentationPropsInternal\n\treadonly fontMetrics: FontMetricsRegistry\n\t/**\n\t * Which renderer emits each shape family. An extracted body is the same XML a write would put\n\t * in the slide part, so it is emitted through the same table rather than a fixed one — see\n\t * `RendererTable` in `slide/objects/shared.ts`.\n\t */\n\treadonly renderers: RendererTable\n\t/**\n\t * What each construct family adds to an extracted slide beyond that XML. Handed in for the same\n\t * reason the renderers are: naming the chart emitters here put every plot module in the graph of\n\t * any program that can build a deck, because this path is reachable from all of them.\n\t */\n\treadonly extract: SlideExtractors\n}\n\n/** One slide's `_relsMedia`, indexed by `rId`, for the media descriptors that resolve rels by id. */\ntype RelsByRid = ReadonlyMap<number, PresSlideInternal['_relsMedia'][number]>\n\n/**\n * Embedded audio/video. addMedia (`gen/define/media.ts`) pushes three consecutive\n * _relsMedia entries per item off `mediaRid`: the ECMA audio/video rel\n * (rId=mediaRid), the MS-2007 `media` rel (mediaRid+1, sharing one Target),\n * and the preview image rel (mediaRid+2). The body references all three; we\n * surface the descriptor so appendSlides can reproduce the rel graph. Online\n * media (external link) is excluded — it has a different rel shape and no part.\n */\nfunction avMediaOf(slide: PresSlideInternal, relByRid: RelsByRid): ExtractedSlide['avMedia'] {\n\treturn slide._slideObjects\n\t\t.filter((obj) => obj._type === SlideObjectType.media && obj.mtype !== 'online' && typeof obj.mediaRid === 'number')\n\t\t.map((obj) => {\n\t\t\tconst mtype: 'audio' | 'video' = obj.mtype === 'audio' ? 'audio' : 'video'\n\t\t\tconst mediaRid = obj.mediaRid as number\n\t\t\tconst mediaRel = relByRid.get(mediaRid)\n\t\t\tconst previewRel = relByRid.get(previewRid(mediaRid))\n\t\t\tif (!mediaRel || !previewRel) return null\n\t\t\tconst mediaBytes = decodeBase64ToBytes(typeof mediaRel.data === 'string' ? mediaRel.data : '')\n\t\t\tconst previewBytes = decodeBase64ToBytes(typeof previewRel.data === 'string' ? previewRel.data : '')\n\t\t\tif (!mediaBytes || !previewBytes) return null\n\t\t\tconst mediaExtn = relExtension(mediaRel, 'mp4')\n\t\t\tconst previewExtn = relExtension(previewRel, 'png')\n\t\t\treturn {\n\t\t\t\tmtype,\n\t\t\t\tmediaRid,\n\t\t\t\tmsMediaRid: msMediaRid(mediaRid),\n\t\t\t\tpreviewRid: previewRid(mediaRid),\n\t\t\t\tmediaBytes,\n\t\t\t\tmediaExtn,\n\t\t\t\tmediaContentType: avContentType(mediaExtn, mtype),\n\t\t\t\tpreviewBytes,\n\t\t\t\tpreviewExtn,\n\t\t\t\tpreviewContentType: imageContentType(previewExtn),\n\t\t\t}\n\t\t})\n\t\t.filter((m): m is NonNullable<typeof m> => m !== null)\n}\n\n/**\n * A media rel's lowercased file extension: its own `extn` when it has one, else the suffix of\n * its `Target`, else `fallback`.\n * @param rel - the media relationship\n * @param fallback - the extension to assume when neither source names one\n */\nfunction relExtension(rel: { extn?: string; Target: string }, fallback: string): string {\n\treturn (rel.extn || rel.Target.split('.').pop() || fallback).toLowerCase()\n}\n\n/**\n * Plain image media, as decoded bytes keyed by the `rId` the body uses.\n *\n * `avPreviewRids` are the poster frames of {@link avMediaOf}'s items: they live in\n * `_relsMedia` as image rels too, and their descriptor already carries them, so they are\n * excluded here rather than surfaced twice.\n */\nfunction imageMediaOf(slide: PresSlideInternal, avPreviewRids: ReadonlySet<number>): ExtractedSlide['media'] {\n\treturn slide._relsMedia\n\t\t.filter((rel) => rel.type.toLowerCase().includes('image') && !avPreviewRids.has(rel.rId))\n\t\t.map((rel) => {\n\t\t\t// `decodeBase64ToBytes` takes a bare payload and a `data:` URI alike, so there is no prefix to\n\t\t\t// normalize. The one this used to add changed no decoded byte.\n\t\t\tconst data: string = rel.data && typeof rel.data === 'string' ? rel.data : ''\n\t\t\tconst bytes = decodeBase64ToBytes(data)\n\t\t\tconst extn = relExtension(rel, 'png')\n\t\t\treturn bytes ? { rId: rel.rId, bytes, extn, contentType: imageContentType(extn) } : null\n\t\t})\n\t\t.filter((m): m is NonNullable<typeof m> => m !== null)\n}\n\n/**\n * Online (external-link) video. addMedia type:'online' pushes three rels off\n * mediaRid: the ECMA video rel (mediaRid, External), the MS-2007 media rel\n * (mediaRid+1, External, sharing the link Target), and the poster image rel\n * (mediaRid+2, carried by {@link imageMediaOf} as a normal image). No media binary\n * part exists; appendSlides reproduces only the two external rels + poster.\n */\nfunction onlineMediaOf(slide: PresSlideInternal, relByRid: RelsByRid): ExtractedSlide['onlineMedia'] {\n\treturn slide._slideObjects\n\t\t.filter((obj) => obj._type === SlideObjectType.media && obj.mtype === 'online' && typeof obj.mediaRid === 'number')\n\t\t.map((obj) => {\n\t\t\tconst mediaRid = obj.mediaRid as number\n\t\t\tconst videoRel = relByRid.get(mediaRid)\n\t\t\tif (!videoRel || typeof videoRel.Target !== 'string' || !videoRel.Target) return null\n\t\t\treturn { mediaRid, msMediaRid: msMediaRid(mediaRid), link: videoRel.Target }\n\t\t})\n\t\t.filter((m): m is NonNullable<typeof m> => m !== null)\n}\n\n/** External hyperlink rels, keyed by the `rId` the body uses. */\nfunction hyperlinksOf(slide: PresSlideInternal): ExtractedSlide['hyperlinks'] {\n\treturn slide._rels\n\t\t.filter((rel) => isHyperlinkRel(rel) && rel.data !== 'slide')\n\t\t.map((rel) => ({ rId: rel.rId, target: rel.Target }))\n}\n\n/**\n * Internal slide-to-slide links: `rel.data === 'slide'`, and `rel.Target` is the 1-based\n * source slide number (see addText's hyperlink.slide handling).\n *\n * A Target that does not read as a slide number throws rather than passing `NaN` on to the\n * append path's rel-graph rebuild, where it surfaces as \"links to source slide NaN\" a whole\n * subsystem later. `addText` writes this Target itself, so the condition is a defect on this\n * side rather than bad input — an {@link InternalError}, like the chart router's own.\n */\nfunction slideLinksOf(slide: PresSlideInternal): ExtractedSlide['slideLinks'] {\n\treturn slide._rels\n\t\t.filter((rel) => isHyperlinkRel(rel) && rel.data === 'slide')\n\t\t.map((rel) => {\n\t\t\tconst sourceSlideNumber = Number(rel.Target)\n\t\t\tif (!Number.isInteger(sourceSlideNumber) || sourceSlideNumber < 1)\n\t\t\t\tthrow new InternalError(\n\t\t\t\t\t'slide/link-target-not-a-number',\n\t\t\t\t\t`Internal slide link rId${rel.rId} targets \"${String(rel.Target)}\", which is not a slide number`\n\t\t\t\t)\n\t\t\treturn { rId: rel.rId, sourceSlideNumber }\n\t\t})\n}\n\n/**\n * Speaker notes, or `undefined` when the slide has none. The body and the hyperlinks come from one\n * resolution of the notes, because the two must agree on every hyperlink rId. Notes rels reserve\n * rId1=notesMaster and rId2=slide, both of which appendSlides wires itself.\n */\nfunction notesOf(slide: PresSlideInternal): ExtractedSlide['notes'] {\n\tconst hasNotes = slide._slideObjects.some((obj) => obj._type === SlideObjectType.notes)\n\tif (!hasNotes) return undefined\n\tconst notes = buildNotesSlideRels(slide)\n\treturn {\n\t\txml: makeXmlNotesSlide(slide, notes),\n\t\thyperlinks: notes.rels\n\t\t\t.filter((rel) => typeof rel.Target === 'string' && rel.Target)\n\t\t\t.map((rel) => ({ rId: rel.rId, target: rel.Target })),\n\t}\n}\n\n/**\n * Serialize a deck's authored slides as injectable descriptors, without producing a package.\n * @param source - the deck state to read; see {@link ExtractSource}\n * @param opts.onMediaError - what a media source that cannot be read does, as on `write()`\n */\nexport async function extractSlides(\n\tsource: ExtractSource,\n\topts: { onMediaError?: 'throw' | 'placeholder' } = {}\n): Promise<ExtractedSlides> {\n\tconst onMediaError = opts.onMediaError ?? 'throw'\n\tconst { presentation } = source\n\tconst deckSlides = presentation.slides\n\n\t// A link to a slide the deck does not have is refused before anything is prepared, as on a write.\n\trequireSlideLinksInDeck(deckSlides)\n\n\t// STEP 1+2: The same pre-serialization pass `buildPackageParts` runs — backfill placeholders,\n\t// encode media, bake measured fit — so extracted bodies match a normal write by construction\n\t// rather than by keeping two copies in step. See `gen/prepare.ts`.\n\t// Only slides here: this emits no layout or master parts.\n\tbackfillPlaceholders(deckSlides)\n\tawait encodeMediaForTargets(deckSlides, source.runtime, onMediaError)\n\tconst restoreAuthoredFit = bakeMeasuredFit(deckSlides, source.fontMetrics)\n\n\t// STEP 3: Serialize each slide body and resolve what it references. The fit bake is undone once\n\t// every body is built, as on a write.\n\tlet slides: ExtractedSlide[]\n\ttry {\n\t\tslides = deckSlides.map((slide) => {\n\t\t\tconst relByRid = new Map(slide._relsMedia.map((rel) => [rel.rId, rel] as const))\n\t\t\tconst avMedia = avMediaOf(slide, relByRid)\n\t\t\tconst notes = notesOf(slide)\n\t\t\treturn {\n\t\t\t\txml: makeXmlSlide(slide, source.renderers),\n\t\t\t\tmedia: imageMediaOf(slide, new Set(avMedia.map((item) => item.previewRid))),\n\t\t\t\thyperlinks: hyperlinksOf(slide),\n\t\t\t\tcharts: source.extract.charts?.(slide) ?? [],\n\t\t\t\tslideLinks: slideLinksOf(slide),\n\t\t\t\tavMedia,\n\t\t\t\tonlineMedia: onlineMediaOf(slide, relByRid),\n\t\t\t\t...(notes ? { notes } : {}),\n\t\t\t}\n\t\t})\n\t} finally {\n\t\trestoreAuthoredFit()\n\t}\n\n\t// Presentation-level embedded fonts (pptx.embedFont) ride alongside the slides\n\t// so appendSlides can carry them into the destination deck; same model the\n\t// write path serializes (see src/embedded-fonts.ts), passed through unchanged.\n\t// A notes slide must bind to a notes master, and a destination template commonly has\n\t// none (a deck authored without notes carries no notesMaster part). Ship ours so the\n\t// append path can install one; it is discarded when the destination already has one.\n\t// theme2.xml is what notesMaster1.xml.rels resolves to on the normal write path.\n\tconst notesMaster = slides.some((s) => s.notes)\n\t\t? { xml: makeXmlNotesMaster(), themeXml: makeXmlTheme(presentation) }\n\t\t: undefined\n\n\treturn {\n\t\twidthEmu: presentation.presLayout.width,\n\t\theightEmu: presentation.presLayout.height,\n\t\tslides,\n\t\tembeddedFonts: presentation.embeddedFonts,\n\t\t...(notesMaster ? { notesMaster } : {}),\n\t}\n}\n","/**\n * ts-pptx: `docProps/app.xml`\n *\n * Emit the extended-properties part (application, slide/notes counts, heading\n * pairs, titles of parts, company).\n */\n\nimport { CRLF, XML_DECL } from '../../constants-internal.js'\nimport type { PresSlideInternal } from '../../types/internal.js'\nimport type { PresLayout } from '../../types/index.js'\nimport { el, raw } from '../oxml/el.js'\nimport { OOXML_NS } from '../../ooxml/namespaces.js'\nimport { presentationFormatLabel } from '../../ooxml/slide-size.js'\n\n/** This part is pretty-printed, one element per line, at three nesting depths. */\nconst INDENT_1 = '\\n\\t'\nconst INDENT_2 = '\\n\\t\\t'\nconst INDENT_3 = '\\n\\t\\t\\t'\nconst PROP = { openPrefix: INDENT_1 }\nconst VECTOR = { openPrefix: INDENT_2, closePrefix: INDENT_2 }\nconst ITEM = { openPrefix: INDENT_3 }\n\nconst NS = {\n\txmlns: OOXML_NS.ep,\n\t'xmlns:vt': OOXML_NS.vt,\n}\n\n/** One `<vt:variant>` of a heading pair: the section's name, then its count. */\nfunction headingPair(name: string, count: number): string[] {\n\treturn [\n\t\tel('vt:variant', null, raw(el('vt:lpstr', null, name)), ITEM),\n\t\tel('vt:variant', null, raw(el('vt:i4', null, count)), ITEM),\n\t]\n}\n\n/**\n * Creates `docProps/app.xml`\n *\n * `PresentationFormat` and `HiddenSlides` were constants -- `On-screen Show (16:9)` and `0` --\n * whatever the deck. PowerPoint rewrites both on its first save, so nothing broke, but until then\n * a 4:3 deck and a deck with hidden slides each stated something false to anything reading the\n * package without opening it. Both are known here, so both are reported.\n * @param {PresSlideInternal[]} slides - Presenation Slides\n * @param {string} company - \"Company\" metadata\n * @param {PresLayout} presLayout - the deck's slide size, which names its presentation format\n * @returns XML\n */\nexport function makeXmlApp(slides: PresSlideInternal[], company: string, presLayout: PresLayout): string {\n\tconst headingPairs = el(\n\t\t'vt:vector',\n\t\t{ size: 6, baseType: 'variant' },\n\t\t[...headingPair('Fonts Used', 2), ...headingPair('Theme', 1), ...headingPair('Slide Titles', slides.length)].map(\n\t\t\traw\n\t\t),\n\t\tVECTOR\n\t)\n\n\tconst titlesOfParts = el(\n\t\t'vt:vector',\n\t\t{ size: slides.length + 1 + 2, baseType: 'lpstr' },\n\t\t[\n\t\t\traw(el('vt:lpstr', null, 'Arial', ITEM)),\n\t\t\traw(el('vt:lpstr', null, 'Calibri', ITEM)),\n\t\t\traw(el('vt:lpstr', null, 'Office Theme', ITEM)),\n\t\t\t// The slide titles share one line, so the indent is emitted once — and it is\n\t\t\t// emitted whether or not there are any titles to follow it.\n\t\t\traw(INDENT_3),\n\t\t\t...slides.map((_slideObj, idx) => raw(el('vt:lpstr', null, `Slide ${idx + 1}`))),\n\t\t],\n\t\tVECTOR\n\t)\n\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tel(\n\t\t\t'Properties',\n\t\t\tNS,\n\t\t\t[\n\t\t\t\traw(el('TotalTime', null, 0, PROP)),\n\t\t\t\traw(el('Words', null, 0, PROP)),\n\t\t\t\traw(el('Application', null, 'Microsoft Office PowerPoint', PROP)),\n\t\t\t\traw(el('PresentationFormat', null, presentationFormatLabel(presLayout.width, presLayout.height), PROP)),\n\t\t\t\traw(el('Paragraphs', null, 0, PROP)),\n\t\t\t\traw(el('Slides', null, slides.length, PROP)),\n\t\t\t\traw(el('Notes', null, slides.length, PROP)),\n\t\t\t\traw(el('HiddenSlides', null, slides.filter((slide) => slide.hidden).length, PROP)),\n\t\t\t\traw(el('MMClips', null, 0, PROP)),\n\t\t\t\traw(el('ScaleCrop', null, 'false', PROP)),\n\t\t\t\traw(el('HeadingPairs', null, raw(headingPairs), { ...PROP, closePrefix: INDENT_1 })),\n\t\t\t\traw(el('TitlesOfParts', null, raw(titlesOfParts), { ...PROP, closePrefix: INDENT_1 })),\n\t\t\t\traw(el('Company', null, company, PROP)),\n\t\t\t\traw(el('LinksUpToDate', null, 'false', PROP)),\n\t\t\t\traw(el('SharedDoc', null, 'false', PROP)),\n\t\t\t\traw(el('HyperlinksChanged', null, 'false', PROP)),\n\t\t\t\traw(el('AppVersion', null, '16.0000', PROP)),\n\t\t\t],\n\t\t\t{ closePrefix: INDENT_1 }\n\t\t)\n\t)\n}\n","/**\n * ts-pptx: `[Content_Types].xml`\n *\n * Emit the package content-types part: Default entries for the media extensions\n * actually used by the deck (plus the font default when faces are embedded) and\n * Override entries for every part the package skeleton writes.\n *\n * Entries that exist only because a construct family put a part in the package arrive as\n * {@link ContentTypeContributions} — already resolved to data and grouped by where they land.\n * The order below is a property of the format, not of whoever assembled that list, so a deck\n * written by a program that links three families and one that links ten emit the same bytes.\n */\n\nimport { CRLF, XML_DECL } from '../../constants-internal.js'\nimport type {\n\tPresSlideInternal,\n\tSlideLayoutInternal,\n\tSlideMasterInternal,\n\tSlideRelMedia,\n} from '../../types/internal.js'\nimport { avContentType } from '../../media/content-type.js'\nimport { type EmbeddedFont, FONT_DATA_CONTENT_TYPE, FONT_DATA_EXTENSION } from '../../embedded-fonts.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { overrideName, PRESENTATION_PATH, slideLayoutPath, SLIDE_MASTER_PATH, slidePath } from './part-paths.js'\nimport { OOXML_NS } from '../../ooxml/namespaces.js'\nimport {\n\tCORE_PROPS_CONTENT_TYPE,\n\tCUSTOM_PROPS_CONTENT_TYPE,\n\tEXTENDED_PROPS_CONTENT_TYPE,\n\tPRES_PROPS_CONTENT_TYPE,\n\tPRESENTATION_MAIN_CONTENT_TYPE,\n\tRELATIONSHIPS_CONTENT_TYPE,\n\tSLIDE_CONTENT_TYPE,\n\tSLIDE_LAYOUT_CONTENT_TYPE,\n\tSLIDE_MASTER_CONTENT_TYPE,\n\tTABLE_STYLES_CONTENT_TYPE,\n\tTHEME_CONTENT_TYPE,\n\tVIEW_PROPS_CONTENT_TYPE,\n} from '../../ooxml/rel-types.js'\n\n/**\n * Some Override entries have always been emitted with a leading space. It is insignificant\n * whitespace, but it is in the bytes this library has shipped for years, so it is reproduced\n * verbatim rather than normalized (see AGENTS.md \"Byte identity\": whitespace diffs are a STOP).\n */\nconst LEADING_SPACE = { openPrefix: ' ' }\n\n/** One `Default` entry: a file extension, and the content type every part named with it carries. */\nexport interface ContentTypeDefault {\n\treadonly extension: string\n\treadonly contentType: string\n}\n\n/**\n * One `Override` entry: an absolute part name and its content type. `leadingSpace` asks for the\n * historic insignificant space before the tag — see {@link LEADING_SPACE}; which entries carry it\n * is a fact about the bytes already shipped, not a style choice.\n */\nexport interface ContentTypeOverride {\n\treadonly partName: string\n\treadonly contentType: string\n\treadonly leadingSpace?: boolean\n}\n\n/**\n * The entries a deck needs beyond the skeleton every package has, grouped by the point in the\n * emission order they belong to. `perSlide` and `perLayout` are index-aligned with the deck's\n * slides and layouts; an entry is emitted immediately after that slide's or layout's own Override.\n */\nexport interface ContentTypeContributions {\n\t/** Default entries, merged after the deck's own media extensions. */\n\treadonly defaults: readonly ContentTypeDefault[]\n\t/** Overrides sitting between the presentation part and the slide master. */\n\treadonly presentation: readonly ContentTypeOverride[]\n\treadonly perSlide: ReadonlyArray<readonly ContentTypeOverride[]>\n\treadonly perLayout: ReadonlyArray<readonly ContentTypeOverride[]>\n\t/** Overrides after the layout block, before docProps closes the part. */\n\treadonly trailing: readonly ContentTypeOverride[]\n}\n\n/** Nothing beyond the skeleton — the shape a deck written with no construct families contributes. */\nexport const NO_CONTENT_TYPE_CONTRIBUTIONS: ContentTypeContributions = Object.freeze({\n\tdefaults: [],\n\tpresentation: [],\n\tperSlide: [],\n\tperLayout: [],\n\ttrailing: [],\n})\n\nfunction contentDefault(extension: string, contentType: string): string {\n\treturn voidEl('Default', { Extension: extension, ContentType: contentType })\n}\n\nfunction override(partName: string, contentType: string, fmt?: { openPrefix: string }): string {\n\treturn voidEl('Override', { PartName: partName, ContentType: contentType }, fmt)\n}\n\n/** Render a contributed Override, honouring its leading-space flag. */\nfunction contributedOverride(entry: ContentTypeOverride): string {\n\treturn override(entry.partName, entry.contentType, entry.leadingSpace ? LEADING_SPACE : undefined)\n}\n\n/**\n * Generate XML ContentType\n * @param opts - the deck's parts, plus whatever the construct families it was written with add\n * @returns XML\n */\nexport function makeXmlContTypes(opts: {\n\tslides: PresSlideInternal[]\n\tslideLayouts: SlideLayoutInternal[]\n\tmasterSlide?: SlideMasterInternal\n\thasCustomProps?: boolean\n\tembeddedFonts?: EmbeddedFont[]\n\tcontributions?: ContentTypeContributions\n}): string {\n\tconst { slides, slideLayouts, masterSlide, hasCustomProps, embeddedFonts } = opts\n\tconst contributions = opts.contributions ?? NO_CONTENT_TYPE_CONTRIBUTIONS\n\tconst parts: string[] = [contentDefault('xml', 'application/xml'), contentDefault('rels', RELATIONSHIPS_CONTENT_TYPE)]\n\n\t// STEP 1 - Emit Default Extension entries only for media types actually used by the deck.\n\t// Walk slides + slideLayouts + masterSlide _relsMedia[] and dedupe by extension.\n\t// Skip 'online' rels (no part written) and rels missing extn/type.\n\tconst extnTypeMap = new Map<string, string>()\n\tconst ctTargets: Array<{ _relsMedia?: SlideRelMedia[] }> = []\n\t;(slides || []).forEach((s) => ctTargets.push(s))\n\t;(slideLayouts || []).forEach((l) => ctTargets.push(l))\n\tif (masterSlide) ctTargets.push(masterSlide)\n\tctTargets.forEach((target) => {\n\t\t;(target._relsMedia || []).forEach((rel) => {\n\t\t\tif (rel.type === 'online' || !rel.extn || !rel.type) return\n\t\t\t// A/V rel `type` is `${mtype}/${extn}` (e.g. `audio/mp3`); resolve the part's\n\t\t\t// Default content type to what PowerPoint authors (`audio/mpeg`). Image rels\n\t\t\t// already carry their final content type (imageContentType).\n\t\t\tconst contentType = rel.type.startsWith('audio/')\n\t\t\t\t? avContentType(rel.extn, 'audio')\n\t\t\t\t: rel.type.startsWith('video/')\n\t\t\t\t\t? avContentType(rel.extn, 'video')\n\t\t\t\t\t: rel.type\n\t\t\tif (!extnTypeMap.has(rel.extn)) extnTypeMap.set(rel.extn, contentType)\n\t\t})\n\t})\n\textnTypeMap.forEach((type, extn) => {\n\t\tparts.push(contentDefault(extn, type))\n\t})\n\t// Contributed Defaults land after the deck's own media extensions, and only if nothing has\n\t// claimed the extension: one Extension may appear once, and an OLE payload can beat a chart's\n\t// embedded workbook to `xlsx`.\n\tcontributions.defaults.forEach((entry) => {\n\t\tif (extnTypeMap.has(entry.extension)) return\n\t\textnTypeMap.set(entry.extension, entry.contentType)\n\t\tparts.push(contentDefault(entry.extension, entry.contentType))\n\t})\n\t// Embedded fonts: one Default covers every `.fntdata` part (emitted only when fonts are embedded).\n\tif ((embeddedFonts || []).some((font) => font.faces.some((face) => face.bytes))) {\n\t\tparts.push(contentDefault(FONT_DATA_EXTENSION, FONT_DATA_CONTENT_TYPE))\n\t}\n\n\t// STEP 2: Add presentation and slide master(s)/slide(s)\n\tparts.push(override(overrideName(PRESENTATION_PATH), PRESENTATION_MAIN_CONTENT_TYPE))\n\tcontributions.presentation.forEach((entry) => parts.push(contributedOverride(entry)))\n\t// Only one slideMaster part (`slideMaster1.xml`) is written; emit a single matching Override\n\t// rather than one per slide (which would dangle, since `slideMaster2..N.xml` do not exist).\n\tparts.push(override(overrideName(SLIDE_MASTER_PATH), SLIDE_MASTER_CONTENT_TYPE))\n\tslides.forEach((_slide, idx) => {\n\t\tparts.push(override(overrideName(slidePath(idx + 1)), SLIDE_CONTENT_TYPE))\n\t\t;(contributions.perSlide[idx] || []).forEach((entry) => parts.push(contributedOverride(entry)))\n\t})\n\n\t// STEP 3: Core PPT\n\tparts.push(override('/ppt/presProps.xml', PRES_PROPS_CONTENT_TYPE))\n\tparts.push(override('/ppt/viewProps.xml', VIEW_PROPS_CONTENT_TYPE))\n\tparts.push(override('/ppt/theme/theme1.xml', THEME_CONTENT_TYPE))\n\t// notesMaster1.xml.rels references ../theme/theme2.xml; emit a matching Override so the part resolves\n\tparts.push(override('/ppt/theme/theme2.xml', THEME_CONTENT_TYPE))\n\tparts.push(override('/ppt/tableStyles.xml', TABLE_STYLES_CONTENT_TYPE))\n\n\t// STEP 4: Add Slide Layouts\n\tslideLayouts.forEach((_layout, idx) => {\n\t\tparts.push(override(overrideName(slideLayoutPath(idx + 1)), SLIDE_LAYOUT_CONTENT_TYPE))\n\t\t;(contributions.perLayout[idx] || []).forEach((entry) => parts.push(contributedOverride(entry)))\n\t})\n\n\t// STEP 5: Everything the deck's construct families put in the package past this point.\n\tcontributions.trailing.forEach((entry) => parts.push(contributedOverride(entry)))\n\n\t// LAST: Finish XML (Resume core)\n\tparts.push(override('/docProps/core.xml', CORE_PROPS_CONTENT_TYPE, LEADING_SPACE))\n\tparts.push(override('/docProps/app.xml', EXTENDED_PROPS_CONTENT_TYPE, LEADING_SPACE))\n\tif (hasCustomProps) parts.push(override('/docProps/custom.xml', CUSTOM_PROPS_CONTENT_TYPE, LEADING_SPACE))\n\n\treturn XML_DECL + CRLF + el('Types', { xmlns: OOXML_NS.ct }, parts.map(raw))\n}\n","/**\n * ts-pptx: `docProps/custom.xml`\n *\n * Emit the custom-properties part from caller-supplied name/value pairs (bool,\n * date, number and string value types).\n */\n\nimport { CRLF, XML_DECL } from '../../constants-internal.js'\nimport type { CustomPropertyValue } from '../../types/index.js'\nimport { el, raw } from '../oxml/el.js'\nimport { OOXML_NS } from '../../ooxml/namespaces.js'\n\nconst CUSTOM_PROPS_FMTID = '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}'\n\nconst PROPS_NS = {\n\txmlns: 'http://schemas.openxmlformats.org/officeDocument/2006/custom-properties',\n\t'xmlns:vt': OOXML_NS.vt,\n}\n\n/** Serialize one custom-property value to its typed `vt:` element. */\nfunction valueEl(value: CustomPropertyValue): string {\n\tif (typeof value === 'boolean') return el('vt:bool', null, String(value))\n\tif (value instanceof Date) return el('vt:filetime', null, value.toISOString().replace(/\\.\\d{3}Z$/, 'Z'))\n\tif (typeof value === 'number') return el(Number.isInteger(value) ? 'vt:i4' : 'vt:r8', null, value)\n\treturn el('vt:lpwstr', null, String(value))\n}\n\n/**\n * Creates `docProps/custom.xml`\n * @param props - custom property name/value pairs\n * @returns XML\n */\nexport function makeXmlCustomProperties(props: Array<{ name: string; value: CustomPropertyValue }>): string {\n\t// pid is 1-based with 1 reserved by the spec, so caller properties start at 2.\n\tconst properties = props.map(({ name, value }, idx) =>\n\t\traw(el('property', { fmtid: CUSTOM_PROPS_FMTID, pid: idx + 2, name }, raw(valueEl(value))))\n\t)\n\treturn XML_DECL + CRLF + el('Properties', PROPS_NS, properties)\n}\n","/**\n * ts-pptx: `_rels/.rels`\n *\n * Emit the package root relationships (app/core/presentation, plus custom-props\n * when present).\n */\n\nimport { relationshipEl, relationshipsPart } from './rels.js'\nimport { CORE_PROPS_REL, CUSTOM_PROPS_REL, EXTENDED_PROPS_REL, OFFICE_DOCUMENT_REL } from '../../ooxml/rel-types.js'\n\n/** Each entry carries its own indent; the `<Relationships>` wrapper adds none of its own. */\nconst INDENTED = { fmt: { openPrefix: '\\n\\t\\t' } }\n\n/**\n * Creates `_rels/.rels`\n * @returns XML\n */\nexport function makeXmlRootRels(hasCustomProps?: boolean): string {\n\tconst rels = [\n\t\trelationshipEl('rId1', EXTENDED_PROPS_REL, 'docProps/app.xml', INDENTED),\n\t\trelationshipEl('rId2', CORE_PROPS_REL, 'docProps/core.xml', INDENTED),\n\t\trelationshipEl('rId3', OFFICE_DOCUMENT_REL, 'ppt/presentation.xml', INDENTED),\n\t]\n\tif (hasCustomProps) {\n\t\trels.push(relationshipEl('rId4', CUSTOM_PROPS_REL, 'docProps/custom.xml', INDENTED))\n\t}\n\t// The closing tag is indented to child depth, not parent depth. That is\n\t// how this part has always been emitted; kept verbatim for byte-identity.\n\treturn relationshipsPart(rels, { closePrefix: '\\n\\t\\t' })\n}\n","/**\n * ts-pptx: `ppt/_rels/presentation.xml.rels`\n *\n * Emit the presentation relationships (slideMaster, slides, notesMaster/\n * presProps/viewProps/theme/tableStyles, optional commentAuthors, embedded-font\n * faces). `presentationFontRelStart` is shared with the presentation-part writer\n * so the embeddedFontLst face `r:id`s match the rels that back them.\n */\n\nimport type { PresSlideInternal } from '../../types/internal.js'\nimport { type EmbeddedFont, FONT_REL_TYPE, flattenEmbeddedFaces } from '../../embedded-fonts.js'\nimport { relationshipEl, relationshipsPart } from '../opc/rels.js'\nimport { fontPath, NOTES_MASTER_PATH, slidePath, SLIDE_MASTER_PATH, targetFromPresentation } from '../opc/part-paths.js'\nimport {\n\tCOMMENT_AUTHORS_REL,\n\tNOTES_MASTER_REL,\n\tPRES_PROPS_REL,\n\tSLIDE_MASTER_REL,\n\tSLIDE_REL,\n\tTABLE_STYLES_REL,\n\tTHEME_REL,\n\tVIEW_PROPS_REL,\n} from '../../ooxml/rel-types.js'\n\n/**\n * Creates `ppt/_rels/presentation.xml.rels`\n * @param {PresSlideInternal[]} slides - Presenation Slides\n * @returns XML\n */\n/**\n * The relationship ids `presentation.xml.rels` gives its fixed parts, and the first id free\n * after them.\n *\n * Layout: rId1 = slideMaster, rId2..(N+1) = N slides, then notesMaster/presProps/viewProps/\n * theme1/tableStyles, then commentAuthors when the deck has any comment, then the embedded\n * fonts.\n *\n * The rels writer and `makeXmlPresentation` both need these numbers — the presentation part\n * names the notesMaster and each embedded face by `r:id` — and each derived them separately,\n * one as `slides.length + 2` under a comment saying it copied the other's logic. Inserting a\n * relationship before `notesMaster` then broke the presentation's own reference with no\n * signal.\n * @param slides - the deck's slides, whose count and comments decide the layout\n */\nexport function presentationFixedRelIds(slides: PresSlideInternal[]): {\n\tnotesMaster: number\n\tpresProps: number\n\tviewProps: number\n\ttheme: number\n\ttableStyles: number\n\tcommentAuthors: number | null\n\tfontStart: number\n} {\n\tconst first = (slides?.length ?? 0) + 2\n\tconst hasComments = (slides || []).some((slide) => (slide._comments || []).length > 0)\n\treturn {\n\t\tnotesMaster: first,\n\t\tpresProps: first + 1,\n\t\tviewProps: first + 2,\n\t\ttheme: first + 3,\n\t\ttableStyles: first + 4,\n\t\tcommentAuthors: hasComments ? first + 5 : null,\n\t\tfontStart: first + (hasComments ? 6 : 5),\n\t}\n}\n\n/**\n * The first relationship id free for embedded-font rels — {@link presentationFixedRelIds}'\n * `fontStart`, kept as its own name because that is what the two font walks ask for.\n */\nexport function presentationFontRelStart(slides: PresSlideInternal[]): number {\n\treturn presentationFixedRelIds(slides).fontStart\n}\n\nexport function makeXmlPresentationRels(slides: PresSlideInternal[], embeddedFonts?: EmbeddedFont[]): string {\n\tconst fixed = presentationFixedRelIds(slides)\n\tconst rels: string[] = [relationshipEl(1, SLIDE_MASTER_REL, targetFromPresentation(SLIDE_MASTER_PATH))]\n\tfor (let idx = 1; idx <= slides.length; idx++) {\n\t\trels.push(relationshipEl(idx + 1, SLIDE_REL, targetFromPresentation(slidePath(idx))))\n\t}\n\trels.push(\n\t\trelationshipEl(fixed.notesMaster, NOTES_MASTER_REL, targetFromPresentation(NOTES_MASTER_PATH)),\n\t\trelationshipEl(fixed.presProps, PRES_PROPS_REL, 'presProps.xml'),\n\t\trelationshipEl(fixed.viewProps, VIEW_PROPS_REL, 'viewProps.xml'),\n\t\trelationshipEl(fixed.theme, THEME_REL, 'theme/theme1.xml'),\n\t\trelationshipEl(fixed.tableStyles, TABLE_STYLES_REL, 'tableStyles.xml')\n\t)\n\t// The presentation-level commentAuthors part is shared by every slide's comments, so it is\n\t// related once from the presentation (only when the deck has at least one comment).\n\tif (fixed.commentAuthors !== null) {\n\t\trels.push(relationshipEl(fixed.commentAuthors, COMMENT_AUTHORS_REL, 'commentAuthors.xml'))\n\t}\n\t// Embedded fonts: one `font` rel per face, ids continuing past the fixed rels above.\n\tfor (const face of flattenEmbeddedFaces(embeddedFonts || [], presentationFontRelStart(slides))) {\n\t\trels.push(relationshipEl(face.rId, FONT_REL_TYPE, targetFromPresentation(fontPath(face.partIndex))))\n\t}\n\n\treturn relationshipsPart(rels)\n}\n","/**\n * ts-pptx: `ppt/presentation.xml` + presProps/viewProps\n *\n * Emit the presentation part (masters/notes/slide id lists, sizes, embedded-font\n * list, default text styles, sections) and the small presProps/viewProps parts.\n */\n\nimport { CRLF, LEVEL_MARGINS_EMU, XML_DECL } from '../../constants-internal.js'\nimport type { PresentationPropsInternal, SectionInternalProps } from '../../types/internal.js'\nimport { flattenEmbeddedFaces, serializeEmbeddedFontLst } from '../../embedded-fonts.js'\nimport { presentationFixedRelIds, presentationFontRelStart } from './presentation-rels.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { lvlPPr, themeFontDefRPr } from '../drawingml/list-style.js'\nimport { OOXML_NS, PML_ROOT_NS } from '../../ooxml/namespaces.js'\nimport { MIN_SLIDE_MASTER_ID } from '../../ooxml/ids.js'\nimport { slideSizeType } from '../../ooxml/slide-size.js'\n\nfunction defaultTextStyleLevel(idy: number, marL: number): string {\n\treturn lvlPPr(idy, { marL, algn: 'l' }, [raw(themeFontDefRPr('mn', { sz: 1800, kern: 1200 }))])\n}\n\nfunction sectionsExtLst(sections: SectionInternalProps[]): string {\n\treturn el('p:extLst', null, [\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:ext',\n\t\t\t\t{ uri: '{521415D9-36F7-43E2-AB2F-B90AF26B5E84}' },\n\t\t\t\traw(\n\t\t\t\t\tel(\n\t\t\t\t\t\t'p14:sectionLst',\n\t\t\t\t\t\t{ 'xmlns:p14': OOXML_NS.p14 },\n\t\t\t\t\t\tsections.map((sect) =>\n\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t\t\t'p14:section',\n\t\t\t\t\t\t\t\t\t{ name: sect.title, id: sect._id },\n\t\t\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t\t\t\t\t'p14:sldIdLst',\n\t\t\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\t\t\tsect._slides.map((slide) => raw(voidEl('p14:sldId', { id: slide._slideId })))\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t),\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:ext',\n\t\t\t\t{ uri: '{EFAFB233-063F-42B5-8137-9DF3F51BA10A}' },\n\t\t\t\traw(voidEl('p15:sldGuideLst', { 'xmlns:p15': OOXML_NS.p15 }))\n\t\t\t)\n\t\t),\n\t])\n}\n\n/**\n * Create presentation file (`ppt/presentation.xml`)\n * @see https://docs.microsoft.com/en-us/office/open-xml/structure-of-a-presentationml-document\n * @see http://www.datypic.com/sc/ooxml/t-p_CT_Presentation.html\n * @param {PresentationPropsInternal} pres - presentation\n * @return {string} XML\n */\nexport function makeXmlPresentation(pres: PresentationPropsInternal): string {\n\t// NOTE: the double space before saveSubsetFonts/embedTrueTypeFonts when\n\t// rtlMode is unset is a pre-existing template artifact (verified against\n\t// the byte-identity baseline) — the literal space around `${rtl}` survives\n\t// even when the interpolation is empty. el()'s attrs always normalize to\n\t// single-space separators, so this opening tag stays a raw template rather\n\t// than being forced through the builder.\n\tconst openTag =\n\t\t`<p:presentation xmlns:a=\"${OOXML_NS.a}\" xmlns:r=\"${OOXML_NS.r}\" ` +\n\t\t// When fonts are embedded we carry WHOLE faces, so `embedTrueTypeFonts=\"1\"` (so\n\t\t// PowerPoint honors the embed) and `saveSubsetFonts=\"0\"` (we did not subset).\n\t\t// With no embedded fonts, keep the historical inert `saveSubsetFonts=\"1\"`.\n\t\t`xmlns:p=\"${OOXML_NS.p}\" ${pres.rtlMode ? 'rtl=\"1\"' : ''} ${(pres.embeddedFonts || []).some((font) => font.faces.some((face) => face.bytes)) ? 'embedTrueTypeFonts=\"1\" saveSubsetFonts=\"0\"' : 'saveSubsetFonts=\"1\"'} autoCompressPictures=\"0\"${pres.firstSlideNum !== 1 ? ` firstSlideNum=\"${pres.firstSlideNum}\"` : ''}>`\n\n\t// SPEC (ECMA-376 Part 1 §19.2.1.26): sldMasterIdLst, then notesMasterIdLst\n\t// BEFORE sldIdLst — emitting notesMasterIdLst after sldIdLst (or after\n\t// sldSz/notesSz) violates the schema and is flagged by OpenXmlValidator as\n\t// Sch_UnexpectedElementContentExpectingComplex.\n\tconst sldMasterIdLst = el(\n\t\t'p:sldMasterIdLst',\n\t\tnull,\n\t\traw(voidEl('p:sldMasterId', { id: MIN_SLIDE_MASTER_ID, 'r:id': 'rId1' }))\n\t)\n\n\t// NOTE: length+2 is from `presentation.xml.rels` func (since we have to match this rId, we just use same logic)\n\tconst notesMasterIdLst = el(\n\t\t'p:notesMasterIdLst',\n\t\tnull,\n\t\traw(voidEl('p:notesMasterId', { 'r:id': `rId${presentationFixedRelIds(pres.slides).notesMaster}` }))\n\t)\n\n\tconst sldIdLst = el(\n\t\t'p:sldIdLst',\n\t\tnull,\n\t\tpres.slides.map((slide) => raw(voidEl('p:sldId', { id: slide._slideId, 'r:id': `rId${slide._rId}` })))\n\t)\n\n\tconst { width, height } = pres.presLayout\n\tconst sldSz = voidEl('p:sldSz', { cx: width, cy: height, type: slideSizeType(width, height) })\n\tconst notesSz = voidEl('p:notesSz', { cx: pres.presLayout.height, cy: pres.presLayout.width })\n\n\t// Embedded fonts (CT_Presentation index 7 — after notesSz, before defaultTextStyle).\n\t// rIds continue past the fixed presentation rels and must match makeXmlPresentationRels.\n\tconst fonts = pres.embeddedFonts || []\n\tconst flat = flattenEmbeddedFaces(fonts, presentationFontRelStart(pres.slides))\n\tconst rIdOf = new Map(flat.map((face) => [`${face.fontIndex}:${face.slot}`, face.rId]))\n\tconst embeddedFontLst = serializeEmbeddedFontLst(fonts, (fontIndex, slot) => rIdOf.get(`${fontIndex}:${slot}`))\n\n\tconst defaultTextStyle = el(\n\t\t'p:defaultTextStyle',\n\t\tnull,\n\t\tLEVEL_MARGINS_EMU.map((marL, i) => raw(defaultTextStyleLevel(i + 1, marL)))\n\t)\n\n\tconst extLst = pres.sections && pres.sections.length > 0 ? sectionsExtLst(pres.sections) : ''\n\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\topenTag +\n\t\tsldMasterIdLst +\n\t\tnotesMasterIdLst +\n\t\tsldIdLst +\n\t\tsldSz +\n\t\tnotesSz +\n\t\tembeddedFontLst +\n\t\tdefaultTextStyle +\n\t\textLst +\n\t\t'</p:presentation>'\n\t)\n}\n\n/**\n * Create `ppt/presProps.xml`\n * @return {string} XML\n */\nexport function makeXmlPresProps(): string {\n\treturn XML_DECL + CRLF + voidEl('p:presentationPr', { ...PML_ROOT_NS })\n}\n\n/**\n * Creates `ppt/viewProps.xml`\n * @return {string} XML\n */\nexport function makeXmlViewProps(): string {\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tel('p:viewPr', { ...PML_ROOT_NS }, [\n\t\t\traw(\n\t\t\t\tel('p:normalViewPr', { horzBarState: 'maximized' }, [\n\t\t\t\t\traw(voidEl('p:restoredLeft', { sz: 15611 })),\n\t\t\t\t\traw(voidEl('p:restoredTop', { sz: 94610 })),\n\t\t\t\t])\n\t\t\t),\n\t\t\traw(\n\t\t\t\tel(\n\t\t\t\t\t'p:slideViewPr',\n\t\t\t\t\tnull,\n\t\t\t\t\traw(\n\t\t\t\t\t\tel('p:cSldViewPr', { snapToGrid: 0, snapToObjects: 1 }, [\n\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\tel('p:cViewPr', { varScale: 1 }, [\n\t\t\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\t\t\tel('p:scale', null, [\n\t\t\t\t\t\t\t\t\t\t\traw(voidEl('a:sx', { n: 136, d: 100 })),\n\t\t\t\t\t\t\t\t\t\t\traw(voidEl('a:sy', { n: 136, d: 100 })),\n\t\t\t\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\traw(voidEl('p:origin', { x: 216, y: 312 })),\n\t\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\traw(voidEl('p:guideLst')),\n\t\t\t\t\t\t])\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t),\n\t\t\traw(\n\t\t\t\tel(\n\t\t\t\t\t'p:notesTextViewPr',\n\t\t\t\t\tnull,\n\t\t\t\t\traw(\n\t\t\t\t\t\tel('p:cViewPr', null, [\n\t\t\t\t\t\t\traw(el('p:scale', null, [raw(voidEl('a:sx', { n: 1, d: 1 })), raw(voidEl('a:sy', { n: 1, d: 1 }))])),\n\t\t\t\t\t\t\traw(voidEl('p:origin', { x: 0, y: 0 })),\n\t\t\t\t\t\t])\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t),\n\t\t\traw(voidEl('p:gridSpacing', { cx: 76200, cy: 76200 })),\n\t\t])\n\t)\n}\n","/**\n * ts-pptx: `ppt/tableStyles.xml`\n *\n * Emit the table-styles part. The part carries only the default style id: it defines no\n * styles of its own, because PowerPoint never reads one out of it.\n *\n * `<a:tableStyleId>` is resolved against PowerPoint's *own* table-style gallery, not against\n * this part. Verified by render (PowerPoint desktop 16.0): a deck pointed at a built-in GUID\n * this part does not define paints correctly, while a PowerPoint-authored deck whose style\n * GUID is rewritten to a novel value — in both this part and the slide, bytes otherwise\n * identical — loses its styling entirely and falls back to the black hairline grid. The same\n * holds for a definition placed inline in the slide's `<a:tblPr>` as `<a:tableStyle>`, and for\n * one nominated by this part's `def=`. So a custom `<a:tblStyle>` is unreachable markup in the\n * supported target, whatever it says and wherever it sits. Brand styling belongs in direct\n * cell formatting (`headerRow`, `columns[i]`, per-cell options); see `docs/tables.md`.\n *\n * The part itself still ships: PowerPoint expects the relationship and content-type override\n * to be present, and the read side (`src/read/api/ops/table-styles.ts`) merges real definitions out of\n * *imported* decks into it, which is a different thing from authoring one here.\n */\n\nimport { TableStyle } from '../../enums.js'\nimport { CRLF, XML_DECL } from '../../constants-internal.js'\nimport { voidEl } from '../oxml/el.js'\nimport { OOXML_NS } from '../../ooxml/namespaces.js'\n\n/**\n * Create `ppt/tableStyles.xml`\n * @see: http://openxmldeveloper.org/discussions/formats/f/13/p/2398/8107.aspx\n * @return {string} XML\n */\nexport function makeXmlTableStyles(): string {\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tvoidEl('a:tblStyleLst', {\n\t\t\t'xmlns:a': OOXML_NS.a,\n\t\t\tdef: TableStyle.MEDIUM_STYLE_2_ACCENT_1,\n\t\t})\n\t)\n}\n","/**\n * ts-pptx: slide-layout part\n *\n * Emit a slide layout (`ppt/slideLayouts/slideLayoutN.xml`) from a layout object.\n */\n\nimport { XML_DECL } from '../../constants-internal.js'\nimport type { SlideLayoutInternal } from '../../types/internal.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { PML_ROOT_NS } from '../../ooxml/namespaces.js'\nimport { slideObjectToXml } from './object.js'\nimport type { RendererTable } from './objects/shared.js'\n\n/**\n * Generates the XML layout resource from a layout object\n * @param layout - slide layout (master)\n * @param renderers - which renderer emits each shape family, passed through to the shape walk\n * @return XML\n */\nexport function makeXmlLayout(layout: SlideLayoutInternal, renderers: RendererTable): string {\n\treturn (\n\t\tXML_DECL +\n\t\tel(\n\t\t\t'p:sldLayout',\n\t\t\t{ ...PML_ROOT_NS, preserve: '1' },\n\t\t\t[raw(slideObjectToXml(layout, renderers)), raw(el('p:clrMapOvr', null, raw(voidEl('a:masterClrMapping'))))],\n\t\t\t// The root and both children sit on their own two-tab line; the closing tag does not.\n\t\t\t{ openPrefix: '\\n\\t\\t', childPrefix: '\\n\\t\\t' }\n\t\t)\n\t)\n}\n","/**\n * ts-pptx: slide-master parts\n *\n * The slide master (`slideMaster1.xml`) and its `.rels`, plus the master text\n * styles (`<p:txStyles>`): per-level default values mirroring the built-in\n * Office master, with any `MasterTextStyleProps` overrides layered on top.\n */\n\nimport { CRLF, LAYOUT_IDX_SERIES_BASE, LEVEL_MARGINS_EMU, XML_DECL } from '../../constants-internal.js'\nimport type { MasterBulletProps, MasterTextStyleLevel, MasterTextStyleProps } from '../../types/index.js'\nimport type { SlideLayoutInternal, SlideMasterInternal } from '../../types/internal.js'\nimport { createColorElement, rejectEmptyColor } from '../drawingml/color.js'\nimport { lvlPPr, themeFontDefRPr } from '../drawingml/list-style.js'\nimport { buAutoNumEl, buCharEl } from '../drawingml/bullet.js'\nimport { clampFontSizeSz, clampParaIndentInchesEmu, clampParaMarginInchesEmu } from '../drawingml/clamp.js'\nimport { EMU_PER_INCH, HUNDREDTHS_PER_POINT } from '../../units.js'\nimport { warn } from '../../diagnostics.js'\nimport { el, raw, voidEl, type XmlAttrs } from '../oxml/el.js'\nimport { defaultRelIdStart, slideObjectRelationsToXml, slideObjectToXml } from './object.js'\nimport type { RendererTable } from './objects/shared.js'\nimport { PML_ROOT_NS } from '../../ooxml/namespaces.js'\nimport { SLIDE_LAYOUT_REL, THEME_REL } from '../../ooxml/rel-types.js'\nimport { DEFAULT_COLOR_MAP } from '../../ooxml/st-enums.js'\nimport { textAlignToken } from '../../ooxml/text-align.js'\nimport { xsdBoolIfTrue } from '../../ooxml/xsd-boolean.js'\nimport { SLIDE_MASTER_PATH, slideLayoutPath, targetFromPptSubpart } from '../opc/part-paths.js'\n\n// Default per-level values mirroring the built-in Office master (used as the base that\n// `MasterTextStyleProps` overrides are layered onto). `bu` describes the level's default\n// bullet: 'none' -> <a:buNone/>, undefined -> no bullet element (otherStyle), or a glyph.\ninterface MasterLevelDefault {\n\tmarL: number // EMU\n\tindent?: number // EMU (omitted when undefined)\n\talgn: string // OOXML algn value\n\tspcBefPct?: number // <a:spcBef> percent (×1000); omitted when undefined\n\tbu?: 'none' | { char: string; font: string } // default bullet; undefined => emit no bullet element\n\tsz: number // <a:defRPr@sz>\n\tfont: 'mj' | 'mn' // major (heading) vs minor (body) theme font family\n}\nconst MASTER_TITLE_DEFAULT: MasterLevelDefault = {\n\tmarL: 0,\n\talgn: 'ctr',\n\tspcBefPct: 0,\n\tbu: 'none',\n\tsz: 4400,\n\tfont: 'mj',\n}\nconst MASTER_BODY_DEFAULTS: MasterLevelDefault[] = [\n\t{\n\t\tmarL: 342900,\n\t\tindent: -342900,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '•', font: 'Arial' },\n\t\tsz: 3200,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 742950,\n\t\tindent: -285750,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '–', font: 'Arial' },\n\t\tsz: 2800,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 1143000,\n\t\tindent: -228600,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '•', font: 'Arial' },\n\t\tsz: 2400,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 1600200,\n\t\tindent: -228600,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '–', font: 'Arial' },\n\t\tsz: 2000,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 2057400,\n\t\tindent: -228600,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '»', font: 'Arial' },\n\t\tsz: 2000,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 2514600,\n\t\tindent: -228600,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '•', font: 'Arial' },\n\t\tsz: 2000,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 2971800,\n\t\tindent: -228600,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '•', font: 'Arial' },\n\t\tsz: 2000,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 3429000,\n\t\tindent: -228600,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '•', font: 'Arial' },\n\t\tsz: 2000,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 3886200,\n\t\tindent: -228600,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '•', font: 'Arial' },\n\t\tsz: 2000,\n\t\tfont: 'mn',\n\t},\n]\nconst MASTER_OTHER_DEFAULTS: MasterLevelDefault[] = LEVEL_MARGINS_EMU.map((marL) => ({\n\tmarL,\n\talgn: 'l',\n\tsz: 1800,\n\tfont: 'mn' as const,\n}))\n\nfunction masterAlignAttr(align: MasterTextStyleLevel['align']): string {\n\t// No `align` on the level: `''` omits `@algn` entirely so the level inherits from the theme,\n\t// which is NOT the same as pinning it to `l`. A value the write API does not name does the same.\n\treturn align === undefined ? '' : (textAlignToken(align) ?? '')\n}\n\n/** Build the bullet element for a master level: caller override wins over the level default. */\nfunction masterBulletXml(\n\tbulletOverride: boolean | MasterBulletProps | undefined,\n\tbase: MasterLevelDefault['bu']\n): string {\n\t// Explicit override\n\tif (bulletOverride === false) return voidEl('a:buNone')\n\tif (bulletOverride && typeof bulletOverride === 'object') {\n\t\tconst font = bulletOverride.fontFace ? voidEl('a:buFont', { typeface: bulletOverride.fontFace }) : ''\n\t\tif (bulletOverride.type === 'number') {\n\t\t\tconst startAt = typeof bulletOverride.numberStartAt === 'number' ? bulletOverride.numberStartAt : undefined\n\t\t\treturn font + buAutoNumEl(bulletOverride.numberType || 'arabicPeriod', startAt, 'master textStyles bullet')\n\t\t}\n\t\t// character bullet (default)\n\t\tconst buFont = bulletOverride.fontFace\n\t\t\t? font\n\t\t\t: voidEl('a:buFont', { typeface: 'Arial', pitchFamily: 34, charset: 0 })\n\t\treturn buFont + buCharEl(bulletOverride.characterCode, '•', 'master textStyles bullet')\n\t}\n\t// No override (undefined / true): keep the level's default bullet\n\tif (base === 'none') return voidEl('a:buNone')\n\tif (base && typeof base === 'object')\n\t\treturn (\n\t\t\tvoidEl('a:buFont', { typeface: base.font, pitchFamily: 34, charset: 0 }) +\n\t\t\tbuCharEl(undefined, base.char, 'master textStyles bullet')\n\t\t)\n\treturn '' // otherStyle: no bullet element by default\n}\n\n/**\n * One length-valued override on a master text-style level, in EMU, or the level's default when the\n * caller stated something we cannot use.\n *\n * `marginLeft` and `indent` used to reach their clamps only when they were finite numbers and fall\n * back in silence otherwise, so `NaN`, `Infinity` and a string such as `'0.5in'` all became the\n * Office default with nothing said -- while `fontSize` on the very same level warned for exactly\n * those inputs. Silent coercion of invalid input is a footgun: the deck comes out wrong and the\n * caller has nothing to go on.\n *\n * `undefined` is the caller stating nothing, which is not a problem and is not reported.\n * @param stated - the caller's value, in inches\n * @param option - the option's name, as `MasterTextStyleLevel` spells it\n * @param fallback - the level's default, already in EMU\n * @param resolve - the clamp that converts a usable value to EMU\n */\nfunction masterLevelLength<T extends number | undefined>(\n\tstated: number | undefined,\n\toption: string,\n\tfallback: T,\n\tresolve: (inches: number) => number\n): number | T {\n\tif (stated === undefined) return fallback\n\tif (typeof stated === 'number' && Number.isFinite(stated)) return resolve(stated)\n\t// A level with no default of its own omits the attribute; say so rather than quoting `NaN` in.\n\tconst kept = fallback === undefined ? 'the level default' : `${fallback / EMU_PER_INCH}in`\n\twarn(\n\t\t'master/invalid-text-style-length',\n\t\t`master textStyles ${option} \"${String(stated)}\" is invalid; keeping ${kept}.`\n\t)\n\treturn fallback\n}\n\n/** Serialize one `<a:lvlNpPr>` from its default, layering an optional caller override. */\nfunction masterLevelXml(levelNum: number, base: MasterLevelDefault, levelOverride: MasterTextStyleLevel = {}): string {\n\tconst marL = masterLevelLength(levelOverride.marginLeft, 'marginLeft', base.marL, (inches) =>\n\t\tclampParaMarginInchesEmu(inches, 'master textStyles marginLeft')\n\t)\n\tconst indentEmu = masterLevelLength(levelOverride.indent, 'indent', base.indent, (inches) =>\n\t\tclampParaIndentInchesEmu(inches, 'master textStyles indent')\n\t)\n\tconst algn = (levelOverride.align && masterAlignAttr(levelOverride.align)) || base.algn\n\n\tlet sz = base.sz\n\t// `!== undefined` rather than `typeof === 'number'`: a string such as `'18pt'` is as much a\n\t// stated value we cannot use as `NaN` is, and it used to fall through to the default unreported.\n\tif (levelOverride.fontSize !== undefined) {\n\t\tif (\n\t\t\ttypeof levelOverride.fontSize !== 'number' ||\n\t\t\t!Number.isFinite(levelOverride.fontSize) ||\n\t\t\tlevelOverride.fontSize <= 0\n\t\t)\n\t\t\twarn(\n\t\t\t\t'master/invalid-text-style-font-size',\n\t\t\t\t`master textStyles fontSize \"${String(levelOverride.fontSize)}\" is invalid; keeping default ${base.sz / HUNDREDTHS_PER_POINT}pt.`\n\t\t\t)\n\t\telse sz = clampFontSizeSz(levelOverride.fontSize, 'master textStyles fontSize')\n\t}\n\t// `''` takes the same `tx1` an omitted colour takes; it is reported rather than silently\n\t// resolved, because it is the caller's missing value and not a way to ask for the default.\n\trejectEmptyColor(levelOverride.color, 'textStyles color')\n\tconst colorXml = levelOverride.color ? createColorElement(levelOverride.color) : voidEl('a:schemeClr', { val: 'tx1' })\n\tconst latinXml = levelOverride.fontFace\n\t\t? voidEl('a:latin', { typeface: levelOverride.fontFace })\n\t\t: voidEl('a:latin', { typeface: `+${base.font}-lt` })\n\n\treturn lvlPPr(levelNum, { marL, indent: indentEmu, algn }, [\n\t\ttypeof base.spcBefPct === 'number'\n\t\t\t? raw(el('a:spcBef', null, raw(voidEl('a:spcPct', { val: base.spcBefPct }))))\n\t\t\t: null,\n\t\traw(masterBulletXml(levelOverride.bullet, base.bu)),\n\t\traw(\n\t\t\tthemeFontDefRPr(\n\t\t\t\tbase.font,\n\t\t\t\t{ sz, b: xsdBoolIfTrue(levelOverride.bold), i: xsdBoolIfTrue(levelOverride.italic), kern: 1200 },\n\t\t\t\tcolorXml,\n\t\t\t\tlatinXml\n\t\t\t)\n\t\t),\n\t])\n}\n\n/** Clamp a caller-provided per-level override array to the 9 valid list levels, warning on overflow. */\nfunction masterLevelOverrides(levels: MasterTextStyleLevel[] | undefined, group: string): MasterTextStyleLevel[] {\n\tif (!Array.isArray(levels)) return []\n\tif (levels.length > 9)\n\t\twarn(\n\t\t\t'master/too-many-text-style-levels',\n\t\t\t`master textStyles.${group} has ${levels.length} levels; only the first 9 are used.`\n\t\t)\n\treturn levels.slice(0, 9)\n}\n\n/**\n * Build the `<p:txStyles>` block from caller overrides layered onto the Office master defaults.\n * Only invoked when `defineSlideMaster({ textStyles })` was set; the unconfigured deck keeps the\n * verbatim default literal in `makeXmlMaster` for byte-identical output.\n */\nfunction makeXmlMasterTxStyles(textStyles: MasterTextStyleProps): string {\n\tconst title = masterLevelXml(1, MASTER_TITLE_DEFAULT, textStyles.title)\n\tconst bodyOverrides = masterLevelOverrides(textStyles.body, 'body')\n\tconst body = MASTER_BODY_DEFAULTS.map((base, i) => masterLevelXml(i + 1, base, bodyOverrides[i])).join('')\n\tconst otherOverrides = masterLevelOverrides(textStyles.other, 'other')\n\tconst other = MASTER_OTHER_DEFAULTS.map((base, i) => masterLevelXml(i + 1, base, otherOverrides[i])).join('')\n\treturn el('p:txStyles', null, [\n\t\traw(el('p:titleStyle', null, raw(title))),\n\t\traw(el('p:bodyStyle', null, raw(body))),\n\t\traw(el('p:otherStyle', null, [raw(el('a:defPPr', null, raw(voidEl('a:defRPr', { lang: 'en-US' })))), raw(other)])),\n\t])\n}\n\n/**\n * The built-in Office master's `<p:txStyles>`, used verbatim when `defineSlideMaster({ textStyles })`\n * was never called. Deliberately NOT built via `masterLevelXml`: a configured title level always\n * carries `marL=\"0\"` (from `MASTER_TITLE_DEFAULT.marL`), but the true unconfigured default titleStyle\n * has no `marL`/`indent` attribute at all — a pre-existing asymmetry between the two paths, preserved\n * exactly rather than unified.\n */\nfunction makeXmlMasterDefaultTxStyles(): string {\n\tconst defaultLevel = (\n\t\tn: number,\n\t\tattrs: XmlAttrs,\n\t\tbullet: string,\n\t\tsz: number,\n\t\tfont: 'mj' | 'mn',\n\t\tspcBefPct?: number\n\t): string =>\n\t\tlvlPPr(n, attrs, [\n\t\t\ttypeof spcBefPct === 'number' ? raw(el('a:spcBef', null, raw(voidEl('a:spcPct', { val: spcBefPct })))) : null,\n\t\t\traw(bullet),\n\t\t\traw(themeFontDefRPr(font, { sz, kern: 1200 })),\n\t\t])\n\n\tconst title = defaultLevel(1, { algn: 'ctr' }, voidEl('a:buNone'), 4400, 'mj', 0)\n\n\tconst bodyLevels = MASTER_BODY_DEFAULTS.map((base, i) => {\n\t\tconst bu = base.bu as { char: string; font: string }\n\t\treturn defaultLevel(\n\t\t\ti + 1,\n\t\t\t{ marL: base.marL, indent: base.indent, algn: base.algn },\n\t\t\tvoidEl('a:buFont', { typeface: bu.font, pitchFamily: 34, charset: 0 }) + voidEl('a:buChar', { char: bu.char }),\n\t\t\tbase.sz,\n\t\t\t'mn',\n\t\t\tbase.spcBefPct\n\t\t)\n\t})\n\n\tconst otherLevels = MASTER_OTHER_DEFAULTS.map((base, i) =>\n\t\tdefaultLevel(i + 1, { marL: base.marL, algn: base.algn }, '', base.sz, 'mn')\n\t)\n\n\t// NOTE: the source template's own indentation reaches the file here — each style block's\n\t// children are preceded by two spaces and its own closing tag by one (see `fmt` below) —\n\t// same class of quirk as `genXmlPlaceholder` in text-body.ts. Preserved, not reformatted.\n\treturn el(\n\t\t'p:txStyles',\n\t\tnull,\n\t\t[\n\t\t\traw(el('p:titleStyle', null, raw(title), { childPrefix: ' ', closePrefix: ' ' })),\n\t\t\traw(el('p:bodyStyle', null, bodyLevels.map(raw), { childPrefix: ' ', closePrefix: ' ' })),\n\t\t\traw(\n\t\t\t\tel(\n\t\t\t\t\t'p:otherStyle',\n\t\t\t\t\tnull,\n\t\t\t\t\t[raw(el('a:defPPr', null, raw(voidEl('a:defRPr', { lang: 'en-US' })))), ...otherLevels.map(raw)],\n\t\t\t\t\t{ childPrefix: ' ', closePrefix: ' ' }\n\t\t\t\t)\n\t\t\t),\n\t\t],\n\t\t{ childPrefix: ' ' }\n\t)\n}\n\n/**\n * Creates Slide Master 1 (`ppt/slideMasters/slideMaster1.xml`)\n * @param slide - slide object that represents master slide layout\n * @param layouts - slide layouts\n * @param renderers - which renderer emits each shape family, passed through to the shape walk\n * @return XML\n */\nexport function makeXmlMaster(\n\tslide: SlideMasterInternal,\n\tlayouts: SlideLayoutInternal[],\n\trenderers: RendererTable\n): string {\n\t// The layouts are the first of the master's default relationships (`makeXmlMasterRel`), so their\n\t// ids start where that part numbers default relationships from.\n\tconst layoutRidStart = defaultRelIdStart(slide)\n\tconst layoutDefs = layouts\n\t\t.map((_layoutDef, idx) =>\n\t\t\tvoidEl('p:sldLayoutId', { id: LAYOUT_IDX_SERIES_BASE + idx, 'r:id': `rId${layoutRidStart + idx}` })\n\t\t)\n\t\t.join('')\n\n\tconst clrMap = voidEl('p:clrMap', DEFAULT_COLOR_MAP)\n\n\t// CT_HeaderFooter/@sldNum defaults to true (ECMA-376). When a slide-number placeholder is\n\t// defined on the master we must NOT disable it here, otherwise slides that PowerPoint inserts\n\t// from this master inherit sldNum=\"0\" and the master slide number disappears.\n\tconst hf = voidEl('p:hf', { sldNum: slide._slideNumberProps ? null : 0, hdr: 0, ftr: 0, dt: 0 })\n\n\tconst txStyles = slide._txStyles ? makeXmlMasterTxStyles(slide._txStyles) : makeXmlMasterDefaultTxStyles()\n\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tel(\n\t\t\t'p:sldMaster',\n\t\t\t{\n\t\t\t\t...PML_ROOT_NS,\n\t\t\t},\n\t\t\t[\n\t\t\t\traw(slideObjectToXml(slide, renderers)),\n\t\t\t\traw(clrMap),\n\t\t\t\traw(el('p:sldLayoutIdLst', null, raw(layoutDefs))),\n\t\t\t\traw(hf),\n\t\t\t\traw(txStyles),\n\t\t\t]\n\t\t)\n\t)\n}\n\n/**\n * Creates `ppt/slideMasters/_rels/slideMaster1.xml.rels`\n * @param {SlideMasterInternal} masterSlide - the deck's slide master\n * @param {SlideLayoutInternal[]} slideLayouts - Slide Layouts\n * @return {string} XML\n */\nexport function makeXmlMasterRel(masterSlide: SlideMasterInternal, slideLayouts: SlideLayoutInternal[]): string {\n\tconst defaultRels = slideLayouts.map((_layoutDef, idx) => ({\n\t\ttarget: targetFromPptSubpart(slideLayoutPath(idx + 1)),\n\t\ttype: SLIDE_LAYOUT_REL,\n\t}))\n\tdefaultRels.push({\n\t\ttarget: '../theme/theme1.xml',\n\t\ttype: THEME_REL,\n\t})\n\n\treturn slideObjectRelationsToXml(masterSlide, defaultRels, SLIDE_MASTER_PATH)\n}\n","/**\n * ts-pptx: the part-contributor seam\n *\n * What a construct family adds to a written package: the parts it puts in the zip, and the\n * `[Content_Types].xml` entries those parts need in order to resolve. The packager\n * (`package/assemble.ts`) owns the skeleton every deck has — content types, the rels graph,\n * docProps, theme, slides, layouts, the master, media — and calls a list of contributors at fixed\n * points in it, so it never names a family.\n *\n * It has to be a list rather than imports, for the same reason the shape walk is handed its\n * renderers (`gen/slide/objects/shared.ts`): a named import inside a reachable function body is\n * retained unconditionally, so a packager that calls `createExcelWorksheet` itself links all of\n * `gen/chart/` — the plot modules, the axes, the chartEx sidecars — into every program that writes\n * a deck, text-only ones included. Same argument, the other axis: that one is about which XML\n * lands in a slide, this one about which parts land in the zip.\n *\n * Nothing else belongs in this module. A contributor's emitters live with the family they belong\n * to under `gen/`; the contributors themselves are one small module each, in this directory.\n */\n\nimport type { ZipWriter } from '../../zip.js'\nimport type { ContentTypeContributions, ContentTypeDefault, ContentTypeOverride } from '../../gen/opc/content-types.js'\nimport type {\n\tPresentationPropsInternal,\n\tPresSlideInternal,\n\tSlideLayoutInternal,\n\tSlideMasterInternal,\n} from '../../types/internal.js'\n\n/** A slide, a layout, or the master — anything carrying the rel arrays a part can be derived from. */\nexport type PartTarget = PresSlideInternal | SlideLayoutInternal | SlideMasterInternal\n\n/**\n * One construct family's contribution to the package.\n *\n * Every hook is optional and every hook is called at one fixed point in the emission order, which\n * is what keeps zip part order and `[Content_Types].xml` byte-identical no matter which families a\n * program links.\n */\nexport interface PartContributor {\n\t/**\n\t * Rank among contributors that write into the same slot. Fixed here, with the family, rather\n\t * than taken from the order a caller happens to list contributors in: the list is a tier's\n\t * business, and the same deck has to come out byte-identical from every tier that can write it.\n\t * Spaced by ten so a family can be slotted between two others without renumbering.\n\t */\n\treadonly order: number\n\t/** Parts this family writes into the package. */\n\treadonly parts?: ContributedParts\n\t/** Content-type entries this family's parts need to resolve. */\n\treadonly contentTypes?: ContributedContentTypes\n}\n\n/** Where a family's parts go into the zip. Order within each hook is the order they are added. */\nexport interface ContributedParts {\n\t/** Written right after slide `slideNumber`'s own part and its rels, inside the slide loop. */\n\treadonly withEachSlide?: (slide: PresSlideInternal, slideNumber: number, zip: ZipWriter) => void\n\t/** Written once, after the slide master and its rels. */\n\treadonly afterMaster?: (pres: PresentationPropsInternal, zip: ZipWriter) => void\n\t/**\n\t * Written from one target's rel arrays, for every layout, then every slide, then the master —\n\t * last, alongside the media parts. Any promises returned join the single pool the packager\n\t * awaits, so a family with async part work does not serialize the write.\n\t */\n\treadonly fromTargetRels?: (target: PartTarget, zip: ZipWriter) => Promise<unknown>[] | void\n}\n\n/**\n * Which `[Content_Types].xml` entries a family needs. Each hook names the slot its entries land\n * in; see {@link ContentTypeContributions} for where those slots sit in the emitted order.\n */\nexport interface ContributedContentTypes {\n\treadonly defaults?: (pres: PresentationPropsInternal) => ContentTypeDefault[]\n\treadonly presentation?: (pres: PresentationPropsInternal) => ContentTypeOverride[]\n\treadonly perSlide?: (slide: PresSlideInternal, slideNumber: number) => ContentTypeOverride[]\n\treadonly perLayout?: (layout: SlideLayoutInternal, layoutNumber: number) => ContentTypeOverride[]\n\treadonly trailing?: (pres: PresentationPropsInternal) => ContentTypeOverride[]\n}\n\n/**\n * The contributors in emission order. Sorting here rather than trusting the caller's array is the\n * whole point of {@link PartContributor.order}; the sort is stable, so two families that share a\n * rank keep their listed order rather than swapping unpredictably.\n */\nexport function orderedContributors(contributors: readonly PartContributor[]): PartContributor[] {\n\treturn [...contributors].sort((a, b) => a.order - b.order)\n}\n\n/**\n * Ask every contributor for its content-type entries and flatten them into the slot-keyed data\n * `makeXmlContTypes` emits. Takes the contributors already ordered — within a slot the entries\n * come out in the order they are collected here.\n */\nexport function collectContentTypes(\n\tcontributors: readonly PartContributor[],\n\tpres: PresentationPropsInternal\n): ContentTypeContributions {\n\tconst defaults: ContentTypeDefault[] = []\n\tconst presentation: ContentTypeOverride[] = []\n\tconst trailing: ContentTypeOverride[] = []\n\tconst perSlide: ContentTypeOverride[][] = pres.slides.map(() => [])\n\tconst perLayout: ContentTypeOverride[][] = pres.slideLayouts.map(() => [])\n\n\tfor (const contributor of contributors) {\n\t\tconst hooks = contributor.contentTypes\n\t\tif (!hooks) continue\n\t\tif (hooks.defaults) defaults.push(...hooks.defaults(pres))\n\t\tif (hooks.presentation) presentation.push(...hooks.presentation(pres))\n\t\tif (hooks.perSlide) {\n\t\t\tconst perSlideHook = hooks.perSlide\n\t\t\tpres.slides.forEach((slide, idx) => perSlide[idx]?.push(...perSlideHook(slide, idx + 1)))\n\t\t}\n\t\tif (hooks.perLayout) {\n\t\t\tconst perLayoutHook = hooks.perLayout\n\t\t\tpres.slideLayouts.forEach((layout, idx) => perLayout[idx]?.push(...perLayoutHook(layout, idx + 1)))\n\t\t}\n\t\tif (hooks.trailing) trailing.push(...hooks.trailing(pres))\n\t}\n\n\treturn { defaults, presentation, perSlide, perLayout, trailing }\n}\n","/**\n * Package assembly: turn an authored presentation's internal state into the full set of\n * OOXML package parts and hand the bytes to the ZIP writer. This is the write-side\n * \"packaging\" layer — `[Content_Types].xml`, the `_rels` graph, docProps, theme, the\n * per-slide/layout/master parts, and media rels — split out of the authoring class\n * (`TsPptx`) so that class stays a façade over slide authoring. The parts a construct\n * family adds on top of that skeleton — charts, comments, notes — come from the part\n * contributors it is handed, so nothing here names a family.\n *\n * The entry point `writePackage` takes a structural {@link PackageSource} that the\n * authoring class satisfies; it does not depend on the class itself, so the same pipeline\n * can be driven from any assembled deck state.\n */\nimport { ZipWriter } from '../zip.js'\nimport type { CustomPropertyValue, WriteProps } from '../types/index.js'\nimport type { PresentationPropsInternal, PresSlideInternal, SlideRelMedia } from '../types/internal.js'\nimport type { RuntimeAdapter } from '../runtime/types.js'\nimport type { FontMetricsRegistry } from '../measure/font-metrics.js'\nimport { flattenEmbeddedFaces } from '../embedded-fonts.js'\nimport { getNewRelId } from '../gen/utils.js'\nimport { pushMediaRel } from '../gen/define/image-rel.js'\nimport { chartPartNames } from '../gen/chart/part-names.js'\nimport { decodeBase64ToBytes } from '../media/base64.js'\nimport { audioExtensionForSubtype, dataUriMediaType } from '../media/content-type.js'\nimport { TRANSITION_TYPES } from '../ooxml/st-enums.js'\nimport {\n\tbackfillPlaceholders,\n\tbakeMeasuredFit,\n\tencodeMediaForTargets,\n\trequireSlideLinksInDeck,\n} from '../gen/prepare.js'\nimport { makeXmlApp } from '../gen/opc/app.js'\nimport { makeXmlContTypes } from '../gen/opc/content-types.js'\nimport { makeXmlCore } from '../gen/opc/core.js'\nimport { makeXmlCustomProperties } from '../gen/opc/custom-props.js'\nimport { makeXmlRootRels } from '../gen/opc/root-rels.js'\nimport { makeXmlPresentationRels } from '../gen/pres/presentation-rels.js'\nimport { makeXmlPresentation, makeXmlPresProps, makeXmlViewProps } from '../gen/pres/presentation.js'\nimport { makeXmlTableStyles } from '../gen/pres/table-styles.js'\nimport { makeXmlTheme } from '../gen/pres/theme.js'\nimport { makeXmlLayout } from '../gen/slide/layout.js'\nimport type { RendererTable } from '../gen/slide/objects/shared.js'\nimport { makeXmlMaster, makeXmlMasterRel } from '../gen/slide/master.js'\nimport { makeXmlSlide, makeXmlSlideLayoutRel, makeXmlSlideRel } from '../gen/slide/slide.js'\nimport { collectContentTypes, orderedContributors, type PartContributor, type PartTarget } from './parts/shared.js'\nimport {\n\tfontPath,\n\tPRESENTATION_PATH,\n\trelsPath,\n\tslideLayoutPath,\n\tSLIDE_MASTER_PATH,\n\tslidePath,\n} from '../gen/opc/part-paths.js'\n\n/**\n * The slice of an authored presentation the packager reads. The authoring class satisfies\n * this structurally: `presentation` is its internal props view (slides, layouts, master,\n * embedded fonts, and metadata), and the remaining fields are state the part builders need\n * that the props view does not carry.\n */\nexport interface PackageSource {\n\treadonly runtime: RuntimeAdapter\n\treadonly presentation: PresentationPropsInternal\n\treadonly customProperties: Array<{ name: string; value: CustomPropertyValue }>\n\treadonly fontMetrics: FontMetricsRegistry\n\t/**\n\t * Which renderer emits each shape family, handed down to every part that carries a shape tree\n\t * (slides, layouts, the master). It travels with the deck state rather than being imported by\n\t * the shape walk so that the set of families a program links is the caller's to decide — see\n\t * `RendererTable` in `gen/slide/objects/shared.ts`.\n\t */\n\treadonly renderers: RendererTable\n\t/**\n\t * Which construct families add parts to the package — the chart parts and their embedded\n\t * workbooks, the comment parts, the notes slides. Travels with the deck state for the same\n\t * reason `renderers` does: naming the emitters here would link every family's part builders\n\t * into every program that writes a deck. See `PartContributor` in `parts/shared.ts`.\n\t */\n\treadonly partContributors: readonly PartContributor[]\n}\n\n/**\n * Media extensions whose bytes are already entropy-coded, so running the ZIP's\n * DEFLATE pass over them costs CPU for a negligible size gain. For these we set\n * the per-entry ZIP compression to STORE while leaving XML parts on DEFLATE.\n * In image/video-heavy decks media dominates the byte count, so this is the\n * dominant cost when writing large presentations.\n * Formats that genuinely benefit from DEFLATE (bmp, wav, tiff, emf, wmf, svg)\n * are deliberately excluded so they keep inheriting the global compression.\n */\nconst ALREADY_COMPRESSED_MEDIA_EXTN = new Set([\n\t'jpg',\n\t'jpeg',\n\t'png',\n\t'gif',\n\t'webp',\n\t'heic',\n\t'heif',\n\t'avif',\n\t'mp4',\n\t'm4v',\n\t'mov',\n\t'avi',\n\t'mpg',\n\t'mpeg',\n\t'wmv',\n\t'webm',\n\t'mkv',\n\t'mp3',\n\t'm4a',\n\t'aac',\n\t'ogg',\n\t'oga',\n])\n\n/**\n * Extensions whose payload is itself a ZIP archive — the embedded OPC packages an OLE object can\n * carry (`addOleObject`). Deflating a zip inside a zip buys nothing, so these are STOREd like the\n * already-compressed media above. No media/image rel ever uses one of these extensions, so decks\n * without an OLE object are unaffected.\n */\nconst ZIP_CONTAINER_EXTN = new Set(['xlsx', 'xlsm', 'docx', 'docm', 'pptx', 'pptm'])\n\n/** The audio relationship a slide's transition sound was registered under, and the sound it was registered for. */\ninterface RegisteredTransitionSound {\n\treadonly rel: SlideRelMedia\n\treadonly data: string | undefined\n\treadonly path: string | undefined\n}\n\n/**\n * Each slide's registered transition sound.\n *\n * Kept per slide, never on the transition: one transition object can be assigned to several slides,\n * and a relationship id means something only inside the slide part that declares it. Kept across\n * writes as well, so a deck written twice registers each sound once. An entry is reused only while\n * the slide still holds its relationship and still has the same sound assigned.\n */\nconst registeredTransitionSounds = new WeakMap<PresSlideInternal, RegisteredTransitionSound>()\n\n/**\n * Register an audio media part + relationship for each slide-transition start sound\n * (`transition.sound` with `data`/`path`), and return the relationship id each slide's\n * `p:sndAc/p:snd r:embed` refers to. Runs before media encoding so the bytes are loaded. Re-export\n * is safe: a slide whose sound is already registered reuses that relationship. The stop-previous\n * form (`sound.stopPrevious`) needs no part and is skipped.\n *\n * Registered here, at write time, rather than when `slide.transition` is assigned. A slide's rel\n * ids and media part names are handed out in registration order, and a transition is often set\n * before the slide's pictures and media are added; registering the sound then would move every\n * later rel id and part name on the slide.\n */\nfunction registerTransitionSounds(slides: PresSlideInternal[]): Map<PresSlideInternal, number> {\n\tconst soundRIds = new Map<PresSlideInternal, number>()\n\tslides.forEach((slide) => {\n\t\tconst transition = slide.transition\n\t\t// A transition the emitter will not write has no sound action to register a part for.\n\t\tif (!transition || !(TRANSITION_TYPES as readonly string[]).includes(transition.type)) return\n\t\tconst sound = transition.sound\n\t\tif (!sound || sound.stopPrevious) return\n\t\tif (!sound.data && !sound.path) return\n\n\t\tconst registered = registeredTransitionSounds.get(slide)\n\t\tif (\n\t\t\tregistered &&\n\t\t\tslide._relsMedia.includes(registered.rel) &&\n\t\t\tregistered.data === sound.data &&\n\t\t\tregistered.path === sound.path\n\t\t) {\n\t\t\tsoundRIds.set(slide, registered.rel.rId)\n\t\t\treturn\n\t\t}\n\n\t\t// Derive the file extension from the data-URI mime, else the path, defaulting to wav.\n\t\t// The mime's subtype is not itself an extension for the spellings PowerPoint actually\n\t\t// uses (`audio/x-wav` for a transition sound), so it goes through the mapping rather\n\t\t// than into the filename raw — see `audioExtensionForSubtype`.\n\t\tconst dataMime = dataUriMediaType(sound.data ?? '')\n\t\tconst pathFile = sound.path ? ((sound.path.split('/').pop() ?? '').split('?')[0] ?? '') : ''\n\t\tconst extn = dataMime?.startsWith('audio/')\n\t\t\t? audioExtensionForSubtype(dataMime.slice('audio/'.length))\n\t\t\t: (pathFile.split('.').pop() ?? 'wav').toLowerCase()\n\n\t\tconst rId = getNewRelId(slide)\n\t\tconst rel = pushMediaRel(slide, {\n\t\t\tkind: 'audio',\n\t\t\textn,\n\t\t\ttype: `audio/${extn}`,\n\t\t\tpath: sound.path,\n\t\t\tdata: sound.data,\n\t\t\trId,\n\t\t})\n\t\tregisteredTransitionSounds.set(slide, { rel, data: sound.data, path: sound.path })\n\t\tsoundRIds.set(slide, rId)\n\t})\n\treturn soundRIds\n}\n\n/**\n * Write the media parts one target's rels point at. Images are how every deck carries a picture,\n * so this stays on the core path; the chart half of what used to be one function is a part\n * contributor (`parts/chart.ts`) and runs just before it, per target, so part order is unchanged.\n *\n * After media de-duplication many relationships share one `Target`, across targets as well as\n * within one: a logo on every slide is one part. Each used to be decoded and added once per\n * relationship. A path is now written the first time it decodes, and skipped after that. The zip\n * keys entries by path and a re-added key keeps its first position, and relationships sharing a\n * `Target` share its data and extension, so skipping cannot change a byte.\n * @param {PartTarget} slide - slide, layout or master carrying the rels\n * @param {ZipWriter} zip - zip writer\n * @param {Set<string>} written - the media paths already added, shared across every target of one package\n */\nfunction createMediaParts(slide: PartTarget, zip: ZipWriter, written: Set<string>): void {\n\tslide._relsMedia.forEach((rel) => {\n\t\tif (rel.type !== 'online' && rel.type !== 'hyperlink') {\n\t\t\tconst path = rel.Target.replace('..', 'ppt')\n\t\t\tif (written.has(path)) return\n\t\t\t// A: fflate needs decoded bytes (no base64 convenience), so decode the payload\n\t\t\t// here. `decodeBase64ToBytes` takes raw base64 and a `data:` URI alike, which is\n\t\t\t// every shape `rel.data` comes in: a loaded rel has been through `toMediaDataUri`,\n\t\t\t// and a caller-supplied `addImage({ data })` may be either. A prefix-correcting\n\t\t\t// block used to sit here and is gone -- it only ever prepended a label the decoder\n\t\t\t// then stripped, so it could not change a single byte of any payload.\n\t\t\tconst data: string = rel.data && typeof rel.data === 'string' ? rel.data : ''\n\n\t\t\t// B: Already-compressed formats (JPEG/PNG/video/…) gain ~nothing from DEFLATE, so\n\t\t\t// STORE them to avoid wasted compression CPU on large decks; other parts inherit\n\t\t\t// global compression.\n\t\t\tconst bytes = decodeBase64ToBytes(data)\n\t\t\tif (!bytes) return\n\t\t\tconst extn = (rel.extn || rel.Target.split('.').pop() || '').toLowerCase()\n\t\t\tzip.add(path, bytes, {\n\t\t\t\tstore: ALREADY_COMPRESSED_MEDIA_EXTN.has(extn) || ZIP_CONTAINER_EXTN.has(extn),\n\t\t\t})\n\t\t\twritten.add(path)\n\t\t}\n\t})\n}\n\n/**\n * One emitted OOXML package part, before zipping: its slash-path, already-encoded bytes, and\n * whether it is added with `store` (DEFLATE skipped — already-compressed media/fonts). This is\n * the build-side seam {@link buildPackageParts} returns and {@link zipPackageParts} consumes;\n * the `store` hint is an fflate-era zip optimization kept internal so re-zipping stays\n * byte-identical. A public parts API exposes only `{ path, data }`.\n */\ninterface InternalPackagePart {\n\treadonly path: string\n\treadonly data: Uint8Array\n\treadonly store: boolean\n}\n\n/**\n * Assemble every package part for `source` and return them in emission order, without zipping.\n * This runs the transition-sound registration, placeholder backfill, media encode, cross-deck\n * media de-dup, chart-part-id assignment, and measured-fit passes before the synchronous\n * XML pass reads slide state. The bytes are the same the ZIP writer would compress; splitting the\n * assembly from the zip lets the byte-identity harness (and a future parts API) read parts\n * directly. Only `onMediaError` is meaningful here — compression/output shape are zip concerns\n * handled by {@link zipPackageParts}.\n */\nexport async function buildPackageParts(\n\tsource: PackageSource,\n\tprops: { onMediaError?: WriteProps['onMediaError'] }\n): Promise<InternalPackagePart[]> {\n\tconst pres = source.presentation\n\t// One pool for every contributor's async part work, awaited once at the end: a family that\n\t// awaited its own would make the write serial.\n\tconst partPromises: Promise<unknown>[] = []\n\tconst contributors = orderedContributors(source.partContributors)\n\tconst zip = new ZipWriter()\n\n\t// A link to a slide the deck does not have is refused before anything is registered or built.\n\t// Layouts and the master carry objects too, and their links are checked with the slides'.\n\trequireSlideLinksInDeck(pres.slides, pres.slideLayouts, pres.masterSlide)\n\n\t// STEP 0: Register transition-sound media parts/rels before encoding picks them up.\n\tconst transitionSoundRIds = registerTransitionSounds(pres.slides)\n\t// STEP 0b: Seed each slide with the layout placeholders it leaves empty, for the same reason:\n\t// a seeded placeholder with an image fill registers media, and encoding has to see it. Shared\n\t// with `extractSlides` (see `gen/prepare.ts`).\n\tbackfillPlaceholders(pres.slides)\n\n\t// STEP 1: Read/Encode all Media before zip as base64 content, etc. is required\n\tconst onMediaError = props.onMediaError ?? 'throw'\n\tconst mediaTargets = [...pres.slides, ...pres.slideLayouts, pres.masterSlide]\n\n\t// STEP 2: Wait for media (if any) then generate the PPTX file\n\treturn await encodeMediaForTargets(mediaTargets, source.runtime, onMediaError).then(async () => {\n\t\t// PERF: Collapse identical media to a single package part across the entire deck.\n\t\t// Each target (slide/layout/master) namespaces its media `Target` by slide, so the\n\t\t// same image used on multiple slides — or loaded from the same path — otherwise\n\t\t// embeds one copy per use. By now `encodeSlideMediaRels` has populated every\n\t\t// `rel.data`, so we can point later duplicates at the first occurrence's `Target`\n\t\t// (slide `.rels` reference media by rId, and sharing a part across slides is valid\n\t\t// OOXML). This subsumes the per-slide path/data de-dup for cross-slide reuse and\n\t\t// also covers background images.\n\t\tconst canonicalMediaTargets = new Map<string, string>()\n\t\tfor (const target of mediaTargets) {\n\t\t\tfor (const rel of target._relsMedia || []) {\n\t\t\t\tif (rel.type === 'online' || rel.type === 'hyperlink' || typeof rel.data !== 'string' || !rel.data) continue\n\t\t\t\t// OLE payloads are exempt: PowerPoint gives every embedded object its own part, and\n\t\t\t\t// collapsing two identical ones would make editing either rewrite the other's source.\n\t\t\t\tif (rel.oleRelType) continue\n\t\t\t\t// Key on extension + bytes so identical content with differing part\n\t\t\t\t// extensions is never merged into one mistyped file.\n\t\t\t\tconst key = (rel.extn || '') + '\\0' + rel.data\n\t\t\t\tconst canonical = canonicalMediaTargets.get(key)\n\t\t\t\tif (canonical) rel.Target = canonical\n\t\t\t\telse canonicalMediaTargets.set(key, rel.Target)\n\t\t\t}\n\t\t}\n\n\t\t// DETERMINISM: Assign chart part filenames from a per-presentation counter here,\n\t\t// at write time, so two identical decks built in one process produce byte-identical\n\t\t// packages. Chart parts share one `ppt/charts/` namespace across slides, layouts, and\n\t\t// the master, so the id must be package-wide; `addChartDefinition` only sets a\n\t\t// target-local placeholder. This is the authoritative assignment consumed by content\n\t\t// types, slide rels, and the chart/embedding parts below — all emitted after this pass.\n\t\t// A never-reset module global in `gen/define/chart.ts` previously drove this — same\n\t\t// input, different bytes. `gen/chart/chartex-xml.ts` derives its series GUIDs from\n\t\t// the id assigned here, so both depend on this pass staying authoritative.\n\t\tlet chartPartIdx = 0\n\t\tfor (const target of mediaTargets) {\n\t\t\tfor (const rel of target._relsChart || []) {\n\t\t\t\tconst chartId = ++chartPartIdx\n\t\t\t\trel.globalId = chartId\n\t\t\t\t// chartEx charts share the `ppt/charts/` namespace but use the `chartEx{N}.xml` name.\n\t\t\t\t// The single shared counter keeps every chart part name globally unique regardless of\n\t\t\t\t// prefix, so classic and chartEx parts never collide.\n\t\t\t\tconst { fileName, target } = chartPartNames(chartId, rel.isChartEx)\n\t\t\t\trel.fileName = fileName\n\t\t\t\trel.Target = target\n\t\t\t}\n\t\t}\n\n\t\t// A: Bake a real fontScale onto `fit:'shrink'` text boxes when font metrics are registered,\n\t\t// before the sync XML pass reads them. Shared with `extractSlides` (see `gen/prepare.ts`). The\n\t\t// bake writes into the stored slide model, so it is undone once B to D, which run with no\n\t\t// `await` between them, have read it, and the next write measures from the authored values.\n\t\tconst restoreAuthoredFit = bakeMeasuredFit(pres.slides, source.fontMetrics)\n\t\ttry {\n\t\t\t// B: Add all required files. fflate keys on full slash-paths and emits no\n\t\t\t// directory entries, so there is no folder scaffolding to set up (and no\n\t\t\t// stray empty-directory entries to guard against on minimal decks).\n\t\t\tconst hasCustomProps = source.customProperties.length > 0\n\t\t\tzip.add(\n\t\t\t\t'[Content_Types].xml',\n\t\t\t\tmakeXmlContTypes({\n\t\t\t\t\tslides: pres.slides,\n\t\t\t\t\tslideLayouts: pres.slideLayouts,\n\t\t\t\t\tmasterSlide: pres.masterSlide,\n\t\t\t\t\thasCustomProps,\n\t\t\t\t\tembeddedFonts: pres.embeddedFonts,\n\t\t\t\t\tcontributions: collectContentTypes(contributors, pres),\n\t\t\t\t})\n\t\t\t)\n\t\t\tzip.add('_rels/.rels', makeXmlRootRels(hasCustomProps))\n\t\t\tzip.add('docProps/app.xml', makeXmlApp(pres.slides, pres.company, pres.presLayout))\n\t\t\tzip.add('docProps/core.xml', makeXmlCore(pres.title, pres.subject, pres.author, pres.revision))\n\t\t\tif (hasCustomProps) {\n\t\t\t\tzip.add('docProps/custom.xml', makeXmlCustomProperties(source.customProperties))\n\t\t\t}\n\t\t\tzip.add(relsPath(PRESENTATION_PATH), makeXmlPresentationRels(pres.slides, pres.embeddedFonts))\n\t\t\t// Embedded font parts (raw whole faces). Fonts are already compact binary, so STORE\n\t\t\t// (no DEFLATE) like already-compressed media. Part index matches the rels Target above.\n\t\t\tfor (const face of flattenEmbeddedFaces(pres.embeddedFonts, 1)) {\n\t\t\t\tzip.add(fontPath(face.partIndex), face.bytes, { store: true })\n\t\t\t}\n\t\t\t// One theme, written twice: theme2.xml is a separate part so notesMaster1.xml.rels resolves.\n\t\t\tconst themeXml = makeXmlTheme(pres)\n\t\t\tzip.add('ppt/theme/theme1.xml', themeXml)\n\t\t\tzip.add('ppt/theme/theme2.xml', themeXml)\n\t\t\tzip.add(PRESENTATION_PATH, makeXmlPresentation(pres))\n\t\t\tzip.add('ppt/presProps.xml', makeXmlPresProps())\n\t\t\tzip.add('ppt/tableStyles.xml', makeXmlTableStyles())\n\t\t\tzip.add('ppt/viewProps.xml', makeXmlViewProps())\n\n\t\t\t// C: Create a Layout/Master/Rel/Slide file for each SlideLayout and Slide\n\t\t\tpres.slideLayouts.forEach((layout, idx) => {\n\t\t\t\tzip.add(slideLayoutPath(idx + 1), makeXmlLayout(layout, source.renderers))\n\t\t\t\tzip.add(relsPath(slideLayoutPath(idx + 1)), makeXmlSlideLayoutRel(idx + 1, pres.slideLayouts))\n\t\t\t})\n\t\t\tpres.slides.forEach((slide, idx) => {\n\t\t\t\tzip.add(slidePath(idx + 1), makeXmlSlide(slide, source.renderers, transitionSoundRIds.get(slide)))\n\t\t\t\tzip.add(relsPath(slidePath(idx + 1)), makeXmlSlideRel(pres.slides, pres.slideLayouts, idx + 1))\n\t\t\t\tcontributors.forEach((contributor) => contributor.parts?.withEachSlide?.(slide, idx + 1, zip))\n\t\t\t})\n\t\t\tzip.add(SLIDE_MASTER_PATH, makeXmlMaster(pres.masterSlide, pres.slideLayouts, source.renderers))\n\t\t\tzip.add(relsPath(SLIDE_MASTER_PATH), makeXmlMasterRel(pres.masterSlide, pres.slideLayouts))\n\t\t\tcontributors.forEach((contributor) => contributor.parts?.afterMaster?.(pres, zip))\n\n\t\t\t// D: Create all Rels (images, media, chart data). Per target the contributors go first, then\n\t\t\t// the media pass, which is the interleaving the zip has always had.\n\t\t\tconst writtenMediaPaths = new Set<string>()\n\t\t\tconst addTargetRelParts = (target: PartTarget): void => {\n\t\t\t\tcontributors.forEach((contributor) => {\n\t\t\t\t\tconst pending = contributor.parts?.fromTargetRels?.(target, zip)\n\t\t\t\t\tif (pending) partPromises.push(...pending)\n\t\t\t\t})\n\t\t\t\tcreateMediaParts(target, zip, writtenMediaPaths)\n\t\t\t}\n\t\t\tpres.slideLayouts.forEach(addTargetRelParts)\n\t\t\tpres.slides.forEach(addTargetRelParts)\n\t\t\taddTargetRelParts(pres.masterSlide)\n\t\t} finally {\n\t\t\trestoreAuthoredFit()\n\t\t}\n\n\t\t// E: Wait for the contributed async parts (if any), then snapshot the accumulated\n\t\t// parts in emission order. Zipping is deferred to `zipPackageParts`.\n\t\treturn await Promise.all(partPromises).then(() => zip.entries())\n\t})\n}\n\n/**\n * Zip an ordered list of package parts into the output shape `props.outputType` selects. Re-adds\n * each part to a fresh {@link ZipWriter} in order — preserving each part's `store` hint — so the\n * archive is byte-identical to assembling straight into one writer. Compression and output type\n * are the only zip-level knobs; part assembly happened in {@link buildPackageParts}.\n */\nasync function zipPackageParts(\n\tparts: InternalPackagePart[],\n\tprops: WriteProps\n): Promise<string | ArrayBuffer | Blob | Uint8Array> {\n\tconst zip = new ZipWriter()\n\tfor (const part of parts) zip.add(part.path, part.data, { store: part.store })\n\n\tconst compression = props.compression !== false\n\tif (props.outputType) {\n\t\t// A: Output type selected by the caller or runtime adapter.\n\t\treturn await zip.generate(props.outputType, { compression })\n\t} else {\n\t\t// B: Browser/neutral default: output a Blob as app/ms-pptx.\n\t\treturn await zip.generate('blob', { compression })\n\t}\n}\n\n/**\n * Assemble every package part for `source` and zip it into the output shape `props.outputType`\n * selects. Thin composition of {@link buildPackageParts} (the assembly pipeline) and\n * {@link zipPackageParts} (the zip pass), kept as the stable entry point the authoring class calls.\n */\nexport async function writePackage(\n\tsource: PackageSource,\n\tprops: WriteProps\n): Promise<string | ArrayBuffer | Blob | Uint8Array> {\n\treturn await zipPackageParts(await buildPackageParts(source, props), props)\n}\n","/**\n * ts-pptx: the presentation core\n *\n * Home of {@link PresentationCore}, the class every entry point subclasses with a runtime\n * adapter (`index.ts`, `node.ts`, `browser.ts`). See the class doc below for the layout of\n * its body and where package assembly actually happens.\n *\n * Units: this library takes user coordinates in inches and converts to EMU on output — see\n * `units.ts` for the conversions and `STANDARD_LAYOUTS` for the built-in slide sizes.\n *\n * Derived from PptxGenJS (C) 2015-present Brent Ely (MIT), which in turn took some code from\n * the OfficeGen project (Copyright 2013 Ziv Barber). This project is likewise MIT; the full\n * license text is in `LICENSE` at the repository root.\n */\n\nimport { warn } from './diagnostics.js'\nimport { InternalError, InvalidOptionError } from './errors.js'\nimport { MIN_SLIDE_ID } from './ooxml/ids.js'\nimport SlideBuilder from './slide.js'\nimport { DEF_PRES_LAYOUT, DEF_PRES_LAYOUT_NAME, DEF_SLIDE_MARGIN_IN } from './constants-internal.js'\nimport type {\n\tAddSlideProps,\n\tCustomPropertyValue,\n\tMeasureTextOptions,\n\tOverflowBoxOptions,\n\tPresLayout,\n\tSectionProps,\n\tSlideLayout,\n\tPackagePart,\n\tPartsProps,\n\tSlideMasterProps,\n\tSlideNumberProps,\n\tTableLayoutResult,\n\tTableProps,\n\tTableRow,\n\tTextMeasurement,\n\tTextProps,\n\tThemeProps,\n\tWriteBaseProps,\n\tWriteFileProps,\n\tWriteProps,\n} from './types/index.js'\nimport type {\n\tPresentationPropsInternal,\n\tPresSlideInternal,\n\tSectionInternalProps,\n\tSlideLayoutInternal,\n\tSlideMasterInternal,\n} from './types/internal.js'\nimport type { Slide } from './types/slide.js'\nimport type { RuntimeAdapter } from './runtime/types.js'\nimport { FontMetricsRegistry, parseFontMetrics } from './measure/font-metrics.js'\nimport { isFontCollection } from './measure/font-collection.js'\nimport { type EmbeddedFont, type EmbeddedFontSlot, EMBEDDED_FONT_SLOTS } from './embedded-fonts.js'\nimport { resolveFontBytes } from './font-source.js'\nimport { inchesToEmu, STANDARD_LAYOUTS, type StandardLayout } from './units.js'\nimport { clampRangedInput } from './units-internal.js'\nimport type { ExtractedSlides } from './read/api/presentation-types.js'\n\nimport { addBackgroundDefinition } from './gen/define/background.js'\nimport { createSlideMaster } from './gen/define/master.js'\n// What this presentation can author: one list of construct families, composed once here. See\n// `families/shared.ts` for why it is a list and not a set of imports.\nimport {\n\tcomposeFamilies,\n\trequirePresentationAuthor,\n\ttype BoundPresentationAuthor,\n\ttype Composition,\n\ttype ConstructFamily,\n\ttype PresentationAuthorContext,\n\ttype PresentationAuthors,\n} from './families/shared.js'\nimport { bracedGuid } from './gen/utils.js'\nimport { extractSlides as extractSlidesFrom } from './gen/extract-slides.js'\nimport { buildPackageParts, writePackage, type PackageSource } from './package/assemble.js'\nimport { pickDefined, setOrClear } from './options-internal.js'\n\nconst VERSION = '4.0.0'\n\nfunction standardLayoutToPresLayout(layout: StandardLayout): PresLayout {\n\treturn {\n\t\tname: layout.name,\n\t\twidth: layout.widthEmu,\n\t\theight: layout.heightEmu,\n\t}\n}\n\n/**\n * One side of a `defineLayout` definition, in inches, clamped to what `ST_SlideSizeCoordinate`\n * allows.\n *\n * `p:sldSz/@cx` and `@cy` are bounded 914400 to 51206400 EMU -- 1 to 56 inches -- and nothing\n * checked. Every arm of `defineLayout`'s guard chain is a `warn`, so\n * `{ name: 'Badge', width: 0.5, height: 0.5 }` produced no diagnostic at all (both values are\n * truthy and finite) and emitted a `sldSz` PowerPoint offers to repair; `width: -5` is truthy\n * too, so it reached the file as `cx=\"-4572000\"`.\n *\n * `Number()` first, because the guard chain above deliberately accepts a numeric string as\n * advice rather than as an error, and `clampRangedInput` takes a number. A value with nothing\n * to coerce from is `NaN`, which it throws on -- as `coord/non-finite`, the code the unit\n * conversion used to raise one line later.\n * @param value - the caller's `width` or `height`\n * @param side - which one, for the diagnostic\n */\nfunction layoutSideInches(value: number | undefined, side: 'width' | 'height'): number {\n\treturn clampRangedInput(\n\t\tNumber(value),\n\t\t1,\n\t\t56,\n\t\t'layout/size-out-of-range',\n\t\t`defineLayout ${side} (inches)`,\n\t\t'coord/non-finite'\n\t)\n}\n\n/**\n * Main presentation class and package export flow — the public entry point consumers\n * instantiate (`new TsPptx()`). Owns presentation-level state and metadata, collects\n * slides, and drives `write`/`writeFile`/`stream`. The actual OOXML string building is\n * delegated to the `gen-*` modules; runtime file/stream output goes through the injected\n * `RuntimeAdapter`. Enums (`AlignH`, `ChartType`, `ShapeType`, …) are imported from the\n * package entry, not read off the instance.\n *\n * Rough layout of the class body:\n * - Metadata accessors layout / author / company / title / theme / sections getters+setters\n * - Private slide helpers addNewSlide, getSlide, setSlideNumber\n * - Public export methods stream / write / writeFile — delegate packaging to `writePackage`\n * - Public authoring methods addSlide / defineLayout / defineSlideMaster / defineTableStyle\n *\n * Package assembly (`[Content_Types].xml`, the rels graph, per-part XML, the ZIP) lives in\n * `package/assemble.ts`; this class provides the deck state via {@link PresentationCore.packageSource}.\n * The live-DOM `tableToSlides()` is NOT here — it is added by the browser entry subclass\n * (`browser.ts`) so it stays out of the Node build and out of the core chunk.\n */\nexport default class PresentationCore {\n\t// Property getters/setters\n\n\t/**\n\t * Presentation layout name\n\t * Standard layouts:\n\t * - 'LAYOUT_4x3' (10\" x 7.5\")\n\t * - 'LAYOUT_16x9' (10\" x 5.625\")\n\t * - 'LAYOUT_16x10' (10\" x 6.25\")\n\t * - 'LAYOUT_WIDE' (13.333\" x 7.5\")\n\t * Custom layouts:\n\t * Use `pptx.defineLayout()` to create custom layouts (e.g.: 'A4')\n\t * @type {string}\n\t * @see https://support.office.com/en-us/article/Change-the-size-of-your-slides-040a811c-be43-40b9-8d04-0de5ed79987e\n\t */\n\tprivate _layout: string = DEF_PRES_LAYOUT\n\tpublic set layout(value: string | StandardLayout) {\n\t\t// Accept either a layout key string or a STANDARD_LAYOUTS preset object directly.\n\t\tconst layoutKey = typeof value === 'string' ? value : value?.layout\n\t\tconst newLayout: PresLayout | undefined = layoutKey ? this.LAYOUTS[layoutKey] : undefined\n\n\t\tif (newLayout) {\n\t\t\tthis._layout = layoutKey\n\t\t\tthis._presLayout = newLayout\n\t\t} else {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'layout/unknown',\n\t\t\t\t`Unknown layout ${JSON.stringify(layoutKey)}; pass a registered layout name (see LAYOUTS) or a STANDARD_LAYOUTS preset`\n\t\t\t)\n\t\t}\n\t}\n\n\tpublic get layout(): string {\n\t\treturn this._layout\n\t}\n\n\t/**\n\t * ts-pptx Library Version\n\t */\n\tprivate readonly _version: string = VERSION\n\tpublic get version(): string {\n\t\treturn this._version\n\t}\n\n\t// The seven pass-through pairs below (`author`, `company`, `revision`, `subject`, `theme`,\n\t// `title`, `rtlMode`) are a private field, a getter that returns it and a setter that assigns\n\t// it, and nothing else. They are kept as accessors rather than collapsed into public fields on\n\t// purpose: `layout`, which sits in the same block and reads like them, is NOT a pass-through --\n\t// it resolves a name against `LAYOUTS` and throws on one that names nothing. `firstSlideNum`\n\t// needed the same treatment once it refused a value that is not an integer, and behind an\n\t// accessor that was an implementation change rather than a change to the public shape. A clone\n\t// detector will pair the rest again; this is the answer.\n\t/**\n\t * @type {string}\n\t */\n\tprivate _author: string\n\tpublic set author(value: string) {\n\t\tthis._author = value\n\t}\n\n\tpublic get author(): string {\n\t\treturn this._author\n\t}\n\n\t/**\n\t * @type {string}\n\t */\n\tprivate _company: string\n\tpublic set company(value: string) {\n\t\tthis._company = value\n\t}\n\n\tpublic get company(): string {\n\t\treturn this._company\n\t}\n\n\t/**\n\t * @type {string}\n\t * @note the `revision` value must be a whole number only (without \".\" or \",\" - otherwise, PPT will throw errors upon opening!)\n\t */\n\tprivate _revision: string\n\tpublic set revision(value: string) {\n\t\tthis._revision = value\n\t}\n\n\tpublic get revision(): string {\n\t\treturn this._revision\n\t}\n\n\t/**\n\t * @type {string}\n\t */\n\tprivate _subject: string\n\tpublic set subject(value: string) {\n\t\tthis._subject = value\n\t}\n\n\tpublic get subject(): string {\n\t\treturn this._subject\n\t}\n\n\t/**\n\t * @type {ThemeProps}\n\t */\n\tprivate _theme: ThemeProps = {}\n\tpublic set theme(value: ThemeProps) {\n\t\tthis._theme = value\n\t}\n\n\tpublic get theme(): ThemeProps {\n\t\treturn this._theme\n\t}\n\n\t/**\n\t * @type {string}\n\t */\n\tprivate _title: string\n\tpublic set title(value: string) {\n\t\tthis._title = value\n\t}\n\n\tpublic get title(): string {\n\t\treturn this._title\n\t}\n\n\t/**\n\t * Slide number shown on the first slide (maps to firstSlideNum in presentation.xml)\n\t * @throws {InvalidOptionError} when the value is not an integer `xsd:int` can hold\n\t */\n\tprivate _firstSlideNum: number\n\tpublic set firstSlideNum(value: number) {\n\t\tif (!Number.isInteger(value) || value < -2147483648 || value > 2147483647)\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'presentation/first-slide-num-not-an-integer',\n\t\t\t\t`firstSlideNum must be an integer, got ${String(value)}`\n\t\t\t)\n\t\tthis._firstSlideNum = value\n\t}\n\n\tpublic get firstSlideNum(): number {\n\t\treturn this._firstSlideNum\n\t}\n\n\t/**\n\t * Whether Right-to-Left (RTL) mode is enabled\n\t * @type {boolean}\n\t */\n\tprivate _rtlMode: boolean\n\tpublic set rtlMode(value: boolean) {\n\t\tthis._rtlMode = value\n\t}\n\n\tpublic get rtlMode(): boolean {\n\t\treturn this._rtlMode\n\t}\n\n\t/** the slide master the deck's master part is written from; not a `Slide`, so not handed out */\n\tprivate readonly _masterSlide: SlideMasterInternal\n\n\t/** this Presentation's Slide objects */\n\tprivate readonly _slides: PresSlideInternal[]\n\tpublic get slides(): Slide[] {\n\t\treturn this._slides\n\t}\n\n\t/** this Presentation's sections */\n\tprivate readonly _sections: SectionInternalProps[]\n\tpublic get sections(): SectionProps[] {\n\t\treturn this._sections\n\t}\n\n\t/** custom document properties stored in docProps/custom.xml */\n\tprivate _customProperties: Array<{ name: string; value: CustomPropertyValue }>\n\n\t/**\n\t * slide layout definition objects, used for generating slide layout files.\n\t * `protected` (not `private`) so the browser entry subclass can resolve\n\t * `tableToSlides({ masterTitle })` against them — that method lives on the\n\t * browser build only (it reads a live DOM), see `browser.ts`.\n\t */\n\tprotected readonly _slideLayouts: SlideLayoutInternal[]\n\tpublic get slideLayouts(): SlideLayout[] {\n\t\treturn this._slideLayouts\n\t}\n\n\tprivate get internalPresentation(): PresentationPropsInternal {\n\t\treturn {\n\t\t\tauthor: this.author,\n\t\t\tcompany: this.company,\n\t\t\tfirstSlideNum: this.firstSlideNum,\n\t\t\tlayout: this.layout,\n\t\t\tmasterSlide: this._masterSlide,\n\t\t\tpresLayout: this.presLayout,\n\t\t\trevision: this.revision,\n\t\t\trtlMode: this.rtlMode,\n\t\t\tsections: this._sections,\n\t\t\tslideLayouts: this._slideLayouts,\n\t\t\tslides: this._slides,\n\t\t\tsubject: this.subject,\n\t\t\ttheme: this.theme,\n\t\t\ttitle: this.title,\n\t\t\tembeddedFonts: this._embeddedFonts,\n\t\t}\n\t}\n\n\tprivate LAYOUTS: { [key: string]: PresLayout }\n\n\t/**\n\t * The built-in default layout, or a throw. `LAYOUTS` is a string-keyed map, so the lookup is\n\t * typed as possibly-missing at every call site even though the constructor registers it — and\n\t * the two callers that need it were spelling the same guard and the same message.\n\t */\n\t#requireDefaultLayout(): PresLayout {\n\t\tconst defLayout = this.LAYOUTS[DEF_PRES_LAYOUT]\n\t\tif (!defLayout)\n\t\t\tthrow new InternalError(\n\t\t\t\t'layout/default-not-registered',\n\t\t\t\t`Default presentation layout \"${DEF_PRES_LAYOUT}\" is not registered`\n\t\t\t)\n\t\treturn defLayout\n\t}\n\n\tprivate _presLayout: PresLayout\n\tpublic get presLayout(): PresLayout {\n\t\treturn this._presLayout\n\t}\n\n\tprivate readonly _runtime: RuntimeAdapter\n\n\t/** The construct families this presentation was composed with, flattened per seam. */\n\treadonly #composition: Composition\n\n\t/**\n\t * What a family's presentation-level author is handed. Assembled once: it carries the font\n\t * metrics registry, which is private to this class and therefore unreachable from a family\n\t * through the instance alone.\n\t */\n\treadonly #authorContext: PresentationAuthorContext\n\n\t/** Write-side font metrics for measured text fit (`fit:'shrink'`). @see registerFontMetrics */\n\tprivate readonly _fontMetrics = new FontMetricsRegistry()\n\n\t/** Author-side embedded font faces, accumulated by {@link embedFont} and emitted at write time. */\n\tprivate readonly _embeddedFonts: EmbeddedFont[] = []\n\n\tconstructor(runtime: RuntimeAdapter, families: readonly ConstructFamily[]) {\n\t\tthis._runtime = runtime\n\t\tthis.#composition = composeFamilies(families)\n\t\tthis.#authorContext = { pres: this, fontMetrics: this._fontMetrics }\n\t\t// Set available layouts\n\t\tthis.LAYOUTS = {\n\t\t\tLAYOUT_4x3: standardLayoutToPresLayout(STANDARD_LAYOUTS.LAYOUT_4x3),\n\t\t\tLAYOUT_16x9: standardLayoutToPresLayout(STANDARD_LAYOUTS.LAYOUT_16x9),\n\t\t\tLAYOUT_16x10: standardLayoutToPresLayout(STANDARD_LAYOUTS.LAYOUT_16x10),\n\t\t\tLAYOUT_WIDE: standardLayoutToPresLayout(STANDARD_LAYOUTS.LAYOUT_WIDE),\n\t\t}\n\n\t\t// Core\n\t\tthis._author = 'ts-pptx'\n\t\tthis._company = 'ts-pptx'\n\t\tthis._revision = '1' // Note: Must be a whole number\n\t\tthis._subject = 'ts-pptx Presentation'\n\t\tthis._title = 'ts-pptx Presentation'\n\t\t// ts-pptx props\n\t\tconst defLayout = this.#requireDefaultLayout()\n\t\tthis._presLayout = {\n\t\t\tname: defLayout.name,\n\t\t\twidth: defLayout.width,\n\t\t\theight: defLayout.height,\n\t\t}\n\t\tthis._firstSlideNum = 1\n\t\tthis._rtlMode = false\n\t\t//\n\t\tthis._slideLayouts = [\n\t\t\t{\n\t\t\t\t_margin: DEF_SLIDE_MARGIN_IN,\n\t\t\t\t_name: DEF_PRES_LAYOUT_NAME,\n\t\t\t\t_presLayout: this._presLayout,\n\t\t\t\t_rels: [],\n\t\t\t\t_relsChart: [],\n\t\t\t\t_relsMedia: [],\n\t\t\t\t_slide: null,\n\t\t\t\t_slideNum: 1000,\n\t\t\t\t_slideNumberProps: null,\n\t\t\t\t_slideObjects: [],\n\t\t\t},\n\t\t]\n\t\tthis._slides = []\n\t\tthis._sections = []\n\t\tthis._customProperties = []\n\t\tthis._masterSlide = {\n\t\t\t_presLayout: this._presLayout,\n\t\t\t_rels: [],\n\t\t\t_relsChart: [],\n\t\t\t_relsMedia: [],\n\t\t\t_slideNum: null,\n\t\t\t_slideNumberProps: null,\n\t\t\t_slideObjects: [],\n\t\t}\n\t}\n\n\t/**\n\t * Provides an API for `addTableDefinition` to create slides as needed for auto-paging\n\t * @param layout - the layout of the slide the table is paged from\n\t * @return {Slide} new Slide\n\t */\n\tprivate readonly addNewSlide = (layout: SlideLayoutInternal | null): PresSlideInternal => {\n\t\tconst nextOptions: AddSlideProps = {}\n\t\t// A registered layout is asked for by name. Any other is the default a slide added with no\n\t\t// `masterTitle` carries, which the continuation gets by naming none.\n\t\tif (layout && this._slideLayouts.includes(layout)) setOrClear(nextOptions, 'masterTitle', layout._name)\n\t\t// Preserve the originating slide's section for all auto-paged continuation slides.\n\t\t// Search for the section that owns the current last slide rather than assuming it is\n\t\t// the last section — the originating slide may not be at the tail of the deck.\n\t\tconst lastSlide = this._slides[this._slides.length - 1]\n\t\tconst sourceSection = this._sections.find((sect) => sect._slides.some((s) => s._slideNum === lastSlide?._slideNum))\n\t\tsetOrClear(nextOptions, 'sectionTitle', sourceSection?.title)\n\n\t\treturn this.addSlide(nextOptions) as PresSlideInternal\n\t}\n\n\t/**\n\t * Provides an API for `addTableDefinition` to get slide reference by number\n\t * @param {number} slideNum - slide number\n\t * @return {Slide} Slide\n\t */\n\tprivate readonly getSlide = (slideNum: number): PresSlideInternal | undefined =>\n\t\tthis._slides.find((slide) => slide._slideNum === slideNum)\n\n\t/**\n\t * Provides the live section list to the `Slide` class so Section/Summary Zoom can resolve\n\t * a section title to its stable GUID and enumerate sections in order.\n\t * @return {SectionInternalProps[]} the presentation's sections\n\t */\n\tprivate readonly getSections = (): SectionInternalProps[] => this._sections\n\n\t/**\n\t * Enables the `Slide` class to set ts-pptx [Presentation] master/layout slidenumbers\n\t * @param {SlideNumberProps} slideNum - slide number config\n\t */\n\tprivate readonly setSlideNumber = (slideNum: SlideNumberProps): void => {\n\t\t// 1: Add slideNumber to slideMaster1.xml\n\t\tthis._masterSlide._slideNumberProps = slideNum\n\n\t\t// 2: Add slideNumber to DEF_PRES_LAYOUT_NAME layout\n\t\tconst defLayout = this._slideLayouts.find((layout) => layout._name === DEF_PRES_LAYOUT_NAME)\n\t\tif (defLayout) defLayout._slideNumberProps = slideNum\n\t}\n\n\t/**\n\t * Assemble the slice of internal state the packaging layer reads. `PresentationCore` owns the\n\t * authored deck; `writePackage` (in `package/assemble.ts`) turns it into OOXML parts.\n\t */\n\tprivate packageSource(): PackageSource {\n\t\treturn {\n\t\t\truntime: this._runtime,\n\t\t\tpresentation: this.internalPresentation,\n\t\t\tcustomProperties: this._customProperties,\n\t\t\tfontMetrics: this._fontMetrics,\n\t\t\trenderers: this.#composition.renderers,\n\t\t\tpartContributors: this.#composition.partContributors,\n\t\t}\n\t}\n\n\t/**\n\t * Author + serialize this presentation's slides as injectable descriptors,\n\t * WITHOUT producing a `.pptx` package. Runs the same media-encode, placeholder\n\t * backfill, and measured-fit passes `write()` uses, then serializes each slide\n\t * body and resolves its image media to decoded bytes — so a loaded deck can\n\t * splice the slides in via `Presentation.appendSlides()` (see `pptx-ts/read`)\n\t * while keeping its own masters/layouts/theme byte-identical.\n\t *\n\t * Returns the deck's slide size (EMU, for the destination size check) and one\n\t * descriptor per authored slide. Charts, audio/video media, online media, and\n\t * internal slide-to-slide hyperlinks are surfaced as descriptors alongside the\n\t * serialized body — this method does not resolve them into a package; the append\n\t * path consumes each descriptor to reserve the parts and rebuild the rel graph.\n\t */\n\textractSlides = async (opts: { onMediaError?: 'throw' | 'placeholder' } = {}): Promise<ExtractedSlides> =>\n\t\textractSlidesFrom(\n\t\t\t{\n\t\t\t\truntime: this._runtime,\n\t\t\t\tpresentation: this.internalPresentation,\n\t\t\t\tfontMetrics: this._fontMetrics,\n\t\t\t\trenderers: this.#composition.renderers,\n\t\t\t\textract: this.#composition.extract,\n\t\t\t},\n\t\t\topts\n\t\t)\n\n\t// FONT METRICS (measured text fit)\n\n\t/**\n\t * One of this presentation's family-supplied methods, or the failure that names the family it\n\t * would have come from. The methods that call it stay on the class because their signatures are\n\t * the public contract; what they reach is what a family owns.\n\t *\n\t * `protected` for the browser entry, whose `tableToSlides` is one of these and is declared on\n\t * the subclass so that a Node build never links the DOM reader.\n\t */\n\tprotected familyAuthor<M extends keyof PresentationAuthors>(\n\t\tmethod: M\n\t): BoundPresentationAuthor<NonNullable<PresentationAuthors[M]>> {\n\t\tconst author = requirePresentationAuthor(this.#composition.presentationAuthors, method) as (\n\t\t\tctx: PresentationAuthorContext,\n\t\t\t...args: never[]\n\t\t) => unknown\n\t\treturn ((...args: never[]) => author(this.#authorContext, ...args)) as BoundPresentationAuthor<\n\t\t\tNonNullable<PresentationAuthors[M]>\n\t\t>\n\t}\n\n\t/**\n\t * Register a font's metrics so `fit:'shrink'` and `fit:'resize'` text is measured at\n\t * export time: `'shrink'` bakes a real `fontScale` and `'resize'` a real box height, so\n\t * the text renders fitted in headless renderers and on plain file-open, with no manual\n\t * edit/resize.\n\t *\n\t * Without registered metrics, both write the bare flag (`<a:normAutofit/>` or\n\t * `<a:spAutoFit/>`) that only PowerPoint recomputes on edit. Register the same\n\t * face once per weight/style you use; bold/italic advances differ.\n\t *\n\t * **Font collections** (`.ttc`/`.otc`, how MS Gothic, Yu Gothic, SimSun, Microsoft\n\t * YaHei and Cambria ship on Windows) hold several fonts in one file, so one has to be\n\t * chosen. With no `font` option, `face` is used as the selector, which is usually what\n\t * you meant; a `face` that names no font in the collection throws rather than falling\n\t * back to the first, since measuring the wrong member is invisible downstream. Pass\n\t * `font` when the deck-side name differs from the name inside the file, and use\n\t * `listFontFaces` from `pptx-ts/measure` to see what a file holds.\n\t * @param {string} face - font family name as used in `fontFace` (e.g. 'Aptos')\n\t * @param {string | Uint8Array | ArrayBuffer} source - font file path/URL (Node/web) or raw TTF/OTF/TTC\n\t * bytes. A string is always a path or URL here; base64 text is `embedFont`'s `data`, not this.\n\t * @param {object} [opts] - variant flags (advances differ per weight/style) and collection selection\n\t * @param {boolean} [opts.bold] - these are the bold advances\n\t * @param {boolean} [opts.italic] - these are the italic advances\n\t * @param {number | string} [opts.font] - which font inside a collection: 0-based index, or a name\n\t * @example await pptx.registerFontMetrics('Aptos', '/usr/share/fonts/Aptos.ttf')\n\t * @example await pptx.registerFontMetrics('Aptos', aptosBoldBytes, { bold: true })\n\t * @example await pptx.registerFontMetrics('MS PGothic', 'C:/Windows/Fonts/msgothic.ttc')\n\t * @example await pptx.registerFontMetrics('Cambria Math', 'C:/Windows/Fonts/cambria.ttc', { font: 1 })\n\t */\n\tasync registerFontMetrics(\n\t\tface: string,\n\t\tsource: string | Uint8Array | ArrayBuffer,\n\t\topts?: { bold?: boolean; italic?: boolean; font?: number | string }\n\t): Promise<void> {\n\t\t// A `string` here is a path or URL, never base64 -- see `resolveFontBytes` for the two\n\t\t// spellings and why `embedFont` reads its `data` string the other way.\n\t\tconst bytes = await resolveFontBytes(source, this._runtime, undefined, 'registerFontMetrics: `source`')\n\t\t// Only a collection is name-selected. A plain TTF holds one font whose internal\n\t\t// name need not match the deck-side family (registering Silkscreen's bytes under\n\t\t// any `face` has always worked), so defaulting `font` there would break that.\n\t\tconst font = opts?.font ?? (isFontCollection(bytes) ? face : undefined)\n\t\tconst metrics = await parseFontMetrics(bytes, font === undefined ? undefined : { font })\n\t\tthis._fontMetrics.set(face, metrics, pickDefined(opts ?? {}, ['bold', 'italic']))\n\t}\n\n\t/**\n\t * Embed a font face so the deck renders with it even on machines that do not\n\t * have it installed. The **whole** face is embedded (not glyph-subset) under\n\t * `/ppt/fonts/` and wired into `presentation.xml` (`p:embeddedFontLst` +\n\t * `embedTrueTypeFonts=\"1\"`), exactly as PowerPoint's \"Embed fonts in the file\"\n\t * does. Call once per face/weight you use.\n\t *\n\t * The declared `typeface` MUST match the family name used in your run/`fontFace`\n\t * typefaces (e.g. `addText('hi', { fontFace: 'Silkscreen' })`) or PowerPoint\n\t * will not bind the embedded bytes to the text. Repeated calls with the same\n\t * `typeface` and different `style` accumulate into one `p:embeddedFont` entry.\n\t *\n\t * Font licensing is the caller's responsibility: the bytes are embedded as\n\t * handed over; `OS/2.fsType` embedding-permission bits are not enforced.\n\t * @param {object} opts - font source + identity\n\t * @param {string} [opts.path] - font file path (Node) or URL (web) to a `.ttf`/`.otf`\n\t * @param {ArrayBuffer | Uint8Array | string} [opts.data] - raw font bytes, or a base64 string (bare or a\n\t * whole `data:` URL), in lieu of `path`. Unlike `registerFontMetrics`, a string here is never a path.\n\t * @param {string} opts.typeface - family name as referenced by run/`fontFace` typefaces\n\t * @param {EmbeddedFontSlot} [opts.style] - face slot; defaults to `'regular'`\n\t * @example await pptx.embedFont({ path: '/fonts/Silkscreen-Regular.ttf', typeface: 'Silkscreen' })\n\t * @example await pptx.embedFont({ path: '/fonts/Silkscreen-Bold.ttf', typeface: 'Silkscreen', style: 'bold' })\n\t */\n\tasync embedFont(opts: {\n\t\tpath?: string\n\t\tdata?: ArrayBuffer | Uint8Array | string\n\t\ttypeface: string\n\t\tstyle?: EmbeddedFontSlot\n\t}): Promise<void> {\n\t\tif (!opts || typeof opts.typeface !== 'string' || opts.typeface.trim() === '') {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'font/missing-typeface',\n\t\t\t\t'embedFont: `typeface` is required (the family name your runs reference)'\n\t\t\t)\n\t\t}\n\t\tconst slot: EmbeddedFontSlot = opts.style ?? 'regular'\n\t\tif (!EMBEDDED_FONT_SLOTS.includes(slot)) {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'font/invalid-style-slot',\n\t\t\t\t`embedFont: invalid style \"${slot}\"; expected one of ${EMBEDDED_FONT_SLOTS.join(', ')}`\n\t\t\t)\n\t\t}\n\n\t\tif (opts.path === undefined && opts.data === undefined)\n\t\t\tthrow new InvalidOptionError('font/missing-source', 'embedFont: provide either `path` or `data`')\n\n\t\t// `path` is a path/URL; a `data` string is base64. That difference is the whole reason\n\t\t// `resolveFontBytes` takes a flag rather than guessing from the value.\n\t\tconst bytes =\n\t\t\ttypeof opts.path === 'string'\n\t\t\t\t? await resolveFontBytes(opts.path, this._runtime, undefined, 'embedFont: `path`')\n\t\t\t\t: await resolveFontBytes(opts.data, this._runtime, { base64: true }, 'embedFont: `data` string')\n\n\t\t// Accumulate faces of one family under a single embeddedFont entry; a repeat\n\t\t// of the same typeface+style replaces the prior bytes (last call wins).\n\t\tlet font = this._embeddedFonts.find((f) => f.typeface === opts.typeface)\n\t\tif (!font) {\n\t\t\tfont = { typeface: opts.typeface, faces: [] }\n\t\t\tthis._embeddedFonts.push(font)\n\t\t}\n\t\tconst existing = font.faces.find((f) => f.slot === slot)\n\t\tif (existing) existing.bytes = bytes\n\t\telse font.faces.push({ slot, bytes })\n\t}\n\n\t/**\n\t * Measure how tall text wraps at a given width, using the **same** calibrated wrap\n\t * model the export-time autofit bake uses — so a layout-time prediction matches the\n\t * value `fit:'shrink'`/`'resize'` would bake. Synchronous: register the face's metrics\n\t * first with {@link TsPptx.registerFontMetrics} (lookup is sync).\n\t *\n\t * Lets a consumer size its own geometry before export — grow a card to fit its text,\n\t * reflow a grid, or detect overflow at layout time. Heights err **tall** (conservative),\n\t * so the returned height is ≥ what PowerPoint/LibreOffice render.\n\t * @param {string | TextProps[]} text - a string or run array (per-run options override the defaults in `opts`)\n\t * @param {MeasureTextOptions} opts - width (inches), font size/face (points), and spacing\n\t * @returns {TextMeasurement} laid-out height + line count + fit helpers\n\t * @example const m = pptx.measureText('Long heading…', { wIn: 3, fontSize: 18, fontFace: 'Aptos' })\n\t * @example if (pptx.measureText(runs, { wIn, fontSize, fontFace }).heightIn > cardHeightIn) growCard()\n\t */\n\tmeasureText(text: string | TextProps[], opts: MeasureTextOptions): TextMeasurement {\n\t\treturn this.familyAuthor('measureText')(text, opts)\n\t}\n\n\t/**\n\t * Convenience overflow check: `true` if `text` does not fit a box of inner size\n\t * `wIn`×`hIn` (inches) at full size. Because the model errs tall, this is a\n\t * **conservative** (slightly over-reporting) check — appropriate for a build-time\n\t * warning, not a hard gate. An unmeasurable (unnamed theme-default) face reports\n\t * `false` (no overflow) so the linter does not false-positive on faces it cannot measure.\n\t * @param {string | TextProps[]} text - a string or run array\n\t * @param {OverflowBoxOptions} opts - {@link MeasureTextOptions} plus the box inner height `hIn`\n\t * @returns {boolean} true if the text overflows the box\n\t */\n\toverflowsBox(text: string | TextProps[], opts: OverflowBoxOptions): boolean {\n\t\treturn this.familyAuthor('overflowsBox')(text, opts)\n\t}\n\n\t/**\n\t * Compute the per-cell geometry of a table laid out at `opts.x`/`y`/`w`, without\n\t * adding it to a slide — so a consumer can place images or shapes precisely over\n\t * cells. Column widths (cell `x`/`w`) are exact, derived from the same logic the\n\t * writer uses. Row heights (`y`/`h`) are exact when pinned by `rowH` (array or\n\t * scalar) or table `h`; an auto-height row is estimated with the same conservative\n\t * (tall) text model as {@link TsPptx.measureText} and flagged `heightExact:false`\n\t * (register the cell font via {@link TsPptx.registerFontMetrics} for an exact\n\t * estimate). Geometry is for a single, un-paginated table — `autoPage` paging is\n\t * not modeled.\n\t * @param {TableRow[]} rows - the same `rows` passed to `slide.addTable`\n\t * @param {TableProps} opts - the same table options (`x`, `y`, `w`, `colW`, `rowH`, `h`, …)\n\t * @returns {TableLayoutResult} per-cell rectangles (inches) plus overall table bounds\n\t * @example\n\t * const g = pptx.tableLayout(rows, { x: 1, y: 1, w: 8, colW: [2, 3, 3] })\n\t * const c = g.cells.find(c => c.row === 0 && c.col === 2)\n\t * slide.addImage({ path: 'logo.png', x: c.xIn, y: c.yIn, w: c.wIn, h: c.hIn })\n\t */\n\ttableLayout(rows: TableRow[], opts: TableProps): TableLayoutResult {\n\t\treturn this.familyAuthor('tableLayout')(rows, opts)\n\t}\n\n\t// EXPORT METHODS\n\n\t/**\n\t * Export the current presentation as portable ZIP bytes. Unlike the former\n\t * `stream()` method, this does not imply incremental output or convert the\n\t * archive to a Node `Buffer`: package assembly is synchronous and the returned\n\t * `Uint8Array` works unchanged in Node, browsers, and workers.\n\t * @param {WriteBaseProps} props - output properties\n\t * @returns {Promise<Uint8Array>} complete `.pptx` archive bytes\n\t */\n\tasync toBytes(props?: WriteBaseProps): Promise<Uint8Array> {\n\t\treturn (await writePackage(this.packageSource(), {\n\t\t\t...pickDefined(props ?? {}, ['compression', 'onMediaError']),\n\t\t\toutputType: 'uint8array',\n\t\t})) as Uint8Array\n\t}\n\n\t/**\n\t * Export the current Presentation as ZIP content with the selected type\n\t * @param {WriteProps} props output properties\n\t * @returns {Promise<string | ArrayBuffer | Blob | Uint8Array>} file content in selected type\n\t */\n\tasync write(props?: WriteProps): Promise<string | ArrayBuffer | Blob | Uint8Array> {\n\t\treturn await writePackage(\n\t\t\tthis.packageSource(),\n\t\t\tpickDefined(props ?? {}, ['compression', 'outputType', 'onMediaError'])\n\t\t)\n\t}\n\n\t/**\n\t * Assemble the current Presentation into its OOXML package parts WITHOUT zipping — the raw\n\t * `path → bytes` contents `write()` would compress into the `.pptx`. Use this to stream parts\n\t * into a custom container, inspect individual parts, or feed a pipeline that does its own\n\t * archiving. To produce a real `.pptx` file, use {@link write} / {@link writeFile} instead.\n\t *\n\t * The returned parts are byte-identical, per part, to what `write()` emits for the same deck,\n\t * and their order is the package's emission order. Both are a stability-guaranteed observable\n\t * contract: adding a new part in a later release is backward-compatible as long as existing\n\t * part paths and their relative order do not shift; renaming or reordering an existing part is\n\t * a breaking change. Each call returns fresh `Uint8Array` views over per-call buffers (a new\n\t * assembly runs each time), so callers may retain or transfer them without defensive copying.\n\t * @param {PartsProps} props - assembly options (`onMediaError` only; compression/output shape\n\t * are zip concerns that do not apply to unzipped parts)\n\t * @returns {Promise<PackagePart[]>} the package parts in emission order\n\t */\n\tasync toParts(props?: PartsProps): Promise<PackagePart[]> {\n\t\tconst parts = await buildPackageParts(this.packageSource(), { onMediaError: props?.onMediaError })\n\t\t// Drop the internal `store` (DEFLATE) hint — an fflate-era zip optimization, not an OOXML fact.\n\t\treturn parts.map(({ path, data }) => ({ path, data }))\n\t}\n\n\t/**\n\t * Export the current Presentation.\n\t * Write the generated presentation to disk (Node) or trigger a download (browser).\n\t * @param {WriteFileProps} props - output file properties\n\t * @returns {Promise<string>} the presentation name\n\t */\n\tasync writeFile(props?: WriteFileProps): Promise<string> {\n\t\tconst rawName = props?.fileName ?? 'Presentation.pptx'\n\t\tconst fileName = rawName.toLowerCase().endsWith('.pptx') ? rawName : `${rawName}.pptx`\n\n\t\t// `writeFileOutputType` is the archive type this runtime prefers where it has one (Node\n\t\t// asks for a Buffer); a runtime that states none leaves the key off, so `zipPackageParts`\n\t\t// applies its own default rather than being handed an `undefined` to interpret.\n\t\tconst writeProps: WriteProps = pickDefined(props ?? {}, ['compression', 'onMediaError'])\n\t\tsetOrClear(writeProps, 'outputType', this._runtime.writeFileOutputType ?? undefined)\n\t\tconst data = await writePackage(this.packageSource(), writeProps)\n\t\treturn await this._runtime.writeFile(fileName, data)\n\t}\n\n\t// PRESENTATION METHODS\n\n\t/**\n\t * Set a custom document property stored in `docProps/custom.xml`.\n\t * Calling with the same name replaces the existing value.\n\t * @param name - property name\n\t * @param value - string, integer/float number, boolean, or Date\n\t */\n\tsetCustomProperty(name: string, value: CustomPropertyValue): void {\n\t\tthis._customProperties = this._customProperties.filter((p) => p.name !== name)\n\t\tthis._customProperties.push({ name, value })\n\t}\n\n\t/**\n\t * Add a new Section to Presentation\n\t * @param {SectionProps} section - section properties\n\t * @example pptx.addSection({ title:'Charts' });\n\t */\n\taddSection(section: SectionProps): void {\n\t\tif (!section) {\n\t\t\twarn('section/missing-argument', 'addSection requires an argument')\n\t\t\treturn\n\t\t} else if (!section.title) {\n\t\t\twarn('section/missing-title', 'addSection requires a title')\n\t\t\treturn\n\t\t} else if (this._sections.some((sect) => sect.title === section.title)) {\n\t\t\twarn(\n\t\t\t\t'section/duplicate-title',\n\t\t\t\t`addSection: a section titled \"${section.title}\" already exists; ignoring duplicate`\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\tconst newSection: SectionInternalProps = {\n\t\t\t_type: 'user',\n\t\t\t_slides: [],\n\t\t\t_id: bracedGuid(),\n\t\t\ttitle: section.title,\n\t\t}\n\n\t\t// `order` counts from 1, as the option documents; the splice index is one less. It was\n\t\t// spliced in raw, so `order: 1` inserted second and `order: 0` -- falsy -- appended\n\t\t// without a word. An order past the end appends, which is what `splice` does anyway.\n\t\tif (section.order === undefined) {\n\t\t\tthis._sections.push(newSection)\n\t\t\treturn\n\t\t}\n\t\tif (!Number.isInteger(section.order) || section.order < 1) {\n\t\t\twarn(\n\t\t\t\t'section/invalid-order',\n\t\t\t\t`addSection: \"order\" must be a whole number of at least 1 (the first position); got ${String(section.order)}. Appending.`\n\t\t\t)\n\t\t\tthis._sections.push(newSection)\n\t\t\treturn\n\t\t}\n\t\tthis._sections.splice(section.order - 1, 0, newSection)\n\t}\n\n\t/**\n\t * Add a new Slide to Presentation\n\t * @param {AddSlideProps} options - slide options\n\t * @returns {Slide} the new Slide\n\t */\n\taddSlide(options?: AddSlideProps): Slide {\n\t\tconst masterTitle = options?.masterTitle ?? ''\n\t\tconst defLayout = this.#requireDefaultLayout()\n\t\tlet slideLayout: SlideLayoutInternal = {\n\t\t\t_name: defLayout.name,\n\t\t\t_presLayout: this.presLayout,\n\t\t\t_rels: [],\n\t\t\t_relsChart: [],\n\t\t\t_relsMedia: [],\n\t\t\t_slideNum: this._slides.length + 1,\n\t\t\t_slideObjects: [],\n\t\t}\n\n\t\t// A title that matches no master falls back to the default layout and says so, as a\n\t\t// `sectionTitle` that matches no section does below.\n\t\tif (masterTitle) {\n\t\t\tconst tmpLayout = this._slideLayouts.find((layout) => layout._name === masterTitle)\n\t\t\tif (tmpLayout) slideLayout = tmpLayout\n\t\t\telse\n\t\t\t\twarn(\n\t\t\t\t\t'slide/master-not-found',\n\t\t\t\t\t`addSlide: unable to find a slide master with title: \"${masterTitle}\"; using the default layout`\n\t\t\t\t)\n\t\t}\n\n\t\tconst newSlide: PresSlideInternal = new SlideBuilder({\n\t\t\taddSlide: this.addNewSlide,\n\t\t\tgetSlide: this.getSlide,\n\t\t\tgetSections: this.getSections,\n\t\t\tpresLayout: this.presLayout,\n\t\t\tauthors: this.#composition.authors,\n\t\t\tchildAuthors: this.#composition.children,\n\t\t\tsetSlideNum: this.setSlideNumber,\n\t\t\tslideId: this._slides.length + MIN_SLIDE_ID,\n\t\t\tslideRId: this._slides.length + 2,\n\t\t\tslideNumber: this._slides.length + 1,\n\t\t\tslideLayout,\n\t\t})\n\n\t\t// A: Add slide to pres\n\t\tthis._slides.push(newSlide)\n\n\t\t// B: Sections. A deck that uses sections at all has no place for a loose slide -- every\n\t\t// slide needs one -- so there are two ways in and one way out.\n\t\t//\n\t\t// The named section is tried first, and a title that matches nothing falls THROUGH to the\n\t\t// default handling rather than returning here. It used to warn and return, which produced\n\t\t// exactly the loose slide the branch below exists to prevent: one `addSection({ title:\n\t\t// 'One' })` and one `addSlide({ sectionTitle: 'Typo' })` left a slide in the deck and in no\n\t\t// section. This stays a warning rather than the throw `groupObjects` uses for its analogous\n\t\t// \"a name that matches nothing\", because the two failures differ in what is left of the\n\t\t// request: a group with no members is not a group, so there is nothing to place, while a\n\t\t// slide is a complete, renderable thing whose only open question is where it files. The\n\t\t// default section is a real answer to that question; there is no equivalent for the group.\n\t\tconst namedSection = options?.sectionTitle\n\t\t\t? this._sections.find((section) => section.title === options.sectionTitle)\n\t\t\t: undefined\n\t\tif (options?.sectionTitle && !namedSection)\n\t\t\twarn('slide/section-not-found', `addSlide: unable to find section with title: \"${options.sectionTitle}\"`)\n\n\t\tif (namedSection) namedSection._slides.push(newSlide)\n\t\telse if (this._sections.length > 0) {\n\t\t\tconst lastSect = this._sections[this._sections.length - 1]\n\n\t\t\t// CASE 1: The latest section is a default type - just add this one\n\t\t\tif (lastSect?._type === 'default') lastSect._slides.push(newSlide)\n\t\t\t// CASE 2: There latest section is NOT a default type - create the defualt, add this slide\n\t\t\telse {\n\t\t\t\tthis._sections.push({\n\t\t\t\t\ttitle: `Default-${this._sections.filter((sect) => sect._type === 'default').length + 1}`,\n\t\t\t\t\t_type: 'default',\n\t\t\t\t\t_id: bracedGuid(),\n\t\t\t\t\t_slides: [newSlide],\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\treturn newSlide\n\t}\n\n\t/**\n\t * Create a custom Slide Layout in any size\n\t * @param {PresLayout} layout - layout properties\n\t * @example pptx.defineLayout({ name:'A3', width:16.5, height:11.7 });\n\t */\n\tdefineLayout(layout: PresLayout): void {\n\t\t// @see https://support.office.com/en-us/article/Change-the-size-of-your-slides-040a811c-be43-40b9-8d04-0de5ed79987e\n\t\t//\n\t\t// Two things here cannot be recovered, and both throw. A non-object used to warn and then\n\t\t// throw a raw `TypeError` on the next line's `layout.name`, breaking the contract that\n\t\t// every failure this library raises is a `TsPptxError`. A missing `name` is the same kind\n\t\t// of unrecoverable: the registration is keyed on it, so warning and carrying on registered\n\t\t// a layout literally called `\"undefined\"` -- selectable as `pptx.layout = 'undefined'`,\n\t\t// carrying `name: undefined` into `<p:sldSz>`, and silently overwritten by the next\n\t\t// unnamed `defineLayout`. There is nothing to key on, so there is nothing to recover.\n\t\tif (!layout || typeof layout !== 'object')\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'layout/invalid-definition',\n\t\t\t\t'defineLayout requires an object `{ name, width, height }` with the dimensions in inches'\n\t\t\t)\n\t\tif (!layout.name)\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'layout/invalid-definition',\n\t\t\t\t'defineLayout requires a non-empty `name`: it is the key the layout is registered and selected under'\n\t\t\t)\n\n\t\t// The two sides are checked independently, because they are independently true facts about\n\t\t// the input: a `{ width: '10', height: '7.5' }` has two things wrong with it and used to be\n\t\t// told about one. Within a side the two arms ARE exclusive -- an absent width is not also\n\t\t// the wrong type -- so those stay an `else if`.\n\t\t//\n\t\t// `=== undefined` rather than `!width`: a stated `0` is a value out of range, not an absent\n\t\t// one, and `layoutSideInches` already reports it as such by clamping to the 1in minimum\n\t\t// with its own diagnostic. Reading `0` as missing produced a second, wrong message saying\n\t\t// the caller had not passed a width they had in fact passed.\n\t\tif (layout.width === undefined) warn('layout/invalid-definition', 'defineLayout requires `width`')\n\t\telse if (typeof layout.width !== 'number')\n\t\t\twarn('layout/invalid-definition', 'defineLayout `width` should be a number (inches)')\n\t\tif (layout.height === undefined) warn('layout/invalid-definition', 'defineLayout requires `height`')\n\t\telse if (typeof layout.height !== 'number')\n\t\t\twarn('layout/invalid-definition', 'defineLayout `height` should be a number (inches)')\n\n\t\tthis.LAYOUTS[layout.name] = {\n\t\t\tname: layout.name,\n\t\t\twidth: inchesToEmu(layoutSideInches(layout.width, 'width')),\n\t\t\theight: inchesToEmu(layoutSideInches(layout.height, 'height')),\n\t\t}\n\t}\n\n\t/**\n\t * Create a new slide master [layout] for the Presentation\n\t * @param {SlideMasterProps} props - layout properties\n\t */\n\tdefineSlideMaster(props: SlideMasterProps): void {\n\t\t// deep clone the props object to avoid mutating the original object.\n\t\t// structuredClone preserves the `SlideMasterProps` type (unlike JSON round-tripping, which widens to `any`).\n\t\tconst propsClone = structuredClone(props)\n\t\tif (!propsClone.title)\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'master/missing-title',\n\t\t\t\t'defineSlideMaster() object argument requires a `title` value.'\n\t\t\t)\n\n\t\tconst newLayout: SlideLayoutInternal = {\n\t\t\t_margin: propsClone.margin || DEF_SLIDE_MARGIN_IN,\n\t\t\t// Kept RAW (unescaped) here, as `objectName` is: `_name`\n\t\t\t// doubles as the lookup key `addSlide({masterTitle})` matches against the caller's raw\n\t\t\t// `title` string (see the `layout._name === masterTitle` comparisons in this file).\n\t\t\t// Escaping it here would break that match for any title containing `&`/`<`/`\"`. It's\n\t\t\t// escaped once at emission instead -- see `slideObjectToXml` in gen/slide/object.ts.\n\t\t\t_name: propsClone.title,\n\t\t\t_presLayout: this.presLayout,\n\t\t\t_rels: [],\n\t\t\t_relsChart: [],\n\t\t\t_relsMedia: [],\n\t\t\t_slide: null,\n\t\t\t_slideNum: 1000 + this._slideLayouts.length + 1,\n\t\t\t_slideNumberProps: propsClone.slideNumber || null,\n\t\t\t_slideObjects: [],\n\t\t\tbackground: propsClone.background,\n\t\t}\n\n\t\t// STEP 1: Create the Slide Master/Layout\n\t\tcreateSlideMaster(propsClone, newLayout, this.#composition.children)\n\n\t\t// STEP 1b: Master text styles (<p:txStyles>) live on the single shared slide master, not per-layout.\n\t\t// Merge each provided group (title/body/other) onto the master, last-call-wins (deck-wide).\n\t\tif (propsClone.textStyles && typeof propsClone.textStyles === 'object') {\n\t\t\tthis._masterSlide._txStyles = { ...this._masterSlide._txStyles, ...propsClone.textStyles }\n\t\t}\n\n\t\t// STEP 2: Add it to layout defs\n\t\tthis._slideLayouts.push(newLayout)\n\n\t\t// STEP 3: Add background (image data/path must be captured before the package is built)\n\t\tif (propsClone.background) addBackgroundDefinition(propsClone.background, newLayout)\n\n\t\t// STEP 4: Add slideNumber to master slide (if any)\n\t\tif (newLayout._slideNumberProps && !this._masterSlide._slideNumberProps)\n\t\t\tthis._masterSlide._slideNumberProps = newLayout._slideNumberProps\n\t}\n}\n","/**\n * ts-pptx: the construct families every presentation carries\n *\n * The core tier. A composed presentation gets these whether it asks for them or not, so\n * `createPresentation()` with no families still authors text, shapes, images, groups and speaker\n * notes -- a deck, rather than a slide-shaped hole.\n *\n * The line is a judgement rather than a measurement: these five are what \"a slide\" means to most\n * callers, they are cheap, and a surface that made someone compose `text` before it could write a\n * word would be a worse default than one that costs a few kilobytes more. A family is core when\n * leaving it out would make the result something other than a deck; everything else is asked for.\n */\n\nimport { groupFamily } from './group.js'\nimport { imageFamily } from './image.js'\nimport { notesFamily } from './notes.js'\nimport { shapeFamily } from './shape.js'\nimport { textFamily } from './text.js'\nimport type { ConstructFamily } from './shared.js'\n\n/** Every family a composed presentation carries without being asked. */\nexport const CORE_CONSTRUCT_FAMILIES = [\n\ttextFamily,\n\tshapeFamily,\n\timageFamily,\n\tgroupFamily,\n\tnotesFamily,\n] as const satisfies readonly ConstructFamily[]\n","/**\n * ts-pptx: composing a presentation from the construct families it actually needs\n *\n * The body behind each entry's `createPresentation`, and the types that describe what comes back.\n * It lives beside `entry-surface.ts` for the same reason that does: `index.ts`, `node.ts` and\n * `browser.ts` differ only in the runtime adapter they hand down, so the shared half is written\n * once and cannot drift between them.\n *\n * There is no second lean entry point, deliberately. A `pptx-ts/core` would need the same\n * three-condition treatment `.` gets, so three more source entries, three more `dist` files, three\n * more budget rows and a second place for the entries to diverge -- and it would buy nothing that\n * export-level shaking does not already give. `pptx-ts` is an intermediate module in a consumer's\n * graph: a program that imports only `createPresentation` drops the `TsPptx` class beside it and,\n * with it, every family that class names.\n */\n\nimport PresentationCore from './presentation.js'\nimport type { RuntimeAdapter } from './runtime/types.js'\nimport { CORE_CONSTRUCT_FAMILIES } from './families/core.js'\nimport type {\n\tBoundPresentationAuthor,\n\tConstructFamily,\n\tPresentationAuthors,\n\tSlideAuthorMethod,\n} from './families/shared.js'\nimport type { CHART_NAME } from './enums.js'\nimport type { AddSlideProps, ChartMulti, ChartOpts, OptsChartData } from './types/index.js'\nimport type { Slide } from './types/slide.js'\n\n/** Turn a union into the intersection of its members. */\ntype UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never\n\n/** One method's public signature, re-pointed at the slide type the caller actually holds. */\ntype Chained<F, S> = F extends (...args: infer A) => unknown ? (...args: A) => S : never\n\n/**\n * The overloaded methods, re-pointed by hand.\n *\n * `Chained` reads one call signature, and TypeScript hands a conditional type the *last* overload,\n * so `addChart` would come out taking a combo array and nothing else. There is one such method, and\n * writing it out is cheaper than a generic that unrolls an arbitrary overload list.\n */\ninterface ChainedOverloads<S> {\n\taddChart: {\n\t\t(data: OptsChartData[], options: ChartOpts & { type: CHART_NAME }): S\n\t\t(charts: ChartMulti[], options?: ChartOpts): S\n\t}\n}\n\n/** The slide methods a family list supplies between them. */\nexport type SlideMethodsOf<Fs extends readonly ConstructFamily[]> = Extract<\n\tkeyof UnionToIntersection<Extract<Fs[number], { authors: object }>['authors']>,\n\tSlideAuthorMethod\n>\n\n/** The presentation methods a family list supplies between them. */\nexport type PresentationMethodsOf<Fs extends readonly ConstructFamily[]> = Extract<\n\tkeyof UnionToIntersection<Extract<Fs[number], { presentationAuthors: object }>['presentationAuthors']>,\n\tkeyof PresentationAuthors\n>\n\n/**\n * A slide from a composed presentation: everything a slide is, plus exactly the authoring methods\n * `M` names.\n *\n * Parameterized by method name rather than by the family list, so what an editor shows a caller is\n * the list of calls this slide takes. The methods answer this same type, so a chain cannot widen\n * back to the full surface and offer a call the deck was not composed for.\n */\nexport type ComposedSlide<M extends SlideAuthorMethod> = Omit<Slide, SlideAuthorMethod> & {\n\t[K in M]: K extends keyof ChainedOverloads<unknown>\n\t\t? ChainedOverloads<ComposedSlide<M>>[K]\n\t\t: Chained<Slide[K], ComposedSlide<M>>\n}\n\n/** Every presentation method a family can supply, as the presentation exposes it. */\ntype PresentationFamilyMethods = {\n\t[K in keyof PresentationAuthors]-?: BoundPresentationAuthor<NonNullable<PresentationAuthors[K]>>\n}\n\n/**\n * A composed presentation: the whole deck-level API, with `addSlide` answering a slide that carries\n * only `M`, and only the presentation-level methods `P` names.\n */\nexport type ComposedPresentation<M extends SlideAuthorMethod, P extends keyof PresentationAuthors> = Omit<\n\tPresentationCore,\n\t'addSlide' | keyof PresentationAuthors\n> &\n\tPick<PresentationFamilyMethods, P> & { addSlide: (options?: AddSlideProps) => ComposedSlide<M> }\n\n/** What `createPresentation` takes: the families this deck needs beyond the core tier. */\nexport interface ComposeOptions<Fs extends readonly ConstructFamily[]> {\n\t/** Construct families to compose in, from `pptx-ts/families`. Listing one twice is harmless. */\n\tuse?: Fs\n}\n\n/** What a family list composes to once the core tier is in front of it. */\nexport type Composed<Fs extends readonly ConstructFamily[]> = ComposedPresentation<\n\tSlideMethodsOf<[...typeof CORE_CONSTRUCT_FAMILIES, ...Fs]>,\n\tPresentationMethodsOf<[...typeof CORE_CONSTRUCT_FAMILIES, ...Fs]>\n>\n\n/**\n * Build a presentation that carries the core tier plus `opts.use`, on the given runtime adapter.\n *\n * The cast is the one place this file is not type-safe, and it is unavoidable: the class is one\n * class whatever it was composed with, while the type says which of its methods are actually\n * there. The two are kept honest by the runtime, which raises `family/not-composed` naming the\n * family for any method the type has already refused.\n */\nexport function composePresentation<const Fs extends readonly ConstructFamily[]>(\n\truntime: RuntimeAdapter,\n\topts?: ComposeOptions<Fs>\n): Composed<Fs> {\n\treturn new PresentationCore(runtime, [...CORE_CONSTRUCT_FAMILIES, ...(opts?.use ?? [])]) as unknown as Composed<Fs>\n}\n","/**\n * ts-pptx: the construct families the three main entries are composed with\n *\n * The full authoring surface, as a list: `index.ts`, `node.ts` and `browser.ts` each compose every\n * family, so `TsPptx` authors everything it ever has; the browser entry adds the table family's\n * live-DOM half on top, because that one needs a `document` to read. The families a *composed*\n * presentation gets without asking are the shorter list in `families/core.ts`.\n *\n * It lives beside `entry-surface.ts`, and for the same reason: the three entries publish one API\n * and differ only in the runtime adapter they hand down, so what they are composed with is one\n * list rather than three that can drift.\n *\n * Naming a family here is what puts its code in the graph -- a named import inside a reachable\n * function body is retained unconditionally. That is the whole point of the seam\n * (`families/shared.ts`): a program composed with fewer families links fewer of them.\n */\n\nimport { animationsFamily } from './families/animations.js'\nimport { chartFamily } from './families/chart.js'\nimport { commentsFamily } from './families/comments.js'\nimport { connectorFamily } from './families/connector.js'\nimport { measureFamily } from './families/measure.js'\nimport { mediaFamily } from './families/media.js'\nimport { model3dFamily } from './families/model3d.js'\nimport { oleFamily } from './families/ole.js'\nimport { tableFamily } from './families/table.js'\nimport { zoomFamily } from './families/zoom.js'\nimport { groupFamily } from './families/group.js'\nimport { imageFamily } from './families/image.js'\nimport { notesFamily } from './families/notes.js'\nimport { shapeFamily } from './families/shape.js'\nimport { textFamily } from './families/text.js'\nimport type { ConstructFamily } from './families/shared.js'\n\n/**\n * Every construct family the library can author with: the core tier, plus everything a composed\n * presentation would have to ask for. Built from `CORE_CONSTRUCT_FAMILIES` rather than restating\n * it, so the two lists cannot disagree about whether a family exists.\n */\nexport const ALL_CONSTRUCT_FAMILIES: readonly ConstructFamily[] = /* @__PURE__ */ Object.freeze([\n\ttextFamily,\n\tshapeFamily,\n\timageFamily,\n\tgroupFamily,\n\tnotesFamily,\n\tanimationsFamily,\n\tchartFamily,\n\tcommentsFamily,\n\tconnectorFamily,\n\tmeasureFamily,\n\tmediaFamily,\n\tmodel3dFamily,\n\toleFamily,\n\ttableFamily,\n\tzoomFamily,\n])\n","/**\n * The parts of a runtime adapter that are not runtime-specific.\n *\n * `fetch`, `btoa` and `TextEncoder` exist in Node, in every browser, and in the edge/worker\n * runtimes the neutral adapter serves, so the remote-load paths were the same code in all three\n * adapters — byte-identical in two of them and an inline branch in the third. What is genuinely\n * per-runtime stays in each adapter: `node:fs`, `FileReader`, the canvas rasterizer, the\n * `<a download>` writer.\n *\n * Nothing here touches a host global beyond `fetch`.\n */\n\nimport { IMG_SVG_PLACEHOLDER } from '../media/placeholders.js'\nimport { MediaError } from '../errors.js'\nimport { bytesToBase64 } from '../media/base64.js'\nimport type { SlideRelMedia } from '../types/internal.js'\n\n/**\n * Whether `source` names something to `fetch` rather than something to read from a filesystem.\n *\n * A real scheme test, not `source.startsWith('http')`. That prefix matched a *relative path* —\n * `httpdocs/logo.png`, `http-icons/x.svg` — and sent it to `fetch`, which then failed with a\n * fetch error naming a file that exists on disk. It was also case-sensitive, so\n * `HTTPS://example.com/f.ttf` missed and went to `fs.readFile`.\n *\n * Only `http:` and `https:` count. A `file:` or `data:` URL falls through to the adapter's\n * local branch, where it fails — the same as before this was tightened, and deliberately left\n * that way: making either work is a feature with its own decisions (what a `file:` URL means\n * off Node, whether a `data:` URL should bypass loading entirely), not a side effect of fixing\n * a prefix test.\n */\nexport function isRemote(source: string): boolean {\n\tconst scheme = /^([a-z][a-z0-9+.-]*):/i.exec(source)?.[1]?.toLowerCase()\n\treturn scheme === 'http' || scheme === 'https'\n}\n\n/** Fetch a font file into raw bytes for `registerFontMetrics`. */\nexport async function fetchFontBytes(source: string): Promise<Uint8Array> {\n\tconst response = await fetch(source)\n\tif (!response.ok) throw new MediaError('font/fetch-failed', `Unable to load font (fetch): ${source}`)\n\treturn new Uint8Array(await response.arrayBuffer())\n}\n\n/**\n * Fetch a media file as raw base64 (no `data:` prefix) — see {@link RuntimeAdapter.loadMedia}\n * for why both encodings are accepted.\n *\n * Encodes through `bytesToBase64` rather than `Buffer`, so the same function serves a runtime\n * that has no `Buffer`. The Node adapter still uses `Buffer` on its *filesystem* branch, where\n * it is both available and faster on a large payload.\n */\nexport async function fetchMediaBase64(path: string): Promise<string> {\n\tconst response = await fetch(path)\n\tif (!response.ok) throw new MediaError('media/fetch-failed', `Unable to load image (fetch): ${path}`)\n\treturn bytesToBase64(new Uint8Array(await response.arrayBuffer()))\n}\n\n/**\n * The SVG-preview fallback for a runtime with no canvas: stamp the placeholder PNG.\n *\n * An SVG placed on a slide needs a raster fallback beside it for viewers that will not render\n * the SVG. Rasterizing needs a canvas, which only the browser adapter has, so everywhere else\n * the fallback is a fixed placeholder image rather than a missing part. That is this runtime's\n * output rather than a failure, so it resolves `null`: reporting one would fail every SVG under\n * the default `onMediaError`.\n */\nexport async function placeholderSvgPreview(rel: SlideRelMedia): Promise<MediaError | null> {\n\trel.data = IMG_SVG_PLACEHOLDER\n\treturn null\n}\n","/**\n * ts-pptx: named clip silhouettes for images\n *\n * A `ClipShape` is declarative data — a named silhouette plus its options — and {@link clipPath}\n * resolves it to the freeform `points` path `addImage` emits as the `<a:custGeom>` clip mask on\n * the `<p:pic>`. Paired with `sizing: { type: 'cover' }` (an `<a:srcRect>` crop) it reproduces\n * what a PowerPoint *picture placeholder* does — a layout `custGeom` clipping an inherited\n * blipFill — but standalone, with no placeholder involved.\n *\n * These are silhouettes recurring often enough in real decks to be worth naming; hand-authored\n * `points` remain available for anything else. Nothing here is theme- or brand-aware: which\n * silhouette to use, and which edge it sits flush to, belongs to the caller.\n *\n * ## The coordinate trap\n *\n * Coordinates come back in the image box's OWN inch space (`0..w`, `0..h`), because `custGeom`\n * points expressed as `%` resolve against the SLIDE, not the box. A box-relative silhouette must\n * therefore be emitted in inches already scaled to the box, which is why {@link clipPath} takes\n * the box size: the fractions below are multiplied by `w` / `h` at build time, so one silhouette\n * scales with whatever region it is handed. Authoring the same shape as percentages would put\n * the clip in the wrong place on every box that is not the full slide.\n */\n\nimport { checkEnumOrThrow } from './ooxml/check-enum.js'\nimport type { GeometryPoint } from './types/index.js'\n\n/**\n * Which edge of the box is the half-disc's FLAT side; the arc bulges toward the opposite edge.\n * `'right'` = flat right edge, arc bulging left.\n */\nexport type FlatSide = 'left' | 'right'\n\n/**\n * Which half-disc proportion to trace. Both are flat-on-one-edge, bulging half-discs whose arc\n * reaches the opposite edge near mid-height; they differ only in how far the arc reaches.\n * - `'deep'` — the arc spans about 32% of the box width, symmetric about mid-height (the default).\n * - `'shallow'` — the arc spans about 13%, slightly asymmetric, with its apex just below mid-height.\n */\nexport type HalfDiscPreset = 'deep' | 'shallow'\n\n/** A named clip silhouette, resolved to a `points` path by {@link clipPath}. */\nexport type ClipShape =\n\t/**\n\t * A rectangle with one side replaced by an elliptical arc that bulges toward the opposite\n\t * edge, reaching it near mid-height — the \"D\" a picture placeholder cuts on a cover slide.\n\t */\n\t{ kind: 'half-disc'; flat: FlatSide; preset?: HalfDiscPreset }\n\n/**\n * A half-disc as box fractions, flat side on the RIGHT (`x = 1`), the arc bulging LEFT toward\n * `x = 0` near mid-height. Two cubic Béziers trace the half-ellipse: the path runs\n * top-flat-corner → top-right → bottom-right → bottom-flat-corner → bottom tip, cubic up to the\n * mid-left apex, cubic back to the top tip, then closes.\n *\n * Each preset spells out every fraction rather than sharing a mirrored `topEdgeX`, because the\n * presets are independent freeforms — the shallow one is asymmetric top-to-bottom, so a\n * symmetric parameterization could not express it without changing its shape.\n */\ninterface HalfDiscSpec {\n\t/** x where the TOP edge departs the flat side toward the arc. */\n\ttopEdgeX: number\n\t/** x where the BOTTOM edge departs the flat side (may differ from the top). */\n\tbotEdgeX: number\n\t/** x where the arc leaves the top edge. */\n\ttipTopX: number\n\t/** y where the arc leaves the top edge. */\n\ttipTopY: number\n\t/** x where the arc leaves the bottom edge. */\n\ttipBotX: number\n\t/** y where the arc leaves the bottom edge. */\n\ttipBotY: number\n\t/** y of the bulge apex (at `x = 0`). */\n\tapexY: number\n\t/** Bottom-segment controls: from the bottom tip, cubic to the apex. */\n\tc1b: { x: number; y: number }\n\tc2b: { x: number; y: number }\n\t/** Top-segment controls: from the apex, cubic back to the top tip. */\n\tc1t: { x: number; y: number }\n\tc2t: { x: number; y: number }\n}\n\n/** `deep` — symmetric top/bottom, apex at mid-height. */\nconst DEEP_DISC: HalfDiscSpec = {\n\ttopEdgeX: 0.31788,\n\tbotEdgeX: 0.31788,\n\ttipTopX: 0.30061,\n\ttipTopY: 0.01078,\n\ttipBotX: 0.30061,\n\ttipBotY: 0.98922,\n\tapexY: 0.5,\n\tc1b: { x: 0.11594, y: 0.86833 },\n\tc2b: { x: 0.0, y: 0.69392 },\n\tc1t: { x: 0.0, y: 0.30609 },\n\tc2t: { x: 0.11594, y: 0.13167 },\n}\n\n/** `shallow` — a slightly asymmetric top/bottom inset and an apex just below mid-height. */\nconst SHALLOW_DISC: HalfDiscSpec = {\n\ttopEdgeX: 0.12611,\n\tbotEdgeX: 0.11128,\n\ttipTopX: 0.09976,\n\ttipTopY: 0.05448,\n\ttipBotX: 0.09976,\n\ttipBotY: 0.97617,\n\tapexY: 0.51533,\n\tc1b: { x: 0.03522, y: 0.83247 },\n\tc2b: { x: 0.0, y: 0.67725 },\n\tc1t: { x: 0.0, y: 0.3534 },\n\tc2t: { x: 0.03522, y: 0.19818 },\n}\n\nconst HALF_DISC: Record<HalfDiscPreset, HalfDiscSpec> = { deep: DEEP_DISC, shallow: SHALLOW_DISC }\n\n/** The values each {@link ClipShape} field takes, for refusing one a JavaScript caller got wrong. */\nconst CLIP_KINDS: readonly ClipShape['kind'][] = ['half-disc']\nconst FLAT_SIDES: readonly FlatSide[] = ['left', 'right']\nconst HALF_DISC_PRESETS = Object.keys(HALF_DISC) as HalfDiscPreset[]\n\n/**\n * Half-disc clip path for a `w × h` box. Authored flat-right; `flat: 'left'` mirrors `x → 1 - x`.\n */\nfunction halfDisc(w: number, h: number, flat: FlatSide, preset: HalfDiscPreset): GeometryPoint[] {\n\tconst s = HALF_DISC[preset]\n\tconst fx = flat === 'left' ? (x: number): number => (1 - x) * w : (x: number): number => x * w\n\tconst fy = (y: number): number => y * h\n\treturn [\n\t\t{ x: fx(s.topEdgeX), y: fy(0), moveTo: true },\n\t\t{ x: fx(1), y: fy(0) },\n\t\t{ x: fx(1), y: fy(1) },\n\t\t{ x: fx(s.botEdgeX), y: fy(1) },\n\t\t{ x: fx(s.tipBotX), y: fy(s.tipBotY) },\n\t\t{\n\t\t\tx: fx(0),\n\t\t\ty: fy(s.apexY),\n\t\t\tcurve: { type: 'cubic', x1: fx(s.c1b.x), y1: fy(s.c1b.y), x2: fx(s.c2b.x), y2: fy(s.c2b.y) },\n\t\t},\n\t\t{\n\t\t\tx: fx(s.tipTopX),\n\t\t\ty: fy(s.tipTopY),\n\t\t\tcurve: { type: 'cubic', x1: fx(s.c1t.x), y1: fy(s.c1t.y), x2: fx(s.c2t.x), y2: fy(s.c2t.y) },\n\t\t},\n\t\t{ close: true },\n\t]\n}\n\n/**\n * Resolve a {@link ClipShape} to a freeform `points` path filling a `w × h` box, ready to hand\n * to `addImage({ points })`.\n *\n * `w`/`h` are the image box's size **in inches** and must match the `w`/`h` the picture is drawn\n * at — the path is emitted in the box's own coordinate space, not normalized (see the module\n * note above).\n * @param {ClipShape} shape - the named silhouette and its options\n * @param {number} w - image box width (inches)\n * @param {number} h - image box height (inches)\n * @returns {GeometryPoint[]} the freeform path, for `addImage({ points })`\n * @throws {InvalidOptionError} `clip/invalid-shape` when `kind`, `flat` or `preset` is not one the\n * silhouette names. From JavaScript an unknown preset used to fail reading a field off\n * `undefined`, an unknown kind returned nothing and an unknown flat side traced the right-flat path.\n * @example\n * const w = 5.22, h = 7.5\n * slide.addImage({\n * path: 'cover.jpg', x: 0, y: 0, w, h,\n * points: clipPath({ kind: 'half-disc', flat: 'right' }, w, h),\n * sizing: { type: 'cover' }, // center-crop the photo into the \"D\"\n * })\n */\nexport function clipPath(shape: ClipShape, w: number, h: number): GeometryPoint[] {\n\tconst kind = checkEnumOrThrow(String(shape?.kind), CLIP_KINDS, 'clipPath `kind`', 'clip/invalid-shape')\n\tswitch (kind) {\n\t\tcase 'half-disc':\n\t\t\treturn halfDisc(\n\t\t\t\tw,\n\t\t\t\th,\n\t\t\t\tcheckEnumOrThrow(shape.flat, FLAT_SIDES, 'clipPath `flat`', 'clip/invalid-shape'),\n\t\t\t\tcheckEnumOrThrow(shape.preset ?? 'deep', HALF_DISC_PRESETS, 'clipPath `preset`', 'clip/invalid-shape')\n\t\t\t)\n\t}\n}\n","/**\n * Text types: the `TextBaseProps` paragraph/run contract shared by text, table cells and charts;\n * `TextPropsOptions`/`TextProps`; measurement and layout results; notes and comments.\n *\n * Re-exported by `./index.js`, which is the import site for the rest of `src/`.\n */\nimport type { SHAPE_NAME } from '../enums.js'\nimport type {\n\tTEXT_AUTONUM_SCHEMES,\n\tTEXT_CAPS_TYPES,\n\tTEXT_STRIKE_TYPES,\n\tTEXT_TAB_ALIGN_TYPES,\n\tTEXT_UNDERLINE_TYPES,\n\tTextShapeType,\n\tTextVerticalType,\n} from '../ooxml/st-enums.js'\nimport type {\n\tColor,\n\tDataOrPathProps,\n\tGeometryPoint,\n\tHAlign,\n\tHexColor,\n\tMargin,\n\tPositionProps,\n\tTextVertType,\n\tVAlign,\n} from './core.js'\nimport type { ShapeAdjustValue } from './shape.js'\nimport type { ObjectNameProps } from './object.js'\nimport type { FillOption, HyperlinkProps, ShadowProps, ShapeLineProps } from './style.js'\n\n/**\n * A drawn bullet: the object arm of {@link TextPropsOptions.bullet}.\n *\n * Named rather than left inline so a caller can build one as a variable and so the two\n * relationship ids `addText()` stamps on it have somewhere off the public surface to live\n * (`TextBulletPropsInternal`).\n */\nexport interface TextBulletProps {\n\t/**\n\t * Bullet type\n\t * @default bullet\n\t */\n\ttype?: 'bullet' | 'number'\n\t/**\n\t * Bullet character code (unicode)\n\t * @example '25BA' // 'BLACK RIGHT-POINTING POINTER' (U+25BA)\n\t */\n\tcharacterCode?: string\n\t/**\n\t * Bullet glyph font typeface (`<a:buFont/>`), e.g. for symbol-font bullets\n\t * @example 'Wingdings' // render `characterCode` using the Wingdings font\n\t */\n\tfontFace?: string\n\t/**\n\t * Bullet glyph size as a percentage of the run's text size (25–400)\n\t * @default 100\n\t * @example 80 // bullet glyph is 80% of the text size\n\t */\n\tsize?: number\n\t/**\n\t * Indentation (space between bullet and text) (points)\n\t * @default 27 // DEF_BULLET_MARGIN\n\t * @example 10 // Indents text 10 points from bullet\n\t */\n\tindent?: number\n\t/**\n\t * Number type: any `ST_TextAutonumberScheme` (`a:buAutoNum/@type`)\n\t * @example 'romanLcParenR' // roman numerals lower-case with paranthesis right\n\t */\n\tnumberType?: (typeof TEXT_AUTONUM_SCHEMES)[number]\n\t/**\n\t * Number bullets start at\n\t * @default 1\n\t * @example 10 // numbered bullets start with 10\n\t */\n\tnumberStartAt?: number\n\t/**\n\t * Image to use as the bullet glyph (\"picture bullet\", `<a:buBlip>`)\n\t * - supply an image `path` (filesystem/URL) or base64 `data` (same forms as `addImage()`)\n\t * - raster formats (PNG/JPG/GIF) and SVG are supported; use `size` to scale relative to the text height\n\t * - SVG bullets embed a PNG preview plus the SVG (the same dual-rel handling as `addImage()`)\n\t * - takes precedence over `type`/`characterCode` when set\n\t * @example image: { path: 'images/star.png' }\n\t * @example image: { data: 'image/png;base64,iVBOR...' }\n\t * @example image: { path: 'images/star.svg' }\n\t */\n\timage?: { path?: string; data?: string }\n\t/**\n\t * Bullet glyph color (separate from the text run color)\n\t * @example 'FF0000' // red bullet\n\t */\n\tcolor?: HexColor\n}\n\n// used by: chart, slide, table, text\nexport interface TextBaseProps {\n\t/**\n\t * Horizontal alignment\n\t *\n\t * When a shape's text is an array of runs, set this on **every run** of a paragraph.\n\t * {@link breakLine} is not the only paragraph boundary: two adjacent runs whose `align`\n\t * differs start a new one, so stating it on the opening run alone splits the paragraph in\n\t * two. That is the mirror of {@link bullet}, {@link paraMarginLeft} and {@link paraIndent},\n\t * which are read from the opening run only. Neither mistake changes the run count — the\n\t * only symptom is a differently shaped paragraph, with no error.\n\t * @default 'left'\n\t */\n\talign?: HAlign\n\t/**\n\t * Bold style\n\t * @default false\n\t */\n\tbold?: boolean\n\t/**\n\t * Add a line-break\n\t * @default false\n\t */\n\tbreakLine?: boolean\n\t/**\n\t * Preset text warp / WordArt shape (`<a:bodyPr><a:prstTxWarp prst=\"..\">`), which\n\t * bends the text along a preset path (arch, circle, wave, …) — the whole\n\t * `ST_TextShapeType` set.\n\t * @example 'textArchUp' // bend text along an upward arch (e.g. a label following a ring/arc)\n\t * @example 'textCircle'\n\t */\n\ttextWarp?: TextShapeType\n\t/**\n\t * Add standard or custom bullet\n\t * - use `true` for standard bullet\n\t * - pass object options for custom bullet\n\t * - `false` (and omitting the option) is the *explicit off*: it writes `<a:buNone/>`\n\t * plus `marL=\"0\" indent=\"0\"`, which overrides whatever bullet the layout's or\n\t * master's list style sets for this level\n\t * - `'inherit'` states nothing at all — no bullet child and no margin attributes — so\n\t * the list style keeps reaching the paragraph. This is the one state omission\n\t * cannot spell, because omitting the option means `false` here for compatibility\n\t *\n\t * The margins are only a *default* of the bullet state: {@link paraMarginLeft} and\n\t * {@link paraIndent} state `@marL`/`@indent` independently in any of the three, including\n\t * an inherited margin under a drawn bullet.\n\t *\n\t * When a shape's text is an array of runs, state this on the **opening run only**. A run\n\t * that draws a bullet starts a new paragraph by itself, so repeating it — the placement\n\t * that {@link align} requires — turns one three-run paragraph into three one-run\n\t * paragraphs. A paragraph takes its properties from its first run.\n\t * @default false\n\t */\n\tbullet?: boolean | 'inherit' | TextBulletProps\n\t/**\n\t * Text capitalization (`a:rPr/@cap`, `ST_TextCapsType`)\n\t * - `'all'` = ALL CAPS\n\t * - `'small'` = Small Caps\n\t * - `'none'` = the *explicit off*: it writes `cap=\"none\"`, which overrides a capitalization\n\t * the run would otherwise inherit. Omitting the option states nothing and lets that\n\t * inheritance stand\n\t * - PowerPoint: Font > Effects > All Caps / Small Caps\n\t * @default (unset) inherit\n\t */\n\tcaps?: (typeof TEXT_CAPS_TYPES)[number]\n\t/**\n\t * Text color\n\t * - `HexColor` or `ThemeColor`\n\t * - MS-PPT > Format Shape > Text Options > Text Fill & Outline > Text Fill > Color\n\t * @example 'FF0000' // hex color (red)\n\t * @example SchemeColor.text1 // Theme color (Text1)\n\t */\n\tcolor?: Color\n\t/**\n\t * Font face name\n\t *\n\t * Applied to the Latin (`<a:latin>`) and complex-script (`<a:cs>`) font slots, matching\n\t * how PowerPoint writes a font picked from the UI. The East Asian slot (`<a:ea>`) is left\n\t * to inherit from the theme unless `fontFaceEA` is set — forcing a Latin-only face into the\n\t * East Asian slot duplicates/ghosts text in Office 365.\n\t * @example 'Arial' // Arial font\n\t */\n\tfontFace?: string\n\t/**\n\t * East Asian font face name (`<a:ea>` slot), used to render CJK (Chinese/Japanese/Korean) glyphs\n\t *\n\t * Set this when the East Asian font differs from `fontFace`. When omitted, `<a:ea>` inherits the\n\t * theme East Asian font, which is what PowerPoint does for Latin fonts.\n\t * @example '微軟正黑體' // render East Asian glyphs with Microsoft JhengHei\n\t */\n\tfontFaceEA?: string\n\t/**\n\t * Font size\n\t * @example 12 // Font size 12\n\t */\n\tfontSize?: number\n\t/**\n\t * Text highlight color (hex format)\n\t * @example 'FFFF00' // yellow\n\t */\n\thighlight?: HexColor\n\t/**\n\t * italic style\n\t * @default false\n\t */\n\titalic?: boolean\n\t/**\n\t * language\n\t * - ISO 639-1 standard language code\n\t * @default 'en-US' // english US\n\t * @example 'fr-CA' // french Canadian\n\t */\n\tlang?: string\n\t/**\n\t * First-line indent (points) — `a:pPr/@indent`, the offset of the paragraph's FIRST line\n\t * from {@link paraMarginLeft}. Negative hangs the first line to the left of the body, which\n\t * is what a bulleted paragraph does; positive indents it to the right, the \"first line\n\t * indented\" prose form. PowerPoint: Paragraph > Indentation > Special.\n\t * - `'inherit'` writes no `@indent` at all, so the paragraph takes whatever its list style\n\t * (`a:lstStyle` → placeholder → layout → master) sets — the same third state\n\t * {@link bullet} spells, on the attribute beside it\n\t * - omitting the option keeps the bullet-derived default: a drawn bullet hangs the first\n\t * line by its margin, `bullet: false` writes `indent=\"0\"`, `bullet: 'inherit'` writes\n\t * nothing\n\t * - a value here overrides all of those, in every bullet state\n\t * @example -18 // hang the first line 18pt left of the body text\n\t * @example 18 // indent the first line 18pt, prose style\n\t * @example 'inherit' // keep the list style's indent, even on a bulleted paragraph\n\t * @remarks Read from the **opening run** of a paragraph, like {@link bullet} and unlike\n\t * {@link align}; a value on a continuation run is ignored.\n\t */\n\tparaIndent?: number | 'inherit'\n\t/**\n\t * Left margin of the paragraph (points) — `a:pPr/@marL`, where the paragraph's body text\n\t * starts. This is the paragraph's own margin, not the text frame's internal padding\n\t * (`margin`) and not the discrete outline level (`indentLevel`, which writes `a:p/@lvl`).\n\t * PowerPoint: Paragraph > Indentation > Before text.\n\t * - `'inherit'` writes no `@marL` at all, so the paragraph takes whatever its list style\n\t * (`a:lstStyle` → placeholder → layout → master) sets — the third state that omission\n\t * cannot spell, since omitting it writes the bullet-derived default\n\t * - omitting the option keeps that default: a drawn bullet writes its own margin (see\n\t * `bullet.indent`), `bullet: false` writes `marL=\"0\"`, `bullet: 'inherit'` writes nothing\n\t * - a value here overrides all of those, in every bullet state\n\t * @example 36 // body text starts 36pt (0.5in) from the frame's text edge\n\t * @example 'inherit' // keep the list style's margin, even on a bulleted paragraph\n\t * @remarks Read from the **opening run** of a paragraph, like {@link bullet} and unlike\n\t * {@link align}; a value on a continuation run is ignored.\n\t */\n\tparaMarginLeft?: number | 'inherit'\n\t/**\n\t * Add a soft line-break (shift+enter) before line text content\n\t * @default false\n\t */\n\tsoftBreakBefore?: boolean\n\t/**\n\t * tab stops\n\t * - PowerPoint: Paragraph > Tabs > Tab stop position\n\t * @example [{ position:1 }, { position:3 }] // Set first tab stop to 1 inch, set second tab stop to 3 inches\n\t */\n\ttabStops?: Array<{ position: number; alignment?: (typeof TEXT_TAB_ALIGN_TYPES)[number] }>\n\t/**\n\t * text direction\n\t * `horz` = horizontal\n\t * `vert` = rotate 90^\n\t * `vert270` = rotate 270^\n\t * `wordArtVert` = stacked\n\t * @default 'horz'\n\t */\n\ttextDirection?: Extract<TextVerticalType, 'horz' | 'vert' | 'vert270' | 'wordArtVert'>\n\t/**\n\t * Transparency (percent)\n\t * - MS-PPT > Format Shape > Text Options > Text Fill & Outline > Text Fill > Transparency\n\t * - range: 0-100\n\t * @default 0\n\t */\n\ttransparency?: number\n\t/**\n\t * underline properties\n\t * - PowerPoint: Font > Color & Underline > Underline Style/Underline Color\n\t * - `style` is the full `ST_TextUnderlineType` enumeration (ECMA-376 §20.1.10.81)\n\t * - `'none'` is the *explicit off*: it writes `a:rPr/@u=\"none\"`, which overrides an\n\t * underline the run would otherwise inherit from its list style, placeholder, layout or\n\t * master. Omitting the option instead states nothing and lets that inheritance stand —\n\t * the two are different facts, not two spellings of one.\n\t * @default (unset) inherit\n\t */\n\tunderline?: {\n\t\tstyle?: (typeof TEXT_UNDERLINE_TYPES)[number]\n\t\tcolor?: Color\n\t}\n\t/**\n\t * vertical alignment\n\t * @default 'top'\n\t */\n\tvalign?: VAlign\n}\n\nexport interface TextGlowProps {\n\t/**\n\t * Border color (hex format)\n\t * @example 'FF3399'\n\t */\n\tcolor?: HexColor\n\t/**\n\t * opacity (0.0 - 1.0)\n\t * @example 0.5\n\t * 50% opaque\n\t */\n\topacity?: number\n\t/**\n\t * size (points)\n\t */\n\tsize: number\n}\n\nexport interface TextFitShrinkProps {\n\t/**\n\t * Shrink text on overflow (`<a:normAutofit>`)\n\t */\n\ttype: 'shrink'\n\t/**\n\t * Font scale as a percent (0-100), mapped to `<a:normAutofit fontScale=\"..\">`.\n\t *\n\t * PowerPoint normally calculates this dynamically when text overflows; set it\n\t * explicitly to bake the scale into the generated file.\n\t * @example 85 // render text at 85% of its nominal size\n\t * @default undefined // attribute omitted (PowerPoint defaults to 100%)\n\t */\n\tfontScale?: number\n\t/**\n\t * Line-space reduction as a percent (0-100), mapped to `<a:normAutofit lnSpcReduction=\"..\">`.\n\t * @example 20 // reduce line spacing by 20%\n\t * @default undefined // attribute omitted (PowerPoint defaults to 0%)\n\t */\n\tlnSpcReduction?: number\n}\n\nexport interface TextPropsOptions extends PositionProps, DataOrPathProps, TextBaseProps, ObjectNameProps {\n\t/**\n\t * Preset-geometry start/end angles for text frames (`shape` + these build `<a:prstGeom>`\n\t * adjustment guides through the shared emitter — `genXmlPresetGeom` reads them whether\n\t * the object is a shape or a styled text frame).\n\t */\n\tangleRange?: [number, number]\n\t/** Preset-geometry block-arc thickness for text frames. */\n\tarcThicknessRatio?: number\n\t/** Custom geometry points when a text frame uses a custom geometry shape. */\n\tpoints?: GeometryPoint[]\n\t/** Preset-geometry adjustment guides for text frames. */\n\tshapeAdjust?: ShapeAdjustValue | ShapeAdjustValue[]\n\n\tbaseline?: number\n\t/**\n\t * Character spacing\n\t */\n\tcharSpacing?: number\n\t/**\n\t * Number of text columns in the text body\n\t * - PowerPoint: Format Shape > Shape Options > Size & Properties > Text Box > Columns > \"Number\"\n\t * - range: 1-16\n\t * @default 1\n\t * @example 2 // flow text into two columns\n\t */\n\tcolumns?: number\n\t/**\n\t * Spacing between text columns (points)\n\t * - PowerPoint: Format Shape > Shape Options > Size & Properties > Text Box > Columns > \"Spacing\"\n\t * - only applies when `columns` > 1\n\t * @default 0\n\t * @example 10 // 10pt gap between columns\n\t */\n\tcolumnSpacing?: number\n\t/**\n\t * Text fit options\n\t *\n\t * MS-PPT > Format Shape > Shape Options > Text Box > \"[unlabeled group]\": [3 options below]\n\t * - 'none' = Do not Autofit\n\t * - 'shrink' = Shrink text on overflow\n\t * - 'resize' = Resize shape to fit text\n\t *\n\t * **Measured fit:** if you register the box's font with\n\t * {@link TsPptx.registerFontMetrics}, both `'shrink'` and `'resize'` are\n\t * **measured at export time**, so the text renders correctly in headless renderers\n\t * and on plain file-open (no edit/resize needed):\n\t * - `'shrink'` computes the largest `fontScale` at which the wrapped text fits and\n\t * bakes `<a:normAutofit fontScale=…/>`.\n\t * - `'resize'` computes the height the text needs and bakes it into the shape's\n\t * `a:ext/@cy` (adjusting `a:off/@y` per vertical anchor), the marker being\n\t * `<a:spAutoFit/>`.\n\t * With no metrics registered at all they fall back to the bare flag (`<a:normAutofit/>` /\n\t * `<a:spAutoFit/>`, which only PowerPoint recomputes on edit), with no warning. Once any face\n\t * is registered, a named face without metrics is measured with a conservative estimate\n\t * (`measure/heuristic-metrics`), and a run with no face keeps the bare flag\n\t * (`measure/shrink-unmeasured`, `measure/resize-unmeasured`); each code warns once per write.\n\t *\n\t * **Note** Bare `'shrink'`/`'resize'` (no metrics) only take effect after editing\n\t * text / resizing the shape; PowerPoint calculates the result then. The object form\n\t * of `'shrink'` always bakes the explicit values you pass.\n\t * @example 'shrink' // measured when metrics are registered; else bare <a:normAutofit/>\n\t * @example 'resize' // measured when metrics are registered; else bare <a:spAutoFit/>\n\t * @example { type: 'shrink', fontScale: 85, lnSpcReduction: 20 } // pre-shrink with explicit values\n\t * @default \"none\"\n\t */\n\tfit?: 'none' | 'shrink' | 'resize' | TextFitShrinkProps\n\t/**\n\t * Shape fill, or a bare {@link Color} as shorthand for a solid fill ({@link FillOption}).\n\t * @example 'FF0000' // hex color (red), shorthand for { color:'FF0000' }\n\t * @example { color:'FF0000' } // hex color (red)\n\t * @example { color:'0088CC', transparency:50 } // hex color, 50% transparent\n\t * @example { color:SchemeColor.accent1 } // theme color Accent1\n\t */\n\tfill?: FillOption\n\t/**\n\t * Flip shape horizontally?\n\t * @default false\n\t */\n\tflipH?: boolean\n\t/**\n\t * Flip shape vertical?\n\t * @default false\n\t */\n\tflipV?: boolean\n\tglow?: TextGlowProps\n\thyperlink?: HyperlinkProps\n\t/**\n\t * Outline level of the paragraph (`a:p/@lvl`) — which of the list style's nine levels the\n\t * paragraph takes its bullet, indent and typography from.\n\t * - range: 0-8, whole numbers only (`ST_TextIndentLevelType`); anything else is reported\n\t * under `text/invalid-indent-level` and ignored\n\t * - `0` is the default and writes no attribute\n\t * - this is the discrete level, not a measurement: `paraMarginLeft` and `paraIndent` are the\n\t * points-valued controls\n\t * @default 0\n\t */\n\tindentLevel?: number\n\tisTextBox?: boolean\n\tline?: ShapeLineProps\n\t/**\n\t * Line spacing (pt)\n\t * - PowerPoint: Paragraph > Indents and Spacing > Line Spacing: > \"Exactly\"\n\t * @example 28 // 28pt\n\t */\n\tlineSpacing?: number\n\t/**\n\t * line spacing multiple (percent)\n\t * - range: 0.0-9.99\n\t * - PowerPoint: Paragraph > Indents and Spacing > Line Spacing: > \"Multiple\"\n\t * @example 1.5 // 1.5X line spacing\n\t */\n\tlineSpacingMultiple?: number\n\t/**\n\t * Margin (inches) — the text-frame internal margin/padding\n\t * - PowerPoint: Format Shape > Shape Options > Size & Properties > Text Box > Left/Right/Top/Bottom margin (shown in inches)\n\t * - array order is `[top, right, bottom, left]`\n\t * - a value `>= 1` is honored as inches but warns once (it is likely a legacy points value; divide by 72)\n\t * @default (unset) PowerPoint's \"Normal\" internal margin [0.05\", 0.1\", 0.05\", 0.1\"]\n\t * @example 0 // Top/Right/Bottom/Left margin 0\n\t * @example 0.1 // Top/Right/Bottom/Left margin 0.1 inch\n\t * @example [0.05, 0.1, 0.05, 0.1] // top 0.05\", right 0.1\", bottom 0.05\", left 0.1\"\n\t */\n\tmargin?: Margin\n\toutline?: { color: Color; size: number }\n\tparaSpaceAfter?: number\n\tparaSpaceBefore?: number\n\t/**\n\t * Placeholder type\n\t * - when the value matches a placeholder defined on the slide layout/master, this text\n\t * inherits that placeholder's position and formatting\n\t * - otherwise the text shape is promoted to a standalone placeholder of this type, emitting\n\t * a real `<p:ph type=\"...\">`. Use `placeholder: 'title'` to give a slide an accessible\n\t * title (PowerPoint's accessibility checker otherwise reports \"Missing Slide Title\")\n\t * - values: 'title' | 'body' | et. al.\n\t *\n\t * **The placeholder supplies, it does not impose.** Every option this bag states wins; the\n\t * layout placeholder fills in the ones it leaves out. So `{ placeholder: 'body' }` alone\n\t * takes the placeholder's frame, anchor, margins, bullet and text style, and\n\t * `{ placeholder: 'body', valign: 'top' }` takes all of that except the anchor. It matches\n\t * PowerPoint, where a slide placeholder's XML carries only the properties it overrides and\n\t * inherits the rest.\n\t *\n\t * The rule is about what the *caller* wrote, not about what the option bag holds by the time\n\t * inheritance runs: a value this library defaults on the way past does not count as the\n\t * caller stating one, and does not beat the layout.\n\t * @example 'title'\n\t * @see https://learn.microsoft.com/en-us/office/vba/api/powerpoint.ppplaceholdertype\n\t */\n\tplaceholder?: string\n\t/**\n\t * Corner radius (inches) of the text box's `shape`, for `'roundRect'` and the other rounded presets\n\t * - resolved against the shorter side of the box and written as the preset's corner guide\n\t * - not clamped: a radius past half the shorter side is written as given, and PowerPoint draws the corner at its limit\n\t * - omitted, the preset keeps its own radius\n\t */\n\trectRadius?: number\n\t/**\n\t * Rotation (degrees)\n\t * - range: -360 to 360\n\t * @default 0\n\t * @example 180 // rotate 180 degrees\n\t */\n\trotate?: number\n\t/**\n\t * Whether to enable right-to-left mode\n\t * @default false\n\t */\n\trtlMode?: boolean\n\t/**\n\t * Shadow options. **Which shadow depends on which bag it is on**, and the two are different\n\t * effects rather than two spellings of one:\n\t *\n\t * - on the options passed to `addText` — the *shape's* bag — it is the shape's drop shadow\n\t * (`p:spPr/a:effectLst`), PowerPoint's Shape Effects ▸ Shadow;\n\t * - on a run's own `options` inside the text array, it is the *text* shadow\n\t * (`a:rPr/a:effectLst`), PowerPoint's Text Effects ▸ Shadow.\n\t *\n\t * A run therefore does **not** inherit the shape's shadow: PowerPoint's two gestures are\n\t * independent, and applying both is what darkens a shadow twice. State it in both places to\n\t * get both, exactly as it takes two actions there.\n\t * @example addText('hi', { shadow }) // the box has a shadow; its glyphs do not\n\t * @example addText([{ text: 'hi', options: { shadow } }]) // the glyphs do; the box does not\n\t */\n\tshadow?: ShadowProps\n\tshape?: SHAPE_NAME\n\t/**\n\t * Strikethrough (`a:rPr/@strike`, `ST_TextStrikeType` — ECMA-376 §20.1.10.78)\n\t * - `true` is `'sngStrike'`; `'dblStrike'` is the double rule\n\t * - `'noStrike'` is the *explicit off*: it writes `strike=\"noStrike\"`, which overrides a\n\t * strikethrough the run would otherwise inherit from its list style, placeholder, layout\n\t * or master\n\t * - `false`, like leaving the option out, writes no attribute at all and so states\n\t * *nothing* — the run keeps whatever it inherits. This matches `bold`/`italic`, whose\n\t * falsy arm is likewise an omission; reach for `'noStrike'` when the intent is \"not\n\t * struck\" rather than \"unspecified\"\n\t * @default (unset) inherit\n\t */\n\tstrike?: boolean | (typeof TEXT_STRIKE_TYPES)[number]\n\tsubscript?: boolean\n\tsuperscript?: boolean\n\t/**\n\t * Vertical alignment\n\t * @default middle\n\t */\n\tvalign?: VAlign\n\t/**\n\t * Advanced/legacy escape hatch for the full `ST_TextVerticalType` range (e.g. `eaVert`,\n\t * `mongolianVert`, `wordArtVert`). Prefer {@link TextBaseProps.textDirection} for the common\n\t * cases; both map to `a:bodyPr@vert`.\n\t */\n\tvert?: TextVertType\n\t/**\n\t * Text wrap\n\t * @default true\n\t */\n\twrap?: boolean\n}\nexport interface TextProps {\n\ttext?: string | number\n\toptions?: TextPropsOptions\n\t/**\n\t * Raw OMML (Office MathML) for a native, editable PowerPoint equation. By default it is emitted\n\t * as its own centered display-math paragraph (`<a14:m><m:oMathPara><m:oMath>…`) and `text` is\n\t * ignored; set `inline` to instead flow it as an equation run mid-paragraph. Accepts either the\n\t * inner OMML (children of `<m:oMath>`), a full `<m:oMath>…</m:oMath>`, or a full\n\t * `<m:oMathPara>…</m:oMathPara>`; the `m:` prefix is resolved by the wrapper, so the markup does\n\t * not need its own namespace declarations.\n\t * This is the raw-OMML entry point. To author from LaTeX or MathML, convert with\n\t * `latexToOmml()` / `mathmlToOmml()` from the `pptx-ts/math` subpath.\n\t * @example { math: '<m:r><m:t>x^2+1=y</m:t></m:r>' } // raw OMML\n\t * @example import { latexToOmml } from 'pptx-ts/math'; ({ math: latexToOmml('x^2+1=y') })\n\t */\n\tmath?: string\n\t/**\n\t * Emit this item's `math` equation *inline* — an `<a14:m><m:oMath>` run flowing mid-paragraph\n\t * between the surrounding plain text runs — instead of as its own centered display-math\n\t * paragraph. Has no effect unless `math` is set. Pair with the bare-`<m:oMath>` inline form of\n\t * the equation: `latexToOmml(tex, { display: false })` or `mathmlToOmml(mathml)`.\n\t * @example addText([{ text: 'where ' }, { math: latexToOmml('x^2+1=y', { display: false }), inline: true }, { text: ' holds' }])\n\t */\n\tinline?: boolean\n}\n\n/**\n * Options for layout-time text measurement ({@link TsPptx.measureText}).\n * Inches for width, points for type/spacing — the consumer-facing units. The\n * measured face must have metrics registered via {@link TsPptx.registerFontMetrics}\n * (a named face without exact metrics uses a conservative heuristic; an unnamed\n * theme-default face is unmeasurable).\n */\nexport interface MeasureTextOptions {\n\t/** Available text width in inches (the box width minus L/R inset, unless `insetIn` is given). */\n\twIn: number\n\t/** Font size in points. */\n\tfontSize: number\n\t/** Font family name, as used in `fontFace`. Required for an exact measure; an unnamed face is unmeasurable. */\n\tfontFace?: string\n\tbold?: boolean\n\titalic?: boolean\n\t/** Character spacing in points. */\n\tcharSpacing?: number\n\t/** Exact line spacing in points (overrides `lineSpacingMultiple`). */\n\tlineSpacing?: number\n\t/** Line spacing as a multiple of single (e.g. `1.5`). */\n\tlineSpacingMultiple?: number\n\t/** Space before each paragraph, in points. */\n\tparaSpaceBefore?: number\n\t/** Space after each paragraph, in points. */\n\tparaSpaceAfter?: number\n\t/** L/R text inset in inches; when set, subtracted from `wIn` on both sides (pass a raw box width). */\n\tinsetIn?: number\n}\n\n/**\n * Result of {@link TsPptx.measureText}. Heights err **tall** (conservative) —\n * they match the value the export-time autofit bake uses, so the laid-out height is\n * ≥ what PowerPoint/LibreOffice render. Use it to grow a container; for an overflow\n * check it may slightly over-report (good for a warning, not a hard gate).\n */\nexport interface TextMeasurement {\n\t/** Laid-out height in inches at the given `fontSize` (conservative/tall). */\n\theightIn: number\n\t/** Number of wrapped lines (conservative — the model wraps marginally early). */\n\tlineCount: number\n\t/**\n\t * Width in inches of the widest laid-out line (conservative — the model wraps\n\t * marginally early, so this errs slightly wide). With an unconstrained `wIn` it\n\t * is the natural single-line width; constrained, it is the widest wrapped line.\n\t * A box set to this width will not re-wrap the text.\n\t */\n\twidestLineIn: number\n\t/** `false` only for an unnamed theme-default face that could not be measured. */\n\tmeasurable: boolean\n\t/**\n\t * The **named** faces laid out with the conservative average-advance heuristic\n\t * instead of their real metrics — i.e. faces with no registered metrics. Empty\n\t * when every run was measured exactly (and for an unmeasurable result, which\n\t * guessed nothing). The numbers stay conservative (they err tall/wide), but a\n\t * non-empty list means they are an approximation, not a measurement; register\n\t * the face via {@link TsPptx.registerFontMetrics} for an exact result.\n\t */\n\tapproximatedFaces: string[]\n\t/**\n\t * Code points in the measured text — sorted, deduplicated — whose run resolved to a\n\t * **registered** face that has no glyph for them. Empty for fully covered text.\n\t *\n\t * Unlike everything else here, a non-empty list means the numbers are **not reliably\n\t * conservative**. PowerPoint renders such a code point from a substituted face and\n\t * measures it in that face's advances; this model has no fallback and charges the\n\t * registered font's `.notdef` advance, which is unrelated to the glyph that paints. A\n\t * `.notdef` wider than the real glyph over-reports (harmless); a narrower one\n\t * under-reports the width and can drop a line, so `heightIn` may come back **short**\n\t * and the text overflow. Register a face that covers them (or set an explicit\n\t * `fontFace` on those runs) before trusting the height.\n\t *\n\t * Faces with no registered metrics are not audited — they measure through the\n\t * cmap-less heuristic and are reported in {@link approximatedFaces} instead.\n\t * `String.fromCodePoint(...uncoveredCodepoints)` renders the list.\n\t */\n\tuncoveredCodepoints: number[]\n\t/** True if the text fits a box of inner height `hIn` (inches) at full size. */\n\tfitsBox: (hIn: number) => boolean\n\t/** The `fontScale` (percent) that fits inner height `hIn`; `100` if it already fits, never below the shrink floor. */\n\tshrinkScaleFor: (hIn: number) => number\n}\n\n/** Options for {@link TsPptx.overflowsBox}: a measure plus the box inner height to test against. */\nexport interface OverflowBoxOptions extends MeasureTextOptions {\n\t/** Box inner height in inches to test for overflow. */\n\thIn: number\n}\n\n/**\n * One cell's computed rectangle from {@link TsPptx.tableLayout}. All values are\n * inches; `x`/`y` are absolute (offset from the table's `x`/`y`). For a merged cell,\n * `row`/`col` are the top-left origin and `wIn`/`hIn` cover the whole span; the\n * cells it covers are not emitted separately.\n */\nexport interface TableCellLayout {\n\t/** Zero-based grid row of the cell's top-left origin. */\n\trow: number\n\t/** Zero-based grid column of the cell's top-left origin. */\n\tcol: number\n\t/** Number of rows the cell spans (1 if not merged). */\n\trowSpan: number\n\t/** Number of columns the cell spans (1 if not merged). */\n\tcolSpan: number\n\t/** Left edge in inches (absolute). */\n\txIn: number\n\t/** Top edge in inches (absolute). */\n\tyIn: number\n\t/** Outer cell width in inches (sum of spanned column widths). */\n\twIn: number\n\t/** Outer cell height in inches (sum of spanned row heights). */\n\thIn: number\n\t/**\n\t * `true` when `hIn`/`yIn` are pinned by an explicit `rowH` (array or scalar) or\n\t * table `h`; `false` when the row is auto-height and the value is a conservative\n\t * (tall) estimate from the same text model as {@link TsPptx.measureText}.\n\t */\n\theightExact: boolean\n}\n\n/**\n * Result of {@link TsPptx.tableLayout}: per-cell geometry plus overall table\n * bounds, for placing images/shapes over a table without rendering it. Geometry is\n * for a single, un-paginated table laid out at `opts.x`/`y`/`w`; `autoPage` paging\n * is not modeled. Widths are exact; auto-height row heights are conservative\n * estimates (see {@link TableCellLayout.heightExact}).\n */\nexport interface TableLayoutResult {\n\t/** One entry per non-merged origin cell, in row-major order. */\n\tcells: TableCellLayout[]\n\t/** Overall table width in inches (sum of column widths). */\n\twidthIn: number\n\t/** Overall table height in inches (sum of row heights; may include estimates). */\n\theightIn: number\n\t/** `false` if any row height was estimated (the total errs tall, like `measureText`). */\n\theightExact: boolean\n}\n\n/**\n * Per-run options for a speaker-notes text run.\n * A focused subset of `TextPropsOptions`: inline formatting plus an (external URL) hyperlink.\n * Notes hyperlinks support `url` only; `slide` targets are not yet supported.\n */\nexport type NotesTextOptions = Pick<\n\tTextPropsOptions,\n\t'hyperlink' | 'bold' | 'italic' | 'underline' | 'color' | 'fontSize' | 'fontFace'\n>\n\n/** A single speaker-notes text run: text plus optional inline formatting / hyperlink. */\nexport interface NotesProps {\n\ttext: string\n\toptions?: NotesTextOptions\n}\n\n/**\n * A review comment attached to a slide (legacy ISO/IEC 29500 §13 comment).\n */\nexport interface CommentProps {\n\t/** Author display name (required). Comments sharing the same `author`+`initials` are grouped under one author entry. */\n\tauthor: string\n\t/** Author initials shown in the comment marker. Defaults to letters derived from `author`. */\n\tinitials?: string\n\t/** Comment body text (required). */\n\ttext: string\n\t/** Comment marker X position in inches. @default 0.5 */\n\tx?: number\n\t/** Comment marker Y position in inches. @default 0.5 */\n\ty?: number\n\t/** Authored date/time as a `Date` or ISO-8601 string. Omitted from the XML when not provided. */\n\tdate?: Date | string\n}\n\n/** Internal normalized comment stored on a slide (`_comments`). x/y are inches; `date` is ISO-8601 when present. */\nexport interface SlideComment {\n\tauthor: string\n\tinitials: string\n\ttext: string\n\tx: number\n\ty: number\n\tdate?: string\n}\n\n/** Resolved presentation-level comment author, emitted to `commentAuthors.xml`. */\nexport interface ResolvedCommentAuthor {\n\tid: number\n\tname: string\n\tinitials: string\n\tlastIdx: number\n\tclrIdx: number\n}\n\n/** Factory for a single inline text run. Prevents `as never` casts when building mixed-style run arrays. */\nexport function textRun(text: string | number, options?: TextPropsOptions): TextProps {\n\treturn options !== undefined ? { text, options } : { text }\n}\n\n/** Wraps a run array so TypeScript accepts it as `TextProps[]` without a cast. */\nexport function textRuns(runs: TextProps[]): TextProps[] {\n\treturn runs\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,SAAgB,wBAAwB,OAAqC,QAAmC;CAC/G,IAAI,EAAE,SAAS,OAAO,UAAU,aAAa,MAAM,QAAQ,MAAM,QAAQ;EACxE,OAAO,OAAO;EACd;CACD;CAMA,MAAM,SAAS,mBAAmB,KAAK;CACvC,IAAI,OAAO,WAAW,UAAU;EAC/B,KACC,oCACA,4GACD;EACA,OAAO,OAAO;EACd;CACD;CACA,IAAI,aAAa,OAAO;CACxB,IAAI,eAAe,OAAO,aAAa;CACvC,MAAM,OAAO,iBAAiB,UAAU;CAExC,MAAM,WAAW,OAAO,WAAW,WAAW,QAAQ,IAAI,QAAQ,OAAO,WAAW;CACpF,MAAM,WAAW,OAAO,WAAW;CACnC,IAAI,UAAU;EAGb,OAAO,WAAW,YAAY;GAC7B,MAAM,OAAO,QAAQ,eAAe,UAAU;GAC9C;GACA,MAAM;GACN,MAAM,OAAO;GACb,KAAK,SAAS;GACd,QAAQ,SAAS,OAAO,QAAQ,aAAa,IAAI,YAAY;EAC9D;EACA;CACD;CAIA,MAAM,QAAQ;CACd,MAAM,MAAM,YAAY,KAAK;CAC7B,aAAa,OAAO;EAAE,MAAM;EAAS,MAAM;EAAY;EAAM,MAAM,OAAO;EAAM,MAAM,OAAO;EAAM;CAAI,CAAC;CACxG,OAAO,cAAc;AACtB;;;;;;;;;;;;;;;AChCA,SAAS,kBAAkB,KAAmC;CAC7D,MAAM,SAAS,IAAI,SAAS;CAC5B,OAAO;EACN,M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