@pptx-editor.dev/editor-api 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/runtime/argument-hints.ts","../src/runtime/edit-diagnostics.ts","../src/runtime/errors.ts","../src/runtime/internals.ts","../src/runtime/deferred-checks.ts","../src/runtime/load-options.ts","../src/runtime/client-object.ts","../src/runtime/object-path.ts","../src/runtime/hydrate.ts","../src/model/model-object.ts","../src/model/application.ts","../src/runtime/client-result.ts","../src/model/enums.ts","../src/model/adjustments.ts","../src/model/fill-line.ts","../src/model/geometry.ts","../src/model/collection.ts","../src/runtime/batch.ts","../src/model/images.ts","../src/model/backgrounds.ts","../src/model/custom-xml.ts","../src/model/tags.ts","../src/model/theme.ts","../src/model/slides.ts","../src/model/table-format.ts","../src/model/table-cell.ts","../src/model/table-options.ts","../src/model/tables.ts","../src/model/shapes.ts","../src/model/hyperlinks.ts","../src/model/text.ts","../src/model/bindings.ts","../src/model/custom-properties.ts","../src/model/presentation.ts","../src/runtime/tracked-objects.ts","../src/runtime/queue.ts","../src/runtime/dev-warnings.ts","../src/runtime/request-context.ts","../src/runtime/server.ts","../src/model/type-names.ts","../src/runtime/runtime.ts"],"sourcesContent":["/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// The hint of each argument that the engine refuses with `invalid-argument`, by the name the\n// engine gives (the detail of the refusal). Every refusal of an argument says what to pass, so\n// no argument refusal falls back to a generic text. `scripts/__tests__/refusal-reasons.test.ts`\n// fails when the engine names an argument that has no row here.\n\nconst WHOLE_FROM_ZERO = 'Use a whole number of 0 or more that is less than the number of items.';\nconst BOOLEAN = 'Use true or false.';\nconst TEXT = 'Use text of at most 4096 characters, with no control characters.';\nconst POINTS = 'Use a number of points from 0 to 4032.';\nconst MARGIN = 'Use a margin of 0 to 4032 points.';\n\n/** `[engine detail, hint]`. A hint says what to pass. */\nconst ROWS: readonly (readonly [string, string])[] = [\n // Colors and fills.\n ['color', \"Use '#RRGGBB' (for example '#1F4E79') or a named color such as 'red'.\"],\n ['foregroundColor', \"Use '#RRGGBB' (for example '#1F4E79') or a named color such as 'red'.\"],\n ['backgroundColor', \"Use '#RRGGBB' (for example '#1F4E79') or a named color such as 'red'.\"],\n ['transparency', 'Use a fraction from 0 (opaque) to 1 (clear).'],\n ['fill', 'Use a fill object: a solid color, a gradient, a pattern, a picture, or no fill.'],\n ['gradientType', 'Use a value of SlideBackgroundGradientFillType.'],\n ['pattern', 'Use a value of SlideBackgroundPatternFillType.'],\n ['imageBase64', 'Use the Base64 bytes of a PNG, JPEG, GIF, or BMP picture.'],\n ['base64', 'Use the Base64 bytes of a PNG, JPEG, GIF, or BMP picture.'],\n ['image-size', 'Use a width and a height greater than 0, at most 8192 pixels.'],\n ['background', 'Use a fill write that this slide can take; a layout or master cannot inherit.'],\n ['areBackgroundGraphicsHidden', BOOLEAN],\n // Lines and borders.\n ['line', 'Use a line object with color, weight, dashStyle, style, transparency, or visible.'],\n ['weight', 'Use a line weight from 0 to 1584 points.'],\n ['dashStyle', 'Use a value of ShapeLineDashStyle.'],\n ['style', 'Use a value of ShapeLineStyle, or a table style the presentation defines.'],\n ['visible', BOOLEAN],\n ['side', 'Use a border side: left, right, top, bottom, diagonalDown, or diagonalUp.'],\n // Shapes and their boxes.\n ['shape', 'Use a shape kind that this collection can add, with its options.'],\n ['shapes', 'Use an array of shapes of one slide or one group, at most 10 000.'],\n ['geometry', 'Use a value of GeometricShapeType.'],\n ['connector', 'Use a value of ConnectorType.'],\n ['left', 'Use a number of points from -169 093 to 169 093.'],\n ['top', 'Use a number of points from -169 093 to 169 093.'],\n ['width', 'Use a number of points from 0 to 169 093.'],\n ['height', 'Use a number of points from 0 to 169 093.'],\n ['rotation', 'Use a rotation in degrees, a finite number.'],\n ['position', 'Use a value of ShapeZOrder.'],\n ['props', 'Use an object of the properties to write.'],\n ['isDecorative', BOOLEAN],\n ['title', TEXT],\n ['descr', TEXT],\n ['altTextTitle', TEXT],\n ['altTextDescription', TEXT],\n ['name', 'Use a name of 1 to 255 characters, with no control characters.'],\n ['value', 'Use a value of the type this property takes, in its range.'],\n ['index', WHOLE_FROM_ZERO],\n ['group', 'Use a shape that is a group.'],\n ['group-count', 'Use two or more different shapes.'],\n ['group-parent', 'Use shapes of one slide, or of one group.'],\n // Text.\n ['text', 'Use text of at most 1 000 000 characters, with no control characters.'],\n ['span', 'Use a start and a length inside the text, around some text.'],\n ['start', 'Use a start of 0 or more, at most the length of the text.'],\n ['length', 'Use a length of 0 or more that ends inside the text.'],\n ['font', 'Use an object of font properties.'],\n ['size', 'Use a font size from 1 to 4000 points.'],\n ['underline', 'Use a value of ShapeFontUnderlineStyle.'],\n ['bold', BOOLEAN],\n ['italic', BOOLEAN],\n ['allCaps', BOOLEAN],\n ['smallCaps', BOOLEAN],\n ['strikethrough', BOOLEAN],\n ['doubleStrikethrough', BOOLEAN],\n ['subscript', BOOLEAN],\n ['superscript', BOOLEAN],\n ['paragraph', 'Use an object of paragraph format properties.'],\n ['alignment', 'Use a value of ParagraphHorizontalAlignment.'],\n ['indentLevel', 'Use a whole number from 1 to 9.'],\n ['bulletStyle', 'Use a value of ShapeBulletStyle.'],\n ['verticalAlignment', 'Use a value of TextVerticalAlignment.'],\n ['wordWrap', BOOLEAN],\n ['autoSize', 'Use a value of ShapeAutoSize.'],\n ['leftMargin', MARGIN],\n ['rightMargin', MARGIN],\n ['topMargin', MARGIN],\n ['bottomMargin', MARGIN],\n [\n 'address',\n \"Use an 'http', 'https', 'mailto', 'tel', or 'ftp' address of at most 2048 characters.\",\n ],\n ['screenTip', 'Use a screen tip of at most 1024 characters, with no control characters.'],\n // Tables.\n ['values', 'Use an array of rows of strings, at most one per row and one per column.'],\n ['cell', 'Use a row and a column inside the table.'],\n ['row', 'Use a row index of 0 or more, less than the number of rows.'],\n ['column', 'Use a column index of 0 or more, less than the number of columns.'],\n ['rows', 'Use a whole number of rows from 1 to 75.'],\n ['columns', 'Use a whole number of columns from 1 to 75.'],\n ['rowCount', 'Use a whole number of rows of 1 or more that ends inside the table.'],\n ['columnCount', 'Use a whole number of columns of 1 or more that ends inside the table.'],\n ['count', 'Use a whole number of 1 or more that fits the table.'],\n ['lineSize', POINTS],\n ['anchor', 'Use a value of TableCellVerticalAlignment.'],\n ['anchorCenter', BOOLEAN],\n ['margins', 'Use an object of margins, each from 0 to 4032 points, or null.'],\n ['options', 'Use true or false for text and for format.'],\n ['styleName', 'Use the name of a table style as a string, or null.'],\n ['firstRow', BOOLEAN],\n ['lastRow', BOOLEAN],\n ['firstColumn', BOOLEAN],\n ['lastColumn', BOOLEAN],\n ['bandedRows', BOOLEAN],\n ['bandedColumns', BOOLEAN],\n // Presentation, properties, tags, custom XML, slides.\n ['properties', 'Use an object of document properties.'],\n ['revisionNumber', 'Use a whole number from 0 to 2147483647.'],\n ['subject', TEXT],\n ['author', TEXT],\n ['keywords', TEXT],\n ['comments', TEXT],\n ['category', TEXT],\n ['lastAuthor', TEXT],\n ['company', TEXT],\n ['manager', TEXT],\n ['slideWidth', 'Use a slide width from 72 to 4032 points (1 to 56 inches).'],\n ['slideHeight', 'Use a slide height from 72 to 4032 points (1 to 56 inches).'],\n [\n 'key',\n 'Use a key of 1 to 255 characters, with no control characters, on a presentation with fewer than 2 147 483 647 properties.',\n ],\n ['type', 'Use a value of DocumentPropertyType.'],\n ['id', 'Use an id of 1 to 255 characters.'],\n ['binding-limit', 'Delete bindings first: a runtime keeps at most 10 000.'],\n ['binding-selection', 'Select exactly one shape first.'],\n ['custom-xml', 'Use well-formed XML text with no DTD and one root element.'],\n ['custom-xml-id', 'Use an id that no other custom XML part has.'],\n ['xml', 'Delete custom XML parts first: the presentation has no free part name left.'],\n ['namespaceUri', 'Use a namespace URI as a string.'],\n ['slides', 'Use a non-empty array of slides of this presentation.'],\n ['layoutId', 'Use the id of a slide layout of this presentation as a string.'],\n ['slideMasterId', 'Use the id of a slide master of this presentation as a string.'],\n ['formatting', 'Use a value of InsertSlideFormatting.'],\n ['import-base64', 'Use the Base64 bytes of a PPTX file.'],\n ['sourceSlideIds', 'Use an array of different slide ids of the source file.'],\n ['operations', 'Make fewer calls in one sync.'],\n];\n\n/** The hints, in a record with no prototype, so a detail never reaches a built-in name. */\nexport const ARGUMENT_HINTS: Readonly<Record<string, string>> = Object.freeze(\n Object.assign(Object.create(null) as Record<string, string>, Object.fromEntries(ROWS))\n);\n\n/** The hint for an argument the engine refused, or undefined when the engine named none. */\nexport function argumentHint(detail: string | undefined): string | undefined {\n return detail === undefined ? undefined : ARGUMENT_HINTS[detail];\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// The public diagnostics of the engine's edit refusals, beside `errors.ts` (which keeps the\n// shape of DOCX Editor's module). Each row maps a host detail to a stable code and a fixed hint:\n// the cause, then the action. `scripts/refusal-reasons.mjs` lists every reason the core can\n// give through an automation host, and `scripts/__tests__/refusal-reasons.test.ts` fails when\n// one has no diagnostic.\n\n/** Rows of `[host detail, public code, hint]`. */\nexport const EDIT_DIAGNOSTICS: readonly (readonly [string, string, string])[] = [\n // Edit refusals of the engine (`disabled.*`): NotSupported.\n [\n 'disabled.cropFillMode',\n 'edit.picture-not-stretched',\n 'The picture is tiled or inset in its frame, so it cannot be cropped. Use a stretched picture.',\n ],\n [\n 'disabled.cropLocked',\n 'edit.picture-locked',\n 'The picture is locked against this change in the file. Remove the lock in the file first.',\n ],\n [\n 'disabled.rotationLocked',\n 'edit.picture-locked',\n 'The picture is locked against rotation in the file. Remove the lock in the file first.',\n ],\n [\n 'disabled.sizeLocked',\n 'edit.picture-locked',\n 'The picture is locked against resizing in the file. Remove the lock in the file first.',\n ],\n [\n 'disabled.shapeLocked',\n 'edit.picture-locked',\n 'The picture is locked against a change of shape in the file. Remove the lock in the file first.',\n ],\n [\n 'disabled.decorative',\n 'edit.decorative',\n 'The shape is decorative, so it has no alternative text. Set isDecorative to false first.',\n ],\n [\n 'disabled.distributeNeedsThree',\n 'edit.needs-three-shapes',\n 'Distributing needs three or more shapes. Pass more shapes.',\n ],\n [\n 'disabled.groupNeedsTwo',\n 'edit.group-count',\n 'A group needs two or more different shapes. Remove repeated shapes or add more.',\n ],\n [\n 'disabled.groupScope',\n 'edit.group-parent',\n 'The shapes are not in the same parent. Use shapes of one slide, or of one group.',\n ],\n [\n 'disabled.imageSizeUnknown',\n 'edit.picture-size-unknown',\n 'The size of the picture cannot be read from its bytes. Use a PNG, JPEG, or GIF picture.',\n ],\n [\n 'disabled.mergeOneCell',\n 'edit.merge-one-cell',\n 'A merge needs two or more cells. Pass a row count or a column count above 1.',\n ],\n [\n 'disabled.mixedSize',\n 'edit.mixed-size',\n 'The text has more than one size, so it cannot be stepped as one. Set font.size instead.',\n ],\n [\n 'disabled.noArrangeChange',\n 'edit.no-change',\n 'The shapes are already in that position. Read zOrderPosition before you move a shape.',\n ],\n [\n 'disabled.noEffectChange',\n 'edit.no-change',\n 'The shapes do not have that effect, so nothing changes.',\n ],\n [\n 'disabled.noLockChange',\n 'edit.no-change',\n 'The setting already has that value, so nothing changes.',\n ],\n [\n 'disabled.noNameChange',\n 'edit.no-change',\n 'The shape already has that name, so nothing changes.',\n ],\n [\n 'disabled.noVisibilityChange',\n 'edit.no-change',\n 'The shapes already have that visibility, so nothing changes.',\n ],\n [\n 'disabled.noEditor',\n 'host.no-document',\n 'The editor has no presentation open yet. Wait until it has loaded one.',\n ],\n [\n 'disabled.noList',\n 'edit.no-list',\n 'The paragraphs have no bullets or numbers. Set bulletFormat.visible to true first.',\n ],\n ['disabled.noMatch', 'edit.no-match', 'The text was not found. Read the text again.'],\n ['disabled.noNotes', 'edit.no-notes', 'The slide has no speaker notes. Add notes first.'],\n ['disabled.noPicture', 'edit.not-a-picture', 'The shape is not a picture. Use a picture shape.'],\n [\n 'disabled.onePicture',\n 'edit.not-a-picture',\n 'This change takes exactly one picture. Pass one picture shape.',\n ],\n [\n 'disabled.pictureEffects',\n 'edit.picture-effects',\n 'The picture has effects this API cannot change. Change another property, or remove the effects in the file.',\n ],\n [\n 'disabled.noSections',\n 'edit.no-sections',\n 'The presentation has no sections. Add a section first.',\n ],\n [\n 'disabled.sectionEdge',\n 'edit.section-edge',\n 'The section is already at that edge of the presentation, so it cannot move further.',\n ],\n [\n 'disabled.noSelection',\n 'edit.no-target',\n 'The call has no shape to act on. Pass a shape, or select one in the editor first.',\n ],\n ['disabled.selectOne', 'edit.no-target', 'This change takes exactly one shape. Pass one shape.'],\n [\n 'disabled.selectText',\n 'edit.no-target',\n 'The call needs a text range. Pass a text range with text in it.',\n ],\n [\n 'disabled.selectWord',\n 'edit.no-target',\n 'The call needs text. Pass a text range that is not empty.',\n ],\n [\n 'disabled.selectNotesText',\n 'edit.no-target',\n 'The call needs the text of the notes. Address the text of the notes placeholder.',\n ],\n [\n 'disabled.noShapeEffects',\n 'edit.no-effects',\n 'The shape cannot take effects. Use a shape, a line, or a picture.',\n ],\n [\n 'disabled.noShapeFill',\n 'edit.no-fill',\n 'The shape cannot have a fill, for example a line or a connector. Use a shape with an area.',\n ],\n [\n 'disabled.noShapeStyle',\n 'edit.no-style',\n 'The shape cannot take a shape style. Use a geometric shape.',\n ],\n [\n 'disabled.noSlideNumberPlaceholder',\n 'edit.no-slide-number-placeholder',\n 'The layouts have no slide number placeholder. Add one to the layout first.',\n ],\n ['disabled.noTable', 'edit.not-a-table', 'The shape is not a table. Use a table shape.'],\n [\n 'disabled.notAGroup',\n 'edit.not-a-group',\n 'The shape is not a group. Check shape.type first, and use a group shape.',\n ],\n ['disabled.notALine', 'edit.not-a-line', 'The shape is not a line or a connector. Use a line.'],\n [\n 'disabled.noText',\n 'edit.no-text-frame',\n 'The shape has no text frame. Check shape.type first, and read text only of a shape that holds text.',\n ],\n [\n 'disabled.slideNotCopyable',\n 'import.slide-not-copyable',\n 'A slide to import has threaded comments or an embedded control. Leave it out with sourceSlideIds.',\n ],\n [\n 'disabled.slideSorter',\n 'host.slide-sorter',\n 'The editor shows the slide sorter, which takes no shape edits. Switch the editor to the normal view.',\n ],\n [\n 'disabled.splitOneCell',\n 'edit.split-one-cell',\n 'A split takes one cell. Use getCellOrNullObject for one cell, then split it.',\n ],\n [\n 'disabled.splitUneven',\n 'edit.split-uneven',\n 'A merged cell splits only into parts that divide it evenly. Use a row and column count that divides its span.',\n ],\n [\n 'disabled.tableText',\n 'edit.table-text',\n 'A table cell does not take this text body setting. Set it on a text box or a shape.',\n ],\n [\n 'disabled.tableTooLarge',\n 'edit.table-too-large',\n 'A table has at most 75 columns and 1,000 rows. Use fewer rows or columns.',\n ],\n [\n 'disabled.unsupportedElement',\n 'edit.unsupported-element',\n 'The object is of a kind this API cannot edit, for example a chart or an embedded object. Read it, or edit another object.',\n ],\n // Edit errors of the engine (`errors.*`): GeneralException, or InvalidArgument for a name.\n [\n 'errors.altTextLength',\n 'edit.alt-text-length',\n 'Alternative text can have up to 4000 characters. Shorten it.',\n ],\n [\n 'errors.clipboard',\n 'edit.clipboard',\n 'The content is not shapes this API can insert. Insert shapes from a presentation instead.',\n ],\n [\n 'errors.coordinateRange',\n 'edit.coordinate-range',\n 'The position or size is outside the range a slide can hold. Use values within the slide size limits.',\n ],\n [\n 'errors.exportFailed',\n 'image.failed',\n 'The picture could not be made. Read the shape, then try again.',\n ],\n [\n 'errors.exportSize',\n 'image.invalid-size',\n 'A picture is from 16 to 8192 pixels on a side. Pass a size in that range.',\n ],\n [\n 'errors.findStale',\n 'edit.stale-target',\n 'An edit removed the object. Read the presentation again.',\n ],\n [\n 'errors.findTooLong',\n 'edit.text-too-long',\n 'The text is too long for this call. Use shorter text.',\n ],\n [\n 'errors.invalidName',\n 'edit.invalid-name',\n 'A name has 1 to 255 characters. Use a shorter name that is not empty.',\n ],\n [\n 'errors.invalidText',\n 'edit.invalid-text',\n 'The text has no characters that a slide can hold, such as control characters only. Remove them.',\n ],\n [\n 'errors.layoutNotFound',\n 'edit.layout-not-found',\n 'The presentation has no such slide layout. Read the layouts of the master again.',\n ],\n [\n 'errors.malformed',\n 'edit.malformed-part',\n 'A part of the presentation is damaged, so the change cannot apply. Repair the file, then try again.',\n ],\n [\n 'errors.sectionName',\n 'edit.section-name',\n 'A section name has 1 to 255 characters. Use a shorter name that is not empty.',\n ],\n [\n 'errors.sectionNotFound',\n 'edit.section-not-found',\n 'The presentation has no such section. Read the sections again.',\n ],\n [\n 'errors.slideNotFound',\n 'edit.slide-not-found',\n 'The presentation has no such slide. Read the slides again.',\n ],\n [\n 'errors.tooLarge',\n 'edit.too-large',\n 'The content is larger than the presentation accepts. Use smaller content.',\n ],\n [\n 'errors.unsafeLink',\n 'argument.not-accepted',\n 'Use an http, https, mailto, tel, or ftp address of up to 2048 characters.',\n ],\n [\n 'errors.unsupported',\n 'edit.unsupported',\n 'The presentation cannot take this change. Change another property.',\n ],\n [\n 'partly-applied',\n 'edit.partly-applied',\n 'A read in this sync needed the result of the writes before it, so those writes applied first. The call in errorLocation and the calls after it did not apply.',\n ],\n // Host refusals with a detail of their own.\n ['document', 'host.no-document', 'The host holds no presentation. Open one before you run.'],\n [\n 'internal',\n 'host.internal',\n 'The engine could not complete the request, and nothing changed. Report the call that failed.',\n ],\n [\n 'no-theme',\n 'edit.no-theme-color',\n 'The master has no theme, or the theme has no such color. Use a theme color of the master.',\n ],\n ['part', 'edit.not-xml-part', 'That part of the presentation is not XML. Use an XML part.'],\n [\n 'picture',\n 'edit.picture-not-in-package',\n 'The background picture is a theme fill or a link outside the file. Pass imageBase64 to set a picture.',\n ],\n [\n 'rotation',\n 'edit.no-rotation',\n 'A table or another graphic frame does not rotate. Rotate another shape.',\n ],\n [\n 'transparency',\n 'edit.fill-not-solid',\n 'Only a solid fill has a transparency. Call setSolidColor first.',\n ],\n [\n 'result',\n 'edit.stale-target',\n 'The object is not available in this batch. Read the presentation again.',\n ],\n [\n 'parentGroup',\n 'edit.not-in-group',\n 'The shape is not in a group. Check shape.level first: 0 is the top level of the slide.',\n ],\n [\n 'group',\n 'edit.not-a-group',\n 'The shape is not a group. Check shape.type first, and use a group shape.',\n ],\n];\n\n/**\n * The diagnostic of a host refusal that has no detail of its own, by host code: an argument\n * that is out of range or of the wrong form, a missing item, a stale read, a change the store\n * refused as a whole, and an operation the host does not know.\n */\nexport const CODE_DIAGNOSTICS: Readonly<Record<string, readonly [string, string]>> = Object.freeze({\n 'invalid-argument': [\n 'argument.not-accepted',\n 'An argument is out of range or of the wrong form. errorLocation names the call; its reference lists the values it takes.',\n ],\n 'item-not-found': [\n 'edit.item-not-found',\n 'The collection has no item with that id, key, or index. Read the items again.',\n ],\n 'stale-revision': [\n 'edit.stale-document',\n 'Another writer changed the presentation after this context read it. Read again before you write.',\n ],\n 'transaction-refused': [\n 'edit.refused',\n 'The presentation refused the change as a whole, and nothing applied. Change one property at a time to find the cause.',\n ],\n disposed: ['host.disposed', 'The host was disposed. Create a new runtime.'],\n 'document-unavailable': [\n 'host.no-document',\n 'The editor holds no presentation right now. Wait until it has loaded one.',\n ],\n 'unknown-operation': [\n 'host.unknown-operation',\n 'The host does not know this call. Use a host of the same package version.',\n ],\n});\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// After DOCX Editor's `packages/editor-api/src/runtime/errors.ts` (commit 5993bd223945).\n//\n// One error class, a stable code per refusal, and one fixed sentence per code. Nothing from the\n// engine or the file reaches a message: host details only select a public diagnostic, whose\n// fixed hint becomes `debugInfo.innerError`. The edit refusals of the engine have their\n// diagnostics in `edit-diagnostics.ts`.\n\nimport { argumentHint } from './argument-hints.ts';\nimport { CODE_DIAGNOSTICS, EDIT_DIAGNOSTICS } from './edit-diagnostics.ts';\n\n/**\n * What went wrong, as a value a consumer may branch on.\n *\n * @public\n */\nexport type PptxEditorErrorCode =\n /** A property was read before a `load(...)` for it completed in a `sync()`. */\n | 'PropertyNotLoaded'\n /** A `ClientResult` value was read before the sync that fills it. */\n | 'ValueNotLoaded'\n /**\n * The object cannot be addressed: its run ended and nothing tracked it, the call that would\n * have created it was in a refused sync, or the presentation no longer holds it (an edit\n * removed it). A lookup from a refused sync is sent again, so its proxy stays usable.\n */\n | 'InvalidObjectPath'\n /** The object still belongs to a run that has not finished, so it cannot be handed over. */\n | 'ObjectInUse'\n /** An argument or load option this API does not accept. */\n | 'InvalidArgument'\n /** Opening the presentation exceeded a bounded reader limit. */\n | 'ResourceLimitExceeded'\n /** The collection has no such item: `getItem` with an unknown id, `getItemAt` out of range. */\n | 'ItemNotFound'\n /**\n * The call is outside the supported subset for this host or content, and nothing changed.\n * Examples: a server runtime has no selection; a shape has no text frame.\n */\n | 'NotSupported'\n /** The member is one this API does not implement, and nothing changed. */\n | 'NotImplemented'\n /** The request context's `run` has finished, so it can no longer be used. */\n | 'InvalidRequestContext'\n /** The runtime was disposed. Every later operation fails this way. */\n | 'RuntimeDisposed'\n /**\n * The batch was built from an older read, so nothing was applied: another writer changed the\n * presentation after this context read it. Read again before retrying.\n */\n | 'StaleDocument'\n /** The host is live but holds no presentation right now: an editor between documents. */\n | 'DocumentUnavailable'\n /** The presentation refused the change, or answered something this runtime cannot use. */\n | 'GeneralException';\n\nconst MESSAGES: Readonly<Record<PptxEditorErrorCode, string>> = Object.freeze({\n PropertyNotLoaded:\n 'the property has not been loaded. Call load(...) and await context.sync() before reading it.',\n ValueNotLoaded: 'the result has not been filled in yet. Await context.sync() before reading it.',\n InvalidObjectPath:\n 'the object cannot be addressed. Keep proxies within their run, or use ' +\n 'context.trackedObjects.add(...) before the run ends.',\n ObjectInUse:\n 'the object still belongs to a run that has not finished. Await that run before passing the ' +\n 'object to another one.',\n InvalidArgument: 'the argument is not one this API accepts.',\n ResourceLimitExceeded: 'the presentation exceeds a supported resource limit.',\n ItemNotFound: 'the collection has no such item.',\n NotSupported:\n 'the operation or argument is outside the supported subset for this host or content.',\n NotImplemented: 'this API does not implement that operation for this target.',\n InvalidRequestContext: 'the request context has finished. Start another run to continue.',\n RuntimeDisposed: 'the runtime has been disposed.',\n StaleDocument:\n 'the presentation changed after this context read it, so nothing was applied. Read again ' +\n 'before you decide.',\n DocumentUnavailable: 'the presentation is not available right now.',\n GeneralException: 'the presentation could not complete the request.',\n});\n\n/** A public reason for a refusal: a stable code and a fixed hint. */\nexport interface PptxEditorDiagnostic {\n readonly code: string;\n readonly hint: string;\n}\n\n/** The diagnostic of an argument refusal that names what the API accepts there. */\nconst ARGUMENT_NOT_ACCEPTED = 'argument.not-accepted';\n\n/**\n * The public diagnostics, by the host detail that selects them. A detail that is not here\n * gives no `innerError`: an unknown engine reason never becomes public API.\n */\nconst DIAGNOSTICS: ReadonlyMap<string, PptxEditorDiagnostic> = new Map(\n (\n [\n ['gone', 'edit.stale-target', 'An edit removed the object. Read the presentation again.'],\n [\n 'null-object',\n 'edit.null-object',\n 'The object is a null object: its lookup found nothing. Check isNullObject first.',\n ],\n [\n 'refused-sync',\n 'sync.object-from-refused-sync',\n 'This object came from a sync that was refused, so it was never created. Create it again.',\n ],\n ['disabled.viewing', 'edit.read-only', 'The editor is open for viewing. Switch to editing.'],\n ['selection', 'host.no-selection', 'Only a runtime over a live editor has a selection.'],\n [\n 'no-text',\n 'edit.no-text-frame',\n 'The shape has no text frame. Check shape.type first, and read text only of a shape that ' +\n 'holds text.',\n ],\n [\n 'not-group',\n 'edit.not-a-group',\n 'The shape is not a group. Check shape.type first, and use a group shape.',\n ],\n [\n 'group-count',\n 'edit.group-count',\n 'A group needs two or more different shapes. Remove repeated shapes or add more.',\n ],\n [\n 'disabled.groupPlaceholder',\n 'edit.group-placeholder',\n 'A placeholder cannot be in a group. Group shapes that are not placeholders.',\n ],\n [\n 'group-parent',\n 'edit.group-parent',\n 'The shapes are not in the same parent. Use shapes of one slide, or of one group.',\n ],\n [\n 'group-owner',\n 'edit.group-off-slide',\n 'Only shapes on a slide can be grouped or ungrouped. Use a slide, not a layout or master.',\n ],\n [\n 'group-line',\n 'edit.group-line',\n 'A group has no outline of its own. Set the line format of each shape in the group.',\n ],\n [\n 'disabled.lastSlide',\n 'edit.last-slide',\n 'A presentation keeps at least one slide. Add a slide before you delete this one.',\n ],\n ['not-table', 'edit.not-a-table', 'The shape is not a table. Use a table shape.'],\n [\n 'table-style-undefined',\n 'edit.table-style-undefined',\n 'The presentation does not define that table style. Choose a style that the ' +\n 'presentation defines, or MediumStyle2Accent1, which is built in.',\n ],\n [\n 'table-style-unknown',\n 'read.table-style-unknown',\n 'The table uses a style that has no TableStyle value. Read the other settings, or set ' +\n 'a style first.',\n ],\n [\n 'no-preset-geometry',\n 'edit.no-preset-geometry',\n 'The shape has no preset geometry, so it has no adjustments. Use a shape with a preset ' +\n 'geometry, not a freeform, a group, or a table.',\n ],\n [\n 'merge-overlap',\n 'edit.merge-overlap',\n 'The new span cuts another merged cell. Resize or split that cell first.',\n ],\n [\n 'duplicate-id',\n 'edit.duplicate-shape-id',\n 'Another shape on the slide has the same id. A write could reach the wrong shape.',\n ],\n [\n 'custom-xml',\n 'edit.invalid-custom-xml',\n 'The text is not one well-formed XML element, declares a DTD or an entity, declares an ' +\n 'encoding other than UTF-8, or is longer than 8 MiB. Write plain XML with one root.',\n ],\n [\n 'custom-xml-id',\n 'edit.custom-xml-id-taken',\n 'Another custom XML part of the presentation has that id. Use a new GUID.',\n ],\n [\n 'custom-properties-root',\n 'read.custom-properties-invalid',\n 'The custom properties part of the file is not a custom properties part. Remove it first.',\n ],\n [\n 'import-base64',\n 'import.invalid-base64',\n 'The file is not Base64 text, or it is larger than 100 MiB. Send the PPTX bytes as Base64.',\n ],\n [\n 'import-package',\n 'import.not-a-presentation',\n 'The file is not a presentation, or it exceeds a limit of the bounded reader.',\n ],\n [\n 'import-slide',\n 'import.slide-not-found',\n 'The source presentation has no slide with that id. Use the ids of its Slide objects.',\n ],\n [\n 'import-target',\n 'import.target-not-found',\n 'The presentation has no slide with the targetSlideId. Read the slide ids again.',\n ],\n ['save', 'host.no-save', 'This runtime borrows an editor, which saves its own document.'],\n [\n 'images',\n 'host.no-images',\n 'This runtime draws no pictures. Use a runtime over a live editor in a browser, or ' +\n 'create the server runtime with a rasterize option.',\n ],\n [\n 'image-owner',\n 'image.not-on-slide',\n 'Only a slide or a shape on a slide has a picture. Use a shape of a slide, not of a ' +\n 'layout or a master.',\n ],\n [\n 'image-size',\n 'image.invalid-size',\n 'The width and the height of a picture must be positive numbers of pixels.',\n ],\n [\n 'image-failed',\n 'image.failed',\n 'The editor could not draw the picture: the shape is not drawn (for example, it is ' +\n 'hidden), the browser has no canvas, or the rasterizer failed or answered something ' +\n 'other than a PNG of the asked size. Read the shape, then try again.',\n ],\n [\n 'address',\n ARGUMENT_NOT_ACCEPTED,\n 'Use an http, https, mailto, tel, or ftp address of up to 2048 characters.',\n ],\n [\n 'binding-shape',\n 'binding.shape-deleted',\n 'An edit deleted the shape of the binding. Delete the binding, or bind another shape ' +\n 'with the same id.',\n ],\n [\n 'binding-selection',\n 'binding.selection',\n 'The selection is not one shape. Select exactly one shape on a slide, then add the ' +\n 'binding.',\n ],\n [\n 'binding-limit',\n 'binding.limit',\n 'The runtime holds 10000 bindings. Delete a binding before you add another.',\n ],\n [\n 'read-after-commit',\n 'edit.read-after-commit',\n 'The writes of this sync were applied, but a read after them failed. Read again, and ' +\n 'do not apply the same edit again.',\n ],\n ] as const\n )\n .map(([detail, code, hint]): [string, PptxEditorDiagnostic] => [\n detail,\n Object.freeze({ code, hint }),\n ])\n .concat(EDIT_DIAGNOSTICS.map(([detail, code, hint]) => [detail, Object.freeze({ code, hint })]))\n);\n\n/**\n * The diagnostic of a host refusal: the one its detail selects, else the fixed one of its host\n * code, so every refusal of the engine carries an `innerError`.\n */\nexport function hostDiagnosticOf(\n code: string,\n detail: string | undefined\n): PptxEditorDiagnostic | undefined {\n const own = diagnosticOf(detail);\n if (own) return own;\n // An argument the engine refused: the hint says what to pass (`argument-hints.ts`).\n const hint = code === 'invalid-argument' ? argumentHint(detail) : undefined;\n if (hint) return Object.freeze({ code: ARGUMENT_NOT_ACCEPTED, hint });\n const fallback = Object.prototype.hasOwnProperty.call(CODE_DIAGNOSTICS, code)\n ? CODE_DIAGNOSTICS[code]\n : undefined;\n return fallback ? Object.freeze({ code: fallback[0], hint: fallback[1] }) : undefined;\n}\n\n/**\n * A slide to import that the import cannot copy, with the ids of those slides when the engine\n * names them. The ids are numbers only, so nothing else from the file reaches the hint.\n */\nconst NOT_COPYABLE =\n /^disabled\\.slideNotCopyable:import-(comments|control)(?::(\\d{1,10}(?:,\\d{1,10}){0,19}))?$/;\n\nfunction notCopyable(detail: string): PptxEditorDiagnostic | undefined {\n const m = NOT_COPYABLE.exec(detail);\n if (!m) return undefined;\n const ids = m[2]?.split(',') ?? [];\n const one = ids.length <= 1;\n const slides =\n ids.length === 0\n ? 'A slide to import'\n : `${one ? 'Slide' : 'Slides'} ${ids.join(', ')} of the source`;\n const what =\n m[1] === 'comments'\n ? 'threaded comments, which an import cannot copy yet'\n : 'an embedded control (p:control)';\n return Object.freeze({\n code: m[1] === 'comments' ? 'import.slide-has-comments' : 'import.slide-has-controls',\n hint: `${slides} ${one ? 'has' : 'have'} ${what}. Leave ${one ? 'it' : 'them'} out with sourceSlideIds.`,\n });\n}\n\n/** The public diagnostic a host detail selects, if any. */\nexport function diagnosticOf(detail: string | undefined): PptxEditorDiagnostic | undefined {\n if (detail === undefined) return undefined;\n return DIAGNOSTICS.get(detail) ?? notCopyable(detail) ?? DIAGNOSTICS.get(detail.split(':')[0]!);\n}\n\nconst REMOVED_OBJECT_MESSAGE =\n 'the object no longer exists in the presentation. An edit removed it. Read the presentation ' +\n 'again to get a fresh object.';\n\nconst NULL_OBJECT_MESSAGE =\n 'the object is a null object, so it cannot be written or called. Check isNullObject after a ' +\n 'sync before you use an object from a get...OrNullObject method.';\n\nfunction messageOf(\n code: PptxEditorErrorCode,\n diagnostic: PptxEditorDiagnostic | undefined\n): string {\n if (code === 'InvalidArgument' && diagnostic?.code === ARGUMENT_NOT_ACCEPTED)\n return `${MESSAGES[code]} ${diagnostic.hint}`;\n if (code !== 'InvalidObjectPath') return MESSAGES[code];\n if (diagnostic?.code === 'edit.stale-target') return REMOVED_OBJECT_MESSAGE;\n if (diagnostic?.code === 'edit.null-object') return NULL_OBJECT_MESSAGE;\n return MESSAGES[code];\n}\n\n/**\n * The fields a {@link PptxEditorError} is constructed from.\n *\n * @public\n */\nexport interface PptxEditorErrorInit {\n /** Which refusal this is. The stable thing to branch on. */\n readonly code: PptxEditorErrorCode;\n /** The consumer-facing path of the object or property involved, never a handle. */\n readonly target?: string;\n /** The revision the context had read at, for `StaleDocument`. */\n readonly expectedRevision?: number;\n /** The revision the presentation was actually at, for `StaleDocument`. */\n readonly actualRevision?: number;\n /** The public reason, when the engine gave one this API knows. */\n readonly diagnostic?: PptxEditorDiagnostic;\n /** The `context.trace` messages queued before the call that failed. */\n readonly traceMessages?: readonly string[];\n}\n\n/**\n * Why the engine refused, as a public diagnostic code with its fixed hint.\n *\n * @public\n */\nexport interface PptxEditorInnerError {\n /** A stable public diagnostic code, such as `edit.stale-target`. */\n readonly code: string;\n /** The fixed hint for the code: the cause, then the action. Never presentation content. */\n readonly message: string;\n}\n\n/**\n * Debug details in the shape of Office.js `OfficeExtension.DebugInfo`.\n *\n * @public\n */\nexport interface PptxEditorDebugInfo {\n /** The same code as {@link PptxEditorError.code}. */\n readonly code: PptxEditorErrorCode;\n /** The same message as the error's own. */\n readonly message: string;\n /** The consumer-facing path of the object or property involved, when there is one. */\n readonly errorLocation?: string;\n /** Why the engine refused, when it knows a specific reason. */\n readonly innerError?: PptxEditorInnerError;\n}\n\n/**\n * Every refusal this runtime throws.\n *\n * Branch on {@link PptxEditorError.code}, never on the message. Codes are stable public API.\n * Nothing from the engine or the file appears in the message: a consumer gets a stable code, a\n * fixed sentence, and `target`, the consumer-facing path they wrote themselves.\n *\n * @example\n * ```ts\n * try {\n * await context.sync();\n * } catch (error) {\n * if (isPptxEditorError(error) && error.code === 'StaleDocument') {\n * // Read again: another writer changed the presentation first.\n * }\n * }\n * ```\n *\n * @public\n */\nexport class PptxEditorError extends Error {\n /** Which refusal this is. Stable across versions; the thing to branch on. */\n readonly code: PptxEditorErrorCode;\n /** Consumer-facing path of the object or property involved, when there is one to name. */\n readonly target?: string;\n /** For `StaleDocument`: the revision the context had last read at. */\n readonly expectedRevision?: number;\n /** For `StaleDocument`: the revision the presentation was actually at. */\n readonly actualRevision?: number;\n /** Debug details, as Office.js `OfficeExtension.Error.debugInfo` has them. */\n readonly debugInfo: PptxEditorDebugInfo;\n /**\n * The messages of `context.trace` calls queued before the call that failed, in order, as\n * Office.js `OfficeExtension.Error.traceMessages`. Empty when the sync had none.\n */\n readonly traceMessages: readonly string[];\n\n constructor(init: PptxEditorErrorInit) {\n const base = messageOf(init.code, init.diagnostic);\n const message = init.target ? `${base} (${init.target})` : base;\n super(message);\n this.name = 'PptxEditorError';\n this.code = init.code;\n this.traceMessages = Object.freeze([...(init.traceMessages ?? [])]);\n this.debugInfo = Object.freeze({\n code: init.code,\n message,\n ...(init.target === undefined ? {} : { errorLocation: init.target }),\n ...(init.diagnostic === undefined\n ? {}\n : {\n innerError: Object.freeze({\n code: init.diagnostic.code,\n message: init.diagnostic.hint,\n }),\n }),\n });\n if (init.target !== undefined) this.target = init.target;\n if (init.expectedRevision !== undefined) this.expectedRevision = init.expectedRevision;\n if (init.actualRevision !== undefined) this.actualRevision = init.actualRevision;\n }\n}\n\n/**\n * Whether a caught value is one of ours. By `name` as well as by `instanceof`: a consumer can\n * end up with two copies of this module, and `instanceof` fails across them.\n *\n * @public\n */\nexport function isPptxEditorError(value: unknown): value is PptxEditorError {\n if (value instanceof PptxEditorError) return true;\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { name?: unknown }).name === 'PptxEditorError' &&\n typeof (value as { code?: unknown }).code === 'string'\n );\n}\n\n/** The message this runtime uses for a code, for tests that assert nothing else is thrown. */\nexport function messageFor(code: PptxEditorErrorCode): string {\n return MESSAGES[code];\n}\n\nexport function fail(init: PptxEditorErrorInit): never {\n throw new PptxEditorError(init);\n}\n\n/** The same refusal with the trace messages of its sync. Any other value comes back as it was. */\nexport function withTraceMessages(error: unknown, messages: readonly string[]): unknown {\n if (!(error instanceof PptxEditorError) || messages.length === 0) return error;\n const inner = error.debugInfo.innerError;\n return new PptxEditorError({\n code: error.code,\n ...(error.target === undefined ? {} : { target: error.target }),\n ...(error.expectedRevision === undefined ? {} : { expectedRevision: error.expectedRevision }),\n ...(error.actualRevision === undefined ? {} : { actualRevision: error.actualRevision }),\n ...(inner === undefined ? {} : { diagnostic: { code: inner.code, hint: inner.message } }),\n traceMessages: messages,\n });\n}\n\n/**\n * Refuse an argument with `InvalidArgument`, naming what the API accepts there, such as\n * `a string, a finite number, a boolean, or a valid Date`. The message and the diagnostic\n * `argument.not-accepted` both carry it.\n */\nexport function failArgument(target: string | undefined, accepted: string, guess?: string): never {\n const hint =\n guess === undefined ? `Use ${accepted}.` : `Did you mean '${guess}'? Use ${accepted}.`;\n throw new PptxEditorError({\n code: 'InvalidArgument',\n ...(target === undefined ? {} : { target }),\n diagnostic: Object.freeze({ code: ARGUMENT_NOT_ACCEPTED, hint }),\n });\n}\n\n/** Longer values get no suggestion: they are no typo of a name. */\nconst MAX_GUESSED = 64;\n\n/**\n * The edit distance between `a` and `b`, ignoring case: insertions, deletions, substitutions,\n * and swaps of two neighbors each count one (optimal string alignment).\n */\nfunction distance(a: string, b: string): number {\n const x = a.toLowerCase();\n const y = b.toLowerCase();\n let before: number[] = [];\n let row = Array.from({ length: y.length + 1 }, (_, j) => j);\n for (let i = 1; i <= x.length; i += 1) {\n const next = [i];\n for (let j = 1; j <= y.length; j += 1) {\n let d = Math.min(\n row[j]! + 1,\n next[j - 1]! + 1,\n row[j - 1]! + (x[i - 1] === y[j - 1] ? 0 : 1)\n );\n if (i > 1 && j > 1 && x[i - 1] === y[j - 2] && x[i - 2] === y[j - 1])\n d = Math.min(d, before[j - 2]! + 1);\n next[j] = d;\n }\n before = row;\n row = next;\n }\n return row[y.length]!;\n}\n\n/** The words of a name: `ArabicNumeralPeriod` is `arabic`, `numeral`, `period`. */\nfunction words(name: string): string[] {\n return name\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .toLowerCase()\n .split(/[^a-z0-9]+/)\n .filter((w) => w.length > 0);\n}\n\n/** Two words match when equal, when one starts the other (3 or more letters), or by one typo. */\nfunction sameWord(a: string, b: string): boolean {\n if (a === b) return true;\n if ((a.length >= 3 && b.startsWith(a)) || (b.length >= 3 && a.startsWith(b))) return true;\n return Math.min(a.length, b.length) >= 4 && distance(a, b) <= 1;\n}\n\n/**\n * The candidate nearest to `value`, or undefined when none is near. A candidate is always one\n * of `candidates`, so the suggestion is a value the caller may use.\n *\n * First a typo: the candidate nearest by edit distance, when that is at most a third of its\n * length, and at least 1 and at most 3 edits. Else the words: a candidate that holds every word\n * of `value` (`ArabicPeriod` is in `ArabicNumeralPeriod`; `Rect` starts `Rectangle`), or all\n * but one of three or more. Among those, the one with the fewest other words wins, then the\n * nearest by edit distance, then the first.\n */\nexport function nearest(value: unknown, candidates: readonly string[]): string | undefined {\n if (typeof value !== 'string' || value.length === 0 || value.length > MAX_GUESSED)\n return undefined;\n let best: string | undefined;\n let bestDistance = Infinity;\n for (const candidate of candidates) {\n const d = distance(value, candidate);\n if (d < bestDistance) {\n best = candidate;\n bestDistance = d;\n }\n }\n if (best === undefined) return undefined;\n const limit = Math.min(3, Math.max(1, Math.floor(best.length / 3)));\n if (bestDistance <= limit) return best;\n const wanted = words(value);\n if (wanted.length === 0) return undefined;\n let chosen: { candidate: string; missing: number; extra: number; d: number } | undefined;\n for (const candidate of candidates) {\n const have = words(candidate);\n const used = new Set<number>();\n let missing = 0;\n for (const w of wanted) {\n const at = have.findIndex((h, i) => !used.has(i) && sameWord(w, h));\n if (at < 0) missing += 1;\n else used.add(at);\n }\n if (missing > (wanted.length >= 3 ? 1 : 0)) continue;\n const score = {\n candidate,\n missing,\n extra: have.length - used.size,\n d: distance(value, candidate),\n };\n if (\n !chosen ||\n score.missing < chosen.missing ||\n (score.missing === chosen.missing &&\n (score.extra < chosen.extra || (score.extra === chosen.extra && score.d < chosen.d)))\n )\n chosen = score;\n }\n return chosen?.candidate;\n}\n\n/** Up to this many accepted values are listed in full. */\nconst LISTED_VALUES = 12;\n\n/**\n * `one of A, B, or C`: the accepted values of an enum, in full when there are few, else the\n * count and the first few.\n */\nexport function oneOf(values: readonly string[]): string {\n const quoted = values.map((v) => `'${v}'`);\n if (quoted.length === 1) return quoted[0]!;\n if (quoted.length > LISTED_VALUES)\n return `one of the ${quoted.length} values of the enum, such as ${quoted.slice(0, 3).join(', ')}`;\n return `one of ${quoted.slice(0, -1).join(', ')}${quoted.length > 2 ? ',' : ''} or ${quoted.at(-1)}`;\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// After DOCX Editor's `packages/editor-api/src/runtime/internals.ts` (commit 5993bd223945).\n//\n// The seam between a request context and the proxies it owns, on module-local symbols so no\n// consumer can reach it by name.\n\nimport type { AutomationCapabilities, AutomationHost } from '@pptx-editor.dev/core/automation';\nimport type { ActionQueue } from './queue.ts';\nimport type { RequestContext } from './request-context.ts';\n\nexport const INTERNALS: unique symbol = Symbol('pptx-editor.runtime.internals');\nexport const RELEASE: unique symbol = Symbol('pptx-editor.runtime.release');\nexport const REBIND: unique symbol = Symbol('pptx-editor.runtime.rebind');\nexport const PATH: unique symbol = Symbol('pptx-editor.runtime.path');\nexport const LOAD_REQUEST: unique symbol = Symbol('pptx-editor.runtime.load-request');\nexport const DEFER_REFUSAL: unique symbol = Symbol('pptx-editor.runtime.defer-refusal');\nexport const LOADED_VALUES: unique symbol = Symbol('pptx-editor.runtime.loaded-values');\n\n/** What a proxy may ask of the context it belongs to. */\nexport interface ContextInternals {\n readonly host: AutomationHost;\n readonly capabilities: AutomationCapabilities;\n readonly queue: ActionQueue;\n /**\n * Identity of the runtime behind this context. Compared, never called: it is how adoption\n * refuses an object minted by another runtime, whose handles name another presentation.\n */\n readonly session: object;\n /** Refuse if this context can no longer be used. `target` names what the caller reached for. */\n assertUsable(target?: string): void;\n /** Whether this context's run has ended. */\n isFinished(): boolean;\n /** The revision this context last read at, or `null` if it has never read. */\n readRevision(): number | null;\n register(object: RuntimeManagedObject): void;\n track(object: RuntimeManagedObject): void;\n untrack(object: RuntimeManagedObject): void;\n isTracked(object: RuntimeManagedObject): boolean;\n /** Give up every claim on an object: it belongs to another context now. */\n disown(object: RuntimeManagedObject): void;\n /**\n * Work that a settled answer starts and the sync must wait for (a picture the host draws).\n * The sync that dispatched the answer awaits it before it continues, and fails if it fails.\n */\n defer(work: Promise<void>): void;\n}\n\n/** What a context may do to a proxy it owns. */\nexport interface RuntimeManagedObject {\n /** @internal Drop this object's presentation reference; the run that owned it has ended. */\n [RELEASE](): void;\n /** @internal Adoption: this object now belongs to another run's context on the same runtime. */\n [REBIND](context: RequestContext): void;\n}\n\n/** The internals of a context, for the modules that hold one. */\nexport function internalsOf(context: RequestContext): ContextInternals {\n return context[INTERNALS];\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// One point for argument checks: the sync, as in Office.js.\n//\n// The object model checks its arguments when a call is made. A method call or property write\n// that this API refuses for its argument (`InvalidArgument`, `NotImplemented`, `NotSupported`,\n// `ItemNotFound`) does not throw at the call: the refusal is queued, and the next `sync()`\n// refuses with it as a whole, so nothing of that batch applies and no earlier call stays half\n// queued. A method that answers an object answers a stand-in, which takes further calls and\n// queues nothing. What still throws at the call: a read before its load (`PropertyNotLoaded`),\n// `load(...)` options, and a proxy or context used outside its lifetime.\n\nimport { isPptxEditorError, type PptxEditorError, type PptxEditorErrorCode } from './errors.ts';\nimport { DEFER_REFUSAL } from './internals.ts';\n\n/** The refusals of an argument, which the sync gives. */\nconst DEFERRED: ReadonlySet<PptxEditorErrorCode> = new Set([\n 'InvalidArgument',\n 'NotImplemented',\n 'NotSupported',\n 'ItemNotFound',\n]);\n\n/**\n * Members that are not calls of the object model: its machinery, and the calls that keep\n * throwing at the call (`load`, `toJSON`, and the lifetime members).\n */\nexport const NOT_DEFERRED: ReadonlySet<string> = new Set([\n 'constructor',\n 'load',\n 'toJSON',\n 'track',\n 'untrack',\n 'at',\n 'command',\n 'deleteLines',\n 'enqueue',\n 'find',\n 'groupOf',\n 'handlesOf',\n 'hasLoadedProperty',\n 'indexArg',\n 'itemOf',\n 'keyArg',\n 'listing',\n 'loadBackground',\n 'loadCellFormat',\n 'loadedProperty',\n 'loadScalars',\n 'lookup',\n 'make',\n 'markSkipped',\n 'memberPath',\n 'navigation',\n 'onLoad',\n 'requireUsable',\n 'selection',\n 'setLoadedProperty',\n 'takeNestedPaths',\n 'writeBackground',\n 'writeSize',\n]);\n\n/** How deep in wrapped calls the current call is: only the outermost queues a refusal. */\nlet depth = 0;\n\n/** What a refused call that answers an object answers: it takes any use and queues nothing. */\nfunction standIn(): unknown {\n const proxy: unknown = new Proxy(function standIn() {}, {\n get: (_target, key) => (key === 'then' || typeof key === 'symbol' ? undefined : proxy),\n set: () => true,\n apply: () => proxy,\n });\n return proxy;\n}\n\n/** What a wrapped call needs from its object: a way to queue the refusal. */\ninterface Deferring {\n [DEFER_REFUSAL](error: PptxEditorError): void;\n}\n\nfunction deferring<A extends unknown[], R>(\n call: (this: Deferring, ...args: A) => R,\n answers: boolean\n): (this: Deferring, ...args: A) => R {\n return function (this: Deferring, ...args: A): R {\n depth += 1;\n try {\n return call.apply(this, args);\n } catch (error) {\n if (depth > 1 || !isPptxEditorError(error) || !DEFERRED.has(error.code)) throw error;\n this[DEFER_REFUSAL](error);\n return (answers ? standIn() : undefined) as R;\n } finally {\n depth -= 1;\n }\n };\n}\n\nconst done = new WeakSet<object>();\n\n/** The member names that `deferArgumentChecks` wrapped, for the check against Office.js. */\nexport const DEFERRED_MEMBERS = new Set<string>();\n\n/**\n * Move the argument checks of the calls and property writes of `proto` and the prototypes above\n * it, up to `stop`, to the sync. Each prototype is changed once. `ClientObject` calls this for\n * each object it constructs, so every class of the object model follows the rule.\n */\nexport function deferArgumentChecks(proto: object | null, stop: object): void {\n while (proto && proto !== stop && !done.has(proto)) {\n done.add(proto);\n for (const name of Object.getOwnPropertyNames(proto)) {\n if (NOT_DEFERRED.has(name)) continue;\n const d = Object.getOwnPropertyDescriptor(proto, name)!;\n if (typeof d.value === 'function') {\n Object.defineProperty(proto, name, { ...d, value: deferring(d.value, true) });\n DEFERRED_MEMBERS.add(name);\n } else if (d.set) {\n Object.defineProperty(proto, name, { ...d, set: deferring(d.set, false) });\n DEFERRED_MEMBERS.add(name);\n }\n }\n proto = Object.getPrototypeOf(proto) as object | null;\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Copied from DOCX Editor's `packages/editor-api/src/runtime/load-options.ts` (commit 5993bd223945).\n// What `load(...)` accepts, and what it refuses.\n//\n// Four call shapes, as Office.js takes them: `load('text')`, `load(['text', 'style'])`,\n// `load({ select: 'text', top: 5 })`, and the property tree `load({ font: { bold: true } })`.\n// Each can name properties by path (`shapes/items/textFrame/textRange/text`). They all resolve\n// to one tree of requests, one node for each object on a path, so an object's load planner\n// reads a single shape and hands each navigation property its own node.\n//\n// REFUSAL IS THE POINT. A misspelled option key is the difference between \"load selected\n// properties\" and \"load nothing\", and silently ignoring it produces a `PropertyNotLoaded` later\n// at a call that looks correct. So an unknown key, a non-integer `top`, a property name that is\n// not an identifier, or a value of the wrong type is `InvalidArgument` HERE, naming the option.\n// A name that is not a property of the object it reaches is refused by that object's planner.\n//\n// THE TREE IS BOUNDED. At most 8 segments in a path or levels in a property tree, and at most\n// 256 names in one call. A larger request is refused as it is read, so attacker-influenced data\n// in a consumer's own pipeline cannot drive deep recursion or a large allocation here.\n//\n// Selected names are never used as object keys anywhere in this runtime — loaded values live in\n// a `Map` — so `__proto__` as a property name is inert by construction rather than by filtering.\n// It is still refused, because it is not a property any object of this API has.\n\nimport { failArgument, nearest } from './errors.ts';\n\n/**\n * The object form of `load(...)`: which properties, and how much of a collection.\n *\n * An unknown key, a non-integer `top`, a property name that is not an identifier, or a value of\n * the wrong type is refused as `InvalidArgument` here, naming the option — a misspelled key is\n * the difference between \"load selected properties\" and \"load nothing\", which would otherwise\n * surface as a `PropertyNotLoaded` much later at a call that looks correct.\n *\n * @public\n */\nexport interface LoadQueryOptions {\n /** Which properties to load, as names or paths such as `items/fill/type`. */\n readonly select?: string | readonly string[];\n /**\n * Navigation properties to load with their default set, as names or paths such as\n * `items/fill`. A path that `select` also names deeper loads only what `select` names.\n */\n readonly expand?: string | readonly string[];\n /** For a collection: at most this many items. */\n readonly top?: number;\n /** For a collection: skip this many items first. */\n readonly skip?: number;\n}\n\n/**\n * The property-tree form of `load(...)`, as the Office.js `*LoadOptions` interfaces give it.\n *\n * `true` loads a property. An object loads a navigation property with the properties it names;\n * an empty object loads its default set. `$all: true` loads every scalar property of that\n * object. On a collection, the keys name properties of each item, and `$top` and `$skip` limit\n * the items. `items` is accepted as a key too, so `{ shapes: { items: { name: true } } }` and\n * `{ shapes: { name: true } }` load the same thing.\n *\n * @public\n */\nexport interface LoadPropertyOptions {\n /** Load every scalar property of this object, or of each item of a collection. */\n readonly $all?: boolean;\n /** For a collection: at most this many items. */\n readonly $top?: number;\n /** For a collection: skip this many items first. */\n readonly $skip?: number;\n /** A property: `true` loads it, an object loads a navigation property with what it names. */\n readonly [property: string]: boolean | number | LoadPropertyOptions | undefined;\n}\n\n/**\n * Everything `load(...)` accepts: one property name or path, several, a\n * {@link LoadQueryOptions} object, or a {@link LoadPropertyOptions} tree.\n *\n * @example\n * ```ts\n * shape.load('name');\n * shape.load(['name', 'left', 'fill/foregroundColor']);\n * slide.load('shapes/items/textFrame/textRange/text');\n * slide.load({ shapes: { items: { name: true, fill: { type: true } } } });\n * shapes.load({ select: 'items/name', top: 5 });\n * shapes.load('$all');\n * ```\n *\n * A path names a property through navigation properties, for example `fill/type` on a shape.\n * On a collection, `items/<path>` loads `items` and that path on each item in the same\n * `context.sync()`. A path without the `items/` prefix means the same thing on a collection, so\n * `shapes.load('name')` equals `shapes.load('items/name')`. `$all` loads every scalar property\n * of the object it ends on, and `items/$all` of each item. `load()` and `load('items')` on a\n * collection load every scalar property of each item, in one more round trip.\n *\n * A name that is not a property of the object it reaches is refused as `InvalidArgument`, with\n * the object and the name as the error's `target`.\n *\n * @public\n */\nexport type LoadOption = string | readonly string[] | LoadQueryOptions | LoadPropertyOptions;\n\nexport interface ResolvedLoadOptions {\n /** Selected scalar or navigation property names of this object, without `$all`. */\n readonly select: readonly string[];\n /** True when `$all` was named: load every scalar property as well as `select`. */\n readonly all: boolean;\n /** Navigation properties named with a deeper path, each with the request for that object. */\n readonly nested: ReadonlyMap<string, ResolvedLoadOptions>;\n /**\n * The request for each item of a collection, from `items/<path>` paths or an `items` key.\n * An object that is not a collection refuses it.\n */\n readonly items?: ResolvedLoadOptions;\n /** The property names that `items` selects. Empty when none was named. */\n readonly itemSelect: readonly string[];\n readonly top?: number;\n readonly skip?: number;\n /**\n * Set on the request for each item of a collection and on everything below it: a text read of\n * an item that cannot hold text (a picture, a group) fills nothing instead of failing the sync.\n */\n readonly orNull?: boolean;\n}\n\n/** True when a request names nothing: the object loads its default set. */\nexport function isDefaultLoad(request: ResolvedLoadOptions): boolean {\n return request.select.length === 0 && request.nested.size === 0 && request.items === undefined;\n}\n\n/** True when a request loads every scalar property: `$all`, or nothing named. */\nexport function loadsAllScalars(request: ResolvedLoadOptions): boolean {\n return request.all || isDefaultLoad(request);\n}\n\n/** An empty request: load the default set. */\nexport const DEFAULT_LOAD: ResolvedLoadOptions = Object.freeze({\n select: [],\n all: false,\n nested: new Map(),\n itemSelect: [],\n});\n\nconst QUERY_KEYS = new Set(['select', 'expand', 'top', 'skip']);\nconst PROPERTY_NAME = /^[A-Za-z][A-Za-z0-9]*$/;\nconst ALL = '$all';\nconst ITEMS = 'items';\n/** Segments in one path, and levels in one property tree. */\nconst MAX_DEPTH = 8;\n/** Names in one call, over every path and level. */\nconst MAX_NAMES = 256;\nconst MAX_SEGMENT_LENGTH = 64;\n\n/** A request while it is being built. */\ninterface Draft {\n readonly select: string[];\n all: boolean;\n readonly nested: Map<string, Draft>;\n top?: number;\n skip?: number;\n}\n\nfunction draft(): Draft {\n return { select: [], all: false, nested: new Map() };\n}\n\n/** Counts names across one call, and refuses past the cap. */\nclass Budget {\n #left = MAX_NAMES;\n constructor(readonly target: string) {}\n spend(): void {\n this.#left -= 1;\n if (this.#left < 0)\n failArgument(this.target, `at most ${MAX_NAMES} property names in one load`);\n }\n}\n\nfunction child(node: Draft, name: string): Draft {\n let next = node.nested.get(name);\n if (!next) {\n next = draft();\n node.nested.set(name, next);\n }\n return next;\n}\n\n/**\n * The segments of one path. The refusal names the loaded object alone, because the target must\n * never echo an arbitrary value.\n */\nfunction segmentsOf(entry: unknown, target: string): readonly string[] {\n if (typeof entry !== 'string') failArgument(target, 'a property path as a string');\n const segments = entry.split('/', MAX_DEPTH + 1);\n const valid =\n segments.length <= MAX_DEPTH &&\n segments.every(\n (segment, i) =>\n segment.length <= MAX_SEGMENT_LENGTH &&\n (PROPERTY_NAME.test(segment) || (segment === ALL && i === segments.length - 1))\n );\n if (!valid) failArgument(target, \"property names separated by '/', such as 'items/name'\");\n return segments;\n}\n\n/** Add one path. `leaf` false makes every segment a navigation node (an `expand` path). */\nfunction addPath(root: Draft, segments: readonly string[], leaf: boolean, budget: Budget): void {\n let node = root;\n const last = leaf ? segments.length - 1 : segments.length;\n for (let i = 0; i < last; i += 1) {\n budget.spend();\n node = child(node, segments[i]!);\n }\n if (!leaf) return;\n budget.spend();\n const name = segments[last]!;\n if (name === ALL) node.all = true;\n else if (!node.select.includes(name)) node.select.push(name);\n}\n\nfunction listOf(value: unknown, target: string): readonly unknown[] {\n if (typeof value === 'string') return value.split(',', MAX_NAMES + 1).map((e) => e.trim());\n if (Array.isArray(value)) {\n if (value.length > MAX_NAMES) failArgument(target, `at most ${MAX_NAMES} paths`);\n return value.map((entry: unknown) => (typeof entry === 'string' ? entry.trim() : entry));\n }\n return failArgument(target, 'a path string, an array of path strings, or an options object');\n}\n\nfunction addPaths(root: Draft, value: unknown, leaf: boolean, target: string): void {\n const budget = new Budget(target);\n const entries = listOf(value, target);\n // An empty entry is what a trailing comma or a stray whitespace string produces. Dropping it\n // silently would make `load(' ')` mean `load()` — \"load the default set\" — which is the\n // opposite of what was asked for. `segmentsOf` refuses it.\n if (entries.length === 0) failArgument(target, 'at least one property name');\n for (const entry of entries) addPath(root, segmentsOf(entry, target), leaf, budget);\n}\n\nfunction count(value: unknown, target: string): number {\n if (typeof value !== 'number' || !Number.isInteger(value) || value < 0) {\n failArgument(target, 'a whole number of 0 or more');\n }\n return value;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return false;\n const proto = Object.getPrototypeOf(value) as unknown;\n return proto === Object.prototype || proto === null;\n}\n\n/** One level of a property tree. */\nfunction addTree(\n node: Draft,\n tree: Record<string, unknown>,\n target: string,\n depth: number,\n budget: Budget\n): void {\n if (depth > MAX_DEPTH)\n failArgument(budget.target, `a property tree at most ${MAX_DEPTH} levels deep`);\n for (const key of Object.keys(tree)) {\n budget.spend();\n const value = tree[key];\n if (key === ALL) {\n if (typeof value !== 'boolean') failArgument(`${target}.${key}`, 'true or false');\n if (value) node.all = true;\n } else if (key === '$top') node.top = count(value, `${target}.${key}`);\n else if (key === '$skip') node.skip = count(value, `${target}.${key}`);\n else if (key.length > MAX_SEGMENT_LENGTH || !PROPERTY_NAME.test(key))\n failArgument(target, 'property names of letters and digits');\n else if (value === true) {\n if (!node.select.includes(key)) node.select.push(key);\n } else if (value === false || value === undefined) continue;\n else if (isPlainObject(value))\n addTree(child(node, key), value, `${target}.${key}`, depth + 1, budget);\n else failArgument(`${target}.${key}`, 'true, false, or a nested property tree');\n }\n}\n\n/**\n * The finished request. A navigation property named both alone and with a deeper path loads\n * its default set as well as the deeper path: `load('fill, fill/type')` loads all of `fill`.\n */\nfunction finish(node: Draft): ResolvedLoadOptions {\n const itemsDraft = node.nested.get(ITEMS);\n const nested = new Map<string, ResolvedLoadOptions>();\n for (const [name, next] of node.nested) {\n if (name === ITEMS) continue;\n if (node.select.includes(name)) next.all = true;\n nested.set(name, finish(next));\n }\n const select = node.select.filter((name) => !nested.has(name));\n const items = itemsDraft ? finish(itemsDraft) : undefined;\n return {\n select,\n all: node.all,\n nested,\n ...(items ? { items } : {}),\n itemSelect: items ? items.select : [],\n ...(node.top === undefined ? {} : { top: node.top }),\n ...(node.skip === undefined ? {} : { skip: node.skip }),\n };\n}\n\n/**\n * One resolved request from any accepted call shape.\n *\n * `target` is the object being loaded, so a refusal names `presentation.slides`, not the\n * offending value — which may well be attacker-influenced data in a consumer's own pipeline.\n */\nexport function resolveLoadOption(\n option: LoadOption | undefined,\n target: string\n): ResolvedLoadOptions {\n if (option === undefined) return DEFAULT_LOAD;\n const root = draft();\n if (typeof option === 'string' || Array.isArray(option)) {\n addPaths(root, option, true, target);\n return finish(root);\n }\n if (!isPlainObject(option))\n failArgument(target, 'a path string, an array of path strings, or an options object');\n\n const keys = Object.keys(option);\n if (!keys.some((key) => QUERY_KEYS.has(key))) {\n addTree(root, option, target, 1, new Budget(target));\n return finish(root);\n }\n for (const key of keys) {\n if (!QUERY_KEYS.has(key))\n failArgument(\n `${target}.${key}`,\n 'the options select, expand, top, or skip',\n nearest(key, [...QUERY_KEYS])\n );\n }\n const query = option as LoadQueryOptions;\n if (query.select !== undefined) addPaths(root, query.select, true, `${target}.select`);\n if (query.expand !== undefined) addPaths(root, query.expand, false, `${target}.expand`);\n if (query.top !== undefined) root.top = count(query.top, `${target}.top`);\n if (query.skip !== undefined) root.skip = count(query.skip, `${target}.skip`);\n return finish(root);\n}\n\n/** Two requests for one object, as one. An empty request stands for the default set. */\nfunction merge(a: ResolvedLoadOptions, b: ResolvedLoadOptions): ResolvedLoadOptions {\n const select = [...a.select];\n for (const name of b.select) if (!select.includes(name)) select.push(name);\n const nested = new Map(a.nested);\n for (const [name, next] of b.nested) {\n const mine = nested.get(name);\n nested.set(name, mine ? merge(mine, next) : next);\n }\n const items = a.items && b.items ? merge(a.items, b.items) : (a.items ?? b.items);\n return {\n select,\n all: loadsAllScalars(a) || loadsAllScalars(b),\n nested,\n ...(items ? { items } : {}),\n itemSelect: items ? items.select : [],\n };\n}\n\n/**\n * The request for each item of a collection: the `items` request merged with the names of the\n * collection's own request, because on a collection `name` means `items/name`. `load()` and\n * `load('items')` name every scalar property of each item, as in Office.js.\n */\nexport function itemRequest(request: ResolvedLoadOptions): ResolvedLoadOptions | undefined {\n const bare = isDefaultLoad(request) || request.select.includes(ITEMS);\n const own: ResolvedLoadOptions = {\n select: request.select.filter((name) => name !== ITEMS),\n all: request.all || bare,\n nested: request.nested,\n itemSelect: [],\n };\n const items = request.items;\n const ownNames = own.select.length > 0 || own.nested.size > 0 || own.all;\n const chosen = items ? (ownNames ? merge(own, items) : items) : ownNames ? own : undefined;\n return chosen ? { ...chosen, orNull: true } : undefined;\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// After DOCX Editor's `packages/editor-api/src/runtime/client-object.ts` (commit 5993bd223945).\n//\n// A proxy is three things: the context it belongs to, the path that says whether it can be\n// addressed, and the properties a completed `load` filled in.\n//\n// LOADED VALUES LIVE IN A MAP. Property names reaching `load(...)` can come from a consumer's own\n// data, and a name like `__proto__` assigned into a plain object is the prototype-pollution\n// hazard the repository audits for. A `Map` has no such key.\n//\n// A RELEASED PROXY STILL ANSWERS WHAT IT ALREADY KNEW. A property loaded before the run ended is\n// a copy the consumer already has. Anything that would talk to the presentation (`load`, a write,\n// a method) refuses with `InvalidObjectPath`.\n\nimport type {\n AutomationOperation,\n AutomationRef,\n AutomationValue,\n} from '@pptx-editor.dev/core/automation';\nimport { deferArgumentChecks } from './deferred-checks.ts';\nimport {\n diagnosticOf,\n fail,\n failArgument,\n type PptxEditorDiagnostic,\n type PptxEditorError,\n} from './errors.ts';\nimport {\n DEFER_REFUSAL,\n INTERNALS,\n LOAD_REQUEST,\n LOADED_VALUES,\n PATH,\n REBIND,\n RELEASE,\n type ContextInternals,\n type RuntimeManagedObject,\n} from './internals.ts';\nimport { resolveLoadOption, type LoadOption, type ResolvedLoadOptions } from './load-options.ts';\nimport type { IndexOf, ObjectPath } from './object-path.ts';\nimport type { ActionSort } from './queue.ts';\nimport type { RequestContext } from './request-context.ts';\n\n/** A loaded value as plain data: a proxy becomes its own `toJSON()`. */\nfunction plain(value: unknown): unknown {\n return value instanceof ClientObject ? value.toJSON() : value;\n}\n\n/**\n * The base every presentation proxy extends.\n *\n * A released proxy still answers what it already knew: a property loaded before the run ended is\n * served from memory. Anything that would talk to the presentation (`load`, a write, a method)\n * refuses with `InvalidObjectPath`.\n *\n * @public\n */\nexport abstract class ClientObject implements RuntimeManagedObject {\n #context: RequestContext;\n #internals: ContextInternals;\n readonly #path: ObjectPath;\n readonly #nullable: boolean;\n readonly #loaded = new Map<string, unknown>();\n #nestedTaken = false;\n #loadingOrNull = false;\n /** Why a load through a collection skipped this object, when it did. */\n #skipped: PptxEditorDiagnostic | undefined;\n\n /** @internal */\n protected constructor(\n context: RequestContext,\n path: ObjectPath,\n options: { readonly nullable?: boolean } = {}\n ) {\n this.#context = context;\n this.#internals = context[INTERNALS];\n this.#path = path;\n this.#nullable = options.nullable === true;\n this.#internals.register(this);\n // Argument checks of this class's calls and property writes go to the sync.\n deferArgumentChecks(Object.getPrototypeOf(this) as object, ClientObject.prototype);\n }\n\n /** The request context this object currently belongs to. */\n get context(): RequestContext {\n return this.#context;\n }\n\n /**\n * Whether this object turned out not to exist. Only an answer, never a guess: an object from a\n * `getItemOrNullObject` has no verdict until the sync that looked for it, and reading one\n * before then is `PropertyNotLoaded`.\n */\n get isNullObject(): boolean {\n if (this.#path.isReleased) fail({ code: 'InvalidObjectPath', target: this.#path.label });\n if (!this.#nullable) return false;\n if (this.#path.isPending)\n fail({ code: 'PropertyNotLoaded', target: `${this.#path.label}.isNullObject` });\n return this.#path.isNull;\n }\n\n /**\n * Queue the reads that fill in the selected properties. Returns `this`; the values are\n * readable after the next `sync()`.\n */\n load(option?: LoadOption): this {\n if (this.#path.isReleased) fail({ code: 'InvalidObjectPath', target: this.#path.label });\n this.#internals.assertUsable(this.#path.label);\n return this[LOAD_REQUEST](resolveLoadOption(option, this.#path.label));\n }\n\n /**\n * @internal Queue the reads of a resolved request: what `load(...)` does after it reads its\n * option, and what a navigation property or a collection item gets from the path above it.\n * All or nothing: a refusal drops what this call queued.\n */\n [LOAD_REQUEST](request: ResolvedLoadOptions): this {\n if (this.#path.isReleased) fail({ code: 'InvalidObjectPath', target: this.#path.label });\n this.#internals.assertUsable(this.#path.label);\n if (request.items !== undefined && !this.loadsItemPaths)\n failArgument(`${this.#path.label}.items`, \"'items/' paths on a collection only\");\n // A null object has nothing to load; Office.js lets the load pass.\n if (this.#path.isNull) return this;\n const restore = this.#internals.queue.checkpoint();\n this.#nestedTaken = false;\n const previous = this.#loadingOrNull;\n this.#loadingOrNull = request.orNull === true;\n try {\n this.onLoad(request);\n if (!this.#nestedTaken) {\n const deeper =\n request.nested.keys().next().value ?? request.items?.nested.keys().next().value;\n if (deeper !== undefined)\n failArgument(\n `${this.#path.label}.${deeper}`,\n 'a path through the navigation properties of this object'\n );\n }\n } catch (error) {\n restore();\n throw error;\n } finally {\n this.#loadingOrNull = previous;\n }\n return this;\n }\n\n /**\n * @internal True while this object plans a load that a collection's items started: a text\n * read then answers null for a shape that cannot hold text, and fills nothing.\n */\n protected get loadingOrNull(): boolean {\n return this.#loadingOrNull;\n }\n\n /**\n * @internal Say that this load handed its deeper paths on. A load whose planner does not call\n * this refuses any deeper path, so no path is dropped without a word.\n */\n protected takeNestedPaths(): void {\n this.#nestedTaken = true;\n }\n\n /** The loaded properties as a plain object, as Office.js `toJSON()` gives them. */\n toJSON(): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [name, value] of this.#loaded) {\n if (name === '__proto__' || name === 'constructor' || name === 'prototype') continue;\n out[name] = Array.isArray(value) ? value.map(plain) : plain(value);\n }\n return out;\n }\n\n /** @internal What this kind of object does with a resolved load request. */\n protected abstract onLoad(request: ResolvedLoadOptions): void;\n\n /** @internal Whether `load(...)` accepts `items/<property>` paths. Only collections do. */\n protected get loadsItemPaths(): boolean {\n return false;\n }\n\n /** @internal This object's address, or the promise standing in until a sync resolves it. */\n protected get path(): ObjectPath {\n return this.#path;\n }\n\n /** @internal The owning context's internal surface. */\n protected get internals(): ContextInternals {\n return this.#internals;\n }\n\n /** @internal Refuse a released or null object, and a finished context. */\n protected requireUsable(): void {\n if (this.#path.isReleased) fail({ code: 'InvalidObjectPath', target: this.#path.label });\n if (this.#path.isNull) {\n const diagnostic = diagnosticOf('null-object');\n fail({\n code: 'InvalidObjectPath',\n target: this.#path.label,\n ...(diagnostic ? { diagnostic } : {}),\n });\n }\n this.#internals.assertUsable(this.#path.label);\n }\n\n /**\n * @internal Queue one action. `plan` gets the ref of this object (a handle, or the result\n * reference of the action that creates it in the same batch).\n */\n protected enqueue(\n sort: ActionSort,\n name: string,\n plan: (ref: (path: ObjectPath) => AutomationRef) => AutomationOperation,\n settle: (value: AutomationValue) => void = () => {},\n produces?: ObjectPath,\n refable = true,\n continues = false\n ): void {\n this.requireUsable();\n const label = name ? `${this.#path.label}.${name}` : this.#path.label;\n const action = {\n sort,\n label,\n target: this.#path,\n ...(continues ? { continues } : {}),\n plan: (indexOf: IndexOf) => plan((path) => path.ref(indexOf)),\n settle,\n };\n produces?.producedBy(action, refable);\n this.#internals.queue.push(action);\n }\n\n /** @internal Read a property a completed `load` filled in; refuses if none did. */\n protected loadedProperty<T>(name: string): T {\n if (!this.#loaded.has(name)) {\n if (this.#path.isReleased) fail({ code: 'InvalidObjectPath', target: this.#path.label });\n fail({\n code: 'PropertyNotLoaded',\n target: `${this.#path.label}.${name}`,\n ...(this.#skipped ? { diagnostic: this.#skipped } : {}),\n });\n }\n return this.#loaded.get(name) as T;\n }\n\n /**\n * @internal A load through a collection skipped this object, for `reason` (a shape with no\n * text frame, a shape that is not a group): a read of what it did not load says why.\n */\n protected markSkipped(reason: PptxEditorDiagnostic | undefined): void {\n this.#skipped = reason;\n }\n\n /** @internal Whether a completed `load` filled this property in. */\n protected hasLoadedProperty(name: string): boolean {\n return this.#loaded.has(name);\n }\n\n /** @internal Record a value a completed load produced. */\n protected setLoadedProperty(name: string, value: unknown): void {\n this.#loaded.set(name, value);\n }\n\n /** @internal The values completed loads filled in, for `context.loadRecursive`. */\n [LOADED_VALUES](): readonly unknown[] {\n return [...this.#loaded.values()];\n }\n\n /** @internal The path of this object, for the model objects that address another one. */\n get [PATH](): ObjectPath {\n return this.#path;\n }\n\n /**\n * @internal Queue the refusal of a call whose argument this API does not accept, so the next\n * `sync()` refuses as a whole and applies nothing (`deferred-checks.ts`).\n */\n [DEFER_REFUSAL](error: PptxEditorError): void {\n this.requireUsable();\n this.#internals.queue.push({\n sort: 'write',\n label: error.debugInfo.errorLocation ?? this.#path.label,\n target: this.#path,\n refusal: error,\n plan: () => {\n throw error;\n },\n settle: () => {},\n });\n }\n\n /** @internal Drop this object's presentation reference; the run that owned it has ended. */\n [RELEASE](): void {\n this.#path.release();\n }\n\n /** @internal Adopt this object into another run's context. */\n [REBIND](context: RequestContext): void {\n this.#context = context;\n this.#internals = context[INTERNALS];\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// After DOCX Editor's `packages/editor-api/src/runtime/object-path.ts` (commit 5993bd223945).\n//\n// What the host is told to look at. A proxy's path is pending until the read that names it\n// answers, then resolved to a handle, null (a `getItemOrNullObject` that found nothing), or\n// released (its run ended and nothing tracked it).\n//\n// ONE BATCH, NOT ROUNDS. The presentation host takes a result reference (`{ result: i }`) for\n// the handle operation `i` of the same batch answers. So a pending path whose producing action\n// is in the batch being planned is addressed by that reference, and a consumer can create a\n// shape and write its text in one `sync()`. A pending path whose producer is not in the batch\n// (an earlier sync failed) cannot be addressed, and the plan refuses with `InvalidObjectPath`.\n\nimport type { AutomationHandle, AutomationRef } from '@pptx-editor.dev/core/automation';\nimport { diagnosticOf, fail } from './errors.ts';\n\n/** Refuse a path that cannot be addressed, with the reason when it is a null object. */\nfunction unaddressable(state: ObjectPathState, target: string, refused = false): never {\n const diagnostic =\n state.status === 'null'\n ? diagnosticOf('null-object')\n : refused\n ? diagnosticOf('refused-sync')\n : undefined;\n fail({ code: 'InvalidObjectPath', target, ...(diagnostic ? { diagnostic } : {}) });\n}\n\nexport type ObjectPathState =\n /** Promised: created by a queued action that has not answered yet. */\n | { readonly status: 'pending' }\n /** Addressable: the host has named this object. */\n | { readonly status: 'resolved'; readonly handle: AutomationHandle }\n /** A `get…OrNullObject` that found nothing. Not an error, and never addressable. */\n | { readonly status: 'null' }\n /** Its run ended without tracking it. Terminal. */\n | { readonly status: 'released' };\n\n/** The batch index of an action, while a batch is planned. */\nexport type IndexOf = (producer: object) => number | undefined;\n\n/**\n * Thrown while planning: the object is named by a read in this batch whose answer is not a\n * handle (the reader's selection, a null-object check). The sync sends that read first, in an\n * earlier round at the same revision, and plans the call again.\n */\nexport class WaitForRead {\n constructor(readonly producer: object) {}\n}\n\n/**\n * The lookups of a sync that was refused or dropped. A proxy is a path, as in Office.js: when a\n * later batch names an object whose lookup was in that sync, the batch sends the lookup again\n * (`NeedsProducer`), so the same proxy works in a retry while the object exists.\n */\nconst replayable = new WeakSet<object>();\n\n/** Mark a read action of a refused sync, so a later batch that needs its answer resends it. */\nexport function markReplayable(action: object): void {\n replayable.add(action);\n}\n\n/**\n * The calls of a refused sync that would have created an object (`addTextBox`, `add`). Their\n * objects never existed, so a later call on one refuses with its own diagnostic.\n */\nconst refusedCreators = new WeakSet<object>();\n\n/** Mark a write action of a refused sync: the object it would have created does not exist. */\nexport function markRefused(action: object): void {\n refusedCreators.add(action);\n}\n\n/** Thrown while planning: the object's lookup was in a refused sync. Send it again first. */\nexport class NeedsProducer {\n constructor(readonly producer: object) {}\n}\n\nexport class ObjectPath {\n readonly label: string;\n #state: ObjectPathState;\n /**\n * The path whose fate this one shares. `shape.fill` is addressable exactly when the shape is,\n * and released when the shape is.\n */\n readonly #parent: ObjectPath | null;\n /** The queued action whose answer names this object, while it is pending. */\n #producer: object | null = null;\n /** Whether the producer's answer is this object's handle, so a result reference names it. */\n #refable = true;\n\n private constructor(label: string, state: ObjectPathState, parent: ObjectPath | null = null) {\n this.label = label;\n this.#state = state;\n this.#parent = parent;\n }\n\n /** A path that is addressable from the moment it exists: a root, or an item just hydrated. */\n static of(label: string, handle: AutomationHandle): ObjectPath {\n return new ObjectPath(label, { status: 'resolved', handle });\n }\n\n /** A path a queued action will fill in, or mark null. */\n static pending(label: string): ObjectPath {\n return new ObjectPath(label, { status: 'pending' });\n }\n\n /**\n * A pending path that the same queued action as this one settles, for an object that its\n * answer names or finds absent. A call in the same batch waits for that read.\n */\n sibling(label: string): ObjectPath {\n const path = new ObjectPath(label, { status: 'pending' });\n const origin = this.origin;\n if (origin.#producer) {\n path.#producer = origin.#producer;\n path.#refable = false;\n }\n return path;\n }\n\n /** A path that is whatever its owner's path is, under its own name. */\n static derived(label: string, parent: ObjectPath): ObjectPath {\n return new ObjectPath(label, { status: 'pending' }, parent);\n }\n\n get state(): ObjectPathState {\n return this.#parent ? this.#parent.state : this.#state;\n }\n\n /** The path this one shares its fate with, followed to the end. */\n get origin(): ObjectPath {\n return this.#parent ? this.#parent.origin : this;\n }\n\n get isAddressable(): boolean {\n return this.state.status === 'resolved';\n }\n\n get isPending(): boolean {\n return this.state.status === 'pending';\n }\n\n get isNull(): boolean {\n return this.state.status === 'null';\n }\n\n get isReleased(): boolean {\n return this.state.status === 'released';\n }\n\n /**\n * Name the action whose answer resolves this path. `refable` is false when the answer is not\n * the handle itself, so a call in the same batch waits for that read.\n */\n producedBy(action: object, refable = true): void {\n this.origin.#producer = action;\n this.origin.#refable = refable;\n }\n\n /**\n * What to put in an operation: the handle, or the result reference of the producing action\n * when it is in the batch being planned. Anything else refuses with `InvalidObjectPath`.\n */\n ref(indexOf: IndexOf): AutomationRef {\n const state = this.state;\n if (state.status === 'resolved') return state.handle;\n if (state.status === 'pending') {\n const producer = this.origin.#producer;\n const index = producer ? indexOf(producer) : undefined;\n if (index !== undefined) {\n if (this.origin.#refable) return { result: index };\n throw new WaitForRead(producer!);\n }\n if (producer && replayable.has(producer)) throw new NeedsProducer(producer);\n if (producer && refusedCreators.has(producer)) unaddressable(state, this.label, true);\n }\n unaddressable(state, this.label);\n }\n\n /** The handle, once resolved. */\n handle(): AutomationHandle {\n const state = this.state;\n if (state.status !== 'resolved') unaddressable(state, this.label);\n return state.handle;\n }\n\n /** Hydration: the read answered, and this is the object it named. A released path stays so. */\n resolveTo(handle: AutomationHandle): void {\n if (this.#parent || this.#state.status === 'released') return;\n this.#state = { status: 'resolved', handle };\n this.#producer = null;\n }\n\n /** Hydration: the read answered, and there was nothing there. */\n resolveNull(): void {\n if (this.#parent || this.#state.status === 'released') return;\n this.#state = { status: 'null' };\n this.#producer = null;\n }\n\n /** The run ended and nothing kept this object alive. A derived path follows its owner. */\n release(): void {\n if (this.#parent) return;\n this.#state = { status: 'released' };\n this.#producer = null;\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// After DOCX Editor's `packages/editor-api/src/runtime/hydrate.ts` (commit 5993bd223945).\n//\n// Narrow one host answer to the shape an action asked for. A wrong shape is the host breaking\n// its contract, so it is `GeneralException`, never a guess.\n\nimport type { AutomationHandle, AutomationValue } from '@pptx-editor.dev/core/automation';\nimport { PptxEditorError } from './errors.ts';\n\ntype ValueOf<K extends AutomationValue['kind']> = Extract<AutomationValue, { kind: K }>;\n\n/** The answer as kind `kind`, or `GeneralException`. */\nexport function hydrated<K extends AutomationValue['kind']>(\n value: AutomationValue,\n kind: K,\n target: string\n): ValueOf<K> {\n if (value.kind !== kind) throw new PptxEditorError({ code: 'GeneralException', target });\n return value as ValueOf<K>;\n}\n\n/** A handle answer, or null for a null answer. */\nexport function hydratedHandleOrNull(\n value: AutomationValue,\n target: string\n): AutomationHandle | null {\n if (value.kind === 'null') return null;\n return hydrated(value, 'handle', target).handle;\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// After DOCX Editor's `packages/editor-api/src/model/model-object.ts` (commit 5993bd223945).\n//\n// The helpers every object of the model plans through: a scalar load that sets only the names\n// the consumer selected, a command whose answer is `applied`, and the path of another object.\n\nimport type {\n AutomationOperation,\n AutomationRef,\n AutomationValue,\n} from '@pptx-editor.dev/core/automation';\nimport { ClientObject } from '../runtime/client-object.ts';\nimport {\n diagnosticOf,\n failArgument,\n nearest,\n type PptxEditorDiagnostic,\n} from '../runtime/errors.ts';\nimport { hydrated } from '../runtime/hydrate.ts';\nimport { LOAD_REQUEST, PATH } from '../runtime/internals.ts';\nimport {\n DEFAULT_LOAD,\n loadsAllScalars,\n type ResolvedLoadOptions,\n} from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\n\n/** Turns a path into what an operation names: a handle or a result reference. */\nexport type RefOf = (path: ObjectPath) => AutomationRef;\n\n/** The path of any proxy, for an operation that names a second object. */\nexport function pathOf(object: ClientObject): ObjectPath {\n if (!(object instanceof ClientObject)) failArgument(undefined, 'an object of this API');\n return object[PATH];\n}\n\n/** Navigation properties a load may name: loading one loads that object. */\nexport type Navigation = Readonly<Record<string, () => ClientObject>>;\n\nexport abstract class ModelObject extends ClientObject {\n /**\n * The scalar properties a load asked for. An empty selection means every scalar property. A\n * navigation property name loads that object instead. Any other name is `InvalidArgument`.\n */\n protected selection(\n request: ResolvedLoadOptions,\n available: readonly string[],\n navigation: Navigation = {}\n ): readonly string[] {\n const navigates = (name: string): boolean =>\n Object.prototype.hasOwnProperty.call(navigation, name);\n // Check every name before anything is queued. A refusal names the nearest property and\n // every property this object loads.\n const all = [...available, ...Object.keys(navigation)];\n const unknown = (name: string, accepted: readonly string[]): never =>\n failArgument(\n `${this.path.label}.${name}`,\n `a property of this object: ${listOf(accepted)}`,\n nearest(name, accepted)\n );\n for (const name of request.select)\n if (!available.includes(name) && !navigates(name)) unknown(name, all);\n for (const name of request.nested.keys())\n if (!navigates(name)) unknown(name, Object.keys(navigation));\n this.takeNestedPaths();\n const names: string[] = loadsAllScalars(request) ? [...available] : [];\n // Below a collection's items, the objects a path reaches skip a shape with no text too.\n const below = (next: ResolvedLoadOptions): ResolvedLoadOptions =>\n request.orNull ? { ...next, orNull: true } : next;\n // Office.js `toJSON()` shows a loaded navigation object under its name.\n for (const name of request.select) {\n if (available.includes(name)) {\n if (!names.includes(name)) names.push(name);\n } else this.setLoadedProperty(name, navigation[name]!()[LOAD_REQUEST](below(DEFAULT_LOAD)));\n }\n for (const [name, deeper] of request.nested)\n this.setLoadedProperty(name, navigation[name]!()[LOAD_REQUEST](below(deeper)));\n return names;\n }\n\n /**\n * Queue one read whose answer of `kind` fills `names` through `project`. A null answer (the\n * object turned out not to exist in this batch) fills nothing.\n */\n protected loadScalars<K extends AutomationValue['kind']>(\n names: readonly string[],\n kind: K,\n plan: (ref: RefOf) => AutomationOperation,\n project: (value: Extract<AutomationValue, { kind: K }>) => Readonly<Record<string, unknown>>\n ): void {\n if (names.length === 0) return;\n const label = `${this.path.label}.load`;\n const orNull = this.loadingOrNull;\n let planned: AutomationOperation | undefined;\n const send = (ref: RefOf): AutomationOperation => (planned = skippingAbsent(plan(ref)));\n this.enqueue('read', 'load', orNull ? send : plan, (value) => {\n if (value.kind === 'null') {\n this.markSkipped(orNull && planned ? skipReason(planned) : undefined);\n return;\n }\n const all = project(hydrated(value, kind, label));\n for (const name of names) this.setLoadedProperty(name, all[name]);\n });\n }\n\n /** @internal The consumer-facing path of a member, for the `target` of a refusal. */\n protected at(name: string): string {\n return `${this.path.label}.${name}`;\n }\n\n /** Queue a command that answers `applied`. Nothing is written until `sync()`. */\n protected command(name: string, plan: (ref: RefOf) => AutomationOperation): void {\n const label = `${this.path.label}.${name}`;\n this.enqueue('write', name, plan, (value) => void hydrated(value, 'applied', label));\n }\n\n /**\n * A navigation object (`slide.layout`, `shape.parentGroup`) over a pending path, with the read\n * that answers its handle queued now. A call on it in the same sync names that read's answer.\n */\n protected navigation<T>(\n name: string,\n make: (path: ObjectPath) => T,\n plan: (ref: RefOf) => AutomationOperation,\n nullable = false\n ): T {\n const path = ObjectPath.pending(`${this.path.label}.${name}`);\n const object = make(path);\n const label = path.label;\n this.enqueue(\n 'read',\n name,\n plan,\n (value) => {\n if (value.kind === 'null' && nullable) return path.resolveNull();\n path.resolveTo(hydrated(value, 'handle', label).handle);\n },\n path\n );\n return object;\n }\n\n /** @internal */\n protected onLoad(request: ResolvedLoadOptions): void {\n this.selection(request, []);\n }\n}\n\n/** Every name, quoted, as `'a', 'b', or 'c'`. */\nfunction listOf(names: readonly string[]): string {\n const quoted = names.map((n) => `'${n}'`);\n if (quoted.length <= 2) return quoted.join(' or ');\n return `${quoted.slice(0, -1).join(', ')}, or ${quoted.at(-1)}`;\n}\n\n/** The text reads that answer null for a shape that cannot hold text, when asked to. */\nconst TEXT_READS = new Set(['readTextFrame', 'readText', 'readFont', 'readParagraph']);\n\n/** Whether a read through a collection skips a shape that does not have what it reads. */\nfunction skippable(op: AutomationOperation): boolean {\n if (TEXT_READS.has(op.op)) return !('cell' in op && op.cell !== undefined);\n return (op.op === 'readShape' && op.group === true) || op.op === 'listShapes';\n}\n\n/**\n * A read of a shape's own text, or of a shape as a group, that answers null instead of\n * refusing for a shape that has no text frame or is not a group.\n */\nexport function skippingAbsent(op: AutomationOperation): AutomationOperation {\n return skippable(op) ? ({ ...op, orNull: true } as AutomationOperation) : op;\n}\n\n/** Why a read that `skippingAbsent` made nullable answered null. */\nfunction skipReason(op: AutomationOperation): PptxEditorDiagnostic | undefined {\n if (!skippable(op)) return undefined;\n if (TEXT_READS.has(op.op)) return diagnosticOf('no-text');\n return op.op === 'readShape' || op.op === 'listShapes' ? diagnosticOf('not-group') : undefined;\n}\n\n/** A finite number, or `InvalidArgument` naming `target`. */\nexport function finite(value: unknown, target: string): number {\n if (typeof value !== 'number' || !Number.isFinite(value)) failArgument(target, 'a finite number');\n return value;\n}\n\n/** A string, or `InvalidArgument` naming `target`. */\nexport function text(value: unknown, target: string): string {\n if (typeof value !== 'string') failArgument(target, 'a string');\n return value;\n}\n\n/** A boolean, or `InvalidArgument` naming `target`. */\nexport function flag(value: unknown, target: string): boolean {\n if (typeof value !== 'boolean') failArgument(target, 'true or false');\n return value;\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Office.js `Application`: the object that stands for the host application. Office.js gives it\n// no properties and no methods, so it has none here either; it exists so that\n// `context.application` and `load()` on it work as in Office.js.\n\nimport type { ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport { ModelObject } from './model-object.ts';\n\n/**\n * The application the presentation is open in. It has no properties or methods.\n *\n * @public\n */\nexport class Application extends ModelObject {\n /** @internal */\n private constructor(context: RequestContext, path: ObjectPath) {\n super(context, path);\n }\n\n /** @internal The application of a request context. It addresses nothing in the host. */\n static open(context: RequestContext): Application {\n return new Application(context, ObjectPath.pending('application'));\n }\n\n /** @internal There is nothing to load. */\n protected override onLoad(request: ResolvedLoadOptions): void {\n this.selection(request, []);\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Copied from DOCX Editor's `packages/editor-api/src/runtime/client-result.ts` (commit 5993bd223945).\n\nimport { fail } from './errors.ts';\n\n/**\n * A value a queued method promised to produce, readable after the next `sync()`.\n *\n * Not a `Promise`: a method call inside a batch has not been sent yet, so there is nothing that\n * could resolve on its own. Reading one early is `ValueNotLoaded`.\n *\n * @example\n * ```ts\n * const count = context.presentation.slides.getCount();\n * await context.sync();\n * console.log(count.value);\n * ```\n *\n * @public\n */\nexport class ClientResult<T> {\n #filled = false;\n #value: T | undefined;\n readonly #target: string;\n\n private constructor(target: string) {\n this.#target = target;\n }\n\n /** The value, once a `sync()` has filled it in. */\n get value(): T {\n if (!this.#filled) fail({ code: 'ValueNotLoaded', target: this.#target });\n return this.#value as T;\n }\n\n /** Whether the sync that fills this has happened. */\n get isLoaded(): boolean {\n return this.#filled;\n }\n\n /** @internal The box and the way to fill it, so only the creator can settle it. */\n static create<T>(target: string): { result: ClientResult<T>; fill: (value: T) => void } {\n const result = new ClientResult<T>(target);\n return {\n result,\n fill(value: T) {\n result.#filled = true;\n result.#value = value;\n },\n };\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// The Office.js enum values of the presentation object model, as string literal types, and\n// their ECMA-376 values. The automation protocol speaks ECMA-376 (`ST_TextAnchoringType`,\n// `ST_PresetLineDashVal`, …); this module is the only place that translates.\n//\n// Each map is a null-prototype record, so an enum value from a consumer can never select an\n// inherited key.\n\nimport { failArgument, nearest, oneOf } from '../runtime/errors.ts';\n\n/** @public */\nexport enum ShapeType {\n unsupported = 'Unsupported',\n image = 'Image',\n geometricShape = 'GeometricShape',\n group = 'Group',\n line = 'Line',\n table = 'Table',\n callout = 'Callout',\n chart = 'Chart',\n contentApp = 'ContentApp',\n diagram = 'Diagram',\n freeform = 'Freeform',\n graphic = 'Graphic',\n ink = 'Ink',\n media = 'Media',\n model3D = 'Model3D',\n ole = 'Ole',\n placeholder = 'Placeholder',\n textBox = 'TextBox',\n}\n\n/** @public */\nexport enum BindingType {\n shape = 'Shape',\n}\n\n/** @public */\nexport enum ConnectorType {\n straight = 'Straight',\n elbow = 'Elbow',\n curve = 'Curve',\n}\n\n/** @public */\nexport enum HyperlinkType {\n textRange = 'TextRange',\n shape = 'Shape',\n}\n\n/** @public */\nexport enum ShapeZOrder {\n bringForward = 'BringForward',\n bringToFront = 'BringToFront',\n sendBackward = 'SendBackward',\n sendToBack = 'SendToBack',\n}\n\n/** @public */\nexport enum ShapeFillType {\n noFill = 'NoFill',\n solid = 'Solid',\n gradient = 'Gradient',\n pattern = 'Pattern',\n pictureAndTexture = 'PictureAndTexture',\n slideBackground = 'SlideBackground',\n}\n\n/** @public */\nexport enum ShapeLineDashStyle {\n dash = 'Dash',\n dashDot = 'DashDot',\n dashDotDot = 'DashDotDot',\n longDash = 'LongDash',\n longDashDot = 'LongDashDot',\n roundDot = 'RoundDot',\n solid = 'Solid',\n squareDot = 'SquareDot',\n longDashDotDot = 'LongDashDotDot',\n systemDash = 'SystemDash',\n systemDot = 'SystemDot',\n systemDashDot = 'SystemDashDot',\n}\n\n/** @public */\nexport enum ShapeLineStyle {\n single = 'Single',\n thickBetweenThin = 'ThickBetweenThin',\n thickThin = 'ThickThin',\n thinThick = 'ThinThick',\n thinThin = 'ThinThin',\n}\n\n/** @public */\nexport enum ShapeAutoSize {\n autoSizeNone = 'AutoSizeNone',\n autoSizeTextToFitShape = 'AutoSizeTextToFitShape',\n autoSizeShapeToFitText = 'AutoSizeShapeToFitText',\n autoSizeMixed = 'AutoSizeMixed',\n}\n\n/** @public */\nexport enum TextVerticalAlignment {\n top = 'Top',\n middle = 'Middle',\n bottom = 'Bottom',\n topCentered = 'TopCentered',\n middleCentered = 'MiddleCentered',\n bottomCentered = 'BottomCentered',\n}\n\n/** @public */\nexport enum ParagraphHorizontalAlignment {\n left = 'Left',\n center = 'Center',\n right = 'Right',\n justify = 'Justify',\n justifyLow = 'JustifyLow',\n distributed = 'Distributed',\n thaiDistributed = 'ThaiDistributed',\n}\n\n/** @public */\nexport enum ShapeFontUnderlineStyle {\n none = 'None',\n single = 'Single',\n double = 'Double',\n heavy = 'Heavy',\n dotted = 'Dotted',\n dottedHeavy = 'DottedHeavy',\n dash = 'Dash',\n dashHeavy = 'DashHeavy',\n dashLong = 'DashLong',\n dashLongHeavy = 'DashLongHeavy',\n dotDash = 'DotDash',\n dotDashHeavy = 'DotDashHeavy',\n dotDotDash = 'DotDotDash',\n dotDotDashHeavy = 'DotDotDashHeavy',\n wavy = 'Wavy',\n wavyHeavy = 'WavyHeavy',\n wavyDouble = 'WavyDouble',\n}\n\n/** @public */\nexport enum PlaceholderType {\n unsupported = 'Unsupported',\n date = 'Date',\n slideNumber = 'SlideNumber',\n footer = 'Footer',\n header = 'Header',\n title = 'Title',\n body = 'Body',\n centerTitle = 'CenterTitle',\n subtitle = 'Subtitle',\n verticalTitle = 'VerticalTitle',\n verticalBody = 'VerticalBody',\n content = 'Content',\n chart = 'Chart',\n table = 'Table',\n onlinePicture = 'OnlinePicture',\n media = 'Media',\n verticalContent = 'VerticalContent',\n picture = 'Picture',\n cameo = 'Cameo',\n}\n\n/** @public */\nexport enum SlideLayoutType {\n blank = 'Blank',\n chart = 'Chart',\n chartAndText = 'ChartAndText',\n clipArtAndText = 'ClipArtAndText',\n clipArtAndVerticalText = 'ClipArtAndVerticalText',\n comparison = 'Comparison',\n contentWithCaption = 'ContentWithCaption',\n custom = 'Custom',\n fourObjects = 'FourObjects',\n largeObject = 'LargeObject',\n mediaClipAndText = 'MediaClipAndText',\n mixed = 'Mixed',\n object = 'Object',\n objectAndText = 'ObjectAndText',\n objectAndTwoObjects = 'ObjectAndTwoObjects',\n objectOverText = 'ObjectOverText',\n organizationChart = 'OrganizationChart',\n pictureWithCaption = 'PictureWithCaption',\n sectionHeader = 'SectionHeader',\n table = 'Table',\n text = 'Text',\n textAndChart = 'TextAndChart',\n textAndClipArt = 'TextAndClipArt',\n textAndMediaClip = 'TextAndMediaClip',\n textAndObject = 'TextAndObject',\n textAndTwoObjects = 'TextAndTwoObjects',\n textOverObject = 'TextOverObject',\n title = 'Title',\n titleOnly = 'TitleOnly',\n twoColumnText = 'TwoColumnText',\n twoObjects = 'TwoObjects',\n twoObjectsAndObject = 'TwoObjectsAndObject',\n twoObjectsAndText = 'TwoObjectsAndText',\n twoObjectsOverText = 'TwoObjectsOverText',\n verticalText = 'VerticalText',\n verticalTitleAndText = 'VerticalTitleAndText',\n verticalTitleAndTextOverChart = 'VerticalTitleAndTextOverChart',\n}\n\n/** @public */\nexport enum BulletType {\n unsupported = 'Unsupported',\n none = 'None',\n numbered = 'Numbered',\n unnumbered = 'Unnumbered',\n}\n\n/** @public */\nexport enum BulletStyle {\n unsupported = 'Unsupported',\n alphabetLowercaseParenthesesBoth = 'AlphabetLowercaseParenthesesBoth',\n alphabetUppercaseParenthesesBoth = 'AlphabetUppercaseParenthesesBoth',\n alphabetLowercaseParenthesisRight = 'AlphabetLowercaseParenthesisRight',\n alphabetUppercaseParenthesisRight = 'AlphabetUppercaseParenthesisRight',\n alphabetLowercasePeriod = 'AlphabetLowercasePeriod',\n alphabetUppercasePeriod = 'AlphabetUppercasePeriod',\n arabicNumeralParenthesesBoth = 'ArabicNumeralParenthesesBoth',\n arabicNumeralParenthesisRight = 'ArabicNumeralParenthesisRight',\n arabicNumeralPeriod = 'ArabicNumeralPeriod',\n arabicNumeralPlain = 'ArabicNumeralPlain',\n romanLowercaseParenthesesBoth = 'RomanLowercaseParenthesesBoth',\n romanUppercaseParenthesesBoth = 'RomanUppercaseParenthesesBoth',\n romanLowercaseParenthesisRight = 'RomanLowercaseParenthesisRight',\n romanUppercaseParenthesisRight = 'RomanUppercaseParenthesisRight',\n romanLowercasePeriod = 'RomanLowercasePeriod',\n romanUppercasePeriod = 'RomanUppercasePeriod',\n circleNumberDoubleBytePlain = 'CircleNumberDoubleBytePlain',\n circleNumberWideDoubleByteBlackPlain = 'CircleNumberWideDoubleByteBlackPlain',\n circleNumberWideDoubleByteWhitePlain = 'CircleNumberWideDoubleByteWhitePlain',\n arabicDoubleBytePeriod = 'ArabicDoubleBytePeriod',\n arabicDoubleBytePlain = 'ArabicDoubleBytePlain',\n simplifiedChinesePeriod = 'SimplifiedChinesePeriod',\n simplifiedChinesePlain = 'SimplifiedChinesePlain',\n traditionalChinesePeriod = 'TraditionalChinesePeriod',\n traditionalChinesePlain = 'TraditionalChinesePlain',\n kanjiSimplifiedChineseDoubleBytePeriod = 'KanjiSimplifiedChineseDoubleBytePeriod',\n kanjiKoreanPlain = 'KanjiKoreanPlain',\n kanjiKoreanPeriod = 'KanjiKoreanPeriod',\n arabicAlphabetDash = 'ArabicAlphabetDash',\n arabicAbjadDash = 'ArabicAbjadDash',\n hebrewAlphabetDash = 'HebrewAlphabetDash',\n thaiAlphabetPeriod = 'ThaiAlphabetPeriod',\n thaiAlphabetParenthesisRight = 'ThaiAlphabetParenthesisRight',\n thaiAlphabetParenthesesBoth = 'ThaiAlphabetParenthesesBoth',\n thaiNumeralPeriod = 'ThaiNumeralPeriod',\n thaiNumeralParenthesisRight = 'ThaiNumeralParenthesisRight',\n thaiNumeralParenthesesBoth = 'ThaiNumeralParenthesesBoth',\n hindiAlphabetPeriod = 'HindiAlphabetPeriod',\n hindiNumeralPeriod = 'HindiNumeralPeriod',\n hindiNumeralParenthesisRight = 'HindiNumeralParenthesisRight',\n hindiAlphabet1Period = 'HindiAlphabet1Period',\n}\n\n/** @public */\nexport enum SlideBackgroundFillType {\n gradient = 'Gradient',\n pattern = 'Pattern',\n pictureOrTexture = 'PictureOrTexture',\n solid = 'Solid',\n unsupported = 'Unsupported',\n}\n\n/** @public */\nexport enum SlideBackgroundGradientFillType {\n linear = 'Linear',\n path = 'Path',\n radial = 'Radial',\n rectangular = 'Rectangular',\n shadeFromTitle = 'ShadeFromTitle',\n unsupported = 'Unsupported',\n}\n\n/** @public */\nexport enum SlideBackgroundPatternFillType {\n cross = 'Cross',\n darkDownwardDiagonal = 'DarkDownwardDiagonal',\n darkHorizontal = 'DarkHorizontal',\n darkUpwardDiagonal = 'DarkUpwardDiagonal',\n darkVertical = 'DarkVertical',\n dashedDownwardDiagonal = 'DashedDownwardDiagonal',\n dashedHorizontal = 'DashedHorizontal',\n dashedUpwardDiagonal = 'DashedUpwardDiagonal',\n dashedVertical = 'DashedVertical',\n diagonalBrick = 'DiagonalBrick',\n diagonalCross = 'DiagonalCross',\n divot = 'Divot',\n dottedDiamond = 'DottedDiamond',\n dottedGrid = 'DottedGrid',\n downwardDiagonal = 'DownwardDiagonal',\n horizontal = 'Horizontal',\n horizontalBrick = 'HorizontalBrick',\n largeCheckerBoard = 'LargeCheckerBoard',\n largeConfetti = 'LargeConfetti',\n largeGrid = 'LargeGrid',\n lightDownwardDiagonal = 'LightDownwardDiagonal',\n lightHorizontal = 'LightHorizontal',\n lightUpwardDiagonal = 'LightUpwardDiagonal',\n lightVertical = 'LightVertical',\n narrowHorizontal = 'NarrowHorizontal',\n narrowVertical = 'NarrowVertical',\n outlinedDiamond = 'OutlinedDiamond',\n percent10 = 'Percent10',\n percent20 = 'Percent20',\n percent25 = 'Percent25',\n percent30 = 'Percent30',\n percent40 = 'Percent40',\n percent5 = 'Percent5',\n percent50 = 'Percent50',\n percent60 = 'Percent60',\n percent70 = 'Percent70',\n percent75 = 'Percent75',\n percent80 = 'Percent80',\n percent90 = 'Percent90',\n plaid = 'Plaid',\n shingle = 'Shingle',\n smallCheckerBoard = 'SmallCheckerBoard',\n smallConfetti = 'SmallConfetti',\n smallGrid = 'SmallGrid',\n solidDiamond = 'SolidDiamond',\n sphere = 'Sphere',\n trellis = 'Trellis',\n unsupported = 'Unsupported',\n upwardDiagonal = 'UpwardDiagonal',\n vertical = 'Vertical',\n wave = 'Wave',\n weave = 'Weave',\n wideDownwardDiagonal = 'WideDownwardDiagonal',\n wideUpwardDiagonal = 'WideUpwardDiagonal',\n zigZag = 'ZigZag',\n}\n\n/** @public */\nexport enum ThemeColor {\n accent1 = 'Accent1',\n accent2 = 'Accent2',\n accent3 = 'Accent3',\n accent4 = 'Accent4',\n accent5 = 'Accent5',\n accent6 = 'Accent6',\n dark1 = 'Dark1',\n dark2 = 'Dark2',\n followedHyperlink = 'FollowedHyperlink',\n hyperlink = 'Hyperlink',\n light1 = 'Light1',\n light2 = 'Light2',\n mixed = 'Mixed',\n none = 'None',\n}\n\n/** @public */\nexport enum TableStyle {\n darkStyle1 = 'DarkStyle1',\n darkStyle1Accent1 = 'DarkStyle1Accent1',\n darkStyle1Accent2 = 'DarkStyle1Accent2',\n darkStyle1Accent3 = 'DarkStyle1Accent3',\n darkStyle1Accent4 = 'DarkStyle1Accent4',\n darkStyle1Accent5 = 'DarkStyle1Accent5',\n darkStyle1Accent6 = 'DarkStyle1Accent6',\n darkStyle2 = 'DarkStyle2',\n darkStyle2Accent1 = 'DarkStyle2Accent1',\n darkStyle2Accent2 = 'DarkStyle2Accent2',\n darkStyle2Accent3 = 'DarkStyle2Accent3',\n lightStyle1 = 'LightStyle1',\n lightStyle1Accent1 = 'LightStyle1Accent1',\n lightStyle1Accent2 = 'LightStyle1Accent2',\n lightStyle1Accent3 = 'LightStyle1Accent3',\n lightStyle1Accent4 = 'LightStyle1Accent4',\n lightStyle1Accent5 = 'LightStyle1Accent5',\n lightStyle1Accent6 = 'LightStyle1Accent6',\n lightStyle2 = 'LightStyle2',\n lightStyle2Accent1 = 'LightStyle2Accent1',\n lightStyle2Accent2 = 'LightStyle2Accent2',\n lightStyle2Accent3 = 'LightStyle2Accent3',\n lightStyle2Accent4 = 'LightStyle2Accent4',\n lightStyle2Accent5 = 'LightStyle2Accent5',\n lightStyle2Accent6 = 'LightStyle2Accent6',\n lightStyle3 = 'LightStyle3',\n lightStyle3Accent1 = 'LightStyle3Accent1',\n lightStyle3Accent2 = 'LightStyle3Accent2',\n lightStyle3Accent3 = 'LightStyle3Accent3',\n lightStyle3Accent4 = 'LightStyle3Accent4',\n lightStyle3Accent5 = 'LightStyle3Accent5',\n lightStyle3Accent6 = 'LightStyle3Accent6',\n mediumStyle1 = 'MediumStyle1',\n mediumStyle1Accent1 = 'MediumStyle1Accent1',\n mediumStyle1Accent2 = 'MediumStyle1Accent2',\n mediumStyle1Accent3 = 'MediumStyle1Accent3',\n mediumStyle1Accent4 = 'MediumStyle1Accent4',\n mediumStyle1Accent5 = 'MediumStyle1Accent5',\n mediumStyle1Accent6 = 'MediumStyle1Accent6',\n mediumStyle2 = 'MediumStyle2',\n mediumStyle2Accent1 = 'MediumStyle2Accent1',\n mediumStyle2Accent2 = 'MediumStyle2Accent2',\n mediumStyle2Accent3 = 'MediumStyle2Accent3',\n mediumStyle2Accent4 = 'MediumStyle2Accent4',\n mediumStyle2Accent5 = 'MediumStyle2Accent5',\n mediumStyle2Accent6 = 'MediumStyle2Accent6',\n mediumStyle3 = 'MediumStyle3',\n mediumStyle3Accent1 = 'MediumStyle3Accent1',\n mediumStyle3Accent2 = 'MediumStyle3Accent2',\n mediumStyle3Accent3 = 'MediumStyle3Accent3',\n mediumStyle3Accent4 = 'MediumStyle3Accent4',\n mediumStyle3Accent5 = 'MediumStyle3Accent5',\n mediumStyle3Accent6 = 'MediumStyle3Accent6',\n mediumStyle4 = 'MediumStyle4',\n mediumStyle4Accent1 = 'MediumStyle4Accent1',\n mediumStyle4Accent2 = 'MediumStyle4Accent2',\n mediumStyle4Accent3 = 'MediumStyle4Accent3',\n mediumStyle4Accent4 = 'MediumStyle4Accent4',\n mediumStyle4Accent5 = 'MediumStyle4Accent5',\n mediumStyle4Accent6 = 'MediumStyle4Accent6',\n noStyleNoGrid = 'NoStyleNoGrid',\n noStyleTableGrid = 'NoStyleTableGrid',\n themedStyle1Accent1 = 'ThemedStyle1Accent1',\n themedStyle1Accent2 = 'ThemedStyle1Accent2',\n themedStyle1Accent3 = 'ThemedStyle1Accent3',\n themedStyle1Accent4 = 'ThemedStyle1Accent4',\n themedStyle1Accent5 = 'ThemedStyle1Accent5',\n themedStyle1Accent6 = 'ThemedStyle1Accent6',\n themedStyle2Accent1 = 'ThemedStyle2Accent1',\n themedStyle2Accent2 = 'ThemedStyle2Accent2',\n themedStyle2Accent3 = 'ThemedStyle2Accent3',\n themedStyle2Accent4 = 'ThemedStyle2Accent4',\n themedStyle2Accent5 = 'ThemedStyle2Accent5',\n themedStyle2Accent6 = 'ThemedStyle2Accent6',\n}\n\n/** @public */\nexport enum InsertSlideFormatting {\n keepSourceFormatting = 'KeepSourceFormatting',\n useDestinationTheme = 'UseDestinationTheme',\n}\n\n/** The format of a shape picture from `Shape.getImageAsBase64`. @public */\nexport enum ShapeGetImageFormatType {\n png = 'Png',\n}\n\n/** The type of a custom document property value. @public */\nexport enum DocumentPropertyType {\n boolean = 'Boolean',\n date = 'Date',\n number = 'Number',\n string = 'String',\n}\n\n/** A two-way table between Office.js values and ECMA-376 values. */\nexport interface EnumMap<O extends string> {\n /** The ECMA-376 value of an Office.js value, or `InvalidArgument` naming `target`. */\n toFile(value: unknown, target: string): string;\n /** The Office.js value of an ECMA-376 value, or `fallback`. */\n fromFile(value: string | null | undefined): O | null;\n}\n\nfunction enumMap<O extends string>(\n pairs: readonly (readonly [O, string])[],\n options: { readonly writeOnly?: readonly (readonly [O, string])[]; readonly fallback?: O } = {}\n): EnumMap<O> {\n const toFile: Record<string, string> = Object.create(null);\n const fromFile: Record<string, O> = Object.create(null);\n for (const [o, f] of pairs) {\n toFile[o] = f;\n fromFile[f] ??= o;\n }\n for (const [o, f] of options.writeOnly ?? []) toFile[o] = f;\n return {\n toFile(value, target) {\n if (typeof value !== 'string' || !(value in toFile))\n failArgument(target, oneOf(Object.keys(toFile)), nearest(value, Object.keys(toFile)));\n return toFile[value]!;\n },\n fromFile(value) {\n if (value === null || value === undefined) return null;\n return fromFile[value] ?? options.fallback ?? null;\n },\n };\n}\n\n/** `ST_TextAnchoringType` with `anchorCtr` (ECMA-376 Part 1, 21.1.2.1.1). */\nexport const VERTICAL_ALIGNMENT = enumMap<`${TextVerticalAlignment}`>([\n ['Top', 't'],\n ['Middle', 'ctr'],\n ['Bottom', 'b'],\n ['TopCentered', 'tCentered'],\n ['MiddleCentered', 'ctrCentered'],\n ['BottomCentered', 'bCentered'],\n]);\n\n/** `ST_TextAlignType` (ECMA-376 Part 1, 20.1.10.59). */\nexport const HORIZONTAL_ALIGNMENT = enumMap<`${ParagraphHorizontalAlignment}`>([\n ['Left', 'l'],\n ['Center', 'ctr'],\n ['Right', 'r'],\n ['Justify', 'just'],\n ['JustifyLow', 'justLow'],\n ['Distributed', 'dist'],\n ['ThaiDistributed', 'thaiDist'],\n]);\n\n/** The autofit choice of `a:bodyPr` (ECMA-376 Part 1, 21.1.2.1.1). */\nexport const AUTO_SIZE = enumMap<`${ShapeAutoSize}`>([\n ['AutoSizeNone', 'none'],\n ['AutoSizeTextToFitShape', 'normal'],\n ['AutoSizeShapeToFitText', 'shape'],\n]);\n\n/** `ST_TextUnderlineType` (ECMA-376 Part 1, 20.1.10.82). `words` reads as `Single`. */\nexport const UNDERLINE = enumMap<`${ShapeFontUnderlineStyle}`>([\n ['None', 'none'],\n ['Single', 'sng'],\n ['Single', 'words'],\n ['Double', 'dbl'],\n ['Heavy', 'heavy'],\n ['Dotted', 'dotted'],\n ['DottedHeavy', 'dottedHeavy'],\n ['Dash', 'dash'],\n ['DashHeavy', 'dashHeavy'],\n ['DashLong', 'dashLong'],\n ['DashLongHeavy', 'dashLongHeavy'],\n ['DotDash', 'dotDash'],\n ['DotDashHeavy', 'dotDashHeavy'],\n ['DotDotDash', 'dotDotDash'],\n ['DotDotDashHeavy', 'dotDotDashHeavy'],\n ['Wavy', 'wavy'],\n ['WavyHeavy', 'wavyHeavy'],\n ['WavyDouble', 'wavyDbl'],\n]);\n\n/**\n * `ST_PresetLineDashVal` (ECMA-376 Part 1, 20.1.10.48). The file has eleven dash presets and\n * the object model twelve: `SquareDot` writes `sysDot`, which reads back as `SystemDot`.\n */\nexport const DASH_STYLE = enumMap<`${ShapeLineDashStyle}`>(\n [\n ['Solid', 'solid'],\n ['RoundDot', 'dot'],\n ['Dash', 'dash'],\n ['LongDash', 'lgDash'],\n ['DashDot', 'dashDot'],\n ['LongDashDot', 'lgDashDot'],\n ['LongDashDotDot', 'lgDashDotDot'],\n ['SystemDash', 'sysDash'],\n ['SystemDot', 'sysDot'],\n ['SystemDashDot', 'sysDashDot'],\n ['DashDotDot', 'sysDashDotDot'],\n ],\n { writeOnly: [['SquareDot', 'sysDot']] }\n);\n\n/** `ST_CompoundLine` (ECMA-376 Part 1, 20.1.10.15). */\nexport const LINE_STYLE = enumMap<`${ShapeLineStyle}`>([\n ['Single', 'sng'],\n ['ThinThin', 'dbl'],\n ['ThickThin', 'thickThin'],\n ['ThinThick', 'thinThick'],\n ['ThickBetweenThin', 'tri'],\n]);\n\n/** `ST_PlaceholderType` (ECMA-376 Part 1, 19.7.10). A diagram placeholder reads as `Unsupported`. */\nexport const PLACEHOLDER_TYPE = enumMap<`${PlaceholderType}`>(\n [\n ['Title', 'title'],\n ['Body', 'body'],\n ['CenterTitle', 'ctrTitle'],\n ['Subtitle', 'subTitle'],\n ['Date', 'dt'],\n ['SlideNumber', 'sldNum'],\n ['Footer', 'ftr'],\n ['Header', 'hdr'],\n ['Content', 'obj'],\n ['Chart', 'chart'],\n ['Table', 'tbl'],\n ['OnlinePicture', 'clipArt'],\n ['Media', 'media'],\n ['Picture', 'pic'],\n ],\n { fallback: 'Unsupported' }\n);\n\n/** `ST_SlideLayoutType` (ECMA-376 Part 1, 19.7.15). */\nexport const LAYOUT_TYPE = enumMap<`${SlideLayoutType}`>(\n [\n ['Title', 'title'],\n ['Text', 'tx'],\n ['TwoColumnText', 'twoColTx'],\n ['Table', 'tbl'],\n ['TextAndChart', 'txAndChart'],\n ['ChartAndText', 'chartAndTx'],\n ['OrganizationChart', 'dgm'],\n ['Chart', 'chart'],\n ['TextAndClipArt', 'txAndClipArt'],\n ['ClipArtAndText', 'clipArtAndTx'],\n ['TitleOnly', 'titleOnly'],\n ['Blank', 'blank'],\n ['TextAndObject', 'txAndObj'],\n ['ObjectAndText', 'objAndTx'],\n ['LargeObject', 'objOnly'],\n ['Object', 'obj'],\n ['TextAndMediaClip', 'txAndMedia'],\n ['MediaClipAndText', 'mediaAndTx'],\n ['ObjectOverText', 'objOverTx'],\n ['TextOverObject', 'txOverObj'],\n ['TextAndTwoObjects', 'txAndTwoObj'],\n ['TwoObjectsAndText', 'twoObjAndTx'],\n ['TwoObjectsOverText', 'twoObjOverTx'],\n ['FourObjects', 'fourObj'],\n ['VerticalText', 'vertTx'],\n ['ClipArtAndVerticalText', 'clipArtAndVertTx'],\n ['VerticalTitleAndText', 'vertTitleAndTx'],\n ['VerticalTitleAndTextOverChart', 'vertTitleAndTxOverChart'],\n ['TwoObjects', 'twoObj'],\n ['ObjectAndTwoObjects', 'objAndTwoObj'],\n ['TwoObjectsAndObject', 'twoObjAndObj'],\n ['Custom', 'cust'],\n ['SectionHeader', 'secHead'],\n ['Comparison', 'twoTxTwoObj'],\n ['ContentWithCaption', 'objTx'],\n ['PictureWithCaption', 'picTx'],\n ],\n { fallback: 'Custom' }\n);\n\n/** The fill kinds of `a:spPr` (ECMA-376 Part 1, 20.1.8). */\nexport const FILL_TYPE = enumMap<`${ShapeFillType}`>([\n ['NoFill', 'noFill'],\n ['Solid', 'solid'],\n ['Gradient', 'gradient'],\n ['Pattern', 'pattern'],\n ['PictureAndTexture', 'pictureAndTexture'],\n]);\n\n/** The connector kinds of `addLine` (`p:cxnSp` presets, ECMA-376 Part 1, 20.1.10.56). */\nexport const CONNECTOR = enumMap<`${ConnectorType}`>([\n ['Straight', 'straight'],\n ['Elbow', 'elbow'],\n ['Curve', 'curve'],\n]);\n\n/** The z-order moves of `setZOrder`. */\nexport const Z_ORDER = enumMap<`${ShapeZOrder}`>([\n ['BringForward', 'bringForward'],\n ['BringToFront', 'bringToFront'],\n ['SendBackward', 'sendBackward'],\n ['SendToBack', 'sendToBack'],\n]);\n\n/** `ST_TextAutonumberScheme` (ECMA-376 Part 1, 20.1.10.61) for the bullet styles that have one. */\nexport const BULLET_STYLE = enumMap<`${BulletStyle}`>(\n [\n ['AlphabetLowercaseParenthesesBoth', 'alphaLcParenBoth'],\n ['AlphabetUppercaseParenthesesBoth', 'alphaUcParenBoth'],\n ['AlphabetLowercaseParenthesisRight', 'alphaLcParenR'],\n ['AlphabetUppercaseParenthesisRight', 'alphaUcParenR'],\n ['AlphabetLowercasePeriod', 'alphaLcPeriod'],\n ['AlphabetUppercasePeriod', 'alphaUcPeriod'],\n ['ArabicNumeralParenthesesBoth', 'arabicParenBoth'],\n ['ArabicNumeralParenthesisRight', 'arabicParenR'],\n ['ArabicNumeralPeriod', 'arabicPeriod'],\n ['ArabicNumeralPlain', 'arabicPlain'],\n ['RomanLowercaseParenthesesBoth', 'romanLcParenBoth'],\n ['RomanUppercaseParenthesesBoth', 'romanUcParenBoth'],\n ['RomanLowercaseParenthesisRight', 'romanLcParenR'],\n ['RomanUppercaseParenthesisRight', 'romanUcParenR'],\n ['RomanLowercasePeriod', 'romanLcPeriod'],\n ['RomanUppercasePeriod', 'romanUcPeriod'],\n ['CircleNumberDoubleBytePlain', 'circleNumDbPlain'],\n ['CircleNumberWideDoubleByteBlackPlain', 'circleNumWdBlackPlain'],\n ['CircleNumberWideDoubleByteWhitePlain', 'circleNumWdWhitePlain'],\n ['ArabicDoubleBytePeriod', 'arabicDbPeriod'],\n ['ArabicDoubleBytePlain', 'arabicDbPlain'],\n ['SimplifiedChinesePeriod', 'ea1ChsPeriod'],\n ['SimplifiedChinesePlain', 'ea1ChsPlain'],\n ['TraditionalChinesePeriod', 'ea1ChtPeriod'],\n ['TraditionalChinesePlain', 'ea1ChtPlain'],\n ['KanjiSimplifiedChineseDoubleBytePeriod', 'ea1JpnChsDbPeriod'],\n ['KanjiKoreanPlain', 'ea1JpnKorPlain'],\n ['KanjiKoreanPeriod', 'ea1JpnKorPeriod'],\n ['ArabicAlphabetDash', 'arabic1Minus'],\n ['ArabicAbjadDash', 'arabic2Minus'],\n ['HebrewAlphabetDash', 'hebrew2Minus'],\n ['ThaiAlphabetPeriod', 'thaiAlphaPeriod'],\n ['ThaiAlphabetParenthesisRight', 'thaiAlphaParenR'],\n ['ThaiAlphabetParenthesesBoth', 'thaiAlphaParenBoth'],\n ['ThaiNumeralPeriod', 'thaiNumPeriod'],\n ['ThaiNumeralParenthesisRight', 'thaiNumParenR'],\n ['ThaiNumeralParenthesesBoth', 'thaiNumParenBoth'],\n ['HindiAlphabetPeriod', 'hindiAlphaPeriod'],\n ['HindiNumeralPeriod', 'hindiNumPeriod'],\n ['HindiNumeralParenthesisRight', 'hindiNumParenR'],\n ['HindiAlphabet1Period', 'hindiAlpha1Period'],\n ],\n { fallback: 'Unsupported' }\n);\n\n/** The bullet kinds of a paragraph: `a:buNone`, `a:buAutoNum`, `a:buChar` or `a:buBlip`. */\nexport const BULLET_TYPE = enumMap<`${BulletType}`>(\n [\n ['None', 'none'],\n ['Numbered', 'autonum'],\n ['Unnumbered', 'char'],\n ],\n { fallback: 'Unsupported' }\n);\n\n/** The shape type of a protocol read (`geometricShape`) as the Office.js value. */\nexport function shapeTypeOf(type: string): `${ShapeType}` {\n const known: readonly `${ShapeType}`[] = [\n 'Image',\n 'GeometricShape',\n 'Group',\n 'Line',\n 'Table',\n 'Chart',\n 'Diagram',\n 'Freeform',\n 'Media',\n 'Ole',\n 'Placeholder',\n 'TextBox',\n ];\n const value = (type.charAt(0).toUpperCase() + type.slice(1)) as ShapeType;\n return known.includes(value) ? value : 'Unsupported';\n}\n\n/** The background fill kinds (EG_FillProperties of `p:bgPr`, ECMA-376 Part 1, 19.3.1.2). */\nexport const BACKGROUND_FILL_TYPE = enumMap<`${SlideBackgroundFillType}`>(\n [\n ['Solid', 'solid'],\n ['Gradient', 'gradient'],\n ['Pattern', 'pattern'],\n ['PictureOrTexture', 'picture'],\n ],\n { fallback: 'Unsupported' }\n);\n\n/**\n * The gradient shadings of a background: `a:lin`, or an `a:path` (ECMA-376 Part 1, 20.1.8.46).\n * `ShadeFromTitle` (`p:bgPr/@shadeToTitle`) is a read state only.\n */\nexport const BACKGROUND_GRADIENT_TYPE = enumMap<`${SlideBackgroundGradientFillType}`>(\n [\n ['Linear', 'linear'],\n ['Radial', 'circle'],\n ['Rectangular', 'rect'],\n ['Path', 'shape'],\n ],\n { fallback: 'Unsupported' }\n);\n\n/** `ST_PresetPatternVal` (ECMA-376 Part 1, 20.1.10.51). */\nexport const BACKGROUND_PATTERN = enumMap<`${SlideBackgroundPatternFillType}`>(\n [\n ['Cross', 'cross'],\n ['DarkDownwardDiagonal', 'dkDnDiag'],\n ['DarkHorizontal', 'dkHorz'],\n ['DarkUpwardDiagonal', 'dkUpDiag'],\n ['DarkVertical', 'dkVert'],\n ['DashedDownwardDiagonal', 'dashDnDiag'],\n ['DashedHorizontal', 'dashHorz'],\n ['DashedUpwardDiagonal', 'dashUpDiag'],\n ['DashedVertical', 'dashVert'],\n ['DiagonalBrick', 'diagBrick'],\n ['DiagonalCross', 'diagCross'],\n ['Divot', 'divot'],\n ['DottedDiamond', 'dotDmnd'],\n ['DottedGrid', 'dotGrid'],\n ['DownwardDiagonal', 'dnDiag'],\n ['Horizontal', 'horz'],\n ['HorizontalBrick', 'horzBrick'],\n ['LargeCheckerBoard', 'lgCheck'],\n ['LargeConfetti', 'lgConfetti'],\n ['LargeGrid', 'lgGrid'],\n ['LightDownwardDiagonal', 'ltDnDiag'],\n ['LightHorizontal', 'ltHorz'],\n ['LightUpwardDiagonal', 'ltUpDiag'],\n ['LightVertical', 'ltVert'],\n ['NarrowHorizontal', 'narHorz'],\n ['NarrowVertical', 'narVert'],\n ['OutlinedDiamond', 'openDmnd'],\n ['Percent10', 'pct10'],\n ['Percent20', 'pct20'],\n ['Percent25', 'pct25'],\n ['Percent30', 'pct30'],\n ['Percent40', 'pct40'],\n ['Percent5', 'pct5'],\n ['Percent50', 'pct50'],\n ['Percent60', 'pct60'],\n ['Percent70', 'pct70'],\n ['Percent75', 'pct75'],\n ['Percent80', 'pct80'],\n ['Percent90', 'pct90'],\n ['Plaid', 'plaid'],\n ['Shingle', 'shingle'],\n ['SmallCheckerBoard', 'smCheck'],\n ['SmallConfetti', 'smConfetti'],\n ['SmallGrid', 'smGrid'],\n ['SolidDiamond', 'solidDmnd'],\n ['Sphere', 'sphere'],\n ['Trellis', 'trellis'],\n ['UpwardDiagonal', 'upDiag'],\n ['Vertical', 'vert'],\n ['Wave', 'wave'],\n ['Weave', 'weave'],\n ['WideDownwardDiagonal', 'wdDnDiag'],\n ['WideUpwardDiagonal', 'wdUpDiag'],\n ['ZigZag', 'zigZag'],\n ],\n { fallback: 'Unsupported' }\n);\n\n/** The colors of a theme's `a:clrScheme` (CT_ColorScheme, ECMA-376 Part 1, 20.1.6.2). */\nexport const THEME_COLOR = enumMap<`${ThemeColor}`>([\n ['Dark1', 'dk1'],\n ['Light1', 'lt1'],\n ['Dark2', 'dk2'],\n ['Light2', 'lt2'],\n ['Accent1', 'accent1'],\n ['Accent2', 'accent2'],\n ['Accent3', 'accent3'],\n ['Accent4', 'accent4'],\n ['Accent5', 'accent5'],\n ['Accent6', 'accent6'],\n ['Hyperlink', 'hlink'],\n ['FollowedHyperlink', 'folHlink'],\n]);\n\n/**\n * The `styleName` of a table style (`a:tblStyle/@styleName`, ECMA-376 Part 1, 20.1.4.2.26) for\n * each `TableStyle` value: `MediumStyle2Accent1` is \"Medium Style 2 - Accent 1\". `NoStyleNoGrid`\n * is a table with no style choice, so it has no name.\n */\nexport function tableStyleName(value: unknown, target: string): string | null {\n // No guess here: a style that is not defined in the presentation refuses at the sync, so a\n // suggested style could fail too.\n if (typeof value !== 'string' || !TABLE_STYLES.has(value))\n failArgument(target, oneOf([...TABLE_STYLES]));\n if (value === 'NoStyleNoGrid') return null;\n if (value === 'NoStyleTableGrid') return 'No Style, Table Grid';\n const m = /^(Dark|Light|Medium|Themed)Style(\\d)(?:Accent(\\d))?$/.exec(value)!;\n return `${m[1]} Style ${m[2]}${m[3] ? ` - Accent ${m[3]}` : ''}`;\n}\n\n/** The `TableStyle` value of a table style name, or null for a name it has no value for. */\nexport function tableStyleOf(name: string): `${TableStyle}` | null {\n if (name === 'No Style, No Grid') return 'NoStyleNoGrid';\n if (name === 'No Style, Table Grid') return 'NoStyleTableGrid';\n const m = /^(Dark|Light|Medium|Themed) Style (\\d)(?: - Accent (\\d))?$/.exec(name);\n const value = m ? `${m[1]}Style${m[2]}${m[3] ? `Accent${m[3]}` : ''}` : '';\n return TABLE_STYLES.has(value) ? (value as `${TableStyle}`) : null;\n}\n\nconst TABLE_STYLES: ReadonlySet<string> = new Set(Object.values(TableStyle));\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Office.js `Adjustments` over the adjust values of a preset geometry\n// (`a:prstGeom/a:avLst/a:gd`, ECMA-376 Part 1, 20.1.9.5). The index order is the order of the\n// preset's own `a:avLst`; a value the shape does not store reads as the preset's default.\n\nimport { ClientResult } from '../runtime/client-result.ts';\nimport { fail, failArgument } from '../runtime/errors.ts';\nimport { hydrated } from '../runtime/hydrate.ts';\nimport type { ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport type { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport { finite, ModelObject } from './model-object.ts';\n\n/** A zero-based index, or `InvalidArgument`. */\nfunction indexOf(value: unknown, target: string): number {\n if (typeof value !== 'number' || !Number.isInteger(value) || value < 0)\n failArgument(target, 'a whole number of 0 or more');\n return value;\n}\n\n/**\n * The adjust values of a shape's preset geometry: the handles that change, for example, the\n * corner radius of a rounded rectangle. A length is a fraction of the shape size (0.5 is half);\n * an angle is in degrees. A write is bounded to the range of the preset's adjust handle.\n *\n * A shape with no preset geometry (a freeform, a group, a table) refuses with `NotSupported`.\n *\n * @public\n */\nexport class Adjustments extends ModelObject {\n readonly #shape: ObjectPath;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, shape: ObjectPath) {\n super(context, path);\n this.#shape = shape;\n }\n\n /** The number of adjust values that the preset defines. */\n get count(): number {\n return this.loadedProperty('count');\n }\n\n /** The adjust value at a zero-based index, after the next `sync()`. */\n get(index: number): ClientResult<number> {\n const at = indexOf(index, `${this.path.label}.get`);\n const label = `${this.path.label}.get(${at})`;\n const { result, fill } = ClientResult.create<number>(label);\n const shape = this.#shape;\n this.enqueue(\n 'read',\n `get(${at})`,\n (ref) => ({ op: 'readAdjustments', shape: ref(shape) }),\n (value) => {\n const values = hydrated(value, 'adjustments', label).adjustments.values;\n if (at >= values.length) fail({ code: 'ItemNotFound', target: label });\n fill(values[at]!);\n }\n );\n return result;\n }\n\n /** Set the adjust value at a zero-based index. */\n set(index: number, value: number): void {\n const at = indexOf(index, `${this.path.label}.set`);\n const v = finite(value, `${this.path.label}.set`);\n const shape = this.#shape;\n this.command('set', (ref) => ({\n op: 'setAdjustment',\n shape: ref(shape),\n index: at,\n value: v,\n }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const shape = this.#shape;\n this.loadScalars(\n this.selection(request, ['count']),\n 'adjustments',\n (ref) => ({ op: 'readAdjustments', shape: ref(shape) }),\n (v) => ({ count: v.adjustments.values.length })\n );\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Office.js `ShapeFill` and `ShapeLineFormat`: the fill and the outline of `p:spPr`\n// (EG_FillProperties, ECMA-376 Part 1, 20.1.8; CT_LineProperties, 20.1.2.2.24). Colors are\n// `#RRGGBB` strings or preset color names; transparency is 0 (opaque) to 1 (clear).\n\nimport type {\n AutomationCellAddress,\n AutomationFillWrite,\n AutomationLineWrite,\n} from '@pptx-editor.dev/core/automation';\nimport { failArgument } from '../runtime/errors.ts';\nimport type { ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport type { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport {\n DASH_STYLE,\n FILL_TYPE,\n LINE_STYLE,\n type ShapeFillType,\n type ShapeLineDashStyle,\n type ShapeLineStyle,\n} from './enums.ts';\nimport { finite, flag, ModelObject, text } from './model-object.ts';\n\n/** What a fill belongs to: a shape, or one cell of a table shape (`a:tcPr`). */\nexport type FillTarget =\n | { readonly kind: 'shape'; readonly shape: ObjectPath }\n | { readonly kind: 'cell'; readonly shape: ObjectPath; readonly cell: AutomationCellAddress };\n\n/** A fraction from 0 to 1, or `InvalidArgument`. */\nexport function fraction(value: unknown, target: string): number {\n const n = finite(value, target);\n if (n < 0 || n > 1) failArgument(target, 'a fraction from 0 (opaque) to 1 (clear)');\n return n;\n}\n\n/**\n * The fill of a shape.\n *\n * @public\n */\nexport class ShapeFill extends ModelObject {\n readonly #target: FillTarget;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, target: FillTarget) {\n super(context, path);\n this.#target = target;\n }\n\n /** The solid fill color as `#RRGGBB`, or an empty string for any other fill. */\n get foregroundColor(): string {\n return this.loadedProperty('foregroundColor');\n }\n set foregroundColor(value: string) {\n this.#write('foregroundColor', {\n kind: 'solid',\n color: text(value, this.at('foregroundColor')),\n });\n }\n /** The transparency of a solid fill, from 0 (opaque) to 1 (clear). */\n get transparency(): number {\n return this.loadedProperty('transparency');\n }\n set transparency(value: number) {\n this.#write('transparency', {\n kind: 'transparency',\n transparency: fraction(value, 'transparency'),\n });\n }\n /** The kind of fill. */\n get type(): ShapeFillType | `${ShapeFillType}` {\n return this.loadedProperty('type');\n }\n\n /** Remove the fill (`a:noFill`). */\n clear(): void {\n this.#write('clear', { kind: 'clear' });\n }\n\n /** Fill with a solid color, `#RRGGBB` or a preset color name. */\n setSolidColor(color: string): void {\n this.#write('setSolidColor', { kind: 'solid', color: text(color, this.at('color')) });\n }\n\n /**\n * Fill with a picture, stretched (`a:blipFill`): PNG, JPEG, or GIF bytes in base64. A table\n * cell refuses a picture fill with `InvalidArgument`.\n */\n setImage(base64EncodedImage: string): void {\n const base64 = text(base64EncodedImage, `${this.path.label}.setImage`);\n this.#write('setImage', { kind: 'image', base64 });\n }\n\n #write(name: string, fill: AutomationFillWrite): void {\n const shape = this.#target.shape;\n const cell = this.#cell();\n this.command(name, (ref) => ({ op: 'setFill', shape: ref(shape), fill, ...cell }));\n }\n\n #cell(): { readonly cell?: AutomationCellAddress } {\n return this.#target.kind === 'cell' ? { cell: this.#target.cell } : {};\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, ['foregroundColor', 'transparency', 'type']);\n const shape = this.#target.shape;\n this.loadScalars(\n names,\n 'fill',\n (ref) => ({ op: 'readFill', shape: ref(shape), ...this.#cell() }),\n (v) => ({\n foregroundColor: v.fill.foregroundColor ?? '',\n transparency: v.fill.transparency ?? 0,\n // A group fill (`a:grpFill`) takes the fill of the group; it reads as `NoFill` here.\n type: FILL_TYPE.fromFile(v.fill.type) ?? 'NoFill',\n })\n );\n }\n}\n\nconst LINE_NAMES = ['color', 'dashStyle', 'style', 'transparency', 'visible', 'weight'] as const;\n\n/**\n * The outline of a shape, or a line.\n *\n * @public\n */\nexport class ShapeLineFormat extends ModelObject {\n readonly #shape: ObjectPath;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, shape: ObjectPath) {\n super(context, path);\n this.#shape = shape;\n }\n\n /** The line color as `#RRGGBB`, or an empty string when it has none. */\n get color(): string {\n return this.loadedProperty('color');\n }\n set color(value: string) {\n this.#write('color', { color: text(value, this.at('color')) });\n }\n /** The dash style. */\n get dashStyle(): ShapeLineDashStyle | `${ShapeLineDashStyle}` {\n return this.loadedProperty('dashStyle');\n }\n set dashStyle(value: ShapeLineDashStyle | `${ShapeLineDashStyle}`) {\n this.#write('dashStyle', { dashStyle: DASH_STYLE.toFile(value, 'dashStyle') });\n }\n /** The compound line style. */\n get style(): ShapeLineStyle | `${ShapeLineStyle}` {\n return this.loadedProperty('style');\n }\n set style(value: ShapeLineStyle | `${ShapeLineStyle}`) {\n this.#write('style', { style: LINE_STYLE.toFile(value, 'style') });\n }\n /** The transparency, from 0 (opaque) to 1 (clear). */\n get transparency(): number {\n return this.loadedProperty('transparency');\n }\n set transparency(value: number) {\n this.#write('transparency', { transparency: fraction(value, 'transparency') });\n }\n /** Whether the line shows. */\n get visible(): boolean {\n return this.loadedProperty('visible');\n }\n set visible(value: boolean) {\n this.#write('visible', { visible: flag(value, this.at('visible')) });\n }\n /** The line weight, in points. */\n get weight(): number {\n return this.loadedProperty('weight');\n }\n set weight(value: number) {\n this.#write('weight', { weight: finite(value, this.at('weight')) });\n }\n\n #write(name: string, line: AutomationLineWrite): void {\n const shape = this.#shape;\n this.command(name, (ref) => ({ op: 'setLine', shape: ref(shape), line }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, LINE_NAMES);\n const shape = this.#shape;\n this.loadScalars(\n names,\n 'line',\n (ref) => ({ op: 'readLine', shape: ref(shape) }),\n (v) => ({\n color: v.line.color ?? '',\n dashStyle: DASH_STYLE.fromFile(v.line.dashStyle) ?? 'Solid',\n style: LINE_STYLE.fromFile(v.line.style) ?? 'Single',\n transparency: v.line.transparency ?? 0,\n visible: v.line.visible,\n weight: v.line.weight ?? 0,\n })\n );\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// The Office.js `GeometricShapeType` values and their ECMA-376 preset names (`ST_ShapeType`,\n// ECMA-376 Part 1, 20.1.10.56). Most values are the preset name with a capital first letter;\n// the table lists the others.\n\nimport { failArgument, nearest, oneOf } from '../runtime/errors.ts';\n\n/**\n * A preset geometry for `ShapeCollection.addGeometricShape`.\n *\n * @public\n */\nexport enum GeometricShapeType {\n lineInverse = 'LineInverse',\n triangle = 'Triangle',\n rightTriangle = 'RightTriangle',\n rectangle = 'Rectangle',\n diamond = 'Diamond',\n parallelogram = 'Parallelogram',\n trapezoid = 'Trapezoid',\n nonIsoscelesTrapezoid = 'NonIsoscelesTrapezoid',\n pentagon = 'Pentagon',\n hexagon = 'Hexagon',\n heptagon = 'Heptagon',\n octagon = 'Octagon',\n decagon = 'Decagon',\n dodecagon = 'Dodecagon',\n star4 = 'Star4',\n star5 = 'Star5',\n star6 = 'Star6',\n star7 = 'Star7',\n star8 = 'Star8',\n star10 = 'Star10',\n star12 = 'Star12',\n star16 = 'Star16',\n star24 = 'Star24',\n star32 = 'Star32',\n roundRectangle = 'RoundRectangle',\n round1Rectangle = 'Round1Rectangle',\n round2SameRectangle = 'Round2SameRectangle',\n round2DiagonalRectangle = 'Round2DiagonalRectangle',\n snipRoundRectangle = 'SnipRoundRectangle',\n snip1Rectangle = 'Snip1Rectangle',\n snip2SameRectangle = 'Snip2SameRectangle',\n snip2DiagonalRectangle = 'Snip2DiagonalRectangle',\n plaque = 'Plaque',\n ellipse = 'Ellipse',\n teardrop = 'Teardrop',\n homePlate = 'HomePlate',\n chevron = 'Chevron',\n pieWedge = 'PieWedge',\n pie = 'Pie',\n blockArc = 'BlockArc',\n donut = 'Donut',\n noSmoking = 'NoSmoking',\n rightArrow = 'RightArrow',\n leftArrow = 'LeftArrow',\n upArrow = 'UpArrow',\n downArrow = 'DownArrow',\n stripedRightArrow = 'StripedRightArrow',\n notchedRightArrow = 'NotchedRightArrow',\n bentUpArrow = 'BentUpArrow',\n leftRightArrow = 'LeftRightArrow',\n upDownArrow = 'UpDownArrow',\n leftUpArrow = 'LeftUpArrow',\n leftRightUpArrow = 'LeftRightUpArrow',\n quadArrow = 'QuadArrow',\n leftArrowCallout = 'LeftArrowCallout',\n rightArrowCallout = 'RightArrowCallout',\n upArrowCallout = 'UpArrowCallout',\n downArrowCallout = 'DownArrowCallout',\n leftRightArrowCallout = 'LeftRightArrowCallout',\n upDownArrowCallout = 'UpDownArrowCallout',\n quadArrowCallout = 'QuadArrowCallout',\n bentArrow = 'BentArrow',\n uturnArrow = 'UturnArrow',\n circularArrow = 'CircularArrow',\n leftCircularArrow = 'LeftCircularArrow',\n leftRightCircularArrow = 'LeftRightCircularArrow',\n curvedRightArrow = 'CurvedRightArrow',\n curvedLeftArrow = 'CurvedLeftArrow',\n curvedUpArrow = 'CurvedUpArrow',\n curvedDownArrow = 'CurvedDownArrow',\n swooshArrow = 'SwooshArrow',\n cube = 'Cube',\n can = 'Can',\n lightningBolt = 'LightningBolt',\n heart = 'Heart',\n sun = 'Sun',\n moon = 'Moon',\n smileyFace = 'SmileyFace',\n irregularSeal1 = 'IrregularSeal1',\n irregularSeal2 = 'IrregularSeal2',\n foldedCorner = 'FoldedCorner',\n bevel = 'Bevel',\n frame = 'Frame',\n halfFrame = 'HalfFrame',\n corner = 'Corner',\n diagonalStripe = 'DiagonalStripe',\n chord = 'Chord',\n arc = 'Arc',\n leftBracket = 'LeftBracket',\n rightBracket = 'RightBracket',\n leftBrace = 'LeftBrace',\n rightBrace = 'RightBrace',\n bracketPair = 'BracketPair',\n bracePair = 'BracePair',\n callout1 = 'Callout1',\n callout2 = 'Callout2',\n callout3 = 'Callout3',\n accentCallout1 = 'AccentCallout1',\n accentCallout2 = 'AccentCallout2',\n accentCallout3 = 'AccentCallout3',\n borderCallout1 = 'BorderCallout1',\n borderCallout2 = 'BorderCallout2',\n borderCallout3 = 'BorderCallout3',\n accentBorderCallout1 = 'AccentBorderCallout1',\n accentBorderCallout2 = 'AccentBorderCallout2',\n accentBorderCallout3 = 'AccentBorderCallout3',\n wedgeRectCallout = 'WedgeRectCallout',\n wedgeRRectCallout = 'WedgeRRectCallout',\n wedgeEllipseCallout = 'WedgeEllipseCallout',\n cloudCallout = 'CloudCallout',\n cloud = 'Cloud',\n ribbon = 'Ribbon',\n ribbon2 = 'Ribbon2',\n ellipseRibbon = 'EllipseRibbon',\n ellipseRibbon2 = 'EllipseRibbon2',\n leftRightRibbon = 'LeftRightRibbon',\n verticalScroll = 'VerticalScroll',\n horizontalScroll = 'HorizontalScroll',\n wave = 'Wave',\n doubleWave = 'DoubleWave',\n plus = 'Plus',\n flowChartProcess = 'FlowChartProcess',\n flowChartDecision = 'FlowChartDecision',\n flowChartInputOutput = 'FlowChartInputOutput',\n flowChartPredefinedProcess = 'FlowChartPredefinedProcess',\n flowChartInternalStorage = 'FlowChartInternalStorage',\n flowChartDocument = 'FlowChartDocument',\n flowChartMultidocument = 'FlowChartMultidocument',\n flowChartTerminator = 'FlowChartTerminator',\n flowChartPreparation = 'FlowChartPreparation',\n flowChartManualInput = 'FlowChartManualInput',\n flowChartManualOperation = 'FlowChartManualOperation',\n flowChartConnector = 'FlowChartConnector',\n flowChartPunchedCard = 'FlowChartPunchedCard',\n flowChartPunchedTape = 'FlowChartPunchedTape',\n flowChartSummingJunction = 'FlowChartSummingJunction',\n flowChartOr = 'FlowChartOr',\n flowChartCollate = 'FlowChartCollate',\n flowChartSort = 'FlowChartSort',\n flowChartExtract = 'FlowChartExtract',\n flowChartMerge = 'FlowChartMerge',\n flowChartOfflineStorage = 'FlowChartOfflineStorage',\n flowChartOnlineStorage = 'FlowChartOnlineStorage',\n flowChartMagneticTape = 'FlowChartMagneticTape',\n flowChartMagneticDisk = 'FlowChartMagneticDisk',\n flowChartMagneticDrum = 'FlowChartMagneticDrum',\n flowChartDisplay = 'FlowChartDisplay',\n flowChartDelay = 'FlowChartDelay',\n flowChartAlternateProcess = 'FlowChartAlternateProcess',\n flowChartOffpageConnector = 'FlowChartOffpageConnector',\n actionButtonBlank = 'ActionButtonBlank',\n actionButtonHome = 'ActionButtonHome',\n actionButtonHelp = 'ActionButtonHelp',\n actionButtonInformation = 'ActionButtonInformation',\n actionButtonForwardNext = 'ActionButtonForwardNext',\n actionButtonBackPrevious = 'ActionButtonBackPrevious',\n actionButtonEnd = 'ActionButtonEnd',\n actionButtonBeginning = 'ActionButtonBeginning',\n actionButtonReturn = 'ActionButtonReturn',\n actionButtonDocument = 'ActionButtonDocument',\n actionButtonSound = 'ActionButtonSound',\n actionButtonMovie = 'ActionButtonMovie',\n gear6 = 'Gear6',\n gear9 = 'Gear9',\n funnel = 'Funnel',\n mathPlus = 'MathPlus',\n mathMinus = 'MathMinus',\n mathMultiply = 'MathMultiply',\n mathDivide = 'MathDivide',\n mathEqual = 'MathEqual',\n mathNotEqual = 'MathNotEqual',\n cornerTabs = 'CornerTabs',\n squareTabs = 'SquareTabs',\n plaqueTabs = 'PlaqueTabs',\n chartX = 'ChartX',\n chartStar = 'ChartStar',\n chartPlus = 'ChartPlus',\n}\n\nconst KNOWN: ReadonlySet<string> = new Set<`${GeometricShapeType}`>([\n 'LineInverse',\n 'Triangle',\n 'RightTriangle',\n 'Rectangle',\n 'Diamond',\n 'Parallelogram',\n 'Trapezoid',\n 'NonIsoscelesTrapezoid',\n 'Pentagon',\n 'Hexagon',\n 'Heptagon',\n 'Octagon',\n 'Decagon',\n 'Dodecagon',\n 'Star4',\n 'Star5',\n 'Star6',\n 'Star7',\n 'Star8',\n 'Star10',\n 'Star12',\n 'Star16',\n 'Star24',\n 'Star32',\n 'RoundRectangle',\n 'Round1Rectangle',\n 'Round2SameRectangle',\n 'Round2DiagonalRectangle',\n 'SnipRoundRectangle',\n 'Snip1Rectangle',\n 'Snip2SameRectangle',\n 'Snip2DiagonalRectangle',\n 'Plaque',\n 'Ellipse',\n 'Teardrop',\n 'HomePlate',\n 'Chevron',\n 'PieWedge',\n 'Pie',\n 'BlockArc',\n 'Donut',\n 'NoSmoking',\n 'RightArrow',\n 'LeftArrow',\n 'UpArrow',\n 'DownArrow',\n 'StripedRightArrow',\n 'NotchedRightArrow',\n 'BentUpArrow',\n 'LeftRightArrow',\n 'UpDownArrow',\n 'LeftUpArrow',\n 'LeftRightUpArrow',\n 'QuadArrow',\n 'LeftArrowCallout',\n 'RightArrowCallout',\n 'UpArrowCallout',\n 'DownArrowCallout',\n 'LeftRightArrowCallout',\n 'UpDownArrowCallout',\n 'QuadArrowCallout',\n 'BentArrow',\n 'UturnArrow',\n 'CircularArrow',\n 'LeftCircularArrow',\n 'LeftRightCircularArrow',\n 'CurvedRightArrow',\n 'CurvedLeftArrow',\n 'CurvedUpArrow',\n 'CurvedDownArrow',\n 'SwooshArrow',\n 'Cube',\n 'Can',\n 'LightningBolt',\n 'Heart',\n 'Sun',\n 'Moon',\n 'SmileyFace',\n 'IrregularSeal1',\n 'IrregularSeal2',\n 'FoldedCorner',\n 'Bevel',\n 'Frame',\n 'HalfFrame',\n 'Corner',\n 'DiagonalStripe',\n 'Chord',\n 'Arc',\n 'LeftBracket',\n 'RightBracket',\n 'LeftBrace',\n 'RightBrace',\n 'BracketPair',\n 'BracePair',\n 'Callout1',\n 'Callout2',\n 'Callout3',\n 'AccentCallout1',\n 'AccentCallout2',\n 'AccentCallout3',\n 'BorderCallout1',\n 'BorderCallout2',\n 'BorderCallout3',\n 'AccentBorderCallout1',\n 'AccentBorderCallout2',\n 'AccentBorderCallout3',\n 'WedgeRectCallout',\n 'WedgeRRectCallout',\n 'WedgeEllipseCallout',\n 'CloudCallout',\n 'Cloud',\n 'Ribbon',\n 'Ribbon2',\n 'EllipseRibbon',\n 'EllipseRibbon2',\n 'LeftRightRibbon',\n 'VerticalScroll',\n 'HorizontalScroll',\n 'Wave',\n 'DoubleWave',\n 'Plus',\n 'FlowChartProcess',\n 'FlowChartDecision',\n 'FlowChartInputOutput',\n 'FlowChartPredefinedProcess',\n 'FlowChartInternalStorage',\n 'FlowChartDocument',\n 'FlowChartMultidocument',\n 'FlowChartTerminator',\n 'FlowChartPreparation',\n 'FlowChartManualInput',\n 'FlowChartManualOperation',\n 'FlowChartConnector',\n 'FlowChartPunchedCard',\n 'FlowChartPunchedTape',\n 'FlowChartSummingJunction',\n 'FlowChartOr',\n 'FlowChartCollate',\n 'FlowChartSort',\n 'FlowChartExtract',\n 'FlowChartMerge',\n 'FlowChartOfflineStorage',\n 'FlowChartOnlineStorage',\n 'FlowChartMagneticTape',\n 'FlowChartMagneticDisk',\n 'FlowChartMagneticDrum',\n 'FlowChartDisplay',\n 'FlowChartDelay',\n 'FlowChartAlternateProcess',\n 'FlowChartOffpageConnector',\n 'ActionButtonBlank',\n 'ActionButtonHome',\n 'ActionButtonHelp',\n 'ActionButtonInformation',\n 'ActionButtonForwardNext',\n 'ActionButtonBackPrevious',\n 'ActionButtonEnd',\n 'ActionButtonBeginning',\n 'ActionButtonReturn',\n 'ActionButtonDocument',\n 'ActionButtonSound',\n 'ActionButtonMovie',\n 'Gear6',\n 'Gear9',\n 'Funnel',\n 'MathPlus',\n 'MathMinus',\n 'MathMultiply',\n 'MathDivide',\n 'MathEqual',\n 'MathNotEqual',\n 'CornerTabs',\n 'SquareTabs',\n 'PlaqueTabs',\n 'ChartX',\n 'ChartStar',\n 'ChartPlus',\n]);\n\n/** The values whose preset name is not the value with a lower-case first letter. */\nconst PRESETS: Readonly<Record<string, string>> = Object.assign(\n Object.create(null) as Record<string, string>,\n {\n LineInverse: 'lineInv',\n RightTriangle: 'rtTriangle',\n Rectangle: 'rect',\n RoundRectangle: 'roundRect',\n Round1Rectangle: 'round1Rect',\n Round2SameRectangle: 'round2SameRect',\n Round2DiagonalRectangle: 'round2DiagRect',\n SnipRoundRectangle: 'snipRoundRect',\n Snip1Rectangle: 'snip1Rect',\n Snip2SameRectangle: 'snip2SameRect',\n Snip2DiagonalRectangle: 'snip2DiagRect',\n DiagonalStripe: 'diagStripe',\n WedgeRRectCallout: 'wedgeRoundRectCallout',\n }\n);\n\n/** The ECMA-376 preset name of a geometric shape type, or `InvalidArgument` naming `target`. */\nexport function geometryOf(value: unknown, target: string): string {\n if (typeof value !== 'string' || !KNOWN.has(value))\n failArgument(target, oneOf([...KNOWN]), nearest(value, [...KNOWN]));\n return PRESETS[value] ?? value.charAt(0).toLowerCase() + value.slice(1);\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// After DOCX Editor's `packages/editor-api/src/model/item-collection.ts` (commit 5993bd223945).\n//\n// A collection lists handles; `items` are proxies over them. `load('items/name')` reads `name`\n// on each item in the same `sync()`: the listing answers first, and the item reads go out as a\n// second batch pinned to the same revision. A deeper path (`items/textFrame/textRange/text`)\n// reads in that same second batch, because a navigation object is addressed through its item, or\n// by result reference to the read that finds it. Only a collection under the items (`items/shapes/items/name`) adds a round.\n//\n// `getItem`, `getItemAt`, and `getItemOrNullObject` answer a proxy at once, over a pending path\n// that the lookup in the same sync resolves. A call on it in that sync names the lookup's answer\n// by result reference, so `slides.getItemAt(0).shapes.addTextBox('Hi')` is one atomic batch.\n\nimport type {\n AutomationHandle,\n AutomationItemKey,\n AutomationOperation,\n AutomationValue,\n} from '@pptx-editor.dev/core/automation';\nimport { ClientResult } from '../runtime/client-result.ts';\nimport type { ClientObject } from '../runtime/client-object.ts';\nimport { diagnosticOf, fail, failArgument, isPptxEditorError, nearest } from '../runtime/errors.ts';\nimport { hydrated, hydratedHandleOrNull } from '../runtime/hydrate.ts';\nimport { LOAD_REQUEST } from '../runtime/internals.ts';\nimport { itemRequest, type ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport { ModelObject, skippingAbsent, type RefOf } from './model-object.ts';\n\nexport abstract class ItemCollection<T extends ClientObject> extends ModelObject {\n /** @internal The read that lists this collection's members. */\n protected abstract listing(ref: RefOf): AutomationOperation;\n /** @internal The proxy for a member the host named. */\n protected abstract itemOf(path: ObjectPath, nullable: boolean): T;\n /** @internal The members a listing answered. */\n protected handlesOf(value: AutomationValue, label: string): readonly AutomationHandle[] {\n return hydrated(value, 'handles', label).handles;\n }\n\n /**\n * @internal The read that finds one member, or undefined when the host has no lookup for this\n * collection: an index then picks from the listing, and an id is `NotImplemented`.\n */\n protected abstract lookup(\n ref: RefOf,\n key: AutomationItemKey,\n orNull: boolean\n ): AutomationOperation | undefined;\n\n /** The loaded members. */\n get items(): T[] {\n return this.loadedProperty<T[]>('items');\n }\n\n /** @internal */\n protected override get loadsItemPaths(): boolean {\n return true;\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n // On a collection, every name and path is about the items.\n const forItems = itemRequest(request);\n this.takeNestedPaths();\n if (forItems) this.#checkItemPaths(request, forItems);\n const skip = request.skip ?? 0;\n const top = request.top;\n const label = `${this.path.label}.items`;\n // Through a collection's items, a listing of a shape that has no members (a group's shapes\n // on a shape that is not a group) answers null and leaves the items not loaded.\n const orNull = this.loadingOrNull;\n this.enqueue(\n 'read',\n 'items',\n (ref) => (orNull ? skippingAbsent(this.listing(ref)) : this.listing(ref)),\n (value) => {\n if (value.kind === 'null') {\n this.markSkipped(diagnosticOf('not-group'));\n return;\n }\n const handles = this.handlesOf(value, label);\n const end = top === undefined ? handles.length : Math.min(handles.length, skip + top);\n const loaded = handles\n .slice(skip, end)\n .map((handle, i) => this.itemOf(this.memberPath(handle, skip + i), false));\n this.setLoadedProperty('items', loaded);\n if (forItems)\n this.internals.queue.continuing(() => {\n for (const item of loaded) item[LOAD_REQUEST](forItems);\n });\n },\n undefined,\n true,\n forItems !== undefined\n );\n }\n\n /**\n * Check the item paths of a load now, so a wrong name throws at the call with the nearest\n * name, as on any other object: a stand-in item plans the load, and what it queued is dropped.\n * A first segment that is a typo of `items` (`itmes/name`) suggests `items`.\n */\n #checkItemPaths(request: ResolvedLoadOptions, forItems: ResolvedLoadOptions): void {\n const restore = this.internals.queue.checkpoint();\n try {\n this.itemOf(ObjectPath.pending(`${this.path.label}.items`), false)[LOAD_REQUEST](forItems);\n } catch (error) {\n if (!isPptxEditorError(error) || error.code !== 'InvalidArgument') throw error;\n for (const name of [...request.select, ...request.nested.keys()])\n if (nearest(name, ['items']) === 'items')\n failArgument(\n `${this.path.label}.${name}`,\n \"'items/<property>', or a property of the items\",\n 'items'\n );\n throw error;\n } finally {\n restore();\n }\n }\n\n /** @internal The path of a member the host named. */\n protected memberPath(handle: AutomationHandle, index: number): ObjectPath {\n return ObjectPath.of(`${this.path.label}.items[${index}]`, handle);\n }\n\n /** The number of members, after the next `sync()`. */\n getCount(): ClientResult<number> {\n const { result, fill } = ClientResult.create<number>(`${this.path.label}.getCount`);\n const label = `${this.path.label}.getCount`;\n this.enqueue(\n 'read',\n 'getCount',\n (ref) => this.listing(ref),\n (value) => fill(this.handlesOf(value, label).length)\n );\n return result;\n }\n\n /** @internal A member by key, as a proxy over the lookup queued now. */\n protected find(key: AutomationItemKey, name: string, orNull: boolean): T {\n const path = ObjectPath.pending(`${this.path.label}.${name}`);\n const item = this.itemOf(path, orNull);\n const label = path.label;\n if (this.hasLookup) {\n this.enqueue(\n 'read',\n name,\n (ref) => this.lookup(ref, key, orNull)!,\n (value) => {\n const handle = hydratedHandleOrNull(value, label);\n if (handle) path.resolveTo(handle);\n else path.resolveNull();\n },\n path\n );\n return item;\n }\n if (!('index' in key)) fail({ code: 'NotImplemented', target: label });\n // No lookup: pick from the listing, which a call on the item waits for.\n this.enqueue(\n 'read',\n name,\n (ref) => this.listing(ref),\n (value) => {\n const handle = this.handlesOf(value, label)[key.index];\n if (handle) path.resolveTo(handle);\n else if (orNull) path.resolveNull();\n else fail({ code: 'ItemNotFound', target: label });\n },\n path,\n false\n );\n return item;\n }\n\n /** @internal Whether `lookup` answers for this collection. */\n protected get hasLookup(): boolean {\n return true;\n }\n\n /** @internal Check an index argument. */\n protected indexArg(index: unknown): number {\n if (typeof index !== 'number' || !Number.isInteger(index) || index < 0)\n failArgument(`${this.path.label}.getItemAt`, 'a whole number of 0 or more');\n return index;\n }\n\n /** @internal Check a key argument. */\n protected keyArg(key: unknown, name: string): string {\n if (typeof key !== 'string' || key.length === 0)\n failArgument(`${this.path.label}.${name}`, 'a non-empty string');\n return key;\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// After DOCX Editor's `packages/editor-api/src/runtime/batch.ts` (commit 5993bd223945).\n//\n// Planning, refusal mapping, and positional hydration of one batch.\n\nimport type {\n AutomationBatchResponse,\n AutomationError,\n AutomationErrorCode,\n AutomationOperation,\n} from '@pptx-editor.dev/core/automation';\nimport { hostDiagnosticOf, PptxEditorError, type PptxEditorErrorCode } from './errors.ts';\nimport { NeedsProducer, WaitForRead } from './object-path.ts';\nimport type { QueuedAction } from './queue.ts';\n\nexport interface PlannedBatch {\n readonly operations: readonly AutomationOperation[];\n readonly hasRead: boolean;\n readonly hasWrite: boolean;\n}\n\n/**\n * Plan every action, in order. All or nothing before anything is sent: if one action cannot\n * name its target, the throw happens here and the host is never called.\n */\nexport function planBatch(actions: readonly QueuedAction[]): PlannedBatch {\n const index = new Map<object, number>();\n actions.forEach((action, i) => index.set(action, i));\n const operations: AutomationOperation[] = [];\n let hasRead = false;\n let hasWrite = false;\n for (const action of actions) {\n operations.push(action.plan((producer) => index.get(producer)));\n if (action.sort === 'write') hasWrite = true;\n else hasRead = true;\n }\n return { operations, hasRead, hasWrite };\n}\n\n/**\n * `actions` with the lookups they name from a refused sync put back, each just before the first\n * call that names it, so a proxy from a refused sync addresses its object again and the lookup\n * still sees the writes queued before that call. Planning errors other than `NeedsProducer` are\n * left for the real planning to raise.\n */\nexport function withReplayedLookups(actions: readonly QueuedAction[]): QueuedAction[] {\n let list = [...actions];\n for (let guard = 0; guard <= actions.length + 10_000; guard += 1) {\n const index = new Map<object, number>();\n list.forEach((action, i) => index.set(action, i));\n let needed: QueuedAction | undefined;\n let at = 0;\n for (const [i, action] of list.entries()) {\n try {\n action.plan((producer) => index.get(producer));\n } catch (error) {\n if (error instanceof NeedsProducer) {\n needed = error.producer as QueuedAction;\n at = i;\n break;\n }\n }\n }\n if (!needed) return list;\n list = [...list.slice(0, at), needed, ...list.slice(at)];\n }\n return list;\n}\n\n/**\n * Where a sync must split so that every read sees the writes queued before it: the position of\n * the first read that a later call waits for (`WaitForRead`) and that has a write before it in\n * the queue, or -1. The actions before it are sent first, as their own batch; the read then goes\n * in an earlier round of the rest, after those writes.\n */\nexport function readAfterWriteCut(actions: readonly QueuedAction[]): number {\n const index = new Map<object, number>();\n actions.forEach((action, i) => index.set(action, i));\n const firstWrite = actions.findIndex((action) => action.sort === 'write');\n if (firstWrite < 0) return -1;\n let cut = -1;\n for (const action of actions) {\n try {\n action.plan((producer) => index.get(producer));\n } catch (error) {\n if (!(error instanceof WaitForRead)) continue;\n const at = index.get(error.producer);\n if (at !== undefined && at > firstWrite && (cut < 0 || at < cut)) cut = at;\n }\n }\n return cut;\n}\n\n/**\n * The reads to send in an earlier round, in queue order: those that other actions of this batch\n * wait for (`WaitForRead`), with the reads they name by result reference. Empty when the whole\n * batch plans in one round. A read that waits on an object a write of the same batch creates\n * cannot go early, because the writes stay one atomic batch: it refuses with\n * `InvalidObjectPath`, and a `sync()` between the write and the read resolves it. Any other\n * planning refusal propagates.\n */\nexport function awaitedReads(actions: readonly QueuedAction[]): QueuedAction[] {\n const index = new Map<object, number>();\n actions.forEach((action, i) => index.set(action, i));\n const awaited: QueuedAction[] = [];\n const waiting = new Set<QueuedAction>();\n const uses = new Map<QueuedAction, QueuedAction[]>();\n for (const action of actions) {\n const used: QueuedAction[] = [];\n uses.set(action, used);\n try {\n action.plan((producer) => {\n const at = index.get(producer);\n if (at !== undefined) used.push(actions[at]!);\n return at;\n });\n } catch (error) {\n if (!(error instanceof WaitForRead)) throw error;\n awaited.push(error.producer as QueuedAction);\n waiting.add(action);\n }\n }\n if (awaited.length === 0) return [];\n const round = new Set<QueuedAction>();\n // The read and every action it names, if none of them waits or writes.\n const closure = (start: QueuedAction): Set<QueuedAction> | null => {\n const seen = new Set<QueuedAction>();\n const stack = [start];\n while (stack.length > 0) {\n const action = stack.pop()!;\n if (seen.has(action) || round.has(action)) continue;\n if (waiting.has(action)) return null;\n if (action.sort === 'write')\n throw new PptxEditorError({ code: 'InvalidObjectPath', target: start.label });\n seen.add(action);\n for (const used of uses.get(action) ?? []) stack.push(used);\n }\n return seen;\n };\n for (const read of awaited) for (const action of closure(read) ?? []) round.add(action);\n if (round.size === 0)\n throw new PptxEditorError({ code: 'InvalidObjectPath', target: [...waiting][0]?.label });\n return actions.filter((action) => round.has(action));\n}\n\n/**\n * The host's refusal codes, mapped onto this runtime's. A total mapping: a new protocol code\n * fails to compile here rather than reaching consumers as `GeneralException`.\n */\nconst HOST_CODES: Readonly<Record<AutomationErrorCode, PptxEditorErrorCode>> = Object.freeze({\n 'stale-revision': 'StaleDocument',\n 'invalid-handle': 'InvalidObjectPath',\n 'invalid-argument': 'InvalidArgument',\n 'unsupported-capability': 'NotSupported',\n disposed: 'RuntimeDisposed',\n 'transaction-refused': 'GeneralException',\n 'unknown-operation': 'NotSupported',\n 'unsupported-content': 'NotSupported',\n 'item-not-found': 'ItemNotFound',\n 'document-unavailable': 'DocumentUnavailable',\n});\n\nexport interface HostFailureContext {\n readonly target?: string;\n readonly expectedRevision?: number;\n readonly actualRevision?: number;\n}\n\n/**\n * One host error as one of ours. Nothing from `error.message` or `error.detail` survives: the\n * detail only selects a public diagnostic.\n */\nexport function hostFailure(\n error: AutomationError,\n context: HostFailureContext = {}\n): PptxEditorError {\n const code = HOST_CODES[error.code] ?? 'GeneralException';\n const stale = code === 'StaleDocument';\n const diagnostic = hostDiagnosticOf(error.code, error.detail);\n return new PptxEditorError({\n code,\n ...(diagnostic === undefined ? {} : { diagnostic }),\n ...(context.target === undefined ? {} : { target: context.target }),\n ...(stale && context.expectedRevision !== undefined\n ? { expectedRevision: context.expectedRevision }\n : {}),\n ...(stale && context.actualRevision !== undefined\n ? { actualRevision: context.actualRevision }\n : {}),\n });\n}\n\n/** The error for a refused batch, named after the consumer call that failed. */\nexport function batchFailure(\n response: AutomationBatchResponse,\n actions: readonly QueuedAction[],\n expectedRevision?: number,\n onAction?: (action: QueuedAction) => void\n): PptxEditorError {\n for (let i = 0; i < response.results.length; i += 1) {\n const result = response.results[i];\n if (result?.status !== 'error') continue;\n const label = actions[i]?.label;\n if (actions[i]) onAction?.(actions[i]!);\n return hostFailure(result.error, {\n ...(label === undefined ? {} : { target: label }),\n ...(expectedRevision === undefined ? {} : { expectedRevision }),\n actualRevision: response.revision,\n });\n }\n return new PptxEditorError({ code: 'GeneralException' });\n}\n\n/**\n * Hydrate a successful response into the actions that asked for it. Positional and\n * length-checked: a response that does not match the request cannot be matched up at all.\n */\nexport function settleBatch(\n actions: readonly QueuedAction[],\n response: AutomationBatchResponse,\n onAction?: (action: QueuedAction) => void\n): void {\n if (response.results.length !== actions.length)\n throw new PptxEditorError({ code: 'GeneralException' });\n for (let i = 0; i < actions.length; i += 1) {\n const result = response.results[i]!;\n const action = actions[i]!;\n // The action a settle failure names, for the trace messages of the error.\n onAction?.(action);\n if (result.status !== 'ok')\n throw new PptxEditorError({ code: 'GeneralException', target: action.label });\n action.settle(result.value);\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Office.js `Slide.getImageAsBase64` and `Shape.getImageAsBase64`: a PNG picture as base64.\n//\n// The sync checks the target and the size in its batch (`prepareImage`), then asks the host to\n// draw (`renderImage`) and waits for the picture before it returns. Only a host that draws\n// pictures (a live editor in a browser, or a server runtime with a rasterizer) has the `images`\n// capability; any other host refuses in the batch with `NotSupported`.\n\nimport type { AutomationHandle, AutomationValue } from '@pptx-editor.dev/core/automation';\nimport { hostFailure } from '../runtime/batch.ts';\nimport { diagnosticOf, failArgument, PptxEditorError } from '../runtime/errors.ts';\nimport { hydrated } from '../runtime/hydrate.ts';\nimport type { ContextInternals } from '../runtime/internals.ts';\nimport { ShapeGetImageFormatType } from './enums.ts';\n\n/**\n * Options for `Slide.getImageAsBase64`. The picture keeps the slide's aspect ratio and fits into\n * the box: with both sizes it fits into both, with one size it takes that size, and with neither\n * it has the slide's own size at 96 pixels per inch.\n *\n * @public\n */\nexport interface SlideGetImageOptions {\n /** The height of the box, in pixels. */\n height?: number;\n /** The width of the box, in pixels. */\n width?: number;\n}\n\n/**\n * Options for `Shape.getImageAsBase64`. The picture keeps the shape's aspect ratio and fits into\n * the box, as for a slide.\n *\n * @public\n */\nexport interface ShapeGetImageOptions {\n /** The image format. Only PNG. */\n format?: ShapeGetImageFormatType | `${ShapeGetImageFormatType}` | undefined;\n /** The height of the box, in pixels. */\n height?: number;\n /** The width of the box, in pixels. */\n width?: number;\n}\n\n/** The box a picture fits into, as the host takes it. */\nexport interface ImageBox {\n readonly width?: number;\n readonly height?: number;\n}\n\n/** A size of the box: absent, or a positive finite number. Else `InvalidArgument`. */\nfunction side(value: unknown, target: string): number | undefined {\n if (value === undefined || value === null) return undefined;\n if (typeof value !== 'number' || !Number.isFinite(value) || value <= 0)\n failArgument(target, 'a number of pixels greater than 0');\n return value;\n}\n\n/** The box of picture options, checked before the sync sends anything. `format` is a shape option only. */\nexport function imageBox(options: unknown, target: string, format: boolean): ImageBox {\n if (options === undefined || options === null) return {};\n if (typeof options !== 'object' || Array.isArray(options))\n failArgument(target, 'an options object with width and height');\n const o = options as Record<string, unknown>;\n if (\n format &&\n o['format'] !== undefined &&\n o['format'] !== null &&\n o['format'] !== ShapeGetImageFormatType.png\n )\n failArgument(target, \"the format 'Png'\");\n const width = side(o['width'], target);\n const height = side(o['height'], target);\n return {\n ...(width === undefined ? {} : { width }),\n ...(height === undefined ? {} : { height }),\n };\n}\n\n/** Ask the host to draw the picture of a checked handle, as base64. */\nasync function draw(\n internals: ContextInternals,\n handle: AutomationHandle,\n box: ImageBox,\n target: string\n): Promise<string> {\n const host = internals.host;\n if (typeof host.renderImage !== 'function') {\n const diagnostic = diagnosticOf('images');\n throw new PptxEditorError({\n code: 'NotSupported',\n target,\n ...(diagnostic === undefined ? {} : { diagnostic }),\n });\n }\n const answer = await host.renderImage({ target: handle, ...box });\n if (!answer.ok) throw hostFailure(answer.error, { target });\n return answer.base64;\n}\n\n/**\n * The settle of a `prepareImage` read: start the drawing, and fill the result when it is done.\n * The sync waits for it.\n */\nexport function settleImage(\n internals: ContextInternals,\n box: ImageBox,\n target: string,\n fill: (base64: string) => void\n): (value: AutomationValue) => void {\n return (value) => {\n const handle = hydrated(value, 'handle', target).handle;\n internals.defer(draw(internals, handle, box, target).then(fill));\n };\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Office.js `SlideBackground`, `SlideLayoutBackground`, `SlideMasterBackground`,\n// `SlideBackgroundFill`, and its solid, gradient, pattern, and picture fills: the background of\n// a slide, a layout, or a master (`p:cSld/p:bg`, ECMA-376 Part 1, 19.3.1.1). A read gives the\n// background the part shows, also when it comes from the layout or master. A fill write gives\n// the part its own `p:bgPr`.\n\nimport type {\n AutomationBackgroundRead,\n AutomationBackgroundWrite,\n} from '@pptx-editor.dev/core/automation';\nimport { fail, failArgument, nearest, oneOf } from '../runtime/errors.ts';\nimport { hydrated } from '../runtime/hydrate.ts';\nimport type { ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport {\n BACKGROUND_FILL_TYPE,\n BACKGROUND_GRADIENT_TYPE,\n BACKGROUND_PATTERN,\n type SlideBackgroundFillType,\n type SlideBackgroundGradientFillType,\n type SlideBackgroundPatternFillType,\n} from './enums.ts';\nimport { fraction } from './fill-line.ts';\nimport { flag, ModelObject, text } from './model-object.ts';\n\n/**\n * Options for `SlideBackgroundFill.setSolidFill`.\n *\n * @public\n */\nexport interface SlideBackgroundSolidFillOptions {\n /** `#RRGGBB` or a preset color name. The current solid color, or white, when absent. */\n color?: string | undefined;\n /** From 0 (opaque) to 1 (clear). The current transparency, or 0, when absent. */\n transparency?: number | undefined;\n}\n\n/**\n * Options for `SlideBackgroundFill.setGradientFill`.\n *\n * @public\n */\nexport interface SlideBackgroundGradientFillOptions {\n /** The shading. The current shading, or `Linear`, when absent. */\n type?: SlideBackgroundGradientFillType | `${SlideBackgroundGradientFillType}` | undefined;\n}\n\n/**\n * Options for `SlideBackgroundFill.setPatternFill`.\n *\n * @public\n */\nexport interface SlideBackgroundPatternFillOptions {\n /** The color behind the pattern. The current one, or white, when absent. */\n backgroundColor?: string | undefined;\n /** The color of the pattern. The current one, or black, when absent. */\n foregroundColor?: string | undefined;\n /** The pattern. The current one, or `Percent5`, when absent. */\n pattern?: SlideBackgroundPatternFillType | `${SlideBackgroundPatternFillType}` | undefined;\n}\n\n/**\n * Options for `SlideBackgroundFill.setPictureOrTextureFill`.\n *\n * @public\n */\nexport interface SlideBackgroundPictureOrTextureFillOptions {\n /** PNG, JPEG, or GIF bytes in base64. The current picture when absent. */\n imageBase64?: string | undefined;\n /** From 0 (opaque) to 1 (clear). */\n transparency: number;\n}\n\n/** The names an options object may carry, or `InvalidArgument` naming the first other one. */\nfunction optionsOf<T extends object>(\n value: T | undefined,\n names: readonly string[],\n target: string\n): Partial<Record<string, unknown>> {\n if (value === undefined) return {};\n if (typeof value !== 'object' || value === null || Array.isArray(value))\n failArgument(target, 'an options object');\n for (const key of Object.keys(value))\n if (!names.includes(key))\n failArgument(`${target}.${key}`, `an option name: ${oneOf(names)}`, nearest(key, names));\n return value as Partial<Record<string, unknown>>;\n}\n\n/** A gradient shading a write accepts. `ShadeFromTitle` is a read state only. */\nfunction gradientArg(value: unknown, target: string): 'linear' | 'circle' | 'rect' | 'shape' {\n if (value === 'ShadeFromTitle') fail({ code: 'NotImplemented', target });\n return BACKGROUND_GRADIENT_TYPE.toFile(value, target) as 'linear' | 'circle' | 'rect' | 'shape';\n}\n\n/** The object that writes and reads one background, by the slide, layout, or master path. */\nabstract class BackgroundPart extends ModelObject {\n /** @internal The slide, layout, or master; for a typed fill, its null-object path. */\n protected readonly owner: ObjectPath;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, owner: ObjectPath, nullable = false) {\n super(context, path, { nullable });\n this.owner = owner;\n }\n\n /** @internal Queue one background write. */\n protected writeBackground(name: string, background: AutomationBackgroundWrite): void {\n const owner = this.owner;\n this.command(name, (ref) => ({ op: 'setBackground', owner: ref(owner), background }));\n }\n\n /** @internal Queue the background read that fills `names`. */\n protected loadBackground(\n names: readonly string[],\n project: (background: AutomationBackgroundRead) => Readonly<Record<string, unknown>>\n ): void {\n const owner = this.owner;\n this.loadScalars(\n names,\n 'background',\n (ref) => ({ op: 'readBackground', owner: ref(owner) }),\n (v) => project(v.background)\n );\n }\n}\n\n/**\n * A solid background fill.\n *\n * @public\n */\nexport class SlideBackgroundSolidFill extends BackgroundPart {\n /** The color as `#RRGGBB`. */\n get color(): string {\n return this.loadedProperty('color');\n }\n set color(value: string) {\n this.writeBackground('color', { kind: 'solid', color: text(value, this.at('color')) });\n }\n /** The transparency, from 0 (opaque) to 1 (clear). */\n get transparency(): number {\n return this.loadedProperty('transparency');\n }\n set transparency(value: number) {\n const transparency = fraction(value, this.at('transparency'));\n this.writeBackground('transparency', { kind: 'solid', transparency });\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n this.loadBackground(this.selection(request, ['color', 'transparency']), (b) => ({\n color: b.fill.color ?? '',\n transparency: b.fill.transparency ?? 0,\n }));\n }\n}\n\n/**\n * A gradient background fill.\n *\n * @public\n */\nexport class SlideBackgroundGradientFill extends BackgroundPart {\n /** The shading: `a:lin`, or an `a:path` of `circle` (Radial), `rect`, or `shape` (Path). */\n get type(): SlideBackgroundGradientFillType | `${SlideBackgroundGradientFillType}` {\n return this.loadedProperty('type');\n }\n set type(value: SlideBackgroundGradientFillType | `${SlideBackgroundGradientFillType}`) {\n const gradientType = gradientArg(value, this.at('type'));\n this.writeBackground('type', { kind: 'gradient', gradientType });\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n this.loadBackground(this.selection(request, ['type']), (b) => ({\n type:\n b.fill.gradientType === 'shadeToTitle'\n ? 'ShadeFromTitle'\n : (BACKGROUND_GRADIENT_TYPE.fromFile(b.fill.gradientType) ?? 'Unsupported'),\n }));\n }\n}\n\n/**\n * A pattern background fill (`a:pattFill`).\n *\n * @public\n */\nexport class SlideBackgroundPatternFill extends BackgroundPart {\n /** The color behind the pattern, as `#RRGGBB`. */\n get backgroundColor(): string {\n return this.loadedProperty('backgroundColor');\n }\n set backgroundColor(value: string) {\n const backgroundColor = text(value, this.at('backgroundColor'));\n this.writeBackground('backgroundColor', { kind: 'pattern', backgroundColor });\n }\n /** The color of the pattern, as `#RRGGBB`. */\n get foregroundColor(): string {\n return this.loadedProperty('foregroundColor');\n }\n set foregroundColor(value: string) {\n const foregroundColor = text(value, this.at('foregroundColor'));\n this.writeBackground('foregroundColor', { kind: 'pattern', foregroundColor });\n }\n /** The pattern (`ST_PresetPatternVal`). */\n get pattern(): SlideBackgroundPatternFillType | `${SlideBackgroundPatternFillType}` {\n return this.loadedProperty('pattern');\n }\n set pattern(value: SlideBackgroundPatternFillType | `${SlideBackgroundPatternFillType}`) {\n const pattern = BACKGROUND_PATTERN.toFile(value, this.at('pattern'));\n this.writeBackground('pattern', { kind: 'pattern', pattern });\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = ['backgroundColor', 'foregroundColor', 'pattern'];\n this.loadBackground(this.selection(request, names), (b) => ({\n backgroundColor: b.fill.backgroundColor ?? '',\n foregroundColor: b.fill.foregroundColor ?? '',\n pattern: BACKGROUND_PATTERN.fromFile(b.fill.pattern) ?? 'Unsupported',\n }));\n }\n}\n\n/**\n * A picture background fill (`a:blipFill`), stretched to the slide.\n *\n * @public\n */\nexport class SlideBackgroundPictureOrTextureFill extends BackgroundPart {\n /** The transparency of the picture (`a:alphaModFix`), from 0 (opaque) to 1 (clear). */\n get transparency(): number {\n return this.loadedProperty('transparency');\n }\n set transparency(value: number) {\n const transparency = fraction(value, this.at('transparency'));\n this.writeBackground('transparency', { kind: 'picture', transparency });\n }\n\n /** Show other picture bytes: PNG, JPEG, or GIF in base64. The transparency stays. */\n setImage(base64EncodedImage: string): void {\n const base64 = text(base64EncodedImage, this.at('setImage'));\n this.writeBackground('setImage', { kind: 'picture', base64 });\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n this.loadBackground(this.selection(request, ['transparency']), (b) => ({\n transparency: b.fill.transparency ?? 0,\n }));\n }\n}\n\n/**\n * The fill of a background.\n *\n * @public\n */\nexport class SlideBackgroundFill extends BackgroundPart {\n /** The kind of fill. `Unsupported` for no fill. */\n get type(): SlideBackgroundFillType | `${SlideBackgroundFillType}` {\n return this.loadedProperty('type');\n }\n\n /** The gradient fill, or a null object when the fill is of another kind. */\n getGradientFillOrNullObject(): SlideBackgroundGradientFill {\n return this.#typed(\n 'getGradientFillOrNullObject',\n 'gradient',\n (p) => new SlideBackgroundGradientFill(this.context, p, p, true)\n );\n }\n /** The pattern fill, or a null object when the fill is of another kind. */\n getPatternFillOrNullObject(): SlideBackgroundPatternFill {\n return this.#typed(\n 'getPatternFillOrNullObject',\n 'pattern',\n (p) => new SlideBackgroundPatternFill(this.context, p, p, true)\n );\n }\n /** The picture fill, or a null object when the fill is of another kind. */\n getPictureOrTextureFillOrNullObject(): SlideBackgroundPictureOrTextureFill {\n return this.#typed(\n 'getPictureOrTextureFillOrNullObject',\n 'picture',\n (p) => new SlideBackgroundPictureOrTextureFill(this.context, p, p, true)\n );\n }\n /** The solid fill, or a null object when the fill is of another kind. */\n getSolidFillOrNullObject(): SlideBackgroundSolidFill {\n return this.#typed(\n 'getSolidFillOrNullObject',\n 'solid',\n (p) => new SlideBackgroundSolidFill(this.context, p, p, true)\n );\n }\n\n /** Fill with a gradient. The stops of a current gradient stay. */\n setGradientFill(options?: SlideBackgroundGradientFillOptions): void {\n const target = this.at('setGradientFill');\n const o = optionsOf(options, ['type'], target);\n this.writeBackground('setGradientFill', {\n kind: 'gradient',\n ...(o.type === undefined ? {} : { gradientType: gradientArg(o.type, `${target}.type`) }),\n });\n }\n\n /** Fill with a pattern (`a:pattFill`). */\n setPatternFill(options?: SlideBackgroundPatternFillOptions): void {\n const target = this.at('setPatternFill');\n const o = optionsOf(options, ['backgroundColor', 'foregroundColor', 'pattern'], target);\n this.writeBackground('setPatternFill', {\n kind: 'pattern',\n ...(o.pattern === undefined\n ? {}\n : { pattern: BACKGROUND_PATTERN.toFile(o.pattern, `${target}.pattern`) }),\n ...(o.foregroundColor === undefined\n ? {}\n : { foregroundColor: text(o.foregroundColor, `${target}.foregroundColor`) }),\n ...(o.backgroundColor === undefined\n ? {}\n : { backgroundColor: text(o.backgroundColor, `${target}.backgroundColor`) }),\n });\n }\n\n /** Fill with a stretched picture. Without `imageBase64`, the current picture stays. */\n setPictureOrTextureFill(options?: SlideBackgroundPictureOrTextureFillOptions): void {\n const target = this.at('setPictureOrTextureFill');\n const o = optionsOf(options, ['imageBase64', 'transparency'], target);\n this.writeBackground('setPictureOrTextureFill', {\n kind: 'picture',\n ...(o.imageBase64 === undefined\n ? {}\n : { base64: text(o.imageBase64, `${target}.imageBase64`) }),\n ...(o.transparency === undefined\n ? {}\n : { transparency: fraction(o.transparency, `${target}.transparency`) }),\n });\n }\n\n /** Fill with one color. */\n setSolidFill(options?: SlideBackgroundSolidFillOptions): void {\n const target = this.at('setSolidFill');\n const o = optionsOf(options, ['color', 'transparency'], target);\n this.writeBackground('setSolidFill', {\n kind: 'solid',\n ...(o.color === undefined ? {} : { color: text(o.color, `${target}.color`) }),\n ...(o.transparency === undefined\n ? {}\n : { transparency: fraction(o.transparency, `${target}.transparency`) }),\n });\n }\n\n /**\n * A typed fill over a pending path: the read queued now resolves it to the owner when the fill\n * is of `kind`, and to null otherwise. A call on it waits for that read.\n */\n #typed<T>(name: string, kind: string, make: (path: ObjectPath) => T): T {\n const path = ObjectPath.pending(`${this.path.label}.${name}()`);\n const object = make(path);\n const owner = this.owner;\n const label = path.label;\n this.enqueue(\n 'read',\n `${name}()`,\n (ref) => ({ op: 'readBackground', owner: ref(owner) }),\n (value) => {\n const read = value.kind === 'null' ? null : hydrated(value, 'background', label).background;\n if (read?.fill.type === kind && owner.isAddressable) path.resolveTo(owner.handle());\n else path.resolveNull();\n },\n path,\n false\n );\n return object;\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n this.loadBackground(this.selection(request, ['type']), (b) => ({\n type: BACKGROUND_FILL_TYPE.fromFile(b.fill.type) ?? 'Unsupported',\n }));\n }\n}\n\n/** The fill object of a background object. */\nfunction fillOf(context: RequestContext, path: ObjectPath, owner: ObjectPath): SlideBackgroundFill {\n return new SlideBackgroundFill(context, ObjectPath.derived(`${path.label}.fill`, path), owner);\n}\n\n/**\n * The background of a slide.\n *\n * @public\n */\nexport class SlideBackground extends BackgroundPart {\n #fill: SlideBackgroundFill | undefined;\n\n /** Whether the shapes of the layout and master are hidden (`p:sld/@showMasterSp=\"0\"`). */\n get areBackgroundGraphicsHidden(): boolean {\n return this.loadedProperty('areBackgroundGraphicsHidden');\n }\n set areBackgroundGraphicsHidden(value: boolean) {\n const hidden = flag(value, this.at('areBackgroundGraphicsHidden'));\n this.writeBackground('areBackgroundGraphicsHidden', { kind: 'graphicsHidden', hidden });\n }\n /**\n * Whether the slide shows the background of its layout or master (it has no own `p:bg`).\n * Setting `false` copies the shown background into the slide.\n */\n get isMasterBackgroundFollowed(): boolean {\n return this.loadedProperty('isMasterBackgroundFollowed');\n }\n set isMasterBackgroundFollowed(value: boolean) {\n const follow = flag(value, this.at('isMasterBackgroundFollowed'));\n this.writeBackground('isMasterBackgroundFollowed', { kind: follow ? 'follow' : 'own' });\n }\n /** The fill the slide shows. */\n get fill(): SlideBackgroundFill {\n return (this.#fill ??= fillOf(this.context, this.path, this.owner));\n }\n\n /** Remove the own background: the slide shows the background of its layout or master. */\n reset(): void {\n this.writeBackground('reset', { kind: 'follow' });\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = ['areBackgroundGraphicsHidden', 'isMasterBackgroundFollowed'];\n this.loadBackground(this.selection(request, names, { fill: () => this.fill }), (b) => ({\n areBackgroundGraphicsHidden: b.graphicsHidden,\n isMasterBackgroundFollowed: b.followsMaster,\n }));\n }\n}\n\n/**\n * The background of a slide layout.\n *\n * @public\n */\nexport class SlideLayoutBackground extends BackgroundPart {\n #fill: SlideBackgroundFill | undefined;\n\n /** Whether the shapes of the master are hidden (`p:sldLayout/@showMasterSp=\"0\"`). */\n get areBackgroundGraphicsHidden(): boolean {\n return this.loadedProperty('areBackgroundGraphicsHidden');\n }\n set areBackgroundGraphicsHidden(value: boolean) {\n const hidden = flag(value, this.at('areBackgroundGraphicsHidden'));\n this.writeBackground('areBackgroundGraphicsHidden', { kind: 'graphicsHidden', hidden });\n }\n /**\n * Whether the layout shows the background of its master (it has no own `p:bg`). Setting\n * `false` copies the master background into the layout.\n */\n get isMasterBackgroundFollowed(): boolean {\n return this.loadedProperty('isMasterBackgroundFollowed');\n }\n set isMasterBackgroundFollowed(value: boolean) {\n const follow = flag(value, this.at('isMasterBackgroundFollowed'));\n this.writeBackground('isMasterBackgroundFollowed', { kind: follow ? 'follow' : 'own' });\n }\n /** The fill the layout shows. */\n get fill(): SlideBackgroundFill {\n return (this.#fill ??= fillOf(this.context, this.path, this.owner));\n }\n\n /** Remove the own background: the layout shows the background of its master. */\n reset(): void {\n this.writeBackground('reset', { kind: 'follow' });\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = ['areBackgroundGraphicsHidden', 'isMasterBackgroundFollowed'];\n this.loadBackground(this.selection(request, names, { fill: () => this.fill }), (b) => ({\n areBackgroundGraphicsHidden: b.graphicsHidden,\n isMasterBackgroundFollowed: b.followsMaster,\n }));\n }\n}\n\n/**\n * The background of a slide master.\n *\n * @public\n */\nexport class SlideMasterBackground extends BackgroundPart {\n #fill: SlideBackgroundFill | undefined;\n\n /** The fill of the master background. */\n get fill(): SlideBackgroundFill {\n return (this.#fill ??= fillOf(this.context, this.path, this.owner));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n this.selection(request, [], { fill: () => this.fill });\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Office.js `CustomXmlPart`, `CustomXmlPartCollection`, and `CustomXmlPartScopedCollection`: the\n// custom XML parts of a presentation, slide, layout, master, or shape (ECMA-376 Part 1, 22.5).\n// The id is the part's `ds:itemID` GUID. XML the consumer writes goes through the host's bounded\n// XML reader: no DTD, no entities, and size caps.\n\nimport type {\n AutomationCustomXmlPartRead,\n AutomationOperation,\n} from '@pptx-editor.dev/core/automation';\nimport { ClientResult } from '../runtime/client-result.ts';\nimport { fail, failArgument, nearest } from '../runtime/errors.ts';\nimport { hydrated } from '../runtime/hydrate.ts';\nimport type { ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport { ModelObject, type RefOf } from './model-object.ts';\n\ntype Read = AutomationCustomXmlPartRead;\n\n/** Fills a part a read found. Module-private, so no consumer can call it. */\nconst FILLERS = new WeakMap<CustomXmlPart, (read: Read) => void>();\n\nfunction fillPart(part: CustomXmlPart, read: Read): void {\n FILLERS.get(part)?.(read);\n}\n\n/** An item id in its canonical form (braced, upper case), or `InvalidArgument`. */\nfunction idOf(value: unknown, target: string): string {\n const m =\n typeof value === 'string'\n ? /^\\{?([0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12})\\}?$/.exec(\n value.trim()\n )\n : null;\n if (!m) failArgument(target, \"a GUID such as '{01234567-89AB-CDEF-0123-456789ABCDEF}'\");\n return `{${m[1]!.toUpperCase()}}`;\n}\n\n/** XML text: a non-empty string. The host checks that it is well formed. */\nfunction xmlOf(value: unknown, target: string): string {\n if (typeof value !== 'string' || value.length === 0) failArgument(target, 'non-empty XML text');\n return value;\n}\n\n/** A fresh item id: a random version 4 GUID, braced and upper case. */\nfunction newItemId(): string {\n return `{${globalThis.crypto.randomUUID().toUpperCase()}}`;\n}\n\n/**\n * One custom XML part.\n *\n * @public\n */\nexport class CustomXmlPart extends ModelObject {\n readonly #owner: ObjectPath;\n #id: string;\n\n /** @internal */\n constructor(\n context: RequestContext,\n path: ObjectPath,\n owner: ObjectPath,\n id: string,\n nullable = false\n ) {\n super(context, path, { nullable });\n this.#owner = owner;\n this.#id = id;\n if (id) this.setLoadedProperty('id', id);\n FILLERS.set(this, (read) => {\n this.#id = read.id;\n this.setLoadedProperty('id', read.id);\n this.setLoadedProperty('namespaceUri', read.namespaceUri);\n });\n }\n\n /** The id: the part's `ds:itemID` GUID, braced and upper case. */\n get id(): string {\n return this.loadedProperty('id');\n }\n /** The namespace URI of the root element, or an empty string. */\n get namespaceUri(): string {\n return this.loadedProperty('namespaceUri');\n }\n\n /** The XML text of the part, after the next `sync()`. */\n getXml(): ClientResult<string> {\n const label = `${this.path.label}.getXml`;\n const { result, fill } = ClientResult.create<string>(label);\n this.enqueue(\n 'read',\n 'getXml',\n (ref) => ({ op: 'readCustomXml', owner: ref(this.path), id: this.#id }),\n (value) => fill(hydrated(value, 'text', label).text)\n );\n return result;\n }\n\n /** Replace the XML text. Text that is not well-formed XML refuses with `InvalidArgument`. */\n setXml(xml: string): void {\n const text = xmlOf(xml, this.at('setXml'));\n this.command('setXml', (ref) => ({\n op: 'setCustomXml',\n owner: ref(this.path),\n id: this.#id,\n xml: text,\n }));\n }\n\n /** Delete the part from its owner. A part another owner still names stays for that owner. */\n delete(): void {\n this.command('delete', (ref) => ({\n op: 'deleteCustomXmlPart',\n owner: ref(this.path),\n id: this.#id,\n }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, ['id', 'namespaceUri']);\n if (!names.includes('namespaceUri')) return;\n const label = `${this.path.label}.load`;\n this.enqueue(\n 'read',\n 'load',\n (ref) => ({ op: 'listCustomXmlParts', owner: ref(this.#owner) }),\n (value) => {\n if (value.kind === 'null') return;\n const found = hydrated(value, 'customXmlParts', label).parts.find((p) => p.id === this.#id);\n if (found) fillPart(this, found);\n }\n );\n }\n}\n\n/** What both collections share: the reads of a list, filtered by namespace or not. */\nabstract class CustomXmlPartList extends ModelObject {\n readonly #namespaceUri: string | undefined;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, namespaceUri?: string) {\n super(context, path);\n this.#namespaceUri = namespaceUri;\n }\n\n /** The loaded parts. */\n get items(): CustomXmlPart[] {\n return this.loadedProperty<CustomXmlPart[]>('items');\n }\n\n /** The number of parts, after the next `sync()`. */\n getCount(): ClientResult<number> {\n const label = `${this.path.label}.getCount`;\n const { result, fill } = ClientResult.create<number>(label);\n this.enqueue(\n 'read',\n 'getCount',\n (ref) => this.#listing(ref),\n (value) => fill(hydrated(value, 'customXmlParts', label).parts.length)\n );\n return result;\n }\n\n /** The part with this id; `ItemNotFound` at the sync when there is none. */\n getItem(id: string): CustomXmlPart {\n const key = idOf(id, `${this.path.label}.getItem`);\n return this.find('getItem()', (all) => all.find((p) => p.id === key), key, false);\n }\n\n /** The part at a zero-based position; `ItemNotFound` at the sync when there is none. */\n getItemAt(index: number): CustomXmlPart {\n if (typeof index !== 'number' || !Number.isInteger(index) || index < 0)\n failArgument(`${this.path.label}.getItemAt`, 'a whole number of 0 or more');\n return this.find(`getItemAt(${index})`, (all) => all[index], undefined, false);\n }\n\n /** The part with this id, or a null object. */\n getItemOrNullObject(id: string): CustomXmlPart {\n const key = idOf(id, `${this.path.label}.getItemOrNullObject`);\n return this.find('getItemOrNullObject()', (all) => all.find((p) => p.id === key), key, true);\n }\n\n #listing(ref: RefOf): AutomationOperation {\n return {\n op: 'listCustomXmlParts',\n owner: ref(this.path),\n ...(this.#namespaceUri === undefined ? {} : { namespaceUri: this.#namespaceUri }),\n };\n }\n\n /** A part over a pending path that a read resolves to the owner, or null. */\n protected find(\n name: string,\n pick: (all: readonly Read[]) => Read | undefined,\n id: string | undefined,\n orNull: boolean\n ): CustomXmlPart {\n const path = ObjectPath.pending(`${this.path.label}.${name}`);\n const part = new CustomXmlPart(this.context, path, this.path, id ?? '', orNull);\n const label = path.label;\n this.enqueue(\n 'read',\n name,\n (ref) => this.#listing(ref),\n (value) => {\n const found = pick(hydrated(value, 'customXmlParts', label).parts);\n if (!found) {\n if (orNull) return path.resolveNull();\n fail({ code: 'ItemNotFound', target: label });\n }\n fillPart(part, found);\n path.resolveTo(this.path.handle());\n },\n path,\n false\n );\n return part;\n }\n\n /** @internal */\n protected override get loadsItemPaths(): boolean {\n return true;\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n for (const name of [...request.select, ...request.itemSelect])\n if (!['items', 'id', 'namespaceUri'].includes(name))\n failArgument(\n `${this.path.label}.${name}`,\n 'a property of custom XML parts: items, id, or namespaceUri',\n nearest(name, ['items', 'id', 'namespaceUri'])\n );\n const label = `${this.path.label}.items`;\n this.enqueue(\n 'read',\n 'items',\n (ref) => this.#listing(ref),\n (value) => {\n const all = hydrated(value, 'customXmlParts', label).parts;\n const end = request.top === undefined ? all.length : (request.skip ?? 0) + request.top;\n this.setLoadedProperty(\n 'items',\n all.slice(request.skip ?? 0, end).map((read, i) => {\n const path = ObjectPath.of(`${label}[${i}]`, this.path.handle());\n const part = new CustomXmlPart(this.context, path, this.path, read.id);\n fillPart(part, read);\n return part;\n })\n );\n }\n );\n }\n}\n\n/**\n * The custom XML parts of a presentation, slide, layout, master, or shape.\n *\n * @example\n * ```ts\n * await runtime.run(async (context) => {\n * const parts = context.presentation.customXmlParts;\n * const part = parts.add('<review xmlns=\"urn:example:review\"><status>open</status></review>');\n * part.load('id');\n * await context.sync();\n * console.log(part.id);\n * });\n * ```\n *\n * @public\n */\nexport class CustomXmlPartCollection extends CustomXmlPartList {\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath) {\n super(context, path);\n }\n\n /**\n * Add a part with this XML text. Text that is not well-formed XML, or that declares a DTD or\n * an entity, refuses with `InvalidArgument` at the sync.\n */\n add(xml: string): CustomXmlPart {\n const text = xmlOf(xml, `${this.path.label}.add`);\n const id = newItemId();\n const label = `${this.path.label}.add`;\n this.enqueue(\n 'write',\n 'add',\n (ref) => ({ op: 'addCustomXmlPart', owner: ref(this.path), xml: text, id }),\n (value) => void hydrated(value, 'customXmlParts', label)\n );\n return new CustomXmlPart(\n this.context,\n ObjectPath.derived(`${this.path.label}.add()`, this.path),\n this.path,\n id\n );\n }\n\n /** The parts whose root element has this namespace URI. */\n getByNamespace(namespaceUri: string): CustomXmlPartScopedCollection {\n if (typeof namespaceUri !== 'string')\n failArgument(`${this.path.label}.getByNamespace`, 'a namespace URI string');\n return new CustomXmlPartScopedCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.getByNamespace()`, this.path),\n namespaceUri\n );\n }\n}\n\n/**\n * The custom XML parts of one namespace, from `CustomXmlPartCollection.getByNamespace`.\n *\n * @public\n */\nexport class CustomXmlPartScopedCollection extends CustomXmlPartList {\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, namespaceUri: string) {\n super(context, path, namespaceUri);\n }\n\n /** The only part; `ItemNotFound` at the sync unless there is exactly one. */\n getOnlyItem(): CustomXmlPart {\n return this.find(\n 'getOnlyItem()',\n (all) => (all.length === 1 ? all[0] : undefined),\n undefined,\n false\n );\n }\n\n /** The only part, or a null object unless there is exactly one. */\n getOnlyItemOrNullObject(): CustomXmlPart {\n return this.find(\n 'getOnlyItemOrNullObject()',\n (all) => (all.length === 1 ? all[0] : undefined),\n undefined,\n true\n );\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Office.js `Tag` and `TagCollection`: the customer data tags of a presentation, slide, or shape\n// (`p:custDataLst/p:tags`, a `p:tagLst` part; ECMA-376 Part 1, 19.3.3.3). Keys are stored in\n// upper case, as the object model gives them.\n\nimport type { AutomationTag } from '@pptx-editor.dev/core/automation';\nimport { ClientResult } from '../runtime/client-result.ts';\nimport { fail, failArgument, nearest } from '../runtime/errors.ts';\nimport { hydrated } from '../runtime/hydrate.ts';\nimport type { ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport { ModelObject, text } from './model-object.ts';\n\n/** Fills a tag a read found: its key and value. Module-private, so no consumer can call it. */\nconst FILLERS = new WeakMap<Tag, (key: string, value: string) => void>();\n\nfunction fillTag(tag: Tag, key: string, value: string): void {\n FILLERS.get(tag)?.(key, value);\n}\n\n/**\n * One tag: a key and a value.\n *\n * @public\n */\nexport class Tag extends ModelObject {\n readonly #owner: ObjectPath;\n #key: string;\n\n /** @internal */\n constructor(\n context: RequestContext,\n path: ObjectPath,\n owner: ObjectPath,\n key: string,\n nullable = false\n ) {\n super(context, path, { nullable });\n this.#owner = owner;\n this.#key = key;\n if (key) this.setLoadedProperty('key', key);\n FILLERS.set(this, (k, v) => {\n this.#key = k;\n this.setLoadedProperty('key', k);\n this.setLoadedProperty('value', v);\n });\n }\n\n /** The key, in upper case. */\n get key(): string {\n return this.loadedProperty('key');\n }\n /** The value. */\n get value(): string {\n return this.loadedProperty('value');\n }\n set value(value: string) {\n const v = text(value, this.at('value'));\n // The tag's path resolves to its owner, so it names the owner once its lookup answered.\n this.command('value', (ref) => ({\n op: 'setTag',\n owner: ref(this.path),\n key: this.#key,\n value: v,\n }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, ['key', 'value']);\n const label = `${this.path.label}.load`;\n if (!names.includes('value')) return;\n this.enqueue(\n 'read',\n 'load',\n (ref) => ({ op: 'readTags', owner: ref(this.#owner) }),\n (value) => {\n if (value.kind === 'null') return;\n const tag = hydrated(value, 'tags', label).tags.find((t) => t.key === this.#key);\n if (tag) this.setLoadedProperty('value', tag.value);\n }\n );\n }\n}\n\n/** A tag key in upper case, or `InvalidArgument`. */\nfunction keyOf(value: unknown, target: string): string {\n if (typeof value !== 'string' || value.length === 0 || value.length > 255)\n failArgument(target, 'a key of 1 to 255 characters');\n return value.toUpperCase();\n}\n\n/**\n * The tags of a presentation, slide, or shape.\n *\n * @public\n */\nexport class TagCollection extends ModelObject {\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath) {\n super(context, path);\n }\n\n /** The loaded tags. */\n get items(): Tag[] {\n return this.loadedProperty<Tag[]>('items');\n }\n\n /** Add a tag, or set the value of the tag with this key. */\n add(key: string, value: string): void {\n const k = keyOf(key, `${this.path.label}.add`);\n const v = text(value, this.at('value'));\n this.command('add', (ref) => ({ op: 'setTag', owner: ref(this.path), key: k, value: v }));\n }\n\n /** Delete the tag with this key. `ItemNotFound` at the sync when there is none. */\n delete(key: string): void {\n const k = keyOf(key, `${this.path.label}.delete`);\n this.command('delete', (ref) => ({ op: 'deleteTag', owner: ref(this.path), key: k }));\n }\n\n /** The number of tags, after the next `sync()`. */\n getCount(): ClientResult<number> {\n const label = `${this.path.label}.getCount`;\n const { result, fill } = ClientResult.create<number>(label);\n this.enqueue(\n 'read',\n 'getCount',\n (ref) => ({ op: 'readTags', owner: ref(this.path) }),\n (value) => fill(hydrated(value, 'tags', label).tags.length)\n );\n return result;\n }\n\n /** The tag with this key; `ItemNotFound` at the sync when there is none. */\n getItem(key: string): Tag {\n const k = keyOf(key, `${this.path.label}.getItem`);\n return this.#find('getItem()', (tags) => tags.find((t) => t.key === k), k, false);\n }\n\n /** The tag at a zero-based position. */\n getItemAt(index: number): Tag {\n if (typeof index !== 'number' || !Number.isInteger(index) || index < 0)\n failArgument(`${this.path.label}.getItemAt`, 'a whole number of 0 or more');\n return this.#find(`getItemAt(${index})`, (tags) => tags[index], undefined, false);\n }\n\n /** The tag with this key, or a null object. */\n getItemOrNullObject(key: string): Tag {\n const k = keyOf(key, `${this.path.label}.getItemOrNullObject`);\n return this.#find('getItemOrNullObject()', (tags) => tags.find((t) => t.key === k), k, true);\n }\n\n /**\n * A tag over a pending path that a read of the tags resolves to the owner, or null. Its key is\n * known now for a lookup by key, and after the read for a lookup by position.\n */\n #find(\n name: string,\n pick: (tags: readonly AutomationTag[]) => AutomationTag | undefined,\n key: string | undefined,\n orNull: boolean\n ): Tag {\n const path = ObjectPath.pending(`${this.path.label}.${name}`);\n const tag = new Tag(this.context, path, this.path, key ?? '', orNull);\n const label = path.label;\n this.enqueue(\n 'read',\n name,\n (ref) => ({ op: 'readTags', owner: ref(this.path) }),\n (value) => {\n const found = pick(hydrated(value, 'tags', label).tags);\n if (!found) {\n if (orNull) return path.resolveNull();\n fail({ code: 'ItemNotFound', target: label });\n }\n fillTag(tag, found.key, found.value);\n path.resolveTo(this.path.handle());\n },\n path,\n false\n );\n return tag;\n }\n\n /** @internal */\n protected override get loadsItemPaths(): boolean {\n return true;\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n for (const name of [...request.select, ...request.itemSelect])\n if (!['items', 'key', 'value'].includes(name))\n failArgument(\n `${this.path.label}.${name}`,\n 'a property of tags: items, key, or value',\n nearest(name, ['items', 'key', 'value'])\n );\n const label = `${this.path.label}.items`;\n this.enqueue(\n 'read',\n 'items',\n (ref) => ({ op: 'readTags', owner: ref(this.path) }),\n (value) => {\n const tags = hydrated(value, 'tags', label).tags;\n const end = request.top === undefined ? tags.length : (request.skip ?? 0) + request.top;\n this.setLoadedProperty(\n 'items',\n tags.slice(request.skip ?? 0, end).map((t, i) => {\n const path = ObjectPath.of(`${label}[${i}]`, this.path.handle());\n const tag = new Tag(this.context, path, this.path, t.key);\n fillTag(tag, t.key, t.value);\n return tag;\n })\n );\n }\n );\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Office.js `ThemeColorScheme`: the `a:clrScheme` of the theme that the master of a slide, a\n// layout, or a master relates to (CT_ColorScheme, ECMA-376 Part 1, 20.1.6.2).\n\nimport { ClientResult } from '../runtime/client-result.ts';\nimport { hydrated } from '../runtime/hydrate.ts';\nimport type { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport { THEME_COLOR, type ThemeColor } from './enums.ts';\nimport { ModelObject, text } from './model-object.ts';\n\n/**\n * The theme colors of a slide, a layout, or a master. Every slide, layout, and master that uses\n * the same theme shares them, so a write changes all of them.\n *\n * @public\n */\nexport class ThemeColorScheme extends ModelObject {\n readonly #owner: ObjectPath;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, owner: ObjectPath) {\n super(context, path);\n this.#owner = owner;\n }\n\n /** One theme color as `#RRGGBB`. `Mixed` and `None` are `InvalidArgument`. */\n getThemeColor(color: ThemeColor): ClientResult<string>;\n /** One theme color as `#RRGGBB`. `Mixed` and `None` are `InvalidArgument`. */\n getThemeColor(\n color:\n | 'Accent1'\n | 'Accent2'\n | 'Accent3'\n | 'Accent4'\n | 'Accent5'\n | 'Accent6'\n | 'Dark1'\n | 'Dark2'\n | 'FollowedHyperlink'\n | 'Hyperlink'\n | 'Light1'\n | 'Light2'\n | 'Mixed'\n | 'None'\n ): ClientResult<string>;\n getThemeColor(color: ThemeColor | `${ThemeColor}`): ClientResult<string> {\n const label = this.at('getThemeColor');\n const slot = THEME_COLOR.toFile(color, label);\n const { result, fill } = ClientResult.create<string>(label);\n const owner = this.#owner;\n this.enqueue(\n 'read',\n 'getThemeColor',\n (ref) => ({ op: 'readThemeColor', owner: ref(owner), slot }),\n (value) => fill(hydrated(value, 'text', label).text)\n );\n return result;\n }\n\n /** Set one theme color: `#RRGGBB` or a preset color name. */\n setThemeColor(color: ThemeColor, rgbColor: string): void;\n /** Set one theme color: `#RRGGBB` or a preset color name. */\n setThemeColor(\n color:\n | 'Accent1'\n | 'Accent2'\n | 'Accent3'\n | 'Accent4'\n | 'Accent5'\n | 'Accent6'\n | 'Dark1'\n | 'Dark2'\n | 'FollowedHyperlink'\n | 'Hyperlink'\n | 'Light1'\n | 'Light2'\n | 'Mixed'\n | 'None',\n rgbColor: string\n ): void;\n setThemeColor(color: ThemeColor | `${ThemeColor}`, rgbColor: string): void {\n const slot = THEME_COLOR.toFile(color, this.at('setThemeColor'));\n const value = text(rgbColor, this.at('rgbColor'));\n const owner = this.#owner;\n this.command('setThemeColor', (ref) => ({\n op: 'setThemeColor',\n owner: ref(owner),\n slot,\n color: value,\n }));\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Slides, layouts, and masters: Office.js `Slide`, `SlideCollection`, `SlideScopedCollection`,\n// `SlideLayout`, `SlideLayoutCollection`, `SlideMaster`, and `SlideMasterCollection`.\n\nimport type {\n AutomationHandle,\n AutomationItemKey,\n AutomationOperation,\n AutomationValue,\n} from '@pptx-editor.dev/core/automation';\nimport { ClientResult } from '../runtime/client-result.ts';\nimport { fail, failArgument } from '../runtime/errors.ts';\nimport { hydrated } from '../runtime/hydrate.ts';\nimport type { ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport { SlideBackground, SlideLayoutBackground, SlideMasterBackground } from './backgrounds.ts';\nimport { ItemCollection } from './collection.ts';\nimport { LAYOUT_TYPE, type SlideLayoutType } from './enums.ts';\nimport { HyperlinkCollection } from './hyperlinks.ts';\nimport { imageBox, settleImage, type SlideGetImageOptions } from './images.ts';\nimport { ModelObject, pathOf, text, type RefOf } from './model-object.ts';\nimport { ShapeCollection } from './shapes.ts';\nimport { CustomXmlPartCollection } from './custom-xml.ts';\nimport { TagCollection } from './tags.ts';\nimport { ThemeColorScheme } from './theme.ts';\n\n/**\n * Options for `SlideCollection.add`.\n *\n * @public\n */\nexport interface AddSlideOptions {\n /** The layout of the new slide, by id. The first layout of the master when absent. */\n layoutId?: string;\n /** The master of the new slide, by id. The master of the last slide when absent. */\n slideMasterId?: string;\n}\n\n/**\n * A slide.\n *\n * @public\n */\nexport class Slide extends ModelObject {\n #shapes: ShapeCollection | undefined;\n #tags: TagCollection | undefined;\n #customXml: CustomXmlPartCollection | undefined;\n #hyperlinks: HyperlinkCollection | undefined;\n #layout: SlideLayout | undefined;\n #master: SlideMaster | undefined;\n #background: SlideBackground | undefined;\n #theme: ThemeColorScheme | undefined;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, nullable = false) {\n super(context, path, { nullable });\n }\n\n /** The slide id (`p:sldId/@id`). Stable across moves. */\n get id(): string {\n return this.loadedProperty('id');\n }\n\n /** The zero-based position of the slide. */\n get index(): number {\n return this.loadedProperty('index');\n }\n\n /** The shapes of the slide, in z-order. */\n get shapes(): ShapeCollection {\n return (this.#shapes ??= new ShapeCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.shapes`, this.path),\n this.path\n ));\n }\n\n /** The tags of the slide. */\n get tags(): TagCollection {\n return (this.#tags ??= new TagCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.tags`, this.path)\n ));\n }\n\n /** The custom XML parts of the slide. */\n get customXmlParts(): CustomXmlPartCollection {\n return (this.#customXml ??= new CustomXmlPartCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.customXmlParts`, this.path)\n ));\n }\n\n /** The hyperlinks of the slide: text links and shape click links. */\n get hyperlinks(): HyperlinkCollection {\n return (this.#hyperlinks ??= new HyperlinkCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.hyperlinks`, this.path),\n this.path\n ));\n }\n\n /** The background of the slide. */\n get background(): SlideBackground {\n return (this.#background ??= new SlideBackground(\n this.context,\n ObjectPath.derived(`${this.path.label}.background`, this.path),\n this.path\n ));\n }\n\n /** The theme colors of the slide: those of the theme of its master. */\n get themeColorScheme(): ThemeColorScheme {\n return (this.#theme ??= new ThemeColorScheme(\n this.context,\n ObjectPath.derived(`${this.path.label}.themeColorScheme`, this.path),\n this.path\n ));\n }\n\n /** The layout of the slide. */\n get layout(): SlideLayout {\n return (this.#layout ??= this.navigation(\n 'layout',\n (path) => new SlideLayout(this.context, path),\n (ref) => ({ op: 'getSlideLayout', slide: ref(this.path) })\n ));\n }\n\n /** The master of the slide. */\n get slideMaster(): SlideMaster {\n return (this.#master ??= this.navigation(\n 'slideMaster',\n (path) => new SlideMaster(this.context, path),\n (ref) => ({ op: 'getSlideMaster', owner: ref(this.path) })\n ));\n }\n\n /** Change the layout, re-mapping placeholders by type and index. */\n applyLayout(slideLayout: SlideLayout): void {\n const layout = pathOf(slideLayout);\n this.command('applyLayout', (ref) => ({\n op: 'applyLayout',\n slide: ref(this.path),\n layout: ref(layout),\n }));\n }\n\n /** Delete the slide. */\n delete(): void {\n this.command('delete', (ref) => ({ op: 'deleteSlide', slide: ref(this.path) }));\n }\n\n /** Move the slide to a zero-based position. */\n moveTo(slideIndex: number): void {\n if (typeof slideIndex !== 'number' || !Number.isInteger(slideIndex) || slideIndex < 0)\n failArgument(`${this.path.label}.moveTo`, 'a whole number of 0 or more');\n this.command('moveTo', (ref) => ({\n op: 'moveSlide',\n slide: ref(this.path),\n index: slideIndex,\n }));\n }\n\n /**\n * A PNG picture of the slide as base64, drawn by the editor's own renderer. A runtime over a\n * live editor in a browser draws pictures, and so does a server runtime created with a\n * `rasterize` option; any other runtime refuses with `NotSupported`.\n *\n * @example\n * ```ts\n * const image = slide.getImageAsBase64({ width: 640 });\n * await context.sync();\n * const png = `data:image/png;base64,${image.value}`;\n * ```\n */\n getImageAsBase64(options?: SlideGetImageOptions): ClientResult<string> {\n const target = this.at('getImageAsBase64');\n const box = imageBox(options, target, false);\n const { result, fill } = ClientResult.create<string>(target);\n this.enqueue(\n 'read',\n 'getImageAsBase64',\n (ref) => ({ op: 'prepareImage', target: ref(this.path), ...box }),\n settleImage(this.internals, box, target, fill)\n );\n return result;\n }\n\n /** The slide as a presentation of its own, Base64-encoded PPTX bytes. */\n exportAsBase64(): ClientResult<string> {\n const label = `${this.path.label}.exportAsBase64`;\n const { result, fill } = ClientResult.create<string>(label);\n this.enqueue(\n 'read',\n 'exportAsBase64',\n (ref) => ({ op: 'exportSlides', slides: [ref(this.path)] }),\n (value) => fill(hydrated(value, 'base64', label).base64)\n );\n return result;\n }\n\n /** Select shapes of this slide by id. A server runtime refuses with `NotSupported`. */\n setSelectedShapes(shapeIds: string[]): void {\n if (!Array.isArray(shapeIds)) failArgument('setSelectedShapes', 'an array of shape ids');\n const shapes = shapeIds.map((id) =>\n this.shapes.getItem(text(id, this.at('setSelectedShapes')))\n );\n this.command('setSelectedShapes', (ref) => ({\n op: 'selectShapes',\n shapes: shapes.map((shape) => ref(pathOf(shape))),\n }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, ['id', 'index'], {\n shapes: () => this.shapes,\n tags: () => this.tags,\n hyperlinks: () => this.hyperlinks,\n layout: () => this.layout,\n slideMaster: () => this.slideMaster,\n background: () => this.background,\n themeColorScheme: () => this.themeColorScheme,\n customXmlParts: () => this.customXmlParts,\n });\n this.loadScalars(\n names,\n 'slide',\n (ref) => ({ op: 'readSlide', slide: ref(this.path) }),\n (v) => ({ id: v.slide.id, index: v.slide.index })\n );\n }\n}\n\n/**\n * The slides of the presentation, in order.\n *\n * @public\n */\nexport class SlideCollection extends ItemCollection<Slide> {\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath) {\n super(context, path);\n }\n\n /** Add a slide at the end, from a layout and master by id. */\n add(options?: AddSlideOptions): void {\n const layoutId = options?.layoutId;\n const masterId = options?.slideMasterId;\n if (options !== undefined && (typeof options !== 'object' || options === null))\n failArgument('presentation.slides.add', 'an AddSlideOptions object');\n for (const key of Object.keys(options ?? {}))\n if (key !== 'layoutId' && key !== 'slideMasterId')\n fail({ code: 'NotImplemented', target: `presentation.slides.add.${key}` });\n // The host answers the new slide; the object model's `add` answers nothing.\n this.enqueue('write', 'add', () => ({\n op: 'addSlide',\n ...(layoutId === undefined ? {} : { layoutId: text(layoutId, this.at('layoutId')) }),\n ...(masterId === undefined ? {} : { masterId: text(masterId, this.at('slideMasterId')) }),\n }));\n }\n\n /** The listed slides as a presentation of their own, Base64-encoded PPTX bytes. */\n exportAsBase64Presentation(values: Array<string | Slide>): ClientResult<string> {\n if (!Array.isArray(values) || values.length === 0)\n failArgument(\n 'presentation.slides.exportAsBase64Presentation',\n 'a non-empty array of slides or slide ids'\n );\n const slides = values.map((v) => (typeof v === 'string' ? this.getItem(v) : v));\n const paths = slides.map((slide) => pathOf(slide));\n const label = `${this.path.label}.exportAsBase64Presentation`;\n const { result, fill } = ClientResult.create<string>(label);\n this.enqueue(\n 'read',\n 'exportAsBase64Presentation',\n (ref) => ({ op: 'exportSlides', slides: paths.map((p) => ref(p)) }),\n (value) => fill(hydrated(value, 'base64', label).base64)\n );\n return result;\n }\n\n /** A slide by id; `ItemNotFound` at the sync when there is none. */\n getItem(key: string): Slide {\n return this.find({ id: this.keyArg(key, 'getItem') }, 'getItem()', false);\n }\n\n /** A slide by zero-based position; `ItemNotFound` at the sync when there is none. */\n getItemAt(index: number): Slide {\n const at = this.indexArg(index);\n return this.find({ index: at }, `getItemAt(${at})`, false);\n }\n\n /** A slide by id, or a null object. */\n getItemOrNullObject(id: string): Slide {\n return this.find({ id: this.keyArg(id, 'getItemOrNullObject') }, 'getItemOrNullObject()', true);\n }\n\n /** @internal */\n protected listing(): AutomationOperation {\n return { op: 'listSlides' };\n }\n\n /** @internal */\n protected itemOf(path: ObjectPath, nullable: boolean): Slide {\n return new Slide(this.context, path, nullable);\n }\n\n /** @internal */\n protected lookup(_ref: RefOf, key: AutomationItemKey, orNull: boolean): AutomationOperation {\n return { op: 'getSlide', key, ...(orNull ? { orNull: true } : {}) };\n }\n}\n\n/**\n * A set of slides: the reader's selection.\n *\n * @public\n */\nexport class SlideScopedCollection extends ItemCollection<Slide> {\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, source: 'selection') {\n super(context, path);\n void source;\n }\n\n /** The slides as a presentation of their own, Base64-encoded PPTX bytes. */\n exportAsBase64Presentation(): ClientResult<string> {\n const label = `${this.path.label}.exportAsBase64Presentation`;\n const { result, fill } = ClientResult.create<string>(label);\n const listing = ObjectPath.pending(`${this.path.label}.items`);\n let slides: readonly AutomationHandle[] = [];\n this.enqueue(\n 'read',\n 'items',\n () => this.listing(),\n (value) => {\n slides = this.handlesOf(value, label);\n if (slides[0]) listing.resolveTo(slides[0]);\n else listing.resolveNull();\n },\n listing,\n false\n );\n this.enqueue(\n 'read',\n 'exportAsBase64Presentation',\n (ref) => {\n if (listing.isNull) fail({ code: 'ItemNotFound', target: label });\n ref(listing);\n return { op: 'exportSlides', slides };\n },\n (value) => fill(hydrated(value, 'base64', label).base64)\n );\n return result;\n }\n\n /** A selected slide by id; `ItemNotFound` at the sync when there is none. */\n getItem(key: string): Slide {\n return this.find({ id: this.keyArg(key, 'getItem') }, 'getItem()', false);\n }\n\n /** A selected slide by position in the selection. */\n getItemAt(index: number): Slide {\n const at = this.indexArg(index);\n return this.find({ index: at }, `getItemAt(${at})`, false);\n }\n\n /** A selected slide by id, or a null object. */\n getItemOrNullObject(id: string): Slide {\n return this.find({ id: this.keyArg(id, 'getItemOrNullObject') }, 'getItemOrNullObject()', true);\n }\n\n /** @internal */\n protected listing(): AutomationOperation {\n return { op: 'readSelection' };\n }\n\n /** @internal */\n protected override handlesOf(value: AutomationValue, label: string): readonly AutomationHandle[] {\n return hydrated(value, 'selection', label).selection.slides;\n }\n\n /** @internal */\n protected override get hasLookup(): boolean {\n return false;\n }\n\n /** @internal */\n protected itemOf(path: ObjectPath, nullable: boolean): Slide {\n return new Slide(this.context, path, nullable);\n }\n\n /** @internal */\n protected lookup(): undefined {\n return undefined;\n }\n}\n\nconst LAYOUT_NAMES = ['id', 'name', 'type'] as const;\n\n/**\n * A slide layout (`p:sldLayout`).\n *\n * @public\n */\nexport class SlideLayout extends ModelObject {\n #shapes: ShapeCollection | undefined;\n #background: SlideLayoutBackground | undefined;\n #theme: ThemeColorScheme | undefined;\n #customXml: CustomXmlPartCollection | undefined;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, nullable = false) {\n super(context, path, { nullable });\n }\n\n /** The layout id (`p:sldLayoutId/@id`). */\n get id(): string {\n return this.loadedProperty('id');\n }\n /** The layout name (`p:cSld/@name`). */\n get name(): string {\n return this.loadedProperty('name');\n }\n /** The layout type (`p:sldLayout/@type`). */\n get type(): SlideLayoutType | `${SlideLayoutType}` {\n return this.loadedProperty('type');\n }\n /** The shapes of the layout. */\n get shapes(): ShapeCollection {\n return (this.#shapes ??= new ShapeCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.shapes`, this.path),\n this.path\n ));\n }\n\n /** The background of the layout. */\n get background(): SlideLayoutBackground {\n return (this.#background ??= new SlideLayoutBackground(\n this.context,\n ObjectPath.derived(`${this.path.label}.background`, this.path),\n this.path\n ));\n }\n\n /** The custom XML parts of the layout. */\n get customXmlParts(): CustomXmlPartCollection {\n return (this.#customXml ??= new CustomXmlPartCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.customXmlParts`, this.path)\n ));\n }\n\n /** The theme colors of the layout: those of the theme of its master. */\n get themeColorScheme(): ThemeColorScheme {\n return (this.#theme ??= new ThemeColorScheme(\n this.context,\n ObjectPath.derived(`${this.path.label}.themeColorScheme`, this.path),\n this.path\n ));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, LAYOUT_NAMES, {\n shapes: () => this.shapes,\n background: () => this.background,\n themeColorScheme: () => this.themeColorScheme,\n customXmlParts: () => this.customXmlParts,\n });\n this.loadScalars(\n names,\n 'layout',\n (ref) => ({ op: 'readLayout', layout: ref(this.path) }),\n (v) => ({\n id: v.layout.id,\n name: v.layout.name,\n type: LAYOUT_TYPE.fromFile(v.layout.type) ?? 'Custom',\n })\n );\n }\n}\n\n/**\n * The layouts of a slide master, in `p:sldLayoutIdLst` order.\n *\n * @public\n */\nexport class SlideLayoutCollection extends ItemCollection<SlideLayout> {\n readonly #master: ObjectPath;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, master: ObjectPath) {\n super(context, path);\n this.#master = master;\n }\n\n /** A layout by id; `ItemNotFound` at the sync when there is none. */\n getItem(key: string): SlideLayout {\n return this.find({ id: this.keyArg(key, 'getItem') }, 'getItem()', false);\n }\n /** A layout by zero-based position. */\n getItemAt(index: number): SlideLayout {\n const at = this.indexArg(index);\n return this.find({ index: at }, `getItemAt(${at})`, false);\n }\n /** A layout by id, or a null object. */\n getItemOrNullObject(id: string): SlideLayout {\n return this.find({ id: this.keyArg(id, 'getItemOrNullObject') }, 'getItemOrNullObject()', true);\n }\n\n /** @internal */\n protected listing(ref: RefOf): AutomationOperation {\n return { op: 'listLayouts', master: ref(this.#master) };\n }\n /** @internal */\n protected itemOf(path: ObjectPath, nullable: boolean): SlideLayout {\n return new SlideLayout(this.context, path, nullable);\n }\n /** @internal */\n protected lookup(ref: RefOf, key: AutomationItemKey, orNull: boolean): AutomationOperation {\n return { op: 'getLayout', master: ref(this.#master), key, ...(orNull ? { orNull: true } : {}) };\n }\n}\n\n/**\n * A slide master (`p:sldMaster`).\n *\n * @public\n */\nexport class SlideMaster extends ModelObject {\n #layouts: SlideLayoutCollection | undefined;\n #shapes: ShapeCollection | undefined;\n #background: SlideMasterBackground | undefined;\n #theme: ThemeColorScheme | undefined;\n #customXml: CustomXmlPartCollection | undefined;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, nullable = false) {\n super(context, path, { nullable });\n }\n\n /** The master id (`p:sldMasterId/@id`). */\n get id(): string {\n return this.loadedProperty('id');\n }\n /** The master name (`p:cSld/@name`). */\n get name(): string {\n return this.loadedProperty('name');\n }\n /** The layouts of the master. */\n get layouts(): SlideLayoutCollection {\n return (this.#layouts ??= new SlideLayoutCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.layouts`, this.path),\n this.path\n ));\n }\n /** The shapes of the master. */\n get shapes(): ShapeCollection {\n return (this.#shapes ??= new ShapeCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.shapes`, this.path),\n this.path\n ));\n }\n\n /** The background of the master. */\n get background(): SlideMasterBackground {\n return (this.#background ??= new SlideMasterBackground(\n this.context,\n ObjectPath.derived(`${this.path.label}.background`, this.path),\n this.path\n ));\n }\n\n /** The custom XML parts of the master. */\n get customXmlParts(): CustomXmlPartCollection {\n return (this.#customXml ??= new CustomXmlPartCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.customXmlParts`, this.path)\n ));\n }\n\n /** The theme colors of the master: those of the theme of its master. */\n get themeColorScheme(): ThemeColorScheme {\n return (this.#theme ??= new ThemeColorScheme(\n this.context,\n ObjectPath.derived(`${this.path.label}.themeColorScheme`, this.path),\n this.path\n ));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, ['id', 'name'], {\n layouts: () => this.layouts,\n shapes: () => this.shapes,\n background: () => this.background,\n themeColorScheme: () => this.themeColorScheme,\n customXmlParts: () => this.customXmlParts,\n });\n this.loadScalars(\n names,\n 'layout',\n (ref) => ({ op: 'readMaster', master: ref(this.path) }),\n (v) => ({ id: v.layout.id, name: v.layout.name })\n );\n }\n}\n\n/**\n * The slide masters of the presentation, in `p:sldMasterIdLst` order.\n *\n * @public\n */\nexport class SlideMasterCollection extends ItemCollection<SlideMaster> {\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath) {\n super(context, path);\n }\n\n /** A master by id; `ItemNotFound` at the sync when there is none. */\n getItem(key: string): SlideMaster {\n return this.find({ id: this.keyArg(key, 'getItem') }, 'getItem()', false);\n }\n /** A master by zero-based position. */\n getItemAt(index: number): SlideMaster {\n const at = this.indexArg(index);\n return this.find({ index: at }, `getItemAt(${at})`, false);\n }\n /** A master by id, or a null object. */\n getItemOrNullObject(id: string): SlideMaster {\n return this.find({ id: this.keyArg(id, 'getItemOrNullObject') }, 'getItemOrNullObject()', true);\n }\n\n /** @internal */\n protected listing(): AutomationOperation {\n return { op: 'listMasters' };\n }\n /** @internal */\n protected itemOf(path: ObjectPath, nullable: boolean): SlideMaster {\n return new SlideMaster(this.context, path, nullable);\n }\n /** @internal */\n protected lookup(_ref: RefOf, key: AutomationItemKey, orNull: boolean): AutomationOperation {\n return { op: 'getMaster', key, ...(orNull ? { orNull: true } : {}) };\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Table format: Office.js `Borders`, `Border`, and `Margins` over one cell's `a:tcPr` (ECMA-376\n// Part 1, 21.1.3.17), and `TableStyleSettings` over `a:tblPr` (21.1.3.15). Weights and margins\n// are in points; transparency is 0 (opaque) to 1 (clear).\n\nimport type {\n AutomationCellAddress,\n AutomationCellBorderSide,\n AutomationLineRead,\n AutomationLineWrite,\n AutomationTableCellFormatRead,\n AutomationTableStyleWrite,\n} from '@pptx-editor.dev/core/automation';\nimport { diagnosticOf, fail, failArgument } from '../runtime/errors.ts';\nimport { isDefaultLoad, type ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport {\n DASH_STYLE,\n tableStyleName,\n tableStyleOf,\n type ShapeLineDashStyle,\n type TableStyle,\n} from './enums.ts';\nimport { fraction } from './fill-line.ts';\nimport { finite, flag, ModelObject, text } from './model-object.ts';\n\n/** The cell a format object writes through: the table shape and a grid position. */\ninterface CellTarget {\n readonly shape: ObjectPath;\n readonly cell: AutomationCellAddress;\n}\n\n/** An object over one cell's `a:tcPr`. */\nabstract class CellFormatPart extends ModelObject {\n /** @internal */\n protected readonly target: CellTarget;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, target: CellTarget) {\n super(context, path);\n this.target = target;\n }\n\n /** @internal Queue the cell format read that fills `names`. */\n protected loadCellFormat(\n names: readonly string[],\n project: (format: AutomationTableCellFormatRead) => Readonly<Record<string, unknown>>\n ): void {\n const { shape, cell } = this.target;\n this.loadScalars(\n names,\n 'tableCellFormat',\n (ref) => ({ op: 'readTableCellFormat', shape: ref(shape), cell }),\n (v) => project(v.format)\n );\n }\n}\n\n/** The values of one border, or undefined for each when the cell shows no line there. */\nfunction borderValues(line: AutomationLineRead): Readonly<Record<string, unknown>> {\n if (!line.visible)\n return { color: undefined, dashStyle: undefined, transparency: undefined, weight: undefined };\n return {\n color: line.color ?? undefined,\n dashStyle: DASH_STYLE.fromFile(line.dashStyle) ?? 'Solid',\n transparency: line.transparency ?? 0,\n weight: line.weight ?? undefined,\n };\n}\n\nconst BORDER_NAMES = ['color', 'dashStyle', 'transparency', 'weight'] as const;\n\n/**\n * One border of a table cell: an edge or a diagonal. It reads the line the cell shows, its own\n * or the table style's; a cell with no line there reads `undefined` for each property. A write\n * keeps the properties it does not set, and an outside edge also changes the cell across it.\n *\n * @public\n */\nexport class Border extends CellFormatPart {\n readonly #side: AutomationCellBorderSide;\n\n /** @internal */\n constructor(\n context: RequestContext,\n path: ObjectPath,\n target: CellTarget,\n side: AutomationCellBorderSide\n ) {\n super(context, path, target);\n this.#side = side;\n }\n\n /** The line color as `#RRGGBB`. A write also takes a preset color name. */\n get color(): string | undefined {\n return this.loadedProperty('color');\n }\n set color(value: string | undefined) {\n this.#write('color', { color: text(value, this.at('color')) });\n }\n /** The dash style. */\n get dashStyle(): ShapeLineDashStyle | `${ShapeLineDashStyle}` | undefined {\n return this.loadedProperty('dashStyle');\n }\n set dashStyle(value: ShapeLineDashStyle | `${ShapeLineDashStyle}` | undefined) {\n this.#write('dashStyle', { dashStyle: DASH_STYLE.toFile(value, this.at('dashStyle')) });\n }\n /** The transparency, from 0 (opaque) to 1 (clear). */\n get transparency(): number | undefined {\n return this.loadedProperty('transparency');\n }\n set transparency(value: number | undefined) {\n this.#write('transparency', { transparency: fraction(value, this.at('transparency')) });\n }\n /** The line weight, in points. */\n get weight(): number | undefined {\n return this.loadedProperty('weight');\n }\n set weight(value: number | undefined) {\n const weight = finite(value, this.at('weight'));\n if (weight < 0) failArgument(this.at('weight'), 'a weight of 0 or more points');\n this.#write('weight', { weight });\n }\n\n #write(name: string, line: AutomationLineWrite): void {\n const { shape, cell } = this.target;\n const side = this.#side;\n this.command(name, (ref) => ({\n op: 'setTableCellBorder',\n shape: ref(shape),\n cell,\n side,\n line,\n }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const side = this.#side;\n this.loadCellFormat(this.selection(request, BORDER_NAMES), (f) =>\n borderValues(f.borders[side])\n );\n }\n}\n\nconst SIDES = ['left', 'right', 'top', 'bottom', 'diagonalDown', 'diagonalUp'] as const;\n\n/**\n * The borders of a table cell (`a:tcPr/a:lnL`, `a:lnR`, `a:lnT`, `a:lnB`, `a:lnTlToBr`,\n * `a:lnBlToTr`).\n *\n * @public\n */\nexport class Borders extends CellFormatPart {\n readonly #sides = new Map<AutomationCellBorderSide, Border>();\n\n /** The bottom edge. */\n get bottom(): Border {\n return this.#side('bottom');\n }\n /** The diagonal from the top-left to the bottom-right corner. */\n get diagonalDown(): Border {\n return this.#side('diagonalDown');\n }\n /** The diagonal from the bottom-left to the top-right corner. */\n get diagonalUp(): Border {\n return this.#side('diagonalUp');\n }\n /** The left edge. */\n get left(): Border {\n return this.#side('left');\n }\n /** The right edge. */\n get right(): Border {\n return this.#side('right');\n }\n /** The top edge. */\n get top(): Border {\n return this.#side('top');\n }\n\n #side(side: AutomationCellBorderSide): Border {\n let border = this.#sides.get(side);\n if (!border) {\n border = new Border(\n this.context,\n ObjectPath.derived(`${this.path.label}.${side}`, this.path),\n this.target,\n side\n );\n this.#sides.set(side, border);\n }\n return border;\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const navigation = Object.fromEntries(SIDES.map((side) => [side, () => this.#side(side)]));\n // Every name is a navigation property: an empty selection loads all six borders.\n const names = isDefaultLoad(request) ? [...SIDES] : request.select;\n this.selection({ ...request, select: names }, [], navigation);\n }\n}\n\nconst MARGIN_NAMES = ['bottom', 'left', 'right', 'top'] as const;\n\n/**\n * The margins of a table cell, in points (`a:tcPr/@marL`, `@marR`, `@marT`, `@marB`). Writing\n * `undefined` removes the margin, back to its default (7.2 points left and right, 3.6 points\n * top and bottom).\n *\n * @public\n */\nexport class Margins extends CellFormatPart {\n /** The bottom margin, in points. */\n get bottom(): number | undefined {\n return this.loadedProperty('bottom');\n }\n set bottom(value: number | undefined) {\n this.#write('bottom', value);\n }\n /** The left margin, in points. */\n get left(): number | undefined {\n return this.loadedProperty('left');\n }\n set left(value: number | undefined) {\n this.#write('left', value);\n }\n /** The right margin, in points. */\n get right(): number | undefined {\n return this.loadedProperty('right');\n }\n set right(value: number | undefined) {\n this.#write('right', value);\n }\n /** The top margin, in points. */\n get top(): number | undefined {\n return this.loadedProperty('top');\n }\n set top(value: number | undefined) {\n this.#write('top', value);\n }\n\n #write(name: (typeof MARGIN_NAMES)[number], value: number | undefined): void {\n const margin = value === undefined ? null : finite(value, this.at(name));\n if (margin !== null && margin < 0) failArgument(this.at(name), 'a margin of 0 or more points');\n const { shape, cell } = this.target;\n this.command(name, (ref) => ({\n op: 'setTableCellMargins',\n shape: ref(shape),\n cell,\n margins: { [name]: margin },\n }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n this.loadCellFormat(this.selection(request, MARGIN_NAMES), (f) => ({ ...f.margins }));\n }\n}\n\n/** The style option flags, by their Office.js names. */\nconst STYLE_FLAGS = [\n ['areColumnsBanded', 'bandedColumns'],\n ['areRowsBanded', 'bandedRows'],\n ['isFirstColumnHighlighted', 'firstColumn'],\n ['isFirstRowHighlighted', 'firstRow'],\n ['isLastColumnHighlighted', 'lastColumn'],\n ['isLastRowHighlighted', 'lastRow'],\n] as const;\n\n/** A style that has no `TableStyle` value; reading `style` refuses. */\nconst UNKNOWN_STYLE = Symbol('unknown table style');\n\n/**\n * The style options and the style of a table (`a:tblPr`). A style is found by its name in the\n * presentation's `ppt/tableStyles.xml`: `MediumStyle2Accent1` is \"Medium Style 2 - Accent 1\".\n * The presentation must define the style, except `MediumStyle2Accent1`, which is built in, and\n * `NoStyleNoGrid`, which removes the style choice.\n *\n * @public\n */\nexport class TableStyleSettings extends ModelObject {\n readonly #shape: ObjectPath;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, shape: ObjectPath) {\n super(context, path);\n this.#shape = shape;\n }\n\n /** Whether the columns show banded formatting (`a:tblPr/@bandCol`). */\n get areColumnsBanded(): boolean {\n return this.loadedProperty('areColumnsBanded');\n }\n set areColumnsBanded(value: boolean) {\n this.#flag('areColumnsBanded', 'bandedColumns', value);\n }\n /** Whether the rows show banded formatting (`a:tblPr/@bandRow`). */\n get areRowsBanded(): boolean {\n return this.loadedProperty('areRowsBanded');\n }\n set areRowsBanded(value: boolean) {\n this.#flag('areRowsBanded', 'bandedRows', value);\n }\n /** Whether the first column has its own format (`a:tblPr/@firstCol`). */\n get isFirstColumnHighlighted(): boolean {\n return this.loadedProperty('isFirstColumnHighlighted');\n }\n set isFirstColumnHighlighted(value: boolean) {\n this.#flag('isFirstColumnHighlighted', 'firstColumn', value);\n }\n /** Whether the first row has its own format (`a:tblPr/@firstRow`). */\n get isFirstRowHighlighted(): boolean {\n return this.loadedProperty('isFirstRowHighlighted');\n }\n set isFirstRowHighlighted(value: boolean) {\n this.#flag('isFirstRowHighlighted', 'firstRow', value);\n }\n /** Whether the last column has its own format (`a:tblPr/@lastCol`). */\n get isLastColumnHighlighted(): boolean {\n return this.loadedProperty('isLastColumnHighlighted');\n }\n set isLastColumnHighlighted(value: boolean) {\n this.#flag('isLastColumnHighlighted', 'lastColumn', value);\n }\n /** Whether the last row has its own format (`a:tblPr/@lastRow`). */\n get isLastRowHighlighted(): boolean {\n return this.loadedProperty('isLastRowHighlighted');\n }\n set isLastRowHighlighted(value: boolean) {\n this.#flag('isLastRowHighlighted', 'lastRow', value);\n }\n /**\n * The table style. A table with no style reads `NoStyleNoGrid`. A style whose name has no\n * `TableStyle` value refuses the read with `NotImplemented`.\n */\n get style(): TableStyle | `${TableStyle}` {\n const value = this.loadedProperty<`${TableStyle}` | typeof UNKNOWN_STYLE>('style');\n if (value === UNKNOWN_STYLE)\n fail({\n code: 'NotImplemented',\n target: this.at('style'),\n diagnostic: diagnosticOf('table-style-unknown')!,\n });\n return value;\n }\n set style(value: TableStyle | `${TableStyle}`) {\n this.#write('style', { styleName: tableStyleName(value, this.at('style')) });\n }\n\n #flag(\n name: string,\n key: Exclude<keyof AutomationTableStyleWrite, 'styleName'>,\n value: boolean\n ): void {\n this.#write(name, { [key]: flag(value, this.at(name)) });\n }\n\n #write(name: string, style: AutomationTableStyleWrite): void {\n const shape = this.#shape;\n this.command(name, (ref) => ({ op: 'setTableStyle', shape: ref(shape), style }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, [...STYLE_FLAGS.map(([n]) => n), 'style']);\n const shape = this.#shape;\n this.loadScalars(\n names,\n 'table',\n (ref) => ({ op: 'readTable', shape: ref(shape) }),\n ({ table: { style } }) => {\n const out: Record<string, unknown> = {};\n for (const [name, key] of STYLE_FLAGS) out[name] = style[key];\n out.style =\n style.styleId === null && style.styleName === null\n ? 'NoStyleNoGrid'\n : ((style.styleName === null ? null : tableStyleOf(style.styleName)) ?? UNKNOWN_STYLE);\n return out;\n }\n );\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Office.js `TableCell` over one `a:tc` (ECMA-376 Part 1, 21.1.3.16). A covered grid position\n// addresses the anchor cell of the merged block that covers it. The cell's text body takes the\n// same text, font, and paragraph operations as a shape's, with the cell as their target.\n\nimport type {\n AutomationCellAddress,\n AutomationFontWrite,\n AutomationOperation,\n AutomationTextRunRead,\n} from '@pptx-editor.dev/core/automation';\nimport { failArgument, nearest, oneOf } from '../runtime/errors.ts';\nimport type { ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport {\n HORIZONTAL_ALIGNMENT,\n UNDERLINE,\n VERTICAL_ALIGNMENT,\n type ParagraphHorizontalAlignment,\n type ShapeFontUnderlineStyle,\n type TextVerticalAlignment,\n} from './enums.ts';\nimport { ShapeFill } from './fill-line.ts';\nimport { finite, ModelObject, text, type RefOf } from './model-object.ts';\nimport { Borders, Margins } from './table-format.ts';\nimport { ParagraphFormat, ShapeFont } from './text.ts';\n\n/**\n * Character formatting for one run of `TableCell.textRuns`. In a write, an absent property\n * keeps the cell's format. A read gives every property, except `color` when the text has no\n * solid fill.\n *\n * @public\n */\nexport interface FontProperties {\n allCaps?: boolean | undefined;\n bold?: boolean | undefined;\n /** `#RRGGBB` or a preset color name. */\n color?: string | undefined;\n doubleStrikethrough?: boolean | undefined;\n italic?: boolean | undefined;\n name?: string | undefined;\n /** Points. */\n size?: number | undefined;\n smallCaps?: boolean | undefined;\n strikethrough?: boolean | undefined;\n subscript?: boolean | undefined;\n superscript?: boolean | undefined;\n underline?: ShapeFontUnderlineStyle | `${ShapeFontUnderlineStyle}` | undefined;\n}\n\n/**\n * One run of text with its own format, for `TableCell.textRuns`.\n *\n * @public\n */\nexport interface TextRun {\n font?: FontProperties | undefined;\n text: string;\n}\n\nconst FONT_KEYS = new Set([\n 'allCaps',\n 'bold',\n 'color',\n 'doubleStrikethrough',\n 'italic',\n 'name',\n 'size',\n 'smallCaps',\n 'strikethrough',\n 'subscript',\n 'superscript',\n 'underline',\n]);\n\n/** The checked font write of one run, or undefined when the run keeps the cell's format. */\nfunction runFont(\n font: FontProperties | undefined,\n target: string\n): AutomationFontWrite | undefined {\n if (font === undefined) return undefined;\n if (typeof font !== 'object' || font === null)\n failArgument(target, 'an object of font properties');\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(font)) {\n if (!FONT_KEYS.has(key))\n failArgument(\n `${target}.${key}`,\n `a font property: ${oneOf([...FONT_KEYS])}`,\n nearest(key, [...FONT_KEYS])\n );\n if (value === undefined) continue;\n out[key] = key === 'underline' ? UNDERLINE.toFile(value, `${target}.underline`) : value;\n }\n return Object.keys(out).length === 0 ? undefined : (out as AutomationFontWrite);\n}\n\n/** A positive whole number, or `InvalidArgument`. */\nfunction count(value: unknown, target: string): number {\n if (typeof value !== 'number' || !Number.isInteger(value) || value < 1)\n failArgument(target, 'a whole number of 1 or more');\n return value;\n}\n\n/** The span of a cell a collection read already knows. */\nexport interface CellSpan {\n readonly rowIndex: number;\n readonly columnIndex: number;\n readonly rowCount: number;\n readonly columnCount: number;\n}\n\n/** Fills the span of a cell from a collection read. Module-private: no consumer can call it. */\nexport const CELL_SPANS = new WeakMap<TableCell, (span: CellSpan) => void>();\n\n/**\n * One cell of a table.\n *\n * @public\n */\nexport class TableCell extends ModelObject {\n readonly #cell: AutomationCellAddress;\n #font: ShapeFont | undefined;\n #fill: ShapeFill | undefined;\n #paragraph: ParagraphFormat | undefined;\n #borders: Borders | undefined;\n #margins: Margins | undefined;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, row: number, column: number) {\n super(context, path, { nullable: true });\n this.#cell = Object.freeze({ row, column });\n CELL_SPANS.set(this, (span) => {\n for (const [name, value] of Object.entries(span)) this.setLoadedProperty(name, value);\n });\n }\n\n /** The text of the cell. */\n get text(): string {\n return this.loadedProperty('text');\n }\n set text(value: string) {\n const body = text(value, this.at('text'));\n this.#command('text', { op: 'setTableCell', ...this.#cell, text: body });\n }\n /** The zero-based row of the cell; the first row of its merged area. */\n get rowIndex(): number {\n return this.loadedProperty('rowIndex');\n }\n /** The zero-based column of the cell; the first column of its merged area. */\n get columnIndex(): number {\n return this.loadedProperty('columnIndex');\n }\n /** How many rows the cell spans. */\n get rowCount(): number {\n return this.loadedProperty('rowCount');\n }\n /** How many columns the cell spans. */\n get columnCount(): number {\n return this.loadedProperty('columnCount');\n }\n /** The character format of the cell's text. */\n get font(): ShapeFont {\n return (this.#font ??= new ShapeFont(\n this.context,\n ObjectPath.derived(`${this.path.label}.font`, this.path),\n this.path,\n () => undefined,\n this.#cell\n ));\n }\n /** The borders of the cell (`a:tcPr` lines). */\n get borders(): Borders {\n return (this.#borders ??= new Borders(\n this.context,\n ObjectPath.derived(`${this.path.label}.borders`, this.path),\n { shape: this.path, cell: this.#cell }\n ));\n }\n /** The margins of the cell (`a:tcPr/@marL` and the like), in points. */\n get margins(): Margins {\n return (this.#margins ??= new Margins(\n this.context,\n ObjectPath.derived(`${this.path.label}.margins`, this.path),\n { shape: this.path, cell: this.#cell }\n ));\n }\n /** The cell's fill (`a:tcPr`). */\n get fill(): ShapeFill {\n return (this.#fill ??= new ShapeFill(\n this.context,\n ObjectPath.derived(`${this.path.label}.fill`, this.path),\n { kind: 'cell', shape: this.path, cell: this.#cell }\n ));\n }\n /** The horizontal alignment of the cell's paragraphs (`a:pPr/@algn`). */\n get horizontalAlignment():\n ParagraphHorizontalAlignment | `${ParagraphHorizontalAlignment}` | null {\n return this.loadedProperty('horizontalAlignment');\n }\n set horizontalAlignment(\n value: ParagraphHorizontalAlignment | `${ParagraphHorizontalAlignment}` | null\n ) {\n this.#paragraphs().horizontalAlignment = value;\n }\n /** The indent level of the cell's paragraphs, from 1; null when they differ. */\n get indentLevel(): number | null {\n return this.loadedProperty('indentLevel');\n }\n set indentLevel(value: number | null) {\n this.#paragraphs().indentLevel = finite(value, this.at('indentLevel'));\n }\n /**\n * The vertical alignment of the cell's text (`a:tcPr/@anchor`); the `…Centered` values also\n * set `@anchorCtr` (ECMA-376 Part 1, 21.1.3.17).\n */\n get verticalAlignment(): TextVerticalAlignment | `${TextVerticalAlignment}` {\n return this.loadedProperty('verticalAlignment');\n }\n set verticalAlignment(value: TextVerticalAlignment | `${TextVerticalAlignment}`) {\n const file = VERTICAL_ALIGNMENT.toFile(value, `${this.path.label}.verticalAlignment`);\n const anchorCenter = file.endsWith('Centered');\n const anchor = anchorCenter ? file.slice(0, -'Centered'.length) : file;\n this.#command('verticalAlignment', {\n op: 'setTableCellAnchor',\n ...this.#cell,\n anchor,\n anchorCenter,\n });\n }\n /**\n * The cell's text as runs, each with its own character format. Neighbouring text with the\n * same format reads as one run, and the run texts join to `text`. A write replaces the text\n * with the runs in one sync.\n */\n get textRuns(): TextRun[] {\n return this.loadedProperty('textRuns');\n }\n set textRuns(value: TextRun[]) {\n const target = `${this.path.label}.textRuns`;\n if (!Array.isArray(value)) failArgument(target, 'an array of text runs');\n let start = 0;\n const formats: { span: { start: number; length: number }; font: AutomationFontWrite }[] = [];\n const whole = value\n .map((run, i) => {\n if (typeof run !== 'object' || run === null || typeof run.text !== 'string')\n failArgument(`${target}[${i}]`, 'a text run with a text string');\n const font = runFont(run.font, `${target}[${i}].font`);\n // The engine writes one paragraph break for `\\r\\n`; count it as one, so the spans\n // that follow still match the written text.\n const piece = run.text.replace(/\\r\\n|\\n/g, '\\r');\n if (font && piece.length > 0) formats.push({ span: { start, length: piece.length }, font });\n start += piece.length;\n return piece;\n })\n .join('');\n const cell = this.#cell;\n this.command('textRuns', (ref) => ({\n op: 'setText',\n shape: ref(this.path),\n text: whole,\n cell,\n }));\n for (const { span, font } of formats)\n this.command('textRuns', (ref) => ({\n op: 'setFont',\n shape: ref(this.path),\n span,\n font,\n cell,\n }));\n }\n\n /** Make the cell span `rowCount` rows and `columnCount` columns from its first grid position. */\n resize(rowCount: number, columnCount: number): void {\n const target = `${this.path.label}.resize`;\n this.#command('resize', {\n op: 'resizeTableCell',\n ...this.#cell,\n rowCount: count(rowCount, target),\n columnCount: count(columnCount, target),\n });\n }\n\n /** Split the cell into `rowCount` rows and `columnCount` columns of cells. */\n split(rowCount: number, columnCount: number): void {\n const target = `${this.path.label}.split`;\n this.#command('split', {\n op: 'splitTableCell',\n ...this.#cell,\n rowCount: count(rowCount, target),\n columnCount: count(columnCount, target),\n });\n }\n\n #paragraphs(): ParagraphFormat {\n return (this.#paragraph ??= new ParagraphFormat(\n this.context,\n ObjectPath.derived(`${this.path.label}.paragraphFormat`, this.path),\n this.path,\n () => undefined,\n this.#cell\n ));\n }\n\n /** Queue a command on the table shape: `op` without its `shape`. */\n #command(name: string, op: DistributiveOmit<AutomationOperation, 'shape'>): void {\n this.command(name, (ref: RefOf) => ({ ...op, shape: ref(this.path) }) as AutomationOperation);\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(\n request,\n [\n 'text',\n 'rowIndex',\n 'columnIndex',\n 'rowCount',\n 'columnCount',\n 'verticalAlignment',\n 'horizontalAlignment',\n 'indentLevel',\n 'textRuns',\n ],\n {\n font: () => this.font,\n fill: () => this.fill,\n borders: () => this.borders,\n margins: () => this.margins,\n }\n );\n const cell = this.#cell;\n const fromCell = names.filter(\n (n) => n !== 'horizontalAlignment' && n !== 'indentLevel' && n !== 'textRuns'\n );\n this.loadScalars(\n fromCell,\n 'tableCell',\n (ref) => ({ op: 'readTableCell', shape: ref(this.path), ...cell }),\n (v) => ({\n ...v.cell,\n verticalAlignment: VERTICAL_ALIGNMENT.fromFile(\n v.cell.anchor + (v.cell.anchorCenter ? 'Centered' : '')\n ),\n })\n );\n this.loadScalars(\n names.filter((n) => n === 'textRuns'),\n 'textRuns',\n (ref) => ({ op: 'readTextRuns', shape: ref(this.path), cell }),\n (v) => ({ textRuns: v.runs.map(runOf) })\n );\n const fromParagraphs = names.filter((n) => n === 'horizontalAlignment' || n === 'indentLevel');\n this.loadScalars(\n fromParagraphs,\n 'paragraph',\n (ref) => ({ op: 'readParagraph', shape: ref(this.path), cell }),\n (v) => ({\n horizontalAlignment: HORIZONTAL_ALIGNMENT.fromFile(v.paragraph.alignment),\n indentLevel: v.paragraph.indentLevel,\n })\n );\n }\n}\n\n/** A run the host read, as the Office.js `TextRun`: a font property that is unknown is absent. */\nfunction runOf(run: AutomationTextRunRead): TextRun {\n const { underline, ...rest } = run.font;\n const font: FontProperties = {};\n for (const [key, value] of Object.entries(rest))\n if (value !== null) (font as Record<string, unknown>)[key] = value;\n const style = underline === null ? null : UNDERLINE.fromFile(underline);\n if (style) font.underline = style;\n return { text: run.text, font };\n}\n\n/** `Omit` over each member of a union. */\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// The options of `ShapeCollection.addTable`: Office.js `TableAddOptions` and the data types it\n// names (`TableCellProperties`, `TableCellBorders`, `BorderProperties`, `TableCellMargins`,\n// `FillProperties`, `TableColumnProperties`, `TableRowProperties`, `TableMergedAreaProperties`).\n// Every option is checked before anything is queued, so a bad option adds no table.\n\nimport { failArgument, nearest, oneOf } from '../runtime/errors.ts';\nimport {\n DASH_STYLE,\n HORIZONTAL_ALIGNMENT,\n tableStyleName,\n UNDERLINE,\n VERTICAL_ALIGNMENT,\n type ParagraphHorizontalAlignment,\n type ShapeLineDashStyle,\n type TableStyle,\n type TextVerticalAlignment,\n} from './enums.ts';\nimport { fraction } from './fill-line.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport { finite, pathOf } from './model-object.ts';\nimport { TableCell, type FontProperties, type TextRun } from './table-cell.ts';\nimport type { Table } from './tables.ts';\n\n/**\n * One line of a cell, for `TableCellBorders`.\n *\n * @public\n */\nexport interface BorderProperties {\n /** `#RRGGBB` or a preset color name. */\n color?: string | undefined;\n dashStyle?: ShapeLineDashStyle | `${ShapeLineDashStyle}` | undefined;\n /** From 0 (opaque) to 1 (clear). */\n transparency?: number | undefined;\n /** Points. */\n weight?: number | undefined;\n}\n\n/**\n * The lines of a cell, for `TableCellProperties`.\n *\n * @public\n */\nexport interface TableCellBorders {\n bottom?: BorderProperties | undefined;\n diagonalDown?: BorderProperties | undefined;\n diagonalUp?: BorderProperties | undefined;\n left?: BorderProperties | undefined;\n right?: BorderProperties | undefined;\n top?: BorderProperties | undefined;\n}\n\n/**\n * The margins of a cell in points, for `TableCellProperties`.\n *\n * @public\n */\nexport interface TableCellMargins {\n bottom?: number | undefined;\n left?: number | undefined;\n right?: number | undefined;\n top?: number | undefined;\n}\n\n/**\n * A solid fill, for `TableCellProperties`.\n *\n * @public\n */\nexport interface FillProperties {\n /** `#RRGGBB` or a preset color name. */\n color?: string | undefined;\n /** From 0 (opaque) to 1 (clear). */\n transparency?: number | undefined;\n}\n\n/**\n * The format and content of a cell, for `TableAddOptions`.\n *\n * @public\n */\nexport interface TableCellProperties {\n borders?: TableCellBorders | undefined;\n fill?: FillProperties | undefined;\n font?: FontProperties | undefined;\n horizontalAlignment?:\n ParagraphHorizontalAlignment | `${ParagraphHorizontalAlignment}` | undefined;\n indentLevel?: number | undefined;\n margins?: TableCellMargins | undefined;\n text?: string | undefined;\n textRuns?: TextRun[] | undefined;\n verticalAlignment?: TextVerticalAlignment | `${TextVerticalAlignment}` | undefined;\n}\n\n/**\n * One column of a new table, for `TableAddOptions`.\n *\n * @public\n */\nexport interface TableColumnProperties {\n /** Points. */\n columnWidth?: number | undefined;\n}\n\n/**\n * One row of a new table, for `TableAddOptions`.\n *\n * @public\n */\nexport interface TableRowProperties {\n /** Points. */\n rowHeight?: number | undefined;\n}\n\n/**\n * One merged area of a new table, for `TableAddOptions`.\n *\n * @public\n */\nexport interface TableMergedAreaProperties {\n columnCount: number;\n columnIndex: number;\n rowCount: number;\n rowIndex: number;\n}\n\n/**\n * Options for `ShapeCollection.addTable`. They apply in this order: `values`, `style`, the\n * column widths and row heights, `mergedAreas`, `uniformCellProperties`, then\n * `specificCellProperties`.\n *\n * @public\n */\nexport interface TableAddOptions {\n /** One entry for each column. */\n columns?: TableColumnProperties[] | undefined;\n height?: number | undefined;\n left?: number | undefined;\n mergedAreas?: TableMergedAreaProperties[] | undefined;\n /** One entry for each row. */\n rows?: TableRowProperties[] | undefined;\n /** The properties of each cell, by row then column. Its size must equal the table's. */\n specificCellProperties?: TableCellProperties[][] | undefined;\n style?: TableStyle | `${TableStyle}` | undefined;\n top?: number | undefined;\n /** The properties of every cell. */\n uniformCellProperties?: TableCellProperties | undefined;\n /** The text of each cell, by row then column. Its size must equal the table's. */\n values?: string[][] | undefined;\n width?: number | undefined;\n}\n\n/**\n * A cell of a table that the same batch adds. Its path names the new shape directly, so the\n * writes need no read first: a read of a new object cannot go before the batch's writes.\n */\nfunction newCell(table: Table, row: number, column: number): TableCell {\n const at = pathOf(table);\n const label = `${at.label}.getCellOrNullObject(${row}, ${column})`;\n return new TableCell(table.context, ObjectPath.derived(label, at), row, column);\n}\n\n/** The checked options, ready to apply after the table exists. */\nexport interface TablePlan {\n readonly values: string[][] | undefined;\n readonly apply: (table: Table) => void;\n}\n\n/** An options object with only `names`, or `InvalidArgument` naming the first other key. */\nfunction record(value: unknown, names: readonly string[], target: string): Record<string, unknown> {\n if (typeof value !== 'object' || value === null || Array.isArray(value))\n failArgument(target, 'an object of options');\n for (const key of Object.keys(value))\n if (!names.includes(key))\n failArgument(`${target}.${key}`, `an option name: ${oneOf(names)}`, nearest(key, names));\n return value as Record<string, unknown>;\n}\n\nfunction string(value: unknown, target: string): string {\n if (typeof value !== 'string') failArgument(target, 'a string');\n return value;\n}\n\nfunction positive(value: unknown, target: string): number {\n const n = finite(value, target);\n if (n <= 0) failArgument(target, 'a number greater than 0');\n return n;\n}\n\nfunction nonNegative(value: unknown, target: string): number {\n const n = finite(value, target);\n if (n < 0) failArgument(target, 'a number of 0 or more');\n return n;\n}\n\nfunction wholeIn(value: unknown, min: number, max: number, target: string): number {\n if (typeof value !== 'number' || !Number.isInteger(value) || value < min || value > max)\n failArgument(target, `a whole number from ${min} to ${max}`);\n return value;\n}\n\n/** An array of `length` entries, or `InvalidArgument`. */\nfunction list(value: unknown, length: number | undefined, target: string): unknown[] {\n if (!Array.isArray(value) || (length !== undefined && value.length !== length))\n failArgument(\n target,\n length === undefined\n ? 'an array'\n : `an array of ${length} entries, one for each ${target.endsWith('values') || target.endsWith('rows') || target.endsWith('specificCellProperties') ? 'row' : 'entry'}`\n );\n return value;\n}\n\nconst BORDER_KEYS = ['color', 'dashStyle', 'transparency', 'weight'];\nconst SIDES = ['bottom', 'diagonalDown', 'diagonalUp', 'left', 'right', 'top'] as const;\nconst MARGIN_KEYS = ['bottom', 'left', 'right', 'top'] as const;\nconst FONT_KEYS = [\n 'allCaps',\n 'bold',\n 'color',\n 'doubleStrikethrough',\n 'italic',\n 'name',\n 'size',\n 'smallCaps',\n 'strikethrough',\n 'subscript',\n 'superscript',\n 'underline',\n] as const;\nconst CELL_KEYS = [\n 'borders',\n 'fill',\n 'font',\n 'horizontalAlignment',\n 'indentLevel',\n 'margins',\n 'text',\n 'textRuns',\n 'verticalAlignment',\n];\n\n/** Check one `FontProperties`, as the `ShapeFont` setters check each value. */\nfunction checkFont(value: unknown, target: string): void {\n const font = record(value, FONT_KEYS, target);\n for (const key of FONT_KEYS) {\n const v = font[key];\n const at = `${target}.${key}`;\n if (v === undefined) continue;\n if (key === 'underline') UNDERLINE.toFile(v, at);\n else if (key === 'name' || key === 'color') string(v, at);\n else if (key === 'size') positive(v, at);\n else if (typeof v !== 'boolean') failArgument(at, 'true or false');\n }\n}\n\n/** Check one `TableCellProperties`; answer the function that applies it to a cell. */\nfunction checkCell(value: unknown, target: string): (cell: TableCell) => void {\n const props = record(value, CELL_KEYS, target);\n const steps: ((cell: TableCell) => void)[] = [];\n const { borders, fill, font, horizontalAlignment, indentLevel, margins, text, textRuns } = props;\n if (text !== undefined && textRuns !== undefined)\n failArgument(`${target}.textRuns`, 'text or textRuns, not both');\n if (text !== undefined) {\n const t = string(text, `${target}.text`);\n steps.push((cell) => (cell.text = t));\n }\n if (textRuns !== undefined) {\n const runs = list(textRuns, undefined, `${target}.textRuns`).map((run, i) => {\n const r = record(run, ['font', 'text'], `${target}.textRuns[${i}]`);\n string(r.text, `${target}.textRuns[${i}].text`);\n if (r.font !== undefined) checkFont(r.font, `${target}.textRuns[${i}].font`);\n return run as TextRun;\n });\n steps.push((cell) => (cell.textRuns = runs));\n }\n if (font !== undefined) {\n checkFont(font, `${target}.font`);\n const f = font as Record<string, unknown>;\n steps.push((cell) => {\n for (const key of FONT_KEYS)\n if (f[key] !== undefined) (cell.font as unknown as Record<string, unknown>)[key] = f[key];\n });\n }\n if (fill !== undefined) {\n const p = record(fill, ['color', 'transparency'], `${target}.fill`);\n const color = p.color === undefined ? undefined : string(p.color, `${target}.fill.color`);\n const t =\n p.transparency === undefined\n ? undefined\n : fraction(p.transparency, `${target}.fill.transparency`);\n steps.push((cell) => {\n if (color !== undefined) cell.fill.setSolidColor(color);\n if (t !== undefined) cell.fill.transparency = t;\n });\n }\n if (horizontalAlignment !== undefined) {\n HORIZONTAL_ALIGNMENT.toFile(horizontalAlignment, `${target}.horizontalAlignment`);\n const a = horizontalAlignment as `${ParagraphHorizontalAlignment}`;\n steps.push((cell) => (cell.horizontalAlignment = a));\n }\n if (indentLevel !== undefined) {\n const n = finite(indentLevel, `${target}.indentLevel`);\n steps.push((cell) => (cell.indentLevel = n));\n }\n if (props.verticalAlignment !== undefined) {\n VERTICAL_ALIGNMENT.toFile(props.verticalAlignment, `${target}.verticalAlignment`);\n const a = props.verticalAlignment as `${TextVerticalAlignment}`;\n steps.push((cell) => (cell.verticalAlignment = a));\n }\n if (margins !== undefined) {\n const m = record(margins, MARGIN_KEYS, `${target}.margins`);\n for (const key of MARGIN_KEYS)\n if (m[key] !== undefined) {\n const n = nonNegative(m[key], `${target}.margins.${key}`);\n steps.push((cell) => (cell.margins[key] = n));\n }\n }\n if (borders !== undefined) {\n const b = record(borders, SIDES, `${target}.borders`);\n for (const side of SIDES) {\n if (b[side] === undefined) continue;\n const at = `${target}.borders.${side}`;\n const line = record(b[side], BORDER_KEYS, at);\n if (line.color !== undefined) string(line.color, `${at}.color`);\n if (line.dashStyle !== undefined) DASH_STYLE.toFile(line.dashStyle, `${at}.dashStyle`);\n if (line.transparency !== undefined) fraction(line.transparency, `${at}.transparency`);\n if (line.weight !== undefined) nonNegative(line.weight, `${at}.weight`);\n const l = line as BorderProperties;\n steps.push((cell) => {\n const border = cell.borders[side];\n if (l.color !== undefined) border.color = l.color;\n if (l.weight !== undefined) border.weight = l.weight;\n if (l.dashStyle !== undefined) border.dashStyle = l.dashStyle;\n if (l.transparency !== undefined) border.transparency = l.transparency;\n });\n }\n }\n return (cell) => {\n for (const step of steps) step(cell);\n };\n}\n\nconst TABLE_KEYS = [\n 'columns',\n 'height',\n 'left',\n 'mergedAreas',\n 'rows',\n 'specificCellProperties',\n 'style',\n 'top',\n 'uniformCellProperties',\n 'values',\n 'width',\n];\n\n/** Check `TableAddOptions` for a `rows` by `columns` table, before anything is queued. */\nexport function tablePlan(\n options: TableAddOptions | undefined,\n rows: number,\n columns: number,\n target: string\n): TablePlan {\n if (options === undefined) return { values: undefined, apply: () => undefined };\n const o = record(options, TABLE_KEYS, target);\n const steps: ((table: Table) => void)[] = [];\n let values: string[][] | undefined;\n if (o.values !== undefined)\n values = list(o.values, rows, `${target}.values`).map((row) =>\n list(row, columns, `${target}.values`).map((v) => string(v, `${target}.values`))\n );\n if (o.style !== undefined) {\n tableStyleName(o.style, `${target}.style`);\n const style = o.style as `${TableStyle}`;\n steps.push((table) => (table.styleSettings.style = style));\n }\n if (o.columns !== undefined)\n list(o.columns, columns, `${target}.columns`).forEach((entry, i) => {\n const c = record(entry, ['columnWidth'], `${target}.columns[${i}]`);\n if (c.columnWidth === undefined) return;\n const w = positive(c.columnWidth, `${target}.columns[${i}].columnWidth`);\n steps.push((table) => (table.columns.getItemAt(i).width = w));\n });\n if (o.rows !== undefined)\n list(o.rows, rows, `${target}.rows`).forEach((entry, i) => {\n const r = record(entry, ['rowHeight'], `${target}.rows[${i}]`);\n if (r.rowHeight === undefined) return;\n const h = positive(r.rowHeight, `${target}.rows[${i}].rowHeight`);\n steps.push((table) => (table.rows.getItemAt(i).height = h));\n });\n if (o.mergedAreas !== undefined)\n list(o.mergedAreas, undefined, `${target}.mergedAreas`).forEach((entry, i) => {\n const at = `${target}.mergedAreas[${i}]`;\n const a = record(entry, ['columnCount', 'columnIndex', 'rowCount', 'rowIndex'], at);\n const r0 = wholeIn(a.rowIndex, 0, rows - 1, `${at}.rowIndex`);\n const c0 = wholeIn(a.columnIndex, 0, columns - 1, `${at}.columnIndex`);\n const rc = wholeIn(a.rowCount, 1, rows - r0, `${at}.rowCount`);\n const cc = wholeIn(a.columnCount, 1, columns - c0, `${at}.columnCount`);\n steps.push((table) => table.mergeCells(r0, c0, rc, cc));\n });\n if (o.uniformCellProperties !== undefined) {\n const apply = checkCell(o.uniformCellProperties, `${target}.uniformCellProperties`);\n steps.push((table) => {\n for (let r = 0; r < rows; r += 1)\n for (let c = 0; c < columns; c += 1) apply(newCell(table, r, c));\n });\n }\n if (o.specificCellProperties !== undefined) {\n const at = `${target}.specificCellProperties`;\n const grid = list(o.specificCellProperties, rows, at).map((row, r) =>\n list(row, columns, `${at}[${r}]`).map((cell, c) => checkCell(cell, `${at}[${r}][${c}]`))\n );\n steps.push((table) =>\n grid.forEach((row, r) => row.forEach((apply, c) => apply(newCell(table, r, c))))\n );\n }\n return {\n values,\n apply: (table) => {\n for (const step of steps) step(table);\n },\n };\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Tables: Office.js `Table`, `TableCell`, `TableRow`, `TableRowCollection`, `TableColumn`, and\n// `TableColumnCollection` over `a:tbl` in a graphic frame (ECMA-376 Part 1, 21.1.3.13). Row\n// heights and column widths are in points.\n\nimport type { AutomationTableRead } from '@pptx-editor.dev/core/automation';\nimport { ClientResult } from '../runtime/client-result.ts';\nimport { fail, failArgument, nearest } from '../runtime/errors.ts';\nimport { hydrated } from '../runtime/hydrate.ts';\nimport type { ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport { finite, ModelObject, type RefOf } from './model-object.ts';\nimport type { Shape } from './shapes.ts';\nimport { CELL_SPANS, TableCell } from './table-cell.ts';\nimport { TableStyleSettings } from './table-format.ts';\n\n/** Options for `Table.clear`. @public */\nexport interface TableClearOptions {\n all?: boolean;\n format?: boolean;\n text?: boolean;\n}\n\n/** A positive whole number, or `InvalidArgument`. */\nfunction count(value: unknown, target: string): number {\n if (typeof value !== 'number' || !Number.isInteger(value) || value < 1)\n failArgument(target, 'a whole number of 1 or more');\n return value;\n}\n\n/** A zero-based index, or `InvalidArgument`. */\nfunction index(value: unknown, target: string): number {\n if (typeof value !== 'number' || !Number.isInteger(value) || value < 0)\n failArgument(target, 'a whole number of 0 or more');\n return value;\n}\n\n/**\n * The table of a table shape.\n *\n * @public\n */\nexport class Table extends ModelObject {\n readonly #shape: Shape;\n #rows: TableRowCollection | undefined;\n #columns: TableColumnCollection | undefined;\n #styleSettings: TableStyleSettings | undefined;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, shape: Shape) {\n super(context, path);\n this.#shape = shape;\n }\n\n /** The number of columns. */\n get columnCount(): number {\n return this.loadedProperty('columnCount');\n }\n /** The number of rows. */\n get rowCount(): number {\n return this.loadedProperty('rowCount');\n }\n /** The text of each cell, by row then column. A merged area's text is in its first cell. */\n get values(): string[][] {\n return this.loadedProperty('values');\n }\n /** The rows. */\n get rows(): TableRowCollection {\n return (this.#rows ??= new TableRowCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.rows`, this.path)\n ));\n }\n /** The columns. */\n get columns(): TableColumnCollection {\n return (this.#columns ??= new TableColumnCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.columns`, this.path)\n ));\n }\n\n /** The style options and the style of the table (`a:tblPr`). */\n get styleSettings(): TableStyleSettings {\n return (this.#styleSettings ??= new TableStyleSettings(\n this.context,\n ObjectPath.derived(`${this.path.label}.styleSettings`, this.path),\n this.path\n ));\n }\n\n /** The merged areas of the table: one cell for each, its first cell, with its span. */\n getMergedAreas(): TableCellCollection {\n return new TableCellCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.getMergedAreas()`, this.path)\n );\n }\n\n /** The table shape. */\n getShape(): Shape {\n return this.#shape;\n }\n\n /** A cell by zero-based row and column, or a null object outside the table. */\n getCellOrNullObject(rowIndex: number, columnIndex: number): TableCell {\n const row = index(rowIndex, `${this.path.label}.getCellOrNullObject`);\n const column = index(columnIndex, `${this.path.label}.getCellOrNullObject`);\n const path = ObjectPath.pending(`${this.path.label}.getCellOrNullObject(${row}, ${column})`);\n const cell = new TableCell(this.context, path, row, column);\n const label = path.label;\n this.enqueue(\n 'read',\n `getCellOrNullObject(${row}, ${column})`,\n (ref) => ({ op: 'readTableCell', shape: ref(this.path), row, column }),\n (value) => {\n if (value.kind === 'null') return path.resolveNull();\n hydrated(value, 'tableCell', label);\n path.resolveTo(this.path.handle());\n },\n path,\n false\n );\n return cell;\n }\n\n /** Merge a rectangle of cells into its first cell. */\n mergeCells(rowIndex: number, columnIndex: number, rowCount: number, columnCount: number): void {\n const target = `${this.path.label}.mergeCells`;\n const op = {\n op: 'mergeTableCells' as const,\n row: index(rowIndex, target),\n column: index(columnIndex, target),\n rowCount: count(rowCount, target),\n columnCount: count(columnCount, target),\n };\n this.command('mergeCells', (ref) => ({ ...op, shape: ref(this.path) }));\n }\n\n /**\n * Clear the text, the direct format, or both, of every cell. With no options, or `all`, both\n * go. The direct format is each cell's `a:tcPr` and its paragraph and run properties;\n * hyperlinks and the table style stay.\n */\n clear(options?: TableClearOptions): void {\n const target = `${this.path.label}.clear`;\n if (options !== undefined && (typeof options !== 'object' || options === null))\n failArgument(target, 'a TableClearOptions object');\n for (const key of Object.keys(options ?? {}))\n if (key !== 'all' && key !== 'format' && key !== 'text')\n failArgument(\n `${target}.${key}`,\n 'the options all, format, or text',\n nearest(key, ['all', 'format', 'text'])\n );\n const { all, format, text: words } = options ?? {};\n for (const value of [all, format, words])\n if (value !== undefined && typeof value !== 'boolean') failArgument(target, 'true or false');\n const everything =\n all === true || (all === undefined && format === undefined && words === undefined);\n const op = {\n op: 'clearTable' as const,\n text: everything || words === true,\n format: everything || format === true,\n };\n if (!op.text && !op.format) return;\n this.command('clear', (ref) => ({ ...op, shape: ref(this.path) }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, ['columnCount', 'rowCount', 'values'], {\n rows: () => this.rows,\n columns: () => this.columns,\n styleSettings: () => this.styleSettings,\n });\n this.loadScalars(\n names,\n 'table',\n (ref) => ({ op: 'readTable', shape: ref(this.path) }),\n (v) => ({\n columnCount: v.table.columnCount,\n rowCount: v.table.rowCount,\n values: v.table.values.map((row) => [...row]),\n })\n );\n }\n}\n\n/** The names a row or a column uses. */\ninterface LineKind {\n readonly target: 'row' | 'column';\n readonly index: string;\n readonly size: string;\n}\nconst ROW: LineKind = { target: 'row', index: 'rowIndex', size: 'height' };\nconst COLUMN: LineKind = { target: 'column', index: 'columnIndex', size: 'width' };\n\n/** The index of each line and the way to fill its size. Module-private. */\nconst LINES = new WeakMap<object, { readonly at: number; size(value: number): void }>();\n\n/** A row or a column of a table. */\nabstract class TableLine extends ModelObject {\n readonly #at: number;\n readonly #kind: LineKind;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, at: number, size: number, kind: LineKind) {\n super(context, path);\n this.#at = at;\n this.#kind = kind;\n this.setLoadedProperty(kind.index, at);\n this.setLoadedProperty(kind.size, size);\n LINES.set(this, { at, size: (value) => this.setLoadedProperty(kind.size, value) });\n }\n\n /** @internal */\n protected get target(): 'row' | 'column' {\n return this.#kind.target;\n }\n\n /** Delete this line. */\n delete(): void {\n const op = this.target === 'row' ? 'deleteTableRows' : 'deleteTableColumns';\n this.command('delete', (ref) => ({ op, shape: ref(this.path), index: this.#at, count: 1 }));\n }\n\n /** @internal Set the height or width, in points. */\n protected writeSize(name: string, value: number): void {\n const size = finite(value, name);\n if (size <= 0) failArgument(`${this.path.label}.${name}`, 'a size greater than 0 points');\n this.command(name, (ref) => ({\n op: 'setTableSize',\n shape: ref(this.path),\n target: this.target,\n index: this.#at,\n size,\n }));\n }\n\n /** @internal Values come with the line; a load has nothing more to read. */\n protected override onLoad(request: ResolvedLoadOptions): void {\n this.selection(request, [this.#kind.index, this.#kind.size, 'currentHeight']);\n }\n}\n\n/**\n * One row of a table.\n *\n * @public\n */\nexport class TableRow extends TableLine {\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, at: number, size: number) {\n super(context, path, at, size, ROW);\n }\n /** The zero-based row index. */\n get rowIndex(): number {\n return this.loadedProperty('rowIndex');\n }\n /** The row height, in points (`a:tr/@h`). */\n get height(): number {\n return this.loadedProperty('height');\n }\n set height(value: number) {\n this.writeSize('height', value);\n }\n /** The height of the row as stored, in points. */\n get currentHeight(): number {\n return this.loadedProperty('height');\n }\n}\n\n/**\n * One column of a table.\n *\n * @public\n */\nexport class TableColumn extends TableLine {\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, at: number, size: number) {\n super(context, path, at, size, COLUMN);\n }\n /** The zero-based column index. */\n get columnIndex(): number {\n return this.loadedProperty('columnIndex');\n }\n /** The column width, in points (`a:gridCol/@w`). */\n get width(): number {\n return this.loadedProperty('width');\n }\n set width(value: number) {\n this.writeSize('width', value);\n }\n}\n\n/** The rows or the columns of a table. */\nabstract class TableLines<T extends TableLine> extends ModelObject {\n /** @internal */\n protected abstract get target(): 'row' | 'column';\n /** @internal */\n protected abstract make(path: ObjectPath, at: number, size: number): T;\n\n /** The loaded lines. */\n get items(): T[] {\n return this.loadedProperty<T[]>('items');\n }\n\n /** Insert `count` lines at `index`, or at the end. They copy the line before them. */\n add(index_?: number | null | undefined, count_?: number | undefined): void {\n const at = index_ === null || index_ === undefined ? undefined : index(index_, 'index');\n const n = count_ === undefined ? 1 : count(count_, 'count');\n const op = this.target === 'row' ? 'insertTableRows' : 'insertTableColumns';\n this.command('add', (ref) => ({\n op,\n shape: ref(this.path),\n ...(at === undefined ? {} : { index: at }),\n count: n,\n }));\n }\n\n /** The number of lines, after the next `sync()`. */\n getCount(): ClientResult<number> {\n const label = `${this.path.label}.getCount`;\n const { result, fill } = ClientResult.create<number>(label);\n this.enqueue(\n 'read',\n 'getCount',\n (ref) => this.#read(ref),\n (value) => fill(this.#sizes(hydrated(value, 'table', label).table).length)\n );\n return result;\n }\n\n /** The line at a zero-based position; `ItemNotFound` at the sync when there is none. */\n getItemAt(index_: number): T {\n const at = index(index_, `${this.path.label}.getItemAt`);\n const line = this.make(\n ObjectPath.derived(`${this.path.label}.getItemAt(${at})`, this.path),\n at,\n 0\n );\n const label = `${this.path.label}.getItemAt(${at})`;\n this.enqueue(\n 'read',\n `getItemAt(${at})`,\n (ref) => this.#read(ref),\n (value) => {\n const size = this.#sizes(hydrated(value, 'table', label).table)[at];\n if (size === undefined) fail({ code: 'ItemNotFound', target: label });\n LINES.get(line)?.size(size);\n }\n );\n return line;\n }\n\n /** @internal Delete lines, last first so the indices stay valid. */\n protected deleteLines(lines: readonly T[], name: string): void {\n if (!Array.isArray(lines))\n failArgument(`${this.path.label}.${name}`, 'an array of rows or columns of this table');\n const at = (line: T): number => LINES.get(line)?.at ?? 0;\n const sorted = [...lines].sort((a, b) => at(b) - at(a));\n for (const line of sorted) line.delete();\n }\n\n #read(ref: RefOf): { op: 'readTable'; shape: ReturnType<RefOf> } {\n return { op: 'readTable', shape: ref(this.path) };\n }\n\n #sizes(table: AutomationTableRead): readonly number[] {\n return this.target === 'row' ? table.rowHeights : table.columnWidths;\n }\n\n /** @internal */\n protected override get loadsItemPaths(): boolean {\n return true;\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n void request;\n const label = `${this.path.label}.items`;\n this.enqueue(\n 'read',\n 'items',\n (ref) => this.#read(ref),\n (value) => {\n const sizes = this.#sizes(hydrated(value, 'table', label).table);\n this.setLoadedProperty(\n 'items',\n sizes.map((size, i) =>\n this.make(ObjectPath.derived(`${label}[${i}]`, this.path), i, size)\n )\n );\n }\n );\n }\n}\n\n/**\n * The rows of a table.\n *\n * @public\n */\nexport class TableRowCollection extends TableLines<TableRow> {\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath) {\n super(context, path);\n }\n /** Delete rows. */\n deleteRows(rows: TableRow[]): void {\n this.deleteLines(rows, 'deleteRows');\n }\n /** @internal */\n protected get target(): 'row' {\n return 'row';\n }\n /** @internal */\n protected make(path: ObjectPath, at: number, size: number): TableRow {\n return new TableRow(this.context, path, at, size);\n }\n}\n\n/**\n * The columns of a table.\n *\n * @public\n */\nexport class TableColumnCollection extends TableLines<TableColumn> {\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath) {\n super(context, path);\n }\n /** Delete columns. */\n deleteColumns(columns: TableColumn[]): void {\n this.deleteLines(columns, 'deleteColumns');\n }\n /** @internal */\n protected get target(): 'column' {\n return 'column';\n }\n /** @internal */\n protected make(path: ObjectPath, at: number, size: number): TableColumn {\n return new TableColumn(this.context, path, at, size);\n }\n}\n\n/** One merged area of a table, as `readTable` gives it. */\ntype MergedArea = AutomationTableRead['mergedAreas'][number];\n\n/**\n * The merged areas of a table, from `Table.getMergedAreas`. Each item is the first cell of one\n * area, and its `rowCount` and `columnCount` give the span.\n *\n * @public\n */\nexport class TableCellCollection extends ModelObject {\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath) {\n super(context, path);\n }\n\n /** The loaded cells. */\n get items(): TableCell[] {\n return this.loadedProperty<TableCell[]>('items');\n }\n\n /** The number of merged areas, after the next `sync()`. */\n getCount(): ClientResult<number> {\n const label = `${this.path.label}.getCount`;\n const { result, fill } = ClientResult.create<number>(label);\n this.enqueue(\n 'read',\n 'getCount',\n (ref) => this.#read(ref),\n (value) => fill(hydrated(value, 'table', label).table.mergedAreas.length)\n );\n return result;\n }\n\n /**\n * The merged area that holds the cell at a zero-based row and column of the table, as its\n * first cell, or a null object when no merged area holds that cell.\n */\n getItemAtOrNullObject(row: number, column: number): TableCell {\n const r = index(row, `${this.path.label}.getItemAtOrNullObject`);\n const c = index(column, `${this.path.label}.getItemAtOrNullObject`);\n const path = ObjectPath.pending(`${this.path.label}.getItemAtOrNullObject(${r}, ${c})`);\n const cell = new TableCell(this.context, path, r, c);\n const label = path.label;\n this.enqueue(\n 'read',\n `getItemAtOrNullObject(${r}, ${c})`,\n (ref) => this.#read(ref),\n (value) => {\n const area = hydrated(value, 'table', label).table.mergedAreas.find(\n (a) =>\n r >= a.rowIndex &&\n r < a.rowIndex + a.rowCount &&\n c >= a.columnIndex &&\n c < a.columnIndex + a.columnCount\n );\n if (!area) return path.resolveNull();\n CELL_SPANS.get(cell)?.(spanOf(area));\n path.resolveTo(this.path.handle());\n },\n path,\n false\n );\n return cell;\n }\n\n #read(ref: RefOf): { op: 'readTable'; shape: ReturnType<RefOf> } {\n return { op: 'readTable', shape: ref(this.path) };\n }\n\n /** @internal */\n protected override get loadsItemPaths(): boolean {\n return true;\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n void request;\n const label = `${this.path.label}.items`;\n this.enqueue(\n 'read',\n 'items',\n (ref) => this.#read(ref),\n (value) => {\n const areas = hydrated(value, 'table', label).table.mergedAreas;\n this.setLoadedProperty(\n 'items',\n areas.map((area, i) => {\n const cell = new TableCell(\n this.context,\n ObjectPath.derived(`${label}[${i}]`, this.path),\n area.rowIndex,\n area.columnIndex\n );\n CELL_SPANS.get(cell)?.(spanOf(area));\n return cell;\n })\n );\n }\n );\n }\n}\n\nfunction spanOf(area: MergedArea): {\n rowIndex: number;\n columnIndex: number;\n rowCount: number;\n columnCount: number;\n} {\n return {\n rowIndex: area.rowIndex,\n columnIndex: area.columnIndex,\n rowCount: area.rowCount,\n columnCount: area.columnCount,\n };\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Shapes: Office.js `Shape`, `ShapeCollection`, `ShapeScopedCollection`, `ShapeGroup`, and\n// `PlaceholderFormat`. Positions and sizes are in points, as in Office.js; the host converts\n// to EMU (12,700 per point).\n\nimport type {\n AutomationBox,\n AutomationHandle,\n AutomationItemKey,\n AutomationNewShape,\n AutomationOperation,\n AutomationShapeWrite,\n AutomationValue,\n AutomationZOrder,\n} from '@pptx-editor.dev/core/automation';\nimport { ClientObject } from '../runtime/client-object.ts';\nimport { ClientResult } from '../runtime/client-result.ts';\nimport { diagnosticOf, fail, failArgument } from '../runtime/errors.ts';\nimport { hydrated } from '../runtime/hydrate.ts';\nimport type { ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport { Adjustments } from './adjustments.ts';\nimport { ItemCollection } from './collection.ts';\nimport {\n CONNECTOR,\n PLACEHOLDER_TYPE,\n shapeTypeOf,\n Z_ORDER,\n type ConnectorType,\n type PlaceholderType,\n type ShapeType,\n type ShapeZOrder,\n} from './enums.ts';\nimport { ShapeFill, ShapeLineFormat } from './fill-line.ts';\nimport { geometryOf, type GeometricShapeType } from './geometry.ts';\nimport { Hyperlink, type HyperlinkAddOptions } from './hyperlinks.ts';\nimport { imageBox, settleImage, type ShapeGetImageOptions } from './images.ts';\nimport { finite, flag, ModelObject, pathOf, text, type RefOf } from './model-object.ts';\nimport { SlideLayout, SlideMaster, Slide } from './slides.ts';\nimport { tablePlan, type TableAddOptions } from './table-options.ts';\nimport { Table } from './tables.ts';\nimport { CustomXmlPartCollection } from './custom-xml.ts';\nimport { TagCollection } from './tags.ts';\nimport { TextFrame } from './text.ts';\n\n/**\n * Where a new shape goes, in points from the top left of the slide.\n *\n * @public\n */\nexport interface ShapeAddOptions {\n height?: number;\n left?: number;\n top?: number;\n width?: number;\n}\n\nconst SHAPE_NAMES = [\n 'id',\n 'name',\n 'type',\n 'left',\n 'top',\n 'width',\n 'height',\n 'rotation',\n 'visible',\n 'zOrderPosition',\n 'level',\n 'altTextTitle',\n 'altTextDescription',\n 'isDecorative',\n 'creationId',\n] as const;\n\n/** A box from `ShapeAddOptions`, checked. */\nexport function boxOf(options: ShapeAddOptions | undefined, target: string): AutomationBox {\n if (options === undefined) return {};\n if (typeof options !== 'object' || options === null)\n failArgument(target, 'a ShapeAddOptions object');\n const box: { left?: number; top?: number; width?: number; height?: number } = {};\n for (const key of ['left', 'top', 'width', 'height'] as const) {\n const value = options[key];\n if (value !== undefined) box[key] = finite(value, `${target}.${key}`);\n }\n return box;\n}\n\n/**\n * A shape on a slide, layout, or master: a geometric shape, a text box, a picture, a line, a\n * group, a table, or another graphic frame.\n *\n * @public\n */\nexport class Shape extends ModelObject {\n #fill: ShapeFill | undefined;\n #line: ShapeLineFormat | undefined;\n #textFrame: TextFrame | undefined;\n #tags: TagCollection | undefined;\n #customXml: CustomXmlPartCollection | undefined;\n #group: ShapeGroup | undefined;\n #placeholder: PlaceholderFormat | undefined;\n #parentGroup: Shape | undefined;\n #adjustments: Adjustments | undefined;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, nullable = false) {\n super(context, path, { nullable });\n }\n\n /** The shape id (`p:cNvPr/@id`), unique on its slide. */\n get id(): string {\n return this.loadedProperty('id');\n }\n /** The shape name (`p:cNvPr/@name`). */\n get name(): string {\n return this.loadedProperty('name');\n }\n set name(value: string) {\n this.#set('name', { name: text(value, this.at('name')) });\n }\n /** What kind of shape this is. */\n get type(): ShapeType | `${ShapeType}` {\n return this.loadedProperty('type');\n }\n /** The distance from the left edge of the slide, in points. */\n get left(): number {\n return this.loadedProperty('left');\n }\n set left(value: number) {\n this.#set('left', { left: finite(value, this.at('left')) });\n }\n /** The distance from the top edge of the slide, in points. */\n get top(): number {\n return this.loadedProperty('top');\n }\n set top(value: number) {\n this.#set('top', { top: finite(value, this.at('top')) });\n }\n /** The width, in points. */\n get width(): number {\n return this.loadedProperty('width');\n }\n set width(value: number) {\n this.#set('width', { width: finite(value, this.at('width')) });\n }\n /** The height, in points. */\n get height(): number {\n return this.loadedProperty('height');\n }\n set height(value: number) {\n this.#set('height', { height: finite(value, this.at('height')) });\n }\n /** The rotation, in degrees clockwise. */\n get rotation(): number {\n return this.loadedProperty('rotation');\n }\n set rotation(value: number) {\n this.#set('rotation', { rotation: finite(value, this.at('rotation')) });\n }\n /** Whether the shape shows (`p:cNvPr/@hidden` is not set). */\n get visible(): boolean {\n return this.loadedProperty('visible');\n }\n set visible(value: boolean) {\n this.#set('visible', { visible: flag(value, this.at('visible')) });\n }\n /** The zero-based position in the z-order of its parent. */\n get zOrderPosition(): number {\n return this.loadedProperty('zOrderPosition');\n }\n /** How deep in groups the shape is: 0 at the top level. */\n get level(): number {\n return this.loadedProperty('level');\n }\n /** The alternative text title (`p:cNvPr/@title`). */\n get altTextTitle(): string {\n return this.loadedProperty('altTextTitle');\n }\n set altTextTitle(value: string) {\n this.#set('altTextTitle', { altTextTitle: text(value, this.at('altTextTitle')) });\n }\n /** The alternative text description (`p:cNvPr/@descr`). */\n get altTextDescription(): string {\n return this.loadedProperty('altTextDescription');\n }\n set altTextDescription(value: string) {\n this.#set('altTextDescription', {\n altTextDescription: text(value, this.at('altTextDescription')),\n });\n }\n /** Whether the shape is decorative, so readers of alternative text skip it. */\n get isDecorative(): boolean {\n return this.loadedProperty('isDecorative');\n }\n set isDecorative(value: boolean) {\n this.#set('isDecorative', { isDecorative: flag(value, this.at('isDecorative')) });\n }\n /** The creation id of the shape. The file format has none, so this reads `null`. */\n get creationId(): string | null {\n return this.loadedProperty('creationId');\n }\n\n /** The adjust values of the shape's preset geometry (`a:prstGeom/a:avLst`). */\n get adjustments(): Adjustments {\n return (this.#adjustments ??= new Adjustments(\n this.context,\n ObjectPath.derived(`${this.path.label}.adjustments`, this.path),\n this.path\n ));\n }\n /** The fill of the shape. */\n get fill(): ShapeFill {\n return (this.#fill ??= new ShapeFill(\n this.context,\n ObjectPath.derived(`${this.path.label}.fill`, this.path),\n { kind: 'shape', shape: this.path }\n ));\n }\n /** The outline of the shape. */\n get lineFormat(): ShapeLineFormat {\n return (this.#line ??= new ShapeLineFormat(\n this.context,\n ObjectPath.derived(`${this.path.label}.lineFormat`, this.path),\n this.path\n ));\n }\n /** The text frame. `NotSupported` at the sync for a shape that holds no text. */\n get textFrame(): TextFrame {\n return (this.#textFrame ??= new TextFrame(\n this.context,\n ObjectPath.derived(`${this.path.label}.textFrame`, this.path),\n this.path\n ));\n }\n /** The tags of the shape. */\n get tags(): TagCollection {\n return (this.#tags ??= new TagCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.tags`, this.path)\n ));\n }\n /** The custom XML parts of the shape. */\n get customXmlParts(): CustomXmlPartCollection {\n return (this.#customXml ??= new CustomXmlPartCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.customXmlParts`, this.path)\n ));\n }\n /** The group this shape is, for a group shape. */\n get group(): ShapeGroup {\n return (this.#group ??= new ShapeGroup(\n this.context,\n ObjectPath.derived(`${this.path.label}.group`, this.path),\n this\n ));\n }\n /** The placeholder properties, for a placeholder. */\n get placeholderFormat(): PlaceholderFormat {\n return (this.#placeholder ??= new PlaceholderFormat(\n this.context,\n ObjectPath.derived(`${this.path.label}.placeholderFormat`, this.path),\n this.path\n ));\n }\n /** The group that holds this shape. `ItemNotFound` at the sync for a shape at the top level. */\n get parentGroup(): Shape {\n return this.#parentGroupOf(false);\n }\n\n /**\n * The parent group, made on first use. Through a collection's items (`orNull`), a shape at\n * the top level has a null parent group instead of refusing the sync.\n */\n #parentGroupOf(orNull: boolean): Shape {\n return (this.#parentGroup ??= this.navigation(\n 'parentGroup',\n (path) => new Shape(this.context, path, orNull),\n (ref) => ({ op: 'getParentGroup', shape: ref(this.path), ...(orNull ? { orNull } : {}) }),\n orNull\n ));\n }\n\n /** Delete the shape. */\n delete(): void {\n this.command('delete', (ref) => ({ op: 'deleteShape', shape: ref(this.path) }));\n }\n\n /**\n * A PNG picture of the shape, without the slide behind it, as base64, drawn by the editor's\n * own renderer. A runtime over a live editor in a browser draws pictures, and so does a server\n * runtime created with a `rasterize` option; any other runtime refuses with `NotSupported`.\n *\n * @example\n * ```ts\n * const image = shape.getImageAsBase64({ width: 640 });\n * await context.sync();\n * const png = `data:image/png;base64,${image.value}`;\n * ```\n */\n getImageAsBase64(options?: ShapeGetImageOptions): ClientResult<string> {\n const target = this.at('getImageAsBase64');\n const box = imageBox(options, target, true);\n const { result, fill } = ClientResult.create<string>(target);\n this.enqueue(\n 'read',\n 'getImageAsBase64',\n (ref) => ({ op: 'prepareImage', target: ref(this.path), ...box }),\n settleImage(this.internals, box, target, fill)\n );\n return result;\n }\n\n /** The slide the shape is on; `ItemNotFound` at the sync for a layout or master shape. */\n getParentSlide(): Slide {\n return this.#parent('getParentSlide()', 'slide', false, (p) => new Slide(this.context, p));\n }\n /** The slide the shape is on, or a null object. */\n getParentSlideOrNullObject(): Slide {\n return this.#parent(\n 'getParentSlideOrNullObject()',\n 'slide',\n true,\n (p) => new Slide(this.context, p, true)\n );\n }\n /** The layout the shape is on; `ItemNotFound` at the sync for any other shape. */\n getParentSlideLayout(): SlideLayout {\n return this.#parent(\n 'getParentSlideLayout()',\n 'slideLayout',\n false,\n (p) => new SlideLayout(this.context, p)\n );\n }\n /** The layout the shape is on, or a null object. */\n getParentSlideLayoutOrNullObject(): SlideLayout {\n return this.#parent(\n 'getParentSlideLayoutOrNullObject()',\n 'slideLayout',\n true,\n (p) => new SlideLayout(this.context, p, true)\n );\n }\n /** The master the shape is on; `ItemNotFound` at the sync for any other shape. */\n getParentSlideMaster(): SlideMaster {\n return this.#parent(\n 'getParentSlideMaster()',\n 'slideMaster',\n false,\n (p) => new SlideMaster(this.context, p)\n );\n }\n /** The master the shape is on, or a null object. */\n getParentSlideMasterOrNullObject(): SlideMaster {\n return this.#parent(\n 'getParentSlideMasterOrNullObject()',\n 'slideMaster',\n true,\n (p) => new SlideMaster(this.context, p, true)\n );\n }\n\n /** The table of a table shape. `NotSupported` at the sync for any other shape. */\n getTable(): Table {\n return new Table(\n this.context,\n ObjectPath.derived(`${this.path.label}.getTable()`, this.path),\n this\n );\n }\n\n /** The text frame, or a null object for a shape that holds no text. */\n getTextFrameOrNullObject(): TextFrame {\n const path = ObjectPath.pending(`${this.path.label}.getTextFrameOrNullObject()`);\n const frame = new TextFrame(this.context, path, path, true);\n const label = path.label;\n // The read answers the shape, not a handle: a call on the frame waits for this read, and by\n // then the shape's own path has resolved.\n this.enqueue(\n 'read',\n 'getTextFrameOrNullObject()',\n (ref) => ({ op: 'readShape', shape: ref(this.path) }),\n (value) => {\n const read = value.kind === 'null' ? null : hydrated(value, 'shape', label).shape;\n if (read?.hasTextFrame && this.path.isAddressable) path.resolveTo(this.path.handle());\n else path.resolveNull();\n },\n path,\n false\n );\n return frame;\n }\n\n /** Set the click link of the whole shape. */\n setHyperlink(options?: HyperlinkAddOptions): Hyperlink {\n const address = options?.address ?? '';\n const screenTip = options?.screenTip;\n text(address, this.at('address'));\n if (screenTip !== undefined) text(screenTip, this.at('screenTip'));\n this.command('setHyperlink', (ref) => ({\n op: 'setShapeHyperlink',\n shape: ref(this.path),\n address,\n ...(screenTip === undefined ? {} : { screenTip }),\n }));\n return Hyperlink.created(this.context, this.path, null, address, screenTip ?? '');\n }\n\n /** Move the shape in the z-order of its parent. */\n setZOrder(position: ShapeZOrder): void;\n /** Move the shape in the z-order of its parent. */\n setZOrder(position: 'BringForward' | 'BringToFront' | 'SendBackward' | 'SendToBack'): void;\n setZOrder(position: ShapeZOrder | `${ShapeZOrder}`): void {\n const move = Z_ORDER.toFile(position, `${this.path.label}.setZOrder`) as AutomationZOrder;\n this.command('setZOrder', (ref) => ({\n op: 'setZOrder',\n shape: ref(this.path),\n position: move,\n }));\n }\n\n #parent<T>(\n name: string,\n kind: 'slide' | 'slideLayout' | 'slideMaster',\n orNull: boolean,\n make: (path: ObjectPath) => T\n ): T {\n return this.navigation(\n name,\n make,\n (ref) => ({ op: 'parentOf', shape: ref(this.path), kind, ...(orNull ? { orNull } : {}) }),\n orNull\n );\n }\n\n #set(name: string, props: AutomationShapeWrite): void {\n this.command(name, (ref) => ({ op: 'setShape', shape: ref(this.path), props }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, SHAPE_NAMES, {\n adjustments: () => this.adjustments,\n fill: () => this.fill,\n lineFormat: () => this.lineFormat,\n textFrame: () => this.textFrame,\n tags: () => this.tags,\n customXmlParts: () => this.customXmlParts,\n placeholderFormat: () => this.placeholderFormat,\n group: () => this.group,\n parentGroup: () => this.#parentGroupOf(this.loadingOrNull),\n });\n this.loadScalars(\n names,\n 'shape',\n (ref) => ({ op: 'readShape', shape: ref(this.path) }),\n (v) => ({ ...v.shape, type: shapeTypeOf(v.shape.type), creationId: null })\n );\n }\n}\n\n/** The handles a value of shape handles carries. */\nfunction shapeHandles(value: AutomationValue, label: string): readonly AutomationHandle[] {\n return hydrated(value, 'handles', label).handles;\n}\n\n/** What a shape collection lists: a container's shapes, or the reader's selected shapes. */\nexport type ShapeSource =\n { readonly kind: 'container'; readonly container: ObjectPath } | { readonly kind: 'selection' };\n\n/** The members both shape collections share. */\nabstract class ShapeList extends ItemCollection<Shape> {\n /** @internal */\n protected abstract readonly source: ShapeSource;\n\n /** A shape by id; `ItemNotFound` at the sync when there is none. */\n getItem(key: string): Shape {\n return this.find({ id: this.keyArg(key, 'getItem') }, 'getItem()', false);\n }\n /** A shape by zero-based position in the z-order. */\n getItemAt(index: number): Shape {\n const at = this.indexArg(index);\n return this.find({ index: at }, `getItemAt(${at})`, false);\n }\n /** A shape by id, or a null object. */\n getItemOrNullObject(id: string): Shape {\n return this.find({ id: this.keyArg(id, 'getItemOrNullObject') }, 'getItemOrNullObject()', true);\n }\n\n /** @internal */\n protected listing(ref: RefOf): AutomationOperation {\n return this.source.kind === 'container'\n ? { op: 'listShapes', container: ref(this.source.container) }\n : { op: 'readSelection' };\n }\n /** @internal */\n protected override handlesOf(value: AutomationValue, label: string): readonly AutomationHandle[] {\n return this.source.kind === 'container'\n ? shapeHandles(value, label)\n : hydrated(value, 'selection', label).selection.shapes;\n }\n /** @internal */\n protected override get hasLookup(): boolean {\n return this.source.kind === 'container';\n }\n /** @internal */\n protected itemOf(path: ObjectPath, nullable: boolean): Shape {\n return new Shape(this.context, path, nullable);\n }\n /** @internal */\n protected lookup(\n ref: RefOf,\n key: AutomationItemKey,\n orNull: boolean\n ): AutomationOperation | undefined {\n if (this.source.kind !== 'container') return undefined;\n return {\n op: 'getShape',\n container: ref(this.source.container),\n key,\n ...(orNull ? { orNull: true } : {}),\n };\n }\n\n /** @internal Queue the group of `shapes` and answer the new group shape. */\n protected groupOf(shapes: readonly (() => ObjectPath[])[], name: string): Shape {\n const path = ObjectPath.pending(`${this.path.label}.${name}`);\n const group = new Shape(this.context, path);\n const label = path.label;\n this.enqueue(\n 'write',\n name,\n (ref) => ({ op: 'group', shapes: shapes.flatMap((list) => list()).map((p) => ref(p)) }),\n (value) => path.resolveTo(hydrated(value, 'handle', label).handle),\n path\n );\n return group;\n }\n}\n\n/**\n * The shapes of a slide, layout, master, or group, in z-order.\n *\n * @public\n */\nexport class ShapeCollection extends ShapeList {\n /** @internal */\n protected readonly source: ShapeSource;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, container: ObjectPath) {\n super(context, path);\n this.source = { kind: 'container', container };\n }\n\n /** Add a preset geometric shape (`a:prstGeom`, ECMA-376 Part 1, 20.1.9.18). */\n addGeometricShape(geometricShapeType: GeometricShapeType, options?: ShapeAddOptions): Shape;\n /** Add a preset geometric shape (`a:prstGeom`, ECMA-376 Part 1, 20.1.9.18). */\n addGeometricShape(geometricShapeType: `${GeometricShapeType}`, options?: ShapeAddOptions): Shape;\n addGeometricShape(geometricShapeType: GeometricShapeType, options?: ShapeAddOptions): Shape {\n const geometry = geometryOf(geometricShapeType, `${this.path.label}.addGeometricShape`);\n const box = boxOf(options, `${this.path.label}.addGeometricShape`);\n return this.#add('addGeometricShape', { kind: 'geometric', geometry }, box);\n }\n\n /** Add a line or connector (`p:cxnSp`). */\n addLine(connectorType?: ConnectorType, options?: ShapeAddOptions): Shape;\n /** Add a line or connector (`p:cxnSp`). */\n addLine(connectorType?: 'Straight' | 'Elbow' | 'Curve', options?: ShapeAddOptions): Shape;\n addLine(\n connectorType: ConnectorType | `${ConnectorType}` = 'Straight',\n options?: ShapeAddOptions\n ): Shape {\n const connector = CONNECTOR.toFile(connectorType, `${this.path.label}.addLine`);\n const box = boxOf(options, `${this.path.label}.addLine`);\n return this.#add(\n 'addLine',\n { kind: 'line', connector: connector as 'straight' | 'elbow' | 'curve' },\n box\n );\n }\n\n /** Add a text box with `text`. */\n addTextBox(text_: string, options?: ShapeAddOptions): Shape {\n const box = boxOf(options, `${this.path.label}.addTextBox`);\n return this.#add('addTextBox', { kind: 'textBox', text: text(text_, this.at('text')) }, box);\n }\n\n /** Add a table (`a:tbl` in a graphic frame) of `rowCount` rows and `columnCount` columns. */\n addTable(rowCount: number, columnCount: number, options?: TableAddOptions): Shape {\n const target = `${this.path.label}.addTable`;\n for (const value of [rowCount, columnCount])\n if (typeof value !== 'number' || !Number.isInteger(value) || value < 1)\n failArgument(target, 'a whole number of rows and of columns of 1 or more');\n const plan = tablePlan(options, rowCount, columnCount, target);\n const { left, top, width, height } = options ?? {};\n const box = boxOf({ left, top, width, height }, target);\n const values = plan.values;\n const shape = this.#add(\n 'addTable',\n { kind: 'table', rows: rowCount, columns: columnCount, ...(values ? { values } : {}) },\n box\n );\n plan.apply(shape.getTable());\n return shape;\n }\n\n /** Group shapes of this collection, by shape or by id. Answers the new group. */\n addGroup(values: Array<string | Shape>): Shape {\n if (!Array.isArray(values))\n failArgument(`${this.path.label}.addGroup`, 'an array of shapes or shape ids');\n if (values.length < 2)\n fail({\n code: 'InvalidArgument',\n target: `${this.path.label}.addGroup`,\n diagnostic: diagnosticOf('group-count')!,\n });\n const shapes = values.map((v) => (typeof v === 'string' ? this.getItem(v) : v));\n if (shapes.some((s) => !(s instanceof ClientObject)))\n failArgument(`${this.path.label}.addGroup`, 'an array of shapes or shape ids');\n return this.groupOf([() => shapes.map((s) => pathOf(s))], 'addGroup');\n }\n\n #add(name: string, shape: AutomationNewShape, box: AutomationBox): Shape {\n const path = ObjectPath.pending(`${this.path.label}.${name}()`);\n const created = new Shape(this.context, path);\n const label = path.label;\n const container = this.source.kind === 'container' ? this.source.container : this.path;\n this.enqueue(\n 'write',\n name,\n (ref) => ({ op: 'addShape', container: ref(container), shape, box }),\n (value) => path.resolveTo(hydrated(value, 'handle', label).handle),\n path\n );\n return created;\n }\n}\n\n/**\n * A set of shapes: the reader's selection, or the members of a group.\n *\n * @public\n */\nexport class ShapeScopedCollection extends ShapeList {\n /** @internal */\n protected readonly source: ShapeSource;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, source: ShapeSource) {\n super(context, path);\n this.source = source;\n }\n\n /**\n * Group the shapes of this collection and answer the new group. The items need no load: when\n * a completed load has not filled them in, the sync reads them first, in an earlier round at\n * the same revision, and then groups them.\n */\n group(): Shape {\n if (this.hasLoadedProperty('items')) {\n const items = this.items;\n return this.groupOf([() => items.map((s) => pathOf(s))], 'group()');\n }\n // The listing read produces a path that no call can name by result reference, so the group\n // waits for it (`WaitForRead`) and is planned again with the members it answered.\n const listed = ObjectPath.pending(`${this.path.label}.items`);\n let members: readonly Shape[] | undefined;\n this.enqueue(\n 'read',\n 'items',\n (ref) => this.listing(ref),\n (value) => {\n members = this.handlesOf(value, listed.label).map((handle, i) =>\n this.itemOf(this.memberPath(handle, i), false)\n );\n },\n listed,\n false\n );\n return this.groupOf([() => (members ? members.map((s) => pathOf(s)) : [listed])], 'group()');\n }\n}\n\n/**\n * A group shape (`p:grpSp`).\n *\n * @public\n */\nexport class ShapeGroup extends ModelObject {\n readonly #shape: Shape;\n #shapes: ShapeScopedCollection | undefined;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, shape: Shape) {\n super(context, path);\n this.#shape = shape;\n }\n\n /** The id of the group shape. */\n get id(): string {\n return this.loadedProperty('id');\n }\n /** The creation id. The file format has none, so this reads `null`. */\n get creationId(): string | null {\n return this.loadedProperty('creationId');\n }\n /** The group as a shape. */\n get shape(): Shape {\n return this.#shape;\n }\n /** The members of the group, in z-order. */\n get shapes(): ShapeScopedCollection {\n return (this.#shapes ??= new ShapeScopedCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.shapes`, this.path),\n { kind: 'container', container: this.path }\n ));\n }\n\n /** Ungroup: the members move to the group's parent, and the group is deleted. */\n ungroup(): void {\n // The host answers the former members; the object model's `ungroup` answers nothing.\n this.enqueue('write', 'ungroup', (ref) => ({ op: 'ungroup', group: ref(this.path) }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, ['id', 'creationId'], { shapes: () => this.shapes });\n this.loadScalars(\n names,\n 'shape',\n (ref) => ({ op: 'readShape', shape: ref(this.path), group: true }),\n (v) => ({ id: v.shape.id, creationId: null })\n );\n }\n}\n\n/**\n * The placeholder properties of a shape (`p:ph`, ECMA-376 Part 1, 19.3.1.36).\n *\n * @public\n */\nexport class PlaceholderFormat extends ModelObject {\n readonly #shape: ObjectPath;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, shape: ObjectPath) {\n super(context, path);\n this.#shape = shape;\n }\n\n /** The placeholder type. A shape that is no placeholder reads `Unsupported`. */\n get type(): PlaceholderType | `${PlaceholderType}` {\n return this.loadedProperty('type');\n }\n /** The kind of content the placeholder holds, or null for a shape placeholder. */\n get containedType(): ShapeType | `${ShapeType}` | null {\n return this.loadedProperty('containedType');\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, ['type', 'containedType']);\n this.loadScalars(\n names,\n 'shape',\n (ref) => ({ op: 'readShape', shape: ref(this.#shape) }),\n (v) => ({\n type: PLACEHOLDER_TYPE.fromFile(v.shape.placeholder?.type) ?? 'Unsupported',\n containedType: v.shape.placeholder?.containedType\n ? shapeTypeOf(v.shape.placeholder.containedType)\n : null,\n })\n );\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Office.js `Hyperlink`, `HyperlinkCollection`, and `HyperlinkScopedCollection`: the click\n// links of a slide or of a text range, on text runs\n// (`a:rPr/a:hlinkClick`) and on whole shapes (`p:cNvPr/a:hlinkClick`). An address goes\n// through `sanitizeHref` in the host: only http, https, mailto, tel, and ftp links are written.\n\nimport type {\n AutomationHyperlinkRead,\n AutomationOperation,\n AutomationTextSpan,\n} from '@pptx-editor.dev/core/automation';\nimport { ClientResult } from '../runtime/client-result.ts';\nimport { fail, failArgument, nearest } from '../runtime/errors.ts';\nimport { hydrated } from '../runtime/hydrate.ts';\nimport type { ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport type { HyperlinkType } from './enums.ts';\nimport { ModelObject, text, type RefOf } from './model-object.ts';\nimport { Shape } from './shapes.ts';\nimport { TextRange } from './text.ts';\n\n/**\n * Options for a new hyperlink.\n *\n * @public\n */\nexport interface HyperlinkAddOptions {\n /** The address the link opens. */\n address?: string;\n /** The tip that shows over the link. */\n screenTip?: string;\n}\n\n/** A span, null for a shape link, or a getter for the range of a text link a write made. */\ntype LinkSpan = AutomationTextSpan | null | (() => AutomationTextSpan | undefined);\n\n/** Fills a link a lookup found. Module-private, so no consumer can call it. */\nconst FILLERS = new WeakMap<Hyperlink, (read: AutomationHyperlinkRead) => void>();\n\n/**\n * One hyperlink: on a text range or on a whole shape.\n *\n * @public\n */\nexport class Hyperlink extends ModelObject {\n readonly #shape: ObjectPath;\n /** The span, or undefined while a lookup has not answered (`getItemAt`). */\n #span: LinkSpan | undefined;\n /** Values this proxy wrote, which the answer of a pending lookup must not overwrite. */\n readonly #written = new Map<'address' | 'screenTip', string>();\n /** Objects that wait for a pending lookup: the linked shape and the linked text range. */\n readonly #waiting: ((read: AutomationHyperlinkRead) => void)[] = [];\n\n /**\n * @internal `values` absent: the link is a lookup that has not answered, and nothing is\n * loaded until it does.\n */\n constructor(\n context: RequestContext,\n path: ObjectPath,\n shape: ObjectPath,\n span: LinkSpan | undefined,\n values?: { address: string; screenTip: string }\n ) {\n super(context, path);\n this.#shape = shape;\n this.#span = span;\n if (values) {\n this.setLoadedProperty('address', values.address);\n this.setLoadedProperty('screenTip', values.screenTip);\n this.setLoadedProperty('type', span === null ? 'Shape' : 'TextRange');\n }\n FILLERS.set(this, (read) => {\n this.#span = spanOf(read);\n this.setLoadedProperty('address', this.#written.get('address') ?? read.address ?? '');\n this.setLoadedProperty('screenTip', this.#written.get('screenTip') ?? read.screenTip ?? '');\n this.setLoadedProperty('type', read.type === 'shape' ? 'Shape' : 'TextRange');\n for (const settle of this.#waiting.splice(0)) settle(read);\n });\n }\n\n /** @internal A link a write just made, with the values it wrote. */\n static created(\n context: RequestContext,\n shape: ObjectPath,\n span: LinkSpan,\n address: string,\n screenTip: string\n ): Hyperlink {\n return new Hyperlink(\n context,\n ObjectPath.derived(`${shape.label}.hyperlink`, shape),\n shape,\n span,\n { address, screenTip }\n );\n }\n\n /** The address the link opens. */\n get address(): string {\n return this.loadedProperty('address');\n }\n set address(value: string) {\n this.#write('address', text(value, this.at('address')));\n }\n /** The tip that shows over the link. */\n get screenTip(): string {\n return this.loadedProperty('screenTip');\n }\n set screenTip(value: string) {\n this.#write('screenTip', text(value, this.at('screenTip')));\n }\n /** Whether the link is on a text range or on a whole shape. */\n get type(): HyperlinkType | `${HyperlinkType}` {\n return this.loadedProperty('type');\n }\n\n /** Remove the link. The text or shape stays. */\n delete(): void {\n this.command('delete', (ref) => this.#op(ref, null, undefined));\n }\n\n /** The shape a shape link is on, or a null object for a text link. */\n getLinkedShapeOrNullObject(): Shape {\n const label = `${this.path.label}.getLinkedShapeOrNullObject()`;\n if (this.#span === undefined) {\n // The lookup has not answered: the same read settles the shape.\n const path = this.#shape.sibling(label);\n this.#waiting.push((read) =>\n read.type === 'shape' ? path.resolveTo(read.shape) : path.resolveNull()\n );\n return new Shape(this.context, path, true);\n }\n if (this.#spanNow() !== null) {\n const none = ObjectPath.pending(label);\n none.resolveNull();\n return new Shape(this.context, none, true);\n }\n return new Shape(this.context, ObjectPath.derived(label, this.#shape), true);\n }\n\n /** The text range a text link is on, or a null object for a shape link. */\n getLinkedTextRangeOrNullObject(): TextRange {\n const label = `${this.path.label}.getLinkedTextRangeOrNullObject()`;\n if (this.#span === undefined) {\n // The lookup has not answered: the same read settles the range and its span.\n const { range, settle } = TextRange.later(this.context, this.#shape.sibling(label));\n this.#waiting.push((read) => {\n const span = spanOf(read);\n settle(span ? { shape: read.shape, span } : null);\n });\n return range;\n }\n if (this.#spanNow() === null) {\n const none = ObjectPath.pending(label);\n none.resolveNull();\n return new TextRange(this.context, none, none, undefined, true);\n }\n return new TextRange(\n this.context,\n ObjectPath.derived(label, this.#shape),\n this.#shape,\n this.#spanNow() ?? undefined,\n true\n );\n }\n\n /** The value to write for a property this proxy did not set: the loaded one, or empty. */\n #current(name: 'address' | 'screenTip'): string {\n return (\n this.#written.get(name) ??\n (this.hasLoadedProperty(name) ? this.loadedProperty<string>(name) : '')\n );\n }\n\n #spanNow(): AutomationTextSpan | null | undefined {\n return typeof this.#span === 'function' ? this.#span() : this.#span;\n }\n\n #op(ref: RefOf, address: string | null, screenTip: string | undefined): AutomationOperation {\n // `ref` first: for a lookup in this batch it waits for the read, which gives the span.\n const shape = ref(this.#shape);\n const tip = screenTip ? { screenTip } : {};\n const span = this.#spanNow();\n if (span === null) return { op: 'setShapeHyperlink', shape, address, ...tip };\n return { op: 'setHyperlink', shape, ...(span ? { span } : {}), address, ...tip };\n }\n\n /** Write one property. The other keeps its value, read when the batch is planned. */\n #write(name: 'address' | 'screenTip', value: string): void {\n this.#written.set(name, value);\n this.setLoadedProperty(name, value);\n this.command(name, (ref) =>\n this.#op(ref, this.#current('address'), this.#current('screenTip'))\n );\n }\n\n /** @internal Values come with the object; a load has nothing more to read. */\n protected override onLoad(request: ResolvedLoadOptions): void {\n this.selection(request, ['address', 'screenTip', 'type']);\n }\n}\n\n/** A list of hyperlinks that one read answers: of a slide, or of a text range. */\nabstract class HyperlinkList extends ModelObject {\n /** @internal The read that lists the hyperlinks. */\n protected abstract listing(ref: RefOf): AutomationOperation;\n\n /** The loaded hyperlinks. */\n get items(): Hyperlink[] {\n return this.loadedProperty<Hyperlink[]>('items');\n }\n\n /** The number of hyperlinks, after the next `sync()`. */\n getCount(): ClientResult<number> {\n const label = `${this.path.label}.getCount`;\n const { result, fill } = ClientResult.create<number>(label);\n this.enqueue(\n 'read',\n 'getCount',\n (ref) => this.listing(ref),\n (value) => fill(hydrated(value, 'hyperlinks', label).hyperlinks.length)\n );\n return result;\n }\n\n /** The hyperlink at a zero-based position; `ItemNotFound` at the sync when there is none. */\n getItemAt(index: number): Hyperlink {\n if (typeof index !== 'number' || !Number.isInteger(index) || index < 0)\n failArgument(`${this.path.label}.getItemAt`, 'a whole number of 0 or more');\n const path = ObjectPath.pending(`${this.path.label}.getItemAt(${index})`);\n const link = new Hyperlink(this.context, path, path, undefined);\n const label = path.label;\n this.enqueue(\n 'read',\n `getItemAt(${index})`,\n (ref) => this.listing(ref),\n (value) => {\n const found = hydrated(value, 'hyperlinks', label).hyperlinks[index];\n if (!found) fail({ code: 'ItemNotFound', target: label });\n FILLERS.get(link)?.(found);\n path.resolveTo(found.shape);\n },\n path,\n false\n );\n return link;\n }\n\n /** @internal */\n protected override get loadsItemPaths(): boolean {\n return true;\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n for (const name of [...request.select, ...request.itemSelect])\n if (!['items', 'address', 'screenTip', 'type'].includes(name))\n failArgument(\n `${this.path.label}.${name}`,\n 'a property of hyperlinks: items, address, screenTip, or type',\n nearest(name, ['items', 'address', 'screenTip', 'type'])\n );\n const label = `${this.path.label}.items`;\n this.enqueue(\n 'read',\n 'items',\n (ref) => this.listing(ref),\n (value) => {\n const reads = hydrated(value, 'hyperlinks', label).hyperlinks;\n this.setLoadedProperty(\n 'items',\n reads.map((read, i) => {\n const shape = ObjectPath.of(`${label}[${i}]`, read.shape);\n return new Hyperlink(this.context, shape, shape, spanOf(read), {\n address: read.address ?? '',\n screenTip: read.screenTip ?? '',\n });\n })\n );\n }\n );\n }\n}\n\n/**\n * The hyperlinks of a slide, in shape order.\n *\n * @public\n */\nexport class HyperlinkCollection extends HyperlinkList {\n readonly #slide: ObjectPath;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, slide: ObjectPath) {\n super(context, path);\n this.#slide = slide;\n }\n\n /** Link a text range or a whole shape. Answers the new hyperlink. */\n add(target: TextRange | Shape, options?: HyperlinkAddOptions): Hyperlink {\n if (target instanceof TextRange || target instanceof Shape) return target.setHyperlink(options);\n failArgument(`${this.path.label}.add`, 'a TextRange or a Shape');\n }\n\n /** @internal */\n protected override listing(ref: RefOf): AutomationOperation {\n return { op: 'listHyperlinks', slide: ref(this.#slide) };\n }\n}\n\n/**\n * The hyperlinks of a text range: each text link that overlaps the range, in text order. A link\n * keeps its whole span, so one that starts before the range reads from its own start. An empty\n * range holds the link around its point.\n *\n * @public\n */\nexport class HyperlinkScopedCollection extends HyperlinkList {\n readonly #shape: ObjectPath;\n readonly #span: () => AutomationTextSpan | undefined;\n\n /** @internal */\n constructor(\n context: RequestContext,\n path: ObjectPath,\n shape: ObjectPath,\n span: () => AutomationTextSpan | undefined\n ) {\n super(context, path);\n this.#shape = shape;\n this.#span = span;\n }\n\n /** @internal */\n protected override listing(ref: RefOf): AutomationOperation {\n // `ref` first: for a range a read finds, it waits for that read, which gives the span.\n const shape = ref(this.#shape);\n const span = this.#span();\n return { op: 'listTextHyperlinks', shape, ...(span ? { span } : {}) };\n }\n}\n\n/** The span of a text link, or null for a shape link. */\nfunction spanOf(read: AutomationHyperlinkRead | undefined): AutomationTextSpan | null {\n if (!read || read.type === 'shape' || read.start === null || read.length === null) return null;\n return { start: read.start, length: read.length };\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Text: Office.js `TextFrame`, `TextRange`, `ShapeFont`, `ParagraphFormat`, and `BulletFormat`.\n//\n// A text range is a shape and a span: UTF-16 offsets over the paragraphs joined with `\\r`, where\n// a line break (`a:br`) reads as `\\v`. A text write re-fits the text body by its autofit rules\n// (ECMA-376 Part 1, 21.1.2.1) when the host can measure text.\n//\n// A range whose span is known only after a read (the reader's selected text, a substring to the\n// end of the text) is over a pending path that read resolves; a call on it in the same sync\n// waits for that read, which the sync sends in an earlier round.\n\nimport type {\n AutomationCellAddress,\n AutomationHandle,\n AutomationFontWrite,\n AutomationOperation,\n AutomationParagraphWrite,\n AutomationTextFrameWrite,\n AutomationTextSpan,\n} from '@pptx-editor.dev/core/automation';\nimport { fail, failArgument } from '../runtime/errors.ts';\nimport { hydrated } from '../runtime/hydrate.ts';\nimport type { ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport {\n AUTO_SIZE,\n BULLET_STYLE,\n BULLET_TYPE,\n HORIZONTAL_ALIGNMENT,\n UNDERLINE,\n VERTICAL_ALIGNMENT,\n type BulletStyle,\n type BulletType,\n type ParagraphHorizontalAlignment,\n type ShapeAutoSize,\n type ShapeFontUnderlineStyle,\n type TextVerticalAlignment,\n} from './enums.ts';\nimport { Hyperlink, HyperlinkScopedCollection, type HyperlinkAddOptions } from './hyperlinks.ts';\nimport { finite, flag, ModelObject, text, type RefOf } from './model-object.ts';\nimport { Shape } from './shapes.ts';\n\nconst FRAME_NAMES = [\n 'autoSizeSetting',\n 'bottomMargin',\n 'leftMargin',\n 'rightMargin',\n 'topMargin',\n 'verticalAlignment',\n 'wordWrap',\n 'hasText',\n] as const;\n\n/**\n * The text frame of a shape (`p:txBody` and its `a:bodyPr`).\n *\n * @public\n */\nexport class TextFrame extends ModelObject {\n readonly #shape: ObjectPath;\n #range: TextRange | undefined;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath, shape: ObjectPath, nullable = false) {\n super(context, path, { nullable });\n this.#shape = shape;\n }\n\n /** How the text and the shape fit each other. */\n get autoSizeSetting(): ShapeAutoSize | `${ShapeAutoSize}` {\n return this.loadedProperty('autoSizeSetting');\n }\n set autoSizeSetting(value: ShapeAutoSize | `${ShapeAutoSize}`) {\n const autoSize = AUTO_SIZE.toFile(value, 'autoSizeSetting') as 'none' | 'normal' | 'shape';\n this.#write('autoSizeSetting', { autoSize });\n }\n /** The bottom inset, in points. */\n get bottomMargin(): number {\n return this.loadedProperty('bottomMargin');\n }\n set bottomMargin(value: number) {\n this.#write('bottomMargin', { bottomMargin: finite(value, this.at('bottomMargin')) });\n }\n /** The left inset, in points. */\n get leftMargin(): number {\n return this.loadedProperty('leftMargin');\n }\n set leftMargin(value: number) {\n this.#write('leftMargin', { leftMargin: finite(value, this.at('leftMargin')) });\n }\n /** The right inset, in points. */\n get rightMargin(): number {\n return this.loadedProperty('rightMargin');\n }\n set rightMargin(value: number) {\n this.#write('rightMargin', { rightMargin: finite(value, this.at('rightMargin')) });\n }\n /** The top inset, in points. */\n get topMargin(): number {\n return this.loadedProperty('topMargin');\n }\n set topMargin(value: number) {\n this.#write('topMargin', { topMargin: finite(value, this.at('topMargin')) });\n }\n /** The vertical anchor of the text. */\n get verticalAlignment(): TextVerticalAlignment | `${TextVerticalAlignment}` {\n return this.loadedProperty('verticalAlignment');\n }\n set verticalAlignment(value: TextVerticalAlignment | `${TextVerticalAlignment}`) {\n this.#write('verticalAlignment', {\n verticalAlignment: VERTICAL_ALIGNMENT.toFile(value, 'verticalAlignment'),\n });\n }\n /** Whether lines wrap at the frame width. */\n get wordWrap(): boolean {\n return this.loadedProperty('wordWrap');\n }\n set wordWrap(value: boolean) {\n this.#write('wordWrap', { wordWrap: flag(value, this.at('wordWrap')) });\n }\n /** Whether the frame holds any text. */\n get hasText(): boolean {\n return this.loadedProperty('hasText');\n }\n\n /** All the text of the frame. */\n get textRange(): TextRange {\n return (this.#range ??= new TextRange(\n this.context,\n ObjectPath.derived(`${this.path.label}.textRange`, this.path),\n this.#shape,\n undefined\n ));\n }\n\n /** Delete all the text. */\n deleteText(): void {\n const shape = this.#shape;\n this.command('deleteText', (ref) => ({ op: 'setText', shape: ref(shape), text: '' }));\n }\n\n /** The shape that holds the frame. */\n getParentShape(): Shape {\n return new Shape(this.context, this.#shape);\n }\n\n #write(name: string, props: AutomationTextFrameWrite): void {\n const shape = this.#shape;\n this.command(name, (ref) => ({ op: 'setTextFrame', shape: ref(shape), props }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, FRAME_NAMES, { textRange: () => this.textRange });\n const shape = this.#shape;\n this.loadScalars(\n names,\n 'textFrame',\n (ref) => ({ op: 'readTextFrame', shape: ref(shape) }),\n (v) => ({\n ...v.textFrame,\n autoSizeSetting: AUTO_SIZE.fromFile(v.textFrame.autoSize) ?? 'AutoSizeMixed',\n verticalAlignment: VERTICAL_ALIGNMENT.fromFile(v.textFrame.verticalAlignment) ?? 'Top',\n })\n );\n }\n}\n\n/** The table cell a text operation addresses, spread into it; empty for a shape's own text. */\ntype CellArg = { readonly cell?: AutomationCellAddress };\n\n/** A span, or the whole text when absent. */\ntype Span = AutomationTextSpan | undefined;\n\n/** The read of a paragraph format, planned against the batch. */\ntype ParagraphRead = (ref: RefOf) => AutomationOperation;\n\n/**\n * A run of text in a text frame.\n *\n * @public\n */\nexport class TextRange extends ModelObject {\n readonly #shape: ObjectPath;\n #span: Span;\n #font: ShapeFont | undefined;\n #paragraph: ParagraphFormat | undefined;\n #hyperlinks: HyperlinkScopedCollection | undefined;\n\n /** @internal */\n constructor(\n context: RequestContext,\n path: ObjectPath,\n shape: ObjectPath,\n span: Span,\n nullable = false\n ) {\n super(context, path, { nullable });\n this.#shape = shape;\n this.#span = span;\n }\n\n /** @internal The reader's selected text, over a pending path the selection read resolves. */\n static selected(owner: ModelObject, name: string, nullable: boolean): TextRange {\n const path = ObjectPath.pending(`presentation.${name}`);\n const range = new TextRange(owner.context, path, path, undefined, nullable);\n range.enqueue(\n 'read',\n '',\n () => ({ op: 'readSelection' }),\n (value) => {\n const selected = hydrated(value, 'selection', path.label).selection.text;\n if (!selected) {\n if (nullable) return path.resolveNull();\n fail({ code: 'ItemNotFound', target: path.label });\n }\n range.#span = { start: selected.start, length: selected.length };\n path.resolveTo(selected.shape);\n },\n path,\n false\n );\n return range;\n }\n\n /**\n * @internal A nullable range over a pending path whose shape and span a later read gives:\n * the text range of a hyperlink that a lookup finds. `settle` resolves it, or marks it null.\n */\n static later(\n context: RequestContext,\n path: ObjectPath\n ): { range: TextRange; settle: (to: { shape: AutomationHandle; span: Span } | null) => void } {\n const range = new TextRange(context, path, path, undefined, true);\n return {\n range,\n settle(to) {\n if (!to) return path.resolveNull();\n range.#span = to.span;\n path.resolveTo(to.shape);\n },\n };\n }\n\n /** The text. Paragraphs are separated by `\\r`, and a line break reads as `\\v`. */\n get text(): string {\n return this.loadedProperty('text');\n }\n set text(value: string) {\n const body = text(value, this.at('text'));\n this.command('text', (ref) => ({\n op: 'setText',\n shape: ref(this.#shape),\n ...this.#spanArg(),\n text: body,\n }));\n }\n /** The zero-based start of the range in the text of the frame. */\n get start(): number {\n return this.loadedProperty('start');\n }\n set start(value: number) {\n const start = this.#offset(value, 'start');\n const length = this.#span?.length ?? this.#loadedLength();\n this.#span = { start, length };\n this.setLoadedProperty('start', start);\n }\n /** The length of the range. */\n get length(): number {\n return this.loadedProperty('length');\n }\n set length(value: number) {\n const length = this.#offset(value, 'length');\n this.#span = { start: this.#span?.start ?? 0, length };\n this.setLoadedProperty('length', length);\n }\n\n /** The character formatting of the range. */\n get font(): ShapeFont {\n return (this.#font ??= new ShapeFont(\n this.context,\n ObjectPath.derived(`${this.path.label}.font`, this.path),\n this.#shape,\n () => this.#span\n ));\n }\n /** The paragraph formatting of the paragraphs the range touches. */\n get paragraphFormat(): ParagraphFormat {\n return (this.#paragraph ??= new ParagraphFormat(\n this.context,\n ObjectPath.derived(`${this.path.label}.paragraphFormat`, this.path),\n this.#shape,\n () => this.#span\n ));\n }\n\n /** The text links that overlap the range, in text order. */\n get hyperlinks(): HyperlinkScopedCollection {\n return (this.#hyperlinks ??= new HyperlinkScopedCollection(\n this.context,\n ObjectPath.derived(`${this.path.label}.hyperlinks`, this.path),\n this.#shape,\n () => this.#span\n ));\n }\n\n /** The text frame that holds the range. */\n getParentTextFrame(): TextFrame {\n return new TextFrame(\n this.context,\n ObjectPath.derived(`${this.path.label}.getParentTextFrame()`, this.#shape),\n this.#shape\n );\n }\n\n /**\n * A range inside this one, from `start` (relative to this range) for `length` characters, or\n * to the end of this range when `length` is absent.\n */\n getSubstring(start: number, length?: number): TextRange {\n const from = this.#offset(start, 'start');\n const count = length === undefined ? undefined : this.#offset(length, 'length');\n const base = this.#span;\n if (base && count !== undefined) {\n if (from + count > base.length)\n failArgument(\n `${this.path.label}.getSubstring`,\n 'a start and a length inside the text range'\n );\n return this.#sub({ start: base.start + from, length: count });\n }\n if (base) {\n if (from > base.length)\n failArgument(`${this.path.label}.getSubstring`, 'a start inside the text range');\n return this.#sub({ start: base.start + from, length: base.length - from });\n }\n if (count !== undefined) return this.#sub({ start: from, length: count });\n // To the end of the whole text: the length is known after a read of the text.\n const path = ObjectPath.pending(`${this.path.label}.getSubstring()`);\n const range = new TextRange(this.context, path, path, undefined);\n const shape = this.#shape;\n this.enqueue(\n 'read',\n 'getSubstring()',\n (ref) => ({ op: 'readText', shape: ref(shape) }),\n (value) => {\n const all = hydrated(value, 'text', path.label).text;\n if (from > all.length) failArgument(path.label, 'a start inside the text');\n range.#span = { start: from, length: all.length - from };\n path.resolveTo(shape.handle());\n },\n path,\n false\n );\n return range;\n }\n\n /** Select the range in the editor. A server runtime refuses with `NotSupported`. */\n setSelected(): void {\n this.command('setSelected', (ref) => ({\n op: 'selectText',\n shape: ref(this.#shape),\n ...this.#spanArg(),\n }));\n }\n\n /** Link the range to an address. Answers the hyperlink. */\n setHyperlink(options?: HyperlinkAddOptions): Hyperlink {\n const address = text(options?.address ?? '', this.at('address'));\n const screenTip = options?.screenTip;\n if (screenTip !== undefined) text(screenTip, this.at('screenTip'));\n this.command('setHyperlink', (ref) => ({\n op: 'setHyperlink',\n shape: ref(this.#shape),\n ...this.#spanArg(),\n address,\n ...(screenTip === undefined ? {} : { screenTip }),\n }));\n return Hyperlink.created(this.context, this.#shape, () => this.#span, address, screenTip ?? '');\n }\n\n #sub(span: AutomationTextSpan): TextRange {\n return new TextRange(\n this.context,\n ObjectPath.derived(`${this.path.label}.getSubstring()`, this.#shape),\n this.#shape,\n span\n );\n }\n\n #spanArg(): { span?: AutomationTextSpan } {\n return this.#span ? { span: this.#span } : {};\n }\n\n #offset(value: unknown, name: string): number {\n if (typeof value !== 'number' || !Number.isInteger(value) || value < 0)\n failArgument(`${this.path.label}.${name}`, 'a whole number of 0 or more');\n return value;\n }\n\n #loadedLength(): number {\n if (!this.hasLoadedProperty('length'))\n fail({ code: 'PropertyNotLoaded', target: `${this.path.label}.length` });\n return this.loadedProperty<number>('length');\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, ['text', 'start', 'length'], {\n font: () => this.font,\n paragraphFormat: () => this.paragraphFormat,\n hyperlinks: () => this.hyperlinks,\n });\n this.loadScalars(\n names,\n 'text',\n (ref) => ({ op: 'readText', shape: ref(this.#shape), ...this.#spanArg() }),\n (v) => ({\n text: v.text,\n start: this.#span?.start ?? 0,\n length: this.#span?.length ?? v.text.length,\n })\n );\n }\n}\n\nconst FONT_NAMES = [\n 'allCaps',\n 'bold',\n 'color',\n 'doubleStrikethrough',\n 'italic',\n 'name',\n 'size',\n 'smallCaps',\n 'strikethrough',\n 'subscript',\n 'superscript',\n 'underline',\n] as const;\n\n/**\n * The character formatting of a text range. A property reads `null` when the range mixes values.\n *\n * @public\n */\nexport class ShapeFont extends ModelObject {\n readonly #shape: ObjectPath;\n readonly #span: () => Span;\n readonly #cell: CellArg;\n\n /** @internal */\n constructor(\n context: RequestContext,\n path: ObjectPath,\n shape: ObjectPath,\n span: () => Span,\n cell?: AutomationCellAddress\n ) {\n super(context, path);\n this.#shape = shape;\n this.#span = span;\n this.#cell = cell ? { cell } : {};\n }\n\n get allCaps(): boolean | null {\n return this.loadedProperty('allCaps');\n }\n set allCaps(value: boolean | null) {\n this.#write('allCaps', { allCaps: flag(value, this.at('allCaps')) });\n }\n get bold(): boolean | null {\n return this.loadedProperty('bold');\n }\n set bold(value: boolean | null) {\n this.#write('bold', { bold: flag(value, this.at('bold')) });\n }\n /** The color as `#RRGGBB`. */\n get color(): string | null {\n return this.loadedProperty('color');\n }\n set color(value: string | null) {\n this.#write('color', { color: text(value, this.at('color')) });\n }\n get doubleStrikethrough(): boolean | null {\n return this.loadedProperty('doubleStrikethrough');\n }\n set doubleStrikethrough(value: boolean | null) {\n this.#write('doubleStrikethrough', {\n doubleStrikethrough: flag(value, this.at('doubleStrikethrough')),\n });\n }\n get italic(): boolean | null {\n return this.loadedProperty('italic');\n }\n set italic(value: boolean | null) {\n this.#write('italic', { italic: flag(value, this.at('italic')) });\n }\n /** The font family name. */\n get name(): string | null {\n return this.loadedProperty('name');\n }\n set name(value: string | null) {\n this.#write('name', { name: text(value, this.at('name')) });\n }\n /** The size, in points. */\n get size(): number | null {\n return this.loadedProperty('size');\n }\n set size(value: number | null) {\n this.#write('size', { size: finite(value, this.at('size')) });\n }\n get smallCaps(): boolean | null {\n return this.loadedProperty('smallCaps');\n }\n set smallCaps(value: boolean | null) {\n this.#write('smallCaps', { smallCaps: flag(value, this.at('smallCaps')) });\n }\n get strikethrough(): boolean | null {\n return this.loadedProperty('strikethrough');\n }\n set strikethrough(value: boolean | null) {\n this.#write('strikethrough', { strikethrough: flag(value, this.at('strikethrough')) });\n }\n get subscript(): boolean | null {\n return this.loadedProperty('subscript');\n }\n set subscript(value: boolean | null) {\n this.#write('subscript', { subscript: flag(value, this.at('subscript')) });\n }\n get superscript(): boolean | null {\n return this.loadedProperty('superscript');\n }\n set superscript(value: boolean | null) {\n this.#write('superscript', { superscript: flag(value, this.at('superscript')) });\n }\n get underline(): ShapeFontUnderlineStyle | `${ShapeFontUnderlineStyle}` | null {\n return this.loadedProperty('underline');\n }\n set underline(value: ShapeFontUnderlineStyle | `${ShapeFontUnderlineStyle}` | null) {\n this.#write('underline', { underline: UNDERLINE.toFile(value, 'underline') });\n }\n\n #write(name: string, font: AutomationFontWrite): void {\n const shape = this.#shape;\n this.command(name, (ref: RefOf) => {\n const span = this.#span();\n return { op: 'setFont', shape: ref(shape), ...(span ? { span } : {}), ...this.#cell, font };\n });\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, FONT_NAMES);\n const shape = this.#shape;\n this.loadScalars(\n names,\n 'font',\n (ref) => {\n const span = this.#span();\n return { op: 'readFont', shape: ref(shape), ...(span ? { span } : {}), ...this.#cell };\n },\n (v) => ({ ...v.font, underline: UNDERLINE.fromFile(v.font.underline) })\n );\n }\n}\n\n/**\n * The paragraph formatting of the paragraphs a text range touches. A property reads `null` when\n * they differ.\n *\n * @public\n */\nexport class ParagraphFormat extends ModelObject {\n readonly #shape: ObjectPath;\n readonly #span: () => Span;\n readonly #cell: CellArg;\n #bullets: BulletFormat | undefined;\n\n /** @internal */\n constructor(\n context: RequestContext,\n path: ObjectPath,\n shape: ObjectPath,\n span: () => Span,\n cell?: AutomationCellAddress\n ) {\n super(context, path);\n this.#shape = shape;\n this.#span = span;\n this.#cell = cell ? { cell } : {};\n }\n\n /** The horizontal alignment (`a:pPr/@algn`). */\n get horizontalAlignment():\n ParagraphHorizontalAlignment | `${ParagraphHorizontalAlignment}` | null {\n return this.loadedProperty('horizontalAlignment');\n }\n set horizontalAlignment(\n value: ParagraphHorizontalAlignment | `${ParagraphHorizontalAlignment}` | null\n ) {\n this.#write('horizontalAlignment', {\n alignment: HORIZONTAL_ALIGNMENT.toFile(value, 'horizontalAlignment'),\n });\n }\n /**\n * The outline level from 1 to 9, as for `TableCell.indentLevel`: one more than `a:pPr/@lvl`,\n * so a paragraph with no `lvl` reads 1.\n */\n get indentLevel(): number {\n return this.loadedProperty('indentLevel');\n }\n set indentLevel(value: number) {\n this.#write('indentLevel', { indentLevel: finite(value, this.at('indentLevel')) });\n }\n /** The bullets of the paragraphs. */\n get bulletFormat(): BulletFormat {\n return (this.#bullets ??= new BulletFormat(\n this.context,\n ObjectPath.derived(`${this.path.label}.bulletFormat`, this.path),\n (name, paragraph) => this.#write(name, paragraph),\n () => this.#plan()\n ));\n }\n\n #plan(): ParagraphRead {\n const shape = this.#shape;\n return (ref) => {\n const span = this.#span();\n return { op: 'readParagraph', shape: ref(shape), ...(span ? { span } : {}), ...this.#cell };\n };\n }\n\n #write(name: string, paragraph: AutomationParagraphWrite): void {\n const shape = this.#shape;\n this.command(name, (ref) => {\n const span = this.#span();\n return {\n op: 'setParagraph',\n shape: ref(shape),\n ...(span ? { span } : {}),\n ...this.#cell,\n paragraph,\n };\n });\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, ['horizontalAlignment', 'indentLevel'], {\n bulletFormat: () => this.bulletFormat,\n });\n this.loadScalars(names, 'paragraph', this.#plan(), (v) => ({\n horizontalAlignment: HORIZONTAL_ALIGNMENT.fromFile(v.paragraph.alignment),\n indentLevel: v.paragraph.indentLevel,\n }));\n }\n}\n\n/**\n * The bullets of paragraphs (`a:buNone`, `a:buChar`, `a:buAutoNum`).\n *\n * @public\n */\nexport class BulletFormat extends ModelObject {\n readonly #write: (name: string, paragraph: AutomationParagraphWrite) => void;\n readonly #plan: () => ParagraphRead;\n\n /** @internal */\n constructor(\n context: RequestContext,\n path: ObjectPath,\n write: (name: string, paragraph: AutomationParagraphWrite) => void,\n plan: () => ParagraphRead\n ) {\n super(context, path);\n this.#write = write;\n this.#plan = plan;\n }\n\n /** The numbering scheme of numbered bullets, or `null` when the paragraphs differ. */\n get style(): BulletStyle | `${BulletStyle}` | null {\n return this.loadedProperty('style');\n }\n set style(value: BulletStyle | `${BulletStyle}` | null) {\n this.#write('style', { bulletStyle: BULLET_STYLE.toFile(value, 'style') });\n }\n /** The kind of bullet, or `null` when the paragraphs differ. */\n get type(): BulletType | `${BulletType}` | null {\n return this.loadedProperty('type');\n }\n set type(value: BulletType | `${BulletType}` | null) {\n const bulletType = BULLET_TYPE.toFile(value, 'type') as 'none' | 'char' | 'autonum';\n this.#write('type', { bulletType });\n }\n /** Whether the paragraphs show bullets, or `null` when they differ. */\n get visible(): boolean | null {\n return this.loadedProperty('visible');\n }\n set visible(value: boolean | null) {\n this.#write('visible', { bulletVisible: flag(value, this.at('visible')) });\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, ['style', 'type', 'visible']);\n this.loadScalars(names, 'paragraph', this.#plan(), (v) => ({\n style:\n v.paragraph.bulletStyle === null ? null : BULLET_STYLE.fromFile(v.paragraph.bulletStyle),\n type: v.paragraph.bulletType === null ? null : BULLET_TYPE.fromFile(v.paragraph.bulletType),\n visible: v.paragraph.bulletVisible,\n }));\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Office.js `Binding` and `BindingCollection`: named links from code to shapes.\n//\n// A binding is not file content: ECMA-376 has no element for it. The runtime keeps its bindings\n// in memory for its lifetime, keyed to shapes as shape objects are, and never writes them to\n// the package, so a save, a reopen, or another runtime over the same bytes has none. A binding\n// outlives its shape: it stays listed, and `getShape` refuses with `ItemNotFound`.\n\nimport type { AutomationBindingRead } from '@pptx-editor.dev/core/automation';\nimport { ClientResult } from '../runtime/client-result.ts';\nimport { fail, failArgument, nearest } from '../runtime/errors.ts';\nimport { hydrated } from '../runtime/hydrate.ts';\nimport type { ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport { BindingType } from './enums.ts';\nimport { ModelObject, pathOf } from './model-object.ts';\nimport { Shape } from './shapes.ts';\n\n/** A binding id, or `InvalidArgument`: a string of 1 to 255 characters. */\nfunction idOf(value: unknown, target: string): string {\n if (typeof value !== 'string' || value.length === 0 || value.length > 255)\n failArgument(target, 'a string of 1 to 255 characters');\n return value;\n}\n\n/** A binding type, or `InvalidArgument`. Only `Shape`. */\nfunction typeOf(value: unknown, target: string): void {\n if (value !== BindingType.shape) failArgument(target, \"'Shape'\");\n}\n\n/** Fills a binding a lookup by position found. Module-private, so no consumer can call it. */\nconst FILLERS = new WeakMap<Binding, (id: string) => void>();\n\n/**\n * A binding: an id that names one shape for the lifetime of the runtime.\n *\n * @public\n */\nexport class Binding extends ModelObject {\n #id: string;\n\n /**\n * @internal The path resolves to the presentation; the id names the binding. An empty id: a\n * lookup by position that has not answered, and nothing is loaded until it does.\n */\n constructor(context: RequestContext, path: ObjectPath, id: string, nullable = false) {\n super(context, path, { nullable });\n this.#id = id;\n const fill = (found: string): void => {\n this.#id = found;\n this.setLoadedProperty('id', found);\n this.setLoadedProperty('type', BindingType.shape);\n };\n if (id) fill(id);\n FILLERS.set(this, fill);\n }\n\n /** The id of the binding. */\n get id(): string {\n return this.loadedProperty('id');\n }\n /** What the binding names. Always `Shape`. */\n get type(): 'Shape' | BindingType {\n return this.loadedProperty('type');\n }\n\n /** Delete the binding. The shape stays. */\n delete(): void {\n // `ref` first: for a lookup in this batch it waits for the read, which gives the id.\n this.command('delete', (ref) => ({ op: 'deleteBinding', owner: ref(this.path), id: this.#id }));\n }\n\n /** The shape the binding names. A binding whose shape is gone refuses with `ItemNotFound`. */\n getShape(): Shape {\n return this.navigation(\n 'getShape()',\n (path) => new Shape(this.context, path),\n (ref) => ({ op: 'getBindingShape', owner: ref(this.path), id: this.#id })\n );\n }\n\n /** @internal The id and the type come with the object; a load has nothing more to read. */\n protected override onLoad(request: ResolvedLoadOptions): void {\n this.selection(request, ['id', 'type']);\n }\n}\n\n/**\n * The bindings of the runtime, in the order they were added. They live in memory and are never\n * saved with the presentation.\n *\n * @example\n * ```ts\n * await runtime.run(async (context) => {\n * const shape = context.presentation.slides.getItemAt(0).shapes.getItemAt(0);\n * context.presentation.bindings.add(shape, 'Shape', 'title');\n * await context.sync();\n * });\n * ```\n *\n * @public\n */\nexport class BindingCollection extends ModelObject {\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath) {\n super(context, path);\n }\n\n /** The loaded bindings. */\n get items(): Binding[] {\n return this.loadedProperty<Binding[]>('items');\n }\n\n /** Bind a shape under `id`. A binding that has that id moves to the shape. */\n add(shape: Shape, bindingType: BindingType, id: string): Binding;\n /** Bind a shape under `id`. A binding that has that id moves to the shape. */\n add(shape: Shape, bindingType: 'Shape', id: string): Binding;\n add(shape: Shape, bindingType: BindingType | 'Shape', id: string): Binding {\n const target = `${this.path.label}.add`;\n if (!(shape instanceof Shape)) failArgument(target, 'a Shape');\n typeOf(bindingType, target);\n const key = idOf(id, target);\n const shapePath = pathOf(shape);\n this.command('add', (ref) => ({\n op: 'addBinding',\n owner: ref(this.path),\n shape: ref(shapePath),\n id: key,\n }));\n return new Binding(this.context, ObjectPath.derived(`${target}()`, this.path), key);\n }\n\n /**\n * Bind the one selected shape under `id`. Needs a runtime over a live editor; any selection\n * other than one shape refuses with `InvalidArgument`.\n */\n addFromSelection(bindingType: BindingType, id: string): Binding;\n /**\n * Bind the one selected shape under `id`. Needs a runtime over a live editor; any selection\n * other than one shape refuses with `InvalidArgument`.\n */\n addFromSelection(bindingType: 'Shape', id: string): Binding;\n addFromSelection(bindingType: BindingType | 'Shape', id: string): Binding {\n const target = `${this.path.label}.addFromSelection`;\n typeOf(bindingType, target);\n const key = idOf(id, target);\n this.command('addFromSelection', (ref) => ({\n op: 'addBindingFromSelection',\n owner: ref(this.path),\n id: key,\n }));\n return new Binding(this.context, ObjectPath.derived(`${target}()`, this.path), key);\n }\n\n /** The number of bindings, after the next `sync()`. */\n getCount(): ClientResult<number> {\n const label = `${this.path.label}.getCount`;\n const { result, fill } = ClientResult.create<number>(label);\n this.enqueue(\n 'read',\n 'getCount',\n (ref) => ({ op: 'listBindings', owner: ref(this.path) }),\n (value) => fill(hydrated(value, 'bindings', label).bindings.length)\n );\n return result;\n }\n\n /** The binding with this id; `ItemNotFound` at the sync when there is none. */\n getItem(key: string): Binding {\n const id = idOf(key, `${this.path.label}.getItem`);\n return this.#find('getItem()', (all) => all.find((b) => b.id === id), id, false);\n }\n\n /** The binding at a zero-based position; `ItemNotFound` at the sync when there is none. */\n getItemAt(index: number): Binding {\n if (typeof index !== 'number' || !Number.isInteger(index) || index < 0)\n failArgument(`${this.path.label}.getItemAt`, 'a whole number of 0 or more');\n return this.#find(`getItemAt(${index})`, (all) => all[index], undefined, false);\n }\n\n /** The binding with this id, or a null object. */\n getItemOrNullObject(key: string): Binding {\n const id = idOf(key, `${this.path.label}.getItemOrNullObject`);\n return this.#find('getItemOrNullObject()', (all) => all.find((b) => b.id === id), id, true);\n }\n\n /** A binding over a pending path that a listing resolves to the presentation, or null. */\n #find(\n name: string,\n pick: (all: readonly AutomationBindingRead[]) => AutomationBindingRead | undefined,\n id: string | undefined,\n orNull: boolean\n ): Binding {\n const path = ObjectPath.pending(`${this.path.label}.${name}`);\n const binding = new Binding(this.context, path, id ?? '', orNull);\n const label = path.label;\n this.enqueue(\n 'read',\n name,\n (ref) => ({ op: 'listBindings', owner: ref(this.path) }),\n (value) => {\n const read = pick(hydrated(value, 'bindings', label).bindings);\n if (!read) {\n if (orNull) return path.resolveNull();\n fail({ code: 'ItemNotFound', target: label });\n }\n FILLERS.get(binding)?.(read.id);\n path.resolveTo(this.path.handle());\n },\n path,\n false\n );\n return binding;\n }\n\n /** @internal */\n protected override get loadsItemPaths(): boolean {\n return true;\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n for (const name of [...request.select, ...request.itemSelect])\n if (!['items', 'id', 'type'].includes(name))\n failArgument(\n `${this.path.label}.${name}`,\n 'a property of bindings: items, id, or type',\n nearest(name, ['items', 'id', 'type'])\n );\n const label = `${this.path.label}.items`;\n this.enqueue(\n 'read',\n 'items',\n (ref) => ({ op: 'listBindings', owner: ref(this.path) }),\n (value) => {\n const all = hydrated(value, 'bindings', label).bindings;\n const end = request.top === undefined ? all.length : (request.skip ?? 0) + request.top;\n this.setLoadedProperty(\n 'items',\n all\n .slice(request.skip ?? 0, end)\n .map(\n (read, i) =>\n new Binding(\n this.context,\n ObjectPath.of(`${label}[${i}]`, this.path.handle()),\n read.id\n )\n )\n );\n }\n );\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Office.js `CustomProperty` and `CustomPropertyCollection`: the custom document properties of\n// the presentation (`docProps/custom.xml`, ECMA-376 Part 1, 22.3). Keys compare without case. A\n// property of a variant type other than String, Number, Boolean, or Date is not listed, and\n// `deleteAll` keeps it. An `add` with its key replaces it, as in Office.js: a key names one\n// property.\n\nimport type {\n AutomationCustomPropertyRead,\n AutomationCustomPropertyWrite,\n} from '@pptx-editor.dev/core/automation';\nimport { ClientResult } from '../runtime/client-result.ts';\nimport { fail, failArgument, nearest } from '../runtime/errors.ts';\nimport { hydrated } from '../runtime/hydrate.ts';\nimport type { ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport type { DocumentPropertyType } from './enums.ts';\nimport { ModelObject } from './model-object.ts';\n\n/** The value types a custom property holds. */\ntype CustomValue = boolean | Date | number | string;\n\n/** Fills a property a read found. Module-private, so no consumer can call it. */\nconst FILLERS = new WeakMap<CustomProperty, (read: AutomationCustomPropertyRead) => void>();\n\nfunction fillProperty(property: CustomProperty, read: AutomationCustomPropertyRead): void {\n FILLERS.get(property)?.(read);\n}\n\n/** The value a read gives, as the object model shows it: a Date for a Date property. */\nfunction shown(read: AutomationCustomPropertyRead): CustomValue {\n return read.type === 'Date' ? new Date(read.value as string) : read.value;\n}\n\n/** A value as the protocol writes it, or `InvalidArgument` naming `target`. */\nfunction written(value: unknown, target: string): AutomationCustomPropertyWrite {\n if (typeof value === 'string') return { type: 'String', value };\n if (typeof value === 'number' && Number.isFinite(value)) return { type: 'Number', value };\n if (typeof value === 'boolean') return { type: 'Boolean', value };\n if (value instanceof Date && Number.isFinite(value.getTime()))\n return { type: 'Date', value: value.toISOString() };\n return failArgument(target, 'a string, a finite number, a boolean, or a valid Date');\n}\n\n/** A key, or `InvalidArgument`. Up to 255 characters. */\nfunction keyOf(value: unknown, target: string): string {\n if (typeof value !== 'string' || value.length === 0 || value.length > 255)\n failArgument(target, 'a key of 1 to 255 characters');\n return value;\n}\n\nconst sameKey = (a: string, b: string): boolean => a.toLowerCase() === b.toLowerCase();\n\n/**\n * One custom document property: a key, a type, and a value.\n *\n * @public\n */\nexport class CustomProperty extends ModelObject {\n readonly #owner: ObjectPath;\n #key: string;\n\n /** @internal */\n constructor(\n context: RequestContext,\n path: ObjectPath,\n owner: ObjectPath,\n key: string,\n nullable = false\n ) {\n super(context, path, { nullable });\n this.#owner = owner;\n this.#key = key;\n if (key) this.setLoadedProperty('key', key);\n FILLERS.set(this, (read) => {\n this.#key = read.key;\n this.setLoadedProperty('key', read.key);\n this.setLoadedProperty('type', read.type);\n this.setLoadedProperty('value', shown(read));\n });\n }\n\n /** The key. Lookups compare keys without case. */\n get key(): string {\n return this.loadedProperty('key');\n }\n /** The type of the value. */\n get type(): DocumentPropertyType | 'Boolean' | 'Date' | 'Number' | 'String' {\n return this.loadedProperty('type');\n }\n /** The value. A write of another JavaScript type changes the type too. */\n get value(): boolean | Date | number | string {\n return this.loadedProperty('value');\n }\n set value(value: boolean | Date | number | string) {\n const v = written(value, this.at('value'));\n // The property's path resolves to the presentation, so it names it once its lookup answered.\n this.command('value', (ref) => ({\n op: 'setCustomProperty',\n owner: ref(this.path),\n key: this.#key,\n value: v,\n }));\n }\n\n /** Delete the property. */\n delete(): void {\n this.command('delete', (ref) => ({\n op: 'deleteCustomProperty',\n owner: ref(this.path),\n key: this.#key,\n }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, ['key', 'type', 'value']);\n if (!names.includes('type') && !names.includes('value')) return;\n const label = `${this.path.label}.load`;\n this.enqueue(\n 'read',\n 'load',\n (ref) => ({ op: 'readCustomProperties', owner: ref(this.#owner) }),\n (value) => {\n if (value.kind === 'null') return;\n const found = hydrated(value, 'customProperties', label).properties.find((p) =>\n sameKey(p.key, this.#key)\n );\n if (found) fillProperty(this, found);\n }\n );\n }\n}\n\n/**\n * The custom document properties of the presentation.\n *\n * @example\n * ```ts\n * await runtime.run(async (context) => {\n * const custom = context.presentation.properties.customProperties;\n * custom.add('Client', 'Northwind');\n * custom.add('Reviewed', new Date());\n * await context.sync();\n * });\n * ```\n *\n * @public\n */\nexport class CustomPropertyCollection extends ModelObject {\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath) {\n super(context, path);\n }\n\n /** The loaded properties. */\n get items(): CustomProperty[] {\n return this.loadedProperty<CustomProperty[]>('items');\n }\n\n /** Add a property, or set the value and type of the property with this key. */\n add(key: string, value: boolean | Date | number | string): CustomProperty {\n const k = keyOf(key, `${this.path.label}.add`);\n const v = written(value, `${this.path.label}.add`);\n this.command('add', (ref) => ({\n op: 'setCustomProperty',\n owner: ref(this.path),\n key: k,\n value: v,\n }));\n const property = new CustomProperty(\n this.context,\n ObjectPath.derived(`${this.path.label}.add()`, this.path),\n this.path,\n k\n );\n return property;\n }\n\n /** Delete every listed property. A property of another variant type stays. */\n deleteAll(): void {\n this.command('deleteAll', (ref) => ({ op: 'deleteCustomProperties', owner: ref(this.path) }));\n }\n\n /** The number of properties, after the next `sync()`. */\n getCount(): ClientResult<number> {\n const label = `${this.path.label}.getCount`;\n const { result, fill } = ClientResult.create<number>(label);\n this.enqueue(\n 'read',\n 'getCount',\n (ref) => ({ op: 'readCustomProperties', owner: ref(this.path) }),\n (value) => fill(hydrated(value, 'customProperties', label).properties.length)\n );\n return result;\n }\n\n /** The property with this key; `ItemNotFound` at the sync when there is none. */\n getItem(key: string): CustomProperty {\n const k = keyOf(key, `${this.path.label}.getItem`);\n return this.#find('getItem()', (all) => all.find((p) => sameKey(p.key, k)), k, false);\n }\n\n /** The property at a zero-based position; `ItemNotFound` at the sync when there is none. */\n getItemAt(index: number): CustomProperty {\n if (typeof index !== 'number' || !Number.isInteger(index) || index < 0)\n failArgument(`${this.path.label}.getItemAt`, 'a whole number of 0 or more');\n return this.#find(`getItemAt(${index})`, (all) => all[index], undefined, false);\n }\n\n /** The property with this key, or a null object. */\n getItemOrNullObject(key: string): CustomProperty {\n const k = keyOf(key, `${this.path.label}.getItemOrNullObject`);\n return this.#find(\n 'getItemOrNullObject()',\n (all) => all.find((p) => sameKey(p.key, k)),\n k,\n true\n );\n }\n\n /** A property over a pending path that a read resolves to the presentation, or null. */\n #find(\n name: string,\n pick: (\n all: readonly AutomationCustomPropertyRead[]\n ) => AutomationCustomPropertyRead | undefined,\n key: string | undefined,\n orNull: boolean\n ): CustomProperty {\n const path = ObjectPath.pending(`${this.path.label}.${name}`);\n const property = new CustomProperty(this.context, path, this.path, key ?? '', orNull);\n const label = path.label;\n this.enqueue(\n 'read',\n name,\n (ref) => ({ op: 'readCustomProperties', owner: ref(this.path) }),\n (value) => {\n const found = pick(hydrated(value, 'customProperties', label).properties);\n if (!found) {\n if (orNull) return path.resolveNull();\n fail({ code: 'ItemNotFound', target: label });\n }\n fillProperty(property, found);\n path.resolveTo(this.path.handle());\n },\n path,\n false\n );\n return property;\n }\n\n /** @internal */\n protected override get loadsItemPaths(): boolean {\n return true;\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n for (const name of [...request.select, ...request.itemSelect])\n if (!['items', 'key', 'type', 'value'].includes(name))\n failArgument(\n `${this.path.label}.${name}`,\n 'a property of custom properties: items, key, type, or value',\n nearest(name, ['items', 'key', 'type', 'value'])\n );\n const label = `${this.path.label}.items`;\n this.enqueue(\n 'read',\n 'items',\n (ref) => ({ op: 'readCustomProperties', owner: ref(this.path) }),\n (value) => {\n const all = hydrated(value, 'customProperties', label).properties;\n const end = request.top === undefined ? all.length : (request.skip ?? 0) + request.top;\n this.setLoadedProperty(\n 'items',\n all.slice(request.skip ?? 0, end).map((read, i) => {\n const path = ObjectPath.of(`${label}[${i}]`, this.path.handle());\n const property = new CustomProperty(this.context, path, this.path, read.key);\n fillProperty(property, read);\n return property;\n })\n );\n }\n );\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// The root of the object model: Office.js `PowerPoint.Presentation`, `DocumentProperties`, and\n// `PageSetup`.\n\nimport type { AutomationInsertSlidesOptions } from '@pptx-editor.dev/core/automation';\nimport { failArgument, nearest, oneOf } from '../runtime/errors.ts';\nimport { hydrated } from '../runtime/hydrate.ts';\nimport type { ResolvedLoadOptions } from '../runtime/load-options.ts';\nimport { ObjectPath } from '../runtime/object-path.ts';\nimport type { RequestContext } from '../runtime/request-context.ts';\nimport { BindingCollection } from './bindings.ts';\nimport { InsertSlideFormatting } from './enums.ts';\nimport { CustomPropertyCollection } from './custom-properties.ts';\nimport { CustomXmlPartCollection } from './custom-xml.ts';\nimport { finite, ModelObject, pathOf, text } from './model-object.ts';\nimport { ShapeScopedCollection } from './shapes.ts';\nimport {\n SlideCollection,\n SlideMasterCollection,\n SlideScopedCollection,\n type Slide,\n} from './slides.ts';\nimport { TagCollection } from './tags.ts';\nimport { TextRange } from './text.ts';\n\n/**\n * Options for `Presentation.insertSlidesFromBase64`.\n *\n * @public\n */\nexport interface InsertSlideOptions {\n /** How the inserted slides are formatted. */\n formatting?: InsertSlideFormatting | `${InsertSlideFormatting}` | undefined;\n /** The slides of the source presentation to insert, by id. */\n sourceSlideIds?: string[];\n /** The slide the new slides follow, by id. */\n targetSlideId?: string;\n}\n\n/**\n * The presentation: its slides, masters, tags, properties, and page setup.\n *\n * @example\n * ```ts\n * await runtime.run(async (context) => {\n * const slides = context.presentation.slides;\n * slides.load('items/id');\n * await context.sync();\n * console.log(slides.items.map((slide) => slide.id));\n * });\n * ```\n *\n * @public\n */\nexport class Presentation extends ModelObject {\n #slides: SlideCollection | undefined;\n #masters: SlideMasterCollection | undefined;\n #tags: TagCollection | undefined;\n #customXml: CustomXmlPartCollection | undefined;\n #properties: DocumentProperties | undefined;\n #pageSetup: PageSetup | undefined;\n #bindings: BindingCollection | undefined;\n\n /** @internal */\n private constructor(context: RequestContext, path: ObjectPath) {\n super(context, path);\n }\n\n /** @internal The presentation of a request context, with a lookup queued at first use. */\n static open(context: RequestContext): Presentation {\n const path = ObjectPath.pending('presentation');\n const presentation = new Presentation(context, path);\n presentation.enqueue(\n 'read',\n '',\n () => ({ op: 'getPresentation' }),\n (value) => path.resolveTo(hydrated(value, 'handle', 'presentation').handle),\n path\n );\n return presentation;\n }\n\n /** The id of the presentation. */\n get id(): string {\n return this.loadedProperty('id');\n }\n\n /** The title of the presentation, from the core properties. */\n get title(): string {\n return this.loadedProperty('title');\n }\n\n /** The slides, in order. */\n get slides(): SlideCollection {\n return (this.#slides ??= new SlideCollection(\n this.context,\n ObjectPath.derived('presentation.slides', this.path)\n ));\n }\n\n /** The slide masters, in order. */\n get slideMasters(): SlideMasterCollection {\n return (this.#masters ??= new SlideMasterCollection(\n this.context,\n ObjectPath.derived('presentation.slideMasters', this.path)\n ));\n }\n\n /** The tags of the presentation. */\n get tags(): TagCollection {\n return (this.#tags ??= new TagCollection(\n this.context,\n ObjectPath.derived('presentation.tags', this.path)\n ));\n }\n\n /** The custom XML parts of the presentation. */\n get customXmlParts(): CustomXmlPartCollection {\n return (this.#customXml ??= new CustomXmlPartCollection(\n this.context,\n ObjectPath.derived('presentation.customXmlParts', this.path)\n ));\n }\n\n /**\n * The bindings of this runtime: ids that name shapes. They live in memory for the lifetime of\n * the runtime and are never saved with the presentation.\n */\n get bindings(): BindingCollection {\n return (this.#bindings ??= new BindingCollection(\n this.context,\n ObjectPath.derived('presentation.bindings', this.path)\n ));\n }\n\n /** The document properties (title, author, …). */\n get properties(): DocumentProperties {\n return (this.#properties ??= new DocumentProperties(\n this.context,\n ObjectPath.derived('presentation.properties', this.path)\n ));\n }\n\n /** The slide size. */\n get pageSetup(): PageSetup {\n return (this.#pageSetup ??= new PageSetup(\n this.context,\n ObjectPath.derived('presentation.pageSetup', this.path)\n ));\n }\n\n /** The selected slides of the reader. A server runtime refuses with `NotSupported`. */\n getSelectedSlides(): SlideScopedCollection {\n return new SlideScopedCollection(\n this.context,\n ObjectPath.derived('presentation.getSelectedSlides()', this.path),\n 'selection'\n );\n }\n\n /** The selected shapes of the reader. A server runtime refuses with `NotSupported`. */\n getSelectedShapes(): ShapeScopedCollection {\n return new ShapeScopedCollection(\n this.context,\n ObjectPath.derived('presentation.getSelectedShapes()', this.path),\n { kind: 'selection' }\n );\n }\n\n /** The selected text. `ItemNotFound` at the sync when no text is selected. */\n getSelectedTextRange(): TextRange {\n return TextRange.selected(this, 'getSelectedTextRange()', false);\n }\n\n /** The selected text, or a null object when no text is selected. */\n getSelectedTextRangeOrNullObject(): TextRange {\n return TextRange.selected(this, 'getSelectedTextRangeOrNullObject()', true);\n }\n\n /** Select slides by id. A server runtime refuses with `NotSupported`. */\n setSelectedSlides(slideIds: string[]): void {\n if (!Array.isArray(slideIds)) failArgument('setSelectedSlides', 'an array of slide ids');\n const slides = slideIds.map((id) =>\n this.slides.getItem(text(id, this.at('setSelectedSlides')))\n );\n this.command('setSelectedSlides', (ref) => ({\n op: 'selectSlides',\n slides: slides.map((slide: Slide) => ref(pathOf(slide))),\n }));\n }\n\n /**\n * Insert the slides of another presentation, given as Base64-encoded PPTX bytes. Each slide\n * comes with its notes, pictures, media, charts, and other parts. With `KeepSourceFormatting`\n * (the default), its layout, master, and theme come too; with `UseDestinationTheme`, it goes on\n * the layout of this presentation with the same type. Without `targetSlideId`, the slides go\n * first. Comments come along, with their authors merged by name and initials. An unknown slide\n * id refuses with `ItemNotFound`; a slide with threaded comments or an embedded control refuses\n * with `NotSupported`, naming the slide ids. Nothing changes when the call is refused.\n *\n * @example\n * ```ts\n * await runtime.run(async (context) => {\n * context.presentation.insertSlidesFromBase64(base64, {\n * formatting: 'UseDestinationTheme',\n * targetSlideId: '256',\n * });\n * await context.sync();\n * });\n * ```\n */\n insertSlidesFromBase64(base64File: string, options?: InsertSlideOptions): void {\n const target = this.at('insertSlidesFromBase64');\n const base64 = text(base64File, target);\n if (base64.length === 0) failArgument(target, 'the Base64 bytes of a PPTX file');\n const request = importOptions(options, target);\n this.command('insertSlidesFromBase64', () => ({\n op: 'insertSlides',\n base64,\n ...(request ? { options: request } : {}),\n }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, ['id', 'title'], {\n slides: () => this.slides,\n slideMasters: () => this.slideMasters,\n tags: () => this.tags,\n bindings: () => this.bindings,\n customXmlParts: () => this.customXmlParts,\n properties: () => this.properties,\n pageSetup: () => this.pageSetup,\n });\n this.loadScalars(\n names,\n 'presentation',\n () => ({ op: 'readPresentation' }),\n (v) => ({\n id: v.presentation.id,\n title: v.presentation.title,\n })\n );\n }\n}\n\n/** Import options as the protocol takes them, or `InvalidArgument` naming `target`. */\nfunction importOptions(\n options: InsertSlideOptions | undefined,\n target: string\n): AutomationInsertSlidesOptions | undefined {\n if (options === undefined) return undefined;\n if (typeof options !== 'object' || options === null)\n failArgument(target, 'an InsertSlideOptions object');\n const { formatting, sourceSlideIds, targetSlideId } = options;\n if (\n formatting !== undefined &&\n formatting !== InsertSlideFormatting.keepSourceFormatting &&\n formatting !== InsertSlideFormatting.useDestinationTheme\n )\n failArgument(\n `${target}.formatting`,\n oneOf(Object.values(InsertSlideFormatting)),\n nearest(formatting, Object.values(InsertSlideFormatting))\n );\n if (\n sourceSlideIds !== undefined &&\n (!Array.isArray(sourceSlideIds) || sourceSlideIds.some((id) => typeof id !== 'string'))\n )\n failArgument(`${target}.sourceSlideIds`, 'an array of slide id strings');\n if (targetSlideId !== undefined && typeof targetSlideId !== 'string')\n failArgument(`${target}.targetSlideId`, 'a slide id string');\n return {\n ...(formatting === undefined\n ? {}\n : {\n formatting:\n formatting === InsertSlideFormatting.useDestinationTheme\n ? 'useDestinationTheme'\n : 'keepSource',\n }),\n ...(sourceSlideIds === undefined ? {} : { sourceSlideIds: [...sourceSlideIds] }),\n ...(targetSlideId === undefined ? {} : { targetSlideId }),\n };\n}\n\nconst PROPERTY_NAMES = [\n 'author',\n 'category',\n 'comments',\n 'company',\n 'creationDate',\n 'keywords',\n 'lastAuthor',\n 'manager',\n 'revisionNumber',\n 'subject',\n 'title',\n] as const;\n\n/**\n * The core and extended document properties (`docProps/core.xml`, `docProps/app.xml`).\n *\n * @public\n */\nexport class DocumentProperties extends ModelObject {\n #custom: CustomPropertyCollection | undefined;\n\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath) {\n super(context, path);\n }\n\n /** The custom document properties (`docProps/custom.xml`). */\n get customProperties(): CustomPropertyCollection {\n return (this.#custom ??= new CustomPropertyCollection(\n this.context,\n ObjectPath.derived('presentation.properties.customProperties', this.path)\n ));\n }\n\n get author(): string {\n return this.loadedProperty('author');\n }\n set author(value: string) {\n this.#set('author', text(value, this.at('author')));\n }\n get category(): string {\n return this.loadedProperty('category');\n }\n set category(value: string) {\n this.#set('category', text(value, this.at('category')));\n }\n get comments(): string {\n return this.loadedProperty('comments');\n }\n set comments(value: string) {\n this.#set('comments', text(value, this.at('comments')));\n }\n get company(): string {\n return this.loadedProperty('company');\n }\n set company(value: string) {\n this.#set('company', text(value, this.at('company')));\n }\n /**\n * When the presentation was created, from `dcterms:created`. Without one, or with a value\n * that is not a date, it is an invalid `Date`: check `Number.isNaN(creationDate.getTime())`.\n */\n get creationDate(): Date {\n return this.loadedProperty('creationDate');\n }\n get keywords(): string {\n return this.loadedProperty('keywords');\n }\n set keywords(value: string) {\n this.#set('keywords', text(value, this.at('keywords')));\n }\n get lastAuthor(): string {\n return this.loadedProperty('lastAuthor');\n }\n get manager(): string {\n return this.loadedProperty('manager');\n }\n set manager(value: string) {\n this.#set('manager', text(value, this.at('manager')));\n }\n get revisionNumber(): number {\n return this.loadedProperty('revisionNumber');\n }\n set revisionNumber(value: number) {\n this.#set('revisionNumber', finite(value, this.at('revisionNumber')));\n }\n get subject(): string {\n return this.loadedProperty('subject');\n }\n set subject(value: string) {\n this.#set('subject', text(value, this.at('subject')));\n }\n get title(): string {\n return this.loadedProperty('title');\n }\n set title(value: string) {\n this.#set('title', text(value, this.at('title')));\n }\n\n #set(name: string, value: string | number): void {\n this.command(name, () => ({ op: 'setProperties', properties: { [name]: value } }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, PROPERTY_NAMES, {\n customProperties: () => this.customProperties,\n });\n this.loadScalars(\n names,\n 'properties',\n () => ({ op: 'getProperties' }),\n (v) => ({\n ...v.properties,\n // Office.js types creationDate as Date, never null. A file with no dcterms:created\n // reads an invalid Date (getTime() is NaN), not a made-up time.\n creationDate: new Date(v.properties.creationDate ?? Number.NaN),\n })\n );\n }\n}\n\n/**\n * The slide size, in points (`p:sldSz`, ECMA-376 Part 1, 19.2.1.39).\n *\n * @public\n */\nexport class PageSetup extends ModelObject {\n /** @internal */\n constructor(context: RequestContext, path: ObjectPath) {\n super(context, path);\n }\n\n get slideHeight(): number {\n return this.loadedProperty('slideHeight');\n }\n set slideHeight(value: number) {\n const slideHeight = finite(value, this.at('slideHeight'));\n this.command('slideHeight', () => ({ op: 'setPageSetup', slideHeight }));\n }\n get slideWidth(): number {\n return this.loadedProperty('slideWidth');\n }\n set slideWidth(value: number) {\n const slideWidth = finite(value, this.at('slideWidth'));\n this.command('slideWidth', () => ({ op: 'setPageSetup', slideWidth }));\n }\n\n /** @internal */\n protected override onLoad(request: ResolvedLoadOptions): void {\n const names = this.selection(request, ['slideHeight', 'slideWidth']);\n this.loadScalars(\n names,\n 'presentation',\n () => ({ op: 'readPresentation' }),\n (v) => ({ slideHeight: v.presentation.slideHeight, slideWidth: v.presentation.slideWidth })\n );\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// Copied from DOCX Editor's `packages/editor-api/src/runtime/tracked-objects.ts` (commit 5993bd223945).\n// Deliberate object lifetime.\n//\n// The default is that a proxy dies with the run that made it, and that default is the safe one:\n// a presentation object is a reference into a presentation that keeps changing, and code that holds one\n// indefinitely is code whose reference quietly stops meaning what it meant. So keeping one alive\n// is something a consumer has to ASK for, by name, on the context that owns it.\n//\n// `add` is not a cache and not a copy. It says: when this run ends, do not release this object —\n// I intend to hand it to another `run` on this runtime. `remove` withdraws that intent, and the\n// object goes back to being released when the run ends. Both are idempotent, because \"make sure\n// this is tracked\" is a reasonable thing to say twice and turning the second one into an error\n// would only teach consumers to guard every call.\n\nimport type { ClientObject } from './client-object.ts';\nimport { fail } from './errors.ts';\nimport type { ContextInternals } from './internals.ts';\n\nfunction each(\n object: ClientObject | readonly ClientObject[],\n visit: (one: ClientObject) => void\n): void {\n if (Array.isArray(object)) {\n for (const one of object as readonly ClientObject[]) visit(one);\n return;\n }\n visit(object as ClientObject);\n}\n\n/**\n * The objects a context keeps addressable beyond the run that created them.\n *\n * An ordinary proxy stops being usable when its run ends. Tracking one keeps its address alive so\n * a later `run(object, callback)` can adopt it, and untracking releases it — which matters for\n * long-lived callers, since a tracked object is a presentation reference that will not be collected\n * on its own.\n *\n * @public\n */\nexport class TrackedObjects {\n readonly #internals: ContextInternals;\n readonly #owns: (object: ClientObject) => boolean;\n\n /** @internal Built by the static factories above, never directly. */\n constructor(internals: ContextInternals, owns: (object: ClientObject) => boolean) {\n this.#internals = internals;\n this.#owns = owns;\n }\n\n /** Keep these objects usable after this run ends. */\n add(object: ClientObject | readonly ClientObject[]): void {\n this.#internals.assertUsable();\n each(object, (one) => {\n this.#require(one);\n this.#internals.track(one);\n });\n }\n\n /** Stop keeping them: they are released when this run ends, like any other object. */\n remove(object: ClientObject | readonly ClientObject[]): void {\n this.#internals.assertUsable();\n each(object, (one) => {\n this.#require(one);\n this.#internals.untrack(one);\n });\n }\n\n /**\n * Refuse an object this context does not own.\n *\n * A context can only speak for its own objects: tracking one from another run would leave two\n * registries claiming the same lifetime, and tracking one from another RUNTIME would name a\n * presentation this host never opened.\n */\n #require(object: ClientObject): void {\n if (!this.#owns(object)) {\n fail({ code: 'InvalidObjectPath' });\n }\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// After DOCX Editor's `packages/editor-api/src/runtime/queue.ts` (commit 5993bd223945).\n//\n// The action queue: what a proxy call leaves behind instead of doing something. A queued action\n// is how to say it to the host (`plan`) and what to do with the answer (`settle`), plus the label\n// an error may name. Hydration is positional: the answer at index i belongs to the action at i.\n//\n// `take()` REMOVES the actions and nothing puts them back, including when the batch fails. A\n// failed sync loses its batch and says so with a typed error; what is queued afterwards is a new\n// batch that can succeed on its own.\n\nimport type { AutomationOperation, AutomationValue } from '@pptx-editor.dev/core/automation';\nimport type { IndexOf, ObjectPath } from './object-path.ts';\n\n/** Whether an action reads or writes. Drives the conditional-revision rule in `sync()`. */\nexport type ActionSort = 'read' | 'write';\n\nexport interface QueuedAction {\n readonly sort: ActionSort;\n /** The consumer-facing name of what this action is for, for errors. Never a handle. */\n readonly label: string;\n /**\n * The object the action is on. A read on an object that an earlier round of the same sync\n * found null is dropped: a null object has nothing to read.\n */\n readonly target?: ObjectPath;\n /**\n * True for a listing whose answer queues more reads (`load('items/<name>')`). In a sync that\n * writes, such a listing ahead of every write goes in an earlier round, with its item reads,\n * so the writes stay last and atomic.\n */\n readonly continues?: boolean;\n /**\n * The host operation for this action, called once at dispatch. `indexOf` gives the batch\n * index of a producing action, for result references. May throw `InvalidObjectPath`, which\n * refuses the batch before anything is sent.\n */\n plan(indexOf: IndexOf): AutomationOperation;\n /**\n * A call whose argument this API refused. A sync that holds one refuses with it before it\n * sends anything, so the whole batch applies nothing.\n */\n readonly refusal?: Error;\n /** The host's answer for this action, in batch order. */\n settle(value: AutomationValue): void;\n}\n\nexport class ActionQueue {\n #actions: QueuedAction[] = [];\n /** Where `push` puts an action while `continuing` runs. */\n #sink: QueuedAction[] | null = null;\n /** Reads queued while a sync settled an answer, sent by that same sync. */\n #continuations: QueuedAction[] = [];\n\n get size(): number {\n return this.#actions.length;\n }\n\n /** The labels of the actions queued now, in order, for `context.debugInfo`. */\n labels(): string[] {\n return this.#actions.map((action) => action.label);\n }\n\n push(action: QueuedAction): void {\n (this.#sink ?? this.#actions).push(action);\n }\n\n /**\n * Run `work` while a sync settles an answer, and keep what it queued for that same sync. This\n * is how `load('items/name')` reads each item: the items are known only once the listing has\n * answered.\n */\n continuing(work: () => void): void {\n const previous = this.#sink;\n const sink: QueuedAction[] = [];\n this.#sink = sink;\n try {\n work();\n } finally {\n this.#sink = previous;\n }\n for (const action of sink) this.#continuations.push(action);\n }\n\n /**\n * Remember where the queue is now. The function returned drops what was queued since, so a\n * `load(...)` that refuses part way leaves nothing behind.\n */\n checkpoint(): () => void {\n const target = this.#sink ?? this.#actions;\n const length = target.length;\n return () => {\n target.length = Math.min(target.length, length);\n };\n }\n\n /** Hand over the reads `continuing` kept, and forget them. */\n takeContinuations(): readonly QueuedAction[] {\n const taken = this.#continuations;\n this.#continuations = [];\n return taken;\n }\n\n /** Hand over everything queued and forget it. Never replayed. */\n take(): readonly QueuedAction[] {\n const taken = this.#actions;\n this.#actions = [];\n return taken;\n }\n\n /** Drop everything queued: what a finished run does with actions nobody synced. */\n clear(): void {\n this.#actions = [];\n this.#continuations = [];\n }\n}\n","// Development warnings for runs that cannot do what the caller meant. After\n// `packages/core/src/editor/dev-warnings.ts`: each message prints once, never in a production build.\n\n/** Vite's flag when it is a boolean, else the Node convention; production when neither says. */\nfunction isDevelopment(): boolean {\n let dev: unknown;\n try {\n dev = (import.meta as { readonly env?: { readonly DEV?: unknown } }).env?.DEV;\n } catch {\n dev = undefined;\n }\n if (typeof dev === 'boolean') return dev;\n const hasProcess = typeof process !== 'undefined';\n return hasProcess && process.env.NODE_ENV !== 'production';\n}\n\nconst printed = new Set<string>();\n\n/** Print `message` once, in development builds only. */\nfunction devWarning(message: string): void {\n if (!isDevelopment() || printed.has(message)) return;\n printed.add(message);\n console.warn(`[pptx-editor] ${message}`);\n}\n\n/** Forget printed messages. Tests only. @internal */\nexport function resetDevWarnings(): void {\n printed.clear();\n}\n\n/**\n * A run ended with writes that no `sync()` sent: they were dropped. `refusals` are the argument\n * refusals among them, which that sync would have given; the warning names them so they are not\n * lost.\n */\nexport function warnUnsynced(writes: number, refusals: readonly Error[] = []): void {\n const lost = refusals.map((error) => {\n const e = error as { code?: string; debugInfo?: { errorLocation?: string } };\n const where = e.debugInfo?.errorLocation ? ` at ${e.debugInfo.errorLocation}` : '';\n return ` ${e.code ?? 'Error'}${where}: ${error.message}`;\n });\n devWarning(\n `run() ended with ${writes} queued ${writes === 1 ? 'write' : 'writes'} that no sync() sent, ` +\n `so ${writes === 1 ? 'it' : 'they'} did not apply. Call \\`await context.sync()\\` before the ` +\n 'callback returns.' +\n (lost.length === 0\n ? ''\n : ` That sync would have refused with ${lost.length === 1 ? 'this error' : 'these errors'}:` +\n lost.join(';'))\n );\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// After DOCX Editor's `packages/editor-api/src/runtime/request-context.ts` (commit 5993bd223945).\n//\n// One queue, one presentation, one sync at a time. A `sync()` called while another is in flight\n// takes the calls queued so far at once, then waits for it: syncs reach the host in the order\n// they were called, and a refused sync does not stop the ones after it. The presentation host takes result\n// references, so the writes of a sync are ONE atomic host batch: an object a write creates can\n// be read and written in the same sync. Reads go in earlier rounds when other calls wait for\n// their answers, and `load('items/<name>')` on a collection reads the items in a later round,\n// because the items are known only once the listing answers. Every later round is pinned to the\n// revision the round before it left, so it reads the same presentation.\n\nimport type { AutomationHost, AutomationOperation } from '@pptx-editor.dev/core/automation';\nimport type { Application } from '../model/application.ts';\nimport type { Presentation } from '../model/presentation.ts';\nimport {\n awaitedReads,\n batchFailure,\n planBatch,\n readAfterWriteCut,\n settleBatch,\n withReplayedLookups,\n} from './batch.ts';\nimport { markRefused, markReplayable } from './object-path.ts';\nimport { ClientObject } from './client-object.ts';\nimport {\n diagnosticOf,\n fail,\n failArgument,\n isPptxEditorError,\n nearest,\n PptxEditorError,\n withTraceMessages,\n} from './errors.ts';\nimport {\n INTERNALS,\n LOADED_VALUES,\n PATH,\n REBIND,\n RELEASE,\n type ContextInternals,\n} from './internals.ts';\nimport { resolveLoadOption, type LoadOption } from './load-options.ts';\nimport { ActionQueue, type QueuedAction } from './queue.ts';\nimport { TrackedObjects } from './tracked-objects.ts';\nimport { warnUnsynced } from './dev-warnings.ts';\nimport type { PresentationCapabilities } from './runtime.ts';\n\n/**\n * A refusal of a read that went after the writes of its sync committed. Elsewhere a refusal\n * means nothing applied, so this one says that the writes stay.\n */\nfunction readAfterCommit(error: unknown): unknown {\n if (!(error instanceof PptxEditorError)) return error;\n const diagnostic = diagnosticOf('read-after-commit');\n return new PptxEditorError({\n code: error.code,\n ...(error.target === undefined ? {} : { target: error.target }),\n ...(diagnostic === undefined ? {} : { diagnostic }),\n });\n}\n\n/**\n * A refusal in a later part of a split sync: the writes of the parts before it applied. The\n * diagnostic says so, so the caller does not apply them again.\n */\nfunction partlyApplied(error: unknown): unknown {\n if (!(error instanceof PptxEditorError)) return error;\n const general = diagnosticOf('partly-applied');\n const own = error.debugInfo.innerError;\n // The cause keeps its own code; the hint adds that the writes before the read applied.\n const diagnostic = own\n ? { code: own.code, hint: `${own.message} ${general?.hint ?? ''}`.trim() }\n : general;\n return new PptxEditorError({\n code: error.code,\n ...(error.target === undefined ? {} : { target: error.target }),\n ...(diagnostic === undefined ? {} : { diagnostic }),\n });\n}\n\n/** What a context needs from the runtime that made it. */\nexport interface RuntimeSession {\n readonly host: AutomationHost;\n readonly capabilities: PresentationCapabilities;\n /** Told about each refused batch before it is thrown. A listener that throws is ignored. */\n readonly onRefusal?: (error: PptxEditorError, operations: readonly AutomationOperation[]) => void;\n /**\n * Told about each batch that threw an error other than a refusal, before it propagates: an\n * engine defect. A listener that throws is ignored.\n */\n readonly onException?: (error: unknown, operations: readonly AutomationOperation[]) => void;\n /** Identity for adoption checks. */\n readonly id: object;\n /** Refuse if the runtime has been disposed. */\n assertLive(target?: string): void;\n /** Build the presentation proxy for a context. Injected, so this module does not import it. */\n openPresentation(context: RequestContext): Presentation;\n /** Build the application proxy for a context. Injected for the same reason. */\n openApplication(context: RequestContext): Application;\n /** The Office.js type name of an object of the model, for `loadRecursive`. */\n typeName(object: ClientObject): string | undefined;\n /** Every type name `loadRecursive` takes. */\n readonly typeNames: readonly string[];\n}\n\n/**\n * Debug information about a request context, as Office.js `OfficeExtension.RequestContextDebugInfo`.\n *\n * @public\n */\nexport interface RequestContextDebugInfo {\n /**\n * What the next `sync()` sends, in order: the consumer-facing path of each queued call, such\n * as `presentation.slides.getItemAt(0).load`, and the message of each `trace` call. Never a\n * handle or presentation content.\n */\n pendingStatements: string[];\n}\n\n/**\n * The Office.js `OfficeExtension.ClientRequestContext`: here the same class as\n * {@link RequestContext}, under the name that code written for Office.js uses for the base of\n * every request context.\n *\n * @public\n */\nexport type ClientRequestContext = RequestContext;\n\n/** The deepest `loadRecursive` goes. */\nconst MAX_LOAD_DEPTH = 32;\n\n/** How many syncs every context has sent, for history groups that no two syncs share. */\nlet sentSyncs = 0;\n\n/** A `trace` message, and how many calls were queued before it. */\ninterface Trace {\n readonly message: string;\n readonly at: number;\n}\n\n/** The messages of the traces queued before `failed`, or every message when it is unknown. */\nfunction tracesBefore(\n actions: readonly QueuedAction[],\n traces: readonly Trace[],\n failed: QueuedAction | undefined\n): string[] {\n const index = failed ? actions.indexOf(failed) : -1;\n return traces.filter((t) => index < 0 || t.at <= index).map((t) => t.message);\n}\n\n/**\n * What a `run` hands its callback: one queue, one presentation, one sync at a time.\n *\n * `sync()` sends every queued call as one atomic batch: all of it applies, or none of it. A\n * context that has READ remembers the revision it read at, and a later sync that writes is\n * conditional on it, failing `StaleDocument` if another writer moved the presentation. A context\n * that has read nothing writes unconditionally.\n *\n * @public\n */\nexport class RequestContext {\n readonly #session: RuntimeSession;\n readonly #queue = new ActionQueue();\n readonly #created = new Set<ClientObject>();\n readonly #tracked = new Set<ClientObject>();\n readonly #internals: ContextInternals;\n readonly #trackedObjects: TrackedObjects;\n #presentation: Presentation | undefined;\n #application: Application | undefined;\n /** `trace` calls since the last sync. */\n #traces: Trace[] = [];\n /** The action whose answer or settle failed last, for the trace messages of the error. */\n #failed: QueuedAction | undefined;\n /** The history group of the sync in progress (`AutomationBatchRequest.historyGroup`). */\n #historyGroup = '';\n #finished = false;\n #readRevision: number | null = null;\n /** Syncs called and not yet settled. */\n #syncs = 0;\n /** Settles when the last sync called settles; never rejects. */\n #tail: Promise<void> = Promise.resolve();\n #deferred: Promise<void>[] = [];\n\n private constructor(session: RuntimeSession) {\n this.#session = session;\n this.#internals = {\n host: session.host,\n capabilities: session.host.capabilities,\n queue: this.#queue,\n session: session.id,\n assertUsable: (target?: string) => {\n this.#session.assertLive(target);\n if (this.#finished)\n fail({ code: 'InvalidRequestContext', ...(target === undefined ? {} : { target }) });\n },\n isFinished: () => this.#finished,\n readRevision: () => this.#readRevision,\n register: (object) => void this.#created.add(object as ClientObject),\n track: (object) => void this.#tracked.add(object as ClientObject),\n untrack: (object) => void this.#tracked.delete(object as ClientObject),\n isTracked: (object) => this.#tracked.has(object as ClientObject),\n disown: (object) => {\n this.#created.delete(object as ClientObject);\n this.#tracked.delete(object as ClientObject);\n },\n defer: (work) => {\n // A later answer can fail before this work is awaited, and then the sync drops it:\n // mark it handled now, so its own failure is never an unhandled rejection.\n work.catch(() => {});\n this.#deferred.push(work);\n },\n };\n this.#trackedObjects = new TrackedObjects(this.#internals, (object) =>\n this.#created.has(object)\n );\n }\n\n /** The presentation this run is against: the same object for the life of the context. */\n get presentation(): Presentation {\n this.#internals.assertUsable('presentation');\n this.#presentation ??= this.#session.openPresentation(this);\n return this.#presentation;\n }\n\n /** The application the presentation is open in. It has no properties or methods. */\n get application(): Application {\n this.#internals.assertUsable('application');\n this.#application ??= this.#session.openApplication(this);\n return this.#application;\n }\n\n /** What the next `sync()` sends, for debugging. See {@link RequestContextDebugInfo}. */\n get debugInfo(): RequestContextDebugInfo {\n this.#internals.assertUsable('debugInfo');\n const labels = this.#queue.labels();\n const pendingStatements: string[] = [];\n let next = 0;\n for (let i = 0; i <= labels.length; i += 1) {\n while (next < this.#traces.length && this.#traces[next]!.at <= i)\n pendingStatements.push(this.#traces[next++]!.message);\n if (i < labels.length) pendingStatements.push(labels[i]!);\n }\n return { pendingStatements };\n }\n\n /** What the presentation host behind this context can do. */\n get capabilities(): PresentationCapabilities {\n return this.#session.capabilities;\n }\n\n /** Objects kept addressable past the run that created them. See {@link TrackedObjects}. */\n get trackedObjects(): TrackedObjects {\n return this.#trackedObjects;\n }\n\n /** Queue a load on `object`, as Office.js `context.load(object, option)`. */\n load<T extends ClientObject>(object: T, option?: LoadOption): T {\n return object.load(option);\n }\n\n /**\n * Queue loads on `object` and on the objects its loads reach, by type: each object whose\n * Office.js type name is a key of `options` loads that option, and the objects its load\n * fills in (navigation properties and collection items) go on, down to `maxDepth` levels\n * below `object` (at most 32, which is also the default). An object whose type is not a key\n * loads nothing and stops the walk there. Everything loads in the next `sync()`; each level\n * costs one more host batch.\n *\n * @example\n * ```ts\n * context.loadRecursive(context.presentation.slides, {\n * SlideCollection: 'items',\n * Slide: 'id,shapes',\n * ShapeCollection: 'items',\n * Shape: 'name',\n * });\n * await context.sync();\n * ```\n */\n loadRecursive(\n object: ClientObject,\n options: { [typeName: string]: LoadOption | string | string[] },\n maxDepth?: number\n ): void {\n const target = 'loadRecursive';\n this.#internals.assertUsable(target);\n if (!(object instanceof ClientObject)) failArgument(target, 'an object of this API');\n if (object.context !== this) fail({ code: 'InvalidObjectPath', target });\n if (typeof options !== 'object' || options === null || Array.isArray(options))\n failArgument(`${target}.options`, 'an object keyed by type name');\n const names = this.#session.typeNames;\n const table = new Map<string, LoadOption>();\n for (const [name, option] of Object.entries(options)) {\n if (!names.includes(name))\n failArgument(`${target}.options.${name}`, 'a type name of this API', nearest(name, names));\n // A bad option refuses now, before anything is queued.\n resolveLoadOption(option, `${target}.options.${name}`);\n table.set(name, option);\n }\n if (\n maxDepth !== undefined &&\n (typeof maxDepth !== 'number' ||\n !Number.isInteger(maxDepth) ||\n maxDepth < 0 ||\n maxDepth > MAX_LOAD_DEPTH)\n )\n failArgument(`${target}.maxDepth`, `a whole number from 0 to ${MAX_LOAD_DEPTH}`);\n const limit = maxDepth ?? MAX_LOAD_DEPTH;\n const seen = new WeakSet<ClientObject>();\n const visit = (current: ClientObject, depth: number): void => {\n if (seen.has(current) || current[PATH].isReleased || current[PATH].isNull) return;\n seen.add(current);\n const name = this.#session.typeName(current);\n const option = name === undefined ? undefined : table.get(name);\n if (option === undefined) return;\n current.load(option);\n if (depth >= limit) return;\n // Once the load above has answered, walk what it filled in. This read answers nothing of\n // its own; it settles after the reads queued before it, and its settle queues the next\n // level for the same sync.\n this.#queue.push({\n sort: 'read',\n label: `${current[PATH].label}.loadRecursive`,\n continues: true,\n plan: () => ({ op: 'getPresentation' }),\n settle: () =>\n this.#queue.continuing(() => {\n for (const value of current[LOADED_VALUES]())\n for (const child of Array.isArray(value) ? value : [value])\n if (child instanceof ClientObject) visit(child, depth + 1);\n }),\n });\n };\n visit(object, 0);\n }\n\n /**\n * Queue a trace message. A sync that fails gives the messages queued before the failed call\n * in `error.traceMessages`, as Office.js does. The message goes nowhere else.\n */\n trace(message: string): void {\n this.#internals.assertUsable('trace');\n if (typeof message !== 'string') failArgument('trace', 'a string');\n this.#traces.push({ message, at: this.#queue.size });\n }\n\n /**\n * Send everything queued as one atomic batch, then hydrate the answers. An empty queue is not\n * a round trip, so a defensive `sync()` at the end of a run costs nothing.\n *\n * A sync called while an earlier one is in flight takes the calls queued so far at once and\n * sends them when the earlier sync has settled, so syncs apply in the order they were called\n * and no call moves to another batch. A refused sync does not stop the syncs after it.\n *\n * As in Office.js, a refused sync that the caller does not await or catch is an unhandled\n * rejection: the returned promise is the only one that carries the refusal.\n */\n sync<T>(passThroughValue?: T): Promise<T> {\n try {\n this.#internals.assertUsable();\n } catch (error) {\n return Promise.reject(error);\n }\n const actions = this.#queue.take();\n const traces = this.#traces;\n this.#traces = [];\n const start = (): Promise<void> => this.#send(actions, traces);\n const result = this.#syncs === 0 ? start() : this.#tail.then(start);\n this.#syncs += 1;\n const done = (): void => {\n this.#syncs -= 1;\n };\n // The tail handles `result`; the caller gets a promise of its own, so a refusal that the\n // caller ignores stays unhandled instead of being lost.\n this.#tail = result.then(done, done);\n return result.then(() => passThroughValue as T);\n }\n\n /** Settles when every sync called so far has settled. */\n async #idle(): Promise<void> {\n while (this.#syncs > 0) await this.#tail;\n }\n\n async #send(queued: readonly QueuedAction[], traces: readonly Trace[]): Promise<void> {\n if (queued.length === 0) return;\n this.#failed = undefined;\n // Every batch of this sync carries one group, so a sync that splits is one undo step.\n this.#historyGroup = `sync-${(sentSyncs += 1)}`;\n try {\n await this.#sendRounds(queued);\n } catch (error) {\n // Trace positions count the calls as queued, before replayed lookups join them.\n throw withTraceMessages(error, tracesBefore(queued, traces, this.#failed));\n }\n }\n\n async #sendRounds(queued: readonly QueuedAction[]): Promise<void> {\n // A proxy from a refused sync is a path, as in Office.js: its lookup goes again.\n const actions = withReplayedLookups(queued);\n try {\n // A refused argument refuses the whole sync before anything is sent.\n const refused = actions.find((action) => action.refusal);\n if (refused) {\n this.#failed = refused;\n throw refused.refusal;\n }\n // Every read sees the writes queued before it. A read that a later call waits for, after a\n // write, splits the sync there: the calls before it go first, as their own batch.\n let rest: readonly QueuedAction[] = actions;\n let applied = false;\n while (rest.length > 0) {\n const cut = readAfterWriteCut(rest);\n const part = cut < 0 ? rest : rest.slice(0, cut);\n try {\n await this.#sendPart(part);\n } catch (error) {\n throw applied ? partlyApplied(error) : error;\n }\n applied ||= part.some((action) => action.sort === 'write');\n rest = cut < 0 ? [] : rest.slice(cut);\n }\n } catch (error) {\n // Only this sync's calls are dropped. Its lookups stay replayable, so a later batch that\n // names one of their objects looks it up again.\n for (const action of actions)\n if (action.sort === 'read') markReplayable(action);\n else markRefused(action);\n throw error;\n } finally {\n this.#queue.takeContinuations();\n this.#deferred = [];\n }\n }\n\n /** Send one part of a sync: its awaited reads in earlier rounds, then the rest at once. */\n async #sendPart(actions: readonly QueuedAction[]): Promise<void> {\n const hasWrites = actions.some((action) => action.sort === 'write');\n let expected = hasWrites && this.#readRevision !== null ? this.#readRevision : undefined;\n let remaining = actions;\n // Reads that later calls wait for go first, in rounds pinned to one revision; the writes\n // all go in the last round, so they stay one atomic batch.\n for (let ready = awaitedReads(remaining); ready.length > 0; ready = awaitedReads(remaining)) {\n await this.#dispatch(ready, expected);\n expected = this.#readRevision ?? undefined;\n const sent = new Set(ready);\n remaining = remaining.filter(\n (action) => !sent.has(action) && !(action.sort === 'read' && action.target?.isNull)\n );\n }\n // A listing that reads its items, ahead of every write: it and the reads before it go\n // first, with the item reads, so the writes stay one atomic batch at the end. Sent after\n // the writes, an item read of an object a later write removes would fail after the commit.\n const firstWrite = remaining.findIndex((action) => action.sort === 'write');\n const before = firstWrite < 0 ? [] : remaining.slice(0, firstWrite);\n if (before.some((action) => action.continues)) {\n await this.#dispatch(before, expected);\n await this.#continuations();\n expected = this.#readRevision ?? undefined;\n remaining = remaining\n .slice(firstWrite)\n .filter((action) => !(action.sort === 'read' && action.target?.isNull));\n }\n if (remaining.length > 0) {\n await this.#dispatch(remaining, expected);\n const wrote = remaining.some((action) => action.sort === 'write');\n try {\n await this.#continuations();\n } catch (error) {\n throw wrote ? readAfterCommit(error) : error;\n }\n }\n }\n\n /** Send the item reads that settled listings queued, until none is left. */\n async #continuations(): Promise<void> {\n for (\n let more = this.#queue.takeContinuations();\n more.length > 0;\n more = this.#queue.takeContinuations()\n )\n await this.#dispatch(more, this.#readRevision ?? undefined);\n }\n\n async #dispatch(\n actions: readonly QueuedAction[],\n expectedRevision: number | undefined\n ): Promise<void> {\n const planned = planBatch(actions);\n let response: ReturnType<AutomationHost['execute']>;\n try {\n response = this.#session.host.execute({\n operations: planned.operations,\n ...(expectedRevision === undefined ? {} : { expectedRevision }),\n historyGroup: this.#historyGroup,\n });\n } catch (error) {\n // An engine error, not a refusal: reported, then rethrown unchanged.\n if (!isPptxEditorError(error))\n try {\n this.#session.onException?.(error, planned.operations);\n } catch {\n /* an observer must never change what the caller sees */\n }\n throw error;\n }\n if (!response.ok) {\n const error = batchFailure(response, actions, expectedRevision, (action) => {\n this.#failed = action;\n });\n try {\n this.#session.onRefusal?.(error, planned.operations);\n } catch {\n /* an observer must never change what the caller sees */\n }\n throw error;\n }\n this.#readRevision = response.revision;\n settleBatch(actions, response, (action) => {\n this.#failed = action;\n });\n this.#failed = undefined;\n // Work the answers started: wait for all of it, then fail with the first refusal. After a\n // batch that wrote, the writes stay, and the error says so.\n const deferred = this.#deferred;\n this.#deferred = [];\n if (deferred.length === 0) return;\n const outcomes = await Promise.allSettled(deferred);\n const refused = outcomes.find((o): o is PromiseRejectedResult => o.status === 'rejected');\n if (!refused) return;\n throw response.changed ? readAfterCommit(refused.reason) : refused.reason;\n }\n\n /** @internal The seam proxies reach the context through. */\n get [INTERNALS](): ContextInternals {\n return this.#internals;\n }\n\n /** @internal Only `run` may build one, and only `run` may end one. */\n static begin(session: RuntimeSession): {\n context: RequestContext;\n adopt: (objects: readonly ClientObject[]) => void;\n idle: () => Promise<void>;\n /** `completed`: the callback returned, so calls still queued are a mistake worth a warning. */\n finish: (completed?: boolean) => void;\n } {\n const context = new RequestContext(session);\n return {\n context,\n adopt(objects) {\n // All or nothing: check every object before any moves, so a refusal leaves each where\n // it was.\n for (const object of objects) context.#checkAdoptable(object);\n for (const object of objects) context.#adopt(object);\n },\n idle() {\n return context.#idle();\n },\n finish(completed = false) {\n context.#finish(completed);\n },\n };\n }\n\n /**\n * Take over an object a PREVIOUS run tracked. Refused for another runtime's object\n * (`InvalidObjectPath`), for a run still in flight (`ObjectInUse`), and for an untracked\n * object (`InvalidObjectPath`). The revision the source read at comes along, so a write\n * computed from the object's loaded state stays conditional on it.\n */\n #checkAdoptable(object: ClientObject): void {\n const source = object.context;\n if (source === this) return;\n const internals = source[INTERNALS];\n if (internals.session !== this.#session.id)\n throw new PptxEditorError({ code: 'InvalidObjectPath' });\n if (!internals.isFinished()) throw new PptxEditorError({ code: 'ObjectInUse' });\n if (!internals.isTracked(object)) throw new PptxEditorError({ code: 'InvalidObjectPath' });\n }\n\n #adopt(object: ClientObject): void {\n const source = object.context;\n if (source === this) return;\n this.#checkAdoptable(object);\n const internals = source[INTERNALS];\n const carried = internals.readRevision();\n internals.disown(object);\n object[REBIND](this);\n this.#created.add(object);\n this.#tracked.add(object);\n if (carried !== null)\n this.#readRevision =\n this.#readRevision === null ? carried : Math.min(this.#readRevision, carried);\n }\n\n /**\n * End of the run. Queued actions are DROPPED, never flushed: a callback that returned without\n * syncing did not ask for its writes. Every object this context made is released except the\n * tracked ones.\n */\n #finish(completed: boolean): void {\n if (this.#finished) return;\n this.#finished = true;\n // Only writes count: a load left without a sync loses nothing the caller asked to change.\n const writes = this.#queue.take().filter((action) => action.sort === 'write');\n if (completed && writes.length > 0)\n warnUnsynced(\n writes.length,\n writes.flatMap((action) => (action.refusal ? [action.refusal] : []))\n );\n this.#queue.clear();\n this.#traces = [];\n for (const object of this.#created) if (!this.#tracked.has(object)) object[RELEASE]();\n this.#created.clear();\n }\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// After DOCX Editor's `packages/editor-api/src/runtime/server.ts` (commit 5993bd223945).\n//\n// A runtime over PPTX bytes. Opening is the editor's own open: the bounded OPC/XML reader, one\n// store, and the HarfBuzz measurer the editor lays text out with, so a text write re-fits its\n// text body by its autofit rules as an edit in the editor does.\n\nimport { createStoreAutomationHost } from '@pptx-editor.dev/core/automation';\nimport {\n openPresentation,\n renderImageWith,\n type ImageRasterizer,\n} from '@pptx-editor.dev/core/editor';\nimport type { FontSource } from '@pptx-editor.dev/core/layout';\nimport { fail, failArgument } from './errors.ts';\nimport { createRuntime, type PptxEditorServerRuntime } from './runtime.ts';\n\n/**\n * How `PptxEditor.createServer` opens a presentation.\n *\n * Opening PPTX bytes is a bounded parse: zip entry, size, and ratio caps, part name checks, and\n * XML with no DTD. Malformed input refuses with `InvalidArgument`; a zip over a cap refuses with\n * `ResourceLimitExceeded`. No message carries file content.\n *\n * @public\n */\nexport interface CreateServerOptions {\n /**\n * Faces to measure text with, tried before the presentation's embedded fonts and the\n * metric-compatible substitutes.\n */\n readonly fonts?: FontSource | readonly FontSource[];\n /** Load the metric-compatible substitute fonts. Default `true`. */\n readonly substitutes?: boolean;\n /**\n * Turns the SVG of a slide or shape picture into PNG bytes, so `getImageAsBase64` works on a\n * server. The engine paints the picture with the editor's own renderer into a standalone SVG\n * document, with its pictures and fonts inline, and the rasterizer only draws that SVG, for\n * example with an SVG rasterizer library or a headless browser. It must answer a PNG of\n * exactly `width` by `height` pixels; any other answer refuses with `GeneralException`.\n * Without it, `capabilities.images` is false and `getImageAsBase64` refuses with\n * `NotSupported`.\n */\n readonly rasterize?: ImageRasterizer;\n}\n\nexport async function createServer(\n bytes: Uint8Array,\n options: CreateServerOptions = {}\n): Promise<PptxEditorServerRuntime> {\n if (!(bytes instanceof Uint8Array) || bytes.length === 0)\n failArgument('createServer', 'the bytes of a PPTX file as a non-empty Uint8Array');\n if (options === null || typeof options !== 'object')\n failArgument('createServer', 'an options object');\n const rasterize = options.rasterize;\n if (rasterize !== undefined && typeof rasterize !== 'function')\n failArgument('createServer', 'a rasterize function');\n const fonts =\n options.fonts === undefined\n ? undefined\n : Array.isArray(options.fonts)\n ? (options.fonts as readonly FontSource[])\n : [options.fonts as FontSource];\n // The runtime keeps no reference to the caller's array.\n const opened = await openPresentation(bytes.slice(), {\n ...(fonts ? { fonts } : {}),\n ...(options.substitutes === false ? { substitutes: false } : {}),\n });\n if (!opened.ok) {\n const error = opened.error;\n const limit =\n (error.reason === 'zip' &&\n (error.detail === 'too-many-entries' || error.detail === 'too-large')) ||\n error.reason === 'too-many-parts';\n fail({ code: limit ? 'ResourceLimitExceeded' : 'InvalidArgument', target: 'createServer' });\n }\n const session = opened.session;\n const host = createStoreAutomationHost(session.store, {\n measurer: session.measurer,\n ...(rasterize\n ? {\n renderImage: (target) =>\n renderImageWith(\n session,\n target.slideIndex,\n {\n ...(target.shapeNodeId === undefined ? {} : { shapeNodeId: target.shapeNodeId }),\n ...(target.width === undefined ? {} : { width: target.width }),\n ...(target.height === undefined ? {} : { height: target.height }),\n },\n rasterize\n ),\n }\n : {}),\n });\n return createRuntime({\n host: {\n ...host,\n dispose() {\n host.dispose();\n session.dispose();\n },\n },\n save: true,\n });\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// The Office.js type name of each object of the model, for `context.loadRecursive`, whose\n// options are keyed by type name. By class identity, never by `constructor.name`, so a bundler\n// that renames classes changes nothing.\n\nimport type { ClientObject } from '../runtime/client-object.ts';\nimport { Adjustments } from './adjustments.ts';\nimport { Application } from './application.ts';\nimport {\n SlideBackground,\n SlideBackgroundFill,\n SlideBackgroundGradientFill,\n SlideBackgroundPatternFill,\n SlideBackgroundPictureOrTextureFill,\n SlideBackgroundSolidFill,\n SlideLayoutBackground,\n SlideMasterBackground,\n} from './backgrounds.ts';\nimport { Binding, BindingCollection } from './bindings.ts';\nimport { CustomProperty, CustomPropertyCollection } from './custom-properties.ts';\nimport {\n CustomXmlPart,\n CustomXmlPartCollection,\n CustomXmlPartScopedCollection,\n} from './custom-xml.ts';\nimport { ShapeFill, ShapeLineFormat } from './fill-line.ts';\nimport { Hyperlink, HyperlinkCollection, HyperlinkScopedCollection } from './hyperlinks.ts';\nimport { DocumentProperties, PageSetup, Presentation } from './presentation.ts';\nimport {\n PlaceholderFormat,\n Shape,\n ShapeCollection,\n ShapeGroup,\n ShapeScopedCollection,\n} from './shapes.ts';\nimport {\n Slide,\n SlideCollection,\n SlideLayout,\n SlideLayoutCollection,\n SlideMaster,\n SlideMasterCollection,\n SlideScopedCollection,\n} from './slides.ts';\nimport { TableCell } from './table-cell.ts';\nimport { Border, Borders, Margins, TableStyleSettings } from './table-format.ts';\nimport {\n Table,\n TableCellCollection,\n TableColumn,\n TableColumnCollection,\n TableRow,\n TableRowCollection,\n} from './tables.ts';\nimport { Tag, TagCollection } from './tags.ts';\nimport { ThemeColorScheme } from './theme.ts';\nimport { BulletFormat, ParagraphFormat, ShapeFont, TextFrame, TextRange } from './text.ts';\n\n/** Each class with its Office.js type name. */\nconst CLASSES: readonly (readonly [unknown, string])[] = [\n [Adjustments, 'Adjustments'],\n [Application, 'Application'],\n [Binding, 'Binding'],\n [BindingCollection, 'BindingCollection'],\n [Border, 'Border'],\n [Borders, 'Borders'],\n [BulletFormat, 'BulletFormat'],\n [CustomProperty, 'CustomProperty'],\n [CustomPropertyCollection, 'CustomPropertyCollection'],\n [CustomXmlPart, 'CustomXmlPart'],\n [CustomXmlPartCollection, 'CustomXmlPartCollection'],\n [CustomXmlPartScopedCollection, 'CustomXmlPartScopedCollection'],\n [DocumentProperties, 'DocumentProperties'],\n [Hyperlink, 'Hyperlink'],\n [HyperlinkCollection, 'HyperlinkCollection'],\n [HyperlinkScopedCollection, 'HyperlinkScopedCollection'],\n [Margins, 'Margins'],\n [PageSetup, 'PageSetup'],\n [ParagraphFormat, 'ParagraphFormat'],\n [PlaceholderFormat, 'PlaceholderFormat'],\n [Presentation, 'Presentation'],\n [Shape, 'Shape'],\n [ShapeCollection, 'ShapeCollection'],\n [ShapeFill, 'ShapeFill'],\n [ShapeFont, 'ShapeFont'],\n [ShapeGroup, 'ShapeGroup'],\n [ShapeLineFormat, 'ShapeLineFormat'],\n [ShapeScopedCollection, 'ShapeScopedCollection'],\n [Slide, 'Slide'],\n [SlideBackground, 'SlideBackground'],\n [SlideBackgroundFill, 'SlideBackgroundFill'],\n [SlideBackgroundGradientFill, 'SlideBackgroundGradientFill'],\n [SlideBackgroundPatternFill, 'SlideBackgroundPatternFill'],\n [SlideBackgroundPictureOrTextureFill, 'SlideBackgroundPictureOrTextureFill'],\n [SlideBackgroundSolidFill, 'SlideBackgroundSolidFill'],\n [SlideCollection, 'SlideCollection'],\n [SlideLayout, 'SlideLayout'],\n [SlideLayoutBackground, 'SlideLayoutBackground'],\n [SlideLayoutCollection, 'SlideLayoutCollection'],\n [SlideMaster, 'SlideMaster'],\n [SlideMasterBackground, 'SlideMasterBackground'],\n [SlideMasterCollection, 'SlideMasterCollection'],\n [SlideScopedCollection, 'SlideScopedCollection'],\n [Table, 'Table'],\n [TableCell, 'TableCell'],\n [TableCellCollection, 'TableCellCollection'],\n [TableColumn, 'TableColumn'],\n [TableColumnCollection, 'TableColumnCollection'],\n [TableRow, 'TableRow'],\n [TableRowCollection, 'TableRowCollection'],\n [TableStyleSettings, 'TableStyleSettings'],\n [Tag, 'Tag'],\n [TagCollection, 'TagCollection'],\n [TextFrame, 'TextFrame'],\n [TextRange, 'TextRange'],\n [ThemeColorScheme, 'ThemeColorScheme'],\n];\n\nconst BY_CLASS = new Map<unknown, string>(CLASSES.map(([type, name]) => [type, name]));\n\n/** Every type name, sorted. */\nexport const TYPE_NAMES: readonly string[] = Object.freeze(CLASSES.map(([, name]) => name).sort());\n\n/** The Office.js type name of an object of the model, or undefined. */\nexport function typeNameOf(object: ClientObject): string | undefined {\n return BY_CLASS.get(Object.getPrototypeOf(object)?.constructor);\n}\n","/*\nCopyright (c) 2026 EigenPal, Inc. All rights reserved.\nLicensed under the EigenPal Pro Evaluation License 1.0 — see packages/editor-api/LICENSE.md.\nProduction use requires a commercial agreement: licensing@eigenpal.com\n*/\n// After DOCX Editor's `packages/editor-api/src/runtime/runtime.ts` (commit 5993bd223945).\n//\n// A runtime: one presentation host, many runs. Runs are ISOLATED, not serialized: every `run`\n// gets its own context and queue, so two runs cannot interleave into one batch.\n\nimport type { AutomationHost, AutomationOperation } from '@pptx-editor.dev/core/automation';\nimport { Application } from '../model/application.ts';\nimport { Presentation } from '../model/presentation.ts';\nimport { TYPE_NAMES, typeNameOf } from '../model/type-names.ts';\nimport { hostFailure } from './batch.ts';\nimport { ClientObject } from './client-object.ts';\nimport { fail, failArgument, type PptxEditorError } from './errors.ts';\nimport { RequestContext, type RuntimeSession } from './request-context.ts';\n\n/**\n * What a `run` callback is given, and what it may answer with.\n *\n * @public\n */\nexport type RunCallback<T> = (context: RequestContext) => Promise<T>;\n\n/**\n * Capabilities of a runtime, frozen for its lifetime.\n *\n * @public\n */\nexport interface PresentationCapabilities {\n /** There is a presentation to address at all. */\n readonly document: boolean;\n /** `save()` is offered: true for a server runtime, false for one borrowing an editor. */\n readonly save: boolean;\n /** The host raises change events. */\n readonly events: boolean;\n /** The host has a reader's selection to read or move. */\n readonly selection: boolean;\n /** Text writes re-fit text bodies by their autofit rules (ECMA-376 Part 1, 21.1.2.1). */\n readonly autofit: boolean;\n /**\n * `getImageAsBase64` draws pictures of slides and shapes: true for a runtime over a live editor\n * in a browser and for a server runtime created with a `rasterize` option, false otherwise.\n */\n readonly images: boolean;\n}\n\n/**\n * A runtime: one presentation host, many runs.\n *\n * Disposal is final: {@link PptxEditorRuntime.dispose} releases the host once and is safe to call\n * again, and every later `run` fails with `RuntimeDisposed`.\n *\n * @public\n */\nexport interface PptxEditorRuntime {\n /** What the presentation host behind this runtime can do. */\n readonly capabilities: PresentationCapabilities;\n /** Run one batch of work against the presentation. Answers with the callback's value. */\n run<T>(callback: RunCallback<T>): Promise<T>;\n /** Run one batch of work, adopting objects a previous run tracked. */\n run<T>(object: ClientObject | readonly ClientObject[], callback: RunCallback<T>): Promise<T>;\n /** Release the host. Idempotent. */\n dispose(): void;\n}\n\n/**\n * A runtime over PPTX bytes rather than a live editor: what `PptxEditor.createServer` answers.\n *\n * @public\n */\nexport interface PptxEditorServerRuntime extends PptxEditorRuntime {\n /** The current presentation as a fresh, caller-owned PPTX byte array. */\n save(): Promise<Uint8Array>;\n}\n\nexport interface CreateRuntimeOptions {\n readonly host: AutomationHost;\n /** Whether this runtime offers `save()`. */\n readonly save: boolean;\n /** Told about each refused batch before it is thrown. */\n readonly onRefusal?: (error: PptxEditorError, operations: readonly AutomationOperation[]) => void;\n /** Told about each batch that threw an engine error, before it propagates. */\n readonly onException?: (error: unknown, operations: readonly AutomationOperation[]) => void;\n}\n\nexport function createRuntime(\n options: CreateRuntimeOptions & { save: true }\n): PptxEditorServerRuntime;\nexport function createRuntime(options: CreateRuntimeOptions): PptxEditorRuntime;\nexport function createRuntime(options: CreateRuntimeOptions): PptxEditorServerRuntime {\n const host = options.host;\n const capabilities: PresentationCapabilities = Object.freeze({\n document: host.capabilities.document,\n save: options.save && host.capabilities.save,\n events: host.capabilities.events,\n selection: host.capabilities.selection,\n autofit: host.capabilities.autofit,\n images: host.capabilities.images === true && typeof host.renderImage === 'function',\n });\n let disposed = false;\n const assertLive = (target?: string): void => {\n if (disposed) fail({ code: 'RuntimeDisposed', ...(target === undefined ? {} : { target }) });\n };\n const session: RuntimeSession = {\n host,\n capabilities,\n ...(options.onRefusal ? { onRefusal: options.onRefusal } : {}),\n ...(options.onException ? { onException: options.onException } : {}),\n id: {},\n assertLive,\n openPresentation: (context) => Presentation.open(context),\n openApplication: (context) => Application.open(context),\n typeName: typeNameOf,\n typeNames: TYPE_NAMES,\n };\n\n async function run<T>(\n first: RunCallback<T> | ClientObject | readonly ClientObject[],\n second?: RunCallback<T>\n ): Promise<T> {\n assertLive();\n const callback = typeof first === 'function' ? first : second;\n if (typeof callback !== 'function')\n failArgument('run', 'a callback, alone or after the objects to adopt');\n const adopted: readonly ClientObject[] =\n typeof first === 'function'\n ? []\n : Array.isArray(first)\n ? (first as readonly ClientObject[])\n : first instanceof ClientObject\n ? [first]\n : failArgument('run', 'an object of this API or an array of them, then a callback');\n if (!adopted.every((object) => object instanceof ClientObject))\n failArgument('run', 'objects of this API only');\n const { context, adopt, idle, finish } = RequestContext.begin(session);\n let completed = false;\n try {\n adopt(adopted);\n const value = await callback(context);\n completed = true;\n return value;\n } finally {\n // A sync the callback started and did not await still applies before the run ends.\n await idle();\n finish(completed);\n }\n }\n\n const runtime: PptxEditorRuntime = {\n capabilities,\n run,\n dispose() {\n if (disposed) return;\n disposed = true;\n host.dispose();\n },\n };\n if (!options.save) return runtime as PptxEditorServerRuntime;\n return {\n ...runtime,\n async save(): Promise<Uint8Array> {\n assertLive('save');\n if (!capabilities.save) fail({ code: 'NotSupported', target: 'save' });\n const saved = host.save();\n if (!saved.ok) throw hostFailure(saved.error, { target: 'save' });\n return saved.bytes;\n },\n };\n}\n"],"mappings":";AAUA,IAAM,kBAAkB;AACxB,IAAM,UAAU;AAChB,IAAM,OAAO;AACb,IAAM,SAAS;AACf,IAAM,SAAS;AAGf,IAAM,OAA+C;AAAA;AAAA,EAEnD,CAAC,SAAS,uEAAuE;AAAA,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F;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA;AAAA,EAEA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA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AA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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OAAO,gBAAgB,SAAY,CAAC,IAAI,EAAE,aAAa,OAAO,YAAY;AAAA,UAC9E,GAAI,OAAO,UAAU,SAAY,CAAC,IAAI,EAAE,OAAO,OAAO,MAAM;AAAA,UAC5D,GAAI,OAAO,WAAW,SAAY,CAAC,IAAI,EAAE,QAAQ,OAAO,OAAO;AAAA,QACjE;AAAA,QACA;AAAA,MACF;AAAA,IACJ,IACA,CAAC;AAAA,EACP,CAAC;AACD,SAAO,cAAc;AAAA,IACnB,MAAM;AAAA,MACJ,GAAG;AAAA,MACH,UAAU;AACR,aAAK,QAAQ;AACb,gBAAQ,QAAQ;AAAA,MAClB;AAAA,IACF;AAAA,IACA,MAAM;AAAA,EACR,CAAC;AACH;","names":["standIn","depth","indexOf","indexOf","index","listOf","ShapeType","BindingType","ConnectorType","HyperlinkType","ShapeZOrder","ShapeFillType","ShapeLineDashStyle","ShapeLineStyle","ShapeAutoSize","TextVerticalAlignment","ParagraphHorizontalAlignment","ShapeFontUnderlineStyle","PlaceholderType","SlideLayoutType","BulletType","BulletStyle","SlideBackgroundFillType","SlideBackgroundGradientFillType","SlideBackgroundPatternFillType","ThemeColor","TableStyle","InsertSlideFormatting","ShapeGetImageFormatType","DocumentPropertyType","index","GeometricShapeType","index","index","list","text","index","FILLERS","index","index","side","count","SIDES","FONT_KEYS","text","side","count","words","index","list","FILLERS","spanOf","index","count","idOf","FILLERS","index","FILLERS","keyOf","index","index","depth","child","done","finish"]}