ooxml-core 1.30.1 → 1.32.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-KKLAYUGQ.mjs → PptxHandler-QY5VL3CY.mjs} +2 -2
- package/dist/PptxHandler-SJ5ZUIUX.mjs +4 -0
- package/dist/{PptxHandler-DHQPVTUI.cjs → PptxHandler-TESZUH66.cjs} +3 -3
- package/dist/{PresentationBuilder-YYZYCKTZ.mjs → PresentationBuilder-3CH5TR4W.mjs} +2 -2
- package/dist/{PresentationBuilder-JORMF5CP.cjs → PresentationBuilder-5NFBUP7Y.cjs} +5 -5
- package/dist/{PresentationBuilder-Q2Z33LLM.mjs → PresentationBuilder-S6HXHKEJ.mjs} +2 -2
- package/dist/automation/index.cjs +6446 -3410
- package/dist/automation/index.mjs +6446 -3410
- 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-GJDFCP2T.mjs → chunk-3H5UAJB3.mjs} +258 -155
- package/dist/{chunk-MKDONWNO.mjs → chunk-4R65YYAD.mjs} +32 -14
- package/dist/{chunk-KWJYMAEF.mjs → chunk-IOTGRLJH.mjs} +255 -152
- package/dist/{chunk-6FXOAMNL.mjs → chunk-N6424WKA.mjs} +1 -1
- package/dist/{chunk-WZJ25K7P.mjs → chunk-NAWLWKOJ.mjs} +1 -1
- package/dist/{chunk-DJ3CDTMX.mjs → chunk-O7SVHLD7.mjs} +23 -5
- package/dist/{chunk-CZXM4ZJH.cjs → chunk-Q6NM64J2.cjs} +23 -4
- package/dist/{chunk-FFJBOR2Y.mjs → chunk-UYMSFJQZ.mjs} +76 -4
- package/dist/{chunk-B4LXDHBX.cjs → chunk-X6VNUBES.cjs} +1419 -1316
- 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/diagram/index.cjs +8 -4
- package/dist/diagram/index.mjs +8 -4
- 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 +1391 -613
- package/dist/docx/embedded.mjs +1391 -613
- package/dist/docx/index.cjs +1402 -622
- package/dist/docx/index.mjs +1402 -622
- 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 +460 -207
- package/dist/docx/layout/index.mjs +460 -207
- 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 +1405 -627
- package/dist/docx/load/index.mjs +1405 -627
- 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 +725 -260
- 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 +711 -261
- 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/geometry/index.cjs +16 -12
- package/dist/geometry/index.mjs +16 -12
- package/dist/geometry/preset-shape-definitions-table.d.ts.map +1 -1
- package/dist/index.cjs +38 -34
- package/dist/index.mjs +38 -34
- 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 +295 -157
- package/dist/pptx/automation/index.d.ts +9 -3
- 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 → index-D-FdgqrP.d.ts} +102 -3
- package/dist/pptx/chunks/index-D-FdgqrP.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-BQDcu_0a.d.ts → index-DKybuHPT.d.ts} +51 -3
- package/dist/pptx/chunks/{index-BQDcu_0a.d.ts.map → index-DKybuHPT.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-CBV1oHN7.d.ts → index-DnWlmYCy.d.ts} +2 -2
- package/dist/pptx/chunks/{index-CBV1oHN7.d.ts.map → index-DnWlmYCy.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +294 -157
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +8 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.cjs +14 -14
- package/dist/pptx/editor/render/find-replace.d.ts +1 -1
- package/dist/pptx/editor/render/find-replace.mjs +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +8 -8
- package/dist/pptx/editor/render/slide-operations.mjs +2 -2
- package/dist/pptx/index.cjs +380 -171
- package/dist/pptx/index.d.ts +4 -4
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/teams/chat-rooms.d.ts.map +1 -1
- package/dist/teams/chat-view.d.ts +10 -1
- package/dist/teams/chat-view.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 +3471 -1223
- package/dist/teams/index.d.ts +4 -0
- package/dist/teams/index.d.ts.map +1 -1
- package/dist/teams/index.mjs +3435 -1223
- package/dist/teams/message-transfer.d.ts +1 -1
- package/dist/teams/message-transfer.d.ts.map +1 -1
- package/dist/teams/presence-controller.d.ts +18 -3
- package/dist/teams/presence-controller.d.ts.map +1 -1
- package/dist/teams/presence-meetings.d.ts +21 -0
- package/dist/teams/presence-meetings.d.ts.map +1 -0
- package/dist/teams/presence.d.ts +40 -2
- package/dist/teams/presence.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 +14 -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/view.d.ts +5 -0
- package/dist/teams/view.d.ts.map +1 -1
- package/dist/teams/workspace.d.ts +17 -2
- 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 +1359 -396
- package/dist/visio/index.mjs +1359 -396
- package/dist/visio/ui/index.cjs +1346 -383
- package/dist/visio/ui/index.mjs +1346 -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-drift-compare.d.ts +19 -0
- package/dist/xlsx/formula/ets-drift-compare.d.ts.map +1 -0
- package/dist/xlsx/formula/ets-excel-compare.d.ts +36 -0
- package/dist/xlsx/formula/ets-excel-compare.d.ts.map +1 -0
- package/dist/xlsx/formula/ets-init-compare.d.ts +24 -0
- package/dist/xlsx/formula/ets-init-compare.d.ts.map +1 -0
- package/dist/xlsx/formula/ets-init-maps.d.ts +21 -0
- package/dist/xlsx/formula/ets-init-maps.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-chain.d.ts +11 -0
- package/dist/xlsx/formula/functions/ets-init-chain.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init-four.d.ts +3 -0
- package/dist/xlsx/formula/functions/ets-init-four.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init-short.d.ts +17 -0
- package/dist/xlsx/formula/functions/ets-init-short.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init-states.d.ts +5 -0
- package/dist/xlsx/formula/functions/ets-init-states.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init-three.d.ts +23 -0
- package/dist/xlsx/formula/functions/ets-init-three.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init-threeplus.d.ts +13 -0
- package/dist/xlsx/formula/functions/ets-init-threeplus.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init.d.ts +33 -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-search-map.d.ts +24 -0
- package/dist/xlsx/formula/functions/ets-search-map.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-search.d.ts +17 -0
- package/dist/xlsx/formula/functions/ets-search.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/ets-validate.d.ts +16 -0
- package/dist/xlsx/formula/functions/ets-validate.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 +5118 -2648
- package/dist/xlsx/index.mjs +5097 -2649
- 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 +2667 -1163
- package/dist/xlsx/load/index.mjs +2667 -1163
- 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 +5088 -2399
- 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 +5081 -2398
- 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/PptxHandler-E4DDV3FQ.mjs +0 -4
- package/dist/pptx/chunks/index-PdM5zpmu.d.ts.map +0 -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,210 @@ 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
|
+
let stripped = box4.replace(/<br\s*\/?>/gi, "\n");
|
|
20733
|
+
for (let prev = ""; prev !== stripped; ) {
|
|
20734
|
+
prev = stripped;
|
|
20735
|
+
stripped = stripped.replace(/<[^>]*>/g, "");
|
|
20736
|
+
}
|
|
20737
|
+
const text5 = stripped.replace(/&(#x?[0-9a-f]+|\w+);/gi, (match, code) => {
|
|
20738
|
+
if (code.startsWith("#")) {
|
|
20739
|
+
const value3 = code[1]?.toLowerCase() === "x" ? parseInt(code.slice(2), 16) : Number(code.slice(1));
|
|
20740
|
+
return Number.isFinite(value3) ? String.fromCodePoint(value3) : match;
|
|
20741
|
+
}
|
|
20742
|
+
return entities[code.toLowerCase()] ?? match;
|
|
20743
|
+
}).replace(/\s+/g, " ").trim();
|
|
20744
|
+
return text5 || void 0;
|
|
20745
|
+
}
|
|
20746
|
+
function attachFormControls(source, sheetPart, root2, sheet, legacyDrawing) {
|
|
20747
|
+
const controls3 = sheet.drawings.filter(
|
|
20748
|
+
(object) => object.kind === "formControl"
|
|
20749
|
+
);
|
|
20750
|
+
if (!controls3.length) return;
|
|
20751
|
+
const rels = source.rels(sheetPart);
|
|
20752
|
+
const parts = /* @__PURE__ */ new Map();
|
|
20753
|
+
for (const control of Array.from(root2.getElementsByTagNameNS(NS.x, "control"))) {
|
|
20754
|
+
const shapeId2 = Number(att(control, "shapeId"));
|
|
20755
|
+
const rel = rels.get(relAttr(control, "id") ?? "");
|
|
20756
|
+
const target2 = rel ? source.target(sheetPart, rel) : void 0;
|
|
20757
|
+
if (target2) parts.set(shapeId2, target2);
|
|
20758
|
+
}
|
|
20759
|
+
const vmlRel = legacyDrawing ? rels.get(relAttr(legacyDrawing, "id") ?? "") : void 0;
|
|
20760
|
+
const vmlPart = vmlRel ? source.target(sheetPart, vmlRel) : void 0;
|
|
20761
|
+
const vml = vmlPart ? source.text(vmlPart) : void 0;
|
|
20762
|
+
for (const control of controls3) {
|
|
20763
|
+
const part = parts.get(control.shapeId);
|
|
20764
|
+
const xml = part ? source.text(part) : void 0;
|
|
20765
|
+
if (part && xml) {
|
|
20766
|
+
control.partName = part;
|
|
20767
|
+
try {
|
|
20768
|
+
readProps(control, xml);
|
|
20769
|
+
} catch {
|
|
20770
|
+
control.controlType = "other";
|
|
20771
|
+
}
|
|
20772
|
+
}
|
|
20773
|
+
const caption = vml ? vmlCaption(vml, control.shapeId) : void 0;
|
|
20774
|
+
if (caption) control.caption = caption;
|
|
20775
|
+
}
|
|
20776
|
+
}
|
|
20777
|
+
|
|
20778
|
+
// xlsx/read/shape.ts
|
|
20149
20779
|
var xdr = (parent, local) => first(parent, local, NS.xdr);
|
|
20150
|
-
|
|
20780
|
+
function styleRef2(style2, name3) {
|
|
20781
|
+
const ref = first(style2, name3, NS.a);
|
|
20782
|
+
if (!ref) return void 0;
|
|
20783
|
+
const idx = Number(att(ref, "idx") ?? 0);
|
|
20784
|
+
const color2 = parseDrawingColorIn(ref);
|
|
20785
|
+
return { idx: Number.isFinite(idx) ? idx : 0, ...color2 ? { color: color2 } : {} };
|
|
20786
|
+
}
|
|
20787
|
+
function readStyle(style2) {
|
|
20788
|
+
if (!style2) return void 0;
|
|
20789
|
+
const fill = styleRef2(style2, "fillRef");
|
|
20790
|
+
const line = styleRef2(style2, "lnRef");
|
|
20791
|
+
const fontColor = parseDrawingColorIn(first(style2, "fontRef", NS.a));
|
|
20792
|
+
return {
|
|
20793
|
+
...fill ? { fill } : {},
|
|
20794
|
+
...line ? { line } : {},
|
|
20795
|
+
...fontColor ? { font: { color: fontColor } } : {}
|
|
20796
|
+
};
|
|
20797
|
+
}
|
|
20798
|
+
function readShapeNode(element2) {
|
|
20799
|
+
const local = element2.localName;
|
|
20800
|
+
if (local !== "sp" && local !== "cxnSp" && local !== "grpSp") return void 0;
|
|
20801
|
+
const isGroup = local === "grpSp";
|
|
20802
|
+
const nv = elements(element2).find((node4) => node4.localName?.startsWith("nv"));
|
|
20803
|
+
const cNvPr = xdr(nv, "cNvPr");
|
|
20804
|
+
const spPr = xdr(element2, isGroup ? "grpSpPr" : "spPr");
|
|
20805
|
+
const xfrm = first(spPr, "xfrm", NS.a);
|
|
20806
|
+
const transform2 = parseTransform(xfrm);
|
|
20807
|
+
const geometry = isGroup ? { geometry: "group" } : parseDrawingGeometry(spPr);
|
|
20808
|
+
const node3 = {
|
|
20809
|
+
kind: isGroup ? "group" : local === "cxnSp" ? "connector" : "shape",
|
|
20810
|
+
frame: transform2?.frame ?? { x: 0, y: 0, width: 0, height: 0 },
|
|
20811
|
+
geometry: geometry.geometry
|
|
20812
|
+
};
|
|
20813
|
+
const name3 = att(cNvPr, "name");
|
|
20814
|
+
if (name3) node3.name = name3;
|
|
20815
|
+
if (att(xdr(nv, "cNvSpPr"), "txBox") === "1") node3.textBox = true;
|
|
20816
|
+
if (transform2?.rotation) node3.rotation = transform2.rotation;
|
|
20817
|
+
if (transform2?.flipHorizontal) node3.flipH = true;
|
|
20818
|
+
if (transform2?.flipVertical) node3.flipV = true;
|
|
20819
|
+
if ("adjustments" in geometry && geometry.adjustments) node3.adjustments = geometry.adjustments;
|
|
20820
|
+
if ("paths" in geometry && geometry.paths) node3.paths = geometry.paths;
|
|
20821
|
+
if (!isGroup) {
|
|
20822
|
+
const fill = parseDrawingFill(spPr);
|
|
20823
|
+
if (fill) node3.fill = fill;
|
|
20824
|
+
const line = parseDrawingLine(first(spPr, "ln", NS.a));
|
|
20825
|
+
if (line) node3.line = line;
|
|
20826
|
+
const style2 = readStyle(xdr(element2, "style"));
|
|
20827
|
+
if (style2) node3.style = style2;
|
|
20828
|
+
const text5 = parseDrawingTextBody(xdr(element2, "txBody"));
|
|
20829
|
+
if (text5?.text) node3.text = text5;
|
|
20830
|
+
return node3;
|
|
20831
|
+
}
|
|
20832
|
+
const childFrame = parseFrameOf(first(xfrm, "chOff", NS.a), first(xfrm, "chExt", NS.a));
|
|
20833
|
+
if (childFrame) node3.childFrame = childFrame;
|
|
20834
|
+
node3.children = elements(element2).flatMap((child4) => {
|
|
20835
|
+
const read = readShapeNode(child4);
|
|
20836
|
+
return read ? [read] : [];
|
|
20837
|
+
});
|
|
20838
|
+
return node3;
|
|
20839
|
+
}
|
|
20840
|
+
function parseFrameOf(off, ext) {
|
|
20841
|
+
if (!off || !ext) return void 0;
|
|
20842
|
+
return {
|
|
20843
|
+
x: Number(att(off, "x") ?? 0),
|
|
20844
|
+
y: Number(att(off, "y") ?? 0),
|
|
20845
|
+
width: Number(att(ext, "cx") ?? 0),
|
|
20846
|
+
height: Number(att(ext, "cy") ?? 0)
|
|
20847
|
+
};
|
|
20848
|
+
}
|
|
20849
|
+
|
|
20850
|
+
// xlsx/read/drawing.ts
|
|
20851
|
+
var xdr2 = (parent, local) => first(parent, local, NS.xdr);
|
|
20852
|
+
var int2 = (parent, local) => Math.round(Number(xdr2(parent, local)?.textContent ?? 0)) || 0;
|
|
20151
20853
|
function marker(node3) {
|
|
20152
20854
|
return {
|
|
20153
20855
|
col: int2(node3, "col"),
|
|
@@ -20158,7 +20860,7 @@ function marker(node3) {
|
|
|
20158
20860
|
}
|
|
20159
20861
|
function readAnchor(anchor) {
|
|
20160
20862
|
if (anchor.localName === "absoluteAnchor") {
|
|
20161
|
-
const pos =
|
|
20863
|
+
const pos = xdr2(anchor, "pos");
|
|
20162
20864
|
const result3 = {
|
|
20163
20865
|
from: {
|
|
20164
20866
|
row: 0,
|
|
@@ -20167,26 +20869,26 @@ function readAnchor(anchor) {
|
|
|
20167
20869
|
rowOffset: Number(att(pos, "y") ?? 0)
|
|
20168
20870
|
}
|
|
20169
20871
|
};
|
|
20170
|
-
const ext2 =
|
|
20872
|
+
const ext2 = xdr2(anchor, "ext");
|
|
20171
20873
|
if (ext2) result3.ext = { cx: Number(att(ext2, "cx") ?? 0), cy: Number(att(ext2, "cy") ?? 0) };
|
|
20172
20874
|
return result3;
|
|
20173
20875
|
}
|
|
20174
|
-
const result2 = { from: marker(
|
|
20175
|
-
const to =
|
|
20876
|
+
const result2 = { from: marker(xdr2(anchor, "from")) };
|
|
20877
|
+
const to = xdr2(anchor, "to");
|
|
20176
20878
|
if (to) result2.to = marker(to);
|
|
20177
|
-
const ext =
|
|
20879
|
+
const ext = xdr2(anchor, "ext");
|
|
20178
20880
|
if (ext) result2.ext = { cx: Number(att(ext, "cx") ?? 0), cy: Number(att(ext, "cy") ?? 0) };
|
|
20179
20881
|
return result2;
|
|
20180
20882
|
}
|
|
20181
20883
|
var ANCHOR_PARTS = /* @__PURE__ */ new Set(["from", "to", "ext", "pos", "clientData"]);
|
|
20182
20884
|
function nonVisual(content2) {
|
|
20183
20885
|
const nv = elements(content2).find((node3) => node3.localName?.startsWith("nv"));
|
|
20184
|
-
return
|
|
20886
|
+
return xdr2(nv, "cNvPr");
|
|
20185
20887
|
}
|
|
20186
20888
|
function describe(content2) {
|
|
20187
20889
|
switch (content2.localName) {
|
|
20188
20890
|
case "sp":
|
|
20189
|
-
return
|
|
20891
|
+
return xdr2(content2, "nvSpPr") && att(xdr2(xdr2(content2, "nvSpPr"), "cNvSpPr"), "txBox") === "1" ? "text box" : "shape";
|
|
20190
20892
|
case "grpSp":
|
|
20191
20893
|
return "group";
|
|
20192
20894
|
case "cxnSp":
|
|
@@ -20206,6 +20908,11 @@ function parseDrawing(source, partName, warn) {
|
|
|
20206
20908
|
const rels = source.rels(partName);
|
|
20207
20909
|
const out = [];
|
|
20208
20910
|
for (const anchorEl of elements(root2)) {
|
|
20911
|
+
if (anchorEl.localName === "AlternateContent") {
|
|
20912
|
+
const control = readFormControlFrame(anchorEl, readAnchor);
|
|
20913
|
+
if (control) out.push(control);
|
|
20914
|
+
continue;
|
|
20915
|
+
}
|
|
20209
20916
|
if (!["twoCellAnchor", "oneCellAnchor", "absoluteAnchor"].includes(anchorEl.localName ?? ""))
|
|
20210
20917
|
continue;
|
|
20211
20918
|
const anchor = readAnchor(anchorEl);
|
|
@@ -20220,7 +20927,7 @@ function parseDrawing(source, partName, warn) {
|
|
|
20220
20927
|
const cNvPr = nonVisual(content2);
|
|
20221
20928
|
const name3 = att(cNvPr, "name");
|
|
20222
20929
|
if (content2.localName === "pic") {
|
|
20223
|
-
const blipFill =
|
|
20930
|
+
const blipFill = xdr2(content2, "blipFill");
|
|
20224
20931
|
const blip = first(blipFill, "blip", NS.a);
|
|
20225
20932
|
const rel = rels.get(relAttr(blip, "embed") ?? "");
|
|
20226
20933
|
const target2 = rel ? source.target(partName, rel) : void 0;
|
|
@@ -20295,11 +21002,50 @@ function parseDrawing(source, partName, warn) {
|
|
|
20295
21002
|
continue;
|
|
20296
21003
|
}
|
|
20297
21004
|
}
|
|
20298
|
-
|
|
21005
|
+
const shape = readShapeNode(content2);
|
|
21006
|
+
out.push({ ...unsupported4(describe(content2)), ...shape ? { shape } : {} });
|
|
20299
21007
|
}
|
|
20300
21008
|
return out;
|
|
20301
21009
|
}
|
|
20302
21010
|
|
|
21011
|
+
// xlsx/read/header-footer-images.ts
|
|
21012
|
+
var UNIT_PT = { pt: 1, in: 72, cm: 72 / 2.54, mm: 72 / 25.4, px: 0.75 };
|
|
21013
|
+
function styleLength(style2, property2) {
|
|
21014
|
+
const match = new RegExp(
|
|
21015
|
+
`(?:^|[;\\s])${property2}\\s*:\\s*([\\d.]+)\\s*(pt|in|cm|mm|px)?`,
|
|
21016
|
+
"i"
|
|
21017
|
+
).exec(style2);
|
|
21018
|
+
return match ? Number(match[1]) * (UNIT_PT[(match[2] ?? "pt").toLowerCase()] ?? 1) : 0;
|
|
21019
|
+
}
|
|
21020
|
+
function readHeaderFooterImages(source, sheetPart, legacyHF) {
|
|
21021
|
+
if (!legacyHF) return void 0;
|
|
21022
|
+
const rel = source.rels(sheetPart).get(relAttr(legacyHF, "id") ?? "");
|
|
21023
|
+
const vmlPart = rel ? source.target(sheetPart, rel) : void 0;
|
|
21024
|
+
const vml = vmlPart ? source.text(vmlPart) : void 0;
|
|
21025
|
+
if (!vmlPart || !vml) return void 0;
|
|
21026
|
+
const rels = source.rels(vmlPart);
|
|
21027
|
+
const images = {};
|
|
21028
|
+
for (const match of vml.matchAll(/<v:shape\b([^>]*)>([\s\S]*?)<\/v:shape>/g)) {
|
|
21029
|
+
const id3 = /\bid="([^"]+)"/.exec(match[1] ?? "")?.[1];
|
|
21030
|
+
const style2 = /style=(?:'([^']*)'|"([^"]*)")/.exec(match[1] ?? "");
|
|
21031
|
+
const data = /<v:imagedata\b([^>]*)>/.exec(match[2] ?? "")?.[1];
|
|
21032
|
+
const relId = /\bo:relid="([^"]+)"/.exec(data ?? "")?.[1];
|
|
21033
|
+
const imageRel = relId ? rels.get(relId) : void 0;
|
|
21034
|
+
const partName = imageRel ? source.target(vmlPart, imageRel) : void 0;
|
|
21035
|
+
if (!id3 || !partName || !source.has(partName)) continue;
|
|
21036
|
+
const css = style2?.[1] ?? style2?.[2] ?? "";
|
|
21037
|
+
const title = /\bo:title="([^"]*)"/.exec(data ?? "")?.[1];
|
|
21038
|
+
images[id3] = {
|
|
21039
|
+
partName,
|
|
21040
|
+
contentType: source.contentType(partName) ?? "application/octet-stream",
|
|
21041
|
+
widthPt: styleLength(css, "width"),
|
|
21042
|
+
heightPt: styleLength(css, "height"),
|
|
21043
|
+
...title ? { title } : {}
|
|
21044
|
+
};
|
|
21045
|
+
}
|
|
21046
|
+
return Object.keys(images).length ? images : void 0;
|
|
21047
|
+
}
|
|
21048
|
+
|
|
20303
21049
|
// xlsx/read/dates.ts
|
|
20304
21050
|
var DAY_MS2 = 864e5;
|
|
20305
21051
|
var EPOCH_19003 = Date.UTC(1899, 11, 30);
|
|
@@ -20441,6 +21187,8 @@ function readRowInfo(ctx, rowEl) {
|
|
|
20441
21187
|
const outline = numAttr(rowEl, "outlineLevel");
|
|
20442
21188
|
if (outline) info.outlineLevel = outline;
|
|
20443
21189
|
if (boolAttr(rowEl, "collapsed")) info.collapsed = true;
|
|
21190
|
+
if (boolAttr(rowEl, "thickTop")) info.thickTop = true;
|
|
21191
|
+
if (boolAttr(rowEl, "thickBot")) info.thickBot = true;
|
|
20444
21192
|
return Object.keys(info).length ? info : void 0;
|
|
20445
21193
|
}
|
|
20446
21194
|
function readSheetData(ctx, rows, sheet) {
|
|
@@ -20553,15 +21301,6 @@ function readScenarios(node3) {
|
|
|
20553
21301
|
return set;
|
|
20554
21302
|
}
|
|
20555
21303
|
|
|
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
21304
|
// xlsx/read/tables.ts
|
|
20566
21305
|
function parseTable(xml, partName) {
|
|
20567
21306
|
const root2 = parseXml(xml, { label: "XLSX table" }).documentElement;
|
|
@@ -20652,8 +21391,14 @@ var MODELLED = /* @__PURE__ */ new Set([
|
|
|
20652
21391
|
"drawing",
|
|
20653
21392
|
"legacyDrawing",
|
|
20654
21393
|
"tableParts",
|
|
20655
|
-
"scenarios"
|
|
21394
|
+
"scenarios",
|
|
21395
|
+
"customSheetViews"
|
|
20656
21396
|
]);
|
|
21397
|
+
function reportUnplaceable(ctx, sheet, element2) {
|
|
21398
|
+
ctx.warn(
|
|
21399
|
+
`Sheet "${sheet}": the element "${element2}" is not part of the worksheet schema and is dropped on save.`
|
|
21400
|
+
);
|
|
21401
|
+
}
|
|
20657
21402
|
function keep(sheet, key2, xml) {
|
|
20658
21403
|
const list2 = sheet.preserved.get(key2);
|
|
20659
21404
|
if (list2) list2.push(xml);
|
|
@@ -20735,9 +21480,15 @@ function readWorksheet(ctx, partName, name3, sheetId5, xml, rows) {
|
|
|
20735
21480
|
else if (!byName.has(local)) byName.set(local, node3);
|
|
20736
21481
|
if (SNAPSHOT_ELEMENTS.includes(local))
|
|
20737
21482
|
keep(sheet, snapshotKey(local), outerXml(node3));
|
|
20738
|
-
else if (local === "AlternateContent")
|
|
20739
|
-
|
|
20740
|
-
|
|
21483
|
+
else if (local === "AlternateContent") {
|
|
21484
|
+
const inner = alternateContentName(node3);
|
|
21485
|
+
if (!WORKSHEET_CHILD_ORDER.includes(inner ?? local))
|
|
21486
|
+
reportUnplaceable(ctx, name3, inner ?? local);
|
|
21487
|
+
keep(sheet, inner ?? local, selfContainedXml(node3));
|
|
21488
|
+
} else if (!MODELLED.has(local)) {
|
|
21489
|
+
if (!WORKSHEET_CHILD_ORDER.includes(local)) reportUnplaceable(ctx, name3, local);
|
|
21490
|
+
keep(sheet, local, selfContainedXml(node3));
|
|
21491
|
+
}
|
|
20741
21492
|
}
|
|
20742
21493
|
const sheetPr = byName.get("sheetPr");
|
|
20743
21494
|
const tabColor = readTabColor(sheetPr, ctx.palette);
|
|
@@ -20773,6 +21524,10 @@ function readWorksheet(ctx, partName, name3, sheetId5, xml, rows) {
|
|
|
20773
21524
|
readFitToPage(sheetPr)
|
|
20774
21525
|
);
|
|
20775
21526
|
if (page) sheet.pageSetup = page;
|
|
21527
|
+
const customViews = byName.get("customSheetViews");
|
|
21528
|
+
if (customViews) sheet.customViews = readCustomSheetViews(customViews);
|
|
21529
|
+
const hfImages = readHeaderFooterImages(ctx.source, partName, byName.get("legacyDrawingHF"));
|
|
21530
|
+
if (hfImages) sheet.headerFooterImages = hfImages;
|
|
20776
21531
|
const printOptions = readPrintOptions(byName.get("printOptions"));
|
|
20777
21532
|
if (printOptions) sheet.printOptions = printOptions;
|
|
20778
21533
|
const drawing = byName.get("drawing");
|
|
@@ -20780,6 +21535,7 @@ function readWorksheet(ctx, partName, name3, sheetId5, xml, rows) {
|
|
|
20780
21535
|
const rel = ctx.source.rels(partName).get(relAttr(drawing, "id") ?? "");
|
|
20781
21536
|
const target2 = rel ? ctx.source.target(partName, rel) : void 0;
|
|
20782
21537
|
if (target2) sheet.drawings = parseDrawing(ctx.source, target2, (m) => ctx.warn(m));
|
|
21538
|
+
attachFormControls(ctx.source, partName, root2, sheet, byName.get("legacyDrawing"));
|
|
20783
21539
|
}
|
|
20784
21540
|
readTables(ctx, partName, byName.get("tableParts"), sheet);
|
|
20785
21541
|
readComments(ctx, partName, sheet);
|
|
@@ -20888,6 +21644,7 @@ async function loadXlsx(input, options2 = {}) {
|
|
|
20888
21644
|
if (book.workbookPasswordHash) workbook.workbookPasswordHash = book.workbookPasswordHash;
|
|
20889
21645
|
if (book.workbookModernHash) workbook.workbookModernHash = book.workbookModernHash;
|
|
20890
21646
|
if (book.oleSize) workbook.oleSize = book.oleSize;
|
|
21647
|
+
if (book.customViews) workbook.customViews = book.customViews;
|
|
20891
21648
|
if (book.calcMode) workbook.calcMode = book.calcMode;
|
|
20892
21649
|
if (book.iterate) workbook.iterate = book.iterate;
|
|
20893
21650
|
if (signatures.hasSignatures)
|
|
@@ -22671,9 +23428,9 @@ function sampleArc(start, rxIn, ryIn, xAxisRotationDeg, largeArcFlag, sweepFlag,
|
|
|
22671
23428
|
ry *= scale;
|
|
22672
23429
|
}
|
|
22673
23430
|
const sign = largeArcFlag !== sweepFlag ? 1 : -1;
|
|
22674
|
-
const
|
|
23431
|
+
const num2 = rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p;
|
|
22675
23432
|
const den = rx * rx * y1p * y1p + ry * ry * x1p * x1p;
|
|
22676
|
-
const coef = sign * Math.sqrt(Math.max(0,
|
|
23433
|
+
const coef = sign * Math.sqrt(Math.max(0, num2 / den));
|
|
22677
23434
|
const cxp = coef * (rx * y1p) / ry;
|
|
22678
23435
|
const cyp = coef * -(ry * x1p) / rx;
|
|
22679
23436
|
const cx = cosPhi * cxp - sinPhi * cyp + (start.x + end.x) / 2;
|
|
@@ -28463,10 +29220,10 @@ function processCompoundFileStream(input, path3, replacement) {
|
|
|
28463
29220
|
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
29221
|
replacement && view2.getUint16(28, true) !== 65534)
|
|
28465
29222
|
return reject2();
|
|
28466
|
-
const major = view2.getUint16(26, true),
|
|
28467
|
-
if (major !== 3 && major !== 4 ||
|
|
29223
|
+
const major = view2.getUint16(26, true), shift3 = view2.getUint16(30, true), miniShift = view2.getUint16(32, true);
|
|
29224
|
+
if (major !== 3 && major !== 4 || shift3 !== (major === 3 ? 9 : 12) || miniShift !== 6)
|
|
28468
29225
|
return reject2();
|
|
28469
|
-
const sectorSize = 1 <<
|
|
29226
|
+
const sectorSize = 1 << shift3, miniSize = 1 << miniShift;
|
|
28470
29227
|
if (input.length < sectorSize || replacement && input.length % sectorSize !== 0)
|
|
28471
29228
|
return reject2();
|
|
28472
29229
|
const sectorCount = Math.ceil(input.length / sectorSize) - 1;
|
|
@@ -36210,7 +36967,7 @@ function readVsdDrawing(input) {
|
|
|
36210
36967
|
}
|
|
36211
36968
|
seen.add(offset);
|
|
36212
36969
|
active.add(offset);
|
|
36213
|
-
const compressed = (format5 & 2) !== 0,
|
|
36970
|
+
const compressed = (format5 & 2) !== 0, shift3 = compressed ? 4 : 0;
|
|
36214
36971
|
const bytes = compressed ? decodeVsdBlock(stream.subarray(offset, offset + length), decodedBudget) : stream.slice(offset, offset + length);
|
|
36215
36972
|
decodedBudget -= bytes.length;
|
|
36216
36973
|
if (decodedBudget < 0)
|
|
@@ -36225,17 +36982,17 @@ function readVsdDrawing(input) {
|
|
|
36225
36982
|
if (page && [71, 72, 78].includes(type)) {
|
|
36226
36983
|
shape = { id: id3, kind: type === 71 ? "group" : type === 78 ? "foreign" : "shape", coordinateSpace: "shape-local", unsupportedGeometry: false, unsafeTransform: false, geometry: [], unsafeText: false };
|
|
36227
36984
|
page.shapes.push(shape);
|
|
36228
|
-
if (bytes.length -
|
|
36985
|
+
if (bytes.length - shift3 >= 54) {
|
|
36229
36986
|
const sv = view(bytes);
|
|
36230
|
-
shape.parentId = sv.getUint32(
|
|
36231
|
-
shape.masterPageId = sv.getUint32(
|
|
36232
|
-
shape.masterShapeId = sv.getUint32(
|
|
36987
|
+
shape.parentId = sv.getUint32(shift3 + 10, true);
|
|
36988
|
+
shape.masterPageId = sv.getUint32(shift3 + 18, true);
|
|
36989
|
+
shape.masterShapeId = sv.getUint32(shift3 + 26, true);
|
|
36233
36990
|
}
|
|
36234
36991
|
}
|
|
36235
36992
|
const mode = format5 >>> 4;
|
|
36236
36993
|
if (mode === 5 || type === 20) {
|
|
36237
|
-
bounded3(bytes,
|
|
36238
|
-
const table2 = view(bytes).getUint32(
|
|
36994
|
+
bounded3(bytes, shift3, 4);
|
|
36995
|
+
const table2 = view(bytes).getUint32(shift3, true) + shift3 - 4;
|
|
36239
36996
|
bounded3(bytes, table2, 12);
|
|
36240
36997
|
const count = view(bytes).getInt32(table2 + 4, true), order = view(bytes).getUint32(table2, true);
|
|
36241
36998
|
if (count < 0 || count > 1e5 || count > Math.floor((bytes.length - table2 - 12) / 18))
|
|
@@ -37372,8 +38129,13 @@ function resolveVisioPageVisibility(page, options2 = {}) {
|
|
|
37372
38129
|
}
|
|
37373
38130
|
|
|
37374
38131
|
// visio/edit-formatting-scope.ts
|
|
37375
|
-
async function assertFormattingDependencies(pkg, pagePaths, roots, pageId2, shape, changed, check, instanceView2) {
|
|
37376
|
-
indexCells(roots, { check })
|
|
38132
|
+
async function assertFormattingDependencies(pkg, pagePaths, roots, pageId2, shape, changed, check, instanceView2, options2 = {}) {
|
|
38133
|
+
for (const item2 of indexCells(roots, { check, scope: "affected" }).values())
|
|
38134
|
+
if (item2.refusal && item2.pageId === pageId2)
|
|
38135
|
+
fail(
|
|
38136
|
+
"EDIT_UNKNOWN_DEPENDENCY",
|
|
38137
|
+
`Cannot prove ShapeSheet dependency closure: ${item2.refusal}`
|
|
38138
|
+
);
|
|
37377
38139
|
const shapeId2 = attribute2(shape, "ID");
|
|
37378
38140
|
const changedNames = new Set([...changed.keys()].map((name3) => name3.toLowerCase()));
|
|
37379
38141
|
const jumpOnly = [...changedNames].every(
|
|
@@ -37428,11 +38190,17 @@ async function assertFormattingDependencies(pkg, pagePaths, roots, pageId2, shap
|
|
|
37428
38190
|
if (textEdit && localShapeId === shapeId2 && sourcePageId === pageId2) continue;
|
|
37429
38191
|
analysis = sized;
|
|
37430
38192
|
}
|
|
38193
|
+
if (options2.textReads && textEdit && !named2 && sourcePageId !== void 0 && textReadFormula(source))
|
|
38194
|
+
continue;
|
|
37431
38195
|
if (named2 && analysis.dynamic) {
|
|
37432
38196
|
if (mentions()) failure2();
|
|
37433
38197
|
continue;
|
|
37434
38198
|
}
|
|
37435
|
-
if (analysis.dynamic
|
|
38199
|
+
if (analysis.dynamic && analysis.opaque) {
|
|
38200
|
+
if (sourcePageId === pageId2 || mentions()) failure2();
|
|
38201
|
+
continue;
|
|
38202
|
+
}
|
|
38203
|
+
if (analysis.references.some(
|
|
37436
38204
|
(ref) => changedNames.has(canonical2(ref.cell)) && (sourcePageId === void 0 || sourcePageId === pageId2) && (ref.shapeId === shapeId2 || ref.shapeId === void 0 && (localShapeId === shapeId2 || sourcePageId === void 0))
|
|
37437
38205
|
))
|
|
37438
38206
|
failure2();
|
|
@@ -37445,6 +38213,7 @@ async function assertFormattingDependencies(pkg, pagePaths, roots, pageId2, shap
|
|
|
37445
38213
|
const part = await pkg.readXml(path3);
|
|
37446
38214
|
const master2 = part.localName === "MasterContents";
|
|
37447
38215
|
if (instanceView2 && master2) continue;
|
|
38216
|
+
if (master2 && !shape.hasAttribute("Master") && !shape.hasAttribute("MasterShape")) continue;
|
|
37448
38217
|
inspect7(part, void 0, master2);
|
|
37449
38218
|
}
|
|
37450
38219
|
}
|
|
@@ -37647,7 +38416,7 @@ function masterTemplate(pkg) {
|
|
|
37647
38416
|
return matches2.length === 1 ? matches2[0] : missing();
|
|
37648
38417
|
};
|
|
37649
38418
|
}
|
|
37650
|
-
function replaceScopedPlainText(pkg, pagePaths, roots, document, edit, check) {
|
|
38419
|
+
function replaceScopedPlainText(pkg, pagePaths, roots, document, edit, check, diagnostics = []) {
|
|
37651
38420
|
return replacePlainText(
|
|
37652
38421
|
roots.get(edit.pageId),
|
|
37653
38422
|
document,
|
|
@@ -37661,10 +38430,20 @@ function replaceScopedPlainText(pkg, pagePaths, roots, document, edit, check) {
|
|
|
37661
38430
|
edit.pageId,
|
|
37662
38431
|
shape,
|
|
37663
38432
|
/* @__PURE__ */ new Map([["TheText", text5]]),
|
|
37664
|
-
check
|
|
38433
|
+
check,
|
|
38434
|
+
void 0,
|
|
38435
|
+
{ textReads: true }
|
|
37665
38436
|
),
|
|
37666
38437
|
masterTemplate(pkg)
|
|
37667
|
-
)
|
|
38438
|
+
).then((changed) => {
|
|
38439
|
+
if (changed)
|
|
38440
|
+
recalculateVisioCells(
|
|
38441
|
+
roots,
|
|
38442
|
+
[{ pageId: edit.pageId, shapeId: edit.shapeId, cell: "TheText" }],
|
|
38443
|
+
{ check, cycles: "keep", diagnostics }
|
|
38444
|
+
);
|
|
38445
|
+
return changed;
|
|
38446
|
+
});
|
|
37668
38447
|
}
|
|
37669
38448
|
|
|
37670
38449
|
// visio/edit-stencil-connector.ts
|
|
@@ -38928,9 +39707,16 @@ function visioWalkPath(begin, end) {
|
|
|
38928
39707
|
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
39708
|
};
|
|
38930
39709
|
let path3;
|
|
38931
|
-
if (gapX >= -EPSILON3 && inside2(from.y, b.minY, b.maxY))
|
|
38932
|
-
|
|
38933
|
-
|
|
39710
|
+
if (gapX >= -EPSILON3 && inside2(from.y, b.minY, b.maxY)) {
|
|
39711
|
+
const p = side(begin, sx, 0), q = side(end, -sx, 0);
|
|
39712
|
+
if (begin.shape?.floating && end.shape?.floating) {
|
|
39713
|
+
const y = (Math.max(a2.minY, b.minY) + Math.min(a2.maxY, b.maxY)) / 2;
|
|
39714
|
+
path3 = [
|
|
39715
|
+
{ x: p.x, y },
|
|
39716
|
+
{ x: q.x, y }
|
|
39717
|
+
];
|
|
39718
|
+
} else path3 = jog(p, q, true);
|
|
39719
|
+
} else if (gapY >= -EPSILON3 && inside2(from.x, b.minX, b.maxX))
|
|
38934
39720
|
path3 = jog(side(begin, 0, sy), side(end, 0, -sy), false);
|
|
38935
39721
|
else if (gapY < -EPSILON3 || gapY < CHANNEL && gapX >= CHANNEL) {
|
|
38936
39722
|
const p = side(begin, sx, 0);
|
|
@@ -39566,7 +40352,7 @@ function writeStencilConnector(shape, route, vertices) {
|
|
|
39566
40352
|
|
|
39567
40353
|
// visio/edit-stencil-connector-layout.ts
|
|
39568
40354
|
var same6 = (a2, b) => Math.abs(a2 - b) <= 1e-9 * Math.max(1, Math.abs(a2), Math.abs(b));
|
|
39569
|
-
function walkShape(box4) {
|
|
40355
|
+
function walkShape(box4, floating = false) {
|
|
39570
40356
|
const [a2, b, c2, d, e, f] = box4.transform;
|
|
39571
40357
|
const at2 = (x, y) => ({
|
|
39572
40358
|
x: a2 * x + c2 * y + e,
|
|
@@ -39578,7 +40364,8 @@ function walkShape(box4) {
|
|
|
39578
40364
|
sites: sites.map((site) => ({ point: site.point, normal: site.normal })),
|
|
39579
40365
|
bounds: sites[0].box,
|
|
39580
40366
|
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)]
|
|
40367
|
+
corners: [at2(0, 0), at2(box4.width, 0), at2(box4.width, box4.height), at2(0, box4.height)],
|
|
40368
|
+
...floating ? { floating } : {}
|
|
39582
40369
|
}
|
|
39583
40370
|
};
|
|
39584
40371
|
}
|
|
@@ -39799,6 +40586,11 @@ function connectionRows(shape) {
|
|
|
39799
40586
|
}
|
|
39800
40587
|
return rows;
|
|
39801
40588
|
}
|
|
40589
|
+
function hasConnectionPoints(root2, shapeId2) {
|
|
40590
|
+
const target2 = topShape(root2, shapeId2);
|
|
40591
|
+
if (!target2) return false;
|
|
40592
|
+
return (stencilTemplate(target2) ? effectiveRows(target2, "Connection") : connectionRows(target2)).size > 0;
|
|
40593
|
+
}
|
|
39802
40594
|
function glueSites(root2, end) {
|
|
39803
40595
|
const box4 = glueBox(root2, end.target);
|
|
39804
40596
|
if (end.point === void 0) return dynamicSites(box4);
|
|
@@ -39909,8 +40701,9 @@ function proveConnector(root2, connectorId) {
|
|
|
39909
40701
|
const named2 = visioPointGlueTarget(source);
|
|
39910
40702
|
return index2 === void 0 ? !named2 : !!named2 && named2.shapeId === target2 && named2.index === index2;
|
|
39911
40703
|
};
|
|
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
|
-
|
|
40704
|
+
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
|
|
40705
|
+
// point glue on a drawn line has none either (native-edit-families-flat-2026-10-29.json).
|
|
40706
|
+
visioGlueTriggerTarget(formula2(triggerName(end))) !== target2 && !(formula2(triggerName(end)) === void 0 && !local.has(triggerName(end)) && (isStencilLine(shape) || index2 !== void 0)) || !glued("X") || !glued("Y"))
|
|
39914
40707
|
fail("UNSUPPORTED_GEOMETRY_EDIT", UNSUPPORTED2);
|
|
39915
40708
|
ends[end] = { target: target2, ...index2 === void 0 ? {} : { point: index2 } };
|
|
39916
40709
|
}
|
|
@@ -40176,7 +40969,7 @@ function rerouteConnector(roots, pageId2, glue, check, options2 = {}) {
|
|
|
40176
40969
|
}
|
|
40177
40970
|
const walk = (end) => {
|
|
40178
40971
|
const target2 = glue.ends[end];
|
|
40179
|
-
return target2 && target2.point === void 0 ? walkShape(glueBox(root2, target2.target)) : { point: sites(end)[0].point };
|
|
40972
|
+
return target2 && target2.point === void 0 ? walkShape(glueBox(root2, target2.target), !hasConnectionPoints(root2, target2.target)) : { point: sites(end)[0].point };
|
|
40180
40973
|
};
|
|
40181
40974
|
const route = options2.route ?? current;
|
|
40182
40975
|
if (route === "straight" && current === "straight" && ENDS.every(
|
|
@@ -41447,7 +42240,7 @@ var unquotedVisioFormula = (source) => source.split(/("(?:[^"]|"")*")/g).map((pa
|
|
|
41447
42240
|
|
|
41448
42241
|
// visio/formula-functions.ts
|
|
41449
42242
|
var DOCUMENTED = new Set(
|
|
41450
|
-
`ABS ACOS AND ANG360 ANGLEALONGPATH ANGLETOLOC ANGLETOPAR ASIN ATAN ATAN2 BITAND BITNOT BITOR
|
|
42243
|
+
`ABS ACOS AND ARG ANG360 ANGLEALONGPATH ANGLETOLOC ANGLETOPAR ASIN ATAN ATAN2 BITAND BITNOT BITOR
|
|
41451
42244
|
BITXOR BKGPAGENAME BLEND BLOB BLUE BOUND CALLOUTCOUNT CALLOUTTARGETREF CALLTHIS CATEGORY CEILING
|
|
41452
42245
|
CELLISTHEMED CHAR COMPANY CONTAINERCOUNT CONTAINERMEMBERCOUNT CONTAINERSHEETREF COS COSH CREATOR
|
|
41453
42246
|
CY DATA1 DATA2 DATA3 DATE DATETIME DATEVALUE DAY DAYOFYEAR DECIMALSEP DEFAULTEVENT DEG DEPENDSON
|
|
@@ -42976,17 +43769,17 @@ function pageSettingConstant(node3, length) {
|
|
|
42976
43769
|
}
|
|
42977
43770
|
return value3.value;
|
|
42978
43771
|
}
|
|
42979
|
-
var
|
|
43772
|
+
var escape3 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
42980
43773
|
function assertDependencies(roots, pagesPart, pages, pagePaths, pageId2, changed, check) {
|
|
42981
43774
|
const page = children2(pages, "Page").find((node3) => attribute2(node3, "ID") === pageId2);
|
|
42982
43775
|
const targetNames = new Set(
|
|
42983
43776
|
["Name", "NameU"].map((name3) => attribute2(page, name3)?.toLowerCase())
|
|
42984
43777
|
);
|
|
42985
43778
|
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(
|
|
43779
|
+
const cells4 = changed.map(escape3).join("|");
|
|
42987
43780
|
const reference2 = new RegExp(`(?:^|[^a-z0-9_.])(?:${cells4})(?:$|[^a-z0-9_.])`, "i");
|
|
42988
43781
|
const other = otherNames.length ? new RegExp(
|
|
42989
|
-
`Pages\\[(?:${otherNames.map(
|
|
43782
|
+
`Pages\\[(?:${otherNames.map(escape3).join("|")})\\]!(?:ThePage!)?(?:${cells4})(?![a-z0-9_.])`,
|
|
42990
43783
|
"gi"
|
|
42991
43784
|
) : void 0;
|
|
42992
43785
|
const paths = new Map([...pagePaths].map(([id3, path3]) => [path3, id3]));
|
|
@@ -43405,7 +44198,7 @@ var VISIO_DEFAULT_TITLE = "Title";
|
|
|
43405
44198
|
var ACCENT = { background: "Background Accent", border: "Border Accent" };
|
|
43406
44199
|
function visioShade(color2, amount) {
|
|
43407
44200
|
const value3 = Number.parseInt(color2.slice(1), 16);
|
|
43408
|
-
const channel = (
|
|
44201
|
+
const channel = (shift3) => Math.round((value3 >> shift3 & 255) * (1 - amount)).toString(16).padStart(2, "0");
|
|
43409
44202
|
return `#${channel(16)}${channel(8)}${channel(0)}`.toUpperCase();
|
|
43410
44203
|
}
|
|
43411
44204
|
function visioDecorationName(name3) {
|
|
@@ -43602,14 +44395,14 @@ function snapshotPageSetupEdit(edit) {
|
|
|
43602
44395
|
}
|
|
43603
44396
|
|
|
43604
44397
|
// visio/edit-data-commands.ts
|
|
43605
|
-
var
|
|
44398
|
+
var TYPES2 = [
|
|
43606
44399
|
"import-data-recordset",
|
|
43607
44400
|
"refresh-data-recordset",
|
|
43608
44401
|
"delete-data-recordset",
|
|
43609
44402
|
"link-data-rows",
|
|
43610
44403
|
"unlink-data-rows"
|
|
43611
44404
|
];
|
|
43612
|
-
var isVisioDataEdit = (edit) =>
|
|
44405
|
+
var isVisioDataEdit = (edit) => TYPES2.includes(edit.type);
|
|
43613
44406
|
var id = (value3, label) => {
|
|
43614
44407
|
if (typeof value3 !== "string" || !/^(0|[1-9]\d{0,9})$/.test(value3) || Number(value3) > 4294967295)
|
|
43615
44408
|
fail("INVALID_EDIT", `Invalid ${label}.`);
|
|
@@ -46082,6 +46875,7 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
|
|
|
46082
46875
|
fail("UNSUPPORTED_GEOMETRY_EDIT", "Glued shapes require routing outside this subset.");
|
|
46083
46876
|
const graph = indexCells(roots, {
|
|
46084
46877
|
check,
|
|
46878
|
+
scope: "affected",
|
|
46085
46879
|
glueShapes,
|
|
46086
46880
|
...group2 ? { groupResizeShapes: group2.shapes } : {}
|
|
46087
46881
|
});
|
|
@@ -46395,13 +47189,23 @@ function prepareMasterMovePins(roots, commands, bindings, check) {
|
|
|
46395
47189
|
}
|
|
46396
47190
|
}
|
|
46397
47191
|
if (result2.size) {
|
|
46398
|
-
const indexed = indexCells(roots, { check });
|
|
47192
|
+
const indexed = indexCells(roots, { check, scope: "affected" });
|
|
46399
47193
|
const pins = new Set(
|
|
46400
47194
|
[...indexed.values()].filter((cell) => cell.node && result2.has(cell.node)).map(key)
|
|
46401
47195
|
);
|
|
46402
|
-
|
|
46403
|
-
|
|
47196
|
+
const pinPages = new Set(
|
|
47197
|
+
[...indexed.values()].filter((cell) => cell.node && result2.has(cell.node)).map((c2) => c2.pageId)
|
|
47198
|
+
);
|
|
47199
|
+
for (const cell of indexed.values()) {
|
|
47200
|
+
charge();
|
|
47201
|
+
if (cell.opaque && pinPages.has(cell.pageId))
|
|
47202
|
+
fail(
|
|
47203
|
+
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
47204
|
+
"A formula that may read a master rotation pin exists."
|
|
47205
|
+
);
|
|
47206
|
+
if (cell.dependencies.some((dependency) => pins.has(dependency)))
|
|
46404
47207
|
fail("EDIT_UNSUPPORTED_DEPENDENCY", "A page cache depends on a master rotation pin.");
|
|
47208
|
+
}
|
|
46405
47209
|
}
|
|
46406
47210
|
return { pins: result2, dimensions: provenDimensions };
|
|
46407
47211
|
}
|
|
@@ -46498,8 +47302,12 @@ function applyGeometryEdit(roots, document, edit, check, masterMoveProof = empty
|
|
|
46498
47302
|
if (edit.type === "delete-shape") {
|
|
46499
47303
|
unlocked("LockDelete");
|
|
46500
47304
|
releaseDeletedGlue(roots, /* @__PURE__ */ new Map([[edit.pageId, /* @__PURE__ */ new Set([edit.shapeId])]]));
|
|
46501
|
-
assertVisioShapeUnreferenced(roots, edit.pageId, edit.shapeId, {
|
|
47305
|
+
const frozen = assertVisioShapeUnreferenced(roots, edit.pageId, edit.shapeId, {
|
|
47306
|
+
check,
|
|
47307
|
+
freeze: true
|
|
47308
|
+
});
|
|
46502
47309
|
shape.parentNode.removeChild(shape);
|
|
47310
|
+
freezeVisioCells(frozen);
|
|
46503
47311
|
return [edit.pageId];
|
|
46504
47312
|
}
|
|
46505
47313
|
if (edit.type === "rotate-shape" || edit.type === "flip-shape") {
|
|
@@ -47437,7 +48245,7 @@ async function recalculatePageFormulas(pkg, pagesPart, pages, paths, dirty, chec
|
|
|
47437
48245
|
}
|
|
47438
48246
|
|
|
47439
48247
|
// visio/edit-page-rename.ts
|
|
47440
|
-
var
|
|
48248
|
+
var escape4 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
47441
48249
|
function localCell(node3) {
|
|
47442
48250
|
const row2 = node3.parentNode;
|
|
47443
48251
|
const section3 = row2?.parentNode;
|
|
@@ -47466,7 +48274,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
|
|
|
47466
48274
|
}
|
|
47467
48275
|
const roots = await editableVisioPageRoots(pkg, pagesPart, pages, pagePaths, dirty, check);
|
|
47468
48276
|
const changedCells = [];
|
|
47469
|
-
const prefix2 = new RegExp(`Pages\\[${
|
|
48277
|
+
const prefix2 = new RegExp(`Pages\\[${escape4(oldUniversal)}\\]!`, "gi");
|
|
47470
48278
|
const targetByPath = new Map([...pagePaths].map(([id3, path3]) => [path3, id3]));
|
|
47471
48279
|
for (const [path3, root2] of roots) {
|
|
47472
48280
|
let changed = false;
|
|
@@ -47500,7 +48308,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
|
|
|
47500
48308
|
if (cell) changedCells.push({ node: node3, cell });
|
|
47501
48309
|
}
|
|
47502
48310
|
} else if (/\bPAGENAME\s*\(/i.test(code)) {
|
|
47503
|
-
if (target2 === pageId2 || !target2 || new RegExp(`Pages\\[${
|
|
48311
|
+
if (target2 === pageId2 || !target2 || new RegExp(`Pages\\[${escape4(oldUniversal)}\\]!`, "i").test(code))
|
|
47504
48312
|
fail(
|
|
47505
48313
|
"EDIT_UNSUPPORTED_PAGE_NAME_FORMULA",
|
|
47506
48314
|
"Complex page-name formula caches cannot be safely refreshed."
|
|
@@ -47550,7 +48358,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
|
|
|
47550
48358
|
for (const changed of changedCells) {
|
|
47551
48359
|
if (changed.node === node3) continue;
|
|
47552
48360
|
const reference2 = new RegExp(
|
|
47553
|
-
`(?:^|[^a-z0-9_.])${
|
|
48361
|
+
`(?:^|[^a-z0-9_.])${escape4(changed.cell)}(?:$|[^a-z0-9_.])`,
|
|
47554
48362
|
"i"
|
|
47555
48363
|
);
|
|
47556
48364
|
if (reference2.test(unquotedVisioFormula(formula2)))
|
|
@@ -47572,7 +48380,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
|
|
|
47572
48380
|
// visio/edit-page-delete.ts
|
|
47573
48381
|
var officeRel = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
47574
48382
|
var pageType = "http://schemas.microsoft.com/visio/2010/relationships/page";
|
|
47575
|
-
var
|
|
48383
|
+
var escape5 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
47576
48384
|
async function deleteVisioPage(pkg, pagesPart, pages, rels, types, pagePaths, parts, dirty, removed, pageId2, check) {
|
|
47577
48385
|
const existing = children2(pages, "Page");
|
|
47578
48386
|
const page = existing.find((node3) => attribute2(node3, "ID") === pageId2);
|
|
@@ -47581,7 +48389,7 @@ async function deleteVisioPage(pkg, pagesPart, pages, rels, types, pagePaths, pa
|
|
|
47581
48389
|
const names = new Set(
|
|
47582
48390
|
["Name", "NameU"].map((key2) => attribute2(page, key2)).filter((value3) => !!value3)
|
|
47583
48391
|
);
|
|
47584
|
-
const reference2 = new RegExp(`Pages\\[(?:${[...names].map(
|
|
48392
|
+
const reference2 = new RegExp(`Pages\\[(?:${[...names].map(escape5).join("|")})\\]!`, "i");
|
|
47585
48393
|
const documentPart2 = await related(pkg, "", "document");
|
|
47586
48394
|
const roots = await editableVisioPageRoots(
|
|
47587
48395
|
pkg,
|
|
@@ -47906,7 +48714,7 @@ function createVisioPagePart(parts, pages, pageId2, check) {
|
|
|
47906
48714
|
}
|
|
47907
48715
|
|
|
47908
48716
|
// visio/edit-page-decoration.ts
|
|
47909
|
-
var
|
|
48717
|
+
var escape6 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
47910
48718
|
var name2 = (page) => attribute2(page, "NameU") ?? attribute2(page, "Name") ?? "";
|
|
47911
48719
|
function largestShapeId(root2) {
|
|
47912
48720
|
let largest = 0;
|
|
@@ -47922,9 +48730,9 @@ function removeDecoration(root2, pageName, kind, pageRoots, check) {
|
|
|
47922
48730
|
) : [];
|
|
47923
48731
|
if (!targets.length) return false;
|
|
47924
48732
|
const ids = targets.map((shape) => attribute2(shape, "ID") ?? "");
|
|
47925
|
-
const local = new RegExp(`\\bSheet\\.(?:${ids.map(
|
|
48733
|
+
const local = new RegExp(`\\bSheet\\.(?:${ids.map(escape6).join("|")})!`, "i");
|
|
47926
48734
|
const remote = new RegExp(
|
|
47927
|
-
`Pages\\[${
|
|
48735
|
+
`Pages\\[${escape6(pageName)}\\]!Sheet\\.(?:${ids.map(escape6).join("|")})!`,
|
|
47928
48736
|
"i"
|
|
47929
48737
|
);
|
|
47930
48738
|
for (const connect of children2(root2, "Connects").flatMap((node3) => children2(node3, "Connect")))
|
|
@@ -48758,17 +49566,117 @@ async function formatTarget(pkg, pagePaths, roots, document, edit, check, instan
|
|
|
48758
49566
|
return true;
|
|
48759
49567
|
}
|
|
48760
49568
|
|
|
49569
|
+
// visio/edit-duplicate-line.ts
|
|
49570
|
+
var ENDS2 = ["BeginX", "BeginY", "EndX", "EndY"];
|
|
49571
|
+
var connects = (root2) => children2(root2, "Connects").flatMap((container) => children2(container, "Connect"));
|
|
49572
|
+
var gluedTargets = (root2, id3) => connects(root2).filter((row2) => attribute2(row2, "FromSheet") === id3).map((row2) => attribute2(row2, "ToSheet") ?? "");
|
|
49573
|
+
function assertGlueDroppable(root2, id3, copied, code = "UNSUPPORTED_DUPLICATE") {
|
|
49574
|
+
if (gluedTargets(root2, id3).some((target2) => copied.has(target2)))
|
|
49575
|
+
fail(code, "A glued connector cannot be copied together with a shape it is glued to yet.");
|
|
49576
|
+
}
|
|
49577
|
+
function assertEndFormulas(read, code) {
|
|
49578
|
+
for (const name3 of ENDS2) {
|
|
49579
|
+
const formula2 = executableCellFormula(attribute2(read(name3), "F"));
|
|
49580
|
+
if (formula2 && !isNativeGlueCell(name3, formula2))
|
|
49581
|
+
fail(code, `${name3} of the line holds a formula that is not native glue.`);
|
|
49582
|
+
}
|
|
49583
|
+
}
|
|
49584
|
+
var isLineSheet2 = (shape) => ENDS2.some((name3) => cells(shape).has(name3));
|
|
49585
|
+
function planLineCopy(shape, code = "UNSUPPORTED_DUPLICATE") {
|
|
49586
|
+
proveLocalLine(shape);
|
|
49587
|
+
assertEndFormulas((name3) => cells(shape).get(name3), code);
|
|
49588
|
+
const local = cells(shape);
|
|
49589
|
+
return { x: numeric(local.get("PinX")), y: numeric(local.get("PinY")) };
|
|
49590
|
+
}
|
|
49591
|
+
var shift2 = (node3, delta, name3) => {
|
|
49592
|
+
if (!node3) fail("UNSUPPORTED_DUPLICATE", `The line has no local ${name3}.`);
|
|
49593
|
+
const value3 = numeric(node3);
|
|
49594
|
+
node3.setAttribute("V", String(Object.is(value3 + delta, -0) ? 0 : value3 + delta));
|
|
49595
|
+
node3.removeAttribute("E");
|
|
49596
|
+
};
|
|
49597
|
+
function finishLineCopy(shape, dx, dy) {
|
|
49598
|
+
const local = cells(shape);
|
|
49599
|
+
for (const name3 of ENDS2) {
|
|
49600
|
+
const node3 = local.get(name3);
|
|
49601
|
+
const formula2 = executableCellFormula(attribute2(node3, "F"));
|
|
49602
|
+
if (formula2 && isNativeGlueCell(name3, formula2)) node3.removeAttribute("F");
|
|
49603
|
+
shift2(node3, name3.endsWith("X") ? dx : dy, name3);
|
|
49604
|
+
}
|
|
49605
|
+
shift2(local.get("PinX"), dx, "PinX");
|
|
49606
|
+
shift2(local.get("PinY"), dy, "PinY");
|
|
49607
|
+
}
|
|
49608
|
+
var isStencilConnector2 = (target2) => ENDS2.some((name3) => instanceCell(target2, name3));
|
|
49609
|
+
function planConnectorCopy(target2, code = "UNSUPPORTED_DUPLICATE") {
|
|
49610
|
+
const local = cells(target2.instance);
|
|
49611
|
+
for (const name3 of [...ENDS2, "PinX", "PinY"]) {
|
|
49612
|
+
const node3 = local.get(name3);
|
|
49613
|
+
if (!node3?.hasAttribute("V") || node3.hasAttribute("E"))
|
|
49614
|
+
fail(code, `The stencil connector has no usable local ${name3}.`);
|
|
49615
|
+
numeric(node3);
|
|
49616
|
+
}
|
|
49617
|
+
assertEndFormulas((name3) => local.get(name3), code);
|
|
49618
|
+
return { x: numeric(local.get("PinX")), y: numeric(local.get("PinY")) };
|
|
49619
|
+
}
|
|
49620
|
+
function finishConnectorCopy(shape, id3, dx, dy) {
|
|
49621
|
+
const local = cells(shape);
|
|
49622
|
+
for (const name3 of ENDS2) shift2(local.get(name3), name3.endsWith("X") ? dx : dy, name3);
|
|
49623
|
+
shift2(local.get("PinX"), dx, "PinX");
|
|
49624
|
+
shift2(local.get("PinY"), dy, "PinY");
|
|
49625
|
+
for (const name3 of ["BegTrigger", "EndTrigger"]) {
|
|
49626
|
+
const node3 = local.get(name3);
|
|
49627
|
+
if (!node3) continue;
|
|
49628
|
+
node3.setAttribute("F", visioGlueTrigger(id3));
|
|
49629
|
+
node3.setAttribute("V", "1");
|
|
49630
|
+
}
|
|
49631
|
+
}
|
|
49632
|
+
var CLEARANCE = 0.25;
|
|
49633
|
+
var endsBox = (shape, dx, dy) => {
|
|
49634
|
+
const local = cells(shape);
|
|
49635
|
+
const x = [numeric(local.get("BeginX")) + dx, numeric(local.get("EndX")) + dx];
|
|
49636
|
+
const y = [numeric(local.get("BeginY")) + dy, numeric(local.get("EndY")) + dy];
|
|
49637
|
+
return {
|
|
49638
|
+
minX: Math.min(...x) - CLEARANCE,
|
|
49639
|
+
maxX: Math.max(...x) + CLEARANCE,
|
|
49640
|
+
minY: Math.min(...y) - CLEARANCE,
|
|
49641
|
+
maxY: Math.max(...y) + CLEARANCE
|
|
49642
|
+
};
|
|
49643
|
+
};
|
|
49644
|
+
function assertConnectorCopyApart(root2, copies, dx, dy, code = "UNSUPPORTED_DUPLICATE") {
|
|
49645
|
+
const boxes = copies.map((shape) => endsBox(shape, dx, dy));
|
|
49646
|
+
for (const container of children2(root2, "Shapes"))
|
|
49647
|
+
for (const other of children2(container, "Shape")) {
|
|
49648
|
+
const local = cells(other);
|
|
49649
|
+
const formula2 = executableCellFormula(attribute2(local.get("BeginX"), "F")) ?? "";
|
|
49650
|
+
if (!/^_WALKGLUE\(/i.test(formula2)) continue;
|
|
49651
|
+
const box4 = endsBox(other, 0, 0);
|
|
49652
|
+
for (const copy8 of boxes)
|
|
49653
|
+
if (copy8.minX <= box4.maxX && box4.minX <= copy8.maxX && copy8.minY <= box4.maxY && box4.minY <= copy8.maxY)
|
|
49654
|
+
fail(
|
|
49655
|
+
code,
|
|
49656
|
+
"The copy of a connector would meet another connector, which Visio lays out again."
|
|
49657
|
+
);
|
|
49658
|
+
}
|
|
49659
|
+
}
|
|
49660
|
+
|
|
48761
49661
|
// visio/edit-instance-duplicate.ts
|
|
48762
|
-
async function planInstanceCopy(pkg, pageId2, sourceRoot, target2, offsetX, offsetY, code = "UNSUPPORTED_DUPLICATE") {
|
|
49662
|
+
async function planInstanceCopy(pkg, pageId2, sourceRoot, target2, offsetX, offsetY, code = "UNSUPPORTED_DUPLICATE", allowConnector = code === "UNSUPPORTED_DUPLICATE") {
|
|
48763
49663
|
const id3 = attribute2(target2.instance, "ID");
|
|
48764
|
-
|
|
49664
|
+
const connector2 = allowConnector && isStencilConnector2(target2);
|
|
49665
|
+
if (!connector2 && (isStencilConnector2(target2) || connectRows(sourceRoot).some((row2) => attribute2(row2, "FromSheet") === id3)))
|
|
48765
49666
|
fail(code, "Lines and connectors that come from a stencil cannot be copied yet.");
|
|
48766
49667
|
await assertInstanceUnlocked(pkg, pageId2, target2, ["LockSelect"], "selection");
|
|
49668
|
+
if (connector2) {
|
|
49669
|
+
const pin2 = planConnectorCopy(target2, code);
|
|
49670
|
+
const x2 = pin2.x + offsetX, y2 = pin2.y + offsetY;
|
|
49671
|
+
if (Math.abs(x2) > 1e6 || Math.abs(y2) > 1e6)
|
|
49672
|
+
fail(code, "Duplicated pins exceed coordinate limits.");
|
|
49673
|
+
return { x: x2, y: y2, connector: connector2 };
|
|
49674
|
+
}
|
|
48767
49675
|
const pin = instancePin(target2);
|
|
48768
49676
|
const x = pin.x + offsetX, y = pin.y + offsetY;
|
|
48769
49677
|
if (Math.abs(x) > 1e6 || Math.abs(y) > 1e6)
|
|
48770
49678
|
fail(code, "Duplicated pins exceed coordinate limits.");
|
|
48771
|
-
return { x, y };
|
|
49679
|
+
return { x, y, connector: connector2 };
|
|
48772
49680
|
}
|
|
48773
49681
|
function finishInstanceCopy(clone, template, x, y, taken, check) {
|
|
48774
49682
|
const mapping = /* @__PURE__ */ new Map();
|
|
@@ -48852,7 +49760,18 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48852
49760
|
structural ||= !source || await shapeIsStructural(source, template);
|
|
48853
49761
|
}
|
|
48854
49762
|
await assertDuplicateScope(pkg, pagePaths, root2, newIds, check, structural);
|
|
48855
|
-
const
|
|
49763
|
+
const glueTargets = new Set(
|
|
49764
|
+
children2(sourceRoot, "Connects").flatMap(
|
|
49765
|
+
(container2) => children2(container2, "Connect").map((row2) => attribute2(row2, "ToSheet"))
|
|
49766
|
+
)
|
|
49767
|
+
);
|
|
49768
|
+
const indexed = indexCells(detached ? /* @__PURE__ */ new Map([[sourcePageId, sourceRoot]]) : roots, {
|
|
49769
|
+
check,
|
|
49770
|
+
scope: "affected",
|
|
49771
|
+
glueShapes: new Set(
|
|
49772
|
+
pageShapes(sourceRoot).filter((shape) => glueTargets.has(attribute2(shape, "ID")))
|
|
49773
|
+
)
|
|
49774
|
+
});
|
|
48856
49775
|
const evaluate = createVisioCellEvaluator(indexed, { check }, true);
|
|
48857
49776
|
const containers = children2(root2, "Shapes");
|
|
48858
49777
|
if (containers.length > 1) fail("INVALID_SHAPE_ID", "Duplicate Shapes containers.");
|
|
@@ -48866,6 +49785,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48866
49785
|
if (value3 !== void 0) occupied.add(value3.toLowerCase());
|
|
48867
49786
|
}
|
|
48868
49787
|
const plans = [];
|
|
49788
|
+
const copied = new Set(edit.copies.map((copy8) => copy8.shapeId));
|
|
48869
49789
|
let cloneNodes = 0, cloneCharacters = buildXml(root2).length;
|
|
48870
49790
|
const size3 = (source) => {
|
|
48871
49791
|
cloneNodes += source.getElementsByTagName("*").length + 1;
|
|
@@ -48882,6 +49802,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48882
49802
|
"UNSUPPORTED_DUPLICATE"
|
|
48883
49803
|
);
|
|
48884
49804
|
if (stencil) {
|
|
49805
|
+
assertGlueDroppable(sourceRoot, copy8.shapeId, copied);
|
|
48885
49806
|
const pin = await planInstanceCopy(
|
|
48886
49807
|
pkg,
|
|
48887
49808
|
edit.pageId,
|
|
@@ -48894,18 +49815,33 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48894
49815
|
plans.push({
|
|
48895
49816
|
source: stencil.instance,
|
|
48896
49817
|
id: copy8.newShapeId,
|
|
48897
|
-
|
|
49818
|
+
x: pin.x,
|
|
49819
|
+
y: pin.y,
|
|
49820
|
+
...pin.connector ? { connector: true } : {},
|
|
48898
49821
|
template: stencil.template
|
|
48899
49822
|
});
|
|
48900
49823
|
continue;
|
|
48901
49824
|
}
|
|
49825
|
+
const line = pageShapes(sourceRoot).find((shape) => attribute2(shape, "ID") === copy8.shapeId);
|
|
49826
|
+
if (line && !line.hasAttribute("Master") && isLineSheet2(line)) {
|
|
49827
|
+
assertCloneLeaf(line);
|
|
49828
|
+
assertUnlayeredShape(line, document);
|
|
49829
|
+
assertShapeLocks(line, document, ["LockSelect"]);
|
|
49830
|
+
assertGlueDroppable(sourceRoot, copy8.shapeId, copied);
|
|
49831
|
+
const pin = planLineCopy(line);
|
|
49832
|
+
if (Math.abs(pin.x + edit.offsetX) > 1e6 || Math.abs(pin.y + edit.offsetY) > 1e6)
|
|
49833
|
+
fail("UNSUPPORTED_DUPLICATE", "Duplicated pins exceed coordinate limits.");
|
|
49834
|
+
size3(line);
|
|
49835
|
+
plans.push({ source: line, id: copy8.newShapeId, x: pin.x, y: pin.y, line: true });
|
|
49836
|
+
continue;
|
|
49837
|
+
}
|
|
48902
49838
|
const source = admitted(sourceRoot, copy8.shapeId);
|
|
48903
49839
|
assertCloneLeaf(source);
|
|
48904
49840
|
assertUnlayeredShape(source, document);
|
|
48905
49841
|
assertShapeLocks(source, document, ["LockSelect"]);
|
|
48906
|
-
for (const
|
|
48907
|
-
for (const connection of children2(
|
|
48908
|
-
if (
|
|
49842
|
+
for (const connects2 of children2(sourceRoot, "Connects"))
|
|
49843
|
+
for (const connection of children2(connects2, "Connect"))
|
|
49844
|
+
if (attribute2(connection, "FromSheet") === copy8.shapeId)
|
|
48909
49845
|
fail("UNSUPPORTED_DUPLICATE", "Glued shapes cannot be duplicated safely.");
|
|
48910
49846
|
const x = numeric(formattingCell(source, "PinX")), y = numeric(formattingCell(source, "PinY"));
|
|
48911
49847
|
for (const [name3, offset] of [
|
|
@@ -48920,6 +49856,9 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48920
49856
|
size3(source);
|
|
48921
49857
|
plans.push({ source, id: copy8.newShapeId, x: x + edit.offsetX, y: y + edit.offsetY });
|
|
48922
49858
|
}
|
|
49859
|
+
const connectorSources = plans.filter((plan) => plan.connector).map((plan) => plan.source);
|
|
49860
|
+
if (connectorSources.length)
|
|
49861
|
+
assertConnectorCopyApart(root2, connectorSources, edit.offsetX, edit.offsetY);
|
|
48923
49862
|
const order = new Map(
|
|
48924
49863
|
children2(children2(sourceRoot, "Shapes")[0], "Shape").map((source, index2) => [source, index2])
|
|
48925
49864
|
);
|
|
@@ -48930,6 +49869,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48930
49869
|
check();
|
|
48931
49870
|
const shape = root2.ownerDocument.importNode(plan.source, true);
|
|
48932
49871
|
copyIdentity(shape, plan.id, names);
|
|
49872
|
+
if (plan.line) finishLineCopy(shape, edit.offsetX, edit.offsetY);
|
|
48933
49873
|
for (const node3 of [shape, ...Array.from(shape.getElementsByTagName("*"))]) {
|
|
48934
49874
|
const source = executableCellFormula(attribute2(node3, "F"));
|
|
48935
49875
|
if (!source) continue;
|
|
@@ -48948,6 +49888,15 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48948
49888
|
)
|
|
48949
49889
|
);
|
|
48950
49890
|
}
|
|
49891
|
+
if (plan.line) {
|
|
49892
|
+
container.appendChild(shape);
|
|
49893
|
+
continue;
|
|
49894
|
+
}
|
|
49895
|
+
if (plan.connector) {
|
|
49896
|
+
finishConnectorCopy(shape, plan.id, edit.offsetX, edit.offsetY);
|
|
49897
|
+
container.appendChild(shape);
|
|
49898
|
+
continue;
|
|
49899
|
+
}
|
|
48951
49900
|
if (plan.template) {
|
|
48952
49901
|
for (const id3 of newIds) ids.add(id3);
|
|
48953
49902
|
finishInstanceCopy(shape, plan.template, plan.x, plan.y, ids, check);
|
|
@@ -48964,7 +49913,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48964
49913
|
}
|
|
48965
49914
|
container.appendChild(shape);
|
|
48966
49915
|
}
|
|
48967
|
-
const local = plans.filter((plan) => !plan.template);
|
|
49916
|
+
const local = plans.filter((plan) => !plan.template && !plan.line);
|
|
48968
49917
|
if (changed.length) {
|
|
48969
49918
|
await assertGeometryPackageScope(
|
|
48970
49919
|
pkg,
|
|
@@ -48998,6 +49947,9 @@ async function duplicateVisioShapes(pkg, pagePaths, roots, document, edit, check
|
|
|
48998
49947
|
}
|
|
48999
49948
|
const dirty = /* @__PURE__ */ new Set([edit.pageId]);
|
|
49000
49949
|
for (const id3 of recalculateVisioCells(roots, changed, { check })) dirty.add(id3);
|
|
49950
|
+
for (const plan of plans)
|
|
49951
|
+
if (!plan.line && !plan.connector)
|
|
49952
|
+
for (const id3 of rerouteBlockedConnectors(roots, edit.pageId, plan.id, check)) dirty.add(id3);
|
|
49001
49953
|
return [...dirty];
|
|
49002
49954
|
}
|
|
49003
49955
|
function assertCloneLeaf(source) {
|
|
@@ -49328,9 +50280,10 @@ function deleteVisioShapes(roots, document, edits, check, instances = /* @__PURE
|
|
|
49328
50280
|
}
|
|
49329
50281
|
releaseStencilGlue(roots, removed);
|
|
49330
50282
|
releaseDeletedGlue(roots, removed);
|
|
49331
|
-
assertVisioShapesUnreferenced(roots, removed, { check });
|
|
50283
|
+
const frozen = assertVisioShapesUnreferenced(roots, removed, { check, freeze: true });
|
|
49332
50284
|
check();
|
|
49333
50285
|
for (const shape of shapes) shape.parentNode.removeChild(shape);
|
|
50286
|
+
freezeVisioCells(frozen);
|
|
49334
50287
|
for (const pageId2 of removed.keys())
|
|
49335
50288
|
for (const container of children2(roots.get(pageId2), "Connects"))
|
|
49336
50289
|
if (!children2(container, "Connect").length) container.parentNode.removeChild(container);
|
|
@@ -49359,8 +50312,8 @@ function admittedShape(root2, document, shapeId2) {
|
|
|
49359
50312
|
if (["1", "true"].includes(attribute2(shape, "Del") ?? "")) refuse3("The shape is deleted.");
|
|
49360
50313
|
const local = cells(shape);
|
|
49361
50314
|
if (isLineSheet(local)) refuse3("Lines and connectors (1D shapes) cannot change shape.");
|
|
49362
|
-
for (const
|
|
49363
|
-
for (const connect of children2(
|
|
50315
|
+
for (const connects2 of children2(root2, "Connects"))
|
|
50316
|
+
for (const connect of children2(connects2, "Connect"))
|
|
49364
50317
|
if (["FromSheet", "ToSheet"].some((name3) => attribute2(connect, name3) === shapeId2))
|
|
49365
50318
|
refuse3("Glued connectors would need rerouting, which is not supported yet.");
|
|
49366
50319
|
if (children2(shape, "Section").some((section3) => attribute2(section3, "N") === "Controls"))
|
|
@@ -50803,8 +51756,8 @@ async function captureVisioClipboard(input, pageId2, shapeIds2, options2 = {}) {
|
|
|
50803
51756
|
numeric(formattingCell(source, name3));
|
|
50804
51757
|
evaluate(key({ pageId: pageId2, shapeId: id3, cell: name3 }));
|
|
50805
51758
|
}
|
|
50806
|
-
for (const
|
|
50807
|
-
for (const connection of children2(
|
|
51759
|
+
for (const connects2 of children2(root2, "Connects"))
|
|
51760
|
+
for (const connection of children2(connects2, "Connect"))
|
|
50808
51761
|
if (["FromSheet", "ToSheet"].some((name3) => attribute2(connection, name3) === id3))
|
|
50809
51762
|
fail("UNSUPPORTED_CLIPBOARD", "Glued shapes cannot be captured safely.");
|
|
50810
51763
|
}
|
|
@@ -51345,8 +52298,8 @@ function assertUnreferenced3(roots, shapeId2, check) {
|
|
|
51345
52298
|
if (reference2.test(executableCellFormula(attribute2(cell, "F")) ?? ""))
|
|
51346
52299
|
fail("UNSUPPORTED_GUIDE_EDIT", "A shape formula refers to this guide.");
|
|
51347
52300
|
}
|
|
51348
|
-
for (const
|
|
51349
|
-
for (const row2 of children2(
|
|
52301
|
+
for (const connects2 of children2(root2, "Connects"))
|
|
52302
|
+
for (const row2 of children2(connects2, "Connect"))
|
|
51350
52303
|
if (attribute2(row2, "ToSheet") === shapeId2 || attribute2(row2, "FromSheet") === shapeId2)
|
|
51351
52304
|
fail("UNSUPPORTED_GUIDE_EDIT", "Shapes are glued to this guide.");
|
|
51352
52305
|
}
|
|
@@ -51723,6 +52676,7 @@ async function editVsdxTransaction(input, edits, options2, clock = {
|
|
|
51723
52676
|
if (deleteOnly)
|
|
51724
52677
|
for (const pageId2 of deleteVisioShapes(roots, document, deletions, check, instanceDeletes))
|
|
51725
52678
|
dirty.set(pages.get(pageId2), roots.get(pageId2));
|
|
52679
|
+
const formulaDiagnostics = [];
|
|
51726
52680
|
const noteTextSize = async (target2, root2) => {
|
|
51727
52681
|
if (await measuresOwnText(root2, target2.shapeId, masterTemplate(pkg), check))
|
|
51728
52682
|
clock.textSizes.push({ pageId: target2.pageId, shapeId: target2.shapeId });
|
|
@@ -51738,7 +52692,15 @@ async function editVsdxTransaction(input, edits, options2, clock = {
|
|
|
51738
52692
|
roots.set(command2.pageId, root2);
|
|
51739
52693
|
}
|
|
51740
52694
|
if (command2.type === "replace-plain-text" || command2.type === "replace-text-ranges") {
|
|
51741
|
-
if (await (command2.type === "replace-plain-text" ? replaceScopedPlainText(
|
|
52695
|
+
if (await (command2.type === "replace-plain-text" ? replaceScopedPlainText(
|
|
52696
|
+
pkg,
|
|
52697
|
+
new Set(pages.values()),
|
|
52698
|
+
roots,
|
|
52699
|
+
document,
|
|
52700
|
+
command2,
|
|
52701
|
+
check,
|
|
52702
|
+
formulaDiagnostics
|
|
52703
|
+
) : replaceScopedTextRanges(pkg, new Set(pages.values()), roots, document, command2, check))) {
|
|
51742
52704
|
dirty.set(path3, root2);
|
|
51743
52705
|
textChanged = true;
|
|
51744
52706
|
await noteTextSize(command2, root2);
|
|
@@ -51884,6 +52846,7 @@ async function editVsdxTransaction(input, edits, options2, clock = {
|
|
|
51884
52846
|
bytes,
|
|
51885
52847
|
changedParts: [...dirty.keys()],
|
|
51886
52848
|
diagnostics: [
|
|
52849
|
+
...formulaDiagnostics,
|
|
51887
52850
|
...pasteChanged ? [
|
|
51888
52851
|
{
|
|
51889
52852
|
code: "edit-paste-experimental",
|