ooxml-core 1.20.0 → 1.22.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/README.md +35 -0
- package/dist/{PptxHandler-TEKISCJO.cjs → PptxHandler-DNSXWTQV.cjs} +3 -3
- package/dist/{PptxHandler-FYD7IYXT.mjs → PptxHandler-FSKKPZZC.mjs} +3 -3
- package/dist/PptxHandler-H7MEWJJJ.mjs +4 -0
- package/dist/{PresentationBuilder-IMB4DVRN.mjs → PresentationBuilder-7TSENZTX.mjs} +2 -2
- package/dist/{PresentationBuilder-NCKASKXU.cjs → PresentationBuilder-A5NI35VN.cjs} +5 -5
- package/dist/{PresentationBuilder-EYI6Z2JP.mjs → PresentationBuilder-RIJWQSEU.mjs} +3 -3
- package/dist/automation/docx-forms.d.ts +26 -0
- package/dist/automation/docx-forms.d.ts.map +1 -0
- package/dist/automation/index.cjs +39159 -14352
- package/dist/automation/index.d.ts +5 -0
- package/dist/automation/index.d.ts.map +1 -1
- package/dist/automation/index.mjs +39145 -14353
- package/dist/automation/node.cjs +37 -0
- package/dist/automation/node.d.ts +32 -1
- package/dist/automation/node.d.ts.map +1 -1
- package/dist/automation/node.mjs +36 -1
- package/dist/automation/proposal.d.ts +25 -0
- package/dist/automation/proposal.d.ts.map +1 -0
- package/dist/automation/tools/define.d.ts +27 -0
- package/dist/automation/tools/define.d.ts.map +1 -0
- package/dist/automation/tools/docx-tools.d.ts +4 -0
- package/dist/automation/tools/docx-tools.d.ts.map +1 -0
- package/dist/automation/tools/index.d.ts +16 -0
- package/dist/automation/tools/index.d.ts.map +1 -0
- package/dist/automation/tools/types.d.ts +52 -0
- package/dist/automation/tools/types.d.ts.map +1 -0
- package/dist/automation/tools/visio-tools.d.ts +4 -0
- package/dist/automation/tools/visio-tools.d.ts.map +1 -0
- package/dist/automation/tools/xlsx-tools.d.ts +8 -0
- package/dist/automation/tools/xlsx-tools.d.ts.map +1 -0
- package/dist/automation/xlsx-edits.d.ts +88 -0
- package/dist/automation/xlsx-edits.d.ts.map +1 -0
- package/dist/automation/xlsx-proposal.d.ts +34 -0
- package/dist/automation/xlsx-proposal.d.ts.map +1 -0
- package/dist/automation/xlsx.d.ts +10 -5
- package/dist/automation/xlsx.d.ts.map +1 -1
- package/dist/chart/axis-range.d.ts.map +1 -1
- package/dist/chart/bubble-radius.d.ts +0 -5
- package/dist/chart/bubble-radius.d.ts.map +1 -1
- package/dist/chart/extent.d.ts +9 -0
- package/dist/chart/extent.d.ts.map +1 -0
- package/dist/chart/histogram-binning.d.ts.map +1 -1
- package/dist/chart/index.cjs +56 -18
- package/dist/chart/index.mjs +56 -18
- package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-legend.d.ts.map +1 -1
- package/dist/chart/render/chart-view-ex.d.ts.map +1 -1
- package/dist/chart/render/chart-view.d.ts.map +1 -1
- package/dist/chart/trendline-fit.d.ts.map +1 -1
- package/dist/{chunk-3IENHIFD.cjs → chunk-4LZIUJI3.cjs} +52 -12
- package/dist/{chunk-LEV2SVMK.mjs → chunk-4QPOJCJG.mjs} +45 -8
- package/dist/{chunk-CC5UNZOO.mjs → chunk-6IIMI5RS.mjs} +52 -12
- package/dist/{chunk-MN27HKHM.mjs → chunk-BA7Z6ATM.mjs} +5 -5
- package/dist/{chunk-LVM3IZJ2.mjs → chunk-DLFMCZZT.mjs} +1 -1
- package/dist/{chunk-M4XLF4R7.mjs → chunk-GBKBR4CX.mjs} +20 -8
- package/dist/{chunk-NXKATFM5.cjs → chunk-HL3FBJ6X.cjs} +1065 -1016
- package/dist/{chunk-WXY5EDGT.mjs → chunk-LF5E5ZOH.mjs} +51 -2
- package/dist/chunk-MHNETXQB.mjs +1 -0
- package/dist/{chunk-MNXKRXFB.mjs → chunk-Q5PKBQXH.mjs} +52 -3
- package/dist/{chunk-GQYQQ3GA.mjs → chunk-VQF6HQEE.mjs} +1 -1
- package/dist/collab/embedding.d.ts +108 -0
- package/dist/collab/embedding.d.ts.map +1 -0
- package/dist/collab/index.cjs +423 -293
- package/dist/collab/index.d.ts +2 -0
- package/dist/collab/index.d.ts.map +1 -1
- package/dist/collab/index.mjs +415 -294
- package/dist/collab/webrtc-provider.d.ts +21 -0
- package/dist/collab/webrtc-provider.d.ts.map +1 -0
- package/dist/color/theme-palette.d.ts +5 -1
- package/dist/color/theme-palette.d.ts.map +1 -1
- package/dist/crypto/index.cjs +27 -2
- package/dist/crypto/index.mjs +27 -2
- package/dist/diagram/index.cjs +31 -3
- package/dist/diagram/index.mjs +31 -3
- package/dist/docx/block-parser.d.ts.map +1 -1
- package/dist/docx/cell-blocks.d.ts +7 -1
- package/dist/docx/cell-blocks.d.ts.map +1 -1
- package/dist/docx/content-control-edit.d.ts +14 -0
- package/dist/docx/content-control-edit.d.ts.map +1 -1
- package/dist/docx/content-control-model.d.ts +8 -0
- package/dist/docx/content-control-model.d.ts.map +1 -1
- package/dist/docx/content-control-values.d.ts +20 -0
- package/dist/docx/content-control-values.d.ts.map +1 -0
- package/dist/docx/content-control.d.ts +7 -1
- package/dist/docx/content-control.d.ts.map +1 -1
- package/dist/docx/element-order.d.ts +10 -5
- package/dist/docx/element-order.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +3861 -1379
- package/dist/docx/embedded.mjs +3861 -1379
- package/dist/docx/field-instruction.d.ts +22 -0
- package/dist/docx/field-instruction.d.ts.map +1 -0
- package/dist/docx/form-field-model.d.ts +48 -0
- package/dist/docx/form-field-model.d.ts.map +1 -0
- package/dist/docx/form-fields.d.ts +31 -0
- package/dist/docx/form-fields.d.ts.map +1 -0
- package/dist/docx/form-fill-fields.d.ts +61 -0
- package/dist/docx/form-fill-fields.d.ts.map +1 -0
- package/dist/docx/form-fill-labels.d.ts +8 -0
- package/dist/docx/form-fill-labels.d.ts.map +1 -0
- package/dist/docx/form-fill-sites.d.ts +59 -0
- package/dist/docx/form-fill-sites.d.ts.map +1 -0
- package/dist/docx/form-fill-values.d.ts +28 -0
- package/dist/docx/form-fill-values.d.ts.map +1 -0
- package/dist/docx/form-fill-write.d.ts +26 -0
- package/dist/docx/form-fill-write.d.ts.map +1 -0
- package/dist/docx/glossary.d.ts +15 -0
- package/dist/docx/glossary.d.ts.map +1 -0
- package/dist/docx/index.cjs +5929 -3153
- package/dist/docx/index.d.ts +7 -0
- package/dist/docx/index.d.ts.map +1 -1
- package/dist/docx/index.mjs +5913 -3154
- package/dist/docx/inline-annotations.d.ts +21 -0
- package/dist/docx/inline-annotations.d.ts.map +1 -0
- package/dist/docx/inline-container-markers.d.ts +14 -0
- package/dist/docx/inline-container-markers.d.ts.map +1 -0
- package/dist/docx/inline-containers.d.ts +54 -0
- package/dist/docx/inline-containers.d.ts.map +1 -0
- package/dist/docx/inline-form-field-bookmarks.d.ts +15 -0
- package/dist/docx/inline-form-field-bookmarks.d.ts.map +1 -0
- package/dist/docx/inline-marker-positions.d.ts +15 -0
- package/dist/docx/inline-marker-positions.d.ts.map +1 -0
- package/dist/docx/inline-markers.d.ts +63 -0
- package/dist/docx/inline-markers.d.ts.map +1 -0
- package/dist/docx/inline-slots.d.ts +24 -0
- package/dist/docx/inline-slots.d.ts.map +1 -0
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +1176 -563
- package/dist/docx/layout/index.d.ts +2 -1
- package/dist/docx/layout/index.d.ts.map +1 -1
- package/dist/docx/layout/index.mjs +1175 -564
- package/dist/docx/layout/input.d.ts +5 -1
- package/dist/docx/layout/input.d.ts.map +1 -1
- package/dist/docx/layout/page-style-refs.d.ts +21 -0
- package/dist/docx/layout/page-style-refs.d.ts.map +1 -0
- package/dist/docx/layout/paragraph-fragments.d.ts.map +1 -1
- package/dist/docx/layout/result.d.ts +1 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/layout/tab-stops.d.ts +8 -1
- package/dist/docx/layout/tab-stops.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +3969 -1487
- package/dist/docx/load/index.mjs +3969 -1487
- package/dist/docx/model-run.d.ts +24 -2
- package/dist/docx/model-run.d.ts.map +1 -1
- package/dist/docx/model.d.ts +5 -0
- package/dist/docx/model.d.ts.map +1 -1
- package/dist/docx/numbering-format.d.ts.map +1 -1
- package/dist/docx/parse-warnings.d.ts.map +1 -1
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/run-segmentation.d.ts +11 -0
- package/dist/docx/run-segmentation.d.ts.map +1 -0
- package/dist/docx/save.d.ts.map +1 -1
- package/dist/docx/section-model.d.ts +5 -0
- package/dist/docx/section-model.d.ts.map +1 -1
- package/dist/docx/sections.d.ts +4 -2
- package/dist/docx/sections.d.ts.map +1 -1
- package/dist/docx/settings.d.ts +9 -0
- package/dist/docx/settings.d.ts.map +1 -1
- package/dist/docx/special-characters.d.ts +34 -0
- package/dist/docx/special-characters.d.ts.map +1 -0
- package/dist/docx/style-ref-fields.d.ts +40 -0
- package/dist/docx/style-ref-fields.d.ts.map +1 -0
- package/dist/docx/style-ref.d.ts +85 -0
- package/dist/docx/style-ref.d.ts.map +1 -0
- package/dist/docx/table-model.d.ts +2 -2
- package/dist/docx/table-model.d.ts.map +1 -1
- package/dist/docx/ui/break-note-schema.d.ts.map +1 -1
- package/dist/docx/ui/content-control-commands.d.ts +20 -8
- package/dist/docx/ui/content-control-commands.d.ts.map +1 -1
- package/dist/docx/ui/content-control-guard.d.ts +4 -1
- package/dist/docx/ui/content-control-guard.d.ts.map +1 -1
- package/dist/docx/ui/content-control-paste.d.ts +23 -0
- package/dist/docx/ui/content-control-paste.d.ts.map +1 -0
- package/dist/docx/ui/content-control-rows.d.ts +15 -0
- package/dist/docx/ui/content-control-rows.d.ts.map +1 -0
- package/dist/docx/ui/content-control-sources.d.ts +12 -0
- package/dist/docx/ui/content-control-sources.d.ts.map +1 -0
- package/dist/docx/ui/content-control-spans.d.ts +29 -6
- package/dist/docx/ui/content-control-spans.d.ts.map +1 -1
- package/dist/docx/ui/content-control-temporary.d.ts +10 -0
- package/dist/docx/ui/content-control-temporary.d.ts.map +1 -0
- package/dist/docx/ui/form-field-commands.d.ts +41 -0
- package/dist/docx/ui/form-field-commands.d.ts.map +1 -0
- package/dist/docx/ui/form-field-guard.d.ts +24 -0
- package/dist/docx/ui/form-field-guard.d.ts.map +1 -0
- package/dist/docx/ui/form-text-blank.d.ts +18 -0
- package/dist/docx/ui/form-text-blank.d.ts.map +1 -0
- package/dist/docx/ui/index.cjs +9276 -7132
- package/dist/docx/ui/index.d.ts +5 -0
- package/dist/docx/ui/index.d.ts.map +1 -1
- package/dist/docx/ui/index.mjs +9259 -7137
- package/dist/docx/ui/positional-tab-input.d.ts +7 -0
- package/dist/docx/ui/positional-tab-input.d.ts.map +1 -0
- package/dist/docx/ui/run-compare.d.ts.map +1 -1
- package/dist/docx/ui/run-extra-mark.d.ts +1 -1
- package/dist/docx/ui/run-extra-mark.d.ts.map +1 -1
- package/dist/docx/ui/schema-marks.d.ts +1 -1
- package/dist/docx/ui/schema-marks.d.ts.map +1 -1
- package/dist/docx/ui/symbol-font.d.ts +4 -0
- package/dist/docx/ui/symbol-font.d.ts.map +1 -0
- package/dist/docx/ui/yjs-collaboration.d.ts +12 -1
- package/dist/docx/ui/yjs-collaboration.d.ts.map +1 -1
- package/dist/docx/write-block-placement.d.ts +7 -0
- package/dist/docx/write-block-placement.d.ts.map +1 -1
- package/dist/docx/write-content-control.d.ts +6 -0
- package/dist/docx/write-content-control.d.ts.map +1 -1
- package/dist/docx/write-header-footer.d.ts +6 -2
- package/dist/docx/write-header-footer.d.ts.map +1 -1
- package/dist/docx/write-inline.d.ts +12 -16
- package/dist/docx/write-inline.d.ts.map +1 -1
- package/dist/docx/write-paragraph.d.ts.map +1 -1
- package/dist/docx/write-revisions.d.ts.map +1 -1
- package/dist/docx/write-run.d.ts.map +1 -1
- package/dist/docx/write-section-properties.d.ts +5 -0
- package/dist/docx/write-section-properties.d.ts.map +1 -0
- package/dist/docx/write-sections.d.ts.map +1 -1
- package/dist/docx/write-table-controls.d.ts +15 -0
- package/dist/docx/write-table-controls.d.ts.map +1 -0
- package/dist/docx/write-table-properties.d.ts.map +1 -1
- package/dist/docx/write-table.d.ts.map +1 -1
- package/dist/docx/write.d.ts.map +1 -1
- package/dist/docx/xml.d.ts +6 -0
- package/dist/docx/xml.d.ts.map +1 -1
- package/dist/drawingml/index.cjs +31 -3
- package/dist/drawingml/index.mjs +31 -3
- package/dist/index.cjs +77 -26
- package/dist/index.mjs +77 -26
- package/dist/math/index.cjs +27 -2
- package/dist/math/index.mjs +27 -2
- package/dist/opc/index.cjs +51 -11
- package/dist/opc/index.mjs +51 -11
- package/dist/opc/zip-folders.d.ts +11 -0
- package/dist/opc/zip-folders.d.ts.map +1 -0
- package/dist/opc/zip-limits.d.ts +9 -0
- package/dist/opc/zip-limits.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +28818 -7388
- package/dist/pptx/automation/index.d.ts +93 -3
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +740 -63
- package/dist/pptx/automation/schemas/chart-formatting-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/chart-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/chart-user-shape-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/element-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/export-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/geometry-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/hyperlink-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/index.mjs +1 -0
- package/dist/pptx/automation/schemas/json-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/layout-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/lock-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/metadata-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/ole-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/presentation-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/section-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/slide-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/smartart-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/table-style-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/template-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/theme-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/validation-schemas.d.ts +1 -1
- package/dist/pptx/chunks/{index-CgFX0T7b.d.ts → index-CPhsd7Df.d.ts} +9 -1
- package/dist/pptx/chunks/{index-CgFX0T7b.d.ts.map → index-CPhsd7Df.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-qwVYoFn6.d.ts → index-Q5mM8kIR.d.ts} +2 -2
- package/dist/pptx/chunks/{index-qwVYoFn6.d.ts.map → index-Q5mM8kIR.d.ts.map} +1 -1
- package/dist/pptx/chunks/{schemas-CWr181Wx.d.ts → schemas-fuDGetRe.d.ts} +2 -2
- package/dist/pptx/chunks/{schemas-CWr181Wx.d.ts.map → schemas-fuDGetRe.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +116 -17
- package/dist/pptx/cli/index.mjs +5 -5
- package/dist/pptx/converter/index.cjs +12 -3
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +3 -3
- 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 +116 -17
- package/dist/pptx/index.d.ts +2 -2
- package/dist/pptx/index.mjs +6 -6
- package/dist/pptx/signature-node/index.cjs +20 -8
- package/dist/pptx/signature-node/index.mjs +2 -2
- package/dist/teams/index.cjs +105 -70
- package/dist/teams/index.mjs +105 -70
- package/dist/text/text-diff.d.ts +15 -0
- package/dist/text/text-diff.d.ts.map +1 -0
- package/dist/visio/collab/bind.d.ts +44 -0
- package/dist/visio/collab/bind.d.ts.map +1 -0
- package/dist/visio/collab/compose.d.ts +15 -0
- package/dist/visio/collab/compose.d.ts.map +1 -0
- package/dist/visio/collab/index.cjs +1194 -0
- package/dist/visio/collab/index.d.ts +8 -0
- package/dist/visio/collab/index.d.ts.map +1 -0
- package/dist/visio/collab/index.mjs +1152 -0
- package/dist/visio/collab/keys.d.ts +22 -0
- package/dist/visio/collab/keys.d.ts.map +1 -0
- package/dist/visio/collab/order.d.ts +11 -0
- package/dist/visio/collab/order.d.ts.map +1 -0
- package/dist/visio/collab/package.d.ts +37 -0
- package/dist/visio/collab/package.d.ts.map +1 -0
- package/dist/visio/collab/read.d.ts +41 -0
- package/dist/visio/collab/read.d.ts.map +1 -0
- package/dist/visio/collab/scan.d.ts +28 -0
- package/dist/visio/collab/scan.d.ts.map +1 -0
- package/dist/visio/collab/schema.d.ts +70 -0
- package/dist/visio/collab/schema.d.ts.map +1 -0
- package/dist/visio/collab/snapshot.d.ts +61 -0
- package/dist/visio/collab/snapshot.d.ts.map +1 -0
- package/dist/visio/collab/write.d.ts +20 -0
- package/dist/visio/collab/write.d.ts.map +1 -0
- package/dist/visio/index.cjs +159 -39
- package/dist/visio/index.mjs +159 -39
- package/dist/visio/ui/collab-options.d.ts +24 -0
- package/dist/visio/ui/collab-options.d.ts.map +1 -0
- package/dist/visio/ui/collab-presence.d.ts +31 -0
- package/dist/visio/ui/collab-presence.d.ts.map +1 -0
- package/dist/visio/ui/contract.d.ts +9 -3
- package/dist/visio/ui/contract.d.ts.map +1 -1
- package/dist/visio/ui/document-history.d.ts +3 -1
- package/dist/visio/ui/document-history.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +284 -95
- package/dist/visio/ui/index.d.ts +2 -0
- package/dist/visio/ui/index.d.ts.map +1 -1
- package/dist/visio/ui/index.mjs +278 -95
- package/dist/xlsx/collab/index.cjs +8 -3
- package/dist/xlsx/collab/index.mjs +8 -3
- package/dist/xlsx/compare/cells.d.ts +22 -0
- package/dist/xlsx/compare/cells.d.ts.map +1 -0
- package/dist/xlsx/compare/compare.d.ts +12 -0
- package/dist/xlsx/compare/compare.d.ts.map +1 -0
- package/dist/xlsx/compare/conditional.d.ts +7 -0
- package/dist/xlsx/compare/conditional.d.ts.map +1 -0
- package/dist/xlsx/compare/format-key.d.ts +34 -0
- package/dist/xlsx/compare/format-key.d.ts.map +1 -0
- package/dist/xlsx/compare/group.d.ts +8 -0
- package/dist/xlsx/compare/group.d.ts.map +1 -0
- package/dist/xlsx/compare/index.d.ts +5 -0
- package/dist/xlsx/compare/index.d.ts.map +1 -0
- package/dist/xlsx/compare/rich-text.d.ts +7 -0
- package/dist/xlsx/compare/rich-text.d.ts.map +1 -0
- package/dist/xlsx/compare/sheets.d.ts +22 -0
- package/dist/xlsx/compare/sheets.d.ts.map +1 -0
- package/dist/xlsx/compare/structure.d.ts +11 -0
- package/dist/xlsx/compare/structure.d.ts.map +1 -0
- package/dist/xlsx/compare/text.d.ts +8 -0
- package/dist/xlsx/compare/text.d.ts.map +1 -0
- package/dist/xlsx/compare/types.d.ts +173 -0
- package/dist/xlsx/compare/types.d.ts.map +1 -0
- package/dist/xlsx/edit/cell-values.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard-html.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard-text.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard.d.ts.map +1 -1
- package/dist/xlsx/edit/clone-cell.d.ts +9 -0
- package/dist/xlsx/edit/clone-cell.d.ts.map +1 -0
- package/dist/xlsx/edit/history.d.ts +8 -3
- package/dist/xlsx/edit/history.d.ts.map +1 -1
- package/dist/xlsx/edit/timelines.d.ts.map +1 -1
- package/dist/xlsx/formula/change-areas.d.ts +9 -0
- package/dist/xlsx/formula/change-areas.d.ts.map +1 -0
- package/dist/xlsx/formula/engine-prepare.d.ts +8 -0
- package/dist/xlsx/formula/engine-prepare.d.ts.map +1 -1
- package/dist/xlsx/formula/engine.d.ts.map +1 -1
- package/dist/xlsx/formula/spill.d.ts +5 -1
- package/dist/xlsx/formula/spill.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +2461 -1192
- package/dist/xlsx/index.d.ts +1 -0
- package/dist/xlsx/index.d.ts.map +1 -1
- package/dist/xlsx/index.mjs +2454 -1193
- package/dist/xlsx/layout/cell-view.d.ts.map +1 -1
- package/dist/xlsx/layout/navigate.d.ts.map +1 -1
- package/dist/xlsx/layout/style-view.d.ts +5 -0
- package/dist/xlsx/layout/style-view.d.ts.map +1 -1
- package/dist/xlsx/load/csv-dates.d.ts +22 -0
- package/dist/xlsx/load/csv-dates.d.ts.map +1 -0
- package/dist/xlsx/load/csv-import.d.ts +64 -0
- package/dist/xlsx/load/csv-import.d.ts.map +1 -0
- package/dist/xlsx/load/csv-separators.d.ts +13 -0
- package/dist/xlsx/load/csv-separators.d.ts.map +1 -0
- package/dist/xlsx/load/csv-traits.d.ts +20 -0
- package/dist/xlsx/load/csv-traits.d.ts.map +1 -0
- package/dist/xlsx/load/csv.d.ts +8 -4
- package/dist/xlsx/load/csv.d.ts.map +1 -1
- package/dist/xlsx/load/detect.d.ts +13 -0
- package/dist/xlsx/load/detect.d.ts.map +1 -1
- package/dist/xlsx/load/errors.d.ts +1 -0
- package/dist/xlsx/load/errors.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +537 -91
- package/dist/xlsx/load/index.d.ts +3 -1
- package/dist/xlsx/load/index.d.ts.map +1 -1
- package/dist/xlsx/load/index.mjs +536 -92
- package/dist/xlsx/numfmt/input-date.d.ts +2 -0
- package/dist/xlsx/numfmt/input-date.d.ts.map +1 -1
- package/dist/xlsx/pivot/cache-xml.d.ts.map +1 -1
- package/dist/xlsx/pivot/groups.d.ts.map +1 -1
- package/dist/xlsx/read/index.d.ts +2 -1
- package/dist/xlsx/read/index.d.ts.map +1 -1
- package/dist/xlsx/read/limits.d.ts +50 -0
- package/dist/xlsx/read/limits.d.ts.map +1 -0
- package/dist/xlsx/read/load.d.ts +11 -1
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/read/package.d.ts +5 -23
- package/dist/xlsx/read/package.d.ts.map +1 -1
- package/dist/xlsx/read/shared-strings.d.ts +2 -2
- package/dist/xlsx/read/shared-strings.d.ts.map +1 -1
- package/dist/xlsx/read/worksheet.d.ts +2 -0
- package/dist/xlsx/read/worksheet.d.ts.map +1 -1
- package/dist/xlsx/stable-key.d.ts +3 -0
- package/dist/xlsx/stable-key.d.ts.map +1 -0
- package/dist/xlsx/styles.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +662 -372
- package/dist/xlsx/ui/index.mjs +662 -372
- package/dist/xlsx/ui/locales/de/shell.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/en/shell.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/es/shell.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/fr/shell.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/zh-CN/shell.d.ts.map +1 -1
- package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
- package/dist/xml/index.cjs +32 -3
- package/dist/xml/index.mjs +32 -4
- package/dist/xml/xml.d.ts +11 -1
- package/dist/xml/xml.d.ts.map +1 -1
- package/package.json +6 -1
- package/dist/PptxHandler-SITN3K3F.mjs +0 -4
|
@@ -0,0 +1,1152 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
import JSZip from 'jszip';
|
|
3
|
+
import { XMLSerializer, DOMParser } from '@xmldom/xmldom';
|
|
4
|
+
|
|
5
|
+
// visio/collab/bind.ts
|
|
6
|
+
var DEFAULT_XML_LIMITS = {
|
|
7
|
+
maxDepth: 512,
|
|
8
|
+
maxNodes: 5e6
|
|
9
|
+
};
|
|
10
|
+
var XmlLimitError = class extends Error {
|
|
11
|
+
code = "xml-limit";
|
|
12
|
+
/** The limit that was exceeded. */
|
|
13
|
+
limit;
|
|
14
|
+
/** Its value: the largest depth or element count allowed. */
|
|
15
|
+
maximum;
|
|
16
|
+
constructor(message, limit, maximum) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.name = "XmlLimitError";
|
|
19
|
+
this.limit = limit;
|
|
20
|
+
this.maximum = maximum;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var TAG_RE = /<(\/?)([^\s\/><]+)(?:\s+[^\s=\/><]+\s*=\s*(?:"[^"<]*"|'[^'<]*'))*\s*(\/?)>/y;
|
|
24
|
+
var MARKUP_SKIPS = [
|
|
25
|
+
["<!--", "-->"],
|
|
26
|
+
["<![CDATA[", "]]>"],
|
|
27
|
+
["<?", "?>"]
|
|
28
|
+
];
|
|
29
|
+
function checkXmlLimits(xml, label, limits = {}) {
|
|
30
|
+
const maxDepth = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
|
|
31
|
+
const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
|
|
32
|
+
let depth = 0;
|
|
33
|
+
let nodes = 0;
|
|
34
|
+
let at = xml.indexOf("<");
|
|
35
|
+
while (at !== -1) {
|
|
36
|
+
const skip = MARKUP_SKIPS.find(([open]) => xml.startsWith(open, at));
|
|
37
|
+
if (skip) {
|
|
38
|
+
const end = xml.indexOf(skip[1], at + skip[0].length);
|
|
39
|
+
if (end === -1) return;
|
|
40
|
+
at = xml.indexOf("<", end + skip[1].length);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
TAG_RE.lastIndex = at;
|
|
44
|
+
const match = TAG_RE.exec(xml);
|
|
45
|
+
if (!match) {
|
|
46
|
+
at = xml.indexOf("<", at + 1);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const [, closing, , selfClosing] = match;
|
|
50
|
+
at = xml.indexOf("<", at + match[0].length);
|
|
51
|
+
if (closing) {
|
|
52
|
+
depth--;
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
nodes++;
|
|
56
|
+
if (nodes > maxNodes)
|
|
57
|
+
throw new XmlLimitError(
|
|
58
|
+
`${label} XML exceeds the limit of ${maxNodes} elements`,
|
|
59
|
+
"maxNodes",
|
|
60
|
+
maxNodes
|
|
61
|
+
);
|
|
62
|
+
if (!selfClosing && ++depth > maxDepth)
|
|
63
|
+
throw new XmlLimitError(
|
|
64
|
+
`${label} XML exceeds the nesting depth limit of ${maxDepth}`,
|
|
65
|
+
"maxDepth",
|
|
66
|
+
maxDepth
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
var CRLF_DECLARATION = /^<\?xml[^>]*\?>\r\n/;
|
|
71
|
+
var crlfDeclarations = /* @__PURE__ */ new WeakSet();
|
|
72
|
+
function parseXml(xml, options = {}) {
|
|
73
|
+
const label = options.label ?? "OOXML";
|
|
74
|
+
if (/<!DOCTYPE|<!ENTITY/i.test(xml))
|
|
75
|
+
throw new Error(`${label} XML with DTD or entity declarations is not supported`);
|
|
76
|
+
checkXmlLimits(xml, label, options.limits);
|
|
77
|
+
let parseError = "";
|
|
78
|
+
let parsed;
|
|
79
|
+
try {
|
|
80
|
+
parsed = new DOMParser({
|
|
81
|
+
onError: (level, message) => {
|
|
82
|
+
if (level !== "warning") parseError = message;
|
|
83
|
+
}
|
|
84
|
+
}).parseFromString(xml, "application/xml");
|
|
85
|
+
} catch (error) {
|
|
86
|
+
throw new Error(
|
|
87
|
+
`Invalid ${label} XML: ${error instanceof Error ? error.message : String(error)}`,
|
|
88
|
+
{ cause: error }
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
if (parseError || !parsed.documentElement)
|
|
92
|
+
throw new Error(`Invalid ${label} XML: ${parseError || "missing root element"}`);
|
|
93
|
+
if (CRLF_DECLARATION.test(xml)) crlfDeclarations.add(parsed);
|
|
94
|
+
return parsed;
|
|
95
|
+
}
|
|
96
|
+
var buildXml = (node) => {
|
|
97
|
+
const xml = new XMLSerializer().serializeToString(node);
|
|
98
|
+
return crlfDeclarations.has(node) ? xml.replace(/^(<\?xml[^>]*\?>)\n/, "$1\r\n") : xml;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// visio/collab/scan.ts
|
|
102
|
+
function* tags(xml) {
|
|
103
|
+
let i = 0;
|
|
104
|
+
while (i < xml.length) {
|
|
105
|
+
const lt = xml.indexOf("<", i);
|
|
106
|
+
if (lt < 0) return;
|
|
107
|
+
if (xml.startsWith("<!--", lt)) {
|
|
108
|
+
const close = xml.indexOf("-->", lt + 4);
|
|
109
|
+
i = close < 0 ? xml.length : close + 3;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (xml.startsWith("<![CDATA[", lt)) {
|
|
113
|
+
const close = xml.indexOf("]]>", lt + 9);
|
|
114
|
+
i = close < 0 ? xml.length : close + 3;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (xml[lt + 1] === "?" || xml[lt + 1] === "!") {
|
|
118
|
+
const close = xml.indexOf(">", lt + 2);
|
|
119
|
+
i = close < 0 ? xml.length : close + 1;
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
let j = lt + 1;
|
|
123
|
+
const closing = xml[j] === "/";
|
|
124
|
+
if (closing) j++;
|
|
125
|
+
const nameStart = j;
|
|
126
|
+
while (j < xml.length && !/[\s/>]/.test(xml[j])) j++;
|
|
127
|
+
const qualified = xml.slice(nameStart, j);
|
|
128
|
+
let quote = "";
|
|
129
|
+
while (j < xml.length) {
|
|
130
|
+
const ch = xml[j];
|
|
131
|
+
if (quote) {
|
|
132
|
+
if (ch === quote) quote = "";
|
|
133
|
+
} else if (ch === '"' || ch === "'") quote = ch;
|
|
134
|
+
else if (ch === ">") break;
|
|
135
|
+
j++;
|
|
136
|
+
}
|
|
137
|
+
if (j >= xml.length) return;
|
|
138
|
+
const colon = qualified.indexOf(":");
|
|
139
|
+
yield {
|
|
140
|
+
name: colon < 0 ? qualified : qualified.slice(colon + 1),
|
|
141
|
+
closing,
|
|
142
|
+
selfClosing: !closing && xml[j - 1] === "/",
|
|
143
|
+
start: lt,
|
|
144
|
+
end: j + 1
|
|
145
|
+
};
|
|
146
|
+
i = j + 1;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function scanContainer(xml, parent) {
|
|
150
|
+
const stack = [];
|
|
151
|
+
let found;
|
|
152
|
+
const children = [];
|
|
153
|
+
for (const tag of tags(xml)) {
|
|
154
|
+
if (tag.closing) {
|
|
155
|
+
const open = stack.pop();
|
|
156
|
+
if (!open || open.name !== tag.name) return void 0;
|
|
157
|
+
if (!found) continue;
|
|
158
|
+
if (stack.length === found.depth)
|
|
159
|
+
return {
|
|
160
|
+
name: parent,
|
|
161
|
+
start: found.start,
|
|
162
|
+
openEnd: found.openEnd,
|
|
163
|
+
closeStart: tag.start,
|
|
164
|
+
end: tag.end,
|
|
165
|
+
selfClosing: false,
|
|
166
|
+
children
|
|
167
|
+
};
|
|
168
|
+
if (stack.length === found.depth + 1)
|
|
169
|
+
children.push({
|
|
170
|
+
name: tag.name,
|
|
171
|
+
start: open.start,
|
|
172
|
+
openEnd: open.openEnd,
|
|
173
|
+
closeStart: tag.start,
|
|
174
|
+
end: tag.end,
|
|
175
|
+
selfClosing: false
|
|
176
|
+
});
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (!found && tag.name === parent) {
|
|
180
|
+
if (tag.selfClosing)
|
|
181
|
+
return {
|
|
182
|
+
name: parent,
|
|
183
|
+
start: tag.start,
|
|
184
|
+
openEnd: tag.end,
|
|
185
|
+
closeStart: tag.end,
|
|
186
|
+
end: tag.end,
|
|
187
|
+
selfClosing: true,
|
|
188
|
+
children: []
|
|
189
|
+
};
|
|
190
|
+
found = { start: tag.start, openEnd: tag.end, depth: stack.length };
|
|
191
|
+
stack.push({ name: tag.name, start: tag.start, openEnd: tag.end });
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (found && stack.length === found.depth + 1 && tag.selfClosing)
|
|
195
|
+
children.push({
|
|
196
|
+
name: tag.name,
|
|
197
|
+
start: tag.start,
|
|
198
|
+
openEnd: tag.end,
|
|
199
|
+
closeStart: tag.end,
|
|
200
|
+
end: tag.end,
|
|
201
|
+
selfClosing: true
|
|
202
|
+
});
|
|
203
|
+
if (!tag.selfClosing) stack.push({ name: tag.name, start: tag.start, openEnd: tag.end });
|
|
204
|
+
}
|
|
205
|
+
return void 0;
|
|
206
|
+
}
|
|
207
|
+
function attrOf(tag, name) {
|
|
208
|
+
const match = new RegExp(String.raw`\s${name}\s*=\s*(?:"([^"]*)"|'([^']*)')`).exec(tag);
|
|
209
|
+
return match ? match[1] ?? match[2] : void 0;
|
|
210
|
+
}
|
|
211
|
+
var escapeAttr = (value) => value.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
212
|
+
|
|
213
|
+
// visio/collab/package.ts
|
|
214
|
+
var dirName = (path) => {
|
|
215
|
+
const i = path.lastIndexOf("/");
|
|
216
|
+
return i < 0 ? "" : path.slice(0, i);
|
|
217
|
+
};
|
|
218
|
+
var baseName = (path) => path.slice(path.lastIndexOf("/") + 1);
|
|
219
|
+
var relsPathOf = (part) => {
|
|
220
|
+
const dir = dirName(part);
|
|
221
|
+
return `${dir ? `${dir}/` : ""}_rels/${baseName(part)}.rels`;
|
|
222
|
+
};
|
|
223
|
+
function resolveTarget(dir, target) {
|
|
224
|
+
const parts = target.startsWith("/") ? [] : dir ? dir.split("/") : [];
|
|
225
|
+
for (const segment of target.split("/")) {
|
|
226
|
+
if (segment === "" || segment === ".") continue;
|
|
227
|
+
if (segment === "..") parts.pop();
|
|
228
|
+
else parts.push(segment);
|
|
229
|
+
}
|
|
230
|
+
return parts.join("/");
|
|
231
|
+
}
|
|
232
|
+
function parseRelationships(xml) {
|
|
233
|
+
if (!xml) return [];
|
|
234
|
+
const out = [];
|
|
235
|
+
for (const match of xml.matchAll(/<(?:\w+:)?Relationship\b[^>]*>/g)) {
|
|
236
|
+
const text = match[0];
|
|
237
|
+
const id = attrOf(text, "Id");
|
|
238
|
+
const type = attrOf(text, "Type");
|
|
239
|
+
const target = attrOf(text, "Target");
|
|
240
|
+
if (id === void 0 || type === void 0 || target === void 0) continue;
|
|
241
|
+
out.push({ id, type, target, external: attrOf(text, "TargetMode") === "External", text });
|
|
242
|
+
}
|
|
243
|
+
return out;
|
|
244
|
+
}
|
|
245
|
+
var PAGE_TYPE = "http://schemas.microsoft.com/visio/2010/relationships/page";
|
|
246
|
+
var PAGE_CONTENT_TYPE = "application/vnd.ms-visio.page+xml";
|
|
247
|
+
var REL_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
248
|
+
var isLocalOnlyPart = (path) => /(^|\/)windows\.xml$/i.test(path) || /^docProps\/thumbnail\./i.test(path);
|
|
249
|
+
var CONTENT_TYPES = "[Content_Types].xml";
|
|
250
|
+
function stripPageOverrides(xml) {
|
|
251
|
+
return xml.replace(
|
|
252
|
+
/<(?:\w+:)?Override\b[^>]*>/g,
|
|
253
|
+
(tag) => attrOf(tag, "ContentType") === PAGE_CONTENT_TYPE ? "" : tag
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
function withPageOverrides(xml, pagePaths) {
|
|
257
|
+
const clean = stripPageOverrides(xml);
|
|
258
|
+
const add = pagePaths.map((path) => `<Override PartName="/${path}" ContentType="${PAGE_CONTENT_TYPE}"/>`).join("");
|
|
259
|
+
const close = clean.lastIndexOf("</");
|
|
260
|
+
return close < 0 ? clean : clean.slice(0, close) + add + clean.slice(close);
|
|
261
|
+
}
|
|
262
|
+
function toBase64(bytes) {
|
|
263
|
+
let out = "";
|
|
264
|
+
for (let i = 0; i < bytes.length; i += 32768)
|
|
265
|
+
out += String.fromCharCode(...bytes.subarray(i, i + 32768));
|
|
266
|
+
return btoa(out);
|
|
267
|
+
}
|
|
268
|
+
function fromBase64(text) {
|
|
269
|
+
const raw = atob(text);
|
|
270
|
+
const out = new Uint8Array(raw.length);
|
|
271
|
+
for (let i = 0; i < raw.length; i++) out[i] = raw.charCodeAt(i);
|
|
272
|
+
return out;
|
|
273
|
+
}
|
|
274
|
+
function fingerprint(bytes) {
|
|
275
|
+
let hash = 2166136261;
|
|
276
|
+
for (let i = 0; i < bytes.length; i++) hash = Math.imul(hash ^ bytes[i], 16777619);
|
|
277
|
+
return `${bytes.length}:${(hash >>> 0).toString(16)}`;
|
|
278
|
+
}
|
|
279
|
+
var encoder = new TextEncoder();
|
|
280
|
+
var decoder = new TextDecoder();
|
|
281
|
+
var canonCache = /* @__PURE__ */ new Map();
|
|
282
|
+
function canon(xml) {
|
|
283
|
+
const cached = canonCache.get(xml);
|
|
284
|
+
if (cached !== void 0) return cached;
|
|
285
|
+
let result = xml;
|
|
286
|
+
try {
|
|
287
|
+
result = buildXml(parseXml(xml).documentElement);
|
|
288
|
+
} catch {
|
|
289
|
+
}
|
|
290
|
+
if (canonCache.size > 4e3) canonCache.clear();
|
|
291
|
+
canonCache.set(xml, result);
|
|
292
|
+
return result;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// visio/collab/schema.ts
|
|
296
|
+
var SCHEMA_VERSION = 1;
|
|
297
|
+
var META = "visio:meta";
|
|
298
|
+
var PAGES = "visio:pages";
|
|
299
|
+
var BODIES = "visio:bodies";
|
|
300
|
+
var SHAPES = "visio:shapes";
|
|
301
|
+
var CONNECTS = "visio:connects";
|
|
302
|
+
var DEAD = "visio:dead";
|
|
303
|
+
var PARTS = "visio:parts";
|
|
304
|
+
var REL_MARK = "<!--@rel-->";
|
|
305
|
+
var SHAPES_MARK = "<!--@shapes-->";
|
|
306
|
+
var CONNECTS_MARK = "<!--@connects-->";
|
|
307
|
+
function sharedDrawing(doc) {
|
|
308
|
+
return {
|
|
309
|
+
meta: doc.getMap(META),
|
|
310
|
+
pages: doc.getMap(PAGES),
|
|
311
|
+
bodies: doc.getMap(BODIES),
|
|
312
|
+
shapes: doc.getMap(SHAPES),
|
|
313
|
+
connects: doc.getMap(CONNECTS),
|
|
314
|
+
dead: doc.getMap(DEAD),
|
|
315
|
+
parts: doc.getMap(PARTS)
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
var sharedTypes = (shared) => [
|
|
319
|
+
shared.meta,
|
|
320
|
+
shared.pages,
|
|
321
|
+
shared.bodies,
|
|
322
|
+
shared.shapes,
|
|
323
|
+
shared.connects,
|
|
324
|
+
shared.dead,
|
|
325
|
+
shared.parts
|
|
326
|
+
];
|
|
327
|
+
var isSharedDrawingEmpty = (shared) => shared.pages.size === 0 && shared.meta.get("v") === void 0;
|
|
328
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
329
|
+
function sameRecord(a, b) {
|
|
330
|
+
if (!isRecord(a) || !isRecord(b)) return a === b;
|
|
331
|
+
const ka = Object.keys(a).filter((k) => a[k] !== void 0);
|
|
332
|
+
const kb = Object.keys(b).filter((k) => b[k] !== void 0);
|
|
333
|
+
return ka.length === kb.length && ka.every((k) => a[k] === b[k]);
|
|
334
|
+
}
|
|
335
|
+
function setIfChanged(map, key, value) {
|
|
336
|
+
if (sameRecord(map.get(key), value)) return false;
|
|
337
|
+
map.set(key, value);
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
var str = (value) => typeof value === "string" ? value : void 0;
|
|
341
|
+
var num = (value) => typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
342
|
+
function pageEntry(value) {
|
|
343
|
+
if (!isRecord(value)) return void 0;
|
|
344
|
+
const pos = num(value.pos);
|
|
345
|
+
const id = str(value.id);
|
|
346
|
+
const xml = str(value.xml);
|
|
347
|
+
if (pos === void 0 || id === void 0 || xml === void 0) return void 0;
|
|
348
|
+
const back = str(value.back);
|
|
349
|
+
return { pos, id, xml, ...back !== void 0 ? { back } : {} };
|
|
350
|
+
}
|
|
351
|
+
function bodyEntry(value) {
|
|
352
|
+
if (!isRecord(value)) return void 0;
|
|
353
|
+
const shell = str(value.shell);
|
|
354
|
+
if (shell === void 0) return void 0;
|
|
355
|
+
const rels = str(value.rels);
|
|
356
|
+
return { shell, ...rels !== void 0 ? { rels } : {} };
|
|
357
|
+
}
|
|
358
|
+
function shapeEntry(value) {
|
|
359
|
+
if (!isRecord(value)) return void 0;
|
|
360
|
+
const pos = num(value.pos);
|
|
361
|
+
const xml = str(value.xml);
|
|
362
|
+
return pos === void 0 || xml === void 0 ? void 0 : { pos, xml };
|
|
363
|
+
}
|
|
364
|
+
function connectEntry(value) {
|
|
365
|
+
if (!isRecord(value)) return void 0;
|
|
366
|
+
const out = {};
|
|
367
|
+
for (const field of ["fk", "fi", "tk", "ti", "fc", "tc", "fp", "tp"]) {
|
|
368
|
+
const v = str(value[field]);
|
|
369
|
+
if (v === void 0) return void 0;
|
|
370
|
+
out[field] = v;
|
|
371
|
+
}
|
|
372
|
+
return out;
|
|
373
|
+
}
|
|
374
|
+
var DEFAULT_MAX_PART_BYTES = 48 * 1024 * 1024;
|
|
375
|
+
var SHAPE_ID = /<(?:\w+:)?Shape\s[^>]*?\bID\s*=\s*(["'])(\d+)\1/g;
|
|
376
|
+
function shapeIds(xml) {
|
|
377
|
+
return [...xml.matchAll(SHAPE_ID)].map((m) => m[2]);
|
|
378
|
+
}
|
|
379
|
+
function splitList(text, name, mark, child) {
|
|
380
|
+
const box = scanContainer(text, name);
|
|
381
|
+
if (!box) return { text, items: [] };
|
|
382
|
+
const items = box.children.filter((c) => c.name === child).map((c) => text.slice(c.start, c.end));
|
|
383
|
+
if (box.selfClosing) {
|
|
384
|
+
const tag = text.slice(box.start, box.end);
|
|
385
|
+
const qualified = /^<([^\s/>]+)/.exec(tag)?.[1] ?? name;
|
|
386
|
+
const open = tag.replace(/\s*\/>$/, ">");
|
|
387
|
+
return {
|
|
388
|
+
text: text.slice(0, box.start) + open + mark + `</${qualified}>` + text.slice(box.end),
|
|
389
|
+
items
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
return { text: text.slice(0, box.openEnd) + mark + text.slice(box.closeStart), items };
|
|
393
|
+
}
|
|
394
|
+
var readZip = (bytes) => JSZip.loadAsync(bytes);
|
|
395
|
+
var zipText = async (zip, path) => zip.file(path)?.async("string");
|
|
396
|
+
async function readLayout(zip) {
|
|
397
|
+
const root = parseRelationships(await zipText(zip, "_rels/.rels")).find(
|
|
398
|
+
(r) => r.type.endsWith("/document")
|
|
399
|
+
);
|
|
400
|
+
if (!root) return void 0;
|
|
401
|
+
const documentPath = resolveTarget("", root.target);
|
|
402
|
+
const rels = parseRelationships(await zipText(zip, relsPathOf(documentPath)));
|
|
403
|
+
const pages = rels.find((r) => r.type.endsWith("/pages"));
|
|
404
|
+
return pages ? { documentPath, pagesPath: resolveTarget(dirName(documentPath), pages.target) } : void 0;
|
|
405
|
+
}
|
|
406
|
+
async function readLocalPages(zip, layout, pagesXml) {
|
|
407
|
+
const box = scanContainer(pagesXml, "Pages");
|
|
408
|
+
if (!box) return void 0;
|
|
409
|
+
const rels = new Map(
|
|
410
|
+
parseRelationships(await zipText(zip, relsPathOf(layout.pagesPath))).map((r) => [r.id, r])
|
|
411
|
+
);
|
|
412
|
+
const pages = [];
|
|
413
|
+
for (const span of box.children) {
|
|
414
|
+
if (span.name !== "Page") continue;
|
|
415
|
+
const text = pagesXml.slice(span.start, span.end);
|
|
416
|
+
const inner = scanContainer(text, "Page");
|
|
417
|
+
const relSpan = inner?.children.find((c) => c.name === "Rel");
|
|
418
|
+
if (!inner || !relSpan) return void 0;
|
|
419
|
+
const relTag = text.slice(relSpan.start, relSpan.openEnd);
|
|
420
|
+
const rid = /\s(?:\w+:)?id\s*=\s*(["'])([^"']+)\1/.exec(relTag)?.[2];
|
|
421
|
+
const target = rid ? rels.get(rid)?.target : void 0;
|
|
422
|
+
const id = attrOf(text.slice(0, inner.openEnd), "ID");
|
|
423
|
+
if (target === void 0 || id === void 0) return void 0;
|
|
424
|
+
pages.push({
|
|
425
|
+
id,
|
|
426
|
+
text,
|
|
427
|
+
path: resolveTarget(dirName(layout.pagesPath), target),
|
|
428
|
+
rel: { start: relSpan.start, end: relSpan.end }
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
return { box, pages };
|
|
432
|
+
}
|
|
433
|
+
async function snapshotDrawing(bytes, keys, options = {}) {
|
|
434
|
+
const zip = await readZip(bytes);
|
|
435
|
+
const layout = await readLayout(zip);
|
|
436
|
+
if (!layout) throw new Error("The package has no Visio pages part.");
|
|
437
|
+
const pagesXml = await zipText(zip, layout.pagesPath) ?? "";
|
|
438
|
+
const local = await readLocalPages(zip, layout, pagesXml);
|
|
439
|
+
if (!local) throw new Error("The pages part cannot be split into pages.");
|
|
440
|
+
const derived = /* @__PURE__ */ new Set([layout.pagesPath, relsPathOf(layout.pagesPath)]);
|
|
441
|
+
const idToKey = new Map(local.pages.map((p) => [p.id, keys.pageKey(p.id)]));
|
|
442
|
+
const pages = [];
|
|
443
|
+
for (const page of local.pages) {
|
|
444
|
+
const key = idToKey.get(page.id);
|
|
445
|
+
derived.add(page.path).add(relsPathOf(page.path));
|
|
446
|
+
const head = page.text.slice(0, scanContainer(page.text, "Page").openEnd);
|
|
447
|
+
const backId = attrOf(head, "BackPage");
|
|
448
|
+
const xml = page.text.slice(0, page.rel.start) + REL_MARK + page.text.slice(page.rel.end);
|
|
449
|
+
const content = await zipText(zip, page.path) ?? "";
|
|
450
|
+
const rels = await zipText(zip, relsPathOf(page.path));
|
|
451
|
+
const shapesSplit = splitList(content, "Shapes", SHAPES_MARK, "Shape");
|
|
452
|
+
const connectsSplit = splitList(shapesSplit.text, "Connects", CONNECTS_MARK, "Connect");
|
|
453
|
+
const owner = /* @__PURE__ */ new Map();
|
|
454
|
+
const shapes = [];
|
|
455
|
+
for (const text of shapesSplit.items) {
|
|
456
|
+
const ids = shapeIds(text);
|
|
457
|
+
const id = ids[0];
|
|
458
|
+
if (id === void 0) continue;
|
|
459
|
+
const shapeKey = keys.shapeKey(key, id);
|
|
460
|
+
for (const nested of ids) owner.set(nested, shapeKey);
|
|
461
|
+
shapes.push({ key: shapeKey, id, xml: text });
|
|
462
|
+
}
|
|
463
|
+
const connects = [];
|
|
464
|
+
for (const text of connectsSplit.items) {
|
|
465
|
+
const a = (name) => attrOf(text, name) ?? "";
|
|
466
|
+
const entry = {
|
|
467
|
+
fk: owner.get(a("FromSheet")) ?? "",
|
|
468
|
+
fi: a("FromSheet"),
|
|
469
|
+
tk: owner.get(a("ToSheet")) ?? "",
|
|
470
|
+
ti: a("ToSheet"),
|
|
471
|
+
fc: a("FromCell"),
|
|
472
|
+
tc: a("ToCell"),
|
|
473
|
+
fp: a("FromPart"),
|
|
474
|
+
tp: a("ToPart")
|
|
475
|
+
};
|
|
476
|
+
connects.push({
|
|
477
|
+
key: `${key}/${entry.fk}.${entry.fi}.${entry.fc}.${entry.fp}>${entry.tk}.${entry.ti}.${entry.tc}.${entry.tp}`,
|
|
478
|
+
entry
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
keys.pagePaths.set(key, page.path);
|
|
482
|
+
pages.push({
|
|
483
|
+
key,
|
|
484
|
+
id: page.id,
|
|
485
|
+
...backId !== void 0 && idToKey.has(backId) ? { back: idToKey.get(backId) } : {},
|
|
486
|
+
xml,
|
|
487
|
+
shell: connectsSplit.text,
|
|
488
|
+
...rels !== void 0 ? { rels } : {},
|
|
489
|
+
path: page.path,
|
|
490
|
+
shapes,
|
|
491
|
+
connects
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
const parts = /* @__PURE__ */ new Map();
|
|
495
|
+
let total = 0;
|
|
496
|
+
const limit = options.maxPartBytes ?? DEFAULT_MAX_PART_BYTES;
|
|
497
|
+
for (const path of Object.keys(zip.files)) {
|
|
498
|
+
const file = zip.files[path];
|
|
499
|
+
if (file.dir || derived.has(path) || isLocalOnlyPart(path)) continue;
|
|
500
|
+
let data = await file.async("uint8array");
|
|
501
|
+
if (path === CONTENT_TYPES) data = encoder.encode(stripPageOverrides(decoder.decode(data)));
|
|
502
|
+
total += data.length;
|
|
503
|
+
if (total > limit) throw new Error("The package parts exceed the shared size limit.");
|
|
504
|
+
parts.set(path, data);
|
|
505
|
+
}
|
|
506
|
+
return {
|
|
507
|
+
pagesPath: layout.pagesPath,
|
|
508
|
+
pagesOpen: pagesXml.slice(0, local.box.openEnd),
|
|
509
|
+
pagesClose: pagesXml.slice(local.box.closeStart),
|
|
510
|
+
pages,
|
|
511
|
+
parts
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// visio/collab/order.ts
|
|
516
|
+
function assignPositions(order, current) {
|
|
517
|
+
const result = /* @__PURE__ */ new Map();
|
|
518
|
+
const kept = [];
|
|
519
|
+
let last = -Infinity;
|
|
520
|
+
for (const key of order) {
|
|
521
|
+
const pos = current(key);
|
|
522
|
+
if (pos !== void 0 && pos > last) {
|
|
523
|
+
kept.push(pos);
|
|
524
|
+
last = pos;
|
|
525
|
+
} else kept.push(void 0);
|
|
526
|
+
}
|
|
527
|
+
let i = 0;
|
|
528
|
+
while (i < order.length) {
|
|
529
|
+
const known = kept[i];
|
|
530
|
+
if (known !== void 0) {
|
|
531
|
+
result.set(order[i], known);
|
|
532
|
+
i++;
|
|
533
|
+
continue;
|
|
534
|
+
}
|
|
535
|
+
let end = i;
|
|
536
|
+
while (end < order.length && kept[end] === void 0) end++;
|
|
537
|
+
const lo = i > 0 ? kept[i - 1] : void 0;
|
|
538
|
+
const hi = end < order.length ? kept[end] : void 0;
|
|
539
|
+
const count = end - i;
|
|
540
|
+
for (let j = 0; j < count; j++) {
|
|
541
|
+
const key = order[i + j];
|
|
542
|
+
if (lo !== void 0 && hi !== void 0)
|
|
543
|
+
result.set(key, lo + (hi - lo) * (j + 1) / (count + 1));
|
|
544
|
+
else if (lo !== void 0) result.set(key, lo + j + 1);
|
|
545
|
+
else if (hi !== void 0) result.set(key, hi - count + j);
|
|
546
|
+
else result.set(key, j + 1);
|
|
547
|
+
}
|
|
548
|
+
i = end;
|
|
549
|
+
}
|
|
550
|
+
return result;
|
|
551
|
+
}
|
|
552
|
+
function byPosition(items) {
|
|
553
|
+
return items.sort((a, b) => a.pos - b.pos || (a.key < b.key ? -1 : a.key > b.key ? 1 : 0));
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// visio/collab/write.ts
|
|
557
|
+
var pageId = (key) => `p:${key}`;
|
|
558
|
+
var bodyId = (key) => `b:${key}`;
|
|
559
|
+
var shapeId = (page, key) => `s:${page}/${key}`;
|
|
560
|
+
var connectId = (key) => `c:${key}`;
|
|
561
|
+
var pageContent = (e) => JSON.stringify([e.id, e.back ?? null, canon(e.xml)]);
|
|
562
|
+
var bodyContent = (e) => JSON.stringify([canon(e.shell), e.rels ?? null]);
|
|
563
|
+
function writeSharedDrawing(shared, snapshot, keys) {
|
|
564
|
+
let writes = 0;
|
|
565
|
+
const set = (map, key, value) => {
|
|
566
|
+
if (setIfChanged(map, key, value)) writes++;
|
|
567
|
+
};
|
|
568
|
+
set(shared.meta, "v", SCHEMA_VERSION);
|
|
569
|
+
set(shared.meta, "pagesPath", snapshot.pagesPath);
|
|
570
|
+
set(shared.meta, "pagesOpen", snapshot.pagesOpen);
|
|
571
|
+
set(shared.meta, "pagesClose", snapshot.pagesClose);
|
|
572
|
+
const now = /* @__PURE__ */ new Map();
|
|
573
|
+
const changed = (id, content, room) => {
|
|
574
|
+
const base = keys.known.get(id);
|
|
575
|
+
return base === void 0 ? room !== content : base !== content;
|
|
576
|
+
};
|
|
577
|
+
const pagePos = assignPositions(
|
|
578
|
+
snapshot.pages.map((p) => p.key),
|
|
579
|
+
(key) => pageEntry(shared.pages.get(key))?.pos
|
|
580
|
+
);
|
|
581
|
+
for (const page of snapshot.pages) {
|
|
582
|
+
const room = pageEntry(shared.pages.get(page.key));
|
|
583
|
+
const content = pageContent(page);
|
|
584
|
+
now.set(pageId(page.key), content);
|
|
585
|
+
const own = changed(pageId(page.key), content, room && pageContent(room));
|
|
586
|
+
const source = own || !room ? page : room;
|
|
587
|
+
set(shared.pages, page.key, {
|
|
588
|
+
pos: pagePos.get(page.key),
|
|
589
|
+
id: source.id,
|
|
590
|
+
...source.back !== void 0 ? { back: source.back } : {},
|
|
591
|
+
xml: source.xml
|
|
592
|
+
});
|
|
593
|
+
const roomBody = bodyEntry(shared.bodies.get(page.key));
|
|
594
|
+
const bodyText = bodyContent(page);
|
|
595
|
+
now.set(bodyId(page.key), bodyText);
|
|
596
|
+
const ownBody = changed(bodyId(page.key), bodyText, roomBody && bodyContent(roomBody));
|
|
597
|
+
const body = ownBody || !roomBody ? page : roomBody;
|
|
598
|
+
set(shared.bodies, page.key, {
|
|
599
|
+
shell: body.shell,
|
|
600
|
+
...body.rels !== void 0 ? { rels: body.rels } : {}
|
|
601
|
+
});
|
|
602
|
+
const shapePos = assignPositions(
|
|
603
|
+
page.shapes.map((s) => s.key),
|
|
604
|
+
(key) => shapeEntry(shared.shapes.get(`${page.key}/${key}`))?.pos
|
|
605
|
+
);
|
|
606
|
+
for (const shape of page.shapes) {
|
|
607
|
+
const id = shapeId(page.key, shape.key);
|
|
608
|
+
const roomShape = shapeEntry(shared.shapes.get(`${page.key}/${shape.key}`));
|
|
609
|
+
const text = canon(shape.xml);
|
|
610
|
+
now.set(id, text);
|
|
611
|
+
const xml = changed(id, text, roomShape && canon(roomShape.xml)) || !roomShape ? shape.xml : roomShape.xml;
|
|
612
|
+
set(shared.shapes, `${page.key}/${shape.key}`, { pos: shapePos.get(shape.key), xml });
|
|
613
|
+
}
|
|
614
|
+
for (const connect of page.connects) {
|
|
615
|
+
now.set(connectId(connect.key), "");
|
|
616
|
+
if (!keys.known.has(connectId(connect.key)) || !shared.connects.has(connect.key))
|
|
617
|
+
set(shared.connects, connect.key, connect.entry);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
for (const id of keys.known.keys()) {
|
|
621
|
+
if (now.has(id)) continue;
|
|
622
|
+
const name = id.slice(2);
|
|
623
|
+
if (id.startsWith("p:")) {
|
|
624
|
+
shared.dead.set(name, true);
|
|
625
|
+
for (const map of [shared.pages, shared.bodies]) map.delete(name);
|
|
626
|
+
for (const map of [shared.shapes, shared.connects])
|
|
627
|
+
for (const key of [...map.keys()]) if (key.startsWith(`${name}/`)) map.delete(key);
|
|
628
|
+
keys.forgetPage(name);
|
|
629
|
+
writes++;
|
|
630
|
+
} else if (id.startsWith("s:")) {
|
|
631
|
+
const slash = name.indexOf("/");
|
|
632
|
+
const page = name.slice(0, slash);
|
|
633
|
+
if (!now.has(pageId(page))) continue;
|
|
634
|
+
shared.dead.set(name, true);
|
|
635
|
+
shared.shapes.delete(name);
|
|
636
|
+
keys.forgetShape(page, name.slice(slash + 1));
|
|
637
|
+
writes++;
|
|
638
|
+
} else if (id.startsWith("c:") && shared.connects.has(name)) {
|
|
639
|
+
shared.connects.delete(name);
|
|
640
|
+
writes++;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
keys.known = now;
|
|
644
|
+
for (const [path, data] of snapshot.parts) {
|
|
645
|
+
const print = fingerprint(data);
|
|
646
|
+
if (keys.partPrints.get(path) === print) continue;
|
|
647
|
+
set(shared.parts, path, toBase64(data));
|
|
648
|
+
keys.partPrints.set(path, print);
|
|
649
|
+
}
|
|
650
|
+
for (const path of [...keys.partPrints.keys()])
|
|
651
|
+
if (!snapshot.parts.has(path)) {
|
|
652
|
+
shared.parts.delete(path);
|
|
653
|
+
keys.partPrints.delete(path);
|
|
654
|
+
writes++;
|
|
655
|
+
}
|
|
656
|
+
return writes;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
// visio/collab/compose.ts
|
|
660
|
+
var DEFAULT_CONTENT_TYPES = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"></Types>';
|
|
661
|
+
function connectXml(item) {
|
|
662
|
+
const attrs = [
|
|
663
|
+
["FromSheet", item.from],
|
|
664
|
+
["FromCell", item.entry.fc],
|
|
665
|
+
["FromPart", item.entry.fp],
|
|
666
|
+
["ToSheet", item.to],
|
|
667
|
+
["ToCell", item.entry.tc],
|
|
668
|
+
["ToPart", item.entry.tp]
|
|
669
|
+
];
|
|
670
|
+
return `<Connect ${attrs.filter(([, v]) => v !== "").map(([k, v]) => `${k}="${escapeAttr(v)}"`).join(" ")}/>`;
|
|
671
|
+
}
|
|
672
|
+
function pagePartXml(page) {
|
|
673
|
+
let shell = page.body.shell;
|
|
674
|
+
const root = scanContainer(shell, "PageContents");
|
|
675
|
+
if (page.shapes.length && !shell.includes(SHAPES_MARK) && root && !root.selfClosing)
|
|
676
|
+
shell = shell.slice(0, root.openEnd) + `<Shapes>${SHAPES_MARK}</Shapes>` + shell.slice(root.openEnd);
|
|
677
|
+
const root2 = scanContainer(shell, "PageContents");
|
|
678
|
+
if (page.connects.length && !shell.includes(CONNECTS_MARK) && root2 && !root2.selfClosing)
|
|
679
|
+
shell = shell.slice(0, root2.closeStart) + `<Connects>${CONNECTS_MARK}</Connects>` + shell.slice(root2.closeStart);
|
|
680
|
+
return shell.replace(SHAPES_MARK, () => page.shapes.map((s) => s.xml).join("")).replace(CONNECTS_MARK, () => page.connects.map(connectXml).join(""));
|
|
681
|
+
}
|
|
682
|
+
function relTarget(pagesDir, path) {
|
|
683
|
+
return pagesDir && path.startsWith(`${pagesDir}/`) ? path.slice(pagesDir.length + 1) : `/${path}`;
|
|
684
|
+
}
|
|
685
|
+
async function composeDrawing(drawing, local, keys, options = {}) {
|
|
686
|
+
const localZip = local ? await readZip(local) : void 0;
|
|
687
|
+
const files = /* @__PURE__ */ new Map();
|
|
688
|
+
const prints = /* @__PURE__ */ new Map();
|
|
689
|
+
let total = 0;
|
|
690
|
+
const limit = options.maxPartBytes ?? 48 * 1024 * 1024;
|
|
691
|
+
for (const [path, b64] of drawing.parts) {
|
|
692
|
+
const data = fromBase64(b64);
|
|
693
|
+
total += data.length;
|
|
694
|
+
if (total > limit) throw new Error("The shared parts exceed the size limit.");
|
|
695
|
+
files.set(path, data);
|
|
696
|
+
prints.set(path, fingerprint(data));
|
|
697
|
+
}
|
|
698
|
+
if (localZip)
|
|
699
|
+
for (const path of Object.keys(localZip.files)) {
|
|
700
|
+
const file = localZip.files[path];
|
|
701
|
+
if (!file.dir && isLocalOnlyPart(path) && !files.has(path))
|
|
702
|
+
files.set(path, await file.async("uint8array"));
|
|
703
|
+
}
|
|
704
|
+
let contentTypes = files.get(CONTENT_TYPES) !== void 0 ? decoder.decode(files.get(CONTENT_TYPES)) : (localZip && await zipText(localZip, CONTENT_TYPES)) ?? DEFAULT_CONTENT_TYPES;
|
|
705
|
+
for (const [path, data] of [...files]) {
|
|
706
|
+
if (!path.endsWith(".rels") || typeof data === "string") continue;
|
|
707
|
+
const source = path.replace(/(^|\/)_rels\/([^/]+)\.rels$/, "$1$2");
|
|
708
|
+
const base = dirName(source);
|
|
709
|
+
const text = decoder.decode(data);
|
|
710
|
+
const next = text.replace(/<(?:\w+:)?Relationship\b[^>]*>/g, (tag) => {
|
|
711
|
+
const target = attrOf(tag, "Target");
|
|
712
|
+
if (target === void 0 || attrOf(tag, "TargetMode") === "External") return tag;
|
|
713
|
+
const resolved = resolveTarget(base, target);
|
|
714
|
+
if (!isLocalOnlyPart(resolved) || files.has(resolved)) return tag;
|
|
715
|
+
contentTypes = contentTypes.replace(
|
|
716
|
+
/<(?:\w+:)?Override\b[^>]*>/g,
|
|
717
|
+
(o) => attrOf(o, "PartName") === `/${resolved}` ? "" : o
|
|
718
|
+
);
|
|
719
|
+
return "";
|
|
720
|
+
});
|
|
721
|
+
if (next !== text) files.set(path, encoder.encode(next));
|
|
722
|
+
}
|
|
723
|
+
const pagesDir = dirName(drawing.pagesPath);
|
|
724
|
+
const taken = /* @__PURE__ */ new Set([
|
|
725
|
+
...files.keys(),
|
|
726
|
+
drawing.pagesPath,
|
|
727
|
+
relsPathOf(drawing.pagesPath)
|
|
728
|
+
]);
|
|
729
|
+
const paths = /* @__PURE__ */ new Map();
|
|
730
|
+
for (const page of drawing.pages) {
|
|
731
|
+
const known = keys.pagePaths.get(page.key);
|
|
732
|
+
if (known && !taken.has(known) && localZip?.file(known)) {
|
|
733
|
+
paths.set(page.key, known);
|
|
734
|
+
taken.add(known);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
let counter = 0;
|
|
738
|
+
for (const page of drawing.pages) {
|
|
739
|
+
if (paths.has(page.key)) continue;
|
|
740
|
+
let path;
|
|
741
|
+
do
|
|
742
|
+
path = `${pagesDir ? `${pagesDir}/` : ""}page${++counter}.xml`;
|
|
743
|
+
while (taken.has(path) || localZip?.file(path));
|
|
744
|
+
paths.set(page.key, path);
|
|
745
|
+
taken.add(path);
|
|
746
|
+
}
|
|
747
|
+
const others = parseRelationships(
|
|
748
|
+
localZip ? await zipText(localZip, relsPathOf(drawing.pagesPath)) : void 0
|
|
749
|
+
).filter((r) => r.type !== PAGE_TYPE);
|
|
750
|
+
const usedIds = new Set(others.map((r) => r.id));
|
|
751
|
+
let nextRel = 0;
|
|
752
|
+
const pageRels = [];
|
|
753
|
+
const pageXml = [];
|
|
754
|
+
for (const page of drawing.pages) {
|
|
755
|
+
const path = paths.get(page.key);
|
|
756
|
+
let id;
|
|
757
|
+
do
|
|
758
|
+
id = `rId${++nextRel}`;
|
|
759
|
+
while (usedIds.has(id));
|
|
760
|
+
usedIds.add(id);
|
|
761
|
+
pageRels.push(
|
|
762
|
+
`<Relationship Id="${id}" Type="${PAGE_TYPE}" Target="${escapeAttr(relTarget(pagesDir, path))}"/>`
|
|
763
|
+
);
|
|
764
|
+
const rel = `<Rel xmlns:r="${REL_NS}" r:id="${id}"/>`;
|
|
765
|
+
pageXml.push(
|
|
766
|
+
page.xml.includes(REL_MARK) ? page.xml.replace(REL_MARK, () => rel) : page.xml.slice(0, page.xml.lastIndexOf("</")) + rel + page.xml.slice(page.xml.lastIndexOf("</"))
|
|
767
|
+
);
|
|
768
|
+
files.set(path, encoder.encode(pagePartXml(page)));
|
|
769
|
+
if (page.body.rels !== void 0) files.set(relsPathOf(path), encoder.encode(page.body.rels));
|
|
770
|
+
}
|
|
771
|
+
files.set(
|
|
772
|
+
drawing.pagesPath,
|
|
773
|
+
encoder.encode(drawing.pagesOpen + pageXml.join("") + drawing.pagesClose)
|
|
774
|
+
);
|
|
775
|
+
files.set(
|
|
776
|
+
relsPathOf(drawing.pagesPath),
|
|
777
|
+
encoder.encode(
|
|
778
|
+
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">' + others.map((r) => r.text).join("") + pageRels.join("") + "</Relationships>"
|
|
779
|
+
)
|
|
780
|
+
);
|
|
781
|
+
files.set(CONTENT_TYPES, encoder.encode(withPageOverrides(contentTypes, [...paths.values()])));
|
|
782
|
+
const zip = new JSZip();
|
|
783
|
+
const names = [...files.keys()].sort(
|
|
784
|
+
(a, b) => a === CONTENT_TYPES ? -1 : b === CONTENT_TYPES ? 1 : 0
|
|
785
|
+
);
|
|
786
|
+
for (const name of names) zip.file(name, files.get(name), { createFolders: false });
|
|
787
|
+
const bytes = await zip.generateAsync({ type: "uint8array", compression: "STORE" });
|
|
788
|
+
const commit = () => {
|
|
789
|
+
const pageIds = /* @__PURE__ */ new Map();
|
|
790
|
+
const shapeIds2 = /* @__PURE__ */ new Map();
|
|
791
|
+
const known = /* @__PURE__ */ new Map();
|
|
792
|
+
keys.pagePaths.clear();
|
|
793
|
+
for (const page of drawing.pages) {
|
|
794
|
+
pageIds.set(page.id, page.key);
|
|
795
|
+
keys.pagePaths.set(page.key, paths.get(page.key));
|
|
796
|
+
known.set(pageId(page.key), pageContent(page));
|
|
797
|
+
known.set(bodyId(page.key), bodyContent(page.body));
|
|
798
|
+
shapeIds2.set(page.key, new Map(page.shapes.map((s) => [s.id, s.key])));
|
|
799
|
+
for (const shape of page.shapes) known.set(shapeId(page.key, shape.key), canon(shape.xml));
|
|
800
|
+
for (const connect of page.connects) known.set(connectId(connect.key), "");
|
|
801
|
+
}
|
|
802
|
+
keys.reset(pageIds, shapeIds2);
|
|
803
|
+
keys.known = known;
|
|
804
|
+
keys.partPrints.clear();
|
|
805
|
+
for (const [path, print] of prints) keys.partPrints.set(path, print);
|
|
806
|
+
};
|
|
807
|
+
return { bytes, commit };
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
// visio/collab/keys.ts
|
|
811
|
+
var DrawingKeys = class {
|
|
812
|
+
constructor(tag) {
|
|
813
|
+
this.tag = tag;
|
|
814
|
+
}
|
|
815
|
+
tag;
|
|
816
|
+
#counter = 0;
|
|
817
|
+
/** Seeding derives keys from ids; otherwise they are minted. */
|
|
818
|
+
seeding = false;
|
|
819
|
+
#pages = /* @__PURE__ */ new Map();
|
|
820
|
+
#shapes = /* @__PURE__ */ new Map();
|
|
821
|
+
/** Content of each entry this peer last wrote or applied, to tell a local edit or deletion from a change it has not applied yet. */
|
|
822
|
+
known = /* @__PURE__ */ new Map();
|
|
823
|
+
/** Fingerprints of the parts this peer last wrote or applied. */
|
|
824
|
+
partPrints = /* @__PURE__ */ new Map();
|
|
825
|
+
/** The part path of each page key in the local package. */
|
|
826
|
+
pagePaths = /* @__PURE__ */ new Map();
|
|
827
|
+
mint() {
|
|
828
|
+
return `${this.tag}.${(++this.#counter).toString(36)}`;
|
|
829
|
+
}
|
|
830
|
+
pageKey(id) {
|
|
831
|
+
let key = this.#pages.get(id);
|
|
832
|
+
if (key === void 0) {
|
|
833
|
+
key = this.seeding ? `s${id}` : this.mint();
|
|
834
|
+
this.#pages.set(id, key);
|
|
835
|
+
}
|
|
836
|
+
return key;
|
|
837
|
+
}
|
|
838
|
+
shapeKey(pageKey, id) {
|
|
839
|
+
let map = this.#shapes.get(pageKey);
|
|
840
|
+
if (!map) this.#shapes.set(pageKey, map = /* @__PURE__ */ new Map());
|
|
841
|
+
let key = map.get(id);
|
|
842
|
+
if (key === void 0) {
|
|
843
|
+
key = this.seeding ? `s${id}` : this.mint();
|
|
844
|
+
map.set(id, key);
|
|
845
|
+
}
|
|
846
|
+
return key;
|
|
847
|
+
}
|
|
848
|
+
findPage(id) {
|
|
849
|
+
return this.#pages.get(id);
|
|
850
|
+
}
|
|
851
|
+
forgetPage(key) {
|
|
852
|
+
for (const [id, k] of this.#pages) if (k === key) this.#pages.delete(id);
|
|
853
|
+
this.#shapes.delete(key);
|
|
854
|
+
}
|
|
855
|
+
forgetShape(pageKey, key) {
|
|
856
|
+
const map = this.#shapes.get(pageKey);
|
|
857
|
+
if (map) {
|
|
858
|
+
for (const [id, k] of map) if (k === key) map.delete(id);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
/** Replaces the id-to-key tables with those of a freshly composed package. */
|
|
862
|
+
reset(pages, shapes) {
|
|
863
|
+
this.#pages.clear();
|
|
864
|
+
this.#shapes.clear();
|
|
865
|
+
for (const [id, key] of pages) this.#pages.set(id, key);
|
|
866
|
+
for (const [page, map] of shapes) this.#shapes.set(page, new Map(map));
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
// visio/collab/read.ts
|
|
871
|
+
var compare = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
872
|
+
var numeric = (id) => /^\d+$/.test(id) ? Number(id) : 0;
|
|
873
|
+
function setAttr(open, name, value) {
|
|
874
|
+
return open.replace(
|
|
875
|
+
new RegExp(String.raw`(\s${name}\s*=\s*)(?:"[^"]*"|'[^']*')`),
|
|
876
|
+
(_m, head) => `${head}"${value}"`
|
|
877
|
+
);
|
|
878
|
+
}
|
|
879
|
+
function renumberShape(xml, remap) {
|
|
880
|
+
if (!remap.size) return xml;
|
|
881
|
+
return xml.replace(
|
|
882
|
+
/<(?:\w+:)?Shape\s[^>]*>/g,
|
|
883
|
+
(tag) => tag.replace(/(\bID\s*=\s*)(["'])(\d+)\2/, (m, head, q, id) => {
|
|
884
|
+
const next = remap.get(id);
|
|
885
|
+
return next === void 0 ? m : `${head}${q}${next}${q}`;
|
|
886
|
+
})
|
|
887
|
+
).replace(/Sheet\.(\d+)(?!\d)/g, (m, id) => {
|
|
888
|
+
const next = remap.get(id);
|
|
889
|
+
return next === void 0 ? m : `Sheet.${next}`;
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
function readSharedDrawing(shared) {
|
|
893
|
+
if (isSharedDrawingEmpty(shared)) return void 0;
|
|
894
|
+
const pagesPath = str(shared.meta.get("pagesPath"));
|
|
895
|
+
const pagesOpen = str(shared.meta.get("pagesOpen"));
|
|
896
|
+
const pagesClose = str(shared.meta.get("pagesClose"));
|
|
897
|
+
if (pagesPath === void 0 || pagesOpen === void 0 || pagesClose === void 0)
|
|
898
|
+
return void 0;
|
|
899
|
+
const alive = [...shared.pages].filter(([key]) => !shared.dead.has(key)).flatMap(([key, value]) => {
|
|
900
|
+
const entry = pageEntry(value);
|
|
901
|
+
const body = bodyEntry(shared.bodies.get(key));
|
|
902
|
+
return entry && body ? [{ key, pos: entry.pos, entry, body }] : [];
|
|
903
|
+
});
|
|
904
|
+
const pageIds = /* @__PURE__ */ new Map();
|
|
905
|
+
const taken = /* @__PURE__ */ new Set();
|
|
906
|
+
let maxPage = Math.max(0, ...alive.map((p) => numeric(p.entry.id)));
|
|
907
|
+
for (const page of [...alive].sort((a, b) => compare(a.key, b.key))) {
|
|
908
|
+
let id = page.entry.id;
|
|
909
|
+
if (taken.has(id)) id = String(++maxPage);
|
|
910
|
+
taken.add(id);
|
|
911
|
+
pageIds.set(page.key, id);
|
|
912
|
+
}
|
|
913
|
+
const shapesByPage = /* @__PURE__ */ new Map();
|
|
914
|
+
for (const [full, value] of shared.shapes) {
|
|
915
|
+
const slash = full.indexOf("/");
|
|
916
|
+
if (slash < 0 || shared.dead.has(full)) continue;
|
|
917
|
+
const entry = shapeEntry(value);
|
|
918
|
+
if (!entry) continue;
|
|
919
|
+
const page = full.slice(0, slash);
|
|
920
|
+
const list = shapesByPage.get(page) ?? [];
|
|
921
|
+
list.push({ key: full.slice(slash + 1), pos: entry.pos, xml: entry.xml });
|
|
922
|
+
shapesByPage.set(page, list);
|
|
923
|
+
}
|
|
924
|
+
const connectsByPage = /* @__PURE__ */ new Map();
|
|
925
|
+
for (const [full, value] of shared.connects) {
|
|
926
|
+
const entry = connectEntry(value);
|
|
927
|
+
const slash = full.indexOf("/");
|
|
928
|
+
if (!entry || slash < 0) continue;
|
|
929
|
+
const list = connectsByPage.get(full.slice(0, slash)) ?? [];
|
|
930
|
+
list.push({ key: full, entry });
|
|
931
|
+
connectsByPage.set(full.slice(0, slash), list);
|
|
932
|
+
}
|
|
933
|
+
const pages = [];
|
|
934
|
+
for (const page of byPosition(alive)) {
|
|
935
|
+
const finalId = pageIds.get(page.key);
|
|
936
|
+
const shapes = resolveShapes(shapesByPage.get(page.key) ?? []);
|
|
937
|
+
const byKey = new Map(shapes.map((s) => [s.key, s]));
|
|
938
|
+
const connects = [];
|
|
939
|
+
for (const item of (connectsByPage.get(page.key) ?? []).sort((a, b) => compare(a.key, b.key))) {
|
|
940
|
+
const { entry } = item;
|
|
941
|
+
const from = entry.fk ? byKey.get(entry.fk) : void 0;
|
|
942
|
+
const to = entry.tk ? byKey.get(entry.tk) : void 0;
|
|
943
|
+
if (entry.fk && !from || entry.tk && !to) continue;
|
|
944
|
+
connects.push({
|
|
945
|
+
key: item.key,
|
|
946
|
+
entry,
|
|
947
|
+
from: from?.remap.get(entry.fi) ?? entry.fi,
|
|
948
|
+
to: to?.remap.get(entry.ti) ?? entry.ti
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
let xml = page.entry.xml;
|
|
952
|
+
const open = /^<[^>]*>/.exec(xml)?.[0];
|
|
953
|
+
if (open) {
|
|
954
|
+
let next = setAttr(open, "ID", finalId);
|
|
955
|
+
const back = page.entry.back !== void 0 ? pageIds.get(page.entry.back) : void 0;
|
|
956
|
+
if (back !== void 0) next = setAttr(next, "BackPage", back);
|
|
957
|
+
xml = next + xml.slice(open.length);
|
|
958
|
+
}
|
|
959
|
+
pages.push({
|
|
960
|
+
key: page.key,
|
|
961
|
+
id: finalId,
|
|
962
|
+
...page.entry.back !== void 0 ? { back: page.entry.back } : {},
|
|
963
|
+
xml,
|
|
964
|
+
body: page.body,
|
|
965
|
+
shapes,
|
|
966
|
+
connects
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
const parts = /* @__PURE__ */ new Map();
|
|
970
|
+
for (const [path, value] of shared.parts) if (typeof value === "string") parts.set(path, value);
|
|
971
|
+
return { pagesPath, pagesOpen, pagesClose, pages, parts };
|
|
972
|
+
}
|
|
973
|
+
function resolveShapes(entries) {
|
|
974
|
+
const parsed = entries.map((entry) => ({ ...entry, ids: shapeIds(entry.xml) }));
|
|
975
|
+
let max = Math.max(0, ...parsed.flatMap((p) => p.ids.map(numeric)));
|
|
976
|
+
const used = /* @__PURE__ */ new Set();
|
|
977
|
+
const done = /* @__PURE__ */ new Map();
|
|
978
|
+
for (const item of [...parsed].sort((a, b) => compare(a.key, b.key))) {
|
|
979
|
+
const remap = /* @__PURE__ */ new Map();
|
|
980
|
+
for (const id of item.ids) {
|
|
981
|
+
if (used.has(id) || remap.has(id)) remap.set(id, String(++max));
|
|
982
|
+
}
|
|
983
|
+
const ids = item.ids.map((id) => remap.get(id) ?? id);
|
|
984
|
+
for (const id of ids) used.add(id);
|
|
985
|
+
done.set(item.key, {
|
|
986
|
+
key: item.key,
|
|
987
|
+
id: ids[0] ?? "",
|
|
988
|
+
xml: renumberShape(item.xml, remap),
|
|
989
|
+
remap,
|
|
990
|
+
ids
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
return byPosition(parsed).map((item) => done.get(item.key));
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
// visio/collab/bind.ts
|
|
997
|
+
var VISIO_EDIT_ORIGIN = /* @__PURE__ */ Symbol("ooxml-core:visio:edit");
|
|
998
|
+
var VISIO_SYNC_ORIGIN = /* @__PURE__ */ Symbol("ooxml-core:visio:sync");
|
|
999
|
+
function bindDrawingSession(host, editor, options = {}) {
|
|
1000
|
+
const { doc } = host;
|
|
1001
|
+
const shared = sharedDrawing(doc);
|
|
1002
|
+
const types = sharedTypes(shared);
|
|
1003
|
+
const keys = new DrawingKeys(options.keyTag ?? doc.clientID.toString(36));
|
|
1004
|
+
const undoManager = new Y.UndoManager(types, {
|
|
1005
|
+
trackedOrigins: /* @__PURE__ */ new Set([VISIO_EDIT_ORIGIN]),
|
|
1006
|
+
captureTimeout: 0
|
|
1007
|
+
});
|
|
1008
|
+
const historyListeners = /* @__PURE__ */ new Set();
|
|
1009
|
+
const historyChanged = () => {
|
|
1010
|
+
for (const listener of [...historyListeners]) listener();
|
|
1011
|
+
};
|
|
1012
|
+
for (const event of ["stack-item-added", "stack-item-popped", "stack-cleared"])
|
|
1013
|
+
undoManager.on(event, historyChanged);
|
|
1014
|
+
let disposed = false;
|
|
1015
|
+
let settled = false;
|
|
1016
|
+
let localDirty = false;
|
|
1017
|
+
let remoteDirty = false;
|
|
1018
|
+
let running;
|
|
1019
|
+
const report = (error) => options.onError?.(error);
|
|
1020
|
+
const publish = async () => {
|
|
1021
|
+
const bytes = editor.exportBytes();
|
|
1022
|
+
if (!bytes) return;
|
|
1023
|
+
keys.seeding = keys.known.size === 0 && isSharedDrawingEmpty(shared);
|
|
1024
|
+
const snapshot = await snapshotDrawing(bytes, keys);
|
|
1025
|
+
if (disposed) return;
|
|
1026
|
+
const seed = isSharedDrawingEmpty(shared);
|
|
1027
|
+
doc.transact(
|
|
1028
|
+
() => writeSharedDrawing(shared, snapshot, keys),
|
|
1029
|
+
seed ? VISIO_SYNC_ORIGIN : VISIO_EDIT_ORIGIN
|
|
1030
|
+
);
|
|
1031
|
+
undoManager.stopCapturing();
|
|
1032
|
+
};
|
|
1033
|
+
const rebuild = async () => {
|
|
1034
|
+
const resolved = readSharedDrawing(shared);
|
|
1035
|
+
if (!resolved) return;
|
|
1036
|
+
const version = editor.version();
|
|
1037
|
+
const composed = await composeDrawing(resolved, editor.exportBytes(), keys);
|
|
1038
|
+
if (disposed) return;
|
|
1039
|
+
if (editor.busy() || editor.version() !== version) {
|
|
1040
|
+
remoteDirty = true;
|
|
1041
|
+
return;
|
|
1042
|
+
}
|
|
1043
|
+
try {
|
|
1044
|
+
await editor.applyRemote(composed.bytes);
|
|
1045
|
+
} catch (error) {
|
|
1046
|
+
if (editor.busy()) remoteDirty = true;
|
|
1047
|
+
else report(error);
|
|
1048
|
+
return;
|
|
1049
|
+
}
|
|
1050
|
+
composed.commit();
|
|
1051
|
+
};
|
|
1052
|
+
const blocked = () => disposed || !settled || editor.busy();
|
|
1053
|
+
const pending = () => !blocked() && (localDirty && host.canWrite() || remoteDirty && !localDirty);
|
|
1054
|
+
const loop = async () => {
|
|
1055
|
+
while (pending()) {
|
|
1056
|
+
try {
|
|
1057
|
+
if (localDirty) {
|
|
1058
|
+
localDirty = false;
|
|
1059
|
+
await publish();
|
|
1060
|
+
} else if (remoteDirty) {
|
|
1061
|
+
remoteDirty = false;
|
|
1062
|
+
await rebuild();
|
|
1063
|
+
}
|
|
1064
|
+
} catch (error) {
|
|
1065
|
+
report(error);
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
const pump = () => {
|
|
1070
|
+
if (running || !pending()) return;
|
|
1071
|
+
running = loop().finally(() => {
|
|
1072
|
+
running = void 0;
|
|
1073
|
+
pump();
|
|
1074
|
+
});
|
|
1075
|
+
};
|
|
1076
|
+
const settle = () => {
|
|
1077
|
+
if (disposed || settled) return;
|
|
1078
|
+
if (isSharedDrawingEmpty(shared)) {
|
|
1079
|
+
if (!host.canWrite()) return;
|
|
1080
|
+
settled = true;
|
|
1081
|
+
if (options.seed !== false) {
|
|
1082
|
+
localDirty = editor.exportBytes() !== void 0 || editor.busy();
|
|
1083
|
+
}
|
|
1084
|
+
} else {
|
|
1085
|
+
settled = true;
|
|
1086
|
+
localDirty = false;
|
|
1087
|
+
remoteDirty = true;
|
|
1088
|
+
}
|
|
1089
|
+
pump();
|
|
1090
|
+
};
|
|
1091
|
+
const afterTransaction = (transaction) => {
|
|
1092
|
+
if (disposed) return;
|
|
1093
|
+
const origin = transaction.origin;
|
|
1094
|
+
if (origin === VISIO_EDIT_ORIGIN || origin === VISIO_SYNC_ORIGIN) return;
|
|
1095
|
+
const changed = transaction.changed;
|
|
1096
|
+
if (!types.some((type) => changed.has(type))) return;
|
|
1097
|
+
if (!settled) {
|
|
1098
|
+
if (!isSharedDrawingEmpty(shared)) settle();
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
remoteDirty = true;
|
|
1102
|
+
pump();
|
|
1103
|
+
};
|
|
1104
|
+
doc.on("afterTransaction", afterTransaction);
|
|
1105
|
+
const stops = [
|
|
1106
|
+
editor.onLocalChange(() => {
|
|
1107
|
+
if (disposed) return;
|
|
1108
|
+
localDirty = true;
|
|
1109
|
+
pump();
|
|
1110
|
+
}),
|
|
1111
|
+
editor.onIdle(pump),
|
|
1112
|
+
host.on("ready", settle),
|
|
1113
|
+
host.on("synced", () => {
|
|
1114
|
+
settle();
|
|
1115
|
+
pump();
|
|
1116
|
+
})
|
|
1117
|
+
];
|
|
1118
|
+
if (host.synced || host.canWrite()) settle();
|
|
1119
|
+
const idle = async () => {
|
|
1120
|
+
while (running) await running;
|
|
1121
|
+
};
|
|
1122
|
+
const replay = async (kind) => {
|
|
1123
|
+
await idle();
|
|
1124
|
+
const stack = kind === "undo" ? undoManager.undoStack : undoManager.redoStack;
|
|
1125
|
+
if (disposed || !stack.length) return false;
|
|
1126
|
+
if (kind === "undo") undoManager.undo();
|
|
1127
|
+
else undoManager.redo();
|
|
1128
|
+
await idle();
|
|
1129
|
+
return true;
|
|
1130
|
+
};
|
|
1131
|
+
return {
|
|
1132
|
+
undo: () => replay("undo"),
|
|
1133
|
+
redo: () => replay("redo"),
|
|
1134
|
+
canUndo: () => undoManager.undoStack.length > 0,
|
|
1135
|
+
canRedo: () => undoManager.redoStack.length > 0,
|
|
1136
|
+
onHistoryChange: (listener) => {
|
|
1137
|
+
historyListeners.add(listener);
|
|
1138
|
+
return () => historyListeners.delete(listener);
|
|
1139
|
+
},
|
|
1140
|
+
idle,
|
|
1141
|
+
dispose: () => {
|
|
1142
|
+
if (disposed) return;
|
|
1143
|
+
disposed = true;
|
|
1144
|
+
doc.off("afterTransaction", afterTransaction);
|
|
1145
|
+
for (const stop of stops) stop();
|
|
1146
|
+
undoManager.destroy();
|
|
1147
|
+
historyListeners.clear();
|
|
1148
|
+
}
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
export { BODIES, CONNECTS, DEAD, DrawingKeys, META, PAGES, PARTS, SCHEMA_VERSION, SHAPES, VISIO_EDIT_ORIGIN, VISIO_SYNC_ORIGIN, bindDrawingSession, composeDrawing, isSharedDrawingEmpty, readSharedDrawing, sharedDrawing, snapshotDrawing, writeSharedDrawing };
|