ooxml-core 1.19.2 → 1.21.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 +47 -1
- package/dist/{PptxHandler-6TNIQ7S5.cjs → PptxHandler-DNSXWTQV.cjs} +3 -3
- package/dist/{PptxHandler-2V4PQL6O.mjs → PptxHandler-FSKKPZZC.mjs} +3 -3
- package/dist/PptxHandler-H7MEWJJJ.mjs +4 -0
- package/dist/{PresentationBuilder-G7MPEGXJ.mjs → PresentationBuilder-7TSENZTX.mjs} +2 -2
- package/dist/{PresentationBuilder-RM52LCVN.cjs → PresentationBuilder-A5NI35VN.cjs} +5 -5
- package/dist/{PresentationBuilder-HQ6C7L4V.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 +6280 -2506
- package/dist/automation/index.d.ts +1 -0
- package/dist/automation/index.d.ts.map +1 -1
- package/dist/automation/index.mjs +6277 -2507
- package/dist/automation/xlsx-read.d.ts +56 -0
- package/dist/automation/xlsx-read.d.ts.map +1 -0
- package/dist/automation/xlsx.d.ts +105 -4
- 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-NYTR4UZ5.cjs → chunk-4LZIUJI3.cjs} +52 -12
- package/dist/{chunk-SLNQNVQM.mjs → chunk-4QPOJCJG.mjs} +45 -8
- package/dist/{chunk-XTSHZGSM.mjs → chunk-6IIMI5RS.mjs} +52 -12
- package/dist/{chunk-TJPUAUWL.mjs → chunk-BA7Z6ATM.mjs} +9 -195
- package/dist/{chunk-JUABSM7C.mjs → chunk-DLFMCZZT.mjs} +1 -1
- package/dist/{chunk-M4XLF4R7.mjs → chunk-GBKBR4CX.mjs} +20 -8
- package/dist/{chunk-R5FIHHGB.cjs → chunk-HL3FBJ6X.cjs} +1648 -1205
- package/dist/{chunk-ZJ2OKIJN.mjs → chunk-LF5E5ZOH.mjs} +642 -199
- package/dist/{chunk-4FTUAD2B.mjs → chunk-Q5PKBQXH.mjs} +766 -202
- package/dist/{chunk-M6GDBVQ7.mjs → chunk-VQF6HQEE.mjs} +1 -1
- package/dist/collab/embedding.d.ts +103 -0
- package/dist/collab/embedding.d.ts.map +1 -0
- package/dist/collab/index.cjs +450 -342
- package/dist/collab/index.d.ts +1 -0
- package/dist/collab/index.d.ts.map +1 -1
- package/dist/collab/index.mjs +443 -343
- 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 +102 -26
- package/dist/index.mjs +102 -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 +995 -462
- package/dist/pptx/automation/index.d.ts +2 -2
- package/dist/pptx/automation/index.mjs +6 -6
- package/dist/pptx/chunks/{index-Bqm-jFG-.d.ts → index-CPhsd7Df.d.ts} +7580 -7507
- package/dist/pptx/chunks/index-CPhsd7Df.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-B9x557hr.d.ts → index-Q5mM8kIR.d.ts} +2 -2
- package/dist/pptx/chunks/{index-B9x557hr.d.ts.map → index-Q5mM8kIR.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +770 -238
- 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 +1099 -628
- package/dist/pptx/index.d.ts +3 -3
- 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/index.cjs +220 -46
- package/dist/visio/index.mjs +220 -46
- package/dist/visio/ui/contract.d.ts +8 -2
- package/dist/visio/ui/contract.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +227 -50
- package/dist/visio/ui/index.mjs +227 -50
- 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/dimensions.d.ts.map +1 -1
- package/dist/xlsx/edit/history-rows.d.ts +7 -0
- package/dist/xlsx/edit/history-rows.d.ts.map +1 -0
- package/dist/xlsx/edit/history.d.ts +19 -4
- package/dist/xlsx/edit/history.d.ts.map +1 -1
- package/dist/xlsx/edit/outline.d.ts.map +1 -1
- package/dist/xlsx/edit/row-autofit.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 +2551 -1208
- package/dist/xlsx/index.d.ts +1 -0
- package/dist/xlsx/index.d.ts.map +1 -1
- package/dist/xlsx/index.mjs +2544 -1209
- 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 +598 -98
- 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 +597 -99
- package/dist/xlsx/numfmt/format.d.ts +8 -0
- package/dist/xlsx/numfmt/format.d.ts.map +1 -1
- 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/sheet-data-source.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 +795 -388
- package/dist/xlsx/ui/index.d.ts +1 -0
- package/dist/xlsx/ui/index.d.ts.map +1 -1
- package/dist/xlsx/ui/index.mjs +795 -389
- package/dist/xlsx/ui/selection-format.d.ts +13 -0
- package/dist/xlsx/ui/selection-format.d.ts.map +1 -0
- package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
- package/dist/xml/index.cjs +57 -3
- package/dist/xml/index.mjs +57 -4
- package/dist/xml/lite.d.ts.map +1 -1
- package/dist/xml/xml.d.ts +11 -1
- package/dist/xml/xml.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/PptxHandler-HSPKEP5E.mjs +0 -4
- package/dist/pptx/chunks/index-Bqm-jFG-.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1383,6 +1383,17 @@ function formatCompactAxisValue(value, formatCode) {
|
|
|
1383
1383
|
return value.toFixed(1);
|
|
1384
1384
|
}
|
|
1385
1385
|
|
|
1386
|
+
// chart/extent.ts
|
|
1387
|
+
function extentOf(values) {
|
|
1388
|
+
let min = Infinity;
|
|
1389
|
+
let max = -Infinity;
|
|
1390
|
+
for (const value of values) {
|
|
1391
|
+
min = Math.min(min, value);
|
|
1392
|
+
max = Math.max(max, value);
|
|
1393
|
+
}
|
|
1394
|
+
return { min, max };
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1386
1397
|
// chart/bubble-radius.ts
|
|
1387
1398
|
function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options2) {
|
|
1388
1399
|
const scale = (options2?.bubbleScale ?? 100) / 100;
|
|
@@ -1393,7 +1404,7 @@ function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options2) {
|
|
|
1393
1404
|
return medianRadius * scale * 0.5 + ratio * medianRadius * scale * 1.5;
|
|
1394
1405
|
}
|
|
1395
1406
|
function maxBubbleSize(sizes) {
|
|
1396
|
-
return
|
|
1407
|
+
return Math.max(1, extentOf(sizes.map(Math.abs)).max);
|
|
1397
1408
|
}
|
|
1398
1409
|
function medianBubbleRadius(plotWidth, plotHeight) {
|
|
1399
1410
|
return Math.min(plotWidth, plotHeight) * 0.04;
|
|
@@ -1812,8 +1823,7 @@ function computeHistogramBins(values, options2, format = String) {
|
|
|
1812
1823
|
});
|
|
1813
1824
|
}
|
|
1814
1825
|
if (regular.length > 0) {
|
|
1815
|
-
const min =
|
|
1816
|
-
const max = Math.max(...regular.map((item) => item.value));
|
|
1826
|
+
const { min, max } = extentOf(regular.map((item) => item.value));
|
|
1817
1827
|
const requestedSize = options2.binSize && options2.binSize > 0 ? options2.binSize : void 0;
|
|
1818
1828
|
const requestedCount = options2.binCount && options2.binCount > 0 ? options2.binCount : void 0;
|
|
1819
1829
|
const start = requestedSize ? Math.floor(min / requestedSize) * requestedSize : min;
|
|
@@ -2029,8 +2039,9 @@ function fitChartTrendline(options2, xVals, yVals) {
|
|
|
2029
2039
|
}
|
|
2030
2040
|
const model = fitModel(options2, xVals, yVals);
|
|
2031
2041
|
if (!model) return noFit();
|
|
2032
|
-
const
|
|
2033
|
-
const
|
|
2042
|
+
const xRange = extentOf(xVals);
|
|
2043
|
+
const startX = xRange.min - (options2.backward ?? 0);
|
|
2044
|
+
const endX = xRange.max + (options2.forward ?? 0);
|
|
2034
2045
|
const steps = Math.max(Math.ceil((endX - startX) * 4), 20);
|
|
2035
2046
|
const points = [];
|
|
2036
2047
|
for (let step = 0; step <= steps; step++) {
|
|
@@ -2209,6 +2220,7 @@ __export(xml_exports, {
|
|
|
2209
2220
|
DEFAULT_XML_LIMITS: () => DEFAULT_XML_LIMITS,
|
|
2210
2221
|
LiteElement: () => LiteElement,
|
|
2211
2222
|
NS: () => NS,
|
|
2223
|
+
XmlLimitError: () => XmlLimitError,
|
|
2212
2224
|
attr: () => attr,
|
|
2213
2225
|
buildXml: () => buildXml,
|
|
2214
2226
|
checkXmlLimits: () => checkXmlLimits,
|
|
@@ -2297,6 +2309,19 @@ var DEFAULT_XML_LIMITS = {
|
|
|
2297
2309
|
maxDepth: 512,
|
|
2298
2310
|
maxNodes: 5e6
|
|
2299
2311
|
};
|
|
2312
|
+
var XmlLimitError = class extends Error {
|
|
2313
|
+
code = "xml-limit";
|
|
2314
|
+
/** The limit that was exceeded. */
|
|
2315
|
+
limit;
|
|
2316
|
+
/** Its value: the largest depth or element count allowed. */
|
|
2317
|
+
maximum;
|
|
2318
|
+
constructor(message, limit, maximum) {
|
|
2319
|
+
super(message);
|
|
2320
|
+
this.name = "XmlLimitError";
|
|
2321
|
+
this.limit = limit;
|
|
2322
|
+
this.maximum = maximum;
|
|
2323
|
+
}
|
|
2324
|
+
};
|
|
2300
2325
|
var TAG_RE = /<(\/?)([^\s\/><]+)(?:\s+[^\s=\/><]+\s*=\s*(?:"[^"<]*"|'[^'<]*'))*\s*(\/?)>/y;
|
|
2301
2326
|
var MARKUP_SKIPS = [
|
|
2302
2327
|
["<!--", "-->"],
|
|
@@ -2330,11 +2355,22 @@ function checkXmlLimits(xml, label, limits = {}) {
|
|
|
2330
2355
|
continue;
|
|
2331
2356
|
}
|
|
2332
2357
|
nodes++;
|
|
2333
|
-
if (nodes > maxNodes)
|
|
2358
|
+
if (nodes > maxNodes)
|
|
2359
|
+
throw new XmlLimitError(
|
|
2360
|
+
`${label} XML exceeds the limit of ${maxNodes} elements`,
|
|
2361
|
+
"maxNodes",
|
|
2362
|
+
maxNodes
|
|
2363
|
+
);
|
|
2334
2364
|
if (!selfClosing && ++depth > maxDepth2)
|
|
2335
|
-
throw new
|
|
2365
|
+
throw new XmlLimitError(
|
|
2366
|
+
`${label} XML exceeds the nesting depth limit of ${maxDepth2}`,
|
|
2367
|
+
"maxDepth",
|
|
2368
|
+
maxDepth2
|
|
2369
|
+
);
|
|
2336
2370
|
}
|
|
2337
2371
|
}
|
|
2372
|
+
var CRLF_DECLARATION = /^<\?xml[^>]*\?>\r\n/;
|
|
2373
|
+
var crlfDeclarations = /* @__PURE__ */ new WeakSet();
|
|
2338
2374
|
function parseXml(xml, options2 = {}) {
|
|
2339
2375
|
const label = options2.label ?? "OOXML";
|
|
2340
2376
|
if (/<!DOCTYPE|<!ENTITY/i.test(xml))
|
|
@@ -2356,9 +2392,13 @@ function parseXml(xml, options2 = {}) {
|
|
|
2356
2392
|
}
|
|
2357
2393
|
if (parseError || !parsed.documentElement)
|
|
2358
2394
|
throw new Error(`Invalid ${label} XML: ${parseError || "missing root element"}`);
|
|
2395
|
+
if (CRLF_DECLARATION.test(xml)) crlfDeclarations.add(parsed);
|
|
2359
2396
|
return parsed;
|
|
2360
2397
|
}
|
|
2361
|
-
var buildXml = (node) =>
|
|
2398
|
+
var buildXml = (node) => {
|
|
2399
|
+
const xml = new xmldom.XMLSerializer().serializeToString(node);
|
|
2400
|
+
return crlfDeclarations.has(node) ? xml.replace(/^(<\?xml[^>]*\?>)\n/, "$1\r\n") : xml;
|
|
2401
|
+
};
|
|
2362
2402
|
var isElement = (node) => node.nodeType === 1;
|
|
2363
2403
|
var elements = (parent) => Array.from(parent.childNodes).filter(isElement);
|
|
2364
2404
|
var textContent = (element2) => element2.textContent ?? "";
|
|
@@ -2459,6 +2499,12 @@ function parseLiteFragment(xml, container, namespaces) {
|
|
|
2459
2499
|
}
|
|
2460
2500
|
if (lt < 0) break;
|
|
2461
2501
|
const next = source.charCodeAt(lt + 1);
|
|
2502
|
+
if (next === 33) {
|
|
2503
|
+
const after = skipCommentOrCdata(source, lt, top);
|
|
2504
|
+
if (after < 0) return void 0;
|
|
2505
|
+
pos = after;
|
|
2506
|
+
continue;
|
|
2507
|
+
}
|
|
2462
2508
|
if (next === 47) {
|
|
2463
2509
|
const gt = source.indexOf(">", lt);
|
|
2464
2510
|
if (gt < 0 || stack.length < 2 || source.slice(lt + 2, gt).trimEnd() !== top.tagName)
|
|
@@ -2479,6 +2525,25 @@ function parseLiteFragment(xml, container, namespaces) {
|
|
|
2479
2525
|
}
|
|
2480
2526
|
return stack.length === 1 ? root : void 0;
|
|
2481
2527
|
}
|
|
2528
|
+
var DECLARATIONS = /<!DOCTYPE|<!ENTITY/i;
|
|
2529
|
+
function skipCommentOrCdata(source, lt, parent) {
|
|
2530
|
+
if (source.startsWith("<!--", lt)) {
|
|
2531
|
+
const end = source.indexOf("-->", lt + 4);
|
|
2532
|
+
if (end < 0) return -1;
|
|
2533
|
+
const body = source.slice(lt + 4, end);
|
|
2534
|
+
if (body.includes("--") || body.endsWith("-") || DECLARATIONS.test(body)) return -1;
|
|
2535
|
+
return end + 3;
|
|
2536
|
+
}
|
|
2537
|
+
if (source.startsWith("<![CDATA[", lt)) {
|
|
2538
|
+
const end = source.indexOf("]]>", lt + 9);
|
|
2539
|
+
if (end < 0) return -1;
|
|
2540
|
+
const text4 = source.slice(lt + 9, end);
|
|
2541
|
+
if (DECLARATIONS.test(text4)) return -1;
|
|
2542
|
+
parent.childNodes.push(text4);
|
|
2543
|
+
return end + 3;
|
|
2544
|
+
}
|
|
2545
|
+
return -1;
|
|
2546
|
+
}
|
|
2482
2547
|
function startTag(source, from, namespaces) {
|
|
2483
2548
|
const n2 = source.length;
|
|
2484
2549
|
let i2 = from;
|
|
@@ -6980,8 +7045,7 @@ function computeLogValueRange(series, logBase) {
|
|
|
6980
7045
|
if (allValues.length === 0) {
|
|
6981
7046
|
return { min: 1, max: logBase, span: 1, logScale: true, logBase };
|
|
6982
7047
|
}
|
|
6983
|
-
const dataMin =
|
|
6984
|
-
const dataMax = Math.max(...allValues);
|
|
7048
|
+
const { min: dataMin, max: dataMax } = extentOf(allValues);
|
|
6985
7049
|
const logMin = Math.floor(Math.log(dataMin) / Math.log(logBase));
|
|
6986
7050
|
const logMax = Math.ceil(Math.log(dataMax) / Math.log(logBase));
|
|
6987
7051
|
const min = logBase ** logMin;
|
|
@@ -7596,8 +7660,9 @@ function waterfallView(chart, model, ctx) {
|
|
|
7596
7660
|
colors: { increase: role(0), decrease: role(1), total: role(2) }
|
|
7597
7661
|
};
|
|
7598
7662
|
const ends = steps.flatMap((step) => [step.startValue, step.endValue]);
|
|
7663
|
+
const range = extentOf(ends);
|
|
7599
7664
|
model.valueAxis = {
|
|
7600
|
-
...ends.length ? niceScale(
|
|
7665
|
+
...ends.length ? niceScale(range.min, range.max) : niceScale(0, 1),
|
|
7601
7666
|
percent: false
|
|
7602
7667
|
};
|
|
7603
7668
|
const labels = model.categories;
|
|
@@ -7713,7 +7778,8 @@ function chartSummaryView(chart, theme, options2 = {}) {
|
|
|
7713
7778
|
s2.xValues = s2.values.map((_, k) => numeric ? toNumber(cats[k] ?? null) : k + 1);
|
|
7714
7779
|
});
|
|
7715
7780
|
const xs = series.flatMap((s2) => s2.xValues ?? []).filter((x) => x !== null);
|
|
7716
|
-
|
|
7781
|
+
const range = extentOf(xs);
|
|
7782
|
+
model.xAxis = xs.length ? niceScale(range.min, range.max) : niceScale(0, 1);
|
|
7717
7783
|
}
|
|
7718
7784
|
if (type === "stock") model.stock = stockView(chart.stock, ctx);
|
|
7719
7785
|
if (type === "bubble") bubbleView(chart, model, ctx.evaluateRef);
|
|
@@ -7745,7 +7811,7 @@ function cartesianAxes(model, area, out) {
|
|
|
7745
7811
|
const cats = Math.max(1, model.categories.length);
|
|
7746
7812
|
const catW = Math.min(
|
|
7747
7813
|
area.w * 0.3,
|
|
7748
|
-
Math.max(
|
|
7814
|
+
Math.max(extentOf(model.categories.map((c2) => textWidth(c2, categorySize))).max, 8) + 6
|
|
7749
7815
|
);
|
|
7750
7816
|
const second = horizontal ? void 0 : model.secondaryAxis;
|
|
7751
7817
|
const secondLabels = second?.ticks.map((t) => axisTickText(t, model.axes?.secondary, second.percent)) ?? [];
|
|
@@ -8438,13 +8504,11 @@ function chartLegendSvg(model, area, frame2, options2) {
|
|
|
8438
8504
|
chartAreaRect(model, "legend", { x: manual.x, y: manual.y, w: manual.width, h: manual.height })
|
|
8439
8505
|
];
|
|
8440
8506
|
const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
|
|
8507
|
+
const widest = extentOf(widths).max;
|
|
8441
8508
|
entries.forEach((entry3, i2) => {
|
|
8442
8509
|
const available = horizontal ? chartTextWidth(entry3.label, attrs, options2) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
|
|
8443
8510
|
const label = fitChartText(entry3.label, available, attrs, options2);
|
|
8444
|
-
const contentWidth = Math.min(
|
|
8445
|
-
horizontal ? widths[i2] ?? 0 : Math.max(...widths),
|
|
8446
|
-
rowWidth - size / 2
|
|
8447
|
-
);
|
|
8511
|
+
const contentWidth = Math.min(horizontal ? widths[i2] ?? 0 : widest, rowWidth - size / 2);
|
|
8448
8512
|
const x = horizontal ? horizontalX : manual.x + Math.max(size / 4, (rowWidth - contentWidth) / 2);
|
|
8449
8513
|
const centerY = manual.y + (horizontal ? 0 : i2 * rowHeight) + rowHeight / 2;
|
|
8450
8514
|
markup.push(rect(x, centerY - keySize / 2, keySize, keySize, entry3.color));
|
|
@@ -8516,7 +8580,7 @@ function automaticLegend(model, area, out, options2, bounds2) {
|
|
|
8516
8580
|
}
|
|
8517
8581
|
const width = Math.min(
|
|
8518
8582
|
area.w * 0.35,
|
|
8519
|
-
|
|
8583
|
+
extentOf(entries.map((e) => chartTextWidth(e.label, attrs, options2))).max + 22
|
|
8520
8584
|
);
|
|
8521
8585
|
const height = entries.length * rowH;
|
|
8522
8586
|
const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
|
|
@@ -33198,10 +33262,13 @@ var DEFAULT_ZIP_LIMITS = {
|
|
|
33198
33262
|
var ZipLimitError = class extends Error {
|
|
33199
33263
|
code = "ZIP_BOMB";
|
|
33200
33264
|
limit;
|
|
33265
|
+
/** The check that failed (absent when the error was built without one). */
|
|
33266
|
+
kind;
|
|
33201
33267
|
constructor(message, details) {
|
|
33202
33268
|
super(message);
|
|
33203
33269
|
this.name = "ZipLimitError";
|
|
33204
33270
|
this.limit = details.limit;
|
|
33271
|
+
this.kind = details.kind;
|
|
33205
33272
|
}
|
|
33206
33273
|
};
|
|
33207
33274
|
var mib = (bytes) => Math.round(bytes / 1048576);
|
|
@@ -33224,7 +33291,7 @@ function resolveLimits(limits) {
|
|
|
33224
33291
|
maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
|
|
33225
33292
|
maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
|
|
33226
33293
|
label: limits.label ?? "ZIP",
|
|
33227
|
-
fail: (message, limit) => create ? create(message, { limit }) : new ZipLimitError(message, { limit })
|
|
33294
|
+
fail: (message, limit, kind) => create ? create(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
|
|
33228
33295
|
};
|
|
33229
33296
|
}
|
|
33230
33297
|
function inflateEntryGuarded(entry3, alreadyRead, limits) {
|
|
@@ -33247,13 +33314,18 @@ function inflateEntryGuarded(entry3, alreadyRead, limits) {
|
|
|
33247
33314
|
size += chunk.byteLength;
|
|
33248
33315
|
if (size > declared || size > r.maxEntryBytes)
|
|
33249
33316
|
return abort(
|
|
33250
|
-
r.fail(
|
|
33317
|
+
r.fail(
|
|
33318
|
+
`${r.label} part ${entry3.name} inflates past its declared size`,
|
|
33319
|
+
r.maxEntryBytes,
|
|
33320
|
+
size > declared ? "declaredSize" : "maxEntryBytes"
|
|
33321
|
+
)
|
|
33251
33322
|
);
|
|
33252
33323
|
if (alreadyRead + size > r.maxTotalBytes)
|
|
33253
33324
|
return abort(
|
|
33254
33325
|
r.fail(
|
|
33255
33326
|
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
33256
|
-
r.maxTotalBytes
|
|
33327
|
+
r.maxTotalBytes,
|
|
33328
|
+
"maxTotalBytes"
|
|
33257
33329
|
)
|
|
33258
33330
|
);
|
|
33259
33331
|
chunks.push(chunk);
|
|
@@ -33286,26 +33358,29 @@ function guardZip(zip, limits = {}) {
|
|
|
33286
33358
|
if (entries.length > r.maxEntries)
|
|
33287
33359
|
throw r.fail(
|
|
33288
33360
|
`${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
|
|
33289
|
-
r.maxEntries
|
|
33361
|
+
r.maxEntries,
|
|
33362
|
+
"maxEntries"
|
|
33290
33363
|
);
|
|
33291
33364
|
let declared = 0;
|
|
33292
33365
|
for (const entry3 of entries) {
|
|
33293
33366
|
const original = entry3.unsafeOriginalName;
|
|
33294
33367
|
if (!isSafePartName(entry3.name) || original !== void 0 && !isSafePartName(original))
|
|
33295
|
-
throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries);
|
|
33368
|
+
throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries, "partName");
|
|
33296
33369
|
if (entry3.dir) continue;
|
|
33297
33370
|
const size = declaredEntrySize(entry3);
|
|
33298
33371
|
if (size > r.maxEntryBytes)
|
|
33299
33372
|
throw r.fail(
|
|
33300
33373
|
`${r.label} part ${entry3.name} exceeds the uncompressed part size limit`,
|
|
33301
|
-
r.maxEntryBytes
|
|
33374
|
+
r.maxEntryBytes,
|
|
33375
|
+
"maxEntryBytes"
|
|
33302
33376
|
);
|
|
33303
33377
|
declared += size;
|
|
33304
33378
|
}
|
|
33305
33379
|
if (declared > r.maxTotalBytes)
|
|
33306
33380
|
throw r.fail(
|
|
33307
33381
|
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
33308
|
-
r.maxTotalBytes
|
|
33382
|
+
r.maxTotalBytes,
|
|
33383
|
+
"maxTotalBytes"
|
|
33309
33384
|
);
|
|
33310
33385
|
const produced = /* @__PURE__ */ new Map();
|
|
33311
33386
|
let total = 0;
|
|
@@ -33343,7 +33418,8 @@ async function openZip(input, limits = {}) {
|
|
|
33343
33418
|
if (bytes.byteLength > maxInput)
|
|
33344
33419
|
throw r.fail(
|
|
33345
33420
|
`${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
|
|
33346
|
-
maxInput
|
|
33421
|
+
maxInput,
|
|
33422
|
+
"maxInputBytes"
|
|
33347
33423
|
);
|
|
33348
33424
|
return guardZip(await JSZip__default.default.loadAsync(bytes), limits);
|
|
33349
33425
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1377,6 +1377,17 @@ function formatCompactAxisValue(value, formatCode) {
|
|
|
1377
1377
|
return value.toFixed(1);
|
|
1378
1378
|
}
|
|
1379
1379
|
|
|
1380
|
+
// chart/extent.ts
|
|
1381
|
+
function extentOf(values) {
|
|
1382
|
+
let min = Infinity;
|
|
1383
|
+
let max = -Infinity;
|
|
1384
|
+
for (const value of values) {
|
|
1385
|
+
min = Math.min(min, value);
|
|
1386
|
+
max = Math.max(max, value);
|
|
1387
|
+
}
|
|
1388
|
+
return { min, max };
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1380
1391
|
// chart/bubble-radius.ts
|
|
1381
1392
|
function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options2) {
|
|
1382
1393
|
const scale = (options2?.bubbleScale ?? 100) / 100;
|
|
@@ -1387,7 +1398,7 @@ function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options2) {
|
|
|
1387
1398
|
return medianRadius * scale * 0.5 + ratio * medianRadius * scale * 1.5;
|
|
1388
1399
|
}
|
|
1389
1400
|
function maxBubbleSize(sizes) {
|
|
1390
|
-
return
|
|
1401
|
+
return Math.max(1, extentOf(sizes.map(Math.abs)).max);
|
|
1391
1402
|
}
|
|
1392
1403
|
function medianBubbleRadius(plotWidth, plotHeight) {
|
|
1393
1404
|
return Math.min(plotWidth, plotHeight) * 0.04;
|
|
@@ -1806,8 +1817,7 @@ function computeHistogramBins(values, options2, format = String) {
|
|
|
1806
1817
|
});
|
|
1807
1818
|
}
|
|
1808
1819
|
if (regular.length > 0) {
|
|
1809
|
-
const min =
|
|
1810
|
-
const max = Math.max(...regular.map((item) => item.value));
|
|
1820
|
+
const { min, max } = extentOf(regular.map((item) => item.value));
|
|
1811
1821
|
const requestedSize = options2.binSize && options2.binSize > 0 ? options2.binSize : void 0;
|
|
1812
1822
|
const requestedCount = options2.binCount && options2.binCount > 0 ? options2.binCount : void 0;
|
|
1813
1823
|
const start = requestedSize ? Math.floor(min / requestedSize) * requestedSize : min;
|
|
@@ -2023,8 +2033,9 @@ function fitChartTrendline(options2, xVals, yVals) {
|
|
|
2023
2033
|
}
|
|
2024
2034
|
const model = fitModel(options2, xVals, yVals);
|
|
2025
2035
|
if (!model) return noFit();
|
|
2026
|
-
const
|
|
2027
|
-
const
|
|
2036
|
+
const xRange = extentOf(xVals);
|
|
2037
|
+
const startX = xRange.min - (options2.backward ?? 0);
|
|
2038
|
+
const endX = xRange.max + (options2.forward ?? 0);
|
|
2028
2039
|
const steps = Math.max(Math.ceil((endX - startX) * 4), 20);
|
|
2029
2040
|
const points = [];
|
|
2030
2041
|
for (let step = 0; step <= steps; step++) {
|
|
@@ -2203,6 +2214,7 @@ __export(xml_exports, {
|
|
|
2203
2214
|
DEFAULT_XML_LIMITS: () => DEFAULT_XML_LIMITS,
|
|
2204
2215
|
LiteElement: () => LiteElement,
|
|
2205
2216
|
NS: () => NS,
|
|
2217
|
+
XmlLimitError: () => XmlLimitError,
|
|
2206
2218
|
attr: () => attr,
|
|
2207
2219
|
buildXml: () => buildXml,
|
|
2208
2220
|
checkXmlLimits: () => checkXmlLimits,
|
|
@@ -2291,6 +2303,19 @@ var DEFAULT_XML_LIMITS = {
|
|
|
2291
2303
|
maxDepth: 512,
|
|
2292
2304
|
maxNodes: 5e6
|
|
2293
2305
|
};
|
|
2306
|
+
var XmlLimitError = class extends Error {
|
|
2307
|
+
code = "xml-limit";
|
|
2308
|
+
/** The limit that was exceeded. */
|
|
2309
|
+
limit;
|
|
2310
|
+
/** Its value: the largest depth or element count allowed. */
|
|
2311
|
+
maximum;
|
|
2312
|
+
constructor(message, limit, maximum) {
|
|
2313
|
+
super(message);
|
|
2314
|
+
this.name = "XmlLimitError";
|
|
2315
|
+
this.limit = limit;
|
|
2316
|
+
this.maximum = maximum;
|
|
2317
|
+
}
|
|
2318
|
+
};
|
|
2294
2319
|
var TAG_RE = /<(\/?)([^\s\/><]+)(?:\s+[^\s=\/><]+\s*=\s*(?:"[^"<]*"|'[^'<]*'))*\s*(\/?)>/y;
|
|
2295
2320
|
var MARKUP_SKIPS = [
|
|
2296
2321
|
["<!--", "-->"],
|
|
@@ -2324,11 +2349,22 @@ function checkXmlLimits(xml, label, limits = {}) {
|
|
|
2324
2349
|
continue;
|
|
2325
2350
|
}
|
|
2326
2351
|
nodes++;
|
|
2327
|
-
if (nodes > maxNodes)
|
|
2352
|
+
if (nodes > maxNodes)
|
|
2353
|
+
throw new XmlLimitError(
|
|
2354
|
+
`${label} XML exceeds the limit of ${maxNodes} elements`,
|
|
2355
|
+
"maxNodes",
|
|
2356
|
+
maxNodes
|
|
2357
|
+
);
|
|
2328
2358
|
if (!selfClosing && ++depth > maxDepth2)
|
|
2329
|
-
throw new
|
|
2359
|
+
throw new XmlLimitError(
|
|
2360
|
+
`${label} XML exceeds the nesting depth limit of ${maxDepth2}`,
|
|
2361
|
+
"maxDepth",
|
|
2362
|
+
maxDepth2
|
|
2363
|
+
);
|
|
2330
2364
|
}
|
|
2331
2365
|
}
|
|
2366
|
+
var CRLF_DECLARATION = /^<\?xml[^>]*\?>\r\n/;
|
|
2367
|
+
var crlfDeclarations = /* @__PURE__ */ new WeakSet();
|
|
2332
2368
|
function parseXml(xml, options2 = {}) {
|
|
2333
2369
|
const label = options2.label ?? "OOXML";
|
|
2334
2370
|
if (/<!DOCTYPE|<!ENTITY/i.test(xml))
|
|
@@ -2350,9 +2386,13 @@ function parseXml(xml, options2 = {}) {
|
|
|
2350
2386
|
}
|
|
2351
2387
|
if (parseError || !parsed.documentElement)
|
|
2352
2388
|
throw new Error(`Invalid ${label} XML: ${parseError || "missing root element"}`);
|
|
2389
|
+
if (CRLF_DECLARATION.test(xml)) crlfDeclarations.add(parsed);
|
|
2353
2390
|
return parsed;
|
|
2354
2391
|
}
|
|
2355
|
-
var buildXml = (node) =>
|
|
2392
|
+
var buildXml = (node) => {
|
|
2393
|
+
const xml = new XMLSerializer().serializeToString(node);
|
|
2394
|
+
return crlfDeclarations.has(node) ? xml.replace(/^(<\?xml[^>]*\?>)\n/, "$1\r\n") : xml;
|
|
2395
|
+
};
|
|
2356
2396
|
var isElement = (node) => node.nodeType === 1;
|
|
2357
2397
|
var elements = (parent) => Array.from(parent.childNodes).filter(isElement);
|
|
2358
2398
|
var textContent = (element2) => element2.textContent ?? "";
|
|
@@ -2453,6 +2493,12 @@ function parseLiteFragment(xml, container, namespaces) {
|
|
|
2453
2493
|
}
|
|
2454
2494
|
if (lt < 0) break;
|
|
2455
2495
|
const next = source.charCodeAt(lt + 1);
|
|
2496
|
+
if (next === 33) {
|
|
2497
|
+
const after = skipCommentOrCdata(source, lt, top);
|
|
2498
|
+
if (after < 0) return void 0;
|
|
2499
|
+
pos = after;
|
|
2500
|
+
continue;
|
|
2501
|
+
}
|
|
2456
2502
|
if (next === 47) {
|
|
2457
2503
|
const gt = source.indexOf(">", lt);
|
|
2458
2504
|
if (gt < 0 || stack.length < 2 || source.slice(lt + 2, gt).trimEnd() !== top.tagName)
|
|
@@ -2473,6 +2519,25 @@ function parseLiteFragment(xml, container, namespaces) {
|
|
|
2473
2519
|
}
|
|
2474
2520
|
return stack.length === 1 ? root : void 0;
|
|
2475
2521
|
}
|
|
2522
|
+
var DECLARATIONS = /<!DOCTYPE|<!ENTITY/i;
|
|
2523
|
+
function skipCommentOrCdata(source, lt, parent) {
|
|
2524
|
+
if (source.startsWith("<!--", lt)) {
|
|
2525
|
+
const end = source.indexOf("-->", lt + 4);
|
|
2526
|
+
if (end < 0) return -1;
|
|
2527
|
+
const body = source.slice(lt + 4, end);
|
|
2528
|
+
if (body.includes("--") || body.endsWith("-") || DECLARATIONS.test(body)) return -1;
|
|
2529
|
+
return end + 3;
|
|
2530
|
+
}
|
|
2531
|
+
if (source.startsWith("<![CDATA[", lt)) {
|
|
2532
|
+
const end = source.indexOf("]]>", lt + 9);
|
|
2533
|
+
if (end < 0) return -1;
|
|
2534
|
+
const text4 = source.slice(lt + 9, end);
|
|
2535
|
+
if (DECLARATIONS.test(text4)) return -1;
|
|
2536
|
+
parent.childNodes.push(text4);
|
|
2537
|
+
return end + 3;
|
|
2538
|
+
}
|
|
2539
|
+
return -1;
|
|
2540
|
+
}
|
|
2476
2541
|
function startTag(source, from, namespaces) {
|
|
2477
2542
|
const n2 = source.length;
|
|
2478
2543
|
let i2 = from;
|
|
@@ -6974,8 +7039,7 @@ function computeLogValueRange(series, logBase) {
|
|
|
6974
7039
|
if (allValues.length === 0) {
|
|
6975
7040
|
return { min: 1, max: logBase, span: 1, logScale: true, logBase };
|
|
6976
7041
|
}
|
|
6977
|
-
const dataMin =
|
|
6978
|
-
const dataMax = Math.max(...allValues);
|
|
7042
|
+
const { min: dataMin, max: dataMax } = extentOf(allValues);
|
|
6979
7043
|
const logMin = Math.floor(Math.log(dataMin) / Math.log(logBase));
|
|
6980
7044
|
const logMax = Math.ceil(Math.log(dataMax) / Math.log(logBase));
|
|
6981
7045
|
const min = logBase ** logMin;
|
|
@@ -7590,8 +7654,9 @@ function waterfallView(chart, model, ctx) {
|
|
|
7590
7654
|
colors: { increase: role(0), decrease: role(1), total: role(2) }
|
|
7591
7655
|
};
|
|
7592
7656
|
const ends = steps.flatMap((step) => [step.startValue, step.endValue]);
|
|
7657
|
+
const range = extentOf(ends);
|
|
7593
7658
|
model.valueAxis = {
|
|
7594
|
-
...ends.length ? niceScale(
|
|
7659
|
+
...ends.length ? niceScale(range.min, range.max) : niceScale(0, 1),
|
|
7595
7660
|
percent: false
|
|
7596
7661
|
};
|
|
7597
7662
|
const labels = model.categories;
|
|
@@ -7707,7 +7772,8 @@ function chartSummaryView(chart, theme, options2 = {}) {
|
|
|
7707
7772
|
s2.xValues = s2.values.map((_, k) => numeric ? toNumber(cats[k] ?? null) : k + 1);
|
|
7708
7773
|
});
|
|
7709
7774
|
const xs = series.flatMap((s2) => s2.xValues ?? []).filter((x) => x !== null);
|
|
7710
|
-
|
|
7775
|
+
const range = extentOf(xs);
|
|
7776
|
+
model.xAxis = xs.length ? niceScale(range.min, range.max) : niceScale(0, 1);
|
|
7711
7777
|
}
|
|
7712
7778
|
if (type === "stock") model.stock = stockView(chart.stock, ctx);
|
|
7713
7779
|
if (type === "bubble") bubbleView(chart, model, ctx.evaluateRef);
|
|
@@ -7739,7 +7805,7 @@ function cartesianAxes(model, area, out) {
|
|
|
7739
7805
|
const cats = Math.max(1, model.categories.length);
|
|
7740
7806
|
const catW = Math.min(
|
|
7741
7807
|
area.w * 0.3,
|
|
7742
|
-
Math.max(
|
|
7808
|
+
Math.max(extentOf(model.categories.map((c2) => textWidth(c2, categorySize))).max, 8) + 6
|
|
7743
7809
|
);
|
|
7744
7810
|
const second = horizontal ? void 0 : model.secondaryAxis;
|
|
7745
7811
|
const secondLabels = second?.ticks.map((t) => axisTickText(t, model.axes?.secondary, second.percent)) ?? [];
|
|
@@ -8432,13 +8498,11 @@ function chartLegendSvg(model, area, frame2, options2) {
|
|
|
8432
8498
|
chartAreaRect(model, "legend", { x: manual.x, y: manual.y, w: manual.width, h: manual.height })
|
|
8433
8499
|
];
|
|
8434
8500
|
const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
|
|
8501
|
+
const widest = extentOf(widths).max;
|
|
8435
8502
|
entries.forEach((entry3, i2) => {
|
|
8436
8503
|
const available = horizontal ? chartTextWidth(entry3.label, attrs, options2) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
|
|
8437
8504
|
const label = fitChartText(entry3.label, available, attrs, options2);
|
|
8438
|
-
const contentWidth = Math.min(
|
|
8439
|
-
horizontal ? widths[i2] ?? 0 : Math.max(...widths),
|
|
8440
|
-
rowWidth - size / 2
|
|
8441
|
-
);
|
|
8505
|
+
const contentWidth = Math.min(horizontal ? widths[i2] ?? 0 : widest, rowWidth - size / 2);
|
|
8442
8506
|
const x = horizontal ? horizontalX : manual.x + Math.max(size / 4, (rowWidth - contentWidth) / 2);
|
|
8443
8507
|
const centerY = manual.y + (horizontal ? 0 : i2 * rowHeight) + rowHeight / 2;
|
|
8444
8508
|
markup.push(rect(x, centerY - keySize / 2, keySize, keySize, entry3.color));
|
|
@@ -8510,7 +8574,7 @@ function automaticLegend(model, area, out, options2, bounds2) {
|
|
|
8510
8574
|
}
|
|
8511
8575
|
const width = Math.min(
|
|
8512
8576
|
area.w * 0.35,
|
|
8513
|
-
|
|
8577
|
+
extentOf(entries.map((e) => chartTextWidth(e.label, attrs, options2))).max + 22
|
|
8514
8578
|
);
|
|
8515
8579
|
const height = entries.length * rowH;
|
|
8516
8580
|
const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
|
|
@@ -33192,10 +33256,13 @@ var DEFAULT_ZIP_LIMITS = {
|
|
|
33192
33256
|
var ZipLimitError = class extends Error {
|
|
33193
33257
|
code = "ZIP_BOMB";
|
|
33194
33258
|
limit;
|
|
33259
|
+
/** The check that failed (absent when the error was built without one). */
|
|
33260
|
+
kind;
|
|
33195
33261
|
constructor(message, details) {
|
|
33196
33262
|
super(message);
|
|
33197
33263
|
this.name = "ZipLimitError";
|
|
33198
33264
|
this.limit = details.limit;
|
|
33265
|
+
this.kind = details.kind;
|
|
33199
33266
|
}
|
|
33200
33267
|
};
|
|
33201
33268
|
var mib = (bytes) => Math.round(bytes / 1048576);
|
|
@@ -33218,7 +33285,7 @@ function resolveLimits(limits) {
|
|
|
33218
33285
|
maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
|
|
33219
33286
|
maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
|
|
33220
33287
|
label: limits.label ?? "ZIP",
|
|
33221
|
-
fail: (message, limit) => create ? create(message, { limit }) : new ZipLimitError(message, { limit })
|
|
33288
|
+
fail: (message, limit, kind) => create ? create(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
|
|
33222
33289
|
};
|
|
33223
33290
|
}
|
|
33224
33291
|
function inflateEntryGuarded(entry3, alreadyRead, limits) {
|
|
@@ -33241,13 +33308,18 @@ function inflateEntryGuarded(entry3, alreadyRead, limits) {
|
|
|
33241
33308
|
size += chunk.byteLength;
|
|
33242
33309
|
if (size > declared || size > r.maxEntryBytes)
|
|
33243
33310
|
return abort(
|
|
33244
|
-
r.fail(
|
|
33311
|
+
r.fail(
|
|
33312
|
+
`${r.label} part ${entry3.name} inflates past its declared size`,
|
|
33313
|
+
r.maxEntryBytes,
|
|
33314
|
+
size > declared ? "declaredSize" : "maxEntryBytes"
|
|
33315
|
+
)
|
|
33245
33316
|
);
|
|
33246
33317
|
if (alreadyRead + size > r.maxTotalBytes)
|
|
33247
33318
|
return abort(
|
|
33248
33319
|
r.fail(
|
|
33249
33320
|
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
33250
|
-
r.maxTotalBytes
|
|
33321
|
+
r.maxTotalBytes,
|
|
33322
|
+
"maxTotalBytes"
|
|
33251
33323
|
)
|
|
33252
33324
|
);
|
|
33253
33325
|
chunks.push(chunk);
|
|
@@ -33280,26 +33352,29 @@ function guardZip(zip, limits = {}) {
|
|
|
33280
33352
|
if (entries.length > r.maxEntries)
|
|
33281
33353
|
throw r.fail(
|
|
33282
33354
|
`${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
|
|
33283
|
-
r.maxEntries
|
|
33355
|
+
r.maxEntries,
|
|
33356
|
+
"maxEntries"
|
|
33284
33357
|
);
|
|
33285
33358
|
let declared = 0;
|
|
33286
33359
|
for (const entry3 of entries) {
|
|
33287
33360
|
const original = entry3.unsafeOriginalName;
|
|
33288
33361
|
if (!isSafePartName(entry3.name) || original !== void 0 && !isSafePartName(original))
|
|
33289
|
-
throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries);
|
|
33362
|
+
throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries, "partName");
|
|
33290
33363
|
if (entry3.dir) continue;
|
|
33291
33364
|
const size = declaredEntrySize(entry3);
|
|
33292
33365
|
if (size > r.maxEntryBytes)
|
|
33293
33366
|
throw r.fail(
|
|
33294
33367
|
`${r.label} part ${entry3.name} exceeds the uncompressed part size limit`,
|
|
33295
|
-
r.maxEntryBytes
|
|
33368
|
+
r.maxEntryBytes,
|
|
33369
|
+
"maxEntryBytes"
|
|
33296
33370
|
);
|
|
33297
33371
|
declared += size;
|
|
33298
33372
|
}
|
|
33299
33373
|
if (declared > r.maxTotalBytes)
|
|
33300
33374
|
throw r.fail(
|
|
33301
33375
|
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
33302
|
-
r.maxTotalBytes
|
|
33376
|
+
r.maxTotalBytes,
|
|
33377
|
+
"maxTotalBytes"
|
|
33303
33378
|
);
|
|
33304
33379
|
const produced = /* @__PURE__ */ new Map();
|
|
33305
33380
|
let total = 0;
|
|
@@ -33337,7 +33412,8 @@ async function openZip(input, limits = {}) {
|
|
|
33337
33412
|
if (bytes.byteLength > maxInput)
|
|
33338
33413
|
throw r.fail(
|
|
33339
33414
|
`${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
|
|
33340
|
-
maxInput
|
|
33415
|
+
maxInput,
|
|
33416
|
+
"maxInputBytes"
|
|
33341
33417
|
);
|
|
33342
33418
|
return guardZip(await JSZip.loadAsync(bytes), limits);
|
|
33343
33419
|
}
|
package/dist/math/index.cjs
CHANGED
|
@@ -2122,6 +2122,19 @@ var DEFAULT_XML_LIMITS = {
|
|
|
2122
2122
|
maxDepth: 512,
|
|
2123
2123
|
maxNodes: 5e6
|
|
2124
2124
|
};
|
|
2125
|
+
var XmlLimitError = class extends Error {
|
|
2126
|
+
code = "xml-limit";
|
|
2127
|
+
/** The limit that was exceeded. */
|
|
2128
|
+
limit;
|
|
2129
|
+
/** Its value: the largest depth or element count allowed. */
|
|
2130
|
+
maximum;
|
|
2131
|
+
constructor(message, limit, maximum) {
|
|
2132
|
+
super(message);
|
|
2133
|
+
this.name = "XmlLimitError";
|
|
2134
|
+
this.limit = limit;
|
|
2135
|
+
this.maximum = maximum;
|
|
2136
|
+
}
|
|
2137
|
+
};
|
|
2125
2138
|
var TAG_RE = /<(\/?)([^\s\/><]+)(?:\s+[^\s=\/><]+\s*=\s*(?:"[^"<]*"|'[^'<]*'))*\s*(\/?)>/y;
|
|
2126
2139
|
var MARKUP_SKIPS = [
|
|
2127
2140
|
["<!--", "-->"],
|
|
@@ -2155,11 +2168,22 @@ function checkXmlLimits(xml, label, limits = {}) {
|
|
|
2155
2168
|
continue;
|
|
2156
2169
|
}
|
|
2157
2170
|
nodes++;
|
|
2158
|
-
if (nodes > maxNodes)
|
|
2171
|
+
if (nodes > maxNodes)
|
|
2172
|
+
throw new XmlLimitError(
|
|
2173
|
+
`${label} XML exceeds the limit of ${maxNodes} elements`,
|
|
2174
|
+
"maxNodes",
|
|
2175
|
+
maxNodes
|
|
2176
|
+
);
|
|
2159
2177
|
if (!selfClosing && ++depth > maxDepth)
|
|
2160
|
-
throw new
|
|
2178
|
+
throw new XmlLimitError(
|
|
2179
|
+
`${label} XML exceeds the nesting depth limit of ${maxDepth}`,
|
|
2180
|
+
"maxDepth",
|
|
2181
|
+
maxDepth
|
|
2182
|
+
);
|
|
2161
2183
|
}
|
|
2162
2184
|
}
|
|
2185
|
+
var CRLF_DECLARATION = /^<\?xml[^>]*\?>\r\n/;
|
|
2186
|
+
var crlfDeclarations = /* @__PURE__ */ new WeakSet();
|
|
2163
2187
|
function parseXml(xml, options = {}) {
|
|
2164
2188
|
const label = options.label ?? "OOXML";
|
|
2165
2189
|
if (/<!DOCTYPE|<!ENTITY/i.test(xml))
|
|
@@ -2181,6 +2205,7 @@ function parseXml(xml, options = {}) {
|
|
|
2181
2205
|
}
|
|
2182
2206
|
if (parseError || !parsed.documentElement)
|
|
2183
2207
|
throw new Error(`Invalid ${label} XML: ${parseError || "missing root element"}`);
|
|
2208
|
+
if (CRLF_DECLARATION.test(xml)) crlfDeclarations.add(parsed);
|
|
2184
2209
|
return parsed;
|
|
2185
2210
|
}
|
|
2186
2211
|
var isElement = (node) => node.nodeType === 1;
|