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
|
@@ -10,6 +10,19 @@ var DEFAULT_XML_LIMITS = {
|
|
|
10
10
|
maxDepth: 512,
|
|
11
11
|
maxNodes: 5e6
|
|
12
12
|
};
|
|
13
|
+
var XmlLimitError = class extends Error {
|
|
14
|
+
code = "xml-limit";
|
|
15
|
+
/** The limit that was exceeded. */
|
|
16
|
+
limit;
|
|
17
|
+
/** Its value: the largest depth or element count allowed. */
|
|
18
|
+
maximum;
|
|
19
|
+
constructor(message, limit, maximum) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.name = "XmlLimitError";
|
|
22
|
+
this.limit = limit;
|
|
23
|
+
this.maximum = maximum;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
13
26
|
var TAG_RE = /<(\/?)([^\s\/><]+)(?:\s+[^\s=\/><]+\s*=\s*(?:"[^"<]*"|'[^'<]*'))*\s*(\/?)>/y;
|
|
14
27
|
var MARKUP_SKIPS = [
|
|
15
28
|
["<!--", "-->"],
|
|
@@ -43,11 +56,22 @@ function checkXmlLimits(xml, label, limits = {}) {
|
|
|
43
56
|
continue;
|
|
44
57
|
}
|
|
45
58
|
nodes++;
|
|
46
|
-
if (nodes > maxNodes)
|
|
59
|
+
if (nodes > maxNodes)
|
|
60
|
+
throw new XmlLimitError(
|
|
61
|
+
`${label} XML exceeds the limit of ${maxNodes} elements`,
|
|
62
|
+
"maxNodes",
|
|
63
|
+
maxNodes
|
|
64
|
+
);
|
|
47
65
|
if (!selfClosing && ++depth > maxDepth)
|
|
48
|
-
throw new
|
|
66
|
+
throw new XmlLimitError(
|
|
67
|
+
`${label} XML exceeds the nesting depth limit of ${maxDepth}`,
|
|
68
|
+
"maxDepth",
|
|
69
|
+
maxDepth
|
|
70
|
+
);
|
|
49
71
|
}
|
|
50
72
|
}
|
|
73
|
+
var CRLF_DECLARATION = /^<\?xml[^>]*\?>\r\n/;
|
|
74
|
+
var crlfDeclarations = /* @__PURE__ */ new WeakSet();
|
|
51
75
|
function parseXml(xml, options2 = {}) {
|
|
52
76
|
const label = options2.label ?? "OOXML";
|
|
53
77
|
if (/<!DOCTYPE|<!ENTITY/i.test(xml))
|
|
@@ -69,9 +93,13 @@ function parseXml(xml, options2 = {}) {
|
|
|
69
93
|
}
|
|
70
94
|
if (parseError || !parsed.documentElement)
|
|
71
95
|
throw new Error(`Invalid ${label} XML: ${parseError || "missing root element"}`);
|
|
96
|
+
if (CRLF_DECLARATION.test(xml)) crlfDeclarations.add(parsed);
|
|
72
97
|
return parsed;
|
|
73
98
|
}
|
|
74
|
-
var buildXml = (node) =>
|
|
99
|
+
var buildXml = (node) => {
|
|
100
|
+
const xml = new XMLSerializer().serializeToString(node);
|
|
101
|
+
return crlfDeclarations.has(node) ? xml.replace(/^(<\?xml[^>]*\?>)\n/, "$1\r\n") : xml;
|
|
102
|
+
};
|
|
75
103
|
var isElement = (node) => node.nodeType === 1;
|
|
76
104
|
var elements = (parent) => Array.from(parent.childNodes).filter(isElement);
|
|
77
105
|
function named(element, local, ns, lenient = true) {
|
|
@@ -1489,9 +1517,10 @@ function expectDefined(value, context) {
|
|
|
1489
1517
|
// docx/element-order.ts
|
|
1490
1518
|
function orderChildren(parent, order) {
|
|
1491
1519
|
const elements2 = Array.from(parent.childNodes).filter(isElement);
|
|
1520
|
+
const rankOf = (name) => order.findIndex((entry) => typeof entry === "string" ? entry === name : entry.includes(name));
|
|
1492
1521
|
let previousRank = -1;
|
|
1493
1522
|
const ranked = elements2.map((element, index) => {
|
|
1494
|
-
const rank = element.namespaceURI === WORD_NS ?
|
|
1523
|
+
const rank = element.namespaceURI === WORD_NS ? rankOf(element.localName ?? "") : -1;
|
|
1495
1524
|
if (rank >= 0) previousRank = rank;
|
|
1496
1525
|
return { element, index, rank: rank >= 0 ? rank : previousRank + 0.5 };
|
|
1497
1526
|
});
|
|
@@ -1554,6 +1583,35 @@ function orderParagraphProperties(props) {
|
|
|
1554
1583
|
orderChildren(props, PPR_ORDER);
|
|
1555
1584
|
}
|
|
1556
1585
|
|
|
1586
|
+
// docx/special-characters.ts
|
|
1587
|
+
function symbolCharacter(char) {
|
|
1588
|
+
const code = /^[0-9a-f]{1,6}$/i.test(char) ? Number.parseInt(char, 16) : Number.NaN;
|
|
1589
|
+
if (!Number.isInteger(code) || code > 1114111 || code >= 55296 && code <= 57343) return "";
|
|
1590
|
+
return String.fromCodePoint(code < 256 ? 61440 + code : code);
|
|
1591
|
+
}
|
|
1592
|
+
function symbolOnly(run) {
|
|
1593
|
+
const symbol = run.symbol && symbolCharacter(run.symbol.char);
|
|
1594
|
+
return Boolean(symbol && run.text && [...run.text].every((character) => character === symbol));
|
|
1595
|
+
}
|
|
1596
|
+
function symbolSegments(run) {
|
|
1597
|
+
const symbol = run.symbol && symbolCharacter(run.symbol.char);
|
|
1598
|
+
if (!symbol || symbolOnly(run) || !run.text.includes(symbol)) return [run];
|
|
1599
|
+
const segments = [];
|
|
1600
|
+
let piece = "";
|
|
1601
|
+
let symbols = false;
|
|
1602
|
+
for (const character of run.text) {
|
|
1603
|
+
const isSymbol = character === symbol;
|
|
1604
|
+
if (piece && isSymbol !== symbols) {
|
|
1605
|
+
segments.push({ ...run, text: piece });
|
|
1606
|
+
piece = "";
|
|
1607
|
+
}
|
|
1608
|
+
piece += character;
|
|
1609
|
+
symbols = isSymbol;
|
|
1610
|
+
}
|
|
1611
|
+
if (piece) segments.push({ ...run, text: piece });
|
|
1612
|
+
return segments;
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1557
1615
|
// docx/revision-properties.ts
|
|
1558
1616
|
function parsePropertiesSnapshot(xml, local) {
|
|
1559
1617
|
const element = parseXml2(xml).documentElement;
|
|
@@ -1562,142 +1620,6 @@ function parsePropertiesSnapshot(xml, local) {
|
|
|
1562
1620
|
return element;
|
|
1563
1621
|
}
|
|
1564
1622
|
|
|
1565
|
-
// docx/write-run-validation.ts
|
|
1566
|
-
var modeledRunProperties = /* @__PURE__ */ new Set([
|
|
1567
|
-
"b",
|
|
1568
|
-
"i",
|
|
1569
|
-
"bCs",
|
|
1570
|
-
"iCs",
|
|
1571
|
-
"szCs",
|
|
1572
|
-
"strike",
|
|
1573
|
-
"u",
|
|
1574
|
-
"highlight",
|
|
1575
|
-
"vertAlign",
|
|
1576
|
-
"sz",
|
|
1577
|
-
"rFonts",
|
|
1578
|
-
"color",
|
|
1579
|
-
"lang",
|
|
1580
|
-
"rtl",
|
|
1581
|
-
"rStyle",
|
|
1582
|
-
"caps",
|
|
1583
|
-
"smallCaps",
|
|
1584
|
-
"dstrike",
|
|
1585
|
-
"vanish",
|
|
1586
|
-
"spacing",
|
|
1587
|
-
"w",
|
|
1588
|
-
"kern",
|
|
1589
|
-
"position",
|
|
1590
|
-
"shd"
|
|
1591
|
-
]);
|
|
1592
|
-
var simpleToggleProperties = [
|
|
1593
|
-
"b",
|
|
1594
|
-
"i",
|
|
1595
|
-
"bCs",
|
|
1596
|
-
"iCs",
|
|
1597
|
-
"strike",
|
|
1598
|
-
"caps",
|
|
1599
|
-
"smallCaps",
|
|
1600
|
-
"dstrike",
|
|
1601
|
-
"vanish"
|
|
1602
|
-
];
|
|
1603
|
-
var allowedRunPropertyAttributes = {
|
|
1604
|
-
rFonts: [
|
|
1605
|
-
"ascii",
|
|
1606
|
-
"hAnsi",
|
|
1607
|
-
"eastAsia",
|
|
1608
|
-
"cs",
|
|
1609
|
-
"asciiTheme",
|
|
1610
|
-
"hAnsiTheme",
|
|
1611
|
-
"eastAsiaTheme",
|
|
1612
|
-
"cstheme"
|
|
1613
|
-
],
|
|
1614
|
-
lang: ["val", "eastAsia", "bidi"],
|
|
1615
|
-
highlight: ["val"],
|
|
1616
|
-
vertAlign: ["val"],
|
|
1617
|
-
sz: ["val"],
|
|
1618
|
-
szCs: ["val"],
|
|
1619
|
-
rtl: ["val"],
|
|
1620
|
-
rStyle: ["val"],
|
|
1621
|
-
spacing: ["val"],
|
|
1622
|
-
w: ["val"],
|
|
1623
|
-
kern: ["val"],
|
|
1624
|
-
position: ["val"],
|
|
1625
|
-
u: ["val", "color"],
|
|
1626
|
-
color: ["val", "themeColor", "themeTint", "themeShade"],
|
|
1627
|
-
shd: ["val", "fill", "color", "themeFill", "themeFillTint", "themeFillShade"]
|
|
1628
|
-
};
|
|
1629
|
-
function hasUnexpectedAttributes(element, allowed, allowDateUtc = false) {
|
|
1630
|
-
for (const attribute of Array.from(element.attributes)) {
|
|
1631
|
-
if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
|
|
1632
|
-
if (allowDateUtc && attribute.namespaceURI === WORD_DATE_UTC_NS && attribute.localName === "dateUtc")
|
|
1633
|
-
continue;
|
|
1634
|
-
if (attribute.namespaceURI !== WORD_NS || !allowed.includes(attribute.localName)) return true;
|
|
1635
|
-
}
|
|
1636
|
-
return false;
|
|
1637
|
-
}
|
|
1638
|
-
function runPropertiesHaveUnknownContent(properties2) {
|
|
1639
|
-
if (!properties2) return false;
|
|
1640
|
-
if (hasUnexpectedAttributes(properties2, [])) return true;
|
|
1641
|
-
for (const node of Array.from(properties2.childNodes)) {
|
|
1642
|
-
if (node.nodeType !== 1) {
|
|
1643
|
-
if (node.nodeType === 3 && node.textContent?.trim()) return true;
|
|
1644
|
-
continue;
|
|
1645
|
-
}
|
|
1646
|
-
const property = node;
|
|
1647
|
-
if (property.namespaceURI === WORD_NS && property.localName === "rPrChange") {
|
|
1648
|
-
if (hasUnexpectedAttributes(property, ["id", "author", "date"], true) || Array.from(property.childNodes).some(
|
|
1649
|
-
(child2) => child2.nodeType === 3 && child2.textContent?.trim()
|
|
1650
|
-
) || elements(property).length !== 1 || !first2(property, "rPr") || !getW(property, "id") || !getW(property, "author"))
|
|
1651
|
-
return true;
|
|
1652
|
-
continue;
|
|
1653
|
-
}
|
|
1654
|
-
if (property.namespaceURI === WORD_2010_NS && property.localName === "ligatures") {
|
|
1655
|
-
if (!isLigatures(property.getAttributeNS(WORD_2010_NS, "val")) || elements(property).length)
|
|
1656
|
-
return true;
|
|
1657
|
-
if (Array.from(property.attributes).some(
|
|
1658
|
-
(attribute) => attribute.namespaceURI !== "http://www.w3.org/2000/xmlns/" && (attribute.namespaceURI !== WORD_2010_NS || attribute.localName !== "val")
|
|
1659
|
-
))
|
|
1660
|
-
return true;
|
|
1661
|
-
continue;
|
|
1662
|
-
}
|
|
1663
|
-
if (property.namespaceURI !== WORD_NS || !modeledRunProperties.has(property.localName))
|
|
1664
|
-
return true;
|
|
1665
|
-
const allowed = simpleToggleProperties.includes(property.localName) ? ["val"] : allowedRunPropertyAttributes[property.localName] ?? [];
|
|
1666
|
-
if (hasUnexpectedAttributes(property, allowed) || elements(property).length > 0) return true;
|
|
1667
|
-
const value = getW(property, "val");
|
|
1668
|
-
if (property.localName === "w" && parseTextScale(value ?? "100") === void 0) return true;
|
|
1669
|
-
if (property.localName === "kern" && parseHalfPoints(value) === void 0) return true;
|
|
1670
|
-
if (property.localName === "position" && parseSignedHalfPoints(value) === void 0)
|
|
1671
|
-
return true;
|
|
1672
|
-
if (property.localName === "highlight" && value && !isWordHighlightToken(value)) return true;
|
|
1673
|
-
if (property.localName === "rtl" && value && !["1", "true", "on", "0", "false", "off", "no"].includes(value))
|
|
1674
|
-
return true;
|
|
1675
|
-
if (property.localName === "lang" && ["val", "eastAsia", "bidi"].some((key) => {
|
|
1676
|
-
const language = getW(property, key);
|
|
1677
|
-
return language !== void 0 && !isValidLanguageTag(language);
|
|
1678
|
-
}))
|
|
1679
|
-
return true;
|
|
1680
|
-
if (property.localName === "vertAlign" && !isStVerticalAlignRun(value)) return true;
|
|
1681
|
-
if (property.localName === "u" && value && !isWordUnderlineStyle(value) && !["0", "false", "off", "1", "true", "on"].includes(value))
|
|
1682
|
-
return true;
|
|
1683
|
-
if (property.localName === "u") {
|
|
1684
|
-
const color = getW(property, "color");
|
|
1685
|
-
if (color && parseHexColor(color) === void 0) return true;
|
|
1686
|
-
}
|
|
1687
|
-
if (["sz", "szCs"].includes(property.localName) && value && parseHalfPoints(value) === void 0)
|
|
1688
|
-
return true;
|
|
1689
|
-
if (property.localName === "spacing" && value && parseSignedTwips(value) === void 0)
|
|
1690
|
-
return true;
|
|
1691
|
-
if (property.localName === "color" || property.localName === "shd") {
|
|
1692
|
-
const fillValue = property.localName === "shd" ? getW(property, "fill") : value;
|
|
1693
|
-
if (fillValue && parseHexColor(fillValue) === void 0) return true;
|
|
1694
|
-
const themeValue = getW(property, property.localName === "shd" ? "themeFill" : "themeColor");
|
|
1695
|
-
if (themeValue && !isThemeColorToken(themeValue)) return true;
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
return false;
|
|
1699
|
-
}
|
|
1700
|
-
|
|
1701
1623
|
// docx/defined-props.ts
|
|
1702
1624
|
function definedProps(source) {
|
|
1703
1625
|
return Object.fromEntries(Object.entries(source).filter(([, value]) => value !== void 0));
|
|
@@ -11623,6 +11545,17 @@ function composeDataLabelText(input) {
|
|
|
11623
11545
|
return { text: text2, color: parts.length === 1 && flags.showValue ? valueColor : void 0 };
|
|
11624
11546
|
}
|
|
11625
11547
|
|
|
11548
|
+
// chart/extent.ts
|
|
11549
|
+
function extentOf(values) {
|
|
11550
|
+
let min = Infinity;
|
|
11551
|
+
let max = -Infinity;
|
|
11552
|
+
for (const value of values) {
|
|
11553
|
+
min = Math.min(min, value);
|
|
11554
|
+
max = Math.max(max, value);
|
|
11555
|
+
}
|
|
11556
|
+
return { min, max };
|
|
11557
|
+
}
|
|
11558
|
+
|
|
11626
11559
|
// chart/bubble-radius.ts
|
|
11627
11560
|
function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options2) {
|
|
11628
11561
|
const scale = (options2?.bubbleScale ?? 100) / 100;
|
|
@@ -11633,7 +11566,7 @@ function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options2) {
|
|
|
11633
11566
|
return medianRadius * scale * 0.5 + ratio * medianRadius * scale * 1.5;
|
|
11634
11567
|
}
|
|
11635
11568
|
function maxBubbleSize(sizes) {
|
|
11636
|
-
return
|
|
11569
|
+
return Math.max(1, extentOf(sizes.map(Math.abs)).max);
|
|
11637
11570
|
}
|
|
11638
11571
|
function medianBubbleRadius(plotWidth, plotHeight) {
|
|
11639
11572
|
return Math.min(plotWidth, plotHeight) * 0.04;
|
|
@@ -11979,8 +11912,7 @@ function computeHistogramBins(values, options2, format = String) {
|
|
|
11979
11912
|
});
|
|
11980
11913
|
}
|
|
11981
11914
|
if (regular.length > 0) {
|
|
11982
|
-
const min =
|
|
11983
|
-
const max = Math.max(...regular.map((item) => item.value));
|
|
11915
|
+
const { min, max } = extentOf(regular.map((item) => item.value));
|
|
11984
11916
|
const requestedSize = options2.binSize && options2.binSize > 0 ? options2.binSize : void 0;
|
|
11985
11917
|
const requestedCount = options2.binCount && options2.binCount > 0 ? options2.binCount : void 0;
|
|
11986
11918
|
const start = requestedSize ? Math.floor(min / requestedSize) * requestedSize : min;
|
|
@@ -12180,8 +12112,9 @@ function fitChartTrendline(options2, xVals, yVals) {
|
|
|
12180
12112
|
}
|
|
12181
12113
|
const model = fitModel(options2, xVals, yVals);
|
|
12182
12114
|
if (!model) return noFit();
|
|
12183
|
-
const
|
|
12184
|
-
const
|
|
12115
|
+
const xRange = extentOf(xVals);
|
|
12116
|
+
const startX = xRange.min - (options2.backward ?? 0);
|
|
12117
|
+
const endX = xRange.max + (options2.forward ?? 0);
|
|
12185
12118
|
const steps = Math.max(Math.ceil((endX - startX) * 4), 20);
|
|
12186
12119
|
const points = [];
|
|
12187
12120
|
for (let step = 0; step <= steps; step++) {
|
|
@@ -13714,8 +13647,7 @@ function computeLogValueRange(series, logBase) {
|
|
|
13714
13647
|
if (allValues.length === 0) {
|
|
13715
13648
|
return { min: 1, max: logBase, span: 1, logScale: true, logBase };
|
|
13716
13649
|
}
|
|
13717
|
-
const dataMin =
|
|
13718
|
-
const dataMax = Math.max(...allValues);
|
|
13650
|
+
const { min: dataMin, max: dataMax } = extentOf(allValues);
|
|
13719
13651
|
const logMin = Math.floor(Math.log(dataMin) / Math.log(logBase));
|
|
13720
13652
|
const logMax = Math.ceil(Math.log(dataMax) / Math.log(logBase));
|
|
13721
13653
|
const min = logBase ** logMin;
|
|
@@ -14280,8 +14212,9 @@ function waterfallView(chart, model, ctx) {
|
|
|
14280
14212
|
colors: { increase: role(0), decrease: role(1), total: role(2) }
|
|
14281
14213
|
};
|
|
14282
14214
|
const ends = steps.flatMap((step) => [step.startValue, step.endValue]);
|
|
14215
|
+
const range = extentOf(ends);
|
|
14283
14216
|
model.valueAxis = {
|
|
14284
|
-
...ends.length ? niceScale(
|
|
14217
|
+
...ends.length ? niceScale(range.min, range.max) : niceScale(0, 1),
|
|
14285
14218
|
percent: false
|
|
14286
14219
|
};
|
|
14287
14220
|
const labels = model.categories;
|
|
@@ -14397,7 +14330,8 @@ function chartSummaryView(chart, theme, options2 = {}) {
|
|
|
14397
14330
|
s.xValues = s.values.map((_, k) => numeric ? toNumber(cats[k] ?? null) : k + 1);
|
|
14398
14331
|
});
|
|
14399
14332
|
const xs = series.flatMap((s) => s.xValues ?? []).filter((x) => x !== null);
|
|
14400
|
-
|
|
14333
|
+
const range = extentOf(xs);
|
|
14334
|
+
model.xAxis = xs.length ? niceScale(range.min, range.max) : niceScale(0, 1);
|
|
14401
14335
|
}
|
|
14402
14336
|
if (type === "stock") model.stock = stockView(chart.stock, ctx);
|
|
14403
14337
|
if (type === "bubble") bubbleView(chart, model, ctx.evaluateRef);
|
|
@@ -14429,7 +14363,7 @@ function cartesianAxes(model, area, out) {
|
|
|
14429
14363
|
const cats = Math.max(1, model.categories.length);
|
|
14430
14364
|
const catW = Math.min(
|
|
14431
14365
|
area.w * 0.3,
|
|
14432
|
-
Math.max(
|
|
14366
|
+
Math.max(extentOf(model.categories.map((c) => textWidth(c, categorySize))).max, 8) + 6
|
|
14433
14367
|
);
|
|
14434
14368
|
const second = horizontal ? void 0 : model.secondaryAxis;
|
|
14435
14369
|
const secondLabels = second?.ticks.map((t) => axisTickText(t, model.axes?.secondary, second.percent)) ?? [];
|
|
@@ -15122,13 +15056,11 @@ function chartLegendSvg(model, area, frame2, options2) {
|
|
|
15122
15056
|
chartAreaRect(model, "legend", { x: manual.x, y: manual.y, w: manual.width, h: manual.height })
|
|
15123
15057
|
];
|
|
15124
15058
|
const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
|
|
15059
|
+
const widest = extentOf(widths).max;
|
|
15125
15060
|
entries.forEach((entry, i) => {
|
|
15126
15061
|
const available = horizontal ? chartTextWidth(entry.label, attrs, options2) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
|
|
15127
15062
|
const label = fitChartText(entry.label, available, attrs, options2);
|
|
15128
|
-
const contentWidth = Math.min(
|
|
15129
|
-
horizontal ? widths[i] ?? 0 : Math.max(...widths),
|
|
15130
|
-
rowWidth - size / 2
|
|
15131
|
-
);
|
|
15063
|
+
const contentWidth = Math.min(horizontal ? widths[i] ?? 0 : widest, rowWidth - size / 2);
|
|
15132
15064
|
const x = horizontal ? horizontalX : manual.x + Math.max(size / 4, (rowWidth - contentWidth) / 2);
|
|
15133
15065
|
const centerY = manual.y + (horizontal ? 0 : i * rowHeight) + rowHeight / 2;
|
|
15134
15066
|
markup.push(rect2(x, centerY - keySize / 2, keySize, keySize, entry.color));
|
|
@@ -15200,7 +15132,7 @@ function automaticLegend(model, area, out, options2, bounds) {
|
|
|
15200
15132
|
}
|
|
15201
15133
|
const width = Math.min(
|
|
15202
15134
|
area.w * 0.35,
|
|
15203
|
-
|
|
15135
|
+
extentOf(entries.map((e) => chartTextWidth(e.label, attrs, options2))).max + 22
|
|
15204
15136
|
);
|
|
15205
15137
|
const height = entries.length * rowH;
|
|
15206
15138
|
const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
|
|
@@ -15538,41 +15470,195 @@ function renderChartSummarySvg(summary, options2) {
|
|
|
15538
15470
|
return renderChartSvg(view, width, height, svg);
|
|
15539
15471
|
}
|
|
15540
15472
|
|
|
15541
|
-
// docx/
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15473
|
+
// docx/write-run-validation.ts
|
|
15474
|
+
var modeledRunProperties = /* @__PURE__ */ new Set([
|
|
15475
|
+
"b",
|
|
15476
|
+
"i",
|
|
15477
|
+
"bCs",
|
|
15478
|
+
"iCs",
|
|
15479
|
+
"szCs",
|
|
15480
|
+
"strike",
|
|
15481
|
+
"u",
|
|
15482
|
+
"highlight",
|
|
15483
|
+
"vertAlign",
|
|
15484
|
+
"sz",
|
|
15485
|
+
"rFonts",
|
|
15486
|
+
"color",
|
|
15487
|
+
"lang",
|
|
15488
|
+
"rtl",
|
|
15489
|
+
"rStyle",
|
|
15490
|
+
"caps",
|
|
15491
|
+
"smallCaps",
|
|
15492
|
+
"dstrike",
|
|
15493
|
+
"vanish",
|
|
15494
|
+
"spacing",
|
|
15495
|
+
"w",
|
|
15496
|
+
"kern",
|
|
15497
|
+
"position",
|
|
15498
|
+
"shd"
|
|
15499
|
+
]);
|
|
15500
|
+
var simpleToggleProperties = [
|
|
15501
|
+
"b",
|
|
15502
|
+
"i",
|
|
15503
|
+
"bCs",
|
|
15504
|
+
"iCs",
|
|
15505
|
+
"strike",
|
|
15506
|
+
"caps",
|
|
15507
|
+
"smallCaps",
|
|
15508
|
+
"dstrike",
|
|
15509
|
+
"vanish"
|
|
15510
|
+
];
|
|
15511
|
+
var allowedRunPropertyAttributes = {
|
|
15512
|
+
rFonts: [
|
|
15513
|
+
"ascii",
|
|
15514
|
+
"hAnsi",
|
|
15515
|
+
"eastAsia",
|
|
15516
|
+
"cs",
|
|
15517
|
+
"asciiTheme",
|
|
15518
|
+
"hAnsiTheme",
|
|
15519
|
+
"eastAsiaTheme",
|
|
15520
|
+
"cstheme"
|
|
15521
|
+
],
|
|
15522
|
+
lang: ["val", "eastAsia", "bidi"],
|
|
15523
|
+
highlight: ["val"],
|
|
15524
|
+
vertAlign: ["val"],
|
|
15525
|
+
sz: ["val"],
|
|
15526
|
+
szCs: ["val"],
|
|
15527
|
+
rtl: ["val"],
|
|
15528
|
+
rStyle: ["val"],
|
|
15529
|
+
spacing: ["val"],
|
|
15530
|
+
w: ["val"],
|
|
15531
|
+
kern: ["val"],
|
|
15532
|
+
position: ["val"],
|
|
15533
|
+
u: ["val", "color"],
|
|
15534
|
+
color: ["val", "themeColor", "themeTint", "themeShade"],
|
|
15535
|
+
shd: ["val", "fill", "color", "themeFill", "themeFillTint", "themeFillShade"]
|
|
15536
|
+
};
|
|
15537
|
+
function hasUnexpectedAttributes(element, allowed, allowDateUtc = false) {
|
|
15538
|
+
for (const attribute of Array.from(element.attributes)) {
|
|
15539
|
+
if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
|
|
15540
|
+
if (allowDateUtc && attribute.namespaceURI === WORD_DATE_UTC_NS && attribute.localName === "dateUtc")
|
|
15541
|
+
continue;
|
|
15542
|
+
if (attribute.namespaceURI !== WORD_NS || !allowed.includes(attribute.localName)) return true;
|
|
15543
|
+
}
|
|
15544
|
+
return false;
|
|
15566
15545
|
}
|
|
15567
|
-
|
|
15568
|
-
|
|
15569
|
-
|
|
15570
|
-
|
|
15571
|
-
|
|
15572
|
-
|
|
15573
|
-
|
|
15574
|
-
|
|
15575
|
-
|
|
15546
|
+
function runPropertiesHaveUnknownContent(properties2) {
|
|
15547
|
+
if (!properties2) return false;
|
|
15548
|
+
if (hasUnexpectedAttributes(properties2, [])) return true;
|
|
15549
|
+
for (const node of Array.from(properties2.childNodes)) {
|
|
15550
|
+
if (node.nodeType !== 1) {
|
|
15551
|
+
if (node.nodeType === 3 && node.textContent?.trim()) return true;
|
|
15552
|
+
continue;
|
|
15553
|
+
}
|
|
15554
|
+
const property = node;
|
|
15555
|
+
if (property.namespaceURI === WORD_NS && property.localName === "rPrChange") {
|
|
15556
|
+
if (hasUnexpectedAttributes(property, ["id", "author", "date"], true) || Array.from(property.childNodes).some(
|
|
15557
|
+
(child2) => child2.nodeType === 3 && child2.textContent?.trim()
|
|
15558
|
+
) || elements(property).length !== 1 || !first2(property, "rPr") || !getW(property, "id") || !getW(property, "author"))
|
|
15559
|
+
return true;
|
|
15560
|
+
continue;
|
|
15561
|
+
}
|
|
15562
|
+
if (property.namespaceURI === WORD_2010_NS && property.localName === "ligatures") {
|
|
15563
|
+
if (!isLigatures(property.getAttributeNS(WORD_2010_NS, "val")) || elements(property).length)
|
|
15564
|
+
return true;
|
|
15565
|
+
if (Array.from(property.attributes).some(
|
|
15566
|
+
(attribute) => attribute.namespaceURI !== "http://www.w3.org/2000/xmlns/" && (attribute.namespaceURI !== WORD_2010_NS || attribute.localName !== "val")
|
|
15567
|
+
))
|
|
15568
|
+
return true;
|
|
15569
|
+
continue;
|
|
15570
|
+
}
|
|
15571
|
+
if (property.namespaceURI !== WORD_NS || !modeledRunProperties.has(property.localName))
|
|
15572
|
+
return true;
|
|
15573
|
+
const allowed = simpleToggleProperties.includes(property.localName) ? ["val"] : allowedRunPropertyAttributes[property.localName] ?? [];
|
|
15574
|
+
if (hasUnexpectedAttributes(property, allowed) || elements(property).length > 0) return true;
|
|
15575
|
+
const value = getW(property, "val");
|
|
15576
|
+
if (property.localName === "w" && parseTextScale(value ?? "100") === void 0) return true;
|
|
15577
|
+
if (property.localName === "kern" && parseHalfPoints(value) === void 0) return true;
|
|
15578
|
+
if (property.localName === "position" && parseSignedHalfPoints(value) === void 0)
|
|
15579
|
+
return true;
|
|
15580
|
+
if (property.localName === "highlight" && value && !isWordHighlightToken(value)) return true;
|
|
15581
|
+
if (property.localName === "rtl" && value && !["1", "true", "on", "0", "false", "off", "no"].includes(value))
|
|
15582
|
+
return true;
|
|
15583
|
+
if (property.localName === "lang" && ["val", "eastAsia", "bidi"].some((key) => {
|
|
15584
|
+
const language = getW(property, key);
|
|
15585
|
+
return language !== void 0 && !isValidLanguageTag(language);
|
|
15586
|
+
}))
|
|
15587
|
+
return true;
|
|
15588
|
+
if (property.localName === "vertAlign" && !isStVerticalAlignRun(value)) return true;
|
|
15589
|
+
if (property.localName === "u" && value && !isWordUnderlineStyle(value) && !["0", "false", "off", "1", "true", "on"].includes(value))
|
|
15590
|
+
return true;
|
|
15591
|
+
if (property.localName === "u") {
|
|
15592
|
+
const color = getW(property, "color");
|
|
15593
|
+
if (color && parseHexColor(color) === void 0) return true;
|
|
15594
|
+
}
|
|
15595
|
+
if (["sz", "szCs"].includes(property.localName) && value && parseHalfPoints(value) === void 0)
|
|
15596
|
+
return true;
|
|
15597
|
+
if (property.localName === "spacing" && value && parseSignedTwips(value) === void 0)
|
|
15598
|
+
return true;
|
|
15599
|
+
if (property.localName === "color" || property.localName === "shd") {
|
|
15600
|
+
const fillValue = property.localName === "shd" ? getW(property, "fill") : value;
|
|
15601
|
+
if (fillValue && parseHexColor(fillValue) === void 0) return true;
|
|
15602
|
+
const themeValue = getW(property, property.localName === "shd" ? "themeFill" : "themeColor");
|
|
15603
|
+
if (themeValue && !isThemeColorToken(themeValue)) return true;
|
|
15604
|
+
}
|
|
15605
|
+
}
|
|
15606
|
+
return false;
|
|
15607
|
+
}
|
|
15608
|
+
|
|
15609
|
+
// docx/restore-run-format.ts
|
|
15610
|
+
function parseRunPropertiesSnapshot(xml) {
|
|
15611
|
+
return parsePropertiesSnapshot(xml, "rPr");
|
|
15612
|
+
}
|
|
15613
|
+
function restoreRunFormatting(run) {
|
|
15614
|
+
const nested = run.formatRevision;
|
|
15615
|
+
const xml = (nested ?? run.revision)?.previousRunPropertiesXml;
|
|
15616
|
+
if (!xml)
|
|
15617
|
+
throw new Error(
|
|
15618
|
+
"Cannot reject a formatting revision without its prior run-properties snapshot."
|
|
15619
|
+
);
|
|
15620
|
+
const snapshot2 = parseRunPropertiesSnapshot(xml);
|
|
15621
|
+
const previous = parseDirectRunProperties(snapshot2);
|
|
15622
|
+
for (const key of DIRECT_RUN_PROPERTY_KEYS) delete run[key];
|
|
15623
|
+
Object.assign(run, previous);
|
|
15624
|
+
run.restoredRunPropertiesXml = xml;
|
|
15625
|
+
if (runPropertiesHaveUnknownContent(snapshot2)) run.sourceRunPropertiesXml = buildXml(snapshot2);
|
|
15626
|
+
else delete run.sourceRunPropertiesXml;
|
|
15627
|
+
if (nested) delete run.formatRevision;
|
|
15628
|
+
else delete run.revision;
|
|
15629
|
+
}
|
|
15630
|
+
|
|
15631
|
+
// docx/form-fields.ts
|
|
15632
|
+
var formCheckboxChecked = (field) => field.checkBox?.checked ?? field.checkBox?.default ?? false;
|
|
15633
|
+
function formDropDownIndex(field) {
|
|
15634
|
+
const entries = field.dropDown?.entries ?? [];
|
|
15635
|
+
for (const index of [field.dropDown?.result, field.dropDown?.default, 0])
|
|
15636
|
+
if (index !== void 0 && index >= 0 && index < entries.length) return index;
|
|
15637
|
+
return void 0;
|
|
15638
|
+
}
|
|
15639
|
+
function formFieldDisplayText(run) {
|
|
15640
|
+
const field = run.fieldChar === "begin" ? run.formField : void 0;
|
|
15641
|
+
if (field?.kind === "checkbox") return formCheckboxChecked(field) ? "\u2612" : "\u2610";
|
|
15642
|
+
if (field?.kind === "dropDown") {
|
|
15643
|
+
const index = formDropDownIndex(field);
|
|
15644
|
+
return index === void 0 ? "" : field.dropDown.entries[index];
|
|
15645
|
+
}
|
|
15646
|
+
return void 0;
|
|
15647
|
+
}
|
|
15648
|
+
|
|
15649
|
+
// docx/field-lock.ts
|
|
15650
|
+
function isFieldLocked(run) {
|
|
15651
|
+
return run?.fieldFlags?.locked === true;
|
|
15652
|
+
}
|
|
15653
|
+
|
|
15654
|
+
// docx/paragraph-properties.ts
|
|
15655
|
+
var signedTwipValue = parseSignedTwips;
|
|
15656
|
+
var twipValue = parseTwips;
|
|
15657
|
+
function parseDirectParagraphProperties(props) {
|
|
15658
|
+
const paragraph = {};
|
|
15659
|
+
const bidi = onOffElement(first2(props, "bidi"));
|
|
15660
|
+
if (bidi !== void 0) paragraph.direction = bidi ? "rtl" : "ltr";
|
|
15661
|
+
const { align, justification } = parseJustification(props);
|
|
15576
15662
|
if (align) paragraph.align = align;
|
|
15577
15663
|
if (justification) paragraph.justification = justification;
|
|
15578
15664
|
const style = getW(first2(props, "pStyle"), "val");
|
|
@@ -15662,62 +15748,54 @@ function resolveNumberingLevel(catalog, numId, level2) {
|
|
|
15662
15748
|
return start !== base.start ? { ...base, start } : base;
|
|
15663
15749
|
}
|
|
15664
15750
|
|
|
15665
|
-
// docx/
|
|
15666
|
-
function
|
|
15667
|
-
|
|
15668
|
-
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
|
|
15751
|
+
// docx/field-instruction.ts
|
|
15752
|
+
function fieldTokens(instr) {
|
|
15753
|
+
const tokens = [];
|
|
15754
|
+
let index = 0;
|
|
15755
|
+
while (index < instr.length) {
|
|
15756
|
+
const char = instr[index];
|
|
15757
|
+
if (/\s/.test(char)) {
|
|
15758
|
+
index++;
|
|
15759
|
+
continue;
|
|
15673
15760
|
}
|
|
15674
|
-
|
|
15761
|
+
if (char === '"') {
|
|
15762
|
+
let value = "";
|
|
15763
|
+
index++;
|
|
15764
|
+
while (index < instr.length && instr[index] !== '"') {
|
|
15765
|
+
if (instr[index] === "\\" && /["\\]/.test(instr[index + 1] ?? "")) index++;
|
|
15766
|
+
value += instr[index++];
|
|
15767
|
+
}
|
|
15768
|
+
index++;
|
|
15769
|
+
tokens.push({ kind: "text", value });
|
|
15770
|
+
continue;
|
|
15771
|
+
}
|
|
15772
|
+
const switchMatch = /^\\([*#@!]|[A-Za-z]{1,2}(?![A-Za-z]))/.exec(instr.slice(index));
|
|
15773
|
+
if (switchMatch) {
|
|
15774
|
+
tokens.push({ kind: "switch", value: switchMatch[1].toLowerCase() });
|
|
15775
|
+
index += switchMatch[0].length;
|
|
15776
|
+
continue;
|
|
15777
|
+
}
|
|
15778
|
+
const word = /^\S+/.exec(instr.slice(index))[0];
|
|
15779
|
+
tokens.push({ kind: "text", value: word });
|
|
15780
|
+
index += word.length;
|
|
15781
|
+
}
|
|
15782
|
+
return tokens;
|
|
15675
15783
|
}
|
|
15676
|
-
|
|
15677
|
-
|
|
15678
|
-
|
|
15679
|
-
|
|
15680
|
-
|
|
15681
|
-
|
|
15682
|
-
|
|
15683
|
-
)
|
|
15784
|
+
var TEXT_CASES = /* @__PURE__ */ new Set(["upper", "lower", "firstcap", "caps"]);
|
|
15785
|
+
var isFieldTextCase = (format) => TEXT_CASES.has(format.toLowerCase());
|
|
15786
|
+
function applyFieldTextCase(text2, format) {
|
|
15787
|
+
if (format === "upper") return text2.toUpperCase();
|
|
15788
|
+
if (format === "lower") return text2.toLowerCase();
|
|
15789
|
+
const capitalize = (word) => word.replace(
|
|
15790
|
+
/^(\P{L}*)(\p{L})/u,
|
|
15791
|
+
(_match, lead, letter) => `${lead}${letter.toUpperCase()}`
|
|
15684
15792
|
);
|
|
15685
|
-
|
|
15686
|
-
|
|
15687
|
-
|
|
15688
|
-
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
...section.headers ? { headers: slots(section.headers) } : {},
|
|
15692
|
-
...section.footers ? { footers: slots(section.footers) } : {}
|
|
15693
|
-
}))
|
|
15694
|
-
} : {},
|
|
15695
|
-
...model.footnoteSeparators ? {
|
|
15696
|
-
footnoteSeparators: Object.fromEntries(
|
|
15697
|
-
Object.entries(model.footnoteSeparators).map(([kind, note]) => [
|
|
15698
|
-
kind,
|
|
15699
|
-
{ ...note, blocks: mapBlockParagraphs(note.blocks, map) }
|
|
15700
|
-
])
|
|
15701
|
-
)
|
|
15702
|
-
} : {},
|
|
15703
|
-
...model.footnotes ? {
|
|
15704
|
-
footnotes: model.footnotes.map((note) => ({
|
|
15705
|
-
...note,
|
|
15706
|
-
blocks: mapBlockParagraphs(note.blocks, map)
|
|
15707
|
-
}))
|
|
15708
|
-
} : {},
|
|
15709
|
-
...model.endnotes ? {
|
|
15710
|
-
endnotes: model.endnotes.map((note) => ({
|
|
15711
|
-
...note,
|
|
15712
|
-
blocks: mapBlockParagraphs(note.blocks, map)
|
|
15713
|
-
}))
|
|
15714
|
-
} : {}
|
|
15715
|
-
};
|
|
15716
|
-
}
|
|
15717
|
-
|
|
15718
|
-
// docx/field-runs.ts
|
|
15719
|
-
function fieldName(instr) {
|
|
15720
|
-
return instr.trim().split(/\s+/)[0]?.toUpperCase() ?? "";
|
|
15793
|
+
if (format === "firstcap")
|
|
15794
|
+
return text2.replace(
|
|
15795
|
+
/^(\s*)(\S+)/,
|
|
15796
|
+
(_match, space, word) => `${space}${capitalize(word)}`
|
|
15797
|
+
);
|
|
15798
|
+
return text2.replace(/\S+/g, capitalize);
|
|
15721
15799
|
}
|
|
15722
15800
|
|
|
15723
15801
|
// docx/cell-blocks.ts
|
|
@@ -15745,195 +15823,70 @@ function cellSourceBlocks(cell) {
|
|
|
15745
15823
|
blocks.push(...cell.paragraphs.slice(cursor));
|
|
15746
15824
|
return blocks;
|
|
15747
15825
|
}
|
|
15826
|
+
function documentParagraphs(blocks) {
|
|
15827
|
+
const result = [];
|
|
15828
|
+
const visit = (items) => {
|
|
15829
|
+
for (const block of items) {
|
|
15830
|
+
if (block.type === "paragraph") result.push(block);
|
|
15831
|
+
else for (const row2 of block.rows) for (const cell of row2) visit(cellSourceBlocks(cell));
|
|
15832
|
+
}
|
|
15833
|
+
};
|
|
15834
|
+
visit(blocks);
|
|
15835
|
+
return result;
|
|
15836
|
+
}
|
|
15748
15837
|
|
|
15749
|
-
// docx/
|
|
15750
|
-
|
|
15751
|
-
[1e3,
|
|
15752
|
-
[
|
|
15753
|
-
|
|
15754
|
-
|
|
15755
|
-
|
|
15756
|
-
|
|
15757
|
-
|
|
15758
|
-
|
|
15759
|
-
|
|
15760
|
-
|
|
15761
|
-
|
|
15762
|
-
|
|
15763
|
-
|
|
15764
|
-
|
|
15765
|
-
|
|
15766
|
-
|
|
15838
|
+
// docx/numbering-text.ts
|
|
15839
|
+
function romanNumeral(n2) {
|
|
15840
|
+
const values = [1e3, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
|
|
15841
|
+
const numerals = [
|
|
15842
|
+
"M",
|
|
15843
|
+
"CM",
|
|
15844
|
+
"D",
|
|
15845
|
+
"CD",
|
|
15846
|
+
"C",
|
|
15847
|
+
"XC",
|
|
15848
|
+
"L",
|
|
15849
|
+
"XL",
|
|
15850
|
+
"X",
|
|
15851
|
+
"IX",
|
|
15852
|
+
"V",
|
|
15853
|
+
"IV",
|
|
15854
|
+
"I"
|
|
15855
|
+
];
|
|
15856
|
+
let remaining = Math.max(1, Math.min(Math.trunc(n2), 3999));
|
|
15767
15857
|
let result = "";
|
|
15768
|
-
for (const [
|
|
15769
|
-
while (remaining >=
|
|
15770
|
-
result +=
|
|
15771
|
-
remaining -=
|
|
15858
|
+
for (const [i, value] of values.entries()) {
|
|
15859
|
+
while (remaining >= value) {
|
|
15860
|
+
result += numerals[i] ?? "";
|
|
15861
|
+
remaining -= value;
|
|
15772
15862
|
}
|
|
15773
15863
|
}
|
|
15774
|
-
return result
|
|
15864
|
+
return result;
|
|
15775
15865
|
}
|
|
15776
|
-
|
|
15777
|
-
|
|
15778
|
-
|
|
15779
|
-
|
|
15780
|
-
|
|
15781
|
-
|
|
15782
|
-
|
|
15866
|
+
var LATIN_LOWER = Array.from("abcdefghijklmnopqrstuvwxyz");
|
|
15867
|
+
var MAX_LETTER_LABEL = 64;
|
|
15868
|
+
function letterLabel(n2) {
|
|
15869
|
+
const index = Math.max(0, Math.trunc(n2) - 1);
|
|
15870
|
+
const letter = LATIN_LOWER[index % LATIN_LOWER.length] ?? "a";
|
|
15871
|
+
const repeats = Math.min(Math.floor(index / LATIN_LOWER.length) + 1, MAX_LETTER_LABEL);
|
|
15872
|
+
return letter.repeat(repeats);
|
|
15873
|
+
}
|
|
15874
|
+
var ORDINAL_SUFFIX = (n2) => {
|
|
15875
|
+
const abs = Math.abs(Math.trunc(n2));
|
|
15876
|
+
if (abs % 100 >= 11 && abs % 100 <= 13) return "th";
|
|
15877
|
+
switch (abs % 10) {
|
|
15878
|
+
case 1:
|
|
15879
|
+
return "st";
|
|
15880
|
+
case 2:
|
|
15881
|
+
return "nd";
|
|
15882
|
+
case 3:
|
|
15883
|
+
return "rd";
|
|
15884
|
+
default:
|
|
15885
|
+
return "th";
|
|
15783
15886
|
}
|
|
15784
|
-
|
|
15785
|
-
|
|
15786
|
-
|
|
15787
|
-
switch (format) {
|
|
15788
|
-
case "upperRoman":
|
|
15789
|
-
return toRoman(value);
|
|
15790
|
-
case "lowerRoman":
|
|
15791
|
-
return toRoman(value).toLowerCase();
|
|
15792
|
-
case "upperLetter":
|
|
15793
|
-
return toLetters(value).toUpperCase();
|
|
15794
|
-
case "lowerLetter":
|
|
15795
|
-
return toLetters(value);
|
|
15796
|
-
case "decimalZero":
|
|
15797
|
-
return value < 10 ? `0${value}` : String(value);
|
|
15798
|
-
default:
|
|
15799
|
-
return String(value);
|
|
15800
|
-
}
|
|
15801
|
-
}
|
|
15802
|
-
function walkParagraph(paragraph, kind, order) {
|
|
15803
|
-
for (const run of paragraph.runs) {
|
|
15804
|
-
if (run.noteReference?.kind === kind && !order.has(run.noteReference.id))
|
|
15805
|
-
order.set(run.noteReference.id, order.size + 1);
|
|
15806
|
-
}
|
|
15807
|
-
}
|
|
15808
|
-
function walkBlocks(blocks, kind, order) {
|
|
15809
|
-
for (const block of blocks) {
|
|
15810
|
-
if (block.type === "paragraph") walkParagraph(block, kind, order);
|
|
15811
|
-
else
|
|
15812
|
-
for (const row2 of block.rows)
|
|
15813
|
-
for (const cell of row2) walkBlocks(cellSourceBlocks(cell), kind, order);
|
|
15814
|
-
}
|
|
15815
|
-
}
|
|
15816
|
-
function numberNotesInOrder(blocks, kind) {
|
|
15817
|
-
const order = /* @__PURE__ */ new Map();
|
|
15818
|
-
walkBlocks(blocks, kind, order);
|
|
15819
|
-
return order;
|
|
15820
|
-
}
|
|
15821
|
-
|
|
15822
|
-
// docx/chart-paint.ts
|
|
15823
|
-
function themeCatalogColorScheme(theme) {
|
|
15824
|
-
const colors = {};
|
|
15825
|
-
for (const [slot, value] of Object.entries(theme?.colors ?? {}))
|
|
15826
|
-
if (value) colors[slot] = { kind: "srgb", value: value.replace(/^#/, ""), transforms: [] };
|
|
15827
|
-
return { colors };
|
|
15828
|
-
}
|
|
15829
|
-
function docxChartPaint(chart, widthPx, heightPx, theme) {
|
|
15830
|
-
const space = chart?.chartSpace;
|
|
15831
|
-
const extended = chart?.chartEx;
|
|
15832
|
-
if (chart && extended) return paintExtended(chart, extended, widthPx, heightPx, theme);
|
|
15833
|
-
if (chart && chart.layoutId) return { label: `Chart (${chart.layoutId})` };
|
|
15834
|
-
if (!space) return { label: "Chart" };
|
|
15835
|
-
const kind = chartSpaceKind(space);
|
|
15836
|
-
if (!kind.drawn) return { label: kind.type ? `Chart (${kind.type})` : "Chart" };
|
|
15837
|
-
try {
|
|
15838
|
-
const fonts = {
|
|
15839
|
-
...theme?.fonts.major.latin ? { major: theme.fonts.major.latin } : {},
|
|
15840
|
-
...theme?.fonts.minor.latin ? { minor: theme.fonts.minor.latin } : {}
|
|
15841
|
-
};
|
|
15842
|
-
const svg = renderChartSpaceSvg(space, {
|
|
15843
|
-
width: Math.max(1, Math.round(widthPx)),
|
|
15844
|
-
height: Math.max(1, Math.round(heightPx)),
|
|
15845
|
-
theme: themeCatalogColorScheme(theme),
|
|
15846
|
-
fonts,
|
|
15847
|
-
...chart.formatting ? { formatting: chart.formatting } : {},
|
|
15848
|
-
...chart.colorPalette !== void 0 ? { colorPalette: chart.colorPalette } : {}
|
|
15849
|
-
});
|
|
15850
|
-
return { svg, label: chart.title ? `Chart: ${chart.title}` : "Chart" };
|
|
15851
|
-
} catch {
|
|
15852
|
-
return { label: kind.type ? `Chart (${kind.type})` : "Chart" };
|
|
15853
|
-
}
|
|
15854
|
-
}
|
|
15855
|
-
function paintExtended(chart, summary, widthPx, heightPx, theme) {
|
|
15856
|
-
try {
|
|
15857
|
-
const fonts = {
|
|
15858
|
-
...theme?.fonts.major.latin ? { major: theme.fonts.major.latin } : {},
|
|
15859
|
-
...theme?.fonts.minor.latin ? { minor: theme.fonts.minor.latin } : {}
|
|
15860
|
-
};
|
|
15861
|
-
const svg = renderChartSummarySvg(summary, {
|
|
15862
|
-
width: Math.max(1, Math.round(widthPx)),
|
|
15863
|
-
height: Math.max(1, Math.round(heightPx)),
|
|
15864
|
-
theme: themeCatalogColorScheme(theme),
|
|
15865
|
-
fonts
|
|
15866
|
-
});
|
|
15867
|
-
return { svg, label: chart.title ? `Chart: ${chart.title}` : "Chart" };
|
|
15868
|
-
} catch {
|
|
15869
|
-
return { label: `Chart (${chart.layoutId ?? "extended"})` };
|
|
15870
|
-
}
|
|
15871
|
-
}
|
|
15872
|
-
|
|
15873
|
-
// docx/diagram-theme.ts
|
|
15874
|
-
function diagramColorTheme(theme) {
|
|
15875
|
-
return {
|
|
15876
|
-
scheme(name) {
|
|
15877
|
-
if (!theme) return void 0;
|
|
15878
|
-
const slot = themeColorSlotFor(name, theme.colorMapping);
|
|
15879
|
-
const hex = slot ? theme.colors[slot] : void 0;
|
|
15880
|
-
return hex ? `#${hex.replace(/^#/, "").toUpperCase()}` : void 0;
|
|
15881
|
-
}
|
|
15882
|
-
};
|
|
15883
|
-
}
|
|
15884
|
-
|
|
15885
|
-
// docx/numbering-text.ts
|
|
15886
|
-
function romanNumeral(n2) {
|
|
15887
|
-
const values = [1e3, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
|
|
15888
|
-
const numerals = [
|
|
15889
|
-
"M",
|
|
15890
|
-
"CM",
|
|
15891
|
-
"D",
|
|
15892
|
-
"CD",
|
|
15893
|
-
"C",
|
|
15894
|
-
"XC",
|
|
15895
|
-
"L",
|
|
15896
|
-
"XL",
|
|
15897
|
-
"X",
|
|
15898
|
-
"IX",
|
|
15899
|
-
"V",
|
|
15900
|
-
"IV",
|
|
15901
|
-
"I"
|
|
15902
|
-
];
|
|
15903
|
-
let remaining = Math.max(1, Math.min(Math.trunc(n2), 3999));
|
|
15904
|
-
let result = "";
|
|
15905
|
-
for (const [i, value] of values.entries()) {
|
|
15906
|
-
while (remaining >= value) {
|
|
15907
|
-
result += numerals[i] ?? "";
|
|
15908
|
-
remaining -= value;
|
|
15909
|
-
}
|
|
15910
|
-
}
|
|
15911
|
-
return result;
|
|
15912
|
-
}
|
|
15913
|
-
var LATIN_LOWER = Array.from("abcdefghijklmnopqrstuvwxyz");
|
|
15914
|
-
var MAX_LETTER_LABEL = 64;
|
|
15915
|
-
function letterLabel(n2) {
|
|
15916
|
-
const index = Math.max(0, Math.trunc(n2) - 1);
|
|
15917
|
-
const letter = LATIN_LOWER[index % LATIN_LOWER.length] ?? "a";
|
|
15918
|
-
const repeats = Math.min(Math.floor(index / LATIN_LOWER.length) + 1, MAX_LETTER_LABEL);
|
|
15919
|
-
return letter.repeat(repeats);
|
|
15920
|
-
}
|
|
15921
|
-
var ORDINAL_SUFFIX = (n2) => {
|
|
15922
|
-
const abs = Math.abs(Math.trunc(n2));
|
|
15923
|
-
if (abs % 100 >= 11 && abs % 100 <= 13) return "th";
|
|
15924
|
-
switch (abs % 10) {
|
|
15925
|
-
case 1:
|
|
15926
|
-
return "st";
|
|
15927
|
-
case 2:
|
|
15928
|
-
return "nd";
|
|
15929
|
-
case 3:
|
|
15930
|
-
return "rd";
|
|
15931
|
-
default:
|
|
15932
|
-
return "th";
|
|
15933
|
-
}
|
|
15934
|
-
};
|
|
15935
|
-
function ordinalNumeral(n2) {
|
|
15936
|
-
return `${Math.trunc(n2)}${ORDINAL_SUFFIX(n2)}`;
|
|
15887
|
+
};
|
|
15888
|
+
function ordinalNumeral(n2) {
|
|
15889
|
+
return `${Math.trunc(n2)}${ORDINAL_SUFFIX(n2)}`;
|
|
15937
15890
|
}
|
|
15938
15891
|
var ONES = [
|
|
15939
15892
|
"",
|
|
@@ -16034,135 +15987,623 @@ function formatListNumber(numFmt, value) {
|
|
|
16034
15987
|
return String(value);
|
|
16035
15988
|
}
|
|
16036
15989
|
}
|
|
16037
|
-
function resolveParagraphNumbering(paragraph, styleCatalog, numberingCatalog) {
|
|
16038
|
-
if (paragraph.numbering)
|
|
16039
|
-
return paragraph.numbering.numId > 0 ? paragraph.numbering : void 0;
|
|
16040
|
-
if (!styleCatalog) return void 0;
|
|
16041
|
-
const inherited = resolveStyleNumbering(paragraph.style, styleCatalog);
|
|
16042
|
-
if (!inherited || inherited.numId <= 0) return void 0;
|
|
16043
|
-
if (numberingCatalog && paragraph.style && styleCatalog.styles[paragraph.style]) {
|
|
16044
|
-
for (let level2 = 0; level2 < 9; level2++) {
|
|
16045
|
-
const definition = resolveNumberingLevel(numberingCatalog, String(inherited.numId), level2);
|
|
16046
|
-
if (definition?.paragraphStyleId === paragraph.style)
|
|
16047
|
-
return { numId: inherited.numId, level: level2 };
|
|
16048
|
-
}
|
|
15990
|
+
function resolveParagraphNumbering(paragraph, styleCatalog, numberingCatalog) {
|
|
15991
|
+
if (paragraph.numbering)
|
|
15992
|
+
return paragraph.numbering.numId > 0 ? paragraph.numbering : void 0;
|
|
15993
|
+
if (!styleCatalog) return void 0;
|
|
15994
|
+
const inherited = resolveStyleNumbering(paragraph.style, styleCatalog);
|
|
15995
|
+
if (!inherited || inherited.numId <= 0) return void 0;
|
|
15996
|
+
if (numberingCatalog && paragraph.style && styleCatalog.styles[paragraph.style]) {
|
|
15997
|
+
for (let level2 = 0; level2 < 9; level2++) {
|
|
15998
|
+
const definition = resolveNumberingLevel(numberingCatalog, String(inherited.numId), level2);
|
|
15999
|
+
if (definition?.paragraphStyleId === paragraph.style)
|
|
16000
|
+
return { numId: inherited.numId, level: level2 };
|
|
16001
|
+
}
|
|
16002
|
+
}
|
|
16003
|
+
return inherited;
|
|
16004
|
+
}
|
|
16005
|
+
var NumberingCounters = class {
|
|
16006
|
+
counts = /* @__PURE__ */ new Map();
|
|
16007
|
+
started = /* @__PURE__ */ new Map();
|
|
16008
|
+
forNum(numId) {
|
|
16009
|
+
let counts = this.counts.get(numId);
|
|
16010
|
+
if (!counts) {
|
|
16011
|
+
counts = /* @__PURE__ */ new Map();
|
|
16012
|
+
this.counts.set(numId, counts);
|
|
16013
|
+
}
|
|
16014
|
+
return counts;
|
|
16015
|
+
}
|
|
16016
|
+
startedLevels(numId) {
|
|
16017
|
+
let started = this.started.get(numId);
|
|
16018
|
+
if (!started) {
|
|
16019
|
+
started = /* @__PURE__ */ new Set();
|
|
16020
|
+
this.started.set(numId, started);
|
|
16021
|
+
}
|
|
16022
|
+
return started;
|
|
16023
|
+
}
|
|
16024
|
+
/** Advances one level and resets deeper counters according to their resolved restart rules. */
|
|
16025
|
+
advance(numId, level2, def, catalog) {
|
|
16026
|
+
const counts = this.forNum(numId);
|
|
16027
|
+
const started = this.startedLevels(numId);
|
|
16028
|
+
const next = started.has(level2) ? (counts.get(level2) ?? def.start) + 1 : def.start;
|
|
16029
|
+
counts.set(level2, next);
|
|
16030
|
+
started.add(level2);
|
|
16031
|
+
for (const deeper of [...started]) {
|
|
16032
|
+
if (deeper <= level2) continue;
|
|
16033
|
+
const deeperDef = resolveNumberingLevel(catalog, numId, deeper);
|
|
16034
|
+
const restart = deeperDef?.lvlRestart;
|
|
16035
|
+
if (restart === 0) continue;
|
|
16036
|
+
const trigger = restart !== void 0 && restart > 0 && restart <= deeper ? restart - 1 : deeper - 1;
|
|
16037
|
+
if (level2 > trigger) continue;
|
|
16038
|
+
counts.delete(deeper);
|
|
16039
|
+
started.delete(deeper);
|
|
16040
|
+
}
|
|
16041
|
+
for (let ancestor = 0; ancestor < level2; ancestor++) {
|
|
16042
|
+
if (started.has(ancestor)) continue;
|
|
16043
|
+
const ancestorDef = resolveNumberingLevel(catalog, numId, ancestor);
|
|
16044
|
+
if (!ancestorDef) continue;
|
|
16045
|
+
counts.set(ancestor, ancestorDef.start);
|
|
16046
|
+
started.add(ancestor);
|
|
16047
|
+
}
|
|
16048
|
+
return next;
|
|
16049
|
+
}
|
|
16050
|
+
/** Current value for an ancestor placeholder, defaulting to its own start when never instantiated. */
|
|
16051
|
+
current(numId, level2, start) {
|
|
16052
|
+
return this.forNum(numId).get(level2) ?? start;
|
|
16053
|
+
}
|
|
16054
|
+
};
|
|
16055
|
+
function substituteLvlText(lvlText, numId, level2, catalog, counters, forceDecimal) {
|
|
16056
|
+
return lvlText.replace(/%([1-9])/g, (match, digit) => {
|
|
16057
|
+
const ancestorLevel = Number(digit) - 1;
|
|
16058
|
+
if (ancestorLevel > level2) return match;
|
|
16059
|
+
const ancestorDef = resolveNumberingLevel(catalog, numId, ancestorLevel);
|
|
16060
|
+
const start = ancestorDef?.start ?? 1;
|
|
16061
|
+
const value = counters.current(numId, ancestorLevel, start);
|
|
16062
|
+
const fmt = forceDecimal ? "decimal" : ancestorDef?.numFmt ?? "decimal";
|
|
16063
|
+
return formatListNumber(fmt, value);
|
|
16064
|
+
});
|
|
16065
|
+
}
|
|
16066
|
+
function computeListLabels(model) {
|
|
16067
|
+
const catalog = model.numberingCatalog;
|
|
16068
|
+
const labels = /* @__PURE__ */ new Map();
|
|
16069
|
+
if (!catalog) return labels;
|
|
16070
|
+
const counters = new NumberingCounters();
|
|
16071
|
+
for (const paragraph of documentParagraphs(model.blocks)) {
|
|
16072
|
+
const numbering = resolveParagraphNumbering(paragraph, model.paragraphStyles, catalog);
|
|
16073
|
+
if (!numbering) continue;
|
|
16074
|
+
const numId = String(numbering.numId);
|
|
16075
|
+
const level2 = Math.min(8, Math.max(0, numbering.level));
|
|
16076
|
+
const def = resolveNumberingLevel(catalog, numId, level2);
|
|
16077
|
+
if (!def) continue;
|
|
16078
|
+
if (def.numFmt === "none") continue;
|
|
16079
|
+
counters.advance(numId, level2, def, catalog);
|
|
16080
|
+
const text2 = def.numFmt === "bullet" ? def.lvlText : substituteLvlText(def.lvlText, numId, level2, catalog, counters, Boolean(def.isLgl));
|
|
16081
|
+
labels.set(paragraph.id, {
|
|
16082
|
+
numId,
|
|
16083
|
+
level: level2,
|
|
16084
|
+
text: text2,
|
|
16085
|
+
suffix: def.suffix ?? "tab",
|
|
16086
|
+
...definedProps({
|
|
16087
|
+
alignment: def.lvlJc,
|
|
16088
|
+
indentLeftTwips: def.indentLeftTwips,
|
|
16089
|
+
hangingTwips: def.hangingTwips,
|
|
16090
|
+
firstLineTwips: def.firstLineTwips,
|
|
16091
|
+
markerFormat: def.markerFormat,
|
|
16092
|
+
tabStopTwips: def.tabStopTwips
|
|
16093
|
+
})
|
|
16094
|
+
});
|
|
16095
|
+
}
|
|
16096
|
+
return labels;
|
|
16097
|
+
}
|
|
16098
|
+
var SYMBOL_BULLETS = {
|
|
16099
|
+
"\uF0B7": "\u2022",
|
|
16100
|
+
"\uF0A7": "\u25AA",
|
|
16101
|
+
"\uF0D8": "\u27A2",
|
|
16102
|
+
"\uF076": "\u2756",
|
|
16103
|
+
"\uF0FC": "\u2713",
|
|
16104
|
+
"\uF06E": "\u25A0",
|
|
16105
|
+
"\uF071": "\u2751",
|
|
16106
|
+
"\uF0E0": "\u27A9",
|
|
16107
|
+
"\uF0B2": "\u25CB"
|
|
16108
|
+
};
|
|
16109
|
+
function displayListLabel(text2) {
|
|
16110
|
+
return text2.replace(/[-]/g, (char) => SYMBOL_BULLETS[char] ?? "\u2022");
|
|
16111
|
+
}
|
|
16112
|
+
|
|
16113
|
+
// docx/style-ref.ts
|
|
16114
|
+
function parseStyleReference(instr) {
|
|
16115
|
+
const tokens = fieldTokens(instr);
|
|
16116
|
+
if (tokens[0]?.kind !== "text" || tokens[0].value.toUpperCase() !== "STYLEREF") return void 0;
|
|
16117
|
+
let style;
|
|
16118
|
+
const reference = {
|
|
16119
|
+
style: "",
|
|
16120
|
+
last: false,
|
|
16121
|
+
number: false,
|
|
16122
|
+
numberOnly: false
|
|
16123
|
+
};
|
|
16124
|
+
for (let index = 1; index < tokens.length; index++) {
|
|
16125
|
+
const token = tokens[index];
|
|
16126
|
+
if (token.kind === "text") {
|
|
16127
|
+
if (style !== void 0) return void 0;
|
|
16128
|
+
style = token.value;
|
|
16129
|
+
} else if (token.value === "l") reference.last = true;
|
|
16130
|
+
else if (token.value === "n") reference.number = true;
|
|
16131
|
+
else if (token.value === "t") reference.numberOnly = true;
|
|
16132
|
+
else if (token.value === "s") {
|
|
16133
|
+
reference.number = true;
|
|
16134
|
+
reference.numberOnly = true;
|
|
16135
|
+
} else if (token.value === "*") {
|
|
16136
|
+
const format = tokens[++index];
|
|
16137
|
+
if (format?.kind !== "text") return void 0;
|
|
16138
|
+
const name = format.value.toLowerCase();
|
|
16139
|
+
if (isFieldTextCase(name)) reference.textCase = name;
|
|
16140
|
+
else if (name === "charformat") reference.charFormat = true;
|
|
16141
|
+
else if (name !== "mergeformat") return void 0;
|
|
16142
|
+
} else return void 0;
|
|
16143
|
+
}
|
|
16144
|
+
if (!style) return void 0;
|
|
16145
|
+
reference.style = style;
|
|
16146
|
+
return reference;
|
|
16147
|
+
}
|
|
16148
|
+
function styleTarget(model, style) {
|
|
16149
|
+
const name = /^[1-9]$/.test(style) ? `heading ${style}` : style;
|
|
16150
|
+
const key = name.toLowerCase();
|
|
16151
|
+
const paragraphs = Object.values(model.paragraphStyles?.styles ?? {});
|
|
16152
|
+
const characters = Object.values(model.characterStyles?.styles ?? {}).filter(
|
|
16153
|
+
(definition) => definition.type === "character"
|
|
16154
|
+
);
|
|
16155
|
+
const paragraph = (definition) => definition && {
|
|
16156
|
+
kind: "paragraph",
|
|
16157
|
+
id: definition.id,
|
|
16158
|
+
...definition.isDefault ? { isDefault: true } : {}
|
|
16159
|
+
};
|
|
16160
|
+
const character = (definition) => definition && { kind: "character", id: definition.id };
|
|
16161
|
+
const named3 = (list) => list.find((definition) => definition.name?.toLowerCase() === key);
|
|
16162
|
+
const withId = (list) => list.find((definition) => definition.id === name) ?? list.find((definition) => definition.id.toLowerCase() === key);
|
|
16163
|
+
return paragraph(named3(paragraphs)) ?? character(named3(characters)) ?? paragraph(withId(paragraphs)) ?? character(withId(characters));
|
|
16164
|
+
}
|
|
16165
|
+
var shownText = (run) => run.vanish || run.revision?.kind === "delete" || run.revision?.kind === "moveFrom" ? "" : run.text;
|
|
16166
|
+
function characterPortions(paragraph, id, hidden, skip) {
|
|
16167
|
+
const portions = [];
|
|
16168
|
+
let open;
|
|
16169
|
+
paragraph.runs.forEach((run, index) => {
|
|
16170
|
+
if (skip && index >= skip.from && index <= skip.to) {
|
|
16171
|
+
open = void 0;
|
|
16172
|
+
return;
|
|
16173
|
+
}
|
|
16174
|
+
if (!run.text || run.revision?.kind === "delete" || run.revision?.kind === "moveFrom") return;
|
|
16175
|
+
if (run.style !== id) {
|
|
16176
|
+
open = void 0;
|
|
16177
|
+
return;
|
|
16178
|
+
}
|
|
16179
|
+
const text2 = hidden(run, paragraph) ? "" : run.text;
|
|
16180
|
+
if (open) {
|
|
16181
|
+
open.text += text2;
|
|
16182
|
+
open.to = index;
|
|
16183
|
+
} else portions.push(open = { text: text2, from: index, to: index });
|
|
16184
|
+
});
|
|
16185
|
+
return portions;
|
|
16186
|
+
}
|
|
16187
|
+
var inParagraphStyle = (paragraph, target) => paragraph.style === target.id || paragraph.style === void 0 && target.isDefault === true;
|
|
16188
|
+
var deletedWhole = (paragraph) => (paragraph.markRevision?.kind === "delete" || paragraph.markRevision?.kind === "moveFrom") && paragraph.runs.every(
|
|
16189
|
+
(run) => !run.text || run.revision?.kind === "delete" || run.revision?.kind === "moveFrom"
|
|
16190
|
+
);
|
|
16191
|
+
function styleRefSource(model) {
|
|
16192
|
+
const paragraphs = documentParagraphs(model.blocks);
|
|
16193
|
+
const hidden = (run, paragraph) => resolveRunFormatting(run, {
|
|
16194
|
+
runCatalog: model.characterStyles,
|
|
16195
|
+
paragraphCatalog: model.paragraphStyles,
|
|
16196
|
+
paragraphStyleId: paragraph.style
|
|
16197
|
+
}).vanish === true;
|
|
16198
|
+
const index = new Map(paragraphs.map((paragraph, at) => [paragraph.id, at]));
|
|
16199
|
+
const targets = /* @__PURE__ */ new Map();
|
|
16200
|
+
let labels;
|
|
16201
|
+
const number = (paragraph, numberOnly) => {
|
|
16202
|
+
labels ??= computeListLabels(model);
|
|
16203
|
+
const label = labels.get(paragraph.id);
|
|
16204
|
+
if (!label || !model.numberingCatalog) return "0";
|
|
16205
|
+
const level2 = resolveNumberingLevel(model.numberingCatalog, label.numId, label.level);
|
|
16206
|
+
if (!level2 || level2.numFmt === "bullet") return null;
|
|
16207
|
+
let text2 = label.text;
|
|
16208
|
+
if (numberOnly) {
|
|
16209
|
+
const first3 = level2.lvlText.indexOf("%");
|
|
16210
|
+
const end = level2.lvlText.search(/%[1-9](?!.*%[1-9])/);
|
|
16211
|
+
const prefix2 = first3 < 0 ? "" : level2.lvlText.slice(0, first3);
|
|
16212
|
+
const suffix = end < 0 ? "" : level2.lvlText.slice(end + 2);
|
|
16213
|
+
const inner = first3 < 0 || end < 0 ? "" : level2.lvlText.slice(first3, end + 2);
|
|
16214
|
+
if (/\p{L}/u.test(inner.replace(/%[1-9]/g, ""))) return null;
|
|
16215
|
+
if (prefix2 && text2.startsWith(prefix2)) text2 = text2.slice(prefix2.length);
|
|
16216
|
+
if (suffix && text2.endsWith(suffix)) text2 = text2.slice(0, -suffix.length);
|
|
16217
|
+
}
|
|
16218
|
+
return text2.trim().replace(/\.+$/, "");
|
|
16219
|
+
};
|
|
16220
|
+
const portions = (at, reference, target, skip) => {
|
|
16221
|
+
const paragraph = paragraphs[at];
|
|
16222
|
+
if (!paragraph) return [];
|
|
16223
|
+
let found;
|
|
16224
|
+
if (target.kind === "character") found = characterPortions(paragraph, target.id, hidden, skip);
|
|
16225
|
+
else
|
|
16226
|
+
found = inParagraphStyle(paragraph, target) && !deletedWhole(paragraph) ? [
|
|
16227
|
+
{
|
|
16228
|
+
text: paragraph.runs.map((run) => hidden(run, paragraph) ? "" : shownText(run)).join(""),
|
|
16229
|
+
from: 0,
|
|
16230
|
+
to: paragraph.runs.length - 1
|
|
16231
|
+
}
|
|
16232
|
+
] : [];
|
|
16233
|
+
if (reference.number && found.length) {
|
|
16234
|
+
const label = number(paragraph, reference.numberOnly);
|
|
16235
|
+
found = found.map((portion) => ({ ...portion, text: label ?? void 0 }));
|
|
16236
|
+
}
|
|
16237
|
+
return reference.textCase ? found.map((portion) => ({
|
|
16238
|
+
...portion,
|
|
16239
|
+
text: portion.text === void 0 ? void 0 : applyFieldTextCase(portion.text, reference.textCase)
|
|
16240
|
+
})) : found;
|
|
16241
|
+
};
|
|
16242
|
+
return {
|
|
16243
|
+
paragraphs,
|
|
16244
|
+
index,
|
|
16245
|
+
target(style) {
|
|
16246
|
+
if (!targets.has(style)) targets.set(style, styleTarget(model, style));
|
|
16247
|
+
return targets.get(style);
|
|
16248
|
+
},
|
|
16249
|
+
portions,
|
|
16250
|
+
results: (at, reference, target) => portions(at, reference, target).map((portion) => portion.text)
|
|
16251
|
+
};
|
|
16252
|
+
}
|
|
16253
|
+
|
|
16254
|
+
// docx/style-ref-fields.ts
|
|
16255
|
+
var removed = (run) => run.revision?.kind === "delete" || run.revision?.kind === "moveFrom";
|
|
16256
|
+
function fieldResults(runs) {
|
|
16257
|
+
const found = [];
|
|
16258
|
+
const open = [];
|
|
16259
|
+
runs.forEach((run, index) => {
|
|
16260
|
+
const top = open.at(-1);
|
|
16261
|
+
if (run.fieldChar === "begin")
|
|
16262
|
+
open.push({ begin: index, code: "", locked: isFieldLocked(run) });
|
|
16263
|
+
else if (run.fieldCode !== void 0 && top && top.separate === void 0) {
|
|
16264
|
+
top.code += run.fieldCode;
|
|
16265
|
+
top.codeRun ??= index;
|
|
16266
|
+
if (top.nameRun === void 0 && /\S/.test(run.fieldCode)) top.nameRun = index;
|
|
16267
|
+
} else if (run.fieldChar === "separate" && top) top.separate = index;
|
|
16268
|
+
else if (run.fieldChar === "end" && top) {
|
|
16269
|
+
open.pop();
|
|
16270
|
+
if (top.separate === void 0) return;
|
|
16271
|
+
const instr = top.code.trim();
|
|
16272
|
+
const results = [];
|
|
16273
|
+
let gone = false;
|
|
16274
|
+
for (let at = top.separate + 1; at < index; at++) {
|
|
16275
|
+
const item = runs[at];
|
|
16276
|
+
if (item.field?.instr !== instr || item.fieldChar || item.fieldCode !== void 0) continue;
|
|
16277
|
+
if (removed(item)) gone = true;
|
|
16278
|
+
else results.push(at);
|
|
16279
|
+
}
|
|
16280
|
+
found.push({
|
|
16281
|
+
from: top.begin,
|
|
16282
|
+
to: index,
|
|
16283
|
+
instr,
|
|
16284
|
+
locked: top.locked || results.some((at) => isFieldLocked(runs[at])),
|
|
16285
|
+
runs: results,
|
|
16286
|
+
...top.codeRun !== void 0 ? { code: top.codeRun } : {},
|
|
16287
|
+
...top.nameRun !== void 0 ? { name: top.nameRun } : {},
|
|
16288
|
+
insertAt: top.separate + 1,
|
|
16289
|
+
...gone && !results.length ? { removed: true } : {}
|
|
16290
|
+
});
|
|
16291
|
+
}
|
|
16292
|
+
});
|
|
16293
|
+
let simple;
|
|
16294
|
+
let identity;
|
|
16295
|
+
runs.forEach((run, index) => {
|
|
16296
|
+
if (!run.field?.simple) {
|
|
16297
|
+
simple = void 0;
|
|
16298
|
+
return;
|
|
16299
|
+
}
|
|
16300
|
+
if (simple && simple.instr === run.field.instr && identity === run.fieldInstanceId) {
|
|
16301
|
+
if (!removed(run)) simple.runs.push(index);
|
|
16302
|
+
simple.to = index;
|
|
16303
|
+
} else {
|
|
16304
|
+
simple = {
|
|
16305
|
+
from: index,
|
|
16306
|
+
to: index,
|
|
16307
|
+
instr: run.field.instr,
|
|
16308
|
+
locked: false,
|
|
16309
|
+
runs: removed(run) ? [] : [index],
|
|
16310
|
+
insertAt: index
|
|
16311
|
+
};
|
|
16312
|
+
identity = run.fieldInstanceId;
|
|
16313
|
+
found.push(simple);
|
|
16314
|
+
}
|
|
16315
|
+
simple.locked ||= isFieldLocked(run);
|
|
16316
|
+
});
|
|
16317
|
+
return found;
|
|
16318
|
+
}
|
|
16319
|
+
var STRUCTURE = [
|
|
16320
|
+
"fieldChar",
|
|
16321
|
+
"fieldCode",
|
|
16322
|
+
"fieldInstanceId",
|
|
16323
|
+
"fieldFlags",
|
|
16324
|
+
"break",
|
|
16325
|
+
"noteReference",
|
|
16326
|
+
"noteMark",
|
|
16327
|
+
"noteSeparator",
|
|
16328
|
+
"equation",
|
|
16329
|
+
"image"
|
|
16330
|
+
];
|
|
16331
|
+
var NOT_FORMATTING = [
|
|
16332
|
+
...STRUCTURE,
|
|
16333
|
+
"text",
|
|
16334
|
+
"field",
|
|
16335
|
+
"revision",
|
|
16336
|
+
"formatRevision",
|
|
16337
|
+
"restoredRunPropertiesXml",
|
|
16338
|
+
"commentIds",
|
|
16339
|
+
"link",
|
|
16340
|
+
"contentControl"
|
|
16341
|
+
];
|
|
16342
|
+
function withFieldCodeFormatting(result, code, text2) {
|
|
16343
|
+
const formatted = { ...code };
|
|
16344
|
+
const own2 = {};
|
|
16345
|
+
for (const key of NOT_FORMATTING) {
|
|
16346
|
+
delete formatted[key];
|
|
16347
|
+
if (result[key] !== void 0) Object.assign(own2, { [key]: result[key] });
|
|
16348
|
+
}
|
|
16349
|
+
return { ...formatted, ...own2, text: text2 };
|
|
16350
|
+
}
|
|
16351
|
+
function replaceResult(runs, field, text2, charFormat) {
|
|
16352
|
+
const current = field.runs.map((at) => runs[at].text).join("") === text2;
|
|
16353
|
+
const next = [...runs];
|
|
16354
|
+
const [first3, ...rest] = field.runs;
|
|
16355
|
+
const name = field.name ?? field.code;
|
|
16356
|
+
if (first3 !== void 0) {
|
|
16357
|
+
const formatted = charFormat && name !== void 0 ? withFieldCodeFormatting(runs[first3], runs[name], text2) : void 0;
|
|
16358
|
+
if (current && (!formatted || sameRun(formatted, runs[first3]) && rest.every((at) => !runs[at].text)))
|
|
16359
|
+
return void 0;
|
|
16360
|
+
next[first3] = formatted ?? { ...runs[first3], text: text2 };
|
|
16361
|
+
for (const at of rest) next[at] = { ...runs[at], text: "" };
|
|
16362
|
+
return next;
|
|
16363
|
+
}
|
|
16364
|
+
const code = charFormat ? name : field.code;
|
|
16365
|
+
if (current || code === void 0 || field.removed) return void 0;
|
|
16366
|
+
next.splice(field.insertAt, 0, fieldResultRun(runs[code], field.instr, text2));
|
|
16367
|
+
return next;
|
|
16368
|
+
}
|
|
16369
|
+
function sameRun(a, b) {
|
|
16370
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)]);
|
|
16371
|
+
return [...keys].every((key) => JSON.stringify(a[key]) === JSON.stringify(b[key]));
|
|
16372
|
+
}
|
|
16373
|
+
function fieldResultRun(code, instr, text2) {
|
|
16374
|
+
const formatted = { ...code };
|
|
16375
|
+
for (const key of STRUCTURE) delete formatted[key];
|
|
16376
|
+
return { ...formatted, text: text2, field: { instr } };
|
|
16377
|
+
}
|
|
16378
|
+
function paragraphWithResults(paragraph, evaluate) {
|
|
16379
|
+
let runs = paragraph.runs;
|
|
16380
|
+
const start = (field) => field.runs[0] ?? field.insertAt;
|
|
16381
|
+
for (const field of fieldResults(runs).sort((a, b) => start(b) - start(a))) {
|
|
16382
|
+
const reference = field.locked ? void 0 : parseStyleReference(field.instr);
|
|
16383
|
+
const text2 = reference && evaluate(reference, paragraph, field);
|
|
16384
|
+
if (text2 !== void 0)
|
|
16385
|
+
runs = replaceResult(runs, field, text2, reference?.charFormat === true) ?? runs;
|
|
16386
|
+
}
|
|
16387
|
+
return runs === paragraph.runs ? paragraph : { ...paragraph, runs: [...runs] };
|
|
16388
|
+
}
|
|
16389
|
+
function tableWithResults(table, evaluate) {
|
|
16390
|
+
let changed = false;
|
|
16391
|
+
const rows = table.rows.map(
|
|
16392
|
+
(row2) => row2.map((cell) => {
|
|
16393
|
+
const paragraphs = cell.paragraphs.map((item) => paragraphWithResults(item, evaluate));
|
|
16394
|
+
const sourceBlocks = cell.sourceBlocks?.map(
|
|
16395
|
+
(item) => item.type === "table" ? tableWithResults(item, evaluate) : item
|
|
16396
|
+
);
|
|
16397
|
+
if (paragraphs.every((item, index) => item === cell.paragraphs[index]) && (sourceBlocks ?? []).every((item, index) => item === cell.sourceBlocks[index]))
|
|
16398
|
+
return cell;
|
|
16399
|
+
changed = true;
|
|
16400
|
+
return { ...cell, paragraphs, ...sourceBlocks ? { sourceBlocks } : {} };
|
|
16401
|
+
})
|
|
16402
|
+
);
|
|
16403
|
+
return changed ? { ...table, rows } : table;
|
|
16404
|
+
}
|
|
16405
|
+
function withStyleRefResults(blocks, evaluate) {
|
|
16406
|
+
let changed = false;
|
|
16407
|
+
const next = blocks.map((block) => {
|
|
16408
|
+
const updated = block.type === "paragraph" ? paragraphWithResults(block, evaluate) : tableWithResults(block, evaluate);
|
|
16409
|
+
changed ||= updated !== block;
|
|
16410
|
+
return updated;
|
|
16411
|
+
});
|
|
16412
|
+
return changed ? next : blocks;
|
|
16413
|
+
}
|
|
16414
|
+
|
|
16415
|
+
// docx/document-paragraphs.ts
|
|
16416
|
+
function mapBlockParagraphs(blocks, map) {
|
|
16417
|
+
return blocks.map(
|
|
16418
|
+
(block) => block.type === "paragraph" ? map(block) : {
|
|
16419
|
+
...block,
|
|
16420
|
+
rows: block.rows.map(
|
|
16421
|
+
(row2) => row2.map((cell) => ({ ...cell, paragraphs: cell.paragraphs.map(map) }))
|
|
16422
|
+
)
|
|
16423
|
+
}
|
|
16424
|
+
);
|
|
16425
|
+
}
|
|
16426
|
+
function mapDocumentParagraphs(model, map) {
|
|
16427
|
+
const slots = (value) => Object.fromEntries(
|
|
16428
|
+
Object.entries(value).map(
|
|
16429
|
+
([key, content]) => [
|
|
16430
|
+
key,
|
|
16431
|
+
content ? { ...content, blocks: mapBlockParagraphs(content.blocks, map) } : content
|
|
16432
|
+
]
|
|
16433
|
+
)
|
|
16434
|
+
);
|
|
16435
|
+
return {
|
|
16436
|
+
...model,
|
|
16437
|
+
blocks: mapBlockParagraphs(model.blocks, map),
|
|
16438
|
+
...model.sections ? {
|
|
16439
|
+
sections: model.sections.map((section) => ({
|
|
16440
|
+
...section,
|
|
16441
|
+
...section.headers ? { headers: slots(section.headers) } : {},
|
|
16442
|
+
...section.footers ? { footers: slots(section.footers) } : {}
|
|
16443
|
+
}))
|
|
16444
|
+
} : {},
|
|
16445
|
+
...model.footnoteSeparators ? {
|
|
16446
|
+
footnoteSeparators: Object.fromEntries(
|
|
16447
|
+
Object.entries(model.footnoteSeparators).map(([kind, note]) => [
|
|
16448
|
+
kind,
|
|
16449
|
+
{ ...note, blocks: mapBlockParagraphs(note.blocks, map) }
|
|
16450
|
+
])
|
|
16451
|
+
)
|
|
16452
|
+
} : {},
|
|
16453
|
+
...model.footnotes ? {
|
|
16454
|
+
footnotes: model.footnotes.map((note) => ({
|
|
16455
|
+
...note,
|
|
16456
|
+
blocks: mapBlockParagraphs(note.blocks, map)
|
|
16457
|
+
}))
|
|
16458
|
+
} : {},
|
|
16459
|
+
...model.endnotes ? {
|
|
16460
|
+
endnotes: model.endnotes.map((note) => ({
|
|
16461
|
+
...note,
|
|
16462
|
+
blocks: mapBlockParagraphs(note.blocks, map)
|
|
16463
|
+
}))
|
|
16464
|
+
} : {}
|
|
16465
|
+
};
|
|
16466
|
+
}
|
|
16467
|
+
|
|
16468
|
+
// docx/field-runs.ts
|
|
16469
|
+
function fieldName(instr) {
|
|
16470
|
+
return instr.trim().split(/\s+/)[0]?.toUpperCase() ?? "";
|
|
16471
|
+
}
|
|
16472
|
+
|
|
16473
|
+
// docx/notes.ts
|
|
16474
|
+
var romanNumerals = [
|
|
16475
|
+
[1e3, "M"],
|
|
16476
|
+
[900, "CM"],
|
|
16477
|
+
[500, "D"],
|
|
16478
|
+
[400, "CD"],
|
|
16479
|
+
[100, "C"],
|
|
16480
|
+
[90, "XC"],
|
|
16481
|
+
[50, "L"],
|
|
16482
|
+
[40, "XL"],
|
|
16483
|
+
[10, "X"],
|
|
16484
|
+
[9, "IX"],
|
|
16485
|
+
[5, "V"],
|
|
16486
|
+
[4, "IV"],
|
|
16487
|
+
[1, "I"]
|
|
16488
|
+
];
|
|
16489
|
+
function toRoman(value) {
|
|
16490
|
+
let remaining = Math.max(1, Math.round(value));
|
|
16491
|
+
let result = "";
|
|
16492
|
+
for (const [amount, numeral] of romanNumerals) {
|
|
16493
|
+
while (remaining >= amount) {
|
|
16494
|
+
result += numeral;
|
|
16495
|
+
remaining -= amount;
|
|
16496
|
+
}
|
|
16497
|
+
}
|
|
16498
|
+
return result || "I";
|
|
16499
|
+
}
|
|
16500
|
+
function toLetters(value) {
|
|
16501
|
+
let remaining = Math.max(1, Math.round(value));
|
|
16502
|
+
let result = "";
|
|
16503
|
+
while (remaining > 0) {
|
|
16504
|
+
remaining--;
|
|
16505
|
+
result = String.fromCharCode(97 + remaining % 26) + result;
|
|
16506
|
+
remaining = Math.floor(remaining / 26);
|
|
16507
|
+
}
|
|
16508
|
+
return result || "a";
|
|
16509
|
+
}
|
|
16510
|
+
function formatNoteNumber(value, format) {
|
|
16511
|
+
switch (format) {
|
|
16512
|
+
case "upperRoman":
|
|
16513
|
+
return toRoman(value);
|
|
16514
|
+
case "lowerRoman":
|
|
16515
|
+
return toRoman(value).toLowerCase();
|
|
16516
|
+
case "upperLetter":
|
|
16517
|
+
return toLetters(value).toUpperCase();
|
|
16518
|
+
case "lowerLetter":
|
|
16519
|
+
return toLetters(value);
|
|
16520
|
+
case "decimalZero":
|
|
16521
|
+
return value < 10 ? `0${value}` : String(value);
|
|
16522
|
+
default:
|
|
16523
|
+
return String(value);
|
|
16524
|
+
}
|
|
16525
|
+
}
|
|
16526
|
+
function walkParagraph(paragraph, kind, order) {
|
|
16527
|
+
for (const run of paragraph.runs) {
|
|
16528
|
+
if (run.noteReference?.kind === kind && !order.has(run.noteReference.id))
|
|
16529
|
+
order.set(run.noteReference.id, order.size + 1);
|
|
16049
16530
|
}
|
|
16050
|
-
return inherited;
|
|
16051
16531
|
}
|
|
16052
|
-
function
|
|
16053
|
-
const result = [];
|
|
16532
|
+
function walkBlocks(blocks, kind, order) {
|
|
16054
16533
|
for (const block of blocks) {
|
|
16055
|
-
if (block.type === "paragraph")
|
|
16056
|
-
else
|
|
16534
|
+
if (block.type === "paragraph") walkParagraph(block, kind, order);
|
|
16535
|
+
else
|
|
16536
|
+
for (const row2 of block.rows)
|
|
16537
|
+
for (const cell of row2) walkBlocks(cellSourceBlocks(cell), kind, order);
|
|
16057
16538
|
}
|
|
16058
|
-
return result;
|
|
16059
16539
|
}
|
|
16060
|
-
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
|
|
16064
|
-
|
|
16065
|
-
|
|
16066
|
-
|
|
16067
|
-
|
|
16068
|
-
|
|
16069
|
-
|
|
16070
|
-
|
|
16071
|
-
|
|
16072
|
-
|
|
16073
|
-
|
|
16074
|
-
|
|
16075
|
-
|
|
16076
|
-
|
|
16077
|
-
|
|
16078
|
-
}
|
|
16079
|
-
|
|
16080
|
-
|
|
16081
|
-
|
|
16082
|
-
const
|
|
16083
|
-
|
|
16084
|
-
|
|
16085
|
-
|
|
16086
|
-
|
|
16087
|
-
|
|
16088
|
-
|
|
16089
|
-
|
|
16090
|
-
|
|
16091
|
-
|
|
16092
|
-
|
|
16093
|
-
|
|
16094
|
-
|
|
16095
|
-
|
|
16096
|
-
|
|
16097
|
-
if (started.has(ancestor)) continue;
|
|
16098
|
-
const ancestorDef = resolveNumberingLevel(catalog, numId, ancestor);
|
|
16099
|
-
if (!ancestorDef) continue;
|
|
16100
|
-
counts.set(ancestor, ancestorDef.start);
|
|
16101
|
-
started.add(ancestor);
|
|
16102
|
-
}
|
|
16103
|
-
return next;
|
|
16104
|
-
}
|
|
16105
|
-
/** Current value for an ancestor placeholder, defaulting to its own start when never instantiated. */
|
|
16106
|
-
current(numId, level2, start) {
|
|
16107
|
-
return this.forNum(numId).get(level2) ?? start;
|
|
16540
|
+
function numberNotesInOrder(blocks, kind) {
|
|
16541
|
+
const order = /* @__PURE__ */ new Map();
|
|
16542
|
+
walkBlocks(blocks, kind, order);
|
|
16543
|
+
return order;
|
|
16544
|
+
}
|
|
16545
|
+
|
|
16546
|
+
// docx/chart-paint.ts
|
|
16547
|
+
function themeCatalogColorScheme(theme) {
|
|
16548
|
+
const colors = {};
|
|
16549
|
+
for (const [slot, value] of Object.entries(theme?.colors ?? {}))
|
|
16550
|
+
if (value) colors[slot] = { kind: "srgb", value: value.replace(/^#/, ""), transforms: [] };
|
|
16551
|
+
return { colors };
|
|
16552
|
+
}
|
|
16553
|
+
function docxChartPaint(chart, widthPx, heightPx, theme) {
|
|
16554
|
+
const space = chart?.chartSpace;
|
|
16555
|
+
const extended = chart?.chartEx;
|
|
16556
|
+
if (chart && extended) return paintExtended(chart, extended, widthPx, heightPx, theme);
|
|
16557
|
+
if (chart && chart.layoutId) return { label: `Chart (${chart.layoutId})` };
|
|
16558
|
+
if (!space) return { label: "Chart" };
|
|
16559
|
+
const kind = chartSpaceKind(space);
|
|
16560
|
+
if (!kind.drawn) return { label: kind.type ? `Chart (${kind.type})` : "Chart" };
|
|
16561
|
+
try {
|
|
16562
|
+
const fonts = {
|
|
16563
|
+
...theme?.fonts.major.latin ? { major: theme.fonts.major.latin } : {},
|
|
16564
|
+
...theme?.fonts.minor.latin ? { minor: theme.fonts.minor.latin } : {}
|
|
16565
|
+
};
|
|
16566
|
+
const svg = renderChartSpaceSvg(space, {
|
|
16567
|
+
width: Math.max(1, Math.round(widthPx)),
|
|
16568
|
+
height: Math.max(1, Math.round(heightPx)),
|
|
16569
|
+
theme: themeCatalogColorScheme(theme),
|
|
16570
|
+
fonts,
|
|
16571
|
+
...chart.formatting ? { formatting: chart.formatting } : {},
|
|
16572
|
+
...chart.colorPalette !== void 0 ? { colorPalette: chart.colorPalette } : {}
|
|
16573
|
+
});
|
|
16574
|
+
return { svg, label: chart.title ? `Chart: ${chart.title}` : "Chart" };
|
|
16575
|
+
} catch {
|
|
16576
|
+
return { label: kind.type ? `Chart (${kind.type})` : "Chart" };
|
|
16108
16577
|
}
|
|
16109
|
-
};
|
|
16110
|
-
function substituteLvlText(lvlText, numId, level2, catalog, counters, forceDecimal) {
|
|
16111
|
-
return lvlText.replace(/%([1-9])/g, (match, digit) => {
|
|
16112
|
-
const ancestorLevel = Number(digit) - 1;
|
|
16113
|
-
if (ancestorLevel > level2) return match;
|
|
16114
|
-
const ancestorDef = resolveNumberingLevel(catalog, numId, ancestorLevel);
|
|
16115
|
-
const start = ancestorDef?.start ?? 1;
|
|
16116
|
-
const value = counters.current(numId, ancestorLevel, start);
|
|
16117
|
-
const fmt = forceDecimal ? "decimal" : ancestorDef?.numFmt ?? "decimal";
|
|
16118
|
-
return formatListNumber(fmt, value);
|
|
16119
|
-
});
|
|
16120
16578
|
}
|
|
16121
|
-
function
|
|
16122
|
-
|
|
16123
|
-
|
|
16124
|
-
|
|
16125
|
-
|
|
16126
|
-
|
|
16127
|
-
const
|
|
16128
|
-
|
|
16129
|
-
|
|
16130
|
-
|
|
16131
|
-
|
|
16132
|
-
if (!def) continue;
|
|
16133
|
-
if (def.numFmt === "none") continue;
|
|
16134
|
-
counters.advance(numId, level2, def, catalog);
|
|
16135
|
-
const text2 = def.numFmt === "bullet" ? def.lvlText : substituteLvlText(def.lvlText, numId, level2, catalog, counters, Boolean(def.isLgl));
|
|
16136
|
-
labels.set(paragraph.id, {
|
|
16137
|
-
numId,
|
|
16138
|
-
level: level2,
|
|
16139
|
-
text: text2,
|
|
16140
|
-
suffix: def.suffix ?? "tab",
|
|
16141
|
-
...definedProps({
|
|
16142
|
-
alignment: def.lvlJc,
|
|
16143
|
-
indentLeftTwips: def.indentLeftTwips,
|
|
16144
|
-
hangingTwips: def.hangingTwips,
|
|
16145
|
-
firstLineTwips: def.firstLineTwips,
|
|
16146
|
-
markerFormat: def.markerFormat,
|
|
16147
|
-
tabStopTwips: def.tabStopTwips
|
|
16148
|
-
})
|
|
16579
|
+
function paintExtended(chart, summary, widthPx, heightPx, theme) {
|
|
16580
|
+
try {
|
|
16581
|
+
const fonts = {
|
|
16582
|
+
...theme?.fonts.major.latin ? { major: theme.fonts.major.latin } : {},
|
|
16583
|
+
...theme?.fonts.minor.latin ? { minor: theme.fonts.minor.latin } : {}
|
|
16584
|
+
};
|
|
16585
|
+
const svg = renderChartSummarySvg(summary, {
|
|
16586
|
+
width: Math.max(1, Math.round(widthPx)),
|
|
16587
|
+
height: Math.max(1, Math.round(heightPx)),
|
|
16588
|
+
theme: themeCatalogColorScheme(theme),
|
|
16589
|
+
fonts
|
|
16149
16590
|
});
|
|
16591
|
+
return { svg, label: chart.title ? `Chart: ${chart.title}` : "Chart" };
|
|
16592
|
+
} catch {
|
|
16593
|
+
return { label: `Chart (${chart.layoutId ?? "extended"})` };
|
|
16150
16594
|
}
|
|
16151
|
-
return labels;
|
|
16152
16595
|
}
|
|
16153
|
-
|
|
16154
|
-
|
|
16155
|
-
|
|
16156
|
-
|
|
16157
|
-
|
|
16158
|
-
|
|
16159
|
-
|
|
16160
|
-
|
|
16161
|
-
|
|
16162
|
-
|
|
16163
|
-
};
|
|
16164
|
-
function displayListLabel(text2) {
|
|
16165
|
-
return text2.replace(/[-]/g, (char) => SYMBOL_BULLETS[char] ?? "\u2022");
|
|
16596
|
+
|
|
16597
|
+
// docx/diagram-theme.ts
|
|
16598
|
+
function diagramColorTheme(theme) {
|
|
16599
|
+
return {
|
|
16600
|
+
scheme(name) {
|
|
16601
|
+
if (!theme) return void 0;
|
|
16602
|
+
const slot = themeColorSlotFor(name, theme.colorMapping);
|
|
16603
|
+
const hex = slot ? theme.colors[slot] : void 0;
|
|
16604
|
+
return hex ? `#${hex.replace(/^#/, "").toUpperCase()}` : void 0;
|
|
16605
|
+
}
|
|
16606
|
+
};
|
|
16166
16607
|
}
|
|
16167
16608
|
|
|
16168
16609
|
// docx/restore-paragraph-format.ts
|
|
@@ -16609,6 +17050,155 @@ function headerFooterForPage(model, page, pageNumber, kind) {
|
|
|
16609
17050
|
return void 0;
|
|
16610
17051
|
}
|
|
16611
17052
|
|
|
17053
|
+
// docx/layout/review-display.ts
|
|
17054
|
+
function reviewSourceLength(run) {
|
|
17055
|
+
return run.equation || run.break || run.fieldChar || run.fieldCode !== void 0 || run.noteReference || run.image ? 1 : run.text.length;
|
|
17056
|
+
}
|
|
17057
|
+
function visibleReviewParagraph(paragraph, mode) {
|
|
17058
|
+
return mode === "all" ? paragraph : {
|
|
17059
|
+
...paragraph,
|
|
17060
|
+
runs: paragraph.runs.filter((run) => !isRunHiddenForReview(run, mode))
|
|
17061
|
+
};
|
|
17062
|
+
}
|
|
17063
|
+
function visibleReviewModel(model, mode) {
|
|
17064
|
+
return mode === "all" ? model : mapDocumentParagraphs(model, (paragraph) => visibleReviewParagraph(paragraph, mode));
|
|
17065
|
+
}
|
|
17066
|
+
|
|
17067
|
+
// docx/layout/page-style-refs.ts
|
|
17068
|
+
function paragraphsByPage(pages, source) {
|
|
17069
|
+
return pages.map((page) => {
|
|
17070
|
+
const found = /* @__PURE__ */ new Map();
|
|
17071
|
+
const add = (box) => {
|
|
17072
|
+
const at = source.index.get(box.blockId);
|
|
17073
|
+
if (at === void 0) return;
|
|
17074
|
+
const shown = found.get(at) ?? [];
|
|
17075
|
+
if (!box.lines.length) shown.push([0, Number.POSITIVE_INFINITY]);
|
|
17076
|
+
for (const line3 of box.lines) shown.push([line3.sourceStart, line3.sourceEnd]);
|
|
17077
|
+
found.set(at, shown);
|
|
17078
|
+
};
|
|
17079
|
+
const visit = (blocks) => {
|
|
17080
|
+
for (const block of blocks)
|
|
17081
|
+
if (block.kind === "paragraph") add(block);
|
|
17082
|
+
else
|
|
17083
|
+
for (const row2 of block.rows)
|
|
17084
|
+
if (!row2.repeated) for (const cell of row2.cells) for (const box of cell) add(box);
|
|
17085
|
+
};
|
|
17086
|
+
for (const column of page.columns) visit(column.blocks);
|
|
17087
|
+
return found;
|
|
17088
|
+
});
|
|
17089
|
+
}
|
|
17090
|
+
var shows2 = (shown, start, end) => shown.some(
|
|
17091
|
+
([from, to]) => start === end ? from <= start && start <= to : start < to && end > from
|
|
17092
|
+
);
|
|
17093
|
+
function pageStyleRefs(model, pages) {
|
|
17094
|
+
let source;
|
|
17095
|
+
let onPage;
|
|
17096
|
+
let pagesOf;
|
|
17097
|
+
const matches = /* @__PURE__ */ new Map();
|
|
17098
|
+
const offsets = /* @__PURE__ */ new Map();
|
|
17099
|
+
const read = () => {
|
|
17100
|
+
if (!source) {
|
|
17101
|
+
source = styleRefSource(model);
|
|
17102
|
+
onPage = paragraphsByPage(pages, source);
|
|
17103
|
+
pagesOf = /* @__PURE__ */ new Map();
|
|
17104
|
+
onPage.forEach((here, page) => {
|
|
17105
|
+
for (const at of here.keys()) {
|
|
17106
|
+
const list = pagesOf.get(at);
|
|
17107
|
+
if (list) list.push(page);
|
|
17108
|
+
else pagesOf.set(at, [page]);
|
|
17109
|
+
}
|
|
17110
|
+
});
|
|
17111
|
+
}
|
|
17112
|
+
return source;
|
|
17113
|
+
};
|
|
17114
|
+
const span = (at, portion) => {
|
|
17115
|
+
let starts = offsets.get(at);
|
|
17116
|
+
if (!starts) {
|
|
17117
|
+
starts = [0];
|
|
17118
|
+
for (const run of source.paragraphs[at].runs)
|
|
17119
|
+
starts.push(starts.at(-1) + reviewSourceLength(run));
|
|
17120
|
+
offsets.set(at, starts);
|
|
17121
|
+
}
|
|
17122
|
+
return [starts[portion.from], starts[portion.to + 1]];
|
|
17123
|
+
};
|
|
17124
|
+
const place2 = (portions) => {
|
|
17125
|
+
const count = source.paragraphs.length;
|
|
17126
|
+
const lastBefore = [];
|
|
17127
|
+
for (let at = 0, last = -1; at < count; at++) {
|
|
17128
|
+
lastBefore[at] = last;
|
|
17129
|
+
last = pagesOf.get(at)?.at(-1) ?? last;
|
|
17130
|
+
}
|
|
17131
|
+
const firstAfter = [];
|
|
17132
|
+
for (let at = count - 1, first3 = pages.length; at >= 0; at--) {
|
|
17133
|
+
firstAfter[at] = first3;
|
|
17134
|
+
first3 = pagesOf.get(at)?.[0] ?? first3;
|
|
17135
|
+
}
|
|
17136
|
+
const placed2 = [];
|
|
17137
|
+
for (const [at, found] of portions) {
|
|
17138
|
+
const showing = pagesOf.get(at);
|
|
17139
|
+
for (const portion of found) {
|
|
17140
|
+
if (!showing) {
|
|
17141
|
+
placed2.push({ text: portion.text, first: firstAfter[at], last: lastBefore[at] });
|
|
17142
|
+
continue;
|
|
17143
|
+
}
|
|
17144
|
+
const [start, end] = span(at, portion);
|
|
17145
|
+
const on = showing.filter((page) => shows2(onPage[page].get(at), start, end));
|
|
17146
|
+
const list = on.length ? on : showing;
|
|
17147
|
+
placed2.push({ text: portion.text, first: list[0], last: list.at(-1) });
|
|
17148
|
+
}
|
|
17149
|
+
}
|
|
17150
|
+
const before = new Array(pages.length).fill(-1);
|
|
17151
|
+
const after = new Array(pages.length).fill(-1);
|
|
17152
|
+
placed2.forEach((item, index) => {
|
|
17153
|
+
if (item.last + 1 < pages.length) before[Math.max(0, item.last + 1)] = index;
|
|
17154
|
+
});
|
|
17155
|
+
for (let index = placed2.length - 1; index >= 0; index--) {
|
|
17156
|
+
const page = placed2[index].first - 1;
|
|
17157
|
+
if (page >= 0) after[Math.min(page, pages.length - 1)] = index;
|
|
17158
|
+
}
|
|
17159
|
+
for (let page = 1; page < pages.length; page++)
|
|
17160
|
+
before[page] = Math.max(before[page], before[page - 1]);
|
|
17161
|
+
for (let page = pages.length - 2; page >= 0; page--)
|
|
17162
|
+
if (after[page] < 0 || after[page + 1] >= 0 && after[page + 1] < after[page])
|
|
17163
|
+
after[page] = after[page + 1];
|
|
17164
|
+
return { portions, placed: placed2, before, after };
|
|
17165
|
+
};
|
|
17166
|
+
const result = (page, reference) => {
|
|
17167
|
+
const document = read();
|
|
17168
|
+
const target = document.target(reference.style);
|
|
17169
|
+
if (!target) return void 0;
|
|
17170
|
+
const key = JSON.stringify(reference);
|
|
17171
|
+
let found = matches.get(key);
|
|
17172
|
+
if (!found) {
|
|
17173
|
+
const portions = /* @__PURE__ */ new Map();
|
|
17174
|
+
for (let at = 0; at < document.paragraphs.length; at++) {
|
|
17175
|
+
const results = document.portions(at, reference, target);
|
|
17176
|
+
if (results.length) portions.set(at, results);
|
|
17177
|
+
}
|
|
17178
|
+
found = place2(portions);
|
|
17179
|
+
matches.set(key, found);
|
|
17180
|
+
}
|
|
17181
|
+
const here = onPage[page] ?? /* @__PURE__ */ new Map();
|
|
17182
|
+
const order = [...here.keys()];
|
|
17183
|
+
for (const at of reference.last ? order.reverse() : order) {
|
|
17184
|
+
const shown = here.get(at);
|
|
17185
|
+
const texts = (found.portions.get(at) ?? []).filter(
|
|
17186
|
+
(portion) => shows2(shown, ...span(at, portion))
|
|
17187
|
+
);
|
|
17188
|
+
if (texts.length) return (reference.last ? texts.at(-1) : texts[0]).text;
|
|
17189
|
+
}
|
|
17190
|
+
const nearest = (found.before[page] ?? -1) >= 0 ? found.before[page] : found.after[page] ?? -1;
|
|
17191
|
+
return nearest >= 0 ? found.placed[nearest].text : void 0;
|
|
17192
|
+
};
|
|
17193
|
+
return {
|
|
17194
|
+
result,
|
|
17195
|
+
content(content, page) {
|
|
17196
|
+
const blocks = withStyleRefResults(content.blocks, (reference) => result(page, reference));
|
|
17197
|
+
return blocks === content.blocks ? content : { ...content, blocks };
|
|
17198
|
+
}
|
|
17199
|
+
};
|
|
17200
|
+
}
|
|
17201
|
+
|
|
16612
17202
|
// docx/layout/tab-stops.ts
|
|
16613
17203
|
function placeTab(positionPx, stops, hangingStopPx, followingPx, beforeDecimalPx) {
|
|
16614
17204
|
const epsilon = 0.5;
|
|
@@ -16626,6 +17216,15 @@ function placeTab(positionPx, stops, hangingStopPx, followingPx, beforeDecimalPx
|
|
|
16626
17216
|
const next = (Math.floor(positionPx / DEFAULT_TAB_STOP_PX) + 1) * DEFAULT_TAB_STOP_PX;
|
|
16627
17217
|
return { widthPx: next - positionPx };
|
|
16628
17218
|
}
|
|
17219
|
+
function placePositionalTab(positionPx, tab, startPx, endPx, followingPx) {
|
|
17220
|
+
const target = tab.alignment === "left" ? startPx : tab.alignment === "center" ? (startPx + endPx) / 2 : endPx;
|
|
17221
|
+
if (positionPx > target + 0.5) return void 0;
|
|
17222
|
+
const shift = tab.alignment === "right" ? followingPx : tab.alignment === "center" ? followingPx / 2 : 0;
|
|
17223
|
+
return {
|
|
17224
|
+
widthPx: Math.max(0, target - shift - positionPx),
|
|
17225
|
+
...tab.leader && tab.leader !== "none" ? { leader: tab.leader } : {}
|
|
17226
|
+
};
|
|
17227
|
+
}
|
|
16629
17228
|
|
|
16630
17229
|
// docx/layout/paragraph-tokens.ts
|
|
16631
17230
|
var SCRIPT_SCALE = 0.65;
|
|
@@ -16752,6 +17351,7 @@ function buildFragments(tokensOnLine, paragraph) {
|
|
|
16752
17351
|
...leader ? { leader } : {},
|
|
16753
17352
|
...run?.script ? { script: run.script } : {},
|
|
16754
17353
|
...run?.color ? { color: run.color } : {},
|
|
17354
|
+
...run?.background ? { background: run.background } : {},
|
|
16755
17355
|
...run?.underline ? { underline: true } : {},
|
|
16756
17356
|
...run?.strike ? { strike: true } : {},
|
|
16757
17357
|
...token.kind === "object" && run?.object ? { object: run.object } : {}
|
|
@@ -16847,6 +17447,7 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
|
|
|
16847
17447
|
let widthOverflowNoted = false;
|
|
16848
17448
|
let placed2 = [];
|
|
16849
17449
|
let lineWidthPx = 0;
|
|
17450
|
+
let marginReachPx = 0;
|
|
16850
17451
|
let tokenCursor = startToken;
|
|
16851
17452
|
let firstToken = startToken;
|
|
16852
17453
|
const boxes = [];
|
|
@@ -16942,6 +17543,7 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
|
|
|
16942
17543
|
if (forcedByBreak === "column") columnBreakAfterLine.add(lineIndex);
|
|
16943
17544
|
placed2 = [];
|
|
16944
17545
|
lineWidthPx = 0;
|
|
17546
|
+
marginReachPx = 0;
|
|
16945
17547
|
}
|
|
16946
17548
|
for (const [tokenIndex, token] of tokens.entries()) {
|
|
16947
17549
|
if (tokenIndex < startToken) continue;
|
|
@@ -16961,7 +17563,23 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
|
|
|
16961
17563
|
const marker = paragraph.runs[token.runIndex]?.marker;
|
|
16962
17564
|
const markerFactor = marker && token.kind === "word" && tokenIndex === 0 ? marker.alignment === "right" ? 1 : marker.alignment === "center" ? 0.5 : 0 : 0;
|
|
16963
17565
|
const advance = width * (1 - markerFactor);
|
|
16964
|
-
|
|
17566
|
+
const positional = token.kind === "tab" && paragraph.runs[token.runIndex]?.positionalTab;
|
|
17567
|
+
if (positional) {
|
|
17568
|
+
const { followingPx } = segmentAfter(tokenIndex);
|
|
17569
|
+
const [startPx, endPx] = positional.relativeTo === "indent" ? [Math.max(leftPx, 0), Math.min(contentWidthPx - rightPx, contentWidthPx)] : [0, contentWidthPx];
|
|
17570
|
+
const placeAt = (positionPx) => placePositionalTab(positionPx, positional, startPx, endPx, followingPx);
|
|
17571
|
+
let tab = placeAt(lineStart(lines.length) + lineWidthPx);
|
|
17572
|
+
if (!tab && placed2.length) {
|
|
17573
|
+
tokenCursor = tokenIndex;
|
|
17574
|
+
flushLine(false, void 0);
|
|
17575
|
+
tokenCursor = tokenIndex + 1;
|
|
17576
|
+
tab = placeAt(lineStart(lines.length));
|
|
17577
|
+
}
|
|
17578
|
+
width = tab?.widthPx ?? 0;
|
|
17579
|
+
leader = tab?.leader === "none" ? void 0 : tab?.leader;
|
|
17580
|
+
if (positional.relativeTo === "margin")
|
|
17581
|
+
marginReachPx = contentWidthPx - lineStart(lines.length);
|
|
17582
|
+
} else if (token.kind === "tab") {
|
|
16965
17583
|
const { followingPx, beforeDecimalPx } = segmentAfter(tokenIndex);
|
|
16966
17584
|
const tab = placeTab(
|
|
16967
17585
|
lineStart(lines.length) + lineWidthPx,
|
|
@@ -16974,7 +17592,7 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
|
|
|
16974
17592
|
leader = tab.leader === "none" ? void 0 : tab.leader;
|
|
16975
17593
|
}
|
|
16976
17594
|
const lineIndex = lines.length;
|
|
16977
|
-
const limit = availableWidth(lineIndex);
|
|
17595
|
+
const limit = Math.max(availableWidth(lineIndex), marginReachPx);
|
|
16978
17596
|
const wouldFit = lineWidthPx + (token.kind === "tab" ? width : advance) <= limit || placed2.every((placed3) => paragraph.runs[placed3.token.runIndex]?.synthetic);
|
|
16979
17597
|
if (!wouldFit && token.kind !== "space") {
|
|
16980
17598
|
tokenCursor = tokenIndex;
|
|
@@ -20856,21 +21474,8 @@ function endnoteParagraphs(model, label, adaptParagraph) {
|
|
|
20856
21474
|
});
|
|
20857
21475
|
}
|
|
20858
21476
|
|
|
20859
|
-
// docx/layout/review-display.ts
|
|
20860
|
-
function reviewSourceLength(run) {
|
|
20861
|
-
return run.equation || run.break || run.fieldChar || run.fieldCode !== void 0 || run.noteReference || run.image ? 1 : run.text.length;
|
|
20862
|
-
}
|
|
20863
|
-
function visibleReviewParagraph(paragraph, mode) {
|
|
20864
|
-
return mode === "all" ? paragraph : {
|
|
20865
|
-
...paragraph,
|
|
20866
|
-
runs: paragraph.runs.filter((run) => !isRunHiddenForReview(run, mode))
|
|
20867
|
-
};
|
|
20868
|
-
}
|
|
20869
|
-
function visibleReviewModel(model, mode) {
|
|
20870
|
-
return mode === "all" ? model : mapDocumentParagraphs(model, (paragraph) => visibleReviewParagraph(paragraph, mode));
|
|
20871
|
-
}
|
|
20872
|
-
|
|
20873
21477
|
// docx/layout/adapter.ts
|
|
21478
|
+
var FORM_FIELD_SHADING = "#d9d9d9";
|
|
20874
21479
|
var TABLE_ROW_NOTE = "Table rows with an exact height clip content that does not fit; text in them is not shrunk.";
|
|
20875
21480
|
var VERTICAL_MERGE_NOTE = "Vertically merged table cells are drawn as one cell, but their text stays in the first row of the merge.";
|
|
20876
21481
|
var DROP_CAP_NOTE = "Drop caps are laid out as an enlarged first letter (a raised cap), not as a dropped cap.";
|
|
@@ -20913,7 +21518,7 @@ function adaptDocumentModel(model, note = () => {
|
|
|
20913
21518
|
paragraphStyleId
|
|
20914
21519
|
});
|
|
20915
21520
|
const role = formatting.fontTheme?.ascii ?? formatting.fontTheme?.hAnsi;
|
|
20916
|
-
const family = formatting.fontFamily ?? (role && theme ? theme.fonts[role]?.latin : void 0);
|
|
21521
|
+
const family = symbolOnly(run) && run.symbol?.font || (formatting.fontFamily ?? (role && theme ? theme.fonts[role]?.latin : void 0));
|
|
20917
21522
|
const color = formatting.color ?? (formatting.colorTheme && theme ? resolveThemeColorReference(formatting.colorTheme, theme) : void 0);
|
|
20918
21523
|
return { formatting, family, color };
|
|
20919
21524
|
}
|
|
@@ -20926,7 +21531,9 @@ function adaptDocumentModel(model, note = () => {
|
|
|
20926
21531
|
if (run.equation && !equation) reportOnce(EQUATION_NOTE);
|
|
20927
21532
|
const name = run.field ? fieldName(run.field.instr) : "";
|
|
20928
21533
|
const noteText = run.noteReference ? noteLabel(run.noteReference.kind, run.noteReference.id) : run.noteMark ? markLabel ?? "" : void 0;
|
|
20929
|
-
const
|
|
21534
|
+
const formText = formFieldDisplayText(run);
|
|
21535
|
+
const shaded = model.formFieldShading !== false && (formText !== void 0 || name === "FORMTEXT");
|
|
21536
|
+
const text2 = noteText ?? formText ?? (run.field && !isFieldLocked(run) && (name === "DATE" || name === "TIME") ? dateFieldResult(name, run.field.instr, now) : run.equation ? equation ? "" : "[Equation]" : run.text);
|
|
20930
21537
|
const script = formatting.verticalAlign === "superscript" || noteText !== void 0 && formatting.verticalAlign === void 0 ? "super" : formatting.verticalAlign === "subscript" ? "sub" : void 0;
|
|
20931
21538
|
const image = run.image;
|
|
20932
21539
|
if (image?.unsupported === "Text box") reportOnce(TEXT_BOX_NOTE);
|
|
@@ -20962,6 +21569,8 @@ function adaptDocumentModel(model, note = () => {
|
|
|
20962
21569
|
positionPx: formatting.positionHalfPoints === void 0 ? void 0 : formatting.positionHalfPoints * 2 / 3
|
|
20963
21570
|
}),
|
|
20964
21571
|
...color && /^#[0-9a-f]{6}$/i.test(color) ? { color } : {},
|
|
21572
|
+
...shaded ? { background: FORM_FIELD_SHADING } : {},
|
|
21573
|
+
...run.positionalTab ? { positionalTab: run.positionalTab } : {},
|
|
20965
21574
|
...formatting.underline ? { underline: true } : {},
|
|
20966
21575
|
...formatting.strike || formatting.doubleStrike ? { strike: true } : {},
|
|
20967
21576
|
...run.break ? { breakAfter: run.break } : {},
|
|
@@ -21000,7 +21609,9 @@ function adaptDocumentModel(model, note = () => {
|
|
|
21000
21609
|
const resolved = catalog ? resolveParagraphFormatting(paragraph, catalog) : paragraph;
|
|
21001
21610
|
const label = labels.get(paragraph.id);
|
|
21002
21611
|
const ownFirstLine = resolved.firstLineTwips !== void 0 || resolved.hangingTwips !== void 0;
|
|
21003
|
-
const runs = paragraph.runs.
|
|
21612
|
+
const runs = paragraph.runs.flatMap(
|
|
21613
|
+
(run) => symbolSegments(run).map((segment2) => adaptRun(segment2, paragraph.style, markLabel))
|
|
21614
|
+
);
|
|
21004
21615
|
const visible = visibleReviewParagraph(paragraph, reviewMode);
|
|
21005
21616
|
const footnotes = paragraphFootnotes(visible, visibleModel, noteLabel, adaptParagraph);
|
|
21006
21617
|
const { betweenBorder: _between, ...box } = paragraphBox(resolved, model.theme);
|
|
@@ -21493,4 +22104,4 @@ function createLayoutSession(measurer, options2 = {}) {
|
|
|
21493
22104
|
};
|
|
21494
22105
|
}
|
|
21495
22106
|
|
|
21496
|
-
export { DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE_PT, DEFAULT_TAB_STOP_PX, FLOAT_WRAP_NOTE, NO_TWIPS, PageCursor, SINGLE_LINE_SPACING_UNITS, adaptDocumentModel, adjustForWidowOrphan, appendBreakMarker, cellVerticalOffset, createFakeMeasurer, createLayoutSession, cssFontStack, fieldDisplayText, floatOrigin, floatPosition, fontMetrics, headerFooterForPage, headerFooterSlotForPage, isEastAsianChar, layoutDocument, layoutDocumentModel, layoutParagraph, layoutRow, layoutSections, ligatureCss, pageNumberValues, pageNumbers, paragraphFloats, placeParagraph, placeTab, placeTable, positionFloats, ptToPx, pxToTwips, sectionPageCounts, splitRowAtHeight, suppressesSpacing, tokenizeRun, twipsToPx, widowControlEnabled };
|
|
22107
|
+
export { DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE_PT, DEFAULT_TAB_STOP_PX, FLOAT_WRAP_NOTE, NO_TWIPS, PageCursor, SINGLE_LINE_SPACING_UNITS, adaptDocumentModel, adjustForWidowOrphan, appendBreakMarker, cellVerticalOffset, createFakeMeasurer, createLayoutSession, cssFontStack, fieldDisplayText, floatOrigin, floatPosition, fontMetrics, headerFooterForPage, headerFooterSlotForPage, isEastAsianChar, layoutDocument, layoutDocumentModel, layoutParagraph, layoutRow, layoutSections, ligatureCss, pageNumberValues, pageNumbers, pageStyleRefs, paragraphFloats, placeParagraph, placeTab, placeTable, positionFloats, ptToPx, pxToTwips, reviewSourceLength, sectionPageCounts, splitRowAtHeight, suppressesSpacing, tokenizeRun, twipsToPx, widowControlEnabled };
|