ooxml-core 1.19.2 → 1.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -1
- package/dist/{PptxHandler-6TNIQ7S5.cjs → PptxHandler-DNSXWTQV.cjs} +3 -3
- package/dist/{PptxHandler-2V4PQL6O.mjs → PptxHandler-FSKKPZZC.mjs} +3 -3
- package/dist/PptxHandler-H7MEWJJJ.mjs +4 -0
- package/dist/{PresentationBuilder-G7MPEGXJ.mjs → PresentationBuilder-7TSENZTX.mjs} +2 -2
- package/dist/{PresentationBuilder-RM52LCVN.cjs → PresentationBuilder-A5NI35VN.cjs} +5 -5
- package/dist/{PresentationBuilder-HQ6C7L4V.mjs → PresentationBuilder-RIJWQSEU.mjs} +3 -3
- package/dist/automation/docx-forms.d.ts +26 -0
- package/dist/automation/docx-forms.d.ts.map +1 -0
- package/dist/automation/index.cjs +6280 -2506
- package/dist/automation/index.d.ts +1 -0
- package/dist/automation/index.d.ts.map +1 -1
- package/dist/automation/index.mjs +6277 -2507
- package/dist/automation/xlsx-read.d.ts +56 -0
- package/dist/automation/xlsx-read.d.ts.map +1 -0
- package/dist/automation/xlsx.d.ts +105 -4
- package/dist/automation/xlsx.d.ts.map +1 -1
- package/dist/chart/axis-range.d.ts.map +1 -1
- package/dist/chart/bubble-radius.d.ts +0 -5
- package/dist/chart/bubble-radius.d.ts.map +1 -1
- package/dist/chart/extent.d.ts +9 -0
- package/dist/chart/extent.d.ts.map +1 -0
- package/dist/chart/histogram-binning.d.ts.map +1 -1
- package/dist/chart/index.cjs +56 -18
- package/dist/chart/index.mjs +56 -18
- package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-legend.d.ts.map +1 -1
- package/dist/chart/render/chart-view-ex.d.ts.map +1 -1
- package/dist/chart/render/chart-view.d.ts.map +1 -1
- package/dist/chart/trendline-fit.d.ts.map +1 -1
- package/dist/{chunk-NYTR4UZ5.cjs → chunk-4LZIUJI3.cjs} +52 -12
- package/dist/{chunk-SLNQNVQM.mjs → chunk-4QPOJCJG.mjs} +45 -8
- package/dist/{chunk-XTSHZGSM.mjs → chunk-6IIMI5RS.mjs} +52 -12
- package/dist/{chunk-TJPUAUWL.mjs → chunk-BA7Z6ATM.mjs} +9 -195
- package/dist/{chunk-JUABSM7C.mjs → chunk-DLFMCZZT.mjs} +1 -1
- package/dist/{chunk-M4XLF4R7.mjs → chunk-GBKBR4CX.mjs} +20 -8
- package/dist/{chunk-R5FIHHGB.cjs → chunk-HL3FBJ6X.cjs} +1648 -1205
- package/dist/{chunk-ZJ2OKIJN.mjs → chunk-LF5E5ZOH.mjs} +642 -199
- package/dist/{chunk-4FTUAD2B.mjs → chunk-Q5PKBQXH.mjs} +766 -202
- package/dist/{chunk-M6GDBVQ7.mjs → chunk-VQF6HQEE.mjs} +1 -1
- package/dist/collab/embedding.d.ts +103 -0
- package/dist/collab/embedding.d.ts.map +1 -0
- package/dist/collab/index.cjs +450 -342
- package/dist/collab/index.d.ts +1 -0
- package/dist/collab/index.d.ts.map +1 -1
- package/dist/collab/index.mjs +443 -343
- package/dist/color/theme-palette.d.ts +5 -1
- package/dist/color/theme-palette.d.ts.map +1 -1
- package/dist/crypto/index.cjs +27 -2
- package/dist/crypto/index.mjs +27 -2
- package/dist/diagram/index.cjs +31 -3
- package/dist/diagram/index.mjs +31 -3
- package/dist/docx/block-parser.d.ts.map +1 -1
- package/dist/docx/cell-blocks.d.ts +7 -1
- package/dist/docx/cell-blocks.d.ts.map +1 -1
- package/dist/docx/content-control-edit.d.ts +14 -0
- package/dist/docx/content-control-edit.d.ts.map +1 -1
- package/dist/docx/content-control-model.d.ts +8 -0
- package/dist/docx/content-control-model.d.ts.map +1 -1
- package/dist/docx/content-control-values.d.ts +20 -0
- package/dist/docx/content-control-values.d.ts.map +1 -0
- package/dist/docx/content-control.d.ts +7 -1
- package/dist/docx/content-control.d.ts.map +1 -1
- package/dist/docx/element-order.d.ts +10 -5
- package/dist/docx/element-order.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +3861 -1379
- package/dist/docx/embedded.mjs +3861 -1379
- package/dist/docx/field-instruction.d.ts +22 -0
- package/dist/docx/field-instruction.d.ts.map +1 -0
- package/dist/docx/form-field-model.d.ts +48 -0
- package/dist/docx/form-field-model.d.ts.map +1 -0
- package/dist/docx/form-fields.d.ts +31 -0
- package/dist/docx/form-fields.d.ts.map +1 -0
- package/dist/docx/form-fill-fields.d.ts +61 -0
- package/dist/docx/form-fill-fields.d.ts.map +1 -0
- package/dist/docx/form-fill-labels.d.ts +8 -0
- package/dist/docx/form-fill-labels.d.ts.map +1 -0
- package/dist/docx/form-fill-sites.d.ts +59 -0
- package/dist/docx/form-fill-sites.d.ts.map +1 -0
- package/dist/docx/form-fill-values.d.ts +28 -0
- package/dist/docx/form-fill-values.d.ts.map +1 -0
- package/dist/docx/form-fill-write.d.ts +26 -0
- package/dist/docx/form-fill-write.d.ts.map +1 -0
- package/dist/docx/glossary.d.ts +15 -0
- package/dist/docx/glossary.d.ts.map +1 -0
- package/dist/docx/index.cjs +5929 -3153
- package/dist/docx/index.d.ts +7 -0
- package/dist/docx/index.d.ts.map +1 -1
- package/dist/docx/index.mjs +5913 -3154
- package/dist/docx/inline-annotations.d.ts +21 -0
- package/dist/docx/inline-annotations.d.ts.map +1 -0
- package/dist/docx/inline-container-markers.d.ts +14 -0
- package/dist/docx/inline-container-markers.d.ts.map +1 -0
- package/dist/docx/inline-containers.d.ts +54 -0
- package/dist/docx/inline-containers.d.ts.map +1 -0
- package/dist/docx/inline-form-field-bookmarks.d.ts +15 -0
- package/dist/docx/inline-form-field-bookmarks.d.ts.map +1 -0
- package/dist/docx/inline-marker-positions.d.ts +15 -0
- package/dist/docx/inline-marker-positions.d.ts.map +1 -0
- package/dist/docx/inline-markers.d.ts +63 -0
- package/dist/docx/inline-markers.d.ts.map +1 -0
- package/dist/docx/inline-slots.d.ts +24 -0
- package/dist/docx/inline-slots.d.ts.map +1 -0
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +1176 -563
- package/dist/docx/layout/index.d.ts +2 -1
- package/dist/docx/layout/index.d.ts.map +1 -1
- package/dist/docx/layout/index.mjs +1175 -564
- package/dist/docx/layout/input.d.ts +5 -1
- package/dist/docx/layout/input.d.ts.map +1 -1
- package/dist/docx/layout/page-style-refs.d.ts +21 -0
- package/dist/docx/layout/page-style-refs.d.ts.map +1 -0
- package/dist/docx/layout/paragraph-fragments.d.ts.map +1 -1
- package/dist/docx/layout/result.d.ts +1 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/layout/tab-stops.d.ts +8 -1
- package/dist/docx/layout/tab-stops.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +3969 -1487
- package/dist/docx/load/index.mjs +3969 -1487
- package/dist/docx/model-run.d.ts +24 -2
- package/dist/docx/model-run.d.ts.map +1 -1
- package/dist/docx/model.d.ts +5 -0
- package/dist/docx/model.d.ts.map +1 -1
- package/dist/docx/numbering-format.d.ts.map +1 -1
- package/dist/docx/parse-warnings.d.ts.map +1 -1
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/run-segmentation.d.ts +11 -0
- package/dist/docx/run-segmentation.d.ts.map +1 -0
- package/dist/docx/save.d.ts.map +1 -1
- package/dist/docx/section-model.d.ts +5 -0
- package/dist/docx/section-model.d.ts.map +1 -1
- package/dist/docx/sections.d.ts +4 -2
- package/dist/docx/sections.d.ts.map +1 -1
- package/dist/docx/settings.d.ts +9 -0
- package/dist/docx/settings.d.ts.map +1 -1
- package/dist/docx/special-characters.d.ts +34 -0
- package/dist/docx/special-characters.d.ts.map +1 -0
- package/dist/docx/style-ref-fields.d.ts +40 -0
- package/dist/docx/style-ref-fields.d.ts.map +1 -0
- package/dist/docx/style-ref.d.ts +85 -0
- package/dist/docx/style-ref.d.ts.map +1 -0
- package/dist/docx/table-model.d.ts +2 -2
- package/dist/docx/table-model.d.ts.map +1 -1
- package/dist/docx/ui/break-note-schema.d.ts.map +1 -1
- package/dist/docx/ui/content-control-commands.d.ts +20 -8
- package/dist/docx/ui/content-control-commands.d.ts.map +1 -1
- package/dist/docx/ui/content-control-guard.d.ts +4 -1
- package/dist/docx/ui/content-control-guard.d.ts.map +1 -1
- package/dist/docx/ui/content-control-paste.d.ts +23 -0
- package/dist/docx/ui/content-control-paste.d.ts.map +1 -0
- package/dist/docx/ui/content-control-rows.d.ts +15 -0
- package/dist/docx/ui/content-control-rows.d.ts.map +1 -0
- package/dist/docx/ui/content-control-sources.d.ts +12 -0
- package/dist/docx/ui/content-control-sources.d.ts.map +1 -0
- package/dist/docx/ui/content-control-spans.d.ts +29 -6
- package/dist/docx/ui/content-control-spans.d.ts.map +1 -1
- package/dist/docx/ui/content-control-temporary.d.ts +10 -0
- package/dist/docx/ui/content-control-temporary.d.ts.map +1 -0
- package/dist/docx/ui/form-field-commands.d.ts +41 -0
- package/dist/docx/ui/form-field-commands.d.ts.map +1 -0
- package/dist/docx/ui/form-field-guard.d.ts +24 -0
- package/dist/docx/ui/form-field-guard.d.ts.map +1 -0
- package/dist/docx/ui/form-text-blank.d.ts +18 -0
- package/dist/docx/ui/form-text-blank.d.ts.map +1 -0
- package/dist/docx/ui/index.cjs +9276 -7132
- package/dist/docx/ui/index.d.ts +5 -0
- package/dist/docx/ui/index.d.ts.map +1 -1
- package/dist/docx/ui/index.mjs +9259 -7137
- package/dist/docx/ui/positional-tab-input.d.ts +7 -0
- package/dist/docx/ui/positional-tab-input.d.ts.map +1 -0
- package/dist/docx/ui/run-compare.d.ts.map +1 -1
- package/dist/docx/ui/run-extra-mark.d.ts +1 -1
- package/dist/docx/ui/run-extra-mark.d.ts.map +1 -1
- package/dist/docx/ui/schema-marks.d.ts +1 -1
- package/dist/docx/ui/schema-marks.d.ts.map +1 -1
- package/dist/docx/ui/symbol-font.d.ts +4 -0
- package/dist/docx/ui/symbol-font.d.ts.map +1 -0
- package/dist/docx/ui/yjs-collaboration.d.ts +12 -1
- package/dist/docx/ui/yjs-collaboration.d.ts.map +1 -1
- package/dist/docx/write-block-placement.d.ts +7 -0
- package/dist/docx/write-block-placement.d.ts.map +1 -1
- package/dist/docx/write-content-control.d.ts +6 -0
- package/dist/docx/write-content-control.d.ts.map +1 -1
- package/dist/docx/write-header-footer.d.ts +6 -2
- package/dist/docx/write-header-footer.d.ts.map +1 -1
- package/dist/docx/write-inline.d.ts +12 -16
- package/dist/docx/write-inline.d.ts.map +1 -1
- package/dist/docx/write-paragraph.d.ts.map +1 -1
- package/dist/docx/write-revisions.d.ts.map +1 -1
- package/dist/docx/write-run.d.ts.map +1 -1
- package/dist/docx/write-section-properties.d.ts +5 -0
- package/dist/docx/write-section-properties.d.ts.map +1 -0
- package/dist/docx/write-sections.d.ts.map +1 -1
- package/dist/docx/write-table-controls.d.ts +15 -0
- package/dist/docx/write-table-controls.d.ts.map +1 -0
- package/dist/docx/write-table-properties.d.ts.map +1 -1
- package/dist/docx/write-table.d.ts.map +1 -1
- package/dist/docx/write.d.ts.map +1 -1
- package/dist/docx/xml.d.ts +6 -0
- package/dist/docx/xml.d.ts.map +1 -1
- package/dist/drawingml/index.cjs +31 -3
- package/dist/drawingml/index.mjs +31 -3
- package/dist/index.cjs +102 -26
- package/dist/index.mjs +102 -26
- package/dist/math/index.cjs +27 -2
- package/dist/math/index.mjs +27 -2
- package/dist/opc/index.cjs +51 -11
- package/dist/opc/index.mjs +51 -11
- package/dist/opc/zip-folders.d.ts +11 -0
- package/dist/opc/zip-folders.d.ts.map +1 -0
- package/dist/opc/zip-limits.d.ts +9 -0
- package/dist/opc/zip-limits.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +995 -462
- package/dist/pptx/automation/index.d.ts +2 -2
- package/dist/pptx/automation/index.mjs +6 -6
- package/dist/pptx/chunks/{index-Bqm-jFG-.d.ts → index-CPhsd7Df.d.ts} +7580 -7507
- package/dist/pptx/chunks/index-CPhsd7Df.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-B9x557hr.d.ts → index-Q5mM8kIR.d.ts} +2 -2
- package/dist/pptx/chunks/{index-B9x557hr.d.ts.map → index-Q5mM8kIR.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +770 -238
- package/dist/pptx/cli/index.mjs +5 -5
- package/dist/pptx/converter/index.cjs +12 -3
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +3 -3
- package/dist/pptx/editor/render/find-replace.cjs +14 -14
- package/dist/pptx/editor/render/find-replace.d.ts +1 -1
- package/dist/pptx/editor/render/find-replace.mjs +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +8 -8
- package/dist/pptx/editor/render/slide-operations.mjs +2 -2
- package/dist/pptx/index.cjs +1099 -628
- package/dist/pptx/index.d.ts +3 -3
- package/dist/pptx/index.mjs +6 -6
- package/dist/pptx/signature-node/index.cjs +20 -8
- package/dist/pptx/signature-node/index.mjs +2 -2
- package/dist/teams/index.cjs +105 -70
- package/dist/teams/index.mjs +105 -70
- package/dist/text/text-diff.d.ts +15 -0
- package/dist/text/text-diff.d.ts.map +1 -0
- package/dist/visio/index.cjs +220 -46
- package/dist/visio/index.mjs +220 -46
- package/dist/visio/ui/contract.d.ts +8 -2
- package/dist/visio/ui/contract.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +227 -50
- package/dist/visio/ui/index.mjs +227 -50
- package/dist/xlsx/collab/index.cjs +8 -3
- package/dist/xlsx/collab/index.mjs +8 -3
- package/dist/xlsx/compare/cells.d.ts +22 -0
- package/dist/xlsx/compare/cells.d.ts.map +1 -0
- package/dist/xlsx/compare/compare.d.ts +12 -0
- package/dist/xlsx/compare/compare.d.ts.map +1 -0
- package/dist/xlsx/compare/conditional.d.ts +7 -0
- package/dist/xlsx/compare/conditional.d.ts.map +1 -0
- package/dist/xlsx/compare/format-key.d.ts +34 -0
- package/dist/xlsx/compare/format-key.d.ts.map +1 -0
- package/dist/xlsx/compare/group.d.ts +8 -0
- package/dist/xlsx/compare/group.d.ts.map +1 -0
- package/dist/xlsx/compare/index.d.ts +5 -0
- package/dist/xlsx/compare/index.d.ts.map +1 -0
- package/dist/xlsx/compare/rich-text.d.ts +7 -0
- package/dist/xlsx/compare/rich-text.d.ts.map +1 -0
- package/dist/xlsx/compare/sheets.d.ts +22 -0
- package/dist/xlsx/compare/sheets.d.ts.map +1 -0
- package/dist/xlsx/compare/structure.d.ts +11 -0
- package/dist/xlsx/compare/structure.d.ts.map +1 -0
- package/dist/xlsx/compare/text.d.ts +8 -0
- package/dist/xlsx/compare/text.d.ts.map +1 -0
- package/dist/xlsx/compare/types.d.ts +173 -0
- package/dist/xlsx/compare/types.d.ts.map +1 -0
- package/dist/xlsx/edit/cell-values.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard-html.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard-text.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard.d.ts.map +1 -1
- package/dist/xlsx/edit/clone-cell.d.ts +9 -0
- package/dist/xlsx/edit/clone-cell.d.ts.map +1 -0
- package/dist/xlsx/edit/dimensions.d.ts.map +1 -1
- package/dist/xlsx/edit/history-rows.d.ts +7 -0
- package/dist/xlsx/edit/history-rows.d.ts.map +1 -0
- package/dist/xlsx/edit/history.d.ts +19 -4
- package/dist/xlsx/edit/history.d.ts.map +1 -1
- package/dist/xlsx/edit/outline.d.ts.map +1 -1
- package/dist/xlsx/edit/row-autofit.d.ts.map +1 -1
- package/dist/xlsx/edit/timelines.d.ts.map +1 -1
- package/dist/xlsx/formula/change-areas.d.ts +9 -0
- package/dist/xlsx/formula/change-areas.d.ts.map +1 -0
- package/dist/xlsx/formula/engine-prepare.d.ts +8 -0
- package/dist/xlsx/formula/engine-prepare.d.ts.map +1 -1
- package/dist/xlsx/formula/engine.d.ts.map +1 -1
- package/dist/xlsx/formula/spill.d.ts +5 -1
- package/dist/xlsx/formula/spill.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +2551 -1208
- package/dist/xlsx/index.d.ts +1 -0
- package/dist/xlsx/index.d.ts.map +1 -1
- package/dist/xlsx/index.mjs +2544 -1209
- package/dist/xlsx/layout/cell-view.d.ts.map +1 -1
- package/dist/xlsx/layout/navigate.d.ts.map +1 -1
- package/dist/xlsx/layout/style-view.d.ts +5 -0
- package/dist/xlsx/layout/style-view.d.ts.map +1 -1
- package/dist/xlsx/load/csv-dates.d.ts +22 -0
- package/dist/xlsx/load/csv-dates.d.ts.map +1 -0
- package/dist/xlsx/load/csv-import.d.ts +64 -0
- package/dist/xlsx/load/csv-import.d.ts.map +1 -0
- package/dist/xlsx/load/csv-separators.d.ts +13 -0
- package/dist/xlsx/load/csv-separators.d.ts.map +1 -0
- package/dist/xlsx/load/csv-traits.d.ts +20 -0
- package/dist/xlsx/load/csv-traits.d.ts.map +1 -0
- package/dist/xlsx/load/csv.d.ts +8 -4
- package/dist/xlsx/load/csv.d.ts.map +1 -1
- package/dist/xlsx/load/detect.d.ts +13 -0
- package/dist/xlsx/load/detect.d.ts.map +1 -1
- package/dist/xlsx/load/errors.d.ts +1 -0
- package/dist/xlsx/load/errors.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +598 -98
- package/dist/xlsx/load/index.d.ts +3 -1
- package/dist/xlsx/load/index.d.ts.map +1 -1
- package/dist/xlsx/load/index.mjs +597 -99
- package/dist/xlsx/numfmt/format.d.ts +8 -0
- package/dist/xlsx/numfmt/format.d.ts.map +1 -1
- package/dist/xlsx/numfmt/input-date.d.ts +2 -0
- package/dist/xlsx/numfmt/input-date.d.ts.map +1 -1
- package/dist/xlsx/pivot/cache-xml.d.ts.map +1 -1
- package/dist/xlsx/pivot/groups.d.ts.map +1 -1
- package/dist/xlsx/read/index.d.ts +2 -1
- package/dist/xlsx/read/index.d.ts.map +1 -1
- package/dist/xlsx/read/limits.d.ts +50 -0
- package/dist/xlsx/read/limits.d.ts.map +1 -0
- package/dist/xlsx/read/load.d.ts +11 -1
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/read/package.d.ts +5 -23
- package/dist/xlsx/read/package.d.ts.map +1 -1
- package/dist/xlsx/read/shared-strings.d.ts +2 -2
- package/dist/xlsx/read/shared-strings.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-data-source.d.ts.map +1 -1
- package/dist/xlsx/read/worksheet.d.ts +2 -0
- package/dist/xlsx/read/worksheet.d.ts.map +1 -1
- package/dist/xlsx/stable-key.d.ts +3 -0
- package/dist/xlsx/stable-key.d.ts.map +1 -0
- package/dist/xlsx/styles.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +795 -388
- 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 +795 -389
- package/dist/xlsx/ui/selection-format.d.ts +13 -0
- package/dist/xlsx/ui/selection-format.d.ts.map +1 -0
- package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
- package/dist/xml/index.cjs +57 -3
- package/dist/xml/index.mjs +57 -4
- package/dist/xml/lite.d.ts.map +1 -1
- package/dist/xml/xml.d.ts +11 -1
- package/dist/xml/xml.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/PptxHandler-HSPKEP5E.mjs +0 -4
- package/dist/pptx/chunks/index-Bqm-jFG-.d.ts.map +0 -1
package/dist/pptx/cli/index.cjs
CHANGED
|
@@ -81,17 +81,24 @@ var init_type_guards = __esm({
|
|
|
81
81
|
function stripFontStyleSuffix(fontName) {
|
|
82
82
|
let name = fontName.trim();
|
|
83
83
|
let stripped = false;
|
|
84
|
-
|
|
84
|
+
let previous = "";
|
|
85
|
+
let tokens = 0;
|
|
86
|
+
for (; ; ) {
|
|
85
87
|
const idx = name.lastIndexOf(" ");
|
|
86
88
|
if (idx <= 0) {
|
|
87
89
|
break;
|
|
88
90
|
}
|
|
89
91
|
const token2 = name.slice(idx + 1).toLowerCase().replace(/-/g, "");
|
|
90
|
-
|
|
92
|
+
const prefix = FONT_WEIGHT_PREFIX_TOKENS.has(token2) && FONT_PREFIXED_WEIGHT_TOKENS.has(previous);
|
|
93
|
+
if (!prefix && (tokens >= 2 || !FONT_STYLE_SUFFIX_TOKENS.has(token2))) {
|
|
91
94
|
break;
|
|
92
95
|
}
|
|
93
96
|
name = name.slice(0, idx).trim();
|
|
94
97
|
stripped = true;
|
|
98
|
+
previous = prefix ? "" : token2;
|
|
99
|
+
if (!prefix) {
|
|
100
|
+
tokens++;
|
|
101
|
+
}
|
|
95
102
|
}
|
|
96
103
|
return stripped && name.length > 0 ? name : void 0;
|
|
97
104
|
}
|
|
@@ -132,7 +139,7 @@ function quoteFontName(name) {
|
|
|
132
139
|
}
|
|
133
140
|
return `"${trimmed2}"`;
|
|
134
141
|
}
|
|
135
|
-
var FONT_SUBSTITUTION_MAP, FONT_STYLE_SUFFIX_TOKENS, CSS_GENERIC_FAMILIES;
|
|
142
|
+
var FONT_SUBSTITUTION_MAP, FONT_STYLE_SUFFIX_TOKENS, FONT_WEIGHT_PREFIX_TOKENS, FONT_PREFIXED_WEIGHT_TOKENS, CSS_GENERIC_FAMILIES;
|
|
136
143
|
var init_font_substitution = __esm({
|
|
137
144
|
"pptx/core/utils/font-substitution.ts"() {
|
|
138
145
|
FONT_SUBSTITUTION_MAP = {
|
|
@@ -320,6 +327,8 @@ var init_font_substitution = __esm({
|
|
|
320
327
|
"italic",
|
|
321
328
|
"oblique"
|
|
322
329
|
]);
|
|
330
|
+
FONT_WEIGHT_PREFIX_TOKENS = /* @__PURE__ */ new Set(["semi", "demi", "extra", "ultra"]);
|
|
331
|
+
FONT_PREFIXED_WEIGHT_TOKENS = /* @__PURE__ */ new Set(["bold", "light", "black"]);
|
|
323
332
|
CSS_GENERIC_FAMILIES = /* @__PURE__ */ new Set([
|
|
324
333
|
"serif",
|
|
325
334
|
"sans-serif",
|
|
@@ -10382,7 +10391,7 @@ function getShapeType(shapeType) {
|
|
|
10382
10391
|
if (normalized === "downarrow") {
|
|
10383
10392
|
return "downArrow";
|
|
10384
10393
|
}
|
|
10385
|
-
if (normalized.includes("connector")) {
|
|
10394
|
+
if (normalized.includes("connector") && !normalized.startsWith("flowchart")) {
|
|
10386
10395
|
return "connector";
|
|
10387
10396
|
}
|
|
10388
10397
|
if (PRESET_SHAPE_CLIP_PATHS[normalized] !== void 0) {
|
|
@@ -14686,7 +14695,7 @@ function resolveLimits(limits) {
|
|
|
14686
14695
|
maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
|
|
14687
14696
|
maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
|
|
14688
14697
|
label: limits.label ?? "ZIP",
|
|
14689
|
-
fail: (message, limit) => create ? create(message, { limit }) : new ZipLimitError(message, { limit })
|
|
14698
|
+
fail: (message, limit, kind) => create ? create(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
|
|
14690
14699
|
};
|
|
14691
14700
|
}
|
|
14692
14701
|
function inflateEntryGuarded(entry2, alreadyRead, limits) {
|
|
@@ -14709,13 +14718,18 @@ function inflateEntryGuarded(entry2, alreadyRead, limits) {
|
|
|
14709
14718
|
size += chunk2.byteLength;
|
|
14710
14719
|
if (size > declared || size > r.maxEntryBytes)
|
|
14711
14720
|
return abort(
|
|
14712
|
-
r.fail(
|
|
14721
|
+
r.fail(
|
|
14722
|
+
`${r.label} part ${entry2.name} inflates past its declared size`,
|
|
14723
|
+
r.maxEntryBytes,
|
|
14724
|
+
size > declared ? "declaredSize" : "maxEntryBytes"
|
|
14725
|
+
)
|
|
14713
14726
|
);
|
|
14714
14727
|
if (alreadyRead + size > r.maxTotalBytes)
|
|
14715
14728
|
return abort(
|
|
14716
14729
|
r.fail(
|
|
14717
14730
|
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
14718
|
-
r.maxTotalBytes
|
|
14731
|
+
r.maxTotalBytes,
|
|
14732
|
+
"maxTotalBytes"
|
|
14719
14733
|
)
|
|
14720
14734
|
);
|
|
14721
14735
|
chunks.push(chunk2);
|
|
@@ -14748,26 +14762,29 @@ function guardZip(zip, limits = {}) {
|
|
|
14748
14762
|
if (entries.length > r.maxEntries)
|
|
14749
14763
|
throw r.fail(
|
|
14750
14764
|
`${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
|
|
14751
|
-
r.maxEntries
|
|
14765
|
+
r.maxEntries,
|
|
14766
|
+
"maxEntries"
|
|
14752
14767
|
);
|
|
14753
14768
|
let declared = 0;
|
|
14754
14769
|
for (const entry2 of entries) {
|
|
14755
14770
|
const original = entry2.unsafeOriginalName;
|
|
14756
14771
|
if (!isSafePartName(entry2.name) || original !== void 0 && !isSafePartName(original))
|
|
14757
|
-
throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries);
|
|
14772
|
+
throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries, "partName");
|
|
14758
14773
|
if (entry2.dir) continue;
|
|
14759
14774
|
const size = declaredEntrySize(entry2);
|
|
14760
14775
|
if (size > r.maxEntryBytes)
|
|
14761
14776
|
throw r.fail(
|
|
14762
14777
|
`${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
|
|
14763
|
-
r.maxEntryBytes
|
|
14778
|
+
r.maxEntryBytes,
|
|
14779
|
+
"maxEntryBytes"
|
|
14764
14780
|
);
|
|
14765
14781
|
declared += size;
|
|
14766
14782
|
}
|
|
14767
14783
|
if (declared > r.maxTotalBytes)
|
|
14768
14784
|
throw r.fail(
|
|
14769
14785
|
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
14770
|
-
r.maxTotalBytes
|
|
14786
|
+
r.maxTotalBytes,
|
|
14787
|
+
"maxTotalBytes"
|
|
14771
14788
|
);
|
|
14772
14789
|
const produced = /* @__PURE__ */ new Map();
|
|
14773
14790
|
let total = 0;
|
|
@@ -14805,7 +14822,8 @@ async function openZip(input, limits = {}) {
|
|
|
14805
14822
|
if (bytes.byteLength > maxInput)
|
|
14806
14823
|
throw r.fail(
|
|
14807
14824
|
`${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
|
|
14808
|
-
maxInput
|
|
14825
|
+
maxInput,
|
|
14826
|
+
"maxInputBytes"
|
|
14809
14827
|
);
|
|
14810
14828
|
return guardZip(await JSZip__default.default.loadAsync(bytes), limits);
|
|
14811
14829
|
}
|
|
@@ -14821,10 +14839,13 @@ var init_zip_limits = __esm({
|
|
|
14821
14839
|
ZipLimitError = class extends Error {
|
|
14822
14840
|
code = "ZIP_BOMB";
|
|
14823
14841
|
limit;
|
|
14842
|
+
/** The check that failed (absent when the error was built without one). */
|
|
14843
|
+
kind;
|
|
14824
14844
|
constructor(message, details) {
|
|
14825
14845
|
super(message);
|
|
14826
14846
|
this.name = "ZipLimitError";
|
|
14827
14847
|
this.limit = details.limit;
|
|
14848
|
+
this.kind = details.kind;
|
|
14828
14849
|
}
|
|
14829
14850
|
};
|
|
14830
14851
|
mib = (bytes) => Math.round(bytes / 1048576);
|
|
@@ -33278,9 +33299,18 @@ function checkXmlLimits(xml, label, limits = {}) {
|
|
|
33278
33299
|
continue;
|
|
33279
33300
|
}
|
|
33280
33301
|
nodes++;
|
|
33281
|
-
if (nodes > maxNodes)
|
|
33302
|
+
if (nodes > maxNodes)
|
|
33303
|
+
throw new XmlLimitError(
|
|
33304
|
+
`${label} XML exceeds the limit of ${maxNodes} elements`,
|
|
33305
|
+
"maxNodes",
|
|
33306
|
+
maxNodes
|
|
33307
|
+
);
|
|
33282
33308
|
if (!selfClosing && ++depth > maxDepth2)
|
|
33283
|
-
throw new
|
|
33309
|
+
throw new XmlLimitError(
|
|
33310
|
+
`${label} XML exceeds the nesting depth limit of ${maxDepth2}`,
|
|
33311
|
+
"maxDepth",
|
|
33312
|
+
maxDepth2
|
|
33313
|
+
);
|
|
33284
33314
|
}
|
|
33285
33315
|
}
|
|
33286
33316
|
function parseXml(xml, options = {}) {
|
|
@@ -33304,6 +33334,7 @@ function parseXml(xml, options = {}) {
|
|
|
33304
33334
|
}
|
|
33305
33335
|
if (parseError || !parsed.documentElement)
|
|
33306
33336
|
throw new Error(`Invalid ${label} XML: ${parseError || "missing root element"}`);
|
|
33337
|
+
if (CRLF_DECLARATION.test(xml)) crlfDeclarations.add(parsed);
|
|
33307
33338
|
return parsed;
|
|
33308
33339
|
}
|
|
33309
33340
|
function named(element, local, ns, lenient = true) {
|
|
@@ -33313,7 +33344,7 @@ function named(element, local, ns, lenient = true) {
|
|
|
33313
33344
|
function attr(element, local, ns, prefix) {
|
|
33314
33345
|
return element?.getAttributeNS(ns, local) ?? element?.getAttribute(`${prefix}:${local}`) ?? void 0;
|
|
33315
33346
|
}
|
|
33316
|
-
var DEFAULT_XML_LIMITS, TAG_RE, MARKUP_SKIPS, buildXml, isElement, elements, children2, first, relAttr;
|
|
33347
|
+
var DEFAULT_XML_LIMITS, XmlLimitError, TAG_RE, MARKUP_SKIPS, CRLF_DECLARATION, crlfDeclarations, buildXml, isElement, elements, children2, first, relAttr;
|
|
33317
33348
|
var init_xml = __esm({
|
|
33318
33349
|
"xml/xml.ts"() {
|
|
33319
33350
|
init_namespaces();
|
|
@@ -33321,13 +33352,31 @@ var init_xml = __esm({
|
|
|
33321
33352
|
maxDepth: 512,
|
|
33322
33353
|
maxNodes: 5e6
|
|
33323
33354
|
};
|
|
33355
|
+
XmlLimitError = class extends Error {
|
|
33356
|
+
code = "xml-limit";
|
|
33357
|
+
/** The limit that was exceeded. */
|
|
33358
|
+
limit;
|
|
33359
|
+
/** Its value: the largest depth or element count allowed. */
|
|
33360
|
+
maximum;
|
|
33361
|
+
constructor(message, limit, maximum) {
|
|
33362
|
+
super(message);
|
|
33363
|
+
this.name = "XmlLimitError";
|
|
33364
|
+
this.limit = limit;
|
|
33365
|
+
this.maximum = maximum;
|
|
33366
|
+
}
|
|
33367
|
+
};
|
|
33324
33368
|
TAG_RE = /<(\/?)([^\s\/><]+)(?:\s+[^\s=\/><]+\s*=\s*(?:"[^"<]*"|'[^'<]*'))*\s*(\/?)>/y;
|
|
33325
33369
|
MARKUP_SKIPS = [
|
|
33326
33370
|
["<!--", "-->"],
|
|
33327
33371
|
["<![CDATA[", "]]>"],
|
|
33328
33372
|
["<?", "?>"]
|
|
33329
33373
|
];
|
|
33330
|
-
|
|
33374
|
+
CRLF_DECLARATION = /^<\?xml[^>]*\?>\r\n/;
|
|
33375
|
+
crlfDeclarations = /* @__PURE__ */ new WeakSet();
|
|
33376
|
+
buildXml = (node) => {
|
|
33377
|
+
const xml = new xmldom.XMLSerializer().serializeToString(node);
|
|
33378
|
+
return crlfDeclarations.has(node) ? xml.replace(/^(<\?xml[^>]*\?>)\n/, "$1\r\n") : xml;
|
|
33379
|
+
};
|
|
33331
33380
|
isElement = (node) => node.nodeType === 1;
|
|
33332
33381
|
elements = (parent) => Array.from(parent.childNodes).filter(isElement);
|
|
33333
33382
|
children2 = (parent, local, ns, lenient = true) => elements(parent).filter((element) => named(element, local, ns, lenient));
|
|
@@ -53297,13 +53346,14 @@ var init_SlideBuilder = __esm({
|
|
|
53297
53346
|
"pptx/core/builders/sdk/SlideBuilder.ts"() {
|
|
53298
53347
|
init_ElementFactory();
|
|
53299
53348
|
SlideBuilder = class {
|
|
53300
|
-
slide;
|
|
53301
53349
|
/**
|
|
53302
53350
|
* @param slideNumber - 1-based slide number.
|
|
53303
53351
|
* @param layoutPath - Optional layout archive path.
|
|
53304
53352
|
* @param layoutName - Optional layout display name.
|
|
53353
|
+
* @param handler - Loaded deck context for placeholder geometry and text styles.
|
|
53305
53354
|
*/
|
|
53306
|
-
constructor(slideNumber, layoutPath, layoutName) {
|
|
53355
|
+
constructor(slideNumber, layoutPath, layoutName, handler) {
|
|
53356
|
+
this.handler = handler;
|
|
53307
53357
|
this.slide = {
|
|
53308
53358
|
id: `slide${slideNumber}`,
|
|
53309
53359
|
rId: `rId${slideNumber + 1}`,
|
|
@@ -53313,11 +53363,52 @@ var init_SlideBuilder = __esm({
|
|
|
53313
53363
|
layoutName: layoutName ?? "Title Slide"
|
|
53314
53364
|
};
|
|
53315
53365
|
}
|
|
53366
|
+
handler;
|
|
53367
|
+
slide;
|
|
53316
53368
|
/** Add a text box to the slide. */
|
|
53317
53369
|
addText(text2, options) {
|
|
53318
53370
|
this.slide.elements.push(createTextElement(text2, options));
|
|
53319
53371
|
return this;
|
|
53320
53372
|
}
|
|
53373
|
+
/**
|
|
53374
|
+
* Fill a layout placeholder, inheriting its frame and text styles.
|
|
53375
|
+
*
|
|
53376
|
+
* Unlike addText, this writes a real p:ph binding, not a free text box.
|
|
53377
|
+
* Use idx to select repeated slots (for example, Two Content's 1 and 2).
|
|
53378
|
+
* Explicit frame fields override the layout; all other fields inherit.
|
|
53379
|
+
* A standalone builder requires the fourth constructor argument (a loaded
|
|
53380
|
+
* handler), even with an explicit frame, so text styles resolve consistently.
|
|
53381
|
+
* Missing slots without a complete frame throw instead of creating a text box.
|
|
53382
|
+
* Master frames requiring compatible-role fallback are materialized locally
|
|
53383
|
+
* for new content only, keeping existing-deck loading unchanged.
|
|
53384
|
+
*
|
|
53385
|
+
* @example
|
|
53386
|
+
* ```ts
|
|
53387
|
+
* createSlide('Title Slide')
|
|
53388
|
+
* .addPlaceholder('ctrTitle', 'Quarterly review')
|
|
53389
|
+
* .addPlaceholder('subTitle', 'October 2026');
|
|
53390
|
+
* createSlide('Two Content').addPlaceholder('body', 'Right column', { idx: 2 });
|
|
53391
|
+
* ```
|
|
53392
|
+
*/
|
|
53393
|
+
addPlaceholder(type, text2, options = {}) {
|
|
53394
|
+
const input = createTextElement(text2);
|
|
53395
|
+
const context = `Slide ${this.slide.slideNumber} (${this.slide.id}), placeholder ${type} idx=${options.idx ?? "auto"}, layout ${this.slide.layoutName} (${this.slide.layoutPath})`;
|
|
53396
|
+
try {
|
|
53397
|
+
if (!this.handler) {
|
|
53398
|
+
throw new Error(
|
|
53399
|
+
"addPlaceholder requires a loaded handler as the fourth SlideBuilder constructor argument"
|
|
53400
|
+
);
|
|
53401
|
+
}
|
|
53402
|
+
this.slide.elements.push(
|
|
53403
|
+
this.handler.createPlaceholderElement(this.slide.layoutPath, input, type, options)
|
|
53404
|
+
);
|
|
53405
|
+
} catch (error) {
|
|
53406
|
+
throw new Error(`${context}: ${error instanceof Error ? error.message : String(error)}`, {
|
|
53407
|
+
cause: error
|
|
53408
|
+
});
|
|
53409
|
+
}
|
|
53410
|
+
return this;
|
|
53411
|
+
}
|
|
53321
53412
|
/** Add a shape to the slide. */
|
|
53322
53413
|
addShape(shapeType, options) {
|
|
53323
53414
|
this.slide.elements.push(createShapeElement(shapeType, options));
|
|
@@ -53557,6 +53648,34 @@ var init_SlideBuilder = __esm({
|
|
|
53557
53648
|
};
|
|
53558
53649
|
}
|
|
53559
53650
|
});
|
|
53651
|
+
|
|
53652
|
+
// pptx/core/builders/sdk/layout-operations.ts
|
|
53653
|
+
function pxToEmu(px2) {
|
|
53654
|
+
return Math.round(px2 * EMU_PER_PIXEL2);
|
|
53655
|
+
}
|
|
53656
|
+
function placeholderSpXml(ph, shapeId) {
|
|
53657
|
+
const name = ph.name ?? `${ph.type.charAt(0).toUpperCase() + ph.type.slice(1)} Placeholder ${shapeId - 1}`;
|
|
53658
|
+
const x = pxToEmu(ph.x);
|
|
53659
|
+
const y = pxToEmu(ph.y);
|
|
53660
|
+
const cx = pxToEmu(ph.width);
|
|
53661
|
+
const cy = pxToEmu(ph.height);
|
|
53662
|
+
const idxAttr = ph.idx !== void 0 ? ` idx="${Math.max(0, Math.round(ph.idx))}"` : "";
|
|
53663
|
+
return ` <p:sp>
|
|
53664
|
+
<p:nvSpPr>
|
|
53665
|
+
<p:cNvPr id="${shapeId}" name="${escAttr(name)}"/>
|
|
53666
|
+
<p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>
|
|
53667
|
+
<p:nvPr><p:ph type="${escAttr(ph.type)}"${idxAttr}/></p:nvPr>
|
|
53668
|
+
</p:nvSpPr>
|
|
53669
|
+
<p:spPr>
|
|
53670
|
+
<a:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>
|
|
53671
|
+
</p:spPr>
|
|
53672
|
+
<p:txBody>
|
|
53673
|
+
<a:bodyPr/>
|
|
53674
|
+
<a:lstStyle/>
|
|
53675
|
+
<a:p><a:endParaRPr lang="en-US"/></a:p>
|
|
53676
|
+
</p:txBody>
|
|
53677
|
+
</p:sp>`;
|
|
53678
|
+
}
|
|
53560
53679
|
function normalizeSrgbHex(color2) {
|
|
53561
53680
|
if (!color2) {
|
|
53562
53681
|
return void 0;
|
|
@@ -53570,10 +53689,111 @@ function normalizeSrgbHex(color2) {
|
|
|
53570
53689
|
}
|
|
53571
53690
|
return void 0;
|
|
53572
53691
|
}
|
|
53692
|
+
function generateLayoutXml(definition) {
|
|
53693
|
+
const layoutType = definition.type ?? "obj";
|
|
53694
|
+
const placeholders = definition.placeholders ?? [];
|
|
53695
|
+
const phShapes = placeholders.map((ph, i2) => placeholderSpXml(ph, i2 + 2)).join("\n");
|
|
53696
|
+
let bgXml = "";
|
|
53697
|
+
const hex3 = normalizeSrgbHex(definition.backgroundColor);
|
|
53698
|
+
if (hex3) {
|
|
53699
|
+
bgXml = ` <p:bg><p:bgPr><a:solidFill><a:srgbClr val="${hex3}"/></a:solidFill><a:effectLst/></p:bgPr></p:bg>
|
|
53700
|
+
`;
|
|
53701
|
+
}
|
|
53702
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
53703
|
+
<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
53704
|
+
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
53705
|
+
xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
53706
|
+
type="${escAttr(layoutType)}" preserve="1">
|
|
53707
|
+
<p:cSld name="${escAttr(definition.name)}">
|
|
53708
|
+
${bgXml} <p:spTree>
|
|
53709
|
+
<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
|
|
53710
|
+
<p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>
|
|
53711
|
+
${phShapes}
|
|
53712
|
+
</p:spTree>
|
|
53713
|
+
</p:cSld>
|
|
53714
|
+
<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
|
|
53715
|
+
</p:sldLayout>`;
|
|
53716
|
+
}
|
|
53717
|
+
var EMU_PER_PIXEL2;
|
|
53718
|
+
var init_layout_operations = __esm({
|
|
53719
|
+
"pptx/core/builders/sdk/layout-operations.ts"() {
|
|
53720
|
+
init_xml_utils();
|
|
53721
|
+
EMU_PER_PIXEL2 = 9525;
|
|
53722
|
+
}
|
|
53723
|
+
});
|
|
53724
|
+
|
|
53725
|
+
// pptx/core/builders/sdk/standard-layout-placeholders.ts
|
|
53726
|
+
function standardLayoutPlaceholders(type, width, height) {
|
|
53727
|
+
if (type === "blank") return [];
|
|
53728
|
+
const box = (type2, idx, x, y, w, h2) => ({
|
|
53729
|
+
type: type2,
|
|
53730
|
+
idx,
|
|
53731
|
+
x: x * width,
|
|
53732
|
+
y: y * height,
|
|
53733
|
+
width: w * width,
|
|
53734
|
+
height: h2 * height
|
|
53735
|
+
});
|
|
53736
|
+
const title = box("title", 0, 0.05, 0.04, 0.9, 0.15);
|
|
53737
|
+
const content2 = box("obj", 1, 0.05, 0.23, 0.9, 0.64);
|
|
53738
|
+
let slots;
|
|
53739
|
+
switch (type) {
|
|
53740
|
+
case "title":
|
|
53741
|
+
slots = [
|
|
53742
|
+
box("ctrTitle", 0, 0.08, 0.24, 0.84, 0.22),
|
|
53743
|
+
box("subTitle", 1, 0.12, 0.49, 0.76, 0.2)
|
|
53744
|
+
];
|
|
53745
|
+
break;
|
|
53746
|
+
case "secHead":
|
|
53747
|
+
slots = [box("title", 0, 0.05, 0.37, 0.9, 0.2), box("body", 1, 0.05, 0.6, 0.9, 0.23)];
|
|
53748
|
+
break;
|
|
53749
|
+
case "twoObj":
|
|
53750
|
+
case "twoTxTwoObj":
|
|
53751
|
+
slots = [title, box("obj", 1, 0.05, 0.27, 0.43, 0.6), box("obj", 2, 0.52, 0.27, 0.43, 0.6)];
|
|
53752
|
+
if (type === "twoTxTwoObj")
|
|
53753
|
+
slots.push(box("body", 3, 0.05, 0.2, 0.43, 0.07), box("body", 4, 0.52, 0.2, 0.43, 0.07));
|
|
53754
|
+
break;
|
|
53755
|
+
case "titleOnly":
|
|
53756
|
+
slots = [title];
|
|
53757
|
+
break;
|
|
53758
|
+
case "objTx":
|
|
53759
|
+
case "picTx":
|
|
53760
|
+
slots = [
|
|
53761
|
+
title,
|
|
53762
|
+
box(type === "picTx" ? "pic" : "obj", 1, 0.36, 0.23, 0.59, 0.64),
|
|
53763
|
+
box("body", 2, 0.05, 0.23, 0.27, 0.64)
|
|
53764
|
+
];
|
|
53765
|
+
break;
|
|
53766
|
+
default:
|
|
53767
|
+
slots = [title, content2];
|
|
53768
|
+
}
|
|
53769
|
+
return [
|
|
53770
|
+
...slots,
|
|
53771
|
+
box("dt", 10, 0.05, 0.92, 0.25, 0.04),
|
|
53772
|
+
box("ftr", 11, 0.33, 0.92, 0.34, 0.04),
|
|
53773
|
+
box("sldNum", 12, 0.75, 0.92, 0.2, 0.04)
|
|
53774
|
+
];
|
|
53775
|
+
}
|
|
53776
|
+
var init_standard_layout_placeholders = __esm({
|
|
53777
|
+
"pptx/core/builders/sdk/standard-layout-placeholders.ts"() {
|
|
53778
|
+
}
|
|
53779
|
+
});
|
|
53780
|
+
function normalizeSrgbHex2(color2) {
|
|
53781
|
+
if (!color2) {
|
|
53782
|
+
return void 0;
|
|
53783
|
+
}
|
|
53784
|
+
const raw = color2.trim().replace(/^#/, "").toUpperCase();
|
|
53785
|
+
if (/^[0-9A-F]{6}$/.test(raw)) {
|
|
53786
|
+
return raw;
|
|
53787
|
+
}
|
|
53788
|
+
if (/^[0-9A-F]{3}$/.test(raw)) {
|
|
53789
|
+
return raw.replace(/./g, (ch) => ch + ch);
|
|
53790
|
+
}
|
|
53791
|
+
return void 0;
|
|
53792
|
+
}
|
|
53573
53793
|
function resolveThemeColors(overrides) {
|
|
53574
53794
|
const resolved = {};
|
|
53575
53795
|
for (const [key2, fallback] of Object.entries(DEFAULT_COLORS2)) {
|
|
53576
|
-
resolved[key2] =
|
|
53796
|
+
resolved[key2] = normalizeSrgbHex2(overrides?.[key2]) ?? normalizeSrgbHex2(fallback) ?? "000000";
|
|
53577
53797
|
}
|
|
53578
53798
|
return resolved;
|
|
53579
53799
|
}
|
|
@@ -53713,21 +53933,6 @@ ${layoutRels}
|
|
|
53713
53933
|
<Relationship Id="rId${layoutCount + 1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>
|
|
53714
53934
|
</Relationships>`;
|
|
53715
53935
|
}
|
|
53716
|
-
function slideLayoutXml(name, layoutType) {
|
|
53717
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
53718
|
-
<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
53719
|
-
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
53720
|
-
xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
53721
|
-
type="${escAttr(layoutType)}" preserve="1">
|
|
53722
|
-
<p:cSld name="${escAttr(name)}">
|
|
53723
|
-
<p:spTree>
|
|
53724
|
-
<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
|
|
53725
|
-
<p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>
|
|
53726
|
-
</p:spTree>
|
|
53727
|
-
</p:cSld>
|
|
53728
|
-
<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
|
|
53729
|
-
</p:sldLayout>`;
|
|
53730
|
-
}
|
|
53731
53936
|
function slideLayoutRelsXml() {
|
|
53732
53937
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
53733
53938
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
@@ -53876,7 +54081,14 @@ async function buildBlankPresentationArchive(options) {
|
|
|
53876
54081
|
zip.file("ppt/slideMasters/_rels/slideMaster1.xml.rels", slideMasterRelsXml(layoutCount));
|
|
53877
54082
|
for (let i2 = 0; i2 < layoutCount; i2++) {
|
|
53878
54083
|
const layout = STANDARD_LAYOUTS[i2];
|
|
53879
|
-
zip.file(
|
|
54084
|
+
zip.file(
|
|
54085
|
+
`ppt/slideLayouts/slideLayout${i2 + 1}.xml`,
|
|
54086
|
+
generateLayoutXml({
|
|
54087
|
+
name: layout.name,
|
|
54088
|
+
type: layout.type,
|
|
54089
|
+
placeholders: standardLayoutPlaceholders(layout.type, width / 9525, height / 9525)
|
|
54090
|
+
})
|
|
54091
|
+
);
|
|
53880
54092
|
zip.file(`ppt/slideLayouts/_rels/slideLayout${i2 + 1}.xml.rels`, slideLayoutRelsXml());
|
|
53881
54093
|
}
|
|
53882
54094
|
for (let i2 = 0; i2 < initialSlideCount; i2++) {
|
|
@@ -53897,6 +54109,8 @@ var init_PresentationBuilder = __esm({
|
|
|
53897
54109
|
init_xml_utils();
|
|
53898
54110
|
init_PptxHandler();
|
|
53899
54111
|
init_SlideBuilder();
|
|
54112
|
+
init_layout_operations();
|
|
54113
|
+
init_standard_layout_placeholders();
|
|
53900
54114
|
DEFAULT_WIDTH = 12192e3;
|
|
53901
54115
|
DEFAULT_HEIGHT = 6858e3;
|
|
53902
54116
|
DEFAULT_COLORS2 = {
|
|
@@ -53954,7 +54168,7 @@ var init_PresentationBuilder = __esm({
|
|
|
53954
54168
|
const layoutIdx = STANDARD_LAYOUTS.findIndex((l) => l.name === layoutName) + 1 || 7;
|
|
53955
54169
|
const layoutPath = `ppt/slideLayouts/slideLayout${layoutIdx}.xml`;
|
|
53956
54170
|
const resolvedName = layoutName ?? STANDARD_LAYOUTS[layoutIdx - 1]?.name ?? "Blank";
|
|
53957
|
-
return new SlideBuilder(slideNum, layoutPath, resolvedName);
|
|
54171
|
+
return new SlideBuilder(slideNum, layoutPath, resolvedName, handler);
|
|
53958
54172
|
};
|
|
53959
54173
|
return { handler, data, createSlide };
|
|
53960
54174
|
}
|
|
@@ -56358,6 +56572,165 @@ var init_inherited_shape_transform = __esm({
|
|
|
56358
56572
|
}
|
|
56359
56573
|
});
|
|
56360
56574
|
|
|
56575
|
+
// pptx/core/utils/placeholder-xml.ts
|
|
56576
|
+
function findNonVisualProps(rawXml) {
|
|
56577
|
+
for (const container2 of ["p:nvSpPr", "p:nvPicPr", "p:nvGraphicFramePr"]) {
|
|
56578
|
+
const parent = rawXml[container2];
|
|
56579
|
+
const nvPr = parent?.["p:nvPr"];
|
|
56580
|
+
if (nvPr) {
|
|
56581
|
+
return nvPr;
|
|
56582
|
+
}
|
|
56583
|
+
}
|
|
56584
|
+
return void 0;
|
|
56585
|
+
}
|
|
56586
|
+
function retargetPlaceholder(rawXml, target) {
|
|
56587
|
+
const nvPr = findNonVisualProps(rawXml);
|
|
56588
|
+
if (!nvPr) {
|
|
56589
|
+
return;
|
|
56590
|
+
}
|
|
56591
|
+
const ph = nvPr["p:ph"] ?? {};
|
|
56592
|
+
nvPr["p:ph"] = ph;
|
|
56593
|
+
if (target.type) {
|
|
56594
|
+
ph["@_type"] = target.type;
|
|
56595
|
+
} else {
|
|
56596
|
+
delete ph["@_type"];
|
|
56597
|
+
}
|
|
56598
|
+
if (target.idx !== void 0) {
|
|
56599
|
+
ph["@_idx"] = target.idx;
|
|
56600
|
+
} else {
|
|
56601
|
+
delete ph["@_idx"];
|
|
56602
|
+
}
|
|
56603
|
+
}
|
|
56604
|
+
function setRawXmlTransform(rawXml, xEmu, yEmu, cxEmu, cyEmu) {
|
|
56605
|
+
const spPr = rawXml["p:spPr"];
|
|
56606
|
+
if (!spPr) {
|
|
56607
|
+
return;
|
|
56608
|
+
}
|
|
56609
|
+
const xfrm = spPr["a:xfrm"] ?? {};
|
|
56610
|
+
spPr["a:xfrm"] = xfrm;
|
|
56611
|
+
const off = xfrm["a:off"] ?? {};
|
|
56612
|
+
xfrm["a:off"] = off;
|
|
56613
|
+
off["@_x"] = String(xEmu);
|
|
56614
|
+
off["@_y"] = String(yEmu);
|
|
56615
|
+
const ext = xfrm["a:ext"] ?? {};
|
|
56616
|
+
xfrm["a:ext"] = ext;
|
|
56617
|
+
ext["@_cx"] = String(cxEmu);
|
|
56618
|
+
ext["@_cy"] = String(cyEmu);
|
|
56619
|
+
}
|
|
56620
|
+
function createEmptyPlaceholderElement(target, xEmu, yEmu, cxEmu, cyEmu, uniqueId) {
|
|
56621
|
+
if (cxEmu <= 0 || cyEmu <= 0) {
|
|
56622
|
+
return null;
|
|
56623
|
+
}
|
|
56624
|
+
const phNode = {};
|
|
56625
|
+
if (target.type) {
|
|
56626
|
+
phNode["@_type"] = target.type;
|
|
56627
|
+
}
|
|
56628
|
+
if (target.idx !== void 0) {
|
|
56629
|
+
phNode["@_idx"] = target.idx;
|
|
56630
|
+
}
|
|
56631
|
+
const rawXml = {
|
|
56632
|
+
"p:nvSpPr": {
|
|
56633
|
+
"p:cNvPr": {
|
|
56634
|
+
"@_id": uniqueId,
|
|
56635
|
+
"@_name": `Placeholder ${target.type || "content"}`
|
|
56636
|
+
},
|
|
56637
|
+
"p:cNvSpPr": {
|
|
56638
|
+
"a:spLocks": { "@_noGrp": "1" }
|
|
56639
|
+
},
|
|
56640
|
+
"p:nvPr": {
|
|
56641
|
+
"p:ph": phNode
|
|
56642
|
+
}
|
|
56643
|
+
},
|
|
56644
|
+
"p:spPr": {
|
|
56645
|
+
"a:xfrm": {
|
|
56646
|
+
"a:off": { "@_x": String(xEmu), "@_y": String(yEmu) },
|
|
56647
|
+
"a:ext": { "@_cx": String(cxEmu), "@_cy": String(cyEmu) }
|
|
56648
|
+
}
|
|
56649
|
+
},
|
|
56650
|
+
"p:txBody": {
|
|
56651
|
+
"a:bodyPr": {},
|
|
56652
|
+
"a:lstStyle": {},
|
|
56653
|
+
"a:p": { "a:endParaRPr": { "@_lang": "en-US" } }
|
|
56654
|
+
}
|
|
56655
|
+
};
|
|
56656
|
+
return {
|
|
56657
|
+
type: "text",
|
|
56658
|
+
id: `ph-${target.type || "content"}-${target.idx ?? "0"}-${uniqueId}`,
|
|
56659
|
+
x: Math.round(xEmu / EMU_PER_PX),
|
|
56660
|
+
y: Math.round(yEmu / EMU_PER_PX),
|
|
56661
|
+
width: Math.round(cxEmu / EMU_PER_PX),
|
|
56662
|
+
height: Math.round(cyEmu / EMU_PER_PX),
|
|
56663
|
+
text: "",
|
|
56664
|
+
rawXml
|
|
56665
|
+
};
|
|
56666
|
+
}
|
|
56667
|
+
var init_placeholder_xml = __esm({
|
|
56668
|
+
"pptx/core/utils/placeholder-xml.ts"() {
|
|
56669
|
+
init_constants2();
|
|
56670
|
+
}
|
|
56671
|
+
});
|
|
56672
|
+
|
|
56673
|
+
// pptx/core/core/runtime/save-geometry-validation.ts
|
|
56674
|
+
function omitsInheritedFrame(element) {
|
|
56675
|
+
if (!["text", "shape", "picture", "media"].includes(element.type) || !element.rawXml)
|
|
56676
|
+
return false;
|
|
56677
|
+
if (!xmlHasChild(findNonVisualProps(element.rawXml), "p:ph")) return false;
|
|
56678
|
+
if (xmlHasChild(xmlChild(element.rawXml, "p:spPr"), "a:xfrm") || xmlHasChild(element.rawXml, "p:xfrm"))
|
|
56679
|
+
return false;
|
|
56680
|
+
const baseline = element.inheritedTransform;
|
|
56681
|
+
if (!baseline) return FRAME_FIELDS.every((key2) => element[key2] === void 0);
|
|
56682
|
+
return FRAME_FIELDS.every(
|
|
56683
|
+
(key2) => Number.isFinite(baseline[key2]) && (element[key2] === void 0 || element[key2] === baseline[key2])
|
|
56684
|
+
) && ["rotation", "skewX", "skewY", "flipHorizontal", "flipVertical"].every(
|
|
56685
|
+
(key2) => (element[key2] ?? 0) === (baseline[key2] ?? 0)
|
|
56686
|
+
);
|
|
56687
|
+
}
|
|
56688
|
+
function validateElementGeometry(element, context, emuPerPx = 9525) {
|
|
56689
|
+
const inherited = omitsInheritedFrame(element);
|
|
56690
|
+
const record2 = element;
|
|
56691
|
+
const fields = [...inherited ? [] : FRAME_FIELDS, ...OPTIONAL_FIELDS];
|
|
56692
|
+
for (const field of fields) {
|
|
56693
|
+
const value = record2[field];
|
|
56694
|
+
if (OPTIONAL_FIELDS.includes(field) && value === void 0) continue;
|
|
56695
|
+
if (typeof value !== "number" || !Number.isFinite(value) || !Number.isFinite(value * emuPerPx)) {
|
|
56696
|
+
throw new Error(
|
|
56697
|
+
`${context}: element '${element.id}' (${element.name ?? "unnamed"}, type=${element.type}) has invalid ${field}=${String(value)}; expected a finite number`
|
|
56698
|
+
);
|
|
56699
|
+
}
|
|
56700
|
+
}
|
|
56701
|
+
if (element.type === "group") {
|
|
56702
|
+
for (const child31 of element.children) validateElementGeometry(child31, context, emuPerPx);
|
|
56703
|
+
}
|
|
56704
|
+
}
|
|
56705
|
+
function validateSlideGeometry(slides) {
|
|
56706
|
+
for (const slide of slides) {
|
|
56707
|
+
for (const element of slide.elements) {
|
|
56708
|
+
validateElementGeometry(element, `Slide ${slide.slideNumber} (${slide.id})`);
|
|
56709
|
+
}
|
|
56710
|
+
}
|
|
56711
|
+
}
|
|
56712
|
+
var FRAME_FIELDS, OPTIONAL_FIELDS;
|
|
56713
|
+
var init_save_geometry_validation = __esm({
|
|
56714
|
+
"pptx/core/core/runtime/save-geometry-validation.ts"() {
|
|
56715
|
+
init_placeholder_xml();
|
|
56716
|
+
init_xml_access();
|
|
56717
|
+
FRAME_FIELDS = ["x", "y", "width", "height"];
|
|
56718
|
+
OPTIONAL_FIELDS = [
|
|
56719
|
+
"xEmu",
|
|
56720
|
+
"yEmu",
|
|
56721
|
+
"widthEmu",
|
|
56722
|
+
"heightEmu",
|
|
56723
|
+
"rotation",
|
|
56724
|
+
"skewX",
|
|
56725
|
+
"skewY",
|
|
56726
|
+
"chOffXEmu",
|
|
56727
|
+
"chOffYEmu",
|
|
56728
|
+
"chExtWidthEmu",
|
|
56729
|
+
"chExtHeightEmu"
|
|
56730
|
+
];
|
|
56731
|
+
}
|
|
56732
|
+
});
|
|
56733
|
+
|
|
56361
56734
|
// pptx/core/core/builders/PptxElementTransformUpdater.ts
|
|
56362
56735
|
var PptxElementTransformUpdater;
|
|
56363
56736
|
var init_PptxElementTransformUpdater = __esm({
|
|
@@ -56367,6 +56740,7 @@ var init_PptxElementTransformUpdater = __esm({
|
|
|
56367
56740
|
init_xml_access();
|
|
56368
56741
|
init_group_tight_rewrap();
|
|
56369
56742
|
init_inherited_shape_transform();
|
|
56743
|
+
init_save_geometry_validation();
|
|
56370
56744
|
PptxElementTransformUpdater = class {
|
|
56371
56745
|
applyTransform(shape, element, emuPerPx, enclosingGroupChildSpace) {
|
|
56372
56746
|
const transform7 = shape["p:spPr"]?.["a:xfrm"] || shape["p:xfrm"] || // A group's child geometry uses a different frame from the load-time baseline.
|
|
@@ -56374,6 +56748,7 @@ var init_PptxElementTransformUpdater = __esm({
|
|
|
56374
56748
|
if (!transform7) {
|
|
56375
56749
|
return;
|
|
56376
56750
|
}
|
|
56751
|
+
validateElementGeometry(element, "Transform writer", emuPerPx);
|
|
56377
56752
|
if (!transform7["a:off"]) {
|
|
56378
56753
|
transform7["a:off"] = {};
|
|
56379
56754
|
}
|
|
@@ -59408,7 +59783,7 @@ function parseBorderSide(side) {
|
|
|
59408
59783
|
}
|
|
59409
59784
|
const widthEmu = parseInt(String(ln["@_w"] || "0"), 10);
|
|
59410
59785
|
if (widthEmu > 0) {
|
|
59411
|
-
border.width = Math.max(1, Math.round(widthEmu /
|
|
59786
|
+
border.width = Math.max(1, Math.round(widthEmu / EMU_PER_PIXEL3));
|
|
59412
59787
|
has2 = true;
|
|
59413
59788
|
}
|
|
59414
59789
|
const prstDash = ln["a:prstDash"];
|
|
@@ -59465,12 +59840,12 @@ function parseTableStyleSectionCell3D(tcStyle) {
|
|
|
59465
59840
|
if (bevel2) {
|
|
59466
59841
|
const bevelWidth = parseInt(String(bevel2["@_w"] || "0"), 10);
|
|
59467
59842
|
if (bevelWidth > 0) {
|
|
59468
|
-
cell3D.bevelWidth = Math.round(bevelWidth /
|
|
59843
|
+
cell3D.bevelWidth = Math.round(bevelWidth / EMU_PER_PIXEL3);
|
|
59469
59844
|
hasStyle = true;
|
|
59470
59845
|
}
|
|
59471
59846
|
const bevelHeight = parseInt(String(bevel2["@_h"] || "0"), 10);
|
|
59472
59847
|
if (bevelHeight > 0) {
|
|
59473
|
-
cell3D.bevelHeight = Math.round(bevelHeight /
|
|
59848
|
+
cell3D.bevelHeight = Math.round(bevelHeight / EMU_PER_PIXEL3);
|
|
59474
59849
|
hasStyle = true;
|
|
59475
59850
|
}
|
|
59476
59851
|
const bevelPreset = String(bevel2["@_prst"] || "").trim();
|
|
@@ -59494,11 +59869,11 @@ function parseTableStyleSectionCell3D(tcStyle) {
|
|
|
59494
59869
|
}
|
|
59495
59870
|
return hasStyle ? cell3D : void 0;
|
|
59496
59871
|
}
|
|
59497
|
-
var
|
|
59872
|
+
var EMU_PER_PIXEL3, BORDER_SIDES;
|
|
59498
59873
|
var init_table_style_border_parse = __esm({
|
|
59499
59874
|
"pptx/core/core/runtime/table-style-border-parse.ts"() {
|
|
59500
59875
|
init_color_primitives();
|
|
59501
|
-
|
|
59876
|
+
EMU_PER_PIXEL3 = 9525;
|
|
59502
59877
|
BORDER_SIDES = [
|
|
59503
59878
|
"left",
|
|
59504
59879
|
"right",
|
|
@@ -88551,6 +88926,80 @@ var init_factories = __esm({
|
|
|
88551
88926
|
}
|
|
88552
88927
|
});
|
|
88553
88928
|
|
|
88929
|
+
// pptx/core/utils/placeholder-remap.ts
|
|
88930
|
+
function placeholderContentRole(type) {
|
|
88931
|
+
const declared = (type ?? "").trim().toLowerCase() || "body";
|
|
88932
|
+
if (TITLE_ROLE.has(declared)) {
|
|
88933
|
+
return "title";
|
|
88934
|
+
}
|
|
88935
|
+
if (CONTENT_ROLE.has(declared)) {
|
|
88936
|
+
return "content";
|
|
88937
|
+
}
|
|
88938
|
+
return declared;
|
|
88939
|
+
}
|
|
88940
|
+
function preferredPlaceholderTypes(element) {
|
|
88941
|
+
switch (element.type) {
|
|
88942
|
+
case "image":
|
|
88943
|
+
case "picture":
|
|
88944
|
+
return ["pic", "obj", "body"];
|
|
88945
|
+
case "chart":
|
|
88946
|
+
return ["chart", "obj", "body"];
|
|
88947
|
+
case "table":
|
|
88948
|
+
return ["tbl", "obj", "body"];
|
|
88949
|
+
case "media":
|
|
88950
|
+
case "model3d":
|
|
88951
|
+
return ["media", "pic", "obj", "body"];
|
|
88952
|
+
case "smartArt":
|
|
88953
|
+
return ["dgm", "obj", "body"];
|
|
88954
|
+
case "text":
|
|
88955
|
+
return ["body", "subtitle", "obj"];
|
|
88956
|
+
default:
|
|
88957
|
+
return ["obj", "body"];
|
|
88958
|
+
}
|
|
88959
|
+
}
|
|
88960
|
+
function scorePlaceholderMatch(element, source, target) {
|
|
88961
|
+
if (placeholderContentRole(source.type) !== placeholderContentRole(target.type)) {
|
|
88962
|
+
return -1;
|
|
88963
|
+
}
|
|
88964
|
+
const sourceType = normalizeType(source.type);
|
|
88965
|
+
const targetType = normalizeType(target.type);
|
|
88966
|
+
let score = 1;
|
|
88967
|
+
if (source.idx !== void 0 && source.idx === target.idx) {
|
|
88968
|
+
score += 100;
|
|
88969
|
+
}
|
|
88970
|
+
if (sourceType === targetType) {
|
|
88971
|
+
score += 50;
|
|
88972
|
+
}
|
|
88973
|
+
const preferred = preferredPlaceholderTypes(element).indexOf(targetType);
|
|
88974
|
+
if (preferred >= 0) {
|
|
88975
|
+
score += 30 - preferred * 5;
|
|
88976
|
+
}
|
|
88977
|
+
if (targetType === "obj") {
|
|
88978
|
+
score += 10;
|
|
88979
|
+
}
|
|
88980
|
+
return score;
|
|
88981
|
+
}
|
|
88982
|
+
function normalizeType(type) {
|
|
88983
|
+
return (type ?? "").trim().toLowerCase() || "body";
|
|
88984
|
+
}
|
|
88985
|
+
var TITLE_ROLE, CONTENT_ROLE;
|
|
88986
|
+
var init_placeholder_remap = __esm({
|
|
88987
|
+
"pptx/core/utils/placeholder-remap.ts"() {
|
|
88988
|
+
TITLE_ROLE = /* @__PURE__ */ new Set(["title", "ctrtitle"]);
|
|
88989
|
+
CONTENT_ROLE = /* @__PURE__ */ new Set([
|
|
88990
|
+
"body",
|
|
88991
|
+
"obj",
|
|
88992
|
+
"subtitle",
|
|
88993
|
+
"pic",
|
|
88994
|
+
"chart",
|
|
88995
|
+
"tbl",
|
|
88996
|
+
"media",
|
|
88997
|
+
"clipart",
|
|
88998
|
+
"dgm"
|
|
88999
|
+
]);
|
|
89000
|
+
}
|
|
89001
|
+
});
|
|
89002
|
+
|
|
88554
89003
|
// pptx/core/core/runtime/master-save-helpers.ts
|
|
88555
89004
|
function applyHeaderFooterFlagsToNode(root, flags) {
|
|
88556
89005
|
if (!flags || Object.keys(flags).length === 0) {
|
|
@@ -108061,178 +108510,6 @@ var init_chart_user_shapes_serializer = __esm({
|
|
|
108061
108510
|
}
|
|
108062
108511
|
});
|
|
108063
108512
|
|
|
108064
|
-
// pptx/core/utils/placeholder-remap.ts
|
|
108065
|
-
function placeholderContentRole(type) {
|
|
108066
|
-
const declared = (type ?? "").trim().toLowerCase() || "body";
|
|
108067
|
-
if (TITLE_ROLE.has(declared)) {
|
|
108068
|
-
return "title";
|
|
108069
|
-
}
|
|
108070
|
-
if (CONTENT_ROLE.has(declared)) {
|
|
108071
|
-
return "content";
|
|
108072
|
-
}
|
|
108073
|
-
return declared;
|
|
108074
|
-
}
|
|
108075
|
-
function preferredPlaceholderTypes(element) {
|
|
108076
|
-
switch (element.type) {
|
|
108077
|
-
case "image":
|
|
108078
|
-
case "picture":
|
|
108079
|
-
return ["pic", "obj", "body"];
|
|
108080
|
-
case "chart":
|
|
108081
|
-
return ["chart", "obj", "body"];
|
|
108082
|
-
case "table":
|
|
108083
|
-
return ["tbl", "obj", "body"];
|
|
108084
|
-
case "media":
|
|
108085
|
-
case "model3d":
|
|
108086
|
-
return ["media", "pic", "obj", "body"];
|
|
108087
|
-
case "smartArt":
|
|
108088
|
-
return ["dgm", "obj", "body"];
|
|
108089
|
-
case "text":
|
|
108090
|
-
return ["body", "subtitle", "obj"];
|
|
108091
|
-
default:
|
|
108092
|
-
return ["obj", "body"];
|
|
108093
|
-
}
|
|
108094
|
-
}
|
|
108095
|
-
function scorePlaceholderMatch(element, source, target) {
|
|
108096
|
-
if (placeholderContentRole(source.type) !== placeholderContentRole(target.type)) {
|
|
108097
|
-
return -1;
|
|
108098
|
-
}
|
|
108099
|
-
const sourceType = normalizeType(source.type);
|
|
108100
|
-
const targetType = normalizeType(target.type);
|
|
108101
|
-
let score = 1;
|
|
108102
|
-
if (source.idx !== void 0 && source.idx === target.idx) {
|
|
108103
|
-
score += 100;
|
|
108104
|
-
}
|
|
108105
|
-
if (sourceType === targetType) {
|
|
108106
|
-
score += 50;
|
|
108107
|
-
}
|
|
108108
|
-
const preferred = preferredPlaceholderTypes(element).indexOf(targetType);
|
|
108109
|
-
if (preferred >= 0) {
|
|
108110
|
-
score += 30 - preferred * 5;
|
|
108111
|
-
}
|
|
108112
|
-
if (targetType === "obj") {
|
|
108113
|
-
score += 10;
|
|
108114
|
-
}
|
|
108115
|
-
return score;
|
|
108116
|
-
}
|
|
108117
|
-
function normalizeType(type) {
|
|
108118
|
-
return (type ?? "").trim().toLowerCase() || "body";
|
|
108119
|
-
}
|
|
108120
|
-
var TITLE_ROLE, CONTENT_ROLE;
|
|
108121
|
-
var init_placeholder_remap = __esm({
|
|
108122
|
-
"pptx/core/utils/placeholder-remap.ts"() {
|
|
108123
|
-
TITLE_ROLE = /* @__PURE__ */ new Set(["title", "ctrtitle"]);
|
|
108124
|
-
CONTENT_ROLE = /* @__PURE__ */ new Set([
|
|
108125
|
-
"body",
|
|
108126
|
-
"obj",
|
|
108127
|
-
"subtitle",
|
|
108128
|
-
"pic",
|
|
108129
|
-
"chart",
|
|
108130
|
-
"tbl",
|
|
108131
|
-
"media",
|
|
108132
|
-
"clipart",
|
|
108133
|
-
"dgm"
|
|
108134
|
-
]);
|
|
108135
|
-
}
|
|
108136
|
-
});
|
|
108137
|
-
|
|
108138
|
-
// pptx/core/utils/placeholder-xml.ts
|
|
108139
|
-
function findNonVisualProps(rawXml) {
|
|
108140
|
-
for (const container2 of ["p:nvSpPr", "p:nvPicPr", "p:nvGraphicFramePr"]) {
|
|
108141
|
-
const parent = rawXml[container2];
|
|
108142
|
-
const nvPr = parent?.["p:nvPr"];
|
|
108143
|
-
if (nvPr) {
|
|
108144
|
-
return nvPr;
|
|
108145
|
-
}
|
|
108146
|
-
}
|
|
108147
|
-
return void 0;
|
|
108148
|
-
}
|
|
108149
|
-
function retargetPlaceholder(rawXml, target) {
|
|
108150
|
-
const nvPr = findNonVisualProps(rawXml);
|
|
108151
|
-
if (!nvPr) {
|
|
108152
|
-
return;
|
|
108153
|
-
}
|
|
108154
|
-
const ph = nvPr["p:ph"] ?? {};
|
|
108155
|
-
nvPr["p:ph"] = ph;
|
|
108156
|
-
if (target.type) {
|
|
108157
|
-
ph["@_type"] = target.type;
|
|
108158
|
-
} else {
|
|
108159
|
-
delete ph["@_type"];
|
|
108160
|
-
}
|
|
108161
|
-
if (target.idx !== void 0) {
|
|
108162
|
-
ph["@_idx"] = target.idx;
|
|
108163
|
-
} else {
|
|
108164
|
-
delete ph["@_idx"];
|
|
108165
|
-
}
|
|
108166
|
-
}
|
|
108167
|
-
function setRawXmlTransform(rawXml, xEmu, yEmu, cxEmu, cyEmu) {
|
|
108168
|
-
const spPr = rawXml["p:spPr"];
|
|
108169
|
-
if (!spPr) {
|
|
108170
|
-
return;
|
|
108171
|
-
}
|
|
108172
|
-
const xfrm = spPr["a:xfrm"] ?? {};
|
|
108173
|
-
spPr["a:xfrm"] = xfrm;
|
|
108174
|
-
const off = xfrm["a:off"] ?? {};
|
|
108175
|
-
xfrm["a:off"] = off;
|
|
108176
|
-
off["@_x"] = String(xEmu);
|
|
108177
|
-
off["@_y"] = String(yEmu);
|
|
108178
|
-
const ext = xfrm["a:ext"] ?? {};
|
|
108179
|
-
xfrm["a:ext"] = ext;
|
|
108180
|
-
ext["@_cx"] = String(cxEmu);
|
|
108181
|
-
ext["@_cy"] = String(cyEmu);
|
|
108182
|
-
}
|
|
108183
|
-
function createEmptyPlaceholderElement(target, xEmu, yEmu, cxEmu, cyEmu, uniqueId) {
|
|
108184
|
-
if (cxEmu <= 0 || cyEmu <= 0) {
|
|
108185
|
-
return null;
|
|
108186
|
-
}
|
|
108187
|
-
const phNode = {};
|
|
108188
|
-
if (target.type) {
|
|
108189
|
-
phNode["@_type"] = target.type;
|
|
108190
|
-
}
|
|
108191
|
-
if (target.idx !== void 0) {
|
|
108192
|
-
phNode["@_idx"] = target.idx;
|
|
108193
|
-
}
|
|
108194
|
-
const rawXml = {
|
|
108195
|
-
"p:nvSpPr": {
|
|
108196
|
-
"p:cNvPr": {
|
|
108197
|
-
"@_id": uniqueId,
|
|
108198
|
-
"@_name": `Placeholder ${target.type || "content"}`
|
|
108199
|
-
},
|
|
108200
|
-
"p:cNvSpPr": {
|
|
108201
|
-
"a:spLocks": { "@_noGrp": "1" }
|
|
108202
|
-
},
|
|
108203
|
-
"p:nvPr": {
|
|
108204
|
-
"p:ph": phNode
|
|
108205
|
-
}
|
|
108206
|
-
},
|
|
108207
|
-
"p:spPr": {
|
|
108208
|
-
"a:xfrm": {
|
|
108209
|
-
"a:off": { "@_x": String(xEmu), "@_y": String(yEmu) },
|
|
108210
|
-
"a:ext": { "@_cx": String(cxEmu), "@_cy": String(cyEmu) }
|
|
108211
|
-
}
|
|
108212
|
-
},
|
|
108213
|
-
"p:txBody": {
|
|
108214
|
-
"a:bodyPr": {},
|
|
108215
|
-
"a:lstStyle": {},
|
|
108216
|
-
"a:p": { "a:endParaRPr": { "@_lang": "en-US" } }
|
|
108217
|
-
}
|
|
108218
|
-
};
|
|
108219
|
-
return {
|
|
108220
|
-
type: "text",
|
|
108221
|
-
id: `ph-${target.type || "content"}-${target.idx ?? "0"}-${uniqueId}`,
|
|
108222
|
-
x: Math.round(xEmu / EMU_PER_PX),
|
|
108223
|
-
y: Math.round(yEmu / EMU_PER_PX),
|
|
108224
|
-
width: Math.round(cxEmu / EMU_PER_PX),
|
|
108225
|
-
height: Math.round(cyEmu / EMU_PER_PX),
|
|
108226
|
-
text: "",
|
|
108227
|
-
rawXml
|
|
108228
|
-
};
|
|
108229
|
-
}
|
|
108230
|
-
var init_placeholder_xml = __esm({
|
|
108231
|
-
"pptx/core/utils/placeholder-xml.ts"() {
|
|
108232
|
-
init_constants2();
|
|
108233
|
-
}
|
|
108234
|
-
});
|
|
108235
|
-
|
|
108236
108513
|
// pptx/core/utils/text-fill-blip.ts
|
|
108237
108514
|
function resolveTextFillBlip(blipFill, lookupTarget, resolveArchivePath, allowExternal) {
|
|
108238
108515
|
const blip = blipFill["a:blip"];
|
|
@@ -126656,8 +126933,8 @@ function mergeBorderSideXml(border, existingSide) {
|
|
|
126656
126933
|
const ln = ensureChild2(existing, "a:ln");
|
|
126657
126934
|
if (border.width !== void 0) {
|
|
126658
126935
|
const currentEmu = parseInt(String(ln["@_w"] || "0"), 10);
|
|
126659
|
-
if (currentEmu <= 0 || Math.max(1, Math.round(currentEmu /
|
|
126660
|
-
ln["@_w"] = String(Math.round(border.width *
|
|
126936
|
+
if (currentEmu <= 0 || Math.max(1, Math.round(currentEmu / EMU_PER_PIXEL4)) !== border.width) {
|
|
126937
|
+
ln["@_w"] = String(Math.round(border.width * EMU_PER_PIXEL4));
|
|
126661
126938
|
}
|
|
126662
126939
|
}
|
|
126663
126940
|
if (border.dash) {
|
|
@@ -126713,10 +126990,10 @@ function writeTableStyleSectionCell3D(section, cell3D) {
|
|
|
126713
126990
|
if (cell3D.bevelWidth !== void 0 || cell3D.bevelHeight !== void 0 || cell3D.bevelPreset !== void 0) {
|
|
126714
126991
|
const bevel2 = {};
|
|
126715
126992
|
if (cell3D.bevelWidth !== void 0) {
|
|
126716
|
-
bevel2["@_w"] = String(Math.round(cell3D.bevelWidth *
|
|
126993
|
+
bevel2["@_w"] = String(Math.round(cell3D.bevelWidth * EMU_PER_PIXEL4));
|
|
126717
126994
|
}
|
|
126718
126995
|
if (cell3D.bevelHeight !== void 0) {
|
|
126719
|
-
bevel2["@_h"] = String(Math.round(cell3D.bevelHeight *
|
|
126996
|
+
bevel2["@_h"] = String(Math.round(cell3D.bevelHeight * EMU_PER_PIXEL4));
|
|
126720
126997
|
}
|
|
126721
126998
|
if (cell3D.bevelPreset) {
|
|
126722
126999
|
bevel2["@_prst"] = cell3D.bevelPreset;
|
|
@@ -126735,12 +127012,12 @@ function writeTableStyleSectionCell3D(section, cell3D) {
|
|
|
126735
127012
|
}
|
|
126736
127013
|
tcStyle["a:cell3D"] = node;
|
|
126737
127014
|
}
|
|
126738
|
-
var
|
|
127015
|
+
var EMU_PER_PIXEL4, BORDER_SIDE_ORDER, LN_CHILD_ORDER, LN_FILL_KEYS;
|
|
126739
127016
|
var init_table_style_border_write = __esm({
|
|
126740
127017
|
"pptx/core/core/runtime/table-style-border-write.ts"() {
|
|
126741
127018
|
init_xml_reorder();
|
|
126742
127019
|
init_table_style_xml_helpers();
|
|
126743
|
-
|
|
127020
|
+
EMU_PER_PIXEL4 = 9525;
|
|
126744
127021
|
BORDER_SIDE_ORDER = [
|
|
126745
127022
|
"a:left",
|
|
126746
127023
|
"a:right",
|
|
@@ -127678,6 +127955,7 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
|
|
|
127678
127955
|
init_header_footer_parts();
|
|
127679
127956
|
init_pptx_print_properties();
|
|
127680
127957
|
init_PptxHandlerRuntimeSaveStructuralIds();
|
|
127958
|
+
init_save_geometry_validation();
|
|
127681
127959
|
PptxHandlerRuntime54 = class _PptxHandlerRuntime extends PptxHandlerRuntime53 {
|
|
127682
127960
|
/**
|
|
127683
127961
|
* Resolve the effective conformance class for this save operation.
|
|
@@ -127692,6 +127970,19 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
|
|
|
127692
127970
|
return this.isStrictOoxml ? "strict" : "transitional";
|
|
127693
127971
|
}
|
|
127694
127972
|
async save(slides, options) {
|
|
127973
|
+
validateSlideGeometry(slides);
|
|
127974
|
+
const templates = [
|
|
127975
|
+
...options?.slideMasters ?? [],
|
|
127976
|
+
...options?.slideLayouts ?? [],
|
|
127977
|
+
...options?.slideMasters?.flatMap((master) => master.layouts ?? []) ?? [],
|
|
127978
|
+
...options?.notesMaster ? [options.notesMaster] : [],
|
|
127979
|
+
...options?.handoutMaster ? [options.handoutMaster] : []
|
|
127980
|
+
];
|
|
127981
|
+
for (const template of templates) {
|
|
127982
|
+
for (const element of template.elements ?? []) {
|
|
127983
|
+
validateElementGeometry(element, `Template (${template.path})`);
|
|
127984
|
+
}
|
|
127985
|
+
}
|
|
127695
127986
|
if (options?.outputFormat === "ppt") {
|
|
127696
127987
|
return this.saveAsLegacyPpt(
|
|
127697
127988
|
slides,
|
|
@@ -128659,8 +128950,7 @@ var init_PptxHandlerRuntimePlaceholderLookup = __esm({
|
|
|
128659
128950
|
return this.scanPlaceholderBuckets(spTree, (info) => info?.type === type);
|
|
128660
128951
|
}
|
|
128661
128952
|
/** The layout and master counterparts of a placeholder, unmerged. */
|
|
128662
|
-
findPlaceholderContexts(slidePath, expected) {
|
|
128663
|
-
const layoutPath = this.resolveLayoutPathForSlide(slidePath);
|
|
128953
|
+
findPlaceholderContexts(slidePath, expected, layoutPath = this.resolveLayoutPathForSlide(slidePath)) {
|
|
128664
128954
|
if (!layoutPath) {
|
|
128665
128955
|
return {};
|
|
128666
128956
|
}
|
|
@@ -128672,10 +128962,11 @@ var init_PptxHandlerRuntimePlaceholderLookup = __esm({
|
|
|
128672
128962
|
const master = this.findPlaceholderInShapeTree(masterSpTree, expected) ?? this.findSingletonPlaceholderInShapeTree(masterSpTree, expected);
|
|
128673
128963
|
return { layout, master };
|
|
128674
128964
|
}
|
|
128675
|
-
findPlaceholderContext(slidePath, expected) {
|
|
128965
|
+
findPlaceholderContext(slidePath, expected, layoutPath) {
|
|
128676
128966
|
const { layout: layoutContext, master: masterContext } = this.findPlaceholderContexts(
|
|
128677
128967
|
slidePath,
|
|
128678
|
-
expected
|
|
128968
|
+
expected,
|
|
128969
|
+
layoutPath
|
|
128679
128970
|
);
|
|
128680
128971
|
if (!layoutContext) {
|
|
128681
128972
|
return masterContext;
|
|
@@ -128701,8 +128992,8 @@ var init_PptxHandlerRuntimePlaceholderLookup = __esm({
|
|
|
128701
128992
|
* a master `p:sp`), so the layout keeps winning exactly as it does when
|
|
128702
128993
|
* both are shapes.
|
|
128703
128994
|
*/
|
|
128704
|
-
findPlaceholderNode(slidePath, expected) {
|
|
128705
|
-
const { layout, master } = this.findPlaceholderContexts(slidePath, expected);
|
|
128995
|
+
findPlaceholderNode(slidePath, expected, layoutPath) {
|
|
128996
|
+
const { layout, master } = this.findPlaceholderContexts(slidePath, expected, layoutPath);
|
|
128706
128997
|
const firstNode2 = (context) => context?.shape ?? context?.picture ?? context?.graphicFrame;
|
|
128707
128998
|
const layoutNode = firstNode2(layout);
|
|
128708
128999
|
const masterNode = firstNode2(master);
|
|
@@ -128743,8 +129034,7 @@ var init_PptxHandlerRuntimePlaceholderLookup = __esm({
|
|
|
128743
129034
|
* reference. Checks the layout cache first, then the master cache, and
|
|
128744
129035
|
* merges them so that layout values take priority over master values.
|
|
128745
129036
|
*/
|
|
128746
|
-
lookupPlaceholderDefaults(slidePath, phInfo) {
|
|
128747
|
-
const layoutPath = this.resolveLayoutPathForSlide(slidePath);
|
|
129037
|
+
lookupPlaceholderDefaults(slidePath, phInfo, layoutPath = this.resolveLayoutPathForSlide(slidePath)) {
|
|
128748
129038
|
if (!layoutPath) {
|
|
128749
129039
|
return void 0;
|
|
128750
129040
|
}
|
|
@@ -129288,6 +129578,7 @@ var init_PptxHandlerRuntimeGeometryParsing = __esm({
|
|
|
129288
129578
|
var PptxHandlerRuntime61;
|
|
129289
129579
|
var init_PptxHandlerRuntimeShapeImageFill = __esm({
|
|
129290
129580
|
"pptx/core/core/runtime/PptxHandlerRuntimeShapeImageFill.ts"() {
|
|
129581
|
+
init_group_parsing_helpers();
|
|
129291
129582
|
init_xml_access();
|
|
129292
129583
|
init_group_shape_geometry();
|
|
129293
129584
|
init_PptxHandlerRuntimeGeometryParsing();
|
|
@@ -129459,6 +129750,53 @@ var init_PptxHandlerRuntimeShapeImageFill = __esm({
|
|
|
129459
129750
|
return null;
|
|
129460
129751
|
}
|
|
129461
129752
|
}
|
|
129753
|
+
/**
|
|
129754
|
+
* A text-bearing shape whose picture fill is inherited from its layout or
|
|
129755
|
+
* master placeholder (`a:blipFill` absent from its own `spPr`) gets
|
|
129756
|
+
* `fillMode: 'image'` from the merged properties but no image: the blip's
|
|
129757
|
+
* relationship id belongs to the part that authored it, not the slide.
|
|
129758
|
+
* Resolve it against the layout's, then the master's, relationships.
|
|
129759
|
+
*/
|
|
129760
|
+
async resolveInheritedFillImage(element, shape, slidePath) {
|
|
129761
|
+
const style = element?.shapeStyle;
|
|
129762
|
+
if (!element || !style || style.fillMode !== "image" || style.fillImageUrl) {
|
|
129763
|
+
return;
|
|
129764
|
+
}
|
|
129765
|
+
const placeholderInfo = this.extractPlaceholderInfo(xmlPath(shape, "p:nvSpPr", "p:nvPr"));
|
|
129766
|
+
const inherited = placeholderInfo ? this.findPlaceholderContext(slidePath, placeholderInfo) : void 0;
|
|
129767
|
+
const effectiveSpPr = this.mergeXmlObjects(
|
|
129768
|
+
inherited?.shape?.["p:spPr"],
|
|
129769
|
+
xmlChild(shape, "p:spPr")
|
|
129770
|
+
);
|
|
129771
|
+
const blipFill = effectiveSpPr?.["a:blipFill"];
|
|
129772
|
+
const blip = blipFill?.["a:blip"];
|
|
129773
|
+
const relId = String(blip?.["@_r:embed"] ?? blip?.["@_r:link"] ?? "");
|
|
129774
|
+
if (!relId) {
|
|
129775
|
+
return;
|
|
129776
|
+
}
|
|
129777
|
+
const layoutPath = this.resolveLayoutPathForSlide(slidePath);
|
|
129778
|
+
const masterPath = layoutPath ? this.resolveMasterPathForLayout(layoutPath) : void 0;
|
|
129779
|
+
for (const partPath of [layoutPath, masterPath]) {
|
|
129780
|
+
if (!partPath || !this.slideRelsMap.get(partPath)?.has(relId)) {
|
|
129781
|
+
continue;
|
|
129782
|
+
}
|
|
129783
|
+
const fill = await resolveGroupFillImagePure(
|
|
129784
|
+
this,
|
|
129785
|
+
blipFill,
|
|
129786
|
+
partPath
|
|
129787
|
+
);
|
|
129788
|
+
if (fill) {
|
|
129789
|
+
const isUrl = /^(?:data:|blob:|https?:)/u.test(fill.fillImageUrl);
|
|
129790
|
+
const decoded = isUrl ? void 0 : await this.getImageData(fill.fillImageUrl);
|
|
129791
|
+
style.fillImageUrl = decoded ?? fill.fillImageUrl;
|
|
129792
|
+
style.fillImageMode = fill.fillImageMode;
|
|
129793
|
+
if (element.type === "text") {
|
|
129794
|
+
element.type = "shape";
|
|
129795
|
+
}
|
|
129796
|
+
}
|
|
129797
|
+
return;
|
|
129798
|
+
}
|
|
129799
|
+
}
|
|
129462
129800
|
textVerticalAlignFromDrawingValue(value) {
|
|
129463
129801
|
const normalized = String(value ?? "").trim().toLowerCase();
|
|
129464
129802
|
if (normalized.length === 0) {
|
|
@@ -130923,14 +131261,14 @@ var init_PptxHandlerRuntimeShapeParsing = __esm({
|
|
|
130923
131261
|
init_element_paragraph_geometry();
|
|
130924
131262
|
init_PptxHandlerRuntimeShapeParagraphContentParsing();
|
|
130925
131263
|
PptxHandlerRuntime67 = class _PptxHandlerRuntime extends PptxHandlerRuntime66 {
|
|
130926
|
-
parseShape(shape, id, slidePath) {
|
|
131264
|
+
parseShape(shape, id, slidePath, layoutPath) {
|
|
130927
131265
|
try {
|
|
130928
131266
|
const spPr = shape["p:spPr"];
|
|
130929
131267
|
const slideRelationshipMap = slidePath ? this.slideRelsMap.get(slidePath) : void 0;
|
|
130930
131268
|
const placeholderInfo = this.extractPlaceholderInfo(
|
|
130931
131269
|
shape?.["p:nvSpPr"]?.["p:nvPr"]
|
|
130932
131270
|
);
|
|
130933
|
-
const inheritedPlaceholder = slidePath && placeholderInfo ? this.findPlaceholderContext(slidePath, placeholderInfo) : void 0;
|
|
131271
|
+
const inheritedPlaceholder = (slidePath || layoutPath) && placeholderInfo ? this.findPlaceholderContext(slidePath ?? "", placeholderInfo, layoutPath) : void 0;
|
|
130934
131272
|
const inheritedSpPr = inheritedPlaceholder?.shape?.["p:spPr"] || inheritedPlaceholder?.picture?.["p:spPr"];
|
|
130935
131273
|
const effectiveSpPr = spPr ? {
|
|
130936
131274
|
...spPr,
|
|
@@ -131056,7 +131394,7 @@ var init_PptxHandlerRuntimeShapeParsing = __esm({
|
|
|
131056
131394
|
);
|
|
131057
131395
|
const linkedTxbxId = bodyPropResult.linkedTxbxId;
|
|
131058
131396
|
const linkedTxbxSeq = bodyPropResult.linkedTxbxSeq;
|
|
131059
|
-
const phDefaults = slidePath && placeholderInfo ? this.lookupPlaceholderDefaults(slidePath, placeholderInfo) : void 0;
|
|
131397
|
+
const phDefaults = (slidePath || layoutPath) && placeholderInfo ? this.lookupPlaceholderDefaults(slidePath ?? "", placeholderInfo, layoutPath) : void 0;
|
|
131060
131398
|
if (phDefaults) {
|
|
131061
131399
|
this.applyPlaceholderBodyDefaults(textStyle, phDefaults);
|
|
131062
131400
|
}
|
|
@@ -131933,7 +132271,9 @@ var init_PptxHandlerRuntimeSpTreeParsing = __esm({
|
|
|
131933
132271
|
slidePath
|
|
131934
132272
|
);
|
|
131935
132273
|
}
|
|
131936
|
-
|
|
132274
|
+
const parsed = this.parseShape(node, `${idPrefix}shape-${indexInType}`, slidePath);
|
|
132275
|
+
await this.resolveInheritedFillImage(parsed, node, slidePath);
|
|
132276
|
+
return parsed;
|
|
131937
132277
|
}
|
|
131938
132278
|
case "p:pic":
|
|
131939
132279
|
return this.parsePicture(node, `${idPrefix}pic-${indexInType}`, slidePath);
|
|
@@ -140419,14 +140759,199 @@ var init_PptxHandlerRuntimeBackgroundStyles = __esm({
|
|
|
140419
140759
|
};
|
|
140420
140760
|
}
|
|
140421
140761
|
});
|
|
140762
|
+
|
|
140763
|
+
// pptx/core/core/runtime/sdk-placeholder.ts
|
|
140764
|
+
function selectTextPlaceholder(input, type, options, slots) {
|
|
140765
|
+
if (!TEXT_PLACEHOLDER_TYPES.has(type.toLowerCase())) {
|
|
140766
|
+
throw new Error(`Unsupported text placeholder type: ${type}`);
|
|
140767
|
+
}
|
|
140768
|
+
if (options.idx !== void 0 && (!Number.isInteger(options.idx) || options.idx < 0 || options.idx > 4294967295)) {
|
|
140769
|
+
throw new Error("Placeholder idx must be an unsigned 32-bit integer");
|
|
140770
|
+
}
|
|
140771
|
+
const source = {
|
|
140772
|
+
type: type.toLowerCase(),
|
|
140773
|
+
...options.idx !== void 0 ? { idx: String(options.idx) } : {}
|
|
140774
|
+
};
|
|
140775
|
+
let best;
|
|
140776
|
+
let bestScore = 0;
|
|
140777
|
+
for (const slot of slots) {
|
|
140778
|
+
if (!TEXT_PLACEHOLDER_TYPES.has(slot.phInfo.type ?? "obj")) continue;
|
|
140779
|
+
if (source.idx !== void 0 && source.idx !== (slot.phInfo.idx ?? "0")) continue;
|
|
140780
|
+
const score = scorePlaceholderMatch(input, source, slot.phInfo);
|
|
140781
|
+
if (score > bestScore) {
|
|
140782
|
+
best = slot;
|
|
140783
|
+
bestScore = score;
|
|
140784
|
+
}
|
|
140785
|
+
}
|
|
140786
|
+
return best ? { type: canonicalPlaceholderType(best.phInfo.type ?? "obj"), idx: best.phInfo.idx } : { type: canonicalPlaceholderType(source.type), idx: source.idx };
|
|
140787
|
+
}
|
|
140788
|
+
function withoutFallbackLanguage(properties) {
|
|
140789
|
+
const { "@_lang": language, ...rest } = properties;
|
|
140790
|
+
if (language !== "en-US") return properties;
|
|
140791
|
+
const keys = Object.keys(rest);
|
|
140792
|
+
return keys.length === 0 || keys.length === 1 && rest["@_dirty"] === "0" ? void 0 : rest;
|
|
140793
|
+
}
|
|
140794
|
+
function stripFallbackLanguage(node, key2) {
|
|
140795
|
+
const properties = node[key2];
|
|
140796
|
+
if (!properties || typeof properties !== "object") return node;
|
|
140797
|
+
const next = withoutFallbackLanguage(properties);
|
|
140798
|
+
if (next === properties) return node;
|
|
140799
|
+
const result = {};
|
|
140800
|
+
for (const [name, value] of Object.entries(node)) {
|
|
140801
|
+
if (name !== key2) result[name] = value;
|
|
140802
|
+
else if (next) result[name] = next;
|
|
140803
|
+
}
|
|
140804
|
+
return result;
|
|
140805
|
+
}
|
|
140806
|
+
function withoutFallbackLanguages(paragraphs) {
|
|
140807
|
+
return paragraphs.map((paragraph) => {
|
|
140808
|
+
const next = { ...stripFallbackLanguage(paragraph, "a:endParaRPr") };
|
|
140809
|
+
for (const child31 of ["a:r", "a:br", "a:fld"]) {
|
|
140810
|
+
const nodes = next[child31];
|
|
140811
|
+
if (nodes === void 0) continue;
|
|
140812
|
+
next[child31] = Array.isArray(nodes) ? nodes.map((node) => stripFallbackLanguage(node, "a:rPr")) : stripFallbackLanguage(nodes, "a:rPr");
|
|
140813
|
+
}
|
|
140814
|
+
return next;
|
|
140815
|
+
});
|
|
140816
|
+
}
|
|
140817
|
+
function placeholderShape2(identity, paragraphs) {
|
|
140818
|
+
paragraphs = withoutFallbackLanguages(paragraphs);
|
|
140819
|
+
return {
|
|
140820
|
+
"p:nvSpPr": {
|
|
140821
|
+
"p:cNvPr": { "@_id": "2", "@_name": `Placeholder ${identity.type}` },
|
|
140822
|
+
"p:cNvSpPr": { "a:spLocks": { "@_noGrp": "1" } },
|
|
140823
|
+
"p:nvPr": {
|
|
140824
|
+
"p:ph": {
|
|
140825
|
+
"@_type": identity.type,
|
|
140826
|
+
...identity.idx !== void 0 ? { "@_idx": identity.idx } : {}
|
|
140827
|
+
}
|
|
140828
|
+
}
|
|
140829
|
+
},
|
|
140830
|
+
"p:spPr": {},
|
|
140831
|
+
"p:txBody": { "a:bodyPr": {}, "a:lstStyle": {}, "a:p": paragraphs }
|
|
140832
|
+
};
|
|
140833
|
+
}
|
|
140834
|
+
function applyPlaceholderFrame(shape, inherited, options, emuPerPx, materializeFrame = false) {
|
|
140835
|
+
for (const key2 of ["x", "y", "width", "height"]) {
|
|
140836
|
+
if (options[key2] !== void 0 && !Number.isFinite(options[key2])) {
|
|
140837
|
+
throw new Error(`Invalid placeholder frame for ${key2}: expected a finite number`);
|
|
140838
|
+
}
|
|
140839
|
+
}
|
|
140840
|
+
const off = xmlPath(inherited, "p:spPr", "a:xfrm", "a:off");
|
|
140841
|
+
const ext = xmlPath(inherited, "p:spPr", "a:xfrm", "a:ext");
|
|
140842
|
+
const frame2 = {
|
|
140843
|
+
x: options.x ?? (off?.["@_x"] !== void 0 ? Number(off["@_x"]) / emuPerPx : void 0),
|
|
140844
|
+
y: options.y ?? (off?.["@_y"] !== void 0 ? Number(off["@_y"]) / emuPerPx : void 0),
|
|
140845
|
+
width: options.width ?? (ext?.["@_cx"] !== void 0 ? Number(ext["@_cx"]) / emuPerPx : void 0),
|
|
140846
|
+
height: options.height ?? (ext?.["@_cy"] !== void 0 ? Number(ext["@_cy"]) / emuPerPx : void 0)
|
|
140847
|
+
};
|
|
140848
|
+
for (const [key2, value] of Object.entries(frame2)) {
|
|
140849
|
+
if (!Number.isFinite(value)) {
|
|
140850
|
+
throw new Error(
|
|
140851
|
+
`No matching placeholder frame for ${key2}; supply a complete explicit frame or choose a layout containing this slot`
|
|
140852
|
+
);
|
|
140853
|
+
}
|
|
140854
|
+
}
|
|
140855
|
+
if (materializeFrame || ["x", "y", "width", "height"].some((key2) => options[key2] !== void 0)) {
|
|
140856
|
+
setRawXmlTransform(
|
|
140857
|
+
shape,
|
|
140858
|
+
...["x", "y", "width", "height"].map(
|
|
140859
|
+
(key2) => Math.round(frame2[key2] * emuPerPx)
|
|
140860
|
+
)
|
|
140861
|
+
);
|
|
140862
|
+
}
|
|
140863
|
+
}
|
|
140864
|
+
var TEXT_PLACEHOLDER_TYPES;
|
|
140865
|
+
var init_sdk_placeholder = __esm({
|
|
140866
|
+
"pptx/core/core/runtime/sdk-placeholder.ts"() {
|
|
140867
|
+
init_placeholder_remap();
|
|
140868
|
+
init_placeholder_xml();
|
|
140869
|
+
init_placeholder_validation();
|
|
140870
|
+
init_xml_access();
|
|
140871
|
+
TEXT_PLACEHOLDER_TYPES = /* @__PURE__ */ new Set([
|
|
140872
|
+
"title",
|
|
140873
|
+
"ctrtitle",
|
|
140874
|
+
"subtitle",
|
|
140875
|
+
"body",
|
|
140876
|
+
"obj",
|
|
140877
|
+
"dt",
|
|
140878
|
+
"ftr",
|
|
140879
|
+
"hdr",
|
|
140880
|
+
"sldnum"
|
|
140881
|
+
]);
|
|
140882
|
+
}
|
|
140883
|
+
});
|
|
140884
|
+
|
|
140885
|
+
// pptx/core/core/runtime/PptxHandlerRuntimeSdkPlaceholders.ts
|
|
140422
140886
|
var PptxHandlerRuntime103;
|
|
140887
|
+
var init_PptxHandlerRuntimeSdkPlaceholders = __esm({
|
|
140888
|
+
"pptx/core/core/runtime/PptxHandlerRuntimeSdkPlaceholders.ts"() {
|
|
140889
|
+
init_placeholder_remap();
|
|
140890
|
+
init_xml_access();
|
|
140891
|
+
init_PptxHandlerRuntimeBackgroundStyles();
|
|
140892
|
+
init_sdk_placeholder();
|
|
140893
|
+
PptxHandlerRuntime103 = class _PptxHandlerRuntime extends PptxHandlerRuntime102 {
|
|
140894
|
+
createPlaceholderElement(layoutPath, input, type, options) {
|
|
140895
|
+
if (input.type !== "text") throw new Error("Placeholder input must be text");
|
|
140896
|
+
const layout = this.layoutXmlMap.get(layoutPath);
|
|
140897
|
+
if (!layout) throw new Error(`Unknown layout: ${layoutPath}`);
|
|
140898
|
+
const identity = selectTextPlaceholder(
|
|
140899
|
+
input,
|
|
140900
|
+
type,
|
|
140901
|
+
options,
|
|
140902
|
+
this.extractLayoutPlaceholders(layout, layoutPath)
|
|
140903
|
+
);
|
|
140904
|
+
const shape = placeholderShape2(
|
|
140905
|
+
identity,
|
|
140906
|
+
this.createParagraphsFromTextContent(input.text, void 0, input.textSegments)
|
|
140907
|
+
);
|
|
140908
|
+
const inherited = this.findPlaceholderNode(
|
|
140909
|
+
"",
|
|
140910
|
+
{ type: identity.type.toLowerCase(), idx: identity.idx },
|
|
140911
|
+
layoutPath
|
|
140912
|
+
);
|
|
140913
|
+
const fallback = this.sdkMasterFrame(layoutPath, identity.type, identity.idx, inherited);
|
|
140914
|
+
applyPlaceholderFrame(
|
|
140915
|
+
shape,
|
|
140916
|
+
fallback ?? inherited,
|
|
140917
|
+
options,
|
|
140918
|
+
_PptxHandlerRuntime.EMU_PER_PX,
|
|
140919
|
+
fallback !== void 0
|
|
140920
|
+
);
|
|
140921
|
+
const element = this.parseShape(shape, input.id, void 0, layoutPath);
|
|
140922
|
+
if (!element) throw new Error("Unable to resolve placeholder content");
|
|
140923
|
+
if ((element.type === "text" || element.type === "shape") && !element.textStyle && element.textSegments?.[0]?.style) {
|
|
140924
|
+
element.textStyle = { ...element.textSegments[0].style };
|
|
140925
|
+
}
|
|
140926
|
+
return element;
|
|
140927
|
+
}
|
|
140928
|
+
sdkMasterFrame(layoutPath, type, idx, inherited) {
|
|
140929
|
+
if (!inherited) return void 0;
|
|
140930
|
+
if (xmlPath(inherited, "p:spPr", "a:xfrm", "a:off") && xmlPath(inherited, "p:spPr", "a:xfrm", "a:ext"))
|
|
140931
|
+
return void 0;
|
|
140932
|
+
const masterPath = this.resolveMasterPathForLayout(layoutPath);
|
|
140933
|
+
const tree = masterPath ? xmlPath(this.masterXmlMap.get(masterPath), "p:sldMaster", "p:cSld", "p:spTree") : void 0;
|
|
140934
|
+
const role = placeholderContentRole(type.toLowerCase());
|
|
140935
|
+
const candidates = this.ensureArray(tree?.["p:sp"]).filter((shape) => {
|
|
140936
|
+
const info = this.extractPlaceholderInfo(xmlPath(shape, "p:nvSpPr", "p:nvPr"));
|
|
140937
|
+
return info && placeholderContentRole(info.type) === role;
|
|
140938
|
+
});
|
|
140939
|
+
const master = candidates.find(
|
|
140940
|
+
(shape) => this.extractPlaceholderInfo(xmlPath(shape, "p:nvSpPr", "p:nvPr"))?.idx === idx
|
|
140941
|
+
) ?? candidates[0];
|
|
140942
|
+
return master ? this.mergeXmlObjects(master, inherited) : void 0;
|
|
140943
|
+
}
|
|
140944
|
+
};
|
|
140945
|
+
}
|
|
140946
|
+
});
|
|
140947
|
+
var PptxHandlerRuntime104;
|
|
140423
140948
|
var init_PptxHandlerRuntimeImplementation = __esm({
|
|
140424
140949
|
"pptx/core/core/runtime/PptxHandlerRuntimeImplementation.ts"() {
|
|
140425
140950
|
init_PptxElementXmlBuilder();
|
|
140426
140951
|
init_builders();
|
|
140427
140952
|
init_factories();
|
|
140428
|
-
|
|
140429
|
-
|
|
140953
|
+
init_PptxHandlerRuntimeSdkPlaceholders();
|
|
140954
|
+
PptxHandlerRuntime104 = class _PptxHandlerRuntime extends PptxHandlerRuntime103 {
|
|
140430
140955
|
constructor(dependencyFactory = new PptxRuntimeDependencyFactory()) {
|
|
140431
140956
|
super();
|
|
140432
140957
|
this.dependencyFactory = dependencyFactory;
|
|
@@ -140566,11 +141091,11 @@ var init_PptxHandlerRuntimeImplementation = __esm({
|
|
|
140566
141091
|
});
|
|
140567
141092
|
|
|
140568
141093
|
// pptx/core/core/PptxHandlerRuntime.ts
|
|
140569
|
-
var
|
|
141094
|
+
var PptxHandlerRuntime105;
|
|
140570
141095
|
var init_PptxHandlerRuntime = __esm({
|
|
140571
141096
|
"pptx/core/core/PptxHandlerRuntime.ts"() {
|
|
140572
141097
|
init_PptxHandlerRuntimeImplementation();
|
|
140573
|
-
|
|
141098
|
+
PptxHandlerRuntime105 = class extends PptxHandlerRuntime104 {
|
|
140574
141099
|
};
|
|
140575
141100
|
}
|
|
140576
141101
|
});
|
|
@@ -140580,7 +141105,7 @@ var createDefaultPptxHandlerRuntime;
|
|
|
140580
141105
|
var init_PptxHandlerRuntimeFactory = __esm({
|
|
140581
141106
|
"pptx/core/core/PptxHandlerRuntimeFactory.ts"() {
|
|
140582
141107
|
init_PptxHandlerRuntime();
|
|
140583
|
-
createDefaultPptxHandlerRuntime = () => new
|
|
141108
|
+
createDefaultPptxHandlerRuntime = () => new PptxHandlerRuntime105();
|
|
140584
141109
|
}
|
|
140585
141110
|
});
|
|
140586
141111
|
|
|
@@ -143164,7 +143689,7 @@ function slideMasterXml2(deck, ctx) {
|
|
|
143164
143689
|
</p:txStyles>
|
|
143165
143690
|
</p:sldMaster>`;
|
|
143166
143691
|
}
|
|
143167
|
-
function
|
|
143692
|
+
function slideLayoutXml() {
|
|
143168
143693
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
143169
143694
|
<p:sldLayout ${XMLNS2} type="blank" preserve="1">
|
|
143170
143695
|
<p:cSld name="Blank">
|
|
@@ -143484,7 +144009,7 @@ async function buildPptxPackage(deck) {
|
|
|
143484
144009
|
${masterRels.join("\n")}
|
|
143485
144010
|
</Relationships>`
|
|
143486
144011
|
);
|
|
143487
|
-
zip.file("ppt/slideLayouts/slideLayout1.xml",
|
|
144012
|
+
zip.file("ppt/slideLayouts/slideLayout1.xml", slideLayoutXml());
|
|
143488
144013
|
zip.file(
|
|
143489
144014
|
"ppt/slideLayouts/_rels/slideLayout1.xml.rels",
|
|
143490
144015
|
`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -143701,6 +144226,13 @@ var init_PptxHandlerCore = __esm({
|
|
|
143701
144226
|
getLayoutOptions() {
|
|
143702
144227
|
return this.runtime.getLayoutOptions();
|
|
143703
144228
|
}
|
|
144229
|
+
/** Resolve a text placeholder in this loaded deck, preserving layout inheritance. */
|
|
144230
|
+
createPlaceholderElement(layoutPath, input, type, options = {}) {
|
|
144231
|
+
if (!this.runtime.createPlaceholderElement) {
|
|
144232
|
+
throw new Error("This runtime does not support creating layout placeholders");
|
|
144233
|
+
}
|
|
144234
|
+
return this.runtime.createPlaceholderElement(layoutPath, input, type, options);
|
|
144235
|
+
}
|
|
143704
144236
|
/**
|
|
143705
144237
|
* Build the artwork thumbnails backing the New Slide / Layout galleries.
|
|
143706
144238
|
*
|