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
|
@@ -16994,10 +16994,10 @@ var init_ole_utils = __esm({
|
|
|
16994
16994
|
}
|
|
16995
16995
|
});
|
|
16996
16996
|
|
|
16997
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16997
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js
|
|
16998
16998
|
var OLE_MAGIC, ENDOFCHAIN, FREESECT, FATSECT, DIFSECT, MAXREGSECT, ENTRY_TYPE_EMPTY, ENTRY_TYPE_STORAGE, ENTRY_TYPE_STREAM, NOSTREAM, ENTRY_TYPE_ROOT, DIR_ENTRY_SIZE, Ole2ParseError;
|
|
16999
16999
|
var init_ole2_parser_types = __esm({
|
|
17000
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
17000
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js"() {
|
|
17001
17001
|
OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
|
|
17002
17002
|
ENDOFCHAIN = 4294967294;
|
|
17003
17003
|
FREESECT = 4294967295;
|
|
@@ -17019,15 +17019,23 @@ var init_ole2_parser_types = __esm({
|
|
|
17019
17019
|
}
|
|
17020
17020
|
});
|
|
17021
17021
|
|
|
17022
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17023
|
-
function
|
|
17024
|
-
const ticks = view.getBigUint64(offset, true);
|
|
17022
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-filetime.js
|
|
17023
|
+
function fileTimeDate(ticks) {
|
|
17025
17024
|
if (ticks === 0n)
|
|
17026
17025
|
return void 0;
|
|
17027
|
-
const
|
|
17028
|
-
const
|
|
17026
|
+
const delta2 = ticks - EPOCH;
|
|
17027
|
+
const ms = delta2 >= 0n ? delta2 / 10000n : (delta2 - 9999n) / 10000n;
|
|
17028
|
+
const date5 = new Date(Number(ms));
|
|
17029
17029
|
return Number.isNaN(date5.getTime()) ? void 0 : date5;
|
|
17030
17030
|
}
|
|
17031
|
+
var EPOCH;
|
|
17032
|
+
var init_ole2_filetime = __esm({
|
|
17033
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-filetime.js"() {
|
|
17034
|
+
EPOCH = 116444736000000000n;
|
|
17035
|
+
}
|
|
17036
|
+
});
|
|
17037
|
+
|
|
17038
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-directory.js
|
|
17031
17039
|
function decodeSlot(dir, id, majorVersion, warnings) {
|
|
17032
17040
|
const view = new DataView(dir.buffer, dir.byteOffset + id * DIR_ENTRY_SIZE, DIR_ENTRY_SIZE);
|
|
17033
17041
|
const nameLen = view.getUint16(64, true);
|
|
@@ -17063,8 +17071,10 @@ function decodeSlot(dir, id, majorVersion, warnings) {
|
|
|
17063
17071
|
childId: link(76),
|
|
17064
17072
|
clsid: new Uint8Array(view.buffer.slice(view.byteOffset + 80, view.byteOffset + 96)),
|
|
17065
17073
|
stateBits: view.getUint32(96, true),
|
|
17066
|
-
created:
|
|
17067
|
-
modified:
|
|
17074
|
+
created: fileTimeDate(view.getBigUint64(100, true)),
|
|
17075
|
+
modified: fileTimeDate(view.getBigUint64(108, true)),
|
|
17076
|
+
createdFileTime: view.getBigUint64(100, true),
|
|
17077
|
+
modifiedFileTime: view.getBigUint64(108, true),
|
|
17068
17078
|
startSector: view.getUint32(116, true),
|
|
17069
17079
|
size,
|
|
17070
17080
|
parentId: -1
|
|
@@ -17179,15 +17189,14 @@ function findStreamByName(entries, name, isReadable) {
|
|
|
17179
17189
|
const top = entries.filter((entry2) => entry2.parentId === root?.id && isReadable(entry2));
|
|
17180
17190
|
return top.find((entry2) => entry2.name === name) ?? top.find((entry2) => sameName(entry2.name, name)) ?? entries.find((entry2) => entry2.name === name && isReadable(entry2));
|
|
17181
17191
|
}
|
|
17182
|
-
var FILETIME_UNIX_EPOCH;
|
|
17183
17192
|
var init_ole2_directory = __esm({
|
|
17184
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
17193
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-directory.js"() {
|
|
17194
|
+
init_ole2_filetime();
|
|
17185
17195
|
init_ole2_parser_types();
|
|
17186
|
-
FILETIME_UNIX_EPOCH = 116444736000000000n;
|
|
17187
17196
|
}
|
|
17188
17197
|
});
|
|
17189
17198
|
|
|
17190
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17199
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
|
|
17191
17200
|
function parseOle2(buffer, options2 = {}) {
|
|
17192
17201
|
const strict = options2.strict === true;
|
|
17193
17202
|
const data = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
@@ -17334,7 +17343,11 @@ function parseOle2(buffer, options2 = {}) {
|
|
|
17334
17343
|
}
|
|
17335
17344
|
if (firstDirectorySector > MAXREGSECT)
|
|
17336
17345
|
throw new Ole2ParseError("Missing directory chain");
|
|
17337
|
-
const
|
|
17346
|
+
const directoryBytes = readMetadataChain(firstDirectorySector, "directory");
|
|
17347
|
+
if (strict && majorVersion === 4 && view.getUint32(40, true) !== directoryBytes.length / sectorSize) {
|
|
17348
|
+
throw new Ole2ParseError("Unexpected directory sector count");
|
|
17349
|
+
}
|
|
17350
|
+
const entries = readDirectory(directoryBytes, majorVersion, strict, warnings);
|
|
17338
17351
|
for (const entry2 of entries) {
|
|
17339
17352
|
if (majorVersion === 4 && (!Number.isSafeInteger(entry2.size) || entry2.size > sectorCount * sectorSize)) {
|
|
17340
17353
|
throw new Ole2ParseError("Stream size exceeds supported file bounds");
|
|
@@ -17425,7 +17438,7 @@ function parseOle2(buffer, options2 = {}) {
|
|
|
17425
17438
|
};
|
|
17426
17439
|
}
|
|
17427
17440
|
var init_ole2_parser_read = __esm({
|
|
17428
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
17441
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js"() {
|
|
17429
17442
|
init_ole2_parser_types();
|
|
17430
17443
|
init_ole2_directory();
|
|
17431
17444
|
}
|
|
@@ -17566,7 +17579,7 @@ var init_ole_embedded_extract = __esm({
|
|
|
17566
17579
|
}
|
|
17567
17580
|
});
|
|
17568
17581
|
|
|
17569
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17582
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js
|
|
17570
17583
|
function compareDirEntryNames(a, b) {
|
|
17571
17584
|
const ua = a.toUpperCase();
|
|
17572
17585
|
const ub = b.toUpperCase();
|
|
@@ -17633,12 +17646,12 @@ function writeInt32Sectors(outBytes, int32Data, firstSector, numSectors, sectorS
|
|
|
17633
17646
|
}
|
|
17634
17647
|
}
|
|
17635
17648
|
var init_ole2_parser_write_helpers = __esm({
|
|
17636
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
17649
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js"() {
|
|
17637
17650
|
init_ole2_parser_types();
|
|
17638
17651
|
}
|
|
17639
17652
|
});
|
|
17640
17653
|
|
|
17641
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17654
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js
|
|
17642
17655
|
function writeHeader(outView, outBytes, params) {
|
|
17643
17656
|
outBytes.set(OLE_MAGIC, 0);
|
|
17644
17657
|
outView.setUint16(24, 62, true);
|
|
@@ -17731,14 +17744,14 @@ function writeStreamSectors(outBytes, streamData, chain2, sectorSize) {
|
|
|
17731
17744
|
}
|
|
17732
17745
|
var HEADER_DIFAT_ENTRIES;
|
|
17733
17746
|
var init_ole2_parser_write_serialize = __esm({
|
|
17734
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
17747
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js"() {
|
|
17735
17748
|
init_ole2_parser_types();
|
|
17736
17749
|
init_ole2_parser_write_helpers();
|
|
17737
17750
|
HEADER_DIFAT_ENTRIES = 109;
|
|
17738
17751
|
}
|
|
17739
17752
|
});
|
|
17740
17753
|
|
|
17741
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17754
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
|
|
17742
17755
|
function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
|
|
17743
17756
|
const sectorSize = 512;
|
|
17744
17757
|
const miniSectorSize = 64;
|
|
@@ -17919,7 +17932,7 @@ function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
|
|
|
17919
17932
|
return output2;
|
|
17920
17933
|
}
|
|
17921
17934
|
var init_ole2_parser_write = __esm({
|
|
17922
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
17935
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js"() {
|
|
17923
17936
|
init_ole2_parser_types();
|
|
17924
17937
|
init_ole2_parser_write_helpers();
|
|
17925
17938
|
init_ole2_parser_write_serialize();
|
|
@@ -18819,7 +18832,7 @@ var init_ole_sheet_xlsx_editor = __esm({
|
|
|
18819
18832
|
}
|
|
18820
18833
|
});
|
|
18821
18834
|
|
|
18822
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18835
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-edit.js
|
|
18823
18836
|
function chain(table, start, limit) {
|
|
18824
18837
|
if (start === END && limit === 0)
|
|
18825
18838
|
return [];
|
|
@@ -18903,21 +18916,21 @@ function readTarget(input2, target, root, fat, sector, sectorCount, sectorSize,
|
|
|
18903
18916
|
return out;
|
|
18904
18917
|
}
|
|
18905
18918
|
function processCompoundFileStream(input2, path4, replacement) {
|
|
18906
|
-
const
|
|
18919
|
+
const reject2 = () => replacement ? input2 : void 0;
|
|
18907
18920
|
try {
|
|
18908
18921
|
if (path4.length === 0 || path4.some((part) => !part) || input2.length < 512)
|
|
18909
|
-
return
|
|
18922
|
+
return reject2();
|
|
18910
18923
|
const view = new DataView(input2.buffer, input2.byteOffset, input2.byteLength);
|
|
18911
18924
|
const read32 = (offset2) => view.getUint32(offset2, true);
|
|
18912
18925
|
if (input2[0] !== 208 || input2[1] !== 207 || input2[2] !== 17 || input2[3] !== 224 || input2[4] !== 161 || input2[5] !== 177 || input2[6] !== 26 || input2[7] !== 225 || // Readers tolerate a non-canonical byte-order mark; edits do not.
|
|
18913
18926
|
replacement && view.getUint16(28, true) !== 65534)
|
|
18914
|
-
return
|
|
18927
|
+
return reject2();
|
|
18915
18928
|
const major = view.getUint16(26, true), shift = view.getUint16(30, true), miniShift = view.getUint16(32, true);
|
|
18916
18929
|
if (major !== 3 && major !== 4 || shift !== (major === 3 ? 9 : 12) || miniShift !== 6)
|
|
18917
|
-
return
|
|
18930
|
+
return reject2();
|
|
18918
18931
|
const sectorSize = 1 << shift, miniSize = 1 << miniShift;
|
|
18919
18932
|
if (input2.length < sectorSize || replacement && input2.length % sectorSize !== 0)
|
|
18920
|
-
return
|
|
18933
|
+
return reject2();
|
|
18921
18934
|
const sectorCount = Math.ceil(input2.length / sectorSize) - 1;
|
|
18922
18935
|
const offset = (id) => (id + 1) * sectorSize;
|
|
18923
18936
|
const sector = (id) => {
|
|
@@ -18936,7 +18949,7 @@ function processCompoundFileStream(input2, path4, replacement) {
|
|
|
18936
18949
|
const difatIds = /* @__PURE__ */ new Set();
|
|
18937
18950
|
for (let i2 = 0; i2 < difatCount; i2++) {
|
|
18938
18951
|
if (difatIds.has(difat) || difat > MAX)
|
|
18939
|
-
return
|
|
18952
|
+
return reject2();
|
|
18940
18953
|
difatIds.add(difat);
|
|
18941
18954
|
const bytes = sector(difat), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
18942
18955
|
for (let j = 0; j < (sectorSize - 4) / 4 && fatIds.length < fatCount; j++) {
|
|
@@ -18947,7 +18960,7 @@ function processCompoundFileStream(input2, path4, replacement) {
|
|
|
18947
18960
|
difat = dv.getUint32(sectorSize - 4, true);
|
|
18948
18961
|
}
|
|
18949
18962
|
if (fatIds.length !== fatCount || new Set(fatIds).size !== fatIds.length || fatIds.some((id) => difatIds.has(id)))
|
|
18950
|
-
return
|
|
18963
|
+
return reject2();
|
|
18951
18964
|
const fat = [];
|
|
18952
18965
|
for (const id of fatIds) {
|
|
18953
18966
|
const bytes = sector(id), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
@@ -18966,13 +18979,13 @@ function processCompoundFileStream(input2, path4, replacement) {
|
|
|
18966
18979
|
continue;
|
|
18967
18980
|
const nameLength = dvDir.getUint16(p + 64, true);
|
|
18968
18981
|
if (nameLength < 2 || nameLength > 64 || nameLength % 2)
|
|
18969
|
-
return
|
|
18982
|
+
return reject2();
|
|
18970
18983
|
let name = "";
|
|
18971
18984
|
for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
|
|
18972
18985
|
name += String.fromCharCode(dvDir.getUint16(p + i2, true));
|
|
18973
18986
|
const sizeLow = dvDir.getUint32(p + 120, true), sizeHigh = dvDir.getUint32(p + 124, true);
|
|
18974
18987
|
if (sizeHigh !== 0 && (replacement || major === 4))
|
|
18975
|
-
return
|
|
18988
|
+
return reject2();
|
|
18976
18989
|
entries.push({
|
|
18977
18990
|
id,
|
|
18978
18991
|
name,
|
|
@@ -18987,7 +19000,7 @@ function processCompoundFileStream(input2, path4, replacement) {
|
|
|
18987
19000
|
const byId = new Map(entries.map((e) => [e.id, e]));
|
|
18988
19001
|
const root = entries.find((e) => e.type === 5);
|
|
18989
19002
|
if (!root)
|
|
18990
|
-
return
|
|
19003
|
+
return reject2();
|
|
18991
19004
|
let parent = root, target;
|
|
18992
19005
|
for (let partIndex = 0; partIndex < path4.length; partIndex++) {
|
|
18993
19006
|
const matches = [], seen = /* @__PURE__ */ new Set();
|
|
@@ -19007,22 +19020,22 @@ function processCompoundFileStream(input2, path4, replacement) {
|
|
|
19007
19020
|
};
|
|
19008
19021
|
visit2(parent.child);
|
|
19009
19022
|
if (matches.length !== 1)
|
|
19010
|
-
return
|
|
19023
|
+
return reject2();
|
|
19011
19024
|
target = matches[0];
|
|
19012
19025
|
if (partIndex < path4.length - 1) {
|
|
19013
19026
|
if (target.type !== 1)
|
|
19014
|
-
return
|
|
19027
|
+
return reject2();
|
|
19015
19028
|
parent = target;
|
|
19016
19029
|
} else if (target.type !== 2 || replacement && replacement.length !== target.size)
|
|
19017
|
-
return
|
|
19030
|
+
return reject2();
|
|
19018
19031
|
}
|
|
19019
19032
|
if (!target)
|
|
19020
|
-
return
|
|
19033
|
+
return reject2();
|
|
19021
19034
|
if (!replacement)
|
|
19022
19035
|
return readTarget(input2, target, root, fat, sector, sectorCount, sectorSize, miniSize, read32);
|
|
19023
19036
|
const names = entries.map((e) => e.name.toLowerCase());
|
|
19024
19037
|
if (replacement && (names.includes("encryptioninfo") || names.includes("encryptedpackage")))
|
|
19025
|
-
return
|
|
19038
|
+
return reject2();
|
|
19026
19039
|
for (const name of replacement ? ["book", "workbook"] : []) {
|
|
19027
19040
|
if (!names.includes(name))
|
|
19028
19041
|
continue;
|
|
@@ -19033,7 +19046,7 @@ function processCompoundFileStream(input2, path4, replacement) {
|
|
|
19033
19046
|
const record3 = workbook[p] | workbook[p + 1] << 8;
|
|
19034
19047
|
const length = workbook[p + 2] | workbook[p + 3] << 8;
|
|
19035
19048
|
if (record3 === 47)
|
|
19036
|
-
return
|
|
19049
|
+
return reject2();
|
|
19037
19050
|
if (p + 4 + length > workbook.length || record3 === 10)
|
|
19038
19051
|
break;
|
|
19039
19052
|
p += 4 + length;
|
|
@@ -19042,13 +19055,13 @@ function processCompoundFileStream(input2, path4, replacement) {
|
|
|
19042
19055
|
if (replacement && names.includes("worddocument")) {
|
|
19043
19056
|
const word = readCompoundFileStream(input2, ["WordDocument"]);
|
|
19044
19057
|
if (word && word.length >= 12 && ((word[10] | word[11] << 8) & 256) !== 0)
|
|
19045
|
-
return
|
|
19058
|
+
return reject2();
|
|
19046
19059
|
}
|
|
19047
19060
|
const miniCutoff = read32(56), miniFatCount = read32(64), miniFatStart = read32(60);
|
|
19048
19061
|
const miniFatSectors = miniFatCount ? chain(fat, miniFatStart, miniFatCount) : [];
|
|
19049
19062
|
const metadataSectors = [...fatIds, ...difatIds, ...dirSectors, ...miniFatSectors];
|
|
19050
19063
|
if (new Set(metadataSectors).size !== metadataSectors.length)
|
|
19051
|
-
return
|
|
19064
|
+
return reject2();
|
|
19052
19065
|
const miniFat = [];
|
|
19053
19066
|
const miniCapacity = Math.floor(Math.min(root.size, sectorCount * sectorSize) / miniSize);
|
|
19054
19067
|
for (const id of miniFatSectors) {
|
|
@@ -19067,7 +19080,7 @@ function processCompoundFileStream(input2, path4, replacement) {
|
|
|
19067
19080
|
for (const id of exactChain(fat, entry2.start, entry2.size, sectorSize)) {
|
|
19068
19081
|
sector(id);
|
|
19069
19082
|
if (regularUsed.has(id))
|
|
19070
|
-
return
|
|
19083
|
+
return reject2();
|
|
19071
19084
|
regularUsed.add(id);
|
|
19072
19085
|
}
|
|
19073
19086
|
}
|
|
@@ -19078,7 +19091,7 @@ function processCompoundFileStream(input2, path4, replacement) {
|
|
|
19078
19091
|
const ids = exactChain(miniFat, entry2.start, entry2.size, miniSize);
|
|
19079
19092
|
for (const id of ids) {
|
|
19080
19093
|
if ((id + 1) * miniSize > rootMini.size || miniUsed.has(id))
|
|
19081
|
-
return
|
|
19094
|
+
return reject2();
|
|
19082
19095
|
miniUsed.add(id);
|
|
19083
19096
|
}
|
|
19084
19097
|
}
|
|
@@ -19112,7 +19125,7 @@ function processCompoundFileStream(input2, path4, replacement) {
|
|
|
19112
19125
|
output2.set(replacement.subarray(i2 * sectorSize, Math.min((i2 + 1) * sectorSize, replacement.length)), offset(sectors[i2]));
|
|
19113
19126
|
} else {
|
|
19114
19127
|
if (!miniFat.length)
|
|
19115
|
-
return
|
|
19128
|
+
return reject2();
|
|
19116
19129
|
const miniSectors = exactChain(miniFat, target.start, target.size, miniSize);
|
|
19117
19130
|
const rootMini2 = entries.find((e) => e.type === 5);
|
|
19118
19131
|
const rootSectors = exactChain(fat, rootMini2.start, rootMini2.size, sectorSize);
|
|
@@ -19122,18 +19135,18 @@ function processCompoundFileStream(input2, path4, replacement) {
|
|
|
19122
19135
|
for (let i2 = 0; i2 < replacement.length; i2++) {
|
|
19123
19136
|
const miniOffset = miniSectors[Math.floor(i2 / miniSize)] * miniSize + i2 % miniSize;
|
|
19124
19137
|
if (miniOffset >= rootData.length)
|
|
19125
|
-
return
|
|
19138
|
+
return reject2();
|
|
19126
19139
|
const rootSectorIndex = Math.floor(miniOffset / sectorSize);
|
|
19127
19140
|
const rootSector = rootSectors[rootSectorIndex];
|
|
19128
19141
|
if (rootSector === void 0)
|
|
19129
|
-
return
|
|
19142
|
+
return reject2();
|
|
19130
19143
|
const physical = offset(rootSector) + miniOffset % sectorSize;
|
|
19131
19144
|
output2[physical] = replacement[i2];
|
|
19132
19145
|
}
|
|
19133
19146
|
}
|
|
19134
19147
|
return output2;
|
|
19135
19148
|
} catch {
|
|
19136
|
-
return
|
|
19149
|
+
return reject2();
|
|
19137
19150
|
}
|
|
19138
19151
|
}
|
|
19139
19152
|
function readCompoundFileStream(input2, path4) {
|
|
@@ -19144,7 +19157,7 @@ function replaceCompoundFileStream(input2, path4, replacement) {
|
|
|
19144
19157
|
}
|
|
19145
19158
|
var END, MAX, NIL, SIZE;
|
|
19146
19159
|
var init_ole2_stream_edit = __esm({
|
|
19147
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
19160
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-edit.js"() {
|
|
19148
19161
|
END = 4294967294;
|
|
19149
19162
|
MAX = 4294967290;
|
|
19150
19163
|
NIL = 4294967295;
|
|
@@ -19152,7 +19165,7 @@ var init_ole2_stream_edit = __esm({
|
|
|
19152
19165
|
}
|
|
19153
19166
|
});
|
|
19154
19167
|
|
|
19155
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19168
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-cfb.js
|
|
19156
19169
|
function unwrapXlsBytes(bytes) {
|
|
19157
19170
|
if (!isCfb(bytes)) {
|
|
19158
19171
|
return { workbookBytes: bytes };
|
|
@@ -19219,7 +19232,7 @@ function isCfb(bytes) {
|
|
|
19219
19232
|
}
|
|
19220
19233
|
var WORKBOOK_STREAM_NAMES;
|
|
19221
19234
|
var init_legacy_excel_cfb = __esm({
|
|
19222
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
19235
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-cfb.js"() {
|
|
19223
19236
|
init_ole2_parser_read();
|
|
19224
19237
|
init_ole2_parser_types();
|
|
19225
19238
|
init_ole2_parser_write();
|
|
@@ -19228,7 +19241,1165 @@ var init_legacy_excel_cfb = __esm({
|
|
|
19228
19241
|
}
|
|
19229
19242
|
});
|
|
19230
19243
|
|
|
19231
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19244
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-record-edit-model.js
|
|
19245
|
+
function reject(reason) {
|
|
19246
|
+
throw new EditError(reason);
|
|
19247
|
+
}
|
|
19248
|
+
function model(bytes) {
|
|
19249
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
19250
|
+
const records = [];
|
|
19251
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
19252
|
+
let offset = 0, depth = 0, globalsEnd = -1;
|
|
19253
|
+
let top;
|
|
19254
|
+
while (offset < bytes.length) {
|
|
19255
|
+
if (depth === 0 && globalsEnd >= 0 && bytes[offset] === 0 && bytes.subarray(offset).every((b) => b === 0))
|
|
19256
|
+
break;
|
|
19257
|
+
if (offset + 4 > bytes.length)
|
|
19258
|
+
reject("malformed-records");
|
|
19259
|
+
const opcode = view.getUint16(offset, true), length = view.getUint16(offset + 2, true), dataOffset = offset + 4;
|
|
19260
|
+
if (length > 8224 || dataOffset + length > bytes.length)
|
|
19261
|
+
reject("malformed-records");
|
|
19262
|
+
if (opcode === 2057) {
|
|
19263
|
+
if (length < 4 || view.getUint16(dataOffset, true) !== 1536 || depth >= 64)
|
|
19264
|
+
reject("unsupported-workbook");
|
|
19265
|
+
const kind = view.getUint16(dataOffset + 2, true);
|
|
19266
|
+
if (depth === 0) {
|
|
19267
|
+
if (offset === 0 ? kind !== 5 : globalsEnd < 0 || kind === 5)
|
|
19268
|
+
reject("malformed-records");
|
|
19269
|
+
top = { start: offset, kind };
|
|
19270
|
+
}
|
|
19271
|
+
depth++;
|
|
19272
|
+
} else if (opcode === 10) {
|
|
19273
|
+
if (depth === 0 || length !== 0)
|
|
19274
|
+
reject("malformed-records");
|
|
19275
|
+
} else if (depth === 0)
|
|
19276
|
+
reject("malformed-records");
|
|
19277
|
+
records.push({ opcode, length, headerOffset: offset, dataOffset, depth });
|
|
19278
|
+
if (opcode === 10 && --depth === 0) {
|
|
19279
|
+
if (!top)
|
|
19280
|
+
reject("malformed-records");
|
|
19281
|
+
streams2.set(top.start, { ...top, end: dataOffset });
|
|
19282
|
+
if (top.kind === 5)
|
|
19283
|
+
globalsEnd = dataOffset;
|
|
19284
|
+
top = void 0;
|
|
19285
|
+
}
|
|
19286
|
+
offset = dataOffset + length;
|
|
19287
|
+
}
|
|
19288
|
+
if (depth !== 0 || globalsEnd < 0)
|
|
19289
|
+
reject("malformed-records");
|
|
19290
|
+
if (records.some((r) => r.opcode === 47 && r.headerOffset < globalsEnd))
|
|
19291
|
+
reject("unsupported-workbook");
|
|
19292
|
+
const bounds = records.filter((r) => r.opcode === 133 && r.headerOffset < globalsEnd && r.depth === 1);
|
|
19293
|
+
if (bounds.length === 0)
|
|
19294
|
+
reject("malformed-records");
|
|
19295
|
+
const worksheets = [];
|
|
19296
|
+
const used = /* @__PURE__ */ new Set();
|
|
19297
|
+
for (const bound of bounds) {
|
|
19298
|
+
const p = bound.dataOffset;
|
|
19299
|
+
if (bound.length < 8)
|
|
19300
|
+
reject("malformed-records");
|
|
19301
|
+
const chars = view.getUint8(p + 6), wide = Boolean(view.getUint8(p + 7) & 1), kind = view.getUint8(p + 5);
|
|
19302
|
+
if (chars < 1 || chars > 31 || bound.length !== 8 + chars * (wide ? 2 : 1) || (view.getUint8(p + 4) & 3) > 2)
|
|
19303
|
+
reject("malformed-records");
|
|
19304
|
+
const expected = { 0: 16, 1: 64, 2: 32, 6: 6 };
|
|
19305
|
+
const stream = streams2.get(view.getUint32(p, true));
|
|
19306
|
+
if (!stream || stream.kind !== expected[kind] || used.has(stream.start))
|
|
19307
|
+
reject("malformed-records");
|
|
19308
|
+
used.add(stream.start);
|
|
19309
|
+
if (kind === 0)
|
|
19310
|
+
worksheets.push(stream);
|
|
19311
|
+
}
|
|
19312
|
+
if (used.size !== streams2.size - 1)
|
|
19313
|
+
reject("malformed-records");
|
|
19314
|
+
return { records, worksheets, globalsEnd };
|
|
19315
|
+
}
|
|
19316
|
+
function findTarget(bytes, m, edit, allowed = [253, 638, 515, 189]) {
|
|
19317
|
+
const range = m.worksheets[edit.worksheetIndex ?? 0];
|
|
19318
|
+
if (!range)
|
|
19319
|
+
reject("sheet-not-found");
|
|
19320
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
19321
|
+
const targets = [];
|
|
19322
|
+
for (const r of m.records) {
|
|
19323
|
+
if (r.headerOffset < range.start || r.headerOffset >= range.end || r.depth !== 1)
|
|
19324
|
+
continue;
|
|
19325
|
+
const p = r.dataOffset;
|
|
19326
|
+
if ([515, 638, 253, 6, 513, 516, 517, 214].includes(r.opcode)) {
|
|
19327
|
+
if (r.length < 6)
|
|
19328
|
+
reject("malformed-records");
|
|
19329
|
+
if (view.getUint16(p, true) === edit.row && view.getUint16(p + 2, true) === edit.col)
|
|
19330
|
+
targets.push(r);
|
|
19331
|
+
} else if (r.opcode === 189 || r.opcode === 190) {
|
|
19332
|
+
const stride = r.opcode === 189 ? 6 : 2;
|
|
19333
|
+
if (r.length < 6 + stride || (r.length - 6) % stride !== 0)
|
|
19334
|
+
reject("malformed-records");
|
|
19335
|
+
const first2 = view.getUint16(p + 2, true), last = view.getUint16(p + r.length - 2, true);
|
|
19336
|
+
if (last > 255 || last < first2 || last - first2 + 1 !== (r.length - 6) / stride)
|
|
19337
|
+
reject("malformed-records");
|
|
19338
|
+
if (r.opcode === 190 && (first2 > 254 || last <= first2))
|
|
19339
|
+
reject("malformed-records");
|
|
19340
|
+
if (view.getUint16(p, true) === edit.row && edit.col >= first2 && edit.col <= last)
|
|
19341
|
+
targets.push(r);
|
|
19342
|
+
}
|
|
19343
|
+
}
|
|
19344
|
+
if (targets.length > 1)
|
|
19345
|
+
reject("ambiguous-cell");
|
|
19346
|
+
const target = targets[0];
|
|
19347
|
+
if (!target || !allowed.includes(target.opcode))
|
|
19348
|
+
reject("cell-not-supported");
|
|
19349
|
+
if (target.opcode !== 189 && target.opcode !== 190 && target.length !== (target.opcode === 515 ? 14 : target.opcode === 517 ? 8 : target.opcode === 513 ? 6 : 10))
|
|
19350
|
+
reject("malformed-records");
|
|
19351
|
+
for (const record3 of m.records.filter((r) => r.headerOffset >= range.start && r.headerOffset < range.end && r.depth === 1 && [545, 1212, 566].includes(r.opcode))) {
|
|
19352
|
+
if (record3.length < 6)
|
|
19353
|
+
reject("malformed-records");
|
|
19354
|
+
const p = record3.dataOffset;
|
|
19355
|
+
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))
|
|
19356
|
+
reject("cell-not-supported");
|
|
19357
|
+
}
|
|
19358
|
+
return target;
|
|
19359
|
+
}
|
|
19360
|
+
var EditError;
|
|
19361
|
+
var init_legacy_excel_record_edit_model = __esm({
|
|
19362
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-record-edit-model.js"() {
|
|
19363
|
+
EditError = class extends Error {
|
|
19364
|
+
reason;
|
|
19365
|
+
constructor(reason) {
|
|
19366
|
+
super(reason);
|
|
19367
|
+
this.reason = reason;
|
|
19368
|
+
}
|
|
19369
|
+
};
|
|
19370
|
+
}
|
|
19371
|
+
});
|
|
19372
|
+
|
|
19373
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-cell-record-splices.js
|
|
19374
|
+
function relocateXlsDbCells(input2, out, records, replacement, map2) {
|
|
19375
|
+
const source2 = new DataView(input2.buffer, input2.byteOffset, input2.byteLength), dest = new DataView(out.buffer, out.byteOffset, out.byteLength);
|
|
19376
|
+
const byOffset = new Map(records.map((r) => [r.headerOffset, r]));
|
|
19377
|
+
for (const db of records.filter((r) => r.opcode === 215)) {
|
|
19378
|
+
if (db.length < 4 || (db.length - 4) % 2 !== 0 || db.length > 68)
|
|
19379
|
+
throw new Error("Invalid DBCELL size");
|
|
19380
|
+
const back = source2.getUint32(db.dataOffset, true);
|
|
19381
|
+
if (back === 0) {
|
|
19382
|
+
if (db.length !== 4)
|
|
19383
|
+
throw new Error("Unsupported empty DBCELL");
|
|
19384
|
+
continue;
|
|
19385
|
+
}
|
|
19386
|
+
const firstRow = byOffset.get(db.headerOffset - back);
|
|
19387
|
+
if (!firstRow || firstRow.opcode !== 520 || firstRow.length !== 16)
|
|
19388
|
+
throw new Error("Invalid DBCELL row pointer");
|
|
19389
|
+
if (replacement.start < firstRow.headerOffset || replacement.start >= db.headerOffset)
|
|
19390
|
+
continue;
|
|
19391
|
+
const rows = records.filter((r) => r.opcode === 520 && r.headerOffset >= firstRow.headerOffset && r.headerOffset < db.headerOffset);
|
|
19392
|
+
if (rows.length !== (db.length - 4) / 2 || rows.some((r) => r.length !== 16))
|
|
19393
|
+
throw new Error("Unsupported DBCELL row block");
|
|
19394
|
+
let base2 = firstRow.dataOffset + firstRow.length;
|
|
19395
|
+
const addresses = [];
|
|
19396
|
+
for (let i2 = 0; i2 < rows.length; i2++) {
|
|
19397
|
+
const address = base2 + source2.getUint16(db.dataOffset + 4 + i2 * 2, true), cell2 = byOffset.get(address);
|
|
19398
|
+
if (!cell2 || !CELL_OPS.has(cell2.opcode) || address >= db.headerOffset || source2.getUint16(cell2.dataOffset, true) !== source2.getUint16(rows[i2].dataOffset, true))
|
|
19399
|
+
throw new Error("Unsupported DBCELL first-cell pointer");
|
|
19400
|
+
addresses.push(address);
|
|
19401
|
+
base2 = address;
|
|
19402
|
+
}
|
|
19403
|
+
const offset = map2(db.headerOffset) - map2(firstRow.headerOffset);
|
|
19404
|
+
if (offset < 0 || offset > 4294967295)
|
|
19405
|
+
throw new Error("DBCELL row pointer overflow");
|
|
19406
|
+
dest.setUint32(map2(db.dataOffset), offset, true);
|
|
19407
|
+
let newBase = map2(firstRow.dataOffset + firstRow.length);
|
|
19408
|
+
for (let i2 = 0; i2 < addresses.length; i2++) {
|
|
19409
|
+
const address = map2(addresses[i2]), relative = address - newBase;
|
|
19410
|
+
if (relative < 0 || relative > 65535)
|
|
19411
|
+
throw new Error("DBCELL cell pointer overflow");
|
|
19412
|
+
dest.setUint16(map2(db.dataOffset + 4 + i2 * 2), relative, true);
|
|
19413
|
+
newBase = address;
|
|
19414
|
+
}
|
|
19415
|
+
}
|
|
19416
|
+
}
|
|
19417
|
+
var CELL_OPS;
|
|
19418
|
+
var init_legacy_excel_cell_record_splices = __esm({
|
|
19419
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-cell-record-splices.js"() {
|
|
19420
|
+
CELL_OPS = /* @__PURE__ */ new Set([6, 513, 515, 516, 517, 638, 253, 189, 190, 214]);
|
|
19421
|
+
}
|
|
19422
|
+
});
|
|
19423
|
+
|
|
19424
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-known-records.js
|
|
19425
|
+
var KNOWN_XLS_RECORDS, XLS_FRT_WRAPPER;
|
|
19426
|
+
var init_legacy_excel_known_records = __esm({
|
|
19427
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-known-records.js"() {
|
|
19428
|
+
KNOWN_XLS_RECORDS = /* @__PURE__ */ new Set([
|
|
19429
|
+
6,
|
|
19430
|
+
10,
|
|
19431
|
+
12,
|
|
19432
|
+
13,
|
|
19433
|
+
14,
|
|
19434
|
+
15,
|
|
19435
|
+
16,
|
|
19436
|
+
17,
|
|
19437
|
+
18,
|
|
19438
|
+
19,
|
|
19439
|
+
20,
|
|
19440
|
+
21,
|
|
19441
|
+
23,
|
|
19442
|
+
24,
|
|
19443
|
+
25,
|
|
19444
|
+
26,
|
|
19445
|
+
27,
|
|
19446
|
+
28,
|
|
19447
|
+
29,
|
|
19448
|
+
34,
|
|
19449
|
+
35,
|
|
19450
|
+
38,
|
|
19451
|
+
39,
|
|
19452
|
+
40,
|
|
19453
|
+
41,
|
|
19454
|
+
42,
|
|
19455
|
+
43,
|
|
19456
|
+
47,
|
|
19457
|
+
49,
|
|
19458
|
+
51,
|
|
19459
|
+
60,
|
|
19460
|
+
61,
|
|
19461
|
+
64,
|
|
19462
|
+
65,
|
|
19463
|
+
66,
|
|
19464
|
+
77,
|
|
19465
|
+
80,
|
|
19466
|
+
81,
|
|
19467
|
+
82,
|
|
19468
|
+
85,
|
|
19469
|
+
89,
|
|
19470
|
+
90,
|
|
19471
|
+
91,
|
|
19472
|
+
92,
|
|
19473
|
+
93,
|
|
19474
|
+
94,
|
|
19475
|
+
95,
|
|
19476
|
+
96,
|
|
19477
|
+
97,
|
|
19478
|
+
99,
|
|
19479
|
+
125,
|
|
19480
|
+
128,
|
|
19481
|
+
129,
|
|
19482
|
+
130,
|
|
19483
|
+
131,
|
|
19484
|
+
132,
|
|
19485
|
+
133,
|
|
19486
|
+
134,
|
|
19487
|
+
140,
|
|
19488
|
+
141,
|
|
19489
|
+
144,
|
|
19490
|
+
146,
|
|
19491
|
+
151,
|
|
19492
|
+
152,
|
|
19493
|
+
153,
|
|
19494
|
+
154,
|
|
19495
|
+
155,
|
|
19496
|
+
156,
|
|
19497
|
+
157,
|
|
19498
|
+
158,
|
|
19499
|
+
160,
|
|
19500
|
+
161,
|
|
19501
|
+
174,
|
|
19502
|
+
175,
|
|
19503
|
+
176,
|
|
19504
|
+
177,
|
|
19505
|
+
178,
|
|
19506
|
+
180,
|
|
19507
|
+
181,
|
|
19508
|
+
182,
|
|
19509
|
+
184,
|
|
19510
|
+
185,
|
|
19511
|
+
189,
|
|
19512
|
+
190,
|
|
19513
|
+
193,
|
|
19514
|
+
197,
|
|
19515
|
+
198,
|
|
19516
|
+
199,
|
|
19517
|
+
200,
|
|
19518
|
+
201,
|
|
19519
|
+
202,
|
|
19520
|
+
203,
|
|
19521
|
+
204,
|
|
19522
|
+
205,
|
|
19523
|
+
206,
|
|
19524
|
+
207,
|
|
19525
|
+
208,
|
|
19526
|
+
209,
|
|
19527
|
+
210,
|
|
19528
|
+
211,
|
|
19529
|
+
213,
|
|
19530
|
+
215,
|
|
19531
|
+
216,
|
|
19532
|
+
217,
|
|
19533
|
+
218,
|
|
19534
|
+
220,
|
|
19535
|
+
221,
|
|
19536
|
+
222,
|
|
19537
|
+
224,
|
|
19538
|
+
225,
|
|
19539
|
+
226,
|
|
19540
|
+
227,
|
|
19541
|
+
229,
|
|
19542
|
+
233,
|
|
19543
|
+
235,
|
|
19544
|
+
236,
|
|
19545
|
+
237,
|
|
19546
|
+
239,
|
|
19547
|
+
240,
|
|
19548
|
+
241,
|
|
19549
|
+
242,
|
|
19550
|
+
244,
|
|
19551
|
+
245,
|
|
19552
|
+
246,
|
|
19553
|
+
247,
|
|
19554
|
+
248,
|
|
19555
|
+
249,
|
|
19556
|
+
251,
|
|
19557
|
+
252,
|
|
19558
|
+
253,
|
|
19559
|
+
255,
|
|
19560
|
+
256,
|
|
19561
|
+
259,
|
|
19562
|
+
290,
|
|
19563
|
+
311,
|
|
19564
|
+
312,
|
|
19565
|
+
315,
|
|
19566
|
+
317,
|
|
19567
|
+
318,
|
|
19568
|
+
319,
|
|
19569
|
+
320,
|
|
19570
|
+
330,
|
|
19571
|
+
331,
|
|
19572
|
+
333,
|
|
19573
|
+
334,
|
|
19574
|
+
335,
|
|
19575
|
+
336,
|
|
19576
|
+
337,
|
|
19577
|
+
338,
|
|
19578
|
+
339,
|
|
19579
|
+
340,
|
|
19580
|
+
351,
|
|
19581
|
+
352,
|
|
19582
|
+
353,
|
|
19583
|
+
401,
|
|
19584
|
+
402,
|
|
19585
|
+
403,
|
|
19586
|
+
404,
|
|
19587
|
+
405,
|
|
19588
|
+
406,
|
|
19589
|
+
407,
|
|
19590
|
+
408,
|
|
19591
|
+
425,
|
|
19592
|
+
426,
|
|
19593
|
+
427,
|
|
19594
|
+
428,
|
|
19595
|
+
429,
|
|
19596
|
+
430,
|
|
19597
|
+
431,
|
|
19598
|
+
432,
|
|
19599
|
+
433,
|
|
19600
|
+
434,
|
|
19601
|
+
437,
|
|
19602
|
+
438,
|
|
19603
|
+
439,
|
|
19604
|
+
440,
|
|
19605
|
+
441,
|
|
19606
|
+
442,
|
|
19607
|
+
443,
|
|
19608
|
+
444,
|
|
19609
|
+
445,
|
|
19610
|
+
446,
|
|
19611
|
+
448,
|
|
19612
|
+
449,
|
|
19613
|
+
450,
|
|
19614
|
+
512,
|
|
19615
|
+
513,
|
|
19616
|
+
515,
|
|
19617
|
+
516,
|
|
19618
|
+
517,
|
|
19619
|
+
519,
|
|
19620
|
+
520,
|
|
19621
|
+
523,
|
|
19622
|
+
545,
|
|
19623
|
+
549,
|
|
19624
|
+
566,
|
|
19625
|
+
574,
|
|
19626
|
+
638,
|
|
19627
|
+
659,
|
|
19628
|
+
1048,
|
|
19629
|
+
1054,
|
|
19630
|
+
1084,
|
|
19631
|
+
1212,
|
|
19632
|
+
2048,
|
|
19633
|
+
2049,
|
|
19634
|
+
2050,
|
|
19635
|
+
2051,
|
|
19636
|
+
2052,
|
|
19637
|
+
2053,
|
|
19638
|
+
2054,
|
|
19639
|
+
2055,
|
|
19640
|
+
2056,
|
|
19641
|
+
2057,
|
|
19642
|
+
2058,
|
|
19643
|
+
2059,
|
|
19644
|
+
2060,
|
|
19645
|
+
2061,
|
|
19646
|
+
2062,
|
|
19647
|
+
2063,
|
|
19648
|
+
2064,
|
|
19649
|
+
2066,
|
|
19650
|
+
2067,
|
|
19651
|
+
2128,
|
|
19652
|
+
2129,
|
|
19653
|
+
2130,
|
|
19654
|
+
2131,
|
|
19655
|
+
2132,
|
|
19656
|
+
2133,
|
|
19657
|
+
2134,
|
|
19658
|
+
2135,
|
|
19659
|
+
2136,
|
|
19660
|
+
2137,
|
|
19661
|
+
2138,
|
|
19662
|
+
2146,
|
|
19663
|
+
2147,
|
|
19664
|
+
2148,
|
|
19665
|
+
2149,
|
|
19666
|
+
2150,
|
|
19667
|
+
2151,
|
|
19668
|
+
2152,
|
|
19669
|
+
2154,
|
|
19670
|
+
2155,
|
|
19671
|
+
2156,
|
|
19672
|
+
2161,
|
|
19673
|
+
2162,
|
|
19674
|
+
2164,
|
|
19675
|
+
2165,
|
|
19676
|
+
2166,
|
|
19677
|
+
2167,
|
|
19678
|
+
2168,
|
|
19679
|
+
2169,
|
|
19680
|
+
2170,
|
|
19681
|
+
2171,
|
|
19682
|
+
2172,
|
|
19683
|
+
2173,
|
|
19684
|
+
2174,
|
|
19685
|
+
2175,
|
|
19686
|
+
2180,
|
|
19687
|
+
2181,
|
|
19688
|
+
2182,
|
|
19689
|
+
2183,
|
|
19690
|
+
2184,
|
|
19691
|
+
2185,
|
|
19692
|
+
2186,
|
|
19693
|
+
2187,
|
|
19694
|
+
2188,
|
|
19695
|
+
2189,
|
|
19696
|
+
2190,
|
|
19697
|
+
2191,
|
|
19698
|
+
2192,
|
|
19699
|
+
2194,
|
|
19700
|
+
2195,
|
|
19701
|
+
2196,
|
|
19702
|
+
2197,
|
|
19703
|
+
2198,
|
|
19704
|
+
2199,
|
|
19705
|
+
2200,
|
|
19706
|
+
2201,
|
|
19707
|
+
2202,
|
|
19708
|
+
2203,
|
|
19709
|
+
2204,
|
|
19710
|
+
2205,
|
|
19711
|
+
2206,
|
|
19712
|
+
2207,
|
|
19713
|
+
2211,
|
|
19714
|
+
2212,
|
|
19715
|
+
2213,
|
|
19716
|
+
2214,
|
|
19717
|
+
2215,
|
|
19718
|
+
4097,
|
|
19719
|
+
4098,
|
|
19720
|
+
4099,
|
|
19721
|
+
4102,
|
|
19722
|
+
4103,
|
|
19723
|
+
4105,
|
|
19724
|
+
4106,
|
|
19725
|
+
4107,
|
|
19726
|
+
4108,
|
|
19727
|
+
4109,
|
|
19728
|
+
4116,
|
|
19729
|
+
4117,
|
|
19730
|
+
4118,
|
|
19731
|
+
4119,
|
|
19732
|
+
4120,
|
|
19733
|
+
4121,
|
|
19734
|
+
4122,
|
|
19735
|
+
4123,
|
|
19736
|
+
4124,
|
|
19737
|
+
4125,
|
|
19738
|
+
4126,
|
|
19739
|
+
4127,
|
|
19740
|
+
4128,
|
|
19741
|
+
4129,
|
|
19742
|
+
4130,
|
|
19743
|
+
4132,
|
|
19744
|
+
4133,
|
|
19745
|
+
4134,
|
|
19746
|
+
4135,
|
|
19747
|
+
4146,
|
|
19748
|
+
4147,
|
|
19749
|
+
4148,
|
|
19750
|
+
4149,
|
|
19751
|
+
4154,
|
|
19752
|
+
4156,
|
|
19753
|
+
4157,
|
|
19754
|
+
4158,
|
|
19755
|
+
4159,
|
|
19756
|
+
4160,
|
|
19757
|
+
4161,
|
|
19758
|
+
4163,
|
|
19759
|
+
4164,
|
|
19760
|
+
4165,
|
|
19761
|
+
4166,
|
|
19762
|
+
4168,
|
|
19763
|
+
4170,
|
|
19764
|
+
4171,
|
|
19765
|
+
4174,
|
|
19766
|
+
4175,
|
|
19767
|
+
4176,
|
|
19768
|
+
4177,
|
|
19769
|
+
4187,
|
|
19770
|
+
4188,
|
|
19771
|
+
4189,
|
|
19772
|
+
4191,
|
|
19773
|
+
4192,
|
|
19774
|
+
4193,
|
|
19775
|
+
4194,
|
|
19776
|
+
4195,
|
|
19777
|
+
4196,
|
|
19778
|
+
4197,
|
|
19779
|
+
4198,
|
|
19780
|
+
4199,
|
|
19781
|
+
4200
|
|
19782
|
+
]);
|
|
19783
|
+
XLS_FRT_WRAPPER = 2129;
|
|
19784
|
+
}
|
|
19785
|
+
});
|
|
19786
|
+
|
|
19787
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-cell-record-replacement.js
|
|
19788
|
+
function applyXlsCellRecordReplacement(input2, m, replacement) {
|
|
19789
|
+
if (!Number.isSafeInteger(replacement.start) || !Number.isSafeInteger(replacement.end) || replacement.start < 0 || replacement.end <= replacement.start || replacement.end > input2.length || !(replacement.bytes instanceof Uint8Array))
|
|
19790
|
+
reject("malformed-records");
|
|
19791
|
+
const target = m.records.find((r) => r.headerOffset === replacement.start);
|
|
19792
|
+
if (!target || target.dataOffset + target.length !== replacement.end || ![513, 190, 517, 515, 638, 189, 253].includes(target.opcode))
|
|
19793
|
+
reject("malformed-records");
|
|
19794
|
+
const delta2 = replacement.bytes.length - (replacement.end - replacement.start);
|
|
19795
|
+
if (delta2 !== 0 && m.records.some((r) => !KNOWN_XLS_RECORDS.has(r.opcode) || r.opcode === XLS_FRT_WRAPPER))
|
|
19796
|
+
reject("unsupported-pointer-record");
|
|
19797
|
+
const map2 = (address) => {
|
|
19798
|
+
if (!Number.isSafeInteger(address) || address < 0 || address > input2.length || address > replacement.start && address < replacement.end)
|
|
19799
|
+
reject("malformed-records");
|
|
19800
|
+
return address >= replacement.end ? address + delta2 : address;
|
|
19801
|
+
};
|
|
19802
|
+
const out = new Uint8Array(input2.length + delta2);
|
|
19803
|
+
out.set(input2.subarray(0, replacement.start));
|
|
19804
|
+
out.set(replacement.bytes, replacement.start);
|
|
19805
|
+
out.set(input2.subarray(replacement.end), replacement.start + replacement.bytes.length);
|
|
19806
|
+
if (delta2 !== 0) {
|
|
19807
|
+
relocateXlsDbCells(input2, out, m.records, replacement, map2);
|
|
19808
|
+
const source2 = new DataView(input2.buffer, input2.byteOffset, input2.byteLength), dest = new DataView(out.buffer), byOffset = new Map(m.records.map((r) => [r.headerOffset, r]));
|
|
19809
|
+
for (const r of m.records) {
|
|
19810
|
+
if (r.opcode === 133) {
|
|
19811
|
+
if (r.headerOffset >= m.globalsEnd || r.depth !== 1)
|
|
19812
|
+
reject("malformed-records");
|
|
19813
|
+
dest.setUint32(map2(r.dataOffset), map2(source2.getUint32(r.dataOffset, true)), true);
|
|
19814
|
+
}
|
|
19815
|
+
if (r.opcode === 523) {
|
|
19816
|
+
if (r.length < 16 || (r.length - 16) % 4 !== 0)
|
|
19817
|
+
reject("malformed-records");
|
|
19818
|
+
const owner = m.worksheets.find((sheet) => r.depth === 1 && r.headerOffset >= sheet.start && r.headerOffset < sheet.end);
|
|
19819
|
+
if (!owner)
|
|
19820
|
+
reject("malformed-records");
|
|
19821
|
+
const pointers = /* @__PURE__ */ new Set();
|
|
19822
|
+
for (let p = r.dataOffset + 12; p < r.dataOffset + r.length; p += 4) {
|
|
19823
|
+
const address = source2.getUint32(p, true);
|
|
19824
|
+
const pointed = byOffset.get(address);
|
|
19825
|
+
if (pointed?.opcode !== (p === r.dataOffset + 12 ? 85 : 215) || pointed.depth !== 1 || address < owner.start || address >= owner.end)
|
|
19826
|
+
reject("malformed-records");
|
|
19827
|
+
if (pointers.has(address))
|
|
19828
|
+
reject("malformed-records");
|
|
19829
|
+
pointers.add(address);
|
|
19830
|
+
dest.setUint32(map2(p), map2(address), true);
|
|
19831
|
+
}
|
|
19832
|
+
}
|
|
19833
|
+
}
|
|
19834
|
+
}
|
|
19835
|
+
return out;
|
|
19836
|
+
}
|
|
19837
|
+
var init_legacy_excel_cell_record_replacement = __esm({
|
|
19838
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-cell-record-replacement.js"() {
|
|
19839
|
+
init_legacy_excel_record_edit_model();
|
|
19840
|
+
init_legacy_excel_cell_record_splices();
|
|
19841
|
+
init_legacy_excel_known_records();
|
|
19842
|
+
}
|
|
19843
|
+
});
|
|
19844
|
+
|
|
19845
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-numeric-promotion.js
|
|
19846
|
+
function promote(input2, target, col, value) {
|
|
19847
|
+
const source2 = new DataView(input2.buffer, input2.byteOffset, input2.byteLength), p = target.dataOffset;
|
|
19848
|
+
const packed = target.opcode === 189;
|
|
19849
|
+
const first2 = packed ? source2.getUint16(p + 2, true) : col;
|
|
19850
|
+
const count2 = packed ? (target.length - 6) / 6 : 1, selected = col - first2;
|
|
19851
|
+
const record3 = (opcode, data2) => {
|
|
19852
|
+
const out = new Uint8Array(data2.length + 4), view2 = new DataView(out.buffer);
|
|
19853
|
+
view2.setUint16(0, opcode, true);
|
|
19854
|
+
view2.setUint16(2, data2.length, true);
|
|
19855
|
+
out.set(data2, 4);
|
|
19856
|
+
return out;
|
|
19857
|
+
};
|
|
19858
|
+
const group = (start, size) => {
|
|
19859
|
+
if (!size)
|
|
19860
|
+
return new Uint8Array();
|
|
19861
|
+
const data2 = new Uint8Array(size === 1 ? 10 : 6 + size * 6), view2 = new DataView(data2.buffer);
|
|
19862
|
+
view2.setUint16(0, source2.getUint16(p, true), true);
|
|
19863
|
+
view2.setUint16(2, first2 + start, true);
|
|
19864
|
+
data2.set(input2.subarray(p + 4 + start * 6, p + 4 + (start + size) * 6), 4);
|
|
19865
|
+
if (size > 1)
|
|
19866
|
+
view2.setUint16(data2.length - 2, first2 + start + size - 1, true);
|
|
19867
|
+
return record3(size === 1 ? 638 : 189, data2);
|
|
19868
|
+
};
|
|
19869
|
+
const data = new Uint8Array(14), view = new DataView(data.buffer);
|
|
19870
|
+
view.setUint16(0, source2.getUint16(p, true), true);
|
|
19871
|
+
view.setUint16(2, col, true);
|
|
19872
|
+
view.setUint16(4, source2.getUint16(p + (packed ? 4 + selected * 6 : 4), true), true);
|
|
19873
|
+
view.setFloat64(6, value, true);
|
|
19874
|
+
const prefix = packed ? group(0, selected) : new Uint8Array(), number5 = record3(515, data);
|
|
19875
|
+
const suffix = packed ? group(selected + 1, count2 - selected - 1) : new Uint8Array();
|
|
19876
|
+
const bytes = new Uint8Array(prefix.length + number5.length + suffix.length);
|
|
19877
|
+
bytes.set(prefix);
|
|
19878
|
+
bytes.set(number5, prefix.length);
|
|
19879
|
+
bytes.set(suffix, prefix.length + number5.length);
|
|
19880
|
+
return bytes;
|
|
19881
|
+
}
|
|
19882
|
+
function promoteXlsNumericCell(input2, edit) {
|
|
19883
|
+
const m = model(input2), target = findTarget(input2, m, edit, [638, 189]);
|
|
19884
|
+
const source2 = new DataView(input2.buffer, input2.byteOffset, input2.byteLength), range = m.worksheets[edit.worksheetIndex ?? 0];
|
|
19885
|
+
for (const record3 of m.records.filter((r) => r.opcode === 229 && r.depth === 1 && r.headerOffset >= range.start && r.headerOffset < range.end)) {
|
|
19886
|
+
if (record3.length < 2 || record3.length !== 2 + source2.getUint16(record3.dataOffset, true) * 8)
|
|
19887
|
+
reject("malformed-records");
|
|
19888
|
+
for (let p = record3.dataOffset + 2; p < record3.dataOffset + record3.length; p += 8) {
|
|
19889
|
+
const firstRow = source2.getUint16(p, true), lastRow = source2.getUint16(p + 2, true), firstCol = source2.getUint16(p + 4, true), lastCol = source2.getUint16(p + 6, true);
|
|
19890
|
+
if (firstRow > lastRow || firstCol > lastCol || lastCol > 255)
|
|
19891
|
+
reject("malformed-records");
|
|
19892
|
+
if (edit.row >= firstRow && edit.row <= lastRow && edit.col >= firstCol && edit.col <= lastCol && (edit.row !== firstRow || edit.col !== firstCol))
|
|
19893
|
+
reject("cell-not-supported");
|
|
19894
|
+
}
|
|
19895
|
+
}
|
|
19896
|
+
return applyXlsCellRecordReplacement(input2, m, { start: target.headerOffset, end: target.dataOffset + target.length, bytes: promote(input2, target, edit.col, edit.value) });
|
|
19897
|
+
}
|
|
19898
|
+
var init_legacy_excel_numeric_promotion = __esm({
|
|
19899
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-numeric-promotion.js"() {
|
|
19900
|
+
init_legacy_excel_record_edit_model();
|
|
19901
|
+
init_legacy_excel_cell_record_replacement();
|
|
19902
|
+
}
|
|
19903
|
+
});
|
|
19904
|
+
|
|
19905
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-v4.js
|
|
19906
|
+
function follow(table, start) {
|
|
19907
|
+
const ids = [], seen = /* @__PURE__ */ new Set();
|
|
19908
|
+
for (let id = start; id !== END2; id = table[id]) {
|
|
19909
|
+
if (id >= table.length || seen.has(id))
|
|
19910
|
+
throw new Error("Invalid allocation chain");
|
|
19911
|
+
seen.add(id);
|
|
19912
|
+
ids.push(id);
|
|
19913
|
+
}
|
|
19914
|
+
return ids;
|
|
19915
|
+
}
|
|
19916
|
+
function findSlot(slots, path4) {
|
|
19917
|
+
let parent = slots.get(0);
|
|
19918
|
+
if (!parent || parent.type !== 5)
|
|
19919
|
+
throw new Error("Invalid root");
|
|
19920
|
+
const parents = /* @__PURE__ */ new Set();
|
|
19921
|
+
for (let part = 0; part < path4.length; part++) {
|
|
19922
|
+
if (parents.has(parent.id))
|
|
19923
|
+
throw new Error("Cyclic storage hierarchy");
|
|
19924
|
+
parents.add(parent.id);
|
|
19925
|
+
const stack = [parent.child], seen = /* @__PURE__ */ new Set(), matches = [];
|
|
19926
|
+
while (stack.length) {
|
|
19927
|
+
const id = stack.pop();
|
|
19928
|
+
if (id === FREE)
|
|
19929
|
+
continue;
|
|
19930
|
+
if (seen.has(id))
|
|
19931
|
+
throw new Error("Invalid directory tree");
|
|
19932
|
+
seen.add(id);
|
|
19933
|
+
const slot2 = slots.get(id);
|
|
19934
|
+
if (!slot2)
|
|
19935
|
+
throw new Error("Missing directory slot");
|
|
19936
|
+
if (slot2.name.toLocaleLowerCase() === path4[part].toLocaleLowerCase())
|
|
19937
|
+
matches.push(slot2);
|
|
19938
|
+
stack.push(slot2.left, slot2.right);
|
|
19939
|
+
}
|
|
19940
|
+
if (matches.length !== 1)
|
|
19941
|
+
throw new Error("Missing or ambiguous stream");
|
|
19942
|
+
parent = matches[0];
|
|
19943
|
+
if (parent.type !== (part === path4.length - 1 ? 2 : 1))
|
|
19944
|
+
throw new Error("Invalid storage path");
|
|
19945
|
+
}
|
|
19946
|
+
return parent;
|
|
19947
|
+
}
|
|
19948
|
+
function validateHierarchy(slots) {
|
|
19949
|
+
const owners = /* @__PURE__ */ new Set(), storages = [0];
|
|
19950
|
+
while (storages.length) {
|
|
19951
|
+
const storage = slots.get(storages.pop());
|
|
19952
|
+
const stack = [storage.child], names = /* @__PURE__ */ new Set();
|
|
19953
|
+
while (stack.length) {
|
|
19954
|
+
const id = stack.pop();
|
|
19955
|
+
if (id === FREE)
|
|
19956
|
+
continue;
|
|
19957
|
+
const slot2 = slots.get(id);
|
|
19958
|
+
if (!slot2 || slot2.type !== 1 && slot2.type !== 2 || owners.has(id))
|
|
19959
|
+
throw new Error("Ambiguous directory ownership");
|
|
19960
|
+
const name = slot2.name.toLocaleLowerCase();
|
|
19961
|
+
if (names.has(name))
|
|
19962
|
+
throw new Error("Duplicate sibling name");
|
|
19963
|
+
names.add(name);
|
|
19964
|
+
owners.add(id);
|
|
19965
|
+
stack.push(slot2.left, slot2.right);
|
|
19966
|
+
if (slot2.type === 1)
|
|
19967
|
+
storages.push(id);
|
|
19968
|
+
}
|
|
19969
|
+
}
|
|
19970
|
+
if (owners.size !== slots.size - 1)
|
|
19971
|
+
throw new Error("Unreachable directory entries");
|
|
19972
|
+
}
|
|
19973
|
+
function resizeCompoundFileStreamV4(input2, path4, replacement) {
|
|
19974
|
+
const fail2 = (reason) => ({ ok: false, bytes: input2, reason });
|
|
19975
|
+
try {
|
|
19976
|
+
if (input2.length < 512 || !path4.length || path4.some((part) => !part))
|
|
19977
|
+
return fail2("invalid-or-missing-stream");
|
|
19978
|
+
const view = new DataView(input2.buffer, input2.byteOffset, input2.byteLength);
|
|
19979
|
+
const read = (offset) => view.getUint32(offset, true);
|
|
19980
|
+
const version2 = view.getUint16(26, true);
|
|
19981
|
+
if (version2 !== 4)
|
|
19982
|
+
return fail2("unsupported-version");
|
|
19983
|
+
const SECTOR3 = 4096, FAT_ENTRIES2 = SECTOR3 / 4, DIRECTORY_ENTRIES = SECTOR3 / 128;
|
|
19984
|
+
if (read(72) !== 0 || read(44) > 109)
|
|
19985
|
+
return fail2("unsupported-difat");
|
|
19986
|
+
const cutoff = read(56);
|
|
19987
|
+
if (cutoff !== 0 && cutoff !== 4096)
|
|
19988
|
+
return fail2("unsupported-layout");
|
|
19989
|
+
const original = readCompoundFileStream(input2, path4);
|
|
19990
|
+
if (!original)
|
|
19991
|
+
return fail2("invalid-or-missing-stream");
|
|
19992
|
+
const name = path4[path4.length - 1].toLocaleLowerCase();
|
|
19993
|
+
if (name === "worddocument" && original.length >= 12 && (original[10] | original[11] << 8) & 33024)
|
|
19994
|
+
return fail2("unsafe-edit");
|
|
19995
|
+
if (name === "book" || name === "workbook") {
|
|
19996
|
+
for (let offset = 0; offset + 4 <= original.length; ) {
|
|
19997
|
+
const record3 = original[offset] | original[offset + 1] << 8;
|
|
19998
|
+
const length = original[offset + 2] | original[offset + 3] << 8;
|
|
19999
|
+
if (record3 === 47)
|
|
20000
|
+
return fail2("unsafe-edit");
|
|
20001
|
+
if (record3 === 10 || offset + 4 + length > original.length)
|
|
20002
|
+
break;
|
|
20003
|
+
offset += 4 + length;
|
|
20004
|
+
}
|
|
20005
|
+
}
|
|
20006
|
+
const validated = replaceCompoundFileStream(input2, path4, original);
|
|
20007
|
+
if (validated === input2)
|
|
20008
|
+
return fail2("unsafe-edit");
|
|
20009
|
+
const sameLength = replacement.length === original.length;
|
|
20010
|
+
if (!sameLength && original.length < cutoff)
|
|
20011
|
+
return fail2("unsupported-mini-stream");
|
|
20012
|
+
if (!sameLength && replacement.length < cutoff)
|
|
20013
|
+
return fail2("unsupported-mini-transition");
|
|
20014
|
+
const sectorCount = input2.length / SECTOR3 - 1, fatCount = read(44);
|
|
20015
|
+
if (sectorCount > fatCount * FAT_ENTRIES2)
|
|
20016
|
+
return fail2("unsafe-edit");
|
|
20017
|
+
const fatIds = Array.from({ length: fatCount }, (_, i2) => read(76 + 4 * i2));
|
|
20018
|
+
const fat = [];
|
|
20019
|
+
for (const id of fatIds) {
|
|
20020
|
+
for (let i2 = 0; i2 < FAT_ENTRIES2 && fat.length < sectorCount; i2++)
|
|
20021
|
+
fat.push(read((id + 1) * SECTOR3 + i2 * 4));
|
|
20022
|
+
}
|
|
20023
|
+
if (fatIds.some((id) => fat[id] !== FAT))
|
|
20024
|
+
return fail2("unsafe-edit");
|
|
20025
|
+
const slots = /* @__PURE__ */ new Map();
|
|
20026
|
+
const directoryChain = follow(fat, read(48));
|
|
20027
|
+
if (read(40) !== directoryChain.length)
|
|
20028
|
+
return fail2("unsafe-edit");
|
|
20029
|
+
for (const [block, sector] of directoryChain.entries()) {
|
|
20030
|
+
for (let entry2 = 0; entry2 < DIRECTORY_ENTRIES; entry2++) {
|
|
20031
|
+
const offset = (sector + 1) * SECTOR3 + entry2 * 128, type = view.getUint8(offset + 66);
|
|
20032
|
+
if (!type)
|
|
20033
|
+
continue;
|
|
20034
|
+
const nameLength = view.getUint16(offset + 64, true);
|
|
20035
|
+
if (![1, 2, 5].includes(type) || nameLength < 2 || nameLength > 64 || nameLength % 2 || view.getUint16(offset + nameLength - 2, true))
|
|
20036
|
+
return fail2("unsafe-edit");
|
|
20037
|
+
let name2 = "";
|
|
20038
|
+
for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
|
|
20039
|
+
name2 += String.fromCharCode(view.getUint16(offset + i2, true));
|
|
20040
|
+
if (read(offset + 124) !== 0)
|
|
20041
|
+
return fail2("unsafe-edit");
|
|
20042
|
+
const id = block * DIRECTORY_ENTRIES + entry2;
|
|
20043
|
+
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 });
|
|
20044
|
+
}
|
|
20045
|
+
}
|
|
20046
|
+
if ([...slots.values()].filter((slot2) => slot2.type === 5).length !== 1)
|
|
20047
|
+
return fail2("unsafe-edit");
|
|
20048
|
+
const target = findSlot(slots, path4);
|
|
20049
|
+
validateHierarchy(slots);
|
|
20050
|
+
if (sameLength) {
|
|
20051
|
+
const bytes = replaceCompoundFileStream(input2, path4, replacement);
|
|
20052
|
+
return bytes === input2 ? fail2("unsafe-edit") : { ok: true, bytes };
|
|
20053
|
+
}
|
|
20054
|
+
const oldChain = follow(fat, target.start);
|
|
20055
|
+
if (target.size !== original.length || oldChain.length !== Math.ceil(target.size / SECTOR3))
|
|
20056
|
+
return fail2("unsafe-edit");
|
|
20057
|
+
const payloadSectors = Math.ceil(replacement.length / SECTOR3);
|
|
20058
|
+
let newFatCount = fatCount;
|
|
20059
|
+
while (sectorCount + payloadSectors + newFatCount - fatCount > newFatCount * FAT_ENTRIES2)
|
|
20060
|
+
newFatCount++;
|
|
20061
|
+
if (newFatCount > 109)
|
|
20062
|
+
return fail2("allocation-limit");
|
|
20063
|
+
const totalSectors = sectorCount + payloadSectors + newFatCount - fatCount;
|
|
20064
|
+
const output2 = new Uint8Array((totalSectors + 1) * SECTOR3);
|
|
20065
|
+
output2.set(input2);
|
|
20066
|
+
output2.set(replacement, (sectorCount + 1) * SECTOR3);
|
|
20067
|
+
const outView = new DataView(output2.buffer);
|
|
20068
|
+
for (let i2 = fatCount; i2 < newFatCount; i2++) {
|
|
20069
|
+
const id = sectorCount + payloadSectors + i2 - fatCount;
|
|
20070
|
+
fatIds.push(id);
|
|
20071
|
+
output2.fill(255, (id + 1) * SECTOR3, (id + 2) * SECTOR3);
|
|
20072
|
+
outView.setUint32(76 + i2 * 4, id, true);
|
|
20073
|
+
}
|
|
20074
|
+
outView.setUint32(44, newFatCount, true);
|
|
20075
|
+
const writeFat = (id, value) => outView.setUint32((fatIds[Math.floor(id / FAT_ENTRIES2)] + 1) * SECTOR3 + id % FAT_ENTRIES2 * 4, value, true);
|
|
20076
|
+
for (const id of oldChain)
|
|
20077
|
+
writeFat(id, FREE);
|
|
20078
|
+
for (let i2 = 0; i2 < payloadSectors; i2++)
|
|
20079
|
+
writeFat(sectorCount + i2, i2 + 1 === payloadSectors ? END2 : sectorCount + i2 + 1);
|
|
20080
|
+
for (const id of fatIds)
|
|
20081
|
+
writeFat(id, FAT);
|
|
20082
|
+
outView.setUint32(target.offset + 116, payloadSectors ? sectorCount : END2, true);
|
|
20083
|
+
outView.setUint32(target.offset + 120, replacement.length, true);
|
|
20084
|
+
return { ok: true, bytes: output2 };
|
|
20085
|
+
} catch {
|
|
20086
|
+
return fail2("unsafe-edit");
|
|
20087
|
+
}
|
|
20088
|
+
}
|
|
20089
|
+
var END2, FREE, FAT;
|
|
20090
|
+
var init_ole2_stream_resize_v4 = __esm({
|
|
20091
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-v4.js"() {
|
|
20092
|
+
init_ole2_stream_edit();
|
|
20093
|
+
END2 = 4294967294;
|
|
20094
|
+
FREE = 4294967295;
|
|
20095
|
+
FAT = 4294967293;
|
|
20096
|
+
}
|
|
20097
|
+
});
|
|
20098
|
+
|
|
20099
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-allocation.js
|
|
20100
|
+
function appendCompoundAllocations(input2, existingFatIds, payloads, sectorSize = 512) {
|
|
20101
|
+
const sectorCount = input2.length / sectorSize - 1;
|
|
20102
|
+
const entriesPerFat = sectorSize / 4;
|
|
20103
|
+
const counts = payloads.map((payload) => Math.ceil(payload.length / sectorSize));
|
|
20104
|
+
const payloadSectors = counts.reduce((sum, count2) => sum + count2, 0);
|
|
20105
|
+
let fatCount = existingFatIds.length;
|
|
20106
|
+
while (sectorCount + payloadSectors + fatCount - existingFatIds.length > fatCount * entriesPerFat)
|
|
20107
|
+
fatCount++;
|
|
20108
|
+
if (fatCount > 109)
|
|
20109
|
+
return void 0;
|
|
20110
|
+
const totalSectors = sectorCount + payloadSectors + fatCount - existingFatIds.length;
|
|
20111
|
+
const bytes = new Uint8Array((totalSectors + 1) * sectorSize);
|
|
20112
|
+
bytes.set(input2);
|
|
20113
|
+
const view = new DataView(bytes.buffer), fatIds = [...existingFatIds];
|
|
20114
|
+
for (let i2 = existingFatIds.length; i2 < fatCount; i2++) {
|
|
20115
|
+
const id = sectorCount + payloadSectors + i2 - existingFatIds.length;
|
|
20116
|
+
fatIds.push(id);
|
|
20117
|
+
bytes.fill(255, (id + 1) * sectorSize, (id + 2) * sectorSize);
|
|
20118
|
+
view.setUint32(76 + i2 * 4, id, true);
|
|
20119
|
+
}
|
|
20120
|
+
view.setUint32(44, fatCount, true);
|
|
20121
|
+
const writeFat = (id, value) => view.setUint32((fatIds[Math.floor(id / entriesPerFat)] + 1) * sectorSize + id % entriesPerFat * 4, value, true);
|
|
20122
|
+
const chains = [];
|
|
20123
|
+
let next = sectorCount;
|
|
20124
|
+
for (let payload = 0; payload < payloads.length; payload++) {
|
|
20125
|
+
bytes.set(payloads[payload], (next + 1) * sectorSize);
|
|
20126
|
+
const chain2 = Array.from({ length: counts[payload] }, (_, i2) => next + i2);
|
|
20127
|
+
chain2.forEach((id, i2) => writeFat(id, chain2[i2 + 1] ?? 4294967294));
|
|
20128
|
+
chains.push(chain2);
|
|
20129
|
+
next += counts[payload];
|
|
20130
|
+
}
|
|
20131
|
+
for (const id of fatIds)
|
|
20132
|
+
writeFat(id, 4294967293);
|
|
20133
|
+
return { bytes, view, chains, writeFat };
|
|
20134
|
+
}
|
|
20135
|
+
function followCompoundAllocation(table, start) {
|
|
20136
|
+
const ids = [], seen = /* @__PURE__ */ new Set();
|
|
20137
|
+
for (let id = start; id !== 4294967294; id = table[id]) {
|
|
20138
|
+
if (id >= table.length || seen.has(id))
|
|
20139
|
+
throw new Error("Invalid allocation chain");
|
|
20140
|
+
seen.add(id);
|
|
20141
|
+
ids.push(id);
|
|
20142
|
+
}
|
|
20143
|
+
return ids;
|
|
20144
|
+
}
|
|
20145
|
+
var init_ole2_stream_resize_allocation = __esm({
|
|
20146
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-allocation.js"() {
|
|
20147
|
+
}
|
|
20148
|
+
});
|
|
20149
|
+
|
|
20150
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-mini.js
|
|
20151
|
+
function resizeMiniCompoundStream(input2, fat, fatIds, root, target, replacement, cutoff) {
|
|
20152
|
+
const inputView = new DataView(input2.buffer, input2.byteOffset, input2.byteLength);
|
|
20153
|
+
const miniFatCount = inputView.getUint32(64, true);
|
|
20154
|
+
const miniFatSectors = miniFatCount ? followCompoundAllocation(fat, inputView.getUint32(60, true)) : [];
|
|
20155
|
+
if (miniFatSectors.length !== miniFatCount)
|
|
20156
|
+
throw new Error("Invalid mini FAT count");
|
|
20157
|
+
const rootSectors = root.size ? followCompoundAllocation(fat, root.start) : [];
|
|
20158
|
+
if (rootSectors.length !== Math.ceil(root.size / SECTOR))
|
|
20159
|
+
throw new Error("Invalid root mini stream");
|
|
20160
|
+
const miniCapacity = Math.floor(root.size / MINI), miniFat = [];
|
|
20161
|
+
for (const id of miniFatSectors) {
|
|
20162
|
+
for (let slot2 = 0; slot2 < SECTOR / 4 && miniFat.length < miniCapacity; slot2++)
|
|
20163
|
+
miniFat.push(inputView.getUint32((id + 1) * SECTOR + slot2 * 4, true));
|
|
20164
|
+
}
|
|
20165
|
+
const wasMini = target.size < cutoff;
|
|
20166
|
+
const oldChain = followCompoundAllocation(wasMini ? miniFat : fat, target.start);
|
|
20167
|
+
if (oldChain.length !== Math.ceil(target.size / (wasMini ? MINI : SECTOR)))
|
|
20168
|
+
throw new Error("Invalid stream allocation");
|
|
20169
|
+
if (!replacement.length) {
|
|
20170
|
+
const bytes = input2.slice(), view = new DataView(bytes.buffer);
|
|
20171
|
+
for (const id of oldChain) {
|
|
20172
|
+
const table = wasMini ? miniFatSectors : fatIds;
|
|
20173
|
+
view.setUint32((table[Math.floor(id / 128)] + 1) * SECTOR + id % 128 * 4, FREE2, true);
|
|
20174
|
+
}
|
|
20175
|
+
view.setUint32(target.offset + 116, END3, true);
|
|
20176
|
+
view.setUint32(target.offset + 120, 0, true);
|
|
20177
|
+
return bytes;
|
|
20178
|
+
}
|
|
20179
|
+
if (replacement.length >= cutoff) {
|
|
20180
|
+
const output3 = appendCompoundAllocations(input2, fatIds, [replacement]);
|
|
20181
|
+
if (!output3)
|
|
20182
|
+
return void 0;
|
|
20183
|
+
for (const id of oldChain)
|
|
20184
|
+
output3.view.setUint32((miniFatSectors[Math.floor(id / 128)] + 1) * SECTOR + id % 128 * 4, FREE2, true);
|
|
20185
|
+
output3.view.setUint32(target.offset + 116, output3.chains[0][0] ?? END3, true);
|
|
20186
|
+
output3.view.setUint32(target.offset + 120, replacement.length, true);
|
|
20187
|
+
return output3.bytes;
|
|
20188
|
+
}
|
|
20189
|
+
const firstMini = Math.ceil(root.size / MINI), count2 = Math.ceil(replacement.length / MINI);
|
|
20190
|
+
const newRootSize = count2 ? (firstMini + count2) * MINI : root.size;
|
|
20191
|
+
const newRoot = new Uint8Array(newRootSize);
|
|
20192
|
+
rootSectors.forEach((id, i2) => newRoot.set(input2.subarray((id + 1) * SECTOR, (id + 1) * SECTOR + Math.min(SECTOR, root.size - i2 * SECTOR)), i2 * SECTOR));
|
|
20193
|
+
if (count2)
|
|
20194
|
+
newRoot.set(replacement, firstMini * MINI);
|
|
20195
|
+
const newMiniFatCount = Math.max(miniFatCount, Math.ceil((firstMini + count2) / 128));
|
|
20196
|
+
const newMiniFat = new Uint8Array(newMiniFatCount * SECTOR).fill(255);
|
|
20197
|
+
miniFatSectors.forEach((id, i2) => newMiniFat.set(input2.subarray((id + 1) * SECTOR, (id + 2) * SECTOR), i2 * SECTOR));
|
|
20198
|
+
const miniView = new DataView(newMiniFat.buffer);
|
|
20199
|
+
if (wasMini)
|
|
20200
|
+
for (const id of oldChain)
|
|
20201
|
+
miniView.setUint32(id * 4, FREE2, true);
|
|
20202
|
+
for (let i2 = 0; i2 < count2; i2++)
|
|
20203
|
+
miniView.setUint32((firstMini + i2) * 4, i2 + 1 === count2 ? END3 : firstMini + i2 + 1, true);
|
|
20204
|
+
const output2 = appendCompoundAllocations(input2, fatIds, [newRoot, newMiniFat]);
|
|
20205
|
+
if (!output2)
|
|
20206
|
+
return void 0;
|
|
20207
|
+
for (const id of [...rootSectors, ...miniFatSectors, ...wasMini ? [] : oldChain])
|
|
20208
|
+
output2.writeFat(id, FREE2);
|
|
20209
|
+
output2.view.setUint32(root.offset + 116, output2.chains[0][0] ?? END3, true);
|
|
20210
|
+
output2.view.setUint32(root.offset + 120, newRootSize, true);
|
|
20211
|
+
output2.view.setUint32(60, output2.chains[1][0] ?? END3, true);
|
|
20212
|
+
output2.view.setUint32(64, newMiniFatCount, true);
|
|
20213
|
+
output2.view.setUint32(target.offset + 116, count2 ? firstMini : END3, true);
|
|
20214
|
+
output2.view.setUint32(target.offset + 120, replacement.length, true);
|
|
20215
|
+
return output2.bytes;
|
|
20216
|
+
}
|
|
20217
|
+
var END3, FREE2, SECTOR, MINI;
|
|
20218
|
+
var init_ole2_stream_resize_mini = __esm({
|
|
20219
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-mini.js"() {
|
|
20220
|
+
init_ole2_stream_resize_allocation();
|
|
20221
|
+
END3 = 4294967294;
|
|
20222
|
+
FREE2 = 4294967295;
|
|
20223
|
+
SECTOR = 512;
|
|
20224
|
+
MINI = 64;
|
|
20225
|
+
}
|
|
20226
|
+
});
|
|
20227
|
+
|
|
20228
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize.js
|
|
20229
|
+
function follow2(table, start) {
|
|
20230
|
+
const ids = [], seen = /* @__PURE__ */ new Set();
|
|
20231
|
+
for (let id = start; id !== END4; id = table[id]) {
|
|
20232
|
+
if (id >= table.length || seen.has(id))
|
|
20233
|
+
throw new Error("Invalid allocation chain");
|
|
20234
|
+
seen.add(id);
|
|
20235
|
+
ids.push(id);
|
|
20236
|
+
}
|
|
20237
|
+
return ids;
|
|
20238
|
+
}
|
|
20239
|
+
function findSlot2(slots, path4) {
|
|
20240
|
+
let parent = slots.get(0);
|
|
20241
|
+
if (!parent || parent.type !== 5)
|
|
20242
|
+
throw new Error("Invalid root");
|
|
20243
|
+
const parents = /* @__PURE__ */ new Set();
|
|
20244
|
+
for (let part = 0; part < path4.length; part++) {
|
|
20245
|
+
if (parents.has(parent.id))
|
|
20246
|
+
throw new Error("Cyclic storage hierarchy");
|
|
20247
|
+
parents.add(parent.id);
|
|
20248
|
+
const stack = [parent.child], seen = /* @__PURE__ */ new Set(), matches = [];
|
|
20249
|
+
while (stack.length) {
|
|
20250
|
+
const id = stack.pop();
|
|
20251
|
+
if (id === FREE3)
|
|
20252
|
+
continue;
|
|
20253
|
+
if (seen.has(id))
|
|
20254
|
+
throw new Error("Invalid directory tree");
|
|
20255
|
+
seen.add(id);
|
|
20256
|
+
const slot2 = slots.get(id);
|
|
20257
|
+
if (!slot2)
|
|
20258
|
+
throw new Error("Missing directory slot");
|
|
20259
|
+
if (slot2.name.toLocaleLowerCase() === path4[part].toLocaleLowerCase())
|
|
20260
|
+
matches.push(slot2);
|
|
20261
|
+
stack.push(slot2.left, slot2.right);
|
|
20262
|
+
}
|
|
20263
|
+
if (matches.length !== 1)
|
|
20264
|
+
throw new Error("Missing or ambiguous stream");
|
|
20265
|
+
parent = matches[0];
|
|
20266
|
+
if (parent.type !== (part === path4.length - 1 ? 2 : 1))
|
|
20267
|
+
throw new Error("Invalid storage path");
|
|
20268
|
+
}
|
|
20269
|
+
return parent;
|
|
20270
|
+
}
|
|
20271
|
+
function validateHierarchy2(slots) {
|
|
20272
|
+
const owners = /* @__PURE__ */ new Set(), storages = [0];
|
|
20273
|
+
while (storages.length) {
|
|
20274
|
+
const storage = slots.get(storages.pop());
|
|
20275
|
+
const stack = [storage.child], names = /* @__PURE__ */ new Set();
|
|
20276
|
+
while (stack.length) {
|
|
20277
|
+
const id = stack.pop();
|
|
20278
|
+
if (id === FREE3)
|
|
20279
|
+
continue;
|
|
20280
|
+
const slot2 = slots.get(id);
|
|
20281
|
+
if (!slot2 || slot2.type !== 1 && slot2.type !== 2 || owners.has(id))
|
|
20282
|
+
throw new Error("Ambiguous directory ownership");
|
|
20283
|
+
const name = slot2.name.toLocaleLowerCase();
|
|
20284
|
+
if (names.has(name))
|
|
20285
|
+
throw new Error("Duplicate sibling name");
|
|
20286
|
+
names.add(name);
|
|
20287
|
+
owners.add(id);
|
|
20288
|
+
stack.push(slot2.left, slot2.right);
|
|
20289
|
+
if (slot2.type === 1)
|
|
20290
|
+
storages.push(id);
|
|
20291
|
+
}
|
|
20292
|
+
}
|
|
20293
|
+
if (owners.size !== slots.size - 1)
|
|
20294
|
+
throw new Error("Unreachable directory entries");
|
|
20295
|
+
}
|
|
20296
|
+
function resizeCompoundFileStream(input2, path4, replacement) {
|
|
20297
|
+
if (input2.length >= 512 && new DataView(input2.buffer, input2.byteOffset, input2.byteLength).getUint16(26, true) === 4)
|
|
20298
|
+
return resizeCompoundFileStreamV4(input2, path4, replacement);
|
|
20299
|
+
const fail2 = (reason) => ({ ok: false, bytes: input2, reason });
|
|
20300
|
+
try {
|
|
20301
|
+
if (input2.length < SECTOR2 || !path4.length || path4.some((part) => !part))
|
|
20302
|
+
return fail2("invalid-or-missing-stream");
|
|
20303
|
+
const view = new DataView(input2.buffer, input2.byteOffset, input2.byteLength);
|
|
20304
|
+
const read = (offset) => view.getUint32(offset, true);
|
|
20305
|
+
if (view.getUint16(26, true) !== 3)
|
|
20306
|
+
return fail2("unsupported-version");
|
|
20307
|
+
if (read(72) !== 0 || read(44) > 109)
|
|
20308
|
+
return fail2("unsupported-difat");
|
|
20309
|
+
const cutoff = read(56);
|
|
20310
|
+
if (cutoff !== 0 && cutoff !== 4096)
|
|
20311
|
+
return fail2("unsupported-layout");
|
|
20312
|
+
const original = readCompoundFileStream(input2, path4);
|
|
20313
|
+
if (!original)
|
|
20314
|
+
return fail2("invalid-or-missing-stream");
|
|
20315
|
+
const name = path4[path4.length - 1].toLocaleLowerCase();
|
|
20316
|
+
if (name === "worddocument" && original.length >= 12 && (original[10] | original[11] << 8) & 33024)
|
|
20317
|
+
return fail2("unsafe-edit");
|
|
20318
|
+
if (name === "book" || name === "workbook") {
|
|
20319
|
+
for (let offset = 0; offset + 4 <= original.length; ) {
|
|
20320
|
+
const record3 = original[offset] | original[offset + 1] << 8;
|
|
20321
|
+
const length = original[offset + 2] | original[offset + 3] << 8;
|
|
20322
|
+
if (record3 === 47)
|
|
20323
|
+
return fail2("unsafe-edit");
|
|
20324
|
+
if (record3 === 10 || offset + 4 + length > original.length)
|
|
20325
|
+
break;
|
|
20326
|
+
offset += 4 + length;
|
|
20327
|
+
}
|
|
20328
|
+
}
|
|
20329
|
+
const validated = replaceCompoundFileStream(input2, path4, original);
|
|
20330
|
+
if (validated === input2)
|
|
20331
|
+
return fail2("unsafe-edit");
|
|
20332
|
+
const sameLength = replacement.length === original.length;
|
|
20333
|
+
const sectorCount = input2.length / SECTOR2 - 1, fatCount = read(44);
|
|
20334
|
+
if (sectorCount > fatCount * FAT_ENTRIES)
|
|
20335
|
+
return fail2("unsafe-edit");
|
|
20336
|
+
const fatIds = Array.from({ length: fatCount }, (_, i2) => read(76 + 4 * i2));
|
|
20337
|
+
const fat = [];
|
|
20338
|
+
for (const id of fatIds) {
|
|
20339
|
+
for (let i2 = 0; i2 < FAT_ENTRIES && fat.length < sectorCount; i2++)
|
|
20340
|
+
fat.push(read((id + 1) * SECTOR2 + i2 * 4));
|
|
20341
|
+
}
|
|
20342
|
+
if (fatIds.some((id) => fat[id] !== FAT2))
|
|
20343
|
+
return fail2("unsafe-edit");
|
|
20344
|
+
const slots = /* @__PURE__ */ new Map();
|
|
20345
|
+
for (const [block, sector] of follow2(fat, read(48)).entries()) {
|
|
20346
|
+
for (let entry2 = 0; entry2 < 4; entry2++) {
|
|
20347
|
+
const offset = (sector + 1) * SECTOR2 + entry2 * 128, type = view.getUint8(offset + 66);
|
|
20348
|
+
if (!type)
|
|
20349
|
+
continue;
|
|
20350
|
+
const nameLength = view.getUint16(offset + 64, true);
|
|
20351
|
+
if (![1, 2, 5].includes(type) || nameLength < 2 || nameLength > 64 || nameLength % 2 || view.getUint16(offset + nameLength - 2, true))
|
|
20352
|
+
return fail2("unsafe-edit");
|
|
20353
|
+
let name2 = "";
|
|
20354
|
+
for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
|
|
20355
|
+
name2 += String.fromCharCode(view.getUint16(offset + i2, true));
|
|
20356
|
+
const id = block * 4 + entry2;
|
|
20357
|
+
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 });
|
|
20358
|
+
}
|
|
20359
|
+
}
|
|
20360
|
+
if ([...slots.values()].filter((slot2) => slot2.type === 5).length !== 1)
|
|
20361
|
+
return fail2("unsafe-edit");
|
|
20362
|
+
const target = findSlot2(slots, path4);
|
|
20363
|
+
validateHierarchy2(slots);
|
|
20364
|
+
if (sameLength) {
|
|
20365
|
+
const bytes = replaceCompoundFileStream(input2, path4, replacement);
|
|
20366
|
+
return bytes === input2 ? fail2("unsafe-edit") : { ok: true, bytes };
|
|
20367
|
+
}
|
|
20368
|
+
if (original.length < cutoff || replacement.length < cutoff) {
|
|
20369
|
+
const bytes = resizeMiniCompoundStream(input2, fat, fatIds, slots.get(0), target, replacement, cutoff);
|
|
20370
|
+
return bytes ? { ok: true, bytes } : fail2("allocation-limit");
|
|
20371
|
+
}
|
|
20372
|
+
const oldChain = follow2(fat, target.start);
|
|
20373
|
+
if (target.size !== original.length || oldChain.length !== Math.ceil(target.size / SECTOR2))
|
|
20374
|
+
return fail2("unsafe-edit");
|
|
20375
|
+
const output2 = appendCompoundAllocations(input2, fatIds, [replacement]);
|
|
20376
|
+
if (!output2)
|
|
20377
|
+
return fail2("allocation-limit");
|
|
20378
|
+
for (const id of oldChain)
|
|
20379
|
+
output2.writeFat(id, FREE3);
|
|
20380
|
+
output2.view.setUint32(target.offset + 116, output2.chains[0][0] ?? END4, true);
|
|
20381
|
+
output2.view.setUint32(target.offset + 120, replacement.length, true);
|
|
20382
|
+
return { ok: true, bytes: output2.bytes };
|
|
20383
|
+
} catch {
|
|
20384
|
+
return fail2("unsafe-edit");
|
|
20385
|
+
}
|
|
20386
|
+
}
|
|
20387
|
+
var END4, FREE3, FAT2, SECTOR2, FAT_ENTRIES;
|
|
20388
|
+
var init_ole2_stream_resize = __esm({
|
|
20389
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize.js"() {
|
|
20390
|
+
init_ole2_stream_edit();
|
|
20391
|
+
init_ole2_stream_resize_v4();
|
|
20392
|
+
init_ole2_stream_resize_allocation();
|
|
20393
|
+
init_ole2_stream_resize_mini();
|
|
20394
|
+
END4 = 4294967294;
|
|
20395
|
+
FREE3 = 4294967295;
|
|
20396
|
+
FAT2 = 4294967293;
|
|
20397
|
+
SECTOR2 = 512;
|
|
20398
|
+
FAT_ENTRIES = SECTOR2 / 4;
|
|
20399
|
+
}
|
|
20400
|
+
});
|
|
20401
|
+
|
|
20402
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-edit.js
|
|
19232
20403
|
function encodeRkExact(value) {
|
|
19233
20404
|
if (!Number.isFinite(value))
|
|
19234
20405
|
return void 0;
|
|
@@ -19305,6 +20476,7 @@ function worksheetRanges(bytes) {
|
|
|
19305
20476
|
}
|
|
19306
20477
|
function editXlsNumericCell(input2, edit) {
|
|
19307
20478
|
const unchanged2 = (reason) => ({ status: "unchanged", bytes: input2, reason });
|
|
20479
|
+
edit = { row: edit.row, col: edit.col, value: edit.value, worksheetIndex: edit.worksheetIndex };
|
|
19308
20480
|
const sheet = edit.worksheetIndex ?? 0;
|
|
19309
20481
|
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))
|
|
19310
20482
|
return unchanged2("invalid-edit");
|
|
@@ -19376,8 +20548,18 @@ function editXlsNumericCell(input2, edit) {
|
|
|
19376
20548
|
if (payload === void 0)
|
|
19377
20549
|
return unchanged2("cell-not-supported");
|
|
19378
20550
|
const rk = packed ? encodeRkExact(edit.value) : void 0;
|
|
19379
|
-
if (packed && rk === void 0)
|
|
19380
|
-
|
|
20551
|
+
if (packed && rk === void 0) {
|
|
20552
|
+
if (!readRecords(bytes, 0, bytes.length).some((r) => r.opcode === 133))
|
|
20553
|
+
return unchanged2("inexact-rk");
|
|
20554
|
+
const promoted = promoteXlsNumericCell(bytes, edit);
|
|
20555
|
+
if (!rewrap)
|
|
20556
|
+
return { status: "edited", bytes: promoted, recalculationRequired: true };
|
|
20557
|
+
const names = ["Workbook", "Book"].filter((name) => readCompoundFileStream(input2, [name]) !== void 0);
|
|
20558
|
+
if (names.length !== 1)
|
|
20559
|
+
return unchanged2("unsupported-workbook");
|
|
20560
|
+
const resized = resizeCompoundFileStream(input2, [names[0]], promoted);
|
|
20561
|
+
return resized.ok ? { status: "edited", bytes: resized.bytes, recalculationRequired: true } : unchanged2("container-not-writable");
|
|
20562
|
+
}
|
|
19381
20563
|
const out = bytes.slice();
|
|
19382
20564
|
const outView = new DataView(out.buffer, out.byteOffset, out.byteLength);
|
|
19383
20565
|
if (packed)
|
|
@@ -19388,18 +20570,22 @@ function editXlsNumericCell(input2, edit) {
|
|
|
19388
20570
|
if (result === input2)
|
|
19389
20571
|
return unchanged2("container-not-writable");
|
|
19390
20572
|
return { status: "edited", bytes: result, recalculationRequired: true };
|
|
19391
|
-
} catch {
|
|
19392
|
-
return unchanged2("malformed-records");
|
|
20573
|
+
} catch (error62) {
|
|
20574
|
+
return unchanged2(error62 instanceof EditError ? error62.reason : "malformed-records");
|
|
19393
20575
|
}
|
|
19394
20576
|
}
|
|
19395
20577
|
var init_legacy_excel_biff8_edit = __esm({
|
|
19396
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
20578
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-edit.js"() {
|
|
19397
20579
|
init_legacy_excel_biff8();
|
|
19398
20580
|
init_legacy_excel_cfb();
|
|
20581
|
+
init_legacy_excel_numeric_promotion();
|
|
20582
|
+
init_legacy_excel_record_edit_model();
|
|
20583
|
+
init_ole2_stream_resize();
|
|
20584
|
+
init_ole2_stream_edit();
|
|
19399
20585
|
}
|
|
19400
20586
|
});
|
|
19401
20587
|
|
|
19402
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20588
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8.js
|
|
19403
20589
|
function readRecords(bytes, start, end) {
|
|
19404
20590
|
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
19405
20591
|
const records = [];
|
|
@@ -19570,7 +20756,7 @@ function writeOleXlsNumericCellEdit(inputBytes, edit) {
|
|
|
19570
20756
|
}
|
|
19571
20757
|
var OPCODE_BOF, OPCODE_EOF, OPCODE_FILEPASS, OPCODE_NUMBER, OPCODE_RK, OPCODE_LABELSST, OPCODE_LABEL, OPCODE_SST, OPCODE_EXTSST, OPCODE_ROW, OPCODE_DBCELL, OPCODE_DIMENSIONS, OPCODE_BLANK, OPCODE_BOUNDSHEET, WORKSHEET_DT, DEFAULT_MAX_ROWS2, DEFAULT_MAX_COLS2;
|
|
19572
20758
|
var init_legacy_excel_biff8 = __esm({
|
|
19573
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
20759
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8.js"() {
|
|
19574
20760
|
init_legacy_excel_biff8_edit();
|
|
19575
20761
|
init_legacy_excel_cfb();
|
|
19576
20762
|
OPCODE_BOF = 2057;
|
|
@@ -19600,7 +20786,7 @@ var init_ole_sheet_xls_biff8 = __esm({
|
|
|
19600
20786
|
}
|
|
19601
20787
|
});
|
|
19602
20788
|
|
|
19603
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20789
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-grid.js
|
|
19604
20790
|
function biffRecord(opcode, data) {
|
|
19605
20791
|
return [
|
|
19606
20792
|
opcode & 255,
|
|
@@ -19725,12 +20911,12 @@ function buildXlsRowCellRegion(grid) {
|
|
|
19725
20911
|
return Uint8Array.from(bytesOut);
|
|
19726
20912
|
}
|
|
19727
20913
|
var init_legacy_excel_biff8_grid = __esm({
|
|
19728
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
20914
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-grid.js"() {
|
|
19729
20915
|
init_legacy_excel_biff8();
|
|
19730
20916
|
}
|
|
19731
20917
|
});
|
|
19732
20918
|
|
|
19733
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20919
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-writer.js
|
|
19734
20920
|
function resolveSstIndex(sharedStrings, value, bytes) {
|
|
19735
20921
|
const existing = sharedStrings.indexOf(value);
|
|
19736
20922
|
if (existing !== -1)
|
|
@@ -19892,7 +21078,7 @@ function writeOleXlsStringCellEdit(inputBytes, edit) {
|
|
|
19892
21078
|
}
|
|
19893
21079
|
}
|
|
19894
21080
|
var init_legacy_excel_biff8_writer = __esm({
|
|
19895
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
21081
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-writer.js"() {
|
|
19896
21082
|
init_legacy_excel_biff8();
|
|
19897
21083
|
init_legacy_excel_biff8_grid();
|
|
19898
21084
|
init_legacy_excel_cfb();
|
|
@@ -19999,7 +21185,7 @@ var init_ole_document_docx_editor = __esm({
|
|
|
19999
21185
|
}
|
|
20000
21186
|
});
|
|
20001
21187
|
|
|
20002
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
21188
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fib.js
|
|
20003
21189
|
function readDocFib(wordDoc) {
|
|
20004
21190
|
const view = new DataView(wordDoc.buffer, wordDoc.byteOffset, wordDoc.byteLength);
|
|
20005
21191
|
const wIdent = view.getUint16(0, true);
|
|
@@ -20089,7 +21275,7 @@ function patchDocFib(wordDoc, fib, patch) {
|
|
|
20089
21275
|
}
|
|
20090
21276
|
var FC_LCB_INDEX, F_COMPLEX_BIT;
|
|
20091
21277
|
var init_ole_document_doc_fib = __esm({
|
|
20092
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
21278
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fib.js"() {
|
|
20093
21279
|
FC_LCB_INDEX = {
|
|
20094
21280
|
plcfbteChpx: 12,
|
|
20095
21281
|
plcfbtePapx: 13,
|
|
@@ -20100,504 +21286,7 @@ var init_ole_document_doc_fib = __esm({
|
|
|
20100
21286
|
}
|
|
20101
21287
|
});
|
|
20102
21288
|
|
|
20103
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20104
|
-
function follow(table, start) {
|
|
20105
|
-
const ids = [], seen = /* @__PURE__ */ new Set();
|
|
20106
|
-
for (let id = start; id !== END2; id = table[id]) {
|
|
20107
|
-
if (id >= table.length || seen.has(id))
|
|
20108
|
-
throw new Error("Invalid allocation chain");
|
|
20109
|
-
seen.add(id);
|
|
20110
|
-
ids.push(id);
|
|
20111
|
-
}
|
|
20112
|
-
return ids;
|
|
20113
|
-
}
|
|
20114
|
-
function findSlot(slots, path4) {
|
|
20115
|
-
let parent = slots.get(0);
|
|
20116
|
-
if (!parent || parent.type !== 5)
|
|
20117
|
-
throw new Error("Invalid root");
|
|
20118
|
-
const parents = /* @__PURE__ */ new Set();
|
|
20119
|
-
for (let part = 0; part < path4.length; part++) {
|
|
20120
|
-
if (parents.has(parent.id))
|
|
20121
|
-
throw new Error("Cyclic storage hierarchy");
|
|
20122
|
-
parents.add(parent.id);
|
|
20123
|
-
const stack = [parent.child], seen = /* @__PURE__ */ new Set(), matches = [];
|
|
20124
|
-
while (stack.length) {
|
|
20125
|
-
const id = stack.pop();
|
|
20126
|
-
if (id === FREE)
|
|
20127
|
-
continue;
|
|
20128
|
-
if (seen.has(id))
|
|
20129
|
-
throw new Error("Invalid directory tree");
|
|
20130
|
-
seen.add(id);
|
|
20131
|
-
const slot2 = slots.get(id);
|
|
20132
|
-
if (!slot2)
|
|
20133
|
-
throw new Error("Missing directory slot");
|
|
20134
|
-
if (slot2.name.toLocaleLowerCase() === path4[part].toLocaleLowerCase())
|
|
20135
|
-
matches.push(slot2);
|
|
20136
|
-
stack.push(slot2.left, slot2.right);
|
|
20137
|
-
}
|
|
20138
|
-
if (matches.length !== 1)
|
|
20139
|
-
throw new Error("Missing or ambiguous stream");
|
|
20140
|
-
parent = matches[0];
|
|
20141
|
-
if (parent.type !== (part === path4.length - 1 ? 2 : 1))
|
|
20142
|
-
throw new Error("Invalid storage path");
|
|
20143
|
-
}
|
|
20144
|
-
return parent;
|
|
20145
|
-
}
|
|
20146
|
-
function validateHierarchy(slots) {
|
|
20147
|
-
const owners = /* @__PURE__ */ new Set(), storages = [0];
|
|
20148
|
-
while (storages.length) {
|
|
20149
|
-
const storage = slots.get(storages.pop());
|
|
20150
|
-
const stack = [storage.child], names = /* @__PURE__ */ new Set();
|
|
20151
|
-
while (stack.length) {
|
|
20152
|
-
const id = stack.pop();
|
|
20153
|
-
if (id === FREE)
|
|
20154
|
-
continue;
|
|
20155
|
-
const slot2 = slots.get(id);
|
|
20156
|
-
if (!slot2 || slot2.type !== 1 && slot2.type !== 2 || owners.has(id))
|
|
20157
|
-
throw new Error("Ambiguous directory ownership");
|
|
20158
|
-
const name = slot2.name.toLocaleLowerCase();
|
|
20159
|
-
if (names.has(name))
|
|
20160
|
-
throw new Error("Duplicate sibling name");
|
|
20161
|
-
names.add(name);
|
|
20162
|
-
owners.add(id);
|
|
20163
|
-
stack.push(slot2.left, slot2.right);
|
|
20164
|
-
if (slot2.type === 1)
|
|
20165
|
-
storages.push(id);
|
|
20166
|
-
}
|
|
20167
|
-
}
|
|
20168
|
-
if (owners.size !== slots.size - 1)
|
|
20169
|
-
throw new Error("Unreachable directory entries");
|
|
20170
|
-
}
|
|
20171
|
-
function resizeCompoundFileStreamV4(input2, path4, replacement) {
|
|
20172
|
-
const fail2 = (reason) => ({ ok: false, bytes: input2, reason });
|
|
20173
|
-
try {
|
|
20174
|
-
if (input2.length < 512 || !path4.length || path4.some((part) => !part))
|
|
20175
|
-
return fail2("invalid-or-missing-stream");
|
|
20176
|
-
const view = new DataView(input2.buffer, input2.byteOffset, input2.byteLength);
|
|
20177
|
-
const read = (offset) => view.getUint32(offset, true);
|
|
20178
|
-
const version2 = view.getUint16(26, true);
|
|
20179
|
-
if (version2 !== 4)
|
|
20180
|
-
return fail2("unsupported-version");
|
|
20181
|
-
const SECTOR3 = 4096, FAT_ENTRIES2 = SECTOR3 / 4, DIRECTORY_ENTRIES = SECTOR3 / 128;
|
|
20182
|
-
if (read(72) !== 0 || read(44) > 109)
|
|
20183
|
-
return fail2("unsupported-difat");
|
|
20184
|
-
const cutoff = read(56);
|
|
20185
|
-
if (cutoff !== 0 && cutoff !== 4096)
|
|
20186
|
-
return fail2("unsupported-layout");
|
|
20187
|
-
const original = readCompoundFileStream(input2, path4);
|
|
20188
|
-
if (!original)
|
|
20189
|
-
return fail2("invalid-or-missing-stream");
|
|
20190
|
-
const name = path4[path4.length - 1].toLocaleLowerCase();
|
|
20191
|
-
if (name === "worddocument" && original.length >= 12 && (original[10] | original[11] << 8) & 33024)
|
|
20192
|
-
return fail2("unsafe-edit");
|
|
20193
|
-
if (name === "book" || name === "workbook") {
|
|
20194
|
-
for (let offset = 0; offset + 4 <= original.length; ) {
|
|
20195
|
-
const record3 = original[offset] | original[offset + 1] << 8;
|
|
20196
|
-
const length = original[offset + 2] | original[offset + 3] << 8;
|
|
20197
|
-
if (record3 === 47)
|
|
20198
|
-
return fail2("unsafe-edit");
|
|
20199
|
-
if (record3 === 10 || offset + 4 + length > original.length)
|
|
20200
|
-
break;
|
|
20201
|
-
offset += 4 + length;
|
|
20202
|
-
}
|
|
20203
|
-
}
|
|
20204
|
-
const validated = replaceCompoundFileStream(input2, path4, original);
|
|
20205
|
-
if (validated === input2)
|
|
20206
|
-
return fail2("unsafe-edit");
|
|
20207
|
-
const sameLength = replacement.length === original.length;
|
|
20208
|
-
if (!sameLength && original.length < cutoff)
|
|
20209
|
-
return fail2("unsupported-mini-stream");
|
|
20210
|
-
if (!sameLength && replacement.length < cutoff)
|
|
20211
|
-
return fail2("unsupported-mini-transition");
|
|
20212
|
-
const sectorCount = input2.length / SECTOR3 - 1, fatCount = read(44);
|
|
20213
|
-
if (sectorCount > fatCount * FAT_ENTRIES2)
|
|
20214
|
-
return fail2("unsafe-edit");
|
|
20215
|
-
const fatIds = Array.from({ length: fatCount }, (_, i2) => read(76 + 4 * i2));
|
|
20216
|
-
const fat = [];
|
|
20217
|
-
for (const id of fatIds) {
|
|
20218
|
-
for (let i2 = 0; i2 < FAT_ENTRIES2 && fat.length < sectorCount; i2++)
|
|
20219
|
-
fat.push(read((id + 1) * SECTOR3 + i2 * 4));
|
|
20220
|
-
}
|
|
20221
|
-
if (fatIds.some((id) => fat[id] !== FAT))
|
|
20222
|
-
return fail2("unsafe-edit");
|
|
20223
|
-
const slots = /* @__PURE__ */ new Map();
|
|
20224
|
-
const directoryChain = follow(fat, read(48));
|
|
20225
|
-
if (read(40) !== directoryChain.length)
|
|
20226
|
-
return fail2("unsafe-edit");
|
|
20227
|
-
for (const [block, sector] of directoryChain.entries()) {
|
|
20228
|
-
for (let entry2 = 0; entry2 < DIRECTORY_ENTRIES; entry2++) {
|
|
20229
|
-
const offset = (sector + 1) * SECTOR3 + entry2 * 128, type = view.getUint8(offset + 66);
|
|
20230
|
-
if (!type)
|
|
20231
|
-
continue;
|
|
20232
|
-
const nameLength = view.getUint16(offset + 64, true);
|
|
20233
|
-
if (![1, 2, 5].includes(type) || nameLength < 2 || nameLength > 64 || nameLength % 2 || view.getUint16(offset + nameLength - 2, true))
|
|
20234
|
-
return fail2("unsafe-edit");
|
|
20235
|
-
let name2 = "";
|
|
20236
|
-
for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
|
|
20237
|
-
name2 += String.fromCharCode(view.getUint16(offset + i2, true));
|
|
20238
|
-
if (read(offset + 124) !== 0)
|
|
20239
|
-
return fail2("unsafe-edit");
|
|
20240
|
-
const id = block * DIRECTORY_ENTRIES + entry2;
|
|
20241
|
-
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 });
|
|
20242
|
-
}
|
|
20243
|
-
}
|
|
20244
|
-
if ([...slots.values()].filter((slot2) => slot2.type === 5).length !== 1)
|
|
20245
|
-
return fail2("unsafe-edit");
|
|
20246
|
-
const target = findSlot(slots, path4);
|
|
20247
|
-
validateHierarchy(slots);
|
|
20248
|
-
if (sameLength) {
|
|
20249
|
-
const bytes = replaceCompoundFileStream(input2, path4, replacement);
|
|
20250
|
-
return bytes === input2 ? fail2("unsafe-edit") : { ok: true, bytes };
|
|
20251
|
-
}
|
|
20252
|
-
const oldChain = follow(fat, target.start);
|
|
20253
|
-
if (target.size !== original.length || oldChain.length !== Math.ceil(target.size / SECTOR3))
|
|
20254
|
-
return fail2("unsafe-edit");
|
|
20255
|
-
const payloadSectors = Math.ceil(replacement.length / SECTOR3);
|
|
20256
|
-
let newFatCount = fatCount;
|
|
20257
|
-
while (sectorCount + payloadSectors + newFatCount - fatCount > newFatCount * FAT_ENTRIES2)
|
|
20258
|
-
newFatCount++;
|
|
20259
|
-
if (newFatCount > 109)
|
|
20260
|
-
return fail2("allocation-limit");
|
|
20261
|
-
const totalSectors = sectorCount + payloadSectors + newFatCount - fatCount;
|
|
20262
|
-
const output2 = new Uint8Array((totalSectors + 1) * SECTOR3);
|
|
20263
|
-
output2.set(input2);
|
|
20264
|
-
output2.set(replacement, (sectorCount + 1) * SECTOR3);
|
|
20265
|
-
const outView = new DataView(output2.buffer);
|
|
20266
|
-
for (let i2 = fatCount; i2 < newFatCount; i2++) {
|
|
20267
|
-
const id = sectorCount + payloadSectors + i2 - fatCount;
|
|
20268
|
-
fatIds.push(id);
|
|
20269
|
-
output2.fill(255, (id + 1) * SECTOR3, (id + 2) * SECTOR3);
|
|
20270
|
-
outView.setUint32(76 + i2 * 4, id, true);
|
|
20271
|
-
}
|
|
20272
|
-
outView.setUint32(44, newFatCount, true);
|
|
20273
|
-
const writeFat = (id, value) => outView.setUint32((fatIds[Math.floor(id / FAT_ENTRIES2)] + 1) * SECTOR3 + id % FAT_ENTRIES2 * 4, value, true);
|
|
20274
|
-
for (const id of oldChain)
|
|
20275
|
-
writeFat(id, FREE);
|
|
20276
|
-
for (let i2 = 0; i2 < payloadSectors; i2++)
|
|
20277
|
-
writeFat(sectorCount + i2, i2 + 1 === payloadSectors ? END2 : sectorCount + i2 + 1);
|
|
20278
|
-
for (const id of fatIds)
|
|
20279
|
-
writeFat(id, FAT);
|
|
20280
|
-
outView.setUint32(target.offset + 116, payloadSectors ? sectorCount : END2, true);
|
|
20281
|
-
outView.setUint32(target.offset + 120, replacement.length, true);
|
|
20282
|
-
return { ok: true, bytes: output2 };
|
|
20283
|
-
} catch {
|
|
20284
|
-
return fail2("unsafe-edit");
|
|
20285
|
-
}
|
|
20286
|
-
}
|
|
20287
|
-
var END2, FREE, FAT;
|
|
20288
|
-
var init_ole2_stream_resize_v4 = __esm({
|
|
20289
|
-
"../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-v4.js"() {
|
|
20290
|
-
init_ole2_stream_edit();
|
|
20291
|
-
END2 = 4294967294;
|
|
20292
|
-
FREE = 4294967295;
|
|
20293
|
-
FAT = 4294967293;
|
|
20294
|
-
}
|
|
20295
|
-
});
|
|
20296
|
-
|
|
20297
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-allocation.js
|
|
20298
|
-
function appendCompoundAllocations(input2, existingFatIds, payloads, sectorSize = 512) {
|
|
20299
|
-
const sectorCount = input2.length / sectorSize - 1;
|
|
20300
|
-
const entriesPerFat = sectorSize / 4;
|
|
20301
|
-
const counts = payloads.map((payload) => Math.ceil(payload.length / sectorSize));
|
|
20302
|
-
const payloadSectors = counts.reduce((sum, count2) => sum + count2, 0);
|
|
20303
|
-
let fatCount = existingFatIds.length;
|
|
20304
|
-
while (sectorCount + payloadSectors + fatCount - existingFatIds.length > fatCount * entriesPerFat)
|
|
20305
|
-
fatCount++;
|
|
20306
|
-
if (fatCount > 109)
|
|
20307
|
-
return void 0;
|
|
20308
|
-
const totalSectors = sectorCount + payloadSectors + fatCount - existingFatIds.length;
|
|
20309
|
-
const bytes = new Uint8Array((totalSectors + 1) * sectorSize);
|
|
20310
|
-
bytes.set(input2);
|
|
20311
|
-
const view = new DataView(bytes.buffer), fatIds = [...existingFatIds];
|
|
20312
|
-
for (let i2 = existingFatIds.length; i2 < fatCount; i2++) {
|
|
20313
|
-
const id = sectorCount + payloadSectors + i2 - existingFatIds.length;
|
|
20314
|
-
fatIds.push(id);
|
|
20315
|
-
bytes.fill(255, (id + 1) * sectorSize, (id + 2) * sectorSize);
|
|
20316
|
-
view.setUint32(76 + i2 * 4, id, true);
|
|
20317
|
-
}
|
|
20318
|
-
view.setUint32(44, fatCount, true);
|
|
20319
|
-
const writeFat = (id, value) => view.setUint32((fatIds[Math.floor(id / entriesPerFat)] + 1) * sectorSize + id % entriesPerFat * 4, value, true);
|
|
20320
|
-
const chains = [];
|
|
20321
|
-
let next = sectorCount;
|
|
20322
|
-
for (let payload = 0; payload < payloads.length; payload++) {
|
|
20323
|
-
bytes.set(payloads[payload], (next + 1) * sectorSize);
|
|
20324
|
-
const chain2 = Array.from({ length: counts[payload] }, (_, i2) => next + i2);
|
|
20325
|
-
chain2.forEach((id, i2) => writeFat(id, chain2[i2 + 1] ?? 4294967294));
|
|
20326
|
-
chains.push(chain2);
|
|
20327
|
-
next += counts[payload];
|
|
20328
|
-
}
|
|
20329
|
-
for (const id of fatIds)
|
|
20330
|
-
writeFat(id, 4294967293);
|
|
20331
|
-
return { bytes, view, chains, writeFat };
|
|
20332
|
-
}
|
|
20333
|
-
function followCompoundAllocation(table, start) {
|
|
20334
|
-
const ids = [], seen = /* @__PURE__ */ new Set();
|
|
20335
|
-
for (let id = start; id !== 4294967294; id = table[id]) {
|
|
20336
|
-
if (id >= table.length || seen.has(id))
|
|
20337
|
-
throw new Error("Invalid allocation chain");
|
|
20338
|
-
seen.add(id);
|
|
20339
|
-
ids.push(id);
|
|
20340
|
-
}
|
|
20341
|
-
return ids;
|
|
20342
|
-
}
|
|
20343
|
-
var init_ole2_stream_resize_allocation = __esm({
|
|
20344
|
-
"../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-allocation.js"() {
|
|
20345
|
-
}
|
|
20346
|
-
});
|
|
20347
|
-
|
|
20348
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-mini.js
|
|
20349
|
-
function resizeMiniCompoundStream(input2, fat, fatIds, root, target, replacement, cutoff) {
|
|
20350
|
-
const inputView = new DataView(input2.buffer, input2.byteOffset, input2.byteLength);
|
|
20351
|
-
const miniFatCount = inputView.getUint32(64, true);
|
|
20352
|
-
const miniFatSectors = miniFatCount ? followCompoundAllocation(fat, inputView.getUint32(60, true)) : [];
|
|
20353
|
-
if (miniFatSectors.length !== miniFatCount)
|
|
20354
|
-
throw new Error("Invalid mini FAT count");
|
|
20355
|
-
const rootSectors = root.size ? followCompoundAllocation(fat, root.start) : [];
|
|
20356
|
-
if (rootSectors.length !== Math.ceil(root.size / SECTOR))
|
|
20357
|
-
throw new Error("Invalid root mini stream");
|
|
20358
|
-
const miniCapacity = Math.floor(root.size / MINI), miniFat = [];
|
|
20359
|
-
for (const id of miniFatSectors) {
|
|
20360
|
-
for (let slot2 = 0; slot2 < SECTOR / 4 && miniFat.length < miniCapacity; slot2++)
|
|
20361
|
-
miniFat.push(inputView.getUint32((id + 1) * SECTOR + slot2 * 4, true));
|
|
20362
|
-
}
|
|
20363
|
-
const wasMini = target.size < cutoff;
|
|
20364
|
-
const oldChain = followCompoundAllocation(wasMini ? miniFat : fat, target.start);
|
|
20365
|
-
if (oldChain.length !== Math.ceil(target.size / (wasMini ? MINI : SECTOR)))
|
|
20366
|
-
throw new Error("Invalid stream allocation");
|
|
20367
|
-
if (!replacement.length) {
|
|
20368
|
-
const bytes = input2.slice(), view = new DataView(bytes.buffer);
|
|
20369
|
-
for (const id of oldChain) {
|
|
20370
|
-
const table = wasMini ? miniFatSectors : fatIds;
|
|
20371
|
-
view.setUint32((table[Math.floor(id / 128)] + 1) * SECTOR + id % 128 * 4, FREE2, true);
|
|
20372
|
-
}
|
|
20373
|
-
view.setUint32(target.offset + 116, END3, true);
|
|
20374
|
-
view.setUint32(target.offset + 120, 0, true);
|
|
20375
|
-
return bytes;
|
|
20376
|
-
}
|
|
20377
|
-
if (replacement.length >= cutoff) {
|
|
20378
|
-
const output3 = appendCompoundAllocations(input2, fatIds, [replacement]);
|
|
20379
|
-
if (!output3)
|
|
20380
|
-
return void 0;
|
|
20381
|
-
for (const id of oldChain)
|
|
20382
|
-
output3.view.setUint32((miniFatSectors[Math.floor(id / 128)] + 1) * SECTOR + id % 128 * 4, FREE2, true);
|
|
20383
|
-
output3.view.setUint32(target.offset + 116, output3.chains[0][0] ?? END3, true);
|
|
20384
|
-
output3.view.setUint32(target.offset + 120, replacement.length, true);
|
|
20385
|
-
return output3.bytes;
|
|
20386
|
-
}
|
|
20387
|
-
const firstMini = Math.ceil(root.size / MINI), count2 = Math.ceil(replacement.length / MINI);
|
|
20388
|
-
const newRootSize = count2 ? (firstMini + count2) * MINI : root.size;
|
|
20389
|
-
const newRoot = new Uint8Array(newRootSize);
|
|
20390
|
-
rootSectors.forEach((id, i2) => newRoot.set(input2.subarray((id + 1) * SECTOR, (id + 1) * SECTOR + Math.min(SECTOR, root.size - i2 * SECTOR)), i2 * SECTOR));
|
|
20391
|
-
if (count2)
|
|
20392
|
-
newRoot.set(replacement, firstMini * MINI);
|
|
20393
|
-
const newMiniFatCount = Math.max(miniFatCount, Math.ceil((firstMini + count2) / 128));
|
|
20394
|
-
const newMiniFat = new Uint8Array(newMiniFatCount * SECTOR).fill(255);
|
|
20395
|
-
miniFatSectors.forEach((id, i2) => newMiniFat.set(input2.subarray((id + 1) * SECTOR, (id + 2) * SECTOR), i2 * SECTOR));
|
|
20396
|
-
const miniView = new DataView(newMiniFat.buffer);
|
|
20397
|
-
if (wasMini)
|
|
20398
|
-
for (const id of oldChain)
|
|
20399
|
-
miniView.setUint32(id * 4, FREE2, true);
|
|
20400
|
-
for (let i2 = 0; i2 < count2; i2++)
|
|
20401
|
-
miniView.setUint32((firstMini + i2) * 4, i2 + 1 === count2 ? END3 : firstMini + i2 + 1, true);
|
|
20402
|
-
const output2 = appendCompoundAllocations(input2, fatIds, [newRoot, newMiniFat]);
|
|
20403
|
-
if (!output2)
|
|
20404
|
-
return void 0;
|
|
20405
|
-
for (const id of [...rootSectors, ...miniFatSectors, ...wasMini ? [] : oldChain])
|
|
20406
|
-
output2.writeFat(id, FREE2);
|
|
20407
|
-
output2.view.setUint32(root.offset + 116, output2.chains[0][0] ?? END3, true);
|
|
20408
|
-
output2.view.setUint32(root.offset + 120, newRootSize, true);
|
|
20409
|
-
output2.view.setUint32(60, output2.chains[1][0] ?? END3, true);
|
|
20410
|
-
output2.view.setUint32(64, newMiniFatCount, true);
|
|
20411
|
-
output2.view.setUint32(target.offset + 116, count2 ? firstMini : END3, true);
|
|
20412
|
-
output2.view.setUint32(target.offset + 120, replacement.length, true);
|
|
20413
|
-
return output2.bytes;
|
|
20414
|
-
}
|
|
20415
|
-
var END3, FREE2, SECTOR, MINI;
|
|
20416
|
-
var init_ole2_stream_resize_mini = __esm({
|
|
20417
|
-
"../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-mini.js"() {
|
|
20418
|
-
init_ole2_stream_resize_allocation();
|
|
20419
|
-
END3 = 4294967294;
|
|
20420
|
-
FREE2 = 4294967295;
|
|
20421
|
-
SECTOR = 512;
|
|
20422
|
-
MINI = 64;
|
|
20423
|
-
}
|
|
20424
|
-
});
|
|
20425
|
-
|
|
20426
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize.js
|
|
20427
|
-
function follow2(table, start) {
|
|
20428
|
-
const ids = [], seen = /* @__PURE__ */ new Set();
|
|
20429
|
-
for (let id = start; id !== END4; id = table[id]) {
|
|
20430
|
-
if (id >= table.length || seen.has(id))
|
|
20431
|
-
throw new Error("Invalid allocation chain");
|
|
20432
|
-
seen.add(id);
|
|
20433
|
-
ids.push(id);
|
|
20434
|
-
}
|
|
20435
|
-
return ids;
|
|
20436
|
-
}
|
|
20437
|
-
function findSlot2(slots, path4) {
|
|
20438
|
-
let parent = slots.get(0);
|
|
20439
|
-
if (!parent || parent.type !== 5)
|
|
20440
|
-
throw new Error("Invalid root");
|
|
20441
|
-
const parents = /* @__PURE__ */ new Set();
|
|
20442
|
-
for (let part = 0; part < path4.length; part++) {
|
|
20443
|
-
if (parents.has(parent.id))
|
|
20444
|
-
throw new Error("Cyclic storage hierarchy");
|
|
20445
|
-
parents.add(parent.id);
|
|
20446
|
-
const stack = [parent.child], seen = /* @__PURE__ */ new Set(), matches = [];
|
|
20447
|
-
while (stack.length) {
|
|
20448
|
-
const id = stack.pop();
|
|
20449
|
-
if (id === FREE3)
|
|
20450
|
-
continue;
|
|
20451
|
-
if (seen.has(id))
|
|
20452
|
-
throw new Error("Invalid directory tree");
|
|
20453
|
-
seen.add(id);
|
|
20454
|
-
const slot2 = slots.get(id);
|
|
20455
|
-
if (!slot2)
|
|
20456
|
-
throw new Error("Missing directory slot");
|
|
20457
|
-
if (slot2.name.toLocaleLowerCase() === path4[part].toLocaleLowerCase())
|
|
20458
|
-
matches.push(slot2);
|
|
20459
|
-
stack.push(slot2.left, slot2.right);
|
|
20460
|
-
}
|
|
20461
|
-
if (matches.length !== 1)
|
|
20462
|
-
throw new Error("Missing or ambiguous stream");
|
|
20463
|
-
parent = matches[0];
|
|
20464
|
-
if (parent.type !== (part === path4.length - 1 ? 2 : 1))
|
|
20465
|
-
throw new Error("Invalid storage path");
|
|
20466
|
-
}
|
|
20467
|
-
return parent;
|
|
20468
|
-
}
|
|
20469
|
-
function validateHierarchy2(slots) {
|
|
20470
|
-
const owners = /* @__PURE__ */ new Set(), storages = [0];
|
|
20471
|
-
while (storages.length) {
|
|
20472
|
-
const storage = slots.get(storages.pop());
|
|
20473
|
-
const stack = [storage.child], names = /* @__PURE__ */ new Set();
|
|
20474
|
-
while (stack.length) {
|
|
20475
|
-
const id = stack.pop();
|
|
20476
|
-
if (id === FREE3)
|
|
20477
|
-
continue;
|
|
20478
|
-
const slot2 = slots.get(id);
|
|
20479
|
-
if (!slot2 || slot2.type !== 1 && slot2.type !== 2 || owners.has(id))
|
|
20480
|
-
throw new Error("Ambiguous directory ownership");
|
|
20481
|
-
const name = slot2.name.toLocaleLowerCase();
|
|
20482
|
-
if (names.has(name))
|
|
20483
|
-
throw new Error("Duplicate sibling name");
|
|
20484
|
-
names.add(name);
|
|
20485
|
-
owners.add(id);
|
|
20486
|
-
stack.push(slot2.left, slot2.right);
|
|
20487
|
-
if (slot2.type === 1)
|
|
20488
|
-
storages.push(id);
|
|
20489
|
-
}
|
|
20490
|
-
}
|
|
20491
|
-
if (owners.size !== slots.size - 1)
|
|
20492
|
-
throw new Error("Unreachable directory entries");
|
|
20493
|
-
}
|
|
20494
|
-
function resizeCompoundFileStream(input2, path4, replacement) {
|
|
20495
|
-
if (input2.length >= 512 && new DataView(input2.buffer, input2.byteOffset, input2.byteLength).getUint16(26, true) === 4)
|
|
20496
|
-
return resizeCompoundFileStreamV4(input2, path4, replacement);
|
|
20497
|
-
const fail2 = (reason) => ({ ok: false, bytes: input2, reason });
|
|
20498
|
-
try {
|
|
20499
|
-
if (input2.length < SECTOR2 || !path4.length || path4.some((part) => !part))
|
|
20500
|
-
return fail2("invalid-or-missing-stream");
|
|
20501
|
-
const view = new DataView(input2.buffer, input2.byteOffset, input2.byteLength);
|
|
20502
|
-
const read = (offset) => view.getUint32(offset, true);
|
|
20503
|
-
if (view.getUint16(26, true) !== 3)
|
|
20504
|
-
return fail2("unsupported-version");
|
|
20505
|
-
if (read(72) !== 0 || read(44) > 109)
|
|
20506
|
-
return fail2("unsupported-difat");
|
|
20507
|
-
const cutoff = read(56);
|
|
20508
|
-
if (cutoff !== 0 && cutoff !== 4096)
|
|
20509
|
-
return fail2("unsupported-layout");
|
|
20510
|
-
const original = readCompoundFileStream(input2, path4);
|
|
20511
|
-
if (!original)
|
|
20512
|
-
return fail2("invalid-or-missing-stream");
|
|
20513
|
-
const name = path4[path4.length - 1].toLocaleLowerCase();
|
|
20514
|
-
if (name === "worddocument" && original.length >= 12 && (original[10] | original[11] << 8) & 33024)
|
|
20515
|
-
return fail2("unsafe-edit");
|
|
20516
|
-
if (name === "book" || name === "workbook") {
|
|
20517
|
-
for (let offset = 0; offset + 4 <= original.length; ) {
|
|
20518
|
-
const record3 = original[offset] | original[offset + 1] << 8;
|
|
20519
|
-
const length = original[offset + 2] | original[offset + 3] << 8;
|
|
20520
|
-
if (record3 === 47)
|
|
20521
|
-
return fail2("unsafe-edit");
|
|
20522
|
-
if (record3 === 10 || offset + 4 + length > original.length)
|
|
20523
|
-
break;
|
|
20524
|
-
offset += 4 + length;
|
|
20525
|
-
}
|
|
20526
|
-
}
|
|
20527
|
-
const validated = replaceCompoundFileStream(input2, path4, original);
|
|
20528
|
-
if (validated === input2)
|
|
20529
|
-
return fail2("unsafe-edit");
|
|
20530
|
-
const sameLength = replacement.length === original.length;
|
|
20531
|
-
const sectorCount = input2.length / SECTOR2 - 1, fatCount = read(44);
|
|
20532
|
-
if (sectorCount > fatCount * FAT_ENTRIES)
|
|
20533
|
-
return fail2("unsafe-edit");
|
|
20534
|
-
const fatIds = Array.from({ length: fatCount }, (_, i2) => read(76 + 4 * i2));
|
|
20535
|
-
const fat = [];
|
|
20536
|
-
for (const id of fatIds) {
|
|
20537
|
-
for (let i2 = 0; i2 < FAT_ENTRIES && fat.length < sectorCount; i2++)
|
|
20538
|
-
fat.push(read((id + 1) * SECTOR2 + i2 * 4));
|
|
20539
|
-
}
|
|
20540
|
-
if (fatIds.some((id) => fat[id] !== FAT2))
|
|
20541
|
-
return fail2("unsafe-edit");
|
|
20542
|
-
const slots = /* @__PURE__ */ new Map();
|
|
20543
|
-
for (const [block, sector] of follow2(fat, read(48)).entries()) {
|
|
20544
|
-
for (let entry2 = 0; entry2 < 4; entry2++) {
|
|
20545
|
-
const offset = (sector + 1) * SECTOR2 + entry2 * 128, type = view.getUint8(offset + 66);
|
|
20546
|
-
if (!type)
|
|
20547
|
-
continue;
|
|
20548
|
-
const nameLength = view.getUint16(offset + 64, true);
|
|
20549
|
-
if (![1, 2, 5].includes(type) || nameLength < 2 || nameLength > 64 || nameLength % 2 || view.getUint16(offset + nameLength - 2, true))
|
|
20550
|
-
return fail2("unsafe-edit");
|
|
20551
|
-
let name2 = "";
|
|
20552
|
-
for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
|
|
20553
|
-
name2 += String.fromCharCode(view.getUint16(offset + i2, true));
|
|
20554
|
-
const id = block * 4 + entry2;
|
|
20555
|
-
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 });
|
|
20556
|
-
}
|
|
20557
|
-
}
|
|
20558
|
-
if ([...slots.values()].filter((slot2) => slot2.type === 5).length !== 1)
|
|
20559
|
-
return fail2("unsafe-edit");
|
|
20560
|
-
const target = findSlot2(slots, path4);
|
|
20561
|
-
validateHierarchy2(slots);
|
|
20562
|
-
if (sameLength) {
|
|
20563
|
-
const bytes = replaceCompoundFileStream(input2, path4, replacement);
|
|
20564
|
-
return bytes === input2 ? fail2("unsafe-edit") : { ok: true, bytes };
|
|
20565
|
-
}
|
|
20566
|
-
if (original.length < cutoff || replacement.length < cutoff) {
|
|
20567
|
-
const bytes = resizeMiniCompoundStream(input2, fat, fatIds, slots.get(0), target, replacement, cutoff);
|
|
20568
|
-
return bytes ? { ok: true, bytes } : fail2("allocation-limit");
|
|
20569
|
-
}
|
|
20570
|
-
const oldChain = follow2(fat, target.start);
|
|
20571
|
-
if (target.size !== original.length || oldChain.length !== Math.ceil(target.size / SECTOR2))
|
|
20572
|
-
return fail2("unsafe-edit");
|
|
20573
|
-
const output2 = appendCompoundAllocations(input2, fatIds, [replacement]);
|
|
20574
|
-
if (!output2)
|
|
20575
|
-
return fail2("allocation-limit");
|
|
20576
|
-
for (const id of oldChain)
|
|
20577
|
-
output2.writeFat(id, FREE3);
|
|
20578
|
-
output2.view.setUint32(target.offset + 116, output2.chains[0][0] ?? END4, true);
|
|
20579
|
-
output2.view.setUint32(target.offset + 120, replacement.length, true);
|
|
20580
|
-
return { ok: true, bytes: output2.bytes };
|
|
20581
|
-
} catch {
|
|
20582
|
-
return fail2("unsafe-edit");
|
|
20583
|
-
}
|
|
20584
|
-
}
|
|
20585
|
-
var END4, FREE3, FAT2, SECTOR2, FAT_ENTRIES;
|
|
20586
|
-
var init_ole2_stream_resize = __esm({
|
|
20587
|
-
"../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize.js"() {
|
|
20588
|
-
init_ole2_stream_edit();
|
|
20589
|
-
init_ole2_stream_resize_v4();
|
|
20590
|
-
init_ole2_stream_resize_allocation();
|
|
20591
|
-
init_ole2_stream_resize_mini();
|
|
20592
|
-
END4 = 4294967294;
|
|
20593
|
-
FREE3 = 4294967295;
|
|
20594
|
-
FAT2 = 4294967293;
|
|
20595
|
-
SECTOR2 = 512;
|
|
20596
|
-
FAT_ENTRIES = SECTOR2 / 4;
|
|
20597
|
-
}
|
|
20598
|
-
});
|
|
20599
|
-
|
|
20600
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cfb.js
|
|
21289
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cfb.js
|
|
20601
21290
|
function unwrapDocBytes(bytes) {
|
|
20602
21291
|
if (bytes.length < 8 || bytes[0] !== 208 || bytes[1] !== 207 || bytes[2] !== 17 || bytes[3] !== 224 || bytes[4] !== 161 || bytes[5] !== 177 || bytes[6] !== 26 || bytes[7] !== 225) {
|
|
20603
21292
|
return void 0;
|
|
@@ -20647,7 +21336,7 @@ function unwrapDocBytes(bytes) {
|
|
|
20647
21336
|
}
|
|
20648
21337
|
var DocCfbRewriteError;
|
|
20649
21338
|
var init_ole_document_doc_cfb = __esm({
|
|
20650
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
21339
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cfb.js"() {
|
|
20651
21340
|
init_ole_document_doc_fib();
|
|
20652
21341
|
init_ole2_stream_edit();
|
|
20653
21342
|
init_ole2_stream_resize();
|
|
@@ -20660,7 +21349,7 @@ var init_ole_document_doc_cfb = __esm({
|
|
|
20660
21349
|
}
|
|
20661
21350
|
});
|
|
20662
21351
|
|
|
20663
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
21352
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fkp.js
|
|
20664
21353
|
function parseBteTable(tableStream, at2) {
|
|
20665
21354
|
const view = new DataView(tableStream.buffer, tableStream.byteOffset, tableStream.byteLength);
|
|
20666
21355
|
if (!Number.isInteger(at2.fc) || !Number.isInteger(at2.lcb) || at2.fc < 0 || at2.lcb < 4 || (at2.lcb - 4) % 8 !== 0 || at2.fc > tableStream.length - at2.lcb)
|
|
@@ -20801,12 +21490,12 @@ function buildSingleRunChpxPage(fcStart, fcEnd, blob) {
|
|
|
20801
21490
|
}
|
|
20802
21491
|
var PAGE_SIZE;
|
|
20803
21492
|
var init_ole_document_doc_fkp = __esm({
|
|
20804
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
21493
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fkp.js"() {
|
|
20805
21494
|
PAGE_SIZE = 512;
|
|
20806
21495
|
}
|
|
20807
21496
|
});
|
|
20808
21497
|
|
|
20809
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
21498
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cp1252.js
|
|
20810
21499
|
function decodeCp1252Byte(byte) {
|
|
20811
21500
|
if (byte >= 128 && byte <= 159) {
|
|
20812
21501
|
return CP1252_HIGH_BLOCK[byte - 128];
|
|
@@ -20840,7 +21529,7 @@ function encodeCp1252(text2) {
|
|
|
20840
21529
|
}
|
|
20841
21530
|
var CP1252_HIGH_BLOCK, CP1252_HIGH_BLOCK_REVERSE;
|
|
20842
21531
|
var init_ole_document_doc_cp1252 = __esm({
|
|
20843
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
21532
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cp1252.js"() {
|
|
20844
21533
|
CP1252_HIGH_BLOCK = [
|
|
20845
21534
|
8364,
|
|
20846
21535
|
129,
|
|
@@ -20879,7 +21568,7 @@ var init_ole_document_doc_cp1252 = __esm({
|
|
|
20879
21568
|
}
|
|
20880
21569
|
});
|
|
20881
21570
|
|
|
20882
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
21571
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-pieces.js
|
|
20883
21572
|
function parseDocClx(tableStream, clx, maxPieces) {
|
|
20884
21573
|
if (maxPieces !== void 0 && (!Number.isSafeInteger(maxPieces) || maxPieces < 0))
|
|
20885
21574
|
throw new Error("Invalid DOC piece limit");
|
|
@@ -21084,7 +21773,7 @@ function buildClxBytes(pieces, prcBytes = new Uint8Array()) {
|
|
|
21084
21773
|
}
|
|
21085
21774
|
var CLXT_PRC, CLXT_PCDT, DocResourceLimitError;
|
|
21086
21775
|
var init_ole_document_doc_pieces = __esm({
|
|
21087
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
21776
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-pieces.js"() {
|
|
21088
21777
|
init_ole_document_doc_cp1252();
|
|
21089
21778
|
CLXT_PRC = 1;
|
|
21090
21779
|
CLXT_PCDT = 2;
|
|
@@ -21097,7 +21786,7 @@ var init_ole_document_doc_pieces = __esm({
|
|
|
21097
21786
|
}
|
|
21098
21787
|
});
|
|
21099
21788
|
|
|
21100
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
21789
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fields.js
|
|
21101
21790
|
function checkFieldRanges(markers, editStart, editEnd, maxDepth2) {
|
|
21102
21791
|
const stack = [];
|
|
21103
21792
|
for (const { cp, ch } of markers) {
|
|
@@ -21176,7 +21865,7 @@ function shiftDocMainFieldCps(table, at2, body, editStart, editEnd, delta2, maxF
|
|
|
21176
21865
|
}
|
|
21177
21866
|
var UnsupportedDocFieldEditError;
|
|
21178
21867
|
var init_ole_document_doc_fields = __esm({
|
|
21179
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
21868
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fields.js"() {
|
|
21180
21869
|
init_ole_document_doc_pieces();
|
|
21181
21870
|
UnsupportedDocFieldEditError = class extends Error {
|
|
21182
21871
|
constructor(message) {
|
|
@@ -21187,7 +21876,7 @@ var init_ole_document_doc_fields = __esm({
|
|
|
21187
21876
|
}
|
|
21188
21877
|
});
|
|
21189
21878
|
|
|
21190
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
21879
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-editor.js
|
|
21191
21880
|
function processingLimits(limits) {
|
|
21192
21881
|
const resolved = {
|
|
21193
21882
|
maxCharacters: DEFAULT_OLE_DOC_PROCESSING_LIMITS.maxCharacters,
|
|
@@ -21247,6 +21936,42 @@ function encodePieceTextUtf16(text2) {
|
|
|
21247
21936
|
view.setUint16(i2 * 2, text2.charCodeAt(i2), true);
|
|
21248
21937
|
return bytes;
|
|
21249
21938
|
}
|
|
21939
|
+
function protectedWordRanges(word, table, fib) {
|
|
21940
|
+
const view = new DataView(word.buffer, word.byteOffset, word.byteLength);
|
|
21941
|
+
const extension = fib.fibRgFcLcbOffset + fib.fibRgFcLcbCount * 8;
|
|
21942
|
+
const fibEnd = extension + 2 + view.getUint16(extension, true) * 2;
|
|
21943
|
+
const pages = /* @__PURE__ */ new Set();
|
|
21944
|
+
for (const at2 of [fib.plcfbteChpx, fib.plcfbtePapx]) {
|
|
21945
|
+
if (at2.lcb > 65536 * 8 + 4)
|
|
21946
|
+
throw new DocResourceLimitError("DOC formatting page count exceeds the processing limit");
|
|
21947
|
+
for (const pn of parseBteTable(table, at2).pns) {
|
|
21948
|
+
const start = (pn & 4194303) * 512;
|
|
21949
|
+
if (start > word.length - 512)
|
|
21950
|
+
throw new Error("Formatting page outside WordDocument");
|
|
21951
|
+
pages.add(start);
|
|
21952
|
+
}
|
|
21953
|
+
}
|
|
21954
|
+
const ranges = [[0, fibEnd]];
|
|
21955
|
+
for (const start of [...pages].sort((a, b) => a - b)) {
|
|
21956
|
+
const last = ranges.at(-1);
|
|
21957
|
+
if (start <= last[1])
|
|
21958
|
+
ranges[ranges.length - 1] = [last[0], Math.max(last[1], start + 512)];
|
|
21959
|
+
else
|
|
21960
|
+
ranges.push([start, start + 512]);
|
|
21961
|
+
}
|
|
21962
|
+
return ranges;
|
|
21963
|
+
}
|
|
21964
|
+
function overlapsWordStructure(ranges, start, end) {
|
|
21965
|
+
let low = 0, high = ranges.length;
|
|
21966
|
+
while (low < high) {
|
|
21967
|
+
const middle = low + Math.floor((high - low) / 2);
|
|
21968
|
+
if (ranges[middle][1] <= start)
|
|
21969
|
+
low = middle + 1;
|
|
21970
|
+
else
|
|
21971
|
+
high = middle;
|
|
21972
|
+
}
|
|
21973
|
+
return low < ranges.length && ranges[low][0] < end;
|
|
21974
|
+
}
|
|
21250
21975
|
function readOleDocParagraphs(docBytes, limits) {
|
|
21251
21976
|
try {
|
|
21252
21977
|
const budget = processingLimits(limits);
|
|
@@ -21278,11 +22003,19 @@ function readOleDocParagraphs(docBytes, limits) {
|
|
|
21278
22003
|
return void 0;
|
|
21279
22004
|
}
|
|
21280
22005
|
}
|
|
21281
|
-
function shiftSectionTableCps(tableBytes, sed, editEndCp, delta2) {
|
|
22006
|
+
function shiftSectionTableCps(tableBytes, sed, editEndCp, delta2, storyLength) {
|
|
21282
22007
|
const view = new DataView(tableBytes.buffer, tableBytes.byteOffset, tableBytes.byteLength);
|
|
21283
22008
|
if (sed.lcb < 4 || (sed.lcb - 4) % 16 !== 0 || sed.fc > tableBytes.length - sed.lcb)
|
|
21284
22009
|
throw new Error("Invalid section table");
|
|
21285
22010
|
const n = (sed.lcb - 4) / 16;
|
|
22011
|
+
let previous = -1;
|
|
22012
|
+
for (let i2 = 0; i2 <= n; i2++) {
|
|
22013
|
+
const cp = view.getInt32(sed.fc + i2 * 4, true);
|
|
22014
|
+
const shifted = cp >= editEndCp ? cp + delta2 : cp;
|
|
22015
|
+
if (cp < 0 || cp > storyLength + 1 || cp < previous || shifted < 0 || shifted > 2147483647 || shifted > storyLength + delta2 + 1)
|
|
22016
|
+
throw new Error("Invalid section table character positions");
|
|
22017
|
+
previous = cp;
|
|
22018
|
+
}
|
|
21286
22019
|
for (let i2 = 0; i2 <= n; i2++) {
|
|
21287
22020
|
const off = sed.fc + i2 * 4;
|
|
21288
22021
|
const cp = view.getInt32(off, true);
|
|
@@ -21335,8 +22068,11 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text2, limits) {
|
|
|
21335
22068
|
const sanitizedText = text2.replaceAll(/[\r\n]+/gu, " ");
|
|
21336
22069
|
if (fib.ccpText - (paragraphEndCp - paragraphStartCp) + sanitizedText.length + 1 > budget.maxCharacters)
|
|
21337
22070
|
return rejected("resource-limit");
|
|
22071
|
+
const mainFields = readFcLcbAt(cfb.wordDocBytes, fib, 16);
|
|
22072
|
+
shiftDocMainFieldCps(cfb.tableBytes, mainFields, bodyText, paragraphStartCp, paragraphEndCp, 0, budget.maxFieldRecords);
|
|
21338
22073
|
if (sanitizedText.length + 1 === paragraphEndCp - paragraphStartCp && bodyText[paragraphEndCp - 1] === "\r") {
|
|
21339
22074
|
const replacement = `${sanitizedText}\r`;
|
|
22075
|
+
const protectedRanges = protectedWordRanges(cfb.wordDocBytes, cfb.tableBytes, fib);
|
|
21340
22076
|
const patched = cfb.wordDocBytes.slice();
|
|
21341
22077
|
let canPatch = true;
|
|
21342
22078
|
for (const piece of pieces) {
|
|
@@ -21348,6 +22084,8 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text2, limits) {
|
|
|
21348
22084
|
const unit = piece.compressed ? 1 : 2;
|
|
21349
22085
|
const fc = piece.fc + (start - piece.cpStart) * unit;
|
|
21350
22086
|
const fcEnd = fc + part.length * unit;
|
|
22087
|
+
if (overlapsWordStructure(protectedRanges, fc, fcEnd))
|
|
22088
|
+
return rejected("invalid-document");
|
|
21351
22089
|
if (pieces.some((other) => other !== piece && other.fc < fcEnd && other.fc + (other.cpEnd - other.cpStart) * (other.compressed ? 1 : 2) > fc)) {
|
|
21352
22090
|
canPatch = false;
|
|
21353
22091
|
break;
|
|
@@ -21367,13 +22105,14 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text2, limits) {
|
|
|
21367
22105
|
if (hasUnsupportedFeatures(cfb.wordDocBytes, fib))
|
|
21368
22106
|
return rejected("unsupported-features");
|
|
21369
22107
|
const delta2 = sanitizedText.length + 1 - (paragraphEndCp - paragraphStartCp);
|
|
21370
|
-
const
|
|
21371
|
-
|
|
22108
|
+
for (const [targetIndex, target] of [[16, mainFields], [6, fib.sed]]) {
|
|
22109
|
+
if (target.lcb === 0)
|
|
22110
|
+
continue;
|
|
21372
22111
|
for (let index2 = 0; index2 < fib.fibRgFcLcbCount; index2++) {
|
|
21373
|
-
if (index2 ===
|
|
22112
|
+
if (index2 === targetIndex || index2 === 87)
|
|
21374
22113
|
continue;
|
|
21375
22114
|
const other = readFcLcbAt(cfb.wordDocBytes, fib, index2);
|
|
21376
|
-
if (other.lcb > 0 && other.fc <
|
|
22115
|
+
if (other.lcb > 0 && other.fc < target.fc + target.lcb && other.fc + other.lcb > target.fc)
|
|
21377
22116
|
return rejected("invalid-document");
|
|
21378
22117
|
}
|
|
21379
22118
|
}
|
|
@@ -21435,7 +22174,7 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text2, limits) {
|
|
|
21435
22174
|
tableOff += papxBteBytes.length;
|
|
21436
22175
|
const newChpxBteFcLcb = { fc: tableOff, lcb: chpxBteBytes.length };
|
|
21437
22176
|
newTableBytes.set(chpxBteBytes, tableOff);
|
|
21438
|
-
shiftSectionTableCps(newTableBytes, fib.sed, paragraphEndCp, delta2);
|
|
22177
|
+
shiftSectionTableCps(newTableBytes, fib.sed, paragraphEndCp, delta2, fib.ccpText);
|
|
21439
22178
|
patchDocFib(newWordDoc, fib, {
|
|
21440
22179
|
ccpText: newCcpText,
|
|
21441
22180
|
cbMac: newWordDocLen,
|
|
@@ -21456,7 +22195,7 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text2, limits) {
|
|
|
21456
22195
|
}
|
|
21457
22196
|
var RISKY_PLCF_INDICES, RISKY_STTB_INDICES, SAFE_EXTENDED_FC_LCB_INDICES, DEFAULT_OLE_DOC_PROCESSING_LIMITS;
|
|
21458
22197
|
var init_ole_document_doc_editor = __esm({
|
|
21459
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
22198
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-editor.js"() {
|
|
21460
22199
|
init_ole_document_doc_cfb();
|
|
21461
22200
|
init_ole_document_doc_fib();
|
|
21462
22201
|
init_ole_document_doc_fkp();
|
|
@@ -21560,7 +22299,7 @@ var init_ole_nested_deck_editor = __esm({
|
|
|
21560
22299
|
}
|
|
21561
22300
|
});
|
|
21562
22301
|
|
|
21563
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
22302
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js
|
|
21564
22303
|
function crc32(bytes) {
|
|
21565
22304
|
let crc = 4294967295;
|
|
21566
22305
|
for (let i2 = 0; i2 < bytes.length; i2++) {
|
|
@@ -21656,7 +22395,7 @@ function encodePng(width, height, rgba) {
|
|
|
21656
22395
|
}
|
|
21657
22396
|
var CRC_TABLE, PNG_SIGNATURE;
|
|
21658
22397
|
var init_png_encoder = __esm({
|
|
21659
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
22398
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js"() {
|
|
21660
22399
|
CRC_TABLE = (() => {
|
|
21661
22400
|
const table = new Uint32Array(256);
|
|
21662
22401
|
for (let n = 0; n < 256; n++) {
|
|
@@ -27408,8 +28147,8 @@ function runSmartArtEngine(data, layoutXml3, width, height, context) {
|
|
|
27408
28147
|
if (!def) {
|
|
27409
28148
|
return void 0;
|
|
27410
28149
|
}
|
|
27411
|
-
const
|
|
27412
|
-
const tree = buildPresentationTree(def,
|
|
28150
|
+
const model2 = buildDataModel(data.nodes, data.connections);
|
|
28151
|
+
const tree = buildPresentationTree(def, model2.doc, {
|
|
27413
28152
|
direction: data.presLayoutVars?.direction === "rev" ? "rev" : void 0
|
|
27414
28153
|
});
|
|
27415
28154
|
if (!tree) {
|
|
@@ -45430,7 +46169,7 @@ function remapFill(fill3, id) {
|
|
|
45430
46169
|
}
|
|
45431
46170
|
return { ...fill3, relId: id, sourceXml: buildXml(node2) };
|
|
45432
46171
|
}
|
|
45433
|
-
function captureDiagramPictures(
|
|
46172
|
+
function captureDiagramPictures(model2, dataXml2, dataParts, drawing) {
|
|
45434
46173
|
const pictures = [];
|
|
45435
46174
|
const parts = { ...dataParts };
|
|
45436
46175
|
const add8 = (source2, owner) => {
|
|
@@ -45455,7 +46194,7 @@ function captureDiagramPictures(model, dataXml2, dataParts, drawing) {
|
|
|
45455
46194
|
for (const element2 of saved) {
|
|
45456
46195
|
const nodeId = element2.getAttribute("nodeId");
|
|
45457
46196
|
const fill3 = first(element2, "blipFill", NS.a);
|
|
45458
|
-
if (nodeId && fill3 &&
|
|
46197
|
+
if (nodeId && fill3 && model2.nodes.some((node2) => node2.modelId === nodeId))
|
|
45459
46198
|
add8(
|
|
45460
46199
|
{
|
|
45461
46200
|
nodeId,
|
|
@@ -45466,10 +46205,10 @@ function captureDiagramPictures(model, dataXml2, dataParts, drawing) {
|
|
|
45466
46205
|
dataParts
|
|
45467
46206
|
);
|
|
45468
46207
|
}
|
|
45469
|
-
for (const point2 of
|
|
46208
|
+
for (const point2 of model2.points) {
|
|
45470
46209
|
if (point2.fill?.kind !== "picture") continue;
|
|
45471
46210
|
const nodeId = point2.type === "pres" ? point2.presAssocId : point2.modelId;
|
|
45472
|
-
if (nodeId &&
|
|
46211
|
+
if (nodeId && model2.nodes.some((node2) => node2.modelId === nodeId) && !pictures.some((item2) => item2.nodeId === nodeId))
|
|
45473
46212
|
add8(
|
|
45474
46213
|
{
|
|
45475
46214
|
nodeId,
|
|
@@ -45482,14 +46221,14 @@ function captureDiagramPictures(model, dataXml2, dataParts, drawing) {
|
|
|
45482
46221
|
}
|
|
45483
46222
|
for (const shape2 of drawing?.shapes ?? []) {
|
|
45484
46223
|
if (shape2.fill?.kind !== "picture") continue;
|
|
45485
|
-
const point2 =
|
|
46224
|
+
const point2 = model2.points.find((point3) => point3.modelId === shape2.modelId);
|
|
45486
46225
|
const nodeId = shape2.sourceNodeId ?? (point2?.type === "pres" ? point2.presAssocId : point2?.modelId);
|
|
45487
46226
|
const part = shape2.fill.relId ? drawing?.pictureParts?.[shape2.fill.relId] : void 0;
|
|
45488
46227
|
if (saved.length && pictures.some(
|
|
45489
46228
|
(item2) => item2.nodeId === nodeId && item2.fill.relId && parts[item2.fill.relId] === part && item2.role !== point2?.presName && item2.styleLabel !== point2?.presStyleLabel
|
|
45490
46229
|
))
|
|
45491
46230
|
continue;
|
|
45492
|
-
if (nodeId &&
|
|
46231
|
+
if (nodeId && model2.nodes.some((node2) => node2.modelId === nodeId))
|
|
45493
46232
|
add8(
|
|
45494
46233
|
{
|
|
45495
46234
|
nodeId,
|
|
@@ -45899,10 +46638,10 @@ function add(parent, namespace, name, attrs4 = {}) {
|
|
|
45899
46638
|
}
|
|
45900
46639
|
function withDiagramDrawingRelationship(xml, relationshipId2) {
|
|
45901
46640
|
const doc = parseXml(xml);
|
|
45902
|
-
const
|
|
45903
|
-
let extension = descendants2(
|
|
46641
|
+
const model2 = doc.documentElement;
|
|
46642
|
+
let extension = descendants2(model2, "dataModelExt").find((node2) => node2.namespaceURI === DSP2);
|
|
45904
46643
|
if (!extension) {
|
|
45905
|
-
const extLst = first(
|
|
46644
|
+
const extLst = first(model2, "extLst", NS.dgm) ?? add(model2, NS.dgm, "dgm:extLst");
|
|
45906
46645
|
extension = add(add(extLst, NS.a, "a:ext", { uri: DSP2 }), DSP2, "dsp:dataModelExt", {
|
|
45907
46646
|
minVer: NS.dgm
|
|
45908
46647
|
});
|
|
@@ -45913,13 +46652,13 @@ function withDiagramDrawingRelationship(xml, relationshipId2) {
|
|
|
45913
46652
|
function buildGeneratedDiagramCache(dataXml2, input2) {
|
|
45914
46653
|
dataXml2 = withDiagramPictureSources(dataXml2, input2.source);
|
|
45915
46654
|
const source2 = { ...input2.source, dataXml: dataXml2 };
|
|
45916
|
-
const
|
|
46655
|
+
const model2 = parseDiagramDataModel(dataXml2);
|
|
45917
46656
|
const scheme2 = { ...DEFAULT_GENERATED_DIAGRAM_SCHEME, ...input2.scheme };
|
|
45918
46657
|
const preview = previewDiagramLayout({
|
|
45919
46658
|
...input2,
|
|
45920
46659
|
source: source2,
|
|
45921
46660
|
scheme: scheme2,
|
|
45922
|
-
nodes: diagramNodesInTreeOrder(
|
|
46661
|
+
nodes: diagramNodesInTreeOrder(model2)
|
|
45923
46662
|
});
|
|
45924
46663
|
if (preview.mode !== "interpreted" || preview.issues.length || !preview.drawing?.shapes.length)
|
|
45925
46664
|
return void 0;
|
|
@@ -45951,7 +46690,7 @@ function buildGeneratedDiagramCache(dataXml2, input2) {
|
|
|
45951
46690
|
const point2 = children2(points7, "pt", NS.dgm).find(
|
|
45952
46691
|
(point3) => point3.getAttribute("modelId") === shape2.sourceNodeId
|
|
45953
46692
|
);
|
|
45954
|
-
const direct =
|
|
46693
|
+
const direct = model2.nodes.find((node2) => node2.modelId === shape2.sourceNodeId);
|
|
45955
46694
|
const fillIndex = shape2.style?.fill?.index;
|
|
45956
46695
|
const template = fillIndex ? input2.formatScheme?.fillStyles[fillIndex - 1]?.fill : void 0;
|
|
45957
46696
|
if (!direct?.fill && shape2.fill?.kind === "solid" && shape2.fill.color.kind === "srgb" && (!template || template.kind === "solid" && template.color.kind === "scheme" && template.color.value === "phClr")) {
|
|
@@ -47785,7 +48524,7 @@ var init_encryption_detection = __esm({
|
|
|
47785
48524
|
}
|
|
47786
48525
|
});
|
|
47787
48526
|
|
|
47788
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
48527
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js
|
|
47789
48528
|
function getSubtle() {
|
|
47790
48529
|
if (typeof globalThis.crypto !== "undefined" && globalThis.crypto.subtle) {
|
|
47791
48530
|
return globalThis.crypto.subtle;
|
|
@@ -47903,7 +48642,7 @@ async function hmac(algorithm, key2, data) {
|
|
|
47903
48642
|
return new Uint8Array(result);
|
|
47904
48643
|
}
|
|
47905
48644
|
var init_ooxml_crypto_primitives = __esm({
|
|
47906
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
48645
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js"() {
|
|
47907
48646
|
}
|
|
47908
48647
|
});
|
|
47909
48648
|
|
|
@@ -61073,6 +61812,130 @@ var init_smartart_definition_metadata = __esm({
|
|
|
61073
61812
|
}
|
|
61074
61813
|
});
|
|
61075
61814
|
|
|
61815
|
+
// pptx/core/utils/custom-show-actions.ts
|
|
61816
|
+
function isUnsignedInt(id) {
|
|
61817
|
+
return /^\d+$/.test(id) && Number(id) <= UNSIGNED_INT_MAX;
|
|
61818
|
+
}
|
|
61819
|
+
function normalizeCustomShowIds(shows) {
|
|
61820
|
+
const used = /* @__PURE__ */ new Set();
|
|
61821
|
+
let max = -1;
|
|
61822
|
+
for (const show of shows) {
|
|
61823
|
+
if (isUnsignedInt(show.id) && !used.has(show.id)) {
|
|
61824
|
+
used.add(show.id);
|
|
61825
|
+
max = Math.max(max, Number(show.id));
|
|
61826
|
+
}
|
|
61827
|
+
}
|
|
61828
|
+
const kept = /* @__PURE__ */ new Set();
|
|
61829
|
+
const idMap = /* @__PURE__ */ new Map();
|
|
61830
|
+
const next = shows.map((show) => {
|
|
61831
|
+
if (isUnsignedInt(show.id) && !kept.has(show.id)) {
|
|
61832
|
+
kept.add(show.id);
|
|
61833
|
+
return show;
|
|
61834
|
+
}
|
|
61835
|
+
const id = String(++max);
|
|
61836
|
+
if (!idMap.has(show.id)) {
|
|
61837
|
+
idMap.set(show.id, id);
|
|
61838
|
+
}
|
|
61839
|
+
return { ...show, id };
|
|
61840
|
+
});
|
|
61841
|
+
return {
|
|
61842
|
+
shows: idMap.size > 0 || next.some((s, i2) => s !== shows[i2]) ? next : [...shows],
|
|
61843
|
+
idMap
|
|
61844
|
+
};
|
|
61845
|
+
}
|
|
61846
|
+
function customShowActionId(action) {
|
|
61847
|
+
if (!action || !action.toLowerCase().includes("ppaction://customshow")) {
|
|
61848
|
+
return void 0;
|
|
61849
|
+
}
|
|
61850
|
+
const match = action.match(/[?&]id=([^&]*)/i);
|
|
61851
|
+
return match ? decodeURIComponent(match[1]) : void 0;
|
|
61852
|
+
}
|
|
61853
|
+
function rewriteAction(action, rewrite) {
|
|
61854
|
+
const id = customShowActionId(action);
|
|
61855
|
+
if (id === void 0) {
|
|
61856
|
+
return { changed: false, action };
|
|
61857
|
+
}
|
|
61858
|
+
const next = rewrite(id);
|
|
61859
|
+
if (next === id) {
|
|
61860
|
+
return { changed: false, action };
|
|
61861
|
+
}
|
|
61862
|
+
return {
|
|
61863
|
+
changed: true,
|
|
61864
|
+
action: next === null ? void 0 : action.replace(/([?&]id=)[^&]*/i, `$1${encodeURIComponent(next)}`)
|
|
61865
|
+
};
|
|
61866
|
+
}
|
|
61867
|
+
function mapElement(element2, rewrite) {
|
|
61868
|
+
let changed = 0;
|
|
61869
|
+
let next = element2;
|
|
61870
|
+
const edit = () => {
|
|
61871
|
+
if (next === element2) {
|
|
61872
|
+
next = { ...element2 };
|
|
61873
|
+
}
|
|
61874
|
+
return next;
|
|
61875
|
+
};
|
|
61876
|
+
for (const key2 of ["actionClick", "actionHover"]) {
|
|
61877
|
+
const current = element2[key2];
|
|
61878
|
+
const result = rewriteAction(current?.action, rewrite);
|
|
61879
|
+
if (current && result.changed) {
|
|
61880
|
+
changed++;
|
|
61881
|
+
if (result.action === void 0) {
|
|
61882
|
+
delete edit()[key2];
|
|
61883
|
+
} else {
|
|
61884
|
+
edit()[key2] = { ...current, action: result.action };
|
|
61885
|
+
}
|
|
61886
|
+
}
|
|
61887
|
+
}
|
|
61888
|
+
const segments = "textSegments" in element2 ? element2.textSegments : void 0;
|
|
61889
|
+
if (segments?.some((s) => customShowActionId(s.style?.hyperlinkAction) !== void 0)) {
|
|
61890
|
+
edit().textSegments = segments.map((segment) => {
|
|
61891
|
+
const result = rewriteAction(segment.style?.hyperlinkAction, rewrite);
|
|
61892
|
+
if (!result.changed) {
|
|
61893
|
+
return segment;
|
|
61894
|
+
}
|
|
61895
|
+
changed++;
|
|
61896
|
+
if (result.action !== void 0) {
|
|
61897
|
+
return { ...segment, style: { ...segment.style, hyperlinkAction: result.action } };
|
|
61898
|
+
}
|
|
61899
|
+
const {
|
|
61900
|
+
hyperlink: _h,
|
|
61901
|
+
hyperlinkRId: _r,
|
|
61902
|
+
hyperlinkTooltip: _t,
|
|
61903
|
+
hyperlinkAction: _a3,
|
|
61904
|
+
hyperlinkTargetSlideIndex: _i,
|
|
61905
|
+
...style
|
|
61906
|
+
} = segment.style;
|
|
61907
|
+
return { ...segment, style };
|
|
61908
|
+
});
|
|
61909
|
+
}
|
|
61910
|
+
if (element2.type === "group") {
|
|
61911
|
+
const children16 = element2.children.map((child33) => mapElement(child33, rewrite));
|
|
61912
|
+
if (children16.some((c) => c.changed > 0)) {
|
|
61913
|
+
edit().children = children16.map((c) => c.element);
|
|
61914
|
+
changed += children16.reduce((n, c) => n + c.changed, 0);
|
|
61915
|
+
}
|
|
61916
|
+
}
|
|
61917
|
+
return { element: next, changed };
|
|
61918
|
+
}
|
|
61919
|
+
function mapCustomShowActions(slides, rewrite) {
|
|
61920
|
+
let changed = 0;
|
|
61921
|
+
const next = slides.map((slide) => {
|
|
61922
|
+
const results = slide.elements.map((element2) => mapElement(element2, rewrite));
|
|
61923
|
+
const n = results.reduce((sum, r) => sum + r.changed, 0);
|
|
61924
|
+
if (n === 0) {
|
|
61925
|
+
return slide;
|
|
61926
|
+
}
|
|
61927
|
+
changed += n;
|
|
61928
|
+
return { ...slide, elements: results.map((r) => r.element) };
|
|
61929
|
+
});
|
|
61930
|
+
return { slides: next, changed };
|
|
61931
|
+
}
|
|
61932
|
+
var UNSIGNED_INT_MAX;
|
|
61933
|
+
var init_custom_show_actions = __esm({
|
|
61934
|
+
"pptx/core/utils/custom-show-actions.ts"() {
|
|
61935
|
+
UNSIGNED_INT_MAX = 4294967295;
|
|
61936
|
+
}
|
|
61937
|
+
});
|
|
61938
|
+
|
|
61076
61939
|
// pptx/core/utils/scene3d-coordinate.ts
|
|
61077
61940
|
var init_scene3d_coordinate2 = __esm({
|
|
61078
61941
|
"pptx/core/utils/scene3d-coordinate.ts"() {
|
|
@@ -65318,6 +66181,7 @@ var init_utils = __esm({
|
|
|
65318
66181
|
init_activex_serializer();
|
|
65319
66182
|
init_pptx_validator();
|
|
65320
66183
|
init_smartart_layout_definition();
|
|
66184
|
+
init_custom_show_actions();
|
|
65321
66185
|
init_smartart_relayout();
|
|
65322
66186
|
init_xml_access();
|
|
65323
66187
|
init_smartart_definition_header();
|
|
@@ -116240,6 +117104,32 @@ var init_modern_comment_package = __esm({
|
|
|
116240
117104
|
}
|
|
116241
117105
|
});
|
|
116242
117106
|
|
|
117107
|
+
// pptx/core/core/runtime/custom-show-save-ids.ts
|
|
117108
|
+
function withValidCustomShowIds(slides, options2) {
|
|
117109
|
+
if (!options2?.customShows) {
|
|
117110
|
+
return { slides, options: options2 };
|
|
117111
|
+
}
|
|
117112
|
+
const { shows, idMap } = normalizeCustomShowIds(options2.customShows);
|
|
117113
|
+
if (idMap.size === 0) {
|
|
117114
|
+
return { slides, options: options2 };
|
|
117115
|
+
}
|
|
117116
|
+
const properties = options2.presentationProperties;
|
|
117117
|
+
const showId = properties?.showSlidesCustomShowId;
|
|
117118
|
+
return {
|
|
117119
|
+
slides: mapCustomShowActions(slides, (id) => idMap.get(id) ?? id).slides,
|
|
117120
|
+
options: {
|
|
117121
|
+
...options2,
|
|
117122
|
+
customShows: shows,
|
|
117123
|
+
...properties && showId !== void 0 && idMap.has(showId) ? { presentationProperties: { ...properties, showSlidesCustomShowId: idMap.get(showId) } } : {}
|
|
117124
|
+
}
|
|
117125
|
+
};
|
|
117126
|
+
}
|
|
117127
|
+
var init_custom_show_save_ids = __esm({
|
|
117128
|
+
"pptx/core/core/runtime/custom-show-save-ids.ts"() {
|
|
117129
|
+
init_custom_show_actions();
|
|
117130
|
+
}
|
|
117131
|
+
});
|
|
117132
|
+
|
|
116243
117133
|
// pptx/core/core/runtime/comment-authors-retention.ts
|
|
116244
117134
|
function shouldKeepSourceCommentAuthors(input2) {
|
|
116245
117135
|
return !input2.hasUsedCommentAuthors && input2.authorsPartPresent && input2.existingLegacyCommentPartCount === 0;
|
|
@@ -118085,7 +118975,7 @@ var init_metro_blob_collect = __esm({
|
|
|
118085
118975
|
}
|
|
118086
118976
|
});
|
|
118087
118977
|
|
|
118088
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
118978
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js
|
|
118089
118979
|
function record(recType, data, recInstance = 0, isContainer2 = false, recVer = 0) {
|
|
118090
118980
|
const header = new Uint8Array(8);
|
|
118091
118981
|
const view = new DataView(header.buffer);
|
|
@@ -118100,7 +118990,7 @@ function record(recType, data, recInstance = 0, isContainer2 = false, recVer = 0
|
|
|
118100
118990
|
}
|
|
118101
118991
|
var ByteWriter;
|
|
118102
118992
|
var init_byte_writer = __esm({
|
|
118103
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
118993
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js"() {
|
|
118104
118994
|
ByteWriter = class {
|
|
118105
118995
|
chunks = [];
|
|
118106
118996
|
length = 0;
|
|
@@ -118183,13 +119073,13 @@ var init_byte_writer = __esm({
|
|
|
118183
119073
|
}
|
|
118184
119074
|
});
|
|
118185
119075
|
|
|
118186
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
119076
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js
|
|
118187
119077
|
function masterToEmu(mu) {
|
|
118188
119078
|
return Math.round(mu * EMU_PER_MASTER);
|
|
118189
119079
|
}
|
|
118190
119080
|
var RT, OA, TEXT_TYPE, HEADER_TOKEN_PLAIN, HEADER_TOKEN_ENCRYPTED, EMU_PER_MASTER;
|
|
118191
119081
|
var init_legacy_ppt_record_types = __esm({
|
|
118192
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
119082
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js"() {
|
|
118193
119083
|
RT = {
|
|
118194
119084
|
Document: 1e3,
|
|
118195
119085
|
DocumentAtom: 1001,
|
|
@@ -118318,14 +119208,14 @@ var init_legacy_ppt_record_types = __esm({
|
|
|
118318
119208
|
}
|
|
118319
119209
|
});
|
|
118320
119210
|
|
|
118321
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
119211
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js
|
|
118322
119212
|
var init_record_types = __esm({
|
|
118323
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
119213
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js"() {
|
|
118324
119214
|
init_legacy_ppt_record_types();
|
|
118325
119215
|
}
|
|
118326
119216
|
});
|
|
118327
119217
|
|
|
118328
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
119218
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js
|
|
118329
119219
|
function buildCurrentUserStream(offsetToCurrentEdit, encrypted) {
|
|
118330
119220
|
const nameBytes = new ByteWriter().ansi(USER_NAME).toBytes();
|
|
118331
119221
|
const data = new ByteWriter().u32(20).u32(encrypted ? HEADER_TOKEN_ENCRYPTED : HEADER_TOKEN_PLAIN).u32(offsetToCurrentEdit).u16(nameBytes.length).u16(1012).u8(3).u8(0).bytes(new Uint8Array(2)).bytes(nameBytes).u32(8).toBytes();
|
|
@@ -118339,7 +119229,7 @@ function buildCurrentUserStream(offsetToCurrentEdit, encrypted) {
|
|
|
118339
119229
|
}
|
|
118340
119230
|
var USER_NAME, CURRENT_USER_STREAM_SIZE;
|
|
118341
119231
|
var init_current_user_writer = __esm({
|
|
118342
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
119232
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js"() {
|
|
118343
119233
|
init_record_types();
|
|
118344
119234
|
init_byte_writer();
|
|
118345
119235
|
USER_NAME = "pptx-viewer";
|
|
@@ -118347,7 +119237,7 @@ var init_current_user_writer = __esm({
|
|
|
118347
119237
|
}
|
|
118348
119238
|
});
|
|
118349
119239
|
|
|
118350
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
119240
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js
|
|
118351
119241
|
function rotl322(x, n) {
|
|
118352
119242
|
return (x << n | x >>> 32 - n) >>> 0;
|
|
118353
119243
|
}
|
|
@@ -118396,11 +119286,11 @@ function mdStyleDigest2(message, initialState, transform8) {
|
|
|
118396
119286
|
return out;
|
|
118397
119287
|
}
|
|
118398
119288
|
var init_bit_ops2 = __esm({
|
|
118399
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
119289
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js"() {
|
|
118400
119290
|
}
|
|
118401
119291
|
});
|
|
118402
119292
|
|
|
118403
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
119293
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js
|
|
118404
119294
|
function f13(x, y, z2) {
|
|
118405
119295
|
return x & y | ~x & z2;
|
|
118406
119296
|
}
|
|
@@ -118424,7 +119314,7 @@ function md42(message) {
|
|
|
118424
119314
|
}
|
|
118425
119315
|
var INITIAL_STATE5, K22, K32, ROUND12, ROUND22, ROUND32;
|
|
118426
119316
|
var init_md42 = __esm({
|
|
118427
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
119317
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js"() {
|
|
118428
119318
|
init_bit_ops2();
|
|
118429
119319
|
INITIAL_STATE5 = [1732584193, 4023233417, 2562383102, 271733878];
|
|
118430
119320
|
K22 = 1518500249;
|
|
@@ -118486,7 +119376,7 @@ var init_md42 = __esm({
|
|
|
118486
119376
|
}
|
|
118487
119377
|
});
|
|
118488
119378
|
|
|
118489
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
119379
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js
|
|
118490
119380
|
function pictureUid(picture) {
|
|
118491
119381
|
return md42(picture.bytes);
|
|
118492
119382
|
}
|
|
@@ -118509,7 +119399,7 @@ function buildFbse(picture, uid, foDelay, size) {
|
|
|
118509
119399
|
}
|
|
118510
119400
|
var MSOBLIP_PICT, BLIP_INFO;
|
|
118511
119401
|
var init_blip_writer = __esm({
|
|
118512
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
119402
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js"() {
|
|
118513
119403
|
init_md42();
|
|
118514
119404
|
init_png_encoder();
|
|
118515
119405
|
init_record_types();
|
|
@@ -118525,7 +119415,7 @@ var init_blip_writer = __esm({
|
|
|
118525
119415
|
}
|
|
118526
119416
|
});
|
|
118527
119417
|
|
|
118528
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
119418
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js
|
|
118529
119419
|
function boolPropValue(flag2, bit, useBit) {
|
|
118530
119420
|
return useBit | (flag2 ? bit : 0);
|
|
118531
119421
|
}
|
|
@@ -118561,7 +119451,7 @@ function buildMetroBlobTertiaryFopt(metroBlob) {
|
|
|
118561
119451
|
}
|
|
118562
119452
|
var OPT, FBID_FLAG, METRO_BLOB_OPID;
|
|
118563
119453
|
var init_fopt_writer = __esm({
|
|
118564
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
119454
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js"() {
|
|
118565
119455
|
init_record_types();
|
|
118566
119456
|
init_byte_writer();
|
|
118567
119457
|
OPT = {
|
|
@@ -118589,7 +119479,7 @@ var init_fopt_writer = __esm({
|
|
|
118589
119479
|
}
|
|
118590
119480
|
});
|
|
118591
119481
|
|
|
118592
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
119482
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js
|
|
118593
119483
|
function buildDggDefaultProperties() {
|
|
118594
119484
|
return buildFopt([
|
|
118595
119485
|
{ id: 385, value: 134217732 },
|
|
@@ -118647,7 +119537,7 @@ function buildPictureStore(pictures, shapesPerDrawing) {
|
|
|
118647
119537
|
}
|
|
118648
119538
|
var SHAPE_ID_CLUSTER_SIZE;
|
|
118649
119539
|
var init_bstore_writer = __esm({
|
|
118650
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
119540
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js"() {
|
|
118651
119541
|
init_record_types();
|
|
118652
119542
|
init_blip_writer();
|
|
118653
119543
|
init_byte_writer();
|
|
@@ -118656,7 +119546,7 @@ var init_bstore_writer = __esm({
|
|
|
118656
119546
|
}
|
|
118657
119547
|
});
|
|
118658
119548
|
|
|
118659
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
119549
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js
|
|
118660
119550
|
function buildFontEntityAtom(name, index2) {
|
|
118661
119551
|
const nameBytes = new ByteWriter().utf16(name.slice(0, 31)).u16(0).toBytes();
|
|
118662
119552
|
const padded = new Uint8Array(LF_FACE_NAME_BYTES);
|
|
@@ -118684,14 +119574,14 @@ function buildEnvironment(fonts, otherTextStyle) {
|
|
|
118684
119574
|
}
|
|
118685
119575
|
var LF_FACE_NAME_BYTES;
|
|
118686
119576
|
var init_font_collection_writer = __esm({
|
|
118687
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
119577
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js"() {
|
|
118688
119578
|
init_record_types();
|
|
118689
119579
|
init_byte_writer();
|
|
118690
119580
|
LF_FACE_NAME_BYTES = 64;
|
|
118691
119581
|
}
|
|
118692
119582
|
});
|
|
118693
119583
|
|
|
118694
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
119584
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js
|
|
118695
119585
|
function emuToMaster(emu2) {
|
|
118696
119586
|
return Math.round(emu2 / EMU_PER_MASTER);
|
|
118697
119587
|
}
|
|
@@ -118747,7 +119637,7 @@ function buildDocumentContainer(input2) {
|
|
|
118747
119637
|
}
|
|
118748
119638
|
var MASTER_SLIDE_ID_SENTINEL, RT_CSTRING, RT_BINARY_TAG_DATA_BLOB;
|
|
118749
119639
|
var init_document_writer = __esm({
|
|
118750
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
119640
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js"() {
|
|
118751
119641
|
init_record_types();
|
|
118752
119642
|
init_byte_writer();
|
|
118753
119643
|
init_font_collection_writer();
|
|
@@ -118757,7 +119647,7 @@ var init_document_writer = __esm({
|
|
|
118757
119647
|
}
|
|
118758
119648
|
});
|
|
118759
119649
|
|
|
118760
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
119650
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js
|
|
118761
119651
|
function buildCString(text2, recInstance) {
|
|
118762
119652
|
return record(RT.CString, new ByteWriter().utf16(text2).toBytes(), recInstance, false, 0);
|
|
118763
119653
|
}
|
|
@@ -118893,7 +119783,7 @@ function buildTextInteractiveInfoAtom(beginChar, endChar) {
|
|
|
118893
119783
|
}
|
|
118894
119784
|
var II_ACTION, II_JUMP, LT, FLAG_CUSTOM_SHOW_RETURN, HyperlinkCollector;
|
|
118895
119785
|
var init_hyperlink_writer = __esm({
|
|
118896
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
119786
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js"() {
|
|
118897
119787
|
init_record_types();
|
|
118898
119788
|
init_byte_writer();
|
|
118899
119789
|
II_ACTION = {
|
|
@@ -118956,7 +119846,7 @@ var init_hyperlink_writer = __esm({
|
|
|
118956
119846
|
}
|
|
118957
119847
|
});
|
|
118958
119848
|
|
|
118959
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
119849
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js
|
|
118960
119850
|
function buildCString2(text2, recInstance) {
|
|
118961
119851
|
return record(RT.CString, new ByteWriter().utf16(text2).toBytes(), recInstance, false, 0);
|
|
118962
119852
|
}
|
|
@@ -118992,7 +119882,7 @@ function buildMediaExObjEntries(media) {
|
|
|
118992
119882
|
}
|
|
118993
119883
|
var MediaCollector, SOUND_EXTENSION_WAV, SOUND_LENGTH_UNKNOWN;
|
|
118994
119884
|
var init_media_writer = __esm({
|
|
118995
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
119885
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js"() {
|
|
118996
119886
|
init_record_types();
|
|
118997
119887
|
init_byte_writer();
|
|
118998
119888
|
MediaCollector = class {
|
|
@@ -119028,7 +119918,7 @@ var init_media_writer = __esm({
|
|
|
119028
119918
|
}
|
|
119029
119919
|
});
|
|
119030
119920
|
|
|
119031
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
119921
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js
|
|
119032
119922
|
function hexToBytes(hex5) {
|
|
119033
119923
|
const out = new Uint8Array(hex5.length / 2);
|
|
119034
119924
|
for (let i2 = 0; i2 < out.length; i2++) {
|
|
@@ -119090,7 +119980,7 @@ function buildExObjRefAtom(exObjId) {
|
|
|
119090
119980
|
}
|
|
119091
119981
|
var PACKAGE_ROOT_CLSID, COMP_OBJ_HEX, EX_OLE_EMBEDDED, DV_ASPECT_ICON, EX_OLE_SUB_DEFAULT, PACKAGER_MENU_NAME, OleCollector;
|
|
119092
119982
|
var init_ole_writer = __esm({
|
|
119093
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
119983
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js"() {
|
|
119094
119984
|
init_ole2_parser_write();
|
|
119095
119985
|
init_record_types();
|
|
119096
119986
|
init_byte_writer();
|
|
@@ -119150,7 +120040,7 @@ var init_ole_writer = __esm({
|
|
|
119150
120040
|
}
|
|
119151
120041
|
});
|
|
119152
120042
|
|
|
119153
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120043
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js
|
|
119154
120044
|
function buildExObjList(hyperlinks, ole, media) {
|
|
119155
120045
|
const oleEntries = ole?.all ?? [];
|
|
119156
120046
|
const mediaEntries = media?.all ?? [];
|
|
@@ -119177,7 +120067,7 @@ function buildExObjList(hyperlinks, ole, media) {
|
|
|
119177
120067
|
return record(RT.ExternalObjectList, w.toBytes(), 0, true);
|
|
119178
120068
|
}
|
|
119179
120069
|
var init_ex_obj_list_writer = __esm({
|
|
119180
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120070
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js"() {
|
|
119181
120071
|
init_record_types();
|
|
119182
120072
|
init_byte_writer();
|
|
119183
120073
|
init_hyperlink_writer();
|
|
@@ -119186,7 +120076,7 @@ var init_ex_obj_list_writer = __esm({
|
|
|
119186
120076
|
}
|
|
119187
120077
|
});
|
|
119188
120078
|
|
|
119189
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120079
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js
|
|
119190
120080
|
function emuToMaster2(emu2) {
|
|
119191
120081
|
return Math.round(emu2 / EMU_PER_MASTER);
|
|
119192
120082
|
}
|
|
@@ -119231,7 +120121,7 @@ function buildChildAnchor(rect2) {
|
|
|
119231
120121
|
}
|
|
119232
120122
|
var INT16_MIN, INT16_MAX;
|
|
119233
120123
|
var init_anchor_writer = __esm({
|
|
119234
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120124
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js"() {
|
|
119235
120125
|
init_record_types();
|
|
119236
120126
|
init_byte_writer();
|
|
119237
120127
|
INT16_MIN = -32768;
|
|
@@ -119239,7 +120129,7 @@ var init_anchor_writer = __esm({
|
|
|
119239
120129
|
}
|
|
119240
120130
|
});
|
|
119241
120131
|
|
|
119242
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120132
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js
|
|
119243
120133
|
function parseHex(rgb2) {
|
|
119244
120134
|
const hex5 = (rgb2 ?? DEFAULT_RGB).replace(/^#/u, "");
|
|
119245
120135
|
if (!/^[0-9a-fA-F]{6}$/u.test(hex5)) {
|
|
@@ -119261,12 +120151,12 @@ function encodeColorIndex(rgb2) {
|
|
|
119261
120151
|
}
|
|
119262
120152
|
var DEFAULT_RGB;
|
|
119263
120153
|
var init_colors2 = __esm({
|
|
119264
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120154
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js"() {
|
|
119265
120155
|
DEFAULT_RGB = "000000";
|
|
119266
120156
|
}
|
|
119267
120157
|
});
|
|
119268
120158
|
|
|
119269
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120159
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js
|
|
119270
120160
|
function writePfException(w, para) {
|
|
119271
120161
|
let mask = 0;
|
|
119272
120162
|
if (para.hasBullet !== void 0) {
|
|
@@ -119356,7 +120246,7 @@ function writeCfException(w, run2, fontIndex) {
|
|
|
119356
120246
|
}
|
|
119357
120247
|
var ALIGN_CODE, EMU_PER_MASTER_UNIT;
|
|
119358
120248
|
var init_text_exception_writer = __esm({
|
|
119359
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120249
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js"() {
|
|
119360
120250
|
init_colors2();
|
|
119361
120251
|
ALIGN_CODE = {
|
|
119362
120252
|
l: 0,
|
|
@@ -119368,7 +120258,7 @@ var init_text_exception_writer = __esm({
|
|
|
119368
120258
|
}
|
|
119369
120259
|
});
|
|
119370
120260
|
|
|
119371
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120261
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js
|
|
119372
120262
|
function joinParagraphText(body) {
|
|
119373
120263
|
return body.paragraphs.map((p) => p.runs.map((r) => r.text).join("")).join("\r");
|
|
119374
120264
|
}
|
|
@@ -119429,7 +120319,7 @@ function buildTextAtoms(body, fonts, hyperlinks) {
|
|
|
119429
120319
|
return new ByteWriter().bytes(buildTextHeaderAtom(body.textType)).bytes(buildTextCharsAtom(text2)).bytes(buildStyleTextPropAtom(body, fontIndex)).bytes(buildRunHyperlinks(body, hyperlinks)).toBytes();
|
|
119430
120320
|
}
|
|
119431
120321
|
var init_text_atom_writer = __esm({
|
|
119432
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120322
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js"() {
|
|
119433
120323
|
init_record_types();
|
|
119434
120324
|
init_byte_writer();
|
|
119435
120325
|
init_hyperlink_writer();
|
|
@@ -119437,7 +120327,7 @@ var init_text_atom_writer = __esm({
|
|
|
119437
120327
|
}
|
|
119438
120328
|
});
|
|
119439
120329
|
|
|
119440
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120330
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js
|
|
119441
120331
|
function utf16z(text2) {
|
|
119442
120332
|
return new ByteWriter().utf16(text2).u16(0).toBytes();
|
|
119443
120333
|
}
|
|
@@ -119534,7 +120424,7 @@ function buildMasterPlaceholders(placeholders, allocator, fieldFontIndex) {
|
|
|
119534
120424
|
}
|
|
119535
120425
|
var FSP_FLAGS, RECTANGLE_SPT, TEXT_TYPE_TITLE, TEXT_TYPE_BODY, TEXT_TYPE_OTHER, SPECS, MASTER_PLACEHOLDER_ORDER, TITLE_PROMPT, BODY_PROMPT, DEFAULT_FRAMES;
|
|
119536
120426
|
var init_master_placeholders_writer = __esm({
|
|
119537
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120427
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js"() {
|
|
119538
120428
|
init_record_types();
|
|
119539
120429
|
init_anchor_writer();
|
|
119540
120430
|
init_byte_writer();
|
|
@@ -119601,18 +120491,18 @@ var init_master_placeholders_writer = __esm({
|
|
|
119601
120491
|
}
|
|
119602
120492
|
});
|
|
119603
120493
|
|
|
119604
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120494
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js
|
|
119605
120495
|
function masterStyleFonts(styles2) {
|
|
119606
120496
|
if (!styles2)
|
|
119607
120497
|
return [];
|
|
119608
120498
|
return [styles2.title, styles2.body, styles2.other].flatMap((levels) => levels ?? []).map((level2) => level2.run.fontName).filter((name) => Boolean(name));
|
|
119609
120499
|
}
|
|
119610
120500
|
var init_master_style_fonts = __esm({
|
|
119611
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120501
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js"() {
|
|
119612
120502
|
}
|
|
119613
120503
|
});
|
|
119614
120504
|
|
|
119615
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120505
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js
|
|
119616
120506
|
function buildMasterStyleAtom(recInstance, levels, fontIndex) {
|
|
119617
120507
|
const w = new ByteWriter().u16(levels.length);
|
|
119618
120508
|
for (const level2 of levels) {
|
|
@@ -119643,7 +120533,7 @@ function buildMasterTextStyles(styles2, fontIndex) {
|
|
|
119643
120533
|
}
|
|
119644
120534
|
var EMPTY_LEVELS, FIXED_INSTANCE_DATA;
|
|
119645
120535
|
var init_master_text_styles_writer = __esm({
|
|
119646
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120536
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js"() {
|
|
119647
120537
|
init_record_types();
|
|
119648
120538
|
init_byte_writer();
|
|
119649
120539
|
init_text_exception_writer();
|
|
@@ -119659,7 +120549,7 @@ var init_master_text_styles_writer = __esm({
|
|
|
119659
120549
|
}
|
|
119660
120550
|
});
|
|
119661
120551
|
|
|
119662
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120552
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js
|
|
119663
120553
|
function fillEntries(fill3) {
|
|
119664
120554
|
if (!fill3 || fill3.kind === "none") {
|
|
119665
120555
|
return [{ id: OPT.fNoFillHitTest, value: boolPropValue(false, 16, 1048576) }];
|
|
@@ -119714,7 +120604,7 @@ function buildShapeFoptProps(input2) {
|
|
|
119714
120604
|
}
|
|
119715
120605
|
var DASH_CODE;
|
|
119716
120606
|
var init_shape_props_writer = __esm({
|
|
119717
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120607
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js"() {
|
|
119718
120608
|
init_colors2();
|
|
119719
120609
|
init_fopt_writer();
|
|
119720
120610
|
DASH_CODE = {
|
|
@@ -119729,7 +120619,7 @@ var init_shape_props_writer = __esm({
|
|
|
119729
120619
|
}
|
|
119730
120620
|
});
|
|
119731
120621
|
|
|
119732
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120622
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js
|
|
119733
120623
|
function buildShapeAnchor(rect2, inGroup) {
|
|
119734
120624
|
return inGroup ? buildChildAnchor(rect2) : buildClientAnchor(rect2);
|
|
119735
120625
|
}
|
|
@@ -119831,7 +120721,7 @@ function buildMediaShapeContainer(media, allocator, hyperlinks, mediaEmbeds, inG
|
|
|
119831
120721
|
}
|
|
119832
120722
|
var FSP_FLAG_FLIPH, FSP_FLAG_FLIPV, FSP_FLAG_OLE_SHAPE, FSP_FLAG_CHILD, PLACEHOLDER_ID;
|
|
119833
120723
|
var init_shape_writer = __esm({
|
|
119834
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120724
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js"() {
|
|
119835
120725
|
init_record_types();
|
|
119836
120726
|
init_anchor_writer();
|
|
119837
120727
|
init_byte_writer();
|
|
@@ -119853,7 +120743,7 @@ var init_shape_writer = __esm({
|
|
|
119853
120743
|
}
|
|
119854
120744
|
});
|
|
119855
120745
|
|
|
119856
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120746
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js
|
|
119857
120747
|
function buildFspgr(childRect) {
|
|
119858
120748
|
return record(OA.FSPGR, buildChildAnchorData(childRect), 0, false, 1);
|
|
119859
120749
|
}
|
|
@@ -119894,7 +120784,7 @@ function buildGroupContainer(group, fonts, allocator, hyperlinks, oleEmbeds, med
|
|
|
119894
120784
|
}
|
|
119895
120785
|
var FSP_FLAG_GROUP, FSP_FLAG_PATRIARCH, FSP_FLAG_HAVE_ANCHOR, ZERO_RECT;
|
|
119896
120786
|
var init_group_writer = __esm({
|
|
119897
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120787
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js"() {
|
|
119898
120788
|
init_record_types();
|
|
119899
120789
|
init_anchor_writer();
|
|
119900
120790
|
init_byte_writer();
|
|
@@ -119906,10 +120796,10 @@ var init_group_writer = __esm({
|
|
|
119906
120796
|
}
|
|
119907
120797
|
});
|
|
119908
120798
|
|
|
119909
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120799
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js
|
|
119910
120800
|
var ShapeIdAllocator2;
|
|
119911
120801
|
var init_shape_id_allocator = __esm({
|
|
119912
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120802
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js"() {
|
|
119913
120803
|
ShapeIdAllocator2 = class {
|
|
119914
120804
|
current;
|
|
119915
120805
|
constructor(drawingId, clusterSize) {
|
|
@@ -119935,7 +120825,7 @@ var init_shape_id_allocator = __esm({
|
|
|
119935
120825
|
}
|
|
119936
120826
|
});
|
|
119937
120827
|
|
|
119938
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120828
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js
|
|
119939
120829
|
function buildDg(drawingId, shapeCount, lastShapeId) {
|
|
119940
120830
|
const data = new ByteWriter().u32(shapeCount + 1).u32(lastShapeId).toBytes();
|
|
119941
120831
|
return record(OA.Dg, data, drawingId, false, 0);
|
|
@@ -119966,7 +120856,7 @@ function buildDrawing(canvasRect, shapes, backgroundRgb, fonts, drawingId, hyper
|
|
|
119966
120856
|
}
|
|
119967
120857
|
var FSP_FLAG_BACKGROUND, BACKGROUND_RECT_SPT, SHAPE_ID_CLUSTER_SIZE2;
|
|
119968
120858
|
var init_drawing_writer = __esm({
|
|
119969
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120859
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js"() {
|
|
119970
120860
|
init_record_types();
|
|
119971
120861
|
init_byte_writer();
|
|
119972
120862
|
init_colors2();
|
|
@@ -119979,7 +120869,7 @@ var init_drawing_writer = __esm({
|
|
|
119979
120869
|
}
|
|
119980
120870
|
});
|
|
119981
120871
|
|
|
119982
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120872
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js
|
|
119983
120873
|
function buildNotesAtom(slidePersistIdRef) {
|
|
119984
120874
|
const data = new ByteWriter().i32(slidePersistIdRef).u16(0).u16(0).toBytes();
|
|
119985
120875
|
return record(RT.NotesAtom, data, 0, false, 1);
|
|
@@ -119997,14 +120887,14 @@ function buildNotesContainer(paragraphs, notesRect, slidePersistIdRef, fonts, dr
|
|
|
119997
120887
|
return record(RT.Notes, data, 0, true);
|
|
119998
120888
|
}
|
|
119999
120889
|
var init_notes_writer = __esm({
|
|
120000
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120890
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js"() {
|
|
120001
120891
|
init_record_types();
|
|
120002
120892
|
init_byte_writer();
|
|
120003
120893
|
init_drawing_writer();
|
|
120004
120894
|
}
|
|
120005
120895
|
});
|
|
120006
120896
|
|
|
120007
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120897
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js
|
|
120008
120898
|
function readRecord(view, offset) {
|
|
120009
120899
|
if (!Number.isSafeInteger(offset) || offset < 0 || offset + RECORD_HEADER_SIZE > view.byteLength) {
|
|
120010
120900
|
return void 0;
|
|
@@ -120084,7 +120974,7 @@ function recordBytes(data, rec) {
|
|
|
120084
120974
|
}
|
|
120085
120975
|
var PptParseError, RECORD_HEADER_SIZE;
|
|
120086
120976
|
var init_legacy_ppt_record_stream = __esm({
|
|
120087
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120977
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js"() {
|
|
120088
120978
|
PptParseError = class extends Error {
|
|
120089
120979
|
constructor(message) {
|
|
120090
120980
|
super(message);
|
|
@@ -120095,14 +120985,14 @@ var init_legacy_ppt_record_stream = __esm({
|
|
|
120095
120985
|
}
|
|
120096
120986
|
});
|
|
120097
120987
|
|
|
120098
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120988
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js
|
|
120099
120989
|
var init_record_stream = __esm({
|
|
120100
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
120990
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js"() {
|
|
120101
120991
|
init_legacy_ppt_record_stream();
|
|
120102
120992
|
}
|
|
120103
120993
|
});
|
|
120104
120994
|
|
|
120105
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
120995
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js
|
|
120106
120996
|
function toHex3(r, g2, b) {
|
|
120107
120997
|
return [r, g2, b].map((v) => (v & 255).toString(16).padStart(2, "0").toUpperCase()).join("");
|
|
120108
120998
|
}
|
|
@@ -120153,7 +121043,7 @@ function resolveEscherColor(colorRef, scheme2) {
|
|
|
120153
121043
|
}
|
|
120154
121044
|
var SCHEME, DEFAULT_SCHEME;
|
|
120155
121045
|
var init_color_scheme = __esm({
|
|
120156
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
121046
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js"() {
|
|
120157
121047
|
init_record_stream();
|
|
120158
121048
|
init_record_types();
|
|
120159
121049
|
SCHEME = {
|
|
@@ -120179,7 +121069,7 @@ var init_color_scheme = __esm({
|
|
|
120179
121069
|
}
|
|
120180
121070
|
});
|
|
120181
121071
|
|
|
120182
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
121072
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js
|
|
120183
121073
|
function buildColorSchemeAtom(recInstance = 1, colors) {
|
|
120184
121074
|
const w = new ByteWriter();
|
|
120185
121075
|
for (const rgb2 of colors?.length === 8 ? colors : DEFAULT_SCHEME) {
|
|
@@ -120188,7 +121078,7 @@ function buildColorSchemeAtom(recInstance = 1, colors) {
|
|
|
120188
121078
|
return record(RT.ColorSchemeAtom, w.toBytes(), recInstance, false, 0);
|
|
120189
121079
|
}
|
|
120190
121080
|
var init_color_scheme_writer = __esm({
|
|
120191
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
121081
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js"() {
|
|
120192
121082
|
init_color_scheme();
|
|
120193
121083
|
init_record_types();
|
|
120194
121084
|
init_byte_writer();
|
|
@@ -120196,7 +121086,7 @@ var init_color_scheme_writer = __esm({
|
|
|
120196
121086
|
}
|
|
120197
121087
|
});
|
|
120198
121088
|
|
|
120199
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
121089
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js
|
|
120200
121090
|
function buildSlideAtomRaw(geom, masterIdRef, notesIdRef, flags3) {
|
|
120201
121091
|
const data = new ByteWriter().i32(geom).bytes(new Uint8Array(8)).u32(masterIdRef).i32(notesIdRef).u16(flags3).u16(0).toBytes();
|
|
120202
121092
|
return record(RT.SlideAtom, data, 0, false, 2);
|
|
@@ -120233,7 +121123,7 @@ function buildMainMasterContainer(slideRect, drawingId, hyperlinks, oleEmbeds, m
|
|
|
120233
121123
|
}
|
|
120234
121124
|
var SLIDE_FLAG_MASTER_OBJECTS, SLIDE_FLAG_MASTER_SCHEME, SLIDE_FLAG_MASTER_BACKGROUND, SLIDE_MASTER_ID_SENTINEL, MASTER_FIRST_COLOR_SCHEME_INSTANCE;
|
|
120235
121125
|
var init_slide_writer = __esm({
|
|
120236
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
121126
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js"() {
|
|
120237
121127
|
init_record_types();
|
|
120238
121128
|
init_byte_writer();
|
|
120239
121129
|
init_color_scheme_writer();
|
|
@@ -120248,7 +121138,7 @@ var init_slide_writer = __esm({
|
|
|
120248
121138
|
}
|
|
120249
121139
|
});
|
|
120250
121140
|
|
|
120251
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
121141
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js
|
|
120252
121142
|
function masterSlideId(index2) {
|
|
120253
121143
|
return MASTER_SLIDE_ID_SENTINEL + index2;
|
|
120254
121144
|
}
|
|
@@ -120372,7 +121262,7 @@ function ensureMinimumDocumentStreamSize(contentSizeWithoutPadding, maxPersistId
|
|
|
120372
121262
|
}
|
|
120373
121263
|
var DOC_ID, MASTER_ID;
|
|
120374
121264
|
var init_document_stream_layout = __esm({
|
|
120375
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
121265
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js"() {
|
|
120376
121266
|
init_bstore_writer();
|
|
120377
121267
|
init_byte_writer();
|
|
120378
121268
|
init_document_writer();
|
|
@@ -120390,15 +121280,15 @@ var init_document_stream_layout = __esm({
|
|
|
120390
121280
|
}
|
|
120391
121281
|
});
|
|
120392
121282
|
|
|
120393
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
121283
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js
|
|
120394
121284
|
var RC4_ALG_ID2;
|
|
120395
121285
|
var init_crypto_constants = __esm({
|
|
120396
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
121286
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js"() {
|
|
120397
121287
|
RC4_ALG_ID2 = 26625;
|
|
120398
121288
|
}
|
|
120399
121289
|
});
|
|
120400
121290
|
|
|
120401
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
121291
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js
|
|
120402
121292
|
function rc4Cipher(key2, data) {
|
|
120403
121293
|
if (key2.length === 0) {
|
|
120404
121294
|
throw new Error("RC4 key must not be empty.");
|
|
@@ -120429,11 +121319,11 @@ function rc4Cipher(key2, data) {
|
|
|
120429
121319
|
return out;
|
|
120430
121320
|
}
|
|
120431
121321
|
var init_rc4_cipher = __esm({
|
|
120432
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
121322
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js"() {
|
|
120433
121323
|
}
|
|
120434
121324
|
});
|
|
120435
121325
|
|
|
120436
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
121326
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js
|
|
120437
121327
|
async function rc4CryptoApiKeyBase(password, salt) {
|
|
120438
121328
|
return hash("SHA-1", concatArrays(salt, encodePasswordUtf16LE(password)));
|
|
120439
121329
|
}
|
|
@@ -120474,14 +121364,14 @@ async function rc4CryptoApiEncryptVerifier(key0, verifier) {
|
|
|
120474
121364
|
}
|
|
120475
121365
|
var PADDED_40_BIT_KEY_BYTES;
|
|
120476
121366
|
var init_rc4_cryptoapi_key = __esm({
|
|
120477
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
121367
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js"() {
|
|
120478
121368
|
init_ooxml_crypto_primitives();
|
|
120479
121369
|
init_rc4_cipher();
|
|
120480
121370
|
PADDED_40_BIT_KEY_BYTES = 16;
|
|
120481
121371
|
}
|
|
120482
121372
|
});
|
|
120483
121373
|
|
|
120484
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
121374
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js
|
|
120485
121375
|
function readHeader(bytes) {
|
|
120486
121376
|
const view = new DataView(bytes.buffer, bytes.byteOffset, RECORD_HEADER_SIZE);
|
|
120487
121377
|
return {
|
|
@@ -120550,7 +121440,7 @@ async function cipherPicturesStream(stream, keyFor2, mode) {
|
|
|
120550
121440
|
}
|
|
120551
121441
|
var UID_SIZE, METAFILE_HEADER_SIZE, BITMAP_TAG_SIZE, METAFILE_BLIPS, BITMAP_BLIPS;
|
|
120552
121442
|
var init_rc4_cryptoapi_streams = __esm({
|
|
120553
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
121443
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js"() {
|
|
120554
121444
|
init_rc4_cipher();
|
|
120555
121445
|
init_record_stream();
|
|
120556
121446
|
UID_SIZE = 16;
|
|
@@ -120561,7 +121451,7 @@ var init_rc4_cryptoapi_streams = __esm({
|
|
|
120561
121451
|
}
|
|
120562
121452
|
});
|
|
120563
121453
|
|
|
120564
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
121454
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js
|
|
120565
121455
|
async function buildCryptSession(password) {
|
|
120566
121456
|
const salt = new Uint8Array(SALT_SIZE);
|
|
120567
121457
|
crypto.getRandomValues(salt);
|
|
@@ -120589,7 +121479,7 @@ async function encryptPicturesStream(stream, ctx) {
|
|
|
120589
121479
|
}
|
|
120590
121480
|
var CSP_NAME, KEY_SIZE_BITS, SALT_SIZE, VERIFIER_SIZE, VERIFIER_HASH_SIZE, ENCRYPTION_FLAGS;
|
|
120591
121481
|
var init_encrypt_writer = __esm({
|
|
120592
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
121482
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js"() {
|
|
120593
121483
|
init_crypto_constants();
|
|
120594
121484
|
init_rc4_cryptoapi_key();
|
|
120595
121485
|
init_rc4_cryptoapi_streams();
|
|
@@ -120604,7 +121494,7 @@ var init_encrypt_writer = __esm({
|
|
|
120604
121494
|
}
|
|
120605
121495
|
});
|
|
120606
121496
|
|
|
120607
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
121497
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js
|
|
120608
121498
|
function levelsFor(styles2, textType) {
|
|
120609
121499
|
switch (textType) {
|
|
120610
121500
|
case 0:
|
|
@@ -120670,12 +121560,12 @@ function withMasterRelativeRunStyles(deck) {
|
|
|
120670
121560
|
}
|
|
120671
121561
|
var STYLE_KEYS;
|
|
120672
121562
|
var init_master_relative_runs = __esm({
|
|
120673
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
121563
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js"() {
|
|
120674
121564
|
STYLE_KEYS = ["bold", "italic", "underline"];
|
|
120675
121565
|
}
|
|
120676
121566
|
});
|
|
120677
121567
|
|
|
120678
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
121568
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js
|
|
120679
121569
|
function buildPersistDirectoryAtom(entries) {
|
|
120680
121570
|
const sorted = [...entries].sort((a, b) => a[0] - b[0]);
|
|
120681
121571
|
const w = new ByteWriter();
|
|
@@ -120705,17 +121595,17 @@ function buildEncryptedUserEditAtom(input2) {
|
|
|
120705
121595
|
}
|
|
120706
121596
|
var MAX_RUN;
|
|
120707
121597
|
var init_persist_writer = __esm({
|
|
120708
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
121598
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js"() {
|
|
120709
121599
|
init_record_types();
|
|
120710
121600
|
init_byte_writer();
|
|
120711
121601
|
MAX_RUN = 4095;
|
|
120712
121602
|
}
|
|
120713
121603
|
});
|
|
120714
121604
|
|
|
120715
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
121605
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js
|
|
120716
121606
|
var PPT_STORAGE_CLSID;
|
|
120717
121607
|
var init_ppt_clsid = __esm({
|
|
120718
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
121608
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js"() {
|
|
120719
121609
|
PPT_STORAGE_CLSID = new Uint8Array([
|
|
120720
121610
|
16,
|
|
120721
121611
|
141,
|
|
@@ -120737,7 +121627,7 @@ var init_ppt_clsid = __esm({
|
|
|
120737
121627
|
}
|
|
120738
121628
|
});
|
|
120739
121629
|
|
|
120740
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
121630
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js
|
|
120741
121631
|
async function finishUnencrypted(layout, lastSlideId) {
|
|
120742
121632
|
const w = new ByteWriter().append(layout.bytes);
|
|
120743
121633
|
const dirAtom = buildPersistDirectoryAtom(layout.offsets);
|
|
@@ -120791,7 +121681,7 @@ async function buildPptFile(deck, options2 = {}) {
|
|
|
120791
121681
|
return new Uint8Array(buildOle2(streams2, PPT_STORAGE_CLSID, 0));
|
|
120792
121682
|
}
|
|
120793
121683
|
var init_write_ppt = __esm({
|
|
120794
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
121684
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js"() {
|
|
120795
121685
|
init_ole2_parser_write();
|
|
120796
121686
|
init_byte_writer();
|
|
120797
121687
|
init_current_user_writer();
|
|
@@ -120803,9 +121693,9 @@ var init_write_ppt = __esm({
|
|
|
120803
121693
|
}
|
|
120804
121694
|
});
|
|
120805
121695
|
|
|
120806
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
121696
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js
|
|
120807
121697
|
var init_legacy_ppt_writer = __esm({
|
|
120808
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
121698
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js"() {
|
|
120809
121699
|
init_write_ppt();
|
|
120810
121700
|
init_master_style_fonts();
|
|
120811
121701
|
}
|
|
@@ -123251,13 +124141,13 @@ function samePaint(a, b) {
|
|
|
123251
124141
|
}
|
|
123252
124142
|
return colorsEqual(a, b);
|
|
123253
124143
|
}
|
|
123254
|
-
function sameFill(
|
|
123255
|
-
if (
|
|
124144
|
+
function sameFill(model2, authored) {
|
|
124145
|
+
if (model2.gradient || authored.gradient) {
|
|
123256
124146
|
return Boolean(
|
|
123257
|
-
|
|
124147
|
+
model2.gradient && authored.gradient && chartGradientsEqual(model2.gradient, authored.gradient)
|
|
123258
124148
|
);
|
|
123259
124149
|
}
|
|
123260
|
-
return samePaint(
|
|
124150
|
+
return samePaint(model2.fill, authored.fill);
|
|
123261
124151
|
}
|
|
123262
124152
|
function setPaint(node2, entry2, choices, after, getLocalName2) {
|
|
123263
124153
|
const entries = Object.entries(node2).filter(([key2]) => !choices.has(getLocalName2(key2)));
|
|
@@ -125932,10 +126822,10 @@ var init_chart_title_text_edit = __esm({
|
|
|
125932
126822
|
});
|
|
125933
126823
|
|
|
125934
126824
|
// pptx/core/utils/chart-title-serializer.ts
|
|
125935
|
-
function applyChartTitleToXml(chartRoot,
|
|
126825
|
+
function applyChartTitleToXml(chartRoot, model2, getLocalName2, options2 = { prefix: "c" }) {
|
|
125936
126826
|
const { prefix } = options2;
|
|
125937
126827
|
const existingKey = findKey7(chartRoot, "title", getLocalName2);
|
|
125938
|
-
const remove4 =
|
|
126828
|
+
const remove4 = model2.hasTitle === false || model2.title === "" && model2.hasTitle !== true;
|
|
125939
126829
|
if (remove4) {
|
|
125940
126830
|
if (existingKey) {
|
|
125941
126831
|
delete chartRoot[existingKey];
|
|
@@ -125945,21 +126835,21 @@ function applyChartTitleToXml(chartRoot, model, getLocalName2, options2 = { pref
|
|
|
125945
126835
|
}
|
|
125946
126836
|
return false;
|
|
125947
126837
|
}
|
|
125948
|
-
if (
|
|
126838
|
+
if (model2.title === void 0 && model2.hasTitle !== true) {
|
|
125949
126839
|
return existingKey !== void 0;
|
|
125950
126840
|
}
|
|
125951
|
-
const runsFirstText =
|
|
125952
|
-
const runsStale =
|
|
125953
|
-
let runs = prefix === "c" &&
|
|
125954
|
-
const staleRuns =
|
|
125955
|
-
if (prefix === "c" && runsStale &&
|
|
125956
|
-
runs = realignOrCollapseRuns(staleRuns,
|
|
126841
|
+
const runsFirstText = model2.titleRuns?.[0]?.text;
|
|
126842
|
+
const runsStale = model2.title !== void 0 && runsFirstText !== void 0 && model2.title !== runsFirstText;
|
|
126843
|
+
let runs = prefix === "c" && model2.titleRuns && model2.titleRuns.length > 0 && !runsStale ? model2.titleRuns : void 0;
|
|
126844
|
+
const staleRuns = model2.titleRuns;
|
|
126845
|
+
if (prefix === "c" && runsStale && model2.title !== void 0 && staleRuns && staleRuns.length > 1) {
|
|
126846
|
+
runs = realignOrCollapseRuns(staleRuns, model2.title);
|
|
125957
126847
|
}
|
|
125958
126848
|
let titleNode = existingKey ? chartRoot[existingKey] : void 0;
|
|
125959
126849
|
const textOnlyStylesMatch = Boolean(
|
|
125960
|
-
runs &&
|
|
126850
|
+
runs && model2.titleTextOnlyStyles?.length === runs.length && runs.every(
|
|
125961
126851
|
(run2, index2) => ["bold", "italic", "fontSize", "color"].every(
|
|
125962
|
-
(key2) => run2[key2] ===
|
|
126852
|
+
(key2) => run2[key2] === model2.titleTextOnlyStyles[index2][key2]
|
|
125963
126853
|
)
|
|
125964
126854
|
)
|
|
125965
126855
|
);
|
|
@@ -125967,19 +126857,19 @@ function applyChartTitleToXml(chartRoot, model, getLocalName2, options2 = { pref
|
|
|
125967
126857
|
const existingTexts = [];
|
|
125968
126858
|
collectAllText(titleNode, getLocalName2, existingTexts);
|
|
125969
126859
|
const newTexts = runs.map((run2) => run2.text);
|
|
125970
|
-
if ((!
|
|
126860
|
+
if ((!model2.titleTextOnly || textOnlyStylesMatch) && existingTexts.length === newTexts.length && existingTexts.every((text2, index2) => text2 === newTexts[index2])) {
|
|
125971
126861
|
runs = void 0;
|
|
125972
126862
|
}
|
|
125973
126863
|
}
|
|
125974
126864
|
if (!titleNode || typeof titleNode !== "object") {
|
|
125975
|
-
titleNode = buildTitleNode(prefix,
|
|
126865
|
+
titleNode = buildTitleNode(prefix, model2.title, runs);
|
|
125976
126866
|
if (existingKey) {
|
|
125977
126867
|
chartRoot[existingKey] = titleNode;
|
|
125978
126868
|
} else {
|
|
125979
126869
|
insertAt2(chartRoot, 0, `${prefix}:title`, titleNode);
|
|
125980
126870
|
}
|
|
125981
126871
|
} else if (runs) {
|
|
125982
|
-
if (
|
|
126872
|
+
if (model2.titleTextOnly && textOnlyStylesMatch) {
|
|
125983
126873
|
if (!patchChartTitleRunText(titleNode, runs, getLocalName2))
|
|
125984
126874
|
throw new Error("This chart title cannot be replaced without changing its text source");
|
|
125985
126875
|
if (prefix === "c") setAutoTitleDeleted(chartRoot, false, getLocalName2);
|
|
@@ -125991,12 +126881,12 @@ function applyChartTitleToXml(chartRoot, model, getLocalName2, options2 = { pref
|
|
|
125991
126881
|
} else {
|
|
125992
126882
|
insertAt2(titleNode, 0, `${prefix}:tx`, buildTitleTextFromRuns(prefix, runs));
|
|
125993
126883
|
}
|
|
125994
|
-
} else if (
|
|
126884
|
+
} else if (model2.title !== void 0 && !replaceFirstText(titleNode, model2.title, getLocalName2)) {
|
|
125995
126885
|
const txKey = findKey7(titleNode, "tx", getLocalName2);
|
|
125996
126886
|
if (txKey) {
|
|
125997
|
-
titleNode[txKey] = buildTitleText(prefix,
|
|
126887
|
+
titleNode[txKey] = buildTitleText(prefix, model2.title);
|
|
125998
126888
|
} else {
|
|
125999
|
-
insertAt2(titleNode, 0, `${prefix}:tx`, buildTitleText(prefix,
|
|
126889
|
+
insertAt2(titleNode, 0, `${prefix}:tx`, buildTitleText(prefix, model2.title));
|
|
126000
126890
|
}
|
|
126001
126891
|
}
|
|
126002
126892
|
if (prefix === "c") {
|
|
@@ -128323,13 +129213,13 @@ async function prepareWorkbook(zip, chart, saved, resolve) {
|
|
|
128323
129213
|
const path4 = resolve(chart.chartPartPath, data.targetPath);
|
|
128324
129214
|
const bytes = await zip.file(path4)?.async("uint8array");
|
|
128325
129215
|
if (!bytes) throw new Error("The embedded chart workbook is missing.");
|
|
128326
|
-
let
|
|
129216
|
+
let model2;
|
|
128327
129217
|
const allocated = await appendChartWorkbookSheet(bytes, (name) => {
|
|
128328
129218
|
const rebased = rebaseChartData(saved.workbookModel, name);
|
|
128329
|
-
|
|
129219
|
+
model2 = rebased.chartSpace;
|
|
128330
129220
|
return rebased.rows;
|
|
128331
129221
|
});
|
|
128332
|
-
const xml = writeChartSpaceOverSource(saved.xml,
|
|
129222
|
+
const xml = writeChartSpaceOverSource(saved.xml, model2);
|
|
128333
129223
|
zip.file(path4, allocated.bytes);
|
|
128334
129224
|
syncIds();
|
|
128335
129225
|
return { xml, workbookWrites: [] };
|
|
@@ -145273,9 +146163,9 @@ var init_PptxHandlerRuntimeSaveModel3D = __esm({
|
|
|
145273
146163
|
/** Wrap newly authored model nodes in the required Choice/Fallback envelope. */
|
|
145274
146164
|
wrapNewModel3DEnvelopes(spTree, models) {
|
|
145275
146165
|
const envelopes = [];
|
|
145276
|
-
for (const
|
|
145277
|
-
const fallback = this.newModel3DFallbackByXml.get(
|
|
145278
|
-
if (!fallback || this.alternateContentBlockByRawXml.has(
|
|
146166
|
+
for (const model2 of models) {
|
|
146167
|
+
const fallback = this.newModel3DFallbackByXml.get(model2);
|
|
146168
|
+
if (!fallback || this.alternateContentBlockByRawXml.has(model2)) {
|
|
145279
146169
|
continue;
|
|
145280
146170
|
}
|
|
145281
146171
|
envelopes.push({
|
|
@@ -145283,7 +146173,7 @@ var init_PptxHandlerRuntimeSaveModel3D = __esm({
|
|
|
145283
146173
|
"mc:Choice": {
|
|
145284
146174
|
"@_Requires": "p16",
|
|
145285
146175
|
"@_xmlns:p16": MODEL3D_NAMESPACE,
|
|
145286
|
-
"p16:model3D":
|
|
146176
|
+
"p16:model3D": model2
|
|
145287
146177
|
},
|
|
145288
146178
|
"mc:Fallback": { "p:pic": fallback }
|
|
145289
146179
|
});
|
|
@@ -149762,6 +150652,7 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
|
|
|
149762
150652
|
init_modern_comment_package();
|
|
149763
150653
|
init_builders();
|
|
149764
150654
|
init_factories();
|
|
150655
|
+
init_custom_show_save_ids();
|
|
149765
150656
|
init_comment_authors_retention();
|
|
149766
150657
|
init_header_footer_parts();
|
|
149767
150658
|
init_pptx_print_properties();
|
|
@@ -149791,7 +150682,8 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
|
|
|
149791
150682
|
* one that fails does not hold up the next.
|
|
149792
150683
|
*/
|
|
149793
150684
|
async save(slides, options2) {
|
|
149794
|
-
const
|
|
150685
|
+
const valid = withValidCustomShowIds(slides, options2);
|
|
150686
|
+
const run2 = this.saveQueue.then(() => this.saveNow(valid.slides, valid.options));
|
|
149795
150687
|
this.saveQueue = run2.catch(() => void 0);
|
|
149796
150688
|
return run2;
|
|
149797
150689
|
}
|
|
@@ -157722,27 +158614,27 @@ var init_PptxHandlerRuntimeThemePartModel = __esm({
|
|
|
157722
158614
|
* Record a parsed part under its path: its original XML (byte-stable passthrough on save,
|
|
157723
158615
|
* C-H3), its names, per-script fonts and the raw subtrees the save re-emits.
|
|
157724
158616
|
*/
|
|
157725
|
-
cacheThemePartModel(themePath, themeXml3,
|
|
158617
|
+
cacheThemePartModel(themePath, themeXml3, model2) {
|
|
157726
158618
|
this.originalThemeXmlByPath.set(themePath, themeXml3);
|
|
157727
158619
|
const keyed = [
|
|
157728
|
-
[this.masterThemeNames,
|
|
157729
|
-
[this.masterThemeColorSchemeNames,
|
|
157730
|
-
[this.masterThemeFontSchemeNames,
|
|
157731
|
-
[this.masterThemeObjectDefaults,
|
|
157732
|
-
[this.masterThemeExtraClrSchemeLst,
|
|
157733
|
-
[this.masterThemeCustClrLst,
|
|
157734
|
-
[this.masterThemeExtLst,
|
|
158620
|
+
[this.masterThemeNames, model2.name],
|
|
158621
|
+
[this.masterThemeColorSchemeNames, model2.colorSchemeName],
|
|
158622
|
+
[this.masterThemeFontSchemeNames, model2.fontSchemeName],
|
|
158623
|
+
[this.masterThemeObjectDefaults, model2.objectDefaults],
|
|
158624
|
+
[this.masterThemeExtraClrSchemeLst, model2.extraClrSchemeLst],
|
|
158625
|
+
[this.masterThemeCustClrLst, model2.custClrLst],
|
|
158626
|
+
[this.masterThemeExtLst, model2.extLst]
|
|
157735
158627
|
];
|
|
157736
158628
|
for (const [map2, value] of keyed) {
|
|
157737
158629
|
if (value !== void 0) {
|
|
157738
158630
|
map2.set(themePath, value);
|
|
157739
158631
|
}
|
|
157740
158632
|
}
|
|
157741
|
-
if (Object.keys(
|
|
157742
|
-
this.masterThemeMajorFontScripts.set(themePath,
|
|
158633
|
+
if (Object.keys(model2.majorFontScripts).length > 0) {
|
|
158634
|
+
this.masterThemeMajorFontScripts.set(themePath, model2.majorFontScripts);
|
|
157743
158635
|
}
|
|
157744
|
-
if (Object.keys(
|
|
157745
|
-
this.masterThemeMinorFontScripts.set(themePath,
|
|
158636
|
+
if (Object.keys(model2.minorFontScripts).length > 0) {
|
|
158637
|
+
this.masterThemeMinorFontScripts.set(themePath, model2.minorFontScripts);
|
|
157746
158638
|
}
|
|
157747
158639
|
}
|
|
157748
158640
|
/**
|
|
@@ -157776,13 +158668,13 @@ var init_PptxHandlerRuntimeThemePartModel = __esm({
|
|
|
157776
158668
|
if (themeXml3 === void 0) {
|
|
157777
158669
|
return void 0;
|
|
157778
158670
|
}
|
|
157779
|
-
const
|
|
158671
|
+
const model2 = this.parseThemePartXml(themeXml3);
|
|
157780
158672
|
return {
|
|
157781
158673
|
path: path4,
|
|
157782
|
-
...
|
|
157783
|
-
colorScheme: colorSchemeFromMap(
|
|
157784
|
-
fontScheme: fontSchemeFromMap(
|
|
157785
|
-
...
|
|
158674
|
+
...model2.name ? { name: model2.name } : {},
|
|
158675
|
+
colorScheme: colorSchemeFromMap(model2.colorMap),
|
|
158676
|
+
fontScheme: fontSchemeFromMap(model2.fontMap, model2.majorFontScripts, model2.minorFontScripts),
|
|
158677
|
+
...model2.formatScheme ? { formatScheme: model2.formatScheme } : {}
|
|
157786
158678
|
};
|
|
157787
158679
|
}
|
|
157788
158680
|
};
|
|
@@ -157953,9 +158845,9 @@ var init_PptxHandlerRuntimeThemeLoading = __esm({
|
|
|
157953
158845
|
return null;
|
|
157954
158846
|
}
|
|
157955
158847
|
const themeXml3 = await this.readPartText(themePath) ?? "";
|
|
157956
|
-
const
|
|
157957
|
-
this.cacheThemePartModel(themePath, themeXml3,
|
|
157958
|
-
return { colorMap:
|
|
158848
|
+
const model2 = this.parseThemePartXml(themeXml3);
|
|
158849
|
+
this.cacheThemePartModel(themePath, themeXml3, model2);
|
|
158850
|
+
return { colorMap: model2.colorMap, fontMap: model2.fontMap, formatScheme: model2.formatScheme };
|
|
157959
158851
|
}
|
|
157960
158852
|
/**
|
|
157961
158853
|
* Flatten a per-theme-path script-override map (`themePath -> {script ->
|
|
@@ -158270,27 +159162,27 @@ var init_PptxHandlerRuntimeThemeSwitching = __esm({
|
|
|
158270
159162
|
if (themeXml3 === void 0) {
|
|
158271
159163
|
return;
|
|
158272
159164
|
}
|
|
158273
|
-
const
|
|
159165
|
+
const model2 = this.parseThemePartXml(themeXml3);
|
|
158274
159166
|
if (!this.originalThemeXmlByPath.has(themePath)) {
|
|
158275
|
-
this.cacheThemePartModel(themePath, themeXml3,
|
|
159167
|
+
this.cacheThemePartModel(themePath, themeXml3, model2);
|
|
158276
159168
|
}
|
|
158277
159169
|
this.masterThemePaths.set(masterPath, themePath);
|
|
158278
|
-
this.masterThemeColorMaps.set(masterPath, { ...
|
|
158279
|
-
this.masterThemeFontMaps.set(masterPath, { ...
|
|
158280
|
-
if (
|
|
158281
|
-
this.masterThemeFormatSchemes.set(masterPath,
|
|
159170
|
+
this.masterThemeColorMaps.set(masterPath, { ...model2.colorMap });
|
|
159171
|
+
this.masterThemeFontMaps.set(masterPath, { ...model2.fontMap });
|
|
159172
|
+
if (model2.formatScheme) {
|
|
159173
|
+
this.masterThemeFormatSchemes.set(masterPath, model2.formatScheme);
|
|
158282
159174
|
} else {
|
|
158283
159175
|
this.masterThemeFormatSchemes.delete(masterPath);
|
|
158284
159176
|
}
|
|
158285
159177
|
if (this.zip.file(SLIDE_MASTER_PART)[0]?.name !== masterPath) {
|
|
158286
159178
|
return;
|
|
158287
159179
|
}
|
|
158288
|
-
this.themeColorMap = { ...
|
|
158289
|
-
this.themeFontMap = { ...
|
|
158290
|
-
this.themeFormatScheme =
|
|
158291
|
-
this.globalThemeColorMapSnapshot = { ...
|
|
158292
|
-
this.globalThemeFontMapSnapshot = { ...
|
|
158293
|
-
this.globalThemeFormatSchemeSnapshot =
|
|
159180
|
+
this.themeColorMap = { ...model2.colorMap };
|
|
159181
|
+
this.themeFontMap = { ...model2.fontMap };
|
|
159182
|
+
this.themeFormatScheme = model2.formatScheme;
|
|
159183
|
+
this.globalThemeColorMapSnapshot = { ...model2.colorMap };
|
|
159184
|
+
this.globalThemeFontMapSnapshot = { ...model2.fontMap };
|
|
159185
|
+
this.globalThemeFormatSchemeSnapshot = model2.formatScheme;
|
|
158294
159186
|
}
|
|
158295
159187
|
};
|
|
158296
159188
|
}
|
|
@@ -160688,15 +161580,15 @@ var init_PptxHandlerRuntimeChartExParsing = __esm({
|
|
|
160688
161580
|
* @returns Parsed chart data, or `undefined` if cx parsing yields no series.
|
|
160689
161581
|
*/
|
|
160690
161582
|
async parseCxChart(plotArea, chartType, chartSpace, chartRoot, chartPartPath, chartRelationshipId, sourceXml) {
|
|
160691
|
-
let
|
|
161583
|
+
let model2;
|
|
160692
161584
|
try {
|
|
160693
161585
|
const parsed = sourceXml ? parseChartExSpace(sourceXml) : void 0;
|
|
160694
161586
|
if (parsed && !parsed.issues.length && parsed.chartExSpace.plotArea.series.length)
|
|
160695
|
-
|
|
161587
|
+
model2 = parsed.chartExSpace;
|
|
160696
161588
|
} catch {
|
|
160697
161589
|
}
|
|
160698
|
-
const result =
|
|
160699
|
-
|
|
161590
|
+
const result = model2 ? chartExFromNeutral(
|
|
161591
|
+
model2,
|
|
160700
161592
|
readChartExStyleBridge(
|
|
160701
161593
|
plotArea,
|
|
160702
161594
|
this.xmlLookupService,
|
|
@@ -160731,7 +161623,7 @@ var init_PptxHandlerRuntimeChartExParsing = __esm({
|
|
|
160731
161623
|
const chartChrome = this.parseChartChrome(chartRoot);
|
|
160732
161624
|
const clrMapOvr = this.parseClrMapOvr(chartSpace);
|
|
160733
161625
|
return {
|
|
160734
|
-
chartType:
|
|
161626
|
+
chartType: model2 ? chartExTypeFromNeutral(model2) : chartType,
|
|
160735
161627
|
categories: result.categories,
|
|
160736
161628
|
...result.categoryLevels ? { categoryLevels: result.categoryLevels } : {},
|
|
160737
161629
|
series: result.series,
|
|
@@ -163901,7 +164793,7 @@ var init_deflate_utils = __esm({
|
|
|
163901
164793
|
}
|
|
163902
164794
|
});
|
|
163903
164795
|
|
|
163904
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
164796
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js
|
|
163905
164797
|
function checkedLimit(value) {
|
|
163906
164798
|
if (!Number.isSafeInteger(value) || value < 1)
|
|
163907
164799
|
throw new PptParseError("Invalid persist directory resource limit");
|
|
@@ -164027,7 +164919,7 @@ function readPersistRecord(view, directory, persistId) {
|
|
|
164027
164919
|
}
|
|
164028
164920
|
var DEFAULT_MAX_EDITS, DEFAULT_MAX_ENTRIES;
|
|
164029
164921
|
var init_persist_directory = __esm({
|
|
164030
|
-
"../../node_modules/.bun/@christophervr+ole2@0.
|
|
164922
|
+
"../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js"() {
|
|
164031
164923
|
init_record_stream();
|
|
164032
164924
|
init_record_types();
|
|
164033
164925
|
DEFAULT_MAX_EDITS = 1e4;
|
|
@@ -169198,18 +170090,18 @@ var FallbackElementProcessor = class {
|
|
|
169198
170090
|
* way to be interactive: the poster is exactly what PowerPoint itself shows
|
|
169199
170091
|
* a viewer that cannot render the model.
|
|
169200
170092
|
*/
|
|
169201
|
-
async renderModel3D(
|
|
169202
|
-
const alt =
|
|
169203
|
-
const poster = await this.savePoster(
|
|
170093
|
+
async renderModel3D(model2, ctx) {
|
|
170094
|
+
const alt = model2.altText?.trim() || "3D Model";
|
|
170095
|
+
const poster = await this.savePoster(model2, ctx);
|
|
169204
170096
|
if (poster) {
|
|
169205
170097
|
return `
|
|
169206
170098
|
|
|
169207
170099
|
*[3D Model]*`;
|
|
169208
170100
|
}
|
|
169209
|
-
return
|
|
170101
|
+
return model2.modelPath ? `*[3D Model: ${model2.modelPath}]*` : "*[3D Model]*";
|
|
169210
170102
|
}
|
|
169211
|
-
async savePoster(
|
|
169212
|
-
const dataUrl =
|
|
170103
|
+
async savePoster(model2, ctx) {
|
|
170104
|
+
const dataUrl = model2.posterImage ?? model2.imageData;
|
|
169213
170105
|
if (!dataUrl || !dataUrl.startsWith("data:")) {
|
|
169214
170106
|
return null;
|
|
169215
170107
|
}
|
|
@@ -174626,6 +175518,240 @@ function updateMetadata(ctx, params) {
|
|
|
174626
175518
|
};
|
|
174627
175519
|
}
|
|
174628
175520
|
|
|
175521
|
+
// pptx/automation/tools/custom-show-tools.ts
|
|
175522
|
+
var custom_show_tools_exports = {};
|
|
175523
|
+
__export(custom_show_tools_exports, {
|
|
175524
|
+
manageCustomShows: () => manageCustomShows
|
|
175525
|
+
});
|
|
175526
|
+
|
|
175527
|
+
// pptx/editor/render/custom-show-operations.ts
|
|
175528
|
+
function nextCustomShowId(shows) {
|
|
175529
|
+
let max = -1;
|
|
175530
|
+
for (const show of shows) {
|
|
175531
|
+
const n = Number(show.id);
|
|
175532
|
+
if (Number.isInteger(n) && n > max) {
|
|
175533
|
+
max = n;
|
|
175534
|
+
}
|
|
175535
|
+
}
|
|
175536
|
+
return String(max + 1);
|
|
175537
|
+
}
|
|
175538
|
+
function uniqueCustomShowName(shows, name, exceptId) {
|
|
175539
|
+
const base2 = name.trim() || "Custom Show";
|
|
175540
|
+
const taken = new Set(
|
|
175541
|
+
shows.filter((s) => s.id !== exceptId).map((s) => s.name.trim().toLowerCase())
|
|
175542
|
+
);
|
|
175543
|
+
if (!taken.has(base2.toLowerCase())) {
|
|
175544
|
+
return base2;
|
|
175545
|
+
}
|
|
175546
|
+
for (let n = 2; ; n++) {
|
|
175547
|
+
const candidate = `${base2} (${n})`;
|
|
175548
|
+
if (!taken.has(candidate.toLowerCase())) {
|
|
175549
|
+
return candidate;
|
|
175550
|
+
}
|
|
175551
|
+
}
|
|
175552
|
+
}
|
|
175553
|
+
function replaceShow(shows, id, update) {
|
|
175554
|
+
let edited;
|
|
175555
|
+
const next = shows.map((show) => {
|
|
175556
|
+
if (show.id !== id) {
|
|
175557
|
+
return show;
|
|
175558
|
+
}
|
|
175559
|
+
edited = update(show);
|
|
175560
|
+
return edited;
|
|
175561
|
+
});
|
|
175562
|
+
return { shows: edited ? next : [...shows], show: edited };
|
|
175563
|
+
}
|
|
175564
|
+
function createCustomShow(shows, name, slideRIds = []) {
|
|
175565
|
+
const show = {
|
|
175566
|
+
id: nextCustomShowId(shows),
|
|
175567
|
+
name: uniqueCustomShowName(shows, name),
|
|
175568
|
+
slideRIds: [...slideRIds]
|
|
175569
|
+
};
|
|
175570
|
+
return { shows: [...shows, show], show };
|
|
175571
|
+
}
|
|
175572
|
+
function renameCustomShow(shows, id, name) {
|
|
175573
|
+
return replaceShow(shows, id, (show) => ({
|
|
175574
|
+
...show,
|
|
175575
|
+
name: uniqueCustomShowName(shows, name, id)
|
|
175576
|
+
}));
|
|
175577
|
+
}
|
|
175578
|
+
function setCustomShowSlides(shows, id, slideRIds) {
|
|
175579
|
+
return replaceShow(shows, id, (show) => ({ ...show, slideRIds: [...slideRIds] }));
|
|
175580
|
+
}
|
|
175581
|
+
function addSlidesToCustomShow(shows, id, slideRIds, index2) {
|
|
175582
|
+
return replaceShow(shows, id, (show) => {
|
|
175583
|
+
const at2 = Math.max(0, Math.min(index2 ?? show.slideRIds.length, show.slideRIds.length));
|
|
175584
|
+
const list3 = [...show.slideRIds];
|
|
175585
|
+
list3.splice(at2, 0, ...slideRIds);
|
|
175586
|
+
return { ...show, slideRIds: list3 };
|
|
175587
|
+
});
|
|
175588
|
+
}
|
|
175589
|
+
function removeSlidesFromCustomShow(shows, id, positions2) {
|
|
175590
|
+
const drop = new Set(positions2);
|
|
175591
|
+
return replaceShow(shows, id, (show) => ({
|
|
175592
|
+
...show,
|
|
175593
|
+
slideRIds: show.slideRIds.filter((_, i2) => !drop.has(i2))
|
|
175594
|
+
}));
|
|
175595
|
+
}
|
|
175596
|
+
function moveCustomShowSlide(shows, id, from, to) {
|
|
175597
|
+
return replaceShow(shows, id, (show) => {
|
|
175598
|
+
if (from < 0 || from >= show.slideRIds.length) {
|
|
175599
|
+
return show;
|
|
175600
|
+
}
|
|
175601
|
+
const list3 = [...show.slideRIds];
|
|
175602
|
+
const [moved] = list3.splice(from, 1);
|
|
175603
|
+
list3.splice(Math.max(0, Math.min(to, list3.length)), 0, moved);
|
|
175604
|
+
return { ...show, slideRIds: list3 };
|
|
175605
|
+
});
|
|
175606
|
+
}
|
|
175607
|
+
function copyCustomShow(shows, id, name) {
|
|
175608
|
+
const source2 = shows.find((s) => s.id === id);
|
|
175609
|
+
if (!source2) {
|
|
175610
|
+
return { shows: [...shows], show: void 0 };
|
|
175611
|
+
}
|
|
175612
|
+
const show = {
|
|
175613
|
+
id: nextCustomShowId(shows),
|
|
175614
|
+
name: uniqueCustomShowName(shows, name ?? `Copy of ${source2.name}`),
|
|
175615
|
+
slideRIds: [...source2.slideRIds]
|
|
175616
|
+
};
|
|
175617
|
+
return { shows: [...shows, show], show };
|
|
175618
|
+
}
|
|
175619
|
+
function deleteCustomShow(shows, id) {
|
|
175620
|
+
const show = shows.find((s) => s.id === id);
|
|
175621
|
+
return { shows: shows.filter((s) => s.id !== id), show };
|
|
175622
|
+
}
|
|
175623
|
+
function clearCustomShowActions(slides, id) {
|
|
175624
|
+
const result = mapCustomShowActions(slides, (target) => target === id ? null : target);
|
|
175625
|
+
return { slides: result.slides, cleared: result.changed };
|
|
175626
|
+
}
|
|
175627
|
+
|
|
175628
|
+
// pptx/automation/tools/custom-show-tools.ts
|
|
175629
|
+
function describeShow(show, data) {
|
|
175630
|
+
const indexByRId = new Map(data.slides.map((s, i2) => [s.rId, i2]));
|
|
175631
|
+
return {
|
|
175632
|
+
id: show.id,
|
|
175633
|
+
name: show.name,
|
|
175634
|
+
slideIndices: show.slideRIds.flatMap((r) => {
|
|
175635
|
+
const i2 = indexByRId.get(r);
|
|
175636
|
+
return i2 === void 0 ? [] : [i2];
|
|
175637
|
+
})
|
|
175638
|
+
};
|
|
175639
|
+
}
|
|
175640
|
+
function rIdsFor(data, indices) {
|
|
175641
|
+
return (indices ?? []).map((i2) => {
|
|
175642
|
+
const slide = data.slides[i2];
|
|
175643
|
+
if (!slide) {
|
|
175644
|
+
throw new Error(`Slide index ${i2} out of range (0\u2013${data.slides.length - 1}).`);
|
|
175645
|
+
}
|
|
175646
|
+
return slide.rId;
|
|
175647
|
+
});
|
|
175648
|
+
}
|
|
175649
|
+
function requireId(params) {
|
|
175650
|
+
if (!params.showId) {
|
|
175651
|
+
throw new Error(`showId is required for ${params.action} action.`);
|
|
175652
|
+
}
|
|
175653
|
+
return params.showId;
|
|
175654
|
+
}
|
|
175655
|
+
function manageCustomShows(ctx, params) {
|
|
175656
|
+
const data = ctx.pptxData;
|
|
175657
|
+
const current = data.customShows ?? [];
|
|
175658
|
+
const commit = (shows, result) => {
|
|
175659
|
+
data.customShows = shows;
|
|
175660
|
+
return { pptxData: data, dirty: true, result, saveOptions: { customShows: shows } };
|
|
175661
|
+
};
|
|
175662
|
+
const unknown2 = (id) => new Error(`No custom show with id ${id}.`);
|
|
175663
|
+
switch (params.action) {
|
|
175664
|
+
case "list":
|
|
175665
|
+
return {
|
|
175666
|
+
pptxData: data,
|
|
175667
|
+
dirty: false,
|
|
175668
|
+
result: { action: "list", shows: current.map((s) => describeShow(s, data)) }
|
|
175669
|
+
};
|
|
175670
|
+
case "create": {
|
|
175671
|
+
if (!params.name?.trim()) {
|
|
175672
|
+
throw new Error("name is required for create action.");
|
|
175673
|
+
}
|
|
175674
|
+
const r = createCustomShow(current, params.name, rIdsFor(data, params.slideIndices));
|
|
175675
|
+
return commit(r.shows, { action: "create", show: describeShow(r.show, data) });
|
|
175676
|
+
}
|
|
175677
|
+
case "rename": {
|
|
175678
|
+
if (!params.name?.trim()) {
|
|
175679
|
+
throw new Error("name is required for rename action.");
|
|
175680
|
+
}
|
|
175681
|
+
const id = requireId(params);
|
|
175682
|
+
const r = renameCustomShow(current, id, params.name);
|
|
175683
|
+
if (!r.show) {
|
|
175684
|
+
throw unknown2(id);
|
|
175685
|
+
}
|
|
175686
|
+
return commit(r.shows, { action: "rename", show: describeShow(r.show, data) });
|
|
175687
|
+
}
|
|
175688
|
+
case "setSlides":
|
|
175689
|
+
case "addSlides": {
|
|
175690
|
+
if (!params.slideIndices) {
|
|
175691
|
+
throw new Error(`slideIndices is required for ${params.action} action.`);
|
|
175692
|
+
}
|
|
175693
|
+
const id = requireId(params);
|
|
175694
|
+
const rIds = rIdsFor(data, params.slideIndices);
|
|
175695
|
+
const r = params.action === "setSlides" ? setCustomShowSlides(current, id, rIds) : addSlidesToCustomShow(current, id, rIds, params.index);
|
|
175696
|
+
if (!r.show) {
|
|
175697
|
+
throw unknown2(id);
|
|
175698
|
+
}
|
|
175699
|
+
return commit(r.shows, { action: params.action, show: describeShow(r.show, data) });
|
|
175700
|
+
}
|
|
175701
|
+
case "removeSlides": {
|
|
175702
|
+
if (!params.positions) {
|
|
175703
|
+
throw new Error("positions is required for removeSlides action.");
|
|
175704
|
+
}
|
|
175705
|
+
const id = requireId(params);
|
|
175706
|
+
const r = removeSlidesFromCustomShow(current, id, params.positions);
|
|
175707
|
+
if (!r.show) {
|
|
175708
|
+
throw unknown2(id);
|
|
175709
|
+
}
|
|
175710
|
+
return commit(r.shows, { action: "removeSlides", show: describeShow(r.show, data) });
|
|
175711
|
+
}
|
|
175712
|
+
case "moveSlide": {
|
|
175713
|
+
if (params.from === void 0 || params.to === void 0) {
|
|
175714
|
+
throw new Error("from and to are required for moveSlide action.");
|
|
175715
|
+
}
|
|
175716
|
+
const id = requireId(params);
|
|
175717
|
+
const r = moveCustomShowSlide(current, id, params.from, params.to);
|
|
175718
|
+
if (!r.show) {
|
|
175719
|
+
throw unknown2(id);
|
|
175720
|
+
}
|
|
175721
|
+
return commit(r.shows, { action: "moveSlide", show: describeShow(r.show, data) });
|
|
175722
|
+
}
|
|
175723
|
+
case "copy": {
|
|
175724
|
+
const id = requireId(params);
|
|
175725
|
+
const r = copyCustomShow(current, id, params.name);
|
|
175726
|
+
if (!r.show) {
|
|
175727
|
+
throw unknown2(id);
|
|
175728
|
+
}
|
|
175729
|
+
return commit(r.shows, { action: "copy", show: describeShow(r.show, data) });
|
|
175730
|
+
}
|
|
175731
|
+
case "delete": {
|
|
175732
|
+
const id = requireId(params);
|
|
175733
|
+
const r = deleteCustomShow(current, id);
|
|
175734
|
+
if (!r.show) {
|
|
175735
|
+
throw unknown2(id);
|
|
175736
|
+
}
|
|
175737
|
+
const cleared = clearCustomShowActions(data.slides, id);
|
|
175738
|
+
data.slides = cleared.slides;
|
|
175739
|
+
const props = data.presentationProperties;
|
|
175740
|
+
if (props?.showSlidesCustomShowId === id) {
|
|
175741
|
+
props.showSlidesMode = "all";
|
|
175742
|
+
delete props.showSlidesCustomShowId;
|
|
175743
|
+
}
|
|
175744
|
+
return commit(r.shows, {
|
|
175745
|
+
action: "delete",
|
|
175746
|
+
show: describeShow(r.show, data),
|
|
175747
|
+
clearedActions: cleared.cleared
|
|
175748
|
+
});
|
|
175749
|
+
}
|
|
175750
|
+
default:
|
|
175751
|
+
throw new Error(`Unknown custom show action: ${String(params.action)}`);
|
|
175752
|
+
}
|
|
175753
|
+
}
|
|
175754
|
+
|
|
174629
175755
|
// pptx/automation/tools/section-tools.ts
|
|
174630
175756
|
var section_tools_exports = {};
|
|
174631
175757
|
__export(section_tools_exports, {
|
|
@@ -195929,6 +197055,31 @@ var ManageSectionsSchema = external_exports.object({
|
|
|
195929
197055
|
slideIndex: external_exports.number().int().min(0).optional().describe("Slide index (for getForSlide)")
|
|
195930
197056
|
});
|
|
195931
197057
|
|
|
197058
|
+
// pptx/automation/schemas/custom-show-schemas.ts
|
|
197059
|
+
var ManageCustomShowsSchema = external_exports.object({
|
|
197060
|
+
filePath: external_exports.string().describe("Path to the PPTX file"),
|
|
197061
|
+
action: external_exports.enum([
|
|
197062
|
+
"list",
|
|
197063
|
+
"create",
|
|
197064
|
+
"rename",
|
|
197065
|
+
"setSlides",
|
|
197066
|
+
"addSlides",
|
|
197067
|
+
"removeSlides",
|
|
197068
|
+
"moveSlide",
|
|
197069
|
+
"copy",
|
|
197070
|
+
"delete"
|
|
197071
|
+
]).describe("Custom show action"),
|
|
197072
|
+
showId: external_exports.string().optional().describe(
|
|
197073
|
+
"Custom show id from list (for rename, setSlides, addSlides, removeSlides, moveSlide, copy, delete)"
|
|
197074
|
+
),
|
|
197075
|
+
name: external_exports.string().optional().describe("Show name (for create, rename, optionally copy)"),
|
|
197076
|
+
slideIndices: external_exports.array(external_exports.number().int().min(0)).optional().describe("0-based slide indices in show order (for create, setSlides, addSlides)"),
|
|
197077
|
+
positions: external_exports.array(external_exports.number().int().min(0)).optional().describe("0-based positions within the show list to remove (for removeSlides)"),
|
|
197078
|
+
from: external_exports.number().int().min(0).optional().describe("Position to move from (for moveSlide)"),
|
|
197079
|
+
to: external_exports.number().int().min(0).optional().describe("Position to move to (for moveSlide)"),
|
|
197080
|
+
index: external_exports.number().int().min(0).optional().describe("Position within the show to insert at; default the end (for addSlides)")
|
|
197081
|
+
});
|
|
197082
|
+
|
|
195932
197083
|
// pptx/automation/schemas/export-schemas.ts
|
|
195933
197084
|
var ExportToSvgSchema = external_exports.object({
|
|
195934
197085
|
filePath: external_exports.string().describe("Path to the PPTX file"),
|
|
@@ -196336,6 +197487,14 @@ var documentTools = [
|
|
|
196336
197487
|
(ctx, params) => manageSections(ctx, params),
|
|
196337
197488
|
{ returnsText: true }
|
|
196338
197489
|
),
|
|
197490
|
+
deckTool(
|
|
197491
|
+
"edit",
|
|
197492
|
+
"manage_custom_shows",
|
|
197493
|
+
"List, create, rename, copy or delete custom shows, or edit their slide lists (add, remove, reorder)",
|
|
197494
|
+
ManageCustomShowsSchema,
|
|
197495
|
+
(ctx, params) => manageCustomShows(ctx, params),
|
|
197496
|
+
{ returnsText: true }
|
|
197497
|
+
),
|
|
196339
197498
|
deckTool(
|
|
196340
197499
|
"read",
|
|
196341
197500
|
"export_to_svg",
|
|
@@ -197167,6 +198326,7 @@ exports.apiToolsChartTools = chart_tools_exports;
|
|
|
197167
198326
|
exports.apiToolsChartUserShapeTools = chart_user_shape_tools_exports;
|
|
197168
198327
|
exports.apiToolsContentTools = content_tools_exports;
|
|
197169
198328
|
exports.apiToolsConversionTools = conversion_tools_exports;
|
|
198329
|
+
exports.apiToolsCustomShowTools = custom_show_tools_exports;
|
|
197170
198330
|
exports.apiToolsElementTools = element_tools_exports;
|
|
197171
198331
|
exports.apiToolsExportTools = export_tools_exports;
|
|
197172
198332
|
exports.apiToolsGeometryTools = geometry_tools_exports;
|
|
@@ -197232,6 +198392,7 @@ exports.importFromJson = importFromJson;
|
|
|
197232
198392
|
exports.listChartUserShapesT = listChartUserShapesT;
|
|
197233
198393
|
exports.loadPresentation = loadPresentation;
|
|
197234
198394
|
exports.manageComments = manageComments;
|
|
198395
|
+
exports.manageCustomShows = manageCustomShows;
|
|
197235
198396
|
exports.manageHyperlinks = manageHyperlinks;
|
|
197236
198397
|
exports.manageSections = manageSections;
|
|
197237
198398
|
exports.manageSmartArt = manageSmartArt;
|