ooxml-core 1.33.0 → 1.34.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-5UDSMCBG.cjs +14 -0
- package/dist/PptxHandler-TTRTAQAR.mjs +5 -0
- package/dist/{PptxHandler-Q7CFNKOU.mjs → PptxHandler-XCYX5DVX.mjs} +2 -2
- package/dist/{PresentationBuilder-VP2637RH.cjs → PresentationBuilder-HA56ZY23.cjs} +6 -5
- package/dist/{PresentationBuilder-SADKXDWC.mjs → PresentationBuilder-IVLUEB4K.mjs} +2 -2
- package/dist/{PresentationBuilder-PJMQRZI6.mjs → PresentationBuilder-JBTNOIL7.mjs} +3 -2
- package/dist/automation/index.cjs +45489 -42876
- package/dist/automation/index.mjs +45489 -42876
- package/dist/{chunk-2LTIDUXH.cjs → chunk-A27O7M5X.cjs} +147 -133
- package/dist/{chunk-Y2RH4QWG.mjs → chunk-EGBNPVBA.mjs} +1542 -721
- package/dist/{chunk-QRXMYOVN.mjs → chunk-GNGL4BO7.mjs} +66 -44
- package/dist/chunk-LSO5SSFX.mjs +112 -0
- package/dist/chunk-MB3TYNMV.mjs +28 -0
- package/dist/{chunk-EBBWRRSB.mjs → chunk-MK2IBZU6.mjs} +1 -1
- package/dist/{chunk-BDZR4DZ6.cjs → chunk-PA5ADSTX.cjs} +1329 -1306
- package/dist/{chunk-BQGLWC6N.mjs → chunk-RI56PFGL.mjs} +67 -44
- package/dist/{chunk-3LMHYL4W.mjs → chunk-RPJHMPEL.mjs} +1 -1
- package/dist/{chunk-JQVOUS6B.mjs → chunk-TJXK4D4U.mjs} +4 -4
- package/dist/{chunk-6LJW76BZ.mjs → chunk-UQMAPY6D.mjs} +147 -128
- package/dist/chunk-XF6ZRA2D.cjs +120 -0
- package/dist/crypto/index.cjs +23 -15
- package/dist/crypto/index.mjs +23 -15
- package/dist/docx/block-parser.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +519 -161
- package/dist/docx/embedded.mjs +519 -161
- package/dist/docx/find-pattern.d.ts +33 -0
- package/dist/docx/find-pattern.d.ts.map +1 -0
- package/dist/docx/find-replacement.d.ts +16 -0
- package/dist/docx/find-replacement.d.ts.map +1 -0
- package/dist/docx/find-syntax.d.ts +13 -0
- package/dist/docx/find-syntax.d.ts.map +1 -0
- package/dist/docx/find-wildcards.d.ts +8 -0
- package/dist/docx/find-wildcards.d.ts.map +1 -0
- package/dist/docx/form-field-model.d.ts +39 -0
- package/dist/docx/form-field-model.d.ts.map +1 -1
- package/dist/docx/index.cjs +3157 -994
- package/dist/docx/index.d.ts +3 -1
- package/dist/docx/index.d.ts.map +1 -1
- package/dist/docx/index.mjs +3153 -995
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +30 -8
- package/dist/docx/layout/index.mjs +30 -8
- package/dist/docx/layout/input.d.ts +2 -0
- package/dist/docx/layout/input.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +6706 -1322
- package/dist/docx/load/index.mjs +6706 -1322
- package/dist/docx/load/legacy-doc/binary-save.d.ts +4 -0
- package/dist/docx/load/legacy-doc/binary-save.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/blocks.d.ts +19 -0
- package/dist/docx/load/legacy-doc/blocks.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/borders.d.ts +7 -0
- package/dist/docx/load/legacy-doc/borders.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/context.d.ts +65 -0
- package/dist/docx/load/legacy-doc/context.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/drawing.d.ts +15 -0
- package/dist/docx/load/legacy-doc/drawing.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/error.d.ts +5 -0
- package/dist/docx/load/legacy-doc/error.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/inline.d.ts +7 -0
- package/dist/docx/load/legacy-doc/inline.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/numbering-part.d.ts +3 -0
- package/dist/docx/load/legacy-doc/numbering-part.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/package.d.ts +8 -0
- package/dist/docx/load/legacy-doc/package.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/para-props.d.ts +6 -0
- package/dist/docx/load/legacy-doc/para-props.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/run-props.d.ts +8 -0
- package/dist/docx/load/legacy-doc/run-props.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/sections.d.ts +23 -0
- package/dist/docx/load/legacy-doc/sections.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/styles-part.d.ts +3 -0
- package/dist/docx/load/legacy-doc/styles-part.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/table.d.ts +6 -0
- package/dist/docx/load/legacy-doc/table.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/xml.d.ts +21 -0
- package/dist/docx/load/legacy-doc/xml.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc.d.ts +5 -4
- package/dist/docx/load/legacy-doc.d.ts.map +1 -1
- package/dist/docx/model-paragraph.d.ts +5 -0
- package/dist/docx/model-paragraph.d.ts.map +1 -1
- package/dist/docx/model.d.ts +3 -0
- package/dist/docx/model.d.ts.map +1 -1
- package/dist/docx/numbering-editing.d.ts +11 -1
- package/dist/docx/numbering-editing.d.ts.map +1 -1
- package/dist/docx/numbering-format.d.ts.map +1 -1
- package/dist/docx/numbering-model.d.ts +17 -0
- package/dist/docx/numbering-model.d.ts.map +1 -1
- package/dist/docx/numbering-package.d.ts +2 -2
- package/dist/docx/numbering-package.d.ts.map +1 -1
- package/dist/docx/numbering-parse.d.ts +2 -1
- package/dist/docx/numbering-parse.d.ts.map +1 -1
- package/dist/docx/numbering-picture-save.d.ts +13 -0
- package/dist/docx/numbering-picture-save.d.ts.map +1 -0
- package/dist/docx/numbering-picture.d.ts +18 -0
- package/dist/docx/numbering-picture.d.ts.map +1 -0
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/permission-markers.d.ts +19 -0
- package/dist/docx/permission-markers.d.ts.map +1 -0
- package/dist/docx/permissions.d.ts +11 -0
- package/dist/docx/permissions.d.ts.map +1 -0
- package/dist/docx/protection-legacy.d.ts +13 -0
- package/dist/docx/protection-legacy.d.ts.map +1 -0
- package/dist/docx/protection.d.ts +30 -0
- package/dist/docx/protection.d.ts.map +1 -0
- package/dist/docx/save.d.ts.map +1 -1
- package/dist/docx/settings.d.ts +6 -1
- package/dist/docx/settings.d.ts.map +1 -1
- package/dist/docx/ui/customization.d.ts.map +1 -1
- package/dist/docx/ui/edit-restriction.d.ts +53 -0
- package/dist/docx/ui/edit-restriction.d.ts.map +1 -0
- package/dist/docx/ui/index.cjs +548 -18
- package/dist/docx/ui/index.d.ts +4 -0
- package/dist/docx/ui/index.d.ts.map +1 -1
- package/dist/docx/ui/index.mjs +528 -19
- package/dist/docx/ui/paragraph-attributes.d.ts.map +1 -1
- package/dist/docx/ui/ribbon-action-ids.d.ts +1 -1
- package/dist/docx/ui/ribbon-action-ids.d.ts.map +1 -1
- package/dist/docx/write-paragraph.d.ts.map +1 -1
- package/dist/drawingml/index.cjs +1 -0
- package/dist/drawingml/index.mjs +1 -0
- package/dist/drawingml/write-theme.d.ts +2 -0
- package/dist/drawingml/write-theme.d.ts.map +1 -1
- package/dist/index.cjs +337 -95
- package/dist/index.mjs +337 -95
- package/dist/pptx/automation/index.cjs +1919 -758
- package/dist/pptx/automation/index.d.ts +37 -3
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +252 -10
- package/dist/pptx/automation/schemas/index.cjs +26 -0
- package/dist/pptx/automation/schemas/index.d.ts +26 -1
- package/dist/pptx/automation/schemas/index.d.ts.map +1 -0
- package/dist/pptx/automation/schemas/index.mjs +1 -1
- package/dist/pptx/chunks/index-Bp-1pGo1.d.ts.map +1 -1
- package/dist/pptx/chunks/{index-BuMPQDQb.d.ts → index-pLLN4OTz.d.ts} +37 -10
- package/dist/pptx/chunks/{index-BuMPQDQb.d.ts.map → index-pLLN4OTz.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +281 -116
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/custom-show-operations.cjs +133 -0
- package/dist/pptx/editor/render/custom-show-operations.d.ts +42 -0
- package/dist/pptx/editor/render/custom-show-operations.d.ts.map +1 -0
- package/dist/pptx/editor/render/custom-show-operations.mjs +119 -0
- package/dist/pptx/editor/render/find-replace.cjs +15 -14
- package/dist/pptx/editor/render/find-replace.d.ts +1 -1
- package/dist/pptx/editor/render/find-replace.mjs +2 -1
- package/dist/pptx/editor/render/slide-operations.cjs +9 -8
- package/dist/pptx/editor/render/slide-operations.mjs +3 -2
- package/dist/pptx/editor/render/table-data-grid-ops.cjs +1 -1
- package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
- package/dist/pptx/index.cjs +1656 -761
- package/dist/pptx/index.d.ts +2 -2
- package/dist/pptx/index.mjs +5 -5
- package/dist/teams/index.cjs +213 -26
- package/dist/teams/index.mjs +213 -26
- package/dist/text/index.cjs +241 -0
- package/dist/text/index.d.ts +2 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.mjs +240 -1
- package/dist/text/truetype/parse.d.ts +36 -0
- package/dist/text/truetype/parse.d.ts.map +1 -0
- package/dist/text/truetype/subset.d.ts +16 -0
- package/dist/text/truetype/subset.d.ts.map +1 -0
- package/dist/visio/cell-formula.d.ts.map +1 -1
- package/dist/visio/container-relationships.d.ts +40 -6
- package/dist/visio/container-relationships.d.ts.map +1 -1
- package/dist/visio/data-connections.d.ts +32 -0
- package/dist/visio/data-connections.d.ts.map +1 -0
- package/dist/visio/data-recordsets.d.ts +7 -0
- package/dist/visio/data-recordsets.d.ts.map +1 -1
- package/dist/visio/data-refresh.d.ts +33 -0
- package/dist/visio/data-refresh.d.ts.map +1 -0
- package/dist/visio/edit-commands.d.ts +6 -1
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-connector.d.ts.map +1 -1
- package/dist/visio/edit-container-fit.d.ts +15 -2
- package/dist/visio/edit-container-fit.d.ts.map +1 -1
- package/dist/visio/edit-container-members.d.ts +12 -0
- package/dist/visio/edit-container-members.d.ts.map +1 -1
- package/dist/visio/edit-container-options.d.ts +33 -0
- package/dist/visio/edit-container-options.d.ts.map +1 -0
- package/dist/visio/edit-data-commands.d.ts +5 -0
- package/dist/visio/edit-data-commands.d.ts.map +1 -1
- package/dist/visio/edit-data-parts.d.ts +2 -0
- package/dist/visio/edit-data-parts.d.ts.map +1 -1
- package/dist/visio/edit-data.d.ts.map +1 -1
- package/dist/visio/edit-diagram-parts-commands.d.ts +2 -1
- package/dist/visio/edit-diagram-parts-commands.d.ts.map +1 -1
- package/dist/visio/edit-diagram-parts.d.ts +8 -0
- package/dist/visio/edit-diagram-parts.d.ts.map +1 -1
- package/dist/visio/edit-group-resize.d.ts.map +1 -1
- package/dist/visio/edit-instance-checks.d.ts.map +1 -1
- package/dist/visio/edit-package.d.ts.map +1 -1
- package/dist/visio/edit-page-theme-commands.d.ts +26 -0
- package/dist/visio/edit-page-theme-commands.d.ts.map +1 -1
- package/dist/visio/edit-page-theme-part.d.ts +6 -0
- package/dist/visio/edit-page-theme-part.d.ts.map +1 -0
- package/dist/visio/edit-page-theme.d.ts +9 -1
- package/dist/visio/edit-page-theme.d.ts.map +1 -1
- package/dist/visio/edit-picture-adjust.d.ts +32 -0
- package/dist/visio/edit-picture-adjust.d.ts.map +1 -0
- package/dist/visio/edit-resize-anchor.d.ts.map +1 -1
- package/dist/visio/edit-swimlane-commands.d.ts +91 -0
- package/dist/visio/edit-swimlane-commands.d.ts.map +1 -0
- package/dist/visio/edit-swimlane-layout.d.ts +64 -0
- package/dist/visio/edit-swimlane-layout.d.ts.map +1 -0
- package/dist/visio/edit-swimlane-ops.d.ts +11 -0
- package/dist/visio/edit-swimlane-ops.d.ts.map +1 -0
- package/dist/visio/edit-swimlane-shapes.d.ts +42 -0
- package/dist/visio/edit-swimlane-shapes.d.ts.map +1 -0
- package/dist/visio/edit-swimlane-turn.d.ts +9 -0
- package/dist/visio/edit-swimlane-turn.d.ts.map +1 -0
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/effects.d.ts +3 -2
- package/dist/visio/effects.d.ts.map +1 -1
- package/dist/visio/geometry.d.ts +2 -1
- package/dist/visio/geometry.d.ts.map +1 -1
- package/dist/visio/index.cjs +10254 -7285
- package/dist/visio/index.d.ts +7 -0
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +10248 -7286
- package/dist/visio/infinite-line.d.ts +17 -0
- package/dist/visio/infinite-line.d.ts.map +1 -0
- package/dist/visio/model.d.ts +46 -0
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/package-kind.d.ts +34 -0
- package/dist/visio/package-kind.d.ts.map +1 -0
- package/dist/visio/page-theme.d.ts +7 -0
- package/dist/visio/page-theme.d.ts.map +1 -1
- package/dist/visio/parser.d.ts +2 -2
- package/dist/visio/parser.d.ts.map +1 -1
- package/dist/visio/shadow.d.ts +2 -1
- package/dist/visio/shadow.d.ts.map +1 -1
- package/dist/visio/shape-structure.d.ts +14 -1
- package/dist/visio/shape-structure.d.ts.map +1 -1
- package/dist/visio/shapes.d.ts +7 -1
- package/dist/visio/shapes.d.ts.map +1 -1
- package/dist/visio/stencil-file.d.ts +2 -2
- package/dist/visio/style.d.ts.map +1 -1
- package/dist/visio/swimlane-stack.d.ts +65 -0
- package/dist/visio/swimlane-stack.d.ts.map +1 -0
- package/dist/visio/theme-builtins.d.ts +3 -0
- package/dist/visio/theme-builtins.d.ts.map +1 -1
- package/dist/visio/theme-effects.d.ts +19 -0
- package/dist/visio/theme-effects.d.ts.map +1 -0
- package/dist/visio/theme-font.d.ts +13 -0
- package/dist/visio/theme-font.d.ts.map +1 -0
- package/dist/visio/theme-line.d.ts.map +1 -1
- package/dist/visio/theme-write.d.ts.map +1 -1
- package/dist/visio/theme.d.ts +7 -0
- package/dist/visio/theme.d.ts.map +1 -1
- package/dist/visio/ui/data-graphic-config.d.ts +45 -0
- package/dist/visio/ui/data-graphic-config.d.ts.map +1 -0
- package/dist/visio/ui/data-graphic-rules.d.ts +7 -0
- package/dist/visio/ui/data-graphic-rules.d.ts.map +1 -1
- package/dist/visio/ui/data-graphics.d.ts +9 -0
- package/dist/visio/ui/data-graphics.d.ts.map +1 -1
- package/dist/visio/ui/diagram-parts.d.ts +8 -1
- package/dist/visio/ui/diagram-parts.d.ts.map +1 -1
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/guides.d.ts +9 -1
- package/dist/visio/ui/guides.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +12664 -9884
- package/dist/visio/ui/index.d.ts +4 -0
- package/dist/visio/ui/index.d.ts.map +1 -1
- package/dist/visio/ui/index.mjs +12630 -9885
- package/dist/visio/ui/org-chart.d.ts +75 -0
- package/dist/visio/ui/org-chart.d.ts.map +1 -0
- package/dist/visio/ui/resize-snap.d.ts +51 -0
- package/dist/visio/ui/resize-snap.d.ts.map +1 -0
- package/dist/visio/ui/sample-drawing.d.ts +26 -0
- package/dist/visio/ui/sample-drawing.d.ts.map +1 -1
- package/dist/visio/ui/scene-validation.d.ts.map +1 -1
- package/dist/visio/ui/selection-resize.d.ts +2 -2
- package/dist/visio/ui/selection-resize.d.ts.map +1 -1
- package/dist/visio/ui/shape-resize.d.ts +29 -1
- package/dist/visio/ui/shape-resize.d.ts.map +1 -1
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
- package/dist/visio/ui/swimlane.d.ts +37 -0
- package/dist/visio/ui/swimlane.d.ts.map +1 -0
- package/dist/visio/ui/templates.d.ts +26 -0
- package/dist/visio/ui/templates.d.ts.map +1 -0
- package/dist/xlsx/audit/ast-text.d.ts +12 -0
- package/dist/xlsx/audit/ast-text.d.ts.map +1 -0
- package/dist/xlsx/audit/error-check.d.ts +23 -0
- package/dist/xlsx/audit/error-check.d.ts.map +1 -0
- package/dist/xlsx/audit/evaluate-steps.d.ts +48 -0
- package/dist/xlsx/audit/evaluate-steps.d.ts.map +1 -0
- package/dist/xlsx/audit/index.d.ts +6 -0
- package/dist/xlsx/audit/index.d.ts.map +1 -0
- package/dist/xlsx/audit/trace.d.ts +59 -0
- package/dist/xlsx/audit/trace.d.ts.map +1 -0
- package/dist/xlsx/audit/watch.d.ts +17 -0
- package/dist/xlsx/audit/watch.d.ts.map +1 -0
- package/dist/xlsx/edit/filter.d.ts +5 -2
- package/dist/xlsx/edit/filter.d.ts.map +1 -1
- package/dist/xlsx/edit/index.d.ts +4 -1
- package/dist/xlsx/edit/index.d.ts.map +1 -1
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/sort-choices.d.ts +23 -0
- package/dist/xlsx/edit/sort-choices.d.ts.map +1 -0
- package/dist/xlsx/edit/sort-keys.d.ts +49 -0
- package/dist/xlsx/edit/sort-keys.d.ts.map +1 -0
- package/dist/xlsx/edit/sort-reapply.d.ts +11 -0
- package/dist/xlsx/edit/sort-reapply.d.ts.map +1 -0
- package/dist/xlsx/edit/sort.d.ts +14 -12
- package/dist/xlsx/edit/sort.d.ts.map +1 -1
- package/dist/xlsx/edit/types.d.ts +7 -6
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/edit/view.d.ts +9 -1
- package/dist/xlsx/edit/view.d.ts.map +1 -1
- package/dist/xlsx/filter-criteria.d.ts +2 -1
- package/dist/xlsx/filter-criteria.d.ts.map +1 -1
- package/dist/xlsx/formula/engine-types.d.ts +8 -0
- package/dist/xlsx/formula/engine-types.d.ts.map +1 -1
- package/dist/xlsx/formula/engine.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +5478 -4220
- package/dist/xlsx/index.d.ts +1 -0
- package/dist/xlsx/index.d.ts.map +1 -1
- package/dist/xlsx/index.mjs +5450 -4221
- package/dist/xlsx/layout/index.d.ts +1 -0
- package/dist/xlsx/layout/index.d.ts.map +1 -1
- package/dist/xlsx/layout/split.d.ts +55 -0
- package/dist/xlsx/layout/split.d.ts.map +1 -0
- package/dist/xlsx/layout/viewport.d.ts +2 -0
- package/dist/xlsx/layout/viewport.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +305 -109
- package/dist/xlsx/load/index.mjs +305 -109
- package/dist/xlsx/model-sort.d.ts +27 -0
- package/dist/xlsx/model-sort.d.ts.map +1 -0
- package/dist/xlsx/model.d.ts +39 -1
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/read/ignored-errors.d.ts +4 -0
- package/dist/xlsx/read/ignored-errors.d.ts.map +1 -0
- package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/read/sort-state.d.ts +5 -0
- package/dist/xlsx/read/sort-state.d.ts.map +1 -0
- package/dist/xlsx/read/tables.d.ts +2 -2
- package/dist/xlsx/read/tables.d.ts.map +1 -1
- package/dist/xlsx/read/worksheet.d.ts.map +1 -1
- package/dist/xlsx/sort-lists.d.ts +6 -0
- package/dist/xlsx/sort-lists.d.ts.map +1 -0
- package/dist/xlsx/ui/audit-state.d.ts +19 -0
- package/dist/xlsx/ui/audit-state.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/audit.d.ts +3 -0
- package/dist/xlsx/ui/commands/audit.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/formulas.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/audit.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/audit.d.ts.map +1 -0
- 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/ribbon-tabs.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/rules.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/icons.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/sort-filter.d.ts.map +1 -1
- package/dist/xlsx/ui/context.d.ts +6 -1
- package/dist/xlsx/ui/context.d.ts.map +1 -1
- package/dist/xlsx/ui/grid/geometry.d.ts +29 -1
- package/dist/xlsx/ui/grid/geometry.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +10761 -9573
- 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 +10755 -9574
- package/dist/xlsx/ui/ribbon/icon-paths.d.ts.map +1 -1
- package/dist/xlsx/ui/ribbon/tabs/review-view.d.ts.map +1 -1
- package/dist/xlsx/write/filter-columns.d.ts +14 -0
- package/dist/xlsx/write/filter-columns.d.ts.map +1 -1
- package/dist/xlsx/write/ignored-errors.d.ts +3 -0
- package/dist/xlsx/write/ignored-errors.d.ts.map +1 -0
- package/dist/xlsx/write/sheet-parts.d.ts.map +1 -1
- package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/write/sort-state.d.ts +55 -0
- package/dist/xlsx/write/sort-state.d.ts.map +1 -0
- package/dist/xlsx/write/table-patch.d.ts +2 -1
- package/dist/xlsx/write/table-patch.d.ts.map +1 -1
- package/dist/xlsx/write/tables.d.ts +2 -1
- package/dist/xlsx/write/tables.d.ts.map +1 -1
- package/dist/xlsx/write/worksheet.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/PptxHandler-MGKMIK22.cjs +0 -13
- package/dist/PptxHandler-TEC7SWBU.mjs +0 -4
- package/dist/chunk-MHNETXQB.mjs +0 -1
|
@@ -1997,18 +1997,18 @@ function getCommentMarkerPosition(comment, index, width, height) {
|
|
|
1997
1997
|
};
|
|
1998
1998
|
}
|
|
1999
1999
|
async function readFileAsDataUrl(file) {
|
|
2000
|
-
return await new Promise((resolve,
|
|
2000
|
+
return await new Promise((resolve, reject2) => {
|
|
2001
2001
|
const reader = new FileReader();
|
|
2002
2002
|
reader.onload = () => {
|
|
2003
2003
|
const result = reader.result;
|
|
2004
2004
|
if (typeof result !== "string") {
|
|
2005
|
-
|
|
2005
|
+
reject2(new Error("Failed to read image file."));
|
|
2006
2006
|
return;
|
|
2007
2007
|
}
|
|
2008
2008
|
resolve(result);
|
|
2009
2009
|
};
|
|
2010
2010
|
reader.onerror = () => {
|
|
2011
|
-
|
|
2011
|
+
reject2(new Error("Failed to read image file."));
|
|
2012
2012
|
};
|
|
2013
2013
|
reader.readAsDataURL(file);
|
|
2014
2014
|
});
|
|
@@ -17749,7 +17749,7 @@ function getOleObjectTypeLabel(oleObjectType) {
|
|
|
17749
17749
|
}
|
|
17750
17750
|
}
|
|
17751
17751
|
|
|
17752
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17752
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js
|
|
17753
17753
|
var OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
|
|
17754
17754
|
var ENDOFCHAIN = 4294967294;
|
|
17755
17755
|
var FREESECT = 4294967295;
|
|
@@ -17769,16 +17769,18 @@ var Ole2ParseError = class extends Error {
|
|
|
17769
17769
|
}
|
|
17770
17770
|
};
|
|
17771
17771
|
|
|
17772
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17773
|
-
var
|
|
17774
|
-
function
|
|
17775
|
-
const ticks = view.getBigUint64(offset, true);
|
|
17772
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-filetime.js
|
|
17773
|
+
var EPOCH = 116444736000000000n;
|
|
17774
|
+
function fileTimeDate(ticks) {
|
|
17776
17775
|
if (ticks === 0n)
|
|
17777
17776
|
return void 0;
|
|
17778
|
-
const
|
|
17779
|
-
const
|
|
17777
|
+
const delta2 = ticks - EPOCH;
|
|
17778
|
+
const ms = delta2 >= 0n ? delta2 / 10000n : (delta2 - 9999n) / 10000n;
|
|
17779
|
+
const date = new Date(Number(ms));
|
|
17780
17780
|
return Number.isNaN(date.getTime()) ? void 0 : date;
|
|
17781
17781
|
}
|
|
17782
|
+
|
|
17783
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-directory.js
|
|
17782
17784
|
function decodeSlot(dir, id, majorVersion, warnings) {
|
|
17783
17785
|
const view = new DataView(dir.buffer, dir.byteOffset + id * DIR_ENTRY_SIZE, DIR_ENTRY_SIZE);
|
|
17784
17786
|
const nameLen = view.getUint16(64, true);
|
|
@@ -17814,8 +17816,10 @@ function decodeSlot(dir, id, majorVersion, warnings) {
|
|
|
17814
17816
|
childId: link(76),
|
|
17815
17817
|
clsid: new Uint8Array(view.buffer.slice(view.byteOffset + 80, view.byteOffset + 96)),
|
|
17816
17818
|
stateBits: view.getUint32(96, true),
|
|
17817
|
-
created:
|
|
17818
|
-
modified:
|
|
17819
|
+
created: fileTimeDate(view.getBigUint64(100, true)),
|
|
17820
|
+
modified: fileTimeDate(view.getBigUint64(108, true)),
|
|
17821
|
+
createdFileTime: view.getBigUint64(100, true),
|
|
17822
|
+
modifiedFileTime: view.getBigUint64(108, true),
|
|
17819
17823
|
startSector: view.getUint32(116, true),
|
|
17820
17824
|
size,
|
|
17821
17825
|
parentId: -1
|
|
@@ -17931,7 +17935,7 @@ function findStreamByName(entries, name, isReadable) {
|
|
|
17931
17935
|
return top.find((entry) => entry.name === name) ?? top.find((entry) => sameName(entry.name, name)) ?? entries.find((entry) => entry.name === name && isReadable(entry));
|
|
17932
17936
|
}
|
|
17933
17937
|
|
|
17934
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17938
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
|
|
17935
17939
|
function parseOle2(buffer, options = {}) {
|
|
17936
17940
|
const strict = options.strict === true;
|
|
17937
17941
|
const data = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
@@ -18078,7 +18082,11 @@ function parseOle2(buffer, options = {}) {
|
|
|
18078
18082
|
}
|
|
18079
18083
|
if (firstDirectorySector > MAXREGSECT)
|
|
18080
18084
|
throw new Ole2ParseError("Missing directory chain");
|
|
18081
|
-
const
|
|
18085
|
+
const directoryBytes = readMetadataChain(firstDirectorySector, "directory");
|
|
18086
|
+
if (strict && majorVersion === 4 && view.getUint32(40, true) !== directoryBytes.length / sectorSize) {
|
|
18087
|
+
throw new Ole2ParseError("Unexpected directory sector count");
|
|
18088
|
+
}
|
|
18089
|
+
const entries = readDirectory(directoryBytes, majorVersion, strict, warnings);
|
|
18082
18090
|
for (const entry of entries) {
|
|
18083
18091
|
if (majorVersion === 4 && (!Number.isSafeInteger(entry.size) || entry.size > sectorCount * sectorSize)) {
|
|
18084
18092
|
throw new Ole2ParseError("Stream size exceeds supported file bounds");
|
|
@@ -18283,7 +18291,7 @@ function unwrapOleEmbedding(bytes) {
|
|
|
18283
18291
|
return { data: bytes };
|
|
18284
18292
|
}
|
|
18285
18293
|
|
|
18286
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18294
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js
|
|
18287
18295
|
function compareDirEntryNames(a, b) {
|
|
18288
18296
|
const ua = a.toUpperCase();
|
|
18289
18297
|
const ub = b.toUpperCase();
|
|
@@ -18350,7 +18358,7 @@ function writeInt32Sectors(outBytes, int32Data, firstSector, numSectors, sectorS
|
|
|
18350
18358
|
}
|
|
18351
18359
|
}
|
|
18352
18360
|
|
|
18353
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18361
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js
|
|
18354
18362
|
function writeHeader(outView, outBytes, params) {
|
|
18355
18363
|
outBytes.set(OLE_MAGIC, 0);
|
|
18356
18364
|
outView.setUint16(24, 62, true);
|
|
@@ -18443,7 +18451,7 @@ function writeStreamSectors(outBytes, streamData, chain2, sectorSize) {
|
|
|
18443
18451
|
}
|
|
18444
18452
|
}
|
|
18445
18453
|
|
|
18446
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18454
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
|
|
18447
18455
|
function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
|
|
18448
18456
|
const sectorSize = 512;
|
|
18449
18457
|
const miniSectorSize = 64;
|
|
@@ -19445,7 +19453,7 @@ async function writeOleSheetCellEdit(xlsxBytes, edit) {
|
|
|
19445
19453
|
}
|
|
19446
19454
|
}
|
|
19447
19455
|
|
|
19448
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19456
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-edit.js
|
|
19449
19457
|
var END = 4294967294;
|
|
19450
19458
|
var MAX = 4294967290;
|
|
19451
19459
|
var NIL = 4294967295;
|
|
@@ -19533,21 +19541,21 @@ function readTarget(input, target, root, fat, sector, sectorCount, sectorSize, m
|
|
|
19533
19541
|
return out;
|
|
19534
19542
|
}
|
|
19535
19543
|
function processCompoundFileStream(input, path, replacement) {
|
|
19536
|
-
const
|
|
19544
|
+
const reject2 = () => replacement ? input : void 0;
|
|
19537
19545
|
try {
|
|
19538
19546
|
if (path.length === 0 || path.some((part) => !part) || input.length < 512)
|
|
19539
|
-
return
|
|
19547
|
+
return reject2();
|
|
19540
19548
|
const view = new DataView(input.buffer, input.byteOffset, input.byteLength);
|
|
19541
19549
|
const read32 = (offset2) => view.getUint32(offset2, true);
|
|
19542
19550
|
if (input[0] !== 208 || input[1] !== 207 || input[2] !== 17 || input[3] !== 224 || input[4] !== 161 || input[5] !== 177 || input[6] !== 26 || input[7] !== 225 || // Readers tolerate a non-canonical byte-order mark; edits do not.
|
|
19543
19551
|
replacement && view.getUint16(28, true) !== 65534)
|
|
19544
|
-
return
|
|
19552
|
+
return reject2();
|
|
19545
19553
|
const major = view.getUint16(26, true), shift = view.getUint16(30, true), miniShift = view.getUint16(32, true);
|
|
19546
19554
|
if (major !== 3 && major !== 4 || shift !== (major === 3 ? 9 : 12) || miniShift !== 6)
|
|
19547
|
-
return
|
|
19555
|
+
return reject2();
|
|
19548
19556
|
const sectorSize = 1 << shift, miniSize = 1 << miniShift;
|
|
19549
19557
|
if (input.length < sectorSize || replacement && input.length % sectorSize !== 0)
|
|
19550
|
-
return
|
|
19558
|
+
return reject2();
|
|
19551
19559
|
const sectorCount = Math.ceil(input.length / sectorSize) - 1;
|
|
19552
19560
|
const offset = (id) => (id + 1) * sectorSize;
|
|
19553
19561
|
const sector = (id) => {
|
|
@@ -19566,7 +19574,7 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
19566
19574
|
const difatIds = /* @__PURE__ */ new Set();
|
|
19567
19575
|
for (let i2 = 0; i2 < difatCount; i2++) {
|
|
19568
19576
|
if (difatIds.has(difat) || difat > MAX)
|
|
19569
|
-
return
|
|
19577
|
+
return reject2();
|
|
19570
19578
|
difatIds.add(difat);
|
|
19571
19579
|
const bytes = sector(difat), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
19572
19580
|
for (let j = 0; j < (sectorSize - 4) / 4 && fatIds.length < fatCount; j++) {
|
|
@@ -19577,7 +19585,7 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
19577
19585
|
difat = dv.getUint32(sectorSize - 4, true);
|
|
19578
19586
|
}
|
|
19579
19587
|
if (fatIds.length !== fatCount || new Set(fatIds).size !== fatIds.length || fatIds.some((id) => difatIds.has(id)))
|
|
19580
|
-
return
|
|
19588
|
+
return reject2();
|
|
19581
19589
|
const fat = [];
|
|
19582
19590
|
for (const id of fatIds) {
|
|
19583
19591
|
const bytes = sector(id), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
@@ -19596,13 +19604,13 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
19596
19604
|
continue;
|
|
19597
19605
|
const nameLength = dvDir.getUint16(p + 64, true);
|
|
19598
19606
|
if (nameLength < 2 || nameLength > 64 || nameLength % 2)
|
|
19599
|
-
return
|
|
19607
|
+
return reject2();
|
|
19600
19608
|
let name = "";
|
|
19601
19609
|
for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
|
|
19602
19610
|
name += String.fromCharCode(dvDir.getUint16(p + i2, true));
|
|
19603
19611
|
const sizeLow = dvDir.getUint32(p + 120, true), sizeHigh = dvDir.getUint32(p + 124, true);
|
|
19604
19612
|
if (sizeHigh !== 0 && (replacement || major === 4))
|
|
19605
|
-
return
|
|
19613
|
+
return reject2();
|
|
19606
19614
|
entries.push({
|
|
19607
19615
|
id,
|
|
19608
19616
|
name,
|
|
@@ -19617,7 +19625,7 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
19617
19625
|
const byId = new Map(entries.map((e) => [e.id, e]));
|
|
19618
19626
|
const root = entries.find((e) => e.type === 5);
|
|
19619
19627
|
if (!root)
|
|
19620
|
-
return
|
|
19628
|
+
return reject2();
|
|
19621
19629
|
let parent = root, target;
|
|
19622
19630
|
for (let partIndex = 0; partIndex < path.length; partIndex++) {
|
|
19623
19631
|
const matches = [], seen = /* @__PURE__ */ new Set();
|
|
@@ -19637,22 +19645,22 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
19637
19645
|
};
|
|
19638
19646
|
visit(parent.child);
|
|
19639
19647
|
if (matches.length !== 1)
|
|
19640
|
-
return
|
|
19648
|
+
return reject2();
|
|
19641
19649
|
target = matches[0];
|
|
19642
19650
|
if (partIndex < path.length - 1) {
|
|
19643
19651
|
if (target.type !== 1)
|
|
19644
|
-
return
|
|
19652
|
+
return reject2();
|
|
19645
19653
|
parent = target;
|
|
19646
19654
|
} else if (target.type !== 2 || replacement && replacement.length !== target.size)
|
|
19647
|
-
return
|
|
19655
|
+
return reject2();
|
|
19648
19656
|
}
|
|
19649
19657
|
if (!target)
|
|
19650
|
-
return
|
|
19658
|
+
return reject2();
|
|
19651
19659
|
if (!replacement)
|
|
19652
19660
|
return readTarget(input, target, root, fat, sector, sectorCount, sectorSize, miniSize, read32);
|
|
19653
19661
|
const names = entries.map((e) => e.name.toLowerCase());
|
|
19654
19662
|
if (replacement && (names.includes("encryptioninfo") || names.includes("encryptedpackage")))
|
|
19655
|
-
return
|
|
19663
|
+
return reject2();
|
|
19656
19664
|
for (const name of replacement ? ["book", "workbook"] : []) {
|
|
19657
19665
|
if (!names.includes(name))
|
|
19658
19666
|
continue;
|
|
@@ -19663,7 +19671,7 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
19663
19671
|
const record = workbook[p] | workbook[p + 1] << 8;
|
|
19664
19672
|
const length = workbook[p + 2] | workbook[p + 3] << 8;
|
|
19665
19673
|
if (record === 47)
|
|
19666
|
-
return
|
|
19674
|
+
return reject2();
|
|
19667
19675
|
if (p + 4 + length > workbook.length || record === 10)
|
|
19668
19676
|
break;
|
|
19669
19677
|
p += 4 + length;
|
|
@@ -19672,13 +19680,13 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
19672
19680
|
if (replacement && names.includes("worddocument")) {
|
|
19673
19681
|
const word = readCompoundFileStream(input, ["WordDocument"]);
|
|
19674
19682
|
if (word && word.length >= 12 && ((word[10] | word[11] << 8) & 256) !== 0)
|
|
19675
|
-
return
|
|
19683
|
+
return reject2();
|
|
19676
19684
|
}
|
|
19677
19685
|
const miniCutoff = read32(56), miniFatCount = read32(64), miniFatStart = read32(60);
|
|
19678
19686
|
const miniFatSectors = miniFatCount ? chain(fat, miniFatStart, miniFatCount) : [];
|
|
19679
19687
|
const metadataSectors = [...fatIds, ...difatIds, ...dirSectors, ...miniFatSectors];
|
|
19680
19688
|
if (new Set(metadataSectors).size !== metadataSectors.length)
|
|
19681
|
-
return
|
|
19689
|
+
return reject2();
|
|
19682
19690
|
const miniFat = [];
|
|
19683
19691
|
const miniCapacity = Math.floor(Math.min(root.size, sectorCount * sectorSize) / miniSize);
|
|
19684
19692
|
for (const id of miniFatSectors) {
|
|
@@ -19697,7 +19705,7 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
19697
19705
|
for (const id of exactChain(fat, entry.start, entry.size, sectorSize)) {
|
|
19698
19706
|
sector(id);
|
|
19699
19707
|
if (regularUsed.has(id))
|
|
19700
|
-
return
|
|
19708
|
+
return reject2();
|
|
19701
19709
|
regularUsed.add(id);
|
|
19702
19710
|
}
|
|
19703
19711
|
}
|
|
@@ -19708,7 +19716,7 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
19708
19716
|
const ids = exactChain(miniFat, entry.start, entry.size, miniSize);
|
|
19709
19717
|
for (const id of ids) {
|
|
19710
19718
|
if ((id + 1) * miniSize > rootMini.size || miniUsed.has(id))
|
|
19711
|
-
return
|
|
19719
|
+
return reject2();
|
|
19712
19720
|
miniUsed.add(id);
|
|
19713
19721
|
}
|
|
19714
19722
|
}
|
|
@@ -19742,7 +19750,7 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
19742
19750
|
output.set(replacement.subarray(i2 * sectorSize, Math.min((i2 + 1) * sectorSize, replacement.length)), offset(sectors[i2]));
|
|
19743
19751
|
} else {
|
|
19744
19752
|
if (!miniFat.length)
|
|
19745
|
-
return
|
|
19753
|
+
return reject2();
|
|
19746
19754
|
const miniSectors = exactChain(miniFat, target.start, target.size, miniSize);
|
|
19747
19755
|
const rootMini2 = entries.find((e) => e.type === 5);
|
|
19748
19756
|
const rootSectors = exactChain(fat, rootMini2.start, rootMini2.size, sectorSize);
|
|
@@ -19752,18 +19760,18 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
19752
19760
|
for (let i2 = 0; i2 < replacement.length; i2++) {
|
|
19753
19761
|
const miniOffset = miniSectors[Math.floor(i2 / miniSize)] * miniSize + i2 % miniSize;
|
|
19754
19762
|
if (miniOffset >= rootData.length)
|
|
19755
|
-
return
|
|
19763
|
+
return reject2();
|
|
19756
19764
|
const rootSectorIndex = Math.floor(miniOffset / sectorSize);
|
|
19757
19765
|
const rootSector = rootSectors[rootSectorIndex];
|
|
19758
19766
|
if (rootSector === void 0)
|
|
19759
|
-
return
|
|
19767
|
+
return reject2();
|
|
19760
19768
|
const physical = offset(rootSector) + miniOffset % sectorSize;
|
|
19761
19769
|
output[physical] = replacement[i2];
|
|
19762
19770
|
}
|
|
19763
19771
|
}
|
|
19764
19772
|
return output;
|
|
19765
19773
|
} catch {
|
|
19766
|
-
return
|
|
19774
|
+
return reject2();
|
|
19767
19775
|
}
|
|
19768
19776
|
}
|
|
19769
19777
|
function readCompoundFileStream(input, path) {
|
|
@@ -19773,7 +19781,7 @@ function replaceCompoundFileStream(input, path, replacement) {
|
|
|
19773
19781
|
return processCompoundFileStream(input, path, replacement) ?? input;
|
|
19774
19782
|
}
|
|
19775
19783
|
|
|
19776
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19784
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-cfb.js
|
|
19777
19785
|
var WORKBOOK_STREAM_NAMES = ["workbook", "book"];
|
|
19778
19786
|
function unwrapXlsBytes(bytes) {
|
|
19779
19787
|
if (!isCfb(bytes)) {
|
|
@@ -19840,7 +19848,1112 @@ function isCfb(bytes) {
|
|
|
19840
19848
|
return OLE_MAGIC.every((value, index) => bytes[index] === value);
|
|
19841
19849
|
}
|
|
19842
19850
|
|
|
19843
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19851
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-record-edit-model.js
|
|
19852
|
+
var EditError = class extends Error {
|
|
19853
|
+
reason;
|
|
19854
|
+
constructor(reason) {
|
|
19855
|
+
super(reason);
|
|
19856
|
+
this.reason = reason;
|
|
19857
|
+
}
|
|
19858
|
+
};
|
|
19859
|
+
function reject(reason) {
|
|
19860
|
+
throw new EditError(reason);
|
|
19861
|
+
}
|
|
19862
|
+
function model(bytes) {
|
|
19863
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
19864
|
+
const records = [];
|
|
19865
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
19866
|
+
let offset = 0, depth = 0, globalsEnd = -1;
|
|
19867
|
+
let top;
|
|
19868
|
+
while (offset < bytes.length) {
|
|
19869
|
+
if (depth === 0 && globalsEnd >= 0 && bytes[offset] === 0 && bytes.subarray(offset).every((b) => b === 0))
|
|
19870
|
+
break;
|
|
19871
|
+
if (offset + 4 > bytes.length)
|
|
19872
|
+
reject("malformed-records");
|
|
19873
|
+
const opcode = view.getUint16(offset, true), length = view.getUint16(offset + 2, true), dataOffset = offset + 4;
|
|
19874
|
+
if (length > 8224 || dataOffset + length > bytes.length)
|
|
19875
|
+
reject("malformed-records");
|
|
19876
|
+
if (opcode === 2057) {
|
|
19877
|
+
if (length < 4 || view.getUint16(dataOffset, true) !== 1536 || depth >= 64)
|
|
19878
|
+
reject("unsupported-workbook");
|
|
19879
|
+
const kind = view.getUint16(dataOffset + 2, true);
|
|
19880
|
+
if (depth === 0) {
|
|
19881
|
+
if (offset === 0 ? kind !== 5 : globalsEnd < 0 || kind === 5)
|
|
19882
|
+
reject("malformed-records");
|
|
19883
|
+
top = { start: offset, kind };
|
|
19884
|
+
}
|
|
19885
|
+
depth++;
|
|
19886
|
+
} else if (opcode === 10) {
|
|
19887
|
+
if (depth === 0 || length !== 0)
|
|
19888
|
+
reject("malformed-records");
|
|
19889
|
+
} else if (depth === 0)
|
|
19890
|
+
reject("malformed-records");
|
|
19891
|
+
records.push({ opcode, length, headerOffset: offset, dataOffset, depth });
|
|
19892
|
+
if (opcode === 10 && --depth === 0) {
|
|
19893
|
+
if (!top)
|
|
19894
|
+
reject("malformed-records");
|
|
19895
|
+
streams2.set(top.start, { ...top, end: dataOffset });
|
|
19896
|
+
if (top.kind === 5)
|
|
19897
|
+
globalsEnd = dataOffset;
|
|
19898
|
+
top = void 0;
|
|
19899
|
+
}
|
|
19900
|
+
offset = dataOffset + length;
|
|
19901
|
+
}
|
|
19902
|
+
if (depth !== 0 || globalsEnd < 0)
|
|
19903
|
+
reject("malformed-records");
|
|
19904
|
+
if (records.some((r) => r.opcode === 47 && r.headerOffset < globalsEnd))
|
|
19905
|
+
reject("unsupported-workbook");
|
|
19906
|
+
const bounds = records.filter((r) => r.opcode === 133 && r.headerOffset < globalsEnd && r.depth === 1);
|
|
19907
|
+
if (bounds.length === 0)
|
|
19908
|
+
reject("malformed-records");
|
|
19909
|
+
const worksheets = [];
|
|
19910
|
+
const used = /* @__PURE__ */ new Set();
|
|
19911
|
+
for (const bound of bounds) {
|
|
19912
|
+
const p = bound.dataOffset;
|
|
19913
|
+
if (bound.length < 8)
|
|
19914
|
+
reject("malformed-records");
|
|
19915
|
+
const chars = view.getUint8(p + 6), wide = Boolean(view.getUint8(p + 7) & 1), kind = view.getUint8(p + 5);
|
|
19916
|
+
if (chars < 1 || chars > 31 || bound.length !== 8 + chars * (wide ? 2 : 1) || (view.getUint8(p + 4) & 3) > 2)
|
|
19917
|
+
reject("malformed-records");
|
|
19918
|
+
const expected = { 0: 16, 1: 64, 2: 32, 6: 6 };
|
|
19919
|
+
const stream = streams2.get(view.getUint32(p, true));
|
|
19920
|
+
if (!stream || stream.kind !== expected[kind] || used.has(stream.start))
|
|
19921
|
+
reject("malformed-records");
|
|
19922
|
+
used.add(stream.start);
|
|
19923
|
+
if (kind === 0)
|
|
19924
|
+
worksheets.push(stream);
|
|
19925
|
+
}
|
|
19926
|
+
if (used.size !== streams2.size - 1)
|
|
19927
|
+
reject("malformed-records");
|
|
19928
|
+
return { records, worksheets, globalsEnd };
|
|
19929
|
+
}
|
|
19930
|
+
function findTarget(bytes, m, edit, allowed = [253, 638, 515, 189]) {
|
|
19931
|
+
const range = m.worksheets[edit.worksheetIndex ?? 0];
|
|
19932
|
+
if (!range)
|
|
19933
|
+
reject("sheet-not-found");
|
|
19934
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
19935
|
+
const targets = [];
|
|
19936
|
+
for (const r of m.records) {
|
|
19937
|
+
if (r.headerOffset < range.start || r.headerOffset >= range.end || r.depth !== 1)
|
|
19938
|
+
continue;
|
|
19939
|
+
const p = r.dataOffset;
|
|
19940
|
+
if ([515, 638, 253, 6, 513, 516, 517, 214].includes(r.opcode)) {
|
|
19941
|
+
if (r.length < 6)
|
|
19942
|
+
reject("malformed-records");
|
|
19943
|
+
if (view.getUint16(p, true) === edit.row && view.getUint16(p + 2, true) === edit.col)
|
|
19944
|
+
targets.push(r);
|
|
19945
|
+
} else if (r.opcode === 189 || r.opcode === 190) {
|
|
19946
|
+
const stride = r.opcode === 189 ? 6 : 2;
|
|
19947
|
+
if (r.length < 6 + stride || (r.length - 6) % stride !== 0)
|
|
19948
|
+
reject("malformed-records");
|
|
19949
|
+
const first2 = view.getUint16(p + 2, true), last = view.getUint16(p + r.length - 2, true);
|
|
19950
|
+
if (last > 255 || last < first2 || last - first2 + 1 !== (r.length - 6) / stride)
|
|
19951
|
+
reject("malformed-records");
|
|
19952
|
+
if (r.opcode === 190 && (first2 > 254 || last <= first2))
|
|
19953
|
+
reject("malformed-records");
|
|
19954
|
+
if (view.getUint16(p, true) === edit.row && edit.col >= first2 && edit.col <= last)
|
|
19955
|
+
targets.push(r);
|
|
19956
|
+
}
|
|
19957
|
+
}
|
|
19958
|
+
if (targets.length > 1)
|
|
19959
|
+
reject("ambiguous-cell");
|
|
19960
|
+
const target = targets[0];
|
|
19961
|
+
if (!target || !allowed.includes(target.opcode))
|
|
19962
|
+
reject("cell-not-supported");
|
|
19963
|
+
if (target.opcode !== 189 && target.opcode !== 190 && target.length !== (target.opcode === 515 ? 14 : target.opcode === 517 ? 8 : target.opcode === 513 ? 6 : 10))
|
|
19964
|
+
reject("malformed-records");
|
|
19965
|
+
for (const record of m.records.filter((r) => r.headerOffset >= range.start && r.headerOffset < range.end && r.depth === 1 && [545, 1212, 566].includes(r.opcode))) {
|
|
19966
|
+
if (record.length < 6)
|
|
19967
|
+
reject("malformed-records");
|
|
19968
|
+
const p = record.dataOffset;
|
|
19969
|
+
if (edit.row >= view.getUint16(p, true) && edit.row <= view.getUint16(p + 2, true) && edit.col >= view.getUint8(p + 4) && edit.col <= view.getUint8(p + 5))
|
|
19970
|
+
reject("cell-not-supported");
|
|
19971
|
+
}
|
|
19972
|
+
return target;
|
|
19973
|
+
}
|
|
19974
|
+
|
|
19975
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-cell-record-splices.js
|
|
19976
|
+
var CELL_OPS = /* @__PURE__ */ new Set([6, 513, 515, 516, 517, 638, 253, 189, 190, 214]);
|
|
19977
|
+
function relocateXlsDbCells(input, out, records, replacement, map) {
|
|
19978
|
+
const source2 = new DataView(input.buffer, input.byteOffset, input.byteLength), dest = new DataView(out.buffer, out.byteOffset, out.byteLength);
|
|
19979
|
+
const byOffset = new Map(records.map((r) => [r.headerOffset, r]));
|
|
19980
|
+
for (const db of records.filter((r) => r.opcode === 215)) {
|
|
19981
|
+
if (db.length < 4 || (db.length - 4) % 2 !== 0 || db.length > 68)
|
|
19982
|
+
throw new Error("Invalid DBCELL size");
|
|
19983
|
+
const back = source2.getUint32(db.dataOffset, true);
|
|
19984
|
+
if (back === 0) {
|
|
19985
|
+
if (db.length !== 4)
|
|
19986
|
+
throw new Error("Unsupported empty DBCELL");
|
|
19987
|
+
continue;
|
|
19988
|
+
}
|
|
19989
|
+
const firstRow = byOffset.get(db.headerOffset - back);
|
|
19990
|
+
if (!firstRow || firstRow.opcode !== 520 || firstRow.length !== 16)
|
|
19991
|
+
throw new Error("Invalid DBCELL row pointer");
|
|
19992
|
+
if (replacement.start < firstRow.headerOffset || replacement.start >= db.headerOffset)
|
|
19993
|
+
continue;
|
|
19994
|
+
const rows = records.filter((r) => r.opcode === 520 && r.headerOffset >= firstRow.headerOffset && r.headerOffset < db.headerOffset);
|
|
19995
|
+
if (rows.length !== (db.length - 4) / 2 || rows.some((r) => r.length !== 16))
|
|
19996
|
+
throw new Error("Unsupported DBCELL row block");
|
|
19997
|
+
let base = firstRow.dataOffset + firstRow.length;
|
|
19998
|
+
const addresses = [];
|
|
19999
|
+
for (let i2 = 0; i2 < rows.length; i2++) {
|
|
20000
|
+
const address = base + source2.getUint16(db.dataOffset + 4 + i2 * 2, true), cell = byOffset.get(address);
|
|
20001
|
+
if (!cell || !CELL_OPS.has(cell.opcode) || address >= db.headerOffset || source2.getUint16(cell.dataOffset, true) !== source2.getUint16(rows[i2].dataOffset, true))
|
|
20002
|
+
throw new Error("Unsupported DBCELL first-cell pointer");
|
|
20003
|
+
addresses.push(address);
|
|
20004
|
+
base = address;
|
|
20005
|
+
}
|
|
20006
|
+
const offset = map(db.headerOffset) - map(firstRow.headerOffset);
|
|
20007
|
+
if (offset < 0 || offset > 4294967295)
|
|
20008
|
+
throw new Error("DBCELL row pointer overflow");
|
|
20009
|
+
dest.setUint32(map(db.dataOffset), offset, true);
|
|
20010
|
+
let newBase = map(firstRow.dataOffset + firstRow.length);
|
|
20011
|
+
for (let i2 = 0; i2 < addresses.length; i2++) {
|
|
20012
|
+
const address = map(addresses[i2]), relative = address - newBase;
|
|
20013
|
+
if (relative < 0 || relative > 65535)
|
|
20014
|
+
throw new Error("DBCELL cell pointer overflow");
|
|
20015
|
+
dest.setUint16(map(db.dataOffset + 4 + i2 * 2), relative, true);
|
|
20016
|
+
newBase = address;
|
|
20017
|
+
}
|
|
20018
|
+
}
|
|
20019
|
+
}
|
|
20020
|
+
|
|
20021
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-known-records.js
|
|
20022
|
+
var KNOWN_XLS_RECORDS = /* @__PURE__ */ new Set([
|
|
20023
|
+
6,
|
|
20024
|
+
10,
|
|
20025
|
+
12,
|
|
20026
|
+
13,
|
|
20027
|
+
14,
|
|
20028
|
+
15,
|
|
20029
|
+
16,
|
|
20030
|
+
17,
|
|
20031
|
+
18,
|
|
20032
|
+
19,
|
|
20033
|
+
20,
|
|
20034
|
+
21,
|
|
20035
|
+
23,
|
|
20036
|
+
24,
|
|
20037
|
+
25,
|
|
20038
|
+
26,
|
|
20039
|
+
27,
|
|
20040
|
+
28,
|
|
20041
|
+
29,
|
|
20042
|
+
34,
|
|
20043
|
+
35,
|
|
20044
|
+
38,
|
|
20045
|
+
39,
|
|
20046
|
+
40,
|
|
20047
|
+
41,
|
|
20048
|
+
42,
|
|
20049
|
+
43,
|
|
20050
|
+
47,
|
|
20051
|
+
49,
|
|
20052
|
+
51,
|
|
20053
|
+
60,
|
|
20054
|
+
61,
|
|
20055
|
+
64,
|
|
20056
|
+
65,
|
|
20057
|
+
66,
|
|
20058
|
+
77,
|
|
20059
|
+
80,
|
|
20060
|
+
81,
|
|
20061
|
+
82,
|
|
20062
|
+
85,
|
|
20063
|
+
89,
|
|
20064
|
+
90,
|
|
20065
|
+
91,
|
|
20066
|
+
92,
|
|
20067
|
+
93,
|
|
20068
|
+
94,
|
|
20069
|
+
95,
|
|
20070
|
+
96,
|
|
20071
|
+
97,
|
|
20072
|
+
99,
|
|
20073
|
+
125,
|
|
20074
|
+
128,
|
|
20075
|
+
129,
|
|
20076
|
+
130,
|
|
20077
|
+
131,
|
|
20078
|
+
132,
|
|
20079
|
+
133,
|
|
20080
|
+
134,
|
|
20081
|
+
140,
|
|
20082
|
+
141,
|
|
20083
|
+
144,
|
|
20084
|
+
146,
|
|
20085
|
+
151,
|
|
20086
|
+
152,
|
|
20087
|
+
153,
|
|
20088
|
+
154,
|
|
20089
|
+
155,
|
|
20090
|
+
156,
|
|
20091
|
+
157,
|
|
20092
|
+
158,
|
|
20093
|
+
160,
|
|
20094
|
+
161,
|
|
20095
|
+
174,
|
|
20096
|
+
175,
|
|
20097
|
+
176,
|
|
20098
|
+
177,
|
|
20099
|
+
178,
|
|
20100
|
+
180,
|
|
20101
|
+
181,
|
|
20102
|
+
182,
|
|
20103
|
+
184,
|
|
20104
|
+
185,
|
|
20105
|
+
189,
|
|
20106
|
+
190,
|
|
20107
|
+
193,
|
|
20108
|
+
197,
|
|
20109
|
+
198,
|
|
20110
|
+
199,
|
|
20111
|
+
200,
|
|
20112
|
+
201,
|
|
20113
|
+
202,
|
|
20114
|
+
203,
|
|
20115
|
+
204,
|
|
20116
|
+
205,
|
|
20117
|
+
206,
|
|
20118
|
+
207,
|
|
20119
|
+
208,
|
|
20120
|
+
209,
|
|
20121
|
+
210,
|
|
20122
|
+
211,
|
|
20123
|
+
213,
|
|
20124
|
+
215,
|
|
20125
|
+
216,
|
|
20126
|
+
217,
|
|
20127
|
+
218,
|
|
20128
|
+
220,
|
|
20129
|
+
221,
|
|
20130
|
+
222,
|
|
20131
|
+
224,
|
|
20132
|
+
225,
|
|
20133
|
+
226,
|
|
20134
|
+
227,
|
|
20135
|
+
229,
|
|
20136
|
+
233,
|
|
20137
|
+
235,
|
|
20138
|
+
236,
|
|
20139
|
+
237,
|
|
20140
|
+
239,
|
|
20141
|
+
240,
|
|
20142
|
+
241,
|
|
20143
|
+
242,
|
|
20144
|
+
244,
|
|
20145
|
+
245,
|
|
20146
|
+
246,
|
|
20147
|
+
247,
|
|
20148
|
+
248,
|
|
20149
|
+
249,
|
|
20150
|
+
251,
|
|
20151
|
+
252,
|
|
20152
|
+
253,
|
|
20153
|
+
255,
|
|
20154
|
+
256,
|
|
20155
|
+
259,
|
|
20156
|
+
290,
|
|
20157
|
+
311,
|
|
20158
|
+
312,
|
|
20159
|
+
315,
|
|
20160
|
+
317,
|
|
20161
|
+
318,
|
|
20162
|
+
319,
|
|
20163
|
+
320,
|
|
20164
|
+
330,
|
|
20165
|
+
331,
|
|
20166
|
+
333,
|
|
20167
|
+
334,
|
|
20168
|
+
335,
|
|
20169
|
+
336,
|
|
20170
|
+
337,
|
|
20171
|
+
338,
|
|
20172
|
+
339,
|
|
20173
|
+
340,
|
|
20174
|
+
351,
|
|
20175
|
+
352,
|
|
20176
|
+
353,
|
|
20177
|
+
401,
|
|
20178
|
+
402,
|
|
20179
|
+
403,
|
|
20180
|
+
404,
|
|
20181
|
+
405,
|
|
20182
|
+
406,
|
|
20183
|
+
407,
|
|
20184
|
+
408,
|
|
20185
|
+
425,
|
|
20186
|
+
426,
|
|
20187
|
+
427,
|
|
20188
|
+
428,
|
|
20189
|
+
429,
|
|
20190
|
+
430,
|
|
20191
|
+
431,
|
|
20192
|
+
432,
|
|
20193
|
+
433,
|
|
20194
|
+
434,
|
|
20195
|
+
437,
|
|
20196
|
+
438,
|
|
20197
|
+
439,
|
|
20198
|
+
440,
|
|
20199
|
+
441,
|
|
20200
|
+
442,
|
|
20201
|
+
443,
|
|
20202
|
+
444,
|
|
20203
|
+
445,
|
|
20204
|
+
446,
|
|
20205
|
+
448,
|
|
20206
|
+
449,
|
|
20207
|
+
450,
|
|
20208
|
+
512,
|
|
20209
|
+
513,
|
|
20210
|
+
515,
|
|
20211
|
+
516,
|
|
20212
|
+
517,
|
|
20213
|
+
519,
|
|
20214
|
+
520,
|
|
20215
|
+
523,
|
|
20216
|
+
545,
|
|
20217
|
+
549,
|
|
20218
|
+
566,
|
|
20219
|
+
574,
|
|
20220
|
+
638,
|
|
20221
|
+
659,
|
|
20222
|
+
1048,
|
|
20223
|
+
1054,
|
|
20224
|
+
1084,
|
|
20225
|
+
1212,
|
|
20226
|
+
2048,
|
|
20227
|
+
2049,
|
|
20228
|
+
2050,
|
|
20229
|
+
2051,
|
|
20230
|
+
2052,
|
|
20231
|
+
2053,
|
|
20232
|
+
2054,
|
|
20233
|
+
2055,
|
|
20234
|
+
2056,
|
|
20235
|
+
2057,
|
|
20236
|
+
2058,
|
|
20237
|
+
2059,
|
|
20238
|
+
2060,
|
|
20239
|
+
2061,
|
|
20240
|
+
2062,
|
|
20241
|
+
2063,
|
|
20242
|
+
2064,
|
|
20243
|
+
2066,
|
|
20244
|
+
2067,
|
|
20245
|
+
2128,
|
|
20246
|
+
2129,
|
|
20247
|
+
2130,
|
|
20248
|
+
2131,
|
|
20249
|
+
2132,
|
|
20250
|
+
2133,
|
|
20251
|
+
2134,
|
|
20252
|
+
2135,
|
|
20253
|
+
2136,
|
|
20254
|
+
2137,
|
|
20255
|
+
2138,
|
|
20256
|
+
2146,
|
|
20257
|
+
2147,
|
|
20258
|
+
2148,
|
|
20259
|
+
2149,
|
|
20260
|
+
2150,
|
|
20261
|
+
2151,
|
|
20262
|
+
2152,
|
|
20263
|
+
2154,
|
|
20264
|
+
2155,
|
|
20265
|
+
2156,
|
|
20266
|
+
2161,
|
|
20267
|
+
2162,
|
|
20268
|
+
2164,
|
|
20269
|
+
2165,
|
|
20270
|
+
2166,
|
|
20271
|
+
2167,
|
|
20272
|
+
2168,
|
|
20273
|
+
2169,
|
|
20274
|
+
2170,
|
|
20275
|
+
2171,
|
|
20276
|
+
2172,
|
|
20277
|
+
2173,
|
|
20278
|
+
2174,
|
|
20279
|
+
2175,
|
|
20280
|
+
2180,
|
|
20281
|
+
2181,
|
|
20282
|
+
2182,
|
|
20283
|
+
2183,
|
|
20284
|
+
2184,
|
|
20285
|
+
2185,
|
|
20286
|
+
2186,
|
|
20287
|
+
2187,
|
|
20288
|
+
2188,
|
|
20289
|
+
2189,
|
|
20290
|
+
2190,
|
|
20291
|
+
2191,
|
|
20292
|
+
2192,
|
|
20293
|
+
2194,
|
|
20294
|
+
2195,
|
|
20295
|
+
2196,
|
|
20296
|
+
2197,
|
|
20297
|
+
2198,
|
|
20298
|
+
2199,
|
|
20299
|
+
2200,
|
|
20300
|
+
2201,
|
|
20301
|
+
2202,
|
|
20302
|
+
2203,
|
|
20303
|
+
2204,
|
|
20304
|
+
2205,
|
|
20305
|
+
2206,
|
|
20306
|
+
2207,
|
|
20307
|
+
2211,
|
|
20308
|
+
2212,
|
|
20309
|
+
2213,
|
|
20310
|
+
2214,
|
|
20311
|
+
2215,
|
|
20312
|
+
4097,
|
|
20313
|
+
4098,
|
|
20314
|
+
4099,
|
|
20315
|
+
4102,
|
|
20316
|
+
4103,
|
|
20317
|
+
4105,
|
|
20318
|
+
4106,
|
|
20319
|
+
4107,
|
|
20320
|
+
4108,
|
|
20321
|
+
4109,
|
|
20322
|
+
4116,
|
|
20323
|
+
4117,
|
|
20324
|
+
4118,
|
|
20325
|
+
4119,
|
|
20326
|
+
4120,
|
|
20327
|
+
4121,
|
|
20328
|
+
4122,
|
|
20329
|
+
4123,
|
|
20330
|
+
4124,
|
|
20331
|
+
4125,
|
|
20332
|
+
4126,
|
|
20333
|
+
4127,
|
|
20334
|
+
4128,
|
|
20335
|
+
4129,
|
|
20336
|
+
4130,
|
|
20337
|
+
4132,
|
|
20338
|
+
4133,
|
|
20339
|
+
4134,
|
|
20340
|
+
4135,
|
|
20341
|
+
4146,
|
|
20342
|
+
4147,
|
|
20343
|
+
4148,
|
|
20344
|
+
4149,
|
|
20345
|
+
4154,
|
|
20346
|
+
4156,
|
|
20347
|
+
4157,
|
|
20348
|
+
4158,
|
|
20349
|
+
4159,
|
|
20350
|
+
4160,
|
|
20351
|
+
4161,
|
|
20352
|
+
4163,
|
|
20353
|
+
4164,
|
|
20354
|
+
4165,
|
|
20355
|
+
4166,
|
|
20356
|
+
4168,
|
|
20357
|
+
4170,
|
|
20358
|
+
4171,
|
|
20359
|
+
4174,
|
|
20360
|
+
4175,
|
|
20361
|
+
4176,
|
|
20362
|
+
4177,
|
|
20363
|
+
4187,
|
|
20364
|
+
4188,
|
|
20365
|
+
4189,
|
|
20366
|
+
4191,
|
|
20367
|
+
4192,
|
|
20368
|
+
4193,
|
|
20369
|
+
4194,
|
|
20370
|
+
4195,
|
|
20371
|
+
4196,
|
|
20372
|
+
4197,
|
|
20373
|
+
4198,
|
|
20374
|
+
4199,
|
|
20375
|
+
4200
|
|
20376
|
+
]);
|
|
20377
|
+
var XLS_FRT_WRAPPER = 2129;
|
|
20378
|
+
|
|
20379
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-cell-record-replacement.js
|
|
20380
|
+
function applyXlsCellRecordReplacement(input, m, replacement) {
|
|
20381
|
+
if (!Number.isSafeInteger(replacement.start) || !Number.isSafeInteger(replacement.end) || replacement.start < 0 || replacement.end <= replacement.start || replacement.end > input.length || !(replacement.bytes instanceof Uint8Array))
|
|
20382
|
+
reject("malformed-records");
|
|
20383
|
+
const target = m.records.find((r) => r.headerOffset === replacement.start);
|
|
20384
|
+
if (!target || target.dataOffset + target.length !== replacement.end || ![513, 190, 517, 515, 638, 189, 253].includes(target.opcode))
|
|
20385
|
+
reject("malformed-records");
|
|
20386
|
+
const delta2 = replacement.bytes.length - (replacement.end - replacement.start);
|
|
20387
|
+
if (delta2 !== 0 && m.records.some((r) => !KNOWN_XLS_RECORDS.has(r.opcode) || r.opcode === XLS_FRT_WRAPPER))
|
|
20388
|
+
reject("unsupported-pointer-record");
|
|
20389
|
+
const map = (address) => {
|
|
20390
|
+
if (!Number.isSafeInteger(address) || address < 0 || address > input.length || address > replacement.start && address < replacement.end)
|
|
20391
|
+
reject("malformed-records");
|
|
20392
|
+
return address >= replacement.end ? address + delta2 : address;
|
|
20393
|
+
};
|
|
20394
|
+
const out = new Uint8Array(input.length + delta2);
|
|
20395
|
+
out.set(input.subarray(0, replacement.start));
|
|
20396
|
+
out.set(replacement.bytes, replacement.start);
|
|
20397
|
+
out.set(input.subarray(replacement.end), replacement.start + replacement.bytes.length);
|
|
20398
|
+
if (delta2 !== 0) {
|
|
20399
|
+
relocateXlsDbCells(input, out, m.records, replacement, map);
|
|
20400
|
+
const source2 = new DataView(input.buffer, input.byteOffset, input.byteLength), dest = new DataView(out.buffer), byOffset = new Map(m.records.map((r) => [r.headerOffset, r]));
|
|
20401
|
+
for (const r of m.records) {
|
|
20402
|
+
if (r.opcode === 133) {
|
|
20403
|
+
if (r.headerOffset >= m.globalsEnd || r.depth !== 1)
|
|
20404
|
+
reject("malformed-records");
|
|
20405
|
+
dest.setUint32(map(r.dataOffset), map(source2.getUint32(r.dataOffset, true)), true);
|
|
20406
|
+
}
|
|
20407
|
+
if (r.opcode === 523) {
|
|
20408
|
+
if (r.length < 16 || (r.length - 16) % 4 !== 0)
|
|
20409
|
+
reject("malformed-records");
|
|
20410
|
+
const owner = m.worksheets.find((sheet) => r.depth === 1 && r.headerOffset >= sheet.start && r.headerOffset < sheet.end);
|
|
20411
|
+
if (!owner)
|
|
20412
|
+
reject("malformed-records");
|
|
20413
|
+
const pointers = /* @__PURE__ */ new Set();
|
|
20414
|
+
for (let p = r.dataOffset + 12; p < r.dataOffset + r.length; p += 4) {
|
|
20415
|
+
const address = source2.getUint32(p, true);
|
|
20416
|
+
const pointed = byOffset.get(address);
|
|
20417
|
+
if (pointed?.opcode !== (p === r.dataOffset + 12 ? 85 : 215) || pointed.depth !== 1 || address < owner.start || address >= owner.end)
|
|
20418
|
+
reject("malformed-records");
|
|
20419
|
+
if (pointers.has(address))
|
|
20420
|
+
reject("malformed-records");
|
|
20421
|
+
pointers.add(address);
|
|
20422
|
+
dest.setUint32(map(p), map(address), true);
|
|
20423
|
+
}
|
|
20424
|
+
}
|
|
20425
|
+
}
|
|
20426
|
+
}
|
|
20427
|
+
return out;
|
|
20428
|
+
}
|
|
20429
|
+
|
|
20430
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-numeric-promotion.js
|
|
20431
|
+
function promote(input, target, col, value) {
|
|
20432
|
+
const source2 = new DataView(input.buffer, input.byteOffset, input.byteLength), p = target.dataOffset;
|
|
20433
|
+
const packed = target.opcode === 189;
|
|
20434
|
+
const first2 = packed ? source2.getUint16(p + 2, true) : col;
|
|
20435
|
+
const count = packed ? (target.length - 6) / 6 : 1, selected = col - first2;
|
|
20436
|
+
const record = (opcode, data2) => {
|
|
20437
|
+
const out = new Uint8Array(data2.length + 4), view2 = new DataView(out.buffer);
|
|
20438
|
+
view2.setUint16(0, opcode, true);
|
|
20439
|
+
view2.setUint16(2, data2.length, true);
|
|
20440
|
+
out.set(data2, 4);
|
|
20441
|
+
return out;
|
|
20442
|
+
};
|
|
20443
|
+
const group = (start, size) => {
|
|
20444
|
+
if (!size)
|
|
20445
|
+
return new Uint8Array();
|
|
20446
|
+
const data2 = new Uint8Array(size === 1 ? 10 : 6 + size * 6), view2 = new DataView(data2.buffer);
|
|
20447
|
+
view2.setUint16(0, source2.getUint16(p, true), true);
|
|
20448
|
+
view2.setUint16(2, first2 + start, true);
|
|
20449
|
+
data2.set(input.subarray(p + 4 + start * 6, p + 4 + (start + size) * 6), 4);
|
|
20450
|
+
if (size > 1)
|
|
20451
|
+
view2.setUint16(data2.length - 2, first2 + start + size - 1, true);
|
|
20452
|
+
return record(size === 1 ? 638 : 189, data2);
|
|
20453
|
+
};
|
|
20454
|
+
const data = new Uint8Array(14), view = new DataView(data.buffer);
|
|
20455
|
+
view.setUint16(0, source2.getUint16(p, true), true);
|
|
20456
|
+
view.setUint16(2, col, true);
|
|
20457
|
+
view.setUint16(4, source2.getUint16(p + (packed ? 4 + selected * 6 : 4), true), true);
|
|
20458
|
+
view.setFloat64(6, value, true);
|
|
20459
|
+
const prefix = packed ? group(0, selected) : new Uint8Array(), number2 = record(515, data);
|
|
20460
|
+
const suffix = packed ? group(selected + 1, count - selected - 1) : new Uint8Array();
|
|
20461
|
+
const bytes = new Uint8Array(prefix.length + number2.length + suffix.length);
|
|
20462
|
+
bytes.set(prefix);
|
|
20463
|
+
bytes.set(number2, prefix.length);
|
|
20464
|
+
bytes.set(suffix, prefix.length + number2.length);
|
|
20465
|
+
return bytes;
|
|
20466
|
+
}
|
|
20467
|
+
function promoteXlsNumericCell(input, edit) {
|
|
20468
|
+
const m = model(input), target = findTarget(input, m, edit, [638, 189]);
|
|
20469
|
+
const source2 = new DataView(input.buffer, input.byteOffset, input.byteLength), range = m.worksheets[edit.worksheetIndex ?? 0];
|
|
20470
|
+
for (const record of m.records.filter((r) => r.opcode === 229 && r.depth === 1 && r.headerOffset >= range.start && r.headerOffset < range.end)) {
|
|
20471
|
+
if (record.length < 2 || record.length !== 2 + source2.getUint16(record.dataOffset, true) * 8)
|
|
20472
|
+
reject("malformed-records");
|
|
20473
|
+
for (let p = record.dataOffset + 2; p < record.dataOffset + record.length; p += 8) {
|
|
20474
|
+
const firstRow = source2.getUint16(p, true), lastRow = source2.getUint16(p + 2, true), firstCol = source2.getUint16(p + 4, true), lastCol = source2.getUint16(p + 6, true);
|
|
20475
|
+
if (firstRow > lastRow || firstCol > lastCol || lastCol > 255)
|
|
20476
|
+
reject("malformed-records");
|
|
20477
|
+
if (edit.row >= firstRow && edit.row <= lastRow && edit.col >= firstCol && edit.col <= lastCol && (edit.row !== firstRow || edit.col !== firstCol))
|
|
20478
|
+
reject("cell-not-supported");
|
|
20479
|
+
}
|
|
20480
|
+
}
|
|
20481
|
+
return applyXlsCellRecordReplacement(input, m, { start: target.headerOffset, end: target.dataOffset + target.length, bytes: promote(input, target, edit.col, edit.value) });
|
|
20482
|
+
}
|
|
20483
|
+
|
|
20484
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-v4.js
|
|
20485
|
+
var END2 = 4294967294;
|
|
20486
|
+
var FREE = 4294967295;
|
|
20487
|
+
var FAT = 4294967293;
|
|
20488
|
+
function follow(table, start) {
|
|
20489
|
+
const ids = [], seen = /* @__PURE__ */ new Set();
|
|
20490
|
+
for (let id = start; id !== END2; id = table[id]) {
|
|
20491
|
+
if (id >= table.length || seen.has(id))
|
|
20492
|
+
throw new Error("Invalid allocation chain");
|
|
20493
|
+
seen.add(id);
|
|
20494
|
+
ids.push(id);
|
|
20495
|
+
}
|
|
20496
|
+
return ids;
|
|
20497
|
+
}
|
|
20498
|
+
function findSlot(slots, path) {
|
|
20499
|
+
let parent = slots.get(0);
|
|
20500
|
+
if (!parent || parent.type !== 5)
|
|
20501
|
+
throw new Error("Invalid root");
|
|
20502
|
+
const parents = /* @__PURE__ */ new Set();
|
|
20503
|
+
for (let part = 0; part < path.length; part++) {
|
|
20504
|
+
if (parents.has(parent.id))
|
|
20505
|
+
throw new Error("Cyclic storage hierarchy");
|
|
20506
|
+
parents.add(parent.id);
|
|
20507
|
+
const stack = [parent.child], seen = /* @__PURE__ */ new Set(), matches = [];
|
|
20508
|
+
while (stack.length) {
|
|
20509
|
+
const id = stack.pop();
|
|
20510
|
+
if (id === FREE)
|
|
20511
|
+
continue;
|
|
20512
|
+
if (seen.has(id))
|
|
20513
|
+
throw new Error("Invalid directory tree");
|
|
20514
|
+
seen.add(id);
|
|
20515
|
+
const slot = slots.get(id);
|
|
20516
|
+
if (!slot)
|
|
20517
|
+
throw new Error("Missing directory slot");
|
|
20518
|
+
if (slot.name.toLocaleLowerCase() === path[part].toLocaleLowerCase())
|
|
20519
|
+
matches.push(slot);
|
|
20520
|
+
stack.push(slot.left, slot.right);
|
|
20521
|
+
}
|
|
20522
|
+
if (matches.length !== 1)
|
|
20523
|
+
throw new Error("Missing or ambiguous stream");
|
|
20524
|
+
parent = matches[0];
|
|
20525
|
+
if (parent.type !== (part === path.length - 1 ? 2 : 1))
|
|
20526
|
+
throw new Error("Invalid storage path");
|
|
20527
|
+
}
|
|
20528
|
+
return parent;
|
|
20529
|
+
}
|
|
20530
|
+
function validateHierarchy(slots) {
|
|
20531
|
+
const owners = /* @__PURE__ */ new Set(), storages = [0];
|
|
20532
|
+
while (storages.length) {
|
|
20533
|
+
const storage = slots.get(storages.pop());
|
|
20534
|
+
const stack = [storage.child], names = /* @__PURE__ */ new Set();
|
|
20535
|
+
while (stack.length) {
|
|
20536
|
+
const id = stack.pop();
|
|
20537
|
+
if (id === FREE)
|
|
20538
|
+
continue;
|
|
20539
|
+
const slot = slots.get(id);
|
|
20540
|
+
if (!slot || slot.type !== 1 && slot.type !== 2 || owners.has(id))
|
|
20541
|
+
throw new Error("Ambiguous directory ownership");
|
|
20542
|
+
const name = slot.name.toLocaleLowerCase();
|
|
20543
|
+
if (names.has(name))
|
|
20544
|
+
throw new Error("Duplicate sibling name");
|
|
20545
|
+
names.add(name);
|
|
20546
|
+
owners.add(id);
|
|
20547
|
+
stack.push(slot.left, slot.right);
|
|
20548
|
+
if (slot.type === 1)
|
|
20549
|
+
storages.push(id);
|
|
20550
|
+
}
|
|
20551
|
+
}
|
|
20552
|
+
if (owners.size !== slots.size - 1)
|
|
20553
|
+
throw new Error("Unreachable directory entries");
|
|
20554
|
+
}
|
|
20555
|
+
function resizeCompoundFileStreamV4(input, path, replacement) {
|
|
20556
|
+
const fail2 = (reason) => ({ ok: false, bytes: input, reason });
|
|
20557
|
+
try {
|
|
20558
|
+
if (input.length < 512 || !path.length || path.some((part) => !part))
|
|
20559
|
+
return fail2("invalid-or-missing-stream");
|
|
20560
|
+
const view = new DataView(input.buffer, input.byteOffset, input.byteLength);
|
|
20561
|
+
const read = (offset) => view.getUint32(offset, true);
|
|
20562
|
+
const version = view.getUint16(26, true);
|
|
20563
|
+
if (version !== 4)
|
|
20564
|
+
return fail2("unsupported-version");
|
|
20565
|
+
const SECTOR3 = 4096, FAT_ENTRIES2 = SECTOR3 / 4, DIRECTORY_ENTRIES = SECTOR3 / 128;
|
|
20566
|
+
if (read(72) !== 0 || read(44) > 109)
|
|
20567
|
+
return fail2("unsupported-difat");
|
|
20568
|
+
const cutoff = read(56);
|
|
20569
|
+
if (cutoff !== 0 && cutoff !== 4096)
|
|
20570
|
+
return fail2("unsupported-layout");
|
|
20571
|
+
const original = readCompoundFileStream(input, path);
|
|
20572
|
+
if (!original)
|
|
20573
|
+
return fail2("invalid-or-missing-stream");
|
|
20574
|
+
const name = path[path.length - 1].toLocaleLowerCase();
|
|
20575
|
+
if (name === "worddocument" && original.length >= 12 && (original[10] | original[11] << 8) & 33024)
|
|
20576
|
+
return fail2("unsafe-edit");
|
|
20577
|
+
if (name === "book" || name === "workbook") {
|
|
20578
|
+
for (let offset = 0; offset + 4 <= original.length; ) {
|
|
20579
|
+
const record = original[offset] | original[offset + 1] << 8;
|
|
20580
|
+
const length = original[offset + 2] | original[offset + 3] << 8;
|
|
20581
|
+
if (record === 47)
|
|
20582
|
+
return fail2("unsafe-edit");
|
|
20583
|
+
if (record === 10 || offset + 4 + length > original.length)
|
|
20584
|
+
break;
|
|
20585
|
+
offset += 4 + length;
|
|
20586
|
+
}
|
|
20587
|
+
}
|
|
20588
|
+
const validated = replaceCompoundFileStream(input, path, original);
|
|
20589
|
+
if (validated === input)
|
|
20590
|
+
return fail2("unsafe-edit");
|
|
20591
|
+
const sameLength = replacement.length === original.length;
|
|
20592
|
+
if (!sameLength && original.length < cutoff)
|
|
20593
|
+
return fail2("unsupported-mini-stream");
|
|
20594
|
+
if (!sameLength && replacement.length < cutoff)
|
|
20595
|
+
return fail2("unsupported-mini-transition");
|
|
20596
|
+
const sectorCount = input.length / SECTOR3 - 1, fatCount = read(44);
|
|
20597
|
+
if (sectorCount > fatCount * FAT_ENTRIES2)
|
|
20598
|
+
return fail2("unsafe-edit");
|
|
20599
|
+
const fatIds = Array.from({ length: fatCount }, (_, i2) => read(76 + 4 * i2));
|
|
20600
|
+
const fat = [];
|
|
20601
|
+
for (const id of fatIds) {
|
|
20602
|
+
for (let i2 = 0; i2 < FAT_ENTRIES2 && fat.length < sectorCount; i2++)
|
|
20603
|
+
fat.push(read((id + 1) * SECTOR3 + i2 * 4));
|
|
20604
|
+
}
|
|
20605
|
+
if (fatIds.some((id) => fat[id] !== FAT))
|
|
20606
|
+
return fail2("unsafe-edit");
|
|
20607
|
+
const slots = /* @__PURE__ */ new Map();
|
|
20608
|
+
const directoryChain = follow(fat, read(48));
|
|
20609
|
+
if (read(40) !== directoryChain.length)
|
|
20610
|
+
return fail2("unsafe-edit");
|
|
20611
|
+
for (const [block, sector] of directoryChain.entries()) {
|
|
20612
|
+
for (let entry = 0; entry < DIRECTORY_ENTRIES; entry++) {
|
|
20613
|
+
const offset = (sector + 1) * SECTOR3 + entry * 128, type = view.getUint8(offset + 66);
|
|
20614
|
+
if (!type)
|
|
20615
|
+
continue;
|
|
20616
|
+
const nameLength = view.getUint16(offset + 64, true);
|
|
20617
|
+
if (![1, 2, 5].includes(type) || nameLength < 2 || nameLength > 64 || nameLength % 2 || view.getUint16(offset + nameLength - 2, true))
|
|
20618
|
+
return fail2("unsafe-edit");
|
|
20619
|
+
let name2 = "";
|
|
20620
|
+
for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
|
|
20621
|
+
name2 += String.fromCharCode(view.getUint16(offset + i2, true));
|
|
20622
|
+
if (read(offset + 124) !== 0)
|
|
20623
|
+
return fail2("unsafe-edit");
|
|
20624
|
+
const id = block * DIRECTORY_ENTRIES + entry;
|
|
20625
|
+
slots.set(id, { id, name: name2, type, left: read(offset + 68), right: read(offset + 72), child: read(offset + 76), start: read(offset + 116), size: read(offset + 120), offset });
|
|
20626
|
+
}
|
|
20627
|
+
}
|
|
20628
|
+
if ([...slots.values()].filter((slot) => slot.type === 5).length !== 1)
|
|
20629
|
+
return fail2("unsafe-edit");
|
|
20630
|
+
const target = findSlot(slots, path);
|
|
20631
|
+
validateHierarchy(slots);
|
|
20632
|
+
if (sameLength) {
|
|
20633
|
+
const bytes = replaceCompoundFileStream(input, path, replacement);
|
|
20634
|
+
return bytes === input ? fail2("unsafe-edit") : { ok: true, bytes };
|
|
20635
|
+
}
|
|
20636
|
+
const oldChain = follow(fat, target.start);
|
|
20637
|
+
if (target.size !== original.length || oldChain.length !== Math.ceil(target.size / SECTOR3))
|
|
20638
|
+
return fail2("unsafe-edit");
|
|
20639
|
+
const payloadSectors = Math.ceil(replacement.length / SECTOR3);
|
|
20640
|
+
let newFatCount = fatCount;
|
|
20641
|
+
while (sectorCount + payloadSectors + newFatCount - fatCount > newFatCount * FAT_ENTRIES2)
|
|
20642
|
+
newFatCount++;
|
|
20643
|
+
if (newFatCount > 109)
|
|
20644
|
+
return fail2("allocation-limit");
|
|
20645
|
+
const totalSectors = sectorCount + payloadSectors + newFatCount - fatCount;
|
|
20646
|
+
const output = new Uint8Array((totalSectors + 1) * SECTOR3);
|
|
20647
|
+
output.set(input);
|
|
20648
|
+
output.set(replacement, (sectorCount + 1) * SECTOR3);
|
|
20649
|
+
const outView = new DataView(output.buffer);
|
|
20650
|
+
for (let i2 = fatCount; i2 < newFatCount; i2++) {
|
|
20651
|
+
const id = sectorCount + payloadSectors + i2 - fatCount;
|
|
20652
|
+
fatIds.push(id);
|
|
20653
|
+
output.fill(255, (id + 1) * SECTOR3, (id + 2) * SECTOR3);
|
|
20654
|
+
outView.setUint32(76 + i2 * 4, id, true);
|
|
20655
|
+
}
|
|
20656
|
+
outView.setUint32(44, newFatCount, true);
|
|
20657
|
+
const writeFat = (id, value) => outView.setUint32((fatIds[Math.floor(id / FAT_ENTRIES2)] + 1) * SECTOR3 + id % FAT_ENTRIES2 * 4, value, true);
|
|
20658
|
+
for (const id of oldChain)
|
|
20659
|
+
writeFat(id, FREE);
|
|
20660
|
+
for (let i2 = 0; i2 < payloadSectors; i2++)
|
|
20661
|
+
writeFat(sectorCount + i2, i2 + 1 === payloadSectors ? END2 : sectorCount + i2 + 1);
|
|
20662
|
+
for (const id of fatIds)
|
|
20663
|
+
writeFat(id, FAT);
|
|
20664
|
+
outView.setUint32(target.offset + 116, payloadSectors ? sectorCount : END2, true);
|
|
20665
|
+
outView.setUint32(target.offset + 120, replacement.length, true);
|
|
20666
|
+
return { ok: true, bytes: output };
|
|
20667
|
+
} catch {
|
|
20668
|
+
return fail2("unsafe-edit");
|
|
20669
|
+
}
|
|
20670
|
+
}
|
|
20671
|
+
|
|
20672
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-allocation.js
|
|
20673
|
+
function appendCompoundAllocations(input, existingFatIds, payloads, sectorSize = 512) {
|
|
20674
|
+
const sectorCount = input.length / sectorSize - 1;
|
|
20675
|
+
const entriesPerFat = sectorSize / 4;
|
|
20676
|
+
const counts = payloads.map((payload) => Math.ceil(payload.length / sectorSize));
|
|
20677
|
+
const payloadSectors = counts.reduce((sum, count) => sum + count, 0);
|
|
20678
|
+
let fatCount = existingFatIds.length;
|
|
20679
|
+
while (sectorCount + payloadSectors + fatCount - existingFatIds.length > fatCount * entriesPerFat)
|
|
20680
|
+
fatCount++;
|
|
20681
|
+
if (fatCount > 109)
|
|
20682
|
+
return void 0;
|
|
20683
|
+
const totalSectors = sectorCount + payloadSectors + fatCount - existingFatIds.length;
|
|
20684
|
+
const bytes = new Uint8Array((totalSectors + 1) * sectorSize);
|
|
20685
|
+
bytes.set(input);
|
|
20686
|
+
const view = new DataView(bytes.buffer), fatIds = [...existingFatIds];
|
|
20687
|
+
for (let i2 = existingFatIds.length; i2 < fatCount; i2++) {
|
|
20688
|
+
const id = sectorCount + payloadSectors + i2 - existingFatIds.length;
|
|
20689
|
+
fatIds.push(id);
|
|
20690
|
+
bytes.fill(255, (id + 1) * sectorSize, (id + 2) * sectorSize);
|
|
20691
|
+
view.setUint32(76 + i2 * 4, id, true);
|
|
20692
|
+
}
|
|
20693
|
+
view.setUint32(44, fatCount, true);
|
|
20694
|
+
const writeFat = (id, value) => view.setUint32((fatIds[Math.floor(id / entriesPerFat)] + 1) * sectorSize + id % entriesPerFat * 4, value, true);
|
|
20695
|
+
const chains = [];
|
|
20696
|
+
let next = sectorCount;
|
|
20697
|
+
for (let payload = 0; payload < payloads.length; payload++) {
|
|
20698
|
+
bytes.set(payloads[payload], (next + 1) * sectorSize);
|
|
20699
|
+
const chain2 = Array.from({ length: counts[payload] }, (_, i2) => next + i2);
|
|
20700
|
+
chain2.forEach((id, i2) => writeFat(id, chain2[i2 + 1] ?? 4294967294));
|
|
20701
|
+
chains.push(chain2);
|
|
20702
|
+
next += counts[payload];
|
|
20703
|
+
}
|
|
20704
|
+
for (const id of fatIds)
|
|
20705
|
+
writeFat(id, 4294967293);
|
|
20706
|
+
return { bytes, view, chains, writeFat };
|
|
20707
|
+
}
|
|
20708
|
+
function followCompoundAllocation(table, start) {
|
|
20709
|
+
const ids = [], seen = /* @__PURE__ */ new Set();
|
|
20710
|
+
for (let id = start; id !== 4294967294; id = table[id]) {
|
|
20711
|
+
if (id >= table.length || seen.has(id))
|
|
20712
|
+
throw new Error("Invalid allocation chain");
|
|
20713
|
+
seen.add(id);
|
|
20714
|
+
ids.push(id);
|
|
20715
|
+
}
|
|
20716
|
+
return ids;
|
|
20717
|
+
}
|
|
20718
|
+
|
|
20719
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-mini.js
|
|
20720
|
+
var END3 = 4294967294;
|
|
20721
|
+
var FREE2 = 4294967295;
|
|
20722
|
+
var SECTOR = 512;
|
|
20723
|
+
var MINI = 64;
|
|
20724
|
+
function resizeMiniCompoundStream(input, fat, fatIds, root, target, replacement, cutoff) {
|
|
20725
|
+
const inputView = new DataView(input.buffer, input.byteOffset, input.byteLength);
|
|
20726
|
+
const miniFatCount = inputView.getUint32(64, true);
|
|
20727
|
+
const miniFatSectors = miniFatCount ? followCompoundAllocation(fat, inputView.getUint32(60, true)) : [];
|
|
20728
|
+
if (miniFatSectors.length !== miniFatCount)
|
|
20729
|
+
throw new Error("Invalid mini FAT count");
|
|
20730
|
+
const rootSectors = root.size ? followCompoundAllocation(fat, root.start) : [];
|
|
20731
|
+
if (rootSectors.length !== Math.ceil(root.size / SECTOR))
|
|
20732
|
+
throw new Error("Invalid root mini stream");
|
|
20733
|
+
const miniCapacity = Math.floor(root.size / MINI), miniFat = [];
|
|
20734
|
+
for (const id of miniFatSectors) {
|
|
20735
|
+
for (let slot = 0; slot < SECTOR / 4 && miniFat.length < miniCapacity; slot++)
|
|
20736
|
+
miniFat.push(inputView.getUint32((id + 1) * SECTOR + slot * 4, true));
|
|
20737
|
+
}
|
|
20738
|
+
const wasMini = target.size < cutoff;
|
|
20739
|
+
const oldChain = followCompoundAllocation(wasMini ? miniFat : fat, target.start);
|
|
20740
|
+
if (oldChain.length !== Math.ceil(target.size / (wasMini ? MINI : SECTOR)))
|
|
20741
|
+
throw new Error("Invalid stream allocation");
|
|
20742
|
+
if (!replacement.length) {
|
|
20743
|
+
const bytes = input.slice(), view = new DataView(bytes.buffer);
|
|
20744
|
+
for (const id of oldChain) {
|
|
20745
|
+
const table = wasMini ? miniFatSectors : fatIds;
|
|
20746
|
+
view.setUint32((table[Math.floor(id / 128)] + 1) * SECTOR + id % 128 * 4, FREE2, true);
|
|
20747
|
+
}
|
|
20748
|
+
view.setUint32(target.offset + 116, END3, true);
|
|
20749
|
+
view.setUint32(target.offset + 120, 0, true);
|
|
20750
|
+
return bytes;
|
|
20751
|
+
}
|
|
20752
|
+
if (replacement.length >= cutoff) {
|
|
20753
|
+
const output2 = appendCompoundAllocations(input, fatIds, [replacement]);
|
|
20754
|
+
if (!output2)
|
|
20755
|
+
return void 0;
|
|
20756
|
+
for (const id of oldChain)
|
|
20757
|
+
output2.view.setUint32((miniFatSectors[Math.floor(id / 128)] + 1) * SECTOR + id % 128 * 4, FREE2, true);
|
|
20758
|
+
output2.view.setUint32(target.offset + 116, output2.chains[0][0] ?? END3, true);
|
|
20759
|
+
output2.view.setUint32(target.offset + 120, replacement.length, true);
|
|
20760
|
+
return output2.bytes;
|
|
20761
|
+
}
|
|
20762
|
+
const firstMini = Math.ceil(root.size / MINI), count = Math.ceil(replacement.length / MINI);
|
|
20763
|
+
const newRootSize = count ? (firstMini + count) * MINI : root.size;
|
|
20764
|
+
const newRoot = new Uint8Array(newRootSize);
|
|
20765
|
+
rootSectors.forEach((id, i2) => newRoot.set(input.subarray((id + 1) * SECTOR, (id + 1) * SECTOR + Math.min(SECTOR, root.size - i2 * SECTOR)), i2 * SECTOR));
|
|
20766
|
+
if (count)
|
|
20767
|
+
newRoot.set(replacement, firstMini * MINI);
|
|
20768
|
+
const newMiniFatCount = Math.max(miniFatCount, Math.ceil((firstMini + count) / 128));
|
|
20769
|
+
const newMiniFat = new Uint8Array(newMiniFatCount * SECTOR).fill(255);
|
|
20770
|
+
miniFatSectors.forEach((id, i2) => newMiniFat.set(input.subarray((id + 1) * SECTOR, (id + 2) * SECTOR), i2 * SECTOR));
|
|
20771
|
+
const miniView = new DataView(newMiniFat.buffer);
|
|
20772
|
+
if (wasMini)
|
|
20773
|
+
for (const id of oldChain)
|
|
20774
|
+
miniView.setUint32(id * 4, FREE2, true);
|
|
20775
|
+
for (let i2 = 0; i2 < count; i2++)
|
|
20776
|
+
miniView.setUint32((firstMini + i2) * 4, i2 + 1 === count ? END3 : firstMini + i2 + 1, true);
|
|
20777
|
+
const output = appendCompoundAllocations(input, fatIds, [newRoot, newMiniFat]);
|
|
20778
|
+
if (!output)
|
|
20779
|
+
return void 0;
|
|
20780
|
+
for (const id of [...rootSectors, ...miniFatSectors, ...wasMini ? [] : oldChain])
|
|
20781
|
+
output.writeFat(id, FREE2);
|
|
20782
|
+
output.view.setUint32(root.offset + 116, output.chains[0][0] ?? END3, true);
|
|
20783
|
+
output.view.setUint32(root.offset + 120, newRootSize, true);
|
|
20784
|
+
output.view.setUint32(60, output.chains[1][0] ?? END3, true);
|
|
20785
|
+
output.view.setUint32(64, newMiniFatCount, true);
|
|
20786
|
+
output.view.setUint32(target.offset + 116, count ? firstMini : END3, true);
|
|
20787
|
+
output.view.setUint32(target.offset + 120, replacement.length, true);
|
|
20788
|
+
return output.bytes;
|
|
20789
|
+
}
|
|
20790
|
+
|
|
20791
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize.js
|
|
20792
|
+
var END4 = 4294967294;
|
|
20793
|
+
var FREE3 = 4294967295;
|
|
20794
|
+
var FAT2 = 4294967293;
|
|
20795
|
+
var SECTOR2 = 512;
|
|
20796
|
+
var FAT_ENTRIES = SECTOR2 / 4;
|
|
20797
|
+
function follow2(table, start) {
|
|
20798
|
+
const ids = [], seen = /* @__PURE__ */ new Set();
|
|
20799
|
+
for (let id = start; id !== END4; id = table[id]) {
|
|
20800
|
+
if (id >= table.length || seen.has(id))
|
|
20801
|
+
throw new Error("Invalid allocation chain");
|
|
20802
|
+
seen.add(id);
|
|
20803
|
+
ids.push(id);
|
|
20804
|
+
}
|
|
20805
|
+
return ids;
|
|
20806
|
+
}
|
|
20807
|
+
function findSlot2(slots, path) {
|
|
20808
|
+
let parent = slots.get(0);
|
|
20809
|
+
if (!parent || parent.type !== 5)
|
|
20810
|
+
throw new Error("Invalid root");
|
|
20811
|
+
const parents = /* @__PURE__ */ new Set();
|
|
20812
|
+
for (let part = 0; part < path.length; part++) {
|
|
20813
|
+
if (parents.has(parent.id))
|
|
20814
|
+
throw new Error("Cyclic storage hierarchy");
|
|
20815
|
+
parents.add(parent.id);
|
|
20816
|
+
const stack = [parent.child], seen = /* @__PURE__ */ new Set(), matches = [];
|
|
20817
|
+
while (stack.length) {
|
|
20818
|
+
const id = stack.pop();
|
|
20819
|
+
if (id === FREE3)
|
|
20820
|
+
continue;
|
|
20821
|
+
if (seen.has(id))
|
|
20822
|
+
throw new Error("Invalid directory tree");
|
|
20823
|
+
seen.add(id);
|
|
20824
|
+
const slot = slots.get(id);
|
|
20825
|
+
if (!slot)
|
|
20826
|
+
throw new Error("Missing directory slot");
|
|
20827
|
+
if (slot.name.toLocaleLowerCase() === path[part].toLocaleLowerCase())
|
|
20828
|
+
matches.push(slot);
|
|
20829
|
+
stack.push(slot.left, slot.right);
|
|
20830
|
+
}
|
|
20831
|
+
if (matches.length !== 1)
|
|
20832
|
+
throw new Error("Missing or ambiguous stream");
|
|
20833
|
+
parent = matches[0];
|
|
20834
|
+
if (parent.type !== (part === path.length - 1 ? 2 : 1))
|
|
20835
|
+
throw new Error("Invalid storage path");
|
|
20836
|
+
}
|
|
20837
|
+
return parent;
|
|
20838
|
+
}
|
|
20839
|
+
function validateHierarchy2(slots) {
|
|
20840
|
+
const owners = /* @__PURE__ */ new Set(), storages = [0];
|
|
20841
|
+
while (storages.length) {
|
|
20842
|
+
const storage = slots.get(storages.pop());
|
|
20843
|
+
const stack = [storage.child], names = /* @__PURE__ */ new Set();
|
|
20844
|
+
while (stack.length) {
|
|
20845
|
+
const id = stack.pop();
|
|
20846
|
+
if (id === FREE3)
|
|
20847
|
+
continue;
|
|
20848
|
+
const slot = slots.get(id);
|
|
20849
|
+
if (!slot || slot.type !== 1 && slot.type !== 2 || owners.has(id))
|
|
20850
|
+
throw new Error("Ambiguous directory ownership");
|
|
20851
|
+
const name = slot.name.toLocaleLowerCase();
|
|
20852
|
+
if (names.has(name))
|
|
20853
|
+
throw new Error("Duplicate sibling name");
|
|
20854
|
+
names.add(name);
|
|
20855
|
+
owners.add(id);
|
|
20856
|
+
stack.push(slot.left, slot.right);
|
|
20857
|
+
if (slot.type === 1)
|
|
20858
|
+
storages.push(id);
|
|
20859
|
+
}
|
|
20860
|
+
}
|
|
20861
|
+
if (owners.size !== slots.size - 1)
|
|
20862
|
+
throw new Error("Unreachable directory entries");
|
|
20863
|
+
}
|
|
20864
|
+
function resizeCompoundFileStream(input, path, replacement) {
|
|
20865
|
+
if (input.length >= 512 && new DataView(input.buffer, input.byteOffset, input.byteLength).getUint16(26, true) === 4)
|
|
20866
|
+
return resizeCompoundFileStreamV4(input, path, replacement);
|
|
20867
|
+
const fail2 = (reason) => ({ ok: false, bytes: input, reason });
|
|
20868
|
+
try {
|
|
20869
|
+
if (input.length < SECTOR2 || !path.length || path.some((part) => !part))
|
|
20870
|
+
return fail2("invalid-or-missing-stream");
|
|
20871
|
+
const view = new DataView(input.buffer, input.byteOffset, input.byteLength);
|
|
20872
|
+
const read = (offset) => view.getUint32(offset, true);
|
|
20873
|
+
if (view.getUint16(26, true) !== 3)
|
|
20874
|
+
return fail2("unsupported-version");
|
|
20875
|
+
if (read(72) !== 0 || read(44) > 109)
|
|
20876
|
+
return fail2("unsupported-difat");
|
|
20877
|
+
const cutoff = read(56);
|
|
20878
|
+
if (cutoff !== 0 && cutoff !== 4096)
|
|
20879
|
+
return fail2("unsupported-layout");
|
|
20880
|
+
const original = readCompoundFileStream(input, path);
|
|
20881
|
+
if (!original)
|
|
20882
|
+
return fail2("invalid-or-missing-stream");
|
|
20883
|
+
const name = path[path.length - 1].toLocaleLowerCase();
|
|
20884
|
+
if (name === "worddocument" && original.length >= 12 && (original[10] | original[11] << 8) & 33024)
|
|
20885
|
+
return fail2("unsafe-edit");
|
|
20886
|
+
if (name === "book" || name === "workbook") {
|
|
20887
|
+
for (let offset = 0; offset + 4 <= original.length; ) {
|
|
20888
|
+
const record = original[offset] | original[offset + 1] << 8;
|
|
20889
|
+
const length = original[offset + 2] | original[offset + 3] << 8;
|
|
20890
|
+
if (record === 47)
|
|
20891
|
+
return fail2("unsafe-edit");
|
|
20892
|
+
if (record === 10 || offset + 4 + length > original.length)
|
|
20893
|
+
break;
|
|
20894
|
+
offset += 4 + length;
|
|
20895
|
+
}
|
|
20896
|
+
}
|
|
20897
|
+
const validated = replaceCompoundFileStream(input, path, original);
|
|
20898
|
+
if (validated === input)
|
|
20899
|
+
return fail2("unsafe-edit");
|
|
20900
|
+
const sameLength = replacement.length === original.length;
|
|
20901
|
+
const sectorCount = input.length / SECTOR2 - 1, fatCount = read(44);
|
|
20902
|
+
if (sectorCount > fatCount * FAT_ENTRIES)
|
|
20903
|
+
return fail2("unsafe-edit");
|
|
20904
|
+
const fatIds = Array.from({ length: fatCount }, (_, i2) => read(76 + 4 * i2));
|
|
20905
|
+
const fat = [];
|
|
20906
|
+
for (const id of fatIds) {
|
|
20907
|
+
for (let i2 = 0; i2 < FAT_ENTRIES && fat.length < sectorCount; i2++)
|
|
20908
|
+
fat.push(read((id + 1) * SECTOR2 + i2 * 4));
|
|
20909
|
+
}
|
|
20910
|
+
if (fatIds.some((id) => fat[id] !== FAT2))
|
|
20911
|
+
return fail2("unsafe-edit");
|
|
20912
|
+
const slots = /* @__PURE__ */ new Map();
|
|
20913
|
+
for (const [block, sector] of follow2(fat, read(48)).entries()) {
|
|
20914
|
+
for (let entry = 0; entry < 4; entry++) {
|
|
20915
|
+
const offset = (sector + 1) * SECTOR2 + entry * 128, type = view.getUint8(offset + 66);
|
|
20916
|
+
if (!type)
|
|
20917
|
+
continue;
|
|
20918
|
+
const nameLength = view.getUint16(offset + 64, true);
|
|
20919
|
+
if (![1, 2, 5].includes(type) || nameLength < 2 || nameLength > 64 || nameLength % 2 || view.getUint16(offset + nameLength - 2, true))
|
|
20920
|
+
return fail2("unsafe-edit");
|
|
20921
|
+
let name2 = "";
|
|
20922
|
+
for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
|
|
20923
|
+
name2 += String.fromCharCode(view.getUint16(offset + i2, true));
|
|
20924
|
+
const id = block * 4 + entry;
|
|
20925
|
+
slots.set(id, { id, name: name2, type, left: read(offset + 68), right: read(offset + 72), child: read(offset + 76), start: read(offset + 116), size: read(offset + 120), offset });
|
|
20926
|
+
}
|
|
20927
|
+
}
|
|
20928
|
+
if ([...slots.values()].filter((slot) => slot.type === 5).length !== 1)
|
|
20929
|
+
return fail2("unsafe-edit");
|
|
20930
|
+
const target = findSlot2(slots, path);
|
|
20931
|
+
validateHierarchy2(slots);
|
|
20932
|
+
if (sameLength) {
|
|
20933
|
+
const bytes = replaceCompoundFileStream(input, path, replacement);
|
|
20934
|
+
return bytes === input ? fail2("unsafe-edit") : { ok: true, bytes };
|
|
20935
|
+
}
|
|
20936
|
+
if (original.length < cutoff || replacement.length < cutoff) {
|
|
20937
|
+
const bytes = resizeMiniCompoundStream(input, fat, fatIds, slots.get(0), target, replacement, cutoff);
|
|
20938
|
+
return bytes ? { ok: true, bytes } : fail2("allocation-limit");
|
|
20939
|
+
}
|
|
20940
|
+
const oldChain = follow2(fat, target.start);
|
|
20941
|
+
if (target.size !== original.length || oldChain.length !== Math.ceil(target.size / SECTOR2))
|
|
20942
|
+
return fail2("unsafe-edit");
|
|
20943
|
+
const output = appendCompoundAllocations(input, fatIds, [replacement]);
|
|
20944
|
+
if (!output)
|
|
20945
|
+
return fail2("allocation-limit");
|
|
20946
|
+
for (const id of oldChain)
|
|
20947
|
+
output.writeFat(id, FREE3);
|
|
20948
|
+
output.view.setUint32(target.offset + 116, output.chains[0][0] ?? END4, true);
|
|
20949
|
+
output.view.setUint32(target.offset + 120, replacement.length, true);
|
|
20950
|
+
return { ok: true, bytes: output.bytes };
|
|
20951
|
+
} catch {
|
|
20952
|
+
return fail2("unsafe-edit");
|
|
20953
|
+
}
|
|
20954
|
+
}
|
|
20955
|
+
|
|
20956
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-edit.js
|
|
19844
20957
|
function encodeRkExact(value) {
|
|
19845
20958
|
if (!Number.isFinite(value))
|
|
19846
20959
|
return void 0;
|
|
@@ -19917,6 +21030,7 @@ function worksheetRanges(bytes) {
|
|
|
19917
21030
|
}
|
|
19918
21031
|
function editXlsNumericCell(input, edit) {
|
|
19919
21032
|
const unchanged = (reason) => ({ status: "unchanged", bytes: input, reason });
|
|
21033
|
+
edit = { row: edit.row, col: edit.col, value: edit.value, worksheetIndex: edit.worksheetIndex };
|
|
19920
21034
|
const sheet = edit.worksheetIndex ?? 0;
|
|
19921
21035
|
if (!Number.isInteger(edit.row) || edit.row < 0 || edit.row > 65535 || !Number.isInteger(edit.col) || edit.col < 0 || edit.col > 255 || !Number.isInteger(sheet) || sheet < 0 || !Number.isFinite(edit.value))
|
|
19922
21036
|
return unchanged("invalid-edit");
|
|
@@ -19988,8 +21102,18 @@ function editXlsNumericCell(input, edit) {
|
|
|
19988
21102
|
if (payload === void 0)
|
|
19989
21103
|
return unchanged("cell-not-supported");
|
|
19990
21104
|
const rk = packed ? encodeRkExact(edit.value) : void 0;
|
|
19991
|
-
if (packed && rk === void 0)
|
|
19992
|
-
|
|
21105
|
+
if (packed && rk === void 0) {
|
|
21106
|
+
if (!readRecords(bytes, 0, bytes.length).some((r) => r.opcode === 133))
|
|
21107
|
+
return unchanged("inexact-rk");
|
|
21108
|
+
const promoted = promoteXlsNumericCell(bytes, edit);
|
|
21109
|
+
if (!rewrap)
|
|
21110
|
+
return { status: "edited", bytes: promoted, recalculationRequired: true };
|
|
21111
|
+
const names = ["Workbook", "Book"].filter((name) => readCompoundFileStream(input, [name]) !== void 0);
|
|
21112
|
+
if (names.length !== 1)
|
|
21113
|
+
return unchanged("unsupported-workbook");
|
|
21114
|
+
const resized = resizeCompoundFileStream(input, [names[0]], promoted);
|
|
21115
|
+
return resized.ok ? { status: "edited", bytes: resized.bytes, recalculationRequired: true } : unchanged("container-not-writable");
|
|
21116
|
+
}
|
|
19993
21117
|
const out = bytes.slice();
|
|
19994
21118
|
const outView = new DataView(out.buffer, out.byteOffset, out.byteLength);
|
|
19995
21119
|
if (packed)
|
|
@@ -20000,12 +21124,12 @@ function editXlsNumericCell(input, edit) {
|
|
|
20000
21124
|
if (result === input)
|
|
20001
21125
|
return unchanged("container-not-writable");
|
|
20002
21126
|
return { status: "edited", bytes: result, recalculationRequired: true };
|
|
20003
|
-
} catch {
|
|
20004
|
-
return unchanged("malformed-records");
|
|
21127
|
+
} catch (error) {
|
|
21128
|
+
return unchanged(error instanceof EditError ? error.reason : "malformed-records");
|
|
20005
21129
|
}
|
|
20006
21130
|
}
|
|
20007
21131
|
|
|
20008
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
21132
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8.js
|
|
20009
21133
|
var OPCODE_BOF = 2057;
|
|
20010
21134
|
var OPCODE_EOF = 10;
|
|
20011
21135
|
var OPCODE_FILEPASS = 47;
|
|
@@ -20192,7 +21316,7 @@ function writeOleXlsNumericCellEdit(inputBytes, edit) {
|
|
|
20192
21316
|
return editXlsNumericCell(inputBytes, edit).bytes;
|
|
20193
21317
|
}
|
|
20194
21318
|
|
|
20195
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
21319
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-grid.js
|
|
20196
21320
|
function biffRecord(opcode, data) {
|
|
20197
21321
|
return [
|
|
20198
21322
|
opcode & 255,
|
|
@@ -20317,7 +21441,7 @@ function buildXlsRowCellRegion(grid) {
|
|
|
20317
21441
|
return Uint8Array.from(bytesOut);
|
|
20318
21442
|
}
|
|
20319
21443
|
|
|
20320
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
21444
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-writer.js
|
|
20321
21445
|
function resolveSstIndex(sharedStrings, value, bytes) {
|
|
20322
21446
|
const existing = sharedStrings.indexOf(value);
|
|
20323
21447
|
if (existing !== -1)
|
|
@@ -20466,674 +21590,202 @@ function writeOleXlsStringCellEdit(inputBytes, edit) {
|
|
|
20466
21590
|
if (dimensions.length !== 14)
|
|
20467
21591
|
return inputBytes;
|
|
20468
21592
|
const view = new DataView(result.buffer);
|
|
20469
|
-
const rows = [...grid.keys()];
|
|
20470
|
-
const cols = [...grid.values()].flatMap((row2) => [...row2.cells.keys()]);
|
|
20471
|
-
view.setUint32(dimensions.dataOffset, Math.min(...rows), true);
|
|
20472
|
-
view.setUint32(dimensions.dataOffset + 4, Math.max(...rows) + 1, true);
|
|
20473
|
-
view.setUint16(dimensions.dataOffset + 8, Math.min(...cols), true);
|
|
20474
|
-
view.setUint16(dimensions.dataOffset + 10, Math.max(...cols) + 1, true);
|
|
20475
|
-
}
|
|
20476
|
-
return finish2(result);
|
|
20477
|
-
} catch {
|
|
20478
|
-
return inputBytes;
|
|
20479
|
-
}
|
|
20480
|
-
}
|
|
20481
|
-
var DOCUMENT_PART_PATH = "word/document.xml";
|
|
20482
|
-
function createWordXmlParser() {
|
|
20483
|
-
return new XMLParser({
|
|
20484
|
-
ignoreAttributes: false,
|
|
20485
|
-
attributeNamePrefix: "@_",
|
|
20486
|
-
trimValues: false,
|
|
20487
|
-
// See the matching comment in `ole-sheet-xlsx-editor.ts`: `xmlText`
|
|
20488
|
-
// only accepts string leaves.
|
|
20489
|
-
parseTagValue: false,
|
|
20490
|
-
parseAttributeValue: false
|
|
20491
|
-
});
|
|
20492
|
-
}
|
|
20493
|
-
function createWordXmlBuilder() {
|
|
20494
|
-
return new XMLBuilder({
|
|
20495
|
-
ignoreAttributes: false,
|
|
20496
|
-
attributeNamePrefix: "@_",
|
|
20497
|
-
suppressBooleanAttributes: false,
|
|
20498
|
-
format: false
|
|
20499
|
-
});
|
|
20500
|
-
}
|
|
20501
|
-
function paragraphText(paragraph) {
|
|
20502
|
-
return xmlChildren(paragraph, "w:r").map((run) => xmlText(xmlChild(run, "w:t") ?? run["w:t"]) ?? "").join("");
|
|
20503
|
-
}
|
|
20504
|
-
async function readOleDocumentParagraphs(docxBytes) {
|
|
20505
|
-
try {
|
|
20506
|
-
const zip = await openNestedZip(docxBytes);
|
|
20507
|
-
const documentFile = zip.file(DOCUMENT_PART_PATH);
|
|
20508
|
-
if (!documentFile) {
|
|
20509
|
-
return void 0;
|
|
20510
|
-
}
|
|
20511
|
-
const parser = createWordXmlParser();
|
|
20512
|
-
const tree = parser.parse(await documentFile.async("string"));
|
|
20513
|
-
const body = xmlChild(xmlChild(tree, "w:document"), "w:body");
|
|
20514
|
-
if (!body) {
|
|
20515
|
-
return [];
|
|
20516
|
-
}
|
|
20517
|
-
return xmlChildren(body, "w:p").map(paragraphText);
|
|
20518
|
-
} catch {
|
|
20519
|
-
return void 0;
|
|
20520
|
-
}
|
|
20521
|
-
}
|
|
20522
|
-
async function writeOleDocumentParagraphEdit(docxBytes, paragraphIndex, text) {
|
|
20523
|
-
try {
|
|
20524
|
-
const zip = await openNestedZip(docxBytes);
|
|
20525
|
-
const documentFile = zip.file(DOCUMENT_PART_PATH);
|
|
20526
|
-
if (!documentFile) {
|
|
20527
|
-
return docxBytes;
|
|
20528
|
-
}
|
|
20529
|
-
const parser = createWordXmlParser();
|
|
20530
|
-
const builder3 = createWordXmlBuilder();
|
|
20531
|
-
const tree = parser.parse(await documentFile.async("string"));
|
|
20532
|
-
const body = xmlChild(xmlChild(tree, "w:document"), "w:body");
|
|
20533
|
-
if (!body) {
|
|
20534
|
-
return docxBytes;
|
|
20535
|
-
}
|
|
20536
|
-
const paragraphs = ensureXmlChildren(body, "w:p");
|
|
20537
|
-
const paragraph = paragraphs[paragraphIndex];
|
|
20538
|
-
if (!paragraph) {
|
|
20539
|
-
return docxBytes;
|
|
20540
|
-
}
|
|
20541
|
-
const firstRunRPr = xmlChildren(paragraph, "w:r").map((run) => xmlChild(run, "w:rPr")).find((rPr) => rPr !== void 0);
|
|
20542
|
-
const newRun = {
|
|
20543
|
-
...firstRunRPr ? { "w:rPr": firstRunRPr } : {},
|
|
20544
|
-
"w:t": { "@_xml:space": "preserve", "#text": text }
|
|
20545
|
-
};
|
|
20546
|
-
const pPr = xmlChild(paragraph, "w:pPr");
|
|
20547
|
-
for (const key of Object.keys(paragraph)) {
|
|
20548
|
-
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
20549
|
-
continue;
|
|
20550
|
-
}
|
|
20551
|
-
Reflect.deleteProperty(paragraph, key);
|
|
20552
|
-
}
|
|
20553
|
-
if (pPr) {
|
|
20554
|
-
paragraph["w:pPr"] = pPr;
|
|
20555
|
-
}
|
|
20556
|
-
paragraph["w:r"] = newRun;
|
|
20557
|
-
zip.file(DOCUMENT_PART_PATH, builder3.build(tree));
|
|
20558
|
-
return await zip.generateAsync({
|
|
20559
|
-
type: "uint8array",
|
|
20560
|
-
compression: "DEFLATE",
|
|
20561
|
-
compressionOptions: { level: 6 }
|
|
20562
|
-
});
|
|
20563
|
-
} catch {
|
|
20564
|
-
return docxBytes;
|
|
20565
|
-
}
|
|
20566
|
-
}
|
|
20567
|
-
|
|
20568
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fib.js
|
|
20569
|
-
var FC_LCB_INDEX = {
|
|
20570
|
-
plcfbteChpx: 12,
|
|
20571
|
-
plcfbtePapx: 13,
|
|
20572
|
-
sed: 6,
|
|
20573
|
-
clx: 33
|
|
20574
|
-
};
|
|
20575
|
-
var F_COMPLEX_BIT = 1 << 2;
|
|
20576
|
-
function readDocFib(wordDoc) {
|
|
20577
|
-
const view = new DataView(wordDoc.buffer, wordDoc.byteOffset, wordDoc.byteLength);
|
|
20578
|
-
const wIdent = view.getUint16(0, true);
|
|
20579
|
-
if (wIdent !== 42476) {
|
|
20580
|
-
throw new Error("Not a WordDocument FIB (bad wIdent)");
|
|
20581
|
-
}
|
|
20582
|
-
const nFibBase = view.getUint16(2, true);
|
|
20583
|
-
if (![193, 217, 257, 268, 274].includes(nFibBase))
|
|
20584
|
-
throw new Error("Unsupported Word FIB version");
|
|
20585
|
-
const flags1Offset = 10;
|
|
20586
|
-
const flags1 = view.getUint16(flags1Offset, true);
|
|
20587
|
-
if ((flags1 & 33024) !== 0)
|
|
20588
|
-
throw new Error("Encrypted or obfuscated Word document");
|
|
20589
|
-
const fWhichTblStm = flags1 >> 9 & 1;
|
|
20590
|
-
const csw = view.getUint16(32, true);
|
|
20591
|
-
const fibRgW97Offset = 34;
|
|
20592
|
-
const cslwOffset = fibRgW97Offset + csw * 2;
|
|
20593
|
-
const cslw = view.getUint16(cslwOffset, true);
|
|
20594
|
-
const fibRgLw97Offset = cslwOffset + 2;
|
|
20595
|
-
const cbRgFcLcbCountOffset = fibRgLw97Offset + cslw * 4;
|
|
20596
|
-
const fibRgFcLcbOffset = cbRgFcLcbCountOffset + 2;
|
|
20597
|
-
const fibRgFcLcbCount = view.getUint16(cbRgFcLcbCountOffset, true);
|
|
20598
|
-
if (csw !== 14 || cslw !== 22 || fibRgFcLcbOffset + fibRgFcLcbCount * 8 + 2 > wordDoc.length)
|
|
20599
|
-
throw new Error("Truncated Word FIB arrays");
|
|
20600
|
-
const cswNewOffset = fibRgFcLcbOffset + fibRgFcLcbCount * 8;
|
|
20601
|
-
const cswNew = view.getUint16(cswNewOffset, true);
|
|
20602
|
-
if (cswNewOffset + 2 + cswNew * 2 > wordDoc.length)
|
|
20603
|
-
throw new Error("Truncated Word FIB extension");
|
|
20604
|
-
const nFib = cswNew === 0 ? nFibBase : view.getUint16(cswNewOffset + 2, true);
|
|
20605
|
-
const expectedCounts = /* @__PURE__ */ new Map([[193, 93], [217, 108], [257, 136], [268, 164], [274, 183]]);
|
|
20606
|
-
if (expectedCounts.get(nFib) !== fibRgFcLcbCount || cswNew !== 0 && cswNew !== (nFib === 274 ? 5 : 2))
|
|
20607
|
-
throw new Error("Word FIB version and array counts disagree");
|
|
20608
|
-
const ccpText = view.getInt32(fibRgLw97Offset + 12, true);
|
|
20609
|
-
const otherStories = [4, 5, 7, 8, 9, 10].map((i2) => view.getInt32(fibRgLw97Offset + i2 * 4, true));
|
|
20610
|
-
if (ccpText < 0 || otherStories.some((cp) => cp < 0))
|
|
20611
|
-
throw new Error("Negative Word story length");
|
|
20612
|
-
function fcLcbPair(index) {
|
|
20613
|
-
const off = fibRgFcLcbOffset + index * 8;
|
|
20614
|
-
return { fc: view.getUint32(off, true), lcb: view.getUint32(off + 4, true) };
|
|
20615
|
-
}
|
|
20616
|
-
const cbMacOffset = fibRgLw97Offset + 0;
|
|
20617
|
-
const ccpTextOffset = fibRgLw97Offset + 12;
|
|
20618
|
-
return {
|
|
20619
|
-
nFib,
|
|
20620
|
-
nFibBase,
|
|
20621
|
-
flags1Offset,
|
|
20622
|
-
flags1,
|
|
20623
|
-
tableStreamName: fWhichTblStm ? "1Table" : "0Table",
|
|
20624
|
-
cbMacOffset,
|
|
20625
|
-
cbMac: view.getUint32(cbMacOffset, true),
|
|
20626
|
-
ccpTextOffset,
|
|
20627
|
-
ccpText,
|
|
20628
|
-
ccpOtherStories: otherStories.reduce((sum, cp) => sum + cp, 0),
|
|
20629
|
-
plcfbteChpx: fcLcbPair(FC_LCB_INDEX.plcfbteChpx),
|
|
20630
|
-
plcfbtePapx: fcLcbPair(FC_LCB_INDEX.plcfbtePapx),
|
|
20631
|
-
sed: fcLcbPair(FC_LCB_INDEX.sed),
|
|
20632
|
-
clx: fcLcbPair(FC_LCB_INDEX.clx),
|
|
20633
|
-
fibRgFcLcbOffset,
|
|
20634
|
-
fibRgFcLcbCount
|
|
20635
|
-
};
|
|
20636
|
-
}
|
|
20637
|
-
function fcLcbFieldOffset(fib, key) {
|
|
20638
|
-
return fib.fibRgFcLcbOffset + FC_LCB_INDEX[key] * 8;
|
|
20639
|
-
}
|
|
20640
|
-
function readFcLcbAt(wordDoc, fib, index) {
|
|
20641
|
-
const view = new DataView(wordDoc.buffer, wordDoc.byteOffset, wordDoc.byteLength);
|
|
20642
|
-
const count = view.getUint16(fib.fibRgFcLcbOffset - 2, true);
|
|
20643
|
-
if (!Number.isInteger(index) || index < 0 || index >= count || fib.fibRgFcLcbCount !== void 0 && fib.fibRgFcLcbCount !== count)
|
|
20644
|
-
throw new Error("FIB fc/lcb index outside declared array");
|
|
20645
|
-
const off = fib.fibRgFcLcbOffset + index * 8;
|
|
20646
|
-
return { fc: view.getUint32(off, true), lcb: view.getUint32(off + 4, true) };
|
|
20647
|
-
}
|
|
20648
|
-
function patchDocFib(wordDoc, fib, patch) {
|
|
20649
|
-
const view = new DataView(wordDoc.buffer, wordDoc.byteOffset, wordDoc.byteLength);
|
|
20650
|
-
view.setUint16(fib.flags1Offset, fib.flags1 | F_COMPLEX_BIT, true);
|
|
20651
|
-
view.setUint32(fib.cbMacOffset, patch.cbMac, true);
|
|
20652
|
-
view.setInt32(fib.ccpTextOffset, patch.ccpText, true);
|
|
20653
|
-
const clxOff = fcLcbFieldOffset(fib, "clx");
|
|
20654
|
-
view.setUint32(clxOff, patch.clx.fc, true);
|
|
20655
|
-
view.setUint32(clxOff + 4, patch.clx.lcb, true);
|
|
20656
|
-
const chpxOff = fcLcbFieldOffset(fib, "plcfbteChpx");
|
|
20657
|
-
view.setUint32(chpxOff, patch.plcfbteChpx.fc, true);
|
|
20658
|
-
view.setUint32(chpxOff + 4, patch.plcfbteChpx.lcb, true);
|
|
20659
|
-
const papxOff = fcLcbFieldOffset(fib, "plcfbtePapx");
|
|
20660
|
-
view.setUint32(papxOff, patch.plcfbtePapx.fc, true);
|
|
20661
|
-
view.setUint32(papxOff + 4, patch.plcfbtePapx.lcb, true);
|
|
20662
|
-
}
|
|
20663
|
-
|
|
20664
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-v4.js
|
|
20665
|
-
var END2 = 4294967294;
|
|
20666
|
-
var FREE = 4294967295;
|
|
20667
|
-
var FAT = 4294967293;
|
|
20668
|
-
function follow(table, start) {
|
|
20669
|
-
const ids = [], seen = /* @__PURE__ */ new Set();
|
|
20670
|
-
for (let id = start; id !== END2; id = table[id]) {
|
|
20671
|
-
if (id >= table.length || seen.has(id))
|
|
20672
|
-
throw new Error("Invalid allocation chain");
|
|
20673
|
-
seen.add(id);
|
|
20674
|
-
ids.push(id);
|
|
20675
|
-
}
|
|
20676
|
-
return ids;
|
|
20677
|
-
}
|
|
20678
|
-
function findSlot(slots, path) {
|
|
20679
|
-
let parent = slots.get(0);
|
|
20680
|
-
if (!parent || parent.type !== 5)
|
|
20681
|
-
throw new Error("Invalid root");
|
|
20682
|
-
const parents = /* @__PURE__ */ new Set();
|
|
20683
|
-
for (let part = 0; part < path.length; part++) {
|
|
20684
|
-
if (parents.has(parent.id))
|
|
20685
|
-
throw new Error("Cyclic storage hierarchy");
|
|
20686
|
-
parents.add(parent.id);
|
|
20687
|
-
const stack = [parent.child], seen = /* @__PURE__ */ new Set(), matches = [];
|
|
20688
|
-
while (stack.length) {
|
|
20689
|
-
const id = stack.pop();
|
|
20690
|
-
if (id === FREE)
|
|
20691
|
-
continue;
|
|
20692
|
-
if (seen.has(id))
|
|
20693
|
-
throw new Error("Invalid directory tree");
|
|
20694
|
-
seen.add(id);
|
|
20695
|
-
const slot = slots.get(id);
|
|
20696
|
-
if (!slot)
|
|
20697
|
-
throw new Error("Missing directory slot");
|
|
20698
|
-
if (slot.name.toLocaleLowerCase() === path[part].toLocaleLowerCase())
|
|
20699
|
-
matches.push(slot);
|
|
20700
|
-
stack.push(slot.left, slot.right);
|
|
20701
|
-
}
|
|
20702
|
-
if (matches.length !== 1)
|
|
20703
|
-
throw new Error("Missing or ambiguous stream");
|
|
20704
|
-
parent = matches[0];
|
|
20705
|
-
if (parent.type !== (part === path.length - 1 ? 2 : 1))
|
|
20706
|
-
throw new Error("Invalid storage path");
|
|
20707
|
-
}
|
|
20708
|
-
return parent;
|
|
20709
|
-
}
|
|
20710
|
-
function validateHierarchy(slots) {
|
|
20711
|
-
const owners = /* @__PURE__ */ new Set(), storages = [0];
|
|
20712
|
-
while (storages.length) {
|
|
20713
|
-
const storage = slots.get(storages.pop());
|
|
20714
|
-
const stack = [storage.child], names = /* @__PURE__ */ new Set();
|
|
20715
|
-
while (stack.length) {
|
|
20716
|
-
const id = stack.pop();
|
|
20717
|
-
if (id === FREE)
|
|
20718
|
-
continue;
|
|
20719
|
-
const slot = slots.get(id);
|
|
20720
|
-
if (!slot || slot.type !== 1 && slot.type !== 2 || owners.has(id))
|
|
20721
|
-
throw new Error("Ambiguous directory ownership");
|
|
20722
|
-
const name = slot.name.toLocaleLowerCase();
|
|
20723
|
-
if (names.has(name))
|
|
20724
|
-
throw new Error("Duplicate sibling name");
|
|
20725
|
-
names.add(name);
|
|
20726
|
-
owners.add(id);
|
|
20727
|
-
stack.push(slot.left, slot.right);
|
|
20728
|
-
if (slot.type === 1)
|
|
20729
|
-
storages.push(id);
|
|
20730
|
-
}
|
|
20731
|
-
}
|
|
20732
|
-
if (owners.size !== slots.size - 1)
|
|
20733
|
-
throw new Error("Unreachable directory entries");
|
|
20734
|
-
}
|
|
20735
|
-
function resizeCompoundFileStreamV4(input, path, replacement) {
|
|
20736
|
-
const fail2 = (reason) => ({ ok: false, bytes: input, reason });
|
|
20737
|
-
try {
|
|
20738
|
-
if (input.length < 512 || !path.length || path.some((part) => !part))
|
|
20739
|
-
return fail2("invalid-or-missing-stream");
|
|
20740
|
-
const view = new DataView(input.buffer, input.byteOffset, input.byteLength);
|
|
20741
|
-
const read = (offset) => view.getUint32(offset, true);
|
|
20742
|
-
const version = view.getUint16(26, true);
|
|
20743
|
-
if (version !== 4)
|
|
20744
|
-
return fail2("unsupported-version");
|
|
20745
|
-
const SECTOR3 = 4096, FAT_ENTRIES2 = SECTOR3 / 4, DIRECTORY_ENTRIES = SECTOR3 / 128;
|
|
20746
|
-
if (read(72) !== 0 || read(44) > 109)
|
|
20747
|
-
return fail2("unsupported-difat");
|
|
20748
|
-
const cutoff = read(56);
|
|
20749
|
-
if (cutoff !== 0 && cutoff !== 4096)
|
|
20750
|
-
return fail2("unsupported-layout");
|
|
20751
|
-
const original = readCompoundFileStream(input, path);
|
|
20752
|
-
if (!original)
|
|
20753
|
-
return fail2("invalid-or-missing-stream");
|
|
20754
|
-
const name = path[path.length - 1].toLocaleLowerCase();
|
|
20755
|
-
if (name === "worddocument" && original.length >= 12 && (original[10] | original[11] << 8) & 33024)
|
|
20756
|
-
return fail2("unsafe-edit");
|
|
20757
|
-
if (name === "book" || name === "workbook") {
|
|
20758
|
-
for (let offset = 0; offset + 4 <= original.length; ) {
|
|
20759
|
-
const record = original[offset] | original[offset + 1] << 8;
|
|
20760
|
-
const length = original[offset + 2] | original[offset + 3] << 8;
|
|
20761
|
-
if (record === 47)
|
|
20762
|
-
return fail2("unsafe-edit");
|
|
20763
|
-
if (record === 10 || offset + 4 + length > original.length)
|
|
20764
|
-
break;
|
|
20765
|
-
offset += 4 + length;
|
|
20766
|
-
}
|
|
20767
|
-
}
|
|
20768
|
-
const validated = replaceCompoundFileStream(input, path, original);
|
|
20769
|
-
if (validated === input)
|
|
20770
|
-
return fail2("unsafe-edit");
|
|
20771
|
-
const sameLength = replacement.length === original.length;
|
|
20772
|
-
if (!sameLength && original.length < cutoff)
|
|
20773
|
-
return fail2("unsupported-mini-stream");
|
|
20774
|
-
if (!sameLength && replacement.length < cutoff)
|
|
20775
|
-
return fail2("unsupported-mini-transition");
|
|
20776
|
-
const sectorCount = input.length / SECTOR3 - 1, fatCount = read(44);
|
|
20777
|
-
if (sectorCount > fatCount * FAT_ENTRIES2)
|
|
20778
|
-
return fail2("unsafe-edit");
|
|
20779
|
-
const fatIds = Array.from({ length: fatCount }, (_, i2) => read(76 + 4 * i2));
|
|
20780
|
-
const fat = [];
|
|
20781
|
-
for (const id of fatIds) {
|
|
20782
|
-
for (let i2 = 0; i2 < FAT_ENTRIES2 && fat.length < sectorCount; i2++)
|
|
20783
|
-
fat.push(read((id + 1) * SECTOR3 + i2 * 4));
|
|
20784
|
-
}
|
|
20785
|
-
if (fatIds.some((id) => fat[id] !== FAT))
|
|
20786
|
-
return fail2("unsafe-edit");
|
|
20787
|
-
const slots = /* @__PURE__ */ new Map();
|
|
20788
|
-
const directoryChain = follow(fat, read(48));
|
|
20789
|
-
if (read(40) !== directoryChain.length)
|
|
20790
|
-
return fail2("unsafe-edit");
|
|
20791
|
-
for (const [block, sector] of directoryChain.entries()) {
|
|
20792
|
-
for (let entry = 0; entry < DIRECTORY_ENTRIES; entry++) {
|
|
20793
|
-
const offset = (sector + 1) * SECTOR3 + entry * 128, type = view.getUint8(offset + 66);
|
|
20794
|
-
if (!type)
|
|
20795
|
-
continue;
|
|
20796
|
-
const nameLength = view.getUint16(offset + 64, true);
|
|
20797
|
-
if (![1, 2, 5].includes(type) || nameLength < 2 || nameLength > 64 || nameLength % 2 || view.getUint16(offset + nameLength - 2, true))
|
|
20798
|
-
return fail2("unsafe-edit");
|
|
20799
|
-
let name2 = "";
|
|
20800
|
-
for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
|
|
20801
|
-
name2 += String.fromCharCode(view.getUint16(offset + i2, true));
|
|
20802
|
-
if (read(offset + 124) !== 0)
|
|
20803
|
-
return fail2("unsafe-edit");
|
|
20804
|
-
const id = block * DIRECTORY_ENTRIES + entry;
|
|
20805
|
-
slots.set(id, { id, name: name2, type, left: read(offset + 68), right: read(offset + 72), child: read(offset + 76), start: read(offset + 116), size: read(offset + 120), offset });
|
|
20806
|
-
}
|
|
20807
|
-
}
|
|
20808
|
-
if ([...slots.values()].filter((slot) => slot.type === 5).length !== 1)
|
|
20809
|
-
return fail2("unsafe-edit");
|
|
20810
|
-
const target = findSlot(slots, path);
|
|
20811
|
-
validateHierarchy(slots);
|
|
20812
|
-
if (sameLength) {
|
|
20813
|
-
const bytes = replaceCompoundFileStream(input, path, replacement);
|
|
20814
|
-
return bytes === input ? fail2("unsafe-edit") : { ok: true, bytes };
|
|
20815
|
-
}
|
|
20816
|
-
const oldChain = follow(fat, target.start);
|
|
20817
|
-
if (target.size !== original.length || oldChain.length !== Math.ceil(target.size / SECTOR3))
|
|
20818
|
-
return fail2("unsafe-edit");
|
|
20819
|
-
const payloadSectors = Math.ceil(replacement.length / SECTOR3);
|
|
20820
|
-
let newFatCount = fatCount;
|
|
20821
|
-
while (sectorCount + payloadSectors + newFatCount - fatCount > newFatCount * FAT_ENTRIES2)
|
|
20822
|
-
newFatCount++;
|
|
20823
|
-
if (newFatCount > 109)
|
|
20824
|
-
return fail2("allocation-limit");
|
|
20825
|
-
const totalSectors = sectorCount + payloadSectors + newFatCount - fatCount;
|
|
20826
|
-
const output = new Uint8Array((totalSectors + 1) * SECTOR3);
|
|
20827
|
-
output.set(input);
|
|
20828
|
-
output.set(replacement, (sectorCount + 1) * SECTOR3);
|
|
20829
|
-
const outView = new DataView(output.buffer);
|
|
20830
|
-
for (let i2 = fatCount; i2 < newFatCount; i2++) {
|
|
20831
|
-
const id = sectorCount + payloadSectors + i2 - fatCount;
|
|
20832
|
-
fatIds.push(id);
|
|
20833
|
-
output.fill(255, (id + 1) * SECTOR3, (id + 2) * SECTOR3);
|
|
20834
|
-
outView.setUint32(76 + i2 * 4, id, true);
|
|
21593
|
+
const rows = [...grid.keys()];
|
|
21594
|
+
const cols = [...grid.values()].flatMap((row2) => [...row2.cells.keys()]);
|
|
21595
|
+
view.setUint32(dimensions.dataOffset, Math.min(...rows), true);
|
|
21596
|
+
view.setUint32(dimensions.dataOffset + 4, Math.max(...rows) + 1, true);
|
|
21597
|
+
view.setUint16(dimensions.dataOffset + 8, Math.min(...cols), true);
|
|
21598
|
+
view.setUint16(dimensions.dataOffset + 10, Math.max(...cols) + 1, true);
|
|
20835
21599
|
}
|
|
20836
|
-
|
|
20837
|
-
const writeFat = (id, value) => outView.setUint32((fatIds[Math.floor(id / FAT_ENTRIES2)] + 1) * SECTOR3 + id % FAT_ENTRIES2 * 4, value, true);
|
|
20838
|
-
for (const id of oldChain)
|
|
20839
|
-
writeFat(id, FREE);
|
|
20840
|
-
for (let i2 = 0; i2 < payloadSectors; i2++)
|
|
20841
|
-
writeFat(sectorCount + i2, i2 + 1 === payloadSectors ? END2 : sectorCount + i2 + 1);
|
|
20842
|
-
for (const id of fatIds)
|
|
20843
|
-
writeFat(id, FAT);
|
|
20844
|
-
outView.setUint32(target.offset + 116, payloadSectors ? sectorCount : END2, true);
|
|
20845
|
-
outView.setUint32(target.offset + 120, replacement.length, true);
|
|
20846
|
-
return { ok: true, bytes: output };
|
|
21600
|
+
return finish2(result);
|
|
20847
21601
|
} catch {
|
|
20848
|
-
return
|
|
20849
|
-
}
|
|
20850
|
-
}
|
|
20851
|
-
|
|
20852
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-allocation.js
|
|
20853
|
-
function appendCompoundAllocations(input, existingFatIds, payloads, sectorSize = 512) {
|
|
20854
|
-
const sectorCount = input.length / sectorSize - 1;
|
|
20855
|
-
const entriesPerFat = sectorSize / 4;
|
|
20856
|
-
const counts = payloads.map((payload) => Math.ceil(payload.length / sectorSize));
|
|
20857
|
-
const payloadSectors = counts.reduce((sum, count) => sum + count, 0);
|
|
20858
|
-
let fatCount = existingFatIds.length;
|
|
20859
|
-
while (sectorCount + payloadSectors + fatCount - existingFatIds.length > fatCount * entriesPerFat)
|
|
20860
|
-
fatCount++;
|
|
20861
|
-
if (fatCount > 109)
|
|
20862
|
-
return void 0;
|
|
20863
|
-
const totalSectors = sectorCount + payloadSectors + fatCount - existingFatIds.length;
|
|
20864
|
-
const bytes = new Uint8Array((totalSectors + 1) * sectorSize);
|
|
20865
|
-
bytes.set(input);
|
|
20866
|
-
const view = new DataView(bytes.buffer), fatIds = [...existingFatIds];
|
|
20867
|
-
for (let i2 = existingFatIds.length; i2 < fatCount; i2++) {
|
|
20868
|
-
const id = sectorCount + payloadSectors + i2 - existingFatIds.length;
|
|
20869
|
-
fatIds.push(id);
|
|
20870
|
-
bytes.fill(255, (id + 1) * sectorSize, (id + 2) * sectorSize);
|
|
20871
|
-
view.setUint32(76 + i2 * 4, id, true);
|
|
20872
|
-
}
|
|
20873
|
-
view.setUint32(44, fatCount, true);
|
|
20874
|
-
const writeFat = (id, value) => view.setUint32((fatIds[Math.floor(id / entriesPerFat)] + 1) * sectorSize + id % entriesPerFat * 4, value, true);
|
|
20875
|
-
const chains = [];
|
|
20876
|
-
let next = sectorCount;
|
|
20877
|
-
for (let payload = 0; payload < payloads.length; payload++) {
|
|
20878
|
-
bytes.set(payloads[payload], (next + 1) * sectorSize);
|
|
20879
|
-
const chain2 = Array.from({ length: counts[payload] }, (_, i2) => next + i2);
|
|
20880
|
-
chain2.forEach((id, i2) => writeFat(id, chain2[i2 + 1] ?? 4294967294));
|
|
20881
|
-
chains.push(chain2);
|
|
20882
|
-
next += counts[payload];
|
|
21602
|
+
return inputBytes;
|
|
20883
21603
|
}
|
|
20884
|
-
for (const id of fatIds)
|
|
20885
|
-
writeFat(id, 4294967293);
|
|
20886
|
-
return { bytes, view, chains, writeFat };
|
|
20887
21604
|
}
|
|
20888
|
-
|
|
20889
|
-
|
|
20890
|
-
|
|
20891
|
-
|
|
20892
|
-
|
|
20893
|
-
|
|
20894
|
-
|
|
20895
|
-
|
|
20896
|
-
|
|
21605
|
+
var DOCUMENT_PART_PATH = "word/document.xml";
|
|
21606
|
+
function createWordXmlParser() {
|
|
21607
|
+
return new XMLParser({
|
|
21608
|
+
ignoreAttributes: false,
|
|
21609
|
+
attributeNamePrefix: "@_",
|
|
21610
|
+
trimValues: false,
|
|
21611
|
+
// See the matching comment in `ole-sheet-xlsx-editor.ts`: `xmlText`
|
|
21612
|
+
// only accepts string leaves.
|
|
21613
|
+
parseTagValue: false,
|
|
21614
|
+
parseAttributeValue: false
|
|
21615
|
+
});
|
|
20897
21616
|
}
|
|
20898
|
-
|
|
20899
|
-
|
|
20900
|
-
|
|
20901
|
-
|
|
20902
|
-
|
|
20903
|
-
|
|
20904
|
-
|
|
20905
|
-
const inputView = new DataView(input.buffer, input.byteOffset, input.byteLength);
|
|
20906
|
-
const miniFatCount = inputView.getUint32(64, true);
|
|
20907
|
-
const miniFatSectors = miniFatCount ? followCompoundAllocation(fat, inputView.getUint32(60, true)) : [];
|
|
20908
|
-
if (miniFatSectors.length !== miniFatCount)
|
|
20909
|
-
throw new Error("Invalid mini FAT count");
|
|
20910
|
-
const rootSectors = root.size ? followCompoundAllocation(fat, root.start) : [];
|
|
20911
|
-
if (rootSectors.length !== Math.ceil(root.size / SECTOR))
|
|
20912
|
-
throw new Error("Invalid root mini stream");
|
|
20913
|
-
const miniCapacity = Math.floor(root.size / MINI), miniFat = [];
|
|
20914
|
-
for (const id of miniFatSectors) {
|
|
20915
|
-
for (let slot = 0; slot < SECTOR / 4 && miniFat.length < miniCapacity; slot++)
|
|
20916
|
-
miniFat.push(inputView.getUint32((id + 1) * SECTOR + slot * 4, true));
|
|
20917
|
-
}
|
|
20918
|
-
const wasMini = target.size < cutoff;
|
|
20919
|
-
const oldChain = followCompoundAllocation(wasMini ? miniFat : fat, target.start);
|
|
20920
|
-
if (oldChain.length !== Math.ceil(target.size / (wasMini ? MINI : SECTOR)))
|
|
20921
|
-
throw new Error("Invalid stream allocation");
|
|
20922
|
-
if (!replacement.length) {
|
|
20923
|
-
const bytes = input.slice(), view = new DataView(bytes.buffer);
|
|
20924
|
-
for (const id of oldChain) {
|
|
20925
|
-
const table = wasMini ? miniFatSectors : fatIds;
|
|
20926
|
-
view.setUint32((table[Math.floor(id / 128)] + 1) * SECTOR + id % 128 * 4, FREE2, true);
|
|
20927
|
-
}
|
|
20928
|
-
view.setUint32(target.offset + 116, END3, true);
|
|
20929
|
-
view.setUint32(target.offset + 120, 0, true);
|
|
20930
|
-
return bytes;
|
|
20931
|
-
}
|
|
20932
|
-
if (replacement.length >= cutoff) {
|
|
20933
|
-
const output2 = appendCompoundAllocations(input, fatIds, [replacement]);
|
|
20934
|
-
if (!output2)
|
|
20935
|
-
return void 0;
|
|
20936
|
-
for (const id of oldChain)
|
|
20937
|
-
output2.view.setUint32((miniFatSectors[Math.floor(id / 128)] + 1) * SECTOR + id % 128 * 4, FREE2, true);
|
|
20938
|
-
output2.view.setUint32(target.offset + 116, output2.chains[0][0] ?? END3, true);
|
|
20939
|
-
output2.view.setUint32(target.offset + 120, replacement.length, true);
|
|
20940
|
-
return output2.bytes;
|
|
20941
|
-
}
|
|
20942
|
-
const firstMini = Math.ceil(root.size / MINI), count = Math.ceil(replacement.length / MINI);
|
|
20943
|
-
const newRootSize = count ? (firstMini + count) * MINI : root.size;
|
|
20944
|
-
const newRoot = new Uint8Array(newRootSize);
|
|
20945
|
-
rootSectors.forEach((id, i2) => newRoot.set(input.subarray((id + 1) * SECTOR, (id + 1) * SECTOR + Math.min(SECTOR, root.size - i2 * SECTOR)), i2 * SECTOR));
|
|
20946
|
-
if (count)
|
|
20947
|
-
newRoot.set(replacement, firstMini * MINI);
|
|
20948
|
-
const newMiniFatCount = Math.max(miniFatCount, Math.ceil((firstMini + count) / 128));
|
|
20949
|
-
const newMiniFat = new Uint8Array(newMiniFatCount * SECTOR).fill(255);
|
|
20950
|
-
miniFatSectors.forEach((id, i2) => newMiniFat.set(input.subarray((id + 1) * SECTOR, (id + 2) * SECTOR), i2 * SECTOR));
|
|
20951
|
-
const miniView = new DataView(newMiniFat.buffer);
|
|
20952
|
-
if (wasMini)
|
|
20953
|
-
for (const id of oldChain)
|
|
20954
|
-
miniView.setUint32(id * 4, FREE2, true);
|
|
20955
|
-
for (let i2 = 0; i2 < count; i2++)
|
|
20956
|
-
miniView.setUint32((firstMini + i2) * 4, i2 + 1 === count ? END3 : firstMini + i2 + 1, true);
|
|
20957
|
-
const output = appendCompoundAllocations(input, fatIds, [newRoot, newMiniFat]);
|
|
20958
|
-
if (!output)
|
|
20959
|
-
return void 0;
|
|
20960
|
-
for (const id of [...rootSectors, ...miniFatSectors, ...wasMini ? [] : oldChain])
|
|
20961
|
-
output.writeFat(id, FREE2);
|
|
20962
|
-
output.view.setUint32(root.offset + 116, output.chains[0][0] ?? END3, true);
|
|
20963
|
-
output.view.setUint32(root.offset + 120, newRootSize, true);
|
|
20964
|
-
output.view.setUint32(60, output.chains[1][0] ?? END3, true);
|
|
20965
|
-
output.view.setUint32(64, newMiniFatCount, true);
|
|
20966
|
-
output.view.setUint32(target.offset + 116, count ? firstMini : END3, true);
|
|
20967
|
-
output.view.setUint32(target.offset + 120, replacement.length, true);
|
|
20968
|
-
return output.bytes;
|
|
21617
|
+
function createWordXmlBuilder() {
|
|
21618
|
+
return new XMLBuilder({
|
|
21619
|
+
ignoreAttributes: false,
|
|
21620
|
+
attributeNamePrefix: "@_",
|
|
21621
|
+
suppressBooleanAttributes: false,
|
|
21622
|
+
format: false
|
|
21623
|
+
});
|
|
20969
21624
|
}
|
|
20970
|
-
|
|
20971
|
-
|
|
20972
|
-
var END4 = 4294967294;
|
|
20973
|
-
var FREE3 = 4294967295;
|
|
20974
|
-
var FAT2 = 4294967293;
|
|
20975
|
-
var SECTOR2 = 512;
|
|
20976
|
-
var FAT_ENTRIES = SECTOR2 / 4;
|
|
20977
|
-
function follow2(table, start) {
|
|
20978
|
-
const ids = [], seen = /* @__PURE__ */ new Set();
|
|
20979
|
-
for (let id = start; id !== END4; id = table[id]) {
|
|
20980
|
-
if (id >= table.length || seen.has(id))
|
|
20981
|
-
throw new Error("Invalid allocation chain");
|
|
20982
|
-
seen.add(id);
|
|
20983
|
-
ids.push(id);
|
|
20984
|
-
}
|
|
20985
|
-
return ids;
|
|
21625
|
+
function paragraphText(paragraph) {
|
|
21626
|
+
return xmlChildren(paragraph, "w:r").map((run) => xmlText(xmlChild(run, "w:t") ?? run["w:t"]) ?? "").join("");
|
|
20986
21627
|
}
|
|
20987
|
-
function
|
|
20988
|
-
|
|
20989
|
-
|
|
20990
|
-
|
|
20991
|
-
|
|
20992
|
-
|
|
20993
|
-
if (parents.has(parent.id))
|
|
20994
|
-
throw new Error("Cyclic storage hierarchy");
|
|
20995
|
-
parents.add(parent.id);
|
|
20996
|
-
const stack = [parent.child], seen = /* @__PURE__ */ new Set(), matches = [];
|
|
20997
|
-
while (stack.length) {
|
|
20998
|
-
const id = stack.pop();
|
|
20999
|
-
if (id === FREE3)
|
|
21000
|
-
continue;
|
|
21001
|
-
if (seen.has(id))
|
|
21002
|
-
throw new Error("Invalid directory tree");
|
|
21003
|
-
seen.add(id);
|
|
21004
|
-
const slot = slots.get(id);
|
|
21005
|
-
if (!slot)
|
|
21006
|
-
throw new Error("Missing directory slot");
|
|
21007
|
-
if (slot.name.toLocaleLowerCase() === path[part].toLocaleLowerCase())
|
|
21008
|
-
matches.push(slot);
|
|
21009
|
-
stack.push(slot.left, slot.right);
|
|
21628
|
+
async function readOleDocumentParagraphs(docxBytes) {
|
|
21629
|
+
try {
|
|
21630
|
+
const zip = await openNestedZip(docxBytes);
|
|
21631
|
+
const documentFile = zip.file(DOCUMENT_PART_PATH);
|
|
21632
|
+
if (!documentFile) {
|
|
21633
|
+
return void 0;
|
|
21010
21634
|
}
|
|
21011
|
-
|
|
21012
|
-
|
|
21013
|
-
|
|
21014
|
-
if (
|
|
21015
|
-
|
|
21016
|
-
}
|
|
21017
|
-
return parent;
|
|
21018
|
-
}
|
|
21019
|
-
function validateHierarchy2(slots) {
|
|
21020
|
-
const owners = /* @__PURE__ */ new Set(), storages = [0];
|
|
21021
|
-
while (storages.length) {
|
|
21022
|
-
const storage = slots.get(storages.pop());
|
|
21023
|
-
const stack = [storage.child], names = /* @__PURE__ */ new Set();
|
|
21024
|
-
while (stack.length) {
|
|
21025
|
-
const id = stack.pop();
|
|
21026
|
-
if (id === FREE3)
|
|
21027
|
-
continue;
|
|
21028
|
-
const slot = slots.get(id);
|
|
21029
|
-
if (!slot || slot.type !== 1 && slot.type !== 2 || owners.has(id))
|
|
21030
|
-
throw new Error("Ambiguous directory ownership");
|
|
21031
|
-
const name = slot.name.toLocaleLowerCase();
|
|
21032
|
-
if (names.has(name))
|
|
21033
|
-
throw new Error("Duplicate sibling name");
|
|
21034
|
-
names.add(name);
|
|
21035
|
-
owners.add(id);
|
|
21036
|
-
stack.push(slot.left, slot.right);
|
|
21037
|
-
if (slot.type === 1)
|
|
21038
|
-
storages.push(id);
|
|
21635
|
+
const parser = createWordXmlParser();
|
|
21636
|
+
const tree = parser.parse(await documentFile.async("string"));
|
|
21637
|
+
const body = xmlChild(xmlChild(tree, "w:document"), "w:body");
|
|
21638
|
+
if (!body) {
|
|
21639
|
+
return [];
|
|
21039
21640
|
}
|
|
21641
|
+
return xmlChildren(body, "w:p").map(paragraphText);
|
|
21642
|
+
} catch {
|
|
21643
|
+
return void 0;
|
|
21040
21644
|
}
|
|
21041
|
-
if (owners.size !== slots.size - 1)
|
|
21042
|
-
throw new Error("Unreachable directory entries");
|
|
21043
21645
|
}
|
|
21044
|
-
function
|
|
21045
|
-
if (input.length >= 512 && new DataView(input.buffer, input.byteOffset, input.byteLength).getUint16(26, true) === 4)
|
|
21046
|
-
return resizeCompoundFileStreamV4(input, path, replacement);
|
|
21047
|
-
const fail2 = (reason) => ({ ok: false, bytes: input, reason });
|
|
21646
|
+
async function writeOleDocumentParagraphEdit(docxBytes, paragraphIndex, text) {
|
|
21048
21647
|
try {
|
|
21049
|
-
|
|
21050
|
-
|
|
21051
|
-
|
|
21052
|
-
|
|
21053
|
-
if (view.getUint16(26, true) !== 3)
|
|
21054
|
-
return fail2("unsupported-version");
|
|
21055
|
-
if (read(72) !== 0 || read(44) > 109)
|
|
21056
|
-
return fail2("unsupported-difat");
|
|
21057
|
-
const cutoff = read(56);
|
|
21058
|
-
if (cutoff !== 0 && cutoff !== 4096)
|
|
21059
|
-
return fail2("unsupported-layout");
|
|
21060
|
-
const original = readCompoundFileStream(input, path);
|
|
21061
|
-
if (!original)
|
|
21062
|
-
return fail2("invalid-or-missing-stream");
|
|
21063
|
-
const name = path[path.length - 1].toLocaleLowerCase();
|
|
21064
|
-
if (name === "worddocument" && original.length >= 12 && (original[10] | original[11] << 8) & 33024)
|
|
21065
|
-
return fail2("unsafe-edit");
|
|
21066
|
-
if (name === "book" || name === "workbook") {
|
|
21067
|
-
for (let offset = 0; offset + 4 <= original.length; ) {
|
|
21068
|
-
const record = original[offset] | original[offset + 1] << 8;
|
|
21069
|
-
const length = original[offset + 2] | original[offset + 3] << 8;
|
|
21070
|
-
if (record === 47)
|
|
21071
|
-
return fail2("unsafe-edit");
|
|
21072
|
-
if (record === 10 || offset + 4 + length > original.length)
|
|
21073
|
-
break;
|
|
21074
|
-
offset += 4 + length;
|
|
21075
|
-
}
|
|
21648
|
+
const zip = await openNestedZip(docxBytes);
|
|
21649
|
+
const documentFile = zip.file(DOCUMENT_PART_PATH);
|
|
21650
|
+
if (!documentFile) {
|
|
21651
|
+
return docxBytes;
|
|
21076
21652
|
}
|
|
21077
|
-
const
|
|
21078
|
-
|
|
21079
|
-
|
|
21080
|
-
const
|
|
21081
|
-
|
|
21082
|
-
|
|
21083
|
-
return fail2("unsafe-edit");
|
|
21084
|
-
const fatIds = Array.from({ length: fatCount }, (_, i2) => read(76 + 4 * i2));
|
|
21085
|
-
const fat = [];
|
|
21086
|
-
for (const id of fatIds) {
|
|
21087
|
-
for (let i2 = 0; i2 < FAT_ENTRIES && fat.length < sectorCount; i2++)
|
|
21088
|
-
fat.push(read((id + 1) * SECTOR2 + i2 * 4));
|
|
21653
|
+
const parser = createWordXmlParser();
|
|
21654
|
+
const builder3 = createWordXmlBuilder();
|
|
21655
|
+
const tree = parser.parse(await documentFile.async("string"));
|
|
21656
|
+
const body = xmlChild(xmlChild(tree, "w:document"), "w:body");
|
|
21657
|
+
if (!body) {
|
|
21658
|
+
return docxBytes;
|
|
21089
21659
|
}
|
|
21090
|
-
|
|
21091
|
-
|
|
21092
|
-
|
|
21093
|
-
|
|
21094
|
-
for (let entry = 0; entry < 4; entry++) {
|
|
21095
|
-
const offset = (sector + 1) * SECTOR2 + entry * 128, type = view.getUint8(offset + 66);
|
|
21096
|
-
if (!type)
|
|
21097
|
-
continue;
|
|
21098
|
-
const nameLength = view.getUint16(offset + 64, true);
|
|
21099
|
-
if (![1, 2, 5].includes(type) || nameLength < 2 || nameLength > 64 || nameLength % 2 || view.getUint16(offset + nameLength - 2, true))
|
|
21100
|
-
return fail2("unsafe-edit");
|
|
21101
|
-
let name2 = "";
|
|
21102
|
-
for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
|
|
21103
|
-
name2 += String.fromCharCode(view.getUint16(offset + i2, true));
|
|
21104
|
-
const id = block * 4 + entry;
|
|
21105
|
-
slots.set(id, { id, name: name2, type, left: read(offset + 68), right: read(offset + 72), child: read(offset + 76), start: read(offset + 116), size: read(offset + 120), offset });
|
|
21106
|
-
}
|
|
21660
|
+
const paragraphs = ensureXmlChildren(body, "w:p");
|
|
21661
|
+
const paragraph = paragraphs[paragraphIndex];
|
|
21662
|
+
if (!paragraph) {
|
|
21663
|
+
return docxBytes;
|
|
21107
21664
|
}
|
|
21108
|
-
|
|
21109
|
-
|
|
21110
|
-
|
|
21111
|
-
|
|
21112
|
-
|
|
21113
|
-
|
|
21114
|
-
|
|
21665
|
+
const firstRunRPr = xmlChildren(paragraph, "w:r").map((run) => xmlChild(run, "w:rPr")).find((rPr) => rPr !== void 0);
|
|
21666
|
+
const newRun = {
|
|
21667
|
+
...firstRunRPr ? { "w:rPr": firstRunRPr } : {},
|
|
21668
|
+
"w:t": { "@_xml:space": "preserve", "#text": text }
|
|
21669
|
+
};
|
|
21670
|
+
const pPr = xmlChild(paragraph, "w:pPr");
|
|
21671
|
+
for (const key of Object.keys(paragraph)) {
|
|
21672
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
21673
|
+
continue;
|
|
21674
|
+
}
|
|
21675
|
+
Reflect.deleteProperty(paragraph, key);
|
|
21115
21676
|
}
|
|
21116
|
-
if (
|
|
21117
|
-
|
|
21118
|
-
return bytes ? { ok: true, bytes } : fail2("allocation-limit");
|
|
21677
|
+
if (pPr) {
|
|
21678
|
+
paragraph["w:pPr"] = pPr;
|
|
21119
21679
|
}
|
|
21120
|
-
|
|
21121
|
-
|
|
21122
|
-
|
|
21123
|
-
|
|
21124
|
-
|
|
21125
|
-
|
|
21126
|
-
|
|
21127
|
-
output.writeFat(id, FREE3);
|
|
21128
|
-
output.view.setUint32(target.offset + 116, output.chains[0][0] ?? END4, true);
|
|
21129
|
-
output.view.setUint32(target.offset + 120, replacement.length, true);
|
|
21130
|
-
return { ok: true, bytes: output.bytes };
|
|
21680
|
+
paragraph["w:r"] = newRun;
|
|
21681
|
+
zip.file(DOCUMENT_PART_PATH, builder3.build(tree));
|
|
21682
|
+
return await zip.generateAsync({
|
|
21683
|
+
type: "uint8array",
|
|
21684
|
+
compression: "DEFLATE",
|
|
21685
|
+
compressionOptions: { level: 6 }
|
|
21686
|
+
});
|
|
21131
21687
|
} catch {
|
|
21132
|
-
return
|
|
21688
|
+
return docxBytes;
|
|
21689
|
+
}
|
|
21690
|
+
}
|
|
21691
|
+
|
|
21692
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fib.js
|
|
21693
|
+
var FC_LCB_INDEX = {
|
|
21694
|
+
plcfbteChpx: 12,
|
|
21695
|
+
plcfbtePapx: 13,
|
|
21696
|
+
sed: 6,
|
|
21697
|
+
clx: 33
|
|
21698
|
+
};
|
|
21699
|
+
var F_COMPLEX_BIT = 1 << 2;
|
|
21700
|
+
function readDocFib(wordDoc) {
|
|
21701
|
+
const view = new DataView(wordDoc.buffer, wordDoc.byteOffset, wordDoc.byteLength);
|
|
21702
|
+
const wIdent = view.getUint16(0, true);
|
|
21703
|
+
if (wIdent !== 42476) {
|
|
21704
|
+
throw new Error("Not a WordDocument FIB (bad wIdent)");
|
|
21705
|
+
}
|
|
21706
|
+
const nFibBase = view.getUint16(2, true);
|
|
21707
|
+
if (![193, 217, 257, 268, 274].includes(nFibBase))
|
|
21708
|
+
throw new Error("Unsupported Word FIB version");
|
|
21709
|
+
const flags1Offset = 10;
|
|
21710
|
+
const flags1 = view.getUint16(flags1Offset, true);
|
|
21711
|
+
if ((flags1 & 33024) !== 0)
|
|
21712
|
+
throw new Error("Encrypted or obfuscated Word document");
|
|
21713
|
+
const fWhichTblStm = flags1 >> 9 & 1;
|
|
21714
|
+
const csw = view.getUint16(32, true);
|
|
21715
|
+
const fibRgW97Offset = 34;
|
|
21716
|
+
const cslwOffset = fibRgW97Offset + csw * 2;
|
|
21717
|
+
const cslw = view.getUint16(cslwOffset, true);
|
|
21718
|
+
const fibRgLw97Offset = cslwOffset + 2;
|
|
21719
|
+
const cbRgFcLcbCountOffset = fibRgLw97Offset + cslw * 4;
|
|
21720
|
+
const fibRgFcLcbOffset = cbRgFcLcbCountOffset + 2;
|
|
21721
|
+
const fibRgFcLcbCount = view.getUint16(cbRgFcLcbCountOffset, true);
|
|
21722
|
+
if (csw !== 14 || cslw !== 22 || fibRgFcLcbOffset + fibRgFcLcbCount * 8 + 2 > wordDoc.length)
|
|
21723
|
+
throw new Error("Truncated Word FIB arrays");
|
|
21724
|
+
const cswNewOffset = fibRgFcLcbOffset + fibRgFcLcbCount * 8;
|
|
21725
|
+
const cswNew = view.getUint16(cswNewOffset, true);
|
|
21726
|
+
if (cswNewOffset + 2 + cswNew * 2 > wordDoc.length)
|
|
21727
|
+
throw new Error("Truncated Word FIB extension");
|
|
21728
|
+
const nFib = cswNew === 0 ? nFibBase : view.getUint16(cswNewOffset + 2, true);
|
|
21729
|
+
const expectedCounts = /* @__PURE__ */ new Map([[193, 93], [217, 108], [257, 136], [268, 164], [274, 183]]);
|
|
21730
|
+
if (expectedCounts.get(nFib) !== fibRgFcLcbCount || cswNew !== 0 && cswNew !== (nFib === 274 ? 5 : 2))
|
|
21731
|
+
throw new Error("Word FIB version and array counts disagree");
|
|
21732
|
+
const ccpText = view.getInt32(fibRgLw97Offset + 12, true);
|
|
21733
|
+
const otherStories = [4, 5, 7, 8, 9, 10].map((i2) => view.getInt32(fibRgLw97Offset + i2 * 4, true));
|
|
21734
|
+
if (ccpText < 0 || otherStories.some((cp) => cp < 0))
|
|
21735
|
+
throw new Error("Negative Word story length");
|
|
21736
|
+
function fcLcbPair(index) {
|
|
21737
|
+
const off = fibRgFcLcbOffset + index * 8;
|
|
21738
|
+
return { fc: view.getUint32(off, true), lcb: view.getUint32(off + 4, true) };
|
|
21133
21739
|
}
|
|
21740
|
+
const cbMacOffset = fibRgLw97Offset + 0;
|
|
21741
|
+
const ccpTextOffset = fibRgLw97Offset + 12;
|
|
21742
|
+
return {
|
|
21743
|
+
nFib,
|
|
21744
|
+
nFibBase,
|
|
21745
|
+
flags1Offset,
|
|
21746
|
+
flags1,
|
|
21747
|
+
tableStreamName: fWhichTblStm ? "1Table" : "0Table",
|
|
21748
|
+
cbMacOffset,
|
|
21749
|
+
cbMac: view.getUint32(cbMacOffset, true),
|
|
21750
|
+
ccpTextOffset,
|
|
21751
|
+
ccpText,
|
|
21752
|
+
ccpOtherStories: otherStories.reduce((sum, cp) => sum + cp, 0),
|
|
21753
|
+
plcfbteChpx: fcLcbPair(FC_LCB_INDEX.plcfbteChpx),
|
|
21754
|
+
plcfbtePapx: fcLcbPair(FC_LCB_INDEX.plcfbtePapx),
|
|
21755
|
+
sed: fcLcbPair(FC_LCB_INDEX.sed),
|
|
21756
|
+
clx: fcLcbPair(FC_LCB_INDEX.clx),
|
|
21757
|
+
fibRgFcLcbOffset,
|
|
21758
|
+
fibRgFcLcbCount
|
|
21759
|
+
};
|
|
21760
|
+
}
|
|
21761
|
+
function fcLcbFieldOffset(fib, key) {
|
|
21762
|
+
return fib.fibRgFcLcbOffset + FC_LCB_INDEX[key] * 8;
|
|
21763
|
+
}
|
|
21764
|
+
function readFcLcbAt(wordDoc, fib, index) {
|
|
21765
|
+
const view = new DataView(wordDoc.buffer, wordDoc.byteOffset, wordDoc.byteLength);
|
|
21766
|
+
const count = view.getUint16(fib.fibRgFcLcbOffset - 2, true);
|
|
21767
|
+
if (!Number.isInteger(index) || index < 0 || index >= count || fib.fibRgFcLcbCount !== void 0 && fib.fibRgFcLcbCount !== count)
|
|
21768
|
+
throw new Error("FIB fc/lcb index outside declared array");
|
|
21769
|
+
const off = fib.fibRgFcLcbOffset + index * 8;
|
|
21770
|
+
return { fc: view.getUint32(off, true), lcb: view.getUint32(off + 4, true) };
|
|
21771
|
+
}
|
|
21772
|
+
function patchDocFib(wordDoc, fib, patch) {
|
|
21773
|
+
const view = new DataView(wordDoc.buffer, wordDoc.byteOffset, wordDoc.byteLength);
|
|
21774
|
+
view.setUint16(fib.flags1Offset, fib.flags1 | F_COMPLEX_BIT, true);
|
|
21775
|
+
view.setUint32(fib.cbMacOffset, patch.cbMac, true);
|
|
21776
|
+
view.setInt32(fib.ccpTextOffset, patch.ccpText, true);
|
|
21777
|
+
const clxOff = fcLcbFieldOffset(fib, "clx");
|
|
21778
|
+
view.setUint32(clxOff, patch.clx.fc, true);
|
|
21779
|
+
view.setUint32(clxOff + 4, patch.clx.lcb, true);
|
|
21780
|
+
const chpxOff = fcLcbFieldOffset(fib, "plcfbteChpx");
|
|
21781
|
+
view.setUint32(chpxOff, patch.plcfbteChpx.fc, true);
|
|
21782
|
+
view.setUint32(chpxOff + 4, patch.plcfbteChpx.lcb, true);
|
|
21783
|
+
const papxOff = fcLcbFieldOffset(fib, "plcfbtePapx");
|
|
21784
|
+
view.setUint32(papxOff, patch.plcfbtePapx.fc, true);
|
|
21785
|
+
view.setUint32(papxOff + 4, patch.plcfbtePapx.lcb, true);
|
|
21134
21786
|
}
|
|
21135
21787
|
|
|
21136
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
21788
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cfb.js
|
|
21137
21789
|
var DocCfbRewriteError = class extends Error {
|
|
21138
21790
|
constructor(message) {
|
|
21139
21791
|
super(message);
|
|
@@ -21188,7 +21840,7 @@ function unwrapDocBytes(bytes) {
|
|
|
21188
21840
|
}
|
|
21189
21841
|
}
|
|
21190
21842
|
|
|
21191
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
21843
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fkp.js
|
|
21192
21844
|
var PAGE_SIZE = 512;
|
|
21193
21845
|
function parseBteTable(tableStream, at2) {
|
|
21194
21846
|
const view = new DataView(tableStream.buffer, tableStream.byteOffset, tableStream.byteLength);
|
|
@@ -21329,7 +21981,7 @@ function buildSingleRunChpxPage(fcStart, fcEnd, blob) {
|
|
|
21329
21981
|
return page;
|
|
21330
21982
|
}
|
|
21331
21983
|
|
|
21332
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
21984
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cp1252.js
|
|
21333
21985
|
var CP1252_HIGH_BLOCK = [
|
|
21334
21986
|
8364,
|
|
21335
21987
|
129,
|
|
@@ -21397,7 +22049,7 @@ function encodeCp1252(text) {
|
|
|
21397
22049
|
return Uint8Array.from(bytes);
|
|
21398
22050
|
}
|
|
21399
22051
|
|
|
21400
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
22052
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-pieces.js
|
|
21401
22053
|
var CLXT_PRC = 1;
|
|
21402
22054
|
var CLXT_PCDT = 2;
|
|
21403
22055
|
var DocResourceLimitError = class extends Error {
|
|
@@ -21609,7 +22261,7 @@ function buildClxBytes(pieces, prcBytes = new Uint8Array()) {
|
|
|
21609
22261
|
return result;
|
|
21610
22262
|
}
|
|
21611
22263
|
|
|
21612
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
22264
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fields.js
|
|
21613
22265
|
var UnsupportedDocFieldEditError = class extends Error {
|
|
21614
22266
|
constructor(message) {
|
|
21615
22267
|
super(message);
|
|
@@ -21693,7 +22345,7 @@ function shiftDocMainFieldCps(table, at2, body, editStart, editEnd, delta2, maxF
|
|
|
21693
22345
|
return result;
|
|
21694
22346
|
}
|
|
21695
22347
|
|
|
21696
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
22348
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-editor.js
|
|
21697
22349
|
var RISKY_PLCF_INDICES = [2, 3, 4, 5, 17, 18, 19, 20, 40, 41, 42, 43, 46, 47, 48, 54, 55, 56, 57, 58, 59, 75, 76, 89, 90];
|
|
21698
22350
|
var RISKY_STTB_INDICES = [21, 22, 23];
|
|
21699
22351
|
var SAFE_EXTENDED_FC_LCB_INDICES = /* @__PURE__ */ new Set([93, 94, 113, 181, 182]);
|
|
@@ -21757,6 +22409,42 @@ function encodePieceTextUtf16(text) {
|
|
|
21757
22409
|
view.setUint16(i2 * 2, text.charCodeAt(i2), true);
|
|
21758
22410
|
return bytes;
|
|
21759
22411
|
}
|
|
22412
|
+
function protectedWordRanges(word, table, fib) {
|
|
22413
|
+
const view = new DataView(word.buffer, word.byteOffset, word.byteLength);
|
|
22414
|
+
const extension = fib.fibRgFcLcbOffset + fib.fibRgFcLcbCount * 8;
|
|
22415
|
+
const fibEnd = extension + 2 + view.getUint16(extension, true) * 2;
|
|
22416
|
+
const pages = /* @__PURE__ */ new Set();
|
|
22417
|
+
for (const at2 of [fib.plcfbteChpx, fib.plcfbtePapx]) {
|
|
22418
|
+
if (at2.lcb > 65536 * 8 + 4)
|
|
22419
|
+
throw new DocResourceLimitError("DOC formatting page count exceeds the processing limit");
|
|
22420
|
+
for (const pn of parseBteTable(table, at2).pns) {
|
|
22421
|
+
const start = (pn & 4194303) * 512;
|
|
22422
|
+
if (start > word.length - 512)
|
|
22423
|
+
throw new Error("Formatting page outside WordDocument");
|
|
22424
|
+
pages.add(start);
|
|
22425
|
+
}
|
|
22426
|
+
}
|
|
22427
|
+
const ranges = [[0, fibEnd]];
|
|
22428
|
+
for (const start of [...pages].sort((a, b) => a - b)) {
|
|
22429
|
+
const last = ranges.at(-1);
|
|
22430
|
+
if (start <= last[1])
|
|
22431
|
+
ranges[ranges.length - 1] = [last[0], Math.max(last[1], start + 512)];
|
|
22432
|
+
else
|
|
22433
|
+
ranges.push([start, start + 512]);
|
|
22434
|
+
}
|
|
22435
|
+
return ranges;
|
|
22436
|
+
}
|
|
22437
|
+
function overlapsWordStructure(ranges, start, end) {
|
|
22438
|
+
let low = 0, high = ranges.length;
|
|
22439
|
+
while (low < high) {
|
|
22440
|
+
const middle = low + Math.floor((high - low) / 2);
|
|
22441
|
+
if (ranges[middle][1] <= start)
|
|
22442
|
+
low = middle + 1;
|
|
22443
|
+
else
|
|
22444
|
+
high = middle;
|
|
22445
|
+
}
|
|
22446
|
+
return low < ranges.length && ranges[low][0] < end;
|
|
22447
|
+
}
|
|
21760
22448
|
function readOleDocParagraphs(docBytes, limits) {
|
|
21761
22449
|
try {
|
|
21762
22450
|
const budget = processingLimits(limits);
|
|
@@ -21788,11 +22476,19 @@ function readOleDocParagraphs(docBytes, limits) {
|
|
|
21788
22476
|
return void 0;
|
|
21789
22477
|
}
|
|
21790
22478
|
}
|
|
21791
|
-
function shiftSectionTableCps(tableBytes, sed, editEndCp, delta2) {
|
|
22479
|
+
function shiftSectionTableCps(tableBytes, sed, editEndCp, delta2, storyLength) {
|
|
21792
22480
|
const view = new DataView(tableBytes.buffer, tableBytes.byteOffset, tableBytes.byteLength);
|
|
21793
22481
|
if (sed.lcb < 4 || (sed.lcb - 4) % 16 !== 0 || sed.fc > tableBytes.length - sed.lcb)
|
|
21794
22482
|
throw new Error("Invalid section table");
|
|
21795
22483
|
const n = (sed.lcb - 4) / 16;
|
|
22484
|
+
let previous = -1;
|
|
22485
|
+
for (let i2 = 0; i2 <= n; i2++) {
|
|
22486
|
+
const cp = view.getInt32(sed.fc + i2 * 4, true);
|
|
22487
|
+
const shifted = cp >= editEndCp ? cp + delta2 : cp;
|
|
22488
|
+
if (cp < 0 || cp > storyLength + 1 || cp < previous || shifted < 0 || shifted > 2147483647 || shifted > storyLength + delta2 + 1)
|
|
22489
|
+
throw new Error("Invalid section table character positions");
|
|
22490
|
+
previous = cp;
|
|
22491
|
+
}
|
|
21796
22492
|
for (let i2 = 0; i2 <= n; i2++) {
|
|
21797
22493
|
const off = sed.fc + i2 * 4;
|
|
21798
22494
|
const cp = view.getInt32(off, true);
|
|
@@ -21845,8 +22541,11 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text, limits) {
|
|
|
21845
22541
|
const sanitizedText = text.replaceAll(/[\r\n]+/gu, " ");
|
|
21846
22542
|
if (fib.ccpText - (paragraphEndCp - paragraphStartCp) + sanitizedText.length + 1 > budget.maxCharacters)
|
|
21847
22543
|
return rejected("resource-limit");
|
|
22544
|
+
const mainFields = readFcLcbAt(cfb.wordDocBytes, fib, 16);
|
|
22545
|
+
shiftDocMainFieldCps(cfb.tableBytes, mainFields, bodyText, paragraphStartCp, paragraphEndCp, 0, budget.maxFieldRecords);
|
|
21848
22546
|
if (sanitizedText.length + 1 === paragraphEndCp - paragraphStartCp && bodyText[paragraphEndCp - 1] === "\r") {
|
|
21849
22547
|
const replacement = `${sanitizedText}\r`;
|
|
22548
|
+
const protectedRanges = protectedWordRanges(cfb.wordDocBytes, cfb.tableBytes, fib);
|
|
21850
22549
|
const patched = cfb.wordDocBytes.slice();
|
|
21851
22550
|
let canPatch = true;
|
|
21852
22551
|
for (const piece of pieces) {
|
|
@@ -21858,6 +22557,8 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text, limits) {
|
|
|
21858
22557
|
const unit = piece.compressed ? 1 : 2;
|
|
21859
22558
|
const fc = piece.fc + (start - piece.cpStart) * unit;
|
|
21860
22559
|
const fcEnd = fc + part.length * unit;
|
|
22560
|
+
if (overlapsWordStructure(protectedRanges, fc, fcEnd))
|
|
22561
|
+
return rejected("invalid-document");
|
|
21861
22562
|
if (pieces.some((other) => other !== piece && other.fc < fcEnd && other.fc + (other.cpEnd - other.cpStart) * (other.compressed ? 1 : 2) > fc)) {
|
|
21862
22563
|
canPatch = false;
|
|
21863
22564
|
break;
|
|
@@ -21877,13 +22578,14 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text, limits) {
|
|
|
21877
22578
|
if (hasUnsupportedFeatures(cfb.wordDocBytes, fib))
|
|
21878
22579
|
return rejected("unsupported-features");
|
|
21879
22580
|
const delta2 = sanitizedText.length + 1 - (paragraphEndCp - paragraphStartCp);
|
|
21880
|
-
const
|
|
21881
|
-
|
|
22581
|
+
for (const [targetIndex, target] of [[16, mainFields], [6, fib.sed]]) {
|
|
22582
|
+
if (target.lcb === 0)
|
|
22583
|
+
continue;
|
|
21882
22584
|
for (let index = 0; index < fib.fibRgFcLcbCount; index++) {
|
|
21883
|
-
if (index ===
|
|
22585
|
+
if (index === targetIndex || index === 87)
|
|
21884
22586
|
continue;
|
|
21885
22587
|
const other = readFcLcbAt(cfb.wordDocBytes, fib, index);
|
|
21886
|
-
if (other.lcb > 0 && other.fc <
|
|
22588
|
+
if (other.lcb > 0 && other.fc < target.fc + target.lcb && other.fc + other.lcb > target.fc)
|
|
21887
22589
|
return rejected("invalid-document");
|
|
21888
22590
|
}
|
|
21889
22591
|
}
|
|
@@ -21945,7 +22647,7 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text, limits) {
|
|
|
21945
22647
|
tableOff += papxBteBytes.length;
|
|
21946
22648
|
const newChpxBteFcLcb = { fc: tableOff, lcb: chpxBteBytes.length };
|
|
21947
22649
|
newTableBytes.set(chpxBteBytes, tableOff);
|
|
21948
|
-
shiftSectionTableCps(newTableBytes, fib.sed, paragraphEndCp, delta2);
|
|
22650
|
+
shiftSectionTableCps(newTableBytes, fib.sed, paragraphEndCp, delta2, fib.ccpText);
|
|
21949
22651
|
patchDocFib(newWordDoc, fib, {
|
|
21950
22652
|
ccpText: newCcpText,
|
|
21951
22653
|
cbMac: newWordDocLen,
|
|
@@ -21997,7 +22699,7 @@ function findTextBearingElementById(elements3, elementId) {
|
|
|
21997
22699
|
}
|
|
21998
22700
|
async function loadNestedDeck(pptxBytes) {
|
|
21999
22701
|
try {
|
|
22000
|
-
const { PptxHandler } = await import('./PptxHandler-
|
|
22702
|
+
const { PptxHandler } = await import('./PptxHandler-XCYX5DVX.mjs');
|
|
22001
22703
|
const handler = new PptxHandler();
|
|
22002
22704
|
const data = await handler.load(pptxBytes.buffer.slice(0));
|
|
22003
22705
|
return { handler, slides: data.slides };
|
|
@@ -22044,7 +22746,7 @@ async function writeOleNestedDeckElementText(pptxBytes, slideIndex, elementId, t
|
|
|
22044
22746
|
}
|
|
22045
22747
|
}
|
|
22046
22748
|
|
|
22047
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
22749
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js
|
|
22048
22750
|
var CRC_TABLE = (() => {
|
|
22049
22751
|
const table = new Uint32Array(256);
|
|
22050
22752
|
for (let n = 0; n < 256; n++) {
|
|
@@ -36500,8 +37202,8 @@ function runSmartArtEngine(data, layoutXml, width, height, context) {
|
|
|
36500
37202
|
if (!def) {
|
|
36501
37203
|
return void 0;
|
|
36502
37204
|
}
|
|
36503
|
-
const
|
|
36504
|
-
const tree = buildPresentationTree(def,
|
|
37205
|
+
const model2 = buildDataModel(data.nodes, data.connections);
|
|
37206
|
+
const tree = buildPresentationTree(def, model2.doc, {
|
|
36505
37207
|
direction: data.presLayoutVars?.direction === "rev" ? "rev" : void 0
|
|
36506
37208
|
});
|
|
36507
37209
|
if (!tree) {
|
|
@@ -43010,7 +43712,7 @@ function remapFill(fill, id) {
|
|
|
43010
43712
|
}
|
|
43011
43713
|
return { ...fill, relId: id, sourceXml: buildXml(node) };
|
|
43012
43714
|
}
|
|
43013
|
-
function captureDiagramPictures(
|
|
43715
|
+
function captureDiagramPictures(model2, dataXml, dataParts, drawing) {
|
|
43014
43716
|
const pictures = [];
|
|
43015
43717
|
const parts = { ...dataParts };
|
|
43016
43718
|
const add7 = (source2, owner) => {
|
|
@@ -43035,7 +43737,7 @@ function captureDiagramPictures(model, dataXml, dataParts, drawing) {
|
|
|
43035
43737
|
for (const element of saved) {
|
|
43036
43738
|
const nodeId = element.getAttribute("nodeId");
|
|
43037
43739
|
const fill = first(element, "blipFill", NS.a);
|
|
43038
|
-
if (nodeId && fill &&
|
|
43740
|
+
if (nodeId && fill && model2.nodes.some((node) => node.modelId === nodeId))
|
|
43039
43741
|
add7(
|
|
43040
43742
|
{
|
|
43041
43743
|
nodeId,
|
|
@@ -43046,10 +43748,10 @@ function captureDiagramPictures(model, dataXml, dataParts, drawing) {
|
|
|
43046
43748
|
dataParts
|
|
43047
43749
|
);
|
|
43048
43750
|
}
|
|
43049
|
-
for (const point2 of
|
|
43751
|
+
for (const point2 of model2.points) {
|
|
43050
43752
|
if (point2.fill?.kind !== "picture") continue;
|
|
43051
43753
|
const nodeId = point2.type === "pres" ? point2.presAssocId : point2.modelId;
|
|
43052
|
-
if (nodeId &&
|
|
43754
|
+
if (nodeId && model2.nodes.some((node) => node.modelId === nodeId) && !pictures.some((item2) => item2.nodeId === nodeId))
|
|
43053
43755
|
add7(
|
|
43054
43756
|
{
|
|
43055
43757
|
nodeId,
|
|
@@ -43062,14 +43764,14 @@ function captureDiagramPictures(model, dataXml, dataParts, drawing) {
|
|
|
43062
43764
|
}
|
|
43063
43765
|
for (const shape of drawing?.shapes ?? []) {
|
|
43064
43766
|
if (shape.fill?.kind !== "picture") continue;
|
|
43065
|
-
const point2 =
|
|
43767
|
+
const point2 = model2.points.find((point3) => point3.modelId === shape.modelId);
|
|
43066
43768
|
const nodeId = shape.sourceNodeId ?? (point2?.type === "pres" ? point2.presAssocId : point2?.modelId);
|
|
43067
43769
|
const part = shape.fill.relId ? drawing?.pictureParts?.[shape.fill.relId] : void 0;
|
|
43068
43770
|
if (saved.length && pictures.some(
|
|
43069
43771
|
(item2) => item2.nodeId === nodeId && item2.fill.relId && parts[item2.fill.relId] === part && item2.role !== point2?.presName && item2.styleLabel !== point2?.presStyleLabel
|
|
43070
43772
|
))
|
|
43071
43773
|
continue;
|
|
43072
|
-
if (nodeId &&
|
|
43774
|
+
if (nodeId && model2.nodes.some((node) => node.modelId === nodeId))
|
|
43073
43775
|
add7(
|
|
43074
43776
|
{
|
|
43075
43777
|
nodeId,
|
|
@@ -44597,7 +45299,7 @@ var DataIntegrityError = class extends Error {
|
|
|
44597
45299
|
}
|
|
44598
45300
|
};
|
|
44599
45301
|
|
|
44600
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
45302
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js
|
|
44601
45303
|
function getSubtle() {
|
|
44602
45304
|
if (typeof globalThis.crypto !== "undefined" && globalThis.crypto.subtle) {
|
|
44603
45305
|
return globalThis.crypto.subtle;
|
|
@@ -57946,6 +58648,125 @@ function getCustomShowPositionLabel(currentSlideIndex, filteredIndices) {
|
|
|
57946
58648
|
return `${pos + 1} of ${filteredIndices.length}`;
|
|
57947
58649
|
}
|
|
57948
58650
|
|
|
58651
|
+
// pptx/core/utils/custom-show-actions.ts
|
|
58652
|
+
var UNSIGNED_INT_MAX = 4294967295;
|
|
58653
|
+
function isUnsignedInt(id) {
|
|
58654
|
+
return /^\d+$/.test(id) && Number(id) <= UNSIGNED_INT_MAX;
|
|
58655
|
+
}
|
|
58656
|
+
function normalizeCustomShowIds(shows) {
|
|
58657
|
+
const used = /* @__PURE__ */ new Set();
|
|
58658
|
+
let max = -1;
|
|
58659
|
+
for (const show of shows) {
|
|
58660
|
+
if (isUnsignedInt(show.id) && !used.has(show.id)) {
|
|
58661
|
+
used.add(show.id);
|
|
58662
|
+
max = Math.max(max, Number(show.id));
|
|
58663
|
+
}
|
|
58664
|
+
}
|
|
58665
|
+
const kept = /* @__PURE__ */ new Set();
|
|
58666
|
+
const idMap = /* @__PURE__ */ new Map();
|
|
58667
|
+
const next = shows.map((show) => {
|
|
58668
|
+
if (isUnsignedInt(show.id) && !kept.has(show.id)) {
|
|
58669
|
+
kept.add(show.id);
|
|
58670
|
+
return show;
|
|
58671
|
+
}
|
|
58672
|
+
const id = String(++max);
|
|
58673
|
+
if (!idMap.has(show.id)) {
|
|
58674
|
+
idMap.set(show.id, id);
|
|
58675
|
+
}
|
|
58676
|
+
return { ...show, id };
|
|
58677
|
+
});
|
|
58678
|
+
return {
|
|
58679
|
+
shows: idMap.size > 0 || next.some((s, i2) => s !== shows[i2]) ? next : [...shows],
|
|
58680
|
+
idMap
|
|
58681
|
+
};
|
|
58682
|
+
}
|
|
58683
|
+
function customShowActionId(action) {
|
|
58684
|
+
if (!action || !action.toLowerCase().includes("ppaction://customshow")) {
|
|
58685
|
+
return void 0;
|
|
58686
|
+
}
|
|
58687
|
+
const match = action.match(/[?&]id=([^&]*)/i);
|
|
58688
|
+
return match ? decodeURIComponent(match[1]) : void 0;
|
|
58689
|
+
}
|
|
58690
|
+
function rewriteAction(action, rewrite) {
|
|
58691
|
+
const id = customShowActionId(action);
|
|
58692
|
+
if (id === void 0) {
|
|
58693
|
+
return { changed: false, action };
|
|
58694
|
+
}
|
|
58695
|
+
const next = rewrite(id);
|
|
58696
|
+
if (next === id) {
|
|
58697
|
+
return { changed: false, action };
|
|
58698
|
+
}
|
|
58699
|
+
return {
|
|
58700
|
+
changed: true,
|
|
58701
|
+
action: next === null ? void 0 : action.replace(/([?&]id=)[^&]*/i, `$1${encodeURIComponent(next)}`)
|
|
58702
|
+
};
|
|
58703
|
+
}
|
|
58704
|
+
function mapElement(element, rewrite) {
|
|
58705
|
+
let changed = 0;
|
|
58706
|
+
let next = element;
|
|
58707
|
+
const edit = () => {
|
|
58708
|
+
if (next === element) {
|
|
58709
|
+
next = { ...element };
|
|
58710
|
+
}
|
|
58711
|
+
return next;
|
|
58712
|
+
};
|
|
58713
|
+
for (const key of ["actionClick", "actionHover"]) {
|
|
58714
|
+
const current = element[key];
|
|
58715
|
+
const result = rewriteAction(current?.action, rewrite);
|
|
58716
|
+
if (current && result.changed) {
|
|
58717
|
+
changed++;
|
|
58718
|
+
if (result.action === void 0) {
|
|
58719
|
+
delete edit()[key];
|
|
58720
|
+
} else {
|
|
58721
|
+
edit()[key] = { ...current, action: result.action };
|
|
58722
|
+
}
|
|
58723
|
+
}
|
|
58724
|
+
}
|
|
58725
|
+
const segments = "textSegments" in element ? element.textSegments : void 0;
|
|
58726
|
+
if (segments?.some((s) => customShowActionId(s.style?.hyperlinkAction) !== void 0)) {
|
|
58727
|
+
edit().textSegments = segments.map((segment) => {
|
|
58728
|
+
const result = rewriteAction(segment.style?.hyperlinkAction, rewrite);
|
|
58729
|
+
if (!result.changed) {
|
|
58730
|
+
return segment;
|
|
58731
|
+
}
|
|
58732
|
+
changed++;
|
|
58733
|
+
if (result.action !== void 0) {
|
|
58734
|
+
return { ...segment, style: { ...segment.style, hyperlinkAction: result.action } };
|
|
58735
|
+
}
|
|
58736
|
+
const {
|
|
58737
|
+
hyperlink: _h,
|
|
58738
|
+
hyperlinkRId: _r,
|
|
58739
|
+
hyperlinkTooltip: _t,
|
|
58740
|
+
hyperlinkAction: _a,
|
|
58741
|
+
hyperlinkTargetSlideIndex: _i,
|
|
58742
|
+
...style
|
|
58743
|
+
} = segment.style;
|
|
58744
|
+
return { ...segment, style };
|
|
58745
|
+
});
|
|
58746
|
+
}
|
|
58747
|
+
if (element.type === "group") {
|
|
58748
|
+
const children6 = element.children.map((child14) => mapElement(child14, rewrite));
|
|
58749
|
+
if (children6.some((c) => c.changed > 0)) {
|
|
58750
|
+
edit().children = children6.map((c) => c.element);
|
|
58751
|
+
changed += children6.reduce((n, c) => n + c.changed, 0);
|
|
58752
|
+
}
|
|
58753
|
+
}
|
|
58754
|
+
return { element: next, changed };
|
|
58755
|
+
}
|
|
58756
|
+
function mapCustomShowActions(slides, rewrite) {
|
|
58757
|
+
let changed = 0;
|
|
58758
|
+
const next = slides.map((slide) => {
|
|
58759
|
+
const results = slide.elements.map((element) => mapElement(element, rewrite));
|
|
58760
|
+
const n = results.reduce((sum, r) => sum + r.changed, 0);
|
|
58761
|
+
if (n === 0) {
|
|
58762
|
+
return slide;
|
|
58763
|
+
}
|
|
58764
|
+
changed += n;
|
|
58765
|
+
return { ...slide, elements: results.map((r) => r.element) };
|
|
58766
|
+
});
|
|
58767
|
+
return { slides: next, changed };
|
|
58768
|
+
}
|
|
58769
|
+
|
|
57949
58770
|
// pptx/core/utils/table-style-resolver.ts
|
|
57950
58771
|
function mergeBorder(base, override) {
|
|
57951
58772
|
if (!base && !override) {
|
|
@@ -67229,4 +68050,4 @@ async function blobUrlToDataUrl(blobUrl, fallbackMimeType) {
|
|
|
67229
68050
|
}
|
|
67230
68051
|
}
|
|
67231
68052
|
|
|
67232
|
-
export { ALL_ANIMATION_PRESETS, ARABIC_ABJADI_LETTERS, ARABIC_HIJAI_LETTERS, ARTISTIC_PRIMARY_ATTRIBUTE, BACKGROUND_STYLE_PRESETS, BLIP_FILL_ORDER, CAMERA_PRESETS, CHART_ERROR_BAR_DIRECTIONS, CHART_ERROR_BAR_TYPES, CHART_ERROR_VALUE_TYPES, CLOUD_CALLOUT_TAIL_COUNT, CLOUD_LOBE_COUNT, COLOR_MAP_ALIAS_KEYS, CONNECTOR_ARROW_OPTIONS, CONNECTOR_GEOMETRY_OPTIONS, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, DEFAULT_CHART_GRADIENT_ANGLE, DEFAULT_COLOR_MAP, DEFAULT_FILL_COLOR, DEFAULT_FONT_FAMILY, DEFAULT_GENERATED_DIAGRAM_SCHEME, DEFAULT_SCHEME_COLOR_MAP, DEFAULT_STROKE_COLOR, DEFAULT_TEXT_COLOR, DEFAULT_TEXT_FONT_SIZE, DIAGRAM_DATA_XMLNS, DIAGRAM_DRAWING_CONTENT_TYPE, DIAGRAM_DRAWING_REL_TYPE, DIAGRAM_XML_PROLOG, DataIntegrityError, EFFECT_LST_ORDER, ELEMENT_FIELD_KIND, EMPHASIS_PRESETS, EMPTY_CONSTRAINT_INDEX, EMU_PER_INCH, EMU_PER_PIXEL, EMU_PER_POINT, EMU_PER_PX, ENTRANCE_PRESETS, ENTRY_TYPE_ROOT, EXIT_PRESETS, EncryptedFileError, FONT_SUBSTITUTION_MAP, FreeformPathBuilder, GENERATED_DIAGRAM_CACHE_NS, HEBREW_LETTERS, HINDI_CONSONANTS, HINDI_VOWELS, IncorrectPasswordError, LIGHT_DIRECTIONS, LIGHT_RIGS, LN_CHILD_ORDER, MAX_SHAPE_ID, MAX_TABLE_DIMENSION, MIN_ELEMENT_SIZE, MIN_TABLE_DIMENSION, MOTION_PATH_PRESETS, NS, OOXML_ANGLE_UNITS_PER_DEGREE, OOXML_PERCENT_UNITS, Ole2ParseError, P14_DIR_IS_ORIENTATION_TYPE, P14_GUIDE_URI, P14_TRANSITION_TYPES, P15_GUIDE_URI, PANOSE_FAMILY_MAP, PANOSE_MONOSPACE_PROPORTION, PANOSE_SANS_SERIF_STYLES, PANOSE_WEIGHT_MAP, PML_XMLNS, POWERPOINT_PRESENCE_KEY, PPTX_JSON_FILE_EXTENSION, PPTX_JSON_FORMAT, PPTX_JSON_MIME_TYPE, PPTX_JSON_VERSION, PRESENTATION_CHILD_ORDER, PRESENTATION_FIELD_KEYS, PRESENTATION_FIELD_NAMES, PRESET_COLOR_MAP, PRESET_GEOMETRY_ALIASES, PRESET_SHAPE_CATEGORY_LABELS, PRESET_SHAPE_CLIP_PATHS, PRESET_SHAPE_DEFINITIONS, PRESET_SHAPE_GEOMETRY_TABLE, PptxJsonConverter, PptxJsonFormatError, RC4_ALG_ID, RELATIONSHIP_TYPES, RUN_PROPERTIES_ORDER, RasterCanvas, SHAPE_STYLE_ORDER, SHAPE_TREE_ELEMENT_TAGS, SLIDE_FIELD_KIND, SMART_ART_DEFINITION_PARTS, SP_PR_ORDER2 as SP_PR_ORDER, STROKE_DASH_OPTIONS, STYLE_MATRIX_EFFECT_KEYS, STYLE_MATRIX_FILL_KEYS, STYLE_MATRIX_LINE_KEYS, ST_SHAPE_TYPE_VALUES, SWITCHABLE_LAYOUT_TYPES, SYSTEM_COLOR_MAP, SvgExporter, TC_PR_BORDERS_ORDER, TEXT_AUTONUMBER_SCHEMES, TEXT_ORIENTATION_IDENTITY, THAI_CONSONANTS, THEME_COLOR_SCHEME_KEYS, THEME_EFFECT_SCHEMES, VML_SHAPE_TAGS, WHITESPACE_PRESERVING_TAGS, addSmartArtNode, addSmartArtNodeAbove, addSmartArtNodeAsChild, addSmartArtNodeBefore, algorithmParam, alphaLabel, annotateCustomGeometryCommandOrder, annotateSmartArtTextOrder, appendInSchemaOrder, applyActiveXControlsToSlide, applyBubbleChartOptions, applyCellWritesToWorksheet, applyChartAxisDisplayUnitsToXml, applyChartAxisLabelFormatting, applyChartAxisScaling, applyChartDateAxisUnits, applyChartGradientToSpPr, applyChartLayouts, applyChartManualLayout, applyChartUpDownBars, applyCommentMentions, applyCustomGeometryGuideOverrides, applyCustomLayoutOverrides, applyCustomShows, applyDataLabelsRangeToDLbls, applyDiagramRelationshipIds, applyDrawingLineDash, applyDrawingMediaReference, applyImportedPptxData, applyKinsokuToXml, applyOleDocumentParagraphEdit, applyOleNestedDeckBytes, applyOleNestedDeckElementTextEdit, applyOleSheetCellEdit, applySections, applySeriesDataPointsToXml, applySeriesMarkerToXml, applySeriesPictureOptionsToXml, applySmartArtQuickStyle3d, applySmartArtRoleColors, applyTextBodySp3d, applyThemeOverrideToSlide, applyThemeToData, areNamespacesSupported, arrangeComposite3 as arrangeComposite, arrangeConn2 as arrangeConn, arrangeCycle, arrangeHierarchy2 as arrangeHierarchy, arrangeLinear3 as arrangeLinear, arrangePyramid, arrangeSnake, arrangeSpacer, arrangeText, attr, avLstForPreset, backgroundRefNode, backgroundRefNodeForPreset, backgroundStyleColorMap, backgroundStylePreset, backgroundStylePresetFor, backgroundStyleRefIsCurrent, base64Decode, base64ToBytes, bijectiveLabel, blobUrlToDataUrl, buildActiveXControlNode, buildCalloutLeaderLineSvgPath, buildChartGradFillXml, buildChartMarkerXml, buildChartUniqueIdExtLst, buildClrMapOverrideXml, buildColorMapForBackgroundPair, buildConstraintIndex, buildCustomGeometryPathsFromNodes, buildDefRPrTextProperties, buildEffectDagTreeFromXml, buildFabricatedDiagramDataXml, buildFabricatedDrawingXml, buildFontFamilyString, buildForest, buildGuideListExtension, buildInkMlContent, buildLinkedTextBoxChains, buildNodeGuidMap, buildOle2, buildPointFromParagraphs, buildPointFromRuns, buildPointText, buildPptxJsonDocument, buildPresentationGuidMap, buildRelationshipsXml, buildSaveTimeCustomGeometryXml, buildSmartArtColorLists, buildSmartArtColorRoleMap, buildSrgbColorChoice, buildThemeColorMap, buildTree, buildTrendlineLabel, buildXml, bytesToBase64, captureDiagramPictures, captureStyleBaseline, catmullRomToBezier, chartColorChoiceValue, chartColorHex, chartDataAddCategory, chartDataAddSeries, chartDataApplySheetEdit, chartDataApplySheetEdits, chartDataChangeType, chartDataRemoveCategory, chartDataRemoveSeries, chartDataToSheet, chartDataUpdatePoint, chartGradientsEqual, chartGridAddCategory, chartGridAddSeries, chartGridRemoveCategory, chartGridRemoveSeries, chartGridSetCategoryLabel, chartGridSetCellValue, chartTrendlineKind, chartTrendlineType, checkBlankSlide, checkComplexTables, checkDuplicateTitles, checkLowContrast, checkMissingAltText, checkMissingSlideTitle, checkPresentation, chevronPoints, childNamed, children2 as children, childrenNamed, chooseAlgType2 as chooseAlgType, circleNode, clampByRules, classifyPanose, collectAllText, collectTransitionText, colorsEqual, colour, combineShapes, computeContrastRatio, computeSmartArtElementsWithoutCache, concatArrays, connectionLabel, containsConvertibleStrictNamespaceAttribute, convertMetafileToDataUrl, convertXmlToStrict, createArrayBufferCopy, createBuiltinVariables, createDrawingObjectId, createEditorId, createLineStyleGate, createModifyVerifier, createOfficeGuid, createSaltlessModifyVerifierForTesting, createTemplateConnectorRawXml, createTemplateShapeRawXml, createUniformTextSegments, cropShapeForPresetGeometry, cssDegreesToOoxmlGradientAngle, customGeometryPathsToSvgSubpaths, decodeBase64, decodeJsonValue, decodeOle10Native, decodePngDimensions, decodePptxJsonText, decodeXmlEntities, decomposeSmartArt, decryptPptx, demoteSmartArtNode, deobfuscateFont, deriveSlideTitle, deriveSlideTitles, descendants2 as descendants, deserializePptxFromJson, detectDigitalSignatures, detectFileFormat, detectFontFormat, detectOleObjectType, detectOlePayloadEditorKind, detectStrictConformance, diagramPictureRelationships, discoverArrangement2 as discoverArrangement, distributeSegmentsAcrossChain, douglasPeucker, drawingColorXml, drawingEffectsXml, drawingFillXml, drawingLineXml, effectChild, effectIsPurelyStyleMatrix, elementActionToPptxAction, elementHasAction, elements, emu, encodeCompressedPng, encodeJsonValue, encodeOle10Native, encodePasswordUtf16LE, encodePng, encodeXmlAttributeValue, encodeXmlTextValue, encryptPptx, ensureArrayValue, ensureXmlChild, ensureXmlChildOrCreate, ensureXmlChildren, esc, escAttr, escText, escapeDiagramXml, estimateMediaDurationMs, estimateTextBoxCapacity, evaluateCustomGeometryPathData, evaluateCustomGeometryPaths, evaluateGeometryPaths, evaluateGuides, evaluatePresetShape, expandRangeAddresses, extractColorChoiceXml, extractCxSeriesColor, extractGuidFromPartName, extractModel3DTransform, extractStyleReferenceColorXml, fetchUrlToBytes, fillElementOf, fillIsPurelyStyleMatrix, filterValidShapeAdjustmentEntries, findChartExtByUri, findChildByLocalName, findCnvPrNode, findConstraint, findCustomShow, findKey6 as findKey, findThemeEffectScheme, findThemeEffectSchemeByName, first, firstParagraphRuns, fitFontSize, flattenChartUserShapes, flattenNodes, formatAutoNumberMarker, formatCellAddress, formatCommentTimestamp, formatSchemeKey, formatScriptAutoNumber, fragmentShapes, gearPoints, generateFontGuid, generatedDrawingDigest, getAdjustmentAwareClipPath, getAdjustmentAwareShapeClipPath, getAnimationPresetInfo, getCalloutLeaderLineGeometry, getCalloutTier, getCalloutViewBoxBounds, getCloudCalloutClipPath, getCloudClipPath, getCloudPathForRendering, getCommentMarkerPosition, getConnectorAdjustment, getConnectorPathGeometry, getCssBorderDashStyle, getCustomShowNames, getCustomShowPositionLabel, getElementLabel, getElementOrientationMatrix, getElementTextContent, getElementTransform, getImageMaskStyle, getLinkedTextBoxSegments, getNativeAnimationPresetMetadata, getOleDocumentParagraphs, getOleNestedDeckBytes, getOleNestedDeckDetail, getOleObjectTypeLabel, getOleSheetGrid, getPanoseWeight, getPresetConnectionSites, getPresetShapeClipPath, getPresetTextRect, getPresetsByCategory, getRoundRectRadiusPx, getSectionSlideRange, getShapeClipPath, getShapeClipPathFromPreset, getShapeType, getSignaturePathsToStrip, getSubstituteFontFamily, getSubstituteFonts, getSupportedNamespaces, getSvgStrokeDasharray, getTextCompensationTransform, getZoomElements, getZoomTargetSlideIndexes, gradFill, groupElements, guidToKey, guideEmuToPx, guidePxToEmu, hasDirectSubstitution, hasLocalName, hasNonTrivialOverride, hasReference, hasShapeProperties, hasTextProperties, hash, hebrewAlphaLabel, inferOleExtensionFromTarget, inheritCustomGeometryCommandOrder, inheritedPlaceholderFieldType, inkBounds, inkElementToStrokes, inkLengthToPx, inkPointMapper, insertAt2 as insertAt, interpretSmartArtLayout2 as interpretSmartArtLayout, interpretedLayoutToElements, intersectPolygons, intersectShapes, intersectSvgPaths, isAlternateContentChoiceSupported, isAlternateContentChoiceXmlSupported, isCalloutShape, isConnectorElement, isContentPoint, isDarkColorMap, isDefaultSmartArtLabelScene, isEditableTextElement, isHeaderFooterPlaceholder, isImageLikeElement, isInkElement, isNamespaceSupported, isOle2CompoundFile, isParetoChartData, isPptxJsonText, isShapeElement, isStShapeType, isStrictNamespaceUri, isSummaryZoomSlide, isSwitchableLayoutType, isTemplateElement, isTemplateElementId, isTextElement, isTextOrientationMatrix, isTransitionalNamespaceUri, isXmlNode, isZoomElement, isZoomElement2, itemNode, loadThemeVariants, lookupPresetConnectionSites, lookupPresetShape, lookupPresetTextRectOverride, makeStoreAwareId, mergeAttributeEffectNode, mergeEffectNode, mergeShapes, mergeSmartArtConnectionXml, mergeSmartArtPointXml, mergeStyleParts, mergeThemeColorOverride, mimeTypeForOleFile, multiplyTextOrientationMatrices, navigateCustomShow, newSmartArtGuid, nextRelationshipId, nodeFill, nodeOpacity, nodeStroke, nodeTextStyle, normalizeNamespaceUri, normalizePositiveFixedAngleDegrees, normalizeStShapeType, normalizeStrictXml, normalizeStrokeDashType, numericParam, obfuscateFont, oleBytesToDataUrl, oleObjectTypeToGlyph, ooxmlArcToSvg, ooxmlGradientAngleToCssDegrees, orderedXmlKey, parseActiveXControlsFromSlide, parseAdjustmentValues, parseAlignmentAttr, parseBodyPrBooleanAttrs, parseBubbleChartOptions, parseBulletSizePercent, parseCellAddress, parseChart3DSurfaces, parseChartAxes, parseChartDataLabelOptions, parseChartDataPointPicture, parseChartDataPointPictureBlipRel, parseChartFormulaRange, parseChartLayouts, parseChartManualLayout, parseChartUniqueId, parseChartUpDownBars, parseChartUserShapesDrawing, parseChartWideTextStyle, parseCustomShows, parseCxAxes, parseCxChartSeries, parseCxDataLabels, parseCxRegionMapOptions, parseDataTable, parseDataUrlToBytes, parseDefRPrTextStyle, parseDiagramColors, parseDiagramDataModel, parseDiagramDrawing, parseDiagramLayoutSummary, parseDiagramQuickStyle, parseDiagramRelationshipIds, parseDrawingColor, parseDrawingColorChoice, parseDrawingColorIn, parseDrawingColorOpacity, parseDrawingEffects, parseDrawingFill, parseDrawingLine, parseDrawingLineDash, parseDrawingMediaReference, parseDrawingRichTextBody, parseDrawingTextBody, parseEmbeddedXlsx, parseEncryptionInfo, parseGuideDefinitions, parseHexColor, parseImplicitBlipPictureFill, parseInkMlContent, parseKinsoku, parseLineSpacingExactPt, parseLineSpacingMultiplier, parseLineStyle, parseMarker, parseModel3DScene, parseOle2, parseP14DirectChild, parseP14FromExtLst, parsePanoseBytes, parsePanoseString, parseParagraphExtraAttributes, parseParagraphLevel, parseParagraphMargins, parseParagraphRtl, parseParagraphSpacingPx, parsePptxJson, parsePptxJsonDocument, parsePresentationDrawingGuides, parsePresentationSmartTags, parseRelationships, parseSeriesDataLabels, parseSeriesDataPoints, parseSeriesErrBars, parseSeriesExplosion, parseSeriesTrendlines, parseShapeId, parseShapeProps, parseSignatureXml, parseSlideDrawingGuides, parseSmartArtColorListHexes, parseSmartArtColorStyleLabels, parseSmartArtConnection, parseSmartArtDefinitionHeaderList, parseSmartArtDefinitionMetadata, parseSmartArtPointCustomLayout, parseSmartArtPresLayoutVars, parseSmartArtQuickStyleLabels, parseSmartArtStyleLabelRefs, parseSmartArtTextParagraphs, parseStructuredCustomGeometry, parseTabStops, parseVmlElement, parseVmlElements, parseXml, patchDrawingColorIn, patchDrawingLine, picturePercentage, polygonNode, polygonsToSvgPath, positiveFixedAngleAttribute, pptxActionToElementAction, pptxDataFromJsonDocument, preservesSpreadsheetXmlWhitespace, preservesXmlWhitespace, presetGeometryForCropShape, previewDiagramLayout, prismFamilyFlags, prismFamilyTypeForFlags, prismFamilyTypeOfNode, projectSmartArtNodeText, promoteSmartArtNode, ratioConstraint, reResolveElementColors, reResolveElementFonts, reResolveElementsForColorMapChange, reResolveSlideColors, reResolveSlideFonts, readChartManualLayoutValues, readCommentMentions, readFileAsDataUrl, readOleDocParagraphs, readOleDocumentParagraphs, readOleNestedDeckDetail, readOleNestedDeckFirstSlideTextLines, readOleSheetGrid, readOleXlsGrid, readPathListCommandOrder, readPictureEffect, readScene3DValues, readText3DValues, reapplyAlternateContentToTree, reassignDescendantIds, rebaseCommentMentions, rectNode, reflowSmartArtLayout, reflowSmartArtPictures, regenerateClonedUniqueId, regenerateSmartArtDrawingShapes, relAttr, relationshipsPartFor, relativeLuminance, relayoutSmartArt, remapElementShapeIds, remapShapeIdReferences, removeSmartArtNode, renderOleDeckPreviewPng, renderOleDocumentPreviewPng, renderOleIconPng, renderOleSheetPreviewPng, reorderObjectKeys, reorderObjectKeysByLocalName, reorderSmartArtNode, reorderSmartArtNodeToIndex, repairPptx, repeatedLabel, replaceFirstText, replaceOleEmbedding, replaceOleFile, resetDecomposeCounter, resetSmartArtEditCounter, resetSpPrFormattingForStyleMatrix, resolveConstraint, resolveConstraintDeclaredBy, resolveCoordinate, resolveCustomGeometryGuideContext, resolveCustomGeometryToken, resolveCustomShowSlideIndices, resolveDisplayedChartTypeName, resolveDrawingColor, resolveFlowDirection, resolveLayoutDisplayName, resolveModel3DMimeType, resolveModifyVerifierAlgorithmName, resolveOleEditorKindFromPayload, resolveParagraphAlignment, resolvePartPath, resolveRatioConstraint, resolveSmartArtEffectIntensity, resolveSmartArtNodeCoherent3DOff, resolveSmartArtNodeStyleRoles, resolveTableCellStyle, resolveThemeEffectStyle, resolveThemeFillStyle, resolveThemeLineStyle, resolveTxPrDefRPr, rgb, roleOf, romanNumeral, roundCoordinate, safeResolveZipPath, sampleFirstPixelColorFromBytes, scaleVectorToIntegers, selectAlternateContentBranch, selectArrangedNodes, serializeColorChoice, serializeColorChoiceWithRef, serializePptxToJson, serializeSmartArtDefinitionHeaderList, serializeTabStop, setAutoTitleDeleted, setDrawingFillXml, setOleObjectName, setSmartArtNodeStyle, shadowOffsetToDistanceAndDirection, shouldRebuildFromParagraphs, shouldRebuildFromRuns, shouldRenderFallbackLabel, shouldReturnToZoomSlide, slideBackgroundStyleRefFromNode, smartArtParagraphsText, smartArtQuickStyleHas3d, solidFill, stripParentDirSegments, stripXmlOrderMarkers, stripXmlOrderSuffix, strokeFor, styleContext, styleShadow, styleStroke, subtractPolygons, subtractShapes, subtractSvgPaths, supportsChartGradientFill, svgPathToPolygons, svgToCustomGeometryPaths, switchSmartArtLayout, syncPictureShapeTypeWithCropShape, themeColorSchemesEqual, toArabicAbjadNumeral, toChineseNumeral, toCjkDigitString, toDevanagariDigits, toEa1ChsNumeral, toEa1ChtNumeral, toFullWidthDigits, toHebrewNumeral, toStrictNamespaceUri, toThaiDigits, treeDepth, treeWidth, truncate, uint32LE, ungroupElements, unionPolygons, unionShapes, unionSvgPaths, unwrapAlternateContent, unwrapOleEmbedding, updateSmartArtNodeText, upsertChartAxisChild, validatePptx, validateSmartArtColorStyleLabels, validateSmartArtDefinitionHeaderList, validateSmartArtDefinitionMetadata, verifyModifyPassword, verifyPassword, verifySignatureDigests, visitXmlObjects, withDiagramPictureSources, withThemePlaceholderColor, worksheetData, wrapFormatSchemeXml, writeBodyPrBooleanAttrs, writeChartColorChoice, writeChartShapeProps, writeGeneratedDiagramDrawing, writeOleDocParagraphEdit, writeOleDocumentParagraphEdit, writeOleNestedDeckElementText, writeOleSheetCellEdit, writeOleXlsNumericCellEdit, writeOleXlsStringCellEdit, writeShapeEffects, xmlAttr, xmlAttrBool, xmlAttrNumber, xmlChild, xmlChildren, xmlHasChild, xmlPath, xmlText, zlibDeflate, zlibStore };
|
|
68053
|
+
export { ALL_ANIMATION_PRESETS, ARABIC_ABJADI_LETTERS, ARABIC_HIJAI_LETTERS, ARTISTIC_PRIMARY_ATTRIBUTE, BACKGROUND_STYLE_PRESETS, BLIP_FILL_ORDER, CAMERA_PRESETS, CHART_ERROR_BAR_DIRECTIONS, CHART_ERROR_BAR_TYPES, CHART_ERROR_VALUE_TYPES, CLOUD_CALLOUT_TAIL_COUNT, CLOUD_LOBE_COUNT, COLOR_MAP_ALIAS_KEYS, CONNECTOR_ARROW_OPTIONS, CONNECTOR_GEOMETRY_OPTIONS, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, DEFAULT_CHART_GRADIENT_ANGLE, DEFAULT_COLOR_MAP, DEFAULT_FILL_COLOR, DEFAULT_FONT_FAMILY, DEFAULT_GENERATED_DIAGRAM_SCHEME, DEFAULT_SCHEME_COLOR_MAP, DEFAULT_STROKE_COLOR, DEFAULT_TEXT_COLOR, DEFAULT_TEXT_FONT_SIZE, DIAGRAM_DATA_XMLNS, DIAGRAM_DRAWING_CONTENT_TYPE, DIAGRAM_DRAWING_REL_TYPE, DIAGRAM_XML_PROLOG, DataIntegrityError, EFFECT_LST_ORDER, ELEMENT_FIELD_KIND, EMPHASIS_PRESETS, EMPTY_CONSTRAINT_INDEX, EMU_PER_INCH, EMU_PER_PIXEL, EMU_PER_POINT, EMU_PER_PX, ENTRANCE_PRESETS, ENTRY_TYPE_ROOT, EXIT_PRESETS, EncryptedFileError, FONT_SUBSTITUTION_MAP, FreeformPathBuilder, GENERATED_DIAGRAM_CACHE_NS, HEBREW_LETTERS, HINDI_CONSONANTS, HINDI_VOWELS, IncorrectPasswordError, LIGHT_DIRECTIONS, LIGHT_RIGS, LN_CHILD_ORDER, MAX_SHAPE_ID, MAX_TABLE_DIMENSION, MIN_ELEMENT_SIZE, MIN_TABLE_DIMENSION, MOTION_PATH_PRESETS, NS, OOXML_ANGLE_UNITS_PER_DEGREE, OOXML_PERCENT_UNITS, Ole2ParseError, P14_DIR_IS_ORIENTATION_TYPE, P14_GUIDE_URI, P14_TRANSITION_TYPES, P15_GUIDE_URI, PANOSE_FAMILY_MAP, PANOSE_MONOSPACE_PROPORTION, PANOSE_SANS_SERIF_STYLES, PANOSE_WEIGHT_MAP, PML_XMLNS, POWERPOINT_PRESENCE_KEY, PPTX_JSON_FILE_EXTENSION, PPTX_JSON_FORMAT, PPTX_JSON_MIME_TYPE, PPTX_JSON_VERSION, PRESENTATION_CHILD_ORDER, PRESENTATION_FIELD_KEYS, PRESENTATION_FIELD_NAMES, PRESET_COLOR_MAP, PRESET_GEOMETRY_ALIASES, PRESET_SHAPE_CATEGORY_LABELS, PRESET_SHAPE_CLIP_PATHS, PRESET_SHAPE_DEFINITIONS, PRESET_SHAPE_GEOMETRY_TABLE, PptxJsonConverter, PptxJsonFormatError, RC4_ALG_ID, RELATIONSHIP_TYPES, RUN_PROPERTIES_ORDER, RasterCanvas, SHAPE_STYLE_ORDER, SHAPE_TREE_ELEMENT_TAGS, SLIDE_FIELD_KIND, SMART_ART_DEFINITION_PARTS, SP_PR_ORDER2 as SP_PR_ORDER, STROKE_DASH_OPTIONS, STYLE_MATRIX_EFFECT_KEYS, STYLE_MATRIX_FILL_KEYS, STYLE_MATRIX_LINE_KEYS, ST_SHAPE_TYPE_VALUES, SWITCHABLE_LAYOUT_TYPES, SYSTEM_COLOR_MAP, SvgExporter, TC_PR_BORDERS_ORDER, TEXT_AUTONUMBER_SCHEMES, TEXT_ORIENTATION_IDENTITY, THAI_CONSONANTS, THEME_COLOR_SCHEME_KEYS, THEME_EFFECT_SCHEMES, VML_SHAPE_TAGS, WHITESPACE_PRESERVING_TAGS, addSmartArtNode, addSmartArtNodeAbove, addSmartArtNodeAsChild, addSmartArtNodeBefore, algorithmParam, alphaLabel, annotateCustomGeometryCommandOrder, annotateSmartArtTextOrder, appendInSchemaOrder, applyActiveXControlsToSlide, applyBubbleChartOptions, applyCellWritesToWorksheet, applyChartAxisDisplayUnitsToXml, applyChartAxisLabelFormatting, applyChartAxisScaling, applyChartDateAxisUnits, applyChartGradientToSpPr, applyChartLayouts, applyChartManualLayout, applyChartUpDownBars, applyCommentMentions, applyCustomGeometryGuideOverrides, applyCustomLayoutOverrides, applyCustomShows, applyDataLabelsRangeToDLbls, applyDiagramRelationshipIds, applyDrawingLineDash, applyDrawingMediaReference, applyImportedPptxData, applyKinsokuToXml, applyOleDocumentParagraphEdit, applyOleNestedDeckBytes, applyOleNestedDeckElementTextEdit, applyOleSheetCellEdit, applySections, applySeriesDataPointsToXml, applySeriesMarkerToXml, applySeriesPictureOptionsToXml, applySmartArtQuickStyle3d, applySmartArtRoleColors, applyTextBodySp3d, applyThemeOverrideToSlide, applyThemeToData, areNamespacesSupported, arrangeComposite3 as arrangeComposite, arrangeConn2 as arrangeConn, arrangeCycle, arrangeHierarchy2 as arrangeHierarchy, arrangeLinear3 as arrangeLinear, arrangePyramid, arrangeSnake, arrangeSpacer, arrangeText, attr, avLstForPreset, backgroundRefNode, backgroundRefNodeForPreset, backgroundStyleColorMap, backgroundStylePreset, backgroundStylePresetFor, backgroundStyleRefIsCurrent, base64Decode, base64ToBytes, bijectiveLabel, blobUrlToDataUrl, buildActiveXControlNode, buildCalloutLeaderLineSvgPath, buildChartGradFillXml, buildChartMarkerXml, buildChartUniqueIdExtLst, buildClrMapOverrideXml, buildColorMapForBackgroundPair, buildConstraintIndex, buildCustomGeometryPathsFromNodes, buildDefRPrTextProperties, buildEffectDagTreeFromXml, buildFabricatedDiagramDataXml, buildFabricatedDrawingXml, buildFontFamilyString, buildForest, buildGuideListExtension, buildInkMlContent, buildLinkedTextBoxChains, buildNodeGuidMap, buildOle2, buildPointFromParagraphs, buildPointFromRuns, buildPointText, buildPptxJsonDocument, buildPresentationGuidMap, buildRelationshipsXml, buildSaveTimeCustomGeometryXml, buildSmartArtColorLists, buildSmartArtColorRoleMap, buildSrgbColorChoice, buildThemeColorMap, buildTree, buildTrendlineLabel, buildXml, bytesToBase64, captureDiagramPictures, captureStyleBaseline, catmullRomToBezier, chartColorChoiceValue, chartColorHex, chartDataAddCategory, chartDataAddSeries, chartDataApplySheetEdit, chartDataApplySheetEdits, chartDataChangeType, chartDataRemoveCategory, chartDataRemoveSeries, chartDataToSheet, chartDataUpdatePoint, chartGradientsEqual, chartGridAddCategory, chartGridAddSeries, chartGridRemoveCategory, chartGridRemoveSeries, chartGridSetCategoryLabel, chartGridSetCellValue, chartTrendlineKind, chartTrendlineType, checkBlankSlide, checkComplexTables, checkDuplicateTitles, checkLowContrast, checkMissingAltText, checkMissingSlideTitle, checkPresentation, chevronPoints, childNamed, children2 as children, childrenNamed, chooseAlgType2 as chooseAlgType, circleNode, clampByRules, classifyPanose, collectAllText, collectTransitionText, colorsEqual, colour, combineShapes, computeContrastRatio, computeSmartArtElementsWithoutCache, concatArrays, connectionLabel, containsConvertibleStrictNamespaceAttribute, convertMetafileToDataUrl, convertXmlToStrict, createArrayBufferCopy, createBuiltinVariables, createDrawingObjectId, createEditorId, createLineStyleGate, createModifyVerifier, createOfficeGuid, createSaltlessModifyVerifierForTesting, createTemplateConnectorRawXml, createTemplateShapeRawXml, createUniformTextSegments, cropShapeForPresetGeometry, cssDegreesToOoxmlGradientAngle, customGeometryPathsToSvgSubpaths, customShowActionId, decodeBase64, decodeJsonValue, decodeOle10Native, decodePngDimensions, decodePptxJsonText, decodeXmlEntities, decomposeSmartArt, decryptPptx, demoteSmartArtNode, deobfuscateFont, deriveSlideTitle, deriveSlideTitles, descendants2 as descendants, deserializePptxFromJson, detectDigitalSignatures, detectFileFormat, detectFontFormat, detectOleObjectType, detectOlePayloadEditorKind, detectStrictConformance, diagramPictureRelationships, discoverArrangement2 as discoverArrangement, distributeSegmentsAcrossChain, douglasPeucker, drawingColorXml, drawingEffectsXml, drawingFillXml, drawingLineXml, effectChild, effectIsPurelyStyleMatrix, elementActionToPptxAction, elementHasAction, elements, emu, encodeCompressedPng, encodeJsonValue, encodeOle10Native, encodePasswordUtf16LE, encodePng, encodeXmlAttributeValue, encodeXmlTextValue, encryptPptx, ensureArrayValue, ensureXmlChild, ensureXmlChildOrCreate, ensureXmlChildren, esc, escAttr, escText, escapeDiagramXml, estimateMediaDurationMs, estimateTextBoxCapacity, evaluateCustomGeometryPathData, evaluateCustomGeometryPaths, evaluateGeometryPaths, evaluateGuides, evaluatePresetShape, expandRangeAddresses, extractColorChoiceXml, extractCxSeriesColor, extractGuidFromPartName, extractModel3DTransform, extractStyleReferenceColorXml, fetchUrlToBytes, fillElementOf, fillIsPurelyStyleMatrix, filterValidShapeAdjustmentEntries, findChartExtByUri, findChildByLocalName, findCnvPrNode, findConstraint, findCustomShow, findKey6 as findKey, findThemeEffectScheme, findThemeEffectSchemeByName, first, firstParagraphRuns, fitFontSize, flattenChartUserShapes, flattenNodes, formatAutoNumberMarker, formatCellAddress, formatCommentTimestamp, formatSchemeKey, formatScriptAutoNumber, fragmentShapes, gearPoints, generateFontGuid, generatedDrawingDigest, getAdjustmentAwareClipPath, getAdjustmentAwareShapeClipPath, getAnimationPresetInfo, getCalloutLeaderLineGeometry, getCalloutTier, getCalloutViewBoxBounds, getCloudCalloutClipPath, getCloudClipPath, getCloudPathForRendering, getCommentMarkerPosition, getConnectorAdjustment, getConnectorPathGeometry, getCssBorderDashStyle, getCustomShowNames, getCustomShowPositionLabel, getElementLabel, getElementOrientationMatrix, getElementTextContent, getElementTransform, getImageMaskStyle, getLinkedTextBoxSegments, getNativeAnimationPresetMetadata, getOleDocumentParagraphs, getOleNestedDeckBytes, getOleNestedDeckDetail, getOleObjectTypeLabel, getOleSheetGrid, getPanoseWeight, getPresetConnectionSites, getPresetShapeClipPath, getPresetTextRect, getPresetsByCategory, getRoundRectRadiusPx, getSectionSlideRange, getShapeClipPath, getShapeClipPathFromPreset, getShapeType, getSignaturePathsToStrip, getSubstituteFontFamily, getSubstituteFonts, getSupportedNamespaces, getSvgStrokeDasharray, getTextCompensationTransform, getZoomElements, getZoomTargetSlideIndexes, gradFill, groupElements, guidToKey, guideEmuToPx, guidePxToEmu, hasDirectSubstitution, hasLocalName, hasNonTrivialOverride, hasReference, hasShapeProperties, hasTextProperties, hash, hebrewAlphaLabel, inferOleExtensionFromTarget, inheritCustomGeometryCommandOrder, inheritedPlaceholderFieldType, inkBounds, inkElementToStrokes, inkLengthToPx, inkPointMapper, insertAt2 as insertAt, interpretSmartArtLayout2 as interpretSmartArtLayout, interpretedLayoutToElements, intersectPolygons, intersectShapes, intersectSvgPaths, isAlternateContentChoiceSupported, isAlternateContentChoiceXmlSupported, isCalloutShape, isConnectorElement, isContentPoint, isDarkColorMap, isDefaultSmartArtLabelScene, isEditableTextElement, isHeaderFooterPlaceholder, isImageLikeElement, isInkElement, isNamespaceSupported, isOle2CompoundFile, isParetoChartData, isPptxJsonText, isShapeElement, isStShapeType, isStrictNamespaceUri, isSummaryZoomSlide, isSwitchableLayoutType, isTemplateElement, isTemplateElementId, isTextElement, isTextOrientationMatrix, isTransitionalNamespaceUri, isXmlNode, isZoomElement, isZoomElement2, itemNode, loadThemeVariants, lookupPresetConnectionSites, lookupPresetShape, lookupPresetTextRectOverride, makeStoreAwareId, mapCustomShowActions, mergeAttributeEffectNode, mergeEffectNode, mergeShapes, mergeSmartArtConnectionXml, mergeSmartArtPointXml, mergeStyleParts, mergeThemeColorOverride, mimeTypeForOleFile, multiplyTextOrientationMatrices, navigateCustomShow, newSmartArtGuid, nextRelationshipId, nodeFill, nodeOpacity, nodeStroke, nodeTextStyle, normalizeCustomShowIds, normalizeNamespaceUri, normalizePositiveFixedAngleDegrees, normalizeStShapeType, normalizeStrictXml, normalizeStrokeDashType, numericParam, obfuscateFont, oleBytesToDataUrl, oleObjectTypeToGlyph, ooxmlArcToSvg, ooxmlGradientAngleToCssDegrees, orderedXmlKey, parseActiveXControlsFromSlide, parseAdjustmentValues, parseAlignmentAttr, parseBodyPrBooleanAttrs, parseBubbleChartOptions, parseBulletSizePercent, parseCellAddress, parseChart3DSurfaces, parseChartAxes, parseChartDataLabelOptions, parseChartDataPointPicture, parseChartDataPointPictureBlipRel, parseChartFormulaRange, parseChartLayouts, parseChartManualLayout, parseChartUniqueId, parseChartUpDownBars, parseChartUserShapesDrawing, parseChartWideTextStyle, parseCustomShows, parseCxAxes, parseCxChartSeries, parseCxDataLabels, parseCxRegionMapOptions, parseDataTable, parseDataUrlToBytes, parseDefRPrTextStyle, parseDiagramColors, parseDiagramDataModel, parseDiagramDrawing, parseDiagramLayoutSummary, parseDiagramQuickStyle, parseDiagramRelationshipIds, parseDrawingColor, parseDrawingColorChoice, parseDrawingColorIn, parseDrawingColorOpacity, parseDrawingEffects, parseDrawingFill, parseDrawingLine, parseDrawingLineDash, parseDrawingMediaReference, parseDrawingRichTextBody, parseDrawingTextBody, parseEmbeddedXlsx, parseEncryptionInfo, parseGuideDefinitions, parseHexColor, parseImplicitBlipPictureFill, parseInkMlContent, parseKinsoku, parseLineSpacingExactPt, parseLineSpacingMultiplier, parseLineStyle, parseMarker, parseModel3DScene, parseOle2, parseP14DirectChild, parseP14FromExtLst, parsePanoseBytes, parsePanoseString, parseParagraphExtraAttributes, parseParagraphLevel, parseParagraphMargins, parseParagraphRtl, parseParagraphSpacingPx, parsePptxJson, parsePptxJsonDocument, parsePresentationDrawingGuides, parsePresentationSmartTags, parseRelationships, parseSeriesDataLabels, parseSeriesDataPoints, parseSeriesErrBars, parseSeriesExplosion, parseSeriesTrendlines, parseShapeId, parseShapeProps, parseSignatureXml, parseSlideDrawingGuides, parseSmartArtColorListHexes, parseSmartArtColorStyleLabels, parseSmartArtConnection, parseSmartArtDefinitionHeaderList, parseSmartArtDefinitionMetadata, parseSmartArtPointCustomLayout, parseSmartArtPresLayoutVars, parseSmartArtQuickStyleLabels, parseSmartArtStyleLabelRefs, parseSmartArtTextParagraphs, parseStructuredCustomGeometry, parseTabStops, parseVmlElement, parseVmlElements, parseXml, patchDrawingColorIn, patchDrawingLine, picturePercentage, polygonNode, polygonsToSvgPath, positiveFixedAngleAttribute, pptxActionToElementAction, pptxDataFromJsonDocument, preservesSpreadsheetXmlWhitespace, preservesXmlWhitespace, presetGeometryForCropShape, previewDiagramLayout, prismFamilyFlags, prismFamilyTypeForFlags, prismFamilyTypeOfNode, projectSmartArtNodeText, promoteSmartArtNode, ratioConstraint, reResolveElementColors, reResolveElementFonts, reResolveElementsForColorMapChange, reResolveSlideColors, reResolveSlideFonts, readChartManualLayoutValues, readCommentMentions, readFileAsDataUrl, readOleDocParagraphs, readOleDocumentParagraphs, readOleNestedDeckDetail, readOleNestedDeckFirstSlideTextLines, readOleSheetGrid, readOleXlsGrid, readPathListCommandOrder, readPictureEffect, readScene3DValues, readText3DValues, reapplyAlternateContentToTree, reassignDescendantIds, rebaseCommentMentions, rectNode, reflowSmartArtLayout, reflowSmartArtPictures, regenerateClonedUniqueId, regenerateSmartArtDrawingShapes, relAttr, relationshipsPartFor, relativeLuminance, relayoutSmartArt, remapElementShapeIds, remapShapeIdReferences, removeSmartArtNode, renderOleDeckPreviewPng, renderOleDocumentPreviewPng, renderOleIconPng, renderOleSheetPreviewPng, reorderObjectKeys, reorderObjectKeysByLocalName, reorderSmartArtNode, reorderSmartArtNodeToIndex, repairPptx, repeatedLabel, replaceFirstText, replaceOleEmbedding, replaceOleFile, resetDecomposeCounter, resetSmartArtEditCounter, resetSpPrFormattingForStyleMatrix, resolveConstraint, resolveConstraintDeclaredBy, resolveCoordinate, resolveCustomGeometryGuideContext, resolveCustomGeometryToken, resolveCustomShowSlideIndices, resolveDisplayedChartTypeName, resolveDrawingColor, resolveFlowDirection, resolveLayoutDisplayName, resolveModel3DMimeType, resolveModifyVerifierAlgorithmName, resolveOleEditorKindFromPayload, resolveParagraphAlignment, resolvePartPath, resolveRatioConstraint, resolveSmartArtEffectIntensity, resolveSmartArtNodeCoherent3DOff, resolveSmartArtNodeStyleRoles, resolveTableCellStyle, resolveThemeEffectStyle, resolveThemeFillStyle, resolveThemeLineStyle, resolveTxPrDefRPr, rgb, roleOf, romanNumeral, roundCoordinate, safeResolveZipPath, sampleFirstPixelColorFromBytes, scaleVectorToIntegers, selectAlternateContentBranch, selectArrangedNodes, serializeColorChoice, serializeColorChoiceWithRef, serializePptxToJson, serializeSmartArtDefinitionHeaderList, serializeTabStop, setAutoTitleDeleted, setDrawingFillXml, setOleObjectName, setSmartArtNodeStyle, shadowOffsetToDistanceAndDirection, shouldRebuildFromParagraphs, shouldRebuildFromRuns, shouldRenderFallbackLabel, shouldReturnToZoomSlide, slideBackgroundStyleRefFromNode, smartArtParagraphsText, smartArtQuickStyleHas3d, solidFill, stripParentDirSegments, stripXmlOrderMarkers, stripXmlOrderSuffix, strokeFor, styleContext, styleShadow, styleStroke, subtractPolygons, subtractShapes, subtractSvgPaths, supportsChartGradientFill, svgPathToPolygons, svgToCustomGeometryPaths, switchSmartArtLayout, syncPictureShapeTypeWithCropShape, themeColorSchemesEqual, toArabicAbjadNumeral, toChineseNumeral, toCjkDigitString, toDevanagariDigits, toEa1ChsNumeral, toEa1ChtNumeral, toFullWidthDigits, toHebrewNumeral, toStrictNamespaceUri, toThaiDigits, treeDepth, treeWidth, truncate, uint32LE, ungroupElements, unionPolygons, unionShapes, unionSvgPaths, unwrapAlternateContent, unwrapOleEmbedding, updateSmartArtNodeText, upsertChartAxisChild, validatePptx, validateSmartArtColorStyleLabels, validateSmartArtDefinitionHeaderList, validateSmartArtDefinitionMetadata, verifyModifyPassword, verifyPassword, verifySignatureDigests, visitXmlObjects, withDiagramPictureSources, withThemePlaceholderColor, worksheetData, wrapFormatSchemeXml, writeBodyPrBooleanAttrs, writeChartColorChoice, writeChartShapeProps, writeGeneratedDiagramDrawing, writeOleDocParagraphEdit, writeOleDocumentParagraphEdit, writeOleNestedDeckElementText, writeOleSheetCellEdit, writeOleXlsNumericCellEdit, writeOleXlsStringCellEdit, writeShapeEffects, xmlAttr, xmlAttrBool, xmlAttrNumber, xmlChild, xmlChildren, xmlHasChild, xmlPath, xmlText, zlibDeflate, zlibStore };
|