ooxml-core 1.8.4 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PptxHandler-5UURGJEV.mjs +2 -0
- package/dist/{PptxHandler-BL4B7CZO.mjs → PptxHandler-ADEFY476.mjs} +2 -2
- package/dist/PptxHandler-U5XB2HUE.cjs +11 -0
- package/dist/automation/index.cjs +7239 -4037
- package/dist/automation/index.mjs +7239 -4037
- package/dist/chunk-3N6XMMTT.cjs +87913 -0
- package/dist/{chunk-TTPZITQN.mjs → chunk-5NVJN4E6.mjs} +30 -2
- package/dist/{chunk-ZAP5WLEN.mjs → chunk-A6P7G3UK.mjs} +1 -1
- package/dist/{chunk-CPKNMQLX.cjs → chunk-AWIDASUW.cjs} +25 -2
- package/dist/{chunk-SVQZXP3F.mjs → chunk-CBNKBVX5.mjs} +25 -2
- package/dist/{chunk-GAGSCAR3.mjs → chunk-CCHYFCPD.mjs} +1199 -348
- package/dist/chunk-R6KSBNKX.mjs +44133 -0
- package/dist/chunk-S6DOCMQC.cjs +44451 -0
- package/dist/{chunk-Z7IQR4S4.mjs → chunk-WUE5ZHU3.mjs} +269 -21
- package/dist/chunk-ZE53K7DH.mjs +87907 -0
- package/dist/{chunk-NIHPA63A.mjs → chunk-ZOUGMAZG.mjs} +54 -37
- package/dist/docx/block-parser.d.ts.map +1 -1
- package/dist/docx/cell-blocks.d.ts +4 -0
- package/dist/docx/cell-blocks.d.ts.map +1 -0
- package/dist/docx/document-paragraphs.d.ts.map +1 -1
- package/dist/docx/document-parts.d.ts +2 -0
- package/dist/docx/document-parts.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +189 -20
- package/dist/docx/embedded.mjs +189 -20
- package/dist/docx/index.cjs +219 -24
- package/dist/docx/index.mjs +219 -24
- package/dist/docx/layout/adapt-table.d.ts +2 -2
- package/dist/docx/layout/adapt-table.d.ts.map +1 -1
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/flow-paragraph.d.ts +5 -0
- package/dist/docx/layout/flow-paragraph.d.ts.map +1 -1
- package/dist/docx/layout/flow-table.d.ts +2 -1
- package/dist/docx/layout/flow-table.d.ts.map +1 -1
- package/dist/docx/layout/footnote-columns.d.ts +22 -0
- package/dist/docx/layout/footnote-columns.d.ts.map +1 -0
- package/dist/docx/layout/footnote-flow.d.ts +27 -0
- package/dist/docx/layout/footnote-flow.d.ts.map +1 -0
- package/dist/docx/layout/footnote-split.d.ts +7 -0
- package/dist/docx/layout/footnote-split.d.ts.map +1 -0
- package/dist/docx/layout/index.cjs +1528 -119
- package/dist/docx/layout/index.mjs +1528 -120
- package/dist/docx/layout/input.d.ts +17 -1
- package/dist/docx/layout/input.d.ts.map +1 -1
- package/dist/docx/layout/legacy-footnote-flow.d.ts +18 -0
- package/dist/docx/layout/legacy-footnote-flow.d.ts.map +1 -0
- package/dist/docx/layout/line-metrics.d.ts.map +1 -1
- package/dist/docx/layout/nested-frame-profile.d.ts +9 -0
- package/dist/docx/layout/nested-frame-profile.d.ts.map +1 -0
- package/dist/docx/layout/page-cursor.d.ts +15 -8
- package/dist/docx/layout/page-cursor.d.ts.map +1 -1
- package/dist/docx/layout/page-flow.d.ts.map +1 -1
- package/dist/docx/layout/paragraph-layout.d.ts.map +1 -1
- package/dist/docx/layout/paragraph-tokens.d.ts +2 -0
- package/dist/docx/layout/paragraph-tokens.d.ts.map +1 -1
- package/dist/docx/layout/reference-footnotes.d.ts +7 -0
- package/dist/docx/layout/reference-footnotes.d.ts.map +1 -0
- package/dist/docx/layout/result.d.ts +44 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/layout/section-flow.d.ts +2 -0
- package/dist/docx/layout/section-flow.d.ts.map +1 -1
- package/dist/docx/layout/table-border-layout.d.ts +16 -0
- package/dist/docx/layout/table-border-layout.d.ts.map +1 -0
- package/dist/docx/layout/table-cell-layout.d.ts +12 -0
- package/dist/docx/layout/table-cell-layout.d.ts.map +1 -0
- package/dist/docx/layout/table-content.d.ts +4 -0
- package/dist/docx/layout/table-content.d.ts.map +1 -0
- package/dist/docx/layout/table-footnotes.d.ts +32 -0
- package/dist/docx/layout/table-footnotes.d.ts.map +1 -0
- package/dist/docx/layout/table-frames.d.ts +4 -0
- package/dist/docx/layout/table-frames.d.ts.map +1 -0
- package/dist/docx/layout/table-layout.d.ts +16 -5
- package/dist/docx/layout/table-layout.d.ts.map +1 -1
- package/dist/docx/layout/table-note-completion.d.ts +5 -0
- package/dist/docx/layout/table-note-completion.d.ts.map +1 -0
- package/dist/docx/layout/table-note-stories.d.ts +6 -0
- package/dist/docx/layout/table-note-stories.d.ts.map +1 -0
- package/dist/docx/load/index.cjs +194 -25
- package/dist/docx/load/index.mjs +194 -25
- package/dist/docx/model-run.d.ts +2 -0
- package/dist/docx/model-run.d.ts.map +1 -1
- package/dist/docx/model.d.ts +7 -0
- package/dist/docx/model.d.ts.map +1 -1
- package/dist/docx/notes.d.ts +5 -0
- package/dist/docx/notes.d.ts.map +1 -1
- package/dist/docx/parse-table.d.ts.map +1 -1
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/save.d.ts.map +1 -1
- package/dist/docx/section-model.d.ts +2 -0
- package/dist/docx/section-model.d.ts.map +1 -1
- package/dist/docx/sections.d.ts.map +1 -1
- package/dist/docx/settings.d.ts +2 -0
- package/dist/docx/settings.d.ts.map +1 -1
- package/dist/docx/table-model.d.ts +3 -1
- package/dist/docx/table-model.d.ts.map +1 -1
- package/dist/docx/ui/index.cjs +55 -0
- package/dist/docx/ui/index.d.ts +1 -0
- package/dist/docx/ui/index.d.ts.map +1 -1
- package/dist/docx/ui/index.mjs +55 -1
- package/dist/docx/ui/table-structure-guard.d.ts +4 -0
- package/dist/docx/ui/table-structure-guard.d.ts.map +1 -0
- package/dist/docx/write-footnote-columns.d.ts +3 -0
- package/dist/docx/write-footnote-columns.d.ts.map +1 -0
- package/dist/docx/write-notes.d.ts.map +1 -1
- package/dist/docx/write-run.d.ts.map +1 -1
- package/dist/docx/write-sections.d.ts.map +1 -1
- package/dist/index.cjs +8 -5
- package/dist/index.mjs +8 -5
- package/dist/opc/clone-part-graph.d.ts +4 -0
- package/dist/opc/clone-part-graph.d.ts.map +1 -1
- package/dist/opc/index.cjs +8 -5
- package/dist/opc/index.mjs +8 -5
- package/dist/pptx/automation/index.cjs +1156 -389
- package/dist/pptx/automation/index.d.ts +4 -4
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-CKIUurnd.d.ts → index-Cuxtr76Y.d.ts} +29 -10
- package/dist/pptx/chunks/index-Cuxtr76Y.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-Cn-GzYGp.d.ts → index-DUCGeZh7.d.ts} +94 -5
- package/dist/pptx/chunks/index-DUCGeZh7.d.ts.map +1 -0
- package/dist/pptx/chunks/{smart-art-Q2kZQtHh.d.ts → smart-art-D-sXa_Nb.d.ts} +11 -1
- package/dist/pptx/chunks/smart-art-D-sXa_Nb.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-BHfAm5K9.d.ts → text-operations-BqHmLaLA.d.ts} +54 -13
- package/dist/pptx/chunks/text-operations-BqHmLaLA.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +1157 -395
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +54 -36
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +2 -2
- package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +1 -1
- package/dist/pptx/editor/render/find-replace.cjs +416 -45
- package/dist/pptx/editor/render/find-replace.d.ts +35 -4
- package/dist/pptx/editor/render/find-replace.d.ts.map +1 -1
- package/dist/pptx/editor/render/find-replace.mjs +416 -46
- package/dist/pptx/editor/render/remap-text.cjs +2 -2
- package/dist/pptx/editor/render/remap-text.d.ts.map +1 -1
- package/dist/pptx/editor/render/remap-text.mjs +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +87 -0
- package/dist/pptx/editor/render/slide-operations.d.ts +17 -1
- package/dist/pptx/editor/render/slide-operations.d.ts.map +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +83 -1
- package/dist/pptx/editor/render/slide-search.cjs +6 -10
- package/dist/pptx/editor/render/slide-search.d.ts +1 -1
- package/dist/pptx/editor/render/slide-search.mjs +6 -10
- package/dist/pptx/editor/render/template-editing.d.ts +1 -1
- package/dist/pptx/editor/render/template-editing.d.ts.map +1 -1
- package/dist/pptx/index.cjs +1651 -419
- package/dist/pptx/index.d.ts +5 -5
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/smartart-layouts/index.d.ts +1 -1
- package/dist/teams/index.cjs +965 -34
- package/dist/teams/index.mjs +965 -34
- package/dist/visio/accessibility.d.ts +10 -0
- package/dist/visio/accessibility.d.ts.map +1 -0
- package/dist/visio/cell-formula.d.ts +2 -0
- package/dist/visio/cell-formula.d.ts.map +1 -1
- package/dist/visio/connector-curve-aligned.d.ts +5 -0
- package/dist/visio/connector-curve-aligned.d.ts.map +1 -0
- package/dist/visio/connector-curve-spans.d.ts +14 -0
- package/dist/visio/connector-curve-spans.d.ts.map +1 -0
- package/dist/visio/connector-jumps.d.ts +5 -0
- package/dist/visio/connector-jumps.d.ts.map +1 -0
- package/dist/visio/connector-route-walk.d.ts +2 -1
- package/dist/visio/connector-route-walk.d.ts.map +1 -1
- package/dist/visio/date-cache.d.ts +3 -0
- package/dist/visio/date-cache.d.ts.map +1 -0
- package/dist/visio/edit-alt-text-scope.d.ts +5 -0
- package/dist/visio/edit-alt-text-scope.d.ts.map +1 -0
- package/dist/visio/edit-alt-text.d.ts +3 -0
- package/dist/visio/edit-alt-text.d.ts.map +1 -0
- package/dist/visio/edit-commands.d.ts +7 -2
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-commands.d.ts +5 -0
- package/dist/visio/edit-formatting-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-paint.d.ts.map +1 -1
- package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
- package/dist/visio/edit-line-jump-cache.d.ts +4 -0
- package/dist/visio/edit-line-jump-cache.d.ts.map +1 -0
- package/dist/visio/edit-master-index.d.ts.map +1 -1
- package/dist/visio/edit-metadata-commands.d.ts +10 -2
- package/dist/visio/edit-metadata-commands.d.ts.map +1 -1
- package/dist/visio/edit-metadata.d.ts +3 -1
- package/dist/visio/edit-metadata.d.ts.map +1 -1
- package/dist/visio/edit-page-alt-text.d.ts +4 -0
- package/dist/visio/edit-page-alt-text.d.ts.map +1 -0
- package/dist/visio/edit-page-layout.d.ts.map +1 -1
- package/dist/visio/edit-page-rename.d.ts.map +1 -1
- package/dist/visio/edit-page-setup-commands.d.ts +7 -1
- package/dist/visio/edit-page-setup-commands.d.ts.map +1 -1
- package/dist/visio/edit-page-size.d.ts.map +1 -1
- package/dist/visio/edit-pages.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-scope.d.ts.map +1 -1
- package/dist/visio/edit-shape-create.d.ts.map +1 -1
- package/dist/visio/edit-stencil-connector-write.d.ts.map +1 -1
- package/dist/visio/edit-style-admission.d.ts.map +1 -1
- package/dist/visio/edit-text-field.d.ts.map +1 -1
- package/dist/visio/edit-text.d.ts.map +1 -1
- package/dist/visio/edit.d.ts +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/index.cjs +1215 -248
- package/dist/visio/index.d.ts +2 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +1215 -249
- package/dist/visio/line-jumps.d.ts +1 -5
- package/dist/visio/line-jumps.d.ts.map +1 -1
- package/dist/visio/model.d.ts +13 -0
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/page-layout.d.ts +11 -2
- package/dist/visio/page-layout.d.ts.map +1 -1
- package/dist/visio/parser.d.ts.map +1 -1
- package/dist/visio/shape-metadata.d.ts +6 -0
- package/dist/visio/shape-metadata.d.ts.map +1 -1
- package/dist/visio/shapes.d.ts.map +1 -1
- package/dist/visio/text-field-case.d.ts +2 -0
- package/dist/visio/text-field-case.d.ts.map +1 -0
- package/dist/visio/text-field-display.d.ts.map +1 -1
- package/dist/visio/text-field-fraction.d.ts +3 -0
- package/dist/visio/text-field-fraction.d.ts.map +1 -0
- package/dist/visio/text-field-numeric.d.ts +4 -0
- package/dist/visio/text-field-numeric.d.ts.map +1 -0
- package/dist/visio/text-field-system-date.d.ts +4 -0
- package/dist/visio/text-field-system-date.d.ts.map +1 -0
- package/dist/visio/text-fields.d.ts +1 -0
- package/dist/visio/text-fields.d.ts.map +1 -1
- package/dist/visio/ui/connector-preview.d.ts +1 -1
- package/dist/visio/ui/connector-preview.d.ts.map +1 -1
- package/dist/visio/ui/data-graphic-rules.d.ts +2 -0
- package/dist/visio/ui/data-graphic-rules.d.ts.map +1 -1
- package/dist/visio/ui/data-graphics.d.ts +3 -2
- package/dist/visio/ui/data-graphics.d.ts.map +1 -1
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +19310 -18157
- package/dist/visio/ui/index.mjs +19310 -18158
- package/dist/visio/ui/scene-details.d.ts.map +1 -1
- package/dist/visio/ui/scene-validation.d.ts.map +1 -1
- package/dist/visio/ui/snapshot-scene.d.ts +2 -1
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
- package/dist/visio/ui/text-field-catalog.d.ts.map +1 -1
- package/dist/visio/xml-attribute-whitespace.d.ts +5 -0
- package/dist/visio/xml-attribute-whitespace.d.ts.map +1 -0
- package/dist/xlsx/edit/index.d.ts +1 -0
- package/dist/xlsx/edit/index.d.ts.map +1 -1
- package/dist/xlsx/edit/insert-guard.d.ts.map +1 -1
- package/dist/xlsx/edit/merge.d.ts.map +1 -1
- package/dist/xlsx/edit/page-breaks.d.ts +5 -0
- package/dist/xlsx/edit/page-breaks.d.ts.map +1 -0
- package/dist/xlsx/edit/pivots.d.ts +8 -0
- package/dist/xlsx/edit/pivots.d.ts.map +1 -0
- package/dist/xlsx/edit/print-titles.d.ts +7 -0
- package/dist/xlsx/edit/print-titles.d.ts.map +1 -0
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/sheets.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-formulas.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-sheet.d.ts.map +1 -1
- package/dist/xlsx/edit/sparkline-ranges.d.ts +11 -0
- package/dist/xlsx/edit/sparkline-ranges.d.ts.map +1 -0
- package/dist/xlsx/edit/sparkline-xml.d.ts +13 -0
- package/dist/xlsx/edit/sparkline-xml.d.ts.map +1 -0
- package/dist/xlsx/edit/sparklines.d.ts +16 -0
- package/dist/xlsx/edit/sparklines.d.ts.map +1 -0
- package/dist/xlsx/edit/table-edits.d.ts.map +1 -1
- package/dist/xlsx/edit/tables.d.ts.map +1 -1
- package/dist/xlsx/edit/types.d.ts +22 -1
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/text-regex.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +3638 -1199
- package/dist/xlsx/index.d.ts +1 -0
- package/dist/xlsx/index.d.ts.map +1 -1
- package/dist/xlsx/index.mjs +3619 -1200
- package/dist/xlsx/layout/cell-view.d.ts +2 -0
- package/dist/xlsx/layout/cell-view.d.ts.map +1 -1
- package/dist/xlsx/layout/header-footer.d.ts +58 -0
- package/dist/xlsx/layout/header-footer.d.ts.map +1 -0
- package/dist/xlsx/layout/index.d.ts +5 -0
- package/dist/xlsx/layout/index.d.ts.map +1 -1
- package/dist/xlsx/layout/print-breaks.d.ts +11 -0
- package/dist/xlsx/layout/print-breaks.d.ts.map +1 -0
- package/dist/xlsx/layout/print-layout.d.ts +34 -0
- package/dist/xlsx/layout/print-layout.d.ts.map +1 -0
- package/dist/xlsx/layout/print-merges.d.ts +18 -0
- package/dist/xlsx/layout/print-merges.d.ts.map +1 -0
- package/dist/xlsx/layout/print-repeat.d.ts +12 -0
- package/dist/xlsx/layout/print-repeat.d.ts.map +1 -0
- package/dist/xlsx/layout/print-titles.d.ts +20 -0
- package/dist/xlsx/layout/print-titles.d.ts.map +1 -0
- package/dist/xlsx/layout/sparkline-data.d.ts.map +1 -1
- package/dist/xlsx/layout/sparkline-view.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +8165 -6945
- package/dist/xlsx/load/index.mjs +8165 -6945
- package/dist/xlsx/model-pivots.d.ts +67 -0
- package/dist/xlsx/model-pivots.d.ts.map +1 -0
- package/dist/xlsx/model.d.ts +5 -0
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/pivot/admission.d.ts +5 -0
- package/dist/xlsx/pivot/admission.d.ts.map +1 -0
- package/dist/xlsx/pivot/aggregate.d.ts +21 -0
- package/dist/xlsx/pivot/aggregate.d.ts.map +1 -0
- package/dist/xlsx/pivot/cache-xml.d.ts +9 -0
- package/dist/xlsx/pivot/cache-xml.d.ts.map +1 -0
- package/dist/xlsx/pivot/data.d.ts +12 -0
- package/dist/xlsx/pivot/data.d.ts.map +1 -0
- package/dist/xlsx/pivot/hierarchy-first.d.ts +21 -0
- package/dist/xlsx/pivot/hierarchy-first.d.ts.map +1 -0
- package/dist/xlsx/pivot/hierarchy.d.ts +5 -0
- package/dist/xlsx/pivot/hierarchy.d.ts.map +1 -0
- package/dist/xlsx/pivot/index.d.ts +3 -0
- package/dist/xlsx/pivot/index.d.ts.map +1 -0
- package/dist/xlsx/pivot/measures.d.ts +13 -0
- package/dist/xlsx/pivot/measures.d.ts.map +1 -0
- package/dist/xlsx/pivot/read.d.ts +5 -0
- package/dist/xlsx/pivot/read.d.ts.map +1 -0
- package/dist/xlsx/pivot/table-xml.d.ts +5 -0
- package/dist/xlsx/pivot/table-xml.d.ts.map +1 -0
- package/dist/xlsx/pivot/values-axis.d.ts +9 -0
- package/dist/xlsx/pivot/values-axis.d.ts.map +1 -0
- package/dist/xlsx/pivot/write.d.ts +11 -0
- package/dist/xlsx/pivot/write.d.ts.map +1 -0
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/pivots.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/print-layout.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/print-layout.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/sparklines.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/sparklines.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/tools.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/page-breaks.d.ts +3 -0
- package/dist/xlsx/ui/commands/page-breaks.d.ts.map +1 -0
- package/dist/xlsx/ui/index.cjs +2421 -288
- package/dist/xlsx/ui/index.d.ts +1 -0
- package/dist/xlsx/ui/index.d.ts.map +1 -1
- package/dist/xlsx/ui/index.mjs +2421 -289
- package/dist/xlsx/write/page-setup.d.ts.map +1 -1
- package/dist/xlsx/write/save.d.ts.map +1 -1
- package/dist/xlsx/write/sheet-parts.d.ts +1 -0
- package/dist/xlsx/write/sheet-parts.d.ts.map +1 -1
- package/dist/xlsx/write/workbook-part.d.ts +1 -1
- package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/write/worksheet.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/pptx/chunks/index-CKIUurnd.d.ts.map +0 -1
- package/dist/pptx/chunks/index-Cn-GzYGp.d.ts.map +0 -1
- package/dist/pptx/chunks/smart-art-Q2kZQtHh.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-BHfAm5K9.d.ts.map +0 -1
package/dist/pptx/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var JSZip17 = require('jszip');
|
|
4
4
|
var fastXmlParser = require('fast-xml-parser');
|
|
5
5
|
var xmldom = require('@xmldom/xmldom');
|
|
6
6
|
var mtxDecompressor = require('mtx-decompressor');
|
|
7
7
|
|
|
8
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var JSZip17__default = /*#__PURE__*/_interopDefault(JSZip17);
|
|
11
11
|
|
|
12
12
|
var __defProp = Object.defineProperty;
|
|
13
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1010,6 +1010,7 @@ var init_presentation_field_keys = __esm({
|
|
|
1010
1010
|
modernCommentAuthors: true,
|
|
1011
1011
|
conformance: true,
|
|
1012
1012
|
embedTrueTypeFonts: true,
|
|
1013
|
+
firstSlideNumber: true,
|
|
1013
1014
|
defaultTextStyle: true
|
|
1014
1015
|
};
|
|
1015
1016
|
exports.PRESENTATION_FIELD_NAMES = Object.keys(exports.PRESENTATION_FIELD_KEYS);
|
|
@@ -1537,6 +1538,32 @@ function inheritCustomGeometryCommandOrder(target, ...sources) {
|
|
|
1537
1538
|
}
|
|
1538
1539
|
}
|
|
1539
1540
|
}
|
|
1541
|
+
function pathListPaths(pathLst) {
|
|
1542
|
+
if (!pathLst || typeof pathLst !== "object") {
|
|
1543
|
+
return [];
|
|
1544
|
+
}
|
|
1545
|
+
return ensureArrayLocal(childByLocalName(pathLst, "path")).filter(
|
|
1546
|
+
(path2) => Boolean(path2) && typeof path2 === "object"
|
|
1547
|
+
);
|
|
1548
|
+
}
|
|
1549
|
+
function readPathListCommandOrder(pathLst) {
|
|
1550
|
+
const orders = pathListPaths(pathLst).map((path2) => [...commandOrder.get(path2) ?? []]);
|
|
1551
|
+
return orders.some((order) => order.length > 0) ? orders : void 0;
|
|
1552
|
+
}
|
|
1553
|
+
function restorePathListCommandOrder(pathLst, orders) {
|
|
1554
|
+
if (!orders || orders.length === 0) {
|
|
1555
|
+
return;
|
|
1556
|
+
}
|
|
1557
|
+
pathListPaths(pathLst).forEach((path2, index) => {
|
|
1558
|
+
const order = orders[index];
|
|
1559
|
+
if (!order || order.length === 0 || commandOrder.has(path2)) {
|
|
1560
|
+
return;
|
|
1561
|
+
}
|
|
1562
|
+
if (orderSignature([...order]) === pathSignature(path2)) {
|
|
1563
|
+
commandOrder.set(path2, [...order]);
|
|
1564
|
+
}
|
|
1565
|
+
});
|
|
1566
|
+
}
|
|
1540
1567
|
function orderedXmlKey(baseName, order) {
|
|
1541
1568
|
return `${baseName}${ORDER_SUFFIX}${order}`;
|
|
1542
1569
|
}
|
|
@@ -4928,7 +4955,7 @@ function rootRelsXml() {
|
|
|
4928
4955
|
<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
|
|
4929
4956
|
</Relationships>`;
|
|
4930
4957
|
}
|
|
4931
|
-
function presentationXml(width, height, slideCount) {
|
|
4958
|
+
function presentationXml(width, height, slideCount, firstSlideNumber) {
|
|
4932
4959
|
const slideIdBase = 256;
|
|
4933
4960
|
const slideRIdBase = 6;
|
|
4934
4961
|
const sldIdLst = slideCount > 0 ? ` <p:sldIdLst>
|
|
@@ -4937,6 +4964,7 @@ ${Array.from(
|
|
|
4937
4964
|
(_, i2) => ` <p:sldId id="${slideIdBase + i2}" r:id="rId${slideRIdBase + i2}"/>`
|
|
4938
4965
|
).join("\n")}
|
|
4939
4966
|
</p:sldIdLst>` : "";
|
|
4967
|
+
const firstSlideNum = firstSlideNumber === void 0 ? "" : ` firstSlideNum="${Math.trunc(firstSlideNumber)}"`;
|
|
4940
4968
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
4941
4969
|
<p:presentation xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
4942
4970
|
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
@@ -4944,7 +4972,7 @@ ${Array.from(
|
|
|
4944
4972
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
4945
4973
|
xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main"
|
|
4946
4974
|
xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main"
|
|
4947
|
-
saveSubsetFonts="1">
|
|
4975
|
+
saveSubsetFonts="1"${firstSlideNum}>
|
|
4948
4976
|
<p:sldMasterIdLst>
|
|
4949
4977
|
<p:sldMasterId id="2147483648" r:id="rId1"/>
|
|
4950
4978
|
</p:sldMasterIdLst>
|
|
@@ -5178,10 +5206,13 @@ async function buildBlankPresentationArchive(options) {
|
|
|
5178
5206
|
const layoutCount = STANDARD_LAYOUTS.length;
|
|
5179
5207
|
const initialSlideCount = Math.max(0, options?.initialSlideCount ?? 0);
|
|
5180
5208
|
const blankLayoutIdx = STANDARD_LAYOUTS.findIndex((l) => l.type === "blank") + 1 || 7;
|
|
5181
|
-
const zip = new
|
|
5209
|
+
const zip = new JSZip17__default.default();
|
|
5182
5210
|
zip.file("[Content_Types].xml", contentTypesXml(layoutCount, initialSlideCount));
|
|
5183
5211
|
zip.file("_rels/.rels", rootRelsXml());
|
|
5184
|
-
zip.file(
|
|
5212
|
+
zip.file(
|
|
5213
|
+
"ppt/presentation.xml",
|
|
5214
|
+
presentationXml(width, height, initialSlideCount, options?.firstSlideNumber)
|
|
5215
|
+
);
|
|
5185
5216
|
zip.file("ppt/_rels/presentation.xml.rels", presentationRelsXml(layoutCount, initialSlideCount));
|
|
5186
5217
|
zip.file("ppt/slideMasters/slideMaster1.xml", slideMasterXml(layoutCount));
|
|
5187
5218
|
zip.file("ppt/slideMasters/_rels/slideMaster1.xml.rels", slideMasterRelsXml(layoutCount));
|
|
@@ -22836,7 +22867,7 @@ async function detectOlePayloadEditorKind(bytes) {
|
|
|
22836
22867
|
}
|
|
22837
22868
|
if (isZipMagic(bytes)) {
|
|
22838
22869
|
try {
|
|
22839
|
-
const zip = await
|
|
22870
|
+
const zip = await JSZip17__default.default.loadAsync(bytes);
|
|
22840
22871
|
if (zip.file("xl/workbook.xml")) {
|
|
22841
22872
|
return "sheet-xlsx";
|
|
22842
22873
|
}
|
|
@@ -23326,7 +23357,7 @@ function cellDisplayValue(cell, sharedStrings) {
|
|
|
23326
23357
|
}
|
|
23327
23358
|
async function readOleSheetGrid(xlsxBytes, maxRows = DEFAULT_MAX_ROWS, maxCols = DEFAULT_MAX_COLS) {
|
|
23328
23359
|
try {
|
|
23329
|
-
const zip = await
|
|
23360
|
+
const zip = await JSZip17__default.default.loadAsync(xlsxBytes);
|
|
23330
23361
|
const sheetFile = zip.file(FIRST_SHEET_PATH);
|
|
23331
23362
|
if (!sheetFile) {
|
|
23332
23363
|
return void 0;
|
|
@@ -23385,7 +23416,7 @@ function markFullCalcOnLoad(workbookXml, parser, builder3) {
|
|
|
23385
23416
|
}
|
|
23386
23417
|
async function writeOleSheetCellEdit(xlsxBytes, edit) {
|
|
23387
23418
|
try {
|
|
23388
|
-
const zip = await
|
|
23419
|
+
const zip = await JSZip17__default.default.loadAsync(xlsxBytes);
|
|
23389
23420
|
const sheetFile = zip.file(FIRST_SHEET_PATH);
|
|
23390
23421
|
if (!sheetFile) {
|
|
23391
23422
|
return xlsxBytes;
|
|
@@ -24543,7 +24574,7 @@ function paragraphText(paragraph) {
|
|
|
24543
24574
|
}
|
|
24544
24575
|
async function readOleDocumentParagraphs(docxBytes) {
|
|
24545
24576
|
try {
|
|
24546
|
-
const zip = await
|
|
24577
|
+
const zip = await JSZip17__default.default.loadAsync(docxBytes);
|
|
24547
24578
|
const documentFile = zip.file(DOCUMENT_PART_PATH);
|
|
24548
24579
|
if (!documentFile) {
|
|
24549
24580
|
return void 0;
|
|
@@ -24561,7 +24592,7 @@ async function readOleDocumentParagraphs(docxBytes) {
|
|
|
24561
24592
|
}
|
|
24562
24593
|
async function writeOleDocumentParagraphEdit(docxBytes, paragraphIndex, text2) {
|
|
24563
24594
|
try {
|
|
24564
|
-
const zip = await
|
|
24595
|
+
const zip = await JSZip17__default.default.loadAsync(docxBytes);
|
|
24565
24596
|
const documentFile = zip.file(DOCUMENT_PART_PATH);
|
|
24566
24597
|
if (!documentFile) {
|
|
24567
24598
|
return docxBytes;
|
|
@@ -45038,6 +45069,11 @@ function relationshipsPartFor(partName) {
|
|
|
45038
45069
|
const slash = partName.lastIndexOf("/");
|
|
45039
45070
|
return `${partName.slice(0, slash + 1)}_rels/${partName.slice(slash + 1)}.rels`;
|
|
45040
45071
|
}
|
|
45072
|
+
function nextRelationshipId(used) {
|
|
45073
|
+
let index = 1;
|
|
45074
|
+
while (used.has(`rId${index}`)) index++;
|
|
45075
|
+
return `rId${index}`;
|
|
45076
|
+
}
|
|
45041
45077
|
var escapeAttr;
|
|
45042
45078
|
var init_relationships = __esm({
|
|
45043
45079
|
"opc/relationships.ts"() {
|
|
@@ -45064,6 +45100,13 @@ function parseContentTypes(xml) {
|
|
|
45064
45100
|
}
|
|
45065
45101
|
return { defaults, overrides: overrides28 };
|
|
45066
45102
|
}
|
|
45103
|
+
function contentTypeForPart(types, partName) {
|
|
45104
|
+
const overridePath = partName.startsWith("/") ? partName : `/${partName}`;
|
|
45105
|
+
const override = types.overrides.get(overridePath);
|
|
45106
|
+
if (override) return override;
|
|
45107
|
+
const extension = partName.split(".").pop()?.toLowerCase();
|
|
45108
|
+
return extension ? types.defaults.get(extension) : void 0;
|
|
45109
|
+
}
|
|
45067
45110
|
var init_content_types = __esm({
|
|
45068
45111
|
"opc/content-types.ts"() {
|
|
45069
45112
|
init_xml2();
|
|
@@ -45103,10 +45146,13 @@ function relativePartTarget(basePart, targetPart) {
|
|
|
45103
45146
|
}
|
|
45104
45147
|
async function clonePartGraph(options) {
|
|
45105
45148
|
const { zip, sourcePart, targetPart, shouldClone } = options;
|
|
45106
|
-
const
|
|
45107
|
-
const
|
|
45149
|
+
const sourceZip = options.sourceZip ?? zip;
|
|
45150
|
+
const copies = options.copies ?? /* @__PURE__ */ new Map();
|
|
45151
|
+
copies.set(sourcePart, targetPart);
|
|
45152
|
+
const types = parseContentTypes(await sourceZip.file("[Content_Types].xml")?.async("string"));
|
|
45108
45153
|
const reserved = new Set(Object.keys(zip.files));
|
|
45109
45154
|
reserved.add(targetPart);
|
|
45155
|
+
for (const target of copies.values()) reserved.add(target);
|
|
45110
45156
|
const allocate = (source) => {
|
|
45111
45157
|
const match = /^(?<stem>.*?)(?:\d+)?(?<extension>\.[^/.]+)$/u.exec(source);
|
|
45112
45158
|
const stem = match?.groups?.stem ?? source;
|
|
@@ -45118,9 +45164,9 @@ async function clonePartGraph(options) {
|
|
|
45118
45164
|
return path2;
|
|
45119
45165
|
};
|
|
45120
45166
|
const copyRelationships = async (source, destination) => {
|
|
45121
|
-
const contentType = types
|
|
45167
|
+
const contentType = contentTypeForPart(types, source);
|
|
45122
45168
|
if (contentType) await ensureContentTypeOverride(zip, destination, contentType);
|
|
45123
|
-
const xml = await
|
|
45169
|
+
const xml = await sourceZip.file(relationshipsPartFor(source))?.async("string");
|
|
45124
45170
|
if (!xml) return;
|
|
45125
45171
|
const relationships2 = parseRelationships(xml);
|
|
45126
45172
|
for (const relationship of relationships2.values()) {
|
|
@@ -45128,7 +45174,7 @@ async function clonePartGraph(options) {
|
|
|
45128
45174
|
const originalTarget = resolvePartPath(source, relationship.target);
|
|
45129
45175
|
let newTarget = copies.get(originalTarget);
|
|
45130
45176
|
if (!newTarget && shouldClone(relationship, originalTarget)) {
|
|
45131
|
-
const file =
|
|
45177
|
+
const file = sourceZip.file(originalTarget);
|
|
45132
45178
|
if (!file) throw new Error(`Cannot clone missing package part: ${originalTarget}`);
|
|
45133
45179
|
newTarget = allocate(originalTarget);
|
|
45134
45180
|
copies.set(originalTarget, newTarget);
|
|
@@ -55448,7 +55494,7 @@ function resolveCellValue(cell, sharedStrings) {
|
|
|
55448
55494
|
}
|
|
55449
55495
|
async function parseEmbeddedXlsx(xlsxData) {
|
|
55450
55496
|
try {
|
|
55451
|
-
const xlsxZip = await
|
|
55497
|
+
const xlsxZip = await JSZip17__default.default.loadAsync(xlsxData);
|
|
55452
55498
|
const xmlParser = new fastXmlParser.XMLParser({
|
|
55453
55499
|
ignoreAttributes: false,
|
|
55454
55500
|
attributeNamePrefix: "@_",
|
|
@@ -59553,7 +59599,7 @@ function normalisePath(p) {
|
|
|
59553
59599
|
}
|
|
59554
59600
|
async function tryOpenZip(buffer) {
|
|
59555
59601
|
try {
|
|
59556
|
-
const zip = await
|
|
59602
|
+
const zip = await JSZip17__default.default.loadAsync(buffer);
|
|
59557
59603
|
return { zip };
|
|
59558
59604
|
} catch {
|
|
59559
59605
|
return { error: "Buffer is not a valid ZIP file" };
|
|
@@ -69808,6 +69854,7 @@ var init_custom_geometry_parser = __esm({
|
|
|
69808
69854
|
// pptx/core/geometry/custom-geometry-live-eval.ts
|
|
69809
69855
|
function pathNodesOf(rawData) {
|
|
69810
69856
|
const pathLst = rawData?.pathLstXml;
|
|
69857
|
+
restorePathListCommandOrder(pathLst, rawData?.pathCommandOrder);
|
|
69811
69858
|
return ensureArrayValue(pathLst?.["a:path"]);
|
|
69812
69859
|
}
|
|
69813
69860
|
function evaluateCustomGeometryPathData(rawData, pathWidth, pathHeight, overrides28) {
|
|
@@ -69856,6 +69903,7 @@ var init_custom_geometry_live_eval = __esm({
|
|
|
69856
69903
|
"pptx/core/geometry/custom-geometry-live-eval.ts"() {
|
|
69857
69904
|
init_utils();
|
|
69858
69905
|
init_custom_geometry();
|
|
69906
|
+
init_custom_geometry_command_order();
|
|
69859
69907
|
init_custom_geometry_guides();
|
|
69860
69908
|
init_custom_geometry_parser();
|
|
69861
69909
|
init_guide_formula_paths();
|
|
@@ -72772,7 +72820,7 @@ var init_PptxPresentationSlidesReconciler = __esm({
|
|
|
72772
72820
|
}
|
|
72773
72821
|
staticRelationships.push(relationship);
|
|
72774
72822
|
}
|
|
72775
|
-
const
|
|
72823
|
+
const nextRelationshipId5 = () => {
|
|
72776
72824
|
let index = 1;
|
|
72777
72825
|
while (usedRIds.has(`rId${index}`)) {
|
|
72778
72826
|
index += 1;
|
|
@@ -72816,7 +72864,7 @@ var init_PptxPresentationSlidesReconciler = __esm({
|
|
|
72816
72864
|
const existingSlideXml = input.slideMap.get(slide.id);
|
|
72817
72865
|
if (existingSlideXml) {
|
|
72818
72866
|
if (!slide.rId || slide.rId.length === 0 || !slideTargetByRid.has(slide.rId)) {
|
|
72819
|
-
slide.rId =
|
|
72867
|
+
slide.rId = nextRelationshipId5();
|
|
72820
72868
|
} else {
|
|
72821
72869
|
usedRIds.add(slide.rId);
|
|
72822
72870
|
}
|
|
@@ -72835,7 +72883,7 @@ var init_PptxPresentationSlidesReconciler = __esm({
|
|
|
72835
72883
|
sourceSlidePath,
|
|
72836
72884
|
usedRIds,
|
|
72837
72885
|
slideTargetByRid,
|
|
72838
|
-
nextRelationshipId:
|
|
72886
|
+
nextRelationshipId: nextRelationshipId5
|
|
72839
72887
|
});
|
|
72840
72888
|
attachedPaths.set(originalId, slide.id);
|
|
72841
72889
|
}
|
|
@@ -73858,7 +73906,13 @@ var init_PptxSlideNotesPartUpdater = __esm({
|
|
|
73858
73906
|
init.slideNotesRelationshipType,
|
|
73859
73907
|
`../notesSlides/${fileName}`
|
|
73860
73908
|
);
|
|
73861
|
-
|
|
73909
|
+
const notesXmlObject = this.buildNotesSlide(init.slide, strict);
|
|
73910
|
+
init.updateNotesXmlText(
|
|
73911
|
+
notesXmlObject,
|
|
73912
|
+
init.slide.notes ?? init.slide.notesSegments?.map((segment) => segment.text).join("") ?? "",
|
|
73913
|
+
init.slide.notesSegments
|
|
73914
|
+
);
|
|
73915
|
+
init.zip.file(notesPath, init.xmlBuilder.build(notesXmlObject));
|
|
73862
73916
|
init.zip.file(
|
|
73863
73917
|
`ppt/notesSlides/_rels/${fileName}.rels`,
|
|
73864
73918
|
init.xmlBuilder.build({
|
|
@@ -78542,7 +78596,7 @@ function parseShapeLockNode(node, spec) {
|
|
|
78542
78596
|
return void 0;
|
|
78543
78597
|
}
|
|
78544
78598
|
const locks = {};
|
|
78545
|
-
let
|
|
78599
|
+
let hasAny2 = false;
|
|
78546
78600
|
for (const prop of spec.permitted) {
|
|
78547
78601
|
const raw = node[LOCK_ATTRIBUTE[prop]];
|
|
78548
78602
|
if (raw === void 0) {
|
|
@@ -78550,9 +78604,9 @@ function parseShapeLockNode(node, spec) {
|
|
|
78550
78604
|
}
|
|
78551
78605
|
const value = String(raw).trim().toLowerCase();
|
|
78552
78606
|
locks[prop] = value === "1" || value === "true";
|
|
78553
|
-
|
|
78607
|
+
hasAny2 = true;
|
|
78554
78608
|
}
|
|
78555
|
-
return
|
|
78609
|
+
return hasAny2 ? locks : void 0;
|
|
78556
78610
|
}
|
|
78557
78611
|
var LOCK_ATTRIBUTE, MODELLED_ATTRIBUTES, CARRIED_WHEN_UNSET;
|
|
78558
78612
|
var init_shape_lock_node = __esm({
|
|
@@ -79419,6 +79473,7 @@ var init_PptxLoadDataBuilder = __esm({
|
|
|
79419
79473
|
modernCommentAuthors;
|
|
79420
79474
|
conformance;
|
|
79421
79475
|
embedTrueTypeFonts;
|
|
79476
|
+
firstSlideNumber;
|
|
79422
79477
|
defaultTextStyle;
|
|
79423
79478
|
withDimensions(width, height, widthEmu, heightEmu) {
|
|
79424
79479
|
this.width = width;
|
|
@@ -79588,6 +79643,10 @@ var init_PptxLoadDataBuilder = __esm({
|
|
|
79588
79643
|
this.embedTrueTypeFonts = embedTrueTypeFonts;
|
|
79589
79644
|
return this;
|
|
79590
79645
|
}
|
|
79646
|
+
withFirstSlideNumber(firstSlideNumber) {
|
|
79647
|
+
this.firstSlideNumber = firstSlideNumber;
|
|
79648
|
+
return this;
|
|
79649
|
+
}
|
|
79591
79650
|
withDefaultTextStyle(defaultTextStyle) {
|
|
79592
79651
|
this.defaultTextStyle = defaultTextStyle;
|
|
79593
79652
|
return this;
|
|
@@ -79639,6 +79698,7 @@ var init_PptxLoadDataBuilder = __esm({
|
|
|
79639
79698
|
modernCommentAuthors: this.modernCommentAuthors,
|
|
79640
79699
|
conformance: this.conformance,
|
|
79641
79700
|
embedTrueTypeFonts: this.embedTrueTypeFonts,
|
|
79701
|
+
firstSlideNumber: this.firstSlideNumber,
|
|
79642
79702
|
defaultTextStyle: this.defaultTextStyle
|
|
79643
79703
|
};
|
|
79644
79704
|
}
|
|
@@ -83694,6 +83754,371 @@ var init_native_animation_media_duration = __esm({
|
|
|
83694
83754
|
}
|
|
83695
83755
|
});
|
|
83696
83756
|
|
|
83757
|
+
// pptx/core/services/editor-animation-entry.ts
|
|
83758
|
+
function hasAuthoredAnimationEffect(entry2) {
|
|
83759
|
+
return Boolean(
|
|
83760
|
+
[entry2.entrance, entry2.exit, entry2.emphasis].some((preset2) => preset2 && preset2 !== "none") || entry2.motionPath
|
|
83761
|
+
);
|
|
83762
|
+
}
|
|
83763
|
+
function hasAnimation(animations, elementId) {
|
|
83764
|
+
const entry2 = animationFor(animations, elementId);
|
|
83765
|
+
return Boolean(entry2 && (entry2.entrance || entry2.exit || entry2.emphasis || entry2.motionPath));
|
|
83766
|
+
}
|
|
83767
|
+
function animationFor(slideAnimations, elementId) {
|
|
83768
|
+
return slideAnimations.find((a) => a.elementId === elementId);
|
|
83769
|
+
}
|
|
83770
|
+
function upsert(anims, elementId, updater) {
|
|
83771
|
+
const idx = anims.findIndex((a) => a.elementId === elementId);
|
|
83772
|
+
if (idx >= 0) {
|
|
83773
|
+
const updated2 = updater({ ...anims[idx] });
|
|
83774
|
+
if (updated2 === null) {
|
|
83775
|
+
return anims.filter((a) => a.elementId !== elementId);
|
|
83776
|
+
}
|
|
83777
|
+
return anims.map((a, i2) => i2 === idx ? updated2 : a);
|
|
83778
|
+
}
|
|
83779
|
+
const created = {
|
|
83780
|
+
elementId,
|
|
83781
|
+
durationMs: exports.DEFAULT_ANIMATION_DURATION_MS,
|
|
83782
|
+
order: anims.length,
|
|
83783
|
+
trigger: exports.DEFAULT_ANIMATION_TRIGGER
|
|
83784
|
+
};
|
|
83785
|
+
const updated = updater(created);
|
|
83786
|
+
if (updated === null) {
|
|
83787
|
+
return [...anims];
|
|
83788
|
+
}
|
|
83789
|
+
return [...anims, updated];
|
|
83790
|
+
}
|
|
83791
|
+
exports.DEFAULT_ANIMATION_DURATION_MS = void 0; exports.DEFAULT_ANIMATION_TRIGGER = void 0;
|
|
83792
|
+
var init_editor_animation_entry = __esm({
|
|
83793
|
+
"pptx/core/services/editor-animation-entry.ts"() {
|
|
83794
|
+
exports.DEFAULT_ANIMATION_DURATION_MS = 500;
|
|
83795
|
+
exports.DEFAULT_ANIMATION_TRIGGER = "onClick";
|
|
83796
|
+
}
|
|
83797
|
+
});
|
|
83798
|
+
|
|
83799
|
+
// pptx/core/services/native-animation-after-effect.ts
|
|
83800
|
+
function hasAfterEffectFlag(cTn) {
|
|
83801
|
+
const raw = cTn?.["@_afterEffect"];
|
|
83802
|
+
return raw === "1" || raw === "true";
|
|
83803
|
+
}
|
|
83804
|
+
function extractSrgbHex(colorContainer) {
|
|
83805
|
+
const srgb = colorContainer?.["a:srgbClr"];
|
|
83806
|
+
const val = srgb?.["@_val"];
|
|
83807
|
+
return val !== void 0 ? `#${String(val).toUpperCase()}` : void 0;
|
|
83808
|
+
}
|
|
83809
|
+
function findDimBehaviour(subTnLst) {
|
|
83810
|
+
for (const node of ensureArray11(subTnLst["p:animClr"])) {
|
|
83811
|
+
const cBhvr = node["p:cBhvr"];
|
|
83812
|
+
if (extractAttrNameFromCBhvr(cBhvr) !== "ppt_c") {
|
|
83813
|
+
continue;
|
|
83814
|
+
}
|
|
83815
|
+
if (!hasAfterEffectFlag(cBhvr?.["p:cTn"])) {
|
|
83816
|
+
continue;
|
|
83817
|
+
}
|
|
83818
|
+
const toNode = node["p:to"];
|
|
83819
|
+
const color2 = extractSrgbHex(toNode);
|
|
83820
|
+
if (color2) {
|
|
83821
|
+
return { action: "dimToColor", color: color2 };
|
|
83822
|
+
}
|
|
83823
|
+
const colorRef = themeColorRefFromSchemeClr(toNode?.["a:schemeClr"]);
|
|
83824
|
+
return colorRef ? { action: "dimToColor", colorRef } : { action: "dimToColor" };
|
|
83825
|
+
}
|
|
83826
|
+
return void 0;
|
|
83827
|
+
}
|
|
83828
|
+
function findHideBehaviour(subTnLst) {
|
|
83829
|
+
for (const node of ensureArray11(subTnLst["p:set"])) {
|
|
83830
|
+
const cBhvr = node["p:cBhvr"];
|
|
83831
|
+
if (extractAttrNameFromCBhvr(cBhvr) !== "style.visibility") {
|
|
83832
|
+
continue;
|
|
83833
|
+
}
|
|
83834
|
+
const innerCTn = cBhvr?.["p:cTn"];
|
|
83835
|
+
if (!hasAfterEffectFlag(innerCTn)) {
|
|
83836
|
+
continue;
|
|
83837
|
+
}
|
|
83838
|
+
const toNode = node["p:to"];
|
|
83839
|
+
const strVal = toNode?.["p:strVal"]?.["@_val"];
|
|
83840
|
+
if (String(strVal ?? "").toLowerCase() !== "hidden") {
|
|
83841
|
+
continue;
|
|
83842
|
+
}
|
|
83843
|
+
const action = innerCTn?.["@_masterRel"] === "sameClick" ? "hideAfterAnimation" : "hideOnNextClick";
|
|
83844
|
+
return { action };
|
|
83845
|
+
}
|
|
83846
|
+
return void 0;
|
|
83847
|
+
}
|
|
83848
|
+
function extractAfterAnimationFromSubTnLst(cTn) {
|
|
83849
|
+
const subTnLst = cTn["p:subTnLst"];
|
|
83850
|
+
if (!subTnLst) {
|
|
83851
|
+
return void 0;
|
|
83852
|
+
}
|
|
83853
|
+
return findDimBehaviour(subTnLst) ?? findHideBehaviour(subTnLst);
|
|
83854
|
+
}
|
|
83855
|
+
var init_native_animation_after_effect = __esm({
|
|
83856
|
+
"pptx/core/services/native-animation-after-effect.ts"() {
|
|
83857
|
+
init_theme_color_ref();
|
|
83858
|
+
init_native_animation_attr_name();
|
|
83859
|
+
init_native_animation_helpers();
|
|
83860
|
+
}
|
|
83861
|
+
});
|
|
83862
|
+
|
|
83863
|
+
// pptx/core/services/animation-after-effect-write.ts
|
|
83864
|
+
function assertAfterAnimationClearSupported(effectCTn) {
|
|
83865
|
+
const shapeIds = /* @__PURE__ */ new Set();
|
|
83866
|
+
const checkTarget = (value) => {
|
|
83867
|
+
if (Array.isArray(value)) {
|
|
83868
|
+
value.forEach(checkTarget);
|
|
83869
|
+
return;
|
|
83870
|
+
}
|
|
83871
|
+
if (!isXmlObject5(value)) return;
|
|
83872
|
+
const shapeTarget = value["p:spTgt"];
|
|
83873
|
+
if (isXmlObject5(shapeTarget) && shapeTarget["@_spid"] !== void 0)
|
|
83874
|
+
shapeIds.add(String(shapeTarget["@_spid"]));
|
|
83875
|
+
if ([
|
|
83876
|
+
"p:bg",
|
|
83877
|
+
"p:txEl",
|
|
83878
|
+
"p:subSp",
|
|
83879
|
+
"p:graphicEl",
|
|
83880
|
+
"p:oleChartEl",
|
|
83881
|
+
"p:sndTgt",
|
|
83882
|
+
"p:inkTgt",
|
|
83883
|
+
"p:sldTgt"
|
|
83884
|
+
].some((key2) => value[key2] !== void 0))
|
|
83885
|
+
throw new Error("Clearing after-animation supports whole-shape targets only");
|
|
83886
|
+
Object.values(value).forEach(checkTarget);
|
|
83887
|
+
};
|
|
83888
|
+
checkTarget(effectCTn["p:childTnLst"]);
|
|
83889
|
+
if (shapeIds.size > 1)
|
|
83890
|
+
throw new Error("Editing after-animation supports a single whole-shape target only");
|
|
83891
|
+
const sub = effectCTn["p:subTnLst"];
|
|
83892
|
+
if (!isXmlObject5(sub)) return;
|
|
83893
|
+
const countAfterFlags = (value) => {
|
|
83894
|
+
if (Array.isArray(value))
|
|
83895
|
+
return value.reduce((count, child30) => count + countAfterFlags(child30), 0);
|
|
83896
|
+
if (!isXmlObject5(value)) return 0;
|
|
83897
|
+
return Object.entries(value).reduce(
|
|
83898
|
+
(count, [key2, child30]) => count + (key2 === "@_afterEffect" && ["1", "true"].includes(String(child30)) ? 1 : countAfterFlags(child30)),
|
|
83899
|
+
0
|
|
83900
|
+
);
|
|
83901
|
+
};
|
|
83902
|
+
for (const [key2, value] of Object.entries(sub)) {
|
|
83903
|
+
for (const node of ensureArray11(value)) {
|
|
83904
|
+
const flags = countAfterFlags(node);
|
|
83905
|
+
if (!flags) continue;
|
|
83906
|
+
if (flags !== 1 || !extractAfterAnimationFromSubTnLst({ "p:subTnLst": { [key2]: node } }))
|
|
83907
|
+
throw new Error("Cannot clear an unsupported native after-animation behavior");
|
|
83908
|
+
checkTarget(node);
|
|
83909
|
+
}
|
|
83910
|
+
}
|
|
83911
|
+
if (shapeIds.size > 1)
|
|
83912
|
+
throw new Error("Editing after-animation supports a single whole-shape target only");
|
|
83913
|
+
}
|
|
83914
|
+
function clearAfterAnimationBehavior(effectCTn) {
|
|
83915
|
+
const sub = effectCTn["p:subTnLst"];
|
|
83916
|
+
if (!isXmlObject5(sub)) return;
|
|
83917
|
+
for (const key2 of Object.keys(sub)) {
|
|
83918
|
+
const nodes = ensureArray11(sub[key2]);
|
|
83919
|
+
const remaining = nodes.filter(
|
|
83920
|
+
(node) => !extractAfterAnimationFromSubTnLst({ "p:subTnLst": { [key2]: node } })
|
|
83921
|
+
);
|
|
83922
|
+
if (remaining.length === nodes.length) continue;
|
|
83923
|
+
if (remaining.length === 0) delete sub[key2];
|
|
83924
|
+
else sub[key2] = remaining.length === 1 ? remaining[0] : remaining;
|
|
83925
|
+
}
|
|
83926
|
+
if (Object.keys(sub).length === 0) delete effectCTn["p:subTnLst"];
|
|
83927
|
+
}
|
|
83928
|
+
function applyAfterAnimationBehavior(effectCTn, anim, shapeId) {
|
|
83929
|
+
if (anim.afterAnimation === void 0) return;
|
|
83930
|
+
if (anim.afterAnimation === "none") {
|
|
83931
|
+
assertAfterAnimationClearSupported(effectCTn);
|
|
83932
|
+
clearAfterAnimationBehavior(effectCTn);
|
|
83933
|
+
return;
|
|
83934
|
+
}
|
|
83935
|
+
assertAfterAnimationClearSupported(effectCTn);
|
|
83936
|
+
clearAfterAnimationBehavior(effectCTn);
|
|
83937
|
+
delete effectCTn["@_afterEffect"];
|
|
83938
|
+
if (anim.afterAnimation === "dimToColor" && anim.afterAnimationColor) {
|
|
83939
|
+
appendAfterAnimationBehavior(effectCTn, buildDimSubTnLst(shapeId, anim.afterAnimationColor));
|
|
83940
|
+
return;
|
|
83941
|
+
}
|
|
83942
|
+
if (anim.afterAnimation === "hideAfterAnimation") {
|
|
83943
|
+
const entranceId = effectCTn["@_id"] !== void 0 ? String(effectCTn["@_id"]) : "0";
|
|
83944
|
+
appendAfterAnimationBehavior(effectCTn, buildHideSubTnLst(shapeId, "sameClick", entranceId));
|
|
83945
|
+
return;
|
|
83946
|
+
}
|
|
83947
|
+
if (anim.afterAnimation === "hideOnNextClick") {
|
|
83948
|
+
appendAfterAnimationBehavior(effectCTn, buildHideSubTnLst(shapeId, "nextClick"));
|
|
83949
|
+
}
|
|
83950
|
+
}
|
|
83951
|
+
function appendAfterAnimationBehavior(effect, addition) {
|
|
83952
|
+
const sub = isXmlObject5(effect["p:subTnLst"]) ? effect["p:subTnLst"] : {};
|
|
83953
|
+
for (const [key2, value] of Object.entries(addition)) {
|
|
83954
|
+
const nodes = [...ensureArray11(sub[key2]), ...ensureArray11(value)];
|
|
83955
|
+
sub[key2] = nodes.length === 1 ? nodes[0] : nodes;
|
|
83956
|
+
}
|
|
83957
|
+
effect["p:subTnLst"] = sub;
|
|
83958
|
+
}
|
|
83959
|
+
function buildDimSubTnLst(shapeId, colorHex) {
|
|
83960
|
+
const hex3 = colorHex.replace(/^#/u, "").toUpperCase();
|
|
83961
|
+
return {
|
|
83962
|
+
"p:animClr": {
|
|
83963
|
+
"@_clrSpc": "rgb",
|
|
83964
|
+
"@_dir": "cw",
|
|
83965
|
+
"p:cBhvr": {
|
|
83966
|
+
"@_override": "childStyle",
|
|
83967
|
+
"p:cTn": {
|
|
83968
|
+
"@_dur": "1",
|
|
83969
|
+
"@_fill": "hold",
|
|
83970
|
+
"@_display": "0",
|
|
83971
|
+
"@_masterRel": "nextClick",
|
|
83972
|
+
"@_afterEffect": "1"
|
|
83973
|
+
},
|
|
83974
|
+
"p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
|
|
83975
|
+
"p:attrNameLst": { "p:attrName": "ppt_c" }
|
|
83976
|
+
},
|
|
83977
|
+
"p:to": { "a:srgbClr": { "@_val": hex3 } }
|
|
83978
|
+
}
|
|
83979
|
+
};
|
|
83980
|
+
}
|
|
83981
|
+
function buildHideSubTnLst(shapeId, masterRel, entranceId) {
|
|
83982
|
+
const cTn = {
|
|
83983
|
+
"@_dur": "1",
|
|
83984
|
+
"@_fill": "hold",
|
|
83985
|
+
"@_display": "0",
|
|
83986
|
+
"@_masterRel": masterRel,
|
|
83987
|
+
"@_afterEffect": "1"
|
|
83988
|
+
};
|
|
83989
|
+
if (masterRel === "sameClick") {
|
|
83990
|
+
cTn["p:stCondLst"] = {
|
|
83991
|
+
"p:cond": {
|
|
83992
|
+
"@_evt": "end",
|
|
83993
|
+
"@_delay": "0",
|
|
83994
|
+
"p:tn": { "@_val": entranceId ?? "0" }
|
|
83995
|
+
}
|
|
83996
|
+
};
|
|
83997
|
+
}
|
|
83998
|
+
return {
|
|
83999
|
+
"p:set": {
|
|
84000
|
+
"p:cBhvr": {
|
|
84001
|
+
"@_override": "childStyle",
|
|
84002
|
+
"p:cTn": cTn,
|
|
84003
|
+
"p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
|
|
84004
|
+
"p:attrNameLst": { "p:attrName": "style.visibility" }
|
|
84005
|
+
},
|
|
84006
|
+
"p:to": { "p:strVal": { "@_val": "hidden" } }
|
|
84007
|
+
}
|
|
84008
|
+
};
|
|
84009
|
+
}
|
|
84010
|
+
var init_animation_after_effect_write = __esm({
|
|
84011
|
+
"pptx/core/services/animation-after-effect-write.ts"() {
|
|
84012
|
+
init_native_animation_after_effect();
|
|
84013
|
+
init_native_animation_helpers();
|
|
84014
|
+
}
|
|
84015
|
+
});
|
|
84016
|
+
|
|
84017
|
+
// pptx/core/services/editor-animation-after-effect.ts
|
|
84018
|
+
function setAfterAnimation(anims, elementId, action) {
|
|
84019
|
+
return upsert(anims, elementId, (cur) => {
|
|
84020
|
+
const value = action;
|
|
84021
|
+
return {
|
|
84022
|
+
...cur,
|
|
84023
|
+
afterAnimation: value,
|
|
84024
|
+
afterAnimationColor: value === "dimToColor" ? cur.afterAnimationColor ?? exports.DEFAULT_AFTER_ANIMATION_DIM_COLOR : void 0
|
|
84025
|
+
};
|
|
84026
|
+
});
|
|
84027
|
+
}
|
|
84028
|
+
function setAfterAnimationColor(anims, elementId, color2) {
|
|
84029
|
+
const entry2 = animationFor(anims, elementId);
|
|
84030
|
+
if (!entry2 || (entry2.afterAnimation ?? entry2.nativeAfterAnimation) !== "dimToColor") {
|
|
84031
|
+
return [...anims];
|
|
84032
|
+
}
|
|
84033
|
+
return upsert(anims, elementId, (cur) => ({
|
|
84034
|
+
...cur,
|
|
84035
|
+
afterAnimation: "dimToColor",
|
|
84036
|
+
afterAnimationColor: color2
|
|
84037
|
+
}));
|
|
84038
|
+
}
|
|
84039
|
+
function getAfterAnimation(slideAnimations, elementId) {
|
|
84040
|
+
const entry2 = animationFor(slideAnimations, elementId);
|
|
84041
|
+
return entry2?.afterAnimation ?? entry2?.nativeAfterAnimation ?? "none";
|
|
84042
|
+
}
|
|
84043
|
+
function getAfterAnimationState(entry2) {
|
|
84044
|
+
const action = entry2?.afterAnimation ?? entry2?.nativeAfterAnimation ?? "none";
|
|
84045
|
+
return {
|
|
84046
|
+
action,
|
|
84047
|
+
color: action === "dimToColor" ? entry2?.afterAnimationColor ?? entry2?.nativeAfterAnimationColor : void 0,
|
|
84048
|
+
showColor: entry2?.afterAnimation !== void 0 || /^#[0-9a-f]{6}$/iu.test(entry2?.nativeAfterAnimationColor ?? "")
|
|
84049
|
+
};
|
|
84050
|
+
}
|
|
84051
|
+
function isNativeAfterAnimationOnly(entry2) {
|
|
84052
|
+
return Boolean(
|
|
84053
|
+
entry2?.nativeAfterAnimation && !entry2.entrance && !entry2.exit && !entry2.emphasis && !entry2.motionPath
|
|
84054
|
+
);
|
|
84055
|
+
}
|
|
84056
|
+
function mergeNativeAfterAnimationIntoEditorAnimations(nativeAnimations, animations, rawTiming) {
|
|
84057
|
+
for (const native of nativeAnimations ?? []) {
|
|
84058
|
+
const existing = native.targetId ? animationFor(animations, native.targetId) : void 0;
|
|
84059
|
+
const action = native.afterAnimationAction ?? (existing?.afterAnimation !== void 0 ? "none" : void 0);
|
|
84060
|
+
if ((nativeAnimations ?? []).filter(
|
|
84061
|
+
(other) => other.targetId === native.targetId && ["entr", "emph"].includes(other.presetClass ?? "")
|
|
84062
|
+
).length !== 1)
|
|
84063
|
+
continue;
|
|
84064
|
+
if (!native.targetId || !action || !["entr", "emph"].includes(native.presetClass ?? "") || native.textTarget)
|
|
84065
|
+
continue;
|
|
84066
|
+
if (native.target && (native.target.type !== "shape" || native.target.backgroundOnly || native.target.subShapeId || native.target.graphicElement || native.target.oleChartElement))
|
|
84067
|
+
continue;
|
|
84068
|
+
try {
|
|
84069
|
+
if (rawTiming && native.target?.type === "shape" && indexEffectNodes(rawTiming).filter(
|
|
84070
|
+
(ref) => ref.spid === (native.target?.type === "shape" ? native.target.shapeId : void 0) && ["entr", "emph"].includes(ref.presetClass)
|
|
84071
|
+
).length !== 1)
|
|
84072
|
+
continue;
|
|
84073
|
+
const effect = rawTiming ? indexEffectNodes(rawTiming).find(
|
|
84074
|
+
(ref) => String(ref.cTn["@_id"]) === String(native.nodeId) && native.target?.type === "shape" && ref.spid === native.target.shapeId
|
|
84075
|
+
) : void 0;
|
|
84076
|
+
if (rawTiming && !effect) continue;
|
|
84077
|
+
assertAfterAnimationClearSupported(
|
|
84078
|
+
effect?.cTn ?? { "p:subTnLst": native.cTnAttributes?.["p:subTnLst"] }
|
|
84079
|
+
);
|
|
84080
|
+
} catch {
|
|
84081
|
+
continue;
|
|
84082
|
+
}
|
|
84083
|
+
let entry2 = animationFor(animations, native.targetId);
|
|
84084
|
+
if (!entry2) {
|
|
84085
|
+
entry2 = { elementId: native.targetId };
|
|
84086
|
+
animations.push(entry2);
|
|
84087
|
+
}
|
|
84088
|
+
if (entry2.nativeAfterAnimation !== void 0) continue;
|
|
84089
|
+
entry2.nativeAfterAnimation = action;
|
|
84090
|
+
entry2.nativeAfterAnimationColor = native.afterAnimationColor;
|
|
84091
|
+
}
|
|
84092
|
+
}
|
|
84093
|
+
function isNativeAfterAnimationFallback(entry2) {
|
|
84094
|
+
return entry2.nativeAfterAnimation !== void 0 && Object.entries(entry2).every(
|
|
84095
|
+
([key2, value]) => value === void 0 || [
|
|
84096
|
+
"elementId",
|
|
84097
|
+
"nativeAfterAnimation",
|
|
84098
|
+
"nativeAfterAnimationColor",
|
|
84099
|
+
"soundRId",
|
|
84100
|
+
"soundPath",
|
|
84101
|
+
"soundName",
|
|
84102
|
+
"stopSound"
|
|
84103
|
+
].includes(key2)
|
|
84104
|
+
);
|
|
84105
|
+
}
|
|
84106
|
+
exports.AFTER_ANIMATION_VALUES = void 0; exports.DEFAULT_AFTER_ANIMATION_DIM_COLOR = void 0;
|
|
84107
|
+
var init_editor_animation_after_effect = __esm({
|
|
84108
|
+
"pptx/core/services/editor-animation-after-effect.ts"() {
|
|
84109
|
+
init_editor_animation_entry();
|
|
84110
|
+
init_animation_after_effect_write();
|
|
84111
|
+
init_animation_timing_tree();
|
|
84112
|
+
exports.AFTER_ANIMATION_VALUES = [
|
|
84113
|
+
"none",
|
|
84114
|
+
"dimToColor",
|
|
84115
|
+
"hideAfterAnimation",
|
|
84116
|
+
"hideOnNextClick"
|
|
84117
|
+
];
|
|
84118
|
+
exports.DEFAULT_AFTER_ANIMATION_DIM_COLOR = "#808080";
|
|
84119
|
+
}
|
|
84120
|
+
});
|
|
84121
|
+
|
|
83697
84122
|
// pptx/core/services/slide-name.ts
|
|
83698
84123
|
function asNode3(value) {
|
|
83699
84124
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
@@ -84024,6 +84449,7 @@ var init_PptxSlideLoaderService = __esm({
|
|
|
84024
84449
|
init_animation_target_reconcile();
|
|
84025
84450
|
init_animation_timeline_anchors();
|
|
84026
84451
|
init_native_animation_media_duration();
|
|
84452
|
+
init_editor_animation_after_effect();
|
|
84027
84453
|
init_slide_name();
|
|
84028
84454
|
init_slide_transition_envelope();
|
|
84029
84455
|
exports.PptxSlideLoaderService = class {
|
|
@@ -84235,6 +84661,8 @@ var init_PptxSlideLoaderService = __esm({
|
|
|
84235
84661
|
}
|
|
84236
84662
|
});
|
|
84237
84663
|
reconcileAnimationTargets(elements3, nativeAnimations, animations, animationTimelineAnchors);
|
|
84664
|
+
animations ??= [];
|
|
84665
|
+
mergeNativeAfterAnimationIntoEditorAnimations(nativeAnimations, animations, rawTiming);
|
|
84238
84666
|
mergeNativeSoundIntoEditorAnimations(nativeAnimations, animations);
|
|
84239
84667
|
mergeNativeBuildTemplatesIntoEditorAnimations(nativeAnimations, animations);
|
|
84240
84668
|
applyHiddenFlagFromRawXml(elements3);
|
|
@@ -84577,6 +85005,7 @@ function sortOrder(animation) {
|
|
|
84577
85005
|
exports.PptxEditorAnimationService = void 0;
|
|
84578
85006
|
var init_PptxEditorAnimationService = __esm({
|
|
84579
85007
|
"pptx/core/services/PptxEditorAnimationService.ts"() {
|
|
85008
|
+
init_editor_animation_after_effect();
|
|
84580
85009
|
init_editor_animation_normalizers();
|
|
84581
85010
|
init_editor_animation_trigger_meta();
|
|
84582
85011
|
exports.PptxEditorAnimationService = class {
|
|
@@ -84675,7 +85104,7 @@ var init_PptxEditorAnimationService = __esm({
|
|
|
84675
85104
|
* @param animations - Editor animations to serialize.
|
|
84676
85105
|
*/
|
|
84677
85106
|
applyEditorAnimations(slideNode, animations) {
|
|
84678
|
-
const sequenced =
|
|
85107
|
+
const sequenced = animations.filter((entry2) => !isNativeAfterAnimationFallback(entry2)).sort((left, right) => sortOrder(left) - sortOrder(right));
|
|
84679
85108
|
const sanitizedAnimations = sequenced.map((animation) => {
|
|
84680
85109
|
const elementId = String(animation.elementId || "").trim();
|
|
84681
85110
|
if (elementId.length === 0) {
|
|
@@ -84689,7 +85118,7 @@ var init_PptxEditorAnimationService = __esm({
|
|
|
84689
85118
|
const orderIsTreeDerived = animation.orderFromTimeline !== void 0 && animation.order === animation.orderFromTimeline;
|
|
84690
85119
|
const order = typeof animation.order === "number" && Number.isFinite(animation.order) && !orderIsTreeDerived ? Math.round(animation.order) : void 0;
|
|
84691
85120
|
const repeatCount = typeof animation.repeatCount === "number" && Number.isFinite(animation.repeatCount) && animation.repeatCount > 0 ? animation.repeatCount : void 0;
|
|
84692
|
-
if (!entrance && !exit3 && !emphasis && !animation.motionPath) {
|
|
85121
|
+
if (!entrance && !exit3 && !emphasis && !animation.motionPath && animation.afterAnimation === void 0) {
|
|
84693
85122
|
return null;
|
|
84694
85123
|
}
|
|
84695
85124
|
return {
|
|
@@ -85174,70 +85603,6 @@ var init_animation_effect_filter_parsing = __esm({
|
|
|
85174
85603
|
}
|
|
85175
85604
|
});
|
|
85176
85605
|
|
|
85177
|
-
// pptx/core/services/native-animation-after-effect.ts
|
|
85178
|
-
function hasAfterEffectFlag(cTn) {
|
|
85179
|
-
const raw = cTn?.["@_afterEffect"];
|
|
85180
|
-
return raw === "1" || raw === "true";
|
|
85181
|
-
}
|
|
85182
|
-
function extractSrgbHex(colorContainer) {
|
|
85183
|
-
const srgb = colorContainer?.["a:srgbClr"];
|
|
85184
|
-
const val = srgb?.["@_val"];
|
|
85185
|
-
return val !== void 0 ? `#${String(val).toUpperCase()}` : void 0;
|
|
85186
|
-
}
|
|
85187
|
-
function findDimBehaviour(subTnLst) {
|
|
85188
|
-
for (const node of ensureArray11(subTnLst["p:animClr"])) {
|
|
85189
|
-
const cBhvr = node["p:cBhvr"];
|
|
85190
|
-
if (extractAttrNameFromCBhvr(cBhvr) !== "ppt_c") {
|
|
85191
|
-
continue;
|
|
85192
|
-
}
|
|
85193
|
-
if (!hasAfterEffectFlag(cBhvr?.["p:cTn"])) {
|
|
85194
|
-
continue;
|
|
85195
|
-
}
|
|
85196
|
-
const toNode = node["p:to"];
|
|
85197
|
-
const color2 = extractSrgbHex(toNode);
|
|
85198
|
-
if (color2) {
|
|
85199
|
-
return { action: "dimToColor", color: color2 };
|
|
85200
|
-
}
|
|
85201
|
-
const colorRef = themeColorRefFromSchemeClr(toNode?.["a:schemeClr"]);
|
|
85202
|
-
return colorRef ? { action: "dimToColor", colorRef } : { action: "dimToColor" };
|
|
85203
|
-
}
|
|
85204
|
-
return void 0;
|
|
85205
|
-
}
|
|
85206
|
-
function findHideBehaviour(subTnLst) {
|
|
85207
|
-
for (const node of ensureArray11(subTnLst["p:set"])) {
|
|
85208
|
-
const cBhvr = node["p:cBhvr"];
|
|
85209
|
-
if (extractAttrNameFromCBhvr(cBhvr) !== "style.visibility") {
|
|
85210
|
-
continue;
|
|
85211
|
-
}
|
|
85212
|
-
const innerCTn = cBhvr?.["p:cTn"];
|
|
85213
|
-
if (!hasAfterEffectFlag(innerCTn)) {
|
|
85214
|
-
continue;
|
|
85215
|
-
}
|
|
85216
|
-
const toNode = node["p:to"];
|
|
85217
|
-
const strVal = toNode?.["p:strVal"]?.["@_val"];
|
|
85218
|
-
if (String(strVal ?? "").toLowerCase() !== "hidden") {
|
|
85219
|
-
continue;
|
|
85220
|
-
}
|
|
85221
|
-
const action = innerCTn?.["@_masterRel"] === "sameClick" ? "hideAfterAnimation" : "hideOnNextClick";
|
|
85222
|
-
return { action };
|
|
85223
|
-
}
|
|
85224
|
-
return void 0;
|
|
85225
|
-
}
|
|
85226
|
-
function extractAfterAnimationFromSubTnLst(cTn) {
|
|
85227
|
-
const subTnLst = cTn["p:subTnLst"];
|
|
85228
|
-
if (!subTnLst) {
|
|
85229
|
-
return void 0;
|
|
85230
|
-
}
|
|
85231
|
-
return findDimBehaviour(subTnLst) ?? findHideBehaviour(subTnLst);
|
|
85232
|
-
}
|
|
85233
|
-
var init_native_animation_after_effect = __esm({
|
|
85234
|
-
"pptx/core/services/native-animation-after-effect.ts"() {
|
|
85235
|
-
init_theme_color_ref();
|
|
85236
|
-
init_native_animation_attr_name();
|
|
85237
|
-
init_native_animation_helpers();
|
|
85238
|
-
}
|
|
85239
|
-
});
|
|
85240
|
-
|
|
85241
85606
|
// pptx/core/services/native-animation-cbhvr-attrs.ts
|
|
85242
85607
|
function extractCBhvrAttrs(cBhvr) {
|
|
85243
85608
|
if (!cBhvr) {
|
|
@@ -85386,6 +85751,16 @@ function readTiming(cTn) {
|
|
|
85386
85751
|
return {};
|
|
85387
85752
|
}
|
|
85388
85753
|
const timing = {};
|
|
85754
|
+
const starts = ensureArray11(cTn["p:stCondLst"]?.["p:cond"]);
|
|
85755
|
+
if (starts.length > 1 || cTn["@_dur"] === "indefinite" || cTn["@_repeatCount"] === "indefinite" || cTn["@_repeatDur"] !== void 0 || cTn["p:endCondLst"] !== void 0 || cTn["p:endSync"] !== void 0 || starts.some(
|
|
85756
|
+
(condition) => condition === null || typeof condition !== "object" || condition["@_evt"] !== void 0 || condition["@_tn"] !== void 0 || condition["@_rtn"] !== void 0 || condition["p:tn"] !== void 0 || condition["p:rtn"] !== void 0 || condition["p:tgtEl"] !== void 0 || condition["@_delay"] !== void 0 && !/^\d+$/u.test(String(condition["@_delay"])) || condition["@_delay"] === "indefinite"
|
|
85757
|
+
)) {
|
|
85758
|
+
timing.unsupportedSetTiming = true;
|
|
85759
|
+
}
|
|
85760
|
+
const fill = cTn["@_fill"];
|
|
85761
|
+
if (fill === "remove" || fill === "freeze" || fill === "hold" || fill === "transition") {
|
|
85762
|
+
timing.fill = fill;
|
|
85763
|
+
}
|
|
85389
85764
|
const durationMs = readTimingAttr(cTn["@_dur"]);
|
|
85390
85765
|
if (durationMs !== void 0) {
|
|
85391
85766
|
timing.durationMs = durationMs;
|
|
@@ -85791,6 +86166,7 @@ function buildTimingNodeAnimation(cTn, trigger, group) {
|
|
|
85791
86166
|
commandString: cmdInfo.commandString,
|
|
85792
86167
|
textTarget: textTarget ?? void 0,
|
|
85793
86168
|
cTnAttributes: roundTripAttrs,
|
|
86169
|
+
unsupportedOpacitySetTiming: cTn["@_dur"] === "indefinite" || cTn["p:endSync"] !== void 0 || void 0,
|
|
85794
86170
|
afterEffect: afterEffectFlag,
|
|
85795
86171
|
afterAnimationAction: parsedAfterAnimation?.action,
|
|
85796
86172
|
afterAnimationColor: parsedAfterAnimation?.color,
|
|
@@ -86594,79 +86970,6 @@ var init_PptxSlideTransitionService = __esm({
|
|
|
86594
86970
|
}
|
|
86595
86971
|
});
|
|
86596
86972
|
|
|
86597
|
-
// pptx/core/services/animation-after-effect-write.ts
|
|
86598
|
-
function applyAfterAnimationBehavior(effectCTn, anim, shapeId) {
|
|
86599
|
-
delete effectCTn["p:subTnLst"];
|
|
86600
|
-
delete effectCTn["@_afterEffect"];
|
|
86601
|
-
if (anim.afterAnimation === "dimToColor" && anim.afterAnimationColor) {
|
|
86602
|
-
effectCTn["p:subTnLst"] = buildDimSubTnLst(shapeId, anim.afterAnimationColor);
|
|
86603
|
-
return;
|
|
86604
|
-
}
|
|
86605
|
-
if (anim.afterAnimation === "hideAfterAnimation") {
|
|
86606
|
-
const entranceId = effectCTn["@_id"] !== void 0 ? String(effectCTn["@_id"]) : "0";
|
|
86607
|
-
effectCTn["p:subTnLst"] = buildHideSubTnLst(shapeId, "sameClick", entranceId);
|
|
86608
|
-
return;
|
|
86609
|
-
}
|
|
86610
|
-
if (anim.afterAnimation === "hideOnNextClick") {
|
|
86611
|
-
effectCTn["p:subTnLst"] = buildHideSubTnLst(shapeId, "nextClick");
|
|
86612
|
-
}
|
|
86613
|
-
}
|
|
86614
|
-
function buildDimSubTnLst(shapeId, colorHex) {
|
|
86615
|
-
const hex3 = colorHex.replace(/^#/u, "").toUpperCase();
|
|
86616
|
-
return {
|
|
86617
|
-
"p:animClr": {
|
|
86618
|
-
"@_clrSpc": "rgb",
|
|
86619
|
-
"@_dir": "cw",
|
|
86620
|
-
"p:cBhvr": {
|
|
86621
|
-
"@_override": "childStyle",
|
|
86622
|
-
"p:cTn": {
|
|
86623
|
-
"@_dur": "1",
|
|
86624
|
-
"@_fill": "hold",
|
|
86625
|
-
"@_display": "0",
|
|
86626
|
-
"@_masterRel": "nextClick",
|
|
86627
|
-
"@_afterEffect": "1"
|
|
86628
|
-
},
|
|
86629
|
-
"p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
|
|
86630
|
-
"p:attrNameLst": { "p:attrName": "ppt_c" }
|
|
86631
|
-
},
|
|
86632
|
-
"p:to": { "a:srgbClr": { "@_val": hex3 } }
|
|
86633
|
-
}
|
|
86634
|
-
};
|
|
86635
|
-
}
|
|
86636
|
-
function buildHideSubTnLst(shapeId, masterRel, entranceId) {
|
|
86637
|
-
const cTn = {
|
|
86638
|
-
"@_dur": "1",
|
|
86639
|
-
"@_fill": "hold",
|
|
86640
|
-
"@_display": "0",
|
|
86641
|
-
"@_masterRel": masterRel,
|
|
86642
|
-
"@_afterEffect": "1"
|
|
86643
|
-
};
|
|
86644
|
-
if (masterRel === "sameClick") {
|
|
86645
|
-
cTn["p:stCondLst"] = {
|
|
86646
|
-
"p:cond": {
|
|
86647
|
-
"@_evt": "end",
|
|
86648
|
-
"@_delay": "0",
|
|
86649
|
-
"p:tn": { "@_val": entranceId ?? "0" }
|
|
86650
|
-
}
|
|
86651
|
-
};
|
|
86652
|
-
}
|
|
86653
|
-
return {
|
|
86654
|
-
"p:set": {
|
|
86655
|
-
"p:cBhvr": {
|
|
86656
|
-
"@_override": "childStyle",
|
|
86657
|
-
"p:cTn": cTn,
|
|
86658
|
-
"p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
|
|
86659
|
-
"p:attrNameLst": { "p:attrName": "style.visibility" }
|
|
86660
|
-
},
|
|
86661
|
-
"p:to": { "p:strVal": { "@_val": "hidden" } }
|
|
86662
|
-
}
|
|
86663
|
-
};
|
|
86664
|
-
}
|
|
86665
|
-
var init_animation_after_effect_write = __esm({
|
|
86666
|
-
"pptx/core/services/animation-after-effect-write.ts"() {
|
|
86667
|
-
}
|
|
86668
|
-
});
|
|
86669
|
-
|
|
86670
86973
|
// pptx/core/services/animation-behavior-captures.json
|
|
86671
86974
|
var animation_behavior_captures_default;
|
|
86672
86975
|
var init_animation_behavior_captures = __esm({
|
|
@@ -104900,6 +105203,33 @@ function updateEffectNodeAttributes(cTn, anim, presetClass, shapeId, allocateId)
|
|
|
104900
105203
|
applySoundToEffectCTn(cTn, anim);
|
|
104901
105204
|
}
|
|
104902
105205
|
function surgicallyUpdateTimingTree(rawTiming, animations) {
|
|
105206
|
+
const sourceRefs = indexEffectNodes(rawTiming);
|
|
105207
|
+
for (const entry2 of animations.filter((animation) => animation.afterAnimation !== void 0)) {
|
|
105208
|
+
if (sourceRefs.filter(
|
|
105209
|
+
(ref) => ref.spid === entry2.elementId && ["entr", "emph"].includes(ref.presetClass)
|
|
105210
|
+
).length > 1)
|
|
105211
|
+
throw new Error(
|
|
105212
|
+
"Cannot edit an ambiguous native after-animation target with multiple effects"
|
|
105213
|
+
);
|
|
105214
|
+
}
|
|
105215
|
+
const explicitClears = new Map(
|
|
105216
|
+
animations.filter((a) => a.afterAnimation !== void 0 && !hasAuthoredAnimationEffect(a)).map((a) => [a.elementId, a])
|
|
105217
|
+
);
|
|
105218
|
+
const clearRefs = sourceRefs.filter(
|
|
105219
|
+
(ref) => ref.spid && explicitClears.has(ref.spid) && (ref.presetClass === "entr" || ref.presetClass === "emph")
|
|
105220
|
+
);
|
|
105221
|
+
for (const target of explicitClears.keys()) {
|
|
105222
|
+
if (!clearRefs.some((ref) => ref.spid === target))
|
|
105223
|
+
throw new Error("Cannot edit after-animation without a supported native effect");
|
|
105224
|
+
if (clearRefs.filter((ref) => ref.spid === target).length > 1)
|
|
105225
|
+
throw new Error(
|
|
105226
|
+
"Cannot clear an ambiguous native after-animation target with multiple effects"
|
|
105227
|
+
);
|
|
105228
|
+
}
|
|
105229
|
+
clearRefs.forEach((ref) => assertAfterAnimationClearSupported(ref.cTn));
|
|
105230
|
+
clearRefs.forEach(
|
|
105231
|
+
(ref) => applyAfterAnimationBehavior(ref.cTn, explicitClears.get(ref.spid), ref.spid)
|
|
105232
|
+
);
|
|
104903
105233
|
const desired = collectDesiredEffects(animations);
|
|
104904
105234
|
const previouslyOwned = readOwnedEffectKeys(rawTiming);
|
|
104905
105235
|
if (desired.length === 0 && previouslyOwned.size === 0) {
|
|
@@ -104966,6 +105296,7 @@ function surgicallyUpdateTimingTree(rawTiming, animations) {
|
|
|
104966
105296
|
}
|
|
104967
105297
|
var init_animation_timing_surgical = __esm({
|
|
104968
105298
|
"pptx/core/services/animation-timing-surgical.ts"() {
|
|
105299
|
+
init_editor_animation_entry();
|
|
104969
105300
|
init_animation_after_effect_write();
|
|
104970
105301
|
init_animation_behavior_captured();
|
|
104971
105302
|
init_animation_timing_build_surgical();
|
|
@@ -105016,9 +105347,11 @@ var init_PptxAnimationWriteService = __esm({
|
|
|
105016
105347
|
const validAnimations = animations.filter((a) => a.entrance || a.exit || a.emphasis || a.motionPath).sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
105017
105348
|
if (existingRawTiming) {
|
|
105018
105349
|
const cloned = typeof structuredClone === "function" ? structuredClone(existingRawTiming) : JSON.parse(JSON.stringify(existingRawTiming));
|
|
105019
|
-
return surgicallyUpdateTimingTree(cloned,
|
|
105350
|
+
return surgicallyUpdateTimingTree(cloned, animations);
|
|
105020
105351
|
}
|
|
105021
105352
|
if (validAnimations.length === 0) {
|
|
105353
|
+
if (animations.some((entry2) => entry2.afterAnimation !== void 0))
|
|
105354
|
+
throw new Error("Cannot edit after-animation without a supported native effect");
|
|
105022
105355
|
return void 0;
|
|
105023
105356
|
}
|
|
105024
105357
|
this.nextId = 1;
|
|
@@ -105204,6 +105537,121 @@ var init_animation_behavior_native = __esm({
|
|
|
105204
105537
|
}
|
|
105205
105538
|
});
|
|
105206
105539
|
|
|
105540
|
+
// pptx/core/services/editor-animation-after-effect-precedence.ts
|
|
105541
|
+
function applyAfterAnimationFromEditorList(nativeAnimations, editorAnimations) {
|
|
105542
|
+
if (!editorAnimations || editorAnimations.length === 0) {
|
|
105543
|
+
return [...nativeAnimations];
|
|
105544
|
+
}
|
|
105545
|
+
const byElement = /* @__PURE__ */ new Map();
|
|
105546
|
+
for (const ea of editorAnimations) {
|
|
105547
|
+
if (ea.afterAnimation !== void 0) {
|
|
105548
|
+
byElement.set(ea.elementId, ea);
|
|
105549
|
+
}
|
|
105550
|
+
}
|
|
105551
|
+
if (byElement.size === 0) {
|
|
105552
|
+
return [...nativeAnimations];
|
|
105553
|
+
}
|
|
105554
|
+
for (const [id, editor] of byElement) {
|
|
105555
|
+
const matches = nativeAnimations.filter(
|
|
105556
|
+
(native) => native.targetId === id && ["entr", "emph"].includes(native.presetClass ?? "")
|
|
105557
|
+
);
|
|
105558
|
+
if (matches.length > 1)
|
|
105559
|
+
throw new Error(
|
|
105560
|
+
"Cannot edit an ambiguous native after-animation target with multiple effects"
|
|
105561
|
+
);
|
|
105562
|
+
if (matches.length === 0 && !hasAuthoredAnimationEffect(editor))
|
|
105563
|
+
throw new Error("Cannot edit after-animation without a supported native effect");
|
|
105564
|
+
for (const native of matches) {
|
|
105565
|
+
if (native.textTarget || native.target && (native.target.type !== "shape" || native.target.backgroundOnly || native.target.subShapeId || native.target.graphicElement || native.target.oleChartElement))
|
|
105566
|
+
throw new Error("Editing after-animation supports whole-shape targets only");
|
|
105567
|
+
assertAfterAnimationClearSupported({
|
|
105568
|
+
"p:subTnLst": native.cTnAttributes?.["p:subTnLst"]
|
|
105569
|
+
});
|
|
105570
|
+
}
|
|
105571
|
+
}
|
|
105572
|
+
return nativeAnimations.map((anim) => {
|
|
105573
|
+
if (!anim.targetId || !["entr", "emph"].includes(anim.presetClass ?? "")) {
|
|
105574
|
+
return anim;
|
|
105575
|
+
}
|
|
105576
|
+
const ea = byElement.get(anim.targetId);
|
|
105577
|
+
if (!ea) {
|
|
105578
|
+
return anim;
|
|
105579
|
+
}
|
|
105580
|
+
return {
|
|
105581
|
+
...anim,
|
|
105582
|
+
afterAnimationAction: ea.afterAnimation === "none" ? void 0 : ea.afterAnimation,
|
|
105583
|
+
afterAnimationColor: ea.afterAnimationColor,
|
|
105584
|
+
// The editor's own model has no theme-colour-ref concept (it always
|
|
105585
|
+
// writes a concrete hex); clear a native scheme ref so a stale one
|
|
105586
|
+
// never survives an edit that overrides the colour.
|
|
105587
|
+
afterAnimationColorRef: void 0
|
|
105588
|
+
};
|
|
105589
|
+
});
|
|
105590
|
+
}
|
|
105591
|
+
var init_editor_animation_after_effect_precedence = __esm({
|
|
105592
|
+
"pptx/core/services/editor-animation-after-effect-precedence.ts"() {
|
|
105593
|
+
init_animation_after_effect_write();
|
|
105594
|
+
init_editor_animation_entry();
|
|
105595
|
+
}
|
|
105596
|
+
});
|
|
105597
|
+
|
|
105598
|
+
// pptx/core/services/animation-opacity-set.ts
|
|
105599
|
+
function resolveOpacitySet(anim) {
|
|
105600
|
+
if (anim.unsupportedOpacitySetTiming || anim.endConditions?.length || anim.rawEndCondLst !== void 0 || anim.cTnAttributes?.["@_tmFilter"] !== void 0 || anim.cTnAttributes?.["@_endSync"] !== void 0)
|
|
105601
|
+
return void 0;
|
|
105602
|
+
if (anim.afterAnimationAction !== void 0) return void 0;
|
|
105603
|
+
if (anim.target?.type === "shape" && (anim.target.backgroundOnly || anim.target.subShapeId || anim.target.graphicElement || anim.target.oleChartElement))
|
|
105604
|
+
return void 0;
|
|
105605
|
+
if (anim.textTarget || anim.target && anim.target.type !== "shape" || anim.trigger === "onHover")
|
|
105606
|
+
return void 0;
|
|
105607
|
+
if (anim.presetClass !== "emph" || anim.autoReverse || (anim.repeatCount ?? 1) !== 1 || anim.repeatDurMs !== void 0)
|
|
105608
|
+
return void 0;
|
|
105609
|
+
const behaviors = anim.behaviors;
|
|
105610
|
+
if (!behaviors?.length || behaviors.some(
|
|
105611
|
+
(b) => b.kind !== "set" && !(b.kind === "animEffect" && b.filter === "image" && (b.transition === void 0 || b.transition === "none"))
|
|
105612
|
+
))
|
|
105613
|
+
return void 0;
|
|
105614
|
+
const sets = behaviors.filter((b) => b.kind === "set");
|
|
105615
|
+
if (sets.length !== 1) return void 0;
|
|
105616
|
+
const hints = behaviors.filter((b) => b.kind === "animEffect");
|
|
105617
|
+
if (hints.length > 1) return void 0;
|
|
105618
|
+
const hint = hints[0];
|
|
105619
|
+
if (hint && (hint.timing.unsupportedSetTiming || hint.timing.autoReverse || (hint.timing.repeatCount ?? 1) !== 1 || hint.timing.tmFilter !== void 0))
|
|
105620
|
+
return void 0;
|
|
105621
|
+
const set2 = sets[0];
|
|
105622
|
+
if (set2.attrNames.length !== 1 || set2.attrNames[0] !== "style.opacity" || set2.additive !== void 0 && !["base", "repl", "none"].includes(set2.additive))
|
|
105623
|
+
return void 0;
|
|
105624
|
+
const raw = set2.value;
|
|
105625
|
+
if (typeof raw !== "number" && (typeof raw !== "string" || !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/u.test(raw.trim())))
|
|
105626
|
+
return void 0;
|
|
105627
|
+
const value = Number(raw);
|
|
105628
|
+
const { timing } = set2;
|
|
105629
|
+
if (timing.unsupportedSetTiming) return void 0;
|
|
105630
|
+
if (anim.fill === "transition" || timing.fill === "transition") return void 0;
|
|
105631
|
+
if (!Number.isFinite(value) || value < 0 || value > 1 || timing.autoReverse || (timing.repeatCount ?? 1) !== 1 || timing.tmFilter !== void 0)
|
|
105632
|
+
return void 0;
|
|
105633
|
+
const delayMs = timing.delayMs ?? 0;
|
|
105634
|
+
const durationMs = timing.durationMs;
|
|
105635
|
+
if (!Number.isFinite(delayMs) || delayMs < 0 || durationMs === void 0 || !Number.isFinite(durationMs) || durationMs < 0)
|
|
105636
|
+
return void 0;
|
|
105637
|
+
const effectDuration = anim.durationMs ?? delayMs + durationMs;
|
|
105638
|
+
if (!Number.isFinite(effectDuration) || effectDuration < delayMs || (anim.speedPct ?? 100) !== 100)
|
|
105639
|
+
return void 0;
|
|
105640
|
+
const holdEndState = holds(anim.fill) && holds(timing.fill);
|
|
105641
|
+
return {
|
|
105642
|
+
value,
|
|
105643
|
+
delayMs,
|
|
105644
|
+
durationMs: holds(timing.fill) ? effectDuration - delayMs : Math.min(durationMs, effectDuration - delayMs),
|
|
105645
|
+
holdEndState
|
|
105646
|
+
};
|
|
105647
|
+
}
|
|
105648
|
+
var holds;
|
|
105649
|
+
var init_animation_opacity_set = __esm({
|
|
105650
|
+
"pptx/core/services/animation-opacity-set.ts"() {
|
|
105651
|
+
holds = (fill) => fill === "hold" || fill === "freeze";
|
|
105652
|
+
}
|
|
105653
|
+
});
|
|
105654
|
+
|
|
105207
105655
|
// pptx/core/services/index.ts
|
|
105208
105656
|
var init_services = __esm({
|
|
105209
105657
|
"pptx/core/services/index.ts"() {
|
|
@@ -105226,10 +105674,14 @@ var init_services = __esm({
|
|
|
105226
105674
|
init_animation_behavior_native();
|
|
105227
105675
|
init_animation_write_node_builders();
|
|
105228
105676
|
init_animation_after_effect_write();
|
|
105677
|
+
init_editor_animation_entry();
|
|
105678
|
+
init_editor_animation_after_effect();
|
|
105679
|
+
init_editor_animation_after_effect_precedence();
|
|
105229
105680
|
init_native_animation_after_effect();
|
|
105230
105681
|
init_native_animation_helpers();
|
|
105231
105682
|
init_animation_target_build_helpers();
|
|
105232
105683
|
init_animation_effect_filter_parsing();
|
|
105684
|
+
init_animation_opacity_set();
|
|
105233
105685
|
}
|
|
105234
105686
|
});
|
|
105235
105687
|
|
|
@@ -106659,6 +107111,341 @@ var init_header_footer_parts = __esm({
|
|
|
106659
107111
|
}
|
|
106660
107112
|
});
|
|
106661
107113
|
|
|
107114
|
+
// pptx/core/utils/chart-xlsx-write-validation.ts
|
|
107115
|
+
function unsupported(reason) {
|
|
107116
|
+
throw new Error(`Chart label replacement requires direct literal workbook cells: ${reason}.`);
|
|
107117
|
+
}
|
|
107118
|
+
async function validateAtomicChartWorkbookWrites(zip, parser, paths, writes, requireCurrentValues = false) {
|
|
107119
|
+
const relationships2 = xmlChild(
|
|
107120
|
+
parser.parse(
|
|
107121
|
+
await zip.file("xl/_rels/workbook.xml.rels")?.async("string") ?? ""
|
|
107122
|
+
),
|
|
107123
|
+
"Relationships"
|
|
107124
|
+
);
|
|
107125
|
+
for (const rel of xmlChildren(relationships2, "Relationship")) {
|
|
107126
|
+
if (xmlAttr(rel, "TargetMode") === "External") {
|
|
107127
|
+
unsupported("external worksheet relationships are not supported");
|
|
107128
|
+
}
|
|
107129
|
+
}
|
|
107130
|
+
const sheets = /* @__PURE__ */ new Map();
|
|
107131
|
+
const cellsByPath = /* @__PURE__ */ new Map();
|
|
107132
|
+
for (const path2 of new Set(paths.values())) {
|
|
107133
|
+
const file = zip.file(path2);
|
|
107134
|
+
if (!file) {
|
|
107135
|
+
unsupported("a referenced worksheet is missing");
|
|
107136
|
+
}
|
|
107137
|
+
let tree;
|
|
107138
|
+
try {
|
|
107139
|
+
tree = parser.parse(await file.async("string"));
|
|
107140
|
+
} catch {
|
|
107141
|
+
unsupported("a worksheet cannot be parsed");
|
|
107142
|
+
}
|
|
107143
|
+
const data = xmlChild(xmlChild(tree, "worksheet"), "sheetData");
|
|
107144
|
+
if (!data) {
|
|
107145
|
+
unsupported("a worksheet has no cell data");
|
|
107146
|
+
}
|
|
107147
|
+
if (Object.keys(data).some((key2) => key2.includes(":"))) {
|
|
107148
|
+
unsupported("prefixed worksheet cell nodes are not supported");
|
|
107149
|
+
}
|
|
107150
|
+
const cells2 = /* @__PURE__ */ new Map();
|
|
107151
|
+
for (const row of xmlChildren(data, "row")) {
|
|
107152
|
+
if (Object.keys(row).some((key2) => key2.includes(":"))) {
|
|
107153
|
+
unsupported("prefixed worksheet cell nodes are not supported");
|
|
107154
|
+
}
|
|
107155
|
+
for (const cell of xmlChildren(row, "c")) {
|
|
107156
|
+
const ref = xmlAttr(cell, "r");
|
|
107157
|
+
if (!ref || cells2.has(ref)) {
|
|
107158
|
+
unsupported("duplicate or unidentified worksheet cells are not supported");
|
|
107159
|
+
}
|
|
107160
|
+
cells2.set(ref, cell);
|
|
107161
|
+
if (Object.keys(cell).some((key2) => key2 === "f" || key2.endsWith(":f"))) {
|
|
107162
|
+
unsupported("formula-dependent workbooks are not supported");
|
|
107163
|
+
}
|
|
107164
|
+
}
|
|
107165
|
+
}
|
|
107166
|
+
sheets.set(path2, data);
|
|
107167
|
+
cellsByPath.set(path2, cells2);
|
|
107168
|
+
}
|
|
107169
|
+
const sharedFile = zip.file("xl/sharedStrings.xml");
|
|
107170
|
+
const shared = sharedFile ? xmlChildren(
|
|
107171
|
+
xmlChild(parser.parse(await sharedFile.async("string")), "sst"),
|
|
107172
|
+
"si"
|
|
107173
|
+
) : [];
|
|
107174
|
+
const destinations = /* @__PURE__ */ new Map();
|
|
107175
|
+
for (const write of writes) {
|
|
107176
|
+
const range = parseChartFormulaRange(write.formula);
|
|
107177
|
+
if (!range || /[\[\]:!]/u.test(range.sheetName)) {
|
|
107178
|
+
unsupported("a range is not a direct local reference");
|
|
107179
|
+
}
|
|
107180
|
+
if ([range.start, range.end].some(
|
|
107181
|
+
(cell) => cell.row < 0 || cell.row >= 1048576 || cell.col < 0 || cell.col >= 16384
|
|
107182
|
+
)) {
|
|
107183
|
+
unsupported("a source cell lies outside the worksheet limits");
|
|
107184
|
+
}
|
|
107185
|
+
const addresses = expandRangeAddresses(range, write.values.length);
|
|
107186
|
+
const path2 = paths.get(range.sheetName.toLowerCase());
|
|
107187
|
+
const data = path2 ? sheets.get(path2) : void 0;
|
|
107188
|
+
if (!addresses || !path2 || !data) {
|
|
107189
|
+
unsupported("a source range cannot be resolved");
|
|
107190
|
+
}
|
|
107191
|
+
for (const [index, address] of addresses.entries()) {
|
|
107192
|
+
const value = write.values[index];
|
|
107193
|
+
const key2 = `${path2}!${address}`;
|
|
107194
|
+
const prior = destinations.get(key2);
|
|
107195
|
+
if (prior && (prior.value !== value || prior.numeric !== write.isNumeric)) {
|
|
107196
|
+
unsupported("overlapping source ranges request conflicting values");
|
|
107197
|
+
}
|
|
107198
|
+
destinations.set(key2, { value, numeric: write.isNumeric });
|
|
107199
|
+
const cell = cellsByPath.get(path2)?.get(address);
|
|
107200
|
+
if (!cell) {
|
|
107201
|
+
unsupported("a source cell is missing");
|
|
107202
|
+
}
|
|
107203
|
+
const type = xmlAttr(cell, "t") ?? "n";
|
|
107204
|
+
const text2 = type === "s" ? shared[Number(xmlText(cell.v))] : xmlChild(cell, "is");
|
|
107205
|
+
if (text2 && Object.keys(text2).some((node) => !node.startsWith("@_") && node !== "t" && node !== "#text")) {
|
|
107206
|
+
unsupported("rich worksheet strings require source-workbook editing");
|
|
107207
|
+
}
|
|
107208
|
+
if (requireCurrentValues) {
|
|
107209
|
+
const current = text2 ? xmlText(text2.t) : xmlText(cell.v);
|
|
107210
|
+
const equal = write.isNumeric ? current !== void 0 && Number(current) === Number(value) : current === value;
|
|
107211
|
+
if (!equal) {
|
|
107212
|
+
unsupported("the workbook and chart caches disagree");
|
|
107213
|
+
}
|
|
107214
|
+
}
|
|
107215
|
+
if (write.isNumeric && !Number.isFinite(Number(value))) {
|
|
107216
|
+
unsupported("a numeric cache value is not finite");
|
|
107217
|
+
}
|
|
107218
|
+
if (!["n", "s", "inlineStr", "str"].includes(type)) {
|
|
107219
|
+
unsupported("a source cell has an unsupported value type");
|
|
107220
|
+
}
|
|
107221
|
+
}
|
|
107222
|
+
}
|
|
107223
|
+
}
|
|
107224
|
+
var init_chart_xlsx_write_validation = __esm({
|
|
107225
|
+
"pptx/core/utils/chart-xlsx-write-validation.ts"() {
|
|
107226
|
+
init_chart_xlsx_cellref();
|
|
107227
|
+
init_xml_access();
|
|
107228
|
+
}
|
|
107229
|
+
});
|
|
107230
|
+
function collectChartWorkbookWrite(xmlLookupService, container2, isNumeric2, values) {
|
|
107231
|
+
if (!container2) {
|
|
107232
|
+
return void 0;
|
|
107233
|
+
}
|
|
107234
|
+
const refNode = xmlLookupService.getChildByLocalName(container2, isNumeric2 ? "numRef" : "strRef");
|
|
107235
|
+
const formula = refNode ? xmlLookupService.getScalarChildByLocalName(refNode, "f") : void 0;
|
|
107236
|
+
return formula ? { formula, isNumeric: isNumeric2, values } : void 0;
|
|
107237
|
+
}
|
|
107238
|
+
function createSpreadsheetXmlParser2() {
|
|
107239
|
+
return new fastXmlParser.XMLParser({
|
|
107240
|
+
ignoreAttributes: false,
|
|
107241
|
+
attributeNamePrefix: "@_",
|
|
107242
|
+
trimValues: false,
|
|
107243
|
+
parseTagValue: false,
|
|
107244
|
+
tagValueProcessor: (tagName, tagValue) => preservesSpreadsheetXmlWhitespace(tagName) ? tagValue : tagValue.trim()
|
|
107245
|
+
});
|
|
107246
|
+
}
|
|
107247
|
+
function createSpreadsheetXmlBuilder2() {
|
|
107248
|
+
return new fastXmlParser.XMLBuilder({
|
|
107249
|
+
ignoreAttributes: false,
|
|
107250
|
+
attributeNamePrefix: "@_",
|
|
107251
|
+
suppressBooleanAttributes: false,
|
|
107252
|
+
format: false
|
|
107253
|
+
});
|
|
107254
|
+
}
|
|
107255
|
+
async function resolveWorksheetPathsByName(xlsxZip, parser) {
|
|
107256
|
+
const result = /* @__PURE__ */ new Map();
|
|
107257
|
+
const workbookFile = xlsxZip.file("xl/workbook.xml");
|
|
107258
|
+
const relsFile = xlsxZip.file("xl/_rels/workbook.xml.rels");
|
|
107259
|
+
if (!workbookFile || !relsFile) {
|
|
107260
|
+
return result;
|
|
107261
|
+
}
|
|
107262
|
+
try {
|
|
107263
|
+
const workbookTree = parser.parse(await workbookFile.async("string"));
|
|
107264
|
+
const relsTree = parser.parse(await relsFile.async("string"));
|
|
107265
|
+
const targetByRelId = /* @__PURE__ */ new Map();
|
|
107266
|
+
const relationships2 = xmlChild(relsTree, "Relationships");
|
|
107267
|
+
for (const rel of xmlChildren(relationships2, "Relationship")) {
|
|
107268
|
+
const id = xmlAttr(rel, "Id");
|
|
107269
|
+
const target = xmlAttr(rel, "Target");
|
|
107270
|
+
if (id && target) {
|
|
107271
|
+
targetByRelId.set(id, target);
|
|
107272
|
+
}
|
|
107273
|
+
}
|
|
107274
|
+
const workbookRoot = xmlChild(workbookTree, "workbook");
|
|
107275
|
+
const sheets = xmlChild(workbookRoot, "sheets");
|
|
107276
|
+
for (const sheet of xmlChildren(sheets, "sheet")) {
|
|
107277
|
+
const name = xmlAttr(sheet, "name");
|
|
107278
|
+
const relId = xmlAttr(sheet, "r:id") ?? xmlAttr(sheet, "id");
|
|
107279
|
+
const target = relId ? targetByRelId.get(relId) : void 0;
|
|
107280
|
+
if (name && target) {
|
|
107281
|
+
result.set(name.toLowerCase(), resolveWorkbookPartPath(target));
|
|
107282
|
+
}
|
|
107283
|
+
}
|
|
107284
|
+
} catch {
|
|
107285
|
+
}
|
|
107286
|
+
return result;
|
|
107287
|
+
}
|
|
107288
|
+
function resolveWorkbookPartPath(target) {
|
|
107289
|
+
return target.startsWith("/") ? target.slice(1) : `xl/${target}`;
|
|
107290
|
+
}
|
|
107291
|
+
async function writeChartWorkbookUpdates(xlsxBytes, writes, options = {}) {
|
|
107292
|
+
if (writes.length === 0) {
|
|
107293
|
+
return { unresolved: 0 };
|
|
107294
|
+
}
|
|
107295
|
+
let xlsxZip;
|
|
107296
|
+
try {
|
|
107297
|
+
xlsxZip = await JSZip17__default.default.loadAsync(xlsxBytes);
|
|
107298
|
+
} catch {
|
|
107299
|
+
if (options.atomic) {
|
|
107300
|
+
throw new Error("Chart label replacement requires a readable embedded workbook.");
|
|
107301
|
+
}
|
|
107302
|
+
return { unresolved: writes.length };
|
|
107303
|
+
}
|
|
107304
|
+
const parser = createSpreadsheetXmlParser2();
|
|
107305
|
+
const sheetPathByName = await resolveWorksheetPathsByName(xlsxZip, parser);
|
|
107306
|
+
if (options.atomic) {
|
|
107307
|
+
await validateAtomicChartWorkbookWrites(
|
|
107308
|
+
xlsxZip,
|
|
107309
|
+
parser,
|
|
107310
|
+
sheetPathByName,
|
|
107311
|
+
writes,
|
|
107312
|
+
options.requireCurrentValues ?? false
|
|
107313
|
+
);
|
|
107314
|
+
}
|
|
107315
|
+
const writesBySheetPath = /* @__PURE__ */ new Map();
|
|
107316
|
+
let unresolved = 0;
|
|
107317
|
+
for (const write of writes) {
|
|
107318
|
+
const range = parseChartFormulaRange(write.formula);
|
|
107319
|
+
const sheetPath = range ? sheetPathByName.get(range.sheetName.toLowerCase()) : void 0;
|
|
107320
|
+
const refs = range ? expandRangeAddresses(range, write.values.length) : void 0;
|
|
107321
|
+
if (!range || !sheetPath || !refs) {
|
|
107322
|
+
unresolved += 1;
|
|
107323
|
+
continue;
|
|
107324
|
+
}
|
|
107325
|
+
const bucket = writesBySheetPath.get(sheetPath) ?? [];
|
|
107326
|
+
bucket.push({ refs, values: write.values, isNumeric: write.isNumeric });
|
|
107327
|
+
writesBySheetPath.set(sheetPath, bucket);
|
|
107328
|
+
}
|
|
107329
|
+
const builder3 = createSpreadsheetXmlBuilder2();
|
|
107330
|
+
let changedAny = false;
|
|
107331
|
+
for (const [sheetPath, resolvedWrites] of writesBySheetPath) {
|
|
107332
|
+
const sheetFile = xlsxZip.file(sheetPath);
|
|
107333
|
+
if (!sheetFile) {
|
|
107334
|
+
unresolved += resolvedWrites.length;
|
|
107335
|
+
continue;
|
|
107336
|
+
}
|
|
107337
|
+
try {
|
|
107338
|
+
const sheetTree = parser.parse(await sheetFile.async("string"));
|
|
107339
|
+
const cellWrites = resolvedWrites.flatMap(
|
|
107340
|
+
({ refs, values, isNumeric: isNumeric2 }) => refs.map((ref, i2) => ({ ref, isNumeric: isNumeric2, value: values[i2] }))
|
|
107341
|
+
);
|
|
107342
|
+
if (applyCellWritesToWorksheet(sheetTree, cellWrites)) {
|
|
107343
|
+
xlsxZip.file(sheetPath, builder3.build(sheetTree));
|
|
107344
|
+
changedAny = true;
|
|
107345
|
+
}
|
|
107346
|
+
} catch {
|
|
107347
|
+
unresolved += resolvedWrites.length;
|
|
107348
|
+
}
|
|
107349
|
+
}
|
|
107350
|
+
if (options.atomic && unresolved > 0) {
|
|
107351
|
+
throw new Error("Chart label replacement could not update every source range.");
|
|
107352
|
+
}
|
|
107353
|
+
if (!changedAny) {
|
|
107354
|
+
return { unresolved };
|
|
107355
|
+
}
|
|
107356
|
+
const bytes = await xlsxZip.generateAsync({
|
|
107357
|
+
type: "uint8array",
|
|
107358
|
+
compression: "DEFLATE",
|
|
107359
|
+
compressionOptions: { level: 6 }
|
|
107360
|
+
});
|
|
107361
|
+
return { bytes, unresolved };
|
|
107362
|
+
}
|
|
107363
|
+
var init_chart_xlsx_writer = __esm({
|
|
107364
|
+
"pptx/core/utils/chart-xlsx-writer.ts"() {
|
|
107365
|
+
init_chart_xlsx_cellref();
|
|
107366
|
+
init_chart_xlsx_write_validation();
|
|
107367
|
+
init_chart_xlsx_sheet_cells();
|
|
107368
|
+
init_xml_access();
|
|
107369
|
+
init_xml_whitespace();
|
|
107370
|
+
}
|
|
107371
|
+
});
|
|
107372
|
+
function formulaCount(value) {
|
|
107373
|
+
if (!value || typeof value !== "object") return 0;
|
|
107374
|
+
if (Array.isArray(value)) return value.reduce((total, item) => total + formulaCount(item), 0);
|
|
107375
|
+
return Object.entries(value).reduce(
|
|
107376
|
+
(total, [key2, child30]) => total + (key2 === "f" || key2.endsWith(":f") ? 1 : formulaCount(child30)),
|
|
107377
|
+
0
|
|
107378
|
+
);
|
|
107379
|
+
}
|
|
107380
|
+
async function chartLabelsHaveEditableSources(xml, zip, chartSpace, seriesNodes, series, categories, external, chartPartPath, resolve) {
|
|
107381
|
+
if (!chartSpace || seriesNodes.length !== series.length || !categories.length || external?.isExternal)
|
|
107382
|
+
return false;
|
|
107383
|
+
if (formulaCount(chartSpace) !== seriesNodes.reduce((sum, node) => sum + formulaCount(node), 0))
|
|
107384
|
+
return false;
|
|
107385
|
+
const writes = [];
|
|
107386
|
+
const labelOwners = /* @__PURE__ */ new Map();
|
|
107387
|
+
for (const [index, node] of seriesNodes.entries()) {
|
|
107388
|
+
const entry2 = series[index];
|
|
107389
|
+
for (const [name, numeric, values] of [
|
|
107390
|
+
["tx", false, [entry2.name]],
|
|
107391
|
+
["cat", false, [...categories]],
|
|
107392
|
+
["val", true, entry2.values.map(String)]
|
|
107393
|
+
]) {
|
|
107394
|
+
const container2 = xml.getChildByLocalName(node, name);
|
|
107395
|
+
if (!container2) return false;
|
|
107396
|
+
const write = collectChartWorkbookWrite(xml, container2, numeric, [...values]);
|
|
107397
|
+
if (write) {
|
|
107398
|
+
writes.push(write);
|
|
107399
|
+
if (!numeric) {
|
|
107400
|
+
const range = parseChartFormulaRange(write.formula);
|
|
107401
|
+
const addresses = range ? expandRangeAddresses(range, values.length) : void 0;
|
|
107402
|
+
if (!range || !addresses) return false;
|
|
107403
|
+
for (const [point2, address] of addresses.entries()) {
|
|
107404
|
+
const key2 = `${range.sheetName.toLowerCase()}!${address}`;
|
|
107405
|
+
const owner = name === "tx" ? `series:${index}` : `category:${point2}`;
|
|
107406
|
+
if (labelOwners.has(key2) && labelOwners.get(key2) !== owner) return false;
|
|
107407
|
+
labelOwners.set(key2, owner);
|
|
107408
|
+
}
|
|
107409
|
+
}
|
|
107410
|
+
} else if (external || !xml.getChildByLocalName(container2, numeric ? "numLit" : "strLit") && !(name === "tx" && xml.getScalarChildByLocalName(container2, "v") !== void 0))
|
|
107411
|
+
return false;
|
|
107412
|
+
}
|
|
107413
|
+
}
|
|
107414
|
+
if (formulaCount(chartSpace) !== writes.length) return false;
|
|
107415
|
+
if (!external) return writes.length === 0;
|
|
107416
|
+
if (!external.targetPath || !external.embeddedWorkbookData) return false;
|
|
107417
|
+
const target = resolve(chartPartPath, external.targetPath);
|
|
107418
|
+
let references = 0;
|
|
107419
|
+
const parser = new fastXmlParser.XMLParser({ ignoreAttributes: false, attributeNamePrefix: "@_" });
|
|
107420
|
+
try {
|
|
107421
|
+
for (const path2 of Object.keys(zip.files)) {
|
|
107422
|
+
if (!path2.endsWith(".rels") || !path2.includes("/_rels/")) continue;
|
|
107423
|
+
const source = path2.replace("/_rels/", "/").slice(0, -5);
|
|
107424
|
+
const tree = parser.parse(await zip.file(path2).async("string"));
|
|
107425
|
+
for (const rel of xmlChildren(xmlChild(tree, "Relationships"), "Relationship")) {
|
|
107426
|
+
const relationshipTarget2 = xmlAttr(rel, "Target");
|
|
107427
|
+
if (relationshipTarget2 && xmlAttr(rel, "TargetMode") !== "External" && resolve(source, relationshipTarget2) === target)
|
|
107428
|
+
references++;
|
|
107429
|
+
}
|
|
107430
|
+
}
|
|
107431
|
+
if (references !== 1) return false;
|
|
107432
|
+
await writeChartWorkbookUpdates(external.embeddedWorkbookData, writes, {
|
|
107433
|
+
atomic: true,
|
|
107434
|
+
requireCurrentValues: true
|
|
107435
|
+
});
|
|
107436
|
+
return true;
|
|
107437
|
+
} catch {
|
|
107438
|
+
return false;
|
|
107439
|
+
}
|
|
107440
|
+
}
|
|
107441
|
+
var init_chart_label_source = __esm({
|
|
107442
|
+
"pptx/core/utils/chart-label-source.ts"() {
|
|
107443
|
+
init_chart_xlsx_writer();
|
|
107444
|
+
init_xml_access();
|
|
107445
|
+
init_chart_xlsx_cellref();
|
|
107446
|
+
}
|
|
107447
|
+
});
|
|
107448
|
+
|
|
106662
107449
|
// pptx/core/utils/chart-band-fmts.ts
|
|
106663
107450
|
function safeUnsignedInt2(val) {
|
|
106664
107451
|
const n = Number(val);
|
|
@@ -112581,7 +113368,7 @@ async function persistModernCommentPackage(init) {
|
|
|
112581
113368
|
authorPath,
|
|
112582
113369
|
init.xmlBuilder.build(buildModernAuthorPart(init.authors, init.authorRoot))
|
|
112583
113370
|
);
|
|
112584
|
-
relationshipId2 = init.authorRelationshipId || String(existing?.["@_Id"] || "") ||
|
|
113371
|
+
relationshipId2 = init.authorRelationshipId || String(existing?.["@_Id"] || "") || nextRelationshipId2(retained);
|
|
112585
113372
|
retained.push({
|
|
112586
113373
|
...existing || {},
|
|
112587
113374
|
"@_Id": relationshipId2,
|
|
@@ -112612,7 +113399,7 @@ async function persistModernCommentPackage(init) {
|
|
|
112612
113399
|
}
|
|
112613
113400
|
return hasComments ? { authorPartPath: authorPath, authorRelationshipId: relationshipId2 } : {};
|
|
112614
113401
|
}
|
|
112615
|
-
var RELATIONSHIPS_NS, ensureArray13, resolvePartPath3, relationshipTarget, modernComments,
|
|
113402
|
+
var RELATIONSHIPS_NS, ensureArray13, resolvePartPath3, relationshipTarget, modernComments, nextRelationshipId2, updateOverride;
|
|
112616
113403
|
var init_modern_comment_package = __esm({
|
|
112617
113404
|
"pptx/core/utils/modern-comment-package.ts"() {
|
|
112618
113405
|
init_comment_thread_format();
|
|
@@ -112645,7 +113432,7 @@ var init_modern_comment_package = __esm({
|
|
|
112645
113432
|
return `${"../".repeat(source.length)}${target.join("/")}`;
|
|
112646
113433
|
};
|
|
112647
113434
|
modernComments = (slide) => (slide.comments || []).filter(usesModernCommentFormat).map(promoteCommentToModern);
|
|
112648
|
-
|
|
113435
|
+
nextRelationshipId2 = (relationships2) => {
|
|
112649
113436
|
const used = new Set(relationships2.map((entry2) => String(entry2["@_Id"] || "")));
|
|
112650
113437
|
let index = 1;
|
|
112651
113438
|
while (used.has(`rId${index}`)) {
|
|
@@ -114157,7 +114944,7 @@ function buildContentTypesXml(overrides28) {
|
|
|
114157
114944
|
}
|
|
114158
114945
|
async function buildMetroBlobPackage(input) {
|
|
114159
114946
|
const root = ROOT[input.kind];
|
|
114160
|
-
const zip = new
|
|
114947
|
+
const zip = new JSZip17__default.default();
|
|
114161
114948
|
const overrides28 = new Map([
|
|
114162
114949
|
[root.path, root.contentType],
|
|
114163
114950
|
...input.parts.contentTypes,
|
|
@@ -114473,7 +115260,7 @@ async function buildOne(zip, slidePath, slideXml3, element) {
|
|
|
114473
115260
|
});
|
|
114474
115261
|
}
|
|
114475
115262
|
async function buildMetroBlobs(pptxBytes, slides) {
|
|
114476
|
-
const zip = await
|
|
115263
|
+
const zip = await JSZip17__default.default.loadAsync(pptxBytes);
|
|
114477
115264
|
const slidePaths = await orderedSlidePaths(zip);
|
|
114478
115265
|
const out = /* @__PURE__ */ new Map();
|
|
114479
115266
|
for (let i2 = 0; i2 < slides.length; i2++) {
|
|
@@ -117465,7 +118252,7 @@ function withDeclaration(xml) {
|
|
|
117465
118252
|
${body}`;
|
|
117466
118253
|
}
|
|
117467
118254
|
async function zipParts(parts) {
|
|
117468
|
-
const zip = new
|
|
118255
|
+
const zip = new JSZip17__default.default();
|
|
117469
118256
|
for (const [name, text2] of parts) {
|
|
117470
118257
|
zip.file(name, text2);
|
|
117471
118258
|
}
|
|
@@ -117512,7 +118299,7 @@ async function buildMasterRoundTrip(source) {
|
|
|
117512
118299
|
};
|
|
117513
118300
|
}
|
|
117514
118301
|
async function buildDeckMasterRoundTripsFromPptx(pptxBytes) {
|
|
117515
|
-
const zip = await
|
|
118302
|
+
const zip = await JSZip17__default.default.loadAsync(pptxBytes);
|
|
117516
118303
|
const slidePaths = await readSlideMasterPaths(zip);
|
|
117517
118304
|
const masterPaths = [...new Set(slidePaths)];
|
|
117518
118305
|
if (masterPaths.length === 0) {
|
|
@@ -120348,7 +121135,7 @@ function upsertRelationship(relationships2, entry2, target) {
|
|
|
120348
121135
|
(item) => String(item["@_Id"] ?? "") === entry2.relId && isCustomXmlRelationship(item["@_Type"])
|
|
120349
121136
|
);
|
|
120350
121137
|
if (!relationship) {
|
|
120351
|
-
entry2.relId =
|
|
121138
|
+
entry2.relId = nextRelationshipId3(relationships2);
|
|
120352
121139
|
relationship = {};
|
|
120353
121140
|
relationships2.push(relationship);
|
|
120354
121141
|
}
|
|
@@ -120416,7 +121203,7 @@ function relativeTarget2(source, target) {
|
|
|
120416
121203
|
}
|
|
120417
121204
|
return [...from.map(() => ".."), ...to].join("/");
|
|
120418
121205
|
}
|
|
120419
|
-
function
|
|
121206
|
+
function nextRelationshipId3(relationships2) {
|
|
120420
121207
|
const used = new Set(relationships2.map((entry2) => String(entry2["@_Id"] ?? "")));
|
|
120421
121208
|
let index = 1;
|
|
120422
121209
|
while (used.has(`rId${index}`)) {
|
|
@@ -120673,7 +121460,7 @@ async function upsertTagRelationship(zip, codec, collection) {
|
|
|
120673
121460
|
(entry2) => String(entry2["@_Id"] ?? "") === collection.relationshipId && String(entry2["@_Type"] ?? "") === TAG_RELATIONSHIP_TYPE
|
|
120674
121461
|
);
|
|
120675
121462
|
if (!relationship) {
|
|
120676
|
-
collection.relationshipId =
|
|
121463
|
+
collection.relationshipId = nextRelationshipId4(relationships2);
|
|
120677
121464
|
relationship = {};
|
|
120678
121465
|
relationships2.push(relationship);
|
|
120679
121466
|
}
|
|
@@ -120732,7 +121519,7 @@ function relativeTarget3(source, target) {
|
|
|
120732
121519
|
}
|
|
120733
121520
|
return [...from.map(() => ".."), ...to].join("/");
|
|
120734
121521
|
}
|
|
120735
|
-
function
|
|
121522
|
+
function nextRelationshipId4(relationships2) {
|
|
120736
121523
|
const used = new Set(relationships2.map((entry2) => String(entry2["@_Id"] ?? "")));
|
|
120737
121524
|
let index = 1;
|
|
120738
121525
|
while (used.has(`rId${index}`)) {
|
|
@@ -120759,6 +121546,18 @@ var init_tag_package = __esm({
|
|
|
120759
121546
|
}
|
|
120760
121547
|
});
|
|
120761
121548
|
|
|
121549
|
+
// pptx/core/utils/chart-workbook-data-signature.ts
|
|
121550
|
+
function chartWorkbookDataSignature(data) {
|
|
121551
|
+
return JSON.stringify({
|
|
121552
|
+
categories: data.dateCategories?.values ?? data.categories,
|
|
121553
|
+
series: data.series.map((series) => ({ name: series.name, values: series.values }))
|
|
121554
|
+
});
|
|
121555
|
+
}
|
|
121556
|
+
var init_chart_workbook_data_signature = __esm({
|
|
121557
|
+
"pptx/core/utils/chart-workbook-data-signature.ts"() {
|
|
121558
|
+
}
|
|
121559
|
+
});
|
|
121560
|
+
|
|
120762
121561
|
// pptx/core/utils/chart-axis-deleted.ts
|
|
120763
121562
|
function authoredDeleted(node) {
|
|
120764
121563
|
if (node === void 0) {
|
|
@@ -120927,8 +121726,8 @@ function buildDefRPr(style, existing, resolveColor2) {
|
|
|
120927
121726
|
return rPr;
|
|
120928
121727
|
}
|
|
120929
121728
|
function applyChartAxisTitleStyleToXml(axisNode, style, getLocalName2, resolveColor2) {
|
|
120930
|
-
const
|
|
120931
|
-
if (!
|
|
121729
|
+
const hasAny2 = style.fontFamily !== void 0 || style.fontSize !== void 0 || style.fontBold !== void 0 || style.fontColor !== void 0;
|
|
121730
|
+
if (!hasAny2) {
|
|
120932
121731
|
return;
|
|
120933
121732
|
}
|
|
120934
121733
|
const titleKey = findKey7(axisNode, "title", getLocalName2);
|
|
@@ -121846,6 +122645,33 @@ var init_chart_title_run_alignment = __esm({
|
|
|
121846
122645
|
}
|
|
121847
122646
|
});
|
|
121848
122647
|
|
|
122648
|
+
// pptx/core/utils/chart-title-text-edit.ts
|
|
122649
|
+
function patchChartTitleRunText(title, runs, local) {
|
|
122650
|
+
const tx = title[findKey7(title, "tx", local) ?? ""];
|
|
122651
|
+
const rich = tx?.[findKey7(tx, "rich", local) ?? ""];
|
|
122652
|
+
const raw = rich?.[findKey7(rich, "p", local) ?? ""];
|
|
122653
|
+
const paragraphs = Array.isArray(raw) ? raw : raw ? [raw] : [];
|
|
122654
|
+
if (paragraphs.length !== 1) return false;
|
|
122655
|
+
const paragraph = paragraphs[0];
|
|
122656
|
+
if (findKey7(paragraph, "br", local) || findKey7(paragraph, "fld", local)) return false;
|
|
122657
|
+
const rawRuns = paragraph[findKey7(paragraph, "r", local) ?? ""];
|
|
122658
|
+
const original = Array.isArray(rawRuns) ? rawRuns : rawRuns ? [rawRuns] : [];
|
|
122659
|
+
if (original.length !== runs.length) return false;
|
|
122660
|
+
const keys = original.map((run) => findKey7(run, "t", local));
|
|
122661
|
+
if (keys.some((key2) => !key2)) return false;
|
|
122662
|
+
for (const [index, value] of original.entries()) {
|
|
122663
|
+
const run = value, key2 = keys[index];
|
|
122664
|
+
const text2 = run[key2];
|
|
122665
|
+
run[key2] = text2 && typeof text2 === "object" && !Array.isArray(text2) ? { ...text2, "#text": runs[index].text } : runs[index].text;
|
|
122666
|
+
}
|
|
122667
|
+
return true;
|
|
122668
|
+
}
|
|
122669
|
+
var init_chart_title_text_edit = __esm({
|
|
122670
|
+
"pptx/core/utils/chart-title-text-edit.ts"() {
|
|
122671
|
+
init_chart_title_xml_ops();
|
|
122672
|
+
}
|
|
122673
|
+
});
|
|
122674
|
+
|
|
121849
122675
|
// pptx/core/utils/chart-title-serializer.ts
|
|
121850
122676
|
function applyChartTitleToXml(chartRoot, model, getLocalName2, options = { prefix: "c" }) {
|
|
121851
122677
|
const { prefix } = options;
|
|
@@ -121871,11 +122697,18 @@ function applyChartTitleToXml(chartRoot, model, getLocalName2, options = { prefi
|
|
|
121871
122697
|
runs = realignOrCollapseTitleRuns(staleRuns, model.title);
|
|
121872
122698
|
}
|
|
121873
122699
|
let titleNode = existingKey ? chartRoot[existingKey] : void 0;
|
|
122700
|
+
const textOnlyStylesMatch = Boolean(
|
|
122701
|
+
runs && model.titleTextOnlyStyles?.length === runs.length && runs.every(
|
|
122702
|
+
(run, index) => ["bold", "italic", "fontSize", "color"].every(
|
|
122703
|
+
(key2) => run[key2] === model.titleTextOnlyStyles[index][key2]
|
|
122704
|
+
)
|
|
122705
|
+
)
|
|
122706
|
+
);
|
|
121874
122707
|
if (runs && titleNode && typeof titleNode === "object") {
|
|
121875
122708
|
const existingTexts = [];
|
|
121876
122709
|
collectAllText(titleNode, getLocalName2, existingTexts);
|
|
121877
122710
|
const newTexts = runs.map((run) => run.text);
|
|
121878
|
-
if (existingTexts.length === newTexts.length && existingTexts.every((text2, index) => text2 === newTexts[index])) {
|
|
122711
|
+
if ((!model.titleTextOnly || textOnlyStylesMatch) && existingTexts.length === newTexts.length && existingTexts.every((text2, index) => text2 === newTexts[index])) {
|
|
121879
122712
|
runs = void 0;
|
|
121880
122713
|
}
|
|
121881
122714
|
}
|
|
@@ -121887,6 +122720,12 @@ function applyChartTitleToXml(chartRoot, model, getLocalName2, options = { prefi
|
|
|
121887
122720
|
insertAt2(chartRoot, 0, `${prefix}:title`, titleNode);
|
|
121888
122721
|
}
|
|
121889
122722
|
} else if (runs) {
|
|
122723
|
+
if (model.titleTextOnly && textOnlyStylesMatch) {
|
|
122724
|
+
if (!patchChartTitleRunText(titleNode, runs, getLocalName2))
|
|
122725
|
+
throw new Error("This chart title cannot be replaced without changing its text source");
|
|
122726
|
+
if (prefix === "c") setAutoTitleDeleted(chartRoot, false, getLocalName2);
|
|
122727
|
+
return true;
|
|
122728
|
+
}
|
|
121890
122729
|
const txKey = findKey7(titleNode, "tx", getLocalName2);
|
|
121891
122730
|
if (txKey) {
|
|
121892
122731
|
titleNode[txKey] = buildTitleTextFromRuns(prefix, runs);
|
|
@@ -121910,6 +122749,7 @@ var init_chart_title_serializer = __esm({
|
|
|
121910
122749
|
"pptx/core/utils/chart-title-serializer.ts"() {
|
|
121911
122750
|
init_chart_title_node_builder();
|
|
121912
122751
|
init_chart_title_run_alignment();
|
|
122752
|
+
init_chart_title_text_edit();
|
|
121913
122753
|
init_chart_title_xml_ops();
|
|
121914
122754
|
}
|
|
121915
122755
|
});
|
|
@@ -122071,131 +122911,6 @@ var init_chart_title_style_serializer = __esm({
|
|
|
122071
122911
|
};
|
|
122072
122912
|
}
|
|
122073
122913
|
});
|
|
122074
|
-
function collectChartWorkbookWrite(xmlLookupService, container2, isNumeric2, values) {
|
|
122075
|
-
if (!container2) {
|
|
122076
|
-
return void 0;
|
|
122077
|
-
}
|
|
122078
|
-
const refNode = xmlLookupService.getChildByLocalName(container2, isNumeric2 ? "numRef" : "strRef");
|
|
122079
|
-
const formula = refNode ? xmlLookupService.getScalarChildByLocalName(refNode, "f") : void 0;
|
|
122080
|
-
return formula ? { formula, isNumeric: isNumeric2, values } : void 0;
|
|
122081
|
-
}
|
|
122082
|
-
function createSpreadsheetXmlParser2() {
|
|
122083
|
-
return new fastXmlParser.XMLParser({
|
|
122084
|
-
ignoreAttributes: false,
|
|
122085
|
-
attributeNamePrefix: "@_",
|
|
122086
|
-
trimValues: false,
|
|
122087
|
-
tagValueProcessor: (tagName, tagValue) => preservesSpreadsheetXmlWhitespace(tagName) ? tagValue : tagValue.trim()
|
|
122088
|
-
});
|
|
122089
|
-
}
|
|
122090
|
-
function createSpreadsheetXmlBuilder2() {
|
|
122091
|
-
return new fastXmlParser.XMLBuilder({
|
|
122092
|
-
ignoreAttributes: false,
|
|
122093
|
-
attributeNamePrefix: "@_",
|
|
122094
|
-
suppressBooleanAttributes: false,
|
|
122095
|
-
format: false
|
|
122096
|
-
});
|
|
122097
|
-
}
|
|
122098
|
-
async function resolveWorksheetPathsByName(xlsxZip, parser) {
|
|
122099
|
-
const result = /* @__PURE__ */ new Map();
|
|
122100
|
-
const workbookFile = xlsxZip.file("xl/workbook.xml");
|
|
122101
|
-
const relsFile = xlsxZip.file("xl/_rels/workbook.xml.rels");
|
|
122102
|
-
if (!workbookFile || !relsFile) {
|
|
122103
|
-
return result;
|
|
122104
|
-
}
|
|
122105
|
-
try {
|
|
122106
|
-
const workbookTree = parser.parse(await workbookFile.async("string"));
|
|
122107
|
-
const relsTree = parser.parse(await relsFile.async("string"));
|
|
122108
|
-
const targetByRelId = /* @__PURE__ */ new Map();
|
|
122109
|
-
const relationships2 = xmlChild(relsTree, "Relationships");
|
|
122110
|
-
for (const rel of xmlChildren(relationships2, "Relationship")) {
|
|
122111
|
-
const id = xmlAttr(rel, "Id");
|
|
122112
|
-
const target = xmlAttr(rel, "Target");
|
|
122113
|
-
if (id && target) {
|
|
122114
|
-
targetByRelId.set(id, target);
|
|
122115
|
-
}
|
|
122116
|
-
}
|
|
122117
|
-
const workbookRoot = xmlChild(workbookTree, "workbook");
|
|
122118
|
-
const sheets = xmlChild(workbookRoot, "sheets");
|
|
122119
|
-
for (const sheet of xmlChildren(sheets, "sheet")) {
|
|
122120
|
-
const name = xmlAttr(sheet, "name");
|
|
122121
|
-
const relId = xmlAttr(sheet, "r:id") ?? xmlAttr(sheet, "id");
|
|
122122
|
-
const target = relId ? targetByRelId.get(relId) : void 0;
|
|
122123
|
-
if (name && target) {
|
|
122124
|
-
result.set(name.toLowerCase(), resolveWorkbookPartPath(target));
|
|
122125
|
-
}
|
|
122126
|
-
}
|
|
122127
|
-
} catch {
|
|
122128
|
-
}
|
|
122129
|
-
return result;
|
|
122130
|
-
}
|
|
122131
|
-
function resolveWorkbookPartPath(target) {
|
|
122132
|
-
return target.startsWith("/") ? target.slice(1) : `xl/${target}`;
|
|
122133
|
-
}
|
|
122134
|
-
async function writeChartWorkbookUpdates(xlsxBytes, writes) {
|
|
122135
|
-
if (writes.length === 0) {
|
|
122136
|
-
return { unresolved: 0 };
|
|
122137
|
-
}
|
|
122138
|
-
let xlsxZip;
|
|
122139
|
-
try {
|
|
122140
|
-
xlsxZip = await JSZip3__default.default.loadAsync(xlsxBytes);
|
|
122141
|
-
} catch {
|
|
122142
|
-
return { unresolved: writes.length };
|
|
122143
|
-
}
|
|
122144
|
-
const parser = createSpreadsheetXmlParser2();
|
|
122145
|
-
const sheetPathByName = await resolveWorksheetPathsByName(xlsxZip, parser);
|
|
122146
|
-
const writesBySheetPath = /* @__PURE__ */ new Map();
|
|
122147
|
-
let unresolved = 0;
|
|
122148
|
-
for (const write of writes) {
|
|
122149
|
-
const range = parseChartFormulaRange(write.formula);
|
|
122150
|
-
const sheetPath = range ? sheetPathByName.get(range.sheetName.toLowerCase()) : void 0;
|
|
122151
|
-
const refs = range ? expandRangeAddresses(range, write.values.length) : void 0;
|
|
122152
|
-
if (!range || !sheetPath || !refs) {
|
|
122153
|
-
unresolved += 1;
|
|
122154
|
-
continue;
|
|
122155
|
-
}
|
|
122156
|
-
const bucket = writesBySheetPath.get(sheetPath) ?? [];
|
|
122157
|
-
bucket.push({ refs, values: write.values, isNumeric: write.isNumeric });
|
|
122158
|
-
writesBySheetPath.set(sheetPath, bucket);
|
|
122159
|
-
}
|
|
122160
|
-
const builder3 = createSpreadsheetXmlBuilder2();
|
|
122161
|
-
let changedAny = false;
|
|
122162
|
-
for (const [sheetPath, resolvedWrites] of writesBySheetPath) {
|
|
122163
|
-
const sheetFile = xlsxZip.file(sheetPath);
|
|
122164
|
-
if (!sheetFile) {
|
|
122165
|
-
unresolved += resolvedWrites.length;
|
|
122166
|
-
continue;
|
|
122167
|
-
}
|
|
122168
|
-
try {
|
|
122169
|
-
const sheetTree = parser.parse(await sheetFile.async("string"));
|
|
122170
|
-
const cellWrites = resolvedWrites.flatMap(
|
|
122171
|
-
({ refs, values, isNumeric: isNumeric2 }) => refs.map((ref, i2) => ({ ref, isNumeric: isNumeric2, value: values[i2] }))
|
|
122172
|
-
);
|
|
122173
|
-
if (applyCellWritesToWorksheet(sheetTree, cellWrites)) {
|
|
122174
|
-
xlsxZip.file(sheetPath, builder3.build(sheetTree));
|
|
122175
|
-
changedAny = true;
|
|
122176
|
-
}
|
|
122177
|
-
} catch {
|
|
122178
|
-
unresolved += resolvedWrites.length;
|
|
122179
|
-
}
|
|
122180
|
-
}
|
|
122181
|
-
if (!changedAny) {
|
|
122182
|
-
return { unresolved };
|
|
122183
|
-
}
|
|
122184
|
-
const bytes = await xlsxZip.generateAsync({
|
|
122185
|
-
type: "uint8array",
|
|
122186
|
-
compression: "DEFLATE",
|
|
122187
|
-
compressionOptions: { level: 6 }
|
|
122188
|
-
});
|
|
122189
|
-
return { bytes, unresolved };
|
|
122190
|
-
}
|
|
122191
|
-
var init_chart_xlsx_writer = __esm({
|
|
122192
|
-
"pptx/core/utils/chart-xlsx-writer.ts"() {
|
|
122193
|
-
init_chart_xlsx_cellref();
|
|
122194
|
-
init_chart_xlsx_sheet_cells();
|
|
122195
|
-
init_xml_access();
|
|
122196
|
-
init_xml_whitespace();
|
|
122197
|
-
}
|
|
122198
|
-
});
|
|
122199
122914
|
|
|
122200
122915
|
// pptx/core/core/runtime/chart-cx-update-data.ts
|
|
122201
122916
|
function findKey31(node, localName29, getLocalName2) {
|
|
@@ -122531,13 +123246,19 @@ var init_chart_cx_update = __esm({
|
|
|
122531
123246
|
});
|
|
122532
123247
|
|
|
122533
123248
|
// pptx/core/core/runtime/chart-external-workbook-save.ts
|
|
122534
|
-
async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath, externalData, writes) {
|
|
123249
|
+
async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath, externalData, writes, atomic = false) {
|
|
123250
|
+
if (atomic && externalData && (!externalData.targetPath || externalData.isExternal)) {
|
|
123251
|
+
throw new Error("Chart label replacement cannot update an external or missing workbook.");
|
|
123252
|
+
}
|
|
122535
123253
|
if (writes.length === 0 || !externalData?.targetPath) {
|
|
122536
|
-
return;
|
|
123254
|
+
return writes.length === 0;
|
|
122537
123255
|
}
|
|
122538
123256
|
const embeddingPath = deps.resolveImagePath(chartPartPath, externalData.targetPath);
|
|
122539
123257
|
const looksEmbedded = embeddingPath.includes("embeddings/") && /\.xlsx$/iu.test(embeddingPath);
|
|
122540
|
-
if (!looksEmbedded) {
|
|
123258
|
+
if (!looksEmbedded || externalData.isExternal) {
|
|
123259
|
+
if (atomic) {
|
|
123260
|
+
throw new Error("Chart label replacement requires an embedded .xlsx workbook.");
|
|
123261
|
+
}
|
|
122541
123262
|
deps.reportWarning({
|
|
122542
123263
|
code: "CHART_EXTERNAL_DATA_WRITEBACK_UNSUPPORTED",
|
|
122543
123264
|
message: "Chart data changes were saved to the cached values only: the linked data source is external or not an embedded .xlsx workbook, so it was not updated.",
|
|
@@ -122546,10 +123267,13 @@ async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath,
|
|
|
122546
123267
|
slideId: slidePath,
|
|
122547
123268
|
xmlPath: chartPartPath
|
|
122548
123269
|
});
|
|
122549
|
-
return;
|
|
123270
|
+
return false;
|
|
122550
123271
|
}
|
|
122551
123272
|
const xlsxFile = deps.zip.file(embeddingPath);
|
|
122552
123273
|
if (!xlsxFile) {
|
|
123274
|
+
if (atomic) {
|
|
123275
|
+
throw new Error("Chart label replacement workbook is missing.");
|
|
123276
|
+
}
|
|
122553
123277
|
deps.reportWarning({
|
|
122554
123278
|
code: "CHART_EMBEDDED_WORKBOOK_MISSING",
|
|
122555
123279
|
message: "Chart data changes were saved to the cached values only: the referenced embedded workbook was not found in the package.",
|
|
@@ -122558,12 +123282,15 @@ async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath,
|
|
|
122558
123282
|
slideId: slidePath,
|
|
122559
123283
|
xmlPath: embeddingPath
|
|
122560
123284
|
});
|
|
122561
|
-
return;
|
|
123285
|
+
return false;
|
|
122562
123286
|
}
|
|
122563
123287
|
let xlsxBytes;
|
|
122564
123288
|
try {
|
|
122565
123289
|
xlsxBytes = await xlsxFile.async("uint8array");
|
|
122566
123290
|
} catch {
|
|
123291
|
+
if (atomic) {
|
|
123292
|
+
throw new Error("Chart label replacement workbook cannot be read.");
|
|
123293
|
+
}
|
|
122567
123294
|
deps.reportWarning({
|
|
122568
123295
|
code: "CHART_EMBEDDED_WORKBOOK_UNREADABLE",
|
|
122569
123296
|
message: "Chart data changes were saved to the cached values only: the referenced embedded workbook could not be read.",
|
|
@@ -122572,9 +123299,9 @@ async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath,
|
|
|
122572
123299
|
slideId: slidePath,
|
|
122573
123300
|
xmlPath: embeddingPath
|
|
122574
123301
|
});
|
|
122575
|
-
return;
|
|
123302
|
+
return false;
|
|
122576
123303
|
}
|
|
122577
|
-
const result = await writeChartWorkbookUpdates(xlsxBytes, writes);
|
|
123304
|
+
const result = await writeChartWorkbookUpdates(xlsxBytes, writes, { atomic });
|
|
122578
123305
|
if (result.bytes) {
|
|
122579
123306
|
deps.zip.file(embeddingPath, result.bytes);
|
|
122580
123307
|
}
|
|
@@ -122588,6 +123315,7 @@ async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath,
|
|
|
122588
123315
|
xmlPath: embeddingPath
|
|
122589
123316
|
});
|
|
122590
123317
|
}
|
|
123318
|
+
return result.unresolved === 0;
|
|
122591
123319
|
}
|
|
122592
123320
|
var init_chart_external_workbook_save = __esm({
|
|
122593
123321
|
"pptx/core/core/runtime/chart-external-workbook-save.ts"() {
|
|
@@ -122853,8 +123581,8 @@ function applyRotationFlipToRawNode(node, rotation, flipH, flipV) {
|
|
|
122853
123581
|
const spPrKey = findChildKey2(node, "spPr");
|
|
122854
123582
|
const container2 = spPrKey ? node[spPrKey] ?? node : node;
|
|
122855
123583
|
const xfrmKey = findChildKey2(container2, "xfrm");
|
|
122856
|
-
const
|
|
122857
|
-
if (!xfrmKey && !
|
|
123584
|
+
const hasAny2 = Boolean(rotation) || Boolean(flipH) || Boolean(flipV);
|
|
123585
|
+
if (!xfrmKey && !hasAny2) {
|
|
122858
123586
|
return;
|
|
122859
123587
|
}
|
|
122860
123588
|
const xfrm = xfrmKey ? container2[xfrmKey] : {};
|
|
@@ -122889,24 +123617,24 @@ function hexVal(hex3) {
|
|
|
122889
123617
|
}
|
|
122890
123618
|
function buildRunProps(para) {
|
|
122891
123619
|
const rPr = {};
|
|
122892
|
-
let
|
|
123620
|
+
let hasAny2 = false;
|
|
122893
123621
|
if (para.fontSize !== void 0) {
|
|
122894
123622
|
rPr["@_sz"] = String(Math.round(para.fontSize * 100));
|
|
122895
|
-
|
|
123623
|
+
hasAny2 = true;
|
|
122896
123624
|
}
|
|
122897
123625
|
if (para.bold) {
|
|
122898
123626
|
rPr["@_b"] = "1";
|
|
122899
|
-
|
|
123627
|
+
hasAny2 = true;
|
|
122900
123628
|
}
|
|
122901
123629
|
if (para.italic) {
|
|
122902
123630
|
rPr["@_i"] = "1";
|
|
122903
|
-
|
|
123631
|
+
hasAny2 = true;
|
|
122904
123632
|
}
|
|
122905
123633
|
if (para.color) {
|
|
122906
123634
|
rPr["a:solidFill"] = { "a:srgbClr": { "@_val": hexVal(para.color) } };
|
|
122907
|
-
|
|
123635
|
+
hasAny2 = true;
|
|
122908
123636
|
}
|
|
122909
|
-
return
|
|
123637
|
+
return hasAny2 ? rPr : void 0;
|
|
122910
123638
|
}
|
|
122911
123639
|
function buildParagraphNode(para) {
|
|
122912
123640
|
const node = {};
|
|
@@ -124949,7 +125677,7 @@ var init_blob_url_to_data_url = __esm({
|
|
|
124949
125677
|
|
|
124950
125678
|
// pptx/core/core/runtime/image-a14-effects-model.ts
|
|
124951
125679
|
function applyA14ExtensionToEffects(effects, a14) {
|
|
124952
|
-
let
|
|
125680
|
+
let hasAny2 = false;
|
|
124953
125681
|
if (a14.artisticEffect !== void 0) {
|
|
124954
125682
|
effects.artisticEffect = a14.artisticEffect;
|
|
124955
125683
|
if (a14.originalImageRelId !== void 0) {
|
|
@@ -124961,15 +125689,15 @@ function applyA14ExtensionToEffects(effects, a14) {
|
|
|
124961
125689
|
if (a14.artisticParams) {
|
|
124962
125690
|
effects.artisticParams = a14.artisticParams;
|
|
124963
125691
|
}
|
|
124964
|
-
|
|
125692
|
+
hasAny2 = true;
|
|
124965
125693
|
}
|
|
124966
125694
|
if (a14.backgroundRemoval) {
|
|
124967
125695
|
effects.backgroundRemoval = a14.backgroundRemoval;
|
|
124968
|
-
|
|
125696
|
+
hasAny2 = true;
|
|
124969
125697
|
}
|
|
124970
125698
|
if (a14.originalImageRelId !== void 0) {
|
|
124971
125699
|
effects.originalImageRelId = a14.originalImageRelId;
|
|
124972
|
-
|
|
125700
|
+
hasAny2 = true;
|
|
124973
125701
|
}
|
|
124974
125702
|
const corrections = {};
|
|
124975
125703
|
if (a14.sharpenSoften) {
|
|
@@ -124992,9 +125720,9 @@ function applyA14ExtensionToEffects(effects, a14) {
|
|
|
124992
125720
|
if (a14.originalImageRelId !== void 0) {
|
|
124993
125721
|
effects.prerenderedCorrections = corrections;
|
|
124994
125722
|
}
|
|
124995
|
-
|
|
125723
|
+
hasAny2 = true;
|
|
124996
125724
|
}
|
|
124997
|
-
return
|
|
125725
|
+
return hasAny2;
|
|
124998
125726
|
}
|
|
124999
125727
|
var init_image_a14_effects_model = __esm({
|
|
125000
125728
|
"pptx/core/core/runtime/image-a14-effects-model.ts"() {
|
|
@@ -126042,7 +126770,7 @@ var init_PptxHandlerRuntimeState = __esm({
|
|
|
126042
126770
|
*/
|
|
126043
126771
|
savedSlideFingerprints = /* @__PURE__ */ new Map();
|
|
126044
126772
|
/**
|
|
126045
|
-
* `chartData`
|
|
126773
|
+
* `chartData` as parsed or last serialized into the current ZIP,
|
|
126046
126774
|
* serialized to JSON and keyed by `chartPartPath`. The save pipeline used
|
|
126047
126775
|
* to re-serialize EVERY chart part on any slide rewrite regardless of
|
|
126048
126776
|
* whether the chart itself was touched, which materializes the load-time
|
|
@@ -126055,6 +126783,10 @@ var init_PptxHandlerRuntimeState = __esm({
|
|
|
126055
126783
|
* untouched chart part pass through byte-for-byte instead.
|
|
126056
126784
|
*/
|
|
126057
126785
|
chartDataBaselines = /* @__PURE__ */ new Map();
|
|
126786
|
+
/** Pending chart requests also retain warned workbook writes for later retry. */
|
|
126787
|
+
pendingChartUpdates;
|
|
126788
|
+
/** Last fully reconciled workbook data plus whether a write-back needs retry. */
|
|
126789
|
+
chartWorkbookDataBaselines = /* @__PURE__ */ new Map();
|
|
126058
126790
|
/** Per-slide relationship maps: slide path -> (rId -> target path). */
|
|
126059
126791
|
slideRelsMap = /* @__PURE__ */ new Map();
|
|
126060
126792
|
/** Tracks relationship IDs with TargetMode="External" per slide/part path. */
|
|
@@ -127261,13 +127993,13 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
|
|
|
127261
127993
|
return null;
|
|
127262
127994
|
}
|
|
127263
127995
|
const effects = {};
|
|
127264
|
-
let
|
|
127996
|
+
let hasAny2 = false;
|
|
127265
127997
|
const brightRaw = blip["@_bright"] ?? blip["@_brt"];
|
|
127266
127998
|
if (brightRaw !== null) {
|
|
127267
127999
|
const val = parseInt(String(brightRaw));
|
|
127268
128000
|
if (Number.isFinite(val)) {
|
|
127269
128001
|
effects.brightness = val / 1e3;
|
|
127270
|
-
|
|
128002
|
+
hasAny2 = true;
|
|
127271
128003
|
}
|
|
127272
128004
|
}
|
|
127273
128005
|
const contrastRaw = blip["@_contrast"] ?? blip["@_cont"];
|
|
@@ -127275,7 +128007,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
|
|
|
127275
128007
|
const val = parseInt(String(contrastRaw));
|
|
127276
128008
|
if (Number.isFinite(val)) {
|
|
127277
128009
|
effects.contrast = val / 1e3;
|
|
127278
|
-
|
|
128010
|
+
hasAny2 = true;
|
|
127279
128011
|
}
|
|
127280
128012
|
}
|
|
127281
128013
|
const colorEffects = parseImageColorEffects(
|
|
@@ -127285,12 +128017,12 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
|
|
|
127285
128017
|
);
|
|
127286
128018
|
Object.assign(effects, colorEffects);
|
|
127287
128019
|
if (Object.keys(colorEffects).length > 0) {
|
|
127288
|
-
|
|
128020
|
+
hasAny2 = true;
|
|
127289
128021
|
}
|
|
127290
128022
|
const alphaEffects = parseImageAlphaEffects(blip, (node) => this.parseColor(node));
|
|
127291
128023
|
Object.assign(effects, alphaEffects);
|
|
127292
128024
|
if (Object.keys(alphaEffects).length > 0) {
|
|
127293
|
-
|
|
128025
|
+
hasAny2 = true;
|
|
127294
128026
|
}
|
|
127295
128027
|
const lumNode = blip["a:lum"];
|
|
127296
128028
|
if (lumNode) {
|
|
@@ -127310,7 +128042,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
|
|
|
127310
128042
|
}
|
|
127311
128043
|
}
|
|
127312
128044
|
effects.lum = lumEffect;
|
|
127313
|
-
|
|
128045
|
+
hasAny2 = true;
|
|
127314
128046
|
}
|
|
127315
128047
|
const hslNode = blip["a:hsl"];
|
|
127316
128048
|
if (hslNode) {
|
|
@@ -127337,7 +128069,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
|
|
|
127337
128069
|
}
|
|
127338
128070
|
}
|
|
127339
128071
|
effects.hsl = hslEffect;
|
|
127340
|
-
|
|
128072
|
+
hasAny2 = true;
|
|
127341
128073
|
}
|
|
127342
128074
|
const tintNode = blip["a:tint"];
|
|
127343
128075
|
if (tintNode) {
|
|
@@ -127357,7 +128089,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
|
|
|
127357
128089
|
}
|
|
127358
128090
|
}
|
|
127359
128091
|
effects.tint = tintEffect;
|
|
127360
|
-
|
|
128092
|
+
hasAny2 = true;
|
|
127361
128093
|
}
|
|
127362
128094
|
const fillOverlay = blip["a:fillOverlay"];
|
|
127363
128095
|
if (fillOverlay) {
|
|
@@ -127384,7 +128116,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
|
|
|
127384
128116
|
...resolvedGradient ? { resolvedGradient } : {},
|
|
127385
128117
|
...resolvedPattern ? { resolvedPattern } : {}
|
|
127386
128118
|
};
|
|
127387
|
-
|
|
128119
|
+
hasAny2 = true;
|
|
127388
128120
|
}
|
|
127389
128121
|
const blurNode = blip["a:blur"];
|
|
127390
128122
|
if (blurNode) {
|
|
@@ -127402,16 +128134,16 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
|
|
|
127402
128134
|
blurEffect.grow = s === "1" || s === "true";
|
|
127403
128135
|
}
|
|
127404
128136
|
effects.blur = blurEffect;
|
|
127405
|
-
|
|
128137
|
+
hasAny2 = true;
|
|
127406
128138
|
}
|
|
127407
128139
|
const extLst = xmlChild(blip, "a:extLst");
|
|
127408
128140
|
if (extLst) {
|
|
127409
128141
|
const a14 = parseA14ImageExtension(this.ensureArray(extLst["a:ext"]));
|
|
127410
128142
|
if (a14 && applyA14ExtensionToEffects(effects, a14)) {
|
|
127411
|
-
|
|
128143
|
+
hasAny2 = true;
|
|
127412
128144
|
}
|
|
127413
128145
|
}
|
|
127414
|
-
return
|
|
128146
|
+
return hasAny2 ? effects : null;
|
|
127415
128147
|
}
|
|
127416
128148
|
/**
|
|
127417
128149
|
* Resolve a blip `a:fillOverlay/a:gradFill` to the structured gradient a
|
|
@@ -129064,8 +129796,8 @@ function buildTextRunEffectListXml(style, parseColor) {
|
|
|
129064
129796
|
const hasTextHsl = typeof style.textHslHue === "number" || typeof style.textHslSaturation === "number" || typeof style.textHslLuminance === "number";
|
|
129065
129797
|
const hasTextClrChange = Boolean(style.textClrChangeFrom) && Boolean(style.textClrChangeTo);
|
|
129066
129798
|
const hasTextDuotone = Boolean(style.textDuotone);
|
|
129067
|
-
const
|
|
129068
|
-
if (!
|
|
129799
|
+
const hasAny2 = hasTextShadow || hasTextInnerShadow || hasTextPresetShadow || hasTextGlow || hasTextReflection || hasTextBlur || hasTextSoftEdge || hasTextAlphaModFix || hasTextAlphaMod || hasTextHsl || hasTextClrChange || hasTextDuotone;
|
|
129800
|
+
if (!hasAny2) {
|
|
129069
129801
|
return void 0;
|
|
129070
129802
|
}
|
|
129071
129803
|
const effectLst = {};
|
|
@@ -133416,6 +134148,87 @@ var init_table_column_width_save = __esm({
|
|
|
133416
134148
|
}
|
|
133417
134149
|
});
|
|
133418
134150
|
|
|
134151
|
+
// pptx/core/core/runtime/table-style-change-cell-clear.ts
|
|
134152
|
+
function normaliseStyleId(id) {
|
|
134153
|
+
const text2 = typeof id === "string" || typeof id === "number" ? String(id) : "";
|
|
134154
|
+
const trimmed2 = text2.trim().toUpperCase();
|
|
134155
|
+
if (!trimmed2) {
|
|
134156
|
+
return "";
|
|
134157
|
+
}
|
|
134158
|
+
return trimmed2.startsWith("{") ? trimmed2 : `{${trimmed2}}`;
|
|
134159
|
+
}
|
|
134160
|
+
function xmlTableStyleId(tblPr) {
|
|
134161
|
+
if (!tblPr || typeof tblPr !== "object") {
|
|
134162
|
+
return "";
|
|
134163
|
+
}
|
|
134164
|
+
const props = tblPr;
|
|
134165
|
+
const node = props["a:tableStyleId"];
|
|
134166
|
+
const spec = normaliseStyleId(
|
|
134167
|
+
node && typeof node === "object" ? node["#text"] : node
|
|
134168
|
+
);
|
|
134169
|
+
if (spec) {
|
|
134170
|
+
return spec;
|
|
134171
|
+
}
|
|
134172
|
+
const legacy = props["a:tblStyle"];
|
|
134173
|
+
return normaliseStyleId(legacy?.["@_val"] || props["@_tblStyle"]);
|
|
134174
|
+
}
|
|
134175
|
+
function tableStyleIdChanged(tblPr, nextStyleId) {
|
|
134176
|
+
if (nextStyleId === void 0) {
|
|
134177
|
+
return false;
|
|
134178
|
+
}
|
|
134179
|
+
return normaliseStyleId(nextStyleId) !== xmlTableStyleId(tblPr);
|
|
134180
|
+
}
|
|
134181
|
+
function clearCellFormattingForStyleChange(xmlCell, style) {
|
|
134182
|
+
const tcPr = xmlCell["a:tcPr"];
|
|
134183
|
+
if (!tcPr || typeof tcPr !== "object") {
|
|
134184
|
+
return;
|
|
134185
|
+
}
|
|
134186
|
+
const props = tcPr;
|
|
134187
|
+
if (!hasAny(style, FILL_FIELDS)) {
|
|
134188
|
+
for (const key2 of FILL_KEYS) {
|
|
134189
|
+
delete props[key2];
|
|
134190
|
+
}
|
|
134191
|
+
}
|
|
134192
|
+
for (const [key2, fields] of LINE_KEYS) {
|
|
134193
|
+
if (!hasAny(style, fields)) {
|
|
134194
|
+
delete props[key2];
|
|
134195
|
+
}
|
|
134196
|
+
}
|
|
134197
|
+
if (!style?.cell3D) {
|
|
134198
|
+
delete props["a:cell3D"];
|
|
134199
|
+
}
|
|
134200
|
+
}
|
|
134201
|
+
var FILL_KEYS, LINE_KEYS, FILL_FIELDS, hasAny;
|
|
134202
|
+
var init_table_style_change_cell_clear = __esm({
|
|
134203
|
+
"pptx/core/core/runtime/table-style-change-cell-clear.ts"() {
|
|
134204
|
+
FILL_KEYS = [
|
|
134205
|
+
"a:noFill",
|
|
134206
|
+
"a:solidFill",
|
|
134207
|
+
"a:gradFill",
|
|
134208
|
+
"a:blipFill",
|
|
134209
|
+
"a:pattFill",
|
|
134210
|
+
"a:grpFill"
|
|
134211
|
+
];
|
|
134212
|
+
LINE_KEYS = [
|
|
134213
|
+
["a:lnL", ["borderLeftWidth", "borderLeftColor", "borderLeftDash"]],
|
|
134214
|
+
["a:lnR", ["borderRightWidth", "borderRightColor", "borderRightDash"]],
|
|
134215
|
+
["a:lnT", ["borderTopWidth", "borderTopColor", "borderTopDash"]],
|
|
134216
|
+
["a:lnB", ["borderBottomWidth", "borderBottomColor", "borderBottomDash"]],
|
|
134217
|
+
["a:lnTlToBr", ["borderDiagDownWidth", "borderDiagDownColor"]],
|
|
134218
|
+
["a:lnBlToTr", ["borderDiagUpWidth", "borderDiagUpColor"]]
|
|
134219
|
+
];
|
|
134220
|
+
FILL_FIELDS = [
|
|
134221
|
+
"fillMode",
|
|
134222
|
+
"backgroundColor",
|
|
134223
|
+
"gradientFillStops",
|
|
134224
|
+
"patternFillPreset",
|
|
134225
|
+
"backgroundImageFillPath",
|
|
134226
|
+
"backgroundImageFillData"
|
|
134227
|
+
];
|
|
134228
|
+
hasAny = (style, keys) => keys.some((key2) => style?.[key2] !== void 0);
|
|
134229
|
+
}
|
|
134230
|
+
});
|
|
134231
|
+
|
|
133419
134232
|
// pptx/core/core/runtime/table-paragraph-save-order.ts
|
|
133420
134233
|
function runTag(run) {
|
|
133421
134234
|
return run.isLineBreak ? "a:br" : run.isField ? "a:fld" : "a:r";
|
|
@@ -134402,6 +135215,7 @@ var init_table_tblpr_save = __esm({
|
|
|
134402
135215
|
var CHART_DATA_DISPLAY_OPTIONS_EXT_URI, PptxHandlerRuntime24;
|
|
134403
135216
|
var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
134404
135217
|
"pptx/core/core/runtime/PptxHandlerRuntimeSaveDataSerialization.ts"() {
|
|
135218
|
+
init_chart_workbook_data_signature();
|
|
134405
135219
|
init_chart_axis_dispunits_serializer();
|
|
134406
135220
|
init_chart_axis_gridlines_serializer();
|
|
134407
135221
|
init_chart_axis_label_formatting();
|
|
@@ -134453,6 +135267,7 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
134453
135267
|
init_PptxHandlerRuntimeChartUserShapes();
|
|
134454
135268
|
init_save_table_merge_helpers();
|
|
134455
135269
|
init_table_column_width_save();
|
|
135270
|
+
init_table_style_change_cell_clear();
|
|
134456
135271
|
init_table_paragraph_save_order();
|
|
134457
135272
|
init_table_structural_ops();
|
|
134458
135273
|
init_table_tblpr_save();
|
|
@@ -134474,6 +135289,7 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
134474
135289
|
if (!tbl) {
|
|
134475
135290
|
return;
|
|
134476
135291
|
}
|
|
135292
|
+
const styleChanged = tableData.clearDirectCellFormatting === true || tableStyleIdChanged(tbl["a:tblPr"], tableData.tableStyleId);
|
|
134477
135293
|
serializeTablePropertyFlags(tbl, tableData);
|
|
134478
135294
|
writeTablePropertiesOwnFillAndEffects(tbl["a:tblPr"], tableData);
|
|
134479
135295
|
const xmlRows = this.ensureArray(tbl["a:tr"]);
|
|
@@ -134505,6 +135321,9 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
134505
135321
|
if (cell.text !== void 0) {
|
|
134506
135322
|
this.writeTableCellText(xmlCell, cell.text);
|
|
134507
135323
|
}
|
|
135324
|
+
if (styleChanged) {
|
|
135325
|
+
clearCellFormattingForStyleChange(xmlCell, cell.style);
|
|
135326
|
+
}
|
|
134508
135327
|
if (cell.style) {
|
|
134509
135328
|
this.writeTableCellStyle(xmlCell, cell.style, cell.paragraphs);
|
|
134510
135329
|
}
|
|
@@ -134528,6 +135347,9 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
134528
135347
|
if (cell.text !== void 0) {
|
|
134529
135348
|
this.writeTableCellText(xmlCell, cell.text);
|
|
134530
135349
|
}
|
|
135350
|
+
if (styleChanged) {
|
|
135351
|
+
clearCellFormattingForStyleChange(xmlCell, cell.style);
|
|
135352
|
+
}
|
|
134531
135353
|
if (cell.style) {
|
|
134532
135354
|
this.writeTableCellStyle(xmlCell, cell.style, cell.paragraphs);
|
|
134533
135355
|
}
|
|
@@ -134539,8 +135361,6 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
134539
135361
|
console.warn("Failed to serialize table data:", e);
|
|
134540
135362
|
}
|
|
134541
135363
|
}
|
|
134542
|
-
/** Pending chart data updates to process in the async save method. */
|
|
134543
|
-
pendingChartUpdates;
|
|
134544
135364
|
/**
|
|
134545
135365
|
* Record `chartData` as parsed, straight off `enrichChartData`, as this
|
|
134546
135366
|
* chart's load-time baseline. See {@link chartDataBaselines}.
|
|
@@ -134550,6 +135370,10 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
134550
135370
|
return;
|
|
134551
135371
|
}
|
|
134552
135372
|
this.chartDataBaselines.set(chartData.chartPartPath, JSON.stringify(chartData));
|
|
135373
|
+
this.chartWorkbookDataBaselines.set(chartData.chartPartPath, {
|
|
135374
|
+
signature: chartWorkbookDataSignature(chartData),
|
|
135375
|
+
pending: false
|
|
135376
|
+
});
|
|
134553
135377
|
}
|
|
134554
135378
|
/**
|
|
134555
135379
|
* Collect chart data for deferred async processing during save.
|
|
@@ -134566,12 +135390,28 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
134566
135390
|
/**
|
|
134567
135391
|
* Process all pending chart data updates (called from the async save method).
|
|
134568
135392
|
*/
|
|
134569
|
-
async processPendingChartUpdates() {
|
|
135393
|
+
async processPendingChartUpdates(slides) {
|
|
134570
135394
|
if (!this.pendingChartUpdates || this.pendingChartUpdates.length === 0) {
|
|
134571
135395
|
return;
|
|
134572
135396
|
}
|
|
135397
|
+
if (slides) {
|
|
135398
|
+
const current = /* @__PURE__ */ new Map();
|
|
135399
|
+
const visit = (elements3, slidePath) => {
|
|
135400
|
+
for (const element of elements3) {
|
|
135401
|
+
if (element.type === "group") visit(element.children, slidePath);
|
|
135402
|
+
else if (element.type === "chart" && element.chartData?.chartPartPath) {
|
|
135403
|
+
current.set(element.chartData.chartPartPath, {
|
|
135404
|
+
chartData: element.chartData,
|
|
135405
|
+
slidePath
|
|
135406
|
+
});
|
|
135407
|
+
}
|
|
135408
|
+
}
|
|
135409
|
+
};
|
|
135410
|
+
for (const slide of slides) visit(slide.elements, slide.id);
|
|
135411
|
+
this.pendingChartUpdates = [...current.values()];
|
|
135412
|
+
}
|
|
134573
135413
|
for (const { chartData, slidePath } of this.pendingChartUpdates) {
|
|
134574
|
-
if (chartData.chartPartPath && this.chartDataBaselines.get(chartData.chartPartPath) === JSON.stringify(chartData)) {
|
|
135414
|
+
if (chartData.chartPartPath && !this.chartWorkbookDataBaselines.get(chartData.chartPartPath)?.pending && this.chartDataBaselines.get(chartData.chartPartPath) === JSON.stringify(chartData)) {
|
|
134575
135415
|
continue;
|
|
134576
135416
|
}
|
|
134577
135417
|
if (chartData.colorPalette && chartData.colorStylePartPath) {
|
|
@@ -134990,7 +135830,9 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
134990
135830
|
{
|
|
134991
135831
|
title: chartData.title,
|
|
134992
135832
|
hasTitle: chartData.style?.hasTitle,
|
|
134993
|
-
titleRuns: chartData.titleRuns
|
|
135833
|
+
titleRuns: chartData.titleRuns,
|
|
135834
|
+
titleTextOnly: chartData.titleTextOnly,
|
|
135835
|
+
titleTextOnlyStyles: chartData.titleTextOnlyStyles
|
|
134994
135836
|
},
|
|
134995
135837
|
(key2) => this.compatibilityService.getXmlLocalName(key2)
|
|
134996
135838
|
);
|
|
@@ -135182,23 +136024,41 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
135182
136024
|
}
|
|
135183
136025
|
}
|
|
135184
136026
|
await this.syncChartUserShapesToXml(chartSpace, chartData, chartPartPath);
|
|
136027
|
+
const serializedBaseline = this.chartDataBaselines.get(chartPartPath);
|
|
136028
|
+
const signature = chartWorkbookDataSignature(chartData);
|
|
136029
|
+
const workbookBaseline = this.chartWorkbookDataBaselines.get(chartPartPath);
|
|
136030
|
+
const previousSignature = workbookBaseline?.signature ?? (serializedBaseline ? chartWorkbookDataSignature(JSON.parse(serializedBaseline)) : void 0);
|
|
136031
|
+
const workbookDataChanged = workbookBaseline?.pending || signature !== previousSignature;
|
|
136032
|
+
if (workbookDataChanged) {
|
|
136033
|
+
const complete = await saveChartExternalWorkbookUpdates(
|
|
136034
|
+
{
|
|
136035
|
+
zip: this.zip,
|
|
136036
|
+
resolveImagePath: (basePath, target) => this.resolveImagePath(basePath, target),
|
|
136037
|
+
reportWarning: (warning) => this.compatibilityService.reportWarning(warning)
|
|
136038
|
+
},
|
|
136039
|
+
chartPartPath,
|
|
136040
|
+
slidePath,
|
|
136041
|
+
chartData.externalData,
|
|
136042
|
+
workbookWrites,
|
|
136043
|
+
chartData.dataLabelTextOnly ?? false
|
|
136044
|
+
);
|
|
136045
|
+
this.chartWorkbookDataBaselines.set(chartPartPath, {
|
|
136046
|
+
signature: complete ? signature : previousSignature ?? signature,
|
|
136047
|
+
pending: !complete
|
|
136048
|
+
});
|
|
136049
|
+
}
|
|
135185
136050
|
this.zip.file(chartPartPath, this.builder.build(chartXmlData));
|
|
135186
|
-
|
|
135187
|
-
{
|
|
135188
|
-
zip: this.zip,
|
|
135189
|
-
resolveImagePath: (basePath, target) => this.resolveImagePath(basePath, target),
|
|
135190
|
-
reportWarning: (warning) => this.compatibilityService.reportWarning(warning)
|
|
135191
|
-
},
|
|
135192
|
-
chartPartPath,
|
|
135193
|
-
slidePath,
|
|
135194
|
-
chartData.externalData,
|
|
135195
|
-
workbookWrites
|
|
135196
|
-
);
|
|
136051
|
+
this.chartDataBaselines.set(chartPartPath, JSON.stringify(chartData));
|
|
135197
136052
|
} catch (e) {
|
|
136053
|
+
if (chartData.dataLabelTextOnly) {
|
|
136054
|
+
throw e;
|
|
136055
|
+
}
|
|
135198
136056
|
console.warn(`[pptx-save] Failed to serialize chart data for ${chartPartPath}:`, e);
|
|
135199
136057
|
}
|
|
135200
136058
|
}
|
|
135201
|
-
this.pendingChartUpdates =
|
|
136059
|
+
this.pendingChartUpdates = this.pendingChartUpdates.filter(
|
|
136060
|
+
({ chartData }) => chartData.chartPartPath && this.chartWorkbookDataBaselines.get(chartData.chartPartPath)?.pending
|
|
136061
|
+
);
|
|
135202
136062
|
}
|
|
135203
136063
|
/**
|
|
135204
136064
|
* Route a chart save that the 2006 `c:*Chart` update loop cannot handle:
|
|
@@ -143402,22 +144262,44 @@ function drawingNamespace(strict) {
|
|
|
143402
144262
|
var NOTES_MASTER_CONTENT_TYPE, PptxHandlerRuntime50;
|
|
143403
144263
|
var init_PptxHandlerRuntimeSaveNotesInfrastructure = __esm({
|
|
143404
144264
|
"pptx/core/core/runtime/PptxHandlerRuntimeSaveNotesInfrastructure.ts"() {
|
|
144265
|
+
init_relationships();
|
|
143405
144266
|
init_PptxHandlerRuntimeSaveViewProperties();
|
|
143406
144267
|
NOTES_MASTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml";
|
|
143407
144268
|
PptxHandlerRuntime50 = class extends PptxHandlerRuntime49 {
|
|
143408
144269
|
/** Ensure authored notes have the global notes-master OPC infrastructure. */
|
|
143409
144270
|
async ensureNotesMasterForAuthoredNotes(slides, constants) {
|
|
143410
144271
|
const needsNotes = slides.some(
|
|
143411
|
-
(slide) => slide.notes
|
|
144272
|
+
(slide) => Boolean(slide.notes) || Boolean(slide.notesSegments?.some((segment) => segment.text))
|
|
143412
144273
|
);
|
|
143413
144274
|
if (!needsNotes || Object.keys(this.zip.files).some(
|
|
143414
144275
|
(path2) => /^ppt\/notesMasters\/notesMaster\d+\.xml$/u.test(path2)
|
|
143415
144276
|
)) {
|
|
143416
144277
|
return;
|
|
143417
144278
|
}
|
|
144279
|
+
const relsPath2 = "ppt/_rels/presentation.xml.rels";
|
|
144280
|
+
const relsXml = await this.zip.file(relsPath2)?.async("string");
|
|
144281
|
+
if (!relsXml || !this.presentationData) return;
|
|
144282
|
+
if (Array.from(parseRelationships(relsXml).values()).some(
|
|
144283
|
+
(relationship) => relationship.type.endsWith("/notesMaster") && relationship.mode !== "External" && this.zip.file(resolvePartPath("ppt/presentation.xml", relationship.target))
|
|
144284
|
+
))
|
|
144285
|
+
return;
|
|
143418
144286
|
const strict = constants.conformance === "strict";
|
|
143419
144287
|
const masterPath = "ppt/notesMasters/notesMaster1.xml";
|
|
143420
|
-
const
|
|
144288
|
+
const sourceThemePath = Object.keys(this.zip.files).find((path2) => /^ppt\/theme\/theme\d+\.xml$/u.test(path2)) ?? "ppt/theme/theme1.xml";
|
|
144289
|
+
let themeIndex = 1;
|
|
144290
|
+
while (this.zip.file(`ppt/theme/theme${themeIndex}.xml`)) themeIndex += 1;
|
|
144291
|
+
const themePath = `ppt/theme/theme${themeIndex}.xml`;
|
|
144292
|
+
const themeBytes = await this.zip.file(sourceThemePath)?.async("uint8array");
|
|
144293
|
+
const theme = themeBytes ?? this.buildThemeXml(themePath, void 0);
|
|
144294
|
+
if (!theme) throw new Error("Cannot create a notes theme from the presentation state");
|
|
144295
|
+
this.zip.file(themePath, theme);
|
|
144296
|
+
const themeRelationships = await this.zip.file(`ppt/theme/_rels/${sourceThemePath.slice(sourceThemePath.lastIndexOf("/") + 1)}.rels`)?.async("uint8array");
|
|
144297
|
+
if (themeRelationships)
|
|
144298
|
+
this.zip.file(`ppt/theme/_rels/theme${themeIndex}.xml.rels`, themeRelationships);
|
|
144299
|
+
await this.addContentTypeOverride(
|
|
144300
|
+
`/${themePath}`,
|
|
144301
|
+
"application/vnd.openxmlformats-officedocument.theme+xml"
|
|
144302
|
+
);
|
|
143421
144303
|
this.zip.file(masterPath, this.builder.build(this.buildDefaultNotesMaster(strict)));
|
|
143422
144304
|
this.zip.file(
|
|
143423
144305
|
"ppt/notesMasters/_rels/notesMaster1.xml.rels",
|
|
@@ -143432,11 +144314,6 @@ var init_PptxHandlerRuntimeSaveNotesInfrastructure = __esm({
|
|
|
143432
144314
|
}
|
|
143433
144315
|
})
|
|
143434
144316
|
);
|
|
143435
|
-
const relsPath2 = "ppt/_rels/presentation.xml.rels";
|
|
143436
|
-
const relsXml = await this.zip.file(relsPath2)?.async("string");
|
|
143437
|
-
if (!relsXml || !this.presentationData) {
|
|
143438
|
-
return;
|
|
143439
|
-
}
|
|
143440
144317
|
const relsData = this.parser.parse(relsXml);
|
|
143441
144318
|
const relsRoot = relsData["Relationships"] ?? {};
|
|
143442
144319
|
const relationships2 = asArray7(relsRoot["Relationship"]);
|
|
@@ -144171,7 +145048,7 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
|
|
|
144171
145048
|
saveSession,
|
|
144172
145049
|
saveConstants
|
|
144173
145050
|
);
|
|
144174
|
-
await this.processPendingChartUpdates();
|
|
145051
|
+
await this.processPendingChartUpdates(slides);
|
|
144175
145052
|
await this.ensureChartPartContentTypes();
|
|
144176
145053
|
await this.ensureOleEmbeddingContentTypes();
|
|
144177
145054
|
await this.processPendingOleContentUpdates();
|
|
@@ -145147,6 +146024,7 @@ var PptxHandlerRuntime60;
|
|
|
145147
146024
|
var init_PptxHandlerRuntimeGeometryParsing = __esm({
|
|
145148
146025
|
"pptx/core/core/runtime/PptxHandlerRuntimeGeometryParsing.ts"() {
|
|
145149
146026
|
init_color_primitives();
|
|
146027
|
+
init_custom_geometry_command_order();
|
|
145150
146028
|
init_custom_geometry_parser();
|
|
145151
146029
|
init_guide_formula();
|
|
145152
146030
|
init_PptxHandlerRuntimePlaceholderLookup();
|
|
@@ -145308,6 +146186,10 @@ var init_PptxHandlerRuntimeGeometryParsing = __esm({
|
|
|
145308
146186
|
const pathLst = custGeom["a:pathLst"];
|
|
145309
146187
|
if (isNonEmpty(pathLst)) {
|
|
145310
146188
|
result.pathLstXml = pathLst;
|
|
146189
|
+
const pathCommandOrder = readPathListCommandOrder(pathLst);
|
|
146190
|
+
if (pathCommandOrder) {
|
|
146191
|
+
result.pathCommandOrder = pathCommandOrder;
|
|
146192
|
+
}
|
|
145311
146193
|
}
|
|
145312
146194
|
return Object.keys(result).length > 0 ? result : void 0;
|
|
145313
146195
|
}
|
|
@@ -146218,7 +147100,7 @@ var init_PptxHandlerRuntimeShapeBodyParsing = __esm({
|
|
|
146218
147100
|
return void 0;
|
|
146219
147101
|
}
|
|
146220
147102
|
const locks = {};
|
|
146221
|
-
let
|
|
147103
|
+
let hasAny2 = false;
|
|
146222
147104
|
const boolAttr2 = (attr6) => {
|
|
146223
147105
|
const raw = spLocks[attr6];
|
|
146224
147106
|
if (raw === void 0) {
|
|
@@ -146231,7 +147113,7 @@ var init_PptxHandlerRuntimeShapeBodyParsing = __esm({
|
|
|
146231
147113
|
const val = boolAttr2(attr6);
|
|
146232
147114
|
if (val !== void 0) {
|
|
146233
147115
|
fn(val);
|
|
146234
|
-
|
|
147116
|
+
hasAny2 = true;
|
|
146235
147117
|
}
|
|
146236
147118
|
};
|
|
146237
147119
|
set2("@_noGrp", (v) => {
|
|
@@ -146270,7 +147152,7 @@ var init_PptxHandlerRuntimeShapeBodyParsing = __esm({
|
|
|
146270
147152
|
set2("@_noCrop", (v) => {
|
|
146271
147153
|
locks.noCrop = v;
|
|
146272
147154
|
});
|
|
146273
|
-
return
|
|
147155
|
+
return hasAny2 ? locks : void 0;
|
|
146274
147156
|
}
|
|
146275
147157
|
/**
|
|
146276
147158
|
* Parse the `@txBox` attribute from a `p:cNvSpPr` node. Returns `true` /
|
|
@@ -154182,6 +155064,7 @@ var init_PptxHandlerRuntimeChartExternalData = __esm({
|
|
|
154182
155064
|
);
|
|
154183
155065
|
const autoUpdateAttr = externalDataNode["@_autoUpdate"];
|
|
154184
155066
|
const autoUpdate = autoUpdateNode?.["@_val"] === "1" || autoUpdateNode?.["@_val"] === "true" || autoUpdateAttr === "1" || autoUpdateAttr === "true" || false;
|
|
155067
|
+
let isExternal = false;
|
|
154185
155068
|
let targetPath;
|
|
154186
155069
|
try {
|
|
154187
155070
|
const chartDir = chartPartPath.substring(0, chartPartPath.lastIndexOf("/") + 1);
|
|
@@ -154196,6 +155079,7 @@ var init_PptxHandlerRuntimeChartExternalData = __esm({
|
|
|
154196
155079
|
for (const rel of rels) {
|
|
154197
155080
|
if (String(rel?.["@_Id"] || "") === relId) {
|
|
154198
155081
|
targetPath = String(rel?.["@_Target"] || "").trim() || void 0;
|
|
155082
|
+
isExternal = String(rel?.["@_TargetMode"] || "") === "External";
|
|
154199
155083
|
break;
|
|
154200
155084
|
}
|
|
154201
155085
|
}
|
|
@@ -154204,7 +155088,7 @@ var init_PptxHandlerRuntimeChartExternalData = __esm({
|
|
|
154204
155088
|
} catch {
|
|
154205
155089
|
}
|
|
154206
155090
|
let embeddedWorkbookData;
|
|
154207
|
-
if (targetPath) {
|
|
155091
|
+
if (targetPath && !isExternal) {
|
|
154208
155092
|
try {
|
|
154209
155093
|
const embeddingPath = this.resolveImagePath(chartPartPath, targetPath);
|
|
154210
155094
|
if (embeddingPath.includes("embeddings/") && embeddingPath.endsWith(".xlsx")) {
|
|
@@ -154218,6 +155102,7 @@ var init_PptxHandlerRuntimeChartExternalData = __esm({
|
|
|
154218
155102
|
}
|
|
154219
155103
|
return {
|
|
154220
155104
|
relId,
|
|
155105
|
+
...isExternal ? { isExternal: true } : {},
|
|
154221
155106
|
targetPath,
|
|
154222
155107
|
autoUpdate,
|
|
154223
155108
|
...embeddedWorkbookData ? { embeddedWorkbookData } : {}
|
|
@@ -154588,6 +155473,8 @@ var init_PptxHandlerRuntimeChartExParsing = __esm({
|
|
|
154588
155473
|
...result.categoryLevels ? { categoryLevels: result.categoryLevels } : {},
|
|
154589
155474
|
series: result.series,
|
|
154590
155475
|
title: cxTitleText,
|
|
155476
|
+
titleTextEditable: false,
|
|
155477
|
+
dataLabelTextEditable: false,
|
|
154591
155478
|
style: chartStyle2,
|
|
154592
155479
|
chartPartPath,
|
|
154593
155480
|
chartRelationshipId,
|
|
@@ -154611,6 +155498,7 @@ var init_PptxHandlerRuntimeChartExParsing = __esm({
|
|
|
154611
155498
|
var PptxHandlerRuntime95;
|
|
154612
155499
|
var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
154613
155500
|
"pptx/core/core/runtime/PptxHandlerRuntimeChartParsing.ts"() {
|
|
155501
|
+
init_chart_label_source();
|
|
154614
155502
|
init_chart_advanced_parser();
|
|
154615
155503
|
init_chart_axis_parser();
|
|
154616
155504
|
init_chart_band_fmts();
|
|
@@ -154801,12 +155689,34 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
|
154801
155689
|
colorAdapter
|
|
154802
155690
|
);
|
|
154803
155691
|
const style = chartStyleFromNeutral(neutral, this.extractChartStyle(chartSpace, chartRoot));
|
|
155692
|
+
const titleTx = reader2.xml.getChildByLocalName(
|
|
155693
|
+
reader2.xml.getChildByLocalName(chartRoot, "title"),
|
|
155694
|
+
"tx"
|
|
155695
|
+
);
|
|
155696
|
+
const titleRich = reader2.xml.getChildByLocalName(titleTx, "rich");
|
|
155697
|
+
const titleParagraphs = reader2.xml.getChildrenArrayByLocalName(titleRich, "p");
|
|
155698
|
+
const titleTextEditable = Boolean(
|
|
155699
|
+
titleRuns?.length && titleParagraphs.length === 1 && !Object.keys(titleParagraphs[0] ?? {}).some(
|
|
155700
|
+
(key2) => ["br", "fld"].includes(reader2.localName(key2))
|
|
155701
|
+
)
|
|
155702
|
+
);
|
|
154804
155703
|
const groupOptions = groupOptionsFromNeutral(groups[0]?.group, chartType);
|
|
154805
155704
|
const linesAndChrome = this.readChartLinesAndChrome(neutral, tree, groups, reader2);
|
|
154806
155705
|
const facts = await this.readChartPartFacts(chartSpace, chartRoot, chartPartPath);
|
|
154807
155706
|
const workbook = facts.embeddedWorkbookData;
|
|
154808
155707
|
const dateCategories = rawDateCategories ? { ...rawDateCategories, date1904: neutral.date1904 ?? workbook?.date1904 ?? false } : void 0;
|
|
154809
155708
|
const filled = applyEmbeddedWorkbookFallback(chartType, categories, built.series, workbook);
|
|
155709
|
+
const dataLabelTextEditable = !categoryLevels && !dateCategories && await chartLabelsHaveEditableSources(
|
|
155710
|
+
reader2.xml,
|
|
155711
|
+
this.zip,
|
|
155712
|
+
chartSpace,
|
|
155713
|
+
built.seriesNodes,
|
|
155714
|
+
filled.series,
|
|
155715
|
+
filled.categories,
|
|
155716
|
+
facts.externalData,
|
|
155717
|
+
chartPartPath,
|
|
155718
|
+
this.resolveImagePath.bind(this)
|
|
155719
|
+
);
|
|
154810
155720
|
const hasPicture = filled.series.some(
|
|
154811
155721
|
(entry2) => entry2.picture || entry2.impliedPicture || entry2.dataPoints?.some((point2) => point2.picture || point2.impliedPicture)
|
|
154812
155722
|
);
|
|
@@ -154839,6 +155749,14 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
|
154839
155749
|
...built.filtered,
|
|
154840
155750
|
title: neutralTitleText(neutral.title),
|
|
154841
155751
|
...titleRuns ? { titleRuns } : {},
|
|
155752
|
+
titleTextEditable,
|
|
155753
|
+
dataLabelTextEditable,
|
|
155754
|
+
...dataLabelTextEditable ? {
|
|
155755
|
+
dataLabelSourceShape: {
|
|
155756
|
+
categoryCount: filled.categories.length,
|
|
155757
|
+
seriesValueCounts: filled.series.map((series) => series.values.length)
|
|
155758
|
+
}
|
|
155759
|
+
} : {},
|
|
154842
155760
|
style,
|
|
154843
155761
|
grouping: groupOptions.grouping,
|
|
154844
155762
|
...groupOptions,
|
|
@@ -154862,13 +155780,15 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
|
154862
155780
|
});
|
|
154863
155781
|
|
|
154864
155782
|
// pptx/core/core/runtime/PptxHandlerRuntimePresentationStructure.ts
|
|
154865
|
-
var PptxHandlerRuntime96;
|
|
155783
|
+
var XSD_INT_MIN, XSD_INT_MAX, PptxHandlerRuntime96;
|
|
154866
155784
|
var init_PptxHandlerRuntimePresentationStructure = __esm({
|
|
154867
155785
|
"pptx/core/core/runtime/PptxHandlerRuntimePresentationStructure.ts"() {
|
|
154868
155786
|
init_kinsoku_parser();
|
|
154869
155787
|
init_presentation_section_parser();
|
|
154870
155788
|
init_header_footer_parts();
|
|
154871
155789
|
init_PptxHandlerRuntimeChartParsing();
|
|
155790
|
+
XSD_INT_MIN = -2147483648;
|
|
155791
|
+
XSD_INT_MAX = 2147483647;
|
|
154872
155792
|
PptxHandlerRuntime96 = class extends PptxHandlerRuntime95 {
|
|
154873
155793
|
parseEditorAnimations(slideXml3) {
|
|
154874
155794
|
return this.editorAnimationService.parseEditorAnimations(slideXml3);
|
|
@@ -155051,6 +155971,22 @@ var init_PptxHandlerRuntimePresentationStructure = __esm({
|
|
|
155051
155971
|
const lexical = String(raw).trim().toLowerCase();
|
|
155052
155972
|
return lexical !== "0" && lexical !== "false";
|
|
155053
155973
|
}
|
|
155974
|
+
/**
|
|
155975
|
+
* Extract `p:presentation/@firstSlideNum` (ECMA-376 §19.2.1.26, an
|
|
155976
|
+
* `xsd:int`). `undefined` when absent, not an integer, or outside the
|
|
155977
|
+
* `xsd:int` range (-2147483648 to 2147483647, which also rejects digit
|
|
155978
|
+
* strings too long to parse), so the spec default (`1`) is never forced
|
|
155979
|
+
* onto the typed model.
|
|
155980
|
+
*/
|
|
155981
|
+
extractFirstSlideNumber() {
|
|
155982
|
+
const pres = this.presentationData?.["p:presentation"];
|
|
155983
|
+
const lexical = String(pres?.["@_firstSlideNum"] ?? "").trim();
|
|
155984
|
+
if (!/^[+-]?\d+$/.test(lexical)) {
|
|
155985
|
+
return void 0;
|
|
155986
|
+
}
|
|
155987
|
+
const value = Number(lexical);
|
|
155988
|
+
return value >= XSD_INT_MIN && value <= XSD_INT_MAX ? value : void 0;
|
|
155989
|
+
}
|
|
155054
155990
|
};
|
|
155055
155991
|
}
|
|
155056
155992
|
});
|
|
@@ -155298,7 +156234,7 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
155298
156234
|
);
|
|
155299
156235
|
}
|
|
155300
156236
|
try {
|
|
155301
|
-
this.zip = await
|
|
156237
|
+
this.zip = await JSZip17__default.default.loadAsync(data);
|
|
155302
156238
|
this.documentPropertiesUpdater = this.dependencyFactory.createDocumentPropertiesUpdater(
|
|
155303
156239
|
this.zip,
|
|
155304
156240
|
this.parser,
|
|
@@ -155336,6 +156272,8 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
155336
156272
|
this.slideMap.clear();
|
|
155337
156273
|
this.savedSlideFingerprints.clear();
|
|
155338
156274
|
this.chartDataBaselines.clear();
|
|
156275
|
+
this.chartWorkbookDataBaselines.clear();
|
|
156276
|
+
this.pendingChartUpdates = void 0;
|
|
155339
156277
|
this.layoutCache.clear();
|
|
155340
156278
|
this.masterCache.clear();
|
|
155341
156279
|
this.templateElementBaselines.reset();
|
|
@@ -155719,7 +156657,7 @@ var init_PptxHandlerRuntimeLoadPipeline = __esm({
|
|
|
155719
156657
|
this.commentAuthorDetails.size > 0 ? Array.from(this.commentAuthorDetails.values()) : void 0
|
|
155720
156658
|
).withModernCommentAuthors(
|
|
155721
156659
|
this.modernCommentAuthors.size > 0 ? Array.from(this.modernCommentAuthors.values()) : void 0
|
|
155722
|
-
).withConformance(this.isStrictOoxml ? "strict" : "transitional").withEmbedTrueTypeFonts(embedTrueTypeFonts).withDefaultTextStyle(defaultTextStyle).build();
|
|
156660
|
+
).withConformance(this.isStrictOoxml ? "strict" : "transitional").withEmbedTrueTypeFonts(embedTrueTypeFonts).withFirstSlideNumber(this.extractFirstSlideNumber()).withDefaultTextStyle(defaultTextStyle).build();
|
|
155723
156661
|
}
|
|
155724
156662
|
/**
|
|
155725
156663
|
* Walk the raw XML of every slide to find the highest numeric `@_id`
|
|
@@ -155825,6 +156763,8 @@ var init_PptxHandlerRuntimeLoadPipeline = __esm({
|
|
|
155825
156763
|
this.slideMap.clear();
|
|
155826
156764
|
this.savedSlideFingerprints.clear();
|
|
155827
156765
|
this.chartDataBaselines.clear();
|
|
156766
|
+
this.chartWorkbookDataBaselines.clear();
|
|
156767
|
+
this.pendingChartUpdates = void 0;
|
|
155828
156768
|
this.slideRelsMap.clear();
|
|
155829
156769
|
this.externalRelsMap.clear();
|
|
155830
156770
|
this.layoutCache.clear();
|
|
@@ -156223,7 +157163,7 @@ var init_PptxHandlerRuntimeImplementation = __esm({
|
|
|
156223
157163
|
constructor(dependencyFactory = new exports.PptxRuntimeDependencyFactory()) {
|
|
156224
157164
|
super();
|
|
156225
157165
|
this.dependencyFactory = dependencyFactory;
|
|
156226
|
-
this.zip = new
|
|
157166
|
+
this.zip = new JSZip17__default.default();
|
|
156227
157167
|
this.parser = this.dependencyFactory.createParser();
|
|
156228
157168
|
this.builder = this.dependencyFactory.createBuilder();
|
|
156229
157169
|
this.elementXmlBuilder = new exports.PptxElementXmlBuilder({
|
|
@@ -159295,7 +160235,7 @@ function collectPictureIndexes(slide) {
|
|
|
159295
160235
|
return indexes;
|
|
159296
160236
|
}
|
|
159297
160237
|
async function buildPptxPackage(deck) {
|
|
159298
|
-
const zip = new
|
|
160238
|
+
const zip = new JSZip17__default.default();
|
|
159299
160239
|
const usage = { fileNumbers: /* @__PURE__ */ new Map() };
|
|
159300
160240
|
let mediaCounter = 0;
|
|
159301
160241
|
for (const slide of deck.slides) {
|
|
@@ -160139,7 +161079,10 @@ var init_PptxHandler = __esm({
|
|
|
160139
161079
|
const imported = deserializePptxFromJson(text2);
|
|
160140
161080
|
const blankBytes = await buildBlankPresentationArchive({
|
|
160141
161081
|
width: imported.widthEmu,
|
|
160142
|
-
height: imported.heightEmu
|
|
161082
|
+
height: imported.heightEmu,
|
|
161083
|
+
// Saving writes presentation.xml from the loaded archive, not from
|
|
161084
|
+
// the overlaid model, so the archive must carry the value itself.
|
|
161085
|
+
firstSlideNumber: imported.firstSlideNumber
|
|
160143
161086
|
});
|
|
160144
161087
|
const base = await super.load(blankBytes, options);
|
|
160145
161088
|
return applyImportedPptxData(base, imported);
|
|
@@ -161472,11 +162415,16 @@ function duplicateSlide(slide, newSlideNumber) {
|
|
|
161472
162415
|
cloned.elements = cloned.elements.map(reassignElementId);
|
|
161473
162416
|
if (cloned.animations && cloned.animations.length > 0) {
|
|
161474
162417
|
const idMap = /* @__PURE__ */ new Map();
|
|
161475
|
-
|
|
161476
|
-
|
|
161477
|
-
|
|
161478
|
-
|
|
161479
|
-
|
|
162418
|
+
const mapElements = (originals, copies) => {
|
|
162419
|
+
originals.forEach((original, index) => {
|
|
162420
|
+
const copy2 = copies[index];
|
|
162421
|
+
if (!copy2) return;
|
|
162422
|
+
idMap.set(original.id, copy2.id);
|
|
162423
|
+
if (original.type === "group" && copy2.type === "group")
|
|
162424
|
+
mapElements(original.children, copy2.children);
|
|
162425
|
+
});
|
|
162426
|
+
};
|
|
162427
|
+
mapElements(slide.elements, cloned.elements);
|
|
161480
162428
|
cloned.animations = cloned.animations.map((anim) => ({
|
|
161481
162429
|
...anim,
|
|
161482
162430
|
elementId: idMap.get(anim.elementId) ?? anim.elementId
|
|
@@ -162101,7 +163049,7 @@ async function addLayoutContentType(zip, layoutIndex2) {
|
|
|
162101
163049
|
}
|
|
162102
163050
|
async function createLayout(handler, data, definition, masterIndex = 1) {
|
|
162103
163051
|
const bytes = await handler.save(data.slides);
|
|
162104
|
-
const zip = await
|
|
163052
|
+
const zip = await JSZip17__default.default.loadAsync(bytes);
|
|
162105
163053
|
const existingCount = countExistingLayouts(zip);
|
|
162106
163054
|
const newIndex = existingCount + 1;
|
|
162107
163055
|
const layoutPath = `ppt/slideLayouts/slideLayout${newIndex}.xml`;
|
|
@@ -162124,7 +163072,7 @@ async function createLayouts(handler, data, definitions, masterIndex = 1) {
|
|
|
162124
163072
|
return { layoutPaths: [], handler, data };
|
|
162125
163073
|
}
|
|
162126
163074
|
const bytes = await handler.save(data.slides);
|
|
162127
|
-
const zip = await
|
|
163075
|
+
const zip = await JSZip17__default.default.loadAsync(bytes);
|
|
162128
163076
|
const existingCount = countExistingLayouts(zip);
|
|
162129
163077
|
const layoutPaths = [];
|
|
162130
163078
|
for (let i2 = 0; i2 < definitions.length; i2++) {
|
|
@@ -162230,7 +163178,7 @@ init_xml_utils();
|
|
|
162230
163178
|
init_PptxHandler();
|
|
162231
163179
|
async function saveToZip(handler, data) {
|
|
162232
163180
|
const bytes = await handler.save(data.slides);
|
|
162233
|
-
return
|
|
163181
|
+
return JSZip17__default.default.loadAsync(bytes);
|
|
162234
163182
|
}
|
|
162235
163183
|
async function reload(zip) {
|
|
162236
163184
|
const buffer = await zip.generateAsync({ type: "arraybuffer" });
|
|
@@ -164461,6 +165409,234 @@ function getThemePreset(name) {
|
|
|
164461
165409
|
return ThemePresets[name];
|
|
164462
165410
|
}
|
|
164463
165411
|
|
|
165412
|
+
// pptx/core/builders/sdk/import-slide-package.ts
|
|
165413
|
+
init_PresentationBuilder();
|
|
165414
|
+
init_PptxHandler();
|
|
165415
|
+
init_clone_part_graph();
|
|
165416
|
+
init_relationships();
|
|
165417
|
+
init_xml2();
|
|
165418
|
+
async function importSlidePackage(destination, source, options = {}) {
|
|
165419
|
+
if (options.insertAt !== void 0 && (!Number.isInteger(options.insertAt) || !Number.isFinite(options.insertAt)))
|
|
165420
|
+
throw new Error("Insertion point must be a finite integer");
|
|
165421
|
+
const [zip, sourceZip] = await Promise.all([
|
|
165422
|
+
JSZip17__default.default.loadAsync(destination),
|
|
165423
|
+
JSZip17__default.default.loadAsync(source)
|
|
165424
|
+
]);
|
|
165425
|
+
const presentationPath = "ppt/presentation.xml";
|
|
165426
|
+
const sourceDoc = parseXml(await requiredXml(sourceZip, presentationPath));
|
|
165427
|
+
const destinationDoc = parseXml(await requiredXml(zip, presentationPath));
|
|
165428
|
+
const sourceRoot = sourceDoc.documentElement, root = destinationDoc.documentElement;
|
|
165429
|
+
const ns = root.namespaceURI ?? "";
|
|
165430
|
+
if (sourceRoot.namespaceURI !== ns)
|
|
165431
|
+
throw new Error("Cannot import slides between Strict and Transitional packages");
|
|
165432
|
+
const sourceSize = first(sourceRoot, "sldSz", ns), size = first(root, "sldSz", ns);
|
|
165433
|
+
if (sourceSize?.getAttribute("cx") !== size?.getAttribute("cx") || sourceSize?.getAttribute("cy") !== size?.getAttribute("cy"))
|
|
165434
|
+
throw new Error("Cannot import slides with a different slide size");
|
|
165435
|
+
if (first(sourceRoot, "embeddedFontLst", ns))
|
|
165436
|
+
throw new Error("Cross-deck embedded fonts are not supported");
|
|
165437
|
+
const relationshipNs = ns === "http://purl.oclc.org/ooxml/presentationml/main" ? "http://purl.oclc.org/ooxml/officeDocument/relationships" : "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
165438
|
+
const presentationRels = relationshipsPartFor(presentationPath);
|
|
165439
|
+
const sourceRels = parseRelationships(await requiredXml(sourceZip, presentationRels));
|
|
165440
|
+
for (const relationship of sourceRels.values()) {
|
|
165441
|
+
if (!relationship.type.endsWith("/tableStyles") || relationship.mode === "External") continue;
|
|
165442
|
+
const styles = parseXml(
|
|
165443
|
+
await requiredXml(sourceZip, resolvePartPath(presentationPath, relationship.target))
|
|
165444
|
+
);
|
|
165445
|
+
if (elements(styles.documentElement).some((node) => node.localName === "tblStyle"))
|
|
165446
|
+
throw new Error("Cross-deck custom table styles are not supported");
|
|
165447
|
+
}
|
|
165448
|
+
const destinationRels = parseRelationships(await requiredXml(zip, presentationRels));
|
|
165449
|
+
const masterIds = Array.from(root.getElementsByTagNameNS(ns, "sldMasterId")).map(
|
|
165450
|
+
(entry2) => entry2.getAttribute("id")
|
|
165451
|
+
);
|
|
165452
|
+
for (const relationship of destinationRels.values()) {
|
|
165453
|
+
if (!relationship.type.endsWith("/slideMaster") || relationship.mode === "External") continue;
|
|
165454
|
+
const master = parseXml(
|
|
165455
|
+
await requiredXml(zip, resolvePartPath(presentationPath, relationship.target))
|
|
165456
|
+
);
|
|
165457
|
+
for (const entry2 of Array.from(master.getElementsByTagNameNS(ns, "sldLayoutId")))
|
|
165458
|
+
masterIds.push(entry2.getAttribute("id"));
|
|
165459
|
+
}
|
|
165460
|
+
const allocateMasterId = nativeIdAllocator(masterIds, 2147483648, 4294967295, "master/layout");
|
|
165461
|
+
const masterParts = /* @__PURE__ */ new Map();
|
|
165462
|
+
for (const relationship of sourceRels.values()) {
|
|
165463
|
+
const type = relationship.type.slice(relationship.type.lastIndexOf("/") + 1);
|
|
165464
|
+
if ((type === "slideMaster" || type === "notesMaster") && relationship.mode !== "External")
|
|
165465
|
+
masterParts.set(resolvePartPath(presentationPath, relationship.target), type);
|
|
165466
|
+
}
|
|
165467
|
+
const sourceSlides = elements(first(sourceRoot, "sldIdLst", ns) ?? sourceRoot).filter(
|
|
165468
|
+
(node) => node.localName === "sldId"
|
|
165469
|
+
);
|
|
165470
|
+
const indexes = options.slideIndices ?? sourceSlides.map((_, index) => index);
|
|
165471
|
+
if (indexes.some(
|
|
165472
|
+
(index) => !Number.isInteger(index) || index < 0 || index >= sourceSlides.length
|
|
165473
|
+
) || new Set(indexes).size !== indexes.length)
|
|
165474
|
+
throw new Error("Source slide indexes must be unique valid integers");
|
|
165475
|
+
if (!indexes.length) return { bytes: new Uint8Array(destination), slidePaths: [] };
|
|
165476
|
+
const selected = indexes.map((index) => {
|
|
165477
|
+
const rel = sourceRels.get(
|
|
165478
|
+
sourceSlides[index].getAttributeNS(relationshipNs, "id") ?? sourceSlides[index].getAttribute("r:id") ?? ""
|
|
165479
|
+
);
|
|
165480
|
+
if (!rel || rel.mode === "External") throw new Error("Source slide relationship is missing");
|
|
165481
|
+
return resolvePartPath(presentationPath, rel.target);
|
|
165482
|
+
});
|
|
165483
|
+
const selectedSet = new Set(selected), copies = /* @__PURE__ */ new Map();
|
|
165484
|
+
const reserved = new Set(Object.keys(zip.files));
|
|
165485
|
+
for (const path2 of selected) {
|
|
165486
|
+
let index = 1;
|
|
165487
|
+
while (reserved.has(`ppt/slides/slide${index}.xml`)) index++;
|
|
165488
|
+
const newPath = `ppt/slides/slide${index}.xml`;
|
|
165489
|
+
reserved.add(newPath);
|
|
165490
|
+
copies.set(path2, newPath);
|
|
165491
|
+
const bytes = await sourceZip.file(path2)?.async("uint8array");
|
|
165492
|
+
if (!bytes) throw new Error(`Source slide is missing: ${path2}`);
|
|
165493
|
+
zip.file(newPath, bytes);
|
|
165494
|
+
}
|
|
165495
|
+
for (const path2 of selected) {
|
|
165496
|
+
await clonePartGraph({
|
|
165497
|
+
zip,
|
|
165498
|
+
sourceZip,
|
|
165499
|
+
copies,
|
|
165500
|
+
sourcePart: path2,
|
|
165501
|
+
targetPart: copies.get(path2),
|
|
165502
|
+
shouldClone: (rel, part) => {
|
|
165503
|
+
const type = rel.type.slice(rel.type.lastIndexOf("/") + 1);
|
|
165504
|
+
if (type === "slideMaster" || type === "notesMaster") masterParts.set(part, type);
|
|
165505
|
+
if (/comment/iu.test(type)) throw new Error("Cross-deck comments are not supported");
|
|
165506
|
+
if (type === "slide" && !selectedSet.has(part))
|
|
165507
|
+
throw new Error("An imported slide links to a slide outside the selected set");
|
|
165508
|
+
return true;
|
|
165509
|
+
}
|
|
165510
|
+
});
|
|
165511
|
+
}
|
|
165512
|
+
const slideList = first(root, "sldIdLst", ns) ?? destinationDoc.createElementNS(ns, "p:sldIdLst");
|
|
165513
|
+
if (!slideList.parentNode) root.insertBefore(slideList, first(root, "sldSz", ns) ?? null);
|
|
165514
|
+
const existingSlides = elements(slideList);
|
|
165515
|
+
const insertAt3 = Math.min(
|
|
165516
|
+
Math.max(0, options.insertAt ?? existingSlides.length),
|
|
165517
|
+
existingSlides.length
|
|
165518
|
+
);
|
|
165519
|
+
const allocateSlideId = nativeIdAllocator(
|
|
165520
|
+
existingSlides.map((node) => node.getAttribute("id")),
|
|
165521
|
+
256,
|
|
165522
|
+
2147483647,
|
|
165523
|
+
"slide"
|
|
165524
|
+
);
|
|
165525
|
+
const used = new Set(destinationRels.keys());
|
|
165526
|
+
const register = (part, type) => {
|
|
165527
|
+
const id = nextRelationshipId(used);
|
|
165528
|
+
used.add(id);
|
|
165529
|
+
destinationRels.set(id, {
|
|
165530
|
+
id,
|
|
165531
|
+
type: `${relationshipNs}/${type}`,
|
|
165532
|
+
target: relativePartTarget(presentationPath, part),
|
|
165533
|
+
mode: "Internal"
|
|
165534
|
+
});
|
|
165535
|
+
return id;
|
|
165536
|
+
};
|
|
165537
|
+
const appendEntry = (list2, localName29, relationshipId2, id) => {
|
|
165538
|
+
const entry2 = destinationDoc.createElementNS(ns, `p:${localName29}`);
|
|
165539
|
+
if (id !== void 0) entry2.setAttribute("id", String(id));
|
|
165540
|
+
entry2.setAttributeNS(relationshipNs, "r:id", relationshipId2);
|
|
165541
|
+
list2.appendChild(entry2);
|
|
165542
|
+
return entry2;
|
|
165543
|
+
};
|
|
165544
|
+
for (const path2 of selected) {
|
|
165545
|
+
const entry2 = appendEntry(
|
|
165546
|
+
slideList,
|
|
165547
|
+
"sldId",
|
|
165548
|
+
register(copies.get(path2), "slide"),
|
|
165549
|
+
allocateSlideId()
|
|
165550
|
+
);
|
|
165551
|
+
slideList.insertBefore(entry2, existingSlides[insertAt3] ?? null);
|
|
165552
|
+
}
|
|
165553
|
+
let masterList = first(root, "sldMasterIdLst", ns);
|
|
165554
|
+
for (const [original, copied] of copies) {
|
|
165555
|
+
if (masterParts.get(original) !== "slideMaster") continue;
|
|
165556
|
+
if (!masterList) {
|
|
165557
|
+
masterList = destinationDoc.createElementNS(ns, "p:sldMasterIdLst");
|
|
165558
|
+
root.insertBefore(masterList, root.firstChild);
|
|
165559
|
+
}
|
|
165560
|
+
appendEntry(masterList, "sldMasterId", register(copied, "slideMaster"), allocateMasterId());
|
|
165561
|
+
const master = parseXml(await requiredXml(zip, copied));
|
|
165562
|
+
for (const entry2 of Array.from(master.getElementsByTagNameNS(ns, "sldLayoutId")))
|
|
165563
|
+
entry2.setAttribute("id", String(allocateMasterId()));
|
|
165564
|
+
zip.file(copied, buildXml(master));
|
|
165565
|
+
}
|
|
165566
|
+
let notesMasterList = first(root, "notesMasterIdLst", ns);
|
|
165567
|
+
for (const [original, copied] of copies) {
|
|
165568
|
+
if (masterParts.get(original) !== "notesMaster") continue;
|
|
165569
|
+
if (!notesMasterList) {
|
|
165570
|
+
notesMasterList = destinationDoc.createElementNS(ns, "p:notesMasterIdLst");
|
|
165571
|
+
root.insertBefore(notesMasterList, first(root, "handoutMasterIdLst", ns) ?? slideList);
|
|
165572
|
+
}
|
|
165573
|
+
appendEntry(notesMasterList, "notesMasterId", register(copied, "notesMaster"));
|
|
165574
|
+
}
|
|
165575
|
+
zip.file(presentationPath, buildXml(destinationDoc));
|
|
165576
|
+
zip.file(presentationRels, buildRelationshipsXml(destinationRels));
|
|
165577
|
+
return {
|
|
165578
|
+
bytes: await zip.generateAsync({ type: "uint8array" }),
|
|
165579
|
+
slidePaths: selected.map((path2) => copies.get(path2))
|
|
165580
|
+
};
|
|
165581
|
+
}
|
|
165582
|
+
async function requiredXml(zip, path2) {
|
|
165583
|
+
const text2 = await zip.file(path2)?.async("string");
|
|
165584
|
+
if (!text2) throw new Error(`Required package part is missing: ${path2}`);
|
|
165585
|
+
return text2;
|
|
165586
|
+
}
|
|
165587
|
+
function nativeIdAllocator(values, min, max, kind) {
|
|
165588
|
+
const used = /* @__PURE__ */ new Set();
|
|
165589
|
+
for (const value of values) {
|
|
165590
|
+
const id = Number(value);
|
|
165591
|
+
if (!Number.isInteger(id) || id < min || id > max || used.has(id))
|
|
165592
|
+
throw new Error(`Destination ${kind} IDs must be unique integers between ${min} and ${max}`);
|
|
165593
|
+
used.add(id);
|
|
165594
|
+
}
|
|
165595
|
+
let next = min;
|
|
165596
|
+
return () => {
|
|
165597
|
+
while (used.has(next) && next <= max) next++;
|
|
165598
|
+
if (next > max) throw new Error(`No available ${kind} IDs remain`);
|
|
165599
|
+
used.add(next);
|
|
165600
|
+
return next++;
|
|
165601
|
+
};
|
|
165602
|
+
}
|
|
165603
|
+
async function createSlideClipboardPackage(source, slideIndices) {
|
|
165604
|
+
const sourceZip = await JSZip17__default.default.loadAsync(source);
|
|
165605
|
+
const root = parseXml(await requiredXml(sourceZip, "ppt/presentation.xml")).documentElement;
|
|
165606
|
+
const size = first(root, "sldSz", root.namespaceURI ?? "");
|
|
165607
|
+
const width = Number(size?.getAttribute("cx")), height = Number(size?.getAttribute("cy"));
|
|
165608
|
+
if (!width || !height) throw new Error("Source slide dimensions are missing");
|
|
165609
|
+
let blank = new Uint8Array(await buildBlankPresentationArchive({ width, height }));
|
|
165610
|
+
if (root.namespaceURI === "http://purl.oclc.org/ooxml/presentationml/main") {
|
|
165611
|
+
const handler = new exports.PptxHandler();
|
|
165612
|
+
try {
|
|
165613
|
+
await handler.load(blank.buffer);
|
|
165614
|
+
blank = await handler.save([], { conformance: "strict" });
|
|
165615
|
+
} finally {
|
|
165616
|
+
handler.dispose();
|
|
165617
|
+
}
|
|
165618
|
+
}
|
|
165619
|
+
return (await importSlidePackage(blank, source, { slideIndices })).bytes;
|
|
165620
|
+
}
|
|
165621
|
+
|
|
165622
|
+
// pptx/core/builders/sdk/slide-package-clipboard-codec.ts
|
|
165623
|
+
init_json_binary_codec();
|
|
165624
|
+
var SLIDE_PACKAGE_CLIPBOARD_MIME = "web application/vnd.ooxml.pptx-slide-package";
|
|
165625
|
+
var MARKER2 = "ooxml.pptx.slide-package.v1\n";
|
|
165626
|
+
function serializeSlidePackageClipboard(bytes) {
|
|
165627
|
+
return MARKER2 + bytesToBase64(bytes);
|
|
165628
|
+
}
|
|
165629
|
+
function deserializeSlidePackageClipboard(text2) {
|
|
165630
|
+
if (!text2.startsWith(MARKER2)) return null;
|
|
165631
|
+
const payload = text2.slice(MARKER2.length);
|
|
165632
|
+
if (!payload || payload.length % 4 || !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(payload))
|
|
165633
|
+
throw new Error("Copied slide package is malformed");
|
|
165634
|
+
const bytes = base64ToBytes(payload);
|
|
165635
|
+
if (bytes[0] !== 80 || bytes[1] !== 75)
|
|
165636
|
+
throw new Error("Copied slides do not contain an OOXML archive");
|
|
165637
|
+
return bytes;
|
|
165638
|
+
}
|
|
165639
|
+
|
|
164464
165640
|
// pptx/core/index.ts
|
|
164465
165641
|
init_core2();
|
|
164466
165642
|
init_services();
|
|
@@ -169171,6 +170347,29 @@ assign26(["presentation:attribute:embedTrueTypeFonts"], {
|
|
|
169171
170347
|
)
|
|
169172
170348
|
]
|
|
169173
170349
|
});
|
|
170350
|
+
assign26(["presentation:attribute:firstSlideNum"], {
|
|
170351
|
+
parse: "native",
|
|
170352
|
+
preserve: "native",
|
|
170353
|
+
edit: "unassessed",
|
|
170354
|
+
serialize: "unassessed",
|
|
170355
|
+
note: "`p:presentation/@firstSlideNum` is parsed onto `PptxData.firstSlideNumber` (absent or non-integer stays `undefined`, spec default 1) and the shared field substitution shows `firstSlideNumber + index` for `slidenum` fields. A save keeps the attribute because the loaded presentation.xml object is rewritten in place; there is no save option to change it.",
|
|
170356
|
+
evidence: [
|
|
170357
|
+
testEvidence(
|
|
170358
|
+
"src/__tests__/integration/presentation-first-slide-number.test.ts",
|
|
170359
|
+
[
|
|
170360
|
+
"is undefined (spec default: 1) when the attribute is absent",
|
|
170361
|
+
"parses an explicit @firstSlideNum onto the typed model",
|
|
170362
|
+
"accepts zero and ignores a value that is not an integer"
|
|
170363
|
+
],
|
|
170364
|
+
["parse"]
|
|
170365
|
+
),
|
|
170366
|
+
testEvidence(
|
|
170367
|
+
"src/__tests__/integration/presentation-first-slide-number.test.ts",
|
|
170368
|
+
["survives a save that rewrites presentation.xml and reloads as the same value"],
|
|
170369
|
+
["preserve"]
|
|
170370
|
+
)
|
|
170371
|
+
]
|
|
170372
|
+
});
|
|
169174
170373
|
assign26(["presentation:element:smartTags", "presentation:complexType:CT_SmartTags"], {
|
|
169175
170374
|
parse: "native",
|
|
169176
170375
|
preserve: "native",
|
|
@@ -175639,15 +176838,26 @@ init_font_substitution();
|
|
|
175639
176838
|
var DEFAULT_FONT_SIZE = 18;
|
|
175640
176839
|
var FALLBACK_PAD_FACTOR = 0.06;
|
|
175641
176840
|
function drawTextSegments(ctx, segments, bodyStyle, w, h2, scaleFactor = 1) {
|
|
175642
|
-
const padL = bodyStyle?.bodyInsetLeft ? bodyStyle.bodyInsetLeft * scaleFactor : Math.round(w * FALLBACK_PAD_FACTOR);
|
|
175643
|
-
const padR = bodyStyle?.bodyInsetRight ? bodyStyle.bodyInsetRight * scaleFactor : Math.round(w * FALLBACK_PAD_FACTOR);
|
|
175644
|
-
const padT = bodyStyle?.bodyInsetTop ? bodyStyle.bodyInsetTop * scaleFactor : Math.round(h2 * FALLBACK_PAD_FACTOR);
|
|
175645
|
-
const padB = bodyStyle?.bodyInsetBottom ? bodyStyle.bodyInsetBottom * scaleFactor : Math.round(h2 * FALLBACK_PAD_FACTOR);
|
|
176841
|
+
const padL = bodyStyle?.bodyInsetLeft !== void 0 ? bodyStyle.bodyInsetLeft * scaleFactor : Math.round(w * FALLBACK_PAD_FACTOR);
|
|
176842
|
+
const padR = bodyStyle?.bodyInsetRight !== void 0 ? bodyStyle.bodyInsetRight * scaleFactor : Math.round(w * FALLBACK_PAD_FACTOR);
|
|
176843
|
+
const padT = bodyStyle?.bodyInsetTop !== void 0 ? bodyStyle.bodyInsetTop * scaleFactor : Math.round(h2 * FALLBACK_PAD_FACTOR);
|
|
176844
|
+
const padB = bodyStyle?.bodyInsetBottom !== void 0 ? bodyStyle.bodyInsetBottom * scaleFactor : Math.round(h2 * FALLBACK_PAD_FACTOR);
|
|
175646
176845
|
const maxWidth = w - padL - padR;
|
|
175647
176846
|
if (maxWidth <= 0) {
|
|
175648
176847
|
return;
|
|
175649
176848
|
}
|
|
175650
|
-
const paragraphs = splitIntoParagraphs(
|
|
176849
|
+
const paragraphs = splitIntoParagraphs(
|
|
176850
|
+
segments.map((segment) => ({
|
|
176851
|
+
...segment,
|
|
176852
|
+
style: {
|
|
176853
|
+
...bodyStyle,
|
|
176854
|
+
...Object.fromEntries(
|
|
176855
|
+
Object.entries(segment.style).filter(([, value]) => value !== void 0)
|
|
176856
|
+
)
|
|
176857
|
+
}
|
|
176858
|
+
})),
|
|
176859
|
+
bodyStyle
|
|
176860
|
+
);
|
|
175651
176861
|
const lines = layoutParagraphs(ctx, paragraphs, maxWidth, scaleFactor);
|
|
175652
176862
|
if (lines.length === 0) {
|
|
175653
176863
|
return;
|
|
@@ -175683,33 +176893,58 @@ function drawTextSegments(ctx, segments, bodyStyle, w, h2, scaleFactor = 1) {
|
|
|
175683
176893
|
y += line2.height * 0.3;
|
|
175684
176894
|
}
|
|
175685
176895
|
}
|
|
175686
|
-
function splitIntoParagraphs(segments) {
|
|
175687
|
-
const paragraphs = [[]];
|
|
176896
|
+
function splitIntoParagraphs(segments, bodyStyle) {
|
|
176897
|
+
const paragraphs = [{ segments: [], style: bodyStyle ?? {} }];
|
|
175688
176898
|
for (const seg of segments) {
|
|
175689
|
-
if (seg.isParagraphBreak) {
|
|
175690
|
-
paragraphs.push([]);
|
|
175691
|
-
} else if (seg.text) {
|
|
175692
|
-
paragraphs[paragraphs.length - 1].push(seg);
|
|
176899
|
+
if (seg.isParagraphBreak || seg.text === "\n" && !seg.isLineBreak) {
|
|
176900
|
+
paragraphs.push({ segments: [], style: seg.style });
|
|
176901
|
+
} else if (seg.text || seg.isLineBreak) {
|
|
176902
|
+
paragraphs[paragraphs.length - 1].segments.push(seg);
|
|
175693
176903
|
}
|
|
175694
176904
|
}
|
|
175695
|
-
return paragraphs
|
|
176905
|
+
return paragraphs;
|
|
175696
176906
|
}
|
|
175697
176907
|
function layoutParagraphs(ctx, paragraphs, maxWidth, scaleFactor) {
|
|
175698
176908
|
const lines = [];
|
|
175699
|
-
for (const
|
|
175700
|
-
const
|
|
176909
|
+
for (const paragraph of paragraphs) {
|
|
176910
|
+
const para = paragraph.segments;
|
|
176911
|
+
const paraAlign = para[0]?.style.align ?? paragraph.style.align;
|
|
175701
176912
|
let currentLine = [];
|
|
175702
176913
|
let lineWidth = 0;
|
|
175703
176914
|
let lineHeight = 0;
|
|
176915
|
+
let fallbackHeight = (para[0]?.style.fontSize ?? paragraph.style.fontSize ?? DEFAULT_FONT_SIZE) * scaleFactor * 1.2;
|
|
176916
|
+
const flushLine = () => {
|
|
176917
|
+
while (currentLine.length > 0 && /^\s+$/.test(currentLine[currentLine.length - 1].text)) {
|
|
176918
|
+
lineWidth -= currentLine.pop().measuredWidth;
|
|
176919
|
+
}
|
|
176920
|
+
lines.push({
|
|
176921
|
+
runs: currentLine,
|
|
176922
|
+
width: lineWidth,
|
|
176923
|
+
height: lineHeight || fallbackHeight,
|
|
176924
|
+
align: paraAlign
|
|
176925
|
+
});
|
|
176926
|
+
currentLine = [];
|
|
176927
|
+
lineWidth = 0;
|
|
176928
|
+
lineHeight = 0;
|
|
176929
|
+
};
|
|
175704
176930
|
for (const seg of para) {
|
|
175705
176931
|
ctx.font = buildFont(seg.style, scaleFactor);
|
|
175706
176932
|
const fontSize = (seg.style.fontSize ?? DEFAULT_FONT_SIZE) * scaleFactor;
|
|
175707
176933
|
const segHeight = fontSize * 1.2;
|
|
175708
|
-
|
|
176934
|
+
fallbackHeight = segHeight;
|
|
176935
|
+
if (seg.isLineBreak) {
|
|
176936
|
+
flushLine();
|
|
176937
|
+
continue;
|
|
176938
|
+
}
|
|
176939
|
+
const tokens = seg.text.split(/(\r\n|\r|\n)|(?<=\s)(?=\S)|(?<=\S)(?=\s)/);
|
|
175709
176940
|
for (const raw of tokens) {
|
|
175710
176941
|
if (!raw) {
|
|
175711
176942
|
continue;
|
|
175712
176943
|
}
|
|
176944
|
+
if (/^(\r\n|\r|\n)$/.test(raw)) {
|
|
176945
|
+
flushLine();
|
|
176946
|
+
continue;
|
|
176947
|
+
}
|
|
175713
176948
|
if (/^\s+$/.test(raw)) {
|
|
175714
176949
|
if (currentLine.length > 0) {
|
|
175715
176950
|
const spaceW = ctx.measureText(raw).width;
|
|
@@ -175725,19 +176960,7 @@ function layoutParagraphs(ctx, paragraphs, maxWidth, scaleFactor) {
|
|
|
175725
176960
|
const word = raw;
|
|
175726
176961
|
const wordW = ctx.measureText(word).width;
|
|
175727
176962
|
if (lineWidth + wordW > maxWidth && currentLine.length > 0) {
|
|
175728
|
-
|
|
175729
|
-
const removed = currentLine.pop();
|
|
175730
|
-
lineWidth -= removed.measuredWidth;
|
|
175731
|
-
}
|
|
175732
|
-
lines.push({
|
|
175733
|
-
runs: currentLine,
|
|
175734
|
-
width: lineWidth,
|
|
175735
|
-
height: lineHeight,
|
|
175736
|
-
align: paraAlign
|
|
175737
|
-
});
|
|
175738
|
-
currentLine = [];
|
|
175739
|
-
lineWidth = 0;
|
|
175740
|
-
lineHeight = 0;
|
|
176963
|
+
flushLine();
|
|
175741
176964
|
}
|
|
175742
176965
|
currentLine.push({
|
|
175743
176966
|
text: word,
|
|
@@ -175748,14 +176971,7 @@ function layoutParagraphs(ctx, paragraphs, maxWidth, scaleFactor) {
|
|
|
175748
176971
|
lineHeight = Math.max(lineHeight, segHeight);
|
|
175749
176972
|
}
|
|
175750
176973
|
}
|
|
175751
|
-
|
|
175752
|
-
lines.push({
|
|
175753
|
-
runs: currentLine,
|
|
175754
|
-
width: lineWidth,
|
|
175755
|
-
height: lineHeight,
|
|
175756
|
-
align: paraAlign
|
|
175757
|
-
});
|
|
175758
|
-
}
|
|
176974
|
+
flushLine();
|
|
175759
176975
|
}
|
|
175760
176976
|
return lines;
|
|
175761
176977
|
}
|
|
@@ -177691,6 +178907,7 @@ exports.PptxMarkdownConverter = PptxMarkdownConverter;
|
|
|
177691
178907
|
exports.PptxSaveSession = exports.PptxSaveState;
|
|
177692
178908
|
exports.PptxSaveSessionBuilder = exports.PptxSaveStateBuilder;
|
|
177693
178909
|
exports.Presentation = Presentation;
|
|
178910
|
+
exports.SLIDE_PACKAGE_CLIPBOARD_MIME = SLIDE_PACKAGE_CLIPBOARD_MIME;
|
|
177694
178911
|
exports.ShapeBuilder = ShapeBuilder;
|
|
177695
178912
|
exports.SlideProcessor = SlideProcessor;
|
|
177696
178913
|
exports.SlideSizes = SlideSizes;
|
|
@@ -177707,8 +178924,10 @@ exports.addSmartArtNodeAsChild = addSmartArtNodeAsChild;
|
|
|
177707
178924
|
exports.addTableStyleToMap = addTableStyleToMap;
|
|
177708
178925
|
exports.algorithmParam = algorithmParam;
|
|
177709
178926
|
exports.alphaLabel = alphaLabel;
|
|
178927
|
+
exports.animationFor = animationFor;
|
|
177710
178928
|
exports.applyActiveXControlsToSlide = applyActiveXControlsToSlide;
|
|
177711
178929
|
exports.applyAfterAnimationBehavior = applyAfterAnimationBehavior;
|
|
178930
|
+
exports.applyAfterAnimationFromEditorList = applyAfterAnimationFromEditorList;
|
|
177712
178931
|
exports.applyBubbleChartOptions = applyBubbleChartOptions;
|
|
177713
178932
|
exports.applyChartLayouts = applyChartLayouts;
|
|
177714
178933
|
exports.applyChartManualLayout = applyChartManualLayout;
|
|
@@ -177836,6 +179055,7 @@ exports.createMediaElement = createMediaElement;
|
|
|
177836
179055
|
exports.createModifyVerifier = createModifyVerifier;
|
|
177837
179056
|
exports.createSaltlessModifyVerifierForTesting = createSaltlessModifyVerifierForTesting;
|
|
177838
179057
|
exports.createShapeElement = createShapeElement;
|
|
179058
|
+
exports.createSlideClipboardPackage = createSlideClipboardPackage;
|
|
177839
179059
|
exports.createTableCellXml = createTableCellXml;
|
|
177840
179060
|
exports.createTableElement = createTableElement;
|
|
177841
179061
|
exports.createTableGraphicFrameRawXml = createTableGraphicFrameRawXml;
|
|
@@ -177864,6 +179084,7 @@ exports.deriveOutputPath = deriveOutputPath;
|
|
|
177864
179084
|
exports.deriveSlideTitle = deriveSlideTitle;
|
|
177865
179085
|
exports.deriveSlideTitles = deriveSlideTitles;
|
|
177866
179086
|
exports.deserializePptxFromJson = deserializePptxFromJson;
|
|
179087
|
+
exports.deserializeSlidePackageClipboard = deserializeSlidePackageClipboard;
|
|
177867
179088
|
exports.detectDigitalSignatures = detectDigitalSignatures;
|
|
177868
179089
|
exports.detectFileFormat = detectFileFormat;
|
|
177869
179090
|
exports.detectFontFormat = detectFontFormat;
|
|
@@ -177933,6 +179154,8 @@ exports.generateMediaFilename = generateMediaFilename;
|
|
|
177933
179154
|
exports.generateTableStyleGuid = generateTableStyleGuid;
|
|
177934
179155
|
exports.getAdjustmentAwareClipPath = getAdjustmentAwareClipPath;
|
|
177935
179156
|
exports.getAdjustmentAwareShapeClipPath = getAdjustmentAwareShapeClipPath;
|
|
179157
|
+
exports.getAfterAnimation = getAfterAnimation;
|
|
179158
|
+
exports.getAfterAnimationState = getAfterAnimationState;
|
|
177936
179159
|
exports.getAnimationPresetInfo = getAnimationPresetInfo;
|
|
177937
179160
|
exports.getCalloutLeaderLineGeometry = getCalloutLeaderLineGeometry;
|
|
177938
179161
|
exports.getCalloutTier = getCalloutTier;
|
|
@@ -177986,6 +179209,7 @@ exports.groupElements = groupElements;
|
|
|
177986
179209
|
exports.guidToKey = guidToKey;
|
|
177987
179210
|
exports.guideEmuToPx = guideEmuToPx;
|
|
177988
179211
|
exports.guidePxToEmu = guidePxToEmu;
|
|
179212
|
+
exports.hasAnimation = hasAnimation;
|
|
177989
179213
|
exports.hasDirectSubstitution = hasDirectSubstitution;
|
|
177990
179214
|
exports.hasNonTrivialOverride = hasNonTrivialOverride;
|
|
177991
179215
|
exports.hasReference = hasReference;
|
|
@@ -177994,6 +179218,7 @@ exports.hasTextProperties = hasTextProperties;
|
|
|
177994
179218
|
exports.hebrewAlphaLabel = hebrewAlphaLabel;
|
|
177995
179219
|
exports.hexToRgbChannels = hexToRgbChannels;
|
|
177996
179220
|
exports.hslToRgb = hslToRgb;
|
|
179221
|
+
exports.importSlidePackage = importSlidePackage;
|
|
177997
179222
|
exports.inches = inches;
|
|
177998
179223
|
exports.inchesToEmu = inchesToEmu;
|
|
177999
179224
|
exports.inferOleExtensionFromTarget = inferOleExtensionFromTarget;
|
|
@@ -178023,6 +179248,7 @@ exports.isImageLikeElement = isImageLikeElement;
|
|
|
178023
179248
|
exports.isInkElement = isInkElement;
|
|
178024
179249
|
exports.isLegacyPpt = isLegacyPpt;
|
|
178025
179250
|
exports.isNamespaceSupported = isNamespaceSupported;
|
|
179251
|
+
exports.isNativeAfterAnimationOnly = isNativeAfterAnimationOnly;
|
|
178026
179252
|
exports.isOle2CompoundFile = isOle2CompoundFile;
|
|
178027
179253
|
exports.isParetoChartData = isParetoChartData;
|
|
178028
179254
|
exports.isPptxJsonText = isPptxJsonText;
|
|
@@ -178049,6 +179275,7 @@ exports.lookupPresetShape = lookupPresetShape;
|
|
|
178049
179275
|
exports.lookupPresetTextRectOverride = lookupPresetTextRectOverride;
|
|
178050
179276
|
exports.mailMerge = mailMerge;
|
|
178051
179277
|
exports.makeStoreAwareId = makeStoreAwareId;
|
|
179278
|
+
exports.mergeNativeAfterAnimationIntoEditorAnimations = mergeNativeAfterAnimationIntoEditorAnimations;
|
|
178052
179279
|
exports.mergeNativeSoundIntoEditorAnimations = mergeNativeSoundIntoEditorAnimations;
|
|
178053
179280
|
exports.mergePresentation = mergePresentation;
|
|
178054
179281
|
exports.mergeShapes = mergeShapes;
|
|
@@ -178227,6 +179454,7 @@ exports.resolveModel3DMimeType = resolveModel3DMimeType;
|
|
|
178227
179454
|
exports.resolveModifyVerifierAlgorithmName = resolveModifyVerifierAlgorithmName;
|
|
178228
179455
|
exports.resolveOleEditorKindFromPayload = resolveOleEditorKindFromPayload;
|
|
178229
179456
|
exports.resolveOoxmlPresetMapping = resolveOoxmlPresetMapping;
|
|
179457
|
+
exports.resolveOpacitySet = resolveOpacitySet;
|
|
178230
179458
|
exports.resolveRatioConstraint = resolveRatioConstraint;
|
|
178231
179459
|
exports.resolveReferenceUriToPart = resolveReferenceUriToPart;
|
|
178232
179460
|
exports.resolveSmartArtEffectIntensity = resolveSmartArtEffectIntensity;
|
|
@@ -178247,9 +179475,12 @@ exports.serializeCondition = serializeCondition;
|
|
|
178247
179475
|
exports.serializeConditionList = serializeConditionList;
|
|
178248
179476
|
exports.serializeGraphicBuild = serializeGraphicBuild;
|
|
178249
179477
|
exports.serializePptxToJson = serializePptxToJson;
|
|
179478
|
+
exports.serializeSlidePackageClipboard = serializeSlidePackageClipboard;
|
|
178250
179479
|
exports.serializeSmartArtDefinitionHeaderList = serializeSmartArtDefinitionHeaderList;
|
|
178251
179480
|
exports.serializeSvgPath = serializeSvgPath;
|
|
178252
179481
|
exports.serializeTimeTargetElement = serializeTimeTargetElement;
|
|
179482
|
+
exports.setAfterAnimation = setAfterAnimation;
|
|
179483
|
+
exports.setAfterAnimationColor = setAfterAnimationColor;
|
|
178253
179484
|
exports.setChartAreaFormat = setChartAreaFormat;
|
|
178254
179485
|
exports.setChartAxis = setChartAxis;
|
|
178255
179486
|
exports.setChartAxisGridlineStyle = setChartAxisGridlineStyle;
|
|
@@ -178336,6 +179567,7 @@ exports.updateChartUserShape = updateChartUserShape;
|
|
|
178336
179567
|
exports.updateChartUserShapeAtPath = updateChartUserShapeAtPath;
|
|
178337
179568
|
exports.updateMergeAttrsInRawXml = updateMergeAttrsInRawXml;
|
|
178338
179569
|
exports.updateSmartArtNodeText = updateSmartArtNodeText;
|
|
179570
|
+
exports.upsert = upsert;
|
|
178339
179571
|
exports.validatePptx = validatePptx;
|
|
178340
179572
|
exports.validateSmartArtColorStyleLabels = validateSmartArtColorStyleLabels;
|
|
178341
179573
|
exports.validateSmartArtConstraintRules = validateSmartArtConstraintRules;
|