ooxml-core 1.30.0 → 1.31.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-3OLZT5YW.cjs → PptxHandler-DHQPVTUI.cjs} +2 -2
- package/dist/{PptxHandler-LOFY2PRO.mjs → PptxHandler-E4DDV3FQ.mjs} +1 -1
- package/dist/{PptxHandler-FJHKJEZU.mjs → PptxHandler-KKLAYUGQ.mjs} +2 -2
- package/dist/{PresentationBuilder-LVIVJZIL.cjs → PresentationBuilder-JORMF5CP.cjs} +4 -4
- package/dist/{PresentationBuilder-W5VRPFLM.mjs → PresentationBuilder-Q2Z33LLM.mjs} +2 -2
- package/dist/{PresentationBuilder-23M6WQK3.mjs → PresentationBuilder-YYZYCKTZ.mjs} +1 -1
- package/dist/automation/index.cjs +5829 -3266
- package/dist/automation/index.mjs +5829 -3266
- package/dist/automation/node.cjs +2 -1
- package/dist/automation/node.d.ts.map +1 -1
- package/dist/automation/node.mjs +2 -1
- package/dist/automation/tools/define.d.ts +2 -0
- package/dist/automation/tools/define.d.ts.map +1 -1
- package/dist/automation/tools/types.d.ts +6 -0
- package/dist/automation/tools/types.d.ts.map +1 -1
- package/dist/{chunk-JZ64GVIB.mjs → chunk-6FXOAMNL.mjs} +1 -1
- package/dist/{chunk-SCK5U362.cjs → chunk-B4LXDHBX.cjs} +19 -1
- package/dist/{chunk-5YZFO55V.mjs → chunk-FFJBOR2Y.mjs} +4 -4
- package/dist/{chunk-SCTM27HK.mjs → chunk-GJDFCP2T.mjs} +20 -2
- package/dist/{chunk-HDHUJM5M.mjs → chunk-KWJYMAEF.mjs} +19 -1
- package/dist/{chunk-HK7DVTEF.mjs → chunk-MKDONWNO.mjs} +1 -1
- package/dist/{chunk-UVYWAI4M.mjs → chunk-WZJ25K7P.mjs} +1 -1
- package/dist/collab/index.cjs +35 -4
- package/dist/collab/index.mjs +35 -4
- package/dist/collab/websocket-transport.d.ts +9 -1
- package/dist/collab/websocket-transport.d.ts.map +1 -1
- package/dist/docx/data-binding.d.ts +9 -0
- package/dist/docx/data-binding.d.ts.map +1 -0
- package/dist/docx/document-parts.d.ts +1 -0
- package/dist/docx/document-parts.d.ts.map +1 -1
- package/dist/docx/drawing.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +1383 -609
- package/dist/docx/embedded.mjs +1383 -609
- package/dist/docx/index.cjs +1394 -618
- package/dist/docx/index.mjs +1394 -618
- package/dist/docx/inline-model.d.ts +2 -0
- package/dist/docx/inline-model.d.ts.map +1 -1
- package/dist/docx/layout/adapt-floats.d.ts.map +1 -1
- package/dist/docx/layout/adapt-table.d.ts.map +1 -1
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/equation-object.d.ts +1 -1
- package/dist/docx/layout/equation-object.d.ts.map +1 -1
- package/dist/docx/layout/floats.d.ts +1 -1
- package/dist/docx/layout/floats.d.ts.map +1 -1
- package/dist/docx/layout/flow-paragraph.d.ts +4 -0
- package/dist/docx/layout/flow-paragraph.d.ts.map +1 -1
- package/dist/docx/layout/flow-table.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +452 -203
- package/dist/docx/layout/index.mjs +452 -203
- package/dist/docx/layout/input.d.ts +12 -0
- package/dist/docx/layout/input.d.ts.map +1 -1
- package/dist/docx/layout/nested-frame-profile.d.ts +3 -1
- package/dist/docx/layout/nested-frame-profile.d.ts.map +1 -1
- package/dist/docx/layout/page-cursor.d.ts +11 -2
- package/dist/docx/layout/page-cursor.d.ts.map +1 -1
- package/dist/docx/layout/paragraph-fragments.d.ts.map +1 -1
- package/dist/docx/layout/paragraph-layout.d.ts +5 -0
- package/dist/docx/layout/paragraph-layout.d.ts.map +1 -1
- package/dist/docx/layout/result.d.ts +4 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/layout/section-flow.d.ts +2 -0
- package/dist/docx/layout/section-flow.d.ts.map +1 -1
- package/dist/docx/layout/table-layout.d.ts +4 -14
- package/dist/docx/layout/table-layout.d.ts.map +1 -1
- package/dist/docx/layout/table-merged-rows.d.ts +21 -0
- package/dist/docx/layout/table-merged-rows.d.ts.map +1 -0
- package/dist/docx/layout/table-row-split.d.ts +16 -0
- package/dist/docx/layout/table-row-split.d.ts.map +1 -0
- package/dist/docx/layout/wrap.d.ts +2 -0
- package/dist/docx/layout/wrap.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +1397 -623
- package/dist/docx/load/index.mjs +1397 -623
- package/dist/docx/model-paragraph.d.ts +4 -1
- package/dist/docx/model-paragraph.d.ts.map +1 -1
- package/dist/docx/model.d.ts +24 -1
- package/dist/docx/model.d.ts.map +1 -1
- package/dist/docx/paragraph-properties.d.ts.map +1 -1
- package/dist/docx/paragraph-styles.d.ts.map +1 -1
- package/dist/docx/parse-table.d.ts.map +1 -1
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/run-segmentation.d.ts.map +1 -1
- package/dist/docx/save-modified.d.ts +4 -0
- package/dist/docx/save-modified.d.ts.map +1 -0
- package/dist/docx/save.d.ts +2 -2
- package/dist/docx/save.d.ts.map +1 -1
- package/dist/docx/style-formatting-package.d.ts +9 -0
- package/dist/docx/style-formatting-package.d.ts.map +1 -0
- package/dist/docx/style-numbering-package.d.ts +4 -1
- package/dist/docx/style-numbering-package.d.ts.map +1 -1
- package/dist/docx/table-grid.d.ts +35 -0
- package/dist/docx/table-grid.d.ts.map +1 -0
- package/dist/docx/table-structure-cells.d.ts +19 -0
- package/dist/docx/table-structure-cells.d.ts.map +1 -0
- package/dist/docx/table-structure-check.d.ts +12 -0
- package/dist/docx/table-structure-check.d.ts.map +1 -0
- package/dist/docx/table-structure-merge.d.ts +28 -0
- package/dist/docx/table-structure-merge.d.ts.map +1 -0
- package/dist/docx/table-structure.d.ts +30 -0
- package/dist/docx/table-structure.d.ts.map +1 -0
- package/dist/docx/ui/index.cjs +717 -256
- 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 +703 -257
- 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/ui/table-structure-guard.d.ts +2 -0
- package/dist/docx/ui/table-structure-guard.d.ts.map +1 -1
- package/dist/docx/word-content-control-docs.d.ts +5 -0
- package/dist/docx/word-content-control-docs.d.ts.map +1 -0
- package/dist/docx/word-corpus-gaps.d.ts +10 -0
- package/dist/docx/word-corpus-gaps.d.ts.map +1 -0
- package/dist/docx/word-measurer.d.ts +6 -0
- package/dist/docx/word-measurer.d.ts.map +1 -0
- package/dist/docx/word-spacing-docs.d.ts +12 -0
- package/dist/docx/word-spacing-docs.d.ts.map +1 -0
- package/dist/docx/word-table-docs.d.ts +9 -0
- package/dist/docx/word-table-docs.d.ts.map +1 -0
- package/dist/docx/write-drawing.d.ts.map +1 -1
- package/dist/docx/write-fallback.d.ts +5 -0
- package/dist/docx/write-fallback.d.ts.map +1 -0
- package/dist/docx/write-table-properties.d.ts +1 -0
- package/dist/docx/write-table-properties.d.ts.map +1 -1
- package/dist/docx/write-table-structure.d.ts +14 -0
- package/dist/docx/write-table-structure.d.ts.map +1 -0
- package/dist/docx/write-table.d.ts +3 -4
- package/dist/docx/write-table.d.ts.map +1 -1
- package/dist/index.cjs +22 -22
- package/dist/index.mjs +22 -22
- package/dist/math/index.cjs +22 -22
- package/dist/math/index.mjs +22 -22
- package/dist/math/omml-box-grouped.d.ts.map +1 -1
- package/dist/math/omml-box-layout.d.ts +3 -1
- package/dist/math/omml-box-layout.d.ts.map +1 -1
- package/dist/math/omml-box-structures.d.ts.map +1 -1
- package/dist/math/omml-box.d.ts +2 -0
- package/dist/math/omml-box.d.ts.map +1 -1
- package/dist/math/omml-svg.d.ts +6 -2
- package/dist/math/omml-svg.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +20 -1
- package/dist/pptx/automation/index.d.ts +6 -0
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +6 -5
- package/dist/pptx/chunks/index-PdM5zpmu.d.ts.map +1 -1
- package/dist/pptx/cli/index.cjs +19 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/slide-operations.cjs +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +1 -1
- package/dist/pptx/index.cjs +19 -1
- package/dist/pptx/index.mjs +5 -5
- package/dist/teams/chat-rooms.d.ts.map +1 -1
- package/dist/teams/chat.d.ts +7 -0
- package/dist/teams/chat.d.ts.map +1 -1
- package/dist/teams/files.d.ts +1 -1
- package/dist/teams/files.d.ts.map +1 -1
- package/dist/teams/index.cjs +2735 -1148
- package/dist/teams/index.d.ts +3 -0
- package/dist/teams/index.d.ts.map +1 -1
- package/dist/teams/index.mjs +2710 -1148
- package/dist/teams/message-transfer.d.ts +1 -1
- package/dist/teams/message-transfer.d.ts.map +1 -1
- package/dist/teams/protocol.d.ts +30 -0
- package/dist/teams/protocol.d.ts.map +1 -0
- package/dist/teams/schema.d.ts +59 -0
- package/dist/teams/schema.d.ts.map +1 -0
- package/dist/teams/server-config.d.ts +19 -2
- package/dist/teams/server-config.d.ts.map +1 -1
- package/dist/teams/server-file-storage.d.ts +11 -1
- package/dist/teams/server-file-storage.d.ts.map +1 -1
- package/dist/teams/server-session.d.ts +2 -0
- package/dist/teams/server-session.d.ts.map +1 -1
- package/dist/teams/signaling.d.ts +2 -0
- package/dist/teams/signaling.d.ts.map +1 -1
- package/dist/teams/store.d.ts +9 -0
- package/dist/teams/store.d.ts.map +1 -1
- package/dist/teams/stored-file.d.ts +1 -1
- package/dist/teams/stored-file.d.ts.map +1 -1
- package/dist/teams/sync-transport.d.ts.map +1 -1
- package/dist/teams/validate-members.d.ts +28 -0
- package/dist/teams/validate-members.d.ts.map +1 -0
- package/dist/teams/validate-owned.d.ts +20 -0
- package/dist/teams/validate-owned.d.ts.map +1 -0
- package/dist/teams/validate-update.d.ts +70 -0
- package/dist/teams/validate-update.d.ts.map +1 -0
- package/dist/teams/workspace.d.ts +12 -0
- package/dist/teams/workspace.d.ts.map +1 -1
- package/dist/visio/connector-route-walk.d.ts +2 -0
- package/dist/visio/connector-route-walk.d.ts.map +1 -1
- package/dist/visio/edit-connector-reroute.d.ts.map +1 -1
- package/dist/visio/edit-connector.d.ts +2 -0
- package/dist/visio/edit-connector.d.ts.map +1 -1
- package/dist/visio/edit-delete.d.ts.map +1 -1
- package/dist/visio/edit-duplicate-line.d.ts +40 -0
- package/dist/visio/edit-duplicate-line.d.ts.map +1 -0
- package/dist/visio/edit-duplicate.d.ts.map +1 -1
- package/dist/visio/edit-formatting-scope.d.ts +5 -1
- package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
- package/dist/visio/edit-geometry.d.ts.map +1 -1
- package/dist/visio/edit-instance-duplicate.d.ts +2 -1
- package/dist/visio/edit-instance-duplicate.d.ts.map +1 -1
- package/dist/visio/edit-master-move.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-index.d.ts +23 -0
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-text.d.ts +12 -0
- package/dist/visio/edit-recalculate-text.d.ts.map +1 -0
- package/dist/visio/edit-recalculate-values.d.ts.map +1 -1
- package/dist/visio/edit-recalculate.d.ts +15 -3
- package/dist/visio/edit-recalculate.d.ts.map +1 -1
- package/dist/visio/edit-resize-anchor.d.ts.map +1 -1
- package/dist/visio/edit-stencil-connector-layout.d.ts +1 -1
- package/dist/visio/edit-stencil-connector-layout.d.ts.map +1 -1
- package/dist/visio/edit-text-scope.d.ts +4 -1
- package/dist/visio/edit-text-scope.d.ts.map +1 -1
- package/dist/visio/formula-analyze.d.ts +18 -0
- package/dist/visio/formula-analyze.d.ts.map +1 -0
- package/dist/visio/formula-bound.d.ts +4 -0
- package/dist/visio/formula-bound.d.ts.map +1 -0
- package/dist/visio/formula-evaluate.d.ts +2 -9
- package/dist/visio/formula-evaluate.d.ts.map +1 -1
- package/dist/visio/formula-extra-functions.d.ts +23 -0
- package/dist/visio/formula-extra-functions.d.ts.map +1 -0
- package/dist/visio/formula-indirect.d.ts +6 -0
- package/dist/visio/formula-indirect.d.ts.map +1 -0
- package/dist/visio/formula-master.d.ts +1 -0
- package/dist/visio/formula-master.d.ts.map +1 -1
- package/dist/visio/formula-operators.d.ts +6 -0
- package/dist/visio/formula-operators.d.ts.map +1 -0
- package/dist/visio/formula-text-functions.d.ts +5 -1
- package/dist/visio/formula-text-functions.d.ts.map +1 -1
- package/dist/visio/formula.d.ts +12 -0
- package/dist/visio/formula.d.ts.map +1 -1
- package/dist/visio/index.cjs +1354 -396
- package/dist/visio/index.mjs +1354 -396
- package/dist/visio/ui/index.cjs +1341 -383
- package/dist/visio/ui/index.mjs +1341 -383
- package/dist/xlsx/collab/apply.d.ts.map +1 -1
- package/dist/xlsx/collab/codec.d.ts +2 -0
- package/dist/xlsx/collab/codec.d.ts.map +1 -1
- package/dist/xlsx/collab/dirty.d.ts +4 -1
- package/dist/xlsx/collab/dirty.d.ts.map +1 -1
- package/dist/xlsx/collab/index.cjs +551 -106
- package/dist/xlsx/collab/index.mjs +551 -106
- package/dist/xlsx/collab/keyed.d.ts +36 -0
- package/dist/xlsx/collab/keyed.d.ts.map +1 -0
- package/dist/xlsx/collab/names.d.ts +2 -0
- package/dist/xlsx/collab/names.d.ts.map +1 -1
- package/dist/xlsx/collab/part-specs.d.ts +13 -0
- package/dist/xlsx/collab/part-specs.d.ts.map +1 -0
- package/dist/xlsx/collab/schema.d.ts +8 -0
- package/dist/xlsx/collab/schema.d.ts.map +1 -1
- package/dist/xlsx/collab/sheet-parts.d.ts +19 -0
- package/dist/xlsx/collab/sheet-parts.d.ts.map +1 -0
- package/dist/xlsx/collab/sheets.d.ts +6 -0
- package/dist/xlsx/collab/sheets.d.ts.map +1 -1
- package/dist/xlsx/collab/write.d.ts +3 -0
- package/dist/xlsx/collab/write.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard-areas.d.ts +17 -0
- package/dist/xlsx/edit/clipboard-areas.d.ts.map +1 -0
- package/dist/xlsx/edit/custom-views.d.ts +21 -0
- package/dist/xlsx/edit/custom-views.d.ts.map +1 -0
- package/dist/xlsx/edit/data-table.d.ts.map +1 -1
- package/dist/xlsx/edit/history.d.ts +1 -1
- package/dist/xlsx/edit/history.d.ts.map +1 -1
- package/dist/xlsx/edit/index.d.ts +2 -0
- package/dist/xlsx/edit/index.d.ts.map +1 -1
- package/dist/xlsx/edit/paste-selection.d.ts.map +1 -1
- package/dist/xlsx/edit/scenario-merge.d.ts +7 -0
- package/dist/xlsx/edit/scenario-merge.d.ts.map +1 -0
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-data-tables.d.ts +7 -0
- package/dist/xlsx/edit/shift-data-tables.d.ts.map +1 -0
- package/dist/xlsx/edit/shift-scenarios.d.ts +7 -0
- package/dist/xlsx/edit/shift-scenarios.d.ts.map +1 -0
- package/dist/xlsx/edit/shift-sheet.d.ts.map +1 -1
- package/dist/xlsx/edit/sparkline-grouping.d.ts +10 -0
- package/dist/xlsx/edit/sparkline-grouping.d.ts.map +1 -0
- package/dist/xlsx/edit/types.d.ts +21 -0
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/formula/ets-excel-compare.d.ts +24 -0
- package/dist/xlsx/formula/ets-excel-compare.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-core.d.ts +36 -0
- package/dist/xlsx/formula/functions/ets-core.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-grid.d.ts +15 -0
- package/dist/xlsx/formula/functions/ets-grid.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init.d.ts +15 -0
- package/dist/xlsx/formula/functions/ets-init.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-input.d.ts +13 -0
- package/dist/xlsx/formula/functions/ets-input.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-season.d.ts +6 -0
- package/dist/xlsx/formula/functions/ets-season.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/forecast-ets.d.ts +3 -0
- package/dist/xlsx/formula/functions/forecast-ets.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/statistical.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +4444 -2447
- package/dist/xlsx/index.mjs +4423 -2448
- package/dist/xlsx/layout/form-control-link.d.ts +20 -0
- package/dist/xlsx/layout/form-control-link.d.ts.map +1 -0
- package/dist/xlsx/layout/form-control-state.d.ts +49 -0
- package/dist/xlsx/layout/form-control-state.d.ts.map +1 -0
- package/dist/xlsx/layout/form-control-view.d.ts +11 -0
- package/dist/xlsx/layout/form-control-view.d.ts.map +1 -0
- package/dist/xlsx/layout/header-footer-edit.d.ts +4 -2
- package/dist/xlsx/layout/header-footer-edit.d.ts.map +1 -1
- package/dist/xlsx/layout/header-footer.d.ts +16 -0
- package/dist/xlsx/layout/header-footer.d.ts.map +1 -1
- package/dist/xlsx/layout/index.d.ts +5 -0
- package/dist/xlsx/layout/index.d.ts.map +1 -1
- package/dist/xlsx/layout/ref-evaluator.d.ts +6 -0
- package/dist/xlsx/layout/ref-evaluator.d.ts.map +1 -1
- package/dist/xlsx/layout/shape-paint.d.ts +25 -0
- package/dist/xlsx/layout/shape-paint.d.ts.map +1 -0
- package/dist/xlsx/layout/shape-view.d.ts +15 -0
- package/dist/xlsx/layout/shape-view.d.ts.map +1 -0
- package/dist/xlsx/load/index.cjs +2134 -1103
- package/dist/xlsx/load/index.mjs +2134 -1103
- package/dist/xlsx/model-custom-views.d.ts +33 -0
- package/dist/xlsx/model-custom-views.d.ts.map +1 -0
- package/dist/xlsx/model-shapes.d.ts +78 -0
- package/dist/xlsx/model-shapes.d.ts.map +1 -0
- package/dist/xlsx/model.d.ts +38 -1
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/read/custom-views.d.ts +5 -0
- package/dist/xlsx/read/custom-views.d.ts.map +1 -0
- package/dist/xlsx/read/drawing.d.ts.map +1 -1
- package/dist/xlsx/read/form-control.d.ts +14 -0
- package/dist/xlsx/read/form-control.d.ts.map +1 -0
- package/dist/xlsx/read/header-footer-images.d.ts +5 -0
- package/dist/xlsx/read/header-footer-images.d.ts.map +1 -0
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/read/shape.d.ts +5 -0
- package/dist/xlsx/read/shape.d.ts.map +1 -0
- package/dist/xlsx/read/sheet-data.d.ts.map +1 -1
- package/dist/xlsx/read/workbook-part.d.ts +5 -1
- package/dist/xlsx/read/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/read/worksheet-children.d.ts +3 -0
- package/dist/xlsx/read/worksheet-children.d.ts.map +1 -0
- package/dist/xlsx/read/worksheet.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/sparklines.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/what-if.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/what-if.d.ts +0 -1
- package/dist/xlsx/ui/commands/what-if.d.ts.map +1 -1
- package/dist/xlsx/ui/dialogs/forecast-sheet.d.ts +51 -0
- package/dist/xlsx/ui/dialogs/forecast-sheet.d.ts.map +1 -0
- package/dist/xlsx/ui/dialogs/scenario-summary.d.ts +15 -0
- package/dist/xlsx/ui/dialogs/scenario-summary.d.ts.map +1 -0
- package/dist/xlsx/ui/index.cjs +4411 -2195
- package/dist/xlsx/ui/index.d.ts +2 -0
- package/dist/xlsx/ui/index.d.ts.map +1 -1
- package/dist/xlsx/ui/index.mjs +4404 -2194
- package/dist/xlsx/ui/locales/de/grid.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/en/grid.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/es/grid.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/fr/grid.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/zh-CN/grid.d.ts.map +1 -1
- package/dist/xlsx/write/custom-views.d.ts +4 -0
- package/dist/xlsx/write/custom-views.d.ts.map +1 -0
- package/dist/xlsx/write/drawing.d.ts.map +1 -1
- package/dist/xlsx/write/form-control.d.ts +4 -0
- package/dist/xlsx/write/form-control.d.ts.map +1 -0
- package/dist/xlsx/write/sheet-data.d.ts.map +1 -1
- package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/write/worksheet.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/visio/index.mjs
CHANGED
|
@@ -697,11 +697,11 @@ function inspectDeclaration(value3, encoding) {
|
|
|
697
697
|
if (declarations.length) fail("INVALID_XML", "Invalid XML declaration attributes");
|
|
698
698
|
}
|
|
699
699
|
function decodeXmlAttribute(value3) {
|
|
700
|
-
const
|
|
700
|
+
const entities2 = { amp: "&", lt: "<", gt: ">", apos: "'", quot: '"' };
|
|
701
701
|
return value3.replace(/[\t\r\n]/g, " ").replace(/&(amp|lt|gt|apos|quot|#x[\da-fA-F]+|#\d+);/g, (_, entity) => {
|
|
702
702
|
if (entity.startsWith("#x")) return String.fromCodePoint(parseInt(entity.slice(2), 16));
|
|
703
703
|
if (entity.startsWith("#")) return String.fromCodePoint(Number(entity.slice(1)));
|
|
704
|
-
return
|
|
704
|
+
return entities2[entity] ?? "";
|
|
705
705
|
});
|
|
706
706
|
}
|
|
707
707
|
function inspectNamespaces(root2, check) {
|
|
@@ -2048,6 +2048,60 @@ function evaluateNumericFormulaFunction(name3, args) {
|
|
|
2048
2048
|
return formulaFailure("unsupported", `Unsupported numeric function ${name3}`);
|
|
2049
2049
|
}
|
|
2050
2050
|
|
|
2051
|
+
// visio/formula-extra-functions.ts
|
|
2052
|
+
var IGNORE_CASE = 1;
|
|
2053
|
+
var IGNORE_NONSPACE = 2;
|
|
2054
|
+
var IGNORE_SYMBOLS = 4;
|
|
2055
|
+
function strSameEx(a2, b, flags) {
|
|
2056
|
+
if (!Number.isInteger(flags) || flags < 0)
|
|
2057
|
+
return formulaFailure("value", "STRSAMEEX flags must be a whole number");
|
|
2058
|
+
if (flags & -8)
|
|
2059
|
+
return formulaFailure("unsupported", "STRSAMEEX with kana or width comparison flags");
|
|
2060
|
+
const fold = (text5) => {
|
|
2061
|
+
let result2 = text5;
|
|
2062
|
+
if (flags & IGNORE_NONSPACE) result2 = result2.normalize("NFD").replace(/\p{Mn}/gu, "");
|
|
2063
|
+
if (flags & IGNORE_SYMBOLS) result2 = result2.replace(/[\p{P}\p{S}\s]/gu, "");
|
|
2064
|
+
return flags & IGNORE_CASE ? result2.toLowerCase() : result2;
|
|
2065
|
+
};
|
|
2066
|
+
return fold(a2) === fold(b);
|
|
2067
|
+
}
|
|
2068
|
+
function formatNumberPicture(value3, picture) {
|
|
2069
|
+
if (value3.unit !== "scalar") return formulaFailure("unit", "FORMAT requires a plain number");
|
|
2070
|
+
const match = /^([#,0]*)(?:\.([0#]*))?(%?)$/.exec(picture);
|
|
2071
|
+
const integerPicture = match?.[1] ?? "";
|
|
2072
|
+
if (!match || !integerPicture.includes("0") || /0,*#/.test(integerPicture) || integerPicture.startsWith(",") || integerPicture.endsWith(",") || integerPicture.includes(",,") || /0#/.test(match[2] ?? ""))
|
|
2073
|
+
return formulaFailure("unsupported", `FORMAT picture "${picture}"`);
|
|
2074
|
+
const fractionPicture = match[2] ?? "", percent = match[3] === "%", grouped = integerPicture.includes(",");
|
|
2075
|
+
const minInteger = (integerPicture.match(/0/g) ?? []).length;
|
|
2076
|
+
const minFraction = (fractionPicture.match(/0/g) ?? []).length;
|
|
2077
|
+
const maxFraction = fractionPicture.length;
|
|
2078
|
+
const scaled = percent ? value3.value * 100 : value3.value;
|
|
2079
|
+
const factor = 10 ** maxFraction;
|
|
2080
|
+
const rounded = Math.sign(scaled) * Math.round(Math.abs(scaled) * factor + 1e-9) / factor;
|
|
2081
|
+
const [digits = "", decimals = ""] = Math.abs(rounded).toFixed(maxFraction).split(".");
|
|
2082
|
+
let whole = digits.replace(/^0+/, "").padStart(minInteger, "0");
|
|
2083
|
+
if (grouped) whole = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
2084
|
+
let fraction = decimals;
|
|
2085
|
+
while (fraction.length > minFraction && fraction.endsWith("0")) fraction = fraction.slice(0, -1);
|
|
2086
|
+
const negative = rounded < 0;
|
|
2087
|
+
return `${negative ? "-" : ""}${whole}${fraction ? `.${fraction}` : ""}${percent ? "%" : ""}`;
|
|
2088
|
+
}
|
|
2089
|
+
function visioDateSerial(year, month, day) {
|
|
2090
|
+
if (![year, month, day].every(Number.isInteger))
|
|
2091
|
+
return formulaFailure("value", "DATE requires whole numbers");
|
|
2092
|
+
if (year < 1 || year > 9999 || month < 1 || month > 12 || day < 1 || day > 31)
|
|
2093
|
+
return formulaFailure("value", "DATE is outside the calendar");
|
|
2094
|
+
const date2 = /* @__PURE__ */ new Date(0);
|
|
2095
|
+
date2.setUTCFullYear(year, month - 1, day);
|
|
2096
|
+
if (date2.getUTCMonth() !== month - 1) return formulaFailure("value", "DATE is not a real day");
|
|
2097
|
+
return (date2.getTime() - Date.UTC(1899, 11, 30)) / 864e5;
|
|
2098
|
+
}
|
|
2099
|
+
var angleToLocal = (frame, angle) => angle - frame.angle;
|
|
2100
|
+
function localToParent(frame, x, y) {
|
|
2101
|
+
const dx = x - frame.locPinX, dy = y - frame.locPinY, cos = Math.cos(frame.angle), sin = Math.sin(frame.angle);
|
|
2102
|
+
return [frame.pinX + dx * cos - dy * sin, frame.pinY + dx * sin + dy * cos];
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2051
2105
|
// visio/formula-text-functions.ts
|
|
2052
2106
|
var textResultFunctions = /* @__PURE__ */ new Set([
|
|
2053
2107
|
"MID",
|
|
@@ -2059,12 +2113,15 @@ var textResultFunctions = /* @__PURE__ */ new Set([
|
|
|
2059
2113
|
"SUBSTITUTE",
|
|
2060
2114
|
"REPLACE",
|
|
2061
2115
|
"CHAR",
|
|
2062
|
-
"INDEX"
|
|
2116
|
+
"INDEX",
|
|
2117
|
+
"FORMAT",
|
|
2118
|
+
"SHAPETEXT"
|
|
2063
2119
|
]);
|
|
2064
2120
|
var textNumberFunctions = /* @__PURE__ */ new Set([
|
|
2065
2121
|
"LEN",
|
|
2066
2122
|
"FIND",
|
|
2067
2123
|
"STRSAME",
|
|
2124
|
+
"STRSAMEEX",
|
|
2068
2125
|
"LOOKUP"
|
|
2069
2126
|
]);
|
|
2070
2127
|
var LIST_SEPARATOR = ";";
|
|
@@ -2080,6 +2137,7 @@ function exactInteger(context, node3, name3) {
|
|
|
2080
2137
|
if (!Number.isInteger(value3.value)) return unsupported2(`${name3} with a fractional number`);
|
|
2081
2138
|
return value3.value;
|
|
2082
2139
|
}
|
|
2140
|
+
var isTheText = (node3) => node3.kind === "reference" && node3.reference.cell.toLowerCase() === "thetext";
|
|
2083
2141
|
function evaluateFormulaText(node3, context, depth = 0) {
|
|
2084
2142
|
context.tick();
|
|
2085
2143
|
if (depth > 64) return formulaFailure("limit", "Formula evaluation limit");
|
|
@@ -2090,6 +2148,10 @@ function evaluateFormulaText(node3, context, depth = 0) {
|
|
|
2090
2148
|
if (node3.kind === "string") return node3.value;
|
|
2091
2149
|
if (node3.kind === "binary" && node3.operator === "&")
|
|
2092
2150
|
return text5(node3.left, "&") + text5(node3.right, "&");
|
|
2151
|
+
if (node3.kind === "reference" && isTheText(node3)) {
|
|
2152
|
+
const read = context.textOf?.(node3.reference);
|
|
2153
|
+
return read === void 0 ? unsupported2("Text read from a cell") : read;
|
|
2154
|
+
}
|
|
2093
2155
|
if (node3.kind !== "call") {
|
|
2094
2156
|
let value3;
|
|
2095
2157
|
try {
|
|
@@ -2111,6 +2173,12 @@ function evaluateFormulaText(node3, context, depth = 0) {
|
|
|
2111
2173
|
if (value3.unit !== "scalar") return unsupported2("Text from a number with a unit");
|
|
2112
2174
|
return String(value3.value);
|
|
2113
2175
|
}
|
|
2176
|
+
if (name3 === "SHAPETEXT") {
|
|
2177
|
+
arity(1);
|
|
2178
|
+
const target2 = args[0];
|
|
2179
|
+
if (!isTheText(target2)) return unsupported2("SHAPETEXT of something other than TheText");
|
|
2180
|
+
return text5(target2, name3);
|
|
2181
|
+
}
|
|
2114
2182
|
if (name3 === "MID") {
|
|
2115
2183
|
arity(3);
|
|
2116
2184
|
const source = text5(args[0], name3), start = integer(context, args[1], name3), length = integer(context, args[2], name3);
|
|
@@ -2165,6 +2233,10 @@ function evaluateFormulaText(node3, context, depth = 0) {
|
|
|
2165
2233
|
if (code >= 128 && code <= 159) return unsupported2("CHAR in the Windows-1252 range");
|
|
2166
2234
|
return String.fromCharCode(code);
|
|
2167
2235
|
}
|
|
2236
|
+
if (name3 === "FORMAT") {
|
|
2237
|
+
arity(2);
|
|
2238
|
+
return formatNumberPicture(context.number(args[0]), text5(args[1], name3));
|
|
2239
|
+
}
|
|
2168
2240
|
arity(2);
|
|
2169
2241
|
const index2 = integer(context, args[0], name3);
|
|
2170
2242
|
const items = text5(args[1], name3).split(LIST_SEPARATOR);
|
|
@@ -2197,6 +2269,11 @@ function evaluateTextNumberFunction(name3, args, context) {
|
|
|
2197
2269
|
const ignoreCase = args[2] ? context.number(args[2]).value !== 0 : false;
|
|
2198
2270
|
return scalar4(ignoreCase ? Number(a2.toLowerCase() === b.toLowerCase()) : Number(a2 === b));
|
|
2199
2271
|
}
|
|
2272
|
+
if (name3 === "STRSAMEEX") {
|
|
2273
|
+
if (args.length === 4) return formulaFailure("unsupported", "STRSAMEEX with a locale");
|
|
2274
|
+
arity(3);
|
|
2275
|
+
return scalar4(Number(strSameEx(text5(0), text5(1), context.number(args[2]).value)));
|
|
2276
|
+
}
|
|
2200
2277
|
arity(2);
|
|
2201
2278
|
const wanted = text5(0).toLowerCase();
|
|
2202
2279
|
return scalar4(
|
|
@@ -2204,6 +2281,23 @@ function evaluateTextNumberFunction(name3, args, context) {
|
|
|
2204
2281
|
);
|
|
2205
2282
|
}
|
|
2206
2283
|
|
|
2284
|
+
// visio/formula-indirect.ts
|
|
2285
|
+
var FRAME_INPUTS = {
|
|
2286
|
+
ANGLETOLOC: ["Angle", "FlipX", "FlipY"],
|
|
2287
|
+
LOCTOPAR: ["PinX", "PinY", "LocPinX", "LocPinY", "Angle", "FlipX", "FlipY"]
|
|
2288
|
+
};
|
|
2289
|
+
function literalIndirectTarget(node3) {
|
|
2290
|
+
if (node3.kind !== "call" || node3.args.length !== 1) return void 0;
|
|
2291
|
+
const address = node3.args[0];
|
|
2292
|
+
if (address.kind !== "string") return void 0;
|
|
2293
|
+
try {
|
|
2294
|
+
const target2 = parseVisioFormula(address.value);
|
|
2295
|
+
return target2.kind === "reference" && !(target2.reference.shapeId === void 0 && /^(true|false)$/i.test(target2.reference.cell)) && target2.reference.cell.toLowerCase() !== "thetext" ? target2.reference : void 0;
|
|
2296
|
+
} catch {
|
|
2297
|
+
return void 0;
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2207
2301
|
// visio/formula-math-functions.ts
|
|
2208
2302
|
var mathFormulaFunctions = /* @__PURE__ */ new Set([
|
|
2209
2303
|
"ROUND",
|
|
@@ -2308,7 +2402,7 @@ function evaluateMathFormulaFunction(name3, args) {
|
|
|
2308
2402
|
return formulaFailure("unsupported", `Unsupported function ${name3}`);
|
|
2309
2403
|
}
|
|
2310
2404
|
|
|
2311
|
-
// visio/formula-
|
|
2405
|
+
// visio/formula-analyze.ts
|
|
2312
2406
|
var supported = /* @__PURE__ */ new Set([
|
|
2313
2407
|
"GUARD",
|
|
2314
2408
|
"IF",
|
|
@@ -2330,6 +2424,11 @@ var supported = /* @__PURE__ */ new Set([
|
|
|
2330
2424
|
"PNTY",
|
|
2331
2425
|
"ISERROR",
|
|
2332
2426
|
"IFERROR",
|
|
2427
|
+
"INDIRECT",
|
|
2428
|
+
"DATE",
|
|
2429
|
+
"ANGLETOLOC",
|
|
2430
|
+
"LOCTOPAR",
|
|
2431
|
+
"SHEETREF",
|
|
2333
2432
|
...textNumberFunctions,
|
|
2334
2433
|
...textResultFunctions,
|
|
2335
2434
|
...numericFormulaFunctions,
|
|
@@ -2382,10 +2481,11 @@ var staticUnsupported = /* @__PURE__ */ new Set([
|
|
|
2382
2481
|
"MSOTINT",
|
|
2383
2482
|
"SHADE",
|
|
2384
2483
|
"LUMDIFF",
|
|
2385
|
-
"MODULUS"
|
|
2484
|
+
"MODULUS",
|
|
2485
|
+
// Reads an argument of the master the shape was dropped from; pure, evaluated in master scope.
|
|
2486
|
+
"ARG"
|
|
2386
2487
|
]);
|
|
2387
2488
|
var dynamic = /* @__PURE__ */ new Set([
|
|
2388
|
-
"INDIRECT",
|
|
2389
2489
|
"EVALCELL",
|
|
2390
2490
|
"EVALTEXT",
|
|
2391
2491
|
"DEPENDSON",
|
|
@@ -2402,6 +2502,19 @@ var dynamic = /* @__PURE__ */ new Set([
|
|
|
2402
2502
|
"PAR"
|
|
2403
2503
|
]);
|
|
2404
2504
|
var isClassifiedVisioFunction = (name3) => supported.has(name3) || staticUnsupported.has(name3) || dynamic.has(name3);
|
|
2505
|
+
var opaqueFunctions = /* @__PURE__ */ new Set([
|
|
2506
|
+
"EVALCELL",
|
|
2507
|
+
"EVALTEXT",
|
|
2508
|
+
"GETREF",
|
|
2509
|
+
"REF",
|
|
2510
|
+
"_SHEETCELL",
|
|
2511
|
+
// Structure lookups: the result changes when shapes are created, moved or reparented.
|
|
2512
|
+
"CONTAINERSHEETREF",
|
|
2513
|
+
"MEMBERSHEETREF",
|
|
2514
|
+
"CALLOUTTARGET",
|
|
2515
|
+
"PARENT",
|
|
2516
|
+
"PAR"
|
|
2517
|
+
]);
|
|
2405
2518
|
function traverse(ast, limits, visit) {
|
|
2406
2519
|
const maxNodes = formulaLimit(limits.maxNodes, 1024), maxDepth = formulaLimit(limits.maxDepth, 64);
|
|
2407
2520
|
const queue = [[ast, 0]];
|
|
@@ -2419,7 +2532,7 @@ function traverse(ast, limits, visit) {
|
|
|
2419
2532
|
function analyzeVisioFormula(source, limits = {}) {
|
|
2420
2533
|
const ast = typeof source === "string" ? parseVisioFormula(source, limits) : source;
|
|
2421
2534
|
const references = /* @__PURE__ */ new Map(), unsupportedFunctions = /* @__PURE__ */ new Set();
|
|
2422
|
-
let unsafe2 = false, guarded = false;
|
|
2535
|
+
let unsafe2 = false, opaque = false, guarded = false;
|
|
2423
2536
|
traverse(ast, limits, (node3) => {
|
|
2424
2537
|
if (node3.kind === "reference")
|
|
2425
2538
|
references.set(
|
|
@@ -2429,9 +2542,23 @@ function analyzeVisioFormula(source, limits = {}) {
|
|
|
2429
2542
|
if (node3.kind === "call") {
|
|
2430
2543
|
const inputs = node3.name === "ISTHEMED" ? ["ColorSchemeIndex"] : ["THEMEVAL", "THEME"].includes(node3.name) ? themeInputs : [];
|
|
2431
2544
|
for (const cell of inputs) references.set(`!${cell.toLowerCase()}`, { cell });
|
|
2545
|
+
for (const cell of FRAME_INPUTS[node3.name] ?? [])
|
|
2546
|
+
references.set(`!${cell.toLowerCase()}`, { cell });
|
|
2547
|
+
if (node3.name === "INDIRECT") {
|
|
2548
|
+
const target2 = literalIndirectTarget(node3);
|
|
2549
|
+
if (target2 && limits.literalIndirect)
|
|
2550
|
+
references.set(`${target2.shapeId ?? ""}!${target2.cell.toLowerCase()}`, target2);
|
|
2551
|
+
else {
|
|
2552
|
+
unsafe2 = true;
|
|
2553
|
+
opaque = true;
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2432
2556
|
if (!supported.has(node3.name)) unsupportedFunctions.add(node3.name);
|
|
2433
|
-
|
|
2557
|
+
const shapeText2 = node3.name === "SHAPETEXT" && limits.shapeTextReads === true && node3.args.length === 1 && isTheText(node3.args[0]);
|
|
2558
|
+
if (dynamic.has(node3.name) && !shapeText2 || !supported.has(node3.name) && !staticUnsupported.has(node3.name))
|
|
2434
2559
|
unsafe2 = true;
|
|
2560
|
+
if (opaqueFunctions.has(node3.name) || node3.name === "SHAPETEXT" && !shapeText2 || !supported.has(node3.name) && !staticUnsupported.has(node3.name) && !dynamic.has(node3.name) && node3.name !== "_SHEETCALL")
|
|
2561
|
+
opaque = true;
|
|
2435
2562
|
if (node3.name === "GUARD") guarded = true;
|
|
2436
2563
|
}
|
|
2437
2564
|
});
|
|
@@ -2439,10 +2566,56 @@ function analyzeVisioFormula(source, limits = {}) {
|
|
|
2439
2566
|
references: [...references.values()],
|
|
2440
2567
|
unsupportedFunctions: [...unsupportedFunctions],
|
|
2441
2568
|
dynamic: unsafe2,
|
|
2569
|
+
opaque,
|
|
2442
2570
|
guarded
|
|
2443
2571
|
};
|
|
2444
2572
|
}
|
|
2445
|
-
|
|
2573
|
+
|
|
2574
|
+
// visio/formula-bound.ts
|
|
2575
|
+
function evaluateBound(args, arg) {
|
|
2576
|
+
if (args.length < 5 || (args.length - 2) % 3 !== 0 || args.length > 302)
|
|
2577
|
+
return formulaFailure("arity", "Invalid BOUND argument count");
|
|
2578
|
+
const value3 = arg(0), type = arg(1);
|
|
2579
|
+
if (type.unit !== "scalar" || ![0, 1, 2].includes(type.value))
|
|
2580
|
+
return formulaFailure("value", "BOUND type must be 0, 1 or 2");
|
|
2581
|
+
if (type.value === 2) return value3;
|
|
2582
|
+
if (type.value === 1) {
|
|
2583
|
+
let current = value3.value, unit4 = value3.unit;
|
|
2584
|
+
for (let pass = 0; pass <= (args.length - 2) / 3; pass++) {
|
|
2585
|
+
let moved = false;
|
|
2586
|
+
for (let index2 = 2; index2 < args.length; index2 += 3) {
|
|
2587
|
+
if (arg(index2).value !== 0) continue;
|
|
2588
|
+
const a2 = arg(index2 + 1), b = arg(index2 + 2);
|
|
2589
|
+
unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, a2);
|
|
2590
|
+
unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, b);
|
|
2591
|
+
const low = Math.min(a2.value, b.value), high = Math.max(a2.value, b.value);
|
|
2592
|
+
if (current > low && current < high) {
|
|
2593
|
+
current = current - low < high - current ? low : high;
|
|
2594
|
+
moved = true;
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
if (!moved) break;
|
|
2598
|
+
}
|
|
2599
|
+
return finiteFormulaValue({ value: current, unit: unit4 });
|
|
2600
|
+
}
|
|
2601
|
+
let nearest;
|
|
2602
|
+
let unit3 = value3.unit;
|
|
2603
|
+
for (let index2 = 2; index2 < args.length; index2 += 3) {
|
|
2604
|
+
if (arg(index2).value !== 0) continue;
|
|
2605
|
+
const a2 = arg(index2 + 1), b = arg(index2 + 2);
|
|
2606
|
+
unit3 = compatibleFormulaUnits({ value: value3.value, unit: unit3 }, a2);
|
|
2607
|
+
unit3 = compatibleFormulaUnits({ value: value3.value, unit: unit3 }, b);
|
|
2608
|
+
const low = Math.min(a2.value, b.value), high = Math.max(a2.value, b.value);
|
|
2609
|
+
if (value3.value >= low && value3.value <= high) return finiteFormulaValue({ value: value3.value, unit: unit3 });
|
|
2610
|
+
const edge2 = value3.value < low ? low : high;
|
|
2611
|
+
if (nearest === void 0 || Math.abs(edge2 - value3.value) < Math.abs(nearest - value3.value))
|
|
2612
|
+
nearest = edge2;
|
|
2613
|
+
}
|
|
2614
|
+
return finiteFormulaValue({ value: nearest ?? value3.value, unit: unit3 });
|
|
2615
|
+
}
|
|
2616
|
+
|
|
2617
|
+
// visio/formula-operators.ts
|
|
2618
|
+
function binaryOperator(operator, a2, b) {
|
|
2446
2619
|
let unit3;
|
|
2447
2620
|
if (operator === "+" || operator === "-") {
|
|
2448
2621
|
unit3 = compatibleFormulaUnits(a2, b);
|
|
@@ -2472,12 +2645,36 @@ function binary(operator, a2, b) {
|
|
|
2472
2645
|
return formulaFailure("syntax", `Unsupported operator ${operator}`);
|
|
2473
2646
|
return { value: comparisons[operator] ? 1 : 0, unit: "scalar" };
|
|
2474
2647
|
}
|
|
2648
|
+
function evaluatedShapeFrame(sheet, resolve) {
|
|
2649
|
+
if (sheet.kind !== "call" || sheet.name !== "SHEETREF" || sheet.args.length)
|
|
2650
|
+
return formulaFailure("unsupported", "A sheet other than SHEETREF()");
|
|
2651
|
+
const read = (cell, fallback) => {
|
|
2652
|
+
try {
|
|
2653
|
+
return finiteFormulaValue(resolve({ cell })).value;
|
|
2654
|
+
} catch (error) {
|
|
2655
|
+
if (fallback === void 0) throw error;
|
|
2656
|
+
return fallback;
|
|
2657
|
+
}
|
|
2658
|
+
};
|
|
2659
|
+
if (read("FlipX", 0) !== 0 || read("FlipY", 0) !== 0)
|
|
2660
|
+
return formulaFailure("unsupported", "A coordinate conversion on a flipped shape");
|
|
2661
|
+
return {
|
|
2662
|
+
pinX: read("PinX"),
|
|
2663
|
+
pinY: read("PinY"),
|
|
2664
|
+
locPinX: read("LocPinX", 0),
|
|
2665
|
+
locPinY: read("LocPinY", 0),
|
|
2666
|
+
angle: read("Angle", 0)
|
|
2667
|
+
};
|
|
2668
|
+
}
|
|
2669
|
+
|
|
2670
|
+
// visio/formula-evaluate.ts
|
|
2475
2671
|
function evaluateVisioFormula(source, resolve, limits = {}) {
|
|
2476
2672
|
const ast = typeof source === "string" ? parseVisioFormula(source, limits) : source;
|
|
2477
2673
|
const maxSteps = formulaLimit(limits.maxSteps, 8192), maxDepth = formulaLimit(limits.maxDepth, 64);
|
|
2478
2674
|
traverse(ast, limits, () => {
|
|
2479
2675
|
});
|
|
2480
2676
|
let steps = 0;
|
|
2677
|
+
const shapeFrame = (sheet) => evaluatedShapeFrame(sheet, resolve);
|
|
2481
2678
|
const evaluate = (node3, depth = 0) => {
|
|
2482
2679
|
if (++steps > maxSteps || depth > maxDepth)
|
|
2483
2680
|
return formulaFailure("limit", "Formula evaluation limit");
|
|
@@ -2501,7 +2698,7 @@ function evaluateVisioFormula(source, resolve, limits = {}) {
|
|
|
2501
2698
|
else if (right2.unit === "length" && left.unit === "scalar" && node3.left.kind === "number")
|
|
2502
2699
|
left = { ...left, unit: "length" };
|
|
2503
2700
|
}
|
|
2504
|
-
return
|
|
2701
|
+
return binaryOperator(node3.operator, left, right2);
|
|
2505
2702
|
}
|
|
2506
2703
|
const name3 = node3.name;
|
|
2507
2704
|
if ((name3 === "TEXTWIDTH" || name3 === "TEXTHEIGHT") && limits.text) {
|
|
@@ -2530,18 +2727,57 @@ function evaluateVisioFormula(source, resolve, limits = {}) {
|
|
|
2530
2727
|
return formulaFailure("context", `${name3} requires a valid document context`);
|
|
2531
2728
|
return { value: value4, unit: "scalar" };
|
|
2532
2729
|
}
|
|
2730
|
+
const textContext = {
|
|
2731
|
+
number: (child4) => evaluate(child4, depth + 1),
|
|
2732
|
+
...limits.textOf ? { textOf: limits.textOf } : {},
|
|
2733
|
+
tick: () => {
|
|
2734
|
+
if (++steps > maxSteps) formulaFailure("limit", "Formula evaluation limit");
|
|
2735
|
+
}
|
|
2736
|
+
};
|
|
2533
2737
|
if (textNumberFunctions.has(name3))
|
|
2534
|
-
return evaluateTextNumberFunction(name3, node3.args,
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2738
|
+
return evaluateTextNumberFunction(name3, node3.args, textContext);
|
|
2739
|
+
if (name3 === "INDIRECT") {
|
|
2740
|
+
arity(1);
|
|
2741
|
+
const target2 = parseVisioFormula(evaluateFormulaText(node3.args[0], textContext, 1));
|
|
2742
|
+
if (target2.kind !== "reference")
|
|
2743
|
+
return formulaFailure("value", "INDIRECT needs a cell address");
|
|
2744
|
+
return finiteFormulaValue(resolve(target2.reference));
|
|
2745
|
+
}
|
|
2746
|
+
if (name3 === "DATE") {
|
|
2747
|
+
arity(3);
|
|
2748
|
+
const [year, month, day] = node3.args.map((_, index2) => {
|
|
2749
|
+
const part = arg(index2);
|
|
2750
|
+
if (part.unit !== "scalar") return formulaFailure("unit", "DATE requires plain numbers");
|
|
2751
|
+
return part.value;
|
|
2539
2752
|
});
|
|
2753
|
+
return { value: visioDateSerial(year, month, day), unit: "time" };
|
|
2754
|
+
}
|
|
2755
|
+
if (name3 === "SHEETREF" || name3 === "LOCTOPAR")
|
|
2756
|
+
return formulaFailure("unsupported", `${name3} does not return a number`);
|
|
2757
|
+
if (name3 === "ANGLETOLOC") {
|
|
2758
|
+
arity(2);
|
|
2759
|
+
const angle = arg(1);
|
|
2760
|
+
if (angle.unit !== "angle" && angle.unit !== "scalar")
|
|
2761
|
+
return formulaFailure("unit", "ANGLETOLOC requires an angle");
|
|
2762
|
+
return { value: angleToLocal(shapeFrame(node3.args[0]), angle.value), unit: "angle" };
|
|
2763
|
+
}
|
|
2540
2764
|
if (textResultFunctions.has(name3) || name3 === "PNT")
|
|
2541
2765
|
return formulaFailure("unsupported", `${name3} does not return a number`);
|
|
2542
2766
|
if (name3 === "PNTX" || name3 === "PNTY") {
|
|
2543
2767
|
arity(1);
|
|
2544
2768
|
const point2 = node3.args[0];
|
|
2769
|
+
if (point2.kind === "call" && point2.name === "LOCTOPAR") {
|
|
2770
|
+
if (point2.args.length !== 3)
|
|
2771
|
+
return formulaFailure("arity", "Invalid LOCTOPAR argument count");
|
|
2772
|
+
const [x2, y2] = [1, 2].map((index2) => {
|
|
2773
|
+
const part = evaluate(point2.args[index2], depth + 2);
|
|
2774
|
+
if (part.unit !== "scalar" && part.unit !== "length")
|
|
2775
|
+
return formulaFailure("unit", "LOCTOPAR requires lengths");
|
|
2776
|
+
return part.value;
|
|
2777
|
+
});
|
|
2778
|
+
const parent = localToParent(shapeFrame(point2.args[0]), x2, y2);
|
|
2779
|
+
return finiteFormulaValue({ value: parent[name3 === "PNTX" ? 0 : 1], unit: "length" });
|
|
2780
|
+
}
|
|
2545
2781
|
if (point2.kind !== "call" || point2.name !== "PNT")
|
|
2546
2782
|
return formulaFailure("unsupported", `${name3} of something other than PNT(x,y)`);
|
|
2547
2783
|
if (point2.args.length !== 2) return formulaFailure("arity", "Invalid PNT argument count");
|
|
@@ -2599,47 +2835,7 @@ function evaluateVisioFormula(source, resolve, limits = {}) {
|
|
|
2599
2835
|
}
|
|
2600
2836
|
return finiteFormulaValue(result2);
|
|
2601
2837
|
}
|
|
2602
|
-
if (name3 === "BOUND")
|
|
2603
|
-
if (node3.args.length < 5 || (node3.args.length - 2) % 3 !== 0 || node3.args.length > 302)
|
|
2604
|
-
return formulaFailure("arity", "Invalid BOUND argument count");
|
|
2605
|
-
const value4 = arg(0), type = arg(1);
|
|
2606
|
-
if (type.unit !== "scalar" || ![0, 1, 2].includes(type.value))
|
|
2607
|
-
return formulaFailure("value", "BOUND type must be 0, 1 or 2");
|
|
2608
|
-
if (type.value === 2) return value4;
|
|
2609
|
-
if (type.value === 1) {
|
|
2610
|
-
let current = value4.value, unit4 = value4.unit;
|
|
2611
|
-
for (let pass = 0; pass <= (node3.args.length - 2) / 3; pass++) {
|
|
2612
|
-
let moved = false;
|
|
2613
|
-
for (let index2 = 2; index2 < node3.args.length; index2 += 3) {
|
|
2614
|
-
if (arg(index2).value !== 0) continue;
|
|
2615
|
-
const a2 = arg(index2 + 1), b = arg(index2 + 2);
|
|
2616
|
-
unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, a2);
|
|
2617
|
-
unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, b);
|
|
2618
|
-
const low = Math.min(a2.value, b.value), high = Math.max(a2.value, b.value);
|
|
2619
|
-
if (current > low && current < high) {
|
|
2620
|
-
current = current - low < high - current ? low : high;
|
|
2621
|
-
moved = true;
|
|
2622
|
-
}
|
|
2623
|
-
}
|
|
2624
|
-
if (!moved) break;
|
|
2625
|
-
}
|
|
2626
|
-
return finiteFormulaValue({ value: current, unit: unit4 });
|
|
2627
|
-
}
|
|
2628
|
-
let nearest;
|
|
2629
|
-
let unit3 = value4.unit;
|
|
2630
|
-
for (let index2 = 2; index2 < node3.args.length; index2 += 3) {
|
|
2631
|
-
if (arg(index2).value !== 0) continue;
|
|
2632
|
-
const a2 = arg(index2 + 1), b = arg(index2 + 2);
|
|
2633
|
-
unit3 = compatibleFormulaUnits({ value: value4.value, unit: unit3 }, a2);
|
|
2634
|
-
unit3 = compatibleFormulaUnits({ value: value4.value, unit: unit3 }, b);
|
|
2635
|
-
const low = Math.min(a2.value, b.value), high = Math.max(a2.value, b.value);
|
|
2636
|
-
if (value4.value >= low && value4.value <= high) return finiteFormulaValue({ value: value4.value, unit: unit3 });
|
|
2637
|
-
const edge2 = value4.value < low ? low : high;
|
|
2638
|
-
if (nearest === void 0 || Math.abs(edge2 - value4.value) < Math.abs(nearest - value4.value))
|
|
2639
|
-
nearest = edge2;
|
|
2640
|
-
}
|
|
2641
|
-
return finiteFormulaValue({ value: nearest ?? value4.value, unit: unit3 });
|
|
2642
|
-
}
|
|
2838
|
+
if (name3 === "BOUND") return evaluateBound(node3.args, arg);
|
|
2643
2839
|
if (name3 === "ATAN2") {
|
|
2644
2840
|
arity(2);
|
|
2645
2841
|
const y = arg(0), x = arg(1);
|
|
@@ -2789,14 +2985,18 @@ function parseVisioFormula(source, limits = {}) {
|
|
|
2789
2985
|
offset += identifier[0].length;
|
|
2790
2986
|
whitespace();
|
|
2791
2987
|
if (source[offset] === "(") {
|
|
2792
|
-
|
|
2988
|
+
const qualified = /^Sheet\.(\d+)!([A-Za-z_][A-Za-z_0-9]*)$/i.exec(identifier[0]);
|
|
2989
|
+
if (!qualified && !/^[A-Za-z_][A-Za-z_0-9]*$/.test(identifier[0]))
|
|
2793
2990
|
return formulaFailure("syntax", "Qualified function names are unsupported");
|
|
2794
2991
|
offset++;
|
|
2795
2992
|
const args = [];
|
|
2796
2993
|
whitespace();
|
|
2797
2994
|
if (source[offset] !== ")") {
|
|
2798
2995
|
for (; ; ) {
|
|
2799
|
-
|
|
2996
|
+
whitespace();
|
|
2997
|
+
args.push(
|
|
2998
|
+
/^[,)]/.test(source.slice(offset)) ? node3({ kind: "string", value: "" }) : expression(0, depth + 1)
|
|
2999
|
+
);
|
|
2800
3000
|
whitespace();
|
|
2801
3001
|
if (source[offset] !== ",") break;
|
|
2802
3002
|
offset++;
|
|
@@ -2804,7 +3004,27 @@ function parseVisioFormula(source, limits = {}) {
|
|
|
2804
3004
|
}
|
|
2805
3005
|
if (source[offset++] !== ")")
|
|
2806
3006
|
return formulaFailure("syntax", "Expected function closing parenthesis");
|
|
2807
|
-
left = node3({
|
|
3007
|
+
left = node3({
|
|
3008
|
+
kind: "call",
|
|
3009
|
+
name: (qualified ? qualified[2] : identifier[0]).toUpperCase(),
|
|
3010
|
+
args
|
|
3011
|
+
});
|
|
3012
|
+
if (qualified)
|
|
3013
|
+
left = node3({
|
|
3014
|
+
kind: "call",
|
|
3015
|
+
name: "_SHEETCALL",
|
|
3016
|
+
args: [node3({ kind: "string", value: qualified[1] }), left]
|
|
3017
|
+
});
|
|
3018
|
+
whitespace();
|
|
3019
|
+
const member = source[offset] === "!" && /^!([A-Za-z_][A-Za-z_0-9.]*)/.exec(source.slice(offset));
|
|
3020
|
+
if (member) {
|
|
3021
|
+
offset += member[0].length;
|
|
3022
|
+
left = node3({
|
|
3023
|
+
kind: "call",
|
|
3024
|
+
name: "_SHEETCELL",
|
|
3025
|
+
args: [left, node3({ kind: "string", value: member[1] })]
|
|
3026
|
+
});
|
|
3027
|
+
}
|
|
2808
3028
|
} else {
|
|
2809
3029
|
const ref = /^Sheet\.(\d+)!(.+)$/i.exec(identifier[0]);
|
|
2810
3030
|
left = node3({
|
|
@@ -4391,20 +4611,36 @@ function indexCells(roots, options2) {
|
|
|
4391
4611
|
if (executableCellFormula(source) && !independentTextFieldFormula(node3, source) && !inertDoubleClickFormula(cell, source) && !(glue2 && isNativeGlueCell(cell, source)) && // A trigger only counts events of the sheet it names; an unglued connector keeps one
|
|
4392
4612
|
// (Visio's freshly dropped connector names its own sheet).
|
|
4393
4613
|
!(/^(BegTrigger|EndTrigger)$/.test(cell) && isNativeGlueCell(cell, source))) {
|
|
4614
|
+
const lenient = options2.scope === "affected";
|
|
4615
|
+
const unprovable = (message, opaque) => {
|
|
4616
|
+
if (!lenient) fail("EDIT_UNKNOWN_DEPENDENCY", message);
|
|
4617
|
+
item2.unsafe = true;
|
|
4618
|
+
item2.refusal = message;
|
|
4619
|
+
if (opaque) item2.opaque = true;
|
|
4620
|
+
};
|
|
4394
4621
|
try {
|
|
4395
4622
|
item2.formula = parseVisioFormula(source);
|
|
4396
|
-
const plain4 = analyzeVisioFormula(item2.formula
|
|
4623
|
+
const plain4 = analyzeVisioFormula(item2.formula, {
|
|
4624
|
+
shapeTextReads: true,
|
|
4625
|
+
literalIndirect: true
|
|
4626
|
+
});
|
|
4397
4627
|
const analysis = plain4.dynamic && textSizeFormula(item2.formula) || plain4;
|
|
4398
|
-
if (analysis.dynamic)
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4628
|
+
if (analysis.dynamic) {
|
|
4629
|
+
if (!lenient)
|
|
4630
|
+
fail(
|
|
4631
|
+
"EDIT_DYNAMIC_DEPENDENCY",
|
|
4632
|
+
"Dynamic ShapeSheet dependencies cannot be safely edited."
|
|
4633
|
+
);
|
|
4634
|
+
unprovable(
|
|
4635
|
+
`${cell} on shape ${sheet.shapeId || "page"} has dynamic ShapeSheet dependencies that cannot be followed.`,
|
|
4636
|
+
"opaque" in analysis && analysis.opaque
|
|
4402
4637
|
);
|
|
4638
|
+
}
|
|
4403
4639
|
item2.dependencies = analysis.references.filter((ref) => !isBooleanLiteral(ref)).map((ref) => key({ pageId: pageId2, shapeId: ref.shapeId ?? sheet.shapeId, cell: ref.cell }));
|
|
4404
4640
|
} catch (error) {
|
|
4405
|
-
|
|
4406
|
-
"
|
|
4407
|
-
|
|
4641
|
+
unprovable(
|
|
4642
|
+
`Cannot prove ShapeSheet dependency closure: ${error instanceof Error ? error.message : "invalid formula"}`,
|
|
4643
|
+
true
|
|
4408
4644
|
);
|
|
4409
4645
|
}
|
|
4410
4646
|
}
|
|
@@ -4487,13 +4723,20 @@ function createVisioCellEvaluator(cells4, options2 = {}, verifyCaches = false) {
|
|
|
4487
4723
|
if (!item2 || item2.unsafe && (!item2.node || !options2.masterMovePins?.has(item2.node) && !options2.groupRotationCells?.has(item2.node)))
|
|
4488
4724
|
fail(
|
|
4489
4725
|
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
4490
|
-
"Affected formula references missing, inherited or grouped cells."
|
|
4726
|
+
item2?.refusal ? `Affected formula cannot be evaluated: ${item2.refusal}` : "Affected formula references missing, inherited or grouped cells."
|
|
4491
4727
|
);
|
|
4492
4728
|
if (item2.node?.hasAttribute("E"))
|
|
4493
4729
|
fail("EDIT_FORMULA_ERROR", "Affected ShapeSheet cell has an error cache.");
|
|
4494
4730
|
active.add(id3);
|
|
4731
|
+
try {
|
|
4732
|
+
return evaluateCell(id3, item2);
|
|
4733
|
+
} finally {
|
|
4734
|
+
active.delete(id3);
|
|
4735
|
+
}
|
|
4736
|
+
};
|
|
4737
|
+
const evaluateCell = (id3, item2) => {
|
|
4495
4738
|
let result2;
|
|
4496
|
-
const analysis = item2.formula ? analyzeVisioFormula(item2.formula) : void 0;
|
|
4739
|
+
const analysis = item2.formula ? analyzeVisioFormula(item2.formula, { literalIndirect: true }) : void 0;
|
|
4497
4740
|
if (item2.formula && item2.node && analysis.unsupportedFunctions.length) {
|
|
4498
4741
|
if (!textSizeFormula(item2.formula))
|
|
4499
4742
|
fail("EDIT_UNSUPPORTED_FORMULA", "Affected formula uses unsupported functions.");
|
|
@@ -4509,6 +4752,9 @@ function createVisioCellEvaluator(cells4, options2 = {}, verifyCaches = false) {
|
|
|
4509
4752
|
),
|
|
4510
4753
|
{
|
|
4511
4754
|
...options2.pageContext?.get(item2.pageId),
|
|
4755
|
+
...options2.textOf ? {
|
|
4756
|
+
textOf: (ref) => options2.textOf(item2.pageId, ref.shapeId ?? item2.shapeId)
|
|
4757
|
+
} : {},
|
|
4512
4758
|
onStep: () => {
|
|
4513
4759
|
if (--steps < 0)
|
|
4514
4760
|
fail("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
|
|
@@ -4532,16 +4778,63 @@ function createVisioCellEvaluator(cells4, options2 = {}, verifyCaches = false) {
|
|
|
4532
4778
|
if (Math.abs(cachedValue2.value - result2.value) > 1e-10 * Math.max(1, Math.abs(result2.value)))
|
|
4533
4779
|
fail("EDIT_FORMULA_CACHE", "Source formula and numeric cache disagree.");
|
|
4534
4780
|
}
|
|
4535
|
-
active.delete(id3);
|
|
4536
4781
|
values.set(id3, result2);
|
|
4537
4782
|
return result2;
|
|
4538
4783
|
};
|
|
4539
4784
|
return evaluate;
|
|
4540
4785
|
}
|
|
4541
4786
|
|
|
4787
|
+
// visio/edit-recalculate-text.ts
|
|
4788
|
+
function plainShapeText(root2, shapeId2) {
|
|
4789
|
+
if (!root2) return void 0;
|
|
4790
|
+
const pending2 = children2(children2(root2, "Shapes")[0], "Shape");
|
|
4791
|
+
while (pending2.length) {
|
|
4792
|
+
const shape = pending2.pop();
|
|
4793
|
+
if (attribute2(shape, "ID") === shapeId2) {
|
|
4794
|
+
if (shape.hasAttribute("Master") || shape.hasAttribute("MasterShape")) return void 0;
|
|
4795
|
+
if (children2(shape, "Section").some((section3) => attribute2(section3, "N") === "Field"))
|
|
4796
|
+
return void 0;
|
|
4797
|
+
const texts = children2(shape, "Text");
|
|
4798
|
+
if (texts.length > 1) return void 0;
|
|
4799
|
+
const node3 = texts[0];
|
|
4800
|
+
if (!node3) return "";
|
|
4801
|
+
const plain4 = Array.from(node3.childNodes).every(
|
|
4802
|
+
(item2) => item2.nodeType === 3 || item2.nodeType === 4
|
|
4803
|
+
);
|
|
4804
|
+
return plain4 ? decodeVisioPlainText(node3.textContent ?? "") : void 0;
|
|
4805
|
+
}
|
|
4806
|
+
pending2.push(...children2(children2(shape, "Shapes")[0], "Shape"));
|
|
4807
|
+
}
|
|
4808
|
+
return void 0;
|
|
4809
|
+
}
|
|
4810
|
+
var TEXT_READERS = /* @__PURE__ */ new Set([...textNumberFunctions, ...textResultFunctions]);
|
|
4811
|
+
function textReadFormula(source) {
|
|
4812
|
+
try {
|
|
4813
|
+
const ast = parseVisioFormula(source);
|
|
4814
|
+
const analysis = analyzeVisioFormula(ast, { shapeTextReads: true });
|
|
4815
|
+
if (analysis.dynamic || analysis.unsupportedFunctions.length) return false;
|
|
4816
|
+
const textResult = ast.kind === "string" || isTheText(ast) || ast.kind === "binary" && ast.operator === "&" || ast.kind === "call" && textResultFunctions.has(ast.name);
|
|
4817
|
+
if (textResult) return false;
|
|
4818
|
+
let reads = 0;
|
|
4819
|
+
const walk = (node3, parent) => {
|
|
4820
|
+
if (isTheText(node3)) {
|
|
4821
|
+
reads++;
|
|
4822
|
+
return parent?.kind === "call" && TEXT_READERS.has(parent.name);
|
|
4823
|
+
}
|
|
4824
|
+
if (node3.kind === "unary") return walk(node3.operand, node3);
|
|
4825
|
+
if (node3.kind === "binary") return walk(node3.left, node3) && walk(node3.right, node3);
|
|
4826
|
+
if (node3.kind === "call") return node3.args.every((arg) => walk(arg, node3));
|
|
4827
|
+
return true;
|
|
4828
|
+
};
|
|
4829
|
+
return walk(ast) && reads > 0;
|
|
4830
|
+
} catch {
|
|
4831
|
+
return false;
|
|
4832
|
+
}
|
|
4833
|
+
}
|
|
4834
|
+
|
|
4542
4835
|
// visio/edit-recalculate.ts
|
|
4543
4836
|
function recalculateVisioCells(roots, changed, options2 = {}) {
|
|
4544
|
-
const cells4 = indexCells(roots, options2);
|
|
4837
|
+
const cells4 = indexCells(roots, { scope: "affected", ...options2 });
|
|
4545
4838
|
const reverse = /* @__PURE__ */ new Map();
|
|
4546
4839
|
for (const [id3, item2] of cells4)
|
|
4547
4840
|
for (const dependency of item2.dependencies) {
|
|
@@ -4550,6 +4843,8 @@ function recalculateVisioCells(roots, changed, options2 = {}) {
|
|
|
4550
4843
|
reverse.set(dependency, next);
|
|
4551
4844
|
}
|
|
4552
4845
|
const affected = new Set(changed.map(key));
|
|
4846
|
+
const editedPages = new Set(changed.map((cell) => cell.pageId));
|
|
4847
|
+
for (const [id3, item2] of cells4) if (item2.opaque && editedPages.has(item2.pageId)) affected.add(id3);
|
|
4553
4848
|
const pending2 = [...affected];
|
|
4554
4849
|
const maxAffected = bound(options2.maxAffectedCells, 1e4);
|
|
4555
4850
|
for (let i = 0; i < pending2.length; i++) {
|
|
@@ -4562,13 +4857,29 @@ function recalculateVisioCells(roots, changed, options2 = {}) {
|
|
|
4562
4857
|
if (affected.size > maxAffected)
|
|
4563
4858
|
fail("LIMIT_FORMULA_AFFECTED", "Affected ShapeSheet cell limit exceeded.");
|
|
4564
4859
|
}
|
|
4565
|
-
const evaluate = createVisioCellEvaluator(cells4,
|
|
4860
|
+
const evaluate = createVisioCellEvaluator(cells4, {
|
|
4861
|
+
textOf: (pageId2, shapeId2) => plainShapeText(roots.get(pageId2), shapeId2),
|
|
4862
|
+
...options2
|
|
4863
|
+
});
|
|
4566
4864
|
const values = /* @__PURE__ */ new Map();
|
|
4567
|
-
for (const id3 of affected)
|
|
4865
|
+
for (const id3 of affected) {
|
|
4866
|
+
if (!cells4.has(id3) && /,"thetext"]$/.test(id3)) continue;
|
|
4867
|
+
try {
|
|
4868
|
+
values.set(id3, evaluate(id3));
|
|
4869
|
+
} catch (error) {
|
|
4870
|
+
if (options2.cycles !== "keep" || !(error instanceof VisioPackageError) || error.code !== "EDIT_FORMULA_CYCLE")
|
|
4871
|
+
throw error;
|
|
4872
|
+
const cyclic = cells4.get(id3);
|
|
4873
|
+
options2.diagnostics?.push({
|
|
4874
|
+
code: "FORMULA_CYCLE",
|
|
4875
|
+
message: `Kept the cached value of ${cyclic.cell} on shape ${cyclic.shapeId || "page"} (page ${cyclic.pageId}): it is part of, or depends on, a dependency cycle.`
|
|
4876
|
+
});
|
|
4877
|
+
}
|
|
4878
|
+
}
|
|
4568
4879
|
const pages = /* @__PURE__ */ new Set();
|
|
4569
4880
|
for (const id3 of affected) {
|
|
4570
4881
|
const item2 = cells4.get(id3);
|
|
4571
|
-
if (item2
|
|
4882
|
+
if (item2?.node && item2.formula && values.has(id3)) {
|
|
4572
4883
|
const value3 = String(values.get(id3).value);
|
|
4573
4884
|
if (item2.node.getAttribute("V") !== value3) {
|
|
4574
4885
|
item2.node.setAttribute("V", value3);
|
|
@@ -4579,15 +4890,29 @@ function recalculateVisioCells(roots, changed, options2 = {}) {
|
|
|
4579
4890
|
return [...pages];
|
|
4580
4891
|
}
|
|
4581
4892
|
function assertVisioShapesUnreferenced(roots, removed, options2 = {}) {
|
|
4582
|
-
const cells4 = indexCells(roots, options2);
|
|
4893
|
+
const cells4 = indexCells(roots, { scope: "affected", ...options2 });
|
|
4894
|
+
const frozen = [];
|
|
4583
4895
|
for (const cell of cells4.values()) {
|
|
4584
4896
|
options2.check?.();
|
|
4897
|
+
if (cell.opaque && removed.has(cell.pageId) && !removed.get(cell.pageId).has(cell.shapeId))
|
|
4898
|
+
fail(
|
|
4899
|
+
"EDIT_REFERENCED_DELETE",
|
|
4900
|
+
`${cell.cell} on shape ${cell.shapeId || "page"} may read the removed shape through a dynamic dependency.`
|
|
4901
|
+
);
|
|
4585
4902
|
if (removed.get(cell.pageId)?.has(cell.shapeId)) continue;
|
|
4586
4903
|
if (cell.dependencies.some((id3) => {
|
|
4587
4904
|
const parts = JSON.parse(id3);
|
|
4588
4905
|
return removed.get(parts[0])?.has(parts[1]) ?? false;
|
|
4589
|
-
}))
|
|
4590
|
-
|
|
4906
|
+
})) {
|
|
4907
|
+
if (!options2.freeze || !cell.node || !cell.formula || cell.unsafe || cell.node.hasAttribute("E") || analyzeVisioFormula(cell.formula, { literalIndirect: true }).guarded || !Number.isFinite(
|
|
4908
|
+
visioFormulaCachedValue(
|
|
4909
|
+
cell.node.getAttribute("V") ?? "",
|
|
4910
|
+
cell.node.getAttribute("U") ?? void 0
|
|
4911
|
+
).value
|
|
4912
|
+
))
|
|
4913
|
+
fail("EDIT_REFERENCED_DELETE", "Shape is referenced by a ShapeSheet formula.");
|
|
4914
|
+
frozen.push(cell.node);
|
|
4915
|
+
}
|
|
4591
4916
|
}
|
|
4592
4917
|
for (const [pageId2, ids] of removed)
|
|
4593
4918
|
for (const connections2 of children2(roots.get(pageId2), "Connects"))
|
|
@@ -4596,12 +4921,16 @@ function assertVisioShapesUnreferenced(roots, removed, options2 = {}) {
|
|
|
4596
4921
|
if (["FromSheet", "ToSheet"].some((name3) => ids.has(attribute2(connection, name3) ?? "")))
|
|
4597
4922
|
fail("EDIT_REFERENCED_DELETE", "Shape participates in a Connect record.");
|
|
4598
4923
|
}
|
|
4924
|
+
return frozen;
|
|
4599
4925
|
}
|
|
4926
|
+
var freezeVisioCells = (nodes) => {
|
|
4927
|
+
for (const node3 of nodes) node3.removeAttribute("F");
|
|
4928
|
+
};
|
|
4600
4929
|
function assertVisioShapeUnreferenced(roots, pageId2, shapeId2, options2 = {}) {
|
|
4601
|
-
assertVisioShapesUnreferenced(roots, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]), options2);
|
|
4930
|
+
return assertVisioShapesUnreferenced(roots, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]), options2);
|
|
4602
4931
|
}
|
|
4603
4932
|
function createVisioDependencyQuery(roots, options2 = {}) {
|
|
4604
|
-
const cells4 = indexCells(roots, options2);
|
|
4933
|
+
const cells4 = indexCells(roots, { scope: "affected", ...options2 });
|
|
4605
4934
|
return (source, targets) => {
|
|
4606
4935
|
const wanted = new Set(targets.map(key));
|
|
4607
4936
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -4616,7 +4945,7 @@ function createVisioDependencyQuery(roots, options2 = {}) {
|
|
|
4616
4945
|
if (seen.size > maxSteps) fail("LIMIT_FORMULA_STEPS", "Dependency analysis limit exceeded.");
|
|
4617
4946
|
const item2 = cells4.get(id3);
|
|
4618
4947
|
if (!item2 || item2.unsafe || item2.node?.hasAttribute("E")) return false;
|
|
4619
|
-
if (item2.formula && analyzeVisioFormula(item2.formula).unsupportedFunctions.length)
|
|
4948
|
+
if (item2.formula && analyzeVisioFormula(item2.formula, { literalIndirect: true }).unsupportedFunctions.length)
|
|
4620
4949
|
return false;
|
|
4621
4950
|
if (wanted.has(id3)) found = true;
|
|
4622
4951
|
else pending2.push(...item2.dependencies);
|
|
@@ -11944,10 +12273,10 @@ async function* streamEntryGuarded(entry3, alreadyRead, limits) {
|
|
|
11944
12273
|
}
|
|
11945
12274
|
}
|
|
11946
12275
|
function toBase64(bytes) {
|
|
11947
|
-
let
|
|
12276
|
+
let binary = "";
|
|
11948
12277
|
for (let i = 0; i < bytes.length; i += 32768)
|
|
11949
|
-
|
|
11950
|
-
return btoa(
|
|
12278
|
+
binary += String.fromCharCode(...bytes.subarray(i, i + 32768));
|
|
12279
|
+
return btoa(binary);
|
|
11951
12280
|
}
|
|
11952
12281
|
function guardZip(zip, limits = {}) {
|
|
11953
12282
|
const r = resolveLimits(limits);
|
|
@@ -14391,6 +14720,332 @@ function parseStyles(xml, warnings) {
|
|
|
14391
14720
|
return result2;
|
|
14392
14721
|
}
|
|
14393
14722
|
|
|
14723
|
+
// xlsx/read/print-options.ts
|
|
14724
|
+
var KEYS = ["gridLines", "headings", "horizontalCentered", "verticalCentered"];
|
|
14725
|
+
function readPrintOptions(node3) {
|
|
14726
|
+
if (!node3) return void 0;
|
|
14727
|
+
const out = {};
|
|
14728
|
+
for (const key2 of KEYS) if (boolAttr(node3, key2)) out[key2] = true;
|
|
14729
|
+
return Object.keys(out).length ? out : void 0;
|
|
14730
|
+
}
|
|
14731
|
+
|
|
14732
|
+
// xlsx/read/password-hash.ts
|
|
14733
|
+
function modernHashAttributeNames(prefix2 = "") {
|
|
14734
|
+
const name3 = (base2) => prefix2 ? `${prefix2}${base2[0].toUpperCase()}${base2.slice(1)}` : base2;
|
|
14735
|
+
return {
|
|
14736
|
+
algorithmName: name3("algorithmName"),
|
|
14737
|
+
hashValue: name3("hashValue"),
|
|
14738
|
+
saltValue: name3("saltValue"),
|
|
14739
|
+
spinCount: name3("spinCount")
|
|
14740
|
+
};
|
|
14741
|
+
}
|
|
14742
|
+
function readModernHash(node3, prefix2 = "") {
|
|
14743
|
+
const names = modernHashAttributeNames(prefix2);
|
|
14744
|
+
const algorithmName = att(node3, names.algorithmName);
|
|
14745
|
+
const hashValue = att(node3, names.hashValue);
|
|
14746
|
+
const saltValue = att(node3, names.saltValue);
|
|
14747
|
+
if (!algorithmName || !hashValue || !saltValue) return void 0;
|
|
14748
|
+
const hash2 = { algorithmName, hashValue, saltValue };
|
|
14749
|
+
const spin = att(node3, names.spinCount);
|
|
14750
|
+
const spinCount = spin === void 0 || spin.trim() === "" ? Number.NaN : Number(spin);
|
|
14751
|
+
if (Number.isFinite(spinCount)) hash2.spinCount = spinCount;
|
|
14752
|
+
return hash2;
|
|
14753
|
+
}
|
|
14754
|
+
|
|
14755
|
+
// xlsx/read/sheet-props.ts
|
|
14756
|
+
var defaultSheetView = () => ({
|
|
14757
|
+
showGridLines: true,
|
|
14758
|
+
showHeaders: true,
|
|
14759
|
+
showZeros: true,
|
|
14760
|
+
rightToLeft: false,
|
|
14761
|
+
zoom: 100
|
|
14762
|
+
});
|
|
14763
|
+
function parseSqref(sqref) {
|
|
14764
|
+
if (!sqref) return [];
|
|
14765
|
+
return sqref.split(/\s+/).filter(Boolean).map((part) => parseRange(part)).filter((range2) => range2 !== void 0);
|
|
14766
|
+
}
|
|
14767
|
+
var readTabColor = (sheetPr, palette) => parseColor(xFirst(sheetPr, "tabColor"), palette);
|
|
14768
|
+
var readFitToPage = (sheetPr) => boolAttr(xFirst(sheetPr, "pageSetUpPr"), "fitToPage") ?? false;
|
|
14769
|
+
function readSheetView(sheetViews) {
|
|
14770
|
+
const view2 = defaultSheetView();
|
|
14771
|
+
const node3 = xFirst(sheetViews, "sheetView");
|
|
14772
|
+
if (!node3) return view2;
|
|
14773
|
+
view2.showGridLines = boolAttr(node3, "showGridLines", true);
|
|
14774
|
+
view2.showHeaders = boolAttr(node3, "showRowColHeaders", true);
|
|
14775
|
+
view2.showZeros = boolAttr(node3, "showZeros", true);
|
|
14776
|
+
view2.rightToLeft = boolAttr(node3, "rightToLeft", false);
|
|
14777
|
+
view2.zoom = numAttr(node3, "zoomScale") || 100;
|
|
14778
|
+
if (boolAttr(node3, "showFormulas")) view2.showFormulas = true;
|
|
14779
|
+
const mode = att(node3, "view");
|
|
14780
|
+
if (mode === "pageLayout" || mode === "pageBreakPreview") view2.mode = mode;
|
|
14781
|
+
const pane = xFirst(node3, "pane");
|
|
14782
|
+
const state = att(pane, "state");
|
|
14783
|
+
const frozen = pane && (state === "frozen" || state === "frozenSplit");
|
|
14784
|
+
if (frozen) {
|
|
14785
|
+
const rows = Math.max(0, Math.round(numAttr(pane, "ySplit") ?? 0));
|
|
14786
|
+
const cols = Math.max(0, Math.round(numAttr(pane, "xSplit") ?? 0));
|
|
14787
|
+
if (rows || cols) view2.freeze = { rows, cols };
|
|
14788
|
+
}
|
|
14789
|
+
const topLeft = parseAddress(
|
|
14790
|
+
(frozen ? att(pane, "topLeftCell") : att(node3, "topLeftCell")) ?? ""
|
|
14791
|
+
);
|
|
14792
|
+
if (topLeft) view2.topLeft = topLeft;
|
|
14793
|
+
const selections = xChildren(node3, "selection");
|
|
14794
|
+
const activePane = att(pane, "activePane") ?? "topLeft";
|
|
14795
|
+
const selection = selections.find((sel) => (att(sel, "pane") ?? "topLeft") === activePane) ?? selections[0];
|
|
14796
|
+
if (selection) {
|
|
14797
|
+
const ranges = parseSqref(att(selection, "sqref") ?? att(selection, "activeCell") ?? "A1");
|
|
14798
|
+
const active = parseAddress(att(selection, "activeCell") ?? "") ?? ranges[0]?.start ?? { row: 0, col: 0 };
|
|
14799
|
+
view2.selection = {
|
|
14800
|
+
active,
|
|
14801
|
+
ranges: ranges.length ? ranges : [{ start: active, end: { ...active } }]
|
|
14802
|
+
};
|
|
14803
|
+
}
|
|
14804
|
+
return view2;
|
|
14805
|
+
}
|
|
14806
|
+
var FORMAT_FLAGS = ["zeroHeight", "customHeight", "thickTop", "thickBottom"];
|
|
14807
|
+
function readSheetFormat(format5) {
|
|
14808
|
+
const result2 = {
|
|
14809
|
+
defaultRowHeight: numAttr(format5, "defaultRowHeight") ?? 15
|
|
14810
|
+
};
|
|
14811
|
+
const width = numAttr(format5, "defaultColWidth");
|
|
14812
|
+
if (width !== void 0) result2.defaultColWidth = width;
|
|
14813
|
+
const flags = {};
|
|
14814
|
+
for (const key2 of FORMAT_FLAGS) {
|
|
14815
|
+
const value3 = boolAttr(format5, key2);
|
|
14816
|
+
if (value3 !== void 0) flags[key2] = value3;
|
|
14817
|
+
}
|
|
14818
|
+
const base2 = numAttr(format5, "baseColWidth");
|
|
14819
|
+
if (base2 !== void 0) flags.baseColWidth = base2;
|
|
14820
|
+
if (Object.keys(flags).length) result2.format = flags;
|
|
14821
|
+
return result2;
|
|
14822
|
+
}
|
|
14823
|
+
function readColumns(cols, xfMap) {
|
|
14824
|
+
const out = [];
|
|
14825
|
+
for (const col of cols ? xChildren(cols, "col") : []) {
|
|
14826
|
+
const min = (numAttr(col, "min") ?? 1) - 1;
|
|
14827
|
+
const max = (numAttr(col, "max") ?? min + 1) - 1;
|
|
14828
|
+
const info = { min, max };
|
|
14829
|
+
const width = numAttr(col, "width");
|
|
14830
|
+
if (width !== void 0) info.width = width;
|
|
14831
|
+
if (boolAttr(col, "customWidth")) info.customWidth = true;
|
|
14832
|
+
if (boolAttr(col, "hidden")) info.hidden = true;
|
|
14833
|
+
const style2 = numAttr(col, "style");
|
|
14834
|
+
const styleId = style2 === void 0 ? 0 : xfMap[style2] ?? 0;
|
|
14835
|
+
if (styleId) info.styleId = styleId;
|
|
14836
|
+
const outline = numAttr(col, "outlineLevel");
|
|
14837
|
+
if (outline) info.outlineLevel = outline;
|
|
14838
|
+
if (boolAttr(col, "collapsed")) info.collapsed = true;
|
|
14839
|
+
if (boolAttr(col, "bestFit")) info.bestFit = true;
|
|
14840
|
+
out.push(info);
|
|
14841
|
+
}
|
|
14842
|
+
return out;
|
|
14843
|
+
}
|
|
14844
|
+
var MAIN_NS_DECL = /(?<=^<[^>]*) xmlns="http:\/\/schemas\.openxmlformats\.org\/spreadsheetml\/2006\/main"/;
|
|
14845
|
+
function readAutoFilter(node3) {
|
|
14846
|
+
const range2 = parseRange(att(node3, "ref") ?? "");
|
|
14847
|
+
if (!node3 || !range2) return void 0;
|
|
14848
|
+
const filter = { range: range2 };
|
|
14849
|
+
const columns = [];
|
|
14850
|
+
for (const column of xChildren(node3, "filterColumn")) {
|
|
14851
|
+
const entry3 = {
|
|
14852
|
+
offset: numAttr(column, "colId") ?? 0
|
|
14853
|
+
};
|
|
14854
|
+
const filters = xFirst(column, "filters");
|
|
14855
|
+
if (filters) {
|
|
14856
|
+
entry3.values = xChildren(filters, "filter").map((f) => att(f, "val") ?? "");
|
|
14857
|
+
if (boolAttr(filters, "blank")) entry3.blank = true;
|
|
14858
|
+
}
|
|
14859
|
+
entry3.sourceXml = outerXml(column).replace(MAIN_NS_DECL, "");
|
|
14860
|
+
columns.push(entry3);
|
|
14861
|
+
}
|
|
14862
|
+
if (columns.length) filter.columns = columns;
|
|
14863
|
+
return filter;
|
|
14864
|
+
}
|
|
14865
|
+
var HEADER_FOOTER_TEXT = {
|
|
14866
|
+
header: "oddHeader",
|
|
14867
|
+
footer: "oddFooter",
|
|
14868
|
+
evenHeader: "evenHeader",
|
|
14869
|
+
evenFooter: "evenFooter",
|
|
14870
|
+
firstHeader: "firstHeader",
|
|
14871
|
+
firstFooter: "firstFooter"
|
|
14872
|
+
};
|
|
14873
|
+
var HEADER_FOOTER_FLAGS = [
|
|
14874
|
+
"differentOddEven",
|
|
14875
|
+
"differentFirst",
|
|
14876
|
+
"scaleWithDoc",
|
|
14877
|
+
"alignWithMargins"
|
|
14878
|
+
];
|
|
14879
|
+
function readHeaderFooter(node3) {
|
|
14880
|
+
const out = {};
|
|
14881
|
+
for (const key2 of HEADER_FOOTER_FLAGS) {
|
|
14882
|
+
const value3 = boolAttr(node3, key2);
|
|
14883
|
+
if (value3 !== void 0) out[key2] = value3;
|
|
14884
|
+
}
|
|
14885
|
+
for (const [key2, local] of Object.entries(HEADER_FOOTER_TEXT)) {
|
|
14886
|
+
const child4 = xFirst(node3, local);
|
|
14887
|
+
if (child4) out[key2] = xText(child4);
|
|
14888
|
+
}
|
|
14889
|
+
return out;
|
|
14890
|
+
}
|
|
14891
|
+
var ORIENTATIONS = /* @__PURE__ */ new Set(["portrait", "landscape"]);
|
|
14892
|
+
function readPageSetup(margins, setup, headerFooter, fitToPage) {
|
|
14893
|
+
const page = {};
|
|
14894
|
+
if (setup) {
|
|
14895
|
+
if (/^(1|true)$/.test(att(setup, "useFirstPageNumber") ?? "")) {
|
|
14896
|
+
page.firstPageNumber = numAttr(setup, "firstPageNumber") ?? 1;
|
|
14897
|
+
}
|
|
14898
|
+
const order = att(setup, "pageOrder");
|
|
14899
|
+
if (order === "downThenOver" || order === "overThenDown") page.pageOrder = order;
|
|
14900
|
+
const orientation = att(setup, "orientation");
|
|
14901
|
+
if (orientation && ORIENTATIONS.has(orientation))
|
|
14902
|
+
page.orientation = orientation;
|
|
14903
|
+
const paper = numAttr(setup, "paperSize");
|
|
14904
|
+
if (paper !== void 0) page.paperSize = paper;
|
|
14905
|
+
const scale = numAttr(setup, "scale");
|
|
14906
|
+
if (scale !== void 0) page.scale = scale;
|
|
14907
|
+
}
|
|
14908
|
+
if (fitToPage) {
|
|
14909
|
+
page.fitToWidth = numAttr(setup, "fitToWidth") ?? 1;
|
|
14910
|
+
page.fitToHeight = numAttr(setup, "fitToHeight") ?? 1;
|
|
14911
|
+
}
|
|
14912
|
+
if (margins) {
|
|
14913
|
+
const m = (name3, fallback) => numAttr(margins, name3) ?? fallback;
|
|
14914
|
+
page.margins = {
|
|
14915
|
+
left: m("left", 0.7),
|
|
14916
|
+
right: m("right", 0.7),
|
|
14917
|
+
top: m("top", 0.75),
|
|
14918
|
+
bottom: m("bottom", 0.75),
|
|
14919
|
+
header: m("header", 0.3),
|
|
14920
|
+
footer: m("footer", 0.3)
|
|
14921
|
+
};
|
|
14922
|
+
}
|
|
14923
|
+
if (headerFooter) Object.assign(page, readHeaderFooter(headerFooter));
|
|
14924
|
+
return Object.keys(page).length ? page : void 0;
|
|
14925
|
+
}
|
|
14926
|
+
var PROTECTION_META = /* @__PURE__ */ new Set([
|
|
14927
|
+
"sheet",
|
|
14928
|
+
"password",
|
|
14929
|
+
"algorithmName",
|
|
14930
|
+
"hashValue",
|
|
14931
|
+
"saltValue",
|
|
14932
|
+
"spinCount"
|
|
14933
|
+
]);
|
|
14934
|
+
function readProtection(node3) {
|
|
14935
|
+
if (!node3) return void 0;
|
|
14936
|
+
const protection2 = { sheet: boolAttr(node3, "sheet", false) };
|
|
14937
|
+
const password = att(node3, "password");
|
|
14938
|
+
if (password) protection2.passwordHash = password;
|
|
14939
|
+
const modernHash = readModernHash(node3);
|
|
14940
|
+
if (modernHash) protection2.modernHash = modernHash;
|
|
14941
|
+
const allow = [];
|
|
14942
|
+
for (const attribute4 of Array.from(node3.attributes)) {
|
|
14943
|
+
if (PROTECTION_META.has(attribute4.name)) continue;
|
|
14944
|
+
if (attribute4.value === "0" || attribute4.value === "false") allow.push(attribute4.name);
|
|
14945
|
+
}
|
|
14946
|
+
if (allow.length) protection2.allow = allow.sort();
|
|
14947
|
+
return protection2;
|
|
14948
|
+
}
|
|
14949
|
+
|
|
14950
|
+
// xlsx/read/custom-views.ts
|
|
14951
|
+
var SHEET_VIEW_ATTRS = [
|
|
14952
|
+
"guid",
|
|
14953
|
+
"scale",
|
|
14954
|
+
"showGridLines",
|
|
14955
|
+
"showRowCol",
|
|
14956
|
+
"zeroValues",
|
|
14957
|
+
"topLeftCell",
|
|
14958
|
+
"view",
|
|
14959
|
+
"showFormulas",
|
|
14960
|
+
"hiddenRows",
|
|
14961
|
+
"hiddenColumns",
|
|
14962
|
+
"filter",
|
|
14963
|
+
"showAutoFilter",
|
|
14964
|
+
"fitToPage"
|
|
14965
|
+
];
|
|
14966
|
+
var WORKBOOK_VIEW_KNOWN = ["name", "guid", "includePrintSettings", "includeHiddenRowCol"];
|
|
14967
|
+
function readCustomWorkbookViews(node3) {
|
|
14968
|
+
return xChildren(node3, "customWorkbookView").flatMap((view2) => {
|
|
14969
|
+
const guid3 = att(view2, "guid");
|
|
14970
|
+
if (!guid3) return [];
|
|
14971
|
+
const attrs = {};
|
|
14972
|
+
for (const attribute4 of Array.from(view2.attributes))
|
|
14973
|
+
if (!WORKBOOK_VIEW_KNOWN.includes(attribute4.name) && !attribute4.name.startsWith("xmlns"))
|
|
14974
|
+
attrs[attribute4.name] = attribute4.value;
|
|
14975
|
+
return [
|
|
14976
|
+
{
|
|
14977
|
+
guid: guid3,
|
|
14978
|
+
name: att(view2, "name") ?? "",
|
|
14979
|
+
includePrintSettings: boolAttr(view2, "includePrintSettings", true),
|
|
14980
|
+
includeHiddenRowCol: boolAttr(view2, "includeHiddenRowCol", true),
|
|
14981
|
+
attrs
|
|
14982
|
+
}
|
|
14983
|
+
];
|
|
14984
|
+
});
|
|
14985
|
+
}
|
|
14986
|
+
var escape2 = (value3) => value3.replace(/&/g, "&").replace(/"/g, """);
|
|
14987
|
+
function asSheetViews(view2) {
|
|
14988
|
+
const map = [
|
|
14989
|
+
["scale", "zoomScale"],
|
|
14990
|
+
["showGridLines", "showGridLines"],
|
|
14991
|
+
["showRowCol", "showRowColHeaders"],
|
|
14992
|
+
["zeroValues", "showZeros"],
|
|
14993
|
+
["topLeftCell", "topLeftCell"],
|
|
14994
|
+
["view", "view"],
|
|
14995
|
+
["showFormulas", "showFormulas"]
|
|
14996
|
+
];
|
|
14997
|
+
const attributes = map.flatMap(([from, to]) => {
|
|
14998
|
+
const value3 = att(view2, from);
|
|
14999
|
+
return value3 === void 0 ? [] : [` ${to}="${escape2(value3)}"`];
|
|
15000
|
+
}).join("");
|
|
15001
|
+
const children5 = elements(view2).filter((child4) => child4.localName === "pane" || child4.localName === "selection").map((child4) => outerXml(child4)).join("");
|
|
15002
|
+
return parseXml(
|
|
15003
|
+
`<sheetViews xmlns="${NS.x}"><sheetView${attributes}>${children5}</sheetView></sheetViews>`
|
|
15004
|
+
).documentElement;
|
|
15005
|
+
}
|
|
15006
|
+
function readCustomSheetViews(node3) {
|
|
15007
|
+
return xChildren(node3, "customSheetView").flatMap((view2) => {
|
|
15008
|
+
const guid3 = att(view2, "guid");
|
|
15009
|
+
if (!guid3) return [];
|
|
15010
|
+
const child4 = (name3) => xChildren(view2, name3)[0];
|
|
15011
|
+
const pageSetup = readPageSetup(
|
|
15012
|
+
child4("pageMargins"),
|
|
15013
|
+
child4("pageSetup"),
|
|
15014
|
+
child4("headerFooter"),
|
|
15015
|
+
boolAttr(view2, "fitToPage", false)
|
|
15016
|
+
);
|
|
15017
|
+
const printOptions = readPrintOptions(child4("printOptions"));
|
|
15018
|
+
const filter = readAutoFilter(child4("autoFilter"));
|
|
15019
|
+
const attrs = {};
|
|
15020
|
+
for (const attribute4 of Array.from(view2.attributes))
|
|
15021
|
+
if (!SHEET_VIEW_ATTRS.includes(attribute4.name) && !attribute4.name.startsWith("xmlns"))
|
|
15022
|
+
attrs[attribute4.name] = attribute4.value;
|
|
15023
|
+
const modelled = [
|
|
15024
|
+
"pane",
|
|
15025
|
+
"selection",
|
|
15026
|
+
"pageMargins",
|
|
15027
|
+
"printOptions",
|
|
15028
|
+
"pageSetup",
|
|
15029
|
+
"headerFooter",
|
|
15030
|
+
"autoFilter"
|
|
15031
|
+
];
|
|
15032
|
+
return [
|
|
15033
|
+
{
|
|
15034
|
+
guid: guid3,
|
|
15035
|
+
view: readSheetView(asSheetViews(view2)),
|
|
15036
|
+
...boolAttr(view2, "hiddenRows", false) ? { hiddenRows: true } : {},
|
|
15037
|
+
...boolAttr(view2, "hiddenColumns", false) ? { hiddenColumns: true } : {},
|
|
15038
|
+
...filter ? { filter } : {},
|
|
15039
|
+
...boolAttr(view2, "showAutoFilter", false) ? { showAutoFilter: true } : {},
|
|
15040
|
+
...pageSetup ? { pageSetup } : {},
|
|
15041
|
+
...printOptions ? { printOptions } : {},
|
|
15042
|
+
attrs,
|
|
15043
|
+
extra: elements(view2).filter((c2) => !modelled.includes(c2.localName ?? "")).map((c2) => outerXml(c2))
|
|
15044
|
+
}
|
|
15045
|
+
];
|
|
15046
|
+
});
|
|
15047
|
+
}
|
|
15048
|
+
|
|
14394
15049
|
// xlsx/read/formula-storage.ts
|
|
14395
15050
|
function tokens(formula2) {
|
|
14396
15051
|
try {
|
|
@@ -14488,30 +15143,20 @@ function stripFuturePrefixes(formula2) {
|
|
|
14488
15143
|
return fromStoredSyntax(plain4);
|
|
14489
15144
|
}
|
|
14490
15145
|
|
|
14491
|
-
// xlsx/read/password-hash.ts
|
|
14492
|
-
function modernHashAttributeNames(prefix2 = "") {
|
|
14493
|
-
const name3 = (base2) => prefix2 ? `${prefix2}${base2[0].toUpperCase()}${base2.slice(1)}` : base2;
|
|
14494
|
-
return {
|
|
14495
|
-
algorithmName: name3("algorithmName"),
|
|
14496
|
-
hashValue: name3("hashValue"),
|
|
14497
|
-
saltValue: name3("saltValue"),
|
|
14498
|
-
spinCount: name3("spinCount")
|
|
14499
|
-
};
|
|
14500
|
-
}
|
|
14501
|
-
function readModernHash(node3, prefix2 = "") {
|
|
14502
|
-
const names = modernHashAttributeNames(prefix2);
|
|
14503
|
-
const algorithmName = att(node3, names.algorithmName);
|
|
14504
|
-
const hashValue = att(node3, names.hashValue);
|
|
14505
|
-
const saltValue = att(node3, names.saltValue);
|
|
14506
|
-
if (!algorithmName || !hashValue || !saltValue) return void 0;
|
|
14507
|
-
const hash2 = { algorithmName, hashValue, saltValue };
|
|
14508
|
-
const spin = att(node3, names.spinCount);
|
|
14509
|
-
const spinCount = spin === void 0 || spin.trim() === "" ? Number.NaN : Number(spin);
|
|
14510
|
-
if (Number.isFinite(spinCount)) hash2.spinCount = spinCount;
|
|
14511
|
-
return hash2;
|
|
14512
|
-
}
|
|
14513
|
-
|
|
14514
15146
|
// xlsx/read/workbook-part.ts
|
|
15147
|
+
var NAME_EXTRA_ATTRIBUTES = [
|
|
15148
|
+
"function",
|
|
15149
|
+
"vbProcedure",
|
|
15150
|
+
"xlm",
|
|
15151
|
+
"customMenu",
|
|
15152
|
+
"description",
|
|
15153
|
+
"help",
|
|
15154
|
+
"statusBar",
|
|
15155
|
+
"shortcutKey",
|
|
15156
|
+
"functionGroupId",
|
|
15157
|
+
"publishToServer",
|
|
15158
|
+
"workbookParameter"
|
|
15159
|
+
];
|
|
14515
15160
|
function parseWorkbookPart(xml) {
|
|
14516
15161
|
const root2 = parseXml(xml, { label: "XLSX workbook" }).documentElement;
|
|
14517
15162
|
const sheets = [];
|
|
@@ -14535,6 +15180,12 @@ function parseWorkbookPart(xml) {
|
|
|
14535
15180
|
if (boolAttr(node3, "hidden")) name3.hidden = true;
|
|
14536
15181
|
const comment = att(node3, "comment");
|
|
14537
15182
|
if (comment) name3.comment = comment;
|
|
15183
|
+
const extra = {};
|
|
15184
|
+
for (const key2 of NAME_EXTRA_ATTRIBUTES) {
|
|
15185
|
+
const value3 = att(node3, key2);
|
|
15186
|
+
if (value3 !== void 0) extra[key2] = value3;
|
|
15187
|
+
}
|
|
15188
|
+
if (Object.keys(extra).length) name3.extra = extra;
|
|
14538
15189
|
if (name3.name) definedNames.push(name3);
|
|
14539
15190
|
}
|
|
14540
15191
|
const view2 = xFirst(xFirst(root2, "bookViews"), "workbookView");
|
|
@@ -14548,7 +15199,9 @@ function parseWorkbookPart(xml) {
|
|
|
14548
15199
|
delta: numAttr(calcPr, "iterateDelta") ?? 1e-3
|
|
14549
15200
|
} : void 0;
|
|
14550
15201
|
const oleSize = att(xFirst(root2, "oleSize"), "ref");
|
|
15202
|
+
const customViews = xFirst(root2, "customWorkbookViews");
|
|
14551
15203
|
return {
|
|
15204
|
+
...customViews ? { customViews: readCustomWorkbookViews(customViews) } : {},
|
|
14552
15205
|
...oleSize ? { oleSize } : {},
|
|
14553
15206
|
...iterate ? { iterate } : {},
|
|
14554
15207
|
...password ? { workbookPasswordHash: password } : {},
|
|
@@ -14582,9 +15235,9 @@ function parseFormula(fmla) {
|
|
|
14582
15235
|
return { op, args };
|
|
14583
15236
|
}
|
|
14584
15237
|
function resolveOperand(token, variables) {
|
|
14585
|
-
const
|
|
14586
|
-
if (Number.isFinite(
|
|
14587
|
-
return
|
|
15238
|
+
const num2 = Number(token);
|
|
15239
|
+
if (Number.isFinite(num2)) {
|
|
15240
|
+
return num2;
|
|
14588
15241
|
}
|
|
14589
15242
|
const value3 = variables.get(token);
|
|
14590
15243
|
if (value3 !== void 0) {
|
|
@@ -16257,18 +16910,18 @@ function groupTransform(group2, parent) {
|
|
|
16257
16910
|
const ext = first(xfrm, "ext", NS.a);
|
|
16258
16911
|
const chOff = first(xfrm, "chOff", NS.a);
|
|
16259
16912
|
const chExt = first(xfrm, "chExt", NS.a);
|
|
16260
|
-
const
|
|
16261
|
-
const cx =
|
|
16262
|
-
const cy =
|
|
16263
|
-
const chCx =
|
|
16264
|
-
const chCy =
|
|
16913
|
+
const num2 = (element2, name3) => Number.parseInt(element2?.getAttribute(name3) ?? "", 10);
|
|
16914
|
+
const cx = num2(ext, "cx");
|
|
16915
|
+
const cy = num2(ext, "cy");
|
|
16916
|
+
const chCx = num2(chExt, "cx");
|
|
16917
|
+
const chCy = num2(chExt, "cy");
|
|
16265
16918
|
if (!off || ![cx, cy, chCx, chCy].every(Number.isFinite) || chCx === 0 || chCy === 0)
|
|
16266
16919
|
return parent;
|
|
16267
16920
|
const scaleX = cx / chCx;
|
|
16268
16921
|
const scaleY = cy / chCy;
|
|
16269
16922
|
const local = {
|
|
16270
|
-
offsetX:
|
|
16271
|
-
offsetY:
|
|
16923
|
+
offsetX: num2(off, "x") - (num2(chOff, "x") || 0) * scaleX,
|
|
16924
|
+
offsetY: num2(off, "y") - (num2(chOff, "y") || 0) * scaleY,
|
|
16272
16925
|
scaleX,
|
|
16273
16926
|
scaleY
|
|
16274
16927
|
};
|
|
@@ -16576,200 +17229,48 @@ async function resolveSmartArt(sheets, source, warn) {
|
|
|
16576
17229
|
}
|
|
16577
17230
|
}
|
|
16578
17231
|
|
|
16579
|
-
// xlsx/read/
|
|
16580
|
-
var
|
|
16581
|
-
|
|
16582
|
-
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
|
|
16586
|
-
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16591
|
-
|
|
16592
|
-
|
|
16593
|
-
|
|
16594
|
-
|
|
16595
|
-
|
|
16596
|
-
|
|
16597
|
-
|
|
16598
|
-
|
|
16599
|
-
|
|
16600
|
-
|
|
16601
|
-
|
|
16602
|
-
|
|
16603
|
-
|
|
16604
|
-
|
|
16605
|
-
|
|
16606
|
-
|
|
16607
|
-
|
|
16608
|
-
|
|
16609
|
-
|
|
16610
|
-
|
|
16611
|
-
|
|
16612
|
-
|
|
16613
|
-
|
|
16614
|
-
|
|
16615
|
-
|
|
16616
|
-
|
|
16617
|
-
|
|
16618
|
-
|
|
16619
|
-
|
|
16620
|
-
if (selection) {
|
|
16621
|
-
const ranges = parseSqref(att(selection, "sqref") ?? att(selection, "activeCell") ?? "A1");
|
|
16622
|
-
const active = parseAddress(att(selection, "activeCell") ?? "") ?? ranges[0]?.start ?? { row: 0, col: 0 };
|
|
16623
|
-
view2.selection = {
|
|
16624
|
-
active,
|
|
16625
|
-
ranges: ranges.length ? ranges : [{ start: active, end: { ...active } }]
|
|
16626
|
-
};
|
|
16627
|
-
}
|
|
16628
|
-
return view2;
|
|
16629
|
-
}
|
|
16630
|
-
var FORMAT_FLAGS = ["zeroHeight", "customHeight", "thickTop", "thickBottom"];
|
|
16631
|
-
function readSheetFormat(format5) {
|
|
16632
|
-
const result2 = {
|
|
16633
|
-
defaultRowHeight: numAttr(format5, "defaultRowHeight") ?? 15
|
|
16634
|
-
};
|
|
16635
|
-
const width = numAttr(format5, "defaultColWidth");
|
|
16636
|
-
if (width !== void 0) result2.defaultColWidth = width;
|
|
16637
|
-
const flags = {};
|
|
16638
|
-
for (const key2 of FORMAT_FLAGS) {
|
|
16639
|
-
const value3 = boolAttr(format5, key2);
|
|
16640
|
-
if (value3 !== void 0) flags[key2] = value3;
|
|
16641
|
-
}
|
|
16642
|
-
const base2 = numAttr(format5, "baseColWidth");
|
|
16643
|
-
if (base2 !== void 0) flags.baseColWidth = base2;
|
|
16644
|
-
if (Object.keys(flags).length) result2.format = flags;
|
|
16645
|
-
return result2;
|
|
16646
|
-
}
|
|
16647
|
-
function readColumns(cols, xfMap) {
|
|
16648
|
-
const out = [];
|
|
16649
|
-
for (const col of cols ? xChildren(cols, "col") : []) {
|
|
16650
|
-
const min = (numAttr(col, "min") ?? 1) - 1;
|
|
16651
|
-
const max = (numAttr(col, "max") ?? min + 1) - 1;
|
|
16652
|
-
const info = { min, max };
|
|
16653
|
-
const width = numAttr(col, "width");
|
|
16654
|
-
if (width !== void 0) info.width = width;
|
|
16655
|
-
if (boolAttr(col, "customWidth")) info.customWidth = true;
|
|
16656
|
-
if (boolAttr(col, "hidden")) info.hidden = true;
|
|
16657
|
-
const style2 = numAttr(col, "style");
|
|
16658
|
-
const styleId = style2 === void 0 ? 0 : xfMap[style2] ?? 0;
|
|
16659
|
-
if (styleId) info.styleId = styleId;
|
|
16660
|
-
const outline = numAttr(col, "outlineLevel");
|
|
16661
|
-
if (outline) info.outlineLevel = outline;
|
|
16662
|
-
if (boolAttr(col, "collapsed")) info.collapsed = true;
|
|
16663
|
-
if (boolAttr(col, "bestFit")) info.bestFit = true;
|
|
16664
|
-
out.push(info);
|
|
16665
|
-
}
|
|
16666
|
-
return out;
|
|
16667
|
-
}
|
|
16668
|
-
var MAIN_NS_DECL = /(?<=^<[^>]*) xmlns="http:\/\/schemas\.openxmlformats\.org\/spreadsheetml\/2006\/main"/;
|
|
16669
|
-
function readAutoFilter(node3) {
|
|
16670
|
-
const range2 = parseRange(att(node3, "ref") ?? "");
|
|
16671
|
-
if (!node3 || !range2) return void 0;
|
|
16672
|
-
const filter = { range: range2 };
|
|
16673
|
-
const columns = [];
|
|
16674
|
-
for (const column of xChildren(node3, "filterColumn")) {
|
|
16675
|
-
const entry3 = {
|
|
16676
|
-
offset: numAttr(column, "colId") ?? 0
|
|
16677
|
-
};
|
|
16678
|
-
const filters = xFirst(column, "filters");
|
|
16679
|
-
if (filters) {
|
|
16680
|
-
entry3.values = xChildren(filters, "filter").map((f) => att(f, "val") ?? "");
|
|
16681
|
-
if (boolAttr(filters, "blank")) entry3.blank = true;
|
|
16682
|
-
}
|
|
16683
|
-
entry3.sourceXml = outerXml(column).replace(MAIN_NS_DECL, "");
|
|
16684
|
-
columns.push(entry3);
|
|
16685
|
-
}
|
|
16686
|
-
if (columns.length) filter.columns = columns;
|
|
16687
|
-
return filter;
|
|
16688
|
-
}
|
|
16689
|
-
var HEADER_FOOTER_TEXT = {
|
|
16690
|
-
header: "oddHeader",
|
|
16691
|
-
footer: "oddFooter",
|
|
16692
|
-
evenHeader: "evenHeader",
|
|
16693
|
-
evenFooter: "evenFooter",
|
|
16694
|
-
firstHeader: "firstHeader",
|
|
16695
|
-
firstFooter: "firstFooter"
|
|
16696
|
-
};
|
|
16697
|
-
var HEADER_FOOTER_FLAGS = [
|
|
16698
|
-
"differentOddEven",
|
|
16699
|
-
"differentFirst",
|
|
16700
|
-
"scaleWithDoc",
|
|
16701
|
-
"alignWithMargins"
|
|
17232
|
+
// xlsx/read/worksheet-children.ts
|
|
17233
|
+
var WORKSHEET_CHILD_ORDER = [
|
|
17234
|
+
"sheetPr",
|
|
17235
|
+
"dimension",
|
|
17236
|
+
"sheetViews",
|
|
17237
|
+
"sheetFormatPr",
|
|
17238
|
+
"cols",
|
|
17239
|
+
"sheetData",
|
|
17240
|
+
"sheetCalcPr",
|
|
17241
|
+
"sheetProtection",
|
|
17242
|
+
"protectedRanges",
|
|
17243
|
+
"scenarios",
|
|
17244
|
+
"autoFilter",
|
|
17245
|
+
"sortState",
|
|
17246
|
+
"dataConsolidate",
|
|
17247
|
+
"customSheetViews",
|
|
17248
|
+
"mergeCells",
|
|
17249
|
+
"phoneticPr",
|
|
17250
|
+
"conditionalFormatting",
|
|
17251
|
+
"dataValidations",
|
|
17252
|
+
"hyperlinks",
|
|
17253
|
+
"printOptions",
|
|
17254
|
+
"pageMargins",
|
|
17255
|
+
"pageSetup",
|
|
17256
|
+
"headerFooter",
|
|
17257
|
+
"rowBreaks",
|
|
17258
|
+
"colBreaks",
|
|
17259
|
+
"customProperties",
|
|
17260
|
+
"cellWatches",
|
|
17261
|
+
"ignoredErrors",
|
|
17262
|
+
"smartTags",
|
|
17263
|
+
"drawing",
|
|
17264
|
+
"legacyDrawing",
|
|
17265
|
+
"legacyDrawingHF",
|
|
17266
|
+
"drawingHF",
|
|
17267
|
+
"picture",
|
|
17268
|
+
"oleObjects",
|
|
17269
|
+
"controls",
|
|
17270
|
+
"webPublishItems",
|
|
17271
|
+
"tableParts",
|
|
17272
|
+
"extLst"
|
|
16702
17273
|
];
|
|
16703
|
-
function readHeaderFooter(node3) {
|
|
16704
|
-
const out = {};
|
|
16705
|
-
for (const key2 of HEADER_FOOTER_FLAGS) {
|
|
16706
|
-
const value3 = boolAttr(node3, key2);
|
|
16707
|
-
if (value3 !== void 0) out[key2] = value3;
|
|
16708
|
-
}
|
|
16709
|
-
for (const [key2, local] of Object.entries(HEADER_FOOTER_TEXT)) {
|
|
16710
|
-
const child4 = xFirst(node3, local);
|
|
16711
|
-
if (child4) out[key2] = xText(child4);
|
|
16712
|
-
}
|
|
16713
|
-
return out;
|
|
16714
|
-
}
|
|
16715
|
-
var ORIENTATIONS = /* @__PURE__ */ new Set(["portrait", "landscape"]);
|
|
16716
|
-
function readPageSetup(margins, setup, headerFooter, fitToPage) {
|
|
16717
|
-
const page = {};
|
|
16718
|
-
if (setup) {
|
|
16719
|
-
if (/^(1|true)$/.test(att(setup, "useFirstPageNumber") ?? "")) {
|
|
16720
|
-
page.firstPageNumber = numAttr(setup, "firstPageNumber") ?? 1;
|
|
16721
|
-
}
|
|
16722
|
-
const order = att(setup, "pageOrder");
|
|
16723
|
-
if (order === "downThenOver" || order === "overThenDown") page.pageOrder = order;
|
|
16724
|
-
const orientation = att(setup, "orientation");
|
|
16725
|
-
if (orientation && ORIENTATIONS.has(orientation))
|
|
16726
|
-
page.orientation = orientation;
|
|
16727
|
-
const paper = numAttr(setup, "paperSize");
|
|
16728
|
-
if (paper !== void 0) page.paperSize = paper;
|
|
16729
|
-
const scale = numAttr(setup, "scale");
|
|
16730
|
-
if (scale !== void 0) page.scale = scale;
|
|
16731
|
-
}
|
|
16732
|
-
if (fitToPage) {
|
|
16733
|
-
page.fitToWidth = numAttr(setup, "fitToWidth") ?? 1;
|
|
16734
|
-
page.fitToHeight = numAttr(setup, "fitToHeight") ?? 1;
|
|
16735
|
-
}
|
|
16736
|
-
if (margins) {
|
|
16737
|
-
const m = (name3, fallback) => numAttr(margins, name3) ?? fallback;
|
|
16738
|
-
page.margins = {
|
|
16739
|
-
left: m("left", 0.7),
|
|
16740
|
-
right: m("right", 0.7),
|
|
16741
|
-
top: m("top", 0.75),
|
|
16742
|
-
bottom: m("bottom", 0.75),
|
|
16743
|
-
header: m("header", 0.3),
|
|
16744
|
-
footer: m("footer", 0.3)
|
|
16745
|
-
};
|
|
16746
|
-
}
|
|
16747
|
-
if (headerFooter) Object.assign(page, readHeaderFooter(headerFooter));
|
|
16748
|
-
return Object.keys(page).length ? page : void 0;
|
|
16749
|
-
}
|
|
16750
|
-
var PROTECTION_META = /* @__PURE__ */ new Set([
|
|
16751
|
-
"sheet",
|
|
16752
|
-
"password",
|
|
16753
|
-
"algorithmName",
|
|
16754
|
-
"hashValue",
|
|
16755
|
-
"saltValue",
|
|
16756
|
-
"spinCount"
|
|
16757
|
-
]);
|
|
16758
|
-
function readProtection(node3) {
|
|
16759
|
-
if (!node3) return void 0;
|
|
16760
|
-
const protection2 = { sheet: boolAttr(node3, "sheet", false) };
|
|
16761
|
-
const password = att(node3, "password");
|
|
16762
|
-
if (password) protection2.passwordHash = password;
|
|
16763
|
-
const modernHash = readModernHash(node3);
|
|
16764
|
-
if (modernHash) protection2.modernHash = modernHash;
|
|
16765
|
-
const allow = [];
|
|
16766
|
-
for (const attribute4 of Array.from(node3.attributes)) {
|
|
16767
|
-
if (PROTECTION_META.has(attribute4.name)) continue;
|
|
16768
|
-
if (attribute4.value === "0" || attribute4.value === "false") allow.push(attribute4.name);
|
|
16769
|
-
}
|
|
16770
|
-
if (allow.length) protection2.allow = allow.sort();
|
|
16771
|
-
return protection2;
|
|
16772
|
-
}
|
|
16773
17274
|
|
|
16774
17275
|
// xlsx/read/conditional.ts
|
|
16775
17276
|
var CFVO_TYPES = /* @__PURE__ */ new Set(["min", "max", "num", "percent", "percentile", "formula"]);
|
|
@@ -20145,9 +20646,205 @@ function readSlicerFrame(content2, anchor, sourceXml) {
|
|
|
20145
20646
|
return void 0;
|
|
20146
20647
|
}
|
|
20147
20648
|
|
|
20148
|
-
// xlsx/read/
|
|
20649
|
+
// xlsx/read/form-control.ts
|
|
20650
|
+
var TYPES = {
|
|
20651
|
+
checkbox: "checkbox",
|
|
20652
|
+
radio: "radio",
|
|
20653
|
+
drop: "dropdown",
|
|
20654
|
+
list: "list",
|
|
20655
|
+
button: "button",
|
|
20656
|
+
spin: "spin",
|
|
20657
|
+
scroll: "scroll",
|
|
20658
|
+
gbox: "groupBox",
|
|
20659
|
+
label: "label",
|
|
20660
|
+
edit: "edit"
|
|
20661
|
+
};
|
|
20662
|
+
function readFormControlFrame(alternate, anchorOf) {
|
|
20663
|
+
const choice2 = elements(alternate).find((node3) => node3.localName === "Choice");
|
|
20664
|
+
const anchorEl = choice2 ? elements(choice2).find((node3) => node3.localName?.endsWith("Anchor")) : void 0;
|
|
20665
|
+
if (!anchorEl) return void 0;
|
|
20666
|
+
const shape = elements(anchorEl).find((node3) => node3.localName === "sp");
|
|
20667
|
+
const nv = first(shape, "nvSpPr", NS.xdr);
|
|
20668
|
+
const cNvPr = first(nv, "cNvPr", NS.xdr);
|
|
20669
|
+
const spid = [...cNvPr?.getElementsByTagName("*") ?? []].find(
|
|
20670
|
+
(node3) => node3.localName === "compatExt"
|
|
20671
|
+
);
|
|
20672
|
+
if (!spid) return void 0;
|
|
20673
|
+
const shapeId2 = Number(att(cNvPr, "id"));
|
|
20674
|
+
if (!Number.isFinite(shapeId2)) return void 0;
|
|
20675
|
+
const name3 = att(cNvPr, "name");
|
|
20676
|
+
return {
|
|
20677
|
+
kind: "formControl",
|
|
20678
|
+
anchor: anchorOf(anchorEl),
|
|
20679
|
+
shapeId: shapeId2,
|
|
20680
|
+
controlType: "other",
|
|
20681
|
+
...name3 ? { name: name3 } : {},
|
|
20682
|
+
sourceXml: selfContainedXml(alternate)
|
|
20683
|
+
};
|
|
20684
|
+
}
|
|
20685
|
+
var num = (value3) => {
|
|
20686
|
+
if (value3 === void 0 || value3 === "") return void 0;
|
|
20687
|
+
const parsed = Number(value3);
|
|
20688
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
20689
|
+
};
|
|
20690
|
+
function readProps(control, xml) {
|
|
20691
|
+
const props = parseXml(xml, { label: "XLSX form control" }).documentElement;
|
|
20692
|
+
control.controlType = TYPES[(att(props, "objectType") ?? "").toLowerCase()] ?? "other";
|
|
20693
|
+
const link = att(props, "fmlaLink");
|
|
20694
|
+
if (link) control.linkedCell = link;
|
|
20695
|
+
const range2 = att(props, "fmlaRange");
|
|
20696
|
+
if (range2) control.listRange = range2;
|
|
20697
|
+
if (control.controlType === "checkbox" || control.controlType === "radio") {
|
|
20698
|
+
const checked = att(props, "checked");
|
|
20699
|
+
control.checked = checked === "Checked" ? "checked" : checked === "Mixed" ? "mixed" : "unchecked";
|
|
20700
|
+
}
|
|
20701
|
+
if (att(props, "firstButton") === "1") control.firstButton = true;
|
|
20702
|
+
for (const [key2, attribute4] of [
|
|
20703
|
+
["selected", "sel"],
|
|
20704
|
+
["value", "val"],
|
|
20705
|
+
["min", "min"],
|
|
20706
|
+
["max", "max"],
|
|
20707
|
+
["step", "inc"],
|
|
20708
|
+
["page", "page"]
|
|
20709
|
+
]) {
|
|
20710
|
+
const value3 = num(att(props, attribute4));
|
|
20711
|
+
if (value3 !== void 0) control[key2] = value3;
|
|
20712
|
+
}
|
|
20713
|
+
if (att(props, "horiz") === "1") control.horizontal = true;
|
|
20714
|
+
const style2 = att(props, "dropStyle");
|
|
20715
|
+
if (style2) control.dropStyle = style2;
|
|
20716
|
+
}
|
|
20717
|
+
var entities = {
|
|
20718
|
+
amp: "&",
|
|
20719
|
+
lt: "<",
|
|
20720
|
+
gt: ">",
|
|
20721
|
+
quot: '"',
|
|
20722
|
+
apos: "'",
|
|
20723
|
+
nbsp: " "
|
|
20724
|
+
};
|
|
20725
|
+
function vmlCaption(vml, shapeId2) {
|
|
20726
|
+
const start = vml.indexOf(`id="_x0000_s${shapeId2}"`);
|
|
20727
|
+
if (start < 0) return void 0;
|
|
20728
|
+
const end = vml.indexOf("</v:shape>", start);
|
|
20729
|
+
const shape = vml.slice(start, end < 0 ? void 0 : end);
|
|
20730
|
+
const box4 = /<v:textbox[^>]*>([\s\S]*?)<\/v:textbox>/.exec(shape)?.[1];
|
|
20731
|
+
if (!box4) return void 0;
|
|
20732
|
+
const text5 = box4.replace(/<br\s*\/?>/gi, "\n").replace(/<[^>]*>/g, "").replace(/&(#x?[0-9a-f]+|\w+);/gi, (match, code) => {
|
|
20733
|
+
if (code.startsWith("#")) {
|
|
20734
|
+
const value3 = code[1]?.toLowerCase() === "x" ? parseInt(code.slice(2), 16) : Number(code.slice(1));
|
|
20735
|
+
return Number.isFinite(value3) ? String.fromCodePoint(value3) : match;
|
|
20736
|
+
}
|
|
20737
|
+
return entities[code.toLowerCase()] ?? match;
|
|
20738
|
+
}).replace(/\s+/g, " ").trim();
|
|
20739
|
+
return text5 || void 0;
|
|
20740
|
+
}
|
|
20741
|
+
function attachFormControls(source, sheetPart, root2, sheet, legacyDrawing) {
|
|
20742
|
+
const controls3 = sheet.drawings.filter(
|
|
20743
|
+
(object) => object.kind === "formControl"
|
|
20744
|
+
);
|
|
20745
|
+
if (!controls3.length) return;
|
|
20746
|
+
const rels = source.rels(sheetPart);
|
|
20747
|
+
const parts = /* @__PURE__ */ new Map();
|
|
20748
|
+
for (const control of Array.from(root2.getElementsByTagNameNS(NS.x, "control"))) {
|
|
20749
|
+
const shapeId2 = Number(att(control, "shapeId"));
|
|
20750
|
+
const rel = rels.get(relAttr(control, "id") ?? "");
|
|
20751
|
+
const target2 = rel ? source.target(sheetPart, rel) : void 0;
|
|
20752
|
+
if (target2) parts.set(shapeId2, target2);
|
|
20753
|
+
}
|
|
20754
|
+
const vmlRel = legacyDrawing ? rels.get(relAttr(legacyDrawing, "id") ?? "") : void 0;
|
|
20755
|
+
const vmlPart = vmlRel ? source.target(sheetPart, vmlRel) : void 0;
|
|
20756
|
+
const vml = vmlPart ? source.text(vmlPart) : void 0;
|
|
20757
|
+
for (const control of controls3) {
|
|
20758
|
+
const part = parts.get(control.shapeId);
|
|
20759
|
+
const xml = part ? source.text(part) : void 0;
|
|
20760
|
+
if (part && xml) {
|
|
20761
|
+
control.partName = part;
|
|
20762
|
+
try {
|
|
20763
|
+
readProps(control, xml);
|
|
20764
|
+
} catch {
|
|
20765
|
+
control.controlType = "other";
|
|
20766
|
+
}
|
|
20767
|
+
}
|
|
20768
|
+
const caption = vml ? vmlCaption(vml, control.shapeId) : void 0;
|
|
20769
|
+
if (caption) control.caption = caption;
|
|
20770
|
+
}
|
|
20771
|
+
}
|
|
20772
|
+
|
|
20773
|
+
// xlsx/read/shape.ts
|
|
20149
20774
|
var xdr = (parent, local) => first(parent, local, NS.xdr);
|
|
20150
|
-
|
|
20775
|
+
function styleRef2(style2, name3) {
|
|
20776
|
+
const ref = first(style2, name3, NS.a);
|
|
20777
|
+
if (!ref) return void 0;
|
|
20778
|
+
const idx = Number(att(ref, "idx") ?? 0);
|
|
20779
|
+
const color2 = parseDrawingColorIn(ref);
|
|
20780
|
+
return { idx: Number.isFinite(idx) ? idx : 0, ...color2 ? { color: color2 } : {} };
|
|
20781
|
+
}
|
|
20782
|
+
function readStyle(style2) {
|
|
20783
|
+
if (!style2) return void 0;
|
|
20784
|
+
const fill = styleRef2(style2, "fillRef");
|
|
20785
|
+
const line = styleRef2(style2, "lnRef");
|
|
20786
|
+
const fontColor = parseDrawingColorIn(first(style2, "fontRef", NS.a));
|
|
20787
|
+
return {
|
|
20788
|
+
...fill ? { fill } : {},
|
|
20789
|
+
...line ? { line } : {},
|
|
20790
|
+
...fontColor ? { font: { color: fontColor } } : {}
|
|
20791
|
+
};
|
|
20792
|
+
}
|
|
20793
|
+
function readShapeNode(element2) {
|
|
20794
|
+
const local = element2.localName;
|
|
20795
|
+
if (local !== "sp" && local !== "cxnSp" && local !== "grpSp") return void 0;
|
|
20796
|
+
const isGroup = local === "grpSp";
|
|
20797
|
+
const nv = elements(element2).find((node4) => node4.localName?.startsWith("nv"));
|
|
20798
|
+
const cNvPr = xdr(nv, "cNvPr");
|
|
20799
|
+
const spPr = xdr(element2, isGroup ? "grpSpPr" : "spPr");
|
|
20800
|
+
const xfrm = first(spPr, "xfrm", NS.a);
|
|
20801
|
+
const transform2 = parseTransform(xfrm);
|
|
20802
|
+
const geometry = isGroup ? { geometry: "group" } : parseDrawingGeometry(spPr);
|
|
20803
|
+
const node3 = {
|
|
20804
|
+
kind: isGroup ? "group" : local === "cxnSp" ? "connector" : "shape",
|
|
20805
|
+
frame: transform2?.frame ?? { x: 0, y: 0, width: 0, height: 0 },
|
|
20806
|
+
geometry: geometry.geometry
|
|
20807
|
+
};
|
|
20808
|
+
const name3 = att(cNvPr, "name");
|
|
20809
|
+
if (name3) node3.name = name3;
|
|
20810
|
+
if (att(xdr(nv, "cNvSpPr"), "txBox") === "1") node3.textBox = true;
|
|
20811
|
+
if (transform2?.rotation) node3.rotation = transform2.rotation;
|
|
20812
|
+
if (transform2?.flipHorizontal) node3.flipH = true;
|
|
20813
|
+
if (transform2?.flipVertical) node3.flipV = true;
|
|
20814
|
+
if ("adjustments" in geometry && geometry.adjustments) node3.adjustments = geometry.adjustments;
|
|
20815
|
+
if ("paths" in geometry && geometry.paths) node3.paths = geometry.paths;
|
|
20816
|
+
if (!isGroup) {
|
|
20817
|
+
const fill = parseDrawingFill(spPr);
|
|
20818
|
+
if (fill) node3.fill = fill;
|
|
20819
|
+
const line = parseDrawingLine(first(spPr, "ln", NS.a));
|
|
20820
|
+
if (line) node3.line = line;
|
|
20821
|
+
const style2 = readStyle(xdr(element2, "style"));
|
|
20822
|
+
if (style2) node3.style = style2;
|
|
20823
|
+
const text5 = parseDrawingTextBody(xdr(element2, "txBody"));
|
|
20824
|
+
if (text5?.text) node3.text = text5;
|
|
20825
|
+
return node3;
|
|
20826
|
+
}
|
|
20827
|
+
const childFrame = parseFrameOf(first(xfrm, "chOff", NS.a), first(xfrm, "chExt", NS.a));
|
|
20828
|
+
if (childFrame) node3.childFrame = childFrame;
|
|
20829
|
+
node3.children = elements(element2).flatMap((child4) => {
|
|
20830
|
+
const read = readShapeNode(child4);
|
|
20831
|
+
return read ? [read] : [];
|
|
20832
|
+
});
|
|
20833
|
+
return node3;
|
|
20834
|
+
}
|
|
20835
|
+
function parseFrameOf(off, ext) {
|
|
20836
|
+
if (!off || !ext) return void 0;
|
|
20837
|
+
return {
|
|
20838
|
+
x: Number(att(off, "x") ?? 0),
|
|
20839
|
+
y: Number(att(off, "y") ?? 0),
|
|
20840
|
+
width: Number(att(ext, "cx") ?? 0),
|
|
20841
|
+
height: Number(att(ext, "cy") ?? 0)
|
|
20842
|
+
};
|
|
20843
|
+
}
|
|
20844
|
+
|
|
20845
|
+
// xlsx/read/drawing.ts
|
|
20846
|
+
var xdr2 = (parent, local) => first(parent, local, NS.xdr);
|
|
20847
|
+
var int2 = (parent, local) => Math.round(Number(xdr2(parent, local)?.textContent ?? 0)) || 0;
|
|
20151
20848
|
function marker(node3) {
|
|
20152
20849
|
return {
|
|
20153
20850
|
col: int2(node3, "col"),
|
|
@@ -20158,7 +20855,7 @@ function marker(node3) {
|
|
|
20158
20855
|
}
|
|
20159
20856
|
function readAnchor(anchor) {
|
|
20160
20857
|
if (anchor.localName === "absoluteAnchor") {
|
|
20161
|
-
const pos =
|
|
20858
|
+
const pos = xdr2(anchor, "pos");
|
|
20162
20859
|
const result3 = {
|
|
20163
20860
|
from: {
|
|
20164
20861
|
row: 0,
|
|
@@ -20167,26 +20864,26 @@ function readAnchor(anchor) {
|
|
|
20167
20864
|
rowOffset: Number(att(pos, "y") ?? 0)
|
|
20168
20865
|
}
|
|
20169
20866
|
};
|
|
20170
|
-
const ext2 =
|
|
20867
|
+
const ext2 = xdr2(anchor, "ext");
|
|
20171
20868
|
if (ext2) result3.ext = { cx: Number(att(ext2, "cx") ?? 0), cy: Number(att(ext2, "cy") ?? 0) };
|
|
20172
20869
|
return result3;
|
|
20173
20870
|
}
|
|
20174
|
-
const result2 = { from: marker(
|
|
20175
|
-
const to =
|
|
20871
|
+
const result2 = { from: marker(xdr2(anchor, "from")) };
|
|
20872
|
+
const to = xdr2(anchor, "to");
|
|
20176
20873
|
if (to) result2.to = marker(to);
|
|
20177
|
-
const ext =
|
|
20874
|
+
const ext = xdr2(anchor, "ext");
|
|
20178
20875
|
if (ext) result2.ext = { cx: Number(att(ext, "cx") ?? 0), cy: Number(att(ext, "cy") ?? 0) };
|
|
20179
20876
|
return result2;
|
|
20180
20877
|
}
|
|
20181
20878
|
var ANCHOR_PARTS = /* @__PURE__ */ new Set(["from", "to", "ext", "pos", "clientData"]);
|
|
20182
20879
|
function nonVisual(content2) {
|
|
20183
20880
|
const nv = elements(content2).find((node3) => node3.localName?.startsWith("nv"));
|
|
20184
|
-
return
|
|
20881
|
+
return xdr2(nv, "cNvPr");
|
|
20185
20882
|
}
|
|
20186
20883
|
function describe(content2) {
|
|
20187
20884
|
switch (content2.localName) {
|
|
20188
20885
|
case "sp":
|
|
20189
|
-
return
|
|
20886
|
+
return xdr2(content2, "nvSpPr") && att(xdr2(xdr2(content2, "nvSpPr"), "cNvSpPr"), "txBox") === "1" ? "text box" : "shape";
|
|
20190
20887
|
case "grpSp":
|
|
20191
20888
|
return "group";
|
|
20192
20889
|
case "cxnSp":
|
|
@@ -20206,6 +20903,11 @@ function parseDrawing(source, partName, warn) {
|
|
|
20206
20903
|
const rels = source.rels(partName);
|
|
20207
20904
|
const out = [];
|
|
20208
20905
|
for (const anchorEl of elements(root2)) {
|
|
20906
|
+
if (anchorEl.localName === "AlternateContent") {
|
|
20907
|
+
const control = readFormControlFrame(anchorEl, readAnchor);
|
|
20908
|
+
if (control) out.push(control);
|
|
20909
|
+
continue;
|
|
20910
|
+
}
|
|
20209
20911
|
if (!["twoCellAnchor", "oneCellAnchor", "absoluteAnchor"].includes(anchorEl.localName ?? ""))
|
|
20210
20912
|
continue;
|
|
20211
20913
|
const anchor = readAnchor(anchorEl);
|
|
@@ -20220,7 +20922,7 @@ function parseDrawing(source, partName, warn) {
|
|
|
20220
20922
|
const cNvPr = nonVisual(content2);
|
|
20221
20923
|
const name3 = att(cNvPr, "name");
|
|
20222
20924
|
if (content2.localName === "pic") {
|
|
20223
|
-
const blipFill =
|
|
20925
|
+
const blipFill = xdr2(content2, "blipFill");
|
|
20224
20926
|
const blip = first(blipFill, "blip", NS.a);
|
|
20225
20927
|
const rel = rels.get(relAttr(blip, "embed") ?? "");
|
|
20226
20928
|
const target2 = rel ? source.target(partName, rel) : void 0;
|
|
@@ -20295,11 +20997,50 @@ function parseDrawing(source, partName, warn) {
|
|
|
20295
20997
|
continue;
|
|
20296
20998
|
}
|
|
20297
20999
|
}
|
|
20298
|
-
|
|
21000
|
+
const shape = readShapeNode(content2);
|
|
21001
|
+
out.push({ ...unsupported4(describe(content2)), ...shape ? { shape } : {} });
|
|
20299
21002
|
}
|
|
20300
21003
|
return out;
|
|
20301
21004
|
}
|
|
20302
21005
|
|
|
21006
|
+
// xlsx/read/header-footer-images.ts
|
|
21007
|
+
var UNIT_PT = { pt: 1, in: 72, cm: 72 / 2.54, mm: 72 / 25.4, px: 0.75 };
|
|
21008
|
+
function styleLength(style2, property2) {
|
|
21009
|
+
const match = new RegExp(
|
|
21010
|
+
`(?:^|[;\\s])${property2}\\s*:\\s*([\\d.]+)\\s*(pt|in|cm|mm|px)?`,
|
|
21011
|
+
"i"
|
|
21012
|
+
).exec(style2);
|
|
21013
|
+
return match ? Number(match[1]) * (UNIT_PT[(match[2] ?? "pt").toLowerCase()] ?? 1) : 0;
|
|
21014
|
+
}
|
|
21015
|
+
function readHeaderFooterImages(source, sheetPart, legacyHF) {
|
|
21016
|
+
if (!legacyHF) return void 0;
|
|
21017
|
+
const rel = source.rels(sheetPart).get(relAttr(legacyHF, "id") ?? "");
|
|
21018
|
+
const vmlPart = rel ? source.target(sheetPart, rel) : void 0;
|
|
21019
|
+
const vml = vmlPart ? source.text(vmlPart) : void 0;
|
|
21020
|
+
if (!vmlPart || !vml) return void 0;
|
|
21021
|
+
const rels = source.rels(vmlPart);
|
|
21022
|
+
const images = {};
|
|
21023
|
+
for (const match of vml.matchAll(/<v:shape\b([^>]*)>([\s\S]*?)<\/v:shape>/g)) {
|
|
21024
|
+
const id3 = /\bid="([^"]+)"/.exec(match[1] ?? "")?.[1];
|
|
21025
|
+
const style2 = /style=(?:'([^']*)'|"([^"]*)")/.exec(match[1] ?? "");
|
|
21026
|
+
const data = /<v:imagedata\b([^>]*)>/.exec(match[2] ?? "")?.[1];
|
|
21027
|
+
const relId = /\bo:relid="([^"]+)"/.exec(data ?? "")?.[1];
|
|
21028
|
+
const imageRel = relId ? rels.get(relId) : void 0;
|
|
21029
|
+
const partName = imageRel ? source.target(vmlPart, imageRel) : void 0;
|
|
21030
|
+
if (!id3 || !partName || !source.has(partName)) continue;
|
|
21031
|
+
const css = style2?.[1] ?? style2?.[2] ?? "";
|
|
21032
|
+
const title = /\bo:title="([^"]*)"/.exec(data ?? "")?.[1];
|
|
21033
|
+
images[id3] = {
|
|
21034
|
+
partName,
|
|
21035
|
+
contentType: source.contentType(partName) ?? "application/octet-stream",
|
|
21036
|
+
widthPt: styleLength(css, "width"),
|
|
21037
|
+
heightPt: styleLength(css, "height"),
|
|
21038
|
+
...title ? { title } : {}
|
|
21039
|
+
};
|
|
21040
|
+
}
|
|
21041
|
+
return Object.keys(images).length ? images : void 0;
|
|
21042
|
+
}
|
|
21043
|
+
|
|
20303
21044
|
// xlsx/read/dates.ts
|
|
20304
21045
|
var DAY_MS2 = 864e5;
|
|
20305
21046
|
var EPOCH_19003 = Date.UTC(1899, 11, 30);
|
|
@@ -20441,6 +21182,8 @@ function readRowInfo(ctx, rowEl) {
|
|
|
20441
21182
|
const outline = numAttr(rowEl, "outlineLevel");
|
|
20442
21183
|
if (outline) info.outlineLevel = outline;
|
|
20443
21184
|
if (boolAttr(rowEl, "collapsed")) info.collapsed = true;
|
|
21185
|
+
if (boolAttr(rowEl, "thickTop")) info.thickTop = true;
|
|
21186
|
+
if (boolAttr(rowEl, "thickBot")) info.thickBot = true;
|
|
20444
21187
|
return Object.keys(info).length ? info : void 0;
|
|
20445
21188
|
}
|
|
20446
21189
|
function readSheetData(ctx, rows, sheet) {
|
|
@@ -20553,15 +21296,6 @@ function readScenarios(node3) {
|
|
|
20553
21296
|
return set;
|
|
20554
21297
|
}
|
|
20555
21298
|
|
|
20556
|
-
// xlsx/read/print-options.ts
|
|
20557
|
-
var KEYS = ["gridLines", "headings", "horizontalCentered", "verticalCentered"];
|
|
20558
|
-
function readPrintOptions(node3) {
|
|
20559
|
-
if (!node3) return void 0;
|
|
20560
|
-
const out = {};
|
|
20561
|
-
for (const key2 of KEYS) if (boolAttr(node3, key2)) out[key2] = true;
|
|
20562
|
-
return Object.keys(out).length ? out : void 0;
|
|
20563
|
-
}
|
|
20564
|
-
|
|
20565
21299
|
// xlsx/read/tables.ts
|
|
20566
21300
|
function parseTable(xml, partName) {
|
|
20567
21301
|
const root2 = parseXml(xml, { label: "XLSX table" }).documentElement;
|
|
@@ -20652,8 +21386,14 @@ var MODELLED = /* @__PURE__ */ new Set([
|
|
|
20652
21386
|
"drawing",
|
|
20653
21387
|
"legacyDrawing",
|
|
20654
21388
|
"tableParts",
|
|
20655
|
-
"scenarios"
|
|
21389
|
+
"scenarios",
|
|
21390
|
+
"customSheetViews"
|
|
20656
21391
|
]);
|
|
21392
|
+
function reportUnplaceable(ctx, sheet, element2) {
|
|
21393
|
+
ctx.warn(
|
|
21394
|
+
`Sheet "${sheet}": the element "${element2}" is not part of the worksheet schema and is dropped on save.`
|
|
21395
|
+
);
|
|
21396
|
+
}
|
|
20657
21397
|
function keep(sheet, key2, xml) {
|
|
20658
21398
|
const list2 = sheet.preserved.get(key2);
|
|
20659
21399
|
if (list2) list2.push(xml);
|
|
@@ -20735,9 +21475,15 @@ function readWorksheet(ctx, partName, name3, sheetId5, xml, rows) {
|
|
|
20735
21475
|
else if (!byName.has(local)) byName.set(local, node3);
|
|
20736
21476
|
if (SNAPSHOT_ELEMENTS.includes(local))
|
|
20737
21477
|
keep(sheet, snapshotKey(local), outerXml(node3));
|
|
20738
|
-
else if (local === "AlternateContent")
|
|
20739
|
-
|
|
20740
|
-
|
|
21478
|
+
else if (local === "AlternateContent") {
|
|
21479
|
+
const inner = alternateContentName(node3);
|
|
21480
|
+
if (!WORKSHEET_CHILD_ORDER.includes(inner ?? local))
|
|
21481
|
+
reportUnplaceable(ctx, name3, inner ?? local);
|
|
21482
|
+
keep(sheet, inner ?? local, selfContainedXml(node3));
|
|
21483
|
+
} else if (!MODELLED.has(local)) {
|
|
21484
|
+
if (!WORKSHEET_CHILD_ORDER.includes(local)) reportUnplaceable(ctx, name3, local);
|
|
21485
|
+
keep(sheet, local, selfContainedXml(node3));
|
|
21486
|
+
}
|
|
20741
21487
|
}
|
|
20742
21488
|
const sheetPr = byName.get("sheetPr");
|
|
20743
21489
|
const tabColor = readTabColor(sheetPr, ctx.palette);
|
|
@@ -20773,6 +21519,10 @@ function readWorksheet(ctx, partName, name3, sheetId5, xml, rows) {
|
|
|
20773
21519
|
readFitToPage(sheetPr)
|
|
20774
21520
|
);
|
|
20775
21521
|
if (page) sheet.pageSetup = page;
|
|
21522
|
+
const customViews = byName.get("customSheetViews");
|
|
21523
|
+
if (customViews) sheet.customViews = readCustomSheetViews(customViews);
|
|
21524
|
+
const hfImages = readHeaderFooterImages(ctx.source, partName, byName.get("legacyDrawingHF"));
|
|
21525
|
+
if (hfImages) sheet.headerFooterImages = hfImages;
|
|
20776
21526
|
const printOptions = readPrintOptions(byName.get("printOptions"));
|
|
20777
21527
|
if (printOptions) sheet.printOptions = printOptions;
|
|
20778
21528
|
const drawing = byName.get("drawing");
|
|
@@ -20780,6 +21530,7 @@ function readWorksheet(ctx, partName, name3, sheetId5, xml, rows) {
|
|
|
20780
21530
|
const rel = ctx.source.rels(partName).get(relAttr(drawing, "id") ?? "");
|
|
20781
21531
|
const target2 = rel ? ctx.source.target(partName, rel) : void 0;
|
|
20782
21532
|
if (target2) sheet.drawings = parseDrawing(ctx.source, target2, (m) => ctx.warn(m));
|
|
21533
|
+
attachFormControls(ctx.source, partName, root2, sheet, byName.get("legacyDrawing"));
|
|
20783
21534
|
}
|
|
20784
21535
|
readTables(ctx, partName, byName.get("tableParts"), sheet);
|
|
20785
21536
|
readComments(ctx, partName, sheet);
|
|
@@ -20888,6 +21639,7 @@ async function loadXlsx(input, options2 = {}) {
|
|
|
20888
21639
|
if (book.workbookPasswordHash) workbook.workbookPasswordHash = book.workbookPasswordHash;
|
|
20889
21640
|
if (book.workbookModernHash) workbook.workbookModernHash = book.workbookModernHash;
|
|
20890
21641
|
if (book.oleSize) workbook.oleSize = book.oleSize;
|
|
21642
|
+
if (book.customViews) workbook.customViews = book.customViews;
|
|
20891
21643
|
if (book.calcMode) workbook.calcMode = book.calcMode;
|
|
20892
21644
|
if (book.iterate) workbook.iterate = book.iterate;
|
|
20893
21645
|
if (signatures.hasSignatures)
|
|
@@ -22671,9 +23423,9 @@ function sampleArc(start, rxIn, ryIn, xAxisRotationDeg, largeArcFlag, sweepFlag,
|
|
|
22671
23423
|
ry *= scale;
|
|
22672
23424
|
}
|
|
22673
23425
|
const sign = largeArcFlag !== sweepFlag ? 1 : -1;
|
|
22674
|
-
const
|
|
23426
|
+
const num2 = rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p;
|
|
22675
23427
|
const den = rx * rx * y1p * y1p + ry * ry * x1p * x1p;
|
|
22676
|
-
const coef = sign * Math.sqrt(Math.max(0,
|
|
23428
|
+
const coef = sign * Math.sqrt(Math.max(0, num2 / den));
|
|
22677
23429
|
const cxp = coef * (rx * y1p) / ry;
|
|
22678
23430
|
const cyp = coef * -(ry * x1p) / rx;
|
|
22679
23431
|
const cx = cosPhi * cxp - sinPhi * cyp + (start.x + end.x) / 2;
|
|
@@ -28463,10 +29215,10 @@ function processCompoundFileStream(input, path3, replacement) {
|
|
|
28463
29215
|
if (input[0] !== 208 || input[1] !== 207 || input[2] !== 17 || input[3] !== 224 || input[4] !== 161 || input[5] !== 177 || input[6] !== 26 || input[7] !== 225 || // Readers tolerate a non-canonical byte-order mark; edits do not.
|
|
28464
29216
|
replacement && view2.getUint16(28, true) !== 65534)
|
|
28465
29217
|
return reject2();
|
|
28466
|
-
const major = view2.getUint16(26, true),
|
|
28467
|
-
if (major !== 3 && major !== 4 ||
|
|
29218
|
+
const major = view2.getUint16(26, true), shift3 = view2.getUint16(30, true), miniShift = view2.getUint16(32, true);
|
|
29219
|
+
if (major !== 3 && major !== 4 || shift3 !== (major === 3 ? 9 : 12) || miniShift !== 6)
|
|
28468
29220
|
return reject2();
|
|
28469
|
-
const sectorSize = 1 <<
|
|
29221
|
+
const sectorSize = 1 << shift3, miniSize = 1 << miniShift;
|
|
28470
29222
|
if (input.length < sectorSize || replacement && input.length % sectorSize !== 0)
|
|
28471
29223
|
return reject2();
|
|
28472
29224
|
const sectorCount = Math.ceil(input.length / sectorSize) - 1;
|
|
@@ -36210,7 +36962,7 @@ function readVsdDrawing(input) {
|
|
|
36210
36962
|
}
|
|
36211
36963
|
seen.add(offset);
|
|
36212
36964
|
active.add(offset);
|
|
36213
|
-
const compressed = (format5 & 2) !== 0,
|
|
36965
|
+
const compressed = (format5 & 2) !== 0, shift3 = compressed ? 4 : 0;
|
|
36214
36966
|
const bytes = compressed ? decodeVsdBlock(stream.subarray(offset, offset + length), decodedBudget) : stream.slice(offset, offset + length);
|
|
36215
36967
|
decodedBudget -= bytes.length;
|
|
36216
36968
|
if (decodedBudget < 0)
|
|
@@ -36225,17 +36977,17 @@ function readVsdDrawing(input) {
|
|
|
36225
36977
|
if (page && [71, 72, 78].includes(type)) {
|
|
36226
36978
|
shape = { id: id3, kind: type === 71 ? "group" : type === 78 ? "foreign" : "shape", coordinateSpace: "shape-local", unsupportedGeometry: false, unsafeTransform: false, geometry: [], unsafeText: false };
|
|
36227
36979
|
page.shapes.push(shape);
|
|
36228
|
-
if (bytes.length -
|
|
36980
|
+
if (bytes.length - shift3 >= 54) {
|
|
36229
36981
|
const sv = view(bytes);
|
|
36230
|
-
shape.parentId = sv.getUint32(
|
|
36231
|
-
shape.masterPageId = sv.getUint32(
|
|
36232
|
-
shape.masterShapeId = sv.getUint32(
|
|
36982
|
+
shape.parentId = sv.getUint32(shift3 + 10, true);
|
|
36983
|
+
shape.masterPageId = sv.getUint32(shift3 + 18, true);
|
|
36984
|
+
shape.masterShapeId = sv.getUint32(shift3 + 26, true);
|
|
36233
36985
|
}
|
|
36234
36986
|
}
|
|
36235
36987
|
const mode = format5 >>> 4;
|
|
36236
36988
|
if (mode === 5 || type === 20) {
|
|
36237
|
-
bounded3(bytes,
|
|
36238
|
-
const table2 = view(bytes).getUint32(
|
|
36989
|
+
bounded3(bytes, shift3, 4);
|
|
36990
|
+
const table2 = view(bytes).getUint32(shift3, true) + shift3 - 4;
|
|
36239
36991
|
bounded3(bytes, table2, 12);
|
|
36240
36992
|
const count = view(bytes).getInt32(table2 + 4, true), order = view(bytes).getUint32(table2, true);
|
|
36241
36993
|
if (count < 0 || count > 1e5 || count > Math.floor((bytes.length - table2 - 12) / 18))
|
|
@@ -37372,8 +38124,13 @@ function resolveVisioPageVisibility(page, options2 = {}) {
|
|
|
37372
38124
|
}
|
|
37373
38125
|
|
|
37374
38126
|
// visio/edit-formatting-scope.ts
|
|
37375
|
-
async function assertFormattingDependencies(pkg, pagePaths, roots, pageId2, shape, changed, check, instanceView2) {
|
|
37376
|
-
indexCells(roots, { check })
|
|
38127
|
+
async function assertFormattingDependencies(pkg, pagePaths, roots, pageId2, shape, changed, check, instanceView2, options2 = {}) {
|
|
38128
|
+
for (const item2 of indexCells(roots, { check, scope: "affected" }).values())
|
|
38129
|
+
if (item2.refusal && item2.pageId === pageId2)
|
|
38130
|
+
fail(
|
|
38131
|
+
"EDIT_UNKNOWN_DEPENDENCY",
|
|
38132
|
+
`Cannot prove ShapeSheet dependency closure: ${item2.refusal}`
|
|
38133
|
+
);
|
|
37377
38134
|
const shapeId2 = attribute2(shape, "ID");
|
|
37378
38135
|
const changedNames = new Set([...changed.keys()].map((name3) => name3.toLowerCase()));
|
|
37379
38136
|
const jumpOnly = [...changedNames].every(
|
|
@@ -37428,11 +38185,17 @@ async function assertFormattingDependencies(pkg, pagePaths, roots, pageId2, shap
|
|
|
37428
38185
|
if (textEdit && localShapeId === shapeId2 && sourcePageId === pageId2) continue;
|
|
37429
38186
|
analysis = sized;
|
|
37430
38187
|
}
|
|
38188
|
+
if (options2.textReads && textEdit && !named2 && sourcePageId !== void 0 && textReadFormula(source))
|
|
38189
|
+
continue;
|
|
37431
38190
|
if (named2 && analysis.dynamic) {
|
|
37432
38191
|
if (mentions()) failure2();
|
|
37433
38192
|
continue;
|
|
37434
38193
|
}
|
|
37435
|
-
if (analysis.dynamic
|
|
38194
|
+
if (analysis.dynamic && analysis.opaque) {
|
|
38195
|
+
if (sourcePageId === pageId2 || mentions()) failure2();
|
|
38196
|
+
continue;
|
|
38197
|
+
}
|
|
38198
|
+
if (analysis.references.some(
|
|
37436
38199
|
(ref) => changedNames.has(canonical2(ref.cell)) && (sourcePageId === void 0 || sourcePageId === pageId2) && (ref.shapeId === shapeId2 || ref.shapeId === void 0 && (localShapeId === shapeId2 || sourcePageId === void 0))
|
|
37437
38200
|
))
|
|
37438
38201
|
failure2();
|
|
@@ -37445,6 +38208,7 @@ async function assertFormattingDependencies(pkg, pagePaths, roots, pageId2, shap
|
|
|
37445
38208
|
const part = await pkg.readXml(path3);
|
|
37446
38209
|
const master2 = part.localName === "MasterContents";
|
|
37447
38210
|
if (instanceView2 && master2) continue;
|
|
38211
|
+
if (master2 && !shape.hasAttribute("Master") && !shape.hasAttribute("MasterShape")) continue;
|
|
37448
38212
|
inspect7(part, void 0, master2);
|
|
37449
38213
|
}
|
|
37450
38214
|
}
|
|
@@ -37647,7 +38411,7 @@ function masterTemplate(pkg) {
|
|
|
37647
38411
|
return matches2.length === 1 ? matches2[0] : missing();
|
|
37648
38412
|
};
|
|
37649
38413
|
}
|
|
37650
|
-
function replaceScopedPlainText(pkg, pagePaths, roots, document, edit, check) {
|
|
38414
|
+
function replaceScopedPlainText(pkg, pagePaths, roots, document, edit, check, diagnostics = []) {
|
|
37651
38415
|
return replacePlainText(
|
|
37652
38416
|
roots.get(edit.pageId),
|
|
37653
38417
|
document,
|
|
@@ -37661,10 +38425,20 @@ function replaceScopedPlainText(pkg, pagePaths, roots, document, edit, check) {
|
|
|
37661
38425
|
edit.pageId,
|
|
37662
38426
|
shape,
|
|
37663
38427
|
/* @__PURE__ */ new Map([["TheText", text5]]),
|
|
37664
|
-
check
|
|
38428
|
+
check,
|
|
38429
|
+
void 0,
|
|
38430
|
+
{ textReads: true }
|
|
37665
38431
|
),
|
|
37666
38432
|
masterTemplate(pkg)
|
|
37667
|
-
)
|
|
38433
|
+
).then((changed) => {
|
|
38434
|
+
if (changed)
|
|
38435
|
+
recalculateVisioCells(
|
|
38436
|
+
roots,
|
|
38437
|
+
[{ pageId: edit.pageId, shapeId: edit.shapeId, cell: "TheText" }],
|
|
38438
|
+
{ check, cycles: "keep", diagnostics }
|
|
38439
|
+
);
|
|
38440
|
+
return changed;
|
|
38441
|
+
});
|
|
37668
38442
|
}
|
|
37669
38443
|
|
|
37670
38444
|
// visio/edit-stencil-connector.ts
|
|
@@ -38928,9 +39702,16 @@ function visioWalkPath(begin, end) {
|
|
|
38928
39702
|
return horizontal2 ? [p, { x: p.x + turn, y: p.y }, { x: p.x + turn, y: q.y }, q] : [p, { x: p.x, y: p.y + turn }, { x: q.x, y: p.y + turn }, q];
|
|
38929
39703
|
};
|
|
38930
39704
|
let path3;
|
|
38931
|
-
if (gapX >= -EPSILON3 && inside2(from.y, b.minY, b.maxY))
|
|
38932
|
-
|
|
38933
|
-
|
|
39705
|
+
if (gapX >= -EPSILON3 && inside2(from.y, b.minY, b.maxY)) {
|
|
39706
|
+
const p = side(begin, sx, 0), q = side(end, -sx, 0);
|
|
39707
|
+
if (begin.shape?.floating && end.shape?.floating) {
|
|
39708
|
+
const y = (Math.max(a2.minY, b.minY) + Math.min(a2.maxY, b.maxY)) / 2;
|
|
39709
|
+
path3 = [
|
|
39710
|
+
{ x: p.x, y },
|
|
39711
|
+
{ x: q.x, y }
|
|
39712
|
+
];
|
|
39713
|
+
} else path3 = jog(p, q, true);
|
|
39714
|
+
} else if (gapY >= -EPSILON3 && inside2(from.x, b.minX, b.maxX))
|
|
38934
39715
|
path3 = jog(side(begin, 0, sy), side(end, 0, -sy), false);
|
|
38935
39716
|
else if (gapY < -EPSILON3 || gapY < CHANNEL && gapX >= CHANNEL) {
|
|
38936
39717
|
const p = side(begin, sx, 0);
|
|
@@ -39566,7 +40347,7 @@ function writeStencilConnector(shape, route, vertices) {
|
|
|
39566
40347
|
|
|
39567
40348
|
// visio/edit-stencil-connector-layout.ts
|
|
39568
40349
|
var same6 = (a2, b) => Math.abs(a2 - b) <= 1e-9 * Math.max(1, Math.abs(a2), Math.abs(b));
|
|
39569
|
-
function walkShape(box4) {
|
|
40350
|
+
function walkShape(box4, floating = false) {
|
|
39570
40351
|
const [a2, b, c2, d, e, f] = box4.transform;
|
|
39571
40352
|
const at2 = (x, y) => ({
|
|
39572
40353
|
x: a2 * x + c2 * y + e,
|
|
@@ -39578,7 +40359,8 @@ function walkShape(box4) {
|
|
|
39578
40359
|
sites: sites.map((site) => ({ point: site.point, normal: site.normal })),
|
|
39579
40360
|
bounds: sites[0].box,
|
|
39580
40361
|
center: at2(box4.width / 2, box4.height / 2),
|
|
39581
|
-
corners: [at2(0, 0), at2(box4.width, 0), at2(box4.width, box4.height), at2(0, box4.height)]
|
|
40362
|
+
corners: [at2(0, 0), at2(box4.width, 0), at2(box4.width, box4.height), at2(0, box4.height)],
|
|
40363
|
+
...floating ? { floating } : {}
|
|
39582
40364
|
}
|
|
39583
40365
|
};
|
|
39584
40366
|
}
|
|
@@ -39799,6 +40581,11 @@ function connectionRows(shape) {
|
|
|
39799
40581
|
}
|
|
39800
40582
|
return rows;
|
|
39801
40583
|
}
|
|
40584
|
+
function hasConnectionPoints(root2, shapeId2) {
|
|
40585
|
+
const target2 = topShape(root2, shapeId2);
|
|
40586
|
+
if (!target2) return false;
|
|
40587
|
+
return (stencilTemplate(target2) ? effectiveRows(target2, "Connection") : connectionRows(target2)).size > 0;
|
|
40588
|
+
}
|
|
39802
40589
|
function glueSites(root2, end) {
|
|
39803
40590
|
const box4 = glueBox(root2, end.target);
|
|
39804
40591
|
if (end.point === void 0) return dynamicSites(box4);
|
|
@@ -39909,8 +40696,9 @@ function proveConnector(root2, connectorId) {
|
|
|
39909
40696
|
const named2 = visioPointGlueTarget(source);
|
|
39910
40697
|
return index2 === void 0 ? !named2 : !!named2 && named2.shapeId === target2 && named2.index === index2;
|
|
39911
40698
|
};
|
|
39912
|
-
if (!end || !target2 || ends[end] !== void 0 || (index2 === void 0 ? toCell !== "PinX" || attribute2(row2, "ToPart") !== "3" : attribute2(row2, "ToPart") !== String(100 + index2)) || // A line master has no glue trigger of its own unless Visio wrote one with the glue
|
|
39913
|
-
|
|
40699
|
+
if (!end || !target2 || ends[end] !== void 0 || (index2 === void 0 ? toCell !== "PinX" || attribute2(row2, "ToPart") !== "3" : attribute2(row2, "ToPart") !== String(100 + index2)) || // A line master has no glue trigger of its own unless Visio wrote one with the glue, and
|
|
40700
|
+
// point glue on a drawn line has none either (native-edit-families-flat-2026-10-29.json).
|
|
40701
|
+
visioGlueTriggerTarget(formula2(triggerName(end))) !== target2 && !(formula2(triggerName(end)) === void 0 && !local.has(triggerName(end)) && (isStencilLine(shape) || index2 !== void 0)) || !glued("X") || !glued("Y"))
|
|
39914
40702
|
fail("UNSUPPORTED_GEOMETRY_EDIT", UNSUPPORTED2);
|
|
39915
40703
|
ends[end] = { target: target2, ...index2 === void 0 ? {} : { point: index2 } };
|
|
39916
40704
|
}
|
|
@@ -40176,7 +40964,7 @@ function rerouteConnector(roots, pageId2, glue, check, options2 = {}) {
|
|
|
40176
40964
|
}
|
|
40177
40965
|
const walk = (end) => {
|
|
40178
40966
|
const target2 = glue.ends[end];
|
|
40179
|
-
return target2 && target2.point === void 0 ? walkShape(glueBox(root2, target2.target)) : { point: sites(end)[0].point };
|
|
40967
|
+
return target2 && target2.point === void 0 ? walkShape(glueBox(root2, target2.target), !hasConnectionPoints(root2, target2.target)) : { point: sites(end)[0].point };
|
|
40180
40968
|
};
|
|
40181
40969
|
const route = options2.route ?? current;
|
|
40182
40970
|
if (route === "straight" && current === "straight" && ENDS.every(
|
|
@@ -41447,7 +42235,7 @@ var unquotedVisioFormula = (source) => source.split(/("(?:[^"]|"")*")/g).map((pa
|
|
|
41447
42235
|
|
|
41448
42236
|
// visio/formula-functions.ts
|
|
41449
42237
|
var DOCUMENTED = new Set(
|
|
41450
|
-
`ABS ACOS AND ANG360 ANGLEALONGPATH ANGLETOLOC ANGLETOPAR ASIN ATAN ATAN2 BITAND BITNOT BITOR
|
|
42238
|
+
`ABS ACOS AND ARG ANG360 ANGLEALONGPATH ANGLETOLOC ANGLETOPAR ASIN ATAN ATAN2 BITAND BITNOT BITOR
|
|
41451
42239
|
BITXOR BKGPAGENAME BLEND BLOB BLUE BOUND CALLOUTCOUNT CALLOUTTARGETREF CALLTHIS CATEGORY CEILING
|
|
41452
42240
|
CELLISTHEMED CHAR COMPANY CONTAINERCOUNT CONTAINERMEMBERCOUNT CONTAINERSHEETREF COS COSH CREATOR
|
|
41453
42241
|
CY DATA1 DATA2 DATA3 DATE DATETIME DATEVALUE DAY DAYOFYEAR DECIMALSEP DEFAULTEVENT DEG DEPENDSON
|
|
@@ -42976,17 +43764,17 @@ function pageSettingConstant(node3, length) {
|
|
|
42976
43764
|
}
|
|
42977
43765
|
return value3.value;
|
|
42978
43766
|
}
|
|
42979
|
-
var
|
|
43767
|
+
var escape3 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
42980
43768
|
function assertDependencies(roots, pagesPart, pages, pagePaths, pageId2, changed, check) {
|
|
42981
43769
|
const page = children2(pages, "Page").find((node3) => attribute2(node3, "ID") === pageId2);
|
|
42982
43770
|
const targetNames = new Set(
|
|
42983
43771
|
["Name", "NameU"].map((name3) => attribute2(page, name3)?.toLowerCase())
|
|
42984
43772
|
);
|
|
42985
43773
|
const otherNames = children2(pages, "Page").filter((node3) => node3 !== page).flatMap((node3) => ["Name", "NameU"].map((name3) => attribute2(node3, name3))).filter((name3) => !!name3 && !targetNames.has(name3.toLowerCase()));
|
|
42986
|
-
const cells4 = changed.map(
|
|
43774
|
+
const cells4 = changed.map(escape3).join("|");
|
|
42987
43775
|
const reference2 = new RegExp(`(?:^|[^a-z0-9_.])(?:${cells4})(?:$|[^a-z0-9_.])`, "i");
|
|
42988
43776
|
const other = otherNames.length ? new RegExp(
|
|
42989
|
-
`Pages\\[(?:${otherNames.map(
|
|
43777
|
+
`Pages\\[(?:${otherNames.map(escape3).join("|")})\\]!(?:ThePage!)?(?:${cells4})(?![a-z0-9_.])`,
|
|
42990
43778
|
"gi"
|
|
42991
43779
|
) : void 0;
|
|
42992
43780
|
const paths = new Map([...pagePaths].map(([id3, path3]) => [path3, id3]));
|
|
@@ -43405,7 +44193,7 @@ var VISIO_DEFAULT_TITLE = "Title";
|
|
|
43405
44193
|
var ACCENT = { background: "Background Accent", border: "Border Accent" };
|
|
43406
44194
|
function visioShade(color2, amount) {
|
|
43407
44195
|
const value3 = Number.parseInt(color2.slice(1), 16);
|
|
43408
|
-
const channel = (
|
|
44196
|
+
const channel = (shift3) => Math.round((value3 >> shift3 & 255) * (1 - amount)).toString(16).padStart(2, "0");
|
|
43409
44197
|
return `#${channel(16)}${channel(8)}${channel(0)}`.toUpperCase();
|
|
43410
44198
|
}
|
|
43411
44199
|
function visioDecorationName(name3) {
|
|
@@ -43602,14 +44390,14 @@ function snapshotPageSetupEdit(edit) {
|
|
|
43602
44390
|
}
|
|
43603
44391
|
|
|
43604
44392
|
// visio/edit-data-commands.ts
|
|
43605
|
-
var
|
|
44393
|
+
var TYPES2 = [
|
|
43606
44394
|
"import-data-recordset",
|
|
43607
44395
|
"refresh-data-recordset",
|
|
43608
44396
|
"delete-data-recordset",
|
|
43609
44397
|
"link-data-rows",
|
|
43610
44398
|
"unlink-data-rows"
|
|
43611
44399
|
];
|
|
43612
|
-
var isVisioDataEdit = (edit) =>
|
|
44400
|
+
var isVisioDataEdit = (edit) => TYPES2.includes(edit.type);
|
|
43613
44401
|
var id = (value3, label) => {
|
|
43614
44402
|
if (typeof value3 !== "string" || !/^(0|[1-9]\d{0,9})$/.test(value3) || Number(value3) > 4294967295)
|
|
43615
44403
|
fail("INVALID_EDIT", `Invalid ${label}.`);
|
|
@@ -46082,6 +46870,7 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
|
|
|
46082
46870
|
fail("UNSUPPORTED_GEOMETRY_EDIT", "Glued shapes require routing outside this subset.");
|
|
46083
46871
|
const graph = indexCells(roots, {
|
|
46084
46872
|
check,
|
|
46873
|
+
scope: "affected",
|
|
46085
46874
|
glueShapes,
|
|
46086
46875
|
...group2 ? { groupResizeShapes: group2.shapes } : {}
|
|
46087
46876
|
});
|
|
@@ -46395,13 +47184,23 @@ function prepareMasterMovePins(roots, commands, bindings, check) {
|
|
|
46395
47184
|
}
|
|
46396
47185
|
}
|
|
46397
47186
|
if (result2.size) {
|
|
46398
|
-
const indexed = indexCells(roots, { check });
|
|
47187
|
+
const indexed = indexCells(roots, { check, scope: "affected" });
|
|
46399
47188
|
const pins = new Set(
|
|
46400
47189
|
[...indexed.values()].filter((cell) => cell.node && result2.has(cell.node)).map(key)
|
|
46401
47190
|
);
|
|
46402
|
-
|
|
46403
|
-
|
|
47191
|
+
const pinPages = new Set(
|
|
47192
|
+
[...indexed.values()].filter((cell) => cell.node && result2.has(cell.node)).map((c2) => c2.pageId)
|
|
47193
|
+
);
|
|
47194
|
+
for (const cell of indexed.values()) {
|
|
47195
|
+
charge();
|
|
47196
|
+
if (cell.opaque && pinPages.has(cell.pageId))
|
|
47197
|
+
fail(
|
|
47198
|
+
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
47199
|
+
"A formula that may read a master rotation pin exists."
|
|
47200
|
+
);
|
|
47201
|
+
if (cell.dependencies.some((dependency) => pins.has(dependency)))
|
|
46404
47202
|
fail("EDIT_UNSUPPORTED_DEPENDENCY", "A page cache depends on a master rotation pin.");
|
|
47203
|
+
}
|
|
46405
47204
|
}
|
|
46406
47205
|
return { pins: result2, dimensions: provenDimensions };
|
|
46407
47206
|
}
|
|
@@ -46498,8 +47297,12 @@ function applyGeometryEdit(roots, document, edit, check, masterMoveProof = empty
|
|
|
46498
47297
|
if (edit.type === "delete-shape") {
|
|
46499
47298
|
unlocked("LockDelete");
|
|
46500
47299
|
releaseDeletedGlue(roots, /* @__PURE__ */ new Map([[edit.pageId, /* @__PURE__ */ new Set([edit.shapeId])]]));
|
|
46501
|
-
assertVisioShapeUnreferenced(roots, edit.pageId, edit.shapeId, {
|
|
47300
|
+
const frozen = assertVisioShapeUnreferenced(roots, edit.pageId, edit.shapeId, {
|
|
47301
|
+
check,
|
|
47302
|
+
freeze: true
|
|
47303
|
+
});
|
|
46502
47304
|
shape.parentNode.removeChild(shape);
|
|
47305
|
+
freezeVisioCells(frozen);
|
|
46503
47306
|
return [edit.pageId];
|
|
46504
47307
|
}
|
|
46505
47308
|
if (edit.type === "rotate-shape" || edit.type === "flip-shape") {
|
|
@@ -47437,7 +48240,7 @@ async function recalculatePageFormulas(pkg, pagesPart, pages, paths, dirty, chec
|
|
|
47437
48240
|
}
|
|
47438
48241
|
|
|
47439
48242
|
// visio/edit-page-rename.ts
|
|
47440
|
-
var
|
|
48243
|
+
var escape4 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
47441
48244
|
function localCell(node3) {
|
|
47442
48245
|
const row2 = node3.parentNode;
|
|
47443
48246
|
const section3 = row2?.parentNode;
|
|
@@ -47466,7 +48269,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
|
|
|
47466
48269
|
}
|
|
47467
48270
|
const roots = await editableVisioPageRoots(pkg, pagesPart, pages, pagePaths, dirty, check);
|
|
47468
48271
|
const changedCells = [];
|
|
47469
|
-
const prefix2 = new RegExp(`Pages\\[${
|
|
48272
|
+
const prefix2 = new RegExp(`Pages\\[${escape4(oldUniversal)}\\]!`, "gi");
|
|
47470
48273
|
const targetByPath = new Map([...pagePaths].map(([id3, path3]) => [path3, id3]));
|
|
47471
48274
|
for (const [path3, root2] of roots) {
|
|
47472
48275
|
let changed = false;
|
|
@@ -47500,7 +48303,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
|
|
|
47500
48303
|
if (cell) changedCells.push({ node: node3, cell });
|
|
47501
48304
|
}
|
|
47502
48305
|
} else if (/\bPAGENAME\s*\(/i.test(code)) {
|
|
47503
|
-
if (target2 === pageId2 || !target2 || new RegExp(`Pages\\[${
|
|
48306
|
+
if (target2 === pageId2 || !target2 || new RegExp(`Pages\\[${escape4(oldUniversal)}\\]!`, "i").test(code))
|
|
47504
48307
|
fail(
|
|
47505
48308
|
"EDIT_UNSUPPORTED_PAGE_NAME_FORMULA",
|
|
47506
48309
|
"Complex page-name formula caches cannot be safely refreshed."
|
|
@@ -47550,7 +48353,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
|
|
|
47550
48353
|
for (const changed of changedCells) {
|
|
47551
48354
|
if (changed.node === node3) continue;
|
|
47552
48355
|
const reference2 = new RegExp(
|
|
47553
|
-
`(?:^|[^a-z0-9_.])${
|
|
48356
|
+
`(?:^|[^a-z0-9_.])${escape4(changed.cell)}(?:$|[^a-z0-9_.])`,
|
|
47554
48357
|
"i"
|
|
47555
48358
|
);
|
|
47556
48359
|
if (reference2.test(unquotedVisioFormula(formula2)))
|
|
@@ -47572,7 +48375,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
|
|
|
47572
48375
|
// visio/edit-page-delete.ts
|
|
47573
48376
|
var officeRel = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
47574
48377
|
var pageType = "http://schemas.microsoft.com/visio/2010/relationships/page";
|
|
47575
|
-
var
|
|
48378
|
+
var escape5 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
47576
48379
|
async function deleteVisioPage(pkg, pagesPart, pages, rels, types, pagePaths, parts, dirty, removed, pageId2, check) {
|
|
47577
48380
|
const existing = children2(pages, "Page");
|
|
47578
48381
|
const page = existing.find((node3) => attribute2(node3, "ID") === pageId2);
|
|
@@ -47581,7 +48384,7 @@ async function deleteVisioPage(pkg, pagesPart, pages, rels, types, pagePaths, pa
|
|
|
47581
48384
|
const names = new Set(
|
|
47582
48385
|
["Name", "NameU"].map((key2) => attribute2(page, key2)).filter((value3) => !!value3)
|
|
47583
48386
|
);
|
|
47584
|
-
const reference2 = new RegExp(`Pages\\[(?:${[...names].map(
|
|
48387
|
+
const reference2 = new RegExp(`Pages\\[(?:${[...names].map(escape5).join("|")})\\]!`, "i");
|
|
47585
48388
|
const documentPart2 = await related(pkg, "", "document");
|
|
47586
48389
|
const roots = await editableVisioPageRoots(
|
|
47587
48390
|
pkg,
|
|
@@ -47906,7 +48709,7 @@ function createVisioPagePart(parts, pages, pageId2, check) {
|
|
|
47906
48709
|
}
|
|
47907
48710
|
|
|
47908
48711
|
// visio/edit-page-decoration.ts
|
|
47909
|
-
var
|
|
48712
|
+
var escape6 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
47910
48713
|
var name2 = (page) => attribute2(page, "NameU") ?? attribute2(page, "Name") ?? "";
|
|
47911
48714
|
function largestShapeId(root2) {
|
|
47912
48715
|
let largest = 0;
|
|
@@ -47922,9 +48725,9 @@ function removeDecoration(root2, pageName, kind, pageRoots, check) {
|
|
|
47922
48725
|
) : [];
|
|
47923
48726
|
if (!targets.length) return false;
|
|
47924
48727
|
const ids = targets.map((shape) => attribute2(shape, "ID") ?? "");
|
|
47925
|
-
const local = new RegExp(`\\bSheet\\.(?:${ids.map(
|
|
48728
|
+
const local = new RegExp(`\\bSheet\\.(?:${ids.map(escape6).join("|")})!`, "i");
|
|
47926
48729
|
const remote = new RegExp(
|
|
47927
|
-
`Pages\\[${
|
|
48730
|
+
`Pages\\[${escape6(pageName)}\\]!Sheet\\.(?:${ids.map(escape6).join("|")})!`,
|
|
47928
48731
|
"i"
|
|
47929
48732
|
);
|
|
47930
48733
|
for (const connect of children2(root2, "Connects").flatMap((node3) => children2(node3, "Connect")))
|
|
@@ -48758,17 +49561,117 @@ async function formatTarget(pkg, pagePaths, roots, document, edit, check, instan
|
|
|
48758
49561
|
return true;
|
|
48759
49562
|
}
|
|
48760
49563
|
|
|
49564
|
+
// visio/edit-duplicate-line.ts
|
|
49565
|
+
var ENDS2 = ["BeginX", "BeginY", "EndX", "EndY"];
|
|
49566
|
+
var connects = (root2) => children2(root2, "Connects").flatMap((container) => children2(container, "Connect"));
|
|
49567
|
+
var gluedTargets = (root2, id3) => connects(root2).filter((row2) => attribute2(row2, "FromSheet") === id3).map((row2) => attribute2(row2, "ToSheet") ?? "");
|
|
49568
|
+
function assertGlueDroppable(root2, id3, copied, code = "UNSUPPORTED_DUPLICATE") {
|
|
49569
|
+
if (gluedTargets(root2, id3).some((target2) => copied.has(target2)))
|
|
49570
|
+
fail(code, "A glued connector cannot be copied together with a shape it is glued to yet.");
|
|
49571
|
+
}
|
|
49572
|
+
function assertEndFormulas(read, code) {
|
|
49573
|
+
for (const name3 of ENDS2) {
|
|
49574
|
+
const formula2 = executableCellFormula(attribute2(read(name3), "F"));
|
|
49575
|
+
if (formula2 && !isNativeGlueCell(name3, formula2))
|
|
49576
|
+
fail(code, `${name3} of the line holds a formula that is not native glue.`);
|
|
49577
|
+
}
|
|
49578
|
+
}
|
|
49579
|
+
var isLineSheet2 = (shape) => ENDS2.some((name3) => cells(shape).has(name3));
|
|
49580
|
+
function planLineCopy(shape, code = "UNSUPPORTED_DUPLICATE") {
|
|
49581
|
+
proveLocalLine(shape);
|
|
49582
|
+
assertEndFormulas((name3) => cells(shape).get(name3), code);
|
|
49583
|
+
const local = cells(shape);
|
|
49584
|
+
return { x: numeric(local.get("PinX")), y: numeric(local.get("PinY")) };
|
|
49585
|
+
}
|
|
49586
|
+
var shift2 = (node3, delta, name3) => {
|
|
49587
|
+
if (!node3) fail("UNSUPPORTED_DUPLICATE", `The line has no local ${name3}.`);
|
|
49588
|
+
const value3 = numeric(node3);
|
|
49589
|
+
node3.setAttribute("V", String(Object.is(value3 + delta, -0) ? 0 : value3 + delta));
|
|
49590
|
+
node3.removeAttribute("E");
|
|
49591
|
+
};
|
|
49592
|
+
function finishLineCopy(shape, dx, dy) {
|
|
49593
|
+
const local = cells(shape);
|
|
49594
|
+
for (const name3 of ENDS2) {
|
|
49595
|
+
const node3 = local.get(name3);
|
|
49596
|
+
const formula2 = executableCellFormula(attribute2(node3, "F"));
|
|
49597
|
+
if (formula2 && isNativeGlueCell(name3, formula2)) node3.removeAttribute("F");
|
|
49598
|
+
shift2(node3, name3.endsWith("X") ? dx : dy, name3);
|
|
49599
|
+
}
|
|
49600
|
+
shift2(local.get("PinX"), dx, "PinX");
|
|
49601
|
+
shift2(local.get("PinY"), dy, "PinY");
|
|
49602
|
+
}
|
|
49603
|
+
var isStencilConnector2 = (target2) => ENDS2.some((name3) => instanceCell(target2, name3));
|
|
49604
|
+
function planConnectorCopy(target2, code = "UNSUPPORTED_DUPLICATE") {
|
|
49605
|
+
const local = cells(target2.instance);
|
|
49606
|
+
for (const name3 of [...ENDS2, "PinX", "PinY"]) {
|
|
49607
|
+
const node3 = local.get(name3);
|
|
49608
|
+
if (!node3?.hasAttribute("V") || node3.hasAttribute("E"))
|
|
49609
|
+
fail(code, `The stencil connector has no usable local ${name3}.`);
|
|
49610
|
+
numeric(node3);
|
|
49611
|
+
}
|
|
49612
|
+
assertEndFormulas((name3) => local.get(name3), code);
|
|
49613
|
+
return { x: numeric(local.get("PinX")), y: numeric(local.get("PinY")) };
|
|
49614
|
+
}
|
|
49615
|
+
function finishConnectorCopy(shape, id3, dx, dy) {
|
|
49616
|
+
const local = cells(shape);
|
|
49617
|
+
for (const name3 of ENDS2) shift2(local.get(name3), name3.endsWith("X") ? dx : dy, name3);
|
|
49618
|
+
shift2(local.get("PinX"), dx, "PinX");
|
|
49619
|
+
shift2(local.get("PinY"), dy, "PinY");
|
|
49620
|
+
for (const name3 of ["BegTrigger", "EndTrigger"]) {
|
|
49621
|
+
const node3 = local.get(name3);
|
|
49622
|
+
if (!node3) continue;
|
|
49623
|
+
node3.setAttribute("F", visioGlueTrigger(id3));
|
|
49624
|
+
node3.setAttribute("V", "1");
|
|
49625
|
+
}
|
|
49626
|
+
}
|
|
49627
|
+
var CLEARANCE = 0.25;
|
|
49628
|
+
var endsBox = (shape, dx, dy) => {
|
|
49629
|
+
const local = cells(shape);
|
|
49630
|
+
const x = [numeric(local.get("BeginX")) + dx, numeric(local.get("EndX")) + dx];
|
|
49631
|
+
const y = [numeric(local.get("BeginY")) + dy, numeric(local.get("EndY")) + dy];
|
|
49632
|
+
return {
|
|
49633
|
+
minX: Math.min(...x) - CLEARANCE,
|
|
49634
|
+
maxX: Math.max(...x) + CLEARANCE,
|
|
49635
|
+
minY: Math.min(...y) - CLEARANCE,
|
|
49636
|
+
maxY: Math.max(...y) + CLEARANCE
|
|
49637
|
+
};
|
|
49638
|
+
};
|
|
49639
|
+
function assertConnectorCopyApart(root2, copies, dx, dy, code = "UNSUPPORTED_DUPLICATE") {
|
|
49640
|
+
const boxes = copies.map((shape) => endsBox(shape, dx, dy));
|
|
49641
|
+
for (const container of children2(root2, "Shapes"))
|
|
49642
|
+
for (const other of children2(container, "Shape")) {
|
|
49643
|
+
const local = cells(other);
|
|
49644
|
+
const formula2 = executableCellFormula(attribute2(local.get("BeginX"), "F")) ?? "";
|
|
49645
|
+
if (!/^_WALKGLUE\(/i.test(formula2)) continue;
|
|
49646
|
+
const box4 = endsBox(other, 0, 0);
|
|
49647
|
+
for (const copy8 of boxes)
|
|
49648
|
+
if (copy8.minX <= box4.maxX && box4.minX <= copy8.maxX && copy8.minY <= box4.maxY && box4.minY <= copy8.maxY)
|
|
49649
|
+
fail(
|
|
49650
|
+
code,
|
|
49651
|
+
"The copy of a connector would meet another connector, which Visio lays out again."
|
|
49652
|
+
);
|
|
49653
|
+
}
|
|
49654
|
+
}
|
|
49655
|
+
|
|
48761
49656
|
// visio/edit-instance-duplicate.ts
|
|
48762
|
-
async function planInstanceCopy(pkg, pageId2, sourceRoot, target2, offsetX, offsetY, code = "UNSUPPORTED_DUPLICATE") {
|
|
49657
|
+
async function planInstanceCopy(pkg, pageId2, sourceRoot, target2, offsetX, offsetY, code = "UNSUPPORTED_DUPLICATE", allowConnector = code === "UNSUPPORTED_DUPLICATE") {
|
|
48763
49658
|
const id3 = attribute2(target2.instance, "ID");
|
|
48764
|
-
|
|
49659
|
+
const connector2 = allowConnector && isStencilConnector2(target2);
|
|
49660
|
+
if (!connector2 && (isStencilConnector2(target2) || connectRows(sourceRoot).some((row2) => attribute2(row2, "FromSheet") === id3)))
|
|
48765
49661
|
fail(code, "Lines and connectors that come from a stencil cannot be copied yet.");
|
|
48766
49662
|
await assertInstanceUnlocked(pkg, pageId2, target2, ["LockSelect"], "selection");
|
|
49663
|
+
if (connector2) {
|
|
49664
|
+
const pin2 = planConnectorCopy(target2, code);
|
|
49665
|
+
const x2 = pin2.x + offsetX, y2 = pin2.y + offsetY;
|
|
49666
|
+
if (Math.abs(x2) > 1e6 || Math.abs(y2) > 1e6)
|
|
49667
|
+
fail(code, "Duplicated pins exceed coordinate limits.");
|
|
49668
|
+
return { x: x2, y: y2, connector: connector2 };
|
|
49669
|
+
}
|
|
48767
49670
|
const pin = instancePin(target2);
|
|
48768
49671
|
const x = pin.x + offsetX, y = pin.y + offsetY;
|
|
48769
49672
|
if (Math.abs(x) > 1e6 || Math.abs(y) > 1e6)
|
|
48770
49673
|
fail(code, "Duplicated pins exceed coordinate limits.");
|
|
48771
|
-
return { x, y };
|
|
49674
|
+
return { x, y, connector: connector2 };
|
|
48772
49675
|
}
|
|
48773
49676
|
function finishInstanceCopy(clone, template, x, y, taken, check) {
|
|
48774
49677
|
const mapping = /* @__PURE__ */ new Map();
|
|
@@ -48852,7 +49755,18 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48852
49755
|
structural ||= !source || await shapeIsStructural(source, template);
|
|
48853
49756
|
}
|
|
48854
49757
|
await assertDuplicateScope(pkg, pagePaths, root2, newIds, check, structural);
|
|
48855
|
-
const
|
|
49758
|
+
const glueTargets = new Set(
|
|
49759
|
+
children2(sourceRoot, "Connects").flatMap(
|
|
49760
|
+
(container2) => children2(container2, "Connect").map((row2) => attribute2(row2, "ToSheet"))
|
|
49761
|
+
)
|
|
49762
|
+
);
|
|
49763
|
+
const indexed = indexCells(detached ? /* @__PURE__ */ new Map([[sourcePageId, sourceRoot]]) : roots, {
|
|
49764
|
+
check,
|
|
49765
|
+
scope: "affected",
|
|
49766
|
+
glueShapes: new Set(
|
|
49767
|
+
pageShapes(sourceRoot).filter((shape) => glueTargets.has(attribute2(shape, "ID")))
|
|
49768
|
+
)
|
|
49769
|
+
});
|
|
48856
49770
|
const evaluate = createVisioCellEvaluator(indexed, { check }, true);
|
|
48857
49771
|
const containers = children2(root2, "Shapes");
|
|
48858
49772
|
if (containers.length > 1) fail("INVALID_SHAPE_ID", "Duplicate Shapes containers.");
|
|
@@ -48866,6 +49780,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48866
49780
|
if (value3 !== void 0) occupied.add(value3.toLowerCase());
|
|
48867
49781
|
}
|
|
48868
49782
|
const plans = [];
|
|
49783
|
+
const copied = new Set(edit.copies.map((copy8) => copy8.shapeId));
|
|
48869
49784
|
let cloneNodes = 0, cloneCharacters = buildXml(root2).length;
|
|
48870
49785
|
const size3 = (source) => {
|
|
48871
49786
|
cloneNodes += source.getElementsByTagName("*").length + 1;
|
|
@@ -48882,6 +49797,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48882
49797
|
"UNSUPPORTED_DUPLICATE"
|
|
48883
49798
|
);
|
|
48884
49799
|
if (stencil) {
|
|
49800
|
+
assertGlueDroppable(sourceRoot, copy8.shapeId, copied);
|
|
48885
49801
|
const pin = await planInstanceCopy(
|
|
48886
49802
|
pkg,
|
|
48887
49803
|
edit.pageId,
|
|
@@ -48894,18 +49810,33 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48894
49810
|
plans.push({
|
|
48895
49811
|
source: stencil.instance,
|
|
48896
49812
|
id: copy8.newShapeId,
|
|
48897
|
-
|
|
49813
|
+
x: pin.x,
|
|
49814
|
+
y: pin.y,
|
|
49815
|
+
...pin.connector ? { connector: true } : {},
|
|
48898
49816
|
template: stencil.template
|
|
48899
49817
|
});
|
|
48900
49818
|
continue;
|
|
48901
49819
|
}
|
|
49820
|
+
const line = pageShapes(sourceRoot).find((shape) => attribute2(shape, "ID") === copy8.shapeId);
|
|
49821
|
+
if (line && !line.hasAttribute("Master") && isLineSheet2(line)) {
|
|
49822
|
+
assertCloneLeaf(line);
|
|
49823
|
+
assertUnlayeredShape(line, document);
|
|
49824
|
+
assertShapeLocks(line, document, ["LockSelect"]);
|
|
49825
|
+
assertGlueDroppable(sourceRoot, copy8.shapeId, copied);
|
|
49826
|
+
const pin = planLineCopy(line);
|
|
49827
|
+
if (Math.abs(pin.x + edit.offsetX) > 1e6 || Math.abs(pin.y + edit.offsetY) > 1e6)
|
|
49828
|
+
fail("UNSUPPORTED_DUPLICATE", "Duplicated pins exceed coordinate limits.");
|
|
49829
|
+
size3(line);
|
|
49830
|
+
plans.push({ source: line, id: copy8.newShapeId, x: pin.x, y: pin.y, line: true });
|
|
49831
|
+
continue;
|
|
49832
|
+
}
|
|
48902
49833
|
const source = admitted(sourceRoot, copy8.shapeId);
|
|
48903
49834
|
assertCloneLeaf(source);
|
|
48904
49835
|
assertUnlayeredShape(source, document);
|
|
48905
49836
|
assertShapeLocks(source, document, ["LockSelect"]);
|
|
48906
|
-
for (const
|
|
48907
|
-
for (const connection of children2(
|
|
48908
|
-
if (
|
|
49837
|
+
for (const connects2 of children2(sourceRoot, "Connects"))
|
|
49838
|
+
for (const connection of children2(connects2, "Connect"))
|
|
49839
|
+
if (attribute2(connection, "FromSheet") === copy8.shapeId)
|
|
48909
49840
|
fail("UNSUPPORTED_DUPLICATE", "Glued shapes cannot be duplicated safely.");
|
|
48910
49841
|
const x = numeric(formattingCell(source, "PinX")), y = numeric(formattingCell(source, "PinY"));
|
|
48911
49842
|
for (const [name3, offset] of [
|
|
@@ -48920,6 +49851,9 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48920
49851
|
size3(source);
|
|
48921
49852
|
plans.push({ source, id: copy8.newShapeId, x: x + edit.offsetX, y: y + edit.offsetY });
|
|
48922
49853
|
}
|
|
49854
|
+
const connectorSources = plans.filter((plan) => plan.connector).map((plan) => plan.source);
|
|
49855
|
+
if (connectorSources.length)
|
|
49856
|
+
assertConnectorCopyApart(root2, connectorSources, edit.offsetX, edit.offsetY);
|
|
48923
49857
|
const order = new Map(
|
|
48924
49858
|
children2(children2(sourceRoot, "Shapes")[0], "Shape").map((source, index2) => [source, index2])
|
|
48925
49859
|
);
|
|
@@ -48930,6 +49864,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48930
49864
|
check();
|
|
48931
49865
|
const shape = root2.ownerDocument.importNode(plan.source, true);
|
|
48932
49866
|
copyIdentity(shape, plan.id, names);
|
|
49867
|
+
if (plan.line) finishLineCopy(shape, edit.offsetX, edit.offsetY);
|
|
48933
49868
|
for (const node3 of [shape, ...Array.from(shape.getElementsByTagName("*"))]) {
|
|
48934
49869
|
const source = executableCellFormula(attribute2(node3, "F"));
|
|
48935
49870
|
if (!source) continue;
|
|
@@ -48948,6 +49883,15 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48948
49883
|
)
|
|
48949
49884
|
);
|
|
48950
49885
|
}
|
|
49886
|
+
if (plan.line) {
|
|
49887
|
+
container.appendChild(shape);
|
|
49888
|
+
continue;
|
|
49889
|
+
}
|
|
49890
|
+
if (plan.connector) {
|
|
49891
|
+
finishConnectorCopy(shape, plan.id, edit.offsetX, edit.offsetY);
|
|
49892
|
+
container.appendChild(shape);
|
|
49893
|
+
continue;
|
|
49894
|
+
}
|
|
48951
49895
|
if (plan.template) {
|
|
48952
49896
|
for (const id3 of newIds) ids.add(id3);
|
|
48953
49897
|
finishInstanceCopy(shape, plan.template, plan.x, plan.y, ids, check);
|
|
@@ -48964,7 +49908,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48964
49908
|
}
|
|
48965
49909
|
container.appendChild(shape);
|
|
48966
49910
|
}
|
|
48967
|
-
const local = plans.filter((plan) => !plan.template);
|
|
49911
|
+
const local = plans.filter((plan) => !plan.template && !plan.line);
|
|
48968
49912
|
if (changed.length) {
|
|
48969
49913
|
await assertGeometryPackageScope(
|
|
48970
49914
|
pkg,
|
|
@@ -48998,6 +49942,9 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48998
49942
|
}
|
|
48999
49943
|
const dirty = /* @__PURE__ */ new Set([edit.pageId]);
|
|
49000
49944
|
for (const id3 of recalculateVisioCells(roots, changed, { check })) dirty.add(id3);
|
|
49945
|
+
for (const plan of plans)
|
|
49946
|
+
if (!plan.line && !plan.connector)
|
|
49947
|
+
for (const id3 of rerouteBlockedConnectors(roots, edit.pageId, plan.id, check)) dirty.add(id3);
|
|
49001
49948
|
return [...dirty];
|
|
49002
49949
|
}
|
|
49003
49950
|
function assertCloneLeaf(source) {
|
|
@@ -49328,9 +50275,10 @@ function deleteVisioShapes(roots, document, edits, check, instances = /* @__PURE
|
|
|
49328
50275
|
}
|
|
49329
50276
|
releaseStencilGlue(roots, removed);
|
|
49330
50277
|
releaseDeletedGlue(roots, removed);
|
|
49331
|
-
assertVisioShapesUnreferenced(roots, removed, { check });
|
|
50278
|
+
const frozen = assertVisioShapesUnreferenced(roots, removed, { check, freeze: true });
|
|
49332
50279
|
check();
|
|
49333
50280
|
for (const shape of shapes) shape.parentNode.removeChild(shape);
|
|
50281
|
+
freezeVisioCells(frozen);
|
|
49334
50282
|
for (const pageId2 of removed.keys())
|
|
49335
50283
|
for (const container of children2(roots.get(pageId2), "Connects"))
|
|
49336
50284
|
if (!children2(container, "Connect").length) container.parentNode.removeChild(container);
|
|
@@ -49359,8 +50307,8 @@ function admittedShape(root2, document, shapeId2) {
|
|
|
49359
50307
|
if (["1", "true"].includes(attribute2(shape, "Del") ?? "")) refuse3("The shape is deleted.");
|
|
49360
50308
|
const local = cells(shape);
|
|
49361
50309
|
if (isLineSheet(local)) refuse3("Lines and connectors (1D shapes) cannot change shape.");
|
|
49362
|
-
for (const
|
|
49363
|
-
for (const connect of children2(
|
|
50310
|
+
for (const connects2 of children2(root2, "Connects"))
|
|
50311
|
+
for (const connect of children2(connects2, "Connect"))
|
|
49364
50312
|
if (["FromSheet", "ToSheet"].some((name3) => attribute2(connect, name3) === shapeId2))
|
|
49365
50313
|
refuse3("Glued connectors would need rerouting, which is not supported yet.");
|
|
49366
50314
|
if (children2(shape, "Section").some((section3) => attribute2(section3, "N") === "Controls"))
|
|
@@ -50803,8 +51751,8 @@ async function captureVisioClipboard(input, pageId2, shapeIds2, options2 = {}) {
|
|
|
50803
51751
|
numeric(formattingCell(source, name3));
|
|
50804
51752
|
evaluate(key({ pageId: pageId2, shapeId: id3, cell: name3 }));
|
|
50805
51753
|
}
|
|
50806
|
-
for (const
|
|
50807
|
-
for (const connection of children2(
|
|
51754
|
+
for (const connects2 of children2(root2, "Connects"))
|
|
51755
|
+
for (const connection of children2(connects2, "Connect"))
|
|
50808
51756
|
if (["FromSheet", "ToSheet"].some((name3) => attribute2(connection, name3) === id3))
|
|
50809
51757
|
fail("UNSUPPORTED_CLIPBOARD", "Glued shapes cannot be captured safely.");
|
|
50810
51758
|
}
|
|
@@ -51345,8 +52293,8 @@ function assertUnreferenced3(roots, shapeId2, check) {
|
|
|
51345
52293
|
if (reference2.test(executableCellFormula(attribute2(cell, "F")) ?? ""))
|
|
51346
52294
|
fail("UNSUPPORTED_GUIDE_EDIT", "A shape formula refers to this guide.");
|
|
51347
52295
|
}
|
|
51348
|
-
for (const
|
|
51349
|
-
for (const row2 of children2(
|
|
52296
|
+
for (const connects2 of children2(root2, "Connects"))
|
|
52297
|
+
for (const row2 of children2(connects2, "Connect"))
|
|
51350
52298
|
if (attribute2(row2, "ToSheet") === shapeId2 || attribute2(row2, "FromSheet") === shapeId2)
|
|
51351
52299
|
fail("UNSUPPORTED_GUIDE_EDIT", "Shapes are glued to this guide.");
|
|
51352
52300
|
}
|
|
@@ -51723,6 +52671,7 @@ async function editVsdxTransaction(input, edits, options2, clock = {
|
|
|
51723
52671
|
if (deleteOnly)
|
|
51724
52672
|
for (const pageId2 of deleteVisioShapes(roots, document, deletions, check, instanceDeletes))
|
|
51725
52673
|
dirty.set(pages.get(pageId2), roots.get(pageId2));
|
|
52674
|
+
const formulaDiagnostics = [];
|
|
51726
52675
|
const noteTextSize = async (target2, root2) => {
|
|
51727
52676
|
if (await measuresOwnText(root2, target2.shapeId, masterTemplate(pkg), check))
|
|
51728
52677
|
clock.textSizes.push({ pageId: target2.pageId, shapeId: target2.shapeId });
|
|
@@ -51738,7 +52687,15 @@ async function editVsdxTransaction(input, edits, options2, clock = {
|
|
|
51738
52687
|
roots.set(command2.pageId, root2);
|
|
51739
52688
|
}
|
|
51740
52689
|
if (command2.type === "replace-plain-text" || command2.type === "replace-text-ranges") {
|
|
51741
|
-
if (await (command2.type === "replace-plain-text" ? replaceScopedPlainText(
|
|
52690
|
+
if (await (command2.type === "replace-plain-text" ? replaceScopedPlainText(
|
|
52691
|
+
pkg,
|
|
52692
|
+
new Set(pages.values()),
|
|
52693
|
+
roots,
|
|
52694
|
+
document,
|
|
52695
|
+
command2,
|
|
52696
|
+
check,
|
|
52697
|
+
formulaDiagnostics
|
|
52698
|
+
) : replaceScopedTextRanges(pkg, new Set(pages.values()), roots, document, command2, check))) {
|
|
51742
52699
|
dirty.set(path3, root2);
|
|
51743
52700
|
textChanged = true;
|
|
51744
52701
|
await noteTextSize(command2, root2);
|
|
@@ -51884,6 +52841,7 @@ async function editVsdxTransaction(input, edits, options2, clock = {
|
|
|
51884
52841
|
bytes,
|
|
51885
52842
|
changedParts: [...dirty.keys()],
|
|
51886
52843
|
diagnostics: [
|
|
52844
|
+
...formulaDiagnostics,
|
|
51887
52845
|
...pasteChanged ? [
|
|
51888
52846
|
{
|
|
51889
52847
|
code: "edit-paste-experimental",
|