import { $ as PptxThemeFontScheme, $i as PptxChartRegionMapOptions, $n as ParsedTableStyleText, At as PptxAnimationPreset, C as PptxSlide, Cn as Model3DPptxElement, D as PptxSmartTagsReference, Di as PptxChartChrome, Do as StrokeDashType, Ei as PptxChartBoxWhiskerOptions, Er as PptxSmartArtQuickStyle, Fa as PlaceholderTextLevelStyle, Ga as ShapeStyle, Gn as ParsedTableStyleBorders, Ha as TextStyle, Hi as PptxChartGradientFill, Hn as ZoomPptxElement, It as PptxAnimationTrigger, J as PptxTheme, L as PptxSlideTransition, Ln as SmartArtPptxElement, Nn as PptxImageLikeElement, No as PptxAction, Oi as PptxChartData, On as PptxElement, P as PptxViewProperties, Pa as PlaceholderDefaults, Pr as PptxSmartArtTextRun, S as PptxSection, Sn as MediaPptxElement, So as ConnectorArrowType, T as PptxSlideSize, Tn as OlePptxElement, To as PptxShapeLocks, Ui as PptxChartHistogramOptions, Un as ParsedTableBackground, Ut as PptxNativeAnimation, Va as TextSegment, W as PptxTransitionType, Wa as ResolvedStyleMatrix, X as PptxThemeEffectStyle, Y as PptxThemeColorScheme, Z as PptxThemeFillStyle, Zi as PptxChartOfPieOptions, Zn as ParsedTableStyleMap, _ as PptxLayoutOption, _o as CustomGeometryRawData, a as MergeOptions, an as PptxHandoutMaster, b as PptxPhotoAlbum, ba as PptxChartStyleDefinition, bo as GeometryAdjustmentHandle, c as PptxCustomShow, ca as PptxChartType, cn as PptxMasterTextStyles, ct as PptxComment, d as PptxData, da as PptxChartWaterfallOptions, di as PptxMediaReferenceKind, dn as PptxSlideLayout, dr as PptxSmartArtData, dt as PptxCoreProperties, ei as PptxSmartArtChrome, et as PptxThemeFormatScheme, f as PptxEmbeddedFont, fn as PptxSlideMaster, fo as AdjustHandlePolar, fr as PptxSmartArtDrawingShape, ft as PptxCustomProperty, g as PptxKinsoku, gi as PptxImageEffects, gn as ConnectorPptxElement, h as PptxHeaderFooter, ha as PptxChartUserShape, hn as ChartPptxElement, ho as CustomGeometryPath, ht as PptxTagCollection, ia as PptxChartTreemapOptions, ir as PptxTableData, jn as PptxElementWithText, jr as PptxSmartArtNodeStyle, ko as XmlObject, l as PptxCustomXmlPart, ln as PptxNotesMaster, lo as PptxThemeColorRef, lt as PptxCommentAuthor, m as PptxExportOptions, ma as PptxExternalData, mn as PptxThemeOption, mo as ConnectionSite, nr as PptxTableCellStyle, nt as PptxThemeObjectDefaults, pa as PptxEmbeddedWorkbookData, pn as PptxTextStyleLevels, po as AdjustHandleXY, pt as PptxModernCommentAuthor, qn as ParsedTableStyleFill, ra as PptxChartStyle, s as PptxActiveXControl, si as MediaBookmark, sn as PptxLayoutPreview, st as PptxAppProperties, t as FindResult, ta as PptxChartSeries, tt as PptxThemeLineStyle, u as PptxCustomerData, ua as PptxChartView3D, un as PptxPlaceholderFrame, ur as PptxSmartArtConnection, ut as PptxCompatibilityWarning, v as PptxModernCommentPart, vi as PptxImageProperties, vn as ContentPartPptxElement, w as PptxSlideBackgroundPattern, x as PptxPresentationProperties, xn as InkPptxElement, xr as PptxSmartArtColorTransform, y as PptxModifyVerifier, yn as GroupPptxElement, yo as CustomGeometryTextRect, yt as PptxEmbeddedFontList, za as BulletInfo, zn as TablePptxElement, zt as PptxElementAnimation } from "./text-operations-IlJiffp7.js"; import { XMLBuilder, XMLParser } from "fast-xml-parser"; import JSZip from "jszip"; import { convertMetafileToDataUrl } from "emf-converter"; //#region src/pptx/core/types/theme-presets.d.ts /** * A complete theme preset that can be applied to a presentation. * * @example * ```ts * import { THEME_PRESETS } from "pptx-viewer-core"; * * const office = THEME_PRESETS.find(p => p.id === "office"); * await handler.switchTheme(office.colorScheme, office.fontScheme, office.name); * ``` */ interface PptxThemePreset { /** Unique identifier for the preset. */ id: string; /** Human-readable display name. */ name: string; /** The 12-colour scheme. */ colorScheme: PptxThemeColorScheme; /** Heading and body font families. */ fontScheme: PptxThemeFontScheme; } /** * All built-in theme presets. * * @example * ```ts * import { THEME_PRESETS } from "pptx-viewer-core"; * * // List available theme names * console.log(THEME_PRESETS.map(p => p.name)); * // => ["Office", "Facet", "Integral", "Ion", "Organic", "Retrospect", "Slate", "Metropolitan"] * * // Apply a preset * const preset = THEME_PRESETS.find(p => p.id === "ion"); * if (preset) { * await handler.switchTheme(preset.colorScheme, preset.fontScheme, preset.name); * } * ``` */ declare const THEME_PRESETS: readonly PptxThemePreset[]; //#endregion //#region src/pptx/core/builders/sdk/chart-gradient-input.d.ts /** One gradient stop. */ interface ChartGradientStopInput { /** Hex colour, `#RRGGBB` or `RRGGBB`. */ color: string; /** Stop position along the gradient, 0 to 100 (percent). */ position: number; /** Stop opacity, 0 (transparent) to 1 (opaque, the default); written as `a:alpha`. */ opacity?: number; } /** * A chart series or data-point gradient fill: at least two stops, linear * (the default) or radial. * * `angle` follows the OOXML `a:lin/@ang` convention, the same as the shape * `FillInput`: degrees clockwise from the positive x-axis, pointing from the * first stop towards the last (`0` = left to right, `90` = top to bottom, the * default). A radial gradient radiates from `focalPoint` (fractions 0 to 1 of * the mark's box, the centre by default) and is written as * `a:path path="circle"` with a matching `a:fillToRect`. * * @example * ```ts * const topToBottom: ChartGradientInput = { * angle: 90, * stops: [ * { color: "#60A5FA", position: 0 }, * { color: "#1E3A8A", position: 100 }, * ], * }; * const glow: ChartGradientInput = { * type: "radial", * focalPoint: { x: 0.5, y: 0.5 }, * stops: [ * { color: "#FFFFFF", position: 0, opacity: 0.6 }, * { color: "#ED7D31", position: 100 }, * ], * }; * ``` */ type ChartGradientInput = { type?: 'linear'; angle?: number; stops: ChartGradientStopInput[]; } | { type: 'radial'; focalPoint?: { x: number; y: number; }; stops: ChartGradientStopInput[]; }; /** * Validate a {@link ChartGradientInput} and convert it to the chart model, * normalised the way a reload parses it back: stops sorted by position, * colours as `#RRGGBB`, a linear angle in `[0, 360)` (default 90), a radial * focal point defaulting to the centre. * * @throws {RangeError} Fewer than two stops, or a position, opacity, angle or * focal point out of range. * @throws {Error} A stop colour that is not a 6-digit hex string. */ declare function toChartGradientFill(input: ChartGradientInput): PptxChartGradientFill; //#endregion //#region src/pptx/core/builders/sdk/types.d.ts /** Position and size in pixels. Converted to EMU internally when needed. */ interface ElementPosition { x: number; y: number; width: number; height: number; rotation?: number; } type FillInput = { type: 'solid'; color: string; opacity?: number; /** * A theme colour to use instead of a plain hex. When set, the shape * saves as `` (e.g. `{ scheme: 'accent1', lumMod: 0.8 }` * for "Accent 1, Lighter 80%") so it keeps following the theme after a * later theme change; `color` still supplies the immediate resolved * hex for renderers that read it directly. */ themeColorRef?: PptxThemeColorRef; } | { type: 'gradient'; /** * Gradient direction in the OOXML `a:lin/@ang` convention: degrees * clockwise from the positive x-axis, pointing from the first stop * towards the last (`0` = left to right, `90` = top to bottom). This is * what lands in `ShapeStyle.fillGradientAngle` and what is written back * to the file, NOT a CSS `linear-gradient()` angle. */ angle?: number; gradientType?: 'linear' | 'radial'; stops: Array<{ color: string; position: number; opacity?: number; }>; } | { type: 'pattern'; preset: string; foreground?: string; background?: string; } | { type: 'image'; url: string; mode?: 'stretch' | 'tile'; } | { type: 'none'; }; interface StrokeInput { color?: string; width?: number; dash?: StrokeDashType; opacity?: number; join?: 'round' | 'bevel' | 'miter'; cap?: 'flat' | 'rnd' | 'sq'; /** A theme colour for the outline; see {@link FillInput}'s `themeColorRef`. */ themeColorRef?: PptxThemeColorRef; } interface ShadowInput { color?: string; blur?: number; offsetX?: number; offsetY?: number; opacity?: number; } interface TextStyleInput { fontSize?: number; fontFamily?: string; bold?: boolean; italic?: boolean; underline?: boolean; strikethrough?: boolean; color?: string; /** A theme colour for the run; see {@link FillInput}'s `themeColorRef`. */ themeColorRef?: PptxThemeColorRef; alignment?: 'left' | 'center' | 'right' | 'justify'; verticalAlignment?: 'top' | 'middle' | 'bottom'; lineSpacing?: number; spaceBefore?: number; spaceAfter?: number; } interface TextSegmentInput { text: string; style?: Partial; } interface TextOptions extends Partial { fontSize?: number; fontFamily?: string; bold?: boolean; italic?: boolean; underline?: boolean; strikethrough?: boolean; color?: string; alignment?: 'left' | 'center' | 'right' | 'justify'; verticalAlignment?: 'top' | 'middle' | 'bottom'; lineSpacing?: number; fill?: FillInput; stroke?: StrokeInput; shadow?: ShadowInput; opacity?: number; } interface ShapeOptions extends Partial { fill?: FillInput; stroke?: StrokeInput; text?: string; textStyle?: Partial; adjustments?: Record; shadow?: ShadowInput; opacity?: number; } interface ImageOptions extends Partial { altText?: string; cropLeft?: number; cropTop?: number; cropRight?: number; cropBottom?: number; opacity?: number; } interface TableInput { rows: TableRowInput[]; columnWidths?: number[]; style?: string; bandRows?: boolean; bandColumns?: boolean; firstRow?: boolean; lastRow?: boolean; firstCol?: boolean; lastCol?: boolean; } interface TableRowInput { cells: TableCellInput[]; height?: number; } interface TableCellInput { text: string; style?: Partial; fill?: FillInput; gridSpan?: number; rowSpan?: number; } interface TableOptions extends Partial {} interface ChartSeriesInput { name: string; values: number[]; color?: string; /** * Gradient fill for the whole series, written as `c:ser/c:spPr/a:gradFill`. * Takes precedence over `color`. Area-filled chart types only (bar, area, * pie, doughnut, ofPie, bubble, surface and their 3-D variants); * `createChartElement` throws for line-drawn and ChartEx types. */ gradientFill?: ChartGradientInput; boxWhiskerOptions?: PptxChartBoxWhiskerOptions; histogramOptions?: PptxChartHistogramOptions; waterfallOptions?: PptxChartWaterfallOptions; regionMapOptions?: PptxChartRegionMapOptions; treemapOptions?: PptxChartTreemapOptions; } interface ChartInput { series: ChartSeriesInput[]; categories: string[]; /** ChartEx hierarchy levels in leaf-to-root XML order. */ categoryLevels?: string[][]; title?: string; hasLegend?: boolean; legendPosition?: 't' | 'b' | 'l' | 'r' | 'tr'; grouping?: 'clustered' | 'stacked' | 'percentStacked'; /** Bar series direction (`c:barDir`): vertical columns (default) or horizontal bars. */ barDirection?: 'col' | 'bar'; } interface ChartOptions extends Partial {} interface ConnectorOptions extends Partial { type?: 'straight' | 'bent' | 'curved'; stroke?: StrokeInput; startArrow?: ConnectorArrowType; endArrow?: ConnectorArrowType; from?: { elementId: string; site: number; }; to?: { elementId: string; site: number; }; } interface MediaOptions extends Partial { autoPlay?: boolean; loop?: boolean; volume?: number; trimStartMs?: number; trimEndMs?: number; posterFrame?: string; } interface GroupOptions extends Partial {} type BackgroundInput = { type: 'solid'; color: string; } | { type: 'gradient'; /** * Slide backgrounds are stored as a ready-made CSS gradient string * (`PptxSlide.backgroundGradient`), so this is a CSS * `linear-gradient()` angle: degrees clockwise from "to top" * (`90` = left to right, `180` = top to bottom). Defaults to `180`. */ angle?: number; stops: Array<{ color: string; position: number; }>; } | { type: 'image'; source: string; }; interface TransitionInput { type: PptxTransitionType; duration?: number; direction?: string; advanceAfterMs?: number; } interface AnimationInput { preset: PptxAnimationPreset; trigger?: PptxAnimationTrigger; duration?: number; delay?: number; } interface PresentationOptions { /** Slide width in EMU. Default: 12192000 (16:9 widescreen). */ width?: number; /** Slide height in EMU. Default: 6858000 (16:9 widescreen). */ height?: number; /** Theme configuration. */ theme?: PresentationThemeInput; /** Presentation title (stored in docProps/core.xml). */ title?: string; /** Presentation author. */ creator?: string; /** * Number of blank slides to include in the initial presentation. * Default: 0 (no slides). Slides use the "Blank" layout. */ initialSlideCount?: number; } interface PresentationThemeInput { name?: string; colors?: { dk1?: string; lt1?: string; dk2?: string; lt2?: string; accent1?: string; accent2?: string; accent3?: string; accent4?: string; accent5?: string; accent6?: string; hlink?: string; folHlink?: string; }; fonts?: { majorFont?: string; minorFont?: string; }; } //#endregion //#region src/pptx/core/builders/sdk/SlideBuilder.d.ts /** * Fluent builder for a single slide. * * @example * ```ts * const slide = new SlideBuilder(1) * .addText("Hello World", { fontSize: 36, bold: true, x: 100, y: 50 }) * .addShape("roundRect", { fill: { type: "solid", color: "#4472C4" } }) * .setNotes("Remember to mention key points") * .setBackground({ type: "solid", color: "#F5F5F5" }) * .build(); * ``` */ declare class SlideBuilder { private readonly slide; /** * @param slideNumber - 1-based slide number. * @param layoutPath - Optional layout archive path. * @param layoutName - Optional layout display name. */ constructor(slideNumber: number, layoutPath?: string, layoutName?: string); /** Add a text box to the slide. */ addText(text: string | TextSegmentInput[], options?: TextOptions): this; /** Add a shape to the slide. */ addShape(shapeType: string, options?: ShapeOptions): this; /** Add a connector (line) to the slide. */ addConnector(options?: ConnectorOptions): this; /** Add an image to the slide. */ addImage(source: string, options?: ImageOptions): this; /** Add a table to the slide. */ addTable(input: TableInput, options?: TableOptions): this; /** Add a chart to the slide. */ addChart(chartType: PptxChartType, input: ChartInput, options?: ChartOptions): this; /** Add a media element (video or audio) to the slide. */ addMedia(mediaType: 'video' | 'audio', source: string, options?: MediaOptions): this; /** Add a group of elements to the slide. */ addGroup(children: PptxElement[], options?: GroupOptions): this; /** Add a pre-built element directly. */ addElement(element: PptxElement): this; /** Set slide background. */ setBackground(bg: BackgroundInput): this; /** Set slide transition. */ setTransition(input: TransitionInput): this; /** Add an animation to an element on this slide. */ addAnimation(elementId: string, input: AnimationInput): this; /** Set speaker notes. */ setNotes(text: string): this; /** Mark the slide as hidden. */ setHidden(hidden: boolean): this; /** Assign the slide to a section. */ setSection(name: string, id?: string): this; /** * Add a freeform shape from SVG path data. * * Creates a custom-geometry shape element using the provided SVG path * string and appends it to the slide's element list. * * @param pathData - An SVG path data string (e.g. `"M 0 0 L 100 50 L 50 100 Z"`). * @param options - Optional position, styling, and size overrides. * @returns The builder instance for chaining. * * @example * ```ts * new SlideBuilder(1) * .addFreeform("M 0 0 C 33 0 66 100 100 100", { * stroke: { color: "#FF0000", width: 2 }, * }) * .build(); * ``` */ addFreeform(pathData: string, options?: ShapeOptions): this; /** * Add a pre-built element from any element builder (calls `.build()` for you). * * Accepts any object with a `build()` method that returns a {@link PptxElement}, * such as {@link TextBuilder}, {@link ShapeBuilder}, {@link ImageBuilder}, etc. * * @param builder - An element builder with a `.build()` method. * @returns The builder instance for chaining. * * @example * ```ts * const title = TextBuilder.create("Hello").fontSize(36).bold(); * new SlideBuilder(1).addBuilderElement(title).build(); * ``` */ addBuilderElement(builder: { build(): PptxElement; }): this; /** * Remove an element by its ID. * * Filters out the element with the given ID from the slide's element list. * If no element matches, the slide is left unchanged. * * @param elementId - The unique ID of the element to remove. * @returns The builder instance for chaining. * * @example * ```ts * const slide = new SlideBuilder(1) * .addText("temp", { x: 0, y: 0 }) * .removeElement("txt_abc123_1") * .build(); * ``` */ removeElement(elementId: string): this; /** * Get the current list of elements on this slide. * * Returns a readonly view of the elements array. Useful for inspecting * what has been added so far during the build process. * * @returns A readonly array of the slide's current elements. * * @example * ```ts * const builder = new SlideBuilder(1).addText("Hi"); * console.log(builder.getElements().length); // 1 * ``` */ getElements(): readonly PptxElement[]; /** * Get the number of elements on this slide. * * @returns The count of elements currently added to the slide. * * @example * ```ts * const builder = new SlideBuilder(1) * .addText("A").addText("B"); * console.log(builder.elementCount); // 2 * ``` */ get elementCount(): number; /** * Get the last added element (useful for getting its ID for animations). * * Returns `undefined` if the slide has no elements yet. * * @returns The most recently added element, or `undefined`. * * @example * ```ts * const builder = new SlideBuilder(1).addShape("rect"); * const shape = builder.getLastElement(); * if (shape) { * builder.addAnimation(shape.id, { preset: "fadeIn" }); * } * ``` */ getLastElement(): PptxElement | undefined; /** * Set the slide name/title for organizational purposes. * * Stores an arbitrary name string on the slide object. This is useful * for labeling slides in tooling or custom workflows. * * @param name - The display name to assign to the slide. * @returns The builder instance for chaining. * * @example * ```ts * new SlideBuilder(1) * .setName("Introduction") * .addText("Welcome!") * .build(); * ``` */ setName(name: string): this; /** Return the built {@link PptxSlide}. */ build(): PptxSlide; } //#endregion //#region src/pptx/core/builders/sdk/PresentationBuilder.d.ts /** Result returned by {@link PresentationBuilder.create}. */ interface PresentationBuilderResult { /** Initialized handler ready for editing and saving. */ handler: PptxHandler; /** Parsed presentation data. */ data: PptxData; /** Convenience slide builder factory. */ createSlide: (layoutName?: string) => SlideBuilder; } /** * Build the raw bytes of a minimal valid blank presentation package: theme, * slide master, the 11 standard layouts, optional initial blank slides, and * all required relationships/content types. * * Used by {@link PresentationBuilder.create} and by the `pptx-viewer-json` * import path, which loads a blank package before overlaying imported data * so that editing and save operations work without the original archive. */ declare function buildBlankPresentationArchive(options?: PresentationOptions): Promise; /** * Create PPTX presentations from scratch. * * @example * ```ts * const { handler, data, createSlide } = await PresentationBuilder.create({ * title: "My Deck", * theme: { * name: "Corporate", * colors: { accent1: "#FF6B6B", accent2: "#556270" }, * fonts: { majorFont: "Inter", minorFont: "Inter" }, * }, * }); * * // Add a slide using the builder * const slide = createSlide("Blank") * .addText("Hello World", { fontSize: 36, x: 100, y: 100, width: 800, height: 60 }) * .build(); * data.slides.push(slide); * * // Save * const bytes = await handler.save(data.slides); * ``` */ declare class PresentationBuilder { private constructor(); /** * Create a new blank PPTX presentation. * * Generates a valid OpenXML package with a theme, slide master, * 11 standard layouts, and all required relationships. The returned * handler is ready for editing, adding slides, and saving. * * @param options - Optional slide dimensions, theme, and metadata. * @returns Handler, parsed data, and a slide builder factory. */ static create(options?: PresentationOptions): Promise; } //#endregion //#region src/pptx/core/builders/fluent/PptxXmlBuilder.d.ts /** * Fluent interface for navigating and mutating a {@link PptxData} structure. * Provides method-chaining access to slides, elements, and notes. */ interface IPptxXmlBuilder { /** Navigate to a slide by zero-based index (Pascal-case alias). */ Slides(index: number): PptxSlideBuilder; /** Navigate to a slide by zero-based index. */ slide(index: number): PptxSlideBuilder; /** Navigate to a slide by zero-based index (plural alias). */ slides(index: number): PptxSlideBuilder; /** Return the underlying presentation data. */ project(): PptxData; } /** * Root builder of the fluent PPTX editing API. * * Wraps a {@link PptxData} object and provides chainable accessors * to navigate into slides, elements, and notes for in-place mutation. */ declare class PptxXmlBuilder implements IPptxXmlBuilder { /** The presentation data being mutated. */ private readonly data; /** @param data - The presentation data to wrap. */ constructor(data: PptxData); /** * Factory method to create a builder from presentation data. * @param data - The presentation data to wrap. * @returns A new {@link PptxXmlBuilder} instance. */ static from(data: PptxData): PptxXmlBuilder; /** @inheritdoc */ Slides(index: number): PptxSlideBuilder; /** * Navigate to a slide by zero-based index. * @param index - Zero-based slide index. * @returns A {@link PptxSlideBuilder} for the requested slide. * @throws Error if index is not an integer or is out of range. */ slide(index: number): PptxSlideBuilder; /** @inheritdoc */ slides(index: number): PptxSlideBuilder; /** Return the underlying {@link PptxData}. */ project(): PptxData; /** Pascal-case alias for {@link project}. */ Project(): PptxData; } /** * Fluent builder scoped to a single slide. * Provides navigation to the slide's elements and notes. */ declare class PptxSlideBuilder { /** The slide being operated on. */ private readonly slideValue; /** Reference back to the root builder for chaining. */ private readonly rootBuilder; /** * @param slideValue - The slide data. * @param rootBuilder - The parent builder. */ constructor(slideValue: PptxSlide, rootBuilder: PptxXmlBuilder); /** Navigate to the slide's notes builder (getter). */ get Notes(): PptxSlideNotesBuilder; /** Navigate to the slide's notes builder. */ notes(): PptxSlideNotesBuilder; /** Navigate to the slide's elements builder. */ elements(): PptxSlideElementsBuilder; /** Return the underlying slide data. */ project(): PptxSlide; /** Pascal-case alias for {@link project}. */ Project(): PptxSlide; /** Navigate back to the root builder. */ done(): PptxXmlBuilder; /** Pascal-case alias for {@link done}. */ Done(): PptxXmlBuilder; } /** * Fluent builder for manipulating the elements array of a single slide. * Supports adding, removing, and updating elements by ID. */ declare class PptxSlideElementsBuilder { private readonly slideValue; private readonly slideBuilder; /** * @param slideValue - The slide whose elements are being modified. * @param slideBuilder - The parent slide builder for chaining. */ constructor(slideValue: PptxSlide, slideBuilder: PptxSlideBuilder); /** * Append an element to the slide's element list. * @param element - The element to add. * @returns This builder for chaining. */ add(element: PptxElement): this; /** * Remove an element from the slide by its ID. * @param elementId - The ID of the element to remove. * @returns This builder for chaining. */ removeById(elementId: string): this; /** * Update an element in-place by ID using a transform function. * @param elementId - The ID of the element to update. * @param updater - A function that receives the current element and returns the replacement. * @returns This builder for chaining. */ updateById(elementId: string, updater: (current: PptxElement) => PptxElement): this; /** Return the current elements array. */ project(): PptxElement[]; /** Navigate back to the slide builder. */ done(): PptxSlideBuilder; } /** * Fluent builder for manipulating speaker notes on a single slide. * Supports adding, setting, clearing, and retrieving notes text. */ declare class PptxSlideNotesBuilder { private readonly slideValue; private readonly slideBuilder; /** * @param slideValue - The slide whose notes are being modified. * @param slideBuilder - The parent slide builder for chaining. */ constructor(slideValue: PptxSlide, slideBuilder: PptxSlideBuilder); /** * Append text to existing notes (separated by newline). * @param text - The text to append. * @returns This builder for chaining. */ add(text: string): this; /** Pascal-case alias for {@link add}. */ Add(text: string): this; /** * Replace all notes with the given text. * @param text - The replacement notes text. Empty string clears notes. * @returns This builder for chaining. */ set(text: string): this; /** Pascal-case alias for {@link set}. */ Set(text: string): this; /** Remove all notes from the slide. */ clear(): this; /** Pascal-case alias for {@link clear}. */ Clear(): this; /** Return the current notes text, or `undefined` if none. */ get(): string | undefined; /** Pascal-case alias for {@link get}. */ Get(): string | undefined; /** Navigate back to the slide builder. */ done(): PptxSlideBuilder; /** Pascal-case alias for {@link done}. */ Done(): PptxSlideBuilder; /** * Synchronize the `notesSegments` array from the plain-text notes string. * Splits text on newlines and creates corresponding {@link TextSegment} entries * with paragraph break markers between lines. */ private syncSegmentsFromNotes; } //#endregion //#region src/pptx/core/core/types.d.ts interface PptxHandlerLoadOptions { eagerDecodeImages?: boolean; password?: string; /** * Maximum total uncompressed bytes accepted from the input ZIP archive. * Defaults to 500 MiB. When the sum of `_data.uncompressedSize` across * all archive entries exceeds this cap, `load()` rejects with a * {@link ZipBombError}. A hard cap of 65 536 archive entries also * applies. */ maxUncompressedBytes?: number; /** * When `false` (default), relationship targets that resolve to * `http://` or `https://` URLs are dropped from rendered slides * (image, picture, background). Set to `true` to allow external image * URLs to flow through to ``. * * Disabled by default to mitigate SSRF / privacy-leak vectors in * server-side rendering and headless export pipelines. */ allowExternalImages?: boolean; } /** * Default maximum uncompressed byte budget for {@link PptxHandlerLoadOptions.maxUncompressedBytes}. * 500 MiB. */ declare const DEFAULT_MAX_UNCOMPRESSED_BYTES: number; /** * Hard cap on archive entry count. Beyond this, the package is rejected. */ declare const MAX_ZIP_ENTRY_COUNT = 65536; /** * Thrown by the load pipeline when a ZIP archive exceeds the configured * uncompressed-size budget or the entry-count limit. */ declare class ZipBombError extends Error { readonly code = "ZIP_BOMB"; readonly uncompressedBytes: number | undefined; readonly limit: number; readonly entryCount: number | undefined; constructor(message: string, details: { uncompressedBytes?: number; limit: number; entryCount?: number; }); } /** Output format for the save pipeline. */ type PptxSaveFormat = 'pptx' | 'ppsx' | 'pptm' | 'ppt'; interface PptxHandlerSaveOptions { headerFooter?: PptxHeaderFooter; presentationProperties?: PptxPresentationProperties; customShows?: PptxCustomShow[]; sections?: PptxSection[]; coreProperties?: PptxCoreProperties; appProperties?: PptxAppProperties; customProperties?: PptxCustomProperty[]; /** Updated notes master data to save back to notesMaster1.xml. */ notesMaster?: PptxNotesMaster; /** Updated handout master data to save back to handoutMaster1.xml. */ handoutMaster?: PptxHandoutMaster; /** * Updated slide masters to save back to ppt/slideMasters/slideMaster*.xml. * Each entry in the array applies typed mutations (clrMap, hf flags, * background) to the master at its `path`. Masters not listed here pass * through verbatim from the original load. */ slideMasters?: PptxSlideMaster[]; /** * Updated slide layouts to save back to ppt/slideLayouts/slideLayout*.xml. * Each entry applies typed mutations (clrMapOverride, attrs, hf flags, * background) to the layout at its `path`. Layouts not listed here pass * through verbatim from the original load. */ slideLayouts?: PptxSlideLayout[]; /** Updated tag collections to save back to ppt/tags/tag*.xml. */ tags?: PptxTagCollection[]; /** Presentation-level customer data references to author or update. */ customerData?: PptxCustomerData[]; /** Photo album metadata to save back to `p:photoAlbum`. */ photoAlbum?: PptxPhotoAlbum; /** * Slide dimensions to write back to `p:sldSz`. * * Omitting the option preserves the load-time dimensions verbatim, which * is why an edit made through a viewer's Slide Size control has to reach * the save call: nothing else in the pipeline can observe it. * * PowerPoint derives `Presentation.PageSetup.SlideSize` from `@cx`/`@cy` * alone (verified by COM: an A4-typed `p:sldSz` carrying 4:3 dimensions * still reports `ppSlideSizeCustom`), so `type` is written for fidelity * but the dimensions are what actually decide the reported preset. */ slideSize?: PptxSlideSize; /** East Asian line-break settings to save back to `p:kinsoku`. */ kinsoku?: PptxKinsoku | null; /** Write-protection verifier. Set to `null` to remove, `undefined` to preserve existing. */ modifyVerifier?: PptxModifyVerifier | null; /** * `p:presentation/@embedTrueTypeFonts` to write. `undefined` preserves * whatever was loaded (or omits the attribute for a brand-new deck); * purely declarative here, see {@link PptxData.embedTrueTypeFonts}. */ embedTrueTypeFonts?: boolean; /** * Presentation-level default text style edits to save back to * `p:defaultTextStyle`. Only the levels present in the map are touched; * omitted levels and any unmodelled XML on an edited level survive * untouched. See {@link PptxData.defaultTextStyle}. */ defaultTextStyle?: PptxTextStyleLevels; /** View properties to save back to ppt/viewProps.xml. */ viewProperties?: PptxViewProperties; /** * Table style edits to save back to `ppt/tableStyles.xml`. Pass the * `tableStyleMap` from `PptxData` (optionally with edited entries) * to persist user edits. The `def` GUID and any unmodelled XML are * preserved verbatim. Omitting the option round-trips the original * part untouched. */ tableStyles?: ParsedTableStyleMap; /** * Set `ppt/tableStyles.xml`'s `` to this style GUID * (normalised to uppercase-with-braces). `undefined` preserves the * existing default; there is no removal form (`@def` is required by the * schema and PowerPoint always points it at a real style). No-op when the * archive has no `ppt/tableStyles.xml`, same as {@link tableStyles}. */ tableStylesDefaultId?: string; /** * Style GUIDs to remove from `ppt/tableStyles.xml` entirely, kept as a * separate opt-in list rather than inferred from omission on * {@link tableStyles}: that map is documented as safe to pass a PARTIAL * edit (only the entries a caller actually touched), so treating every * GUID missing from it as "delete this" would silently destroy untouched * styles on an ordinary targeted edit. A GUID here that is also the * current (or newly requested) default is left in place and skipped. */ tableStylesToDelete?: string[]; /** * Target output format. * - `'pptx'` (default): Standard presentation. * - `'ppsx'`: Slide-show file (opens in presentation mode). * - `'pptm'`: Macro-enabled presentation (requires VBA data). * - `'ppt'`: Legacy binary PowerPoint 97-2003 presentation. Bypasses the * OOXML ZIP pipeline entirely; see `PptxHandlerRuntimeSaveLegacyPpt`. * Elements with no binary equivalent (charts, SmartArt, media, OLE, ink, * 3D models) are degraded to a rasterised preview picture or a labelled * placeholder, each reported via a `scope: 'save'`-adjacent * `PptxCompatibilityWarning`. */ outputFormat?: PptxSaveFormat; /** * Password for RC4 CryptoAPI encryption of a `'ppt'`-format save. Ignored * for every other {@link outputFormat}; encrypting a `.pptx`/`.ppsx`/`.pptm` * save uses {@link IPptxHandlerRuntime.saveEncrypted}'s separate AES/Agile * OLE2 wrapping instead, since the legacy binary format's own encryption * scheme is embedded directly in the `.ppt` stream rather than wrapping an * already-produced package. */ pptPassword?: string; /** * Embedded fonts to write back (or add) to the saved PPTX. * * Pass the `embeddedFonts` array from `PptxData` to preserve existing * embedded fonts during save. You can also add new fonts by including * entries with `rawFontData` populated. * * When omitted, the save pipeline will automatically re-embed any * fonts that were loaded from the original PPTX and have `rawFontData` * preserved (i.e. the default is lossless round-trip). */ embeddedFonts?: PptxEmbeddedFont[]; /** Typed embedded-font list metadata. Set to null to remove fonts and relationships. */ embeddedFontList?: PptxEmbeddedFontList | null; /** * OOXML conformance class for the saved output. * - `'preserve'` (default): use the same conformance as the loaded file. * - `'strict'`: force Strict Open XML (ISO/IEC 29500) namespace URIs. * - `'transitional'`: force Transitional (ECMA-376) namespace URIs. */ conformance?: 'strict' | 'transitional' | 'preserve'; } interface IPptxHandlerRuntime { /** * Release all resources held by this runtime (Blob URLs, caches, ZIP). * After calling, the runtime cannot be used further. */ dispose(): void; /** * Revoke all Blob URLs created during image loading. */ revokeBlobUrls(): void; getCompatibilityWarnings(): PptxCompatibilityWarning[]; getLayoutOptions(): PptxLayoutOption[]; getLayoutPreview(layoutPath: string): Promise; getLayoutPreviews(layoutPaths?: readonly string[]): Promise; createXmlBuilder(data: PptxData): PptxXmlBuilder; Builder(data: PptxData): PptxXmlBuilder; setTemplateBackground(path: string, backgroundColor: string | undefined): void; setPresentationTheme(themePath: string, applyToAllMasters?: boolean): Promise; getTemplateBackgroundColor(path: string): string | undefined; updateThemeColorScheme(colorScheme: PptxThemeColorScheme): Promise; updateThemeFontScheme(fontScheme: PptxThemeFontScheme): Promise; updateThemeName(name: string): Promise; /** Resolve a `` node against the loaded theme (see PptxHandlerRuntimeStyleMatrixResolve). */ resolveStyleMatrixReferences(styleXml: XmlObject): ResolvedStyleMatrix; applyTheme(colorScheme: PptxThemeColorScheme, fontScheme: PptxThemeFontScheme, themeName?: string): Promise; load(data: ArrayBuffer, options?: PptxHandlerLoadOptions): Promise; getChartDataForGraphicFrame(slidePath: string, graphicFrame: XmlObject | undefined): Promise; getSmartArtDataForGraphicFrame(slidePath: string, graphicFrame: XmlObject | undefined): Promise; getImageData(imagePath: string): Promise; /** * Extract a media file from the PPTX archive as an ArrayBuffer. * Returns undefined if the file is not found. */ getMediaArrayBuffer(mediaPath: string): Promise; save(slides: PptxSlide[], options?: PptxHandlerSaveOptions): Promise; exportSlides(slides: PptxSlide[], options: PptxExportOptions): Promise>; /** * Get the available slide layouts for a specific slide, based on the * slide's master. Scans the slide master's relationships to find all * layouts that belong to it. * * @param slideIndex - Zero-based slide index. * @param slides - Current slides array. * @returns Array of layout options belonging to the same slide master. */ getAvailableLayoutsForSlide(slideIndex: number, slides: PptxSlide[]): Promise; /** * Resolve the editable template (master + layout) elements a slide * inherits, each carrying a `master-` / `layout-` prefixed id. Excludes * placeholders; returns only decorative shapes/pictures/graphic frames. * * @param slideId - The slide's archive path (`PptxSlide.id`). */ getTemplateElementsForSlide(slideId: string): Promise; /** * Scan the loaded PPTX archive for all theme parts. */ getAvailableThemes(): Promise>; /** * Apply a different layout to an existing slide by updating the slide's * relationship to point to the new layout and re-parsing layout * placeholders / background. * * @param slideIndex - Zero-based slide index. * @param layoutPath - Archive path of the target layout * (e.g. `ppt/slideLayouts/slideLayout2.xml`). * @param slides - Current slides array. * @returns The updated slide with new layout path, name, and background. */ applyLayoutToSlide(slideIndex: number, layoutPath: string, slides: PptxSlide[]): Promise; } //#endregion //#region src/pptx/core/core/PptxHandlerRuntimeFactory.d.ts /** * Abstract factory contract for creating {@link IPptxHandlerRuntime} * instances. * * Implement this interface to supply a custom runtime (e.g. a * WASM-backed or test-double runtime) to {@link PptxHandlerCore}. */ interface IPptxHandlerRuntimeFactory { /** Instantiate and return a new runtime implementation. */ createRuntime(): IPptxHandlerRuntime; } /** * Default factory that produces the standard {@link PptxHandlerRuntime}. * * Used internally by {@link PptxHandlerCore} when no custom factory is * provided. */ declare class PptxHandlerRuntimeFactory implements IPptxHandlerRuntimeFactory { /** * Create and return a new {@link PptxHandlerRuntime} instance. * * @returns A freshly constructed runtime ready for loading a PPTX file. */ createRuntime(): IPptxHandlerRuntime; } /** * Convenience function that creates a default {@link IPptxHandlerRuntime} * without needing to instantiate the factory class. * * @returns A new {@link PptxHandlerRuntime} instance. */ declare const createDefaultPptxHandlerRuntime: () => IPptxHandlerRuntime; //#endregion //#region src/pptx/core/services/PptxCompatibilityService.d.ts interface CompatibilityWarningInput { code: string; message: string; severity?: PptxCompatibilityWarning['severity']; scope: PptxCompatibilityWarning['scope']; slideId?: string; elementId?: string; xmlPath?: string; } interface IPptxCompatibilityService { resetWarnings(): void; getWarnings(): PptxCompatibilityWarning[]; getXmlLocalName(xmlKey: string): string; reportWarning(warning: CompatibilityWarningInput): void; inspectPresentationCompatibility(presentationXmlObj?: XmlObject): void; inspectSlideCompatibility(slideXmlObj: XmlObject, slidePath: string): void; inspectShapeCompatibility(spPr: XmlObject | undefined, txBody: XmlObject | undefined, slideId: string | undefined, elementId: string): void; inspectPictureCompatibility(blipFill: XmlObject | undefined, blip: XmlObject | undefined, slideId: string, elementId: string): void; inspectGraphicFrameCompatibility(type: PptxElement['type'], slideId: string, elementId: string): void; inspectMediaReferenceCompatibility(kind: PptxMediaReferenceKind, slideId: string, elementId: string): void; inspectSlideSynchronizationCompatibility(slideId: string): void; } declare class PptxCompatibilityService implements IPptxCompatibilityService { private warnings; private warningKeys; resetWarnings(): void; getWarnings(): PptxCompatibilityWarning[]; getXmlLocalName(xmlKey: string): string; reportWarning(warning: CompatibilityWarningInput): void; inspectPresentationCompatibility(presentationXmlObj?: XmlObject): void; inspectSlideCompatibility(slideXmlObj: XmlObject, slidePath: string): void; inspectShapeCompatibility(spPr: XmlObject | undefined, txBody: XmlObject | undefined, slideId: string | undefined, elementId: string): void; inspectPictureCompatibility(blipFill: XmlObject | undefined, blip: XmlObject | undefined, slideId: string, elementId: string): void; inspectGraphicFrameCompatibility(type: PptxElement['type'], slideId: string, elementId: string): void; inspectMediaReferenceCompatibility(kind: PptxMediaReferenceKind, slideId: string, elementId: string): void; inspectSlideSynchronizationCompatibility(slideId: string): void; private inspectUnexpectedChildren; private normalizeWarningPath; private getWarningKey; } //#endregion //#region src/pptx/core/services/PptxDocumentPropertiesUpdater.d.ts interface PptxDocumentPropertiesSaveOptions { coreProperties?: PptxCoreProperties; appProperties?: PptxAppProperties; customProperties?: PptxCustomProperty[]; } interface PptxDocumentPropertiesUpdaterContext { zip: JSZip; parser: XMLParser; builder: XMLBuilder; } declare class PptxDocumentPropertiesUpdater { private readonly context; constructor(context: PptxDocumentPropertiesUpdaterContext); updateOnSave(slides: PptxSlide[], options?: PptxDocumentPropertiesSaveOptions): Promise; /** * Declare the prefixes the dcterms date properties depend on. * * `dcterms:created` / `dcterms:modified` are always written with * `xsi:type="dcterms:W3CDTF"` (ECMA-376 Part 2 §11.3, ISO 8601 typing), but * every `CT_CoreProperties` child is optional, so a third-party generator * may ship a `core.xml` that declares neither `xsi` nor `dcterms`. Emitting * the typed attribute into that document produces XML that is not * well-formed (undeclared prefix), which PowerPoint rejects outright. */ private ensureDatePropertyNamespaces; private applyCorePropertiesOverrides; /** * Recompute `TitlesOfParts` / `HeadingPairs` from the current slide set so * the per-slide title list in `app.xml` stays consistent after slides are * added, removed, or retitled. Delegates the vector rebuild to a pure * helper; here we only derive the ordered titles. */ private updateSlideTitleProperties; private applyAppPropertiesOverrides; private updateCustomProperties; /** * Ensure `[Content_Types].xml` has an `Override` for `docProps/custom.xml` * and the root `_rels/.rels` references it (ECMA-376 §15.2.12.2 + * Part 2 §10.1.2.5). Without these, the package fails OPC validation * and Office strips the custom properties on next save. */ private ensureCustomPropertiesPackagingArtifacts; /** * Remove the Override + root rel for `docProps/custom.xml` when the * caller has emptied custom properties so the package doesn't keep an * orphan content-type entry referencing a deleted part. */ private removeCustomPropertiesPackagingArtifacts; private normalizeCustomPropertyType; private extractXmlNodeText; private toW3cDate; } //#endregion //#region src/pptx/core/services/PptxTemplateBackgroundService.d.ts interface PptxTemplateBackgroundState { layoutXmlMap: Map; masterXmlMap: Map; } interface IPptxTemplateBackgroundService { setBackground(state: PptxTemplateBackgroundState, path: string, backgroundColor: string | undefined): void; getBackgroundColor(state: PptxTemplateBackgroundState, path: string, extractBackgroundColor: (xmlObj: XmlObject, rootTag?: string) => string | undefined): string | undefined; } declare class PptxTemplateBackgroundService implements IPptxTemplateBackgroundService { setBackground(state: PptxTemplateBackgroundState, path: string, backgroundColor: string | undefined): void; getBackgroundColor(state: PptxTemplateBackgroundState, path: string, extractBackgroundColor: (xmlObj: XmlObject, rootTag?: string) => string | undefined): string | undefined; private resolvePartContext; } //#endregion //#region src/pptx/core/core/runtime/authored-slide-background.d.ts /** What one slide authored, and what it would inherit if it authored nothing. */ interface AuthoredSlideBackground { /** True when the slide's own `p:sld/p:cSld/p:bg` produced any of these. */ authored: boolean; /** The inherited (or authored) values the loader put on the model. */ color?: string | undefined; gradient?: string | undefined; image?: string | undefined; /** * A deep-cloned snapshot of the slide's own `` exactly as parsed at * load, when it authored one. `color` above is the flattened, alpha-blended * value put on the model (issue #288); this is the source XML that value * was derived from, kept so the save writer can restore it verbatim * (`a:alpha`, scheme-colour references, pattern fills, …) instead of * rebuilding `` from the flat colour alone when nothing about * the background changed. A snapshot, not a live reference: the same * parsed slide XML object is reused and mutated across repeated saves in * one handler session, so reading `p:cSld/p:bg` live at save time can see * an earlier save's output rather than what was actually authored. */ rawBgPr?: XmlObject | undefined; /** * A deep-cloned snapshot of the slide's own `` exactly as parsed, * when it authored one (a theme-referenced background, `idx` + * `a:schemeClr`, rather than a literal fill). Mirrors {@link rawBgPr} for * the OTHER shape `` can take (CT_Background is a choice between * `p:bgPr` and `p:bgRef`), so the save writer can restore either form * verbatim instead of flattening a `p:bgRef` to a literal `p:bgPr` * solid fill the moment nothing about the background changed. */ rawBgRef?: XmlObject | undefined; } //#endregion //#region src/pptx/core/services/slide-loader-types.d.ts /** * Media timing metadata for a single media element within a slide. * Captures trim points, looping, full-screen, and poster frame information. */ interface PptxMediaTimingEntry { /** Start trim offset in milliseconds. */ trimStartMs?: number; /** End trim offset in milliseconds. */ trimEndMs?: number; /** Whether the media should play in full-screen mode. */ fullScreen?: boolean; /** Whether the media should loop continuously. */ loop?: boolean; /** Path to the poster frame image within the .pptx archive. */ posterFramePath?: string; } /** * Map from media element identifier (relationship ID or shape ID) to its * timing metadata. */ type PptxMediaTimingMap = Map; /** * Result of extracting speaker notes from a slide. */ interface PptxSlideNotesResult { /** Plain-text representation of the notes. */ notes?: string; /** Rich text segments preserving formatting. */ notesSegments?: TextSegment[]; } /** * Theme override information for a slide that differs from the master theme. * Used when a layout or slide has its own color map or format scheme. */ interface PptxSlideLoaderThemeOverride { /** Color scheme overrides mapping theme color names to hex values. */ colorOverrides?: Record; /** Format scheme override (fill, line, effect styles). */ formatSchemeOverride?: PptxThemeFormatScheme; } /** * Parameter bundle for {@link IPptxSlideLoaderService.loadSlides}. * * Aggregates all dependencies and callbacks the slide loader needs to * parse, enrich, and assemble slide data from the PPTX archive. */ interface PptxSlideLoaderParams { /** Parsed root presentation XML object. */ presentationData: XmlObject; /** XML parser instance for parsing raw XML strings. */ parser: XMLParser; /** JSZip instance representing the opened .pptx archive. */ zip: JSZip; /** Service for inspecting and reporting compatibility warnings. */ compatibilityService: IPptxCompatibilityService; /** Mutable map storing parsed slide XML keyed by slide path. */ slideMap: Map; /** Map from slide numeric ID to its section metadata. */ sectionBySlideId: Map; /** Callback to register the ordered array of slide file paths. */ setOrderedSlidePaths: (paths: string[]) => void; /** Load relationship data for a specific slide. */ loadSlideRelationships: (slidePath: string, slideRelsPath: string) => Promise; /** Parse color map override from slide XML, if present. */ parseSlideClrMapOverride: (slideXml: XmlObject) => Record | null; /** Set the active color map override for the current slide being parsed. */ setCurrentSlideClrMapOverride: (override: Record | null) => void; /** * Set the master-level state (clrMap + theme color/font/format scheme) * for the slide currently being parsed. Implementations resolve the * slide → layout → master chain and switch the active per-master * theme state. Called once per slide load. Phase 2 Stream B / C-H4. */ setActiveMasterForSlide?: (slidePath: string) => void | Promise; /** Resolve the layout file path associated with a given slide path. */ findLayoutPathForSlide: (slidePath: string) => string | undefined; /** Load theme override data from a layout or slide part. */ loadThemeOverride: (partBasePath: string) => Promise; /** Apply a theme override and return a restore function to revert it. */ applyThemeOverrideState: (override: PptxSlideLoaderThemeOverride) => () => void; /** Retrieve parsed layout elements inherited by a slide. */ getLayoutElements: (slidePath: string) => Promise; /** Parse a slide XML object into an array of presentation elements. */ parseSlide: (slideXml: XmlObject, slidePath: string) => Promise; /** Extract media timing metadata from a slide's XML. */ extractMediaTimingMap: (slideXml: XmlObject, slidePath: string) => PptxMediaTimingMap; /** Enrich media elements with trim, loop, and poster frame info. */ enrichMediaElementsWithTiming: (elements: PptxElement[], timingMap: PptxMediaTimingMap) => Promise; /** Recover and attach embedded binaries for OLE elements (download/open). */ enrichOleElementsWithEmbeddedData: (elements: PptxElement[], slidePath: string) => Promise; /** * Resolve `a:buBlip` picture-bullet images that bullet parsing (synchronous) * could only leave as an `imageRelId`. See `bullet-picture-image-enrichment.ts`. */ enrichBulletPictureElementsWithEmbeddedData: (elements: PptxElement[], slidePath: string) => Promise; /** Extract solid background color from slide XML. */ extractBackgroundColor: (slideXml: XmlObject) => string | undefined; /** * A deep-cloned snapshot of the slide's own `` (undefined when the * slide authored no `p:bg`, or authored one with no `p:bgPr`), kept so a * later save can restore it verbatim when nothing about the background * changed. See {@link AuthoredSlideBackground.rawBgPr}. */ extractOwnBackgroundNode: (slideXml: XmlObject) => XmlObject | undefined; /** * The `` twin of {@link extractOwnBackgroundNode}: a deep-cloned * snapshot of the slide's own `` (a theme-referenced background), * kept so a later save can restore it verbatim instead of flattening it * to a literal `p:bgPr` fill. See {@link AuthoredSlideBackground.rawBgRef}. */ extractOwnBackgroundRefNode: (slideXml: XmlObject) => XmlObject | undefined; /** Get background color from the slide's layout (fallback). */ getLayoutBackgroundColor: (slidePath: string) => Promise; /** Extract gradient background CSS from slide XML. */ extractBackgroundGradient: (slideXml: XmlObject) => string | undefined; /** Get gradient background from the slide's layout (fallback). */ getLayoutBackgroundGradient: (slidePath: string) => Promise; /** Extract background image data URI from slide XML. */ extractBackgroundImage: (slideXml: XmlObject, slidePath: string) => Promise; /** Extract crop, tiling and image effects from a background blip fill. */ extractBackgroundImageProperties: (slideXml: XmlObject, rootElement?: string) => PptxSlide['backgroundImageProperties']; /** Get background image from the slide's layout (fallback). */ getLayoutBackgroundImage: (slidePath: string) => Promise; /** Get background image properties from the slide's layout/master fallback chain. */ getLayoutBackgroundImageProperties: (slidePath: string) => Promise; /** * Record whether this slide authored its own `` and what the * inheritance chain resolved to, so the save writer can tell a background * the user chose from one the loader flattened for painting. */ rememberSlideBackgroundOrigin: (slidePath: string, origin: AuthoredSlideBackground) => void; /** Extract speaker notes text and rich segments from a slide. */ extractSlideNotes: (slidePath: string) => Promise; /** Extract legacy (pre-Office 2021) comments from a slide. */ extractSlideComments: (slidePath: string) => Promise; /** Extract modern (Office 2021+) threaded comments from a slide. */ extractModernSlideComments: (slidePath: string) => Promise; getModernCommentPart: (slidePath: string) => PptxModernCommentPart | undefined; /** Extract a structured pattern fill (``) from slide bg. */ extractBackgroundPattern: (slideXml: XmlObject) => PptxSlideBackgroundPattern | undefined; /** Extract the `` flag from slide bg. */ extractBackgroundShadeToTitle: (slideXml: XmlObject) => boolean | undefined; /** Check whether background shapes should animate. */ extractBackgroundShowAnimation: (slideXml: XmlObject) => boolean | undefined; /** Check whether master slide shapes should be shown. */ extractShowMasterShapes: (slideXml: XmlObject) => boolean | undefined; /** Check whether inherited master placeholder animations should replay. */ extractShowMasterPhAnim: (slideXml: XmlObject) => boolean | undefined; /** Determine if a slide is marked as hidden. */ isSlideHidden: (slideXml: XmlObject, slideIdEntry: XmlObject | undefined) => boolean; /** Parse the slide transition from slide XML. */ parseSlideTransition: (slideXml: XmlObject, slidePath: string) => PptxSlideTransition | undefined; /** Parse editor-level animation definitions from slide XML. */ parseEditorAnimations: (slideXml: XmlObject) => PptxElementAnimation[] | undefined; /** Parse native OOXML animation timing trees from slide XML. */ parseNativeAnimations: (slideXml: XmlObject, slidePath: string) => PptxNativeAnimation[] | undefined; /** Resolve SmartArt data for a graphic frame element. */ getSmartArtDataForGraphicFrame: (slidePath: string, graphicFrame: XmlObject | undefined) => Promise; /** Resolve chart data for a graphic frame element. */ getChartDataForGraphicFrame: (slidePath: string, graphicFrame: XmlObject | undefined) => Promise; /** * Record freshly-parsed `chartData` as the load-time baseline for its * `chartPartPath`, so a later save can tell an untouched chart apart from * an edited one and pass the untouched part's bytes through unchanged. */ rememberChartDataBaseline: (chartData: PptxChartData) => void; /** Parse customer data tags from a slide's `p:custDataLst`. */ parseSlideCustomerData: (slideXml: XmlObject, slidePath: string) => Promise; /** Parse ActiveX control references from a slide's `p:controls`. */ parseSlideActiveXControls: (slideXml: XmlObject) => PptxActiveXControl[]; } /** * Service interface for loading all slides from a PPTX presentation. */ interface IPptxSlideLoaderService { /** * Load and parse all slides from the presentation archive. * @param params - Bundle of dependencies and callbacks for slide parsing. * @returns Array of fully parsed slide objects in presentation order. */ loadSlides: (params: PptxSlideLoaderParams) => Promise; } //#endregion //#region src/pptx/core/services/PptxSlideLoaderService.d.ts /** * Concrete implementation of the slide loader service. * * Reads the presentation's `p:sldIdLst` to determine slide ordering, then * processes each slide sequentially to preserve layout and theme override * state across slides. */ declare class PptxSlideLoaderService implements IPptxSlideLoaderService { /** * Load all slides from the PPTX archive in presentation order. * * @param params - Aggregated dependencies and extraction callbacks. * @returns Array of fully assembled {@link PptxSlide} objects. */ loadSlides(params: PptxSlideLoaderParams): Promise; /** * Load the presentation-level relationships XML and build a map * from relationship IDs to their target file paths. * * @param params - Loader params providing the zip archive and parser. * @returns Map of relationship ID to target path string. */ private loadPresentationSlideRels; /** * Load and assemble a single slide from the archive. * * Resolves the slide file path, parses its XML, loads relationships, * applies theme overrides, extracts elements/backgrounds/notes/comments/ * transitions/animations, and builds the final {@link PptxSlide} object. * * @param params - Loader params with all extraction callbacks. * @param slideIdNode - The `p:sldId` XML node for this slide. * @param slideIndex - Zero-based index of this slide in presentation order. * @param relsMap - Presentation-level relationship ID to target path map. * @returns The assembled slide, or `undefined` if the slide could not be loaded. */ private loadSingleSlide; /** * Post-process loaded slides to enrich SmartArt elements with diagram data. * * Iterates all elements in all slides, and for any SmartArt element that * lacks diagram data, attempts to resolve it from the graphic frame XML. * Failures are silently caught since SmartArt enrichment is non-critical. * * @param slides - Array of loaded slides to enrich. * @param params - Loader params providing the SmartArt extraction callback. */ private enrichSmartArtData; /** * Post-process loaded slides to enrich chart elements with parsed data. * * Mirrors {@link enrichSmartArtData}: iterates every element, and for any * chart element that lacks `chartData`, resolves it from the graphic frame * XML via the chart parser. Without this pass a chart loaded from a `.pptx` * has no `chartData`, so every binding renders the neutral "Chart" * placeholder instead of the real chart. Failures are silently caught since * chart enrichment is non-critical (the placeholder remains). * * @param slides - Array of loaded slides to enrich. * @param params - Loader params providing the chart extraction callback. */ private enrichChartData; /** * Normalize a value into an array of XmlObject entries. * Handles the common OOXML pattern where a single child is an object * but multiple children are an array. * * @param value - Raw XML value (object, array, or undefined). * @returns Array of XmlObject entries (may be empty). */ private toXmlObjectArray; /** * Type guard to check if a value is a non-null, non-array object (XmlObject). * * @param value - Value to check. * @returns `true` if the value is an XmlObject. */ private isXmlObject; } //#endregion //#region src/pptx/core/services/PptxXmlLookupService.d.ts interface IPptxXmlLookupService { getChildByLocalName(parent: XmlObject | undefined, localName: string): XmlObject | undefined; getChildrenArrayByLocalName(parent: XmlObject | undefined, localName: string): XmlObject[]; getScalarChildByLocalName(parent: XmlObject | undefined, localName: string): string | undefined; hasChildByLocalName(parent: XmlObject | undefined, localName: string): boolean; } declare class PptxXmlLookupService implements IPptxXmlLookupService { getChildByLocalName(parent: XmlObject | undefined, localName: string): XmlObject | undefined; getChildrenArrayByLocalName(parent: XmlObject | undefined, localName: string): XmlObject[]; getScalarChildByLocalName(parent: XmlObject | undefined, localName: string): string | undefined; /** * Report whether `parent` declares a child with this local name, regardless * of what the child parsed to. * * Valueless elements such as `a:noFill` or `a:buNone` carry their whole * meaning in being present, and the parser represents them as an empty * string rather than an object, so the child accessors above return * `undefined` for them. Presence has to be asked for directly. */ hasChildByLocalName(parent: XmlObject | undefined, localName: string): boolean; private toXmlArray; private isXmlObject; } //#endregion //#region src/pptx/core/services/PptxEditorAnimationService.d.ts /** * Configuration options for creating a {@link PptxEditorAnimationService}. */ interface PptxEditorAnimationServiceOptions { /** Service for namespace-aware XML child lookups. */ xmlLookupService: IPptxXmlLookupService; /** URI used in the `@uri` attribute of the extension element. */ editorMetaExtensionUri: string; /** XML namespace URI for the editor metadata elements. */ editorMetaNamespaceUri: string; } /** * Interface for parsing and writing editor-level animation definitions. */ interface IPptxEditorAnimationService { /** * Parse editor animation metadata from a slide's extension list. * @param slideXml - The full slide XML object. * @returns Array of parsed animations, empty array if extension exists but has * no animations, or `undefined` if the extension is absent. */ parseEditorAnimations(slideXml: XmlObject | undefined): PptxElementAnimation[] | undefined; /** * Serialize editor animations back into the slide's extension list. * @param slideNode - The root slide XML node (e.g., the `p:sld` element). * @param animations - The animations to write. */ applyEditorAnimations(slideNode: XmlObject, animations: PptxElementAnimation[]): void; } /** * Concrete implementation that reads/writes editor animation metadata * from/to the custom `pptx:editorMeta` extension element in slide XML. */ declare class PptxEditorAnimationService implements IPptxEditorAnimationService { private readonly xmlLookupService; private readonly editorMetaExtensionUri; private readonly editorMetaNamespaceUri; /** * @param options - Service configuration with XML lookup and extension URIs. */ constructor(options: PptxEditorAnimationServiceOptions); /** * Parse editor animation metadata from a slide XML object. * * Traverses the slide's `p:extLst` to find the editor meta extension, * then extracts each `pptx:animation` node and normalizes its attributes * into typed {@link PptxElementAnimation} objects. * * @param slideXml - The full slide XML object. * @returns Sorted array of animations, empty array if no animations found, * or `undefined` if the editor extension is not present. */ parseEditorAnimations(slideXml: XmlObject | undefined): PptxElementAnimation[] | undefined; /** * Serialize editor animations into the slide's XML extension list. * * Sanitizes and validates each animation entry, removes any existing editor * meta extension, then writes the new animations into a `pptx:editorMeta` * extension element. If no valid animations remain, the extension is removed. * * @param slideNode - The root slide XML node to modify. * @param animations - Editor animations to serialize. */ applyEditorAnimations(slideNode: XmlObject, animations: PptxElementAnimation[]): void; } //#endregion //#region src/pptx/core/services/PptxNativeAnimationService.d.ts /** * Interface for parsing native OOXML animation data from slide XML. */ interface IPptxNativeAnimationService { /** * Parse the native OOXML timing tree from a slide XML object. * @param slideXml - The full slide XML object. * @returns Array of native animations, or `undefined` if no timing data exists. */ parseNativeAnimations(slideXml: XmlObject): PptxNativeAnimation[] | undefined; } /** * Concrete implementation that recursively walks the OOXML `p:timing` tree * and extracts animation effect data into a flat array. */ declare class PptxNativeAnimationService implements IPptxNativeAnimationService { /** * Assigns each `p:excl` container encountered while walking one slide's * timing tree its own id, so playback can tell two independent exclusive * groups apart (see {@link PptxNativeAnimation.exclGroupId}). Reset at the * start of every {@link parseNativeAnimations} call; this service instance * is reused across slides, and ids only need to be unique within one * slide's own animation list. */ private exclGroupSeq; /** * Parse native OOXML animations from a slide's timing tree. * * Extracts the `p:timing/p:tnLst` structure, recursively walks the nested * `p:par`/`p:seq`/`p:excl` containers, parses interactive sequences, and * applies build list metadata to the resulting animations. * * @param slideXml - The full slide XML object. * @returns Array of native animations, or `undefined` if the slide has no * timing data or parsing fails. */ parseNativeAnimations(slideXml: XmlObject): PptxNativeAnimation[] | undefined; } //#endregion //#region src/pptx/core/services/PptxSlideTransitionService.d.ts /** * Configuration options for creating a {@link PptxSlideTransitionService}. */ interface PptxSlideTransitionServiceOptions { /** Service for namespace-aware XML child lookups. */ xmlLookupService: IPptxXmlLookupService; /** Utility to extract the local name portion from a namespaced XML key. */ getXmlLocalName: (xmlKey: string) => string; } /** * Interface for parsing and building slide transition XML. */ interface IPptxSlideTransitionService { /** * Parse the `p:transition` element from a slide's XML. * @param slideXml - The full slide XML object. * @returns Parsed transition data, or `undefined` if no transition is defined. */ parseSlideTransition(slideXml: XmlObject | undefined): PptxSlideTransition | undefined; /** * Build a `p:transition` XML object from transition data. * @param transition - Transition configuration to serialize. * @returns XML object suitable for writing, or `undefined` for "none" transitions. */ buildSlideTransitionXml(transition: PptxSlideTransition): XmlObject | undefined; } /** * Concrete service for parsing slide transition XML from OOXML presentations * and serializing transition data back to XML. * * Supports both standard transitions and p14 (Office 2010+) extended * transitions stored in extension lists. */ declare class PptxSlideTransitionService implements IPptxSlideTransitionService { private readonly xmlLookupService; private readonly getXmlLocalName; constructor(options: PptxSlideTransitionServiceOptions); parseSlideTransition(slideXml: XmlObject | undefined): PptxSlideTransition | undefined; buildSlideTransitionXml(transition: PptxSlideTransition): XmlObject | undefined; } //#endregion //#region src/pptx/core/services/animation-write-mappings-types.d.ts /** * Shared type for `animation-write-mappings.ts` and its per-class preset * table modules (`-entrance.ts` / `-exit.ts` / `-emphasis.ts`). Split into * its own module so those tables can import the type without creating a * circular dependency on the orchestrating `animation-write-mappings.ts`. * * @module services/animation-write-mappings-types */ /** Maps editor animation presets to OOXML preset class + presetID pairs. */ interface OoxmlPresetMapping { presetClass: 'entr' | 'exit' | 'emph' | 'path'; presetId: number; /** Default OOXML preset subtype (direction variant). */ defaultSubtype: number; } //#endregion //#region src/pptx/core/services/animation-write-mappings.d.ts /** * Forward lookup: editor preset name -> OOXML mapping. * * Existing typed names (e.g. `flyIn`, `fadeIn`, `pulse`) are preserved for * compatibility with `PptxAnimationPreset` and existing serialisation * tests. Additional canonical PowerPoint preset names are appended so the * round-trip can name and re-emit the full library. */ declare const PRESET_TO_OOXML: Record; /** * Resolve an editor effect token to its OOXML mapping: a typed preset name * (`flyIn`) through {@link PRESET_TO_OOXML}, or a catalogue id (`entr.41`, * what the "Add animation > Effect" pickers store) directly, taking the * default subtype from `defaultSubtypeFor` (the captured PowerPoint table) * when one is known. `undefined` for anything else. */ declare function resolveOoxmlPresetMapping(token: string, defaultSubtypeFor?: (presetClass: 'entr' | 'exit', presetId: number) => number | undefined): OoxmlPresetMapping | undefined; declare const OOXML_TO_PRESET_ENTR: Record; declare const OOXML_TO_PRESET_EXIT: Record; declare const OOXML_TO_PRESET_EMPH: Record; /** * Reverse lookup: resolve a parsed `(presetClass, presetID)` pair to the * canonical typed preset name (the key of `PRESET_TO_OOXML`). * * @returns the typed preset name, or `undefined` if the combination is * unknown. Path-class presets always return `undefined` because their * integer IDs are not standardised; round-trip is preserved via the * raw `presetID` and `motionPath` SVG string instead. */ declare function ooxmlToPresetName(args: { presetClass: 'entr' | 'exit' | 'emph' | 'path'; presetId: number; }): string | undefined; interface IPptxAnimationWriteService { buildTimingXml(animations: PptxElementAnimation[], existingRawTiming: XmlObject | undefined): XmlObject | undefined; } //#endregion //#region src/pptx/core/core/factories/PptxRuntimeDependencyFactory.d.ts interface PptxRuntimeDependencyFactoryInput { zip: JSZip; parser: XMLParser; builder: XMLBuilder; editorMetaExtensionUri: string; editorMetaNamespaceUri: string; getXmlLocalName: (xmlKey: string) => string; } interface PptxRuntimeDependencyBundle { compatibilityService: IPptxCompatibilityService; slideLoaderService: IPptxSlideLoaderService; slideTransitionService: IPptxSlideTransitionService; editorAnimationService: IPptxEditorAnimationService; nativeAnimationService: IPptxNativeAnimationService; animationWriteService: IPptxAnimationWriteService; templateBackgroundService: IPptxTemplateBackgroundService; xmlLookupService: IPptxXmlLookupService; documentPropertiesUpdater: PptxDocumentPropertiesUpdater; } interface IPptxRuntimeDependencyFactory { createParser: () => XMLParser; createBuilder: () => XMLBuilder; createDocumentPropertiesUpdater: (zip: JSZip, parser: XMLParser, builder: XMLBuilder) => PptxDocumentPropertiesUpdater; createDependencies: (input: PptxRuntimeDependencyFactoryInput) => PptxRuntimeDependencyBundle; } declare class PptxRuntimeDependencyFactory implements IPptxRuntimeDependencyFactory { createParser(): XMLParser; createBuilder(): XMLBuilder; createDocumentPropertiesUpdater(zip: JSZip, parser: XMLParser, builder: XMLBuilder): PptxDocumentPropertiesUpdater; createDependencies(input: PptxRuntimeDependencyFactoryInput): PptxRuntimeDependencyBundle; } //#endregion //#region src/pptx/core/utils/presentation-collections.d.ts /** * Slide-reference remapping produced by the presentation-slides reconciler. * * When slides are reordered, added, or removed the reconciler may reassign a * slide relationship id (`r:id`) and mints fresh numeric slide ids for new * slides. Custom shows reference slides by relationship id and sections by * numeric slide id, so those references must be rewritten to the current * values (and references to removed slides dropped) before serialization. */ interface PptxSlideReferenceRemap { /** Old presentation-rels slide rId -> current rId, for surviving slides. */ rIdByOldRId: Map; /** Old numeric slide id -> current numeric slide id, for surviving slides. */ sldIdByOldSldId: Map; /** Old slide rIds whose slide was removed (references must be dropped). */ removedRIds: Set; /** Old numeric slide ids whose slide was removed (references must be dropped). */ removedSldIds: Set; /** True when any reference changed or any slide was removed. */ changed: boolean; } declare function parseCustomShows(presentationData: XmlObject | null, lookup: IPptxXmlLookupService): PptxCustomShow[] | undefined; declare function applyCustomShows(presentation: XmlObject, shows: PptxCustomShow[] | undefined, lookup: IPptxXmlLookupService, remap?: PptxSlideReferenceRemap): void; declare function applySections(presentation: XmlObject, sections: PptxSection[] | undefined, lookup: IPptxXmlLookupService, remap?: PptxSlideReferenceRemap): void; //#endregion //#region src/pptx/core/utils/diagram-relationship-ids.d.ts /** Typed view of the four required relationship attributes on `dgm:relIds`. */ interface DiagramRelationshipIds { dataRelId?: string; layoutRelId?: string; styleRelId?: string; colorsRelId?: string; } /** * Read `CT_RelIds` without assuming the conventional `dgm` or `r` prefixes. * Namespace prefixes are aliases and may legally differ in Strict documents. */ declare function parseDiagramRelationshipIds(graphicData: XmlObject | undefined): DiagramRelationshipIds | undefined; /** * Apply edited relationship ids to an existing SmartArt graphic frame. * Unspecified ids, unknown attributes, child markup, and extensions are kept. */ declare function applyDiagramRelationshipIds(frame: XmlObject, data: Pick): void; //#endregion //#region src/pptx/core/utils/ooxml-crypto-types.d.ts /** * Type definitions for OOXML encryption and decryption. * * Contains all interfaces and type aliases used by the OOXML crypto modules. * * @module ooxml-crypto-types */ /** Supported encryption algorithms. */ type EncryptionAlgorithm = 'AES128' | 'AES256'; /** * Which OOXML encryption scheme to write when creating a password-protected * file. Real PowerPoint can write and open either scheme; this library * defaults to 'agile' (Office 2010+), matching PowerPoint's own default. */ type EncryptionScheme = 'agile' | 'standard'; /** Parsed encryption info from the EncryptionInfo stream (agile format). */ interface EncryptionInfo { /** Encryption version (major.minor). */ version: { major: number; minor: number; }; /** Whether this is agile encryption. */ isAgile: boolean; /** Key encryption data. */ keyData: { saltSize: number; blockSize: number; keyBits: number; hashSize: number; cipherAlgorithm: string; cipherChaining: string; hashAlgorithm: string; saltValue: Uint8Array; }; /** Data integrity verification. */ dataIntegrity?: { encryptedHmacKey: Uint8Array; encryptedHmacValue: Uint8Array; }; /** Password verifier encryption data. */ passwordKeyEncryptor: { saltSize: number; blockSize: number; keyBits: number; hashSize: number; cipherAlgorithm: string; cipherChaining: string; hashAlgorithm: string; saltValue: Uint8Array; spinCount: number; encryptedVerifierHashInput: Uint8Array; encryptedVerifierHashValue: Uint8Array; encryptedKeyValue: Uint8Array; }; } /** * Standard encryption info (Office 2007 format, versions 2.x/3.x/4.x). */ interface StandardEncryptionInfo { /** Encryption version (major.minor). */ version: { major: number; minor: number; }; /** Always false for standard encryption. */ isAgile: false; /** Always true for standard encryption. */ isStandard: true; /** Encryption flags. */ flags: number; /** Size of the encryption header in bytes. */ headerSize: number; /** Encryption header describing algorithm and provider. */ header: { flags: number; algId: number; algIdHash: number; keySize: number; providerType: number; cspName: string; }; /** Password verifier data. */ verifier: { saltSize: number; salt: Uint8Array; encryptedVerifier: Uint8Array; verifierHashSize: number; encryptedVerifierHash: Uint8Array; }; } /** Encryption options for creating encrypted files. */ interface EncryptionOptions { /** The encryption algorithm to use (defaults to AES256). */ algorithm?: EncryptionAlgorithm; /** Number of hash iterations for key derivation (defaults to 100000). Lower values speed up tests. */ spinCount?: number; /** * Which encryption scheme to write (defaults to 'agile'). 'standard' * writes the ECMA-376 Standard scheme (Office 2007-compatible: a single * password-derived AES-CBC key with a zero IV over the whole package), * mirroring the scheme this library already knows how to decrypt. */ encryptionScheme?: EncryptionScheme; } //#endregion //#region src/pptx/core/utils/signature-detection.d.ts /** * Detect, parse, and validate digital signatures in OOXML packages. * * Digital signatures live in `_xmlsignatures/` parts: * - `_xmlsignatures/origin.sigs` — relationship origin * - `_xmlsignatures/sig1.xml`, `sig2.xml`, etc. — individual signatures * * Each signature XML follows the W3C XML-DSig spec and contains: * - `ds:SignedInfo` with `ds:Reference` digests * - `ds:SignatureValue` (base64-encoded signature) * - `ds:KeyInfo > ds:X509Data > ds:X509Certificate` (base64-encoded DER cert) */ /** Result of signature detection. */ interface SignatureDetectionResult { hasSignatures: boolean; signatureCount: number; signaturePaths: string[]; } /** X.509 certificate information extracted from a signature. */ interface SignatureCertificateInfo { /** Base64-encoded DER certificate data. */ certificateBase64: string; /** Issuer distinguished name (CN, O, etc.) if parseable. */ issuer?: string; /** Subject distinguished name (CN, O, etc.) if parseable. */ subject?: string; /** Certificate serial number as hex string. */ serialNumber?: string; /** Not-before validity date (ISO string). */ validFrom?: string; /** Not-after validity date (ISO string). */ validTo?: string; } /** Status of a digital signature. */ type SignatureStatus = 'valid' | 'invalid' | 'expired' | 'unknownCA' | 'unverified'; /** Parsed digital signature with certificate info and validation status. */ interface ParsedSignature { /** Path to the signature XML in the ZIP. */ signaturePath: string; /** The canonicalized signing method algorithm URI. */ signatureMethod?: string; /** The digest method algorithm URI from the first reference. */ digestMethod?: string; /** Base64-encoded signature value. */ signatureValue?: string; /** Certificate information, if X.509 data was found. */ certificate?: SignatureCertificateInfo; /** Signature validation status. */ status: SignatureStatus; /** Reference URIs and their digest values. */ references: SignatureReference[]; } /** A single ds:Reference in the SignedInfo. */ interface SignatureReference { /** The URI identifying the signed part. */ uri: string; /** The digest method algorithm. */ digestMethod?: string; /** Base64-encoded digest value. */ digestValue?: string; } /** * Detect digital signatures by checking for `_xmlsignatures/` paths in the ZIP entries. */ declare function detectDigitalSignatures(zipEntryPaths: string[]): SignatureDetectionResult; /** * Get the list of ZIP entry paths that should be removed to strip signatures. * Includes all `_xmlsignatures/` entries (XML, .sigs, .rels, etc.). */ declare function getSignaturePathsToStrip(zipEntryPaths: string[]): string[]; /** * Parse a single ds:Signature XML document into structured signature info. * * @param signatureXml - The parsed XML object (from fast-xml-parser). * @param signaturePath - Path to the sig*.xml file in the ZIP. * @returns Parsed signature info with certificate data and unverified status. */ declare function parseSignatureXml(signatureXml: Record, signaturePath: string): ParsedSignature; /** * Verify a signature's digest references against actual document content. * * Uses the Web Crypto API (SubtleCrypto) to compute SHA-256/SHA-1 digests * of referenced parts and compare against the signed digest values. * * @param signature - The parsed signature to verify. * @param getPartContent - Function that retrieves part content by URI. * @returns The updated signature status after digest verification. */ declare function verifySignatureDigests(signature: ParsedSignature, getPartContent: (uri: string) => Promise): Promise; //#endregion //#region src/pptx/core/utils/alternate-content.d.ts /** * Select the appropriate branch from a parsed mc:AlternateContent element. * * Iterates through mc:Choice elements in order. Returns the first Choice * whose @Requires namespaces are all in the supported set. If no Choice * matches, returns the mc:Fallback content (or undefined if absent). * * Handles nested mc:AlternateContent within the selected branch by * recursively resolving them. */ declare function selectAlternateContentBranch(ac: XmlObject): XmlObject | undefined; /** * Element tag names that represent renderable shapes/objects in a shape tree. */ declare const SHAPE_TREE_ELEMENT_TAGS: Set; /** * Record of a single `mc:AlternateContent` block resolved during parse. * * Captured by {@link unwrapAlternateContent} so the runtime can reproduce * the original `` / `` envelope on dirty save. * * `rawAc` is the parsed AC envelope object exactly as fast-xml-parser * produced it (containing one or more `mc:Choice` children plus an * optional `mc:Fallback`). `selectedBranch` indicates which branch was * merged into the spTree at parse time. `choiceIndex` (when branch is * `choice`) identifies which `mc:Choice` was selected - needed for * AC blocks containing multiple Choices. `childRefs` holds the actual * XmlObject references that were appended to the parent container - * used by the save layer to associate parsed elements with this block. */ interface AlternateContentBlock { rawAc: XmlObject; selectedBranch: 'choice' | 'fallback'; choiceIndex?: number; childRefs: Array<{ tag: string; node: XmlObject; }>; } /** * Unwrap mc:AlternateContent elements within a shape tree (or group) * container, merging the selected branch's children into the parent * element arrays. * * This mutates the container in-place: mc:AlternateContent entries are * consumed, and their resolved element children (p:sp, p:pic, etc.) are * appended to the corresponding arrays on the container. * * Returns a list of `AlternateContentBlock` records - one per consumed AC * envelope - so callers can preserve the original Choice/Fallback shape * on save (CC-4). The returned `childRefs` reference the same XmlObject * instances that were merged into the container, so callers can identify * them later via reference equality. */ declare function unwrapAlternateContent(container: Record): AlternateContentBlock[]; /** * The passthrough-save counterpart to {@link unwrapAlternateContent}: rebuild * `mc:AlternateContent` envelopes that were flattened at parse time, using the * records `unwrapAlternateContent` left in `blockByNode`. * * Layout and master parts that a save leaves untouched are re-serialized * straight from the cached, ALREADY-UNWRAPPED parse-time XmlObject (see * `PptxHandlerRuntimeSavePipeline`'s passthrough flush) - there is no writer * pass to re-wrap them the way an edited part gets via * `reapplyAlternateContentEnvelopes`. Without this, an `mc:AlternateContent` * envelope inside a slide master or layout's shape tree is unwrapped on the * FIRST load and never reconstituted: the `mc:Fallback` branch is discarded * permanently and the depth-0 child sequence changes, even on a save that * edited nothing (CC-4 for templates; see `template-mce.pptx` in the fixture * corpus manifest). * * Never mutates `container`: returns the same reference when nothing needs * restoring, or a new tree - cloned only at the levels that changed, exactly * like the sibling `withTemplateSpTreeOrder` ordering pass - so the cached * `layoutXmlMap` / `masterXmlMap` entry a second save reads is untouched. * Recurses into `p:grpSp` because `unwrapAlternateContent` runs per-group too. */ declare function reapplyAlternateContentToTree(container: XmlObject, blockByNode: WeakMap): XmlObject; //#endregion //#region src/pptx/core/utils/strict-namespace-map.d.ts /** * Strict OOXML Conformance - Namespace Normalization & Round-Trip * * Office 365 can save files in "Strict Open XML" mode (ISO/IEC 29500 Strict) * which uses different namespace URIs than Transitional (ECMA-376). * * This module provides bidirectional mapping between Strict and Transitional * namespace URIs, enabling: * - Load: normalize Strict URIs to Transitional for internal processing * - Save: convert Transitional URIs back to Strict for round-trip fidelity * * Only the markup-language families defined by ISO/IEC 29500-1 (Fundamentals * and Markup Language Reference) are remapped between conformance classes: * `presentationml`, `drawingml`, `spreadsheetml`, `wordprocessingml`, * `officeDocument` (including its relationship-type URIs), `schemaLibrary`, and * `descriptions`. This matches the authoritative translation table the Open XML * SDK applies when opening a Strict package. * * The Open Packaging Conventions (ISO/IEC 29500-2: `package/*` content-types and * relationships, and the OPC-defined relationship types such as * core-properties and digital-signature) and Markup Compatibility & Extensibility * (ISO/IEC 29500-3: `markup-compatibility/2006`) are SHARED, conformance-INDEPENDENT * specifications. Real Office "Strict Open XML" files keep those namespaces and * relationship types in their canonical `schemas.openxmlformats.org` form even * though the markup inside the parts uses Strict (`purl.oclc.org`) namespaces. * They are therefore intentionally NOT remapped here, in either direction. * * Reference: ECMA-376 5th Edition, Part 1, Annex A & B; ISO/IEC 29500 Parts 2-4. */ /** OOXML conformance class. */ type OoxmlConformanceClass = 'strict' | 'transitional'; /** * Convert a Strict Open XML namespace URI to its Transitional equivalent. * The explicit map takes precedence; any other Strict URI in a remapped family * is derived structurally. If the URI is already Transitional (or unknown), it * is returned unchanged. */ declare function normalizeNamespaceUri(uri: string): string; /** * Check whether a URI belongs to the Strict Open XML namespace family. */ declare function isStrictNamespaceUri(uri: string): boolean; /** * Detect whether a parsed XML object tree contains Strict Open XML * namespace declarations. Checks `@_xmlns` and `@_xmlns:*` attributes * on the first-level root element. */ declare function detectStrictConformance(xmlObj: Record): boolean; /** * Recursively normalize all Strict namespace URIs within a parsed XML * object tree to their Transitional equivalents. * * Normalizes: * - `@_xmlns` and `@_xmlns:*` attribute values (namespace declarations) * - `@_Type` attribute values on Relationship elements (relationship type URIs) * - `@_uri` attribute values (extension URIs that may use Strict form) * * The transformation is performed **in-place** for efficiency. */ declare function normalizeStrictXml(node: Record): Record; /** * Convert a Transitional Open XML namespace URI to its Strict equivalent. * The explicit map takes precedence; any other versioned Transitional URI in a * remapped family is derived structurally. If the URI is already Strict (or * unknown), it is returned unchanged. */ declare function toStrictNamespaceUri(uri: string): string; /** * Check whether a URI belongs to the Transitional Open XML namespace family, * either by explicit mapping or by the structural family rule. */ declare function isTransitionalNamespaceUri(uri: string): boolean; /** * Check whether raw part XML contains a Transitional URI in an attribute that * a Strict-conformance conversion is actually able to rewrite: a namespace * declaration (`xmlns`/`xmlns:*`), a relationship `Type`, or an extension * `uri`. `convertXmlToStrict` only ever touches those three attribute kinds * (see its doc comment), so this mirrors that surface exactly. * * A plain substring/URI scan is too broad: a Strict SmartArt data part * commonly carries a Transitional URI inside unrelated compatibility * metadata such as `minVer`. Matching that value triggered a needless * reparse/rebuild of an otherwise untouched diagram part, and fast-xml-parser * does not preserve the authored order of heterogeneous diagram children * (`dgm:pt`/`dgm:cxn` siblings), so the rebuild could silently reorder them * and change the rendered diagram even though nothing in the part actually * needed Strict conversion. */ declare function containsConvertibleStrictNamespaceAttribute(xml: string): boolean; /** * Recursively convert all Transitional namespace URIs within a parsed XML * object tree to their Strict equivalents. * * Converts: * - `@_xmlns` and `@_xmlns:*` attribute values (namespace declarations) * - `@_Type` attribute values on Relationship elements (relationship type URIs) * - `@_uri` attribute values (extension URIs) * * Also sets `conformance="strict"` on the root `p:presentation` element * when `setConformance` is true. * * The transformation is performed **in-place** for efficiency. */ declare function convertXmlToStrict(node: Record, setConformance?: boolean): Record; //#endregion //#region src/pptx/core/utils/smart-tags-parser.d.ts /** * Parse `p:presentation/p:smartTags` and resolve its relationship target, * when possible, against `ppt/_rels/presentation.xml.rels`. * * Returns `undefined` when the presentation carries no `p:smartTags` * element at all. */ declare function parsePresentationSmartTags(zip: JSZip, parseXml: (xml: string) => XmlObject, presentationData: XmlObject | null | undefined): Promise; //#endregion //#region src/pptx/core/utils/chart-color-choice.d.ts /** * Resolve an authored colour-choice node (`a:schemeClr` with its transforms, * `a:sysClr`, `a:prstClr`, ...) to the hex it currently paints. * * Optional throughout: a serializer called without one cannot tell an authored * theme colour from an edited literal, so it replaces the node, which is the * behaviour every one of them had before this module existed. The save runtime * supplies `parseColor`; a caller fabricating a brand-new chart has nothing to * preserve and passes nothing. */ type ResolveChartColor = (node: XmlObject) => string | undefined; //#endregion //#region src/pptx/core/core/factories/types.d.ts interface IFactory { create(init: TInit): TResult; } //#endregion //#region src/pptx/core/core/factories/PptxSaveConstantsFactory.d.ts interface PptxSaveConstants { slideRelationshipType: string; slideLayoutRelationshipType: string; slideImageRelationshipType: string; slideMediaRelationshipType: string; slideVideoRelationshipType: string; slideAudioRelationshipType: string; slideCommentRelationshipType: string; slideNotesRelationshipType: string; slideSyncRelationshipType: string; slideSyncContentType: string; relationshipsNamespace: string; slideContentType: string; commentContentType: string; commentAuthorContentType: string; commentAuthorsPartName: string; /** The resolved conformance class for the save operation. */ conformance: OoxmlConformanceClass; } declare class PptxSaveConstantsFactory implements IFactory { create(conformance?: OoxmlConformanceClass): PptxSaveConstants; } declare const createPptxSaveConstants: (conformance?: OoxmlConformanceClass) => PptxSaveConstants; //#endregion //#region src/pptx/core/core/runtime/master-part-tags.d.ts /** * @fileoverview Root tags and element-id prefixes for the four "template" * parts whose shape trees the Slide Master view renders and edits. * * Kept in its own module so the save-side writer can name the tag union * without importing the load-side parser, which sits further down the mixin * chain. */ /** Root tags of the parts whose shape tree the Slide Master view can edit. */ type MasterPartRootTag = 'p:notesMaster' | 'p:handoutMaster' | 'p:sldMaster' | 'p:sldLayout'; //#endregion //#region src/pptx/core/core/builders/PptxConnectorParser.d.ts interface ConnectorTextResult { text: string; textStyle: TextStyle; textSegments: TextSegment[]; } interface PptxConnectorParserContext { emuPerPx: number; getOrderedSlidePaths: () => string[]; slideRelsMap: Map>; parseGeometryAdjustments: (prstGeom: XmlObject | undefined) => Record | undefined; readFlipState: (xfrm: XmlObject | undefined) => { flipHorizontal?: boolean; flipVertical?: boolean; }; extractShapeStyle: (spPr: XmlObject | undefined, styleNode?: XmlObject) => ShapeStyle; parseShapeLocks: (spLocks: XmlObject | undefined) => PptxElement['locks']; parseElementActions: (cNvPr: XmlObject | undefined, slideRelationships: Map | undefined, orderedSlidePaths: string[]) => { actionClick?: PptxElement['actionClick']; actionHover?: PptxElement['actionHover']; }; /** Parse text body XML into text, style, and segments. */ parseConnectorTextBody?: (txBody: XmlObject | undefined, slidePath?: string) => ConnectorTextResult | null; } interface IPptxConnectorParser { parseConnector(connector: XmlObject, id: string, slidePath?: string): PptxElement | null; } declare class PptxConnectorParser implements IPptxConnectorParser { private readonly context; constructor(context: PptxConnectorParserContext); parseConnector(connector: XmlObject, id: string, slidePath?: string): PptxElement | null; } //#endregion //#region src/pptx/core/core/builders/PptxContentTypesBuilder.d.ts interface PptxContentTypesSlideMediaBuildInput { contentTypesData: XmlObject; slidePaths: string[]; usedMediaPaths: Set; usedInkPaths?: Set; slideContentType: string; } interface PptxContentTypesCommentBuildInput { contentTypesData: XmlObject; activeCommentPaths: Set; hasCommentAuthors: boolean; commentContentType: string; commentAuthorContentType: string; commentAuthorsPartName: string; } interface PptxContentTypesCustomXmlBuildInput { contentTypesData: XmlObject; customXmlParts: PptxCustomXmlPart[]; } interface IPptxContentTypesBuilder { applySlideAndMediaUpdates(init: PptxContentTypesSlideMediaBuildInput): XmlObject; applyCommentUpdates(init: PptxContentTypesCommentBuildInput): XmlObject; applyCustomXmlUpdates(init: PptxContentTypesCustomXmlBuildInput): void; applyOutputFormatOverride(contentTypesData: XmlObject, format: PptxSaveFormat, hasVba: boolean): void; } declare class PptxContentTypesBuilder implements IPptxContentTypesBuilder { private readonly mimeByExtension; applySlideAndMediaUpdates(init: PptxContentTypesSlideMediaBuildInput): XmlObject; private applyInkOverrides; applyCommentUpdates(init: PptxContentTypesCommentBuildInput): XmlObject; private applyMediaDefaults; private ensureTypesRoot; private ensureArray; private normalizePartName; /** Standard content type for custom XML item data parts. */ private static readonly CUSTOM_XML_CONTENT_TYPE; /** * Ensure `[Content_Types].xml` contains Override entries for each * custom XML properties part (`customXml/itemProps{id}.xml`). * * The custom XML item files themselves are covered by a Default * extension entry for `.xml`, so only the itemProps overrides need * explicit registration. */ applyCustomXmlUpdates(init: PptxContentTypesCustomXmlBuildInput): void; /** Content type for the main presentation part keyed by output format. */ private static readonly PRESENTATION_CONTENT_TYPES; private static readonly VBA_PROJECT_CONTENT_TYPE; /** * Rewrite the main presentation content type for the chosen output format. * For PPTM, also ensures a vbaProject.bin content type override exists. */ applyOutputFormatOverride(contentTypesData: XmlObject, format: PptxSaveFormat, hasVba: boolean): void; } //#endregion //#region src/pptx/core/core/builders/PptxPresentationSaveBuilder.d.ts interface PptxPresentationSaveBuilderOptions { headerFooter?: PptxHeaderFooter; presentationProperties?: PptxPresentationProperties; customShows?: PptxCustomShow[]; sections?: PptxSection[]; photoAlbum?: PptxPhotoAlbum; kinsoku?: PptxKinsoku | null; modifyVerifier?: PptxModifyVerifier | null; /** * Slide dimensions to write instead of the load-time ones. Only the * fields that are present override; a missing `type` keeps whatever the * loaded `p:sldSz` carried, and an explicitly empty string removes it. */ slideSize?: PptxSlideSize; /** `p:presentation/@embedTrueTypeFonts` to write. `undefined` preserves the loaded value. */ embedTrueTypeFonts?: boolean; /** `p:defaultTextStyle` level edits to merge in. `undefined` preserves the loaded value. */ defaultTextStyle?: PptxTextStyleLevels; } interface PptxPresentationSaveBuildInput { presentationData: XmlObject; options?: PptxPresentationSaveBuilderOptions; rawSlideWidthEmu: number; rawSlideHeightEmu: number; rawSlideSizeType?: string; xmlLookupService: IPptxXmlLookupService; /** * Old->new slide-reference remapping from the slides reconciler. Used to * rewrite custom-show relationship ids and section numeric slide ids when * slides were reordered/removed and their ids/rIds were reassigned. */ slideReferenceRemap?: PptxSlideReferenceRemap; } interface IPptxPresentationSaveBuilder { applySaveOptions(init: PptxPresentationSaveBuildInput): XmlObject; } declare class PptxPresentationSaveBuilder implements IPptxPresentationSaveBuilder { applySaveOptions(init: PptxPresentationSaveBuildInput): XmlObject; private applyHeaderFooter; private applySlideDimensions; private applyPhotoAlbum; /** * `@embedTrueTypeFonts` is a bare boolean attribute, so it always writes * the literal `1`/`0` a caller explicitly asked for (never omitted for an * explicit `false`), matching `@showMasterPhAnim`'s convention elsewhere. * `undefined` leaves whatever the loaded XML already carried untouched. */ private applyEmbedTrueTypeFonts; private applyKinsoku; private applyModifyVerifier; } //#endregion //#region src/pptx/core/core/builders/PptxSaveSessionBuilder.d.ts type PptxSaveMediaKind = 'image' | 'audio' | 'video'; interface PptxSaveStateConfig { zip: JSZip; commentAuthorMap: Map; /** Full author details for round-trip preservation of initials, lastIdx, clrIdx. */ commentAuthorDetails?: Map; commentAuthorsRootXml?: XmlObject; emuPerPx: number; } interface PptxCommentAuthorDescriptor { authorId: string; authorName: string; initials: string; lastCommentIndex: number; colorIndex: number; rawXml?: XmlObject; } declare class PptxSaveState { private readonly commentAuthorMap; /** Original author details loaded from the file, for round-trip preservation. */ private readonly commentAuthorDetails; private readonly commentAuthorsRootXml; private readonly emuPerPx; private readonly usedSlideNumbers; private readonly usedMediaPaths; private readonly usedInkPaths; private maxInkPartIndex; private readonly existingCommentPaths; private readonly activeCommentPaths; private readonly existingAuthorIdByName; private readonly usedAuthorIdByName; private readonly commentLastIdxByAuthorId; private maxCommentPartIndex; private maxAuthorId; constructor(config: PptxSaveStateConfig); nextSlideNumber(): number; nextMediaPath(extension: string, kind?: PptxSaveMediaKind): string; getUsedMediaPaths(): Set; nextInkPath(): string; activateInkPath(path: string): void; getUsedInkPaths(): Set; nextCommentPath(): string; toSlideCommentTarget(commentPath: string): string; activateCommentPath(commentPath: string): void; isCommentPathActive(commentPath: string): boolean; getExistingCommentPaths(): Set; getActiveCommentPaths(): Set; toEmu(value: number | undefined, fallback?: number): number; resolveCommentAuthorId(authorName: string | undefined): string; resolveCommentIndex(authorId: string, commentId: string | undefined, fallbackIndex: number): number; hasUsedCommentAuthors(): boolean; getCommentAuthorsRootXml(): XmlObject | undefined; getUsedCommentAuthors(): PptxCommentAuthorDescriptor[]; private initializeZipState; private initializeCommentAuthorState; private toCommentInitials; } declare class PptxSaveStateBuilder { private zip; private commentAuthorMap; private _commentAuthorDetails; private commentAuthorsRootXml; private emuPerPx; withZip(zip: JSZip): this; withCommentAuthorMap(commentAuthorMap: Map): this; withCommentAuthorDetails(details: Map): this; withCommentAuthorsRootXml(root: XmlObject | undefined): this; withEmuPerPx(emuPerPx: number): this; build(): PptxSaveState; } //#endregion //#region src/pptx/core/core/builders/PptxPresentationSlidesReconciler.d.ts interface PptxPresentationSlidesReconcilerInput { slides: PptxSlide[]; saveSession: PptxSaveState; slideRelationshipType: string; slideLayoutRelationshipType: string; relationshipsNamespace: string; zip: JSZip; parser: XMLParser; xmlBuilder: XMLBuilder; presentationData: XmlObject | null; slideMap: Map; slideRelsMap: Map>; toPresentationTarget: (slidePath: string) => string; toSlidePathFromTarget: (target: string) => string; toSlideRelsPath: (slidePath: string) => string; createEmptySlideXml: () => XmlObject; deepCloneXml: (value: XmlObject | undefined) => XmlObject | undefined; findSourceSlidePath: (sourceSlideId: string | undefined) => string | undefined; loadSlideRelationships: (slidePath: string, slideRelsPath: string) => Promise; } interface IPptxPresentationSlidesReconciler { reconcile(input: PptxPresentationSlidesReconcilerInput): Promise; } declare class PptxPresentationSlidesReconciler implements IPptxPresentationSlidesReconciler { reconcile(input: PptxPresentationSlidesReconcilerInput): Promise; /** * Return a new presentation XML object whose `p:sldIdLst` child sits in the * schema-mandated position (after `sldMasterIdLst` / `notesMasterIdLst` / * `handoutMasterIdLst`, before `sldSz`). Non-sldIdLst keys keep their * relative order; attribute keys (`@_...`) stay at the front. */ private insertSlideIdListInOrder; private attachNewSlide; private tryCopySourceRelationships; private removeInactiveSlides; private ensureArray; } //#endregion //#region src/pptx/core/core/builders/slide-reference-remap.d.ts interface SlideReferenceRemapInput { /** Reconciled (final) slide list, each carrying its current id/path and rId. */ slides: PptxSlide[]; /** Load-time map: original slide rId -> slide path it pointed at. */ originalRIdToPath: Map; /** Load-time map: original numeric slide id -> slide path it pointed at. */ originalSldIdToPath: Map; /** Rebuilt `p:sldId` entries (each with `@_r:id` and `@_id`). */ rebuiltSlideIds: XmlObject[]; } /** * Derive the old->new slide-reference remapping from the load-time topology * and the reconciled slide list. Surviving slides get an entry in the rId / * sldId maps (identity when unchanged); slides that are gone are recorded in * the removed sets so their references can be dropped. `changed` stays false * for an unmodified round-trip so callers can keep byte-stable output. */ declare function buildSlideReferenceRemap(init: SlideReferenceRemapInput): PptxSlideReferenceRemap; //#endregion //#region src/pptx/core/core/builders/PptxSlideRelationshipRegistry.d.ts interface PptxSlideCommentRelationshipInfo { relationshipId: string; target: string; } interface PptxSlideRelationshipRegistryOptions { relationships: XmlObject[]; hyperlinkRelationshipType?: string; } interface IPptxSlideRelationshipRegistry { nextRelationshipId(): string; upsertRelationship(relationshipId: string, relationshipType: string, relationshipTarget: string, targetMode?: string): void; resolveHyperlinkRelationshipId(target: string, forceExternal?: boolean): string | undefined; removeCommentRelationships(commentRelationshipType: string): PptxSlideCommentRelationshipInfo; removeRelationshipsByType(relationshipType: string): PptxSlideCommentRelationshipInfo; findFirstByTypeOrTargetIncludes(relationshipType: string, targetIncludes: string): XmlObject | undefined; toRelationshipMap(): Map; } declare class PptxSlideRelationshipRegistry implements IPptxSlideRelationshipRegistry { private readonly relationships; private readonly usedRelationshipIds; private readonly hyperlinkRelationshipIdByTarget; private readonly hyperlinkRelationshipType; constructor(options: PptxSlideRelationshipRegistryOptions); nextRelationshipId(): string; upsertRelationship(relationshipId: string, relationshipType: string, relationshipTarget: string, targetMode?: string): void; /** * @param forceExternal - Set for a target that is ALWAYS an external * destination regardless of its shape (a "Run program" command, an * external file path, or another presentation's path: `ppaction://program` * / `ppaction://hlinkfile` / `ppaction://hlinkpres`). {@link isExternalTarget}'s * URI-scheme heuristic exists for the generic, user-typed `url` field, * where a bare string COULD be a genuine relative package reference; it * has no such ambiguity for these three verbs, and a raw OS command or * path (e.g. `notepad.exe C:\temp\notes.txt`) does not parse as a URI * scheme, which would otherwise leave the relationship looking like an * (invalid) internal package reference. */ resolveHyperlinkRelationshipId(target: string, forceExternal?: boolean): string | undefined; removeCommentRelationships(commentRelationshipType: string): PptxSlideCommentRelationshipInfo; removeRelationshipsByType(relationshipType: string): PptxSlideCommentRelationshipInfo; findFirstByTypeOrTargetIncludes(relationshipType: string, targetIncludes: string): XmlObject | undefined; toRelationshipMap(): Map; private isCommentRelationship; } //#endregion //#region src/pptx/core/core/builders/xml/types.d.ts interface ICoreXmlElementFactory { createXmlElement(init: TInit): TResult; } interface PptxSlideCommentsXmlFactoryInit { slideComments: PptxComment[]; saveState: PptxSaveState; conformance: OoxmlConformanceClass; } interface PptxCommentAuthorsXmlFactoryInit { saveState: PptxSaveState; conformance: OoxmlConformanceClass; } interface IPptxSlideCommentsXmlFactory extends ICoreXmlElementFactory {} interface IPptxCommentAuthorsXmlFactory extends ICoreXmlElementFactory {} interface IPptxCommentXmlFactoryProvider { createSlideCommentsFactory(): IPptxSlideCommentsXmlFactory; createCommentAuthorsFactory(): IPptxCommentAuthorsXmlFactory; } //#endregion //#region src/pptx/core/core/builders/xml/PptxSlideCommentsXmlFactory.d.ts declare class PptxSlideCommentsXmlFactory implements IPptxSlideCommentsXmlFactory { createXmlElement(init: PptxSlideCommentsXmlFactoryInit): XmlObject; private createCommentNode; /** * Rebuild the `p15:threadingInfo` extension (see * `utils/legacy-comment-threading`) from `comment.parentId`, resolved * against the parent's OWN `@authorId`/`@idx` pair rather than the * parent's model id (which `p15:parentCm` has no way to carry). Every * other extension the comment's `rawXml` carried is preserved unchanged. */ private applyThreadingExtension; /** * Reflect the (possibly edited) `resolved` flag onto the legacy comment * node. PowerPoint's legacy comment schema has no standard resolved marker, * but the parser reads a non-standard `@_done` / `@_resolved` attribute, so * we re-emit the current state rather than leaving the stale value carried * over from `rawXml`. The original attribute name is preserved when present. */ private applyResolvedState; /** * A valid, already-authored `@dt` is returned EXACTLY as written, never * reformatted. Reformatting a valid string through `Date.parse` -> * `toISOString()` always renders in UTC, which silently shifted the clock * time by the local machine's offset whenever the source string had no * explicit UTC/offset marker: a comment authored at 10:30 came back * stamped 15:30 on a machine five hours behind UTC, on a save that never * touched the comment at all. */ private resolveCreatedAt; } //#endregion //#region src/pptx/core/core/builders/xml/PptxCommentAuthorsXmlFactory.d.ts declare class PptxCommentAuthorsXmlFactory implements IPptxCommentAuthorsXmlFactory { createXmlElement(init: PptxCommentAuthorsXmlFactoryInit): XmlObject; } //#endregion //#region src/pptx/core/core/builders/xml/PptxCommentXmlFactoryProvider.d.ts declare class PptxCommentXmlFactoryProvider implements IPptxCommentXmlFactoryProvider { createSlideCommentsFactory(): IPptxSlideCommentsXmlFactory; createCommentAuthorsFactory(): IPptxCommentAuthorsXmlFactory; } //#endregion //#region src/pptx/core/core/builders/PptxSlideCommentPartWriter.d.ts interface PptxSlideCommentPartWriterInput { slide: PptxSlide; saveState: PptxSaveState; existingCommentRelationship: PptxSlideCommentRelationshipInfo; relationshipRegistry: IPptxSlideRelationshipRegistry; slideCommentRelationshipType: string; zip: JSZip; xmlBuilder: XMLBuilder; slideCommentsXmlFactory: IPptxSlideCommentsXmlFactory; resolvePartPath: (slidePath: string, relationshipTarget: string) => string; conformance: OoxmlConformanceClass; } interface IPptxSlideCommentPartWriter { writeComments(init: PptxSlideCommentPartWriterInput): void; } declare class PptxSlideCommentPartWriter implements IPptxSlideCommentPartWriter { writeComments(init: PptxSlideCommentPartWriterInput): void; } //#endregion //#region src/pptx/core/core/runtime/group-xfrm-preservation.d.ts /** The subset of `GroupPptxElement` describing its captured child coordinate space. */ interface GroupChildSpaceEmu { readonly chOffXEmu?: number; readonly chOffYEmu?: number; readonly chExtWidthEmu?: number; readonly chExtHeightEmu?: number; } /** * A group's captured child space paired with its OWN IMMUTABLE source * extent (`widthEmu`/`heightEmu`, from its OWN `a:ext`; never a "current" * resolved value - see the module doc for why that distinction is * load-bearing). This is exactly the shape of a `GroupPptxElement` itself; * no derivation is needed to produce it. */ interface GroupChildSpaceOwner extends GroupChildSpaceEmu { readonly widthEmu?: number; readonly heightEmu?: number; } //#endregion //#region src/pptx/core/core/builders/PptxElementTransformUpdater.d.ts interface IPptxElementTransformUpdater { applyTransform(shape: XmlObject, element: PptxElement, emuPerPx: number, enclosingGroupChildSpace?: GroupChildSpaceOwner): void; } declare class PptxElementTransformUpdater implements IPptxElementTransformUpdater { applyTransform(shape: XmlObject, element: PptxElement, emuPerPx: number, enclosingGroupChildSpace?: GroupChildSpaceOwner): void; } //#endregion //#region src/pptx/core/core/builders/PptxSlideMediaRelationshipBuilder.d.ts interface IPptxSlideMediaRelationshipBuilder { resolveMediaRelationshipType(mediaType: MediaPptxElement['mediaType'], relationshipTypes: { media: string; video: string; audio: string; }): string; getMediaRelationshipIdFromShape(shape: XmlObject | undefined): string | undefined; ensureGraphicFrameMediaReference(shape: XmlObject, mediaType: MediaPptxElement['mediaType'], relationshipId: string): void; } declare class PptxSlideMediaRelationshipBuilder implements IPptxSlideMediaRelationshipBuilder { resolveMediaRelationshipType(mediaType: MediaPptxElement['mediaType'], relationshipTypes: { media: string; video: string; audio: string; }): string; getMediaRelationshipIdFromShape(shape: XmlObject | undefined): string | undefined; ensureGraphicFrameMediaReference(shape: XmlObject, mediaType: MediaPptxElement['mediaType'], relationshipId: string): void; } //#endregion //#region src/pptx/core/core/builders/PptxSlideNotesPartUpdater.d.ts interface PptxSlideNotesPartUpdaterInput { slide: PptxSlide; relationshipRegistry: IPptxSlideRelationshipRegistry; slideNotesRelationshipType: string; zip: JSZip; parser: XMLParser; xmlBuilder: XMLBuilder; resolvePartPath: (slidePath: string, relationshipTarget: string) => string; updateNotesXmlText: (notesXmlObject: XmlObject, notesText: string, notesSegments?: PptxSlide['notesSegments']) => boolean; compatibilityReporter: { reportWarning: (warning: CompatibilityWarningInput) => void; }; } interface IPptxSlideNotesPartUpdater { updateNotesPart(init: PptxSlideNotesPartUpdaterInput): Promise; } declare class PptxSlideNotesPartUpdater implements IPptxSlideNotesPartUpdater { updateNotesPart(init: PptxSlideNotesPartUpdaterInput): Promise; private createNotesPart; private nextNotesPartPath; private buildNotesSlide; private addNotesContentType; private reportMissingNotesRelationship; private reportMissingNotesPart; private reportSkippedNotesUpdate; } //#endregion //#region src/pptx/core/core/builders/PptxSlideBackgroundBuilder.d.ts interface PptxSlideBackgroundBuilderInput { slideNode: XmlObject; slide: PptxSlide; zip: JSZip; saveState: PptxSaveState; relationshipRegistry: IPptxSlideRelationshipRegistry; slideImageRelationshipType: string; /** * Resolve a background-image URL to bytes. Handles `data:` URLs * synchronously and fetches `blob:`/`http(s)://`/`pptx-resource://` * asynchronously (same resolver the picture/media embedding uses), so a * freshly applied background whose URL is not a data URL is embedded as a * real media part rather than silently dropped. */ resolveImageToBytes: (url: string) => Promise<{ bytes: Uint8Array; extension: string; } | null>; /** Optional sink for a "could not embed background" compatibility warning. */ reportUnsupportedBackground?: (imageUrl: string) => void; /** * What the loader recorded about this slide's ``: whether the slide * authored one at all, and what the inheritance chain resolved to. Omitted * for slides this handler never parsed (SDK-built decks), where the flat * values on the model are the only description available. */ authoredBackground?: AuthoredSlideBackground | undefined; } interface IPptxSlideBackgroundBuilder { applyBackground(init: PptxSlideBackgroundBuilderInput): Promise; } declare class PptxSlideBackgroundBuilder implements IPptxSlideBackgroundBuilder { applyBackground(init: PptxSlideBackgroundBuilderInput): Promise; private reorderCSldBgFirst; } //#endregion //#region src/pptx/core/core/builders/PptxColorStyleCodec.d.ts interface PptxColorStyleCodecContext { emuPerPx: number; ensureArray: (value: unknown) => unknown[]; resolveThemeColor: (schemeKey: string) => string | undefined; } interface IPptxColorStyleCodec { parseColorChoice(colorChoice: XmlObject | undefined, placeholderColor?: string): string | undefined; parseColor(colorNode: XmlObject | undefined, placeholderColor?: string): string | undefined; percentAttrToUnit(value: unknown): number | undefined; clampUnitInterval(value: number): number; hexToRgb(hex: string): { r: number; g: number; b: number; } | undefined; rgbToHex(r: number, g: number, b: number): string; applyColorTransforms(baseColor: string, colorNode: XmlObject): string; extractColorChoiceNode(colorNode: XmlObject | undefined): XmlObject | undefined; extractColorOpacity(colorNode: XmlObject | undefined): number | undefined; colorWithOpacity(color: string, opacity: number | undefined): string; extractGradientOpacity(gradFill: XmlObject): number | undefined; extractGradientStops(gradFill: XmlObject): NonNullable; extractGradientType(gradFill: XmlObject): NonNullable; extractGradientAngle(gradFill: XmlObject): number; buildGradientCssFromStops(stops: NonNullable, type: NonNullable, angle: number): string | undefined; extractGradientFillCss(gradFill: XmlObject): string | undefined; extractShadowStyle(shapeProps: XmlObject): Partial; extractInnerShadowStyle(shapeProps: XmlObject): Partial; extractGlowStyle(shapeProps: XmlObject): Partial; extractSoftEdgeStyle(shapeProps: XmlObject): Partial; extractReflectionStyle(shapeProps: XmlObject): Partial; extractBlurStyle(shapeProps: XmlObject): Partial; extractEffectDagStyle(shapeProps: XmlObject): Partial; extractFillOverlayStyle(shapeProps: XmlObject): Partial; buildGradientFillXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildOuterShadowXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildPresetShadowXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildInnerShadowXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildGlowXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildSoftEdgeXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildReflectionXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildBlurXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildFillOverlayXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildLineEffectListXml(shapeStyle: ShapeStyle): XmlObject | undefined; extractGradientFillColor(gradFill: XmlObject): string | undefined; extractGradientPathType(gradFill: XmlObject): ShapeStyle['fillGradientPathType']; extractGradientFocalPoint(gradFill: XmlObject): ShapeStyle['fillGradientFocalPoint']; extractGradientFillToRect(gradFill: XmlObject): ShapeStyle['fillGradientFillToRect']; extractGradientFlip(gradFill: XmlObject): ShapeStyle['fillGradientFlip']; extractGradientRotWithShape(gradFill: XmlObject): boolean | undefined; extractGradientScaled(gradFill: XmlObject): boolean | undefined; } declare class PptxColorStyleCodec implements IPptxColorStyleCodec { private readonly colorTransformCodec; private readonly gradientStyleCodec; private readonly shapeEffectXmlCodec; constructor(context: PptxColorStyleCodecContext); parseColorChoice(colorChoice: XmlObject | undefined, placeholderColor?: string): string | undefined; parseColor(colorNode: XmlObject | undefined, placeholderColor?: string): string | undefined; percentAttrToUnit(value: unknown): number | undefined; clampUnitInterval(value: number): number; hexToRgb(hex: string): { r: number; g: number; b: number; } | undefined; rgbToHex(r: number, g: number, b: number): string; applyColorTransforms(baseColor: string, colorNode: XmlObject): string; extractColorChoiceNode(colorNode: XmlObject | undefined): XmlObject | undefined; extractColorOpacity(colorNode: XmlObject | undefined): number | undefined; /** * Parse an OOXML percentage (thousandths, `100000` = 100%) into a fraction * WITHOUT clamping to [0, 1]. Used for additive offsets like `a:alphaOff` * that legitimately carry negative values. */ private signedPercentToUnit; colorWithOpacity(color: string, opacity: number | undefined): string; extractGradientOpacity(gradFill: XmlObject): number | undefined; extractGradientStops(gradFill: XmlObject): NonNullable; extractGradientType(gradFill: XmlObject): NonNullable; extractGradientAngle(gradFill: XmlObject): number; buildGradientCssFromStops(stops: NonNullable, type: NonNullable, angle: number): string | undefined; extractGradientFillCss(gradFill: XmlObject): string | undefined; extractShadowStyle(shapeProps: XmlObject): Partial; extractInnerShadowStyle(shapeProps: XmlObject): Partial; extractGlowStyle(shapeProps: XmlObject): Partial; extractSoftEdgeStyle(shapeProps: XmlObject): Partial; extractReflectionStyle(shapeProps: XmlObject): Partial; extractBlurStyle(shapeProps: XmlObject): Partial; extractEffectDagStyle(shapeProps: XmlObject): Partial; extractFillOverlayStyle(shapeProps: XmlObject): Partial; buildGradientFillXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildOuterShadowXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildPresetShadowXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildInnerShadowXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildGlowXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildSoftEdgeXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildReflectionXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildBlurXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildFillOverlayXml(shapeStyle: ShapeStyle): XmlObject | undefined; buildLineEffectListXml(shapeStyle: ShapeStyle): XmlObject | undefined; extractGradientFillColor(gradFill: XmlObject): string | undefined; extractGradientFlip(gradFill: XmlObject): ShapeStyle['fillGradientFlip']; extractGradientRotWithShape(gradFill: XmlObject): boolean | undefined; extractGradientScaled(gradFill: XmlObject): boolean | undefined; extractGradientPathType(gradFill: XmlObject): ShapeStyle['fillGradientPathType']; extractGradientFocalPoint(gradFill: XmlObject): ShapeStyle['fillGradientFocalPoint']; extractGradientFillToRect(gradFill: XmlObject): ShapeStyle['fillGradientFillToRect']; } //#endregion //#region src/pptx/core/core/builders/PptxShapeStyleExtractor.d.ts interface PptxShapeStyleExtractorContext { emuPerPx: number; parseColor: (colorNode: XmlObject | undefined, placeholderColor?: string) => string | undefined; extractColorOpacity: (colorNode: XmlObject | undefined) => number | undefined; extractGradientFillColor: (gradFill: XmlObject) => string | undefined; extractGradientOpacity: (gradFill: XmlObject) => number | undefined; extractGradientFillCss: (gradFill: XmlObject) => string | undefined; extractGradientStops: (gradFill: XmlObject) => NonNullable; extractGradientAngle: (gradFill: XmlObject) => number; extractGradientType: (gradFill: XmlObject) => NonNullable; extractGradientPathType: (gradFill: XmlObject) => ShapeStyle['fillGradientPathType']; extractGradientFocalPoint: (gradFill: XmlObject) => ShapeStyle['fillGradientFocalPoint']; extractGradientFillToRect: (gradFill: XmlObject) => ShapeStyle['fillGradientFillToRect']; extractGradientFlip: (gradFill: XmlObject) => ShapeStyle['fillGradientFlip']; extractGradientRotWithShape: (gradFill: XmlObject) => boolean | undefined; extractGradientScaled: (gradFill: XmlObject) => boolean | undefined; normalizeStrokeDashType: (value: unknown) => StrokeDashType | undefined; normalizeConnectorArrowType: (value: unknown) => ConnectorArrowType | undefined; ensureArray: (value: unknown) => unknown[]; resolveThemeFillRef: (refNode: XmlObject, style: ShapeStyle) => void; resolveThemeLineRef: (refNode: XmlObject, style: ShapeStyle) => void; resolveThemeEffectRef: (refNode: XmlObject, style: ShapeStyle) => void; extractShadowStyle: (shapeProps: XmlObject) => Partial; extractInnerShadowStyle: (shapeProps: XmlObject) => Partial; extractGlowStyle: (shapeProps: XmlObject) => Partial; extractSoftEdgeStyle: (shapeProps: XmlObject) => Partial; extractReflectionStyle: (shapeProps: XmlObject) => Partial; extractBlurStyle: (shapeProps: XmlObject) => Partial; extractEffectDagStyle: (shapeProps: XmlObject) => Partial; extractFillOverlayStyle: (shapeProps: XmlObject) => Partial; } interface IPptxShapeStyleExtractor { extractShapeStyle(spPr: XmlObject | undefined, styleNode?: XmlObject): ShapeStyle; } declare class PptxShapeStyleExtractor implements IPptxShapeStyleExtractor { private readonly context; constructor(context: PptxShapeStyleExtractorContext); extractShapeStyle(spPr: XmlObject | undefined, styleNode?: XmlObject): ShapeStyle; /** * Pull the verbatim colour-choice child out of an `a:fontRef` element, * preserving any contained colour transforms for round-trip. */ private extractFontRefColorXml; } //#endregion //#region src/pptx/core/core/builders/PptxTableDataParser.d.ts interface PptxTableDataParserContext { emuPerPx: number; ensureArray: (value: unknown) => unknown[]; parseColor: (colorNode: XmlObject | undefined, placeholderColor?: string) => string | undefined; extractGradientFillCss?: (gradFill: XmlObject) => string | undefined; extractGradientStops?: (gradFill: XmlObject) => Array<{ color: string; position: number; opacity?: number; }>; extractGradientType?: (gradFill: XmlObject) => 'linear' | 'radial'; extractGradientAngle?: (gradFill: XmlObject) => number; extractGradientPathType?: (gradFill: XmlObject) => 'circle' | 'rect' | 'shape' | undefined; extractGradientFocalPoint?: (gradFill: XmlObject) => { x: number; y: number; } | undefined; extractGradientFillToRect?: (gradFill: XmlObject) => { l: number; t: number; r: number; b: number; } | undefined; /** See {@link TableCellFillBorderContext.resolveCellImagePath}. */ resolveCellImagePath?: (rEmbed: string | undefined, rLink: string | undefined, slidePath: string | undefined) => string | undefined; /** * Resolve the table-cell-context default font size (points) from the * slide's master `p:otherStyle`. See * {@link PptxHandlerRuntime.resolveTableCellDefaultFontSize}. Optional so * callers without a master/theme context (tests, the built-in style * catalogue generator) simply get `undefined`. */ resolveDefaultCellFontSize?: (slidePath: string | undefined) => number | undefined; } interface IPptxTableDataParser { parseTableData(graphicData: XmlObject, slidePath?: string): PptxTableData | undefined; } declare class PptxTableDataParser implements IPptxTableDataParser { private readonly context; constructor(context: PptxTableDataParserContext); parseTableData(graphicData: XmlObject, slidePath?: string): PptxTableData | undefined; /** * Read the table style ID from `a:tblPr`. * * ECMA-376 §21.1.3.13 defines `{GUID}` as * a child element of `a:tblPr` carrying the GUID as element text. Older * inputs (and earlier versions of this library) used the legacy * `` child element or a `@_tblStyle` attribute. * Accept all three; the spec form takes precedence. */ private extractTableStyleId; /** * CT_TableProperties §21.1.3.15 declares `bandRowCycle` / `bandColCycle` * as either an attribute (`@_bandRowCycle`) or a child element * (``). Read both forms; return `undefined` to * let the caller fall back to the spec default of 1. */ private extractBandCycle; /** * Capture `a:tcPr` attributes that don't yet have typed equivalents on * {@link PptxTableCellStyle} so they survive a round-trip * (`horzOverflow`, `anchorCtr`, `headers`, `hideSlicers`, * `slicerCacheId`). Returns the attribute name (without the `@_` prefix * fast-xml-parser adds) → string-value map, or undefined when none of * the recognised opaque attributes are present. */ private extractCellExtraAttributes; private extractTableCellText; private extractTableCellStyleFromXml; } //#endregion //#region src/pptx/core/core/builders/PptxMediaDataParser.d.ts interface PptxMediaDataParserContext { slideRelsMap: Map>; /** Relationship IDs with TargetMode="External" per slide/part path. */ externalRelsMap: Map>; resolvePath: (base: string, relative: string) => string; getPathExtension: (pathValue: string) => string | undefined; /** * Load H3-style gate for a LINKED (`TargetMode="External"`) media * relationship: mirrors the `allowExternalImages` gate pictures already use * (same security surface: a `