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/ui/index.cjs
CHANGED
|
@@ -1765,11 +1765,11 @@ function inspectDeclaration(value3, encoding) {
|
|
|
1765
1765
|
if (declarations.length) fail("INVALID_XML", "Invalid XML declaration attributes");
|
|
1766
1766
|
}
|
|
1767
1767
|
function decodeXmlAttribute(value3) {
|
|
1768
|
-
const
|
|
1768
|
+
const entities2 = { amp: "&", lt: "<", gt: ">", apos: "'", quot: '"' };
|
|
1769
1769
|
return value3.replace(/[\t\r\n]/g, " ").replace(/&(amp|lt|gt|apos|quot|#x[\da-fA-F]+|#\d+);/g, (_, entity) => {
|
|
1770
1770
|
if (entity.startsWith("#x")) return String.fromCodePoint(parseInt(entity.slice(2), 16));
|
|
1771
1771
|
if (entity.startsWith("#")) return String.fromCodePoint(Number(entity.slice(1)));
|
|
1772
|
-
return
|
|
1772
|
+
return entities2[entity] ?? "";
|
|
1773
1773
|
});
|
|
1774
1774
|
}
|
|
1775
1775
|
function inspectNamespaces(root2, check) {
|
|
@@ -2994,6 +2994,60 @@ function evaluateNumericFormulaFunction(name3, args) {
|
|
|
2994
2994
|
return formulaFailure("unsupported", `Unsupported numeric function ${name3}`);
|
|
2995
2995
|
}
|
|
2996
2996
|
|
|
2997
|
+
// visio/formula-extra-functions.ts
|
|
2998
|
+
var IGNORE_CASE = 1;
|
|
2999
|
+
var IGNORE_NONSPACE = 2;
|
|
3000
|
+
var IGNORE_SYMBOLS = 4;
|
|
3001
|
+
function strSameEx(a2, b, flags) {
|
|
3002
|
+
if (!Number.isInteger(flags) || flags < 0)
|
|
3003
|
+
return formulaFailure("value", "STRSAMEEX flags must be a whole number");
|
|
3004
|
+
if (flags & -8)
|
|
3005
|
+
return formulaFailure("unsupported", "STRSAMEEX with kana or width comparison flags");
|
|
3006
|
+
const fold = (text7) => {
|
|
3007
|
+
let result2 = text7;
|
|
3008
|
+
if (flags & IGNORE_NONSPACE) result2 = result2.normalize("NFD").replace(/\p{Mn}/gu, "");
|
|
3009
|
+
if (flags & IGNORE_SYMBOLS) result2 = result2.replace(/[\p{P}\p{S}\s]/gu, "");
|
|
3010
|
+
return flags & IGNORE_CASE ? result2.toLowerCase() : result2;
|
|
3011
|
+
};
|
|
3012
|
+
return fold(a2) === fold(b);
|
|
3013
|
+
}
|
|
3014
|
+
function formatNumberPicture(value3, picture) {
|
|
3015
|
+
if (value3.unit !== "scalar") return formulaFailure("unit", "FORMAT requires a plain number");
|
|
3016
|
+
const match = /^([#,0]*)(?:\.([0#]*))?(%?)$/.exec(picture);
|
|
3017
|
+
const integerPicture = match?.[1] ?? "";
|
|
3018
|
+
if (!match || !integerPicture.includes("0") || /0,*#/.test(integerPicture) || integerPicture.startsWith(",") || integerPicture.endsWith(",") || integerPicture.includes(",,") || /0#/.test(match[2] ?? ""))
|
|
3019
|
+
return formulaFailure("unsupported", `FORMAT picture "${picture}"`);
|
|
3020
|
+
const fractionPicture = match[2] ?? "", percent = match[3] === "%", grouped = integerPicture.includes(",");
|
|
3021
|
+
const minInteger = (integerPicture.match(/0/g) ?? []).length;
|
|
3022
|
+
const minFraction = (fractionPicture.match(/0/g) ?? []).length;
|
|
3023
|
+
const maxFraction = fractionPicture.length;
|
|
3024
|
+
const scaled = percent ? value3.value * 100 : value3.value;
|
|
3025
|
+
const factor = 10 ** maxFraction;
|
|
3026
|
+
const rounded = Math.sign(scaled) * Math.round(Math.abs(scaled) * factor + 1e-9) / factor;
|
|
3027
|
+
const [digits = "", decimals = ""] = Math.abs(rounded).toFixed(maxFraction).split(".");
|
|
3028
|
+
let whole = digits.replace(/^0+/, "").padStart(minInteger, "0");
|
|
3029
|
+
if (grouped) whole = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
3030
|
+
let fraction = decimals;
|
|
3031
|
+
while (fraction.length > minFraction && fraction.endsWith("0")) fraction = fraction.slice(0, -1);
|
|
3032
|
+
const negative = rounded < 0;
|
|
3033
|
+
return `${negative ? "-" : ""}${whole}${fraction ? `.${fraction}` : ""}${percent ? "%" : ""}`;
|
|
3034
|
+
}
|
|
3035
|
+
function visioDateSerial(year, month, day) {
|
|
3036
|
+
if (![year, month, day].every(Number.isInteger))
|
|
3037
|
+
return formulaFailure("value", "DATE requires whole numbers");
|
|
3038
|
+
if (year < 1 || year > 9999 || month < 1 || month > 12 || day < 1 || day > 31)
|
|
3039
|
+
return formulaFailure("value", "DATE is outside the calendar");
|
|
3040
|
+
const date2 = /* @__PURE__ */ new Date(0);
|
|
3041
|
+
date2.setUTCFullYear(year, month - 1, day);
|
|
3042
|
+
if (date2.getUTCMonth() !== month - 1) return formulaFailure("value", "DATE is not a real day");
|
|
3043
|
+
return (date2.getTime() - Date.UTC(1899, 11, 30)) / 864e5;
|
|
3044
|
+
}
|
|
3045
|
+
var angleToLocal = (frame, angle) => angle - frame.angle;
|
|
3046
|
+
function localToParent(frame, x, y) {
|
|
3047
|
+
const dx = x - frame.locPinX, dy = y - frame.locPinY, cos = Math.cos(frame.angle), sin = Math.sin(frame.angle);
|
|
3048
|
+
return [frame.pinX + dx * cos - dy * sin, frame.pinY + dx * sin + dy * cos];
|
|
3049
|
+
}
|
|
3050
|
+
|
|
2997
3051
|
// visio/formula-text-functions.ts
|
|
2998
3052
|
var textResultFunctions = /* @__PURE__ */ new Set([
|
|
2999
3053
|
"MID",
|
|
@@ -3005,12 +3059,15 @@ var textResultFunctions = /* @__PURE__ */ new Set([
|
|
|
3005
3059
|
"SUBSTITUTE",
|
|
3006
3060
|
"REPLACE",
|
|
3007
3061
|
"CHAR",
|
|
3008
|
-
"INDEX"
|
|
3062
|
+
"INDEX",
|
|
3063
|
+
"FORMAT",
|
|
3064
|
+
"SHAPETEXT"
|
|
3009
3065
|
]);
|
|
3010
3066
|
var textNumberFunctions = /* @__PURE__ */ new Set([
|
|
3011
3067
|
"LEN",
|
|
3012
3068
|
"FIND",
|
|
3013
3069
|
"STRSAME",
|
|
3070
|
+
"STRSAMEEX",
|
|
3014
3071
|
"LOOKUP"
|
|
3015
3072
|
]);
|
|
3016
3073
|
var LIST_SEPARATOR = ";";
|
|
@@ -3026,6 +3083,7 @@ function exactInteger(context, node3, name3) {
|
|
|
3026
3083
|
if (!Number.isInteger(value3.value)) return unsupported2(`${name3} with a fractional number`);
|
|
3027
3084
|
return value3.value;
|
|
3028
3085
|
}
|
|
3086
|
+
var isTheText = (node3) => node3.kind === "reference" && node3.reference.cell.toLowerCase() === "thetext";
|
|
3029
3087
|
function evaluateFormulaText(node3, context, depth = 0) {
|
|
3030
3088
|
context.tick();
|
|
3031
3089
|
if (depth > 64) return formulaFailure("limit", "Formula evaluation limit");
|
|
@@ -3036,6 +3094,10 @@ function evaluateFormulaText(node3, context, depth = 0) {
|
|
|
3036
3094
|
if (node3.kind === "string") return node3.value;
|
|
3037
3095
|
if (node3.kind === "binary" && node3.operator === "&")
|
|
3038
3096
|
return text7(node3.left, "&") + text7(node3.right, "&");
|
|
3097
|
+
if (node3.kind === "reference" && isTheText(node3)) {
|
|
3098
|
+
const read = context.textOf?.(node3.reference);
|
|
3099
|
+
return read === void 0 ? unsupported2("Text read from a cell") : read;
|
|
3100
|
+
}
|
|
3039
3101
|
if (node3.kind !== "call") {
|
|
3040
3102
|
let value3;
|
|
3041
3103
|
try {
|
|
@@ -3057,6 +3119,12 @@ function evaluateFormulaText(node3, context, depth = 0) {
|
|
|
3057
3119
|
if (value3.unit !== "scalar") return unsupported2("Text from a number with a unit");
|
|
3058
3120
|
return String(value3.value);
|
|
3059
3121
|
}
|
|
3122
|
+
if (name3 === "SHAPETEXT") {
|
|
3123
|
+
arity(1);
|
|
3124
|
+
const target2 = args[0];
|
|
3125
|
+
if (!isTheText(target2)) return unsupported2("SHAPETEXT of something other than TheText");
|
|
3126
|
+
return text7(target2, name3);
|
|
3127
|
+
}
|
|
3060
3128
|
if (name3 === "MID") {
|
|
3061
3129
|
arity(3);
|
|
3062
3130
|
const source = text7(args[0], name3), start = integer(context, args[1], name3), length = integer(context, args[2], name3);
|
|
@@ -3111,6 +3179,10 @@ function evaluateFormulaText(node3, context, depth = 0) {
|
|
|
3111
3179
|
if (code >= 128 && code <= 159) return unsupported2("CHAR in the Windows-1252 range");
|
|
3112
3180
|
return String.fromCharCode(code);
|
|
3113
3181
|
}
|
|
3182
|
+
if (name3 === "FORMAT") {
|
|
3183
|
+
arity(2);
|
|
3184
|
+
return formatNumberPicture(context.number(args[0]), text7(args[1], name3));
|
|
3185
|
+
}
|
|
3114
3186
|
arity(2);
|
|
3115
3187
|
const index2 = integer(context, args[0], name3);
|
|
3116
3188
|
const items = text7(args[1], name3).split(LIST_SEPARATOR);
|
|
@@ -3143,6 +3215,11 @@ function evaluateTextNumberFunction(name3, args, context) {
|
|
|
3143
3215
|
const ignoreCase = args[2] ? context.number(args[2]).value !== 0 : false;
|
|
3144
3216
|
return scalar4(ignoreCase ? Number(a2.toLowerCase() === b.toLowerCase()) : Number(a2 === b));
|
|
3145
3217
|
}
|
|
3218
|
+
if (name3 === "STRSAMEEX") {
|
|
3219
|
+
if (args.length === 4) return formulaFailure("unsupported", "STRSAMEEX with a locale");
|
|
3220
|
+
arity(3);
|
|
3221
|
+
return scalar4(Number(strSameEx(text7(0), text7(1), context.number(args[2]).value)));
|
|
3222
|
+
}
|
|
3146
3223
|
arity(2);
|
|
3147
3224
|
const wanted = text7(0).toLowerCase();
|
|
3148
3225
|
return scalar4(
|
|
@@ -3150,6 +3227,23 @@ function evaluateTextNumberFunction(name3, args, context) {
|
|
|
3150
3227
|
);
|
|
3151
3228
|
}
|
|
3152
3229
|
|
|
3230
|
+
// visio/formula-indirect.ts
|
|
3231
|
+
var FRAME_INPUTS = {
|
|
3232
|
+
ANGLETOLOC: ["Angle", "FlipX", "FlipY"],
|
|
3233
|
+
LOCTOPAR: ["PinX", "PinY", "LocPinX", "LocPinY", "Angle", "FlipX", "FlipY"]
|
|
3234
|
+
};
|
|
3235
|
+
function literalIndirectTarget(node3) {
|
|
3236
|
+
if (node3.kind !== "call" || node3.args.length !== 1) return void 0;
|
|
3237
|
+
const address = node3.args[0];
|
|
3238
|
+
if (address.kind !== "string") return void 0;
|
|
3239
|
+
try {
|
|
3240
|
+
const target2 = parseVisioFormula(address.value);
|
|
3241
|
+
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;
|
|
3242
|
+
} catch {
|
|
3243
|
+
return void 0;
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3153
3247
|
// visio/formula-math-functions.ts
|
|
3154
3248
|
var mathFormulaFunctions = /* @__PURE__ */ new Set([
|
|
3155
3249
|
"ROUND",
|
|
@@ -3254,7 +3348,7 @@ function evaluateMathFormulaFunction(name3, args) {
|
|
|
3254
3348
|
return formulaFailure("unsupported", `Unsupported function ${name3}`);
|
|
3255
3349
|
}
|
|
3256
3350
|
|
|
3257
|
-
// visio/formula-
|
|
3351
|
+
// visio/formula-analyze.ts
|
|
3258
3352
|
var supported = /* @__PURE__ */ new Set([
|
|
3259
3353
|
"GUARD",
|
|
3260
3354
|
"IF",
|
|
@@ -3276,6 +3370,11 @@ var supported = /* @__PURE__ */ new Set([
|
|
|
3276
3370
|
"PNTY",
|
|
3277
3371
|
"ISERROR",
|
|
3278
3372
|
"IFERROR",
|
|
3373
|
+
"INDIRECT",
|
|
3374
|
+
"DATE",
|
|
3375
|
+
"ANGLETOLOC",
|
|
3376
|
+
"LOCTOPAR",
|
|
3377
|
+
"SHEETREF",
|
|
3279
3378
|
...textNumberFunctions,
|
|
3280
3379
|
...textResultFunctions,
|
|
3281
3380
|
...numericFormulaFunctions,
|
|
@@ -3328,10 +3427,11 @@ var staticUnsupported = /* @__PURE__ */ new Set([
|
|
|
3328
3427
|
"MSOTINT",
|
|
3329
3428
|
"SHADE",
|
|
3330
3429
|
"LUMDIFF",
|
|
3331
|
-
"MODULUS"
|
|
3430
|
+
"MODULUS",
|
|
3431
|
+
// Reads an argument of the master the shape was dropped from; pure, evaluated in master scope.
|
|
3432
|
+
"ARG"
|
|
3332
3433
|
]);
|
|
3333
3434
|
var dynamic = /* @__PURE__ */ new Set([
|
|
3334
|
-
"INDIRECT",
|
|
3335
3435
|
"EVALCELL",
|
|
3336
3436
|
"EVALTEXT",
|
|
3337
3437
|
"DEPENDSON",
|
|
@@ -3348,6 +3448,19 @@ var dynamic = /* @__PURE__ */ new Set([
|
|
|
3348
3448
|
"PAR"
|
|
3349
3449
|
]);
|
|
3350
3450
|
var isClassifiedVisioFunction = (name3) => supported.has(name3) || staticUnsupported.has(name3) || dynamic.has(name3);
|
|
3451
|
+
var opaqueFunctions = /* @__PURE__ */ new Set([
|
|
3452
|
+
"EVALCELL",
|
|
3453
|
+
"EVALTEXT",
|
|
3454
|
+
"GETREF",
|
|
3455
|
+
"REF",
|
|
3456
|
+
"_SHEETCELL",
|
|
3457
|
+
// Structure lookups: the result changes when shapes are created, moved or reparented.
|
|
3458
|
+
"CONTAINERSHEETREF",
|
|
3459
|
+
"MEMBERSHEETREF",
|
|
3460
|
+
"CALLOUTTARGET",
|
|
3461
|
+
"PARENT",
|
|
3462
|
+
"PAR"
|
|
3463
|
+
]);
|
|
3351
3464
|
function traverse(ast, limits, visit) {
|
|
3352
3465
|
const maxNodes = formulaLimit(limits.maxNodes, 1024), maxDepth = formulaLimit(limits.maxDepth, 64);
|
|
3353
3466
|
const queue = [[ast, 0]];
|
|
@@ -3365,7 +3478,7 @@ function traverse(ast, limits, visit) {
|
|
|
3365
3478
|
function analyzeVisioFormula(source, limits = {}) {
|
|
3366
3479
|
const ast = typeof source === "string" ? parseVisioFormula(source, limits) : source;
|
|
3367
3480
|
const references = /* @__PURE__ */ new Map(), unsupportedFunctions = /* @__PURE__ */ new Set();
|
|
3368
|
-
let unsafe2 = false, guarded = false;
|
|
3481
|
+
let unsafe2 = false, opaque = false, guarded = false;
|
|
3369
3482
|
traverse(ast, limits, (node3) => {
|
|
3370
3483
|
if (node3.kind === "reference")
|
|
3371
3484
|
references.set(
|
|
@@ -3375,9 +3488,23 @@ function analyzeVisioFormula(source, limits = {}) {
|
|
|
3375
3488
|
if (node3.kind === "call") {
|
|
3376
3489
|
const inputs = node3.name === "ISTHEMED" ? ["ColorSchemeIndex"] : ["THEMEVAL", "THEME"].includes(node3.name) ? themeInputs : [];
|
|
3377
3490
|
for (const cell of inputs) references.set(`!${cell.toLowerCase()}`, { cell });
|
|
3491
|
+
for (const cell of FRAME_INPUTS[node3.name] ?? [])
|
|
3492
|
+
references.set(`!${cell.toLowerCase()}`, { cell });
|
|
3493
|
+
if (node3.name === "INDIRECT") {
|
|
3494
|
+
const target2 = literalIndirectTarget(node3);
|
|
3495
|
+
if (target2 && limits.literalIndirect)
|
|
3496
|
+
references.set(`${target2.shapeId ?? ""}!${target2.cell.toLowerCase()}`, target2);
|
|
3497
|
+
else {
|
|
3498
|
+
unsafe2 = true;
|
|
3499
|
+
opaque = true;
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3378
3502
|
if (!supported.has(node3.name)) unsupportedFunctions.add(node3.name);
|
|
3379
|
-
|
|
3503
|
+
const shapeText2 = node3.name === "SHAPETEXT" && limits.shapeTextReads === true && node3.args.length === 1 && isTheText(node3.args[0]);
|
|
3504
|
+
if (dynamic.has(node3.name) && !shapeText2 || !supported.has(node3.name) && !staticUnsupported.has(node3.name))
|
|
3380
3505
|
unsafe2 = true;
|
|
3506
|
+
if (opaqueFunctions.has(node3.name) || node3.name === "SHAPETEXT" && !shapeText2 || !supported.has(node3.name) && !staticUnsupported.has(node3.name) && !dynamic.has(node3.name) && node3.name !== "_SHEETCALL")
|
|
3507
|
+
opaque = true;
|
|
3381
3508
|
if (node3.name === "GUARD") guarded = true;
|
|
3382
3509
|
}
|
|
3383
3510
|
});
|
|
@@ -3385,10 +3512,56 @@ function analyzeVisioFormula(source, limits = {}) {
|
|
|
3385
3512
|
references: [...references.values()],
|
|
3386
3513
|
unsupportedFunctions: [...unsupportedFunctions],
|
|
3387
3514
|
dynamic: unsafe2,
|
|
3515
|
+
opaque,
|
|
3388
3516
|
guarded
|
|
3389
3517
|
};
|
|
3390
3518
|
}
|
|
3391
|
-
|
|
3519
|
+
|
|
3520
|
+
// visio/formula-bound.ts
|
|
3521
|
+
function evaluateBound(args, arg) {
|
|
3522
|
+
if (args.length < 5 || (args.length - 2) % 3 !== 0 || args.length > 302)
|
|
3523
|
+
return formulaFailure("arity", "Invalid BOUND argument count");
|
|
3524
|
+
const value3 = arg(0), type = arg(1);
|
|
3525
|
+
if (type.unit !== "scalar" || ![0, 1, 2].includes(type.value))
|
|
3526
|
+
return formulaFailure("value", "BOUND type must be 0, 1 or 2");
|
|
3527
|
+
if (type.value === 2) return value3;
|
|
3528
|
+
if (type.value === 1) {
|
|
3529
|
+
let current = value3.value, unit4 = value3.unit;
|
|
3530
|
+
for (let pass = 0; pass <= (args.length - 2) / 3; pass++) {
|
|
3531
|
+
let moved = false;
|
|
3532
|
+
for (let index2 = 2; index2 < args.length; index2 += 3) {
|
|
3533
|
+
if (arg(index2).value !== 0) continue;
|
|
3534
|
+
const a2 = arg(index2 + 1), b = arg(index2 + 2);
|
|
3535
|
+
unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, a2);
|
|
3536
|
+
unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, b);
|
|
3537
|
+
const low2 = Math.min(a2.value, b.value), high2 = Math.max(a2.value, b.value);
|
|
3538
|
+
if (current > low2 && current < high2) {
|
|
3539
|
+
current = current - low2 < high2 - current ? low2 : high2;
|
|
3540
|
+
moved = true;
|
|
3541
|
+
}
|
|
3542
|
+
}
|
|
3543
|
+
if (!moved) break;
|
|
3544
|
+
}
|
|
3545
|
+
return finiteFormulaValue({ value: current, unit: unit4 });
|
|
3546
|
+
}
|
|
3547
|
+
let nearest;
|
|
3548
|
+
let unit3 = value3.unit;
|
|
3549
|
+
for (let index2 = 2; index2 < args.length; index2 += 3) {
|
|
3550
|
+
if (arg(index2).value !== 0) continue;
|
|
3551
|
+
const a2 = arg(index2 + 1), b = arg(index2 + 2);
|
|
3552
|
+
unit3 = compatibleFormulaUnits({ value: value3.value, unit: unit3 }, a2);
|
|
3553
|
+
unit3 = compatibleFormulaUnits({ value: value3.value, unit: unit3 }, b);
|
|
3554
|
+
const low2 = Math.min(a2.value, b.value), high2 = Math.max(a2.value, b.value);
|
|
3555
|
+
if (value3.value >= low2 && value3.value <= high2) return finiteFormulaValue({ value: value3.value, unit: unit3 });
|
|
3556
|
+
const edge = value3.value < low2 ? low2 : high2;
|
|
3557
|
+
if (nearest === void 0 || Math.abs(edge - value3.value) < Math.abs(nearest - value3.value))
|
|
3558
|
+
nearest = edge;
|
|
3559
|
+
}
|
|
3560
|
+
return finiteFormulaValue({ value: nearest ?? value3.value, unit: unit3 });
|
|
3561
|
+
}
|
|
3562
|
+
|
|
3563
|
+
// visio/formula-operators.ts
|
|
3564
|
+
function binaryOperator(operator, a2, b) {
|
|
3392
3565
|
let unit3;
|
|
3393
3566
|
if (operator === "+" || operator === "-") {
|
|
3394
3567
|
unit3 = compatibleFormulaUnits(a2, b);
|
|
@@ -3418,12 +3591,36 @@ function binary(operator, a2, b) {
|
|
|
3418
3591
|
return formulaFailure("syntax", `Unsupported operator ${operator}`);
|
|
3419
3592
|
return { value: comparisons[operator] ? 1 : 0, unit: "scalar" };
|
|
3420
3593
|
}
|
|
3594
|
+
function evaluatedShapeFrame(sheet, resolve) {
|
|
3595
|
+
if (sheet.kind !== "call" || sheet.name !== "SHEETREF" || sheet.args.length)
|
|
3596
|
+
return formulaFailure("unsupported", "A sheet other than SHEETREF()");
|
|
3597
|
+
const read = (cell, fallback) => {
|
|
3598
|
+
try {
|
|
3599
|
+
return finiteFormulaValue(resolve({ cell })).value;
|
|
3600
|
+
} catch (error) {
|
|
3601
|
+
if (fallback === void 0) throw error;
|
|
3602
|
+
return fallback;
|
|
3603
|
+
}
|
|
3604
|
+
};
|
|
3605
|
+
if (read("FlipX", 0) !== 0 || read("FlipY", 0) !== 0)
|
|
3606
|
+
return formulaFailure("unsupported", "A coordinate conversion on a flipped shape");
|
|
3607
|
+
return {
|
|
3608
|
+
pinX: read("PinX"),
|
|
3609
|
+
pinY: read("PinY"),
|
|
3610
|
+
locPinX: read("LocPinX", 0),
|
|
3611
|
+
locPinY: read("LocPinY", 0),
|
|
3612
|
+
angle: read("Angle", 0)
|
|
3613
|
+
};
|
|
3614
|
+
}
|
|
3615
|
+
|
|
3616
|
+
// visio/formula-evaluate.ts
|
|
3421
3617
|
function evaluateVisioFormula(source, resolve, limits = {}) {
|
|
3422
3618
|
const ast = typeof source === "string" ? parseVisioFormula(source, limits) : source;
|
|
3423
3619
|
const maxSteps = formulaLimit(limits.maxSteps, 8192), maxDepth = formulaLimit(limits.maxDepth, 64);
|
|
3424
3620
|
traverse(ast, limits, () => {
|
|
3425
3621
|
});
|
|
3426
3622
|
let steps = 0;
|
|
3623
|
+
const shapeFrame = (sheet) => evaluatedShapeFrame(sheet, resolve);
|
|
3427
3624
|
const evaluate = (node3, depth = 0) => {
|
|
3428
3625
|
if (++steps > maxSteps || depth > maxDepth)
|
|
3429
3626
|
return formulaFailure("limit", "Formula evaluation limit");
|
|
@@ -3447,7 +3644,7 @@ function evaluateVisioFormula(source, resolve, limits = {}) {
|
|
|
3447
3644
|
else if (right2.unit === "length" && left.unit === "scalar" && node3.left.kind === "number")
|
|
3448
3645
|
left = { ...left, unit: "length" };
|
|
3449
3646
|
}
|
|
3450
|
-
return
|
|
3647
|
+
return binaryOperator(node3.operator, left, right2);
|
|
3451
3648
|
}
|
|
3452
3649
|
const name3 = node3.name;
|
|
3453
3650
|
if ((name3 === "TEXTWIDTH" || name3 === "TEXTHEIGHT") && limits.text) {
|
|
@@ -3476,18 +3673,57 @@ function evaluateVisioFormula(source, resolve, limits = {}) {
|
|
|
3476
3673
|
return formulaFailure("context", `${name3} requires a valid document context`);
|
|
3477
3674
|
return { value: value4, unit: "scalar" };
|
|
3478
3675
|
}
|
|
3676
|
+
const textContext = {
|
|
3677
|
+
number: (child3) => evaluate(child3, depth + 1),
|
|
3678
|
+
...limits.textOf ? { textOf: limits.textOf } : {},
|
|
3679
|
+
tick: () => {
|
|
3680
|
+
if (++steps > maxSteps) formulaFailure("limit", "Formula evaluation limit");
|
|
3681
|
+
}
|
|
3682
|
+
};
|
|
3479
3683
|
if (textNumberFunctions.has(name3))
|
|
3480
|
-
return evaluateTextNumberFunction(name3, node3.args,
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3684
|
+
return evaluateTextNumberFunction(name3, node3.args, textContext);
|
|
3685
|
+
if (name3 === "INDIRECT") {
|
|
3686
|
+
arity(1);
|
|
3687
|
+
const target2 = parseVisioFormula(evaluateFormulaText(node3.args[0], textContext, 1));
|
|
3688
|
+
if (target2.kind !== "reference")
|
|
3689
|
+
return formulaFailure("value", "INDIRECT needs a cell address");
|
|
3690
|
+
return finiteFormulaValue(resolve(target2.reference));
|
|
3691
|
+
}
|
|
3692
|
+
if (name3 === "DATE") {
|
|
3693
|
+
arity(3);
|
|
3694
|
+
const [year, month, day] = node3.args.map((_, index2) => {
|
|
3695
|
+
const part = arg(index2);
|
|
3696
|
+
if (part.unit !== "scalar") return formulaFailure("unit", "DATE requires plain numbers");
|
|
3697
|
+
return part.value;
|
|
3485
3698
|
});
|
|
3699
|
+
return { value: visioDateSerial(year, month, day), unit: "time" };
|
|
3700
|
+
}
|
|
3701
|
+
if (name3 === "SHEETREF" || name3 === "LOCTOPAR")
|
|
3702
|
+
return formulaFailure("unsupported", `${name3} does not return a number`);
|
|
3703
|
+
if (name3 === "ANGLETOLOC") {
|
|
3704
|
+
arity(2);
|
|
3705
|
+
const angle = arg(1);
|
|
3706
|
+
if (angle.unit !== "angle" && angle.unit !== "scalar")
|
|
3707
|
+
return formulaFailure("unit", "ANGLETOLOC requires an angle");
|
|
3708
|
+
return { value: angleToLocal(shapeFrame(node3.args[0]), angle.value), unit: "angle" };
|
|
3709
|
+
}
|
|
3486
3710
|
if (textResultFunctions.has(name3) || name3 === "PNT")
|
|
3487
3711
|
return formulaFailure("unsupported", `${name3} does not return a number`);
|
|
3488
3712
|
if (name3 === "PNTX" || name3 === "PNTY") {
|
|
3489
3713
|
arity(1);
|
|
3490
3714
|
const point2 = node3.args[0];
|
|
3715
|
+
if (point2.kind === "call" && point2.name === "LOCTOPAR") {
|
|
3716
|
+
if (point2.args.length !== 3)
|
|
3717
|
+
return formulaFailure("arity", "Invalid LOCTOPAR argument count");
|
|
3718
|
+
const [x2, y2] = [1, 2].map((index2) => {
|
|
3719
|
+
const part = evaluate(point2.args[index2], depth + 2);
|
|
3720
|
+
if (part.unit !== "scalar" && part.unit !== "length")
|
|
3721
|
+
return formulaFailure("unit", "LOCTOPAR requires lengths");
|
|
3722
|
+
return part.value;
|
|
3723
|
+
});
|
|
3724
|
+
const parent = localToParent(shapeFrame(point2.args[0]), x2, y2);
|
|
3725
|
+
return finiteFormulaValue({ value: parent[name3 === "PNTX" ? 0 : 1], unit: "length" });
|
|
3726
|
+
}
|
|
3491
3727
|
if (point2.kind !== "call" || point2.name !== "PNT")
|
|
3492
3728
|
return formulaFailure("unsupported", `${name3} of something other than PNT(x,y)`);
|
|
3493
3729
|
if (point2.args.length !== 2) return formulaFailure("arity", "Invalid PNT argument count");
|
|
@@ -3545,47 +3781,7 @@ function evaluateVisioFormula(source, resolve, limits = {}) {
|
|
|
3545
3781
|
}
|
|
3546
3782
|
return finiteFormulaValue(result2);
|
|
3547
3783
|
}
|
|
3548
|
-
if (name3 === "BOUND")
|
|
3549
|
-
if (node3.args.length < 5 || (node3.args.length - 2) % 3 !== 0 || node3.args.length > 302)
|
|
3550
|
-
return formulaFailure("arity", "Invalid BOUND argument count");
|
|
3551
|
-
const value4 = arg(0), type = arg(1);
|
|
3552
|
-
if (type.unit !== "scalar" || ![0, 1, 2].includes(type.value))
|
|
3553
|
-
return formulaFailure("value", "BOUND type must be 0, 1 or 2");
|
|
3554
|
-
if (type.value === 2) return value4;
|
|
3555
|
-
if (type.value === 1) {
|
|
3556
|
-
let current = value4.value, unit4 = value4.unit;
|
|
3557
|
-
for (let pass = 0; pass <= (node3.args.length - 2) / 3; pass++) {
|
|
3558
|
-
let moved = false;
|
|
3559
|
-
for (let index2 = 2; index2 < node3.args.length; index2 += 3) {
|
|
3560
|
-
if (arg(index2).value !== 0) continue;
|
|
3561
|
-
const a2 = arg(index2 + 1), b = arg(index2 + 2);
|
|
3562
|
-
unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, a2);
|
|
3563
|
-
unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, b);
|
|
3564
|
-
const low2 = Math.min(a2.value, b.value), high2 = Math.max(a2.value, b.value);
|
|
3565
|
-
if (current > low2 && current < high2) {
|
|
3566
|
-
current = current - low2 < high2 - current ? low2 : high2;
|
|
3567
|
-
moved = true;
|
|
3568
|
-
}
|
|
3569
|
-
}
|
|
3570
|
-
if (!moved) break;
|
|
3571
|
-
}
|
|
3572
|
-
return finiteFormulaValue({ value: current, unit: unit4 });
|
|
3573
|
-
}
|
|
3574
|
-
let nearest;
|
|
3575
|
-
let unit3 = value4.unit;
|
|
3576
|
-
for (let index2 = 2; index2 < node3.args.length; index2 += 3) {
|
|
3577
|
-
if (arg(index2).value !== 0) continue;
|
|
3578
|
-
const a2 = arg(index2 + 1), b = arg(index2 + 2);
|
|
3579
|
-
unit3 = compatibleFormulaUnits({ value: value4.value, unit: unit3 }, a2);
|
|
3580
|
-
unit3 = compatibleFormulaUnits({ value: value4.value, unit: unit3 }, b);
|
|
3581
|
-
const low2 = Math.min(a2.value, b.value), high2 = Math.max(a2.value, b.value);
|
|
3582
|
-
if (value4.value >= low2 && value4.value <= high2) return finiteFormulaValue({ value: value4.value, unit: unit3 });
|
|
3583
|
-
const edge = value4.value < low2 ? low2 : high2;
|
|
3584
|
-
if (nearest === void 0 || Math.abs(edge - value4.value) < Math.abs(nearest - value4.value))
|
|
3585
|
-
nearest = edge;
|
|
3586
|
-
}
|
|
3587
|
-
return finiteFormulaValue({ value: nearest ?? value4.value, unit: unit3 });
|
|
3588
|
-
}
|
|
3784
|
+
if (name3 === "BOUND") return evaluateBound(node3.args, arg);
|
|
3589
3785
|
if (name3 === "ATAN2") {
|
|
3590
3786
|
arity(2);
|
|
3591
3787
|
const y = arg(0), x = arg(1);
|
|
@@ -3735,14 +3931,18 @@ function parseVisioFormula(source, limits = {}) {
|
|
|
3735
3931
|
offset += identifier[0].length;
|
|
3736
3932
|
whitespace();
|
|
3737
3933
|
if (source[offset] === "(") {
|
|
3738
|
-
|
|
3934
|
+
const qualified = /^Sheet\.(\d+)!([A-Za-z_][A-Za-z_0-9]*)$/i.exec(identifier[0]);
|
|
3935
|
+
if (!qualified && !/^[A-Za-z_][A-Za-z_0-9]*$/.test(identifier[0]))
|
|
3739
3936
|
return formulaFailure("syntax", "Qualified function names are unsupported");
|
|
3740
3937
|
offset++;
|
|
3741
3938
|
const args = [];
|
|
3742
3939
|
whitespace();
|
|
3743
3940
|
if (source[offset] !== ")") {
|
|
3744
3941
|
for (; ; ) {
|
|
3745
|
-
|
|
3942
|
+
whitespace();
|
|
3943
|
+
args.push(
|
|
3944
|
+
/^[,)]/.test(source.slice(offset)) ? node3({ kind: "string", value: "" }) : expression(0, depth + 1)
|
|
3945
|
+
);
|
|
3746
3946
|
whitespace();
|
|
3747
3947
|
if (source[offset] !== ",") break;
|
|
3748
3948
|
offset++;
|
|
@@ -3750,7 +3950,27 @@ function parseVisioFormula(source, limits = {}) {
|
|
|
3750
3950
|
}
|
|
3751
3951
|
if (source[offset++] !== ")")
|
|
3752
3952
|
return formulaFailure("syntax", "Expected function closing parenthesis");
|
|
3753
|
-
left = node3({
|
|
3953
|
+
left = node3({
|
|
3954
|
+
kind: "call",
|
|
3955
|
+
name: (qualified ? qualified[2] : identifier[0]).toUpperCase(),
|
|
3956
|
+
args
|
|
3957
|
+
});
|
|
3958
|
+
if (qualified)
|
|
3959
|
+
left = node3({
|
|
3960
|
+
kind: "call",
|
|
3961
|
+
name: "_SHEETCALL",
|
|
3962
|
+
args: [node3({ kind: "string", value: qualified[1] }), left]
|
|
3963
|
+
});
|
|
3964
|
+
whitespace();
|
|
3965
|
+
const member2 = source[offset] === "!" && /^!([A-Za-z_][A-Za-z_0-9.]*)/.exec(source.slice(offset));
|
|
3966
|
+
if (member2) {
|
|
3967
|
+
offset += member2[0].length;
|
|
3968
|
+
left = node3({
|
|
3969
|
+
kind: "call",
|
|
3970
|
+
name: "_SHEETCELL",
|
|
3971
|
+
args: [left, node3({ kind: "string", value: member2[1] })]
|
|
3972
|
+
});
|
|
3973
|
+
}
|
|
3754
3974
|
} else {
|
|
3755
3975
|
const ref = /^Sheet\.(\d+)!(.+)$/i.exec(identifier[0]);
|
|
3756
3976
|
left = node3({
|
|
@@ -4921,20 +5141,36 @@ function indexCells(roots2, options2) {
|
|
|
4921
5141
|
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
|
|
4922
5142
|
// (Visio's freshly dropped connector names its own sheet).
|
|
4923
5143
|
!(/^(BegTrigger|EndTrigger)$/.test(cell) && isNativeGlueCell(cell, source))) {
|
|
5144
|
+
const lenient = options2.scope === "affected";
|
|
5145
|
+
const unprovable = (message, opaque) => {
|
|
5146
|
+
if (!lenient) fail("EDIT_UNKNOWN_DEPENDENCY", message);
|
|
5147
|
+
item2.unsafe = true;
|
|
5148
|
+
item2.refusal = message;
|
|
5149
|
+
if (opaque) item2.opaque = true;
|
|
5150
|
+
};
|
|
4924
5151
|
try {
|
|
4925
5152
|
item2.formula = parseVisioFormula(source);
|
|
4926
|
-
const plain4 = analyzeVisioFormula(item2.formula
|
|
5153
|
+
const plain4 = analyzeVisioFormula(item2.formula, {
|
|
5154
|
+
shapeTextReads: true,
|
|
5155
|
+
literalIndirect: true
|
|
5156
|
+
});
|
|
4927
5157
|
const analysis = plain4.dynamic && textSizeFormula(item2.formula) || plain4;
|
|
4928
|
-
if (analysis.dynamic)
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
5158
|
+
if (analysis.dynamic) {
|
|
5159
|
+
if (!lenient)
|
|
5160
|
+
fail(
|
|
5161
|
+
"EDIT_DYNAMIC_DEPENDENCY",
|
|
5162
|
+
"Dynamic ShapeSheet dependencies cannot be safely edited."
|
|
5163
|
+
);
|
|
5164
|
+
unprovable(
|
|
5165
|
+
`${cell} on shape ${sheet.shapeId || "page"} has dynamic ShapeSheet dependencies that cannot be followed.`,
|
|
5166
|
+
"opaque" in analysis && analysis.opaque
|
|
4932
5167
|
);
|
|
5168
|
+
}
|
|
4933
5169
|
item2.dependencies = analysis.references.filter((ref) => !isBooleanLiteral(ref)).map((ref) => key({ pageId: pageId2, shapeId: ref.shapeId ?? sheet.shapeId, cell: ref.cell }));
|
|
4934
5170
|
} catch (error) {
|
|
4935
|
-
|
|
4936
|
-
"
|
|
4937
|
-
|
|
5171
|
+
unprovable(
|
|
5172
|
+
`Cannot prove ShapeSheet dependency closure: ${error instanceof Error ? error.message : "invalid formula"}`,
|
|
5173
|
+
true
|
|
4938
5174
|
);
|
|
4939
5175
|
}
|
|
4940
5176
|
}
|
|
@@ -5017,13 +5253,20 @@ function createVisioCellEvaluator(cells4, options2 = {}, verifyCaches = false) {
|
|
|
5017
5253
|
if (!item2 || item2.unsafe && (!item2.node || !options2.masterMovePins?.has(item2.node) && !options2.groupRotationCells?.has(item2.node)))
|
|
5018
5254
|
fail(
|
|
5019
5255
|
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
5020
|
-
"Affected formula references missing, inherited or grouped cells."
|
|
5256
|
+
item2?.refusal ? `Affected formula cannot be evaluated: ${item2.refusal}` : "Affected formula references missing, inherited or grouped cells."
|
|
5021
5257
|
);
|
|
5022
5258
|
if (item2.node?.hasAttribute("E"))
|
|
5023
5259
|
fail("EDIT_FORMULA_ERROR", "Affected ShapeSheet cell has an error cache.");
|
|
5024
5260
|
active.add(id3);
|
|
5261
|
+
try {
|
|
5262
|
+
return evaluateCell(id3, item2);
|
|
5263
|
+
} finally {
|
|
5264
|
+
active.delete(id3);
|
|
5265
|
+
}
|
|
5266
|
+
};
|
|
5267
|
+
const evaluateCell = (id3, item2) => {
|
|
5025
5268
|
let result2;
|
|
5026
|
-
const analysis = item2.formula ? analyzeVisioFormula(item2.formula) : void 0;
|
|
5269
|
+
const analysis = item2.formula ? analyzeVisioFormula(item2.formula, { literalIndirect: true }) : void 0;
|
|
5027
5270
|
if (item2.formula && item2.node && analysis.unsupportedFunctions.length) {
|
|
5028
5271
|
if (!textSizeFormula(item2.formula))
|
|
5029
5272
|
fail("EDIT_UNSUPPORTED_FORMULA", "Affected formula uses unsupported functions.");
|
|
@@ -5039,6 +5282,9 @@ function createVisioCellEvaluator(cells4, options2 = {}, verifyCaches = false) {
|
|
|
5039
5282
|
),
|
|
5040
5283
|
{
|
|
5041
5284
|
...options2.pageContext?.get(item2.pageId),
|
|
5285
|
+
...options2.textOf ? {
|
|
5286
|
+
textOf: (ref) => options2.textOf(item2.pageId, ref.shapeId ?? item2.shapeId)
|
|
5287
|
+
} : {},
|
|
5042
5288
|
onStep: () => {
|
|
5043
5289
|
if (--steps < 0)
|
|
5044
5290
|
fail("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
|
|
@@ -5062,16 +5308,63 @@ function createVisioCellEvaluator(cells4, options2 = {}, verifyCaches = false) {
|
|
|
5062
5308
|
if (Math.abs(cachedValue2.value - result2.value) > 1e-10 * Math.max(1, Math.abs(result2.value)))
|
|
5063
5309
|
fail("EDIT_FORMULA_CACHE", "Source formula and numeric cache disagree.");
|
|
5064
5310
|
}
|
|
5065
|
-
active.delete(id3);
|
|
5066
5311
|
values.set(id3, result2);
|
|
5067
5312
|
return result2;
|
|
5068
5313
|
};
|
|
5069
5314
|
return evaluate;
|
|
5070
5315
|
}
|
|
5071
5316
|
|
|
5317
|
+
// visio/edit-recalculate-text.ts
|
|
5318
|
+
function plainShapeText(root2, shapeId2) {
|
|
5319
|
+
if (!root2) return void 0;
|
|
5320
|
+
const pending2 = children2(children2(root2, "Shapes")[0], "Shape");
|
|
5321
|
+
while (pending2.length) {
|
|
5322
|
+
const shape = pending2.pop();
|
|
5323
|
+
if (attribute2(shape, "ID") === shapeId2) {
|
|
5324
|
+
if (shape.hasAttribute("Master") || shape.hasAttribute("MasterShape")) return void 0;
|
|
5325
|
+
if (children2(shape, "Section").some((section3) => attribute2(section3, "N") === "Field"))
|
|
5326
|
+
return void 0;
|
|
5327
|
+
const texts = children2(shape, "Text");
|
|
5328
|
+
if (texts.length > 1) return void 0;
|
|
5329
|
+
const node3 = texts[0];
|
|
5330
|
+
if (!node3) return "";
|
|
5331
|
+
const plain4 = Array.from(node3.childNodes).every(
|
|
5332
|
+
(item2) => item2.nodeType === 3 || item2.nodeType === 4
|
|
5333
|
+
);
|
|
5334
|
+
return plain4 ? decodeVisioPlainText(node3.textContent ?? "") : void 0;
|
|
5335
|
+
}
|
|
5336
|
+
pending2.push(...children2(children2(shape, "Shapes")[0], "Shape"));
|
|
5337
|
+
}
|
|
5338
|
+
return void 0;
|
|
5339
|
+
}
|
|
5340
|
+
var TEXT_READERS = /* @__PURE__ */ new Set([...textNumberFunctions, ...textResultFunctions]);
|
|
5341
|
+
function textReadFormula(source) {
|
|
5342
|
+
try {
|
|
5343
|
+
const ast = parseVisioFormula(source);
|
|
5344
|
+
const analysis = analyzeVisioFormula(ast, { shapeTextReads: true });
|
|
5345
|
+
if (analysis.dynamic || analysis.unsupportedFunctions.length) return false;
|
|
5346
|
+
const textResult = ast.kind === "string" || isTheText(ast) || ast.kind === "binary" && ast.operator === "&" || ast.kind === "call" && textResultFunctions.has(ast.name);
|
|
5347
|
+
if (textResult) return false;
|
|
5348
|
+
let reads = 0;
|
|
5349
|
+
const walk = (node3, parent) => {
|
|
5350
|
+
if (isTheText(node3)) {
|
|
5351
|
+
reads++;
|
|
5352
|
+
return parent?.kind === "call" && TEXT_READERS.has(parent.name);
|
|
5353
|
+
}
|
|
5354
|
+
if (node3.kind === "unary") return walk(node3.operand, node3);
|
|
5355
|
+
if (node3.kind === "binary") return walk(node3.left, node3) && walk(node3.right, node3);
|
|
5356
|
+
if (node3.kind === "call") return node3.args.every((arg) => walk(arg, node3));
|
|
5357
|
+
return true;
|
|
5358
|
+
};
|
|
5359
|
+
return walk(ast) && reads > 0;
|
|
5360
|
+
} catch {
|
|
5361
|
+
return false;
|
|
5362
|
+
}
|
|
5363
|
+
}
|
|
5364
|
+
|
|
5072
5365
|
// visio/edit-recalculate.ts
|
|
5073
5366
|
function recalculateVisioCells(roots2, changed, options2 = {}) {
|
|
5074
|
-
const cells4 = indexCells(roots2, options2);
|
|
5367
|
+
const cells4 = indexCells(roots2, { scope: "affected", ...options2 });
|
|
5075
5368
|
const reverse = /* @__PURE__ */ new Map();
|
|
5076
5369
|
for (const [id3, item2] of cells4)
|
|
5077
5370
|
for (const dependency of item2.dependencies) {
|
|
@@ -5080,6 +5373,8 @@ function recalculateVisioCells(roots2, changed, options2 = {}) {
|
|
|
5080
5373
|
reverse.set(dependency, next);
|
|
5081
5374
|
}
|
|
5082
5375
|
const affected = new Set(changed.map(key));
|
|
5376
|
+
const editedPages = new Set(changed.map((cell) => cell.pageId));
|
|
5377
|
+
for (const [id3, item2] of cells4) if (item2.opaque && editedPages.has(item2.pageId)) affected.add(id3);
|
|
5083
5378
|
const pending2 = [...affected];
|
|
5084
5379
|
const maxAffected = bound(options2.maxAffectedCells, 1e4);
|
|
5085
5380
|
for (let i = 0; i < pending2.length; i++) {
|
|
@@ -5092,13 +5387,29 @@ function recalculateVisioCells(roots2, changed, options2 = {}) {
|
|
|
5092
5387
|
if (affected.size > maxAffected)
|
|
5093
5388
|
fail("LIMIT_FORMULA_AFFECTED", "Affected ShapeSheet cell limit exceeded.");
|
|
5094
5389
|
}
|
|
5095
|
-
const evaluate = createVisioCellEvaluator(cells4,
|
|
5390
|
+
const evaluate = createVisioCellEvaluator(cells4, {
|
|
5391
|
+
textOf: (pageId2, shapeId2) => plainShapeText(roots2.get(pageId2), shapeId2),
|
|
5392
|
+
...options2
|
|
5393
|
+
});
|
|
5096
5394
|
const values = /* @__PURE__ */ new Map();
|
|
5097
|
-
for (const id3 of affected)
|
|
5395
|
+
for (const id3 of affected) {
|
|
5396
|
+
if (!cells4.has(id3) && /,"thetext"]$/.test(id3)) continue;
|
|
5397
|
+
try {
|
|
5398
|
+
values.set(id3, evaluate(id3));
|
|
5399
|
+
} catch (error) {
|
|
5400
|
+
if (options2.cycles !== "keep" || !(error instanceof VisioPackageError) || error.code !== "EDIT_FORMULA_CYCLE")
|
|
5401
|
+
throw error;
|
|
5402
|
+
const cyclic = cells4.get(id3);
|
|
5403
|
+
options2.diagnostics?.push({
|
|
5404
|
+
code: "FORMULA_CYCLE",
|
|
5405
|
+
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.`
|
|
5406
|
+
});
|
|
5407
|
+
}
|
|
5408
|
+
}
|
|
5098
5409
|
const pages = /* @__PURE__ */ new Set();
|
|
5099
5410
|
for (const id3 of affected) {
|
|
5100
5411
|
const item2 = cells4.get(id3);
|
|
5101
|
-
if (item2
|
|
5412
|
+
if (item2?.node && item2.formula && values.has(id3)) {
|
|
5102
5413
|
const value3 = String(values.get(id3).value);
|
|
5103
5414
|
if (item2.node.getAttribute("V") !== value3) {
|
|
5104
5415
|
item2.node.setAttribute("V", value3);
|
|
@@ -5109,15 +5420,29 @@ function recalculateVisioCells(roots2, changed, options2 = {}) {
|
|
|
5109
5420
|
return [...pages];
|
|
5110
5421
|
}
|
|
5111
5422
|
function assertVisioShapesUnreferenced(roots2, removed, options2 = {}) {
|
|
5112
|
-
const cells4 = indexCells(roots2, options2);
|
|
5423
|
+
const cells4 = indexCells(roots2, { scope: "affected", ...options2 });
|
|
5424
|
+
const frozen = [];
|
|
5113
5425
|
for (const cell of cells4.values()) {
|
|
5114
5426
|
options2.check?.();
|
|
5427
|
+
if (cell.opaque && removed.has(cell.pageId) && !removed.get(cell.pageId).has(cell.shapeId))
|
|
5428
|
+
fail(
|
|
5429
|
+
"EDIT_REFERENCED_DELETE",
|
|
5430
|
+
`${cell.cell} on shape ${cell.shapeId || "page"} may read the removed shape through a dynamic dependency.`
|
|
5431
|
+
);
|
|
5115
5432
|
if (removed.get(cell.pageId)?.has(cell.shapeId)) continue;
|
|
5116
5433
|
if (cell.dependencies.some((id3) => {
|
|
5117
5434
|
const parts = JSON.parse(id3);
|
|
5118
5435
|
return removed.get(parts[0])?.has(parts[1]) ?? false;
|
|
5119
|
-
}))
|
|
5120
|
-
|
|
5436
|
+
})) {
|
|
5437
|
+
if (!options2.freeze || !cell.node || !cell.formula || cell.unsafe || cell.node.hasAttribute("E") || analyzeVisioFormula(cell.formula, { literalIndirect: true }).guarded || !Number.isFinite(
|
|
5438
|
+
visioFormulaCachedValue(
|
|
5439
|
+
cell.node.getAttribute("V") ?? "",
|
|
5440
|
+
cell.node.getAttribute("U") ?? void 0
|
|
5441
|
+
).value
|
|
5442
|
+
))
|
|
5443
|
+
fail("EDIT_REFERENCED_DELETE", "Shape is referenced by a ShapeSheet formula.");
|
|
5444
|
+
frozen.push(cell.node);
|
|
5445
|
+
}
|
|
5121
5446
|
}
|
|
5122
5447
|
for (const [pageId2, ids] of removed)
|
|
5123
5448
|
for (const connections2 of children2(roots2.get(pageId2), "Connects"))
|
|
@@ -5126,12 +5451,16 @@ function assertVisioShapesUnreferenced(roots2, removed, options2 = {}) {
|
|
|
5126
5451
|
if (["FromSheet", "ToSheet"].some((name3) => ids.has(attribute2(connection, name3) ?? "")))
|
|
5127
5452
|
fail("EDIT_REFERENCED_DELETE", "Shape participates in a Connect record.");
|
|
5128
5453
|
}
|
|
5454
|
+
return frozen;
|
|
5129
5455
|
}
|
|
5456
|
+
var freezeVisioCells = (nodes) => {
|
|
5457
|
+
for (const node3 of nodes) node3.removeAttribute("F");
|
|
5458
|
+
};
|
|
5130
5459
|
function assertVisioShapeUnreferenced(roots2, pageId2, shapeId2, options2 = {}) {
|
|
5131
|
-
assertVisioShapesUnreferenced(roots2, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]), options2);
|
|
5460
|
+
return assertVisioShapesUnreferenced(roots2, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]), options2);
|
|
5132
5461
|
}
|
|
5133
5462
|
function createVisioDependencyQuery(roots2, options2 = {}) {
|
|
5134
|
-
const cells4 = indexCells(roots2, options2);
|
|
5463
|
+
const cells4 = indexCells(roots2, { scope: "affected", ...options2 });
|
|
5135
5464
|
return (source, targets) => {
|
|
5136
5465
|
const wanted = new Set(targets.map(key));
|
|
5137
5466
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -5146,7 +5475,7 @@ function createVisioDependencyQuery(roots2, options2 = {}) {
|
|
|
5146
5475
|
if (seen.size > maxSteps) fail("LIMIT_FORMULA_STEPS", "Dependency analysis limit exceeded.");
|
|
5147
5476
|
const item2 = cells4.get(id3);
|
|
5148
5477
|
if (!item2 || item2.unsafe || item2.node?.hasAttribute("E")) return false;
|
|
5149
|
-
if (item2.formula && analyzeVisioFormula(item2.formula).unsupportedFunctions.length)
|
|
5478
|
+
if (item2.formula && analyzeVisioFormula(item2.formula, { literalIndirect: true }).unsupportedFunctions.length)
|
|
5150
5479
|
return false;
|
|
5151
5480
|
if (wanted.has(id3)) found = true;
|
|
5152
5481
|
else pending2.push(...item2.dependencies);
|
|
@@ -6186,7 +6515,7 @@ var VISIO_DEFAULT_TITLE = "Title";
|
|
|
6186
6515
|
var ACCENT = { background: "Background Accent", border: "Border Accent" };
|
|
6187
6516
|
function visioShade(color2, amount) {
|
|
6188
6517
|
const value3 = Number.parseInt(color2.slice(1), 16);
|
|
6189
|
-
const channel = (
|
|
6518
|
+
const channel = (shift3) => Math.round((value3 >> shift3 & 255) * (1 - amount)).toString(16).padStart(2, "0");
|
|
6190
6519
|
return `#${channel(16)}${channel(8)}${channel(0)}`.toUpperCase();
|
|
6191
6520
|
}
|
|
6192
6521
|
function visioDecorationName(name3) {
|
|
@@ -8316,9 +8645,16 @@ function visioWalkPath(begin, end) {
|
|
|
8316
8645
|
return horizontal3 ? [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];
|
|
8317
8646
|
};
|
|
8318
8647
|
let path3;
|
|
8319
|
-
if (gapX >= -EPSILON2 && inside2(from.y, b.minY, b.maxY))
|
|
8320
|
-
|
|
8321
|
-
|
|
8648
|
+
if (gapX >= -EPSILON2 && inside2(from.y, b.minY, b.maxY)) {
|
|
8649
|
+
const p = side(begin, sx, 0), q = side(end, -sx, 0);
|
|
8650
|
+
if (begin.shape?.floating && end.shape?.floating) {
|
|
8651
|
+
const y = (Math.max(a2.minY, b.minY) + Math.min(a2.maxY, b.maxY)) / 2;
|
|
8652
|
+
path3 = [
|
|
8653
|
+
{ x: p.x, y },
|
|
8654
|
+
{ x: q.x, y }
|
|
8655
|
+
];
|
|
8656
|
+
} else path3 = jog(p, q, true);
|
|
8657
|
+
} else if (gapY >= -EPSILON2 && inside2(from.x, b.minX, b.maxX))
|
|
8322
8658
|
path3 = jog(side(begin, 0, sy), side(end, 0, -sy), false);
|
|
8323
8659
|
else if (gapY < -EPSILON2 || gapY < CHANNEL && gapX >= CHANNEL) {
|
|
8324
8660
|
const p = side(begin, sx, 0);
|
|
@@ -15375,10 +15711,10 @@ async function* streamEntryGuarded(entry3, alreadyRead, limits) {
|
|
|
15375
15711
|
}
|
|
15376
15712
|
}
|
|
15377
15713
|
function toBase64(bytes) {
|
|
15378
|
-
let
|
|
15714
|
+
let binary = "";
|
|
15379
15715
|
for (let i = 0; i < bytes.length; i += 32768)
|
|
15380
|
-
|
|
15381
|
-
return btoa(
|
|
15716
|
+
binary += String.fromCharCode(...bytes.subarray(i, i + 32768));
|
|
15717
|
+
return btoa(binary);
|
|
15382
15718
|
}
|
|
15383
15719
|
function guardZip(zip, limits = {}) {
|
|
15384
15720
|
const r = resolveLimits(limits);
|
|
@@ -17822,6 +18158,332 @@ function parseStyles(xml, warnings) {
|
|
|
17822
18158
|
return result2;
|
|
17823
18159
|
}
|
|
17824
18160
|
|
|
18161
|
+
// xlsx/read/print-options.ts
|
|
18162
|
+
var KEYS = ["gridLines", "headings", "horizontalCentered", "verticalCentered"];
|
|
18163
|
+
function readPrintOptions(node3) {
|
|
18164
|
+
if (!node3) return void 0;
|
|
18165
|
+
const out = {};
|
|
18166
|
+
for (const key2 of KEYS) if (boolAttr(node3, key2)) out[key2] = true;
|
|
18167
|
+
return Object.keys(out).length ? out : void 0;
|
|
18168
|
+
}
|
|
18169
|
+
|
|
18170
|
+
// xlsx/read/password-hash.ts
|
|
18171
|
+
function modernHashAttributeNames(prefix2 = "") {
|
|
18172
|
+
const name3 = (base2) => prefix2 ? `${prefix2}${base2[0].toUpperCase()}${base2.slice(1)}` : base2;
|
|
18173
|
+
return {
|
|
18174
|
+
algorithmName: name3("algorithmName"),
|
|
18175
|
+
hashValue: name3("hashValue"),
|
|
18176
|
+
saltValue: name3("saltValue"),
|
|
18177
|
+
spinCount: name3("spinCount")
|
|
18178
|
+
};
|
|
18179
|
+
}
|
|
18180
|
+
function readModernHash(node3, prefix2 = "") {
|
|
18181
|
+
const names = modernHashAttributeNames(prefix2);
|
|
18182
|
+
const algorithmName = att(node3, names.algorithmName);
|
|
18183
|
+
const hashValue = att(node3, names.hashValue);
|
|
18184
|
+
const saltValue = att(node3, names.saltValue);
|
|
18185
|
+
if (!algorithmName || !hashValue || !saltValue) return void 0;
|
|
18186
|
+
const hash = { algorithmName, hashValue, saltValue };
|
|
18187
|
+
const spin = att(node3, names.spinCount);
|
|
18188
|
+
const spinCount = spin === void 0 || spin.trim() === "" ? Number.NaN : Number(spin);
|
|
18189
|
+
if (Number.isFinite(spinCount)) hash.spinCount = spinCount;
|
|
18190
|
+
return hash;
|
|
18191
|
+
}
|
|
18192
|
+
|
|
18193
|
+
// xlsx/read/sheet-props.ts
|
|
18194
|
+
var defaultSheetView = () => ({
|
|
18195
|
+
showGridLines: true,
|
|
18196
|
+
showHeaders: true,
|
|
18197
|
+
showZeros: true,
|
|
18198
|
+
rightToLeft: false,
|
|
18199
|
+
zoom: 100
|
|
18200
|
+
});
|
|
18201
|
+
function parseSqref(sqref) {
|
|
18202
|
+
if (!sqref) return [];
|
|
18203
|
+
return sqref.split(/\s+/).filter(Boolean).map((part) => parseRange(part)).filter((range2) => range2 !== void 0);
|
|
18204
|
+
}
|
|
18205
|
+
var readTabColor = (sheetPr, palette) => parseColor(xFirst(sheetPr, "tabColor"), palette);
|
|
18206
|
+
var readFitToPage = (sheetPr) => boolAttr(xFirst(sheetPr, "pageSetUpPr"), "fitToPage") ?? false;
|
|
18207
|
+
function readSheetView(sheetViews) {
|
|
18208
|
+
const view = defaultSheetView();
|
|
18209
|
+
const node3 = xFirst(sheetViews, "sheetView");
|
|
18210
|
+
if (!node3) return view;
|
|
18211
|
+
view.showGridLines = boolAttr(node3, "showGridLines", true);
|
|
18212
|
+
view.showHeaders = boolAttr(node3, "showRowColHeaders", true);
|
|
18213
|
+
view.showZeros = boolAttr(node3, "showZeros", true);
|
|
18214
|
+
view.rightToLeft = boolAttr(node3, "rightToLeft", false);
|
|
18215
|
+
view.zoom = numAttr(node3, "zoomScale") || 100;
|
|
18216
|
+
if (boolAttr(node3, "showFormulas")) view.showFormulas = true;
|
|
18217
|
+
const mode = att(node3, "view");
|
|
18218
|
+
if (mode === "pageLayout" || mode === "pageBreakPreview") view.mode = mode;
|
|
18219
|
+
const pane = xFirst(node3, "pane");
|
|
18220
|
+
const state = att(pane, "state");
|
|
18221
|
+
const frozen = pane && (state === "frozen" || state === "frozenSplit");
|
|
18222
|
+
if (frozen) {
|
|
18223
|
+
const rows = Math.max(0, Math.round(numAttr(pane, "ySplit") ?? 0));
|
|
18224
|
+
const cols = Math.max(0, Math.round(numAttr(pane, "xSplit") ?? 0));
|
|
18225
|
+
if (rows || cols) view.freeze = { rows, cols };
|
|
18226
|
+
}
|
|
18227
|
+
const topLeft = parseAddress(
|
|
18228
|
+
(frozen ? att(pane, "topLeftCell") : att(node3, "topLeftCell")) ?? ""
|
|
18229
|
+
);
|
|
18230
|
+
if (topLeft) view.topLeft = topLeft;
|
|
18231
|
+
const selections = xChildren(node3, "selection");
|
|
18232
|
+
const activePane = att(pane, "activePane") ?? "topLeft";
|
|
18233
|
+
const selection = selections.find((sel) => (att(sel, "pane") ?? "topLeft") === activePane) ?? selections[0];
|
|
18234
|
+
if (selection) {
|
|
18235
|
+
const ranges = parseSqref(att(selection, "sqref") ?? att(selection, "activeCell") ?? "A1");
|
|
18236
|
+
const active = parseAddress(att(selection, "activeCell") ?? "") ?? ranges[0]?.start ?? { row: 0, col: 0 };
|
|
18237
|
+
view.selection = {
|
|
18238
|
+
active,
|
|
18239
|
+
ranges: ranges.length ? ranges : [{ start: active, end: { ...active } }]
|
|
18240
|
+
};
|
|
18241
|
+
}
|
|
18242
|
+
return view;
|
|
18243
|
+
}
|
|
18244
|
+
var FORMAT_FLAGS = ["zeroHeight", "customHeight", "thickTop", "thickBottom"];
|
|
18245
|
+
function readSheetFormat(format5) {
|
|
18246
|
+
const result2 = {
|
|
18247
|
+
defaultRowHeight: numAttr(format5, "defaultRowHeight") ?? 15
|
|
18248
|
+
};
|
|
18249
|
+
const width = numAttr(format5, "defaultColWidth");
|
|
18250
|
+
if (width !== void 0) result2.defaultColWidth = width;
|
|
18251
|
+
const flags = {};
|
|
18252
|
+
for (const key2 of FORMAT_FLAGS) {
|
|
18253
|
+
const value3 = boolAttr(format5, key2);
|
|
18254
|
+
if (value3 !== void 0) flags[key2] = value3;
|
|
18255
|
+
}
|
|
18256
|
+
const base2 = numAttr(format5, "baseColWidth");
|
|
18257
|
+
if (base2 !== void 0) flags.baseColWidth = base2;
|
|
18258
|
+
if (Object.keys(flags).length) result2.format = flags;
|
|
18259
|
+
return result2;
|
|
18260
|
+
}
|
|
18261
|
+
function readColumns(cols, xfMap) {
|
|
18262
|
+
const out = [];
|
|
18263
|
+
for (const col of cols ? xChildren(cols, "col") : []) {
|
|
18264
|
+
const min = (numAttr(col, "min") ?? 1) - 1;
|
|
18265
|
+
const max = (numAttr(col, "max") ?? min + 1) - 1;
|
|
18266
|
+
const info = { min, max };
|
|
18267
|
+
const width = numAttr(col, "width");
|
|
18268
|
+
if (width !== void 0) info.width = width;
|
|
18269
|
+
if (boolAttr(col, "customWidth")) info.customWidth = true;
|
|
18270
|
+
if (boolAttr(col, "hidden")) info.hidden = true;
|
|
18271
|
+
const style2 = numAttr(col, "style");
|
|
18272
|
+
const styleId = style2 === void 0 ? 0 : xfMap[style2] ?? 0;
|
|
18273
|
+
if (styleId) info.styleId = styleId;
|
|
18274
|
+
const outline = numAttr(col, "outlineLevel");
|
|
18275
|
+
if (outline) info.outlineLevel = outline;
|
|
18276
|
+
if (boolAttr(col, "collapsed")) info.collapsed = true;
|
|
18277
|
+
if (boolAttr(col, "bestFit")) info.bestFit = true;
|
|
18278
|
+
out.push(info);
|
|
18279
|
+
}
|
|
18280
|
+
return out;
|
|
18281
|
+
}
|
|
18282
|
+
var MAIN_NS_DECL = /(?<=^<[^>]*) xmlns="http:\/\/schemas\.openxmlformats\.org\/spreadsheetml\/2006\/main"/;
|
|
18283
|
+
function readAutoFilter(node3) {
|
|
18284
|
+
const range2 = parseRange(att(node3, "ref") ?? "");
|
|
18285
|
+
if (!node3 || !range2) return void 0;
|
|
18286
|
+
const filter = { range: range2 };
|
|
18287
|
+
const columns = [];
|
|
18288
|
+
for (const column of xChildren(node3, "filterColumn")) {
|
|
18289
|
+
const entry3 = {
|
|
18290
|
+
offset: numAttr(column, "colId") ?? 0
|
|
18291
|
+
};
|
|
18292
|
+
const filters = xFirst(column, "filters");
|
|
18293
|
+
if (filters) {
|
|
18294
|
+
entry3.values = xChildren(filters, "filter").map((f) => att(f, "val") ?? "");
|
|
18295
|
+
if (boolAttr(filters, "blank")) entry3.blank = true;
|
|
18296
|
+
}
|
|
18297
|
+
entry3.sourceXml = outerXml(column).replace(MAIN_NS_DECL, "");
|
|
18298
|
+
columns.push(entry3);
|
|
18299
|
+
}
|
|
18300
|
+
if (columns.length) filter.columns = columns;
|
|
18301
|
+
return filter;
|
|
18302
|
+
}
|
|
18303
|
+
var HEADER_FOOTER_TEXT = {
|
|
18304
|
+
header: "oddHeader",
|
|
18305
|
+
footer: "oddFooter",
|
|
18306
|
+
evenHeader: "evenHeader",
|
|
18307
|
+
evenFooter: "evenFooter",
|
|
18308
|
+
firstHeader: "firstHeader",
|
|
18309
|
+
firstFooter: "firstFooter"
|
|
18310
|
+
};
|
|
18311
|
+
var HEADER_FOOTER_FLAGS = [
|
|
18312
|
+
"differentOddEven",
|
|
18313
|
+
"differentFirst",
|
|
18314
|
+
"scaleWithDoc",
|
|
18315
|
+
"alignWithMargins"
|
|
18316
|
+
];
|
|
18317
|
+
function readHeaderFooter(node3) {
|
|
18318
|
+
const out = {};
|
|
18319
|
+
for (const key2 of HEADER_FOOTER_FLAGS) {
|
|
18320
|
+
const value3 = boolAttr(node3, key2);
|
|
18321
|
+
if (value3 !== void 0) out[key2] = value3;
|
|
18322
|
+
}
|
|
18323
|
+
for (const [key2, local] of Object.entries(HEADER_FOOTER_TEXT)) {
|
|
18324
|
+
const child3 = xFirst(node3, local);
|
|
18325
|
+
if (child3) out[key2] = xText(child3);
|
|
18326
|
+
}
|
|
18327
|
+
return out;
|
|
18328
|
+
}
|
|
18329
|
+
var ORIENTATIONS = /* @__PURE__ */ new Set(["portrait", "landscape"]);
|
|
18330
|
+
function readPageSetup(margins, setup, headerFooter, fitToPage) {
|
|
18331
|
+
const page = {};
|
|
18332
|
+
if (setup) {
|
|
18333
|
+
if (/^(1|true)$/.test(att(setup, "useFirstPageNumber") ?? "")) {
|
|
18334
|
+
page.firstPageNumber = numAttr(setup, "firstPageNumber") ?? 1;
|
|
18335
|
+
}
|
|
18336
|
+
const order = att(setup, "pageOrder");
|
|
18337
|
+
if (order === "downThenOver" || order === "overThenDown") page.pageOrder = order;
|
|
18338
|
+
const orientation = att(setup, "orientation");
|
|
18339
|
+
if (orientation && ORIENTATIONS.has(orientation))
|
|
18340
|
+
page.orientation = orientation;
|
|
18341
|
+
const paper = numAttr(setup, "paperSize");
|
|
18342
|
+
if (paper !== void 0) page.paperSize = paper;
|
|
18343
|
+
const scale = numAttr(setup, "scale");
|
|
18344
|
+
if (scale !== void 0) page.scale = scale;
|
|
18345
|
+
}
|
|
18346
|
+
if (fitToPage) {
|
|
18347
|
+
page.fitToWidth = numAttr(setup, "fitToWidth") ?? 1;
|
|
18348
|
+
page.fitToHeight = numAttr(setup, "fitToHeight") ?? 1;
|
|
18349
|
+
}
|
|
18350
|
+
if (margins) {
|
|
18351
|
+
const m = (name3, fallback) => numAttr(margins, name3) ?? fallback;
|
|
18352
|
+
page.margins = {
|
|
18353
|
+
left: m("left", 0.7),
|
|
18354
|
+
right: m("right", 0.7),
|
|
18355
|
+
top: m("top", 0.75),
|
|
18356
|
+
bottom: m("bottom", 0.75),
|
|
18357
|
+
header: m("header", 0.3),
|
|
18358
|
+
footer: m("footer", 0.3)
|
|
18359
|
+
};
|
|
18360
|
+
}
|
|
18361
|
+
if (headerFooter) Object.assign(page, readHeaderFooter(headerFooter));
|
|
18362
|
+
return Object.keys(page).length ? page : void 0;
|
|
18363
|
+
}
|
|
18364
|
+
var PROTECTION_META = /* @__PURE__ */ new Set([
|
|
18365
|
+
"sheet",
|
|
18366
|
+
"password",
|
|
18367
|
+
"algorithmName",
|
|
18368
|
+
"hashValue",
|
|
18369
|
+
"saltValue",
|
|
18370
|
+
"spinCount"
|
|
18371
|
+
]);
|
|
18372
|
+
function readProtection(node3) {
|
|
18373
|
+
if (!node3) return void 0;
|
|
18374
|
+
const protection2 = { sheet: boolAttr(node3, "sheet", false) };
|
|
18375
|
+
const password = att(node3, "password");
|
|
18376
|
+
if (password) protection2.passwordHash = password;
|
|
18377
|
+
const modernHash = readModernHash(node3);
|
|
18378
|
+
if (modernHash) protection2.modernHash = modernHash;
|
|
18379
|
+
const allow = [];
|
|
18380
|
+
for (const attribute4 of Array.from(node3.attributes)) {
|
|
18381
|
+
if (PROTECTION_META.has(attribute4.name)) continue;
|
|
18382
|
+
if (attribute4.value === "0" || attribute4.value === "false") allow.push(attribute4.name);
|
|
18383
|
+
}
|
|
18384
|
+
if (allow.length) protection2.allow = allow.sort();
|
|
18385
|
+
return protection2;
|
|
18386
|
+
}
|
|
18387
|
+
|
|
18388
|
+
// xlsx/read/custom-views.ts
|
|
18389
|
+
var SHEET_VIEW_ATTRS = [
|
|
18390
|
+
"guid",
|
|
18391
|
+
"scale",
|
|
18392
|
+
"showGridLines",
|
|
18393
|
+
"showRowCol",
|
|
18394
|
+
"zeroValues",
|
|
18395
|
+
"topLeftCell",
|
|
18396
|
+
"view",
|
|
18397
|
+
"showFormulas",
|
|
18398
|
+
"hiddenRows",
|
|
18399
|
+
"hiddenColumns",
|
|
18400
|
+
"filter",
|
|
18401
|
+
"showAutoFilter",
|
|
18402
|
+
"fitToPage"
|
|
18403
|
+
];
|
|
18404
|
+
var WORKBOOK_VIEW_KNOWN = ["name", "guid", "includePrintSettings", "includeHiddenRowCol"];
|
|
18405
|
+
function readCustomWorkbookViews(node3) {
|
|
18406
|
+
return xChildren(node3, "customWorkbookView").flatMap((view) => {
|
|
18407
|
+
const guid2 = att(view, "guid");
|
|
18408
|
+
if (!guid2) return [];
|
|
18409
|
+
const attrs = {};
|
|
18410
|
+
for (const attribute4 of Array.from(view.attributes))
|
|
18411
|
+
if (!WORKBOOK_VIEW_KNOWN.includes(attribute4.name) && !attribute4.name.startsWith("xmlns"))
|
|
18412
|
+
attrs[attribute4.name] = attribute4.value;
|
|
18413
|
+
return [
|
|
18414
|
+
{
|
|
18415
|
+
guid: guid2,
|
|
18416
|
+
name: att(view, "name") ?? "",
|
|
18417
|
+
includePrintSettings: boolAttr(view, "includePrintSettings", true),
|
|
18418
|
+
includeHiddenRowCol: boolAttr(view, "includeHiddenRowCol", true),
|
|
18419
|
+
attrs
|
|
18420
|
+
}
|
|
18421
|
+
];
|
|
18422
|
+
});
|
|
18423
|
+
}
|
|
18424
|
+
var escape3 = (value3) => value3.replace(/&/g, "&").replace(/"/g, """);
|
|
18425
|
+
function asSheetViews(view) {
|
|
18426
|
+
const map = [
|
|
18427
|
+
["scale", "zoomScale"],
|
|
18428
|
+
["showGridLines", "showGridLines"],
|
|
18429
|
+
["showRowCol", "showRowColHeaders"],
|
|
18430
|
+
["zeroValues", "showZeros"],
|
|
18431
|
+
["topLeftCell", "topLeftCell"],
|
|
18432
|
+
["view", "view"],
|
|
18433
|
+
["showFormulas", "showFormulas"]
|
|
18434
|
+
];
|
|
18435
|
+
const attributes = map.flatMap(([from, to]) => {
|
|
18436
|
+
const value3 = att(view, from);
|
|
18437
|
+
return value3 === void 0 ? [] : [` ${to}="${escape3(value3)}"`];
|
|
18438
|
+
}).join("");
|
|
18439
|
+
const children3 = elements(view).filter((child3) => child3.localName === "pane" || child3.localName === "selection").map((child3) => outerXml(child3)).join("");
|
|
18440
|
+
return parseXml(
|
|
18441
|
+
`<sheetViews xmlns="${NS.x}"><sheetView${attributes}>${children3}</sheetView></sheetViews>`
|
|
18442
|
+
).documentElement;
|
|
18443
|
+
}
|
|
18444
|
+
function readCustomSheetViews(node3) {
|
|
18445
|
+
return xChildren(node3, "customSheetView").flatMap((view) => {
|
|
18446
|
+
const guid2 = att(view, "guid");
|
|
18447
|
+
if (!guid2) return [];
|
|
18448
|
+
const child3 = (name3) => xChildren(view, name3)[0];
|
|
18449
|
+
const pageSetup = readPageSetup(
|
|
18450
|
+
child3("pageMargins"),
|
|
18451
|
+
child3("pageSetup"),
|
|
18452
|
+
child3("headerFooter"),
|
|
18453
|
+
boolAttr(view, "fitToPage", false)
|
|
18454
|
+
);
|
|
18455
|
+
const printOptions = readPrintOptions(child3("printOptions"));
|
|
18456
|
+
const filter = readAutoFilter(child3("autoFilter"));
|
|
18457
|
+
const attrs = {};
|
|
18458
|
+
for (const attribute4 of Array.from(view.attributes))
|
|
18459
|
+
if (!SHEET_VIEW_ATTRS.includes(attribute4.name) && !attribute4.name.startsWith("xmlns"))
|
|
18460
|
+
attrs[attribute4.name] = attribute4.value;
|
|
18461
|
+
const modelled = [
|
|
18462
|
+
"pane",
|
|
18463
|
+
"selection",
|
|
18464
|
+
"pageMargins",
|
|
18465
|
+
"printOptions",
|
|
18466
|
+
"pageSetup",
|
|
18467
|
+
"headerFooter",
|
|
18468
|
+
"autoFilter"
|
|
18469
|
+
];
|
|
18470
|
+
return [
|
|
18471
|
+
{
|
|
18472
|
+
guid: guid2,
|
|
18473
|
+
view: readSheetView(asSheetViews(view)),
|
|
18474
|
+
...boolAttr(view, "hiddenRows", false) ? { hiddenRows: true } : {},
|
|
18475
|
+
...boolAttr(view, "hiddenColumns", false) ? { hiddenColumns: true } : {},
|
|
18476
|
+
...filter ? { filter } : {},
|
|
18477
|
+
...boolAttr(view, "showAutoFilter", false) ? { showAutoFilter: true } : {},
|
|
18478
|
+
...pageSetup ? { pageSetup } : {},
|
|
18479
|
+
...printOptions ? { printOptions } : {},
|
|
18480
|
+
attrs,
|
|
18481
|
+
extra: elements(view).filter((c2) => !modelled.includes(c2.localName ?? "")).map((c2) => outerXml(c2))
|
|
18482
|
+
}
|
|
18483
|
+
];
|
|
18484
|
+
});
|
|
18485
|
+
}
|
|
18486
|
+
|
|
17825
18487
|
// xlsx/read/formula-storage.ts
|
|
17826
18488
|
function tokens(formula2) {
|
|
17827
18489
|
try {
|
|
@@ -17919,30 +18581,20 @@ function stripFuturePrefixes(formula2) {
|
|
|
17919
18581
|
return fromStoredSyntax(plain4);
|
|
17920
18582
|
}
|
|
17921
18583
|
|
|
17922
|
-
// xlsx/read/password-hash.ts
|
|
17923
|
-
function modernHashAttributeNames(prefix2 = "") {
|
|
17924
|
-
const name3 = (base2) => prefix2 ? `${prefix2}${base2[0].toUpperCase()}${base2.slice(1)}` : base2;
|
|
17925
|
-
return {
|
|
17926
|
-
algorithmName: name3("algorithmName"),
|
|
17927
|
-
hashValue: name3("hashValue"),
|
|
17928
|
-
saltValue: name3("saltValue"),
|
|
17929
|
-
spinCount: name3("spinCount")
|
|
17930
|
-
};
|
|
17931
|
-
}
|
|
17932
|
-
function readModernHash(node3, prefix2 = "") {
|
|
17933
|
-
const names = modernHashAttributeNames(prefix2);
|
|
17934
|
-
const algorithmName = att(node3, names.algorithmName);
|
|
17935
|
-
const hashValue = att(node3, names.hashValue);
|
|
17936
|
-
const saltValue = att(node3, names.saltValue);
|
|
17937
|
-
if (!algorithmName || !hashValue || !saltValue) return void 0;
|
|
17938
|
-
const hash = { algorithmName, hashValue, saltValue };
|
|
17939
|
-
const spin = att(node3, names.spinCount);
|
|
17940
|
-
const spinCount = spin === void 0 || spin.trim() === "" ? Number.NaN : Number(spin);
|
|
17941
|
-
if (Number.isFinite(spinCount)) hash.spinCount = spinCount;
|
|
17942
|
-
return hash;
|
|
17943
|
-
}
|
|
17944
|
-
|
|
17945
18584
|
// xlsx/read/workbook-part.ts
|
|
18585
|
+
var NAME_EXTRA_ATTRIBUTES = [
|
|
18586
|
+
"function",
|
|
18587
|
+
"vbProcedure",
|
|
18588
|
+
"xlm",
|
|
18589
|
+
"customMenu",
|
|
18590
|
+
"description",
|
|
18591
|
+
"help",
|
|
18592
|
+
"statusBar",
|
|
18593
|
+
"shortcutKey",
|
|
18594
|
+
"functionGroupId",
|
|
18595
|
+
"publishToServer",
|
|
18596
|
+
"workbookParameter"
|
|
18597
|
+
];
|
|
17946
18598
|
function parseWorkbookPart(xml) {
|
|
17947
18599
|
const root2 = parseXml(xml, { label: "XLSX workbook" }).documentElement;
|
|
17948
18600
|
const sheets = [];
|
|
@@ -17966,6 +18618,12 @@ function parseWorkbookPart(xml) {
|
|
|
17966
18618
|
if (boolAttr(node3, "hidden")) name3.hidden = true;
|
|
17967
18619
|
const comment = att(node3, "comment");
|
|
17968
18620
|
if (comment) name3.comment = comment;
|
|
18621
|
+
const extra = {};
|
|
18622
|
+
for (const key2 of NAME_EXTRA_ATTRIBUTES) {
|
|
18623
|
+
const value3 = att(node3, key2);
|
|
18624
|
+
if (value3 !== void 0) extra[key2] = value3;
|
|
18625
|
+
}
|
|
18626
|
+
if (Object.keys(extra).length) name3.extra = extra;
|
|
17969
18627
|
if (name3.name) definedNames.push(name3);
|
|
17970
18628
|
}
|
|
17971
18629
|
const view = xFirst(xFirst(root2, "bookViews"), "workbookView");
|
|
@@ -17979,7 +18637,9 @@ function parseWorkbookPart(xml) {
|
|
|
17979
18637
|
delta: numAttr(calcPr, "iterateDelta") ?? 1e-3
|
|
17980
18638
|
} : void 0;
|
|
17981
18639
|
const oleSize = att(xFirst(root2, "oleSize"), "ref");
|
|
18640
|
+
const customViews = xFirst(root2, "customWorkbookViews");
|
|
17982
18641
|
return {
|
|
18642
|
+
...customViews ? { customViews: readCustomWorkbookViews(customViews) } : {},
|
|
17983
18643
|
...oleSize ? { oleSize } : {},
|
|
17984
18644
|
...iterate ? { iterate } : {},
|
|
17985
18645
|
...password ? { workbookPasswordHash: password } : {},
|
|
@@ -18013,9 +18673,9 @@ function parseFormula(fmla) {
|
|
|
18013
18673
|
return { op, args };
|
|
18014
18674
|
}
|
|
18015
18675
|
function resolveOperand(token, variables) {
|
|
18016
|
-
const
|
|
18017
|
-
if (Number.isFinite(
|
|
18018
|
-
return
|
|
18676
|
+
const num2 = Number(token);
|
|
18677
|
+
if (Number.isFinite(num2)) {
|
|
18678
|
+
return num2;
|
|
18019
18679
|
}
|
|
18020
18680
|
const value3 = variables.get(token);
|
|
18021
18681
|
if (value3 !== void 0) {
|
|
@@ -19688,18 +20348,18 @@ function groupTransform(group2, parent) {
|
|
|
19688
20348
|
const ext = first(xfrm, "ext", NS.a);
|
|
19689
20349
|
const chOff = first(xfrm, "chOff", NS.a);
|
|
19690
20350
|
const chExt = first(xfrm, "chExt", NS.a);
|
|
19691
|
-
const
|
|
19692
|
-
const cx =
|
|
19693
|
-
const cy =
|
|
19694
|
-
const chCx =
|
|
19695
|
-
const chCy =
|
|
20351
|
+
const num2 = (element2, name3) => Number.parseInt(element2?.getAttribute(name3) ?? "", 10);
|
|
20352
|
+
const cx = num2(ext, "cx");
|
|
20353
|
+
const cy = num2(ext, "cy");
|
|
20354
|
+
const chCx = num2(chExt, "cx");
|
|
20355
|
+
const chCy = num2(chExt, "cy");
|
|
19696
20356
|
if (!off || ![cx, cy, chCx, chCy].every(Number.isFinite) || chCx === 0 || chCy === 0)
|
|
19697
20357
|
return parent;
|
|
19698
20358
|
const scaleX = cx / chCx;
|
|
19699
20359
|
const scaleY = cy / chCy;
|
|
19700
20360
|
const local = {
|
|
19701
|
-
offsetX:
|
|
19702
|
-
offsetY:
|
|
20361
|
+
offsetX: num2(off, "x") - (num2(chOff, "x") || 0) * scaleX,
|
|
20362
|
+
offsetY: num2(off, "y") - (num2(chOff, "y") || 0) * scaleY,
|
|
19703
20363
|
scaleX,
|
|
19704
20364
|
scaleY
|
|
19705
20365
|
};
|
|
@@ -20007,200 +20667,48 @@ async function resolveSmartArt(sheets, source, warn) {
|
|
|
20007
20667
|
}
|
|
20008
20668
|
}
|
|
20009
20669
|
|
|
20010
|
-
// xlsx/read/
|
|
20011
|
-
var
|
|
20012
|
-
|
|
20013
|
-
|
|
20014
|
-
|
|
20015
|
-
|
|
20016
|
-
|
|
20017
|
-
|
|
20018
|
-
|
|
20019
|
-
|
|
20020
|
-
|
|
20021
|
-
|
|
20022
|
-
|
|
20023
|
-
|
|
20024
|
-
|
|
20025
|
-
|
|
20026
|
-
|
|
20027
|
-
|
|
20028
|
-
|
|
20029
|
-
|
|
20030
|
-
|
|
20031
|
-
|
|
20032
|
-
|
|
20033
|
-
|
|
20034
|
-
|
|
20035
|
-
|
|
20036
|
-
|
|
20037
|
-
|
|
20038
|
-
|
|
20039
|
-
|
|
20040
|
-
|
|
20041
|
-
|
|
20042
|
-
|
|
20043
|
-
|
|
20044
|
-
|
|
20045
|
-
|
|
20046
|
-
|
|
20047
|
-
|
|
20048
|
-
|
|
20049
|
-
|
|
20050
|
-
|
|
20051
|
-
if (selection) {
|
|
20052
|
-
const ranges = parseSqref(att(selection, "sqref") ?? att(selection, "activeCell") ?? "A1");
|
|
20053
|
-
const active = parseAddress(att(selection, "activeCell") ?? "") ?? ranges[0]?.start ?? { row: 0, col: 0 };
|
|
20054
|
-
view.selection = {
|
|
20055
|
-
active,
|
|
20056
|
-
ranges: ranges.length ? ranges : [{ start: active, end: { ...active } }]
|
|
20057
|
-
};
|
|
20058
|
-
}
|
|
20059
|
-
return view;
|
|
20060
|
-
}
|
|
20061
|
-
var FORMAT_FLAGS = ["zeroHeight", "customHeight", "thickTop", "thickBottom"];
|
|
20062
|
-
function readSheetFormat(format5) {
|
|
20063
|
-
const result2 = {
|
|
20064
|
-
defaultRowHeight: numAttr(format5, "defaultRowHeight") ?? 15
|
|
20065
|
-
};
|
|
20066
|
-
const width = numAttr(format5, "defaultColWidth");
|
|
20067
|
-
if (width !== void 0) result2.defaultColWidth = width;
|
|
20068
|
-
const flags = {};
|
|
20069
|
-
for (const key2 of FORMAT_FLAGS) {
|
|
20070
|
-
const value3 = boolAttr(format5, key2);
|
|
20071
|
-
if (value3 !== void 0) flags[key2] = value3;
|
|
20072
|
-
}
|
|
20073
|
-
const base2 = numAttr(format5, "baseColWidth");
|
|
20074
|
-
if (base2 !== void 0) flags.baseColWidth = base2;
|
|
20075
|
-
if (Object.keys(flags).length) result2.format = flags;
|
|
20076
|
-
return result2;
|
|
20077
|
-
}
|
|
20078
|
-
function readColumns(cols, xfMap) {
|
|
20079
|
-
const out = [];
|
|
20080
|
-
for (const col of cols ? xChildren(cols, "col") : []) {
|
|
20081
|
-
const min = (numAttr(col, "min") ?? 1) - 1;
|
|
20082
|
-
const max = (numAttr(col, "max") ?? min + 1) - 1;
|
|
20083
|
-
const info = { min, max };
|
|
20084
|
-
const width = numAttr(col, "width");
|
|
20085
|
-
if (width !== void 0) info.width = width;
|
|
20086
|
-
if (boolAttr(col, "customWidth")) info.customWidth = true;
|
|
20087
|
-
if (boolAttr(col, "hidden")) info.hidden = true;
|
|
20088
|
-
const style2 = numAttr(col, "style");
|
|
20089
|
-
const styleId = style2 === void 0 ? 0 : xfMap[style2] ?? 0;
|
|
20090
|
-
if (styleId) info.styleId = styleId;
|
|
20091
|
-
const outline = numAttr(col, "outlineLevel");
|
|
20092
|
-
if (outline) info.outlineLevel = outline;
|
|
20093
|
-
if (boolAttr(col, "collapsed")) info.collapsed = true;
|
|
20094
|
-
if (boolAttr(col, "bestFit")) info.bestFit = true;
|
|
20095
|
-
out.push(info);
|
|
20096
|
-
}
|
|
20097
|
-
return out;
|
|
20098
|
-
}
|
|
20099
|
-
var MAIN_NS_DECL = /(?<=^<[^>]*) xmlns="http:\/\/schemas\.openxmlformats\.org\/spreadsheetml\/2006\/main"/;
|
|
20100
|
-
function readAutoFilter(node3) {
|
|
20101
|
-
const range2 = parseRange(att(node3, "ref") ?? "");
|
|
20102
|
-
if (!node3 || !range2) return void 0;
|
|
20103
|
-
const filter = { range: range2 };
|
|
20104
|
-
const columns = [];
|
|
20105
|
-
for (const column of xChildren(node3, "filterColumn")) {
|
|
20106
|
-
const entry3 = {
|
|
20107
|
-
offset: numAttr(column, "colId") ?? 0
|
|
20108
|
-
};
|
|
20109
|
-
const filters = xFirst(column, "filters");
|
|
20110
|
-
if (filters) {
|
|
20111
|
-
entry3.values = xChildren(filters, "filter").map((f) => att(f, "val") ?? "");
|
|
20112
|
-
if (boolAttr(filters, "blank")) entry3.blank = true;
|
|
20113
|
-
}
|
|
20114
|
-
entry3.sourceXml = outerXml(column).replace(MAIN_NS_DECL, "");
|
|
20115
|
-
columns.push(entry3);
|
|
20116
|
-
}
|
|
20117
|
-
if (columns.length) filter.columns = columns;
|
|
20118
|
-
return filter;
|
|
20119
|
-
}
|
|
20120
|
-
var HEADER_FOOTER_TEXT = {
|
|
20121
|
-
header: "oddHeader",
|
|
20122
|
-
footer: "oddFooter",
|
|
20123
|
-
evenHeader: "evenHeader",
|
|
20124
|
-
evenFooter: "evenFooter",
|
|
20125
|
-
firstHeader: "firstHeader",
|
|
20126
|
-
firstFooter: "firstFooter"
|
|
20127
|
-
};
|
|
20128
|
-
var HEADER_FOOTER_FLAGS = [
|
|
20129
|
-
"differentOddEven",
|
|
20130
|
-
"differentFirst",
|
|
20131
|
-
"scaleWithDoc",
|
|
20132
|
-
"alignWithMargins"
|
|
20670
|
+
// xlsx/read/worksheet-children.ts
|
|
20671
|
+
var WORKSHEET_CHILD_ORDER = [
|
|
20672
|
+
"sheetPr",
|
|
20673
|
+
"dimension",
|
|
20674
|
+
"sheetViews",
|
|
20675
|
+
"sheetFormatPr",
|
|
20676
|
+
"cols",
|
|
20677
|
+
"sheetData",
|
|
20678
|
+
"sheetCalcPr",
|
|
20679
|
+
"sheetProtection",
|
|
20680
|
+
"protectedRanges",
|
|
20681
|
+
"scenarios",
|
|
20682
|
+
"autoFilter",
|
|
20683
|
+
"sortState",
|
|
20684
|
+
"dataConsolidate",
|
|
20685
|
+
"customSheetViews",
|
|
20686
|
+
"mergeCells",
|
|
20687
|
+
"phoneticPr",
|
|
20688
|
+
"conditionalFormatting",
|
|
20689
|
+
"dataValidations",
|
|
20690
|
+
"hyperlinks",
|
|
20691
|
+
"printOptions",
|
|
20692
|
+
"pageMargins",
|
|
20693
|
+
"pageSetup",
|
|
20694
|
+
"headerFooter",
|
|
20695
|
+
"rowBreaks",
|
|
20696
|
+
"colBreaks",
|
|
20697
|
+
"customProperties",
|
|
20698
|
+
"cellWatches",
|
|
20699
|
+
"ignoredErrors",
|
|
20700
|
+
"smartTags",
|
|
20701
|
+
"drawing",
|
|
20702
|
+
"legacyDrawing",
|
|
20703
|
+
"legacyDrawingHF",
|
|
20704
|
+
"drawingHF",
|
|
20705
|
+
"picture",
|
|
20706
|
+
"oleObjects",
|
|
20707
|
+
"controls",
|
|
20708
|
+
"webPublishItems",
|
|
20709
|
+
"tableParts",
|
|
20710
|
+
"extLst"
|
|
20133
20711
|
];
|
|
20134
|
-
function readHeaderFooter(node3) {
|
|
20135
|
-
const out = {};
|
|
20136
|
-
for (const key2 of HEADER_FOOTER_FLAGS) {
|
|
20137
|
-
const value3 = boolAttr(node3, key2);
|
|
20138
|
-
if (value3 !== void 0) out[key2] = value3;
|
|
20139
|
-
}
|
|
20140
|
-
for (const [key2, local] of Object.entries(HEADER_FOOTER_TEXT)) {
|
|
20141
|
-
const child3 = xFirst(node3, local);
|
|
20142
|
-
if (child3) out[key2] = xText(child3);
|
|
20143
|
-
}
|
|
20144
|
-
return out;
|
|
20145
|
-
}
|
|
20146
|
-
var ORIENTATIONS = /* @__PURE__ */ new Set(["portrait", "landscape"]);
|
|
20147
|
-
function readPageSetup(margins, setup, headerFooter, fitToPage) {
|
|
20148
|
-
const page = {};
|
|
20149
|
-
if (setup) {
|
|
20150
|
-
if (/^(1|true)$/.test(att(setup, "useFirstPageNumber") ?? "")) {
|
|
20151
|
-
page.firstPageNumber = numAttr(setup, "firstPageNumber") ?? 1;
|
|
20152
|
-
}
|
|
20153
|
-
const order = att(setup, "pageOrder");
|
|
20154
|
-
if (order === "downThenOver" || order === "overThenDown") page.pageOrder = order;
|
|
20155
|
-
const orientation = att(setup, "orientation");
|
|
20156
|
-
if (orientation && ORIENTATIONS.has(orientation))
|
|
20157
|
-
page.orientation = orientation;
|
|
20158
|
-
const paper = numAttr(setup, "paperSize");
|
|
20159
|
-
if (paper !== void 0) page.paperSize = paper;
|
|
20160
|
-
const scale = numAttr(setup, "scale");
|
|
20161
|
-
if (scale !== void 0) page.scale = scale;
|
|
20162
|
-
}
|
|
20163
|
-
if (fitToPage) {
|
|
20164
|
-
page.fitToWidth = numAttr(setup, "fitToWidth") ?? 1;
|
|
20165
|
-
page.fitToHeight = numAttr(setup, "fitToHeight") ?? 1;
|
|
20166
|
-
}
|
|
20167
|
-
if (margins) {
|
|
20168
|
-
const m = (name3, fallback) => numAttr(margins, name3) ?? fallback;
|
|
20169
|
-
page.margins = {
|
|
20170
|
-
left: m("left", 0.7),
|
|
20171
|
-
right: m("right", 0.7),
|
|
20172
|
-
top: m("top", 0.75),
|
|
20173
|
-
bottom: m("bottom", 0.75),
|
|
20174
|
-
header: m("header", 0.3),
|
|
20175
|
-
footer: m("footer", 0.3)
|
|
20176
|
-
};
|
|
20177
|
-
}
|
|
20178
|
-
if (headerFooter) Object.assign(page, readHeaderFooter(headerFooter));
|
|
20179
|
-
return Object.keys(page).length ? page : void 0;
|
|
20180
|
-
}
|
|
20181
|
-
var PROTECTION_META = /* @__PURE__ */ new Set([
|
|
20182
|
-
"sheet",
|
|
20183
|
-
"password",
|
|
20184
|
-
"algorithmName",
|
|
20185
|
-
"hashValue",
|
|
20186
|
-
"saltValue",
|
|
20187
|
-
"spinCount"
|
|
20188
|
-
]);
|
|
20189
|
-
function readProtection(node3) {
|
|
20190
|
-
if (!node3) return void 0;
|
|
20191
|
-
const protection2 = { sheet: boolAttr(node3, "sheet", false) };
|
|
20192
|
-
const password = att(node3, "password");
|
|
20193
|
-
if (password) protection2.passwordHash = password;
|
|
20194
|
-
const modernHash = readModernHash(node3);
|
|
20195
|
-
if (modernHash) protection2.modernHash = modernHash;
|
|
20196
|
-
const allow = [];
|
|
20197
|
-
for (const attribute4 of Array.from(node3.attributes)) {
|
|
20198
|
-
if (PROTECTION_META.has(attribute4.name)) continue;
|
|
20199
|
-
if (attribute4.value === "0" || attribute4.value === "false") allow.push(attribute4.name);
|
|
20200
|
-
}
|
|
20201
|
-
if (allow.length) protection2.allow = allow.sort();
|
|
20202
|
-
return protection2;
|
|
20203
|
-
}
|
|
20204
20712
|
|
|
20205
20713
|
// xlsx/read/conditional.ts
|
|
20206
20714
|
var CFVO_TYPES = /* @__PURE__ */ new Set(["min", "max", "num", "percent", "percentile", "formula"]);
|
|
@@ -23576,9 +24084,210 @@ function readSlicerFrame(content2, anchor, sourceXml) {
|
|
|
23576
24084
|
return void 0;
|
|
23577
24085
|
}
|
|
23578
24086
|
|
|
23579
|
-
// xlsx/read/
|
|
24087
|
+
// xlsx/read/form-control.ts
|
|
24088
|
+
var TYPES2 = {
|
|
24089
|
+
checkbox: "checkbox",
|
|
24090
|
+
radio: "radio",
|
|
24091
|
+
drop: "dropdown",
|
|
24092
|
+
list: "list",
|
|
24093
|
+
button: "button",
|
|
24094
|
+
spin: "spin",
|
|
24095
|
+
scroll: "scroll",
|
|
24096
|
+
gbox: "groupBox",
|
|
24097
|
+
label: "label",
|
|
24098
|
+
edit: "edit"
|
|
24099
|
+
};
|
|
24100
|
+
function readFormControlFrame(alternate, anchorOf) {
|
|
24101
|
+
const choice2 = elements(alternate).find((node3) => node3.localName === "Choice");
|
|
24102
|
+
const anchorEl = choice2 ? elements(choice2).find((node3) => node3.localName?.endsWith("Anchor")) : void 0;
|
|
24103
|
+
if (!anchorEl) return void 0;
|
|
24104
|
+
const shape = elements(anchorEl).find((node3) => node3.localName === "sp");
|
|
24105
|
+
const nv = first(shape, "nvSpPr", NS.xdr);
|
|
24106
|
+
const cNvPr = first(nv, "cNvPr", NS.xdr);
|
|
24107
|
+
const spid = [...cNvPr?.getElementsByTagName("*") ?? []].find(
|
|
24108
|
+
(node3) => node3.localName === "compatExt"
|
|
24109
|
+
);
|
|
24110
|
+
if (!spid) return void 0;
|
|
24111
|
+
const shapeId2 = Number(att(cNvPr, "id"));
|
|
24112
|
+
if (!Number.isFinite(shapeId2)) return void 0;
|
|
24113
|
+
const name3 = att(cNvPr, "name");
|
|
24114
|
+
return {
|
|
24115
|
+
kind: "formControl",
|
|
24116
|
+
anchor: anchorOf(anchorEl),
|
|
24117
|
+
shapeId: shapeId2,
|
|
24118
|
+
controlType: "other",
|
|
24119
|
+
...name3 ? { name: name3 } : {},
|
|
24120
|
+
sourceXml: selfContainedXml(alternate)
|
|
24121
|
+
};
|
|
24122
|
+
}
|
|
24123
|
+
var num = (value3) => {
|
|
24124
|
+
if (value3 === void 0 || value3 === "") return void 0;
|
|
24125
|
+
const parsed = Number(value3);
|
|
24126
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
24127
|
+
};
|
|
24128
|
+
function readProps(control, xml) {
|
|
24129
|
+
const props = parseXml(xml, { label: "XLSX form control" }).documentElement;
|
|
24130
|
+
control.controlType = TYPES2[(att(props, "objectType") ?? "").toLowerCase()] ?? "other";
|
|
24131
|
+
const link = att(props, "fmlaLink");
|
|
24132
|
+
if (link) control.linkedCell = link;
|
|
24133
|
+
const range2 = att(props, "fmlaRange");
|
|
24134
|
+
if (range2) control.listRange = range2;
|
|
24135
|
+
if (control.controlType === "checkbox" || control.controlType === "radio") {
|
|
24136
|
+
const checked = att(props, "checked");
|
|
24137
|
+
control.checked = checked === "Checked" ? "checked" : checked === "Mixed" ? "mixed" : "unchecked";
|
|
24138
|
+
}
|
|
24139
|
+
if (att(props, "firstButton") === "1") control.firstButton = true;
|
|
24140
|
+
for (const [key2, attribute4] of [
|
|
24141
|
+
["selected", "sel"],
|
|
24142
|
+
["value", "val"],
|
|
24143
|
+
["min", "min"],
|
|
24144
|
+
["max", "max"],
|
|
24145
|
+
["step", "inc"],
|
|
24146
|
+
["page", "page"]
|
|
24147
|
+
]) {
|
|
24148
|
+
const value3 = num(att(props, attribute4));
|
|
24149
|
+
if (value3 !== void 0) control[key2] = value3;
|
|
24150
|
+
}
|
|
24151
|
+
if (att(props, "horiz") === "1") control.horizontal = true;
|
|
24152
|
+
const style2 = att(props, "dropStyle");
|
|
24153
|
+
if (style2) control.dropStyle = style2;
|
|
24154
|
+
}
|
|
24155
|
+
var entities = {
|
|
24156
|
+
amp: "&",
|
|
24157
|
+
lt: "<",
|
|
24158
|
+
gt: ">",
|
|
24159
|
+
quot: '"',
|
|
24160
|
+
apos: "'",
|
|
24161
|
+
nbsp: " "
|
|
24162
|
+
};
|
|
24163
|
+
function vmlCaption(vml, shapeId2) {
|
|
24164
|
+
const start = vml.indexOf(`id="_x0000_s${shapeId2}"`);
|
|
24165
|
+
if (start < 0) return void 0;
|
|
24166
|
+
const end = vml.indexOf("</v:shape>", start);
|
|
24167
|
+
const shape = vml.slice(start, end < 0 ? void 0 : end);
|
|
24168
|
+
const box5 = /<v:textbox[^>]*>([\s\S]*?)<\/v:textbox>/.exec(shape)?.[1];
|
|
24169
|
+
if (!box5) return void 0;
|
|
24170
|
+
let stripped = box5.replace(/<br\s*\/?>/gi, "\n");
|
|
24171
|
+
for (let prev = ""; prev !== stripped; ) {
|
|
24172
|
+
prev = stripped;
|
|
24173
|
+
stripped = stripped.replace(/<[^>]*>/g, "");
|
|
24174
|
+
}
|
|
24175
|
+
const text7 = stripped.replace(/&(#x?[0-9a-f]+|\w+);/gi, (match, code) => {
|
|
24176
|
+
if (code.startsWith("#")) {
|
|
24177
|
+
const value3 = code[1]?.toLowerCase() === "x" ? parseInt(code.slice(2), 16) : Number(code.slice(1));
|
|
24178
|
+
return Number.isFinite(value3) ? String.fromCodePoint(value3) : match;
|
|
24179
|
+
}
|
|
24180
|
+
return entities[code.toLowerCase()] ?? match;
|
|
24181
|
+
}).replace(/\s+/g, " ").trim();
|
|
24182
|
+
return text7 || void 0;
|
|
24183
|
+
}
|
|
24184
|
+
function attachFormControls(source, sheetPart, root2, sheet, legacyDrawing) {
|
|
24185
|
+
const controls3 = sheet.drawings.filter(
|
|
24186
|
+
(object) => object.kind === "formControl"
|
|
24187
|
+
);
|
|
24188
|
+
if (!controls3.length) return;
|
|
24189
|
+
const rels = source.rels(sheetPart);
|
|
24190
|
+
const parts = /* @__PURE__ */ new Map();
|
|
24191
|
+
for (const control of Array.from(root2.getElementsByTagNameNS(NS.x, "control"))) {
|
|
24192
|
+
const shapeId2 = Number(att(control, "shapeId"));
|
|
24193
|
+
const rel = rels.get(relAttr(control, "id") ?? "");
|
|
24194
|
+
const target2 = rel ? source.target(sheetPart, rel) : void 0;
|
|
24195
|
+
if (target2) parts.set(shapeId2, target2);
|
|
24196
|
+
}
|
|
24197
|
+
const vmlRel = legacyDrawing ? rels.get(relAttr(legacyDrawing, "id") ?? "") : void 0;
|
|
24198
|
+
const vmlPart = vmlRel ? source.target(sheetPart, vmlRel) : void 0;
|
|
24199
|
+
const vml = vmlPart ? source.text(vmlPart) : void 0;
|
|
24200
|
+
for (const control of controls3) {
|
|
24201
|
+
const part = parts.get(control.shapeId);
|
|
24202
|
+
const xml = part ? source.text(part) : void 0;
|
|
24203
|
+
if (part && xml) {
|
|
24204
|
+
control.partName = part;
|
|
24205
|
+
try {
|
|
24206
|
+
readProps(control, xml);
|
|
24207
|
+
} catch {
|
|
24208
|
+
control.controlType = "other";
|
|
24209
|
+
}
|
|
24210
|
+
}
|
|
24211
|
+
const caption = vml ? vmlCaption(vml, control.shapeId) : void 0;
|
|
24212
|
+
if (caption) control.caption = caption;
|
|
24213
|
+
}
|
|
24214
|
+
}
|
|
24215
|
+
|
|
24216
|
+
// xlsx/read/shape.ts
|
|
23580
24217
|
var xdr = (parent, local) => first(parent, local, NS.xdr);
|
|
23581
|
-
|
|
24218
|
+
function styleRef2(style2, name3) {
|
|
24219
|
+
const ref = first(style2, name3, NS.a);
|
|
24220
|
+
if (!ref) return void 0;
|
|
24221
|
+
const idx = Number(att(ref, "idx") ?? 0);
|
|
24222
|
+
const color2 = parseDrawingColorIn(ref);
|
|
24223
|
+
return { idx: Number.isFinite(idx) ? idx : 0, ...color2 ? { color: color2 } : {} };
|
|
24224
|
+
}
|
|
24225
|
+
function readStyle(style2) {
|
|
24226
|
+
if (!style2) return void 0;
|
|
24227
|
+
const fill = styleRef2(style2, "fillRef");
|
|
24228
|
+
const line2 = styleRef2(style2, "lnRef");
|
|
24229
|
+
const fontColor = parseDrawingColorIn(first(style2, "fontRef", NS.a));
|
|
24230
|
+
return {
|
|
24231
|
+
...fill ? { fill } : {},
|
|
24232
|
+
...line2 ? { line: line2 } : {},
|
|
24233
|
+
...fontColor ? { font: { color: fontColor } } : {}
|
|
24234
|
+
};
|
|
24235
|
+
}
|
|
24236
|
+
function readShapeNode(element2) {
|
|
24237
|
+
const local = element2.localName;
|
|
24238
|
+
if (local !== "sp" && local !== "cxnSp" && local !== "grpSp") return void 0;
|
|
24239
|
+
const isGroup = local === "grpSp";
|
|
24240
|
+
const nv = elements(element2).find((node4) => node4.localName?.startsWith("nv"));
|
|
24241
|
+
const cNvPr = xdr(nv, "cNvPr");
|
|
24242
|
+
const spPr = xdr(element2, isGroup ? "grpSpPr" : "spPr");
|
|
24243
|
+
const xfrm = first(spPr, "xfrm", NS.a);
|
|
24244
|
+
const transform2 = parseTransform(xfrm);
|
|
24245
|
+
const geometry = isGroup ? { geometry: "group" } : parseDrawingGeometry(spPr);
|
|
24246
|
+
const node3 = {
|
|
24247
|
+
kind: isGroup ? "group" : local === "cxnSp" ? "connector" : "shape",
|
|
24248
|
+
frame: transform2?.frame ?? { x: 0, y: 0, width: 0, height: 0 },
|
|
24249
|
+
geometry: geometry.geometry
|
|
24250
|
+
};
|
|
24251
|
+
const name3 = att(cNvPr, "name");
|
|
24252
|
+
if (name3) node3.name = name3;
|
|
24253
|
+
if (att(xdr(nv, "cNvSpPr"), "txBox") === "1") node3.textBox = true;
|
|
24254
|
+
if (transform2?.rotation) node3.rotation = transform2.rotation;
|
|
24255
|
+
if (transform2?.flipHorizontal) node3.flipH = true;
|
|
24256
|
+
if (transform2?.flipVertical) node3.flipV = true;
|
|
24257
|
+
if ("adjustments" in geometry && geometry.adjustments) node3.adjustments = geometry.adjustments;
|
|
24258
|
+
if ("paths" in geometry && geometry.paths) node3.paths = geometry.paths;
|
|
24259
|
+
if (!isGroup) {
|
|
24260
|
+
const fill = parseDrawingFill(spPr);
|
|
24261
|
+
if (fill) node3.fill = fill;
|
|
24262
|
+
const line2 = parseDrawingLine(first(spPr, "ln", NS.a));
|
|
24263
|
+
if (line2) node3.line = line2;
|
|
24264
|
+
const style2 = readStyle(xdr(element2, "style"));
|
|
24265
|
+
if (style2) node3.style = style2;
|
|
24266
|
+
const text7 = parseDrawingTextBody(xdr(element2, "txBody"));
|
|
24267
|
+
if (text7?.text) node3.text = text7;
|
|
24268
|
+
return node3;
|
|
24269
|
+
}
|
|
24270
|
+
const childFrame = parseFrameOf(first(xfrm, "chOff", NS.a), first(xfrm, "chExt", NS.a));
|
|
24271
|
+
if (childFrame) node3.childFrame = childFrame;
|
|
24272
|
+
node3.children = elements(element2).flatMap((child3) => {
|
|
24273
|
+
const read = readShapeNode(child3);
|
|
24274
|
+
return read ? [read] : [];
|
|
24275
|
+
});
|
|
24276
|
+
return node3;
|
|
24277
|
+
}
|
|
24278
|
+
function parseFrameOf(off, ext) {
|
|
24279
|
+
if (!off || !ext) return void 0;
|
|
24280
|
+
return {
|
|
24281
|
+
x: Number(att(off, "x") ?? 0),
|
|
24282
|
+
y: Number(att(off, "y") ?? 0),
|
|
24283
|
+
width: Number(att(ext, "cx") ?? 0),
|
|
24284
|
+
height: Number(att(ext, "cy") ?? 0)
|
|
24285
|
+
};
|
|
24286
|
+
}
|
|
24287
|
+
|
|
24288
|
+
// xlsx/read/drawing.ts
|
|
24289
|
+
var xdr2 = (parent, local) => first(parent, local, NS.xdr);
|
|
24290
|
+
var int2 = (parent, local) => Math.round(Number(xdr2(parent, local)?.textContent ?? 0)) || 0;
|
|
23582
24291
|
function marker(node3) {
|
|
23583
24292
|
return {
|
|
23584
24293
|
col: int2(node3, "col"),
|
|
@@ -23589,7 +24298,7 @@ function marker(node3) {
|
|
|
23589
24298
|
}
|
|
23590
24299
|
function readAnchor(anchor) {
|
|
23591
24300
|
if (anchor.localName === "absoluteAnchor") {
|
|
23592
|
-
const pos =
|
|
24301
|
+
const pos = xdr2(anchor, "pos");
|
|
23593
24302
|
const result3 = {
|
|
23594
24303
|
from: {
|
|
23595
24304
|
row: 0,
|
|
@@ -23598,26 +24307,26 @@ function readAnchor(anchor) {
|
|
|
23598
24307
|
rowOffset: Number(att(pos, "y") ?? 0)
|
|
23599
24308
|
}
|
|
23600
24309
|
};
|
|
23601
|
-
const ext2 =
|
|
24310
|
+
const ext2 = xdr2(anchor, "ext");
|
|
23602
24311
|
if (ext2) result3.ext = { cx: Number(att(ext2, "cx") ?? 0), cy: Number(att(ext2, "cy") ?? 0) };
|
|
23603
24312
|
return result3;
|
|
23604
24313
|
}
|
|
23605
|
-
const result2 = { from: marker(
|
|
23606
|
-
const to =
|
|
24314
|
+
const result2 = { from: marker(xdr2(anchor, "from")) };
|
|
24315
|
+
const to = xdr2(anchor, "to");
|
|
23607
24316
|
if (to) result2.to = marker(to);
|
|
23608
|
-
const ext =
|
|
24317
|
+
const ext = xdr2(anchor, "ext");
|
|
23609
24318
|
if (ext) result2.ext = { cx: Number(att(ext, "cx") ?? 0), cy: Number(att(ext, "cy") ?? 0) };
|
|
23610
24319
|
return result2;
|
|
23611
24320
|
}
|
|
23612
24321
|
var ANCHOR_PARTS = /* @__PURE__ */ new Set(["from", "to", "ext", "pos", "clientData"]);
|
|
23613
24322
|
function nonVisual(content2) {
|
|
23614
24323
|
const nv = elements(content2).find((node3) => node3.localName?.startsWith("nv"));
|
|
23615
|
-
return
|
|
24324
|
+
return xdr2(nv, "cNvPr");
|
|
23616
24325
|
}
|
|
23617
24326
|
function describe(content2) {
|
|
23618
24327
|
switch (content2.localName) {
|
|
23619
24328
|
case "sp":
|
|
23620
|
-
return
|
|
24329
|
+
return xdr2(content2, "nvSpPr") && att(xdr2(xdr2(content2, "nvSpPr"), "cNvSpPr"), "txBox") === "1" ? "text box" : "shape";
|
|
23621
24330
|
case "grpSp":
|
|
23622
24331
|
return "group";
|
|
23623
24332
|
case "cxnSp":
|
|
@@ -23637,6 +24346,11 @@ function parseDrawing(source, partName, warn) {
|
|
|
23637
24346
|
const rels = source.rels(partName);
|
|
23638
24347
|
const out = [];
|
|
23639
24348
|
for (const anchorEl of elements(root2)) {
|
|
24349
|
+
if (anchorEl.localName === "AlternateContent") {
|
|
24350
|
+
const control = readFormControlFrame(anchorEl, readAnchor);
|
|
24351
|
+
if (control) out.push(control);
|
|
24352
|
+
continue;
|
|
24353
|
+
}
|
|
23640
24354
|
if (!["twoCellAnchor", "oneCellAnchor", "absoluteAnchor"].includes(anchorEl.localName ?? ""))
|
|
23641
24355
|
continue;
|
|
23642
24356
|
const anchor = readAnchor(anchorEl);
|
|
@@ -23651,7 +24365,7 @@ function parseDrawing(source, partName, warn) {
|
|
|
23651
24365
|
const cNvPr = nonVisual(content2);
|
|
23652
24366
|
const name3 = att(cNvPr, "name");
|
|
23653
24367
|
if (content2.localName === "pic") {
|
|
23654
|
-
const blipFill =
|
|
24368
|
+
const blipFill = xdr2(content2, "blipFill");
|
|
23655
24369
|
const blip = first(blipFill, "blip", NS.a);
|
|
23656
24370
|
const rel = rels.get(relAttr(blip, "embed") ?? "");
|
|
23657
24371
|
const target2 = rel ? source.target(partName, rel) : void 0;
|
|
@@ -23726,11 +24440,50 @@ function parseDrawing(source, partName, warn) {
|
|
|
23726
24440
|
continue;
|
|
23727
24441
|
}
|
|
23728
24442
|
}
|
|
23729
|
-
|
|
24443
|
+
const shape = readShapeNode(content2);
|
|
24444
|
+
out.push({ ...unsupported4(describe(content2)), ...shape ? { shape } : {} });
|
|
23730
24445
|
}
|
|
23731
24446
|
return out;
|
|
23732
24447
|
}
|
|
23733
24448
|
|
|
24449
|
+
// xlsx/read/header-footer-images.ts
|
|
24450
|
+
var UNIT_PT = { pt: 1, in: 72, cm: 72 / 2.54, mm: 72 / 25.4, px: 0.75 };
|
|
24451
|
+
function styleLength(style2, property2) {
|
|
24452
|
+
const match = new RegExp(
|
|
24453
|
+
`(?:^|[;\\s])${property2}\\s*:\\s*([\\d.]+)\\s*(pt|in|cm|mm|px)?`,
|
|
24454
|
+
"i"
|
|
24455
|
+
).exec(style2);
|
|
24456
|
+
return match ? Number(match[1]) * (UNIT_PT[(match[2] ?? "pt").toLowerCase()] ?? 1) : 0;
|
|
24457
|
+
}
|
|
24458
|
+
function readHeaderFooterImages(source, sheetPart, legacyHF) {
|
|
24459
|
+
if (!legacyHF) return void 0;
|
|
24460
|
+
const rel = source.rels(sheetPart).get(relAttr(legacyHF, "id") ?? "");
|
|
24461
|
+
const vmlPart = rel ? source.target(sheetPart, rel) : void 0;
|
|
24462
|
+
const vml = vmlPart ? source.text(vmlPart) : void 0;
|
|
24463
|
+
if (!vmlPart || !vml) return void 0;
|
|
24464
|
+
const rels = source.rels(vmlPart);
|
|
24465
|
+
const images = {};
|
|
24466
|
+
for (const match of vml.matchAll(/<v:shape\b([^>]*)>([\s\S]*?)<\/v:shape>/g)) {
|
|
24467
|
+
const id3 = /\bid="([^"]+)"/.exec(match[1] ?? "")?.[1];
|
|
24468
|
+
const style2 = /style=(?:'([^']*)'|"([^"]*)")/.exec(match[1] ?? "");
|
|
24469
|
+
const data = /<v:imagedata\b([^>]*)>/.exec(match[2] ?? "")?.[1];
|
|
24470
|
+
const relId = /\bo:relid="([^"]+)"/.exec(data ?? "")?.[1];
|
|
24471
|
+
const imageRel = relId ? rels.get(relId) : void 0;
|
|
24472
|
+
const partName = imageRel ? source.target(vmlPart, imageRel) : void 0;
|
|
24473
|
+
if (!id3 || !partName || !source.has(partName)) continue;
|
|
24474
|
+
const css = style2?.[1] ?? style2?.[2] ?? "";
|
|
24475
|
+
const title = /\bo:title="([^"]*)"/.exec(data ?? "")?.[1];
|
|
24476
|
+
images[id3] = {
|
|
24477
|
+
partName,
|
|
24478
|
+
contentType: source.contentType(partName) ?? "application/octet-stream",
|
|
24479
|
+
widthPt: styleLength(css, "width"),
|
|
24480
|
+
heightPt: styleLength(css, "height"),
|
|
24481
|
+
...title ? { title } : {}
|
|
24482
|
+
};
|
|
24483
|
+
}
|
|
24484
|
+
return Object.keys(images).length ? images : void 0;
|
|
24485
|
+
}
|
|
24486
|
+
|
|
23734
24487
|
// xlsx/read/dates.ts
|
|
23735
24488
|
var DAY_MS2 = 864e5;
|
|
23736
24489
|
var EPOCH_19003 = Date.UTC(1899, 11, 30);
|
|
@@ -23872,6 +24625,8 @@ function readRowInfo(ctx, rowEl) {
|
|
|
23872
24625
|
const outline = numAttr(rowEl, "outlineLevel");
|
|
23873
24626
|
if (outline) info.outlineLevel = outline;
|
|
23874
24627
|
if (boolAttr(rowEl, "collapsed")) info.collapsed = true;
|
|
24628
|
+
if (boolAttr(rowEl, "thickTop")) info.thickTop = true;
|
|
24629
|
+
if (boolAttr(rowEl, "thickBot")) info.thickBot = true;
|
|
23875
24630
|
return Object.keys(info).length ? info : void 0;
|
|
23876
24631
|
}
|
|
23877
24632
|
function readSheetData(ctx, rows, sheet) {
|
|
@@ -23984,15 +24739,6 @@ function readScenarios(node3) {
|
|
|
23984
24739
|
return set;
|
|
23985
24740
|
}
|
|
23986
24741
|
|
|
23987
|
-
// xlsx/read/print-options.ts
|
|
23988
|
-
var KEYS = ["gridLines", "headings", "horizontalCentered", "verticalCentered"];
|
|
23989
|
-
function readPrintOptions(node3) {
|
|
23990
|
-
if (!node3) return void 0;
|
|
23991
|
-
const out = {};
|
|
23992
|
-
for (const key2 of KEYS) if (boolAttr(node3, key2)) out[key2] = true;
|
|
23993
|
-
return Object.keys(out).length ? out : void 0;
|
|
23994
|
-
}
|
|
23995
|
-
|
|
23996
24742
|
// xlsx/read/tables.ts
|
|
23997
24743
|
function parseTable(xml, partName) {
|
|
23998
24744
|
const root2 = parseXml(xml, { label: "XLSX table" }).documentElement;
|
|
@@ -24083,8 +24829,14 @@ var MODELLED = /* @__PURE__ */ new Set([
|
|
|
24083
24829
|
"drawing",
|
|
24084
24830
|
"legacyDrawing",
|
|
24085
24831
|
"tableParts",
|
|
24086
|
-
"scenarios"
|
|
24832
|
+
"scenarios",
|
|
24833
|
+
"customSheetViews"
|
|
24087
24834
|
]);
|
|
24835
|
+
function reportUnplaceable(ctx, sheet, element2) {
|
|
24836
|
+
ctx.warn(
|
|
24837
|
+
`Sheet "${sheet}": the element "${element2}" is not part of the worksheet schema and is dropped on save.`
|
|
24838
|
+
);
|
|
24839
|
+
}
|
|
24088
24840
|
function keep(sheet, key2, xml) {
|
|
24089
24841
|
const list2 = sheet.preserved.get(key2);
|
|
24090
24842
|
if (list2) list2.push(xml);
|
|
@@ -24166,9 +24918,15 @@ function readWorksheet(ctx, partName, name3, sheetId5, xml, rows) {
|
|
|
24166
24918
|
else if (!byName.has(local)) byName.set(local, node3);
|
|
24167
24919
|
if (SNAPSHOT_ELEMENTS.includes(local))
|
|
24168
24920
|
keep(sheet, snapshotKey(local), outerXml(node3));
|
|
24169
|
-
else if (local === "AlternateContent")
|
|
24170
|
-
|
|
24171
|
-
|
|
24921
|
+
else if (local === "AlternateContent") {
|
|
24922
|
+
const inner = alternateContentName(node3);
|
|
24923
|
+
if (!WORKSHEET_CHILD_ORDER.includes(inner ?? local))
|
|
24924
|
+
reportUnplaceable(ctx, name3, inner ?? local);
|
|
24925
|
+
keep(sheet, inner ?? local, selfContainedXml(node3));
|
|
24926
|
+
} else if (!MODELLED.has(local)) {
|
|
24927
|
+
if (!WORKSHEET_CHILD_ORDER.includes(local)) reportUnplaceable(ctx, name3, local);
|
|
24928
|
+
keep(sheet, local, selfContainedXml(node3));
|
|
24929
|
+
}
|
|
24172
24930
|
}
|
|
24173
24931
|
const sheetPr = byName.get("sheetPr");
|
|
24174
24932
|
const tabColor = readTabColor(sheetPr, ctx.palette);
|
|
@@ -24204,6 +24962,10 @@ function readWorksheet(ctx, partName, name3, sheetId5, xml, rows) {
|
|
|
24204
24962
|
readFitToPage(sheetPr)
|
|
24205
24963
|
);
|
|
24206
24964
|
if (page) sheet.pageSetup = page;
|
|
24965
|
+
const customViews = byName.get("customSheetViews");
|
|
24966
|
+
if (customViews) sheet.customViews = readCustomSheetViews(customViews);
|
|
24967
|
+
const hfImages = readHeaderFooterImages(ctx.source, partName, byName.get("legacyDrawingHF"));
|
|
24968
|
+
if (hfImages) sheet.headerFooterImages = hfImages;
|
|
24207
24969
|
const printOptions = readPrintOptions(byName.get("printOptions"));
|
|
24208
24970
|
if (printOptions) sheet.printOptions = printOptions;
|
|
24209
24971
|
const drawing2 = byName.get("drawing");
|
|
@@ -24211,6 +24973,7 @@ function readWorksheet(ctx, partName, name3, sheetId5, xml, rows) {
|
|
|
24211
24973
|
const rel = ctx.source.rels(partName).get(relAttr(drawing2, "id") ?? "");
|
|
24212
24974
|
const target2 = rel ? ctx.source.target(partName, rel) : void 0;
|
|
24213
24975
|
if (target2) sheet.drawings = parseDrawing(ctx.source, target2, (m) => ctx.warn(m));
|
|
24976
|
+
attachFormControls(ctx.source, partName, root2, sheet, byName.get("legacyDrawing"));
|
|
24214
24977
|
}
|
|
24215
24978
|
readTables(ctx, partName, byName.get("tableParts"), sheet);
|
|
24216
24979
|
readComments(ctx, partName, sheet);
|
|
@@ -24319,6 +25082,7 @@ async function loadXlsx(input, options2 = {}) {
|
|
|
24319
25082
|
if (book.workbookPasswordHash) workbook.workbookPasswordHash = book.workbookPasswordHash;
|
|
24320
25083
|
if (book.workbookModernHash) workbook.workbookModernHash = book.workbookModernHash;
|
|
24321
25084
|
if (book.oleSize) workbook.oleSize = book.oleSize;
|
|
25085
|
+
if (book.customViews) workbook.customViews = book.customViews;
|
|
24322
25086
|
if (book.calcMode) workbook.calcMode = book.calcMode;
|
|
24323
25087
|
if (book.iterate) workbook.iterate = book.iterate;
|
|
24324
25088
|
if (signatures.hasSignatures)
|
|
@@ -26065,9 +26829,9 @@ function sampleArc(start, rxIn, ryIn, xAxisRotationDeg, largeArcFlag, sweepFlag,
|
|
|
26065
26829
|
ry *= scale;
|
|
26066
26830
|
}
|
|
26067
26831
|
const sign2 = largeArcFlag !== sweepFlag ? 1 : -1;
|
|
26068
|
-
const
|
|
26832
|
+
const num2 = rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p;
|
|
26069
26833
|
const den = rx * rx * y1p * y1p + ry * ry * x1p * x1p;
|
|
26070
|
-
const coef = sign2 * Math.sqrt(Math.max(0,
|
|
26834
|
+
const coef = sign2 * Math.sqrt(Math.max(0, num2 / den));
|
|
26071
26835
|
const cxp = coef * (rx * y1p) / ry;
|
|
26072
26836
|
const cyp = coef * -(ry * x1p) / rx;
|
|
26073
26837
|
const cx = cosPhi * cxp - sinPhi * cyp + (start.x + end.x) / 2;
|
|
@@ -33089,8 +33853,13 @@ var VISIO_VISIBILITY_LIMITS = Object.freeze({
|
|
|
33089
33853
|
});
|
|
33090
33854
|
|
|
33091
33855
|
// visio/edit-formatting-scope.ts
|
|
33092
|
-
async function assertFormattingDependencies(pkg, pagePaths, roots2, pageId2, shape, changed, check, instanceView2) {
|
|
33093
|
-
indexCells(roots2, { check })
|
|
33856
|
+
async function assertFormattingDependencies(pkg, pagePaths, roots2, pageId2, shape, changed, check, instanceView2, options2 = {}) {
|
|
33857
|
+
for (const item2 of indexCells(roots2, { check, scope: "affected" }).values())
|
|
33858
|
+
if (item2.refusal && item2.pageId === pageId2)
|
|
33859
|
+
fail(
|
|
33860
|
+
"EDIT_UNKNOWN_DEPENDENCY",
|
|
33861
|
+
`Cannot prove ShapeSheet dependency closure: ${item2.refusal}`
|
|
33862
|
+
);
|
|
33094
33863
|
const shapeId2 = attribute2(shape, "ID");
|
|
33095
33864
|
const changedNames = new Set([...changed.keys()].map((name3) => name3.toLowerCase()));
|
|
33096
33865
|
const jumpOnly = [...changedNames].every(
|
|
@@ -33145,11 +33914,17 @@ async function assertFormattingDependencies(pkg, pagePaths, roots2, pageId2, sha
|
|
|
33145
33914
|
if (textEdit && localShapeId === shapeId2 && sourcePageId === pageId2) continue;
|
|
33146
33915
|
analysis = sized;
|
|
33147
33916
|
}
|
|
33917
|
+
if (options2.textReads && textEdit && !named2 && sourcePageId !== void 0 && textReadFormula(source))
|
|
33918
|
+
continue;
|
|
33148
33919
|
if (named2 && analysis.dynamic) {
|
|
33149
33920
|
if (mentions()) failure2();
|
|
33150
33921
|
continue;
|
|
33151
33922
|
}
|
|
33152
|
-
if (analysis.dynamic
|
|
33923
|
+
if (analysis.dynamic && analysis.opaque) {
|
|
33924
|
+
if (sourcePageId === pageId2 || mentions()) failure2();
|
|
33925
|
+
continue;
|
|
33926
|
+
}
|
|
33927
|
+
if (analysis.references.some(
|
|
33153
33928
|
(ref) => changedNames.has(canonical2(ref.cell)) && (sourcePageId === void 0 || sourcePageId === pageId2) && (ref.shapeId === shapeId2 || ref.shapeId === void 0 && (localShapeId === shapeId2 || sourcePageId === void 0))
|
|
33154
33929
|
))
|
|
33155
33930
|
failure2();
|
|
@@ -33162,6 +33937,7 @@ async function assertFormattingDependencies(pkg, pagePaths, roots2, pageId2, sha
|
|
|
33162
33937
|
const part = await pkg.readXml(path3);
|
|
33163
33938
|
const master2 = part.localName === "MasterContents";
|
|
33164
33939
|
if (instanceView2 && master2) continue;
|
|
33940
|
+
if (master2 && !shape.hasAttribute("Master") && !shape.hasAttribute("MasterShape")) continue;
|
|
33165
33941
|
inspect3(part, void 0, master2);
|
|
33166
33942
|
}
|
|
33167
33943
|
}
|
|
@@ -33364,7 +34140,7 @@ function masterTemplate(pkg) {
|
|
|
33364
34140
|
return matches2.length === 1 ? matches2[0] : missing();
|
|
33365
34141
|
};
|
|
33366
34142
|
}
|
|
33367
|
-
function replaceScopedPlainText(pkg, pagePaths, roots2, document, edit, check) {
|
|
34143
|
+
function replaceScopedPlainText(pkg, pagePaths, roots2, document, edit, check, diagnostics = []) {
|
|
33368
34144
|
return replacePlainText(
|
|
33369
34145
|
roots2.get(edit.pageId),
|
|
33370
34146
|
document,
|
|
@@ -33378,10 +34154,20 @@ function replaceScopedPlainText(pkg, pagePaths, roots2, document, edit, check) {
|
|
|
33378
34154
|
edit.pageId,
|
|
33379
34155
|
shape,
|
|
33380
34156
|
/* @__PURE__ */ new Map([["TheText", text7]]),
|
|
33381
|
-
check
|
|
34157
|
+
check,
|
|
34158
|
+
void 0,
|
|
34159
|
+
{ textReads: true }
|
|
33382
34160
|
),
|
|
33383
34161
|
masterTemplate(pkg)
|
|
33384
|
-
)
|
|
34162
|
+
).then((changed) => {
|
|
34163
|
+
if (changed)
|
|
34164
|
+
recalculateVisioCells(
|
|
34165
|
+
roots2,
|
|
34166
|
+
[{ pageId: edit.pageId, shapeId: edit.shapeId, cell: "TheText" }],
|
|
34167
|
+
{ check, cycles: "keep", diagnostics }
|
|
34168
|
+
);
|
|
34169
|
+
return changed;
|
|
34170
|
+
});
|
|
33385
34171
|
}
|
|
33386
34172
|
|
|
33387
34173
|
// visio/edit-instance-sheet.ts
|
|
@@ -34289,7 +35075,7 @@ function layoutConnectorShape(roots2, pageId2, shape, route, sites, check, obsta
|
|
|
34289
35075
|
|
|
34290
35076
|
// visio/edit-stencil-connector-layout.ts
|
|
34291
35077
|
var same6 = (a2, b) => Math.abs(a2 - b) <= 1e-9 * Math.max(1, Math.abs(a2), Math.abs(b));
|
|
34292
|
-
function walkShape(box5) {
|
|
35078
|
+
function walkShape(box5, floating = false) {
|
|
34293
35079
|
const [a2, b, c2, d, e, f] = box5.transform;
|
|
34294
35080
|
const at2 = (x, y) => ({
|
|
34295
35081
|
x: a2 * x + c2 * y + e,
|
|
@@ -34301,7 +35087,8 @@ function walkShape(box5) {
|
|
|
34301
35087
|
sites: sites.map((site) => ({ point: site.point, normal: site.normal })),
|
|
34302
35088
|
bounds: sites[0].box,
|
|
34303
35089
|
center: at2(box5.width / 2, box5.height / 2),
|
|
34304
|
-
corners: [at2(0, 0), at2(box5.width, 0), at2(box5.width, box5.height), at2(0, box5.height)]
|
|
35090
|
+
corners: [at2(0, 0), at2(box5.width, 0), at2(box5.width, box5.height), at2(0, box5.height)],
|
|
35091
|
+
...floating ? { floating } : {}
|
|
34305
35092
|
}
|
|
34306
35093
|
};
|
|
34307
35094
|
}
|
|
@@ -34522,6 +35309,11 @@ function connectionRows(shape) {
|
|
|
34522
35309
|
}
|
|
34523
35310
|
return rows;
|
|
34524
35311
|
}
|
|
35312
|
+
function hasConnectionPoints(root2, shapeId2) {
|
|
35313
|
+
const target2 = topShape(root2, shapeId2);
|
|
35314
|
+
if (!target2) return false;
|
|
35315
|
+
return (stencilTemplate(target2) ? effectiveRows(target2, "Connection") : connectionRows(target2)).size > 0;
|
|
35316
|
+
}
|
|
34525
35317
|
function glueSites(root2, end) {
|
|
34526
35318
|
const box5 = glueBox(root2, end.target);
|
|
34527
35319
|
if (end.point === void 0) return dynamicSites(box5);
|
|
@@ -34632,8 +35424,9 @@ function proveConnector(root2, connectorId) {
|
|
|
34632
35424
|
const named2 = visioPointGlueTarget(source);
|
|
34633
35425
|
return index2 === void 0 ? !named2 : !!named2 && named2.shapeId === target2 && named2.index === index2;
|
|
34634
35426
|
};
|
|
34635
|
-
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
|
|
34636
|
-
|
|
35427
|
+
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
|
|
35428
|
+
// point glue on a drawn line has none either (native-edit-families-flat-2026-10-29.json).
|
|
35429
|
+
visioGlueTriggerTarget(formula2(triggerName(end))) !== target2 && !(formula2(triggerName(end)) === void 0 && !local.has(triggerName(end)) && (isStencilLine(shape) || index2 !== void 0)) || !glued("X") || !glued("Y"))
|
|
34637
35430
|
fail("UNSUPPORTED_GEOMETRY_EDIT", UNSUPPORTED);
|
|
34638
35431
|
ends[end] = { target: target2, ...index2 === void 0 ? {} : { point: index2 } };
|
|
34639
35432
|
}
|
|
@@ -34899,7 +35692,7 @@ function rerouteConnector(roots2, pageId2, glue, check, options2 = {}) {
|
|
|
34899
35692
|
}
|
|
34900
35693
|
const walk = (end) => {
|
|
34901
35694
|
const target2 = glue.ends[end];
|
|
34902
|
-
return target2 && target2.point === void 0 ? walkShape(glueBox(root2, target2.target)) : { point: sites(end)[0].point };
|
|
35695
|
+
return target2 && target2.point === void 0 ? walkShape(glueBox(root2, target2.target), !hasConnectionPoints(root2, target2.target)) : { point: sites(end)[0].point };
|
|
34903
35696
|
};
|
|
34904
35697
|
const route = options2.route ?? current;
|
|
34905
35698
|
if (route === "straight" && current === "straight" && ENDS.every(
|
|
@@ -36115,7 +36908,7 @@ async function assertInstanceLayersUnlocked(pkg, pageId2, layerMember) {
|
|
|
36115
36908
|
|
|
36116
36909
|
// visio/formula-functions.ts
|
|
36117
36910
|
var DOCUMENTED = new Set(
|
|
36118
|
-
`ABS ACOS AND ANG360 ANGLEALONGPATH ANGLETOLOC ANGLETOPAR ASIN ATAN ATAN2 BITAND BITNOT BITOR
|
|
36911
|
+
`ABS ACOS AND ARG ANG360 ANGLEALONGPATH ANGLETOLOC ANGLETOPAR ASIN ATAN ATAN2 BITAND BITNOT BITOR
|
|
36119
36912
|
BITXOR BKGPAGENAME BLEND BLOB BLUE BOUND CALLOUTCOUNT CALLOUTTARGETREF CALLTHIS CATEGORY CEILING
|
|
36120
36913
|
CELLISTHEMED CHAR COMPANY CONTAINERCOUNT CONTAINERMEMBERCOUNT CONTAINERSHEETREF COS COSH CREATOR
|
|
36121
36914
|
CY DATA1 DATA2 DATA3 DATE DATETIME DATEVALUE DAY DAYOFYEAR DECIMALSEP DEFAULTEVENT DEG DEPENDSON
|
|
@@ -37382,6 +38175,7 @@ function resizeVisioShapeAtAnchor(roots2, document, edit, check, glueShapes = /*
|
|
|
37382
38175
|
fail("UNSUPPORTED_GEOMETRY_EDIT", "Glued shapes require routing outside this subset.");
|
|
37383
38176
|
const graph = indexCells(roots2, {
|
|
37384
38177
|
check,
|
|
38178
|
+
scope: "affected",
|
|
37385
38179
|
glueShapes,
|
|
37386
38180
|
...group2 ? { groupResizeShapes: group2.shapes } : {}
|
|
37387
38181
|
});
|
|
@@ -37695,13 +38489,23 @@ function prepareMasterMovePins(roots2, commands, bindings, check) {
|
|
|
37695
38489
|
}
|
|
37696
38490
|
}
|
|
37697
38491
|
if (result2.size) {
|
|
37698
|
-
const indexed = indexCells(roots2, { check });
|
|
38492
|
+
const indexed = indexCells(roots2, { check, scope: "affected" });
|
|
37699
38493
|
const pins = new Set(
|
|
37700
38494
|
[...indexed.values()].filter((cell) => cell.node && result2.has(cell.node)).map(key)
|
|
37701
38495
|
);
|
|
37702
|
-
|
|
37703
|
-
|
|
38496
|
+
const pinPages = new Set(
|
|
38497
|
+
[...indexed.values()].filter((cell) => cell.node && result2.has(cell.node)).map((c2) => c2.pageId)
|
|
38498
|
+
);
|
|
38499
|
+
for (const cell of indexed.values()) {
|
|
38500
|
+
charge();
|
|
38501
|
+
if (cell.opaque && pinPages.has(cell.pageId))
|
|
38502
|
+
fail(
|
|
38503
|
+
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
38504
|
+
"A formula that may read a master rotation pin exists."
|
|
38505
|
+
);
|
|
38506
|
+
if (cell.dependencies.some((dependency) => pins.has(dependency)))
|
|
37704
38507
|
fail("EDIT_UNSUPPORTED_DEPENDENCY", "A page cache depends on a master rotation pin.");
|
|
38508
|
+
}
|
|
37705
38509
|
}
|
|
37706
38510
|
return { pins: result2, dimensions: provenDimensions };
|
|
37707
38511
|
}
|
|
@@ -37798,8 +38602,12 @@ function applyGeometryEdit(roots2, document, edit, check, masterMoveProof = empt
|
|
|
37798
38602
|
if (edit.type === "delete-shape") {
|
|
37799
38603
|
unlocked("LockDelete");
|
|
37800
38604
|
releaseDeletedGlue(roots2, /* @__PURE__ */ new Map([[edit.pageId, /* @__PURE__ */ new Set([edit.shapeId])]]));
|
|
37801
|
-
assertVisioShapeUnreferenced(roots2, edit.pageId, edit.shapeId, {
|
|
38605
|
+
const frozen = assertVisioShapeUnreferenced(roots2, edit.pageId, edit.shapeId, {
|
|
38606
|
+
check,
|
|
38607
|
+
freeze: true
|
|
38608
|
+
});
|
|
37802
38609
|
shape.parentNode.removeChild(shape);
|
|
38610
|
+
freezeVisioCells(frozen);
|
|
37803
38611
|
return [edit.pageId];
|
|
37804
38612
|
}
|
|
37805
38613
|
if (edit.type === "rotate-shape" || edit.type === "flip-shape") {
|
|
@@ -38737,7 +39545,7 @@ async function recalculatePageFormulas(pkg, pagesPart, pages, paths, dirty, chec
|
|
|
38737
39545
|
}
|
|
38738
39546
|
|
|
38739
39547
|
// visio/edit-page-rename.ts
|
|
38740
|
-
var
|
|
39548
|
+
var escape4 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
38741
39549
|
function localCell(node3) {
|
|
38742
39550
|
const row2 = node3.parentNode;
|
|
38743
39551
|
const section3 = row2?.parentNode;
|
|
@@ -38766,7 +39574,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
|
|
|
38766
39574
|
}
|
|
38767
39575
|
const roots2 = await editableVisioPageRoots(pkg, pagesPart, pages, pagePaths, dirty, check);
|
|
38768
39576
|
const changedCells = [];
|
|
38769
|
-
const prefix2 = new RegExp(`Pages\\[${
|
|
39577
|
+
const prefix2 = new RegExp(`Pages\\[${escape4(oldUniversal)}\\]!`, "gi");
|
|
38770
39578
|
const targetByPath = new Map([...pagePaths].map(([id3, path3]) => [path3, id3]));
|
|
38771
39579
|
for (const [path3, root2] of roots2) {
|
|
38772
39580
|
let changed = false;
|
|
@@ -38800,7 +39608,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
|
|
|
38800
39608
|
if (cell) changedCells.push({ node: node3, cell });
|
|
38801
39609
|
}
|
|
38802
39610
|
} else if (/\bPAGENAME\s*\(/i.test(code)) {
|
|
38803
|
-
if (target2 === pageId2 || !target2 || new RegExp(`Pages\\[${
|
|
39611
|
+
if (target2 === pageId2 || !target2 || new RegExp(`Pages\\[${escape4(oldUniversal)}\\]!`, "i").test(code))
|
|
38804
39612
|
fail(
|
|
38805
39613
|
"EDIT_UNSUPPORTED_PAGE_NAME_FORMULA",
|
|
38806
39614
|
"Complex page-name formula caches cannot be safely refreshed."
|
|
@@ -38850,7 +39658,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
|
|
|
38850
39658
|
for (const changed of changedCells) {
|
|
38851
39659
|
if (changed.node === node3) continue;
|
|
38852
39660
|
const reference2 = new RegExp(
|
|
38853
|
-
`(?:^|[^a-z0-9_.])${
|
|
39661
|
+
`(?:^|[^a-z0-9_.])${escape4(changed.cell)}(?:$|[^a-z0-9_.])`,
|
|
38854
39662
|
"i"
|
|
38855
39663
|
);
|
|
38856
39664
|
if (reference2.test(unquotedVisioFormula(formula2)))
|
|
@@ -38872,7 +39680,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
|
|
|
38872
39680
|
// visio/edit-page-delete.ts
|
|
38873
39681
|
var officeRel = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
38874
39682
|
var pageType = "http://schemas.microsoft.com/visio/2010/relationships/page";
|
|
38875
|
-
var
|
|
39683
|
+
var escape5 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
38876
39684
|
async function deleteVisioPage(pkg, pagesPart, pages, rels, types, pagePaths, parts, dirty, removed, pageId2, check) {
|
|
38877
39685
|
const existing = children2(pages, "Page");
|
|
38878
39686
|
const page = existing.find((node3) => attribute2(node3, "ID") === pageId2);
|
|
@@ -38881,7 +39689,7 @@ async function deleteVisioPage(pkg, pagesPart, pages, rels, types, pagePaths, pa
|
|
|
38881
39689
|
const names = new Set(
|
|
38882
39690
|
["Name", "NameU"].map((key2) => attribute2(page, key2)).filter((value3) => !!value3)
|
|
38883
39691
|
);
|
|
38884
|
-
const reference2 = new RegExp(`Pages\\[(?:${[...names].map(
|
|
39692
|
+
const reference2 = new RegExp(`Pages\\[(?:${[...names].map(escape5).join("|")})\\]!`, "i");
|
|
38885
39693
|
const documentPart2 = await related(pkg, "", "document");
|
|
38886
39694
|
const roots2 = await editableVisioPageRoots(
|
|
38887
39695
|
pkg,
|
|
@@ -39206,7 +40014,7 @@ function createVisioPagePart(parts, pages, pageId2, check) {
|
|
|
39206
40014
|
}
|
|
39207
40015
|
|
|
39208
40016
|
// visio/edit-page-decoration.ts
|
|
39209
|
-
var
|
|
40017
|
+
var escape6 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
39210
40018
|
var name2 = (page) => attribute2(page, "NameU") ?? attribute2(page, "Name") ?? "";
|
|
39211
40019
|
function largestShapeId(root2) {
|
|
39212
40020
|
let largest = 0;
|
|
@@ -39222,9 +40030,9 @@ function removeDecoration(root2, pageName, kind, pageRoots, check) {
|
|
|
39222
40030
|
) : [];
|
|
39223
40031
|
if (!targets.length) return false;
|
|
39224
40032
|
const ids = targets.map((shape) => attribute2(shape, "ID") ?? "");
|
|
39225
|
-
const local = new RegExp(`\\bSheet\\.(?:${ids.map(
|
|
40033
|
+
const local = new RegExp(`\\bSheet\\.(?:${ids.map(escape6).join("|")})!`, "i");
|
|
39226
40034
|
const remote = new RegExp(
|
|
39227
|
-
`Pages\\[${
|
|
40035
|
+
`Pages\\[${escape6(pageName)}\\]!Sheet\\.(?:${ids.map(escape6).join("|")})!`,
|
|
39228
40036
|
"i"
|
|
39229
40037
|
);
|
|
39230
40038
|
for (const connect of children2(root2, "Connects").flatMap((node3) => children2(node3, "Connect")))
|
|
@@ -40058,17 +40866,117 @@ async function formatTarget(pkg, pagePaths, roots2, document, edit, check, insta
|
|
|
40058
40866
|
return true;
|
|
40059
40867
|
}
|
|
40060
40868
|
|
|
40869
|
+
// visio/edit-duplicate-line.ts
|
|
40870
|
+
var ENDS2 = ["BeginX", "BeginY", "EndX", "EndY"];
|
|
40871
|
+
var connects = (root2) => children2(root2, "Connects").flatMap((container) => children2(container, "Connect"));
|
|
40872
|
+
var gluedTargets = (root2, id3) => connects(root2).filter((row2) => attribute2(row2, "FromSheet") === id3).map((row2) => attribute2(row2, "ToSheet") ?? "");
|
|
40873
|
+
function assertGlueDroppable(root2, id3, copied, code = "UNSUPPORTED_DUPLICATE") {
|
|
40874
|
+
if (gluedTargets(root2, id3).some((target2) => copied.has(target2)))
|
|
40875
|
+
fail(code, "A glued connector cannot be copied together with a shape it is glued to yet.");
|
|
40876
|
+
}
|
|
40877
|
+
function assertEndFormulas(read, code) {
|
|
40878
|
+
for (const name3 of ENDS2) {
|
|
40879
|
+
const formula2 = executableCellFormula(attribute2(read(name3), "F"));
|
|
40880
|
+
if (formula2 && !isNativeGlueCell(name3, formula2))
|
|
40881
|
+
fail(code, `${name3} of the line holds a formula that is not native glue.`);
|
|
40882
|
+
}
|
|
40883
|
+
}
|
|
40884
|
+
var isLineSheet2 = (shape) => ENDS2.some((name3) => cells(shape).has(name3));
|
|
40885
|
+
function planLineCopy(shape, code = "UNSUPPORTED_DUPLICATE") {
|
|
40886
|
+
proveLocalLine(shape);
|
|
40887
|
+
assertEndFormulas((name3) => cells(shape).get(name3), code);
|
|
40888
|
+
const local = cells(shape);
|
|
40889
|
+
return { x: numeric(local.get("PinX")), y: numeric(local.get("PinY")) };
|
|
40890
|
+
}
|
|
40891
|
+
var shift2 = (node3, delta, name3) => {
|
|
40892
|
+
if (!node3) fail("UNSUPPORTED_DUPLICATE", `The line has no local ${name3}.`);
|
|
40893
|
+
const value3 = numeric(node3);
|
|
40894
|
+
node3.setAttribute("V", String(Object.is(value3 + delta, -0) ? 0 : value3 + delta));
|
|
40895
|
+
node3.removeAttribute("E");
|
|
40896
|
+
};
|
|
40897
|
+
function finishLineCopy(shape, dx, dy) {
|
|
40898
|
+
const local = cells(shape);
|
|
40899
|
+
for (const name3 of ENDS2) {
|
|
40900
|
+
const node3 = local.get(name3);
|
|
40901
|
+
const formula2 = executableCellFormula(attribute2(node3, "F"));
|
|
40902
|
+
if (formula2 && isNativeGlueCell(name3, formula2)) node3.removeAttribute("F");
|
|
40903
|
+
shift2(node3, name3.endsWith("X") ? dx : dy, name3);
|
|
40904
|
+
}
|
|
40905
|
+
shift2(local.get("PinX"), dx, "PinX");
|
|
40906
|
+
shift2(local.get("PinY"), dy, "PinY");
|
|
40907
|
+
}
|
|
40908
|
+
var isStencilConnector2 = (target2) => ENDS2.some((name3) => instanceCell(target2, name3));
|
|
40909
|
+
function planConnectorCopy(target2, code = "UNSUPPORTED_DUPLICATE") {
|
|
40910
|
+
const local = cells(target2.instance);
|
|
40911
|
+
for (const name3 of [...ENDS2, "PinX", "PinY"]) {
|
|
40912
|
+
const node3 = local.get(name3);
|
|
40913
|
+
if (!node3?.hasAttribute("V") || node3.hasAttribute("E"))
|
|
40914
|
+
fail(code, `The stencil connector has no usable local ${name3}.`);
|
|
40915
|
+
numeric(node3);
|
|
40916
|
+
}
|
|
40917
|
+
assertEndFormulas((name3) => local.get(name3), code);
|
|
40918
|
+
return { x: numeric(local.get("PinX")), y: numeric(local.get("PinY")) };
|
|
40919
|
+
}
|
|
40920
|
+
function finishConnectorCopy(shape, id3, dx, dy) {
|
|
40921
|
+
const local = cells(shape);
|
|
40922
|
+
for (const name3 of ENDS2) shift2(local.get(name3), name3.endsWith("X") ? dx : dy, name3);
|
|
40923
|
+
shift2(local.get("PinX"), dx, "PinX");
|
|
40924
|
+
shift2(local.get("PinY"), dy, "PinY");
|
|
40925
|
+
for (const name3 of ["BegTrigger", "EndTrigger"]) {
|
|
40926
|
+
const node3 = local.get(name3);
|
|
40927
|
+
if (!node3) continue;
|
|
40928
|
+
node3.setAttribute("F", visioGlueTrigger(id3));
|
|
40929
|
+
node3.setAttribute("V", "1");
|
|
40930
|
+
}
|
|
40931
|
+
}
|
|
40932
|
+
var CLEARANCE = 0.25;
|
|
40933
|
+
var endsBox = (shape, dx, dy) => {
|
|
40934
|
+
const local = cells(shape);
|
|
40935
|
+
const x = [numeric(local.get("BeginX")) + dx, numeric(local.get("EndX")) + dx];
|
|
40936
|
+
const y = [numeric(local.get("BeginY")) + dy, numeric(local.get("EndY")) + dy];
|
|
40937
|
+
return {
|
|
40938
|
+
minX: Math.min(...x) - CLEARANCE,
|
|
40939
|
+
maxX: Math.max(...x) + CLEARANCE,
|
|
40940
|
+
minY: Math.min(...y) - CLEARANCE,
|
|
40941
|
+
maxY: Math.max(...y) + CLEARANCE
|
|
40942
|
+
};
|
|
40943
|
+
};
|
|
40944
|
+
function assertConnectorCopyApart(root2, copies, dx, dy, code = "UNSUPPORTED_DUPLICATE") {
|
|
40945
|
+
const boxes = copies.map((shape) => endsBox(shape, dx, dy));
|
|
40946
|
+
for (const container of children2(root2, "Shapes"))
|
|
40947
|
+
for (const other of children2(container, "Shape")) {
|
|
40948
|
+
const local = cells(other);
|
|
40949
|
+
const formula2 = executableCellFormula(attribute2(local.get("BeginX"), "F")) ?? "";
|
|
40950
|
+
if (!/^_WALKGLUE\(/i.test(formula2)) continue;
|
|
40951
|
+
const box5 = endsBox(other, 0, 0);
|
|
40952
|
+
for (const copy8 of boxes)
|
|
40953
|
+
if (copy8.minX <= box5.maxX && box5.minX <= copy8.maxX && copy8.minY <= box5.maxY && box5.minY <= copy8.maxY)
|
|
40954
|
+
fail(
|
|
40955
|
+
code,
|
|
40956
|
+
"The copy of a connector would meet another connector, which Visio lays out again."
|
|
40957
|
+
);
|
|
40958
|
+
}
|
|
40959
|
+
}
|
|
40960
|
+
|
|
40061
40961
|
// visio/edit-instance-duplicate.ts
|
|
40062
|
-
async function planInstanceCopy(pkg, pageId2, sourceRoot, target2, offsetX, offsetY, code = "UNSUPPORTED_DUPLICATE") {
|
|
40962
|
+
async function planInstanceCopy(pkg, pageId2, sourceRoot, target2, offsetX, offsetY, code = "UNSUPPORTED_DUPLICATE", allowConnector = code === "UNSUPPORTED_DUPLICATE") {
|
|
40063
40963
|
const id3 = attribute2(target2.instance, "ID");
|
|
40064
|
-
|
|
40964
|
+
const connector2 = allowConnector && isStencilConnector2(target2);
|
|
40965
|
+
if (!connector2 && (isStencilConnector2(target2) || connectRows(sourceRoot).some((row2) => attribute2(row2, "FromSheet") === id3)))
|
|
40065
40966
|
fail(code, "Lines and connectors that come from a stencil cannot be copied yet.");
|
|
40066
40967
|
await assertInstanceUnlocked(pkg, pageId2, target2, ["LockSelect"], "selection");
|
|
40968
|
+
if (connector2) {
|
|
40969
|
+
const pin2 = planConnectorCopy(target2, code);
|
|
40970
|
+
const x2 = pin2.x + offsetX, y2 = pin2.y + offsetY;
|
|
40971
|
+
if (Math.abs(x2) > 1e6 || Math.abs(y2) > 1e6)
|
|
40972
|
+
fail(code, "Duplicated pins exceed coordinate limits.");
|
|
40973
|
+
return { x: x2, y: y2, connector: connector2 };
|
|
40974
|
+
}
|
|
40067
40975
|
const pin = instancePin(target2);
|
|
40068
40976
|
const x = pin.x + offsetX, y = pin.y + offsetY;
|
|
40069
40977
|
if (Math.abs(x) > 1e6 || Math.abs(y) > 1e6)
|
|
40070
40978
|
fail(code, "Duplicated pins exceed coordinate limits.");
|
|
40071
|
-
return { x, y };
|
|
40979
|
+
return { x, y, connector: connector2 };
|
|
40072
40980
|
}
|
|
40073
40981
|
function finishInstanceCopy(clone, template, x, y, taken, check) {
|
|
40074
40982
|
const mapping = /* @__PURE__ */ new Map();
|
|
@@ -40152,7 +41060,18 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
|
|
|
40152
41060
|
structural ||= !source || await shapeIsStructural(source, template);
|
|
40153
41061
|
}
|
|
40154
41062
|
await assertDuplicateScope(pkg, pagePaths, root2, newIds, check, structural);
|
|
40155
|
-
const
|
|
41063
|
+
const glueTargets = new Set(
|
|
41064
|
+
children2(sourceRoot, "Connects").flatMap(
|
|
41065
|
+
(container2) => children2(container2, "Connect").map((row2) => attribute2(row2, "ToSheet"))
|
|
41066
|
+
)
|
|
41067
|
+
);
|
|
41068
|
+
const indexed = indexCells(detached ? /* @__PURE__ */ new Map([[sourcePageId, sourceRoot]]) : roots2, {
|
|
41069
|
+
check,
|
|
41070
|
+
scope: "affected",
|
|
41071
|
+
glueShapes: new Set(
|
|
41072
|
+
pageShapes(sourceRoot).filter((shape) => glueTargets.has(attribute2(shape, "ID")))
|
|
41073
|
+
)
|
|
41074
|
+
});
|
|
40156
41075
|
const evaluate = createVisioCellEvaluator(indexed, { check }, true);
|
|
40157
41076
|
const containers = children2(root2, "Shapes");
|
|
40158
41077
|
if (containers.length > 1) fail("INVALID_SHAPE_ID", "Duplicate Shapes containers.");
|
|
@@ -40166,6 +41085,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
|
|
|
40166
41085
|
if (value3 !== void 0) occupied.add(value3.toLowerCase());
|
|
40167
41086
|
}
|
|
40168
41087
|
const plans = [];
|
|
41088
|
+
const copied = new Set(edit.copies.map((copy8) => copy8.shapeId));
|
|
40169
41089
|
let cloneNodes = 0, cloneCharacters = buildXml(root2).length;
|
|
40170
41090
|
const size3 = (source) => {
|
|
40171
41091
|
cloneNodes += source.getElementsByTagName("*").length + 1;
|
|
@@ -40182,6 +41102,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
|
|
|
40182
41102
|
"UNSUPPORTED_DUPLICATE"
|
|
40183
41103
|
);
|
|
40184
41104
|
if (stencil) {
|
|
41105
|
+
assertGlueDroppable(sourceRoot, copy8.shapeId, copied);
|
|
40185
41106
|
const pin = await planInstanceCopy(
|
|
40186
41107
|
pkg,
|
|
40187
41108
|
edit.pageId,
|
|
@@ -40194,18 +41115,33 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
|
|
|
40194
41115
|
plans.push({
|
|
40195
41116
|
source: stencil.instance,
|
|
40196
41117
|
id: copy8.newShapeId,
|
|
40197
|
-
|
|
41118
|
+
x: pin.x,
|
|
41119
|
+
y: pin.y,
|
|
41120
|
+
...pin.connector ? { connector: true } : {},
|
|
40198
41121
|
template: stencil.template
|
|
40199
41122
|
});
|
|
40200
41123
|
continue;
|
|
40201
41124
|
}
|
|
41125
|
+
const line2 = pageShapes(sourceRoot).find((shape) => attribute2(shape, "ID") === copy8.shapeId);
|
|
41126
|
+
if (line2 && !line2.hasAttribute("Master") && isLineSheet2(line2)) {
|
|
41127
|
+
assertCloneLeaf(line2);
|
|
41128
|
+
assertUnlayeredShape(line2, document);
|
|
41129
|
+
assertShapeLocks(line2, document, ["LockSelect"]);
|
|
41130
|
+
assertGlueDroppable(sourceRoot, copy8.shapeId, copied);
|
|
41131
|
+
const pin = planLineCopy(line2);
|
|
41132
|
+
if (Math.abs(pin.x + edit.offsetX) > 1e6 || Math.abs(pin.y + edit.offsetY) > 1e6)
|
|
41133
|
+
fail("UNSUPPORTED_DUPLICATE", "Duplicated pins exceed coordinate limits.");
|
|
41134
|
+
size3(line2);
|
|
41135
|
+
plans.push({ source: line2, id: copy8.newShapeId, x: pin.x, y: pin.y, line: true });
|
|
41136
|
+
continue;
|
|
41137
|
+
}
|
|
40202
41138
|
const source = admitted(sourceRoot, copy8.shapeId);
|
|
40203
41139
|
assertCloneLeaf(source);
|
|
40204
41140
|
assertUnlayeredShape(source, document);
|
|
40205
41141
|
assertShapeLocks(source, document, ["LockSelect"]);
|
|
40206
|
-
for (const
|
|
40207
|
-
for (const connection of children2(
|
|
40208
|
-
if (
|
|
41142
|
+
for (const connects2 of children2(sourceRoot, "Connects"))
|
|
41143
|
+
for (const connection of children2(connects2, "Connect"))
|
|
41144
|
+
if (attribute2(connection, "FromSheet") === copy8.shapeId)
|
|
40209
41145
|
fail("UNSUPPORTED_DUPLICATE", "Glued shapes cannot be duplicated safely.");
|
|
40210
41146
|
const x = numeric(formattingCell(source, "PinX")), y = numeric(formattingCell(source, "PinY"));
|
|
40211
41147
|
for (const [name3, offset] of [
|
|
@@ -40220,6 +41156,9 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
|
|
|
40220
41156
|
size3(source);
|
|
40221
41157
|
plans.push({ source, id: copy8.newShapeId, x: x + edit.offsetX, y: y + edit.offsetY });
|
|
40222
41158
|
}
|
|
41159
|
+
const connectorSources = plans.filter((plan) => plan.connector).map((plan) => plan.source);
|
|
41160
|
+
if (connectorSources.length)
|
|
41161
|
+
assertConnectorCopyApart(root2, connectorSources, edit.offsetX, edit.offsetY);
|
|
40223
41162
|
const order = new Map(
|
|
40224
41163
|
children2(children2(sourceRoot, "Shapes")[0], "Shape").map((source, index2) => [source, index2])
|
|
40225
41164
|
);
|
|
@@ -40230,6 +41169,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
|
|
|
40230
41169
|
check();
|
|
40231
41170
|
const shape = root2.ownerDocument.importNode(plan.source, true);
|
|
40232
41171
|
copyIdentity(shape, plan.id, names);
|
|
41172
|
+
if (plan.line) finishLineCopy(shape, edit.offsetX, edit.offsetY);
|
|
40233
41173
|
for (const node3 of [shape, ...Array.from(shape.getElementsByTagName("*"))]) {
|
|
40234
41174
|
const source = executableCellFormula(attribute2(node3, "F"));
|
|
40235
41175
|
if (!source) continue;
|
|
@@ -40248,6 +41188,15 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
|
|
|
40248
41188
|
)
|
|
40249
41189
|
);
|
|
40250
41190
|
}
|
|
41191
|
+
if (plan.line) {
|
|
41192
|
+
container.appendChild(shape);
|
|
41193
|
+
continue;
|
|
41194
|
+
}
|
|
41195
|
+
if (plan.connector) {
|
|
41196
|
+
finishConnectorCopy(shape, plan.id, edit.offsetX, edit.offsetY);
|
|
41197
|
+
container.appendChild(shape);
|
|
41198
|
+
continue;
|
|
41199
|
+
}
|
|
40251
41200
|
if (plan.template) {
|
|
40252
41201
|
for (const id3 of newIds) ids.add(id3);
|
|
40253
41202
|
finishInstanceCopy(shape, plan.template, plan.x, plan.y, ids, check);
|
|
@@ -40264,7 +41213,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
|
|
|
40264
41213
|
}
|
|
40265
41214
|
container.appendChild(shape);
|
|
40266
41215
|
}
|
|
40267
|
-
const local = plans.filter((plan) => !plan.template);
|
|
41216
|
+
const local = plans.filter((plan) => !plan.template && !plan.line);
|
|
40268
41217
|
if (changed.length) {
|
|
40269
41218
|
await assertGeometryPackageScope(
|
|
40270
41219
|
pkg,
|
|
@@ -40298,6 +41247,9 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
|
|
|
40298
41247
|
}
|
|
40299
41248
|
const dirty = /* @__PURE__ */ new Set([edit.pageId]);
|
|
40300
41249
|
for (const id3 of recalculateVisioCells(roots2, changed, { check })) dirty.add(id3);
|
|
41250
|
+
for (const plan of plans)
|
|
41251
|
+
if (!plan.line && !plan.connector)
|
|
41252
|
+
for (const id3 of rerouteBlockedConnectors(roots2, edit.pageId, plan.id, check)) dirty.add(id3);
|
|
40301
41253
|
return [...dirty];
|
|
40302
41254
|
}
|
|
40303
41255
|
function assertCloneLeaf(source) {
|
|
@@ -40628,9 +41580,10 @@ function deleteVisioShapes(roots2, document, edits, check, instances = /* @__PUR
|
|
|
40628
41580
|
}
|
|
40629
41581
|
releaseStencilGlue(roots2, removed);
|
|
40630
41582
|
releaseDeletedGlue(roots2, removed);
|
|
40631
|
-
assertVisioShapesUnreferenced(roots2, removed, { check });
|
|
41583
|
+
const frozen = assertVisioShapesUnreferenced(roots2, removed, { check, freeze: true });
|
|
40632
41584
|
check();
|
|
40633
41585
|
for (const shape of shapes) shape.parentNode.removeChild(shape);
|
|
41586
|
+
freezeVisioCells(frozen);
|
|
40634
41587
|
for (const pageId2 of removed.keys())
|
|
40635
41588
|
for (const container of children2(roots2.get(pageId2), "Connects"))
|
|
40636
41589
|
if (!children2(container, "Connect").length) container.parentNode.removeChild(container);
|
|
@@ -40659,8 +41612,8 @@ function admittedShape(root2, document, shapeId2) {
|
|
|
40659
41612
|
if (["1", "true"].includes(attribute2(shape, "Del") ?? "")) refuse3("The shape is deleted.");
|
|
40660
41613
|
const local = cells(shape);
|
|
40661
41614
|
if (isLineSheet(local)) refuse3("Lines and connectors (1D shapes) cannot change shape.");
|
|
40662
|
-
for (const
|
|
40663
|
-
for (const connect of children2(
|
|
41615
|
+
for (const connects2 of children2(root2, "Connects"))
|
|
41616
|
+
for (const connect of children2(connects2, "Connect"))
|
|
40664
41617
|
if (["FromSheet", "ToSheet"].some((name3) => attribute2(connect, name3) === shapeId2))
|
|
40665
41618
|
refuse3("Glued connectors would need rerouting, which is not supported yet.");
|
|
40666
41619
|
if (children2(shape, "Section").some((section3) => attribute2(section3, "N") === "Controls"))
|
|
@@ -42103,8 +43056,8 @@ async function captureVisioClipboard(input, pageId2, shapeIds2, options2 = {}) {
|
|
|
42103
43056
|
numeric(formattingCell(source, name3));
|
|
42104
43057
|
evaluate(key({ pageId: pageId2, shapeId: id3, cell: name3 }));
|
|
42105
43058
|
}
|
|
42106
|
-
for (const
|
|
42107
|
-
for (const connection of children2(
|
|
43059
|
+
for (const connects2 of children2(root2, "Connects"))
|
|
43060
|
+
for (const connection of children2(connects2, "Connect"))
|
|
42108
43061
|
if (["FromSheet", "ToSheet"].some((name3) => attribute2(connection, name3) === id3))
|
|
42109
43062
|
fail("UNSUPPORTED_CLIPBOARD", "Glued shapes cannot be captured safely.");
|
|
42110
43063
|
}
|
|
@@ -42645,8 +43598,8 @@ function assertUnreferenced3(roots2, shapeId2, check) {
|
|
|
42645
43598
|
if (reference2.test(executableCellFormula(attribute2(cell, "F")) ?? ""))
|
|
42646
43599
|
fail("UNSUPPORTED_GUIDE_EDIT", "A shape formula refers to this guide.");
|
|
42647
43600
|
}
|
|
42648
|
-
for (const
|
|
42649
|
-
for (const row2 of children2(
|
|
43601
|
+
for (const connects2 of children2(root2, "Connects"))
|
|
43602
|
+
for (const row2 of children2(connects2, "Connect"))
|
|
42650
43603
|
if (attribute2(row2, "ToSheet") === shapeId2 || attribute2(row2, "FromSheet") === shapeId2)
|
|
42651
43604
|
fail("UNSUPPORTED_GUIDE_EDIT", "Shapes are glued to this guide.");
|
|
42652
43605
|
}
|
|
@@ -43023,6 +43976,7 @@ async function editVsdxTransaction(input, edits, options2, clock = {
|
|
|
43023
43976
|
if (deleteOnly)
|
|
43024
43977
|
for (const pageId2 of deleteVisioShapes(roots2, document, deletions, check, instanceDeletes))
|
|
43025
43978
|
dirty.set(pages.get(pageId2), roots2.get(pageId2));
|
|
43979
|
+
const formulaDiagnostics = [];
|
|
43026
43980
|
const noteTextSize = async (target2, root2) => {
|
|
43027
43981
|
if (await measuresOwnText(root2, target2.shapeId, masterTemplate(pkg), check))
|
|
43028
43982
|
clock.textSizes.push({ pageId: target2.pageId, shapeId: target2.shapeId });
|
|
@@ -43038,7 +43992,15 @@ async function editVsdxTransaction(input, edits, options2, clock = {
|
|
|
43038
43992
|
roots2.set(command2.pageId, root2);
|
|
43039
43993
|
}
|
|
43040
43994
|
if (command2.type === "replace-plain-text" || command2.type === "replace-text-ranges") {
|
|
43041
|
-
if (await (command2.type === "replace-plain-text" ? replaceScopedPlainText(
|
|
43995
|
+
if (await (command2.type === "replace-plain-text" ? replaceScopedPlainText(
|
|
43996
|
+
pkg,
|
|
43997
|
+
new Set(pages.values()),
|
|
43998
|
+
roots2,
|
|
43999
|
+
document,
|
|
44000
|
+
command2,
|
|
44001
|
+
check,
|
|
44002
|
+
formulaDiagnostics
|
|
44003
|
+
) : replaceScopedTextRanges(pkg, new Set(pages.values()), roots2, document, command2, check))) {
|
|
43042
44004
|
dirty.set(path3, root2);
|
|
43043
44005
|
textChanged = true;
|
|
43044
44006
|
await noteTextSize(command2, root2);
|
|
@@ -43184,6 +44146,7 @@ async function editVsdxTransaction(input, edits, options2, clock = {
|
|
|
43184
44146
|
bytes,
|
|
43185
44147
|
changedParts: [...dirty.keys()],
|
|
43186
44148
|
diagnostics: [
|
|
44149
|
+
...formulaDiagnostics,
|
|
43187
44150
|
...pasteChanged ? [
|
|
43188
44151
|
{
|
|
43189
44152
|
code: "edit-paste-experimental",
|
|
@@ -47014,7 +47977,7 @@ function checkVisioDiagram(document, options2 = {}) {
|
|
|
47014
47977
|
}
|
|
47015
47978
|
|
|
47016
47979
|
// visio/ui/shape-report.ts
|
|
47017
|
-
var
|
|
47980
|
+
var TYPES3 = {
|
|
47018
47981
|
shape: "Shape",
|
|
47019
47982
|
group: "Group",
|
|
47020
47983
|
connector: "1-D shape",
|
|
@@ -47060,7 +48023,7 @@ function visioShapeReport(document, options2 = {}) {
|
|
|
47060
48023
|
pageId: page.id,
|
|
47061
48024
|
id: shape.id,
|
|
47062
48025
|
name: shape.name,
|
|
47063
|
-
type:
|
|
48026
|
+
type: TYPES3[shape.kind],
|
|
47064
48027
|
master: shape.masterId ?? "",
|
|
47065
48028
|
width: round5(shape.width),
|
|
47066
48029
|
height: round5(shape.height),
|