ooxml-core 1.32.1 → 1.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PptxHandler-5UDSMCBG.cjs +14 -0
- package/dist/PptxHandler-TTRTAQAR.mjs +5 -0
- package/dist/PptxHandler-XCYX5DVX.mjs +7 -0
- package/dist/{PresentationBuilder-5NFBUP7Y.cjs → PresentationBuilder-HA56ZY23.cjs} +6 -5
- package/dist/{PresentationBuilder-S6HXHKEJ.mjs → PresentationBuilder-IVLUEB4K.mjs} +4 -4
- package/dist/{PresentationBuilder-3CH5TR4W.mjs → PresentationBuilder-JBTNOIL7.mjs} +3 -2
- package/dist/automation/index.cjs +47133 -42384
- package/dist/automation/index.mjs +47133 -42384
- package/dist/chart/funnel-geometry.d.ts +1 -1
- package/dist/chart/funnel-geometry.d.ts.map +1 -1
- package/dist/chart/index.cjs +5743 -3820
- package/dist/chart/index.mjs +5736 -3821
- package/dist/chart/region-map/alias.d.ts +12 -0
- package/dist/chart/region-map/alias.d.ts.map +1 -0
- package/dist/chart/region-map/cache.d.ts +20 -0
- package/dist/chart/region-map/cache.d.ts.map +1 -0
- package/dist/chart/region-map/colors.d.ts +4 -0
- package/dist/chart/region-map/colors.d.ts.map +1 -0
- package/dist/chart/region-map/data.d.ts +45 -0
- package/dist/chart/region-map/data.d.ts.map +1 -0
- package/dist/chart/region-map/geographic-projection.d.ts +4 -0
- package/dist/chart/region-map/geographic-projection.d.ts.map +1 -0
- package/dist/chart/region-map/geometry.d.ts +10 -0
- package/dist/chart/region-map/geometry.d.ts.map +1 -0
- package/dist/chart/region-map/index.cjs +892 -0
- package/dist/chart/region-map/index.d.ts +12 -0
- package/dist/chart/region-map/index.d.ts.map +1 -0
- package/dist/chart/region-map/index.mjs +870 -0
- package/dist/chart/region-map/projection.d.ts +19 -0
- package/dist/chart/region-map/projection.d.ts.map +1 -0
- package/dist/chart/region-map/types.d.ts +39 -0
- package/dist/chart/region-map/types.d.ts.map +1 -0
- package/dist/chart/region-map/value-color-positions.d.ts +4 -0
- package/dist/chart/region-map/value-color-positions.d.ts.map +1 -0
- package/dist/chart/region-map/value-colors.d.ts +4 -0
- package/dist/chart/region-map/value-colors.d.ts.map +1 -0
- package/dist/chart/region-map/world-regions.d.ts +22 -0
- package/dist/chart/region-map/world-regions.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-camera.d.ts +26 -0
- package/dist/chart/render/chart-3d-camera.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-layout.d.ts +27 -0
- package/dist/chart/render/chart-3d-layout.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-marks.d.ts +10 -0
- package/dist/chart/render/chart-3d-marks.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-mesh.d.ts +32 -0
- package/dist/chart/render/chart-3d-mesh.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-pie.d.ts +16 -0
- package/dist/chart/render/chart-3d-pie.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-projection.d.ts +37 -0
- package/dist/chart/render/chart-3d-projection.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-scene.d.ts +9 -0
- package/dist/chart/render/chart-3d-scene.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-shading.d.ts +10 -0
- package/dist/chart/render/chart-3d-shading.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-surface.d.ts +5 -0
- package/dist/chart/render/chart-3d-surface.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-svg.d.ts +7 -0
- package/dist/chart/render/chart-3d-svg.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-walls.d.ts +13 -0
- package/dist/chart/render/chart-3d-walls.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-funnel.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-region-map.d.ts +4 -0
- package/dist/chart/render/chart-svg-region-map.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-text-metrics.d.ts +2 -0
- package/dist/chart/render/chart-svg-text-metrics.d.ts.map +1 -1
- package/dist/chart/render/chart-svg.d.ts.map +1 -1
- package/dist/chart/render/chart-view.d.ts +5 -1
- package/dist/chart/render/chart-view.d.ts.map +1 -1
- package/dist/chart/render/index.d.ts +5 -0
- package/dist/chart/render/index.d.ts.map +1 -1
- package/dist/chart/render/render-space.d.ts.map +1 -1
- package/dist/chart/render/summary-ex-formatting.d.ts +5 -0
- package/dist/chart/render/summary-ex-formatting.d.ts.map +1 -0
- package/dist/chart/render/summary-ex-series.d.ts.map +1 -1
- package/dist/chart/render/summary-from-chartex.d.ts.map +1 -1
- package/dist/chart/render/summary-from-space.d.ts.map +1 -1
- package/dist/chart/render/summary.d.ts +5 -1
- package/dist/chart/render/summary.d.ts.map +1 -1
- package/dist/chunk-2N7RZQLC.mjs +8 -0
- package/dist/{chunk-Q6NM64J2.cjs → chunk-A27O7M5X.cjs} +4938 -1083
- package/dist/{chunk-4R65YYAD.mjs → chunk-EGBNPVBA.mjs} +6256 -2277
- package/dist/{chunk-3H5UAJB3.mjs → chunk-GNGL4BO7.mjs} +935 -568
- package/dist/chunk-LSO5SSFX.mjs +112 -0
- package/dist/chunk-MB3TYNMV.mjs +28 -0
- package/dist/{chunk-N6424WKA.mjs → chunk-MK2IBZU6.mjs} +1 -1
- package/dist/{chunk-X6VNUBES.cjs → chunk-PA5ADSTX.cjs} +2124 -1791
- package/dist/{chunk-IOTGRLJH.mjs → chunk-RI56PFGL.mjs} +933 -600
- package/dist/{chunk-NAWLWKOJ.mjs → chunk-RPJHMPEL.mjs} +2 -2
- package/dist/{chunk-UYMSFJQZ.mjs → chunk-TJXK4D4U.mjs} +5 -5
- package/dist/{chunk-O7SVHLD7.mjs → chunk-UQMAPY6D.mjs} +4901 -1077
- package/dist/{chunk-54S5A5PZ.mjs → chunk-VDUNZTJC.mjs} +36 -1
- package/dist/chunk-XF6ZRA2D.cjs +120 -0
- package/dist/crypto/index.cjs +23 -15
- package/dist/crypto/index.mjs +23 -15
- package/dist/diagram/drawing-resolve.d.ts.map +1 -1
- package/dist/diagram/drawing-view.d.ts +6 -0
- package/dist/diagram/drawing-view.d.ts.map +1 -1
- package/dist/diagram/engine/engine-to-result.d.ts.map +1 -1
- package/dist/diagram/index.cjs +786 -145
- package/dist/diagram/index.d.ts +1 -0
- package/dist/diagram/index.d.ts.map +1 -1
- package/dist/diagram/index.mjs +783 -147
- package/dist/diagram/layout/smartart-layout-types.d.ts +7 -0
- package/dist/diagram/layout/smartart-layout-types.d.ts.map +1 -1
- package/dist/diagram/layout-preview.d.ts +4 -0
- package/dist/diagram/layout-preview.d.ts.map +1 -1
- package/dist/diagram/layout-role-style.d.ts +4 -0
- package/dist/diagram/layout-role-style.d.ts.map +1 -0
- package/dist/diagram/load.d.ts.map +1 -1
- package/dist/diagram/picture-layout.d.ts +23 -0
- package/dist/diagram/picture-layout.d.ts.map +1 -0
- package/dist/diagram/types.d.ts +6 -0
- package/dist/diagram/types.d.ts.map +1 -1
- package/dist/diagram/write/cache.d.ts +1 -0
- package/dist/diagram/write/cache.d.ts.map +1 -1
- package/dist/digest/crc32.d.ts +2 -0
- package/dist/digest/crc32.d.ts.map +1 -0
- package/dist/digest/index.cjs +11 -0
- package/dist/digest/index.d.ts +1 -0
- package/dist/digest/index.d.ts.map +1 -1
- package/dist/digest/index.mjs +11 -1
- package/dist/docx/block-parser.d.ts.map +1 -1
- package/dist/docx/diagram-cache.d.ts.map +1 -1
- package/dist/docx/diagram-save.d.ts.map +1 -1
- package/dist/docx/drawing.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +1394 -366
- package/dist/docx/embedded.mjs +1394 -366
- package/dist/docx/find-pattern.d.ts +33 -0
- package/dist/docx/find-pattern.d.ts.map +1 -0
- package/dist/docx/find-replacement.d.ts +16 -0
- package/dist/docx/find-replacement.d.ts.map +1 -0
- package/dist/docx/find-syntax.d.ts +13 -0
- package/dist/docx/find-syntax.d.ts.map +1 -0
- package/dist/docx/find-wildcards.d.ts +8 -0
- package/dist/docx/find-wildcards.d.ts.map +1 -0
- package/dist/docx/form-field-model.d.ts +39 -0
- package/dist/docx/form-field-model.d.ts.map +1 -1
- package/dist/docx/index.cjs +6107 -1728
- package/dist/docx/index.d.ts +3 -1
- package/dist/docx/index.d.ts.map +1 -1
- package/dist/docx/index.mjs +6103 -1729
- package/dist/docx/inline-model.d.ts +4 -0
- package/dist/docx/inline-model.d.ts.map +1 -1
- package/dist/docx/layout/adapt-floats.d.ts.map +1 -1
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/floats.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +2338 -554
- package/dist/docx/layout/index.mjs +2338 -554
- package/dist/docx/layout/input.d.ts +5 -0
- package/dist/docx/layout/input.d.ts.map +1 -1
- package/dist/docx/layout/result.d.ts +3 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +7593 -1539
- package/dist/docx/load/index.mjs +7593 -1539
- package/dist/docx/load/legacy-doc/binary-save.d.ts +4 -0
- package/dist/docx/load/legacy-doc/binary-save.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/blocks.d.ts +19 -0
- package/dist/docx/load/legacy-doc/blocks.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/borders.d.ts +7 -0
- package/dist/docx/load/legacy-doc/borders.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/context.d.ts +65 -0
- package/dist/docx/load/legacy-doc/context.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/drawing.d.ts +15 -0
- package/dist/docx/load/legacy-doc/drawing.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/error.d.ts +5 -0
- package/dist/docx/load/legacy-doc/error.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/inline.d.ts +7 -0
- package/dist/docx/load/legacy-doc/inline.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/numbering-part.d.ts +3 -0
- package/dist/docx/load/legacy-doc/numbering-part.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/package.d.ts +8 -0
- package/dist/docx/load/legacy-doc/package.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/para-props.d.ts +6 -0
- package/dist/docx/load/legacy-doc/para-props.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/run-props.d.ts +8 -0
- package/dist/docx/load/legacy-doc/run-props.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/sections.d.ts +23 -0
- package/dist/docx/load/legacy-doc/sections.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/styles-part.d.ts +3 -0
- package/dist/docx/load/legacy-doc/styles-part.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/table.d.ts +6 -0
- package/dist/docx/load/legacy-doc/table.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc/xml.d.ts +21 -0
- package/dist/docx/load/legacy-doc/xml.d.ts.map +1 -0
- package/dist/docx/load/legacy-doc.d.ts +5 -4
- package/dist/docx/load/legacy-doc.d.ts.map +1 -1
- package/dist/docx/model-paragraph.d.ts +5 -0
- package/dist/docx/model-paragraph.d.ts.map +1 -1
- package/dist/docx/model.d.ts +3 -0
- package/dist/docx/model.d.ts.map +1 -1
- package/dist/docx/numbering-editing.d.ts +11 -1
- package/dist/docx/numbering-editing.d.ts.map +1 -1
- package/dist/docx/numbering-format.d.ts.map +1 -1
- package/dist/docx/numbering-model.d.ts +17 -0
- package/dist/docx/numbering-model.d.ts.map +1 -1
- package/dist/docx/numbering-package.d.ts +2 -2
- package/dist/docx/numbering-package.d.ts.map +1 -1
- package/dist/docx/numbering-parse.d.ts +2 -1
- package/dist/docx/numbering-parse.d.ts.map +1 -1
- package/dist/docx/numbering-picture-save.d.ts +13 -0
- package/dist/docx/numbering-picture-save.d.ts.map +1 -0
- package/dist/docx/numbering-picture.d.ts +18 -0
- package/dist/docx/numbering-picture.d.ts.map +1 -0
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/permission-markers.d.ts +19 -0
- package/dist/docx/permission-markers.d.ts.map +1 -0
- package/dist/docx/permissions.d.ts +11 -0
- package/dist/docx/permissions.d.ts.map +1 -0
- package/dist/docx/protection-legacy.d.ts +13 -0
- package/dist/docx/protection-legacy.d.ts.map +1 -0
- package/dist/docx/protection.d.ts +30 -0
- package/dist/docx/protection.d.ts.map +1 -0
- package/dist/docx/save.d.ts.map +1 -1
- package/dist/docx/settings.d.ts +6 -1
- package/dist/docx/settings.d.ts.map +1 -1
- package/dist/docx/ui/customization.d.ts.map +1 -1
- package/dist/docx/ui/edit-restriction.d.ts +53 -0
- package/dist/docx/ui/edit-restriction.d.ts.map +1 -0
- package/dist/docx/ui/index.cjs +3617 -1097
- package/dist/docx/ui/index.d.ts +4 -0
- package/dist/docx/ui/index.d.ts.map +1 -1
- package/dist/docx/ui/index.mjs +3597 -1098
- package/dist/docx/ui/inline-content-schema.d.ts.map +1 -1
- package/dist/docx/ui/paragraph-attributes.d.ts.map +1 -1
- package/dist/docx/ui/ribbon-action-ids.d.ts +1 -1
- package/dist/docx/ui/ribbon-action-ids.d.ts.map +1 -1
- package/dist/docx/ui/run-adapter.d.ts.map +1 -1
- package/dist/docx/write-drawing.d.ts.map +1 -1
- package/dist/docx/write-paragraph.d.ts.map +1 -1
- package/dist/drawingml/index.cjs +708 -111
- package/dist/drawingml/index.d.ts +7 -0
- package/dist/drawingml/index.d.ts.map +1 -1
- package/dist/drawingml/index.mjs +698 -113
- package/dist/drawingml/picture-artistic.d.ts +14 -0
- package/dist/drawingml/picture-artistic.d.ts.map +1 -0
- package/dist/drawingml/picture-effects.d.ts +4 -1
- package/dist/drawingml/picture-effects.d.ts.map +1 -1
- package/dist/drawingml/picture-fill.d.ts.map +1 -1
- package/dist/drawingml/picture-hsl-pixels.d.ts +4 -0
- package/dist/drawingml/picture-hsl-pixels.d.ts.map +1 -0
- package/dist/drawingml/picture-layout.d.ts +25 -0
- package/dist/drawingml/picture-layout.d.ts.map +1 -0
- package/dist/drawingml/picture-standard-effects.d.ts +15 -0
- package/dist/drawingml/picture-standard-effects.d.ts.map +1 -0
- package/dist/drawingml/picture-transfer.d.ts +11 -0
- package/dist/drawingml/picture-transfer.d.ts.map +1 -0
- package/dist/drawingml/raster-image.d.ts +29 -0
- package/dist/drawingml/raster-image.d.ts.map +1 -0
- package/dist/drawingml/types.d.ts +1 -0
- package/dist/drawingml/types.d.ts.map +1 -1
- package/dist/drawingml/write-pattern-picture.d.ts.map +1 -1
- package/dist/drawingml/write-theme.d.ts +2 -0
- package/dist/drawingml/write-theme.d.ts.map +1 -1
- package/dist/geometry/index.cjs +38 -0
- package/dist/geometry/index.d.ts +1 -0
- package/dist/geometry/index.d.ts.map +1 -1
- package/dist/geometry/index.mjs +36 -1
- package/dist/geometry/picture-tile.d.ts +29 -0
- package/dist/geometry/picture-tile.d.ts.map +1 -0
- package/dist/index.cjs +15671 -12934
- package/dist/index.mjs +15671 -12934
- package/dist/pptx/automation/index.cjs +9313 -3688
- package/dist/pptx/automation/index.d.ts +40 -6
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +254 -12
- package/dist/pptx/automation/schemas/index.cjs +26 -0
- package/dist/pptx/automation/schemas/index.d.ts +26 -1
- package/dist/pptx/automation/schemas/index.d.ts.map +1 -0
- package/dist/pptx/automation/schemas/index.mjs +1 -1
- package/dist/pptx/chunks/{elements-mSCZ84Tc.d.ts → elements-f3UbFph-.d.ts} +7 -2
- package/dist/pptx/chunks/elements-f3UbFph-.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-DnWlmYCy.d.ts → index-BnH2QjYm.d.ts} +4 -4
- package/dist/pptx/chunks/{index-DnWlmYCy.d.ts.map → index-BnH2QjYm.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-D-FdgqrP.d.ts → index-Bp-1pGo1.d.ts} +4 -4
- package/dist/pptx/chunks/{index-D-FdgqrP.d.ts.map → index-Bp-1pGo1.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-DKybuHPT.d.ts → index-pLLN4OTz.d.ts} +62 -24
- package/dist/pptx/chunks/index-pLLN4OTz.d.ts.map +1 -0
- package/dist/pptx/chunks/{smart-art-DLumQo90.d.ts → smart-art-CmOrPLLQ.d.ts} +86 -2
- package/dist/pptx/chunks/smart-art-CmOrPLLQ.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-hyPODwIQ.d.ts → text-operations-D5sgspO6.d.ts} +2 -2
- package/dist/pptx/chunks/{text-operations-hyPODwIQ.d.ts.map → text-operations-D5sgspO6.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +7477 -2848
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +6 -6
- package/dist/pptx/converter/index.cjs +3895 -503
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +3 -3
- package/dist/pptx/editor/render/custom-show-operations.cjs +133 -0
- package/dist/pptx/editor/render/custom-show-operations.d.ts +42 -0
- package/dist/pptx/editor/render/custom-show-operations.d.ts.map +1 -0
- package/dist/pptx/editor/render/custom-show-operations.mjs +119 -0
- package/dist/pptx/editor/render/find-replace.cjs +15 -14
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +2 -1
- package/dist/pptx/editor/render/slide-operations.cjs +9 -8
- package/dist/pptx/editor/render/slide-operations.mjs +3 -2
- package/dist/pptx/editor/render/table-data-grid-ops.cjs +1 -1
- package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
- package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
- package/dist/pptx/index.cjs +8447 -3693
- package/dist/pptx/index.d.ts +7 -7
- package/dist/pptx/index.mjs +7 -7
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/pptx/smartart-layouts/index.d.ts +1 -1
- package/dist/pptx/smartart-layouts/index.mjs +2 -2
- package/dist/teams/index.cjs +2176 -751
- package/dist/teams/index.mjs +2176 -751
- package/dist/text/index.cjs +241 -0
- package/dist/text/index.d.ts +2 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.mjs +240 -1
- package/dist/text/truetype/parse.d.ts +36 -0
- package/dist/text/truetype/parse.d.ts.map +1 -0
- package/dist/text/truetype/subset.d.ts +16 -0
- package/dist/text/truetype/subset.d.ts.map +1 -0
- package/dist/visio/cell-formula.d.ts +5 -1
- package/dist/visio/cell-formula.d.ts.map +1 -1
- package/dist/visio/collab/index.cjs +3 -1
- package/dist/visio/collab/index.mjs +3 -1
- package/dist/visio/container-relationships.d.ts +53 -0
- package/dist/visio/container-relationships.d.ts.map +1 -0
- package/dist/visio/data-connections.d.ts +32 -0
- package/dist/visio/data-connections.d.ts.map +1 -0
- package/dist/visio/data-recordsets.d.ts +7 -0
- package/dist/visio/data-recordsets.d.ts.map +1 -1
- package/dist/visio/data-refresh.d.ts +33 -0
- package/dist/visio/data-refresh.d.ts.map +1 -0
- package/dist/visio/edit-commands.d.ts +6 -1
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-connector.d.ts.map +1 -1
- package/dist/visio/edit-container-fit.d.ts +32 -0
- package/dist/visio/edit-container-fit.d.ts.map +1 -0
- package/dist/visio/edit-container-members.d.ts +33 -0
- package/dist/visio/edit-container-members.d.ts.map +1 -0
- package/dist/visio/edit-container-options.d.ts +33 -0
- package/dist/visio/edit-container-options.d.ts.map +1 -0
- package/dist/visio/edit-data-commands.d.ts +5 -0
- package/dist/visio/edit-data-commands.d.ts.map +1 -1
- package/dist/visio/edit-data-parts.d.ts +2 -0
- package/dist/visio/edit-data-parts.d.ts.map +1 -1
- package/dist/visio/edit-data.d.ts.map +1 -1
- package/dist/visio/edit-delete.d.ts.map +1 -1
- package/dist/visio/edit-diagram-parts-commands.d.ts +24 -1
- package/dist/visio/edit-diagram-parts-commands.d.ts.map +1 -1
- package/dist/visio/edit-diagram-parts.d.ts +11 -2
- package/dist/visio/edit-diagram-parts.d.ts.map +1 -1
- package/dist/visio/edit-geometry.d.ts +4 -1
- package/dist/visio/edit-geometry.d.ts.map +1 -1
- package/dist/visio/edit-group-resize.d.ts.map +1 -1
- package/dist/visio/edit-instance-checks.d.ts.map +1 -1
- package/dist/visio/edit-package.d.ts.map +1 -1
- package/dist/visio/edit-page-theme-commands.d.ts +26 -0
- package/dist/visio/edit-page-theme-commands.d.ts.map +1 -1
- package/dist/visio/edit-page-theme-part.d.ts +6 -0
- package/dist/visio/edit-page-theme-part.d.ts.map +1 -0
- package/dist/visio/edit-page-theme.d.ts +9 -1
- package/dist/visio/edit-page-theme.d.ts.map +1 -1
- package/dist/visio/edit-picture-adjust.d.ts +32 -0
- package/dist/visio/edit-picture-adjust.d.ts.map +1 -0
- package/dist/visio/edit-recalculate-index.d.ts +13 -0
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-values.d.ts.map +1 -1
- package/dist/visio/edit-recalculate.d.ts.map +1 -1
- package/dist/visio/edit-resize-anchor.d.ts.map +1 -1
- package/dist/visio/edit-swimlane-commands.d.ts +91 -0
- package/dist/visio/edit-swimlane-commands.d.ts.map +1 -0
- package/dist/visio/edit-swimlane-layout.d.ts +64 -0
- package/dist/visio/edit-swimlane-layout.d.ts.map +1 -0
- package/dist/visio/edit-swimlane-ops.d.ts +11 -0
- package/dist/visio/edit-swimlane-ops.d.ts.map +1 -0
- package/dist/visio/edit-swimlane-shapes.d.ts +42 -0
- package/dist/visio/edit-swimlane-shapes.d.ts.map +1 -0
- package/dist/visio/edit-swimlane-turn.d.ts +9 -0
- package/dist/visio/edit-swimlane-turn.d.ts.map +1 -0
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/effects.d.ts +3 -2
- package/dist/visio/effects.d.ts.map +1 -1
- package/dist/visio/formula-analyze.d.ts +2 -0
- package/dist/visio/formula-analyze.d.ts.map +1 -1
- package/dist/visio/formula-evaluate.d.ts.map +1 -1
- package/dist/visio/formula-master.d.ts +1 -0
- package/dist/visio/formula-master.d.ts.map +1 -1
- package/dist/visio/geometry.d.ts +2 -1
- package/dist/visio/geometry.d.ts.map +1 -1
- package/dist/visio/index.cjs +12207 -7779
- package/dist/visio/index.d.ts +8 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +12201 -7780
- package/dist/visio/infinite-line.d.ts +17 -0
- package/dist/visio/infinite-line.d.ts.map +1 -0
- package/dist/visio/media.d.ts +4 -23
- package/dist/visio/media.d.ts.map +1 -1
- package/dist/visio/model.d.ts +46 -0
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/package-common.d.ts +1 -1
- package/dist/visio/package-common.d.ts.map +1 -1
- package/dist/visio/package-kind.d.ts +34 -0
- package/dist/visio/package-kind.d.ts.map +1 -0
- package/dist/visio/page-theme.d.ts +7 -0
- package/dist/visio/page-theme.d.ts.map +1 -1
- package/dist/visio/parser.d.ts +2 -2
- package/dist/visio/parser.d.ts.map +1 -1
- package/dist/visio/shadow.d.ts +2 -1
- package/dist/visio/shadow.d.ts.map +1 -1
- package/dist/visio/shape-structure.d.ts +19 -3
- package/dist/visio/shape-structure.d.ts.map +1 -1
- package/dist/visio/shapes.d.ts +7 -1
- package/dist/visio/shapes.d.ts.map +1 -1
- package/dist/visio/stencil-file.d.ts +2 -2
- package/dist/visio/style.d.ts.map +1 -1
- package/dist/visio/swimlane-stack.d.ts +65 -0
- package/dist/visio/swimlane-stack.d.ts.map +1 -0
- package/dist/visio/theme-builtins.d.ts +3 -0
- package/dist/visio/theme-builtins.d.ts.map +1 -1
- package/dist/visio/theme-effects.d.ts +19 -0
- package/dist/visio/theme-effects.d.ts.map +1 -0
- package/dist/visio/theme-font.d.ts +13 -0
- package/dist/visio/theme-font.d.ts.map +1 -0
- package/dist/visio/theme-line.d.ts.map +1 -1
- package/dist/visio/theme-write.d.ts.map +1 -1
- package/dist/visio/theme.d.ts +7 -0
- package/dist/visio/theme.d.ts.map +1 -1
- package/dist/visio/ui/data-graphic-config.d.ts +45 -0
- package/dist/visio/ui/data-graphic-config.d.ts.map +1 -0
- package/dist/visio/ui/data-graphic-rules.d.ts +7 -0
- package/dist/visio/ui/data-graphic-rules.d.ts.map +1 -1
- package/dist/visio/ui/data-graphics.d.ts +9 -0
- package/dist/visio/ui/data-graphics.d.ts.map +1 -1
- package/dist/visio/ui/diagram-parts.d.ts +20 -2
- package/dist/visio/ui/diagram-parts.d.ts.map +1 -1
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/guides.d.ts +9 -1
- package/dist/visio/ui/guides.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +14266 -10008
- package/dist/visio/ui/index.d.ts +4 -0
- package/dist/visio/ui/index.d.ts.map +1 -1
- package/dist/visio/ui/index.mjs +14231 -10009
- package/dist/visio/ui/org-chart.d.ts +75 -0
- package/dist/visio/ui/org-chart.d.ts.map +1 -0
- package/dist/visio/ui/resize-snap.d.ts +51 -0
- package/dist/visio/ui/resize-snap.d.ts.map +1 -0
- package/dist/visio/ui/sample-drawing.d.ts +26 -0
- package/dist/visio/ui/sample-drawing.d.ts.map +1 -1
- package/dist/visio/ui/scene-validation.d.ts.map +1 -1
- package/dist/visio/ui/selection-resize.d.ts +2 -2
- package/dist/visio/ui/selection-resize.d.ts.map +1 -1
- package/dist/visio/ui/shape-resize.d.ts +29 -1
- package/dist/visio/ui/shape-resize.d.ts.map +1 -1
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
- package/dist/visio/ui/swimlane.d.ts +37 -0
- package/dist/visio/ui/swimlane.d.ts.map +1 -0
- package/dist/visio/ui/templates.d.ts +26 -0
- package/dist/visio/ui/templates.d.ts.map +1 -0
- package/dist/xlsx/audit/ast-text.d.ts +12 -0
- package/dist/xlsx/audit/ast-text.d.ts.map +1 -0
- package/dist/xlsx/audit/error-check.d.ts +23 -0
- package/dist/xlsx/audit/error-check.d.ts.map +1 -0
- package/dist/xlsx/audit/evaluate-steps.d.ts +48 -0
- package/dist/xlsx/audit/evaluate-steps.d.ts.map +1 -0
- package/dist/xlsx/audit/index.d.ts +6 -0
- package/dist/xlsx/audit/index.d.ts.map +1 -0
- package/dist/xlsx/audit/trace.d.ts +59 -0
- package/dist/xlsx/audit/trace.d.ts.map +1 -0
- package/dist/xlsx/audit/watch.d.ts +17 -0
- package/dist/xlsx/audit/watch.d.ts.map +1 -0
- package/dist/xlsx/edit/cell-values.d.ts.map +1 -1
- package/dist/xlsx/edit/chart-ex.d.ts +1 -0
- package/dist/xlsx/edit/chart-ex.d.ts.map +1 -1
- package/dist/xlsx/edit/filter.d.ts +8 -1
- package/dist/xlsx/edit/filter.d.ts.map +1 -1
- package/dist/xlsx/edit/index.d.ts +5 -1
- package/dist/xlsx/edit/index.d.ts.map +1 -1
- package/dist/xlsx/edit/session-calc.d.ts +5 -0
- package/dist/xlsx/edit/session-calc.d.ts.map +1 -1
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/sort-choices.d.ts +23 -0
- package/dist/xlsx/edit/sort-choices.d.ts.map +1 -0
- package/dist/xlsx/edit/sort-keys.d.ts +49 -0
- package/dist/xlsx/edit/sort-keys.d.ts.map +1 -0
- package/dist/xlsx/edit/sort-reapply.d.ts +11 -0
- package/dist/xlsx/edit/sort-reapply.d.ts.map +1 -0
- package/dist/xlsx/edit/sort.d.ts +14 -12
- package/dist/xlsx/edit/sort.d.ts.map +1 -1
- package/dist/xlsx/edit/text-columns.d.ts +21 -0
- package/dist/xlsx/edit/text-columns.d.ts.map +1 -0
- package/dist/xlsx/edit/types.d.ts +10 -5
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/edit/view.d.ts +9 -1
- package/dist/xlsx/edit/view.d.ts.map +1 -1
- package/dist/xlsx/embedded-chart-ex-space.d.ts +18 -0
- package/dist/xlsx/embedded-chart-ex-space.d.ts.map +1 -0
- package/dist/xlsx/filter-criteria.d.ts +23 -0
- package/dist/xlsx/filter-criteria.d.ts.map +1 -0
- package/dist/xlsx/filter-dynamic.d.ts +8 -0
- package/dist/xlsx/filter-dynamic.d.ts.map +1 -0
- package/dist/xlsx/filter-menu.d.ts +49 -0
- package/dist/xlsx/filter-menu.d.ts.map +1 -0
- package/dist/xlsx/filter-rows.d.ts +4 -4
- package/dist/xlsx/filter-rows.d.ts.map +1 -1
- package/dist/xlsx/formula/engine-types.d.ts +8 -0
- package/dist/xlsx/formula/engine-types.d.ts.map +1 -1
- package/dist/xlsx/formula/engine.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +7259 -3079
- package/dist/xlsx/index.d.ts +5 -0
- package/dist/xlsx/index.d.ts.map +1 -1
- package/dist/xlsx/index.mjs +7213 -3079
- package/dist/xlsx/layout/index.d.ts +1 -0
- package/dist/xlsx/layout/index.d.ts.map +1 -1
- package/dist/xlsx/layout/split.d.ts +55 -0
- package/dist/xlsx/layout/split.d.ts.map +1 -0
- package/dist/xlsx/layout/viewport.d.ts +2 -0
- package/dist/xlsx/layout/viewport.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +2170 -688
- package/dist/xlsx/load/index.mjs +2170 -688
- package/dist/xlsx/model-filter.d.ts +54 -0
- package/dist/xlsx/model-filter.d.ts.map +1 -0
- package/dist/xlsx/model-sort.d.ts +27 -0
- package/dist/xlsx/model-sort.d.ts.map +1 -0
- package/dist/xlsx/model.d.ts +81 -4
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/read/chart.d.ts.map +1 -1
- package/dist/xlsx/read/drawing.d.ts.map +1 -1
- package/dist/xlsx/read/filter-columns.d.ts +5 -0
- package/dist/xlsx/read/filter-columns.d.ts.map +1 -0
- package/dist/xlsx/read/ignored-errors.d.ts +4 -0
- package/dist/xlsx/read/ignored-errors.d.ts.map +1 -0
- package/dist/xlsx/read/shared-strings.d.ts +5 -3
- package/dist/xlsx/read/shared-strings.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-data.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-props.d.ts +2 -2
- package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/read/sort-state.d.ts +5 -0
- package/dist/xlsx/read/sort-state.d.ts.map +1 -0
- package/dist/xlsx/read/tables.d.ts +2 -2
- package/dist/xlsx/read/tables.d.ts.map +1 -1
- package/dist/xlsx/read/worksheet.d.ts.map +1 -1
- package/dist/xlsx/sort-lists.d.ts +6 -0
- package/dist/xlsx/sort-lists.d.ts.map +1 -0
- package/dist/xlsx/ui/audit-state.d.ts +19 -0
- package/dist/xlsx/ui/audit-state.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/audit.d.ts +3 -0
- package/dist/xlsx/ui/commands/audit.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/formulas.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/audit.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/audit.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/filters.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/filters.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/ribbon-tabs.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/rules.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/tools.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/icons.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/sort-filter.d.ts.map +1 -1
- package/dist/xlsx/ui/context.d.ts +6 -1
- package/dist/xlsx/ui/context.d.ts.map +1 -1
- package/dist/xlsx/ui/dialogs/grid-chart.d.ts.map +1 -1
- package/dist/xlsx/ui/grid/geometry.d.ts +29 -1
- package/dist/xlsx/ui/grid/geometry.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +9454 -5323
- 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 +9448 -5324
- package/dist/xlsx/ui/ribbon/icon-paths.d.ts.map +1 -1
- package/dist/xlsx/ui/ribbon/tabs/review-view.d.ts.map +1 -1
- package/dist/xlsx/write/drawing.d.ts.map +1 -1
- package/dist/xlsx/write/filter-columns.d.ts +53 -0
- package/dist/xlsx/write/filter-columns.d.ts.map +1 -0
- package/dist/xlsx/write/ignored-errors.d.ts +3 -0
- package/dist/xlsx/write/ignored-errors.d.ts.map +1 -0
- package/dist/xlsx/write/shared-strings.d.ts +4 -4
- package/dist/xlsx/write/shared-strings.d.ts.map +1 -1
- package/dist/xlsx/write/sheet-parts.d.ts.map +1 -1
- package/dist/xlsx/write/sheet-props.d.ts +2 -1
- package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/write/smart-art-cache.d.ts.map +1 -1
- package/dist/xlsx/write/smart-art.d.ts.map +1 -1
- package/dist/xlsx/write/sort-state.d.ts +55 -0
- package/dist/xlsx/write/sort-state.d.ts.map +1 -0
- package/dist/xlsx/write/table-patch.d.ts +2 -1
- package/dist/xlsx/write/table-patch.d.ts.map +1 -1
- package/dist/xlsx/write/tables.d.ts +2 -1
- package/dist/xlsx/write/tables.d.ts.map +1 -1
- package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/write/worksheet.d.ts.map +1 -1
- package/package.json +7 -2
- package/dist/PptxHandler-QY5VL3CY.mjs +0 -7
- package/dist/PptxHandler-SJ5ZUIUX.mjs +0 -4
- package/dist/PptxHandler-TESZUH66.cjs +0 -13
- package/dist/chunk-3GXV5MPC.mjs +0 -41
- package/dist/chunk-MHNETXQB.mjs +0 -1
- package/dist/pptx/chunks/elements-mSCZ84Tc.d.ts.map +0 -1
- package/dist/pptx/chunks/index-DKybuHPT.d.ts.map +0 -1
- package/dist/pptx/chunks/smart-art-DLumQo90.d.ts.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DOMParser, XMLSerializer } from '@xmldom/xmldom';
|
|
2
|
+
import { Inflate } from 'fflate';
|
|
2
3
|
|
|
3
4
|
// xml/namespaces.ts
|
|
4
5
|
var NS = {
|
|
@@ -6,6 +7,8 @@ var NS = {
|
|
|
6
7
|
w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
7
8
|
/** DrawingML main. */
|
|
8
9
|
a: "http://schemas.openxmlformats.org/drawingml/2006/main",
|
|
10
|
+
/** Office 2016 extended charts (waterfall, histogram, funnel...; `cx:chartSpace`). */
|
|
11
|
+
cx: "http://schemas.microsoft.com/office/drawing/2014/chartex",
|
|
9
12
|
/** Relationships (`r:id`, `r:embed`). */
|
|
10
13
|
r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships"};
|
|
11
14
|
var DEFAULT_XML_LIMITS = {
|
|
@@ -413,9 +416,9 @@ function parseRunProperties(props) {
|
|
|
413
416
|
if (themeColor2) {
|
|
414
417
|
result.colorTheme = { token: themeColor2 };
|
|
415
418
|
const tint = parseTintShade(getW(color, "themeTint"));
|
|
416
|
-
const
|
|
419
|
+
const shade2 = parseTintShade(getW(color, "themeShade"));
|
|
417
420
|
if (tint !== void 0) result.colorTheme.tint = tint;
|
|
418
|
-
if (
|
|
421
|
+
if (shade2 !== void 0) result.colorTheme.shade = shade2;
|
|
419
422
|
}
|
|
420
423
|
const spacing2 = parseSignedTwips(getW(first2(props, "spacing"), "val"));
|
|
421
424
|
if (spacing2 !== void 0) result.characterSpacingTwips = spacing2;
|
|
@@ -433,9 +436,9 @@ function parseRunProperties(props) {
|
|
|
433
436
|
if (shdTheme) {
|
|
434
437
|
result.shadingThemeFill = { token: shdTheme };
|
|
435
438
|
const tint = parseTintShade(getW(shd, "themeFillTint"));
|
|
436
|
-
const
|
|
439
|
+
const shade2 = parseTintShade(getW(shd, "themeFillShade"));
|
|
437
440
|
if (tint !== void 0) result.shadingThemeFill.tint = tint;
|
|
438
|
-
if (
|
|
441
|
+
if (shade2 !== void 0) result.shadingThemeFill.shade = shade2;
|
|
439
442
|
}
|
|
440
443
|
return result;
|
|
441
444
|
}
|
|
@@ -1369,11 +1372,11 @@ function resolveDrawingColor(color, theme, options2) {
|
|
|
1369
1372
|
}
|
|
1370
1373
|
if (has("inv")) [r, g, b] = [255 - r, 255 - g, 255 - b];
|
|
1371
1374
|
if (has("gray")) r = g = b = Math.round(0.299 * r + 0.587 * g + 0.114 * b);
|
|
1372
|
-
const
|
|
1373
|
-
if (
|
|
1374
|
-
r = linearToSrgb255(srgb255ToLinear(r) *
|
|
1375
|
-
g = linearToSrgb255(srgb255ToLinear(g) *
|
|
1376
|
-
b = linearToSrgb255(srgb255ToLinear(b) *
|
|
1375
|
+
const shade2 = parseDrawingPercent(find("shade"));
|
|
1376
|
+
if (shade2 !== void 0) {
|
|
1377
|
+
r = linearToSrgb255(srgb255ToLinear(r) * shade2);
|
|
1378
|
+
g = linearToSrgb255(srgb255ToLinear(g) * shade2);
|
|
1379
|
+
b = linearToSrgb255(srgb255ToLinear(b) * shade2);
|
|
1377
1380
|
}
|
|
1378
1381
|
const tint = parseDrawingPercent(find("tint"));
|
|
1379
1382
|
if (tint !== void 0) {
|
|
@@ -1419,20 +1422,140 @@ function resolveDrawingColor(color, theme, options2) {
|
|
|
1419
1422
|
};
|
|
1420
1423
|
}
|
|
1421
1424
|
|
|
1422
|
-
// drawingml/picture-
|
|
1423
|
-
var
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1425
|
+
// drawingml/picture-artistic.ts
|
|
1426
|
+
var ARTISTIC_PRIMARY_ATTRIBUTE = {
|
|
1427
|
+
artisticBlur: "radius",
|
|
1428
|
+
artisticCement: "crackSpacing",
|
|
1429
|
+
artisticChalkSketch: "pressure",
|
|
1430
|
+
artisticCrisscrossEtching: "pressure",
|
|
1431
|
+
artisticCutout: "numberOfShades",
|
|
1432
|
+
artisticFilmGrain: "grainSize",
|
|
1433
|
+
artisticGlass: "scaling",
|
|
1434
|
+
artisticGlowDiffused: "intensity",
|
|
1435
|
+
artisticGlowEdges: "smoothness",
|
|
1436
|
+
artisticLightScreen: "gridSize",
|
|
1437
|
+
artisticLineDrawing: "pencilSize",
|
|
1438
|
+
artisticMarker: "size",
|
|
1439
|
+
// Spelled "Mosiaic" in the schema; Microsoft's typo is part of the format.
|
|
1440
|
+
artisticMosiaicBubbles: "pressure",
|
|
1441
|
+
artisticPaintBrush: "brushSize",
|
|
1442
|
+
artisticPaintStrokes: "intensity",
|
|
1443
|
+
artisticPastelsSmooth: "scaling",
|
|
1444
|
+
artisticPencilGrayscale: "pencilSize",
|
|
1445
|
+
artisticPencilSketch: "pressure",
|
|
1446
|
+
artisticPhotocopy: "detail",
|
|
1447
|
+
artisticPlasticWrap: "smoothness",
|
|
1448
|
+
artisticTexturizer: "scaling",
|
|
1449
|
+
artisticWatercolorSponge: "brushSize"
|
|
1450
|
+
};
|
|
1451
|
+
function parseArtisticPictureExtension(node) {
|
|
1452
|
+
if (node.namespaceURI !== NS.a || node.localName !== "extLst") return void 0;
|
|
1453
|
+
const found = [];
|
|
1454
|
+
const unhandled = [];
|
|
1455
|
+
const pending = [node];
|
|
1456
|
+
while (pending.length) {
|
|
1457
|
+
const item = pending.pop();
|
|
1458
|
+
if (item !== node && !(item.namespaceURI === NS.a && item.localName === "ext") && !(item.namespaceURI === "http://schemas.microsoft.com/office/drawing/2010/main" && (["imgProps", "imgLayer", "imgEffect", "useLocalDpi"].includes(item.localName) || ARTISTIC_PRIMARY_ATTRIBUTE[item.localName])))
|
|
1459
|
+
unhandled.push(item.localName);
|
|
1460
|
+
if (item.namespaceURI === "http://schemas.microsoft.com/office/drawing/2010/main" && item.localName.startsWith("artistic"))
|
|
1461
|
+
found.push(item);
|
|
1462
|
+
pending.push(...elements(item));
|
|
1463
|
+
}
|
|
1464
|
+
if (found.length !== 1) return void 0;
|
|
1465
|
+
const effect = found[0];
|
|
1466
|
+
const key = ARTISTIC_PRIMARY_ATTRIBUTE[effect.localName];
|
|
1467
|
+
if (!key) return void 0;
|
|
1468
|
+
const raw = key ? effect.getAttribute(key) : null;
|
|
1469
|
+
const n2 = raw === null ? 0 : Number(raw);
|
|
1470
|
+
if (!Number.isFinite(n2)) return void 0;
|
|
1471
|
+
return {
|
|
1472
|
+
kind: "artistic",
|
|
1473
|
+
name: effect.localName,
|
|
1474
|
+
radius: effect.localName === "artisticBlur" ? n2 : n2 / 1e3,
|
|
1475
|
+
baked: true,
|
|
1476
|
+
...unhandled.length ? { unhandled } : {}
|
|
1477
|
+
};
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
// drawingml/picture-standard-effects.ts
|
|
1481
|
+
var attrs = {
|
|
1482
|
+
biLevel: { threshold: "thresh" },
|
|
1483
|
+
alphaRepl: { amount: "a" },
|
|
1484
|
+
alphaBiLevel: { threshold: "thresh" },
|
|
1485
|
+
hsl: { hue: "hue", saturation: "sat", luminance: "lum" },
|
|
1486
|
+
tint: { hue: "hue", amount: "amt" },
|
|
1487
|
+
blur: { radiusEmu: "rad" }
|
|
1488
|
+
};
|
|
1489
|
+
function parseStandardPictureEffect(node) {
|
|
1490
|
+
const name = node.localName;
|
|
1491
|
+
if (![
|
|
1492
|
+
"biLevel",
|
|
1493
|
+
"alphaInv",
|
|
1494
|
+
"alphaCeiling",
|
|
1495
|
+
"alphaFloor",
|
|
1496
|
+
"alphaRepl",
|
|
1497
|
+
"alphaBiLevel",
|
|
1498
|
+
"alphaMod",
|
|
1499
|
+
"duotone",
|
|
1500
|
+
"clrRepl",
|
|
1501
|
+
"clrChange",
|
|
1502
|
+
"hsl",
|
|
1503
|
+
"tint",
|
|
1504
|
+
"blur"
|
|
1505
|
+
].includes(name))
|
|
1506
|
+
return void 0;
|
|
1507
|
+
const values = {};
|
|
1508
|
+
for (const [key, attribute] of Object.entries(attrs[name] ?? {})) {
|
|
1509
|
+
const raw = node.getAttribute(attribute);
|
|
1510
|
+
if (raw === null) continue;
|
|
1431
1511
|
const percent = raw.endsWith("%");
|
|
1432
|
-
const
|
|
1433
|
-
if (Number.isFinite(
|
|
1512
|
+
const n2 = Number(percent ? raw.slice(0, -1) : raw) / (key === "hue" ? 6e4 : key === "radiusEmu" ? 1 : percent ? 100 : 1e5);
|
|
1513
|
+
if (!Number.isFinite(n2) || key === "hue" && (n2 < 0 || n2 >= 360) || key === "threshold" && (n2 < 0 || n2 > 1) || key === "radiusEmu" && (!Number.isSafeInteger(n2) || n2 < 0) || ["saturation", "luminance", "amount"].includes(key) && name !== "alphaMod" && (n2 < (name === "alphaRepl" ? 0 : -1) || n2 > 1))
|
|
1514
|
+
return void 0;
|
|
1515
|
+
values[key] = n2;
|
|
1434
1516
|
}
|
|
1435
|
-
|
|
1517
|
+
if (["biLevel", "alphaBiLevel"].includes(name) && values.threshold === void 0)
|
|
1518
|
+
return void 0;
|
|
1519
|
+
if (name === "alphaRepl" && values.amount === void 0) return void 0;
|
|
1520
|
+
if (name === "alphaMod") {
|
|
1521
|
+
const cont = first(node, "cont", NS.a);
|
|
1522
|
+
const nested = cont ? elements(cont) : [];
|
|
1523
|
+
if (nested.length !== 1 || nested[0]?.localName !== "alphaModFix") return void 0;
|
|
1524
|
+
const raw = nested[0].getAttribute("amt") ?? "100000";
|
|
1525
|
+
const n2 = Number(raw.endsWith("%") ? raw.slice(0, -1) : raw) / (raw.endsWith("%") ? 100 : 1e5);
|
|
1526
|
+
if (!Number.isFinite(n2) || n2 < 0) return void 0;
|
|
1527
|
+
values.amount = n2;
|
|
1528
|
+
}
|
|
1529
|
+
let colors = [];
|
|
1530
|
+
if (name === "duotone") {
|
|
1531
|
+
const candidates = elements(node).filter(
|
|
1532
|
+
(item) => item.namespaceURI === NS.a && /Clr$/.test(item.localName)
|
|
1533
|
+
);
|
|
1534
|
+
colors = candidates.map((item) => parseDrawingColor(item)).filter((item) => Boolean(item));
|
|
1535
|
+
if (colors.length !== 2) return void 0;
|
|
1536
|
+
}
|
|
1537
|
+
if (name === "clrRepl") {
|
|
1538
|
+
const color = parseDrawingColorIn(node);
|
|
1539
|
+
if (!color) return void 0;
|
|
1540
|
+
colors = [color];
|
|
1541
|
+
}
|
|
1542
|
+
if (name === "clrChange") {
|
|
1543
|
+
const from = parseDrawingColorIn(first(node, "clrFrom", NS.a)), to = parseDrawingColorIn(first(node, "clrTo", NS.a));
|
|
1544
|
+
if (!from || !to) return void 0;
|
|
1545
|
+
colors = [from, to];
|
|
1546
|
+
}
|
|
1547
|
+
if (name === "alphaInv") {
|
|
1548
|
+
const color = parseDrawingColorIn(node);
|
|
1549
|
+
if (color) colors = [color];
|
|
1550
|
+
}
|
|
1551
|
+
return {
|
|
1552
|
+
kind: "standard",
|
|
1553
|
+
name,
|
|
1554
|
+
...Object.keys(values).length ? { values } : {},
|
|
1555
|
+
...colors.length ? { colors } : {},
|
|
1556
|
+
...name === "clrChange" && node.hasAttribute("useA") ? { useAlpha: !["0", "false"].includes(node.getAttribute("useA") ?? "") } : {},
|
|
1557
|
+
...name === "blur" && node.hasAttribute("grow") ? { grow: !["0", "false"].includes(node.getAttribute("grow") ?? "") } : {}
|
|
1558
|
+
};
|
|
1436
1559
|
}
|
|
1437
1560
|
|
|
1438
1561
|
// drawingml/picture-effects.ts
|
|
@@ -1472,11 +1595,70 @@ function readPictureEffect(name, attribute) {
|
|
|
1472
1595
|
function parsePictureEffects(blip) {
|
|
1473
1596
|
if (!blip) return [];
|
|
1474
1597
|
return elements(blip).map((node) => ({
|
|
1475
|
-
...(node.namespaceURI === NS.a ? readPictureEffect(node.localName, (name) => node.getAttribute(name)) : void 0) ?? { kind: "unsupported", name: node.localName },
|
|
1598
|
+
...(node.namespaceURI === NS.a ? readPictureEffect(node.localName, (name) => node.getAttribute(name)) ?? parseStandardPictureEffect(node) ?? parseArtisticPictureExtension(node) : void 0) ?? { kind: "unsupported", name: node.localName },
|
|
1476
1599
|
sourceXml: buildXml(node)
|
|
1477
1600
|
}));
|
|
1478
1601
|
}
|
|
1479
1602
|
|
|
1603
|
+
// drawingml/picture-layout.ts
|
|
1604
|
+
function parsePictureLayout(fill) {
|
|
1605
|
+
const out = {};
|
|
1606
|
+
const rot = fill.getAttribute("rotWithShape");
|
|
1607
|
+
if (rot !== null) out.rotWithShape = rot !== "0" && rot !== "false";
|
|
1608
|
+
const dpi = Number(fill.getAttribute("dpi"));
|
|
1609
|
+
if (fill.hasAttribute("dpi") && Number.isFinite(dpi) && dpi > 0) out.dpi = dpi;
|
|
1610
|
+
const tile = first(fill, "tile", NS.a);
|
|
1611
|
+
if (tile) {
|
|
1612
|
+
const value = {};
|
|
1613
|
+
for (const [key, attr3] of [
|
|
1614
|
+
["scaleX", "sx"],
|
|
1615
|
+
["scaleY", "sy"]
|
|
1616
|
+
]) {
|
|
1617
|
+
const n2 = picturePercentage(tile.getAttribute(attr3));
|
|
1618
|
+
if (n2 !== void 0) value[key] = n2;
|
|
1619
|
+
}
|
|
1620
|
+
for (const [key, attr3] of [
|
|
1621
|
+
["offsetXEmu", "tx"],
|
|
1622
|
+
["offsetYEmu", "ty"]
|
|
1623
|
+
]) {
|
|
1624
|
+
const raw = tile.getAttribute(attr3);
|
|
1625
|
+
const n2 = raw === null ? NaN : Number(raw);
|
|
1626
|
+
if (Number.isSafeInteger(n2)) value[key] = n2;
|
|
1627
|
+
}
|
|
1628
|
+
const alignment = tile.getAttribute("algn");
|
|
1629
|
+
if (alignment) value.alignment = alignment;
|
|
1630
|
+
const flip = tile.getAttribute("flip");
|
|
1631
|
+
if (flip && ["none", "x", "y", "xy"].includes(flip))
|
|
1632
|
+
value.flip = flip;
|
|
1633
|
+
out.tile = value;
|
|
1634
|
+
}
|
|
1635
|
+
const rect3 = first(first(fill, "stretch", NS.a), "fillRect", NS.a);
|
|
1636
|
+
if (rect3)
|
|
1637
|
+
out.fillRect = {
|
|
1638
|
+
l: picturePercentage(rect3.getAttribute("l")) ?? 0,
|
|
1639
|
+
t: picturePercentage(rect3.getAttribute("t")) ?? 0,
|
|
1640
|
+
r: picturePercentage(rect3.getAttribute("r")) ?? 0,
|
|
1641
|
+
b: picturePercentage(rect3.getAttribute("b")) ?? 0
|
|
1642
|
+
};
|
|
1643
|
+
return out;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
// drawingml/picture-crop.ts
|
|
1647
|
+
var SIDES = { l: "cropLeft", t: "cropTop", r: "cropRight", b: "cropBottom" };
|
|
1648
|
+
function parsePictureCrop(blipFill) {
|
|
1649
|
+
const rect3 = first(blipFill, "srcRect", NS.a);
|
|
1650
|
+
if (!rect3) return void 0;
|
|
1651
|
+
const result = {};
|
|
1652
|
+
for (const [attr3, key] of Object.entries(SIDES)) {
|
|
1653
|
+
const raw = rect3.getAttribute(attr3);
|
|
1654
|
+
if (raw === null || !raw.trim()) continue;
|
|
1655
|
+
const percent = raw.endsWith("%");
|
|
1656
|
+
const value = Number(percent ? raw.slice(0, -1) : raw) / (percent ? 100 : 1e5);
|
|
1657
|
+
if (Number.isFinite(value)) result[key] = value;
|
|
1658
|
+
}
|
|
1659
|
+
return result;
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1480
1662
|
// drawingml/picture-fill.ts
|
|
1481
1663
|
function parseDrawingPictureFill(fill) {
|
|
1482
1664
|
const blip = first(fill, "blip", NS.a);
|
|
@@ -1484,13 +1666,32 @@ function parseDrawingPictureFill(fill) {
|
|
|
1484
1666
|
const linkRelId = blip?.getAttributeNS(NS.r, "link") || void 0;
|
|
1485
1667
|
const crop = parsePictureCrop(fill);
|
|
1486
1668
|
const effects = parsePictureEffects(blip);
|
|
1487
|
-
const
|
|
1488
|
-
const
|
|
1489
|
-
const
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1669
|
+
const layout = parsePictureLayout(fill);
|
|
1670
|
+
const unsupported = [];
|
|
1671
|
+
const tile = first(fill, "tile", NS.a), stretch = first(fill, "stretch", NS.a);
|
|
1672
|
+
if (tile && stretch) unsupported.push("tile/stretch-choice");
|
|
1673
|
+
if (tile) {
|
|
1674
|
+
for (const [attr3, key] of [
|
|
1675
|
+
["sx", "scaleX"],
|
|
1676
|
+
["sy", "scaleY"],
|
|
1677
|
+
["tx", "offsetXEmu"],
|
|
1678
|
+
["ty", "offsetYEmu"]
|
|
1679
|
+
])
|
|
1680
|
+
if (tile.hasAttribute(attr3) && (layout.tile?.[key] === void 0 || (attr3 === "sx" || attr3 === "sy") && layout.tile[key] <= 0))
|
|
1681
|
+
unsupported.push(`tile:${attr3}`);
|
|
1682
|
+
if (tile.hasAttribute("algn") && !["tl", "t", "tr", "l", "ctr", "r", "bl", "b", "br"].includes(tile.getAttribute("algn") ?? ""))
|
|
1683
|
+
unsupported.push("tile:algn");
|
|
1684
|
+
if (tile.hasAttribute("flip") && !layout.tile?.flip) unsupported.push("tile:flip");
|
|
1685
|
+
}
|
|
1686
|
+
const rect3 = first(stretch, "fillRect", NS.a);
|
|
1687
|
+
if (rect3)
|
|
1688
|
+
for (const key of ["l", "t", "r", "b"]) {
|
|
1689
|
+
const raw = rect3.getAttribute(key);
|
|
1690
|
+
if (raw !== null && !/^[-+]?(?:\d+\.?\d*|\.\d+)%?$/.test(raw))
|
|
1691
|
+
unsupported.push(`fillRect:${key}`);
|
|
1692
|
+
}
|
|
1693
|
+
if (fill.hasAttribute("rotWithShape") && !["0", "1", "true", "false"].includes(fill.getAttribute("rotWithShape") ?? ""))
|
|
1694
|
+
unsupported.push("rotWithShape");
|
|
1494
1695
|
return {
|
|
1495
1696
|
kind: "picture",
|
|
1496
1697
|
sourceXml: buildXml(fill),
|
|
@@ -1498,6 +1699,7 @@ function parseDrawingPictureFill(fill) {
|
|
|
1498
1699
|
...linkRelId ? { linkRelId } : {},
|
|
1499
1700
|
...crop ? { crop } : {},
|
|
1500
1701
|
...effects.length ? { effects } : {},
|
|
1702
|
+
...Object.keys(layout).length ? { layout } : {},
|
|
1501
1703
|
...unsupported.length ? { unsupportedPicture: unsupported } : {}
|
|
1502
1704
|
};
|
|
1503
1705
|
}
|
|
@@ -1771,16 +1973,16 @@ function escapeXmlAttr(value) {
|
|
|
1771
1973
|
|
|
1772
1974
|
// docx/element-order.ts
|
|
1773
1975
|
function orderChildren(parent, order) {
|
|
1774
|
-
const
|
|
1976
|
+
const elements3 = Array.from(parent.childNodes).filter(isElement);
|
|
1775
1977
|
const rankOf = (name) => order.findIndex((entry) => typeof entry === "string" ? entry === name : entry.includes(name));
|
|
1776
1978
|
let previousRank = -1;
|
|
1777
|
-
const ranked =
|
|
1979
|
+
const ranked = elements3.map((element, index) => {
|
|
1778
1980
|
const rank = element.namespaceURI === WORD_NS ? rankOf(element.localName ?? "") : -1;
|
|
1779
1981
|
if (rank >= 0) previousRank = rank;
|
|
1780
1982
|
return { element, index, rank: rank >= 0 ? rank : previousRank + 0.5 };
|
|
1781
1983
|
});
|
|
1782
1984
|
const sorted = [...ranked].sort((a, b) => a.rank - b.rank || a.index - b.index);
|
|
1783
|
-
if (sorted.every((entry, index) => entry.element ===
|
|
1985
|
+
if (sorted.every((entry, index) => entry.element === elements3[index])) return;
|
|
1784
1986
|
for (const { element } of sorted) parent.appendChild(element);
|
|
1785
1987
|
}
|
|
1786
1988
|
|
|
@@ -1857,16 +2059,16 @@ function tableGrid(table) {
|
|
|
1857
2059
|
const cells = table.rows[row2] ?? [];
|
|
1858
2060
|
if (!cells.length || sumSpans(cells) !== columns) return void 0;
|
|
1859
2061
|
const placed2 = [];
|
|
1860
|
-
const
|
|
2062
|
+
const line4 = new Array(columns);
|
|
1861
2063
|
let col = 0;
|
|
1862
2064
|
cells.forEach((cell, index) => {
|
|
1863
2065
|
const entry = { cell, row: row2, index, col, span: spanOf(cell) };
|
|
1864
|
-
for (let k = 0; k < entry.span; k++)
|
|
2066
|
+
for (let k = 0; k < entry.span; k++) line4[col + k] = entry;
|
|
1865
2067
|
col += entry.span;
|
|
1866
2068
|
placed2.push(entry);
|
|
1867
2069
|
});
|
|
1868
2070
|
rows2.push(placed2);
|
|
1869
|
-
cover.push(
|
|
2071
|
+
cover.push(line4);
|
|
1870
2072
|
}
|
|
1871
2073
|
const grid = { columns, rows: rows2, cover };
|
|
1872
2074
|
for (const entry of rows2.flat())
|
|
@@ -12386,6 +12588,24 @@ function computeHierarchicalSunburstArcs(categoryLevels, values, cx, cy, maxR) {
|
|
|
12386
12588
|
return out;
|
|
12387
12589
|
}
|
|
12388
12590
|
|
|
12591
|
+
// chart/style-palette.ts
|
|
12592
|
+
function hexToRgb3(hex) {
|
|
12593
|
+
const h = hex.replace("#", "");
|
|
12594
|
+
return [
|
|
12595
|
+
parseInt(h.substring(0, 2), 16),
|
|
12596
|
+
parseInt(h.substring(2, 4), 16),
|
|
12597
|
+
parseInt(h.substring(4, 6), 16)
|
|
12598
|
+
];
|
|
12599
|
+
}
|
|
12600
|
+
function rgbToHex(r, g, b) {
|
|
12601
|
+
const clamp3 = (v) => Math.max(0, Math.min(255, Math.round(v)));
|
|
12602
|
+
return `#${clamp3(r).toString(16).padStart(2, "0")}${clamp3(g).toString(16).padStart(2, "0")}${clamp3(b).toString(16).padStart(2, "0")}`;
|
|
12603
|
+
}
|
|
12604
|
+
function shade(hex, amount) {
|
|
12605
|
+
const [r, g, b] = hexToRgb3(hex);
|
|
12606
|
+
return rgbToHex(r * (1 - amount), g * (1 - amount), b * (1 - amount));
|
|
12607
|
+
}
|
|
12608
|
+
|
|
12389
12609
|
// chart/histogram-binning.ts
|
|
12390
12610
|
function binLabel(lower, upper, closed, format) {
|
|
12391
12611
|
return closed === "r" ? `(${format(lower)}, ${format(upper)}]` : `[${format(lower)}, ${format(upper)})`;
|
|
@@ -12892,11 +13112,11 @@ function resolveChartStyleDefinition(style, resolve) {
|
|
|
12892
13112
|
const value = source[key];
|
|
12893
13113
|
if (value !== void 0) Object.assign(entry, { [key]: value });
|
|
12894
13114
|
}
|
|
12895
|
-
const
|
|
13115
|
+
const line4 = fillColor(source.line?.fill) ?? (source.lineRef?.color && resolve(source.lineRef.color));
|
|
12896
13116
|
const fill = fillColor(source.fill) ?? (source.fillRef?.color && resolve(source.fillRef.color));
|
|
12897
13117
|
const color = (source.textColor && resolve(source.textColor)) ?? (source.fontRef?.color && resolve(source.fontRef.color));
|
|
12898
13118
|
if (color !== void 0) entry.color = color;
|
|
12899
|
-
if (
|
|
13119
|
+
if (line4 !== void 0) entry.lineColor = line4;
|
|
12900
13120
|
if (fill !== void 0) entry.fillColor = fill;
|
|
12901
13121
|
if (source.line?.widthEmu !== void 0 && source.line.widthEmu > 0)
|
|
12902
13122
|
entry.lineWidth = source.line.widthEmu / 12700;
|
|
@@ -13042,10 +13262,10 @@ function buildChartGradientDef(id, fill, bounds) {
|
|
|
13042
13262
|
stops
|
|
13043
13263
|
};
|
|
13044
13264
|
}
|
|
13045
|
-
const
|
|
13046
|
-
const span = fill.scaled ? Math.abs(Math.cos(
|
|
13047
|
-
const dx = Math.cos(
|
|
13048
|
-
const dy = Math.sin(
|
|
13265
|
+
const rad2 = (fill.angle ?? 0) * Math.PI / 180;
|
|
13266
|
+
const span = fill.scaled ? Math.abs(Math.cos(rad2)) + Math.abs(Math.sin(rad2)) : 1;
|
|
13267
|
+
const dx = Math.cos(rad2) * span / 2;
|
|
13268
|
+
const dy = Math.sin(rad2) * span / 2;
|
|
13049
13269
|
const round3 = (value) => Math.round(value * 1e4) / 1e4;
|
|
13050
13270
|
return {
|
|
13051
13271
|
kind: "linearGradient",
|
|
@@ -13160,23 +13380,23 @@ function buildMarkerPrimitive(input) {
|
|
|
13160
13380
|
return null;
|
|
13161
13381
|
}
|
|
13162
13382
|
const r = markerRadius(input.size, input.defaultRadius);
|
|
13163
|
-
const
|
|
13383
|
+
const outline2 = input.stroke ? {
|
|
13164
13384
|
stroke: input.stroke,
|
|
13165
13385
|
strokeWidth: input.strokeWidth ?? DEFAULT_MARKER_OUTLINE_PT * CHART_PX_PER_PT
|
|
13166
13386
|
} : void 0;
|
|
13167
|
-
const polygonStroke =
|
|
13387
|
+
const polygonStroke = outline2 ?? { stroke: fill, strokeWidth: 0 };
|
|
13168
13388
|
const lineStroke = input.stroke ?? fill;
|
|
13169
13389
|
switch (symbol) {
|
|
13170
13390
|
case "square":
|
|
13171
13391
|
case "dash": {
|
|
13172
13392
|
const h = symbol === "dash" ? r * 0.64 : r * 2;
|
|
13173
13393
|
const y = cy - h / 2;
|
|
13174
|
-
if (
|
|
13394
|
+
if (outline2) {
|
|
13175
13395
|
return {
|
|
13176
13396
|
kind: "polygon",
|
|
13177
13397
|
points: rectPolygon(cx - r, y, r * 2, h),
|
|
13178
13398
|
fill,
|
|
13179
|
-
...
|
|
13399
|
+
...outline2,
|
|
13180
13400
|
...part
|
|
13181
13401
|
};
|
|
13182
13402
|
}
|
|
@@ -13234,9 +13454,9 @@ function buildMarkerPrimitive(input) {
|
|
|
13234
13454
|
...part
|
|
13235
13455
|
};
|
|
13236
13456
|
case "dot":
|
|
13237
|
-
return { kind: "circle", cx, cy, r: Math.max(r * 0.6, 1), fill, ...part, ...
|
|
13457
|
+
return { kind: "circle", cx, cy, r: Math.max(r * 0.6, 1), fill, ...part, ...outline2 };
|
|
13238
13458
|
default:
|
|
13239
|
-
return { kind: "circle", cx, cy, r, fill, ...part, ...
|
|
13459
|
+
return { kind: "circle", cx, cy, r, fill, ...part, ...outline2 };
|
|
13240
13460
|
}
|
|
13241
13461
|
}
|
|
13242
13462
|
|
|
@@ -13513,6 +13733,18 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
|
13513
13733
|
showNegativeBubbles: group2.showNegativeBubbles === true
|
|
13514
13734
|
};
|
|
13515
13735
|
}
|
|
13736
|
+
if (group2?.is3D) {
|
|
13737
|
+
const v = chartSpace.view3D;
|
|
13738
|
+
summary.view3D = {
|
|
13739
|
+
...v?.rotX === void 0 ? {} : { rotX: v.rotX },
|
|
13740
|
+
...v?.rotY === void 0 ? {} : { rotY: v.rotY },
|
|
13741
|
+
...v?.perspective === void 0 ? {} : { perspective: v.perspective },
|
|
13742
|
+
...v?.rightAngleAxes === void 0 ? {} : { rAngAx: v.rightAngleAxes },
|
|
13743
|
+
...v?.depthPercent === void 0 ? {} : { depthPercent: v.depthPercent },
|
|
13744
|
+
...v?.heightPercent === void 0 ? {} : { hPercent: v.heightPercent },
|
|
13745
|
+
...group2.gapDepth === void 0 ? {} : { gapDepth: group2.gapDepth }
|
|
13746
|
+
};
|
|
13747
|
+
}
|
|
13516
13748
|
const grouping = group2?.grouping;
|
|
13517
13749
|
if (grouping && GROUPINGS.has(grouping))
|
|
13518
13750
|
summary.grouping = grouping;
|
|
@@ -13540,17 +13772,6 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
|
13540
13772
|
return summary;
|
|
13541
13773
|
}
|
|
13542
13774
|
|
|
13543
|
-
// chart/funnel-geometry.ts
|
|
13544
|
-
function computeFunnelGeometry(values, plot) {
|
|
13545
|
-
const max = Math.max(...values.map((v) => Math.abs(v)), 1);
|
|
13546
|
-
const height = plot.height / Math.max(1, values.length);
|
|
13547
|
-
const center = plot.x + plot.width / 2;
|
|
13548
|
-
return values.map((value, index) => {
|
|
13549
|
-
const width = Math.abs(value) / max * plot.width;
|
|
13550
|
-
return { index, x: center - width / 2, y: plot.y + index * height, width, height, center };
|
|
13551
|
-
});
|
|
13552
|
-
}
|
|
13553
|
-
|
|
13554
13775
|
// chart/render/theme-palette.ts
|
|
13555
13776
|
var THEME_SLOTS = [
|
|
13556
13777
|
"lt1",
|
|
@@ -13691,6 +13912,266 @@ function chartAppearance(chart, theme) {
|
|
|
13691
13912
|
return out;
|
|
13692
13913
|
}
|
|
13693
13914
|
|
|
13915
|
+
// chart/render/chart-title-text.ts
|
|
13916
|
+
function chartRunStyle(run) {
|
|
13917
|
+
return {
|
|
13918
|
+
...run.sizePt === void 0 ? {} : { fontSize: run.sizePt },
|
|
13919
|
+
...run.bold === void 0 ? {} : { bold: run.bold },
|
|
13920
|
+
...run.italic === void 0 ? {} : { italic: run.italic },
|
|
13921
|
+
...run.underline === void 0 ? {} : { underline: run.underline },
|
|
13922
|
+
...run.typeface === void 0 ? {} : { typeface: run.typeface },
|
|
13923
|
+
...run.color === void 0 ? {} : { textColor: run.color }
|
|
13924
|
+
};
|
|
13925
|
+
}
|
|
13926
|
+
function chartTitleText(chart, theme) {
|
|
13927
|
+
const formatting = chart.formatting;
|
|
13928
|
+
const entry = formatting?.entries.title;
|
|
13929
|
+
const body = entry?.textBody;
|
|
13930
|
+
if (!formatting || !body || body.text !== chart.title) return void 0;
|
|
13931
|
+
if (body.paragraphs.length === 1 && body.paragraphs[0].runs.length <= 1 && !body.text.includes("\n") && !body.paragraphs[0].lineSpacing && !body.paragraphs[0].spaceBefore && !body.paragraphs[0].spaceAfter)
|
|
13932
|
+
return void 0;
|
|
13933
|
+
return {
|
|
13934
|
+
paragraphs: body.paragraphs.map((paragraph) => ({
|
|
13935
|
+
...paragraph.align ? { align: paragraph.align } : {},
|
|
13936
|
+
...paragraph.lineSpacing ? { lineSpacing: paragraph.lineSpacing } : {},
|
|
13937
|
+
...paragraph.spaceBefore ? { spaceBefore: paragraph.spaceBefore } : {},
|
|
13938
|
+
...paragraph.spaceAfter ? { spaceAfter: paragraph.spaceAfter } : {},
|
|
13939
|
+
runs: paragraph.runs.map((run) => {
|
|
13940
|
+
const direct = {
|
|
13941
|
+
sourceXml: "",
|
|
13942
|
+
...entry.textBodyStyle,
|
|
13943
|
+
...chartRunStyle(paragraph.defaultProperties ?? {}),
|
|
13944
|
+
...chartRunStyle(run)
|
|
13945
|
+
};
|
|
13946
|
+
const appearance = chartAppearance(
|
|
13947
|
+
{
|
|
13948
|
+
...chart,
|
|
13949
|
+
formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
|
|
13950
|
+
},
|
|
13951
|
+
theme
|
|
13952
|
+
)?.title ?? {};
|
|
13953
|
+
return { text: run.text, appearance };
|
|
13954
|
+
})
|
|
13955
|
+
}))
|
|
13956
|
+
};
|
|
13957
|
+
}
|
|
13958
|
+
|
|
13959
|
+
// chart/render/chart-3d-camera.ts
|
|
13960
|
+
var OBLIQUE_DEPTH_SCALE = 0.5;
|
|
13961
|
+
var rad = (deg) => deg * Math.PI / 180;
|
|
13962
|
+
function fitTransform(raw, size, fit2) {
|
|
13963
|
+
const xs = [];
|
|
13964
|
+
const ys = [];
|
|
13965
|
+
for (const x of [0, size.w])
|
|
13966
|
+
for (const y of [0, size.h])
|
|
13967
|
+
for (const z of [0, size.d]) {
|
|
13968
|
+
const q = raw([x, y, z]);
|
|
13969
|
+
xs.push(q.x);
|
|
13970
|
+
ys.push(q.y);
|
|
13971
|
+
}
|
|
13972
|
+
const minX = Math.min(...xs);
|
|
13973
|
+
const maxX = Math.max(...xs);
|
|
13974
|
+
const minY = Math.min(...ys);
|
|
13975
|
+
const maxY = Math.max(...ys);
|
|
13976
|
+
const scale = Math.min(fit2.w / Math.max(1e-6, maxX - minX), fit2.h / Math.max(1e-6, maxY - minY));
|
|
13977
|
+
return {
|
|
13978
|
+
scale,
|
|
13979
|
+
ox: fit2.x + (fit2.w - (maxX - minX) * scale) / 2 - minX * scale,
|
|
13980
|
+
oy: fit2.y + (fit2.h - (maxY - minY) * scale) / 2 + maxY * scale
|
|
13981
|
+
};
|
|
13982
|
+
}
|
|
13983
|
+
function createChart3DCamera(projection, size, fit2) {
|
|
13984
|
+
if (projection.mode === "oblique") {
|
|
13985
|
+
const kx = projection.shearX * OBLIQUE_DEPTH_SCALE;
|
|
13986
|
+
const ky = projection.shearY * OBLIQUE_DEPTH_SCALE;
|
|
13987
|
+
const raw2 = (p) => ({ x: p[0] + p[2] * kx, y: p[1] - p[2] * ky });
|
|
13988
|
+
const t2 = fitTransform(raw2, size, fit2);
|
|
13989
|
+
return {
|
|
13990
|
+
project: (p) => {
|
|
13991
|
+
const q = raw2(p);
|
|
13992
|
+
return { x: t2.ox + q.x * t2.scale, y: t2.oy - q.y * t2.scale, depth: p[2] };
|
|
13993
|
+
},
|
|
13994
|
+
viewDir: () => [-kx, ky, 1],
|
|
13995
|
+
eye: void 0,
|
|
13996
|
+
order: (a, b) => b[2] - a[2] || (projection.shearX >= 0 ? a[0] - b[0] : b[0] - a[0]) || (projection.shearY <= 0 ? a[1] - b[1] : b[1] - a[1]),
|
|
13997
|
+
sideWallAtZero: projection.shearX >= 0
|
|
13998
|
+
};
|
|
13999
|
+
}
|
|
14000
|
+
const cx = size.w / 2;
|
|
14001
|
+
const cy = size.h / 2;
|
|
14002
|
+
const cz = size.d / 2;
|
|
14003
|
+
const [cosY, sinY] = [Math.cos(rad(projection.rotYDeg)), Math.sin(rad(projection.rotYDeg))];
|
|
14004
|
+
const [cosX, sinX] = [Math.cos(rad(projection.rotXDeg)), Math.sin(rad(projection.rotXDeg))];
|
|
14005
|
+
const radius = Math.hypot(size.w, size.h, size.d) / 2;
|
|
14006
|
+
const dist = radius / Math.tan(rad(projection.fovDeg) / 2);
|
|
14007
|
+
const rotate = (p) => {
|
|
14008
|
+
const x = p[0] - cx;
|
|
14009
|
+
const y = p[1] - cy;
|
|
14010
|
+
const z = p[2] - cz;
|
|
14011
|
+
const x1 = x * cosY + z * sinY;
|
|
14012
|
+
const z1 = -x * sinY + z * cosY;
|
|
14013
|
+
return [x1, y * cosX + z1 * sinX, -y * sinX + z1 * cosX];
|
|
14014
|
+
};
|
|
14015
|
+
const raw = (p) => {
|
|
14016
|
+
const r = rotate(p);
|
|
14017
|
+
const s = dist / (dist + r[2]);
|
|
14018
|
+
return { x: r[0] * s, y: r[1] * s, depth: r[2] };
|
|
14019
|
+
};
|
|
14020
|
+
const t = fitTransform(raw, size, fit2);
|
|
14021
|
+
const ey = dist * sinX;
|
|
14022
|
+
const ez1 = -dist * cosX;
|
|
14023
|
+
const eyeX = cx - ez1 * sinY;
|
|
14024
|
+
const eye = [eyeX, cy + ey, cz + ez1 * cosY];
|
|
14025
|
+
return {
|
|
14026
|
+
project: (p) => {
|
|
14027
|
+
const q = raw(p);
|
|
14028
|
+
return { x: t.ox + q.x * t.scale, y: t.oy - q.y * t.scale, depth: q.depth };
|
|
14029
|
+
},
|
|
14030
|
+
viewDir: (p) => [p[0] - eye[0], p[1] - eye[1], p[2] - eye[2]],
|
|
14031
|
+
eye,
|
|
14032
|
+
order: (a, b) => {
|
|
14033
|
+
const da = (a[0] - eyeX) ** 2 + (a[1] - eye[1]) ** 2 + (a[2] - eye[2]) ** 2;
|
|
14034
|
+
const db = (b[0] - eyeX) ** 2 + (b[1] - eye[1]) ** 2 + (b[2] - eye[2]) ** 2;
|
|
14035
|
+
return db - da;
|
|
14036
|
+
},
|
|
14037
|
+
sideWallAtZero: eyeX > cx
|
|
14038
|
+
};
|
|
14039
|
+
}
|
|
14040
|
+
|
|
14041
|
+
// chart/render/chart-spacing.ts
|
|
14042
|
+
function chartBarSpacing(chart) {
|
|
14043
|
+
const stacked = chart.grouping === "stacked" || chart.grouping === "percentStacked";
|
|
14044
|
+
return {
|
|
14045
|
+
barGapWidth: chart.barGapWidth ?? DEFAULT_BAR_GAP_WIDTH,
|
|
14046
|
+
barOverlap: chart.barOverlap ?? (stacked ? 100 : 0)
|
|
14047
|
+
};
|
|
14048
|
+
}
|
|
14049
|
+
|
|
14050
|
+
// chart/render/chart-3d-layout.ts
|
|
14051
|
+
var DEFAULT_GAP_DEPTH = 150;
|
|
14052
|
+
var clamp = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
|
|
14053
|
+
function chart3DSeriesInDepth(model) {
|
|
14054
|
+
return model.type === "surface" || model.grouping === "standard";
|
|
14055
|
+
}
|
|
14056
|
+
function chart3DLayout(model, inner, view) {
|
|
14057
|
+
const horizontal = model.horizontal;
|
|
14058
|
+
const w = Math.max(1, inner.w);
|
|
14059
|
+
const h = Math.max(
|
|
14060
|
+
1,
|
|
14061
|
+
inner.h * (view.hPercent !== void 0 ? clamp(view.hPercent, 5, 500) / 100 : 1)
|
|
14062
|
+
);
|
|
14063
|
+
const catLength = horizontal ? h : w;
|
|
14064
|
+
const valueLength = horizontal ? w : h;
|
|
14065
|
+
const cats = Math.max(1, model.categories.length);
|
|
14066
|
+
const band = catLength / cats;
|
|
14067
|
+
const rows2 = chart3DSeriesInDepth(model) ? Math.max(1, model.series.length) : 1;
|
|
14068
|
+
const isBar = model.type === "bar" || model.type === "column";
|
|
14069
|
+
const clustered = isBar && model.grouping === "clustered";
|
|
14070
|
+
const bars2 = isBar ? clusteredBarGeometry(
|
|
14071
|
+
band,
|
|
14072
|
+
clustered ? Math.max(1, model.series.length) : 1,
|
|
14073
|
+
chartBarSpacing(model)
|
|
14074
|
+
) : void 0;
|
|
14075
|
+
const depthScale = clamp(view.depthPercent ?? 100, 20, 2e3) / 100;
|
|
14076
|
+
const gap = clamp(view.gapDepth ?? DEFAULT_GAP_DEPTH, 0, 500) / 100;
|
|
14077
|
+
const wanted = (bars2?.singleBarWidth ?? band * 0.5) * depthScale;
|
|
14078
|
+
const wantedCell = rows2 === 1 ? wanted * 1.5 : wanted * (1 + gap);
|
|
14079
|
+
const depth = Math.min(rows2 * wantedCell, Math.max(w, h) * 0.9);
|
|
14080
|
+
const cell = depth / rows2;
|
|
14081
|
+
const scale = model.valueAxis;
|
|
14082
|
+
const span = scale ? scale.max - scale.min || 1 : 1;
|
|
14083
|
+
return {
|
|
14084
|
+
size: { w, h, d: depth },
|
|
14085
|
+
horizontal,
|
|
14086
|
+
catLength,
|
|
14087
|
+
valueLength,
|
|
14088
|
+
band,
|
|
14089
|
+
rows: rows2,
|
|
14090
|
+
cell,
|
|
14091
|
+
markDepth: rows2 === 1 ? cell / 1.5 : cell / (1 + gap),
|
|
14092
|
+
bars: bars2,
|
|
14093
|
+
value: (v) => (v - (scale?.min ?? 0)) / span * valueLength || 0,
|
|
14094
|
+
rowZ: (r) => {
|
|
14095
|
+
const mark = rows2 === 1 ? cell / 1.5 : cell / (1 + gap);
|
|
14096
|
+
const z0 = r * cell + (cell - mark) / 2;
|
|
14097
|
+
return [z0, z0 + mark];
|
|
14098
|
+
}
|
|
14099
|
+
};
|
|
14100
|
+
}
|
|
14101
|
+
|
|
14102
|
+
// chart/render/chart-3d-mesh.ts
|
|
14103
|
+
function faceKind(n2) {
|
|
14104
|
+
const [x, y, z] = n2;
|
|
14105
|
+
if (Math.abs(y) >= Math.abs(x) && Math.abs(y) >= Math.abs(z)) return y >= 0 ? "top" : "bottom";
|
|
14106
|
+
if (Math.abs(x) >= Math.abs(z)) return x >= 0 ? "right" : "left";
|
|
14107
|
+
return z < 0 ? "front" : "back";
|
|
14108
|
+
}
|
|
14109
|
+
function signedArea(outline2) {
|
|
14110
|
+
let sum = 0;
|
|
14111
|
+
for (let i = 0; i < outline2.length; i++) {
|
|
14112
|
+
const [x0, y0] = outline2[i];
|
|
14113
|
+
const [x1, y1] = outline2[(i + 1) % outline2.length];
|
|
14114
|
+
sum += x0 * y1 - x1 * y0;
|
|
14115
|
+
}
|
|
14116
|
+
return sum / 2;
|
|
14117
|
+
}
|
|
14118
|
+
function extrudeMesh(outline2, z0, z1, meta) {
|
|
14119
|
+
if (outline2.length < 3 || Math.abs(signedArea(outline2)) < 1e-6) return void 0;
|
|
14120
|
+
const ccw = signedArea(outline2) > 0 ? [...outline2] : [...outline2].reverse();
|
|
14121
|
+
const faces = [
|
|
14122
|
+
{ pts: ccw.map(([x, y]) => [x, y, z0]), normal: [0, 0, -1], kind: "front" },
|
|
14123
|
+
{ pts: ccw.map(([x, y]) => [x, y, z1]), normal: [0, 0, 1], kind: "back" }
|
|
14124
|
+
];
|
|
14125
|
+
for (let i = 0; i < ccw.length; i++) {
|
|
14126
|
+
const [ax, ay] = ccw[i];
|
|
14127
|
+
const [bx, by] = ccw[(i + 1) % ccw.length];
|
|
14128
|
+
const dx = bx - ax;
|
|
14129
|
+
const dy = by - ay;
|
|
14130
|
+
const len = Math.hypot(dx, dy);
|
|
14131
|
+
if (len < 1e-9) continue;
|
|
14132
|
+
const normal = [dy / len, -dx / len, 0];
|
|
14133
|
+
faces.push({
|
|
14134
|
+
pts: [
|
|
14135
|
+
[ax, ay, z0],
|
|
14136
|
+
[bx, by, z0],
|
|
14137
|
+
[bx, by, z1],
|
|
14138
|
+
[ax, ay, z1]
|
|
14139
|
+
],
|
|
14140
|
+
normal,
|
|
14141
|
+
kind: faceKind(normal)
|
|
14142
|
+
});
|
|
14143
|
+
}
|
|
14144
|
+
const xs = ccw.map((p) => p[0]);
|
|
14145
|
+
const ys = ccw.map((p) => p[1]);
|
|
14146
|
+
const center = [
|
|
14147
|
+
(Math.min(...xs) + Math.max(...xs)) / 2,
|
|
14148
|
+
(Math.min(...ys) + Math.max(...ys)) / 2,
|
|
14149
|
+
(z0 + z1) / 2
|
|
14150
|
+
];
|
|
14151
|
+
return { ...meta, center, faces };
|
|
14152
|
+
}
|
|
14153
|
+
function boxMesh(x0, x1, y0, y1, z0, z1, meta) {
|
|
14154
|
+
return extrudeMesh(
|
|
14155
|
+
[
|
|
14156
|
+
[Math.min(x0, x1), Math.min(y0, y1)],
|
|
14157
|
+
[Math.max(x0, x1), Math.min(y0, y1)],
|
|
14158
|
+
[Math.max(x0, x1), Math.max(y0, y1)],
|
|
14159
|
+
[Math.min(x0, x1), Math.max(y0, y1)]
|
|
14160
|
+
],
|
|
14161
|
+
Math.min(z0, z1),
|
|
14162
|
+
Math.max(z0, z1),
|
|
14163
|
+
meta
|
|
14164
|
+
);
|
|
14165
|
+
}
|
|
14166
|
+
|
|
14167
|
+
// chart/data-table-layout.ts
|
|
14168
|
+
function chartDataTableMetrics(fontSize, names, showKeys = true) {
|
|
14169
|
+
const rowH = Math.max(14, Math.round(fontSize * 1.45));
|
|
14170
|
+
const longestName = names.reduce((m, name) => Math.max(m, name.length), 0);
|
|
14171
|
+
const keyW = Math.min(160, Math.max(40, longestName * fontSize * 0.55 + (showKeys ? 24 : 8)));
|
|
14172
|
+
return { fontSize, rowH, keyW, height: rowH * (1 + names.length) };
|
|
14173
|
+
}
|
|
14174
|
+
|
|
13694
14175
|
// chart/render/chart-svg-util.ts
|
|
13695
14176
|
var TEXT_COLOR = "#595959";
|
|
13696
14177
|
var GRID_COLOR = "#D9D9D9";
|
|
@@ -13701,18 +14182,18 @@ function esc(text2) {
|
|
|
13701
14182
|
}
|
|
13702
14183
|
var n = (value) => String(Math.round(value * 100) / 100);
|
|
13703
14184
|
var textWidth = (text2, size = FONT_SIZE) => text2.length * size * 0.55;
|
|
13704
|
-
function text(x, y, content,
|
|
14185
|
+
function text(x, y, content, attrs2 = {}) {
|
|
13705
14186
|
const parts = [`x="${n(x)}"`, `y="${n(y)}"`];
|
|
13706
|
-
parts.push(`font-size="${
|
|
13707
|
-
parts.push(`fill="${esc(
|
|
13708
|
-
if (
|
|
13709
|
-
if (
|
|
13710
|
-
if (
|
|
13711
|
-
if (
|
|
13712
|
-
if (
|
|
13713
|
-
if (
|
|
13714
|
-
if (
|
|
13715
|
-
parts.push(`text-decoration="${
|
|
14187
|
+
parts.push(`font-size="${attrs2.size ?? FONT_SIZE}"`);
|
|
14188
|
+
parts.push(`fill="${esc(attrs2.fill ?? TEXT_COLOR)}"`);
|
|
14189
|
+
if (attrs2.anchor && attrs2.anchor !== "start") parts.push(`text-anchor="${attrs2.anchor}"`);
|
|
14190
|
+
if (attrs2.weight) parts.push(`font-weight="${attrs2.weight}"`);
|
|
14191
|
+
if (attrs2.baseline) parts.push(`dominant-baseline="${attrs2.baseline}"`);
|
|
14192
|
+
if (attrs2.family) parts.push(`font-family="${esc(attrs2.family)}"`);
|
|
14193
|
+
if (attrs2.filter) parts.push(`filter="${esc(attrs2.filter)}"`);
|
|
14194
|
+
if (attrs2.italic !== void 0) parts.push(`font-style="${attrs2.italic ? "italic" : "normal"}"`);
|
|
14195
|
+
if (attrs2.underline !== void 0)
|
|
14196
|
+
parts.push(`text-decoration="${attrs2.underline ? "underline" : "none"}"`);
|
|
13716
14197
|
return `<text ${parts.join(" ")}>${esc(content)}</text>`;
|
|
13717
14198
|
}
|
|
13718
14199
|
var line2 = (x1, y1, x2, y2, stroke, width = 1) => `<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" stroke="${stroke}" stroke-width="${width}"/>`;
|
|
@@ -13828,179 +14309,30 @@ function chartAreaRect(model, part, area) {
|
|
|
13828
14309
|
return `${defs}<rect x="${n(area.x)}" y="${n(area.y)}" width="${n(area.w)}" height="${n(area.h)}" fill="${esc(fill)}" stroke="${esc(stroke)}" stroke-width="${n(width)}" data-chart-part="${part}"/>`;
|
|
13829
14310
|
}
|
|
13830
14311
|
|
|
13831
|
-
// chart/render/chart-svg-
|
|
13832
|
-
|
|
13833
|
-
|
|
13834
|
-
|
|
13835
|
-
|
|
13836
|
-
const
|
|
13837
|
-
|
|
13838
|
-
|
|
13839
|
-
);
|
|
13840
|
-
const plot = { x: area.x + width, y: area.y, width: Math.max(1, area.w - width), height: area.h };
|
|
13841
|
-
const out = [
|
|
13842
|
-
chartAreaRect(model, "plotArea", { x: plot.x, y: plot.y, w: plot.width, h: plot.height })
|
|
13843
|
-
];
|
|
13844
|
-
for (const bar of computeFunnelGeometry(
|
|
13845
|
-
series.values.map((v) => v ?? 0),
|
|
13846
|
-
plot
|
|
13847
|
-
)) {
|
|
13848
|
-
const value = series.values[bar.index];
|
|
13849
|
-
if (value === null || value === void 0) continue;
|
|
13850
|
-
out.push(`<g data-chart-series="${series.sourceIndex ?? 0}" data-chart-point="${bar.index}">`);
|
|
13851
|
-
out.push(
|
|
13852
|
-
rect2(bar.x, bar.y, bar.width, bar.height, series.pointColors?.[bar.index] ?? series.color)
|
|
13853
|
-
);
|
|
13854
|
-
const size = Math.min(10, bar.height * 0.4);
|
|
13855
|
-
const label = series.labels?.[bar.index];
|
|
13856
|
-
if (label)
|
|
13857
|
-
out.push(
|
|
13858
|
-
text(bar.center, bar.y + bar.height / 2 + size * 0.35, label.text, {
|
|
13859
|
-
...chartTextAttributes(model, "dataLabel", size),
|
|
13860
|
-
size,
|
|
13861
|
-
anchor: "middle"
|
|
13862
|
-
})
|
|
13863
|
-
);
|
|
13864
|
-
out.push(
|
|
13865
|
-
text(
|
|
13866
|
-
plot.x - 8,
|
|
13867
|
-
bar.y + bar.height / 2 + (attrs.size ?? 10) * 0.35,
|
|
13868
|
-
fit(model.categories[bar.index] ?? "", width - 8, attrs.size ?? 10),
|
|
13869
|
-
{ ...attrs, anchor: "end" }
|
|
13870
|
-
)
|
|
13871
|
-
);
|
|
13872
|
-
out.push("</g>");
|
|
13873
|
-
}
|
|
13874
|
-
return out.join("");
|
|
13875
|
-
}
|
|
13876
|
-
|
|
13877
|
-
// chart/box-distribution.ts
|
|
13878
|
-
function boxWhiskerDistribution(values, method = "exclusive", trimOutliers = false) {
|
|
13879
|
-
const stats = computeBoxStats(values, method);
|
|
13880
|
-
if (!stats) return void 0;
|
|
13881
|
-
const iqr = stats.q3 - stats.q1;
|
|
13882
|
-
const lowerFence = stats.q1 - 1.5 * iqr;
|
|
13883
|
-
const upperFence = stats.q3 + 1.5 * iqr;
|
|
13884
|
-
const inliers = values.filter((v) => !trimOutliers || v >= lowerFence && v <= upperFence);
|
|
14312
|
+
// chart/render/chart-svg-labels.ts
|
|
14313
|
+
var GAP = 3;
|
|
14314
|
+
var LINE = 1.2;
|
|
14315
|
+
var NAMED_COLORS = /^(black|blue|cyan|green|magenta|red|white|yellow)$/iu;
|
|
14316
|
+
function measure(model, label) {
|
|
14317
|
+
const attrs2 = chartTextAttributes(model, "dataLabel", 10);
|
|
14318
|
+
const size = attrs2.size ?? 10;
|
|
14319
|
+
const lines = label.text.split("\n");
|
|
13885
14320
|
return {
|
|
13886
|
-
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
|
|
14321
|
+
...model.frameSize ? { frame: model.frameSize } : {},
|
|
14322
|
+
lines,
|
|
14323
|
+
size,
|
|
14324
|
+
w: Math.max(...lines.map((l) => textWidth(l, size))),
|
|
14325
|
+
h: lines.length * size * LINE,
|
|
14326
|
+
attrs: attrs2
|
|
13890
14327
|
};
|
|
13891
14328
|
}
|
|
13892
|
-
function
|
|
13893
|
-
|
|
13894
|
-
|
|
13895
|
-
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
13899
|
-
const slot = frame2.bandSize / Math.max(1, visible.length);
|
|
13900
|
-
const width = slot * 0.7;
|
|
13901
|
-
visible.forEach((series, si) => {
|
|
13902
|
-
if (series.hidden) return;
|
|
13903
|
-
const groups = groupRowsByCategory(series.boxCategories ?? []);
|
|
13904
|
-
model.categories.forEach((category, ci) => {
|
|
13905
|
-
const observations = (groups.rowIndexesByCategory.get(category) ?? []).flatMap((row2) => {
|
|
13906
|
-
const value = series.values[row2];
|
|
13907
|
-
return value === null || value === void 0 ? [] : [{ row: row2, value }];
|
|
13908
|
-
});
|
|
13909
|
-
const options2 = series.boxWhisker;
|
|
13910
|
-
const rawMethod = options2?.statistics?.quartileMethod;
|
|
13911
|
-
const method = rawMethod === "inclusive" ? "inclusive" : "exclusive";
|
|
13912
|
-
const visibility = options2?.visibility;
|
|
13913
|
-
const trim = rawMethod === "inclusive" || rawMethod === "exclusive" || !!visibility && Object.values(visibility).some((v) => v !== void 0);
|
|
13914
|
-
const distribution = boxWhiskerDistribution(
|
|
13915
|
-
observations.map((p) => p.value),
|
|
13916
|
-
method,
|
|
13917
|
-
trim
|
|
13918
|
-
);
|
|
13919
|
-
if (!distribution) return;
|
|
13920
|
-
const { stats, whiskerMin, whiskerMax, mean } = distribution;
|
|
13921
|
-
const x = frame2.band(ci) - frame2.bandSize / 2 + si * slot + (slot - width) / 2;
|
|
13922
|
-
const mid = x + width / 2;
|
|
13923
|
-
const y = frame2.value;
|
|
13924
|
-
out.push(
|
|
13925
|
-
`<g data-chart-part="box" data-chart-series="${series.sourceIndex ?? si}" data-chart-point="${ci}">`
|
|
13926
|
-
);
|
|
13927
|
-
out.push(line2(mid, y(whiskerMax), mid, y(stats.q3), "#64748b", 1));
|
|
13928
|
-
out.push(line2(mid, y(stats.q1), mid, y(whiskerMin), "#64748b", 1));
|
|
13929
|
-
out.push(
|
|
13930
|
-
line2(x + width * 0.25, y(whiskerMin), x + width * 0.75, y(whiskerMin), "#64748b", 1)
|
|
13931
|
-
);
|
|
13932
|
-
out.push(
|
|
13933
|
-
line2(x + width * 0.25, y(whiskerMax), x + width * 0.75, y(whiskerMax), "#64748b", 1)
|
|
13934
|
-
);
|
|
13935
|
-
out.push(
|
|
13936
|
-
rect2(
|
|
13937
|
-
x,
|
|
13938
|
-
Math.min(y(stats.q1), y(stats.q3)),
|
|
13939
|
-
width,
|
|
13940
|
-
Math.abs(y(stats.q1) - y(stats.q3)),
|
|
13941
|
-
series.pointColors?.[ci] ?? series.color
|
|
13942
|
-
)
|
|
13943
|
-
);
|
|
13944
|
-
out.push(line2(x, y(stats.median), x + width, y(stats.median), "#1e293b", 2));
|
|
13945
|
-
if (visibility?.meanLine) out.push(line2(x, y(mean), x + width, y(mean), "#0f766e", 1.5));
|
|
13946
|
-
if (visibility?.meanMarker !== false)
|
|
13947
|
-
out.push(
|
|
13948
|
-
`<path d="${boxMeanMarkerPath(mid, y(mean))}" fill="none" stroke="#0f766e" stroke-width="1.5" data-chart-part="mean"/>`
|
|
13949
|
-
);
|
|
13950
|
-
observations.forEach((point, index) => {
|
|
13951
|
-
const outlier = point.value < whiskerMin || point.value > whiskerMax;
|
|
13952
|
-
if (outlier ? !visibility?.outliers : !visibility?.nonoutliers) return;
|
|
13953
|
-
const px = x + width * (0.2 + 0.6 * (index + 1) / (observations.length + 1));
|
|
13954
|
-
out.push(
|
|
13955
|
-
`<circle cx="${n(px)}" cy="${n(y(point.value))}" r="2.25" fill="${outlier ? "#dc2626" : "#1e293b"}" data-chart-series="${series.sourceIndex ?? si}" data-chart-point="${point.row}" data-chart-part="${outlier ? "outlier" : "observation"}"/>`
|
|
13956
|
-
);
|
|
13957
|
-
});
|
|
13958
|
-
out.push("</g>");
|
|
13959
|
-
});
|
|
13960
|
-
});
|
|
13961
|
-
}
|
|
13962
|
-
|
|
13963
|
-
// chart/data-table-layout.ts
|
|
13964
|
-
function chartDataTableMetrics(fontSize, names, showKeys = true) {
|
|
13965
|
-
const rowH = Math.max(14, Math.round(fontSize * 1.45));
|
|
13966
|
-
const longestName = names.reduce((m, name) => Math.max(m, name.length), 0);
|
|
13967
|
-
const keyW = Math.min(160, Math.max(40, longestName * fontSize * 0.55 + (showKeys ? 24 : 8)));
|
|
13968
|
-
return { fontSize, rowH, keyW, height: rowH * (1 + names.length) };
|
|
13969
|
-
}
|
|
13970
|
-
|
|
13971
|
-
// chart/render/chart-spacing.ts
|
|
13972
|
-
function chartBarSpacing(chart) {
|
|
13973
|
-
const stacked = chart.grouping === "stacked" || chart.grouping === "percentStacked";
|
|
13974
|
-
return {
|
|
13975
|
-
barGapWidth: chart.barGapWidth ?? DEFAULT_BAR_GAP_WIDTH,
|
|
13976
|
-
barOverlap: chart.barOverlap ?? (stacked ? 100 : 0)
|
|
13977
|
-
};
|
|
13978
|
-
}
|
|
13979
|
-
|
|
13980
|
-
// chart/render/chart-svg-labels.ts
|
|
13981
|
-
var GAP = 3;
|
|
13982
|
-
var LINE = 1.2;
|
|
13983
|
-
var NAMED_COLORS = /^(black|blue|cyan|green|magenta|red|white|yellow)$/iu;
|
|
13984
|
-
function measure(model, label) {
|
|
13985
|
-
const attrs = chartTextAttributes(model, "dataLabel", 10);
|
|
13986
|
-
const size = attrs.size ?? 10;
|
|
13987
|
-
const lines = label.text.split("\n");
|
|
13988
|
-
return {
|
|
13989
|
-
...model.frameSize ? { frame: model.frameSize } : {},
|
|
13990
|
-
lines,
|
|
13991
|
-
size,
|
|
13992
|
-
w: Math.max(...lines.map((l) => textWidth(l, size))),
|
|
13993
|
-
h: lines.length * size * LINE,
|
|
13994
|
-
attrs
|
|
13995
|
-
};
|
|
13996
|
-
}
|
|
13997
|
-
function draw(m, label, x, y, anchor, out) {
|
|
13998
|
-
if (m.frame) ({ x, y } = applyLabelManualLayout(label.layout, m.frame, { x, y }));
|
|
13999
|
-
const fill = label.color && NAMED_COLORS.test(label.color) ? label.color.toLowerCase() : void 0;
|
|
14000
|
-
m.lines.forEach((line3, k) => {
|
|
14001
|
-
const lineY = y - m.h / 2 + (k + 0.5) * m.size * LINE + m.size * 0.35;
|
|
14002
|
-
out.push(text(x, lineY, line3, { ...m.attrs, ...fill ? { fill } : {}, anchor }));
|
|
14003
|
-
});
|
|
14329
|
+
function draw(m, label, x, y, anchor, out) {
|
|
14330
|
+
if (m.frame) ({ x, y } = applyLabelManualLayout(label.layout, m.frame, { x, y }));
|
|
14331
|
+
const fill = label.color && NAMED_COLORS.test(label.color) ? label.color.toLowerCase() : void 0;
|
|
14332
|
+
m.lines.forEach((line4, k) => {
|
|
14333
|
+
const lineY = y - m.h / 2 + (k + 0.5) * m.size * LINE + m.size * 0.35;
|
|
14334
|
+
out.push(text(x, lineY, line4, { ...m.attrs, ...fill ? { fill } : {}, anchor }));
|
|
14335
|
+
});
|
|
14004
14336
|
}
|
|
14005
14337
|
function barLabels(model, marks, out) {
|
|
14006
14338
|
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
@@ -14300,13 +14632,13 @@ function chartDataTableSvg(model, plot) {
|
|
|
14300
14632
|
const bottom = top + height;
|
|
14301
14633
|
const cellW = plot.w / Math.max(1, model.categories.length);
|
|
14302
14634
|
const styled = { ...model, appearance: { ...model.appearance, dataLabel: table.text ?? {} } };
|
|
14303
|
-
const
|
|
14635
|
+
const attrs2 = chartTextAttributes(styled, "dataLabel", fontSize);
|
|
14304
14636
|
const out = ['<g data-chart-part="dataTable">'];
|
|
14305
14637
|
const border2 = (x1, y1, x2, y2) => out.push(
|
|
14306
14638
|
`<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" ${strokeAttributes(table.stroke)}/>`
|
|
14307
14639
|
);
|
|
14308
14640
|
const label = (x, y, value, width, anchor = "middle") => out.push(
|
|
14309
|
-
text(x, y + fontSize * 0.35, fit(value, Math.max(1, width), fontSize), { ...
|
|
14641
|
+
text(x, y + fontSize * 0.35, fit(value, Math.max(1, width), fontSize), { ...attrs2, anchor })
|
|
14310
14642
|
);
|
|
14311
14643
|
if (table.fill) out.push(rect2(left, top, right - left, height, table.fill));
|
|
14312
14644
|
if (source.showOutline !== false) {
|
|
@@ -14558,8 +14890,8 @@ function chartDateAxis(model, plot, out) {
|
|
|
14558
14890
|
unit,
|
|
14559
14891
|
Math.max(1, axis.majorUnit ?? 1)
|
|
14560
14892
|
);
|
|
14561
|
-
const
|
|
14562
|
-
const size =
|
|
14893
|
+
const attrs2 = chartTextAttributes(model, "categoryAxis");
|
|
14894
|
+
const size = attrs2.size ?? 10;
|
|
14563
14895
|
const y = axis.position === "t" ? plot.y : plot.y + plot.h;
|
|
14564
14896
|
const paint2 = model.axes?.category?.line;
|
|
14565
14897
|
const stroke = { color: paint2?.color ?? "#BFBFBF", width: paint2?.width ?? 1 };
|
|
@@ -14591,13 +14923,13 @@ function chartDateAxis(model, plot, out) {
|
|
|
14591
14923
|
axis.numberFormat?.formatCode
|
|
14592
14924
|
);
|
|
14593
14925
|
if (model.horizontal)
|
|
14594
|
-
out.push(text(plot.x - 4, position(serial) + size * 0.3, label, { ...
|
|
14926
|
+
out.push(text(plot.x - 4, position(serial) + size * 0.3, label, { ...attrs2, anchor: "end" }));
|
|
14595
14927
|
else {
|
|
14596
14928
|
const above2 = axis.tickLabelPosition === "high" || axis.tickLabelPosition !== "low" && axis.position === "t";
|
|
14597
14929
|
const baseline = axis.tickLabelPosition === "high" ? plot.y : axis.tickLabelPosition === "low" ? plot.y + plot.h : y;
|
|
14598
14930
|
out.push(
|
|
14599
14931
|
text(position(serial), baseline + (above2 ? -4 : size + 3), label, {
|
|
14600
|
-
...
|
|
14932
|
+
...attrs2,
|
|
14601
14933
|
anchor: "middle"
|
|
14602
14934
|
})
|
|
14603
14935
|
);
|
|
@@ -14653,11 +14985,11 @@ function smoothSegment(points, i) {
|
|
|
14653
14985
|
function chartLineSvg(points, series) {
|
|
14654
14986
|
if (points.length < 2) return "";
|
|
14655
14987
|
const stroke = series.stroke;
|
|
14656
|
-
const
|
|
14988
|
+
const attrs2 = strokeAttributes(
|
|
14657
14989
|
stroke ? { ...stroke, color: stroke.color === "none" ? "none" : series.color } : { color: series.color, width: 2.25 }
|
|
14658
14990
|
);
|
|
14659
14991
|
const filter = series.shadowFilter ? ` filter="${series.shadowFilter}"` : "";
|
|
14660
|
-
return series.smooth ? `<path d="${smoothLinePath(points)}" fill="none" ${
|
|
14992
|
+
return series.smooth ? `<path d="${smoothLinePath(points)}" fill="none" ${attrs2} stroke-linejoin="round"${filter}/>` : `<polyline points="${points.map((p) => `${n(p.x)},${n(p.y)}`).join(" ")}" fill="none" ${attrs2} stroke-linejoin="round"${filter}/>`;
|
|
14661
14993
|
}
|
|
14662
14994
|
|
|
14663
14995
|
// chart/render/chart-svg-plot-layout.ts
|
|
@@ -14711,9 +15043,9 @@ function chartSeriesMarkerSvg(series, index, cx, cy, defaultRadius = 3) {
|
|
|
14711
15043
|
geometry = `points="${esc(primitive.points)}"`;
|
|
14712
15044
|
break;
|
|
14713
15045
|
}
|
|
14714
|
-
const
|
|
15046
|
+
const outline2 = primitive.stroke ? ` stroke="${esc(primitive.stroke)}" stroke-width="${n(primitive.strokeWidth ?? 1)}"` : "";
|
|
14715
15047
|
const filter = series.shadowFilter ? ` filter="${esc(series.shadowFilter)}"` : "";
|
|
14716
|
-
return `<${primitive.kind} ${geometry} fill="${esc(primitive.fill)}"${
|
|
15048
|
+
return `<${primitive.kind} ${geometry} fill="${esc(primitive.fill)}"${outline2}${filter}/>`;
|
|
14717
15049
|
}
|
|
14718
15050
|
|
|
14719
15051
|
// chart/line-dash.ts
|
|
@@ -14957,69 +15289,76 @@ function applyChartAxes(model, chart, color) {
|
|
|
14957
15289
|
model.axes = out;
|
|
14958
15290
|
}
|
|
14959
15291
|
|
|
14960
|
-
// chart/
|
|
14961
|
-
function
|
|
14962
|
-
|
|
14963
|
-
|
|
14964
|
-
|
|
14965
|
-
|
|
14966
|
-
|
|
14967
|
-
|
|
14968
|
-
|
|
14969
|
-
|
|
14970
|
-
|
|
14971
|
-
|
|
14972
|
-
const
|
|
14973
|
-
|
|
14974
|
-
const
|
|
14975
|
-
|
|
14976
|
-
if (
|
|
14977
|
-
|
|
14978
|
-
|
|
14979
|
-
|
|
14980
|
-
|
|
14981
|
-
|
|
14982
|
-
|
|
14983
|
-
|
|
14984
|
-
|
|
14985
|
-
|
|
14986
|
-
|
|
14987
|
-
|
|
14988
|
-
|
|
14989
|
-
|
|
14990
|
-
|
|
14991
|
-
|
|
14992
|
-
|
|
14993
|
-
|
|
14994
|
-
|
|
14995
|
-
|
|
14996
|
-
|
|
14997
|
-
|
|
14998
|
-
|
|
14999
|
-
|
|
15000
|
-
|
|
15001
|
-
|
|
15292
|
+
// chart/region-map/value-color-positions.ts
|
|
15293
|
+
function schemaPosition(node, end) {
|
|
15294
|
+
for (const kind of ["number", "percent"]) {
|
|
15295
|
+
const element = first(node, kind, NS.cx), raw = element?.getAttribute("val");
|
|
15296
|
+
const value = raw === null || raw === void 0 || raw === "" ? NaN : Number(raw);
|
|
15297
|
+
if (Number.isFinite(value)) return { kind, value };
|
|
15298
|
+
}
|
|
15299
|
+
return end === "mid" ? { kind: "percent", value: 50 } : { kind: end };
|
|
15300
|
+
}
|
|
15301
|
+
function parseRegionValueColorPositions(xml) {
|
|
15302
|
+
if (!xml) return void 0;
|
|
15303
|
+
const root = parseXml(`<cx:root xmlns:cx="${NS.cx}">${xml}</cx:root>`).documentElement;
|
|
15304
|
+
const positions = first(root, "valueColorPositions", NS.cx);
|
|
15305
|
+
if (!positions) return void 0;
|
|
15306
|
+
const count = positions.getAttribute("count");
|
|
15307
|
+
const native = ["min", "mid", "max"].some((key) => first(positions, key, NS.cx));
|
|
15308
|
+
if (native || count !== null && children(positions, "pos", NS.cx).length === 0) {
|
|
15309
|
+
const keys = count === "3" || first(positions, "mid", NS.cx) ? ["min", "mid", "max"] : ["min", "max"];
|
|
15310
|
+
return keys.map((key) => schemaPosition(first(positions, key, NS.cx), key));
|
|
15311
|
+
}
|
|
15312
|
+
const legacy = children(positions, "pos", NS.cx).flatMap(
|
|
15313
|
+
(element) => {
|
|
15314
|
+
const type = element.getAttribute("type");
|
|
15315
|
+
if (type === "min" || type === "max") return [{ kind: type }];
|
|
15316
|
+
if (type !== "num" && type !== "percent") return [];
|
|
15317
|
+
const raw = element.getAttribute("val"), value = raw === null || raw === "" ? NaN : Number(raw);
|
|
15318
|
+
return [
|
|
15319
|
+
{ kind: type === "num" ? "number" : type, ...Number.isFinite(value) ? { value } : {} }
|
|
15320
|
+
];
|
|
15321
|
+
}
|
|
15322
|
+
);
|
|
15323
|
+
return legacy.length ? legacy : void 0;
|
|
15324
|
+
}
|
|
15325
|
+
|
|
15326
|
+
// chart/region-map/value-colors.ts
|
|
15327
|
+
function resolveRegionValueColors(options2, color) {
|
|
15328
|
+
const result = { ...options2 };
|
|
15329
|
+
const xml = `<cx:root xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">${options2.valueColorsXml ?? ""}${options2.valueColorPositionsXml ?? ""}</cx:root>`;
|
|
15330
|
+
const root = parseXml(xml).documentElement;
|
|
15331
|
+
if (options2.valueColorsXml) {
|
|
15332
|
+
const colors = Array.from(root.getElementsByTagName("*")).flatMap((node) => {
|
|
15333
|
+
const c = color(parseDrawingColorIn(node));
|
|
15334
|
+
return c ? [c] : [];
|
|
15335
|
+
});
|
|
15336
|
+
if (colors.length) result.valueColors = colors;
|
|
15337
|
+
}
|
|
15338
|
+
const positions = parseRegionValueColorPositions(options2.valueColorPositionsXml);
|
|
15339
|
+
if (positions) result.valueColorPositions = positions;
|
|
15340
|
+
return result;
|
|
15002
15341
|
}
|
|
15003
15342
|
|
|
15004
15343
|
// chart/render/chart-view-analysis.ts
|
|
15005
|
-
function strokeOf(
|
|
15006
|
-
if (
|
|
15007
|
-
const color = (
|
|
15008
|
-
const width =
|
|
15009
|
-
const dash =
|
|
15344
|
+
function strokeOf(line4, fallback, resolve) {
|
|
15345
|
+
if (line4?.fill?.kind === "none") return void 0;
|
|
15346
|
+
const color = (line4?.fill?.kind === "solid" ? resolve(line4.fill.color) : void 0) ?? fallback.color;
|
|
15347
|
+
const width = line4?.widthEmu === void 0 ? fallback.width : chartPointsToPixels(line4.widthEmu / 12700);
|
|
15348
|
+
const dash = line4?.dash ?? fallback.dash;
|
|
15010
15349
|
return { color, width, ...dash && dash !== "solid" ? { dash } : {} };
|
|
15011
15350
|
}
|
|
15012
15351
|
function analysisView(source, seriesColor, resolve) {
|
|
15013
15352
|
const plain2 = seriesColor === "none" || seriesColor.startsWith("url(") ? TEXT_COLOR : seriesColor;
|
|
15014
15353
|
const trendlines2 = (source.trendlines ?? []).flatMap((entry) => {
|
|
15015
|
-
const { name: _name, line:
|
|
15354
|
+
const { name: _name, line: line4, ...fit2 } = entry;
|
|
15016
15355
|
const fallback = { color: plain2, width: chartPointsToPixels(1.5), dash: "sysDot" };
|
|
15017
|
-
const stroke = strokeOf(
|
|
15356
|
+
const stroke = strokeOf(line4, fallback, resolve);
|
|
15018
15357
|
return stroke ? [{ fit: fit2, stroke }] : [];
|
|
15019
15358
|
});
|
|
15020
15359
|
const errorBars = (source.errorBars ?? []).flatMap((entry) => {
|
|
15021
|
-
const { direction, barType, noEndCap, line:
|
|
15022
|
-
const stroke = strokeOf(
|
|
15360
|
+
const { direction, barType, noEndCap, line: line4, ...amount } = entry;
|
|
15361
|
+
const stroke = strokeOf(line4, { color: TEXT_COLOR, width: chartPointsToPixels(0.75) }, resolve);
|
|
15023
15362
|
return stroke ? [{ direction, barType, amount, endCap: noEndCap !== true, stroke }] : [];
|
|
15024
15363
|
});
|
|
15025
15364
|
return {
|
|
@@ -15203,10 +15542,10 @@ function paintOf(fill, ctx) {
|
|
|
15203
15542
|
return fill?.kind === "solid" ? ctx.drawingColor(fill.color) : void 0;
|
|
15204
15543
|
}
|
|
15205
15544
|
function lineOf(shape, ctx, color) {
|
|
15206
|
-
const
|
|
15545
|
+
const line4 = shape?.line;
|
|
15207
15546
|
return {
|
|
15208
|
-
color: paintOf(
|
|
15209
|
-
width:
|
|
15547
|
+
color: paintOf(line4?.fill, ctx) ?? color,
|
|
15548
|
+
width: line4?.widthEmu === void 0 ? 1 : Math.max(0.5, line4.widthEmu / EMU_PER_PX)
|
|
15210
15549
|
};
|
|
15211
15550
|
}
|
|
15212
15551
|
function barOf(shape, ctx, fallback) {
|
|
@@ -15442,6 +15781,7 @@ var SUPPORTED = /* @__PURE__ */ new Set([
|
|
|
15442
15781
|
"treemap",
|
|
15443
15782
|
"sunburst",
|
|
15444
15783
|
"funnel",
|
|
15784
|
+
"regionMap",
|
|
15445
15785
|
"boxWhisker"
|
|
15446
15786
|
]);
|
|
15447
15787
|
function chartSummaryView(chart, theme, options2 = {}) {
|
|
@@ -15502,8 +15842,14 @@ function chartSummaryView(chart, theme, options2 = {}) {
|
|
|
15502
15842
|
categories,
|
|
15503
15843
|
series: type === "boxWhisker" ? series.filter((s) => !s.hidden) : series,
|
|
15504
15844
|
horizontal: type === "bar",
|
|
15505
|
-
supported: SUPPORTED.has(type)
|
|
15845
|
+
supported: SUPPORTED.has(type) || type === "surface" && chart.view3D !== void 0
|
|
15506
15846
|
};
|
|
15847
|
+
if (chart.view3D) model.view3D = chart.view3D;
|
|
15848
|
+
if (chart.funnelGapWidth !== void 0) model.funnelGapWidth = chart.funnelGapWidth;
|
|
15849
|
+
if (chart.series[0]?.regionMap)
|
|
15850
|
+
model.regionMap = resolveRegionValueColors(chart.series[0].regionMap, ctx.drawingColor);
|
|
15851
|
+
if (model.regionMap && chart.series[0]?.fill?.kind === "solid" && series[0])
|
|
15852
|
+
model.regionMap.fixedColor = series[0].color;
|
|
15507
15853
|
const table = chartDataTableView(chart, theme, ctx.drawingColor);
|
|
15508
15854
|
if (table) model.dataTable = table;
|
|
15509
15855
|
if (chart.date1904 !== void 0) model.date1904 = chart.date1904;
|
|
@@ -15629,131 +15975,1539 @@ function cartesianAxes(model, area, out, size) {
|
|
|
15629
15975
|
const zero = value(Math.min(Math.max(crossing, scale.min), scale.max));
|
|
15630
15976
|
if (horizontal)
|
|
15631
15977
|
out.push(
|
|
15632
|
-
axisLine(model, model.axes?.category, "categoryAxis", zero, plot.y, zero, plot.y + plot.h)
|
|
15978
|
+
axisLine(model, model.axes?.category, "categoryAxis", zero, plot.y, zero, plot.y + plot.h)
|
|
15979
|
+
);
|
|
15980
|
+
else
|
|
15981
|
+
out.push(
|
|
15982
|
+
axisLine(model, model.axes?.category, "categoryAxis", plot.x, zero, plot.x + plot.w, zero)
|
|
15983
|
+
);
|
|
15984
|
+
out.push(...dateMarkup);
|
|
15985
|
+
const step = Math.max(
|
|
15986
|
+
1,
|
|
15987
|
+
Math.ceil(cats / Math.max(1, Math.floor((horizontal ? plot.h : plot.w) / 14)))
|
|
15988
|
+
);
|
|
15989
|
+
model.categories.forEach((c, i) => {
|
|
15990
|
+
if (dates || !categoryLabels || i % step !== 0) return;
|
|
15991
|
+
const p = band(i);
|
|
15992
|
+
if (horizontal)
|
|
15993
|
+
out.push(
|
|
15994
|
+
text(plot.x - 4, p + categorySize * 0.3, fit(c, catW - 6, categorySize), {
|
|
15995
|
+
anchor: "end",
|
|
15996
|
+
...categoryAttrs
|
|
15997
|
+
})
|
|
15998
|
+
);
|
|
15999
|
+
else
|
|
16000
|
+
out.push(
|
|
16001
|
+
text(p, plot.y + plot.h + categorySize + 3, fit(c, bandSize * step, categorySize), {
|
|
16002
|
+
anchor: "middle",
|
|
16003
|
+
...categoryAttrs
|
|
16004
|
+
})
|
|
16005
|
+
);
|
|
16006
|
+
});
|
|
16007
|
+
const frame2 = { plot, value, band, bandSize, ...dates ? { order: dates.order } : {} };
|
|
16008
|
+
if (second) {
|
|
16009
|
+
frame2.secondary = (v) => plot.y + plot.h - chartAxisRatio(v, second, model.axes?.secondary) * plot.h;
|
|
16010
|
+
out.push(
|
|
16011
|
+
axisLine(
|
|
16012
|
+
model,
|
|
16013
|
+
model.axes?.secondary,
|
|
16014
|
+
"valueAxis",
|
|
16015
|
+
plot.x + plot.w,
|
|
16016
|
+
plot.y,
|
|
16017
|
+
plot.x + plot.w,
|
|
16018
|
+
plot.y + plot.h
|
|
16019
|
+
)
|
|
16020
|
+
);
|
|
16021
|
+
if (model.axes?.secondary?.source.majorGridlines || model.axes?.secondary?.source.minorGridlines)
|
|
16022
|
+
out.push(
|
|
16023
|
+
axisGridlines(model, model.axes.secondary, second.ticks, frame2.secondary, plot, false)
|
|
16024
|
+
);
|
|
16025
|
+
if (chartAxisLabels(model.axes?.secondary))
|
|
16026
|
+
second.ticks.forEach(
|
|
16027
|
+
(t, i) => out.push(
|
|
16028
|
+
text(plot.x + plot.w + 4, frame2.secondary(t) + valueSize * 0.3, secondLabels[i] ?? "", {
|
|
16029
|
+
anchor: "start",
|
|
16030
|
+
...valueAttrs
|
|
16031
|
+
})
|
|
16032
|
+
)
|
|
16033
|
+
);
|
|
16034
|
+
}
|
|
16035
|
+
return frame2;
|
|
16036
|
+
}
|
|
16037
|
+
function plotted(model) {
|
|
16038
|
+
if (model.grouping !== "percentStacked") return model.series.map((s) => s.values);
|
|
16039
|
+
const totals = categoryTotals(model);
|
|
16040
|
+
return model.series.map(
|
|
16041
|
+
(s) => s.values.map((v, i) => v === null ? null : v / (totals[i] || 1))
|
|
16042
|
+
);
|
|
16043
|
+
}
|
|
16044
|
+
function linesAndAreas(model, frame2, out) {
|
|
16045
|
+
const values = plotted(model);
|
|
16046
|
+
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
16047
|
+
const acc = new Array(model.categories.length).fill(0);
|
|
16048
|
+
const area = model.type === "area";
|
|
16049
|
+
const marks = [];
|
|
16050
|
+
const layers = [];
|
|
16051
|
+
model.series.forEach((s, si) => {
|
|
16052
|
+
const points = [];
|
|
16053
|
+
const lower = [];
|
|
16054
|
+
(frame2.order ?? model.categories.map((_, i) => i)).forEach((i) => {
|
|
16055
|
+
const v = values[si]?.[i] ?? null;
|
|
16056
|
+
if (v === null && !area) {
|
|
16057
|
+
points.push([NaN, NaN]);
|
|
16058
|
+
return;
|
|
16059
|
+
}
|
|
16060
|
+
const below2 = stacked ? acc[i] ?? 0 : 0;
|
|
16061
|
+
const top = below2 + (v ?? 0);
|
|
16062
|
+
if (stacked) acc[i] = top;
|
|
16063
|
+
points.push([frame2.band(i), frame2.value(top)]);
|
|
16064
|
+
marks.push({
|
|
16065
|
+
series: s,
|
|
16066
|
+
index: i,
|
|
16067
|
+
x: frame2.band(i),
|
|
16068
|
+
y: frame2.value(top),
|
|
16069
|
+
radius: area ? 0 : chartMarkerRadius(s, i, 2.5)
|
|
16070
|
+
});
|
|
16071
|
+
lower.push([frame2.band(i), frame2.value(below2)]);
|
|
16072
|
+
});
|
|
16073
|
+
layers.push({
|
|
16074
|
+
series: s,
|
|
16075
|
+
points,
|
|
16076
|
+
lower,
|
|
16077
|
+
color: s.color,
|
|
16078
|
+
filter: s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""
|
|
16079
|
+
});
|
|
16080
|
+
});
|
|
16081
|
+
for (const { points, lower, color, filter, series } of area ? [...layers].reverse() : layers) {
|
|
16082
|
+
if (area) {
|
|
16083
|
+
const poly = [...points, ...[...lower].reverse()].map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
16084
|
+
out.push(`<polygon points="${poly}" fill="${color}" fill-opacity="0.85"${filter}/>`);
|
|
16085
|
+
continue;
|
|
16086
|
+
}
|
|
16087
|
+
let segment2 = [];
|
|
16088
|
+
const flush = () => {
|
|
16089
|
+
out.push(chartLineSvg(segment2, series));
|
|
16090
|
+
segment2 = [];
|
|
16091
|
+
};
|
|
16092
|
+
for (const [x, y] of points) {
|
|
16093
|
+
if (Number.isNaN(x)) flush();
|
|
16094
|
+
else segment2.push({ x, y });
|
|
16095
|
+
}
|
|
16096
|
+
flush();
|
|
16097
|
+
points.forEach(([x, y], index) => {
|
|
16098
|
+
if (!Number.isNaN(x))
|
|
16099
|
+
out.push(chartSeriesMarkerSvg(series, frame2.order?.[index] ?? index, x, y, 2.5));
|
|
16100
|
+
});
|
|
16101
|
+
}
|
|
16102
|
+
pointLabels(model, marks, out);
|
|
16103
|
+
}
|
|
16104
|
+
|
|
16105
|
+
// chart/render/chart-3d-marks.ts
|
|
16106
|
+
var RIBBON_THICKNESS = 0.025;
|
|
16107
|
+
var stackedOf = (model) => model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
16108
|
+
function chart3DBarMeshes(model, layout) {
|
|
16109
|
+
const bars2 = layout.bars;
|
|
16110
|
+
if (!bars2) return [];
|
|
16111
|
+
const values = plotted(model);
|
|
16112
|
+
const stacked = stackedOf(model);
|
|
16113
|
+
const clustered = model.grouping === "clustered";
|
|
16114
|
+
const inDepth = chart3DSeriesInDepth(model);
|
|
16115
|
+
const pos = new Array(model.categories.length).fill(0);
|
|
16116
|
+
const neg = new Array(model.categories.length).fill(0);
|
|
16117
|
+
const base = layout.value(0);
|
|
16118
|
+
const meshes = [];
|
|
16119
|
+
model.series.forEach((s, si) => {
|
|
16120
|
+
const slot = clustered ? si : 0;
|
|
16121
|
+
const [z0, z1] = layout.rowZ(inDepth ? si : 0);
|
|
16122
|
+
values[si]?.forEach((v, i) => {
|
|
16123
|
+
if (v === null || i >= model.categories.length) return;
|
|
16124
|
+
let from = 0;
|
|
16125
|
+
let to = v;
|
|
16126
|
+
if (stacked) {
|
|
16127
|
+
const acc = v >= 0 ? pos : neg;
|
|
16128
|
+
from = acc[i] ?? 0;
|
|
16129
|
+
to = from + v;
|
|
16130
|
+
acc[i] = to;
|
|
16131
|
+
}
|
|
16132
|
+
const a = stacked ? layout.value(from) : base;
|
|
16133
|
+
const b = layout.value(to);
|
|
16134
|
+
const centre = (i + 0.5) * layout.band;
|
|
16135
|
+
const meta = {
|
|
16136
|
+
series: s.sourceIndex ?? si,
|
|
16137
|
+
point: i,
|
|
16138
|
+
color: s.pointColors?.[i] ?? s.color
|
|
16139
|
+
};
|
|
16140
|
+
const mesh = layout.horizontal ? boxMesh(
|
|
16141
|
+
a,
|
|
16142
|
+
b,
|
|
16143
|
+
centre - (bars2.clusterWidth / 2 - bars2.singleBarWidth - slot * bars2.step) - bars2.singleBarWidth,
|
|
16144
|
+
centre - (bars2.clusterWidth / 2 - bars2.singleBarWidth - slot * bars2.step),
|
|
16145
|
+
z0,
|
|
16146
|
+
z1,
|
|
16147
|
+
meta
|
|
16148
|
+
) : boxMesh(
|
|
16149
|
+
centre - bars2.clusterWidth / 2 + slot * bars2.step,
|
|
16150
|
+
centre - bars2.clusterWidth / 2 + slot * bars2.step + bars2.singleBarWidth,
|
|
16151
|
+
a,
|
|
16152
|
+
b,
|
|
16153
|
+
z0,
|
|
16154
|
+
z1,
|
|
16155
|
+
meta
|
|
16156
|
+
);
|
|
16157
|
+
if (mesh) meshes.push(mesh);
|
|
16158
|
+
});
|
|
16159
|
+
});
|
|
16160
|
+
return meshes;
|
|
16161
|
+
}
|
|
16162
|
+
function chart3DLineMeshes(model, layout) {
|
|
16163
|
+
const values = plotted(model);
|
|
16164
|
+
const stacked = stackedOf(model);
|
|
16165
|
+
const inDepth = chart3DSeriesInDepth(model);
|
|
16166
|
+
const thick = layout.valueLength * RIBBON_THICKNESS;
|
|
16167
|
+
const acc = new Array(model.categories.length).fill(0);
|
|
16168
|
+
const meshes = [];
|
|
16169
|
+
model.series.forEach((s, si) => {
|
|
16170
|
+
const [z0, z1] = layout.rowZ(inDepth ? si : 0);
|
|
16171
|
+
const pts = (values[si] ?? []).map((v, i) => {
|
|
16172
|
+
if (v === null || i >= model.categories.length) return null;
|
|
16173
|
+
const top = stacked ? acc[i] = (acc[i] ?? 0) + v : v;
|
|
16174
|
+
return [(i + 0.5) * layout.band, layout.value(top)];
|
|
16175
|
+
});
|
|
16176
|
+
for (let i = 0; i + 1 < pts.length; i++) {
|
|
16177
|
+
const p = pts[i];
|
|
16178
|
+
const q = pts[i + 1];
|
|
16179
|
+
if (!p || !q) continue;
|
|
16180
|
+
const mesh = extrudeMesh([p, q, [q[0], q[1] - thick], [p[0], p[1] - thick]], z0, z1, {
|
|
16181
|
+
series: s.sourceIndex ?? si,
|
|
16182
|
+
point: i,
|
|
16183
|
+
color: s.color
|
|
16184
|
+
});
|
|
16185
|
+
if (mesh) meshes.push(mesh);
|
|
16186
|
+
}
|
|
16187
|
+
});
|
|
16188
|
+
return meshes;
|
|
16189
|
+
}
|
|
16190
|
+
function chart3DAreaMeshes(model, layout) {
|
|
16191
|
+
const values = plotted(model);
|
|
16192
|
+
const stacked = stackedOf(model);
|
|
16193
|
+
const inDepth = chart3DSeriesInDepth(model);
|
|
16194
|
+
const cats = model.categories.length;
|
|
16195
|
+
const x = (i) => cats > 1 ? i / (cats - 1) * layout.catLength : layout.catLength / 2;
|
|
16196
|
+
const base = layout.value(0);
|
|
16197
|
+
const acc = new Array(cats).fill(0);
|
|
16198
|
+
const meshes = [];
|
|
16199
|
+
model.series.forEach((s, si) => {
|
|
16200
|
+
const [z0, z1] = layout.rowZ(inDepth ? si : 0);
|
|
16201
|
+
const upper = [];
|
|
16202
|
+
const lower = [];
|
|
16203
|
+
for (let i = 0; i < cats; i++) {
|
|
16204
|
+
const v = values[si]?.[i] ?? 0;
|
|
16205
|
+
const below2 = stacked ? acc[i] ?? 0 : 0;
|
|
16206
|
+
if (stacked) acc[i] = below2 + v;
|
|
16207
|
+
upper.push([x(i), layout.value(below2 + v)]);
|
|
16208
|
+
lower.push([x(i), stacked ? layout.value(below2) : base]);
|
|
16209
|
+
}
|
|
16210
|
+
const mesh = extrudeMesh([...upper, ...lower.reverse()], z0, z1, {
|
|
16211
|
+
series: s.sourceIndex ?? si,
|
|
16212
|
+
point: 0,
|
|
16213
|
+
color: s.color
|
|
16214
|
+
});
|
|
16215
|
+
if (mesh) meshes.push(mesh);
|
|
16216
|
+
});
|
|
16217
|
+
return meshes;
|
|
16218
|
+
}
|
|
16219
|
+
|
|
16220
|
+
// chart/render/chart-3d-projection.ts
|
|
16221
|
+
var DEFAULT_ROT_X = 15;
|
|
16222
|
+
var DEFAULT_ROT_Y = 20;
|
|
16223
|
+
var DEFAULT_PIE_ROT_X = 30;
|
|
16224
|
+
var DEFAULT_PIE_ROT_Y = 0;
|
|
16225
|
+
var DEFAULT_PERSPECTIVE_DEG = 30;
|
|
16226
|
+
var PERSPECTIVE_MAX_DEG = 120;
|
|
16227
|
+
var FOV_MIN = 15;
|
|
16228
|
+
var FOV_MAX = 75;
|
|
16229
|
+
var clamp2 = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
16230
|
+
function resolvePerspectiveFov(perspectiveDeg) {
|
|
16231
|
+
const perspective = clamp2(perspectiveDeg ?? DEFAULT_PERSPECTIVE_DEG, 0, PERSPECTIVE_MAX_DEG);
|
|
16232
|
+
return FOV_MIN + perspective / PERSPECTIVE_MAX_DEG * (FOV_MAX - FOV_MIN);
|
|
16233
|
+
}
|
|
16234
|
+
function resolveChart3DProjection(chartType, view3D) {
|
|
16235
|
+
const isPie = chartType === "pie3D";
|
|
16236
|
+
const rotXDeg = view3D?.rotX ?? (isPie ? DEFAULT_PIE_ROT_X : DEFAULT_ROT_X);
|
|
16237
|
+
const rotYDeg = view3D?.rotY ?? (isPie ? DEFAULT_PIE_ROT_Y : DEFAULT_ROT_Y);
|
|
16238
|
+
const rAngAx = view3D?.rAngAx ?? chartType === "bar3D";
|
|
16239
|
+
if (rAngAx) {
|
|
16240
|
+
const rx = rotXDeg * Math.PI / 180;
|
|
16241
|
+
const ry = rotYDeg * Math.PI / 180;
|
|
16242
|
+
return { mode: "oblique", shearX: Math.sin(ry), shearY: -Math.sin(rx), rotXDeg, rotYDeg };
|
|
16243
|
+
}
|
|
16244
|
+
return {
|
|
16245
|
+
mode: "perspective",
|
|
16246
|
+
rotXDeg,
|
|
16247
|
+
rotYDeg,
|
|
16248
|
+
fovDeg: resolvePerspectiveFov(view3D?.perspective)
|
|
16249
|
+
};
|
|
16250
|
+
}
|
|
16251
|
+
|
|
16252
|
+
// chart/render/chart-3d-shading.ts
|
|
16253
|
+
var FACE_SHADE_AMOUNT = {
|
|
16254
|
+
front: 0,
|
|
16255
|
+
top: 0.25,
|
|
16256
|
+
right: 0.36,
|
|
16257
|
+
left: 0.36,
|
|
16258
|
+
back: 0.36,
|
|
16259
|
+
bottom: 0.5
|
|
16260
|
+
};
|
|
16261
|
+
var HEX = /^#[0-9a-f]{6}$/i;
|
|
16262
|
+
function shadeChart3DFace(baseColor, face) {
|
|
16263
|
+
const amount = FACE_SHADE_AMOUNT[face];
|
|
16264
|
+
return amount === 0 || !HEX.test(baseColor) ? baseColor : shade(baseColor, amount);
|
|
16265
|
+
}
|
|
16266
|
+
|
|
16267
|
+
// chart/render/chart-3d-pie.ts
|
|
16268
|
+
var STEP = Math.PI / 45;
|
|
16269
|
+
function chart3DPieGeometry(area, view) {
|
|
16270
|
+
const tilt = resolveChart3DProjection("pie3D", view).rotXDeg;
|
|
16271
|
+
const sin = Math.min(1, Math.max(0.08, Math.sin(Math.abs(tilt) * Math.PI / 180)));
|
|
16272
|
+
const cos = Math.cos(Math.min(90, Math.abs(tilt)) * Math.PI / 180);
|
|
16273
|
+
const depth = Math.min(2e3, Math.max(20, view.depthPercent ?? 100)) / 100;
|
|
16274
|
+
const rx0 = Math.max(1, Math.min(area.w / 2, area.h / 2 / sin) - 4);
|
|
16275
|
+
const thickness = rx0 * 0.35 * cos * depth;
|
|
16276
|
+
const rx = Math.min(rx0, Math.max(1, (area.h - thickness) / 2 / sin));
|
|
16277
|
+
const ry = rx * sin;
|
|
16278
|
+
const thick = Math.min(thickness, Math.max(0, area.h - ry * 2));
|
|
16279
|
+
return {
|
|
16280
|
+
cx: area.x + area.w / 2,
|
|
16281
|
+
cy: area.y + (area.h - thick) / 2 + ry,
|
|
16282
|
+
rx,
|
|
16283
|
+
ry,
|
|
16284
|
+
thickness: thick
|
|
16285
|
+
};
|
|
16286
|
+
}
|
|
16287
|
+
var pt = (g, a, dy) => `${n(g.cx + g.rx * Math.cos(a))},${n(g.cy + g.ry * Math.sin(a) + dy)}`;
|
|
16288
|
+
function frontRanges(a0, a1) {
|
|
16289
|
+
const out = [];
|
|
16290
|
+
for (let k = Math.floor(a0 / (2 * Math.PI)) - 1; k <= Math.ceil(a1 / (2 * Math.PI)); k++) {
|
|
16291
|
+
const lo = Math.max(a0, k * 2 * Math.PI);
|
|
16292
|
+
const hi = Math.min(a1, k * 2 * Math.PI + Math.PI);
|
|
16293
|
+
if (hi - lo > 1e-6) out.push([lo, hi]);
|
|
16294
|
+
}
|
|
16295
|
+
return out;
|
|
16296
|
+
}
|
|
16297
|
+
function chart3DPieSvg(model, area, view) {
|
|
16298
|
+
const series = model.series[0];
|
|
16299
|
+
if (!series) return "";
|
|
16300
|
+
const total = series.values.reduce((sum, v) => sum + (v !== null && v > 0 ? v : 0), 0);
|
|
16301
|
+
if (total <= 0) return "";
|
|
16302
|
+
const g = chart3DPieGeometry(area, view);
|
|
16303
|
+
const walls = [];
|
|
16304
|
+
const tops = [];
|
|
16305
|
+
let angle = -Math.PI / 2;
|
|
16306
|
+
series.values.forEach((v, i) => {
|
|
16307
|
+
if (v === null || v <= 0) return;
|
|
16308
|
+
const sweep = v / total * Math.PI * 2;
|
|
16309
|
+
const a0 = angle;
|
|
16310
|
+
const a1 = angle + sweep;
|
|
16311
|
+
angle = a1;
|
|
16312
|
+
const color = series.pointColors?.[i] ?? series.color;
|
|
16313
|
+
const wall = shadeChart3DFace(color, "right");
|
|
16314
|
+
const top = color;
|
|
16315
|
+
const filter = series.shadowFilter ? ` filter="${series.shadowFilter}"` : "";
|
|
16316
|
+
for (const [lo, hi] of frontRanges(a0, a1)) {
|
|
16317
|
+
const steps = Math.max(2, Math.ceil((hi - lo) / STEP));
|
|
16318
|
+
const upper = [];
|
|
16319
|
+
const lower = [];
|
|
16320
|
+
for (let s = 0; s <= steps; s++) {
|
|
16321
|
+
const a = lo + (hi - lo) * s / steps;
|
|
16322
|
+
upper.push(pt(g, a, 0));
|
|
16323
|
+
lower.push(pt(g, a, g.thickness));
|
|
16324
|
+
}
|
|
16325
|
+
walls.push(
|
|
16326
|
+
`<polygon points="${[...upper, ...lower.reverse()].join(" ")}" fill="${wall}" stroke="${wall}" stroke-width="0.5" data-chart-series="0" data-chart-point="${i}"${filter}/>`
|
|
16327
|
+
);
|
|
16328
|
+
}
|
|
16329
|
+
const full = sweep >= Math.PI * 2 - 1e-6;
|
|
16330
|
+
const start = pt(g, a0, 0);
|
|
16331
|
+
const end = pt(g, a1, 0);
|
|
16332
|
+
const d = full ? `M${pt(g, a0, 0)} A${n(g.rx)},${n(g.ry)} 0 1 1 ${pt(g, a0 + Math.PI, 0)} A${n(g.rx)},${n(g.ry)} 0 1 1 ${start} Z` : `M${n(g.cx)},${n(g.cy)} L${start} A${n(g.rx)},${n(g.ry)} 0 ${sweep > Math.PI ? 1 : 0} 1 ${end} Z`;
|
|
16333
|
+
tops.push(
|
|
16334
|
+
`<path d="${d}" fill="${top}" stroke="#FFFFFF" stroke-width="1" data-chart-series="0" data-chart-point="${i}"${filter}/>`
|
|
16335
|
+
);
|
|
16336
|
+
});
|
|
16337
|
+
return walls.join("") + tops.join("");
|
|
16338
|
+
}
|
|
16339
|
+
|
|
16340
|
+
// chart/render/chart-3d-scene.ts
|
|
16341
|
+
var centroid = (pts) => {
|
|
16342
|
+
const sum = pts.reduce(
|
|
16343
|
+
(acc, p) => [acc[0] + p[0], acc[1] + p[1], acc[2] + p[2]],
|
|
16344
|
+
[0, 0, 0]
|
|
16345
|
+
);
|
|
16346
|
+
return [sum[0] / pts.length, sum[1] / pts.length, sum[2] / pts.length];
|
|
16347
|
+
};
|
|
16348
|
+
function chart3DFaceVisible(camera, face) {
|
|
16349
|
+
if (!face.normal) return true;
|
|
16350
|
+
const d = camera.viewDir(centroid(face.pts));
|
|
16351
|
+
return face.normal[0] * d[0] + face.normal[1] * d[1] + face.normal[2] * d[2] < 0;
|
|
16352
|
+
}
|
|
16353
|
+
function chart3DPolygon(camera, pts, fill, extra = "") {
|
|
16354
|
+
const points = pts.map((p) => {
|
|
16355
|
+
const q = camera.project(p);
|
|
16356
|
+
return `${n(q.x)},${n(q.y)}`;
|
|
16357
|
+
}).join(" ");
|
|
16358
|
+
return `<polygon points="${points}" fill="${fill}" stroke="${fill}" stroke-width="0.5" stroke-linejoin="round"${extra}/>`;
|
|
16359
|
+
}
|
|
16360
|
+
function chart3DMeshesSvg(camera, meshes) {
|
|
16361
|
+
const out = [];
|
|
16362
|
+
const ordered = [...meshes].sort((a, b) => camera.order(a.center, b.center));
|
|
16363
|
+
for (const mesh of ordered) {
|
|
16364
|
+
const faces = mesh.faces.filter((face) => chart3DFaceVisible(camera, face)).map((face) => ({ face, depth: camera.project(centroid(face.pts)).depth })).sort((a, b) => b.depth - a.depth);
|
|
16365
|
+
if (!faces.length) continue;
|
|
16366
|
+
out.push(`<g data-chart-series="${mesh.series}" data-chart-point="${mesh.point}">`);
|
|
16367
|
+
for (const { face } of faces)
|
|
16368
|
+
out.push(
|
|
16369
|
+
chart3DPolygon(camera, face.pts, face.fill ?? shadeChart3DFace(mesh.color, face.kind))
|
|
16370
|
+
);
|
|
16371
|
+
out.push("</g>");
|
|
16372
|
+
}
|
|
16373
|
+
return out.join("");
|
|
16374
|
+
}
|
|
16375
|
+
|
|
16376
|
+
// chart/render/chart-3d-surface.ts
|
|
16377
|
+
var LIGHT = (() => {
|
|
16378
|
+
const v = [-0.3, 0.8, -0.5];
|
|
16379
|
+
const len = Math.hypot(...v);
|
|
16380
|
+
return [v[0] / len, v[1] / len, v[2] / len];
|
|
16381
|
+
})();
|
|
16382
|
+
var HEX2 = /^#[0-9a-f]{6}$/i;
|
|
16383
|
+
var BAND_FALLBACK = ["#4472C4", "#ED7D31", "#A5A5A5", "#FFC000", "#5B9BD5", "#70AD47"];
|
|
16384
|
+
function chart3DSurfaceMeshes(model, layout) {
|
|
16385
|
+
const cols = model.categories.length;
|
|
16386
|
+
const rows2 = model.series.length;
|
|
16387
|
+
const scale = model.valueAxis;
|
|
16388
|
+
if (cols < 2 || rows2 < 1 || !scale) return [];
|
|
16389
|
+
const zRows = rows2 === 1 ? 2 : rows2;
|
|
16390
|
+
const height = (r, c) => layout.value(model.series[Math.min(r, rows2 - 1)]?.values[c] ?? 0);
|
|
16391
|
+
const x = (c) => c / (cols - 1) * layout.catLength;
|
|
16392
|
+
const z = (r) => r / (zRows - 1) * layout.size.d;
|
|
16393
|
+
const meshes = [];
|
|
16394
|
+
for (let r = 0; r + 1 < zRows; r++)
|
|
16395
|
+
for (let c = 0; c + 1 < cols; c++) {
|
|
16396
|
+
const pts = [
|
|
16397
|
+
[x(c), height(r, c), z(r)],
|
|
16398
|
+
[x(c + 1), height(r, c + 1), z(r)],
|
|
16399
|
+
[x(c + 1), height(r + 1, c + 1), z(r + 1)],
|
|
16400
|
+
[x(c), height(r + 1, c), z(r + 1)]
|
|
16401
|
+
];
|
|
16402
|
+
const avg = pts.reduce((sum, p) => sum + p[1], 0) / 4;
|
|
16403
|
+
const band = Math.max(
|
|
16404
|
+
0,
|
|
16405
|
+
Math.min(
|
|
16406
|
+
Math.max(0, scale.ticks.length - 2),
|
|
16407
|
+
Math.floor(avg / layout.valueLength * Math.max(1, scale.ticks.length - 1))
|
|
16408
|
+
)
|
|
16409
|
+
);
|
|
16410
|
+
const color = model.series[band % rows2]?.color && HEX2.test(model.series[band % rows2].color) ? model.series[band % rows2].color : BAND_FALLBACK[band % BAND_FALLBACK.length] ?? "#4472C4";
|
|
16411
|
+
const [a, b, , d] = pts;
|
|
16412
|
+
const e1 = [b[0] - a[0], b[1] - a[1], b[2] - a[2]];
|
|
16413
|
+
const e2 = [d[0] - a[0], d[1] - a[1], d[2] - a[2]];
|
|
16414
|
+
const nx = e1[1] * e2[2] - e1[2] * e2[1];
|
|
16415
|
+
const ny = e1[2] * e2[0] - e1[0] * e2[2];
|
|
16416
|
+
const nz = e1[0] * e2[1] - e1[1] * e2[0];
|
|
16417
|
+
const len = Math.hypot(nx, ny, nz) || 1;
|
|
16418
|
+
const lit = Math.abs((nx * LIGHT[0] + ny * LIGHT[1] + nz * LIGHT[2]) / len);
|
|
16419
|
+
meshes.push({
|
|
16420
|
+
series: Math.min(r, rows2 - 1),
|
|
16421
|
+
point: c,
|
|
16422
|
+
color,
|
|
16423
|
+
center: [(a[0] + b[0]) / 2, avg, (a[2] + d[2]) / 2],
|
|
16424
|
+
faces: [{ pts, normal: void 0, kind: "top", fill: shade(color, 0.35 * (1 - lit)) }]
|
|
16425
|
+
});
|
|
16426
|
+
}
|
|
16427
|
+
return meshes;
|
|
16428
|
+
}
|
|
16429
|
+
|
|
16430
|
+
// chart/render/chart-3d-walls.ts
|
|
16431
|
+
var LABEL_SIZE = 10;
|
|
16432
|
+
function line3(camera, a, b, color) {
|
|
16433
|
+
const p = camera.project(a);
|
|
16434
|
+
const q = camera.project(b);
|
|
16435
|
+
return `<line x1="${n(p.x)}" y1="${n(p.y)}" x2="${n(q.x)}" y2="${n(q.y)}" stroke="${color}" stroke-width="1"/>`;
|
|
16436
|
+
}
|
|
16437
|
+
function outline(camera, pts, fill) {
|
|
16438
|
+
const points = pts.map((p) => {
|
|
16439
|
+
const q = camera.project(p);
|
|
16440
|
+
return `${n(q.x)},${n(q.y)}`;
|
|
16441
|
+
}).join(" ");
|
|
16442
|
+
return `<polygon points="${points}" fill="${fill}" stroke="${AXIS_COLOR}" stroke-width="1"/>`;
|
|
16443
|
+
}
|
|
16444
|
+
function chart3DLabelMargins(model) {
|
|
16445
|
+
const scale = model.valueAxis;
|
|
16446
|
+
const value = scale ? Math.max(
|
|
16447
|
+
...scale.ticks.map(
|
|
16448
|
+
(t) => textWidth(axisTickText(t, model.axes?.value, scale.percent), LABEL_SIZE)
|
|
16449
|
+
),
|
|
16450
|
+
8
|
|
16451
|
+
) + 6 : 8;
|
|
16452
|
+
const category = Math.max(...model.categories.map((c) => textWidth(c, LABEL_SIZE)), 8) + 6;
|
|
16453
|
+
return model.horizontal ? { left: Math.min(category, 120), bottom: LABEL_SIZE + 8 } : { left: Math.min(value, 80), bottom: LABEL_SIZE + 8 };
|
|
16454
|
+
}
|
|
16455
|
+
function chart3DWallsSvg(model, layout, camera) {
|
|
16456
|
+
const { w, h, d } = layout.size;
|
|
16457
|
+
const sx = camera.sideWallAtZero ? 0 : w;
|
|
16458
|
+
const out = [];
|
|
16459
|
+
out.push(
|
|
16460
|
+
outline(
|
|
16461
|
+
camera,
|
|
16462
|
+
[
|
|
16463
|
+
[0, 0, 0],
|
|
16464
|
+
[w, 0, 0],
|
|
16465
|
+
[w, 0, d],
|
|
16466
|
+
[0, 0, d]
|
|
16467
|
+
],
|
|
16468
|
+
"#F2F2F2"
|
|
16469
|
+
)
|
|
16470
|
+
);
|
|
16471
|
+
out.push(
|
|
16472
|
+
outline(
|
|
16473
|
+
camera,
|
|
16474
|
+
[
|
|
16475
|
+
[0, 0, d],
|
|
16476
|
+
[w, 0, d],
|
|
16477
|
+
[w, h, d],
|
|
16478
|
+
[0, h, d]
|
|
16479
|
+
],
|
|
16480
|
+
"none"
|
|
16481
|
+
)
|
|
16482
|
+
);
|
|
16483
|
+
out.push(
|
|
16484
|
+
outline(
|
|
16485
|
+
camera,
|
|
16486
|
+
[
|
|
16487
|
+
[sx, 0, 0],
|
|
16488
|
+
[sx, 0, d],
|
|
16489
|
+
[sx, h, d],
|
|
16490
|
+
[sx, h, 0]
|
|
16491
|
+
],
|
|
16492
|
+
"none"
|
|
16493
|
+
)
|
|
16494
|
+
);
|
|
16495
|
+
for (const tick of model.valueAxis?.ticks ?? []) {
|
|
16496
|
+
const p = layout.value(tick);
|
|
16497
|
+
if (layout.horizontal) {
|
|
16498
|
+
out.push(line3(camera, [p, 0, d], [p, h, d], GRID_COLOR));
|
|
16499
|
+
out.push(line3(camera, [p, 0, 0], [p, 0, d], GRID_COLOR));
|
|
16500
|
+
} else {
|
|
16501
|
+
out.push(line3(camera, [0, p, d], [w, p, d], GRID_COLOR));
|
|
16502
|
+
out.push(line3(camera, [sx, p, 0], [sx, p, d], GRID_COLOR));
|
|
16503
|
+
}
|
|
16504
|
+
}
|
|
16505
|
+
return out.join("");
|
|
16506
|
+
}
|
|
16507
|
+
function chart3DLabelsSvg(model, layout, camera, catPos) {
|
|
16508
|
+
const { w } = layout.size;
|
|
16509
|
+
const sx = camera.sideWallAtZero ? 0 : w;
|
|
16510
|
+
const scale = model.valueAxis;
|
|
16511
|
+
const out = [];
|
|
16512
|
+
const anchor = sx === 0 ? "end" : "start";
|
|
16513
|
+
const dx = sx === 0 ? -4 : 4;
|
|
16514
|
+
for (const tick of scale?.ticks ?? []) {
|
|
16515
|
+
const label = axisTickText(tick, model.axes?.value, scale?.percent ?? false);
|
|
16516
|
+
const p = layout.value(tick);
|
|
16517
|
+
if (layout.horizontal) {
|
|
16518
|
+
const q = camera.project([p, 0, 0]);
|
|
16519
|
+
out.push(text(q.x, q.y + LABEL_SIZE + 3, label, { anchor: "middle", size: LABEL_SIZE }));
|
|
16520
|
+
} else {
|
|
16521
|
+
const q = camera.project([sx, p, 0]);
|
|
16522
|
+
out.push(text(q.x + dx, q.y + 3, label, { anchor, size: LABEL_SIZE }));
|
|
16523
|
+
}
|
|
16524
|
+
}
|
|
16525
|
+
const a = camera.project([0, 0, 0]);
|
|
16526
|
+
const b = camera.project(layout.horizontal ? [0, layout.band, 0] : [layout.band, 0, 0]);
|
|
16527
|
+
const bandPx = Math.max(1, layout.horizontal ? Math.abs(b.y - a.y) : Math.abs(b.x - a.x));
|
|
16528
|
+
const extent = layout.horizontal ? LABEL_SIZE + 2 : Math.max(...model.categories.map((c) => textWidth(c, LABEL_SIZE)), 1);
|
|
16529
|
+
const stride = Math.max(1, Math.ceil(extent / bandPx));
|
|
16530
|
+
model.categories.forEach((label, i) => {
|
|
16531
|
+
if (i % stride) return;
|
|
16532
|
+
if (layout.horizontal) {
|
|
16533
|
+
const q = camera.project([sx, catPos(i), 0]);
|
|
16534
|
+
out.push(text(q.x + dx, q.y + 3, label, { anchor, size: LABEL_SIZE }));
|
|
16535
|
+
} else {
|
|
16536
|
+
const q = camera.project([catPos(i), 0, 0]);
|
|
16537
|
+
out.push(text(q.x, q.y + LABEL_SIZE + 3, label, { anchor: "middle", size: LABEL_SIZE }));
|
|
16538
|
+
}
|
|
16539
|
+
});
|
|
16540
|
+
return out.join("");
|
|
16541
|
+
}
|
|
16542
|
+
|
|
16543
|
+
// chart/render/chart-3d-svg.ts
|
|
16544
|
+
var PROJECTION_TYPE = {
|
|
16545
|
+
bar: "bar3D",
|
|
16546
|
+
column: "bar3D",
|
|
16547
|
+
line: "line3D",
|
|
16548
|
+
area: "area3D",
|
|
16549
|
+
pie: "pie3D",
|
|
16550
|
+
surface: "surface"
|
|
16551
|
+
};
|
|
16552
|
+
function chart3DApplies(model) {
|
|
16553
|
+
return model.view3D !== void 0 && PROJECTION_TYPE[model.type] !== void 0;
|
|
16554
|
+
}
|
|
16555
|
+
function chart3DSvg(model, area) {
|
|
16556
|
+
const view = model.view3D ?? {};
|
|
16557
|
+
if (model.type === "pie")
|
|
16558
|
+
return chartAreaRect(model, "plotArea", area) + chart3DPieSvg(model, area, view);
|
|
16559
|
+
const projection = resolveChart3DProjection(PROJECTION_TYPE[model.type] ?? "bar3D", view);
|
|
16560
|
+
const margins = chart3DLabelMargins(model);
|
|
16561
|
+
const inner = {
|
|
16562
|
+
x: area.x + margins.left,
|
|
16563
|
+
y: area.y + 6,
|
|
16564
|
+
w: Math.max(1, area.w - margins.left - 8),
|
|
16565
|
+
h: Math.max(1, area.h - margins.bottom - 10)
|
|
16566
|
+
};
|
|
16567
|
+
const layout = chart3DLayout(model, inner, view);
|
|
16568
|
+
const camera = createChart3DCamera(projection, layout.size, inner);
|
|
16569
|
+
let meshes;
|
|
16570
|
+
if (model.type === "surface") meshes = chart3DSurfaceMeshes(model, layout);
|
|
16571
|
+
else if (model.type === "line") meshes = chart3DLineMeshes(model, layout);
|
|
16572
|
+
else if (model.type === "area") meshes = chart3DAreaMeshes(model, layout);
|
|
16573
|
+
else meshes = chart3DBarMeshes(model, layout);
|
|
16574
|
+
const edge = model.type === "area" || model.type === "surface";
|
|
16575
|
+
const cats = model.categories.length;
|
|
16576
|
+
const catPos = edge ? (i) => cats > 1 ? i / (cats - 1) * layout.catLength : layout.catLength / 2 : (i) => (i + 0.5) * layout.band;
|
|
16577
|
+
return [
|
|
16578
|
+
chartAreaRect(model, "plotArea", area),
|
|
16579
|
+
chart3DWallsSvg(model, layout, camera),
|
|
16580
|
+
chart3DMeshesSvg(camera, meshes),
|
|
16581
|
+
chart3DLabelsSvg(model, layout, camera, catPos)
|
|
16582
|
+
].join("");
|
|
16583
|
+
}
|
|
16584
|
+
|
|
16585
|
+
// chart/region-map/alias.ts
|
|
16586
|
+
var REGION_ALIAS_MAP = {
|
|
16587
|
+
us: "US",
|
|
16588
|
+
usa: "US",
|
|
16589
|
+
"united states": "US",
|
|
16590
|
+
"united states of america": "US",
|
|
16591
|
+
ca: "CA",
|
|
16592
|
+
can: "CA",
|
|
16593
|
+
canada: "CA",
|
|
16594
|
+
br: "BR",
|
|
16595
|
+
bra: "BR",
|
|
16596
|
+
brazil: "BR",
|
|
16597
|
+
gb: "GB",
|
|
16598
|
+
gbr: "GB",
|
|
16599
|
+
uk: "GB",
|
|
16600
|
+
"united kingdom": "GB",
|
|
16601
|
+
fr: "FR",
|
|
16602
|
+
fra: "FR",
|
|
16603
|
+
france: "FR",
|
|
16604
|
+
de: "DE",
|
|
16605
|
+
deu: "DE",
|
|
16606
|
+
germany: "DE",
|
|
16607
|
+
it: "IT",
|
|
16608
|
+
ita: "IT",
|
|
16609
|
+
italy: "IT",
|
|
16610
|
+
es: "ES",
|
|
16611
|
+
esp: "ES",
|
|
16612
|
+
spain: "ES",
|
|
16613
|
+
ru: "RU",
|
|
16614
|
+
rus: "RU",
|
|
16615
|
+
russia: "RU",
|
|
16616
|
+
cn: "CN",
|
|
16617
|
+
chn: "CN",
|
|
16618
|
+
china: "CN",
|
|
16619
|
+
in: "IN",
|
|
16620
|
+
ind: "IN",
|
|
16621
|
+
india: "IN",
|
|
16622
|
+
jp: "JP",
|
|
16623
|
+
jpn: "JP",
|
|
16624
|
+
japan: "JP",
|
|
16625
|
+
kr: "KR",
|
|
16626
|
+
kor: "KR",
|
|
16627
|
+
"south korea": "KR",
|
|
16628
|
+
korea: "KR",
|
|
16629
|
+
au: "AU",
|
|
16630
|
+
aus: "AU",
|
|
16631
|
+
australia: "AU",
|
|
16632
|
+
mx: "MX",
|
|
16633
|
+
mex: "MX",
|
|
16634
|
+
mexico: "MX",
|
|
16635
|
+
id: "ID",
|
|
16636
|
+
idn: "ID",
|
|
16637
|
+
indonesia: "ID",
|
|
16638
|
+
tr: "TR",
|
|
16639
|
+
tur: "TR",
|
|
16640
|
+
turkey: "TR",
|
|
16641
|
+
sa: "SA",
|
|
16642
|
+
sau: "SA",
|
|
16643
|
+
"saudi arabia": "SA",
|
|
16644
|
+
za: "ZA",
|
|
16645
|
+
zaf: "ZA",
|
|
16646
|
+
"south africa": "ZA",
|
|
16647
|
+
ar: "AR",
|
|
16648
|
+
arg: "AR",
|
|
16649
|
+
argentina: "AR",
|
|
16650
|
+
ng: "NG",
|
|
16651
|
+
nga: "NG",
|
|
16652
|
+
nigeria: "NG",
|
|
16653
|
+
eg: "EG",
|
|
16654
|
+
egy: "EG",
|
|
16655
|
+
egypt: "EG"
|
|
16656
|
+
};
|
|
16657
|
+
function resolveRegionCode(label) {
|
|
16658
|
+
const normalized = label.trim().toLowerCase();
|
|
16659
|
+
return REGION_ALIAS_MAP[normalized];
|
|
16660
|
+
}
|
|
16661
|
+
|
|
16662
|
+
// chart/region-map/data.ts
|
|
16663
|
+
function sourceIndices(indices, length) {
|
|
16664
|
+
return Array.from({ length }, (_, position) => indices?.[position] ?? position);
|
|
16665
|
+
}
|
|
16666
|
+
function valueAtSource(values, indices, sourceIndex) {
|
|
16667
|
+
const position = indices.indexOf(sourceIndex);
|
|
16668
|
+
return position >= 0 ? values[position] : void 0;
|
|
16669
|
+
}
|
|
16670
|
+
function cachedEntityName(cache2, entityId) {
|
|
16671
|
+
if (!cache2 || typeof cache2 !== "object") {
|
|
16672
|
+
return void 0;
|
|
16673
|
+
}
|
|
16674
|
+
const record = cache2;
|
|
16675
|
+
if (String(record["@_entityId"] ?? "") === entityId && record["@_entityName"] !== void 0) {
|
|
16676
|
+
return String(record["@_entityName"]);
|
|
16677
|
+
}
|
|
16678
|
+
for (const value of Object.values(record)) {
|
|
16679
|
+
if (Array.isArray(value)) {
|
|
16680
|
+
for (const item of value) {
|
|
16681
|
+
const name = cachedEntityName(item, entityId);
|
|
16682
|
+
if (name) {
|
|
16683
|
+
return name;
|
|
16684
|
+
}
|
|
16685
|
+
}
|
|
16686
|
+
} else {
|
|
16687
|
+
const name = cachedEntityName(value, entityId);
|
|
16688
|
+
if (name) {
|
|
16689
|
+
return name;
|
|
16690
|
+
}
|
|
16691
|
+
}
|
|
16692
|
+
}
|
|
16693
|
+
return void 0;
|
|
16694
|
+
}
|
|
16695
|
+
function resolveRegionEntityCode(entityId, options2, resolveCode) {
|
|
16696
|
+
if (!entityId) {
|
|
16697
|
+
return void 0;
|
|
16698
|
+
}
|
|
16699
|
+
const direct = resolveCode(entityId);
|
|
16700
|
+
if (direct) {
|
|
16701
|
+
return direct;
|
|
16702
|
+
}
|
|
16703
|
+
const tokens = entityId.split(/[:/|._-]+/u).filter(Boolean);
|
|
16704
|
+
for (let index = tokens.length - 1; index >= 0; index--) {
|
|
16705
|
+
const resolved = resolveCode(tokens[index] ?? "");
|
|
16706
|
+
if (resolved) {
|
|
16707
|
+
return resolved;
|
|
16708
|
+
}
|
|
16709
|
+
}
|
|
16710
|
+
const cachedName = cachedEntityName(options2?.geographyCache, entityId);
|
|
16711
|
+
return cachedName ? resolveCode(cachedName) : void 0;
|
|
16712
|
+
}
|
|
16713
|
+
function buildRegionMapEntries(categories, values, options2, resolveCode) {
|
|
16714
|
+
const entityIds = options2?.entityIds ?? [];
|
|
16715
|
+
const categoryIndices = sourceIndices(options2?.categorySourceIndices, categories.length);
|
|
16716
|
+
const valueIndices = sourceIndices(options2?.valueSourceIndices, values.length);
|
|
16717
|
+
const entityIndices = sourceIndices(options2?.entityIdSourceIndices, entityIds.length);
|
|
16718
|
+
const indices = [.../* @__PURE__ */ new Set([...categoryIndices, ...valueIndices, ...entityIndices])].sort(
|
|
16719
|
+
(a, b) => a - b
|
|
16720
|
+
);
|
|
16721
|
+
return indices.flatMap((sourceIndex) => {
|
|
16722
|
+
const category = valueAtSource(categories, categoryIndices, sourceIndex) ?? "";
|
|
16723
|
+
const value = valueAtSource(values, valueIndices, sourceIndex);
|
|
16724
|
+
if (value === null || value === void 0 || !Number.isFinite(value)) return [];
|
|
16725
|
+
const entityId = valueAtSource(entityIds, entityIndices, sourceIndex);
|
|
16726
|
+
const code = resolveRegionEntityCode(entityId, options2, resolveCode) ?? resolveCode(category);
|
|
16727
|
+
return {
|
|
16728
|
+
sourceIndex,
|
|
16729
|
+
label: category || entityId || `Region ${sourceIndex + 1}`,
|
|
16730
|
+
value,
|
|
16731
|
+
...entityId ? { entityId } : {},
|
|
16732
|
+
...code ? { code } : {}
|
|
16733
|
+
};
|
|
16734
|
+
});
|
|
16735
|
+
}
|
|
16736
|
+
function shouldRenderRegionLabel(layout, projectedWidth, projectedHeight) {
|
|
16737
|
+
if (!layout || layout === "none") {
|
|
16738
|
+
return false;
|
|
16739
|
+
}
|
|
16740
|
+
if (layout === "bestFitOnly") {
|
|
16741
|
+
return projectedWidth >= 18 && projectedHeight >= 10;
|
|
16742
|
+
}
|
|
16743
|
+
return true;
|
|
16744
|
+
}
|
|
16745
|
+
function formatRegionMapValue(value, cultureLanguage) {
|
|
16746
|
+
if (!cultureLanguage) {
|
|
16747
|
+
return String(value);
|
|
16748
|
+
}
|
|
16749
|
+
try {
|
|
16750
|
+
return new Intl.NumberFormat(cultureLanguage, { maximumFractionDigits: 2 }).format(value);
|
|
16751
|
+
} catch {
|
|
16752
|
+
return String(value);
|
|
16753
|
+
}
|
|
16754
|
+
}
|
|
16755
|
+
function lerpColor(a, b, t) {
|
|
16756
|
+
const clamp3 = (v) => Math.max(0, Math.min(255, Math.round(v))), ha = a.replace("#", ""), hb = b.replace("#", ""), r1 = parseInt(ha.substring(0, 2), 16), g1 = parseInt(ha.substring(2, 4), 16), b1 = parseInt(ha.substring(4, 6), 16), r2 = parseInt(hb.substring(0, 2), 16), g2 = parseInt(hb.substring(2, 4), 16), b2 = parseInt(hb.substring(4, 6), 16), r = clamp3(r1 + (r2 - r1) * t), g = clamp3(g1 + (g2 - g1) * t), bl = clamp3(b1 + (b2 - b1) * t), toHex2 = (n2) => n2.toString(16).padStart(2, "0");
|
|
16757
|
+
return `#${toHex2(r)}${toHex2(g)}${toHex2(bl)}`;
|
|
16758
|
+
}
|
|
16759
|
+
function resolveValueColorStops(valueColors, valueColorPositions, minVal, maxVal) {
|
|
16760
|
+
if (!valueColors || valueColors.length < 2) {
|
|
16761
|
+
return void 0;
|
|
16762
|
+
}
|
|
16763
|
+
const span = maxVal - minVal || 1, count = valueColors.length, resolvePosition = (position, index) => {
|
|
16764
|
+
if (position?.kind === "min") {
|
|
16765
|
+
return 0;
|
|
16766
|
+
}
|
|
16767
|
+
if (position?.kind === "max") {
|
|
16768
|
+
return 1;
|
|
16769
|
+
}
|
|
16770
|
+
if (position?.kind === "number" && position.value !== void 0) {
|
|
16771
|
+
return Math.min(1, Math.max(0, (position.value - minVal) / span));
|
|
16772
|
+
}
|
|
16773
|
+
if (position?.kind === "percent" && position.value !== void 0) {
|
|
16774
|
+
return Math.min(1, Math.max(0, position.value / 100));
|
|
16775
|
+
}
|
|
16776
|
+
return count === 1 ? 0 : index / (count - 1);
|
|
16777
|
+
};
|
|
16778
|
+
return valueColors.map((color, index) => ({
|
|
16779
|
+
color,
|
|
16780
|
+
position: resolvePosition(valueColorPositions?.[index], index)
|
|
16781
|
+
}));
|
|
16782
|
+
}
|
|
16783
|
+
function buildValueColorScale(stops) {
|
|
16784
|
+
const sorted = [...stops].sort((a, b) => a.position - b.position);
|
|
16785
|
+
return (t) => {
|
|
16786
|
+
const clamped = Math.max(0, Math.min(1, t)), first3 = sorted[0];
|
|
16787
|
+
if (!first3) {
|
|
16788
|
+
return "#94a3b8";
|
|
16789
|
+
}
|
|
16790
|
+
if (sorted.length === 1) {
|
|
16791
|
+
return first3.color;
|
|
16792
|
+
}
|
|
16793
|
+
for (let i = 0; i < sorted.length - 1; i++) {
|
|
16794
|
+
const a = sorted[i], b = sorted[i + 1];
|
|
16795
|
+
if (clamped >= a.position && clamped <= b.position) {
|
|
16796
|
+
return lerpColor(
|
|
16797
|
+
a.color,
|
|
16798
|
+
b.color,
|
|
16799
|
+
(clamped - a.position) / (b.position - a.position || 1)
|
|
16800
|
+
);
|
|
16801
|
+
}
|
|
16802
|
+
}
|
|
16803
|
+
const last = sorted[sorted.length - 1] ?? first3;
|
|
16804
|
+
return clamped <= first3.position ? first3.color : last.color;
|
|
16805
|
+
};
|
|
16806
|
+
}
|
|
16807
|
+
|
|
16808
|
+
// chart/region-map/colors.ts
|
|
16809
|
+
function sequentialColorScale(t, accent) {
|
|
16810
|
+
const clamped = Math.max(0, Math.min(1, t));
|
|
16811
|
+
if (accent && /^#[0-9a-f]{6}$/iu.test(accent))
|
|
16812
|
+
return lerpColor(lerpColor("#ffffff", accent, 0.2), accent, clamped);
|
|
16813
|
+
if (clamped <= 0.5) {
|
|
16814
|
+
return lerpColor("#dbeafe", "#3b82f6", clamped * 2);
|
|
16815
|
+
}
|
|
16816
|
+
return lerpColor("#3b82f6", "#1e3a5f", (clamped - 0.5) * 2);
|
|
16817
|
+
}
|
|
16818
|
+
function normalizeValue(value, min, max) {
|
|
16819
|
+
if (max === min) {
|
|
16820
|
+
return 0.5;
|
|
16821
|
+
}
|
|
16822
|
+
return (value - min) / (max - min);
|
|
16823
|
+
}
|
|
16824
|
+
|
|
16825
|
+
// chart/region-map/world-regions.ts
|
|
16826
|
+
var WORLD_REGIONS = [
|
|
16827
|
+
{
|
|
16828
|
+
code: "US",
|
|
16829
|
+
name: "United States",
|
|
16830
|
+
path: "M130,160 L250,155 265,170 270,190 260,210 230,215 200,220 170,215 145,205 130,195Z M280,175 L295,165 310,170 310,185 295,195 280,190Z",
|
|
16831
|
+
labelXY: [200, 190]
|
|
16832
|
+
},
|
|
16833
|
+
{
|
|
16834
|
+
code: "CA",
|
|
16835
|
+
name: "Canada",
|
|
16836
|
+
path: "M120,90 L280,85 290,100 295,130 280,150 250,155 200,155 160,155 130,155 115,140 110,115Z",
|
|
16837
|
+
labelXY: [200, 125]
|
|
16838
|
+
},
|
|
16839
|
+
{
|
|
16840
|
+
code: "MX",
|
|
16841
|
+
name: "Mexico",
|
|
16842
|
+
path: "M145,215 L200,220 210,235 200,255 185,265 165,260 150,245 140,230Z",
|
|
16843
|
+
labelXY: [175, 240]
|
|
16844
|
+
},
|
|
16845
|
+
{
|
|
16846
|
+
code: "BR",
|
|
16847
|
+
name: "Brazil",
|
|
16848
|
+
path: "M270,300 L310,280 335,290 340,320 330,355 310,370 285,365 265,345 260,320Z",
|
|
16849
|
+
labelXY: [300, 330]
|
|
16850
|
+
},
|
|
16851
|
+
{
|
|
16852
|
+
code: "AR",
|
|
16853
|
+
name: "Argentina",
|
|
16854
|
+
path: "M260,370 L280,365 290,380 285,410 275,435 260,445 250,425 248,395Z",
|
|
16855
|
+
labelXY: [268, 410]
|
|
16856
|
+
},
|
|
16857
|
+
{
|
|
16858
|
+
code: "GB",
|
|
16859
|
+
name: "United Kingdom",
|
|
16860
|
+
path: "M440,120 L448,110 455,115 455,135 448,142 440,138Z",
|
|
16861
|
+
labelXY: [448, 128]
|
|
16862
|
+
},
|
|
16863
|
+
{
|
|
16864
|
+
code: "FR",
|
|
16865
|
+
name: "France",
|
|
16866
|
+
path: "M450,145 L470,140 480,150 478,168 465,175 450,170 445,158Z",
|
|
16867
|
+
labelXY: [463, 158]
|
|
16868
|
+
},
|
|
16869
|
+
{
|
|
16870
|
+
code: "DE",
|
|
16871
|
+
name: "Germany",
|
|
16872
|
+
path: "M478,125 L498,120 505,130 502,148 490,152 478,148 475,138Z",
|
|
16873
|
+
labelXY: [490, 138]
|
|
16874
|
+
},
|
|
16875
|
+
{
|
|
16876
|
+
code: "IT",
|
|
16877
|
+
name: "Italy",
|
|
16878
|
+
path: "M490,155 L498,152 505,162 500,180 492,190 488,178 486,165Z",
|
|
16879
|
+
labelXY: [495, 172]
|
|
16880
|
+
},
|
|
16881
|
+
{
|
|
16882
|
+
code: "ES",
|
|
16883
|
+
name: "Spain",
|
|
16884
|
+
path: "M432,168 L460,165 465,175 460,188 442,192 430,185 428,175Z",
|
|
16885
|
+
labelXY: [448, 180]
|
|
16886
|
+
},
|
|
16887
|
+
{
|
|
16888
|
+
code: "RU",
|
|
16889
|
+
name: "Russia",
|
|
16890
|
+
path: "M510,60 L780,50 830,70 840,100 820,120 750,115 700,105 650,100 580,105 530,110 510,100 505,80Z",
|
|
16891
|
+
labelXY: [670, 85]
|
|
16892
|
+
},
|
|
16893
|
+
{
|
|
16894
|
+
code: "TR",
|
|
16895
|
+
name: "Turkey",
|
|
16896
|
+
path: "M530,165 L570,160 585,170 580,182 555,185 530,180Z",
|
|
16897
|
+
labelXY: [558, 175]
|
|
16898
|
+
},
|
|
16899
|
+
{
|
|
16900
|
+
code: "EG",
|
|
16901
|
+
name: "Egypt",
|
|
16902
|
+
path: "M530,200 L555,195 565,205 560,225 545,230 530,222Z",
|
|
16903
|
+
labelXY: [548, 215]
|
|
16904
|
+
},
|
|
16905
|
+
{
|
|
16906
|
+
code: "NG",
|
|
16907
|
+
name: "Nigeria",
|
|
16908
|
+
path: "M475,275 L500,270 510,280 505,298 490,302 475,295Z",
|
|
16909
|
+
labelXY: [492, 288]
|
|
16910
|
+
},
|
|
16911
|
+
{
|
|
16912
|
+
code: "ZA",
|
|
16913
|
+
name: "South Africa",
|
|
16914
|
+
path: "M520,380 L545,370 560,380 555,400 540,410 520,405 515,392Z",
|
|
16915
|
+
labelXY: [538, 392]
|
|
16916
|
+
},
|
|
16917
|
+
{
|
|
16918
|
+
code: "SA",
|
|
16919
|
+
name: "Saudi Arabia",
|
|
16920
|
+
path: "M565,220 L600,210 615,225 610,250 590,258 570,250 560,238Z",
|
|
16921
|
+
labelXY: [590, 238]
|
|
16922
|
+
},
|
|
16923
|
+
{
|
|
16924
|
+
code: "IN",
|
|
16925
|
+
name: "India",
|
|
16926
|
+
path: "M640,210 L665,195 685,210 688,240 678,268 660,278 645,265 635,240Z",
|
|
16927
|
+
labelXY: [662, 240]
|
|
16928
|
+
},
|
|
16929
|
+
{
|
|
16930
|
+
code: "CN",
|
|
16931
|
+
name: "China",
|
|
16932
|
+
path: "M700,120 L775,115 800,130 805,160 790,180 760,185 730,180 710,168 695,150 690,135Z",
|
|
16933
|
+
labelXY: [750, 155]
|
|
16934
|
+
},
|
|
16935
|
+
{
|
|
16936
|
+
code: "JP",
|
|
16937
|
+
name: "Japan",
|
|
16938
|
+
path: "M835,145 L845,135 852,140 850,158 842,165 835,160Z",
|
|
16939
|
+
labelXY: [843, 152]
|
|
16940
|
+
},
|
|
16941
|
+
{
|
|
16942
|
+
code: "KR",
|
|
16943
|
+
name: "South Korea",
|
|
16944
|
+
path: "M815,158 L825,152 830,160 827,170 818,172 813,165Z",
|
|
16945
|
+
labelXY: [822, 163]
|
|
16946
|
+
},
|
|
16947
|
+
{
|
|
16948
|
+
code: "ID",
|
|
16949
|
+
name: "Indonesia",
|
|
16950
|
+
path: "M740,295 L780,288 810,292 830,298 825,310 790,312 755,308 740,305Z",
|
|
16951
|
+
labelXY: [785, 302]
|
|
16952
|
+
},
|
|
16953
|
+
{
|
|
16954
|
+
code: "AU",
|
|
16955
|
+
name: "Australia",
|
|
16956
|
+
path: "M790,350 L850,340 880,355 885,385 870,405 840,410 810,400 790,380Z",
|
|
16957
|
+
labelXY: [838, 378]
|
|
16958
|
+
}
|
|
16959
|
+
];
|
|
16960
|
+
|
|
16961
|
+
// chart/region-map/projection.ts
|
|
16962
|
+
function regionBounds(region) {
|
|
16963
|
+
const coordinates = region.path.match(/-?\d+(?:\.\d+)?/gu)?.map(Number) ?? [];
|
|
16964
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
16965
|
+
for (let index = 0; index < coordinates.length; index += 2) {
|
|
16966
|
+
const x = coordinates[index] ?? 0, y = coordinates[index + 1] ?? 0;
|
|
16967
|
+
minX = Math.min(minX, x);
|
|
16968
|
+
maxX = Math.max(maxX, x);
|
|
16969
|
+
minY = Math.min(minY, y);
|
|
16970
|
+
maxY = Math.max(maxY, y);
|
|
16971
|
+
}
|
|
16972
|
+
return { minX, minY, maxX, maxY };
|
|
16973
|
+
}
|
|
16974
|
+
function regionViewBounds(viewedRegionType, regionValues, regions = WORLD_REGIONS) {
|
|
16975
|
+
if (!viewedRegionType || viewedRegionType === "world" || regionValues.size === 0) {
|
|
16976
|
+
return { minX: 0, minY: 0, maxX: 1e3, maxY: 500 };
|
|
16977
|
+
}
|
|
16978
|
+
const matched = regions.filter((region) => regionValues.has(region.code));
|
|
16979
|
+
const targets = viewedRegionType === "countryRegion" ? matched.slice(0, 1) : matched;
|
|
16980
|
+
if (targets.length === 0) {
|
|
16981
|
+
return { minX: 0, minY: 0, maxX: 1e3, maxY: 500 };
|
|
16982
|
+
}
|
|
16983
|
+
const bounds = targets.map(regionBounds);
|
|
16984
|
+
const padding = 10;
|
|
16985
|
+
return {
|
|
16986
|
+
minX: Math.max(0, Math.min(...bounds.map((item) => item.minX)) - padding),
|
|
16987
|
+
minY: Math.max(0, Math.min(...bounds.map((item) => item.minY)) - padding),
|
|
16988
|
+
maxX: Math.min(1e3, Math.max(...bounds.map((item) => item.maxX)) + padding),
|
|
16989
|
+
maxY: Math.min(500, Math.max(...bounds.map((item) => item.maxY)) + padding)
|
|
16990
|
+
};
|
|
16991
|
+
}
|
|
16992
|
+
function scalePathD(d, scale, dx, dy) {
|
|
16993
|
+
const tokens = d.match(/[A-Za-z]|-?\d+(?:\.\d+)?/gu) ?? [];
|
|
16994
|
+
const out = [];
|
|
16995
|
+
let i = 0;
|
|
16996
|
+
while (i < tokens.length) {
|
|
16997
|
+
const tok = tokens[i];
|
|
16998
|
+
if (tok === void 0) {
|
|
16999
|
+
i++;
|
|
17000
|
+
continue;
|
|
17001
|
+
}
|
|
17002
|
+
if (/^[A-Za-z]$/u.test(tok)) {
|
|
17003
|
+
out.push(tok);
|
|
17004
|
+
i++;
|
|
17005
|
+
continue;
|
|
17006
|
+
}
|
|
17007
|
+
const xRaw = parseFloat(tok);
|
|
17008
|
+
const yRaw = parseFloat(tokens[i + 1] ?? "");
|
|
17009
|
+
if (!Number.isNaN(xRaw) && !Number.isNaN(yRaw)) {
|
|
17010
|
+
out.push(`${(xRaw * scale + dx).toFixed(2)},${(yRaw * scale + dy).toFixed(2)}`);
|
|
17011
|
+
i += 2;
|
|
17012
|
+
} else {
|
|
17013
|
+
out.push(tok);
|
|
17014
|
+
i++;
|
|
17015
|
+
}
|
|
17016
|
+
}
|
|
17017
|
+
return out.join(" ");
|
|
17018
|
+
}
|
|
17019
|
+
var CX = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
17020
|
+
var LIMIT = 16 * 1024 * 1024;
|
|
17021
|
+
var ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
|
|
17022
|
+
function decodeGeoRing(encoded, limit = 1e6) {
|
|
17023
|
+
const out = [];
|
|
17024
|
+
let lat = 0, lon = 0, number = 0, shift = 0;
|
|
17025
|
+
for (const ch of encoded) {
|
|
17026
|
+
const value = ALPHABET.indexOf(ch);
|
|
17027
|
+
if (value < 0 || shift > 50) return void 0;
|
|
17028
|
+
number += (value & 31) * 2 ** shift;
|
|
17029
|
+
if (!Number.isSafeInteger(number)) return void 0;
|
|
17030
|
+
if (value >= 32) {
|
|
17031
|
+
shift += 5;
|
|
17032
|
+
continue;
|
|
17033
|
+
}
|
|
17034
|
+
const diagonal = Math.floor((Math.sqrt(8 * number + 1) - 1) / 2);
|
|
17035
|
+
const a = number - diagonal * (diagonal + 1) / 2, b = diagonal - a;
|
|
17036
|
+
lat += a % 2 ? -(a + 1) / 2 : a / 2;
|
|
17037
|
+
lon += b % 2 ? -(b + 1) / 2 : b / 2;
|
|
17038
|
+
if (Math.abs(lat) > 9e6 || Math.abs(lon) > 54e6 || out.length >= limit) return void 0;
|
|
17039
|
+
out.push({ latitude: lat / 1e5, longitude: lon / 1e5 });
|
|
17040
|
+
number = 0;
|
|
17041
|
+
shift = 0;
|
|
17042
|
+
}
|
|
17043
|
+
return shift || out.length < 3 ? void 0 : out;
|
|
17044
|
+
}
|
|
17045
|
+
function elements2(root, name) {
|
|
17046
|
+
return Array.from(root.getElementsByTagNameNS(CX, name));
|
|
17047
|
+
}
|
|
17048
|
+
function inflateGeoCache(binary, maxOutputBytes = LIMIT) {
|
|
17049
|
+
if (!Number.isSafeInteger(maxOutputBytes) || maxOutputBytes < 1 || maxOutputBytes > LIMIT)
|
|
17050
|
+
throw new Error("Invalid geography cache output limit.");
|
|
17051
|
+
if (binary.length > 12 * 1024 * 1024) throw new Error("Geography cache input limit exceeded.");
|
|
17052
|
+
const bytes = Uint8Array.from(atob(binary.replace(/\s/gu, "")), (c) => c.charCodeAt(0));
|
|
17053
|
+
const chunks = [];
|
|
17054
|
+
let size = 0;
|
|
17055
|
+
const stream = new Inflate((chunk) => {
|
|
17056
|
+
size += chunk.length;
|
|
17057
|
+
if (size > maxOutputBytes) throw new Error("Geography cache output limit exceeded.");
|
|
17058
|
+
chunks.push(chunk);
|
|
17059
|
+
});
|
|
17060
|
+
for (let i = 0; i < bytes.length; i += 256)
|
|
17061
|
+
stream.push(bytes.subarray(i, i + 256), false);
|
|
17062
|
+
const out = new Uint8Array(size);
|
|
17063
|
+
let offset = 0;
|
|
17064
|
+
for (const chunk of chunks) {
|
|
17065
|
+
out.set(chunk, offset);
|
|
17066
|
+
offset += chunk.length;
|
|
17067
|
+
}
|
|
17068
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(out);
|
|
17069
|
+
}
|
|
17070
|
+
function readGeographyCache(xml, pointLimit = 1e6) {
|
|
17071
|
+
const result = { regions: [], issues: [] };
|
|
17072
|
+
if (!xml) return result;
|
|
17073
|
+
try {
|
|
17074
|
+
if (!Number.isSafeInteger(pointLimit) || pointLimit < 1 || pointLimit > 1e6)
|
|
17075
|
+
throw new Error("Invalid geography point limit.");
|
|
17076
|
+
if (xml.length > LIMIT) throw new Error("Geography cache input limit exceeded.");
|
|
17077
|
+
let root = parseXml(`<cx:root xmlns:cx="${CX}">${xml}</cx:root>`).documentElement;
|
|
17078
|
+
const binary = elements2(root, "binary")[0];
|
|
17079
|
+
if (binary) root = parseXml(inflateGeoCache(binary.textContent ?? "")).documentElement;
|
|
17080
|
+
let points = 0;
|
|
17081
|
+
for (const data of elements2(root, "geoData")) {
|
|
17082
|
+
const rings = [];
|
|
17083
|
+
for (const polygon of elements2(data, "geoPolygon")) {
|
|
17084
|
+
const parts = (polygon.getAttribute("pcaRings") ?? "").split(",");
|
|
17085
|
+
const version = Number(parts.shift());
|
|
17086
|
+
const expected = Number(polygon.getAttribute("numPoints"));
|
|
17087
|
+
if (version !== 1 || parts.length < 1 || !Number.isInteger(expected) || expected < 3) {
|
|
17088
|
+
result.issues.push("Invalid geography ring count.");
|
|
17089
|
+
continue;
|
|
17090
|
+
}
|
|
17091
|
+
const decoded = [];
|
|
17092
|
+
let polygonPoints2 = 0;
|
|
17093
|
+
for (const part of parts) {
|
|
17094
|
+
const ring = decodeGeoRing(
|
|
17095
|
+
part,
|
|
17096
|
+
Math.min(expected - polygonPoints2, pointLimit - points - polygonPoints2)
|
|
17097
|
+
);
|
|
17098
|
+
if (!ring) break;
|
|
17099
|
+
decoded.push(ring);
|
|
17100
|
+
polygonPoints2 += ring.length;
|
|
17101
|
+
}
|
|
17102
|
+
if (decoded.length !== parts.length) {
|
|
17103
|
+
result.issues.push("Invalid compressed geography polygon.");
|
|
17104
|
+
continue;
|
|
17105
|
+
}
|
|
17106
|
+
for (const ring of decoded) {
|
|
17107
|
+
rings.push(ring);
|
|
17108
|
+
points += ring.length;
|
|
17109
|
+
}
|
|
17110
|
+
}
|
|
17111
|
+
if (rings.length)
|
|
17112
|
+
result.regions.push({
|
|
17113
|
+
entityId: data.getAttribute("entityId") ?? "",
|
|
17114
|
+
name: data.getAttribute("entityName") ?? "",
|
|
17115
|
+
rings,
|
|
17116
|
+
copyright: elements2(data, "copyright").map((c) => c.textContent ?? "")
|
|
17117
|
+
});
|
|
17118
|
+
}
|
|
17119
|
+
} catch (error) {
|
|
17120
|
+
result.issues.push(error instanceof Error ? error.message : String(error));
|
|
17121
|
+
}
|
|
17122
|
+
return result;
|
|
17123
|
+
}
|
|
17124
|
+
|
|
17125
|
+
// chart/region-map/geographic-projection.ts
|
|
17126
|
+
var RAD = Math.PI / 180;
|
|
17127
|
+
var RX = [
|
|
17128
|
+
1,
|
|
17129
|
+
0.9986,
|
|
17130
|
+
0.9954,
|
|
17131
|
+
0.99,
|
|
17132
|
+
0.9822,
|
|
17133
|
+
0.973,
|
|
17134
|
+
0.96,
|
|
17135
|
+
0.9427,
|
|
17136
|
+
0.9216,
|
|
17137
|
+
0.8962,
|
|
17138
|
+
0.8679,
|
|
17139
|
+
0.835,
|
|
17140
|
+
0.7986,
|
|
17141
|
+
0.7597,
|
|
17142
|
+
0.7186,
|
|
17143
|
+
0.6732,
|
|
17144
|
+
0.6213,
|
|
17145
|
+
0.5722,
|
|
17146
|
+
0.5322
|
|
17147
|
+
];
|
|
17148
|
+
var RY = [
|
|
17149
|
+
0,
|
|
17150
|
+
0.062,
|
|
17151
|
+
0.124,
|
|
17152
|
+
0.186,
|
|
17153
|
+
0.248,
|
|
17154
|
+
0.31,
|
|
17155
|
+
0.372,
|
|
17156
|
+
0.434,
|
|
17157
|
+
0.4958,
|
|
17158
|
+
0.5571,
|
|
17159
|
+
0.6176,
|
|
17160
|
+
0.6769,
|
|
17161
|
+
0.7346,
|
|
17162
|
+
0.7903,
|
|
17163
|
+
0.8435,
|
|
17164
|
+
0.8936,
|
|
17165
|
+
0.9394,
|
|
17166
|
+
0.9761,
|
|
17167
|
+
1
|
|
17168
|
+
];
|
|
17169
|
+
function projectGeoPoint(point, projection = "mercator") {
|
|
17170
|
+
const lon = point.longitude * RAD, lat = Math.max(-89.999, Math.min(89.999, point.latitude)) * RAD;
|
|
17171
|
+
if (projection === "mercator")
|
|
17172
|
+
return [
|
|
17173
|
+
lon,
|
|
17174
|
+
-Math.log(
|
|
17175
|
+
Math.tan(Math.PI / 4 + Math.max(-85.05112878 * RAD, Math.min(85.05112878 * RAD, lat)) / 2)
|
|
17176
|
+
)
|
|
17177
|
+
];
|
|
17178
|
+
if (projection === "miller") return [lon, -1.25 * Math.log(Math.tan(Math.PI / 4 + 0.4 * lat))];
|
|
17179
|
+
if (projection === "robinson") {
|
|
17180
|
+
const index = Math.min(17, Math.floor(Math.abs(point.latitude) / 5)), t = Math.min(1, Math.abs(point.latitude) / 5 - index);
|
|
17181
|
+
return [
|
|
17182
|
+
0.8487 * lon * (RX[index] + (RX[index + 1] - RX[index]) * t),
|
|
17183
|
+
-1.3523 * Math.sign(lat) * (RY[index] + (RY[index + 1] - RY[index]) * t)
|
|
17184
|
+
];
|
|
17185
|
+
}
|
|
17186
|
+
if (projection === "albers") {
|
|
17187
|
+
const n2 = (Math.sin(20 * RAD) + Math.sin(50 * RAD)) / 2;
|
|
17188
|
+
const c = Math.cos(20 * RAD) ** 2 + 2 * n2 * Math.sin(20 * RAD);
|
|
17189
|
+
const rho = Math.sqrt(Math.max(0, c - 2 * n2 * Math.sin(lat))) / n2;
|
|
17190
|
+
return [rho * Math.sin(n2 * lon), rho * Math.cos(n2 * lon) - Math.sqrt(c) / n2];
|
|
17191
|
+
}
|
|
17192
|
+
return void 0;
|
|
17193
|
+
}
|
|
17194
|
+
|
|
17195
|
+
// chart/region-map/geometry.ts
|
|
17196
|
+
function regionMapGeometry(options2) {
|
|
17197
|
+
const cache2 = readGeographyCache(options2?.geographyCacheXml);
|
|
17198
|
+
if (!cache2.regions.length)
|
|
17199
|
+
return { regions: WORLD_REGIONS, approximate: true, issues: cache2.issues, copyright: [] };
|
|
17200
|
+
const projection = options2?.projectionType ?? "robinson";
|
|
17201
|
+
const projected = cache2.regions.map((region) => ({
|
|
17202
|
+
region,
|
|
17203
|
+
rings: region.rings.map((ring) => ring.map((p) => projectGeoPoint(p, projection)))
|
|
17204
|
+
}));
|
|
17205
|
+
if (projected.some((r) => r.rings.some((ring) => ring.some((p) => !p))))
|
|
17206
|
+
return {
|
|
17207
|
+
regions: [],
|
|
17208
|
+
approximate: false,
|
|
17209
|
+
issues: [...cache2.issues, "Unsupported geographic projection."],
|
|
17210
|
+
copyright: []
|
|
17211
|
+
};
|
|
17212
|
+
const all = projected.flatMap((r) => r.rings.flatMap((ring) => ring));
|
|
17213
|
+
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
17214
|
+
for (const [x, y] of all) {
|
|
17215
|
+
minX = Math.min(minX, x);
|
|
17216
|
+
maxX = Math.max(maxX, x);
|
|
17217
|
+
minY = Math.min(minY, y);
|
|
17218
|
+
maxY = Math.max(maxY, y);
|
|
17219
|
+
}
|
|
17220
|
+
const factor = Math.min(1e3 / Math.max(maxX - minX, 1e-12), 500 / Math.max(maxY - minY, 1e-12));
|
|
17221
|
+
const sx = factor, sy = factor, ox = (1e3 - (maxX - minX) * factor) / 2, oy = (500 - (maxY - minY) * factor) / 2;
|
|
17222
|
+
const regions = projected.map(({ region, rings }) => {
|
|
17223
|
+
const paths = rings.map(
|
|
17224
|
+
(ring) => ring.map((p) => {
|
|
17225
|
+
const [x2, y2] = p;
|
|
17226
|
+
return [(x2 - minX) * sx + ox, (y2 - minY) * sy + oy];
|
|
17227
|
+
})
|
|
17228
|
+
);
|
|
17229
|
+
const coords = paths.flat();
|
|
17230
|
+
let x = 0, y = 0;
|
|
17231
|
+
for (const p of coords) {
|
|
17232
|
+
x += p[0];
|
|
17233
|
+
y += p[1];
|
|
17234
|
+
}
|
|
17235
|
+
return {
|
|
17236
|
+
code: resolveRegionCode(region.name) ?? region.entityId,
|
|
17237
|
+
entityId: region.entityId,
|
|
17238
|
+
name: region.name,
|
|
17239
|
+
labelXY: [x / coords.length, y / coords.length],
|
|
17240
|
+
path: paths.map(
|
|
17241
|
+
(r) => r.map((p, i) => `${i ? "L" : "M"}${p[0].toFixed(3)},${p[1].toFixed(3)}`).join(" ") + "Z"
|
|
17242
|
+
).join(" ")
|
|
17243
|
+
};
|
|
17244
|
+
});
|
|
17245
|
+
return {
|
|
17246
|
+
regions,
|
|
17247
|
+
approximate: false,
|
|
17248
|
+
issues: cache2.issues,
|
|
17249
|
+
copyright: [...new Set(cache2.regions.flatMap((r) => r.copyright))]
|
|
17250
|
+
};
|
|
17251
|
+
}
|
|
17252
|
+
|
|
17253
|
+
// chart/render/chart-svg-region-map.ts
|
|
17254
|
+
function regionMapSvg(model, area, approximationLabel) {
|
|
17255
|
+
const series = model.series[0];
|
|
17256
|
+
if (!series || series.hidden) return "";
|
|
17257
|
+
const options2 = model.regionMap;
|
|
17258
|
+
const geometry = regionMapGeometry(options2);
|
|
17259
|
+
const resolve = (label) => geometry.regions.find(
|
|
17260
|
+
(r) => r.entityId === label || r.code === label || r.name.toLowerCase() === label.toLowerCase()
|
|
17261
|
+
)?.code ?? resolveRegionCode(label);
|
|
17262
|
+
const entries = buildRegionMapEntries(model.categories, series.values, options2, resolve);
|
|
17263
|
+
const min = entries.length ? Math.min(...entries.map((e) => e.value)) : 0, max = entries.length ? Math.max(...entries.map((e) => e.value)) : 1;
|
|
17264
|
+
const stops = resolveValueColorStops(
|
|
17265
|
+
options2?.valueColors,
|
|
17266
|
+
options2?.valueColorPositions,
|
|
17267
|
+
min,
|
|
17268
|
+
max
|
|
17269
|
+
);
|
|
17270
|
+
const colors = stops ? buildValueColorScale(stops) : (t) => sequentialColorScale(t, series.color);
|
|
17271
|
+
const matched = new Map(entries.filter((e) => e.code).map((e) => [e.code, e]));
|
|
17272
|
+
const missing = entries.filter(
|
|
17273
|
+
(e) => !e.code || !geometry.regions.some((r) => r.code === e.code)
|
|
17274
|
+
);
|
|
17275
|
+
const bounds = regionViewBounds(options2?.viewedRegionType, matched, geometry.regions);
|
|
17276
|
+
const width = bounds.maxX - bounds.minX || 1, height = bounds.maxY - bounds.minY || 1;
|
|
17277
|
+
const reserve = (model.showLegend ? 46 : 12) + Math.min(missing.length, 5) * 14 + (geometry.approximate && approximationLabel ? 14 : 0);
|
|
17278
|
+
const scale = Math.max(
|
|
17279
|
+
1e-5,
|
|
17280
|
+
Math.min(Math.max(1, area.w - 8) / width, Math.max(1, area.h - reserve) / height)
|
|
17281
|
+
);
|
|
17282
|
+
const dx = area.x + (area.w - width * scale) / 2 - bounds.minX * scale, dy = area.y - bounds.minY * scale;
|
|
17283
|
+
const out = [
|
|
17284
|
+
`<g data-chart-part="regionMap" data-map-geometry="${geometry.approximate ? "approximate" : "cached"}"${geometry.approximate ? ' data-map-report="approximate-country-outlines"' : ""}${geometry.issues.length ? ' data-map-partial="true"' : ""}>`
|
|
17285
|
+
];
|
|
17286
|
+
out.push(
|
|
17287
|
+
`<svg x="${area.x}" y="${area.y}" width="${area.w}" height="${Math.max(1, area.h - reserve)}" viewBox="${area.x} ${area.y} ${area.w} ${Math.max(1, area.h - reserve)}" overflow="hidden">`
|
|
17288
|
+
);
|
|
17289
|
+
for (const region of geometry.regions) {
|
|
17290
|
+
const entry = matched.get(region.code);
|
|
17291
|
+
out.push(
|
|
17292
|
+
`<path d="${scalePathD(region.path, scale, dx, dy)}" fill="${esc(options2?.fixedColor ?? (entry ? colors(normalizeValue(entry.value, min, max)) : "#e2e8f0"))}" stroke="${esc(series.stroke?.color ?? "none")}" stroke-width="${series.stroke?.width ?? 0}" fill-rule="evenodd"${entry ? ` data-chart-series="0" data-chart-point="${entry.sourceIndex}"` : ""}><title>${esc(region.name)}${entry ? ": " + esc(formatRegionMapValue(entry.value, options2?.cultureLanguage)) : ""}</title></path>`
|
|
17293
|
+
);
|
|
17294
|
+
const b = regionBounds(region);
|
|
17295
|
+
if (entry && shouldRenderRegionLabel(
|
|
17296
|
+
options2?.regionLabelLayout,
|
|
17297
|
+
(b.maxX - b.minX) * scale,
|
|
17298
|
+
(b.maxY - b.minY) * scale
|
|
17299
|
+
))
|
|
17300
|
+
out.push(
|
|
17301
|
+
text(region.labelXY[0] * scale + dx, region.labelXY[1] * scale + dy, region.name, {
|
|
17302
|
+
size: 8,
|
|
17303
|
+
anchor: "middle"
|
|
17304
|
+
})
|
|
17305
|
+
);
|
|
17306
|
+
const label = entry && series.labels?.[entry.sourceIndex];
|
|
17307
|
+
if (label)
|
|
17308
|
+
draw(
|
|
17309
|
+
measure(model, label),
|
|
17310
|
+
label,
|
|
17311
|
+
region.labelXY[0] * scale + dx,
|
|
17312
|
+
region.labelXY[1] * scale + dy,
|
|
17313
|
+
"middle",
|
|
17314
|
+
out
|
|
17315
|
+
);
|
|
17316
|
+
}
|
|
17317
|
+
out.push("</svg>");
|
|
17318
|
+
const y = area.y + height * scale + 5, bar = Math.min(160, area.w * 0.4), left = area.x + (area.w - bar) / 2;
|
|
17319
|
+
if (model.showLegend) {
|
|
17320
|
+
const attrs2 = chartTextAttributes(model, "legend", 16), size = attrs2.size ?? 16;
|
|
17321
|
+
out.push(text(left - 8, y + size * 0.4, series.name, { ...attrs2, anchor: "end" }));
|
|
17322
|
+
for (let i = 0; i < 32; i++)
|
|
17323
|
+
out.push(rect2(left + i * bar / 32, y, bar / 32 + 0.1, 7, colors((i + 0.5) / 32)));
|
|
17324
|
+
out.push(
|
|
17325
|
+
text(left, y + 8 + size, String(min), attrs2),
|
|
17326
|
+
text(left + bar, y + 8 + size, String(max), { ...attrs2, anchor: "end" })
|
|
15633
17327
|
);
|
|
15634
|
-
|
|
17328
|
+
}
|
|
17329
|
+
let row2 = y + (model.showLegend ? 32 : 0);
|
|
17330
|
+
if (geometry.approximate && approximationLabel) {
|
|
17331
|
+
out.push(text(area.x, row2, approximationLabel, { size: 8 }));
|
|
17332
|
+
row2 += 14;
|
|
17333
|
+
}
|
|
17334
|
+
for (const entry of missing.slice(0, 5)) {
|
|
15635
17335
|
out.push(
|
|
15636
|
-
|
|
17336
|
+
text(
|
|
17337
|
+
area.x,
|
|
17338
|
+
row2,
|
|
17339
|
+
`${entry.label}: ${formatRegionMapValue(entry.value, options2?.cultureLanguage)}`,
|
|
17340
|
+
{ size: 9 }
|
|
17341
|
+
)
|
|
15637
17342
|
);
|
|
15638
|
-
|
|
15639
|
-
|
|
15640
|
-
|
|
15641
|
-
|
|
17343
|
+
row2 += 14;
|
|
17344
|
+
}
|
|
17345
|
+
const credits = [options2?.attribution, ...geometry.copyright].filter(Boolean).join("; ");
|
|
17346
|
+
if (credits)
|
|
17347
|
+
out.push(
|
|
17348
|
+
`<title>${esc(credits)}</title>`,
|
|
17349
|
+
text(
|
|
17350
|
+
area.x,
|
|
17351
|
+
area.y + area.h - 1,
|
|
17352
|
+
credits.length > 180 ? credits.slice(0, 177) + "..." : credits,
|
|
17353
|
+
{ size: 6 }
|
|
17354
|
+
)
|
|
17355
|
+
);
|
|
17356
|
+
return out.join("") + "</g>";
|
|
17357
|
+
}
|
|
17358
|
+
|
|
17359
|
+
// chart/funnel-geometry.ts
|
|
17360
|
+
function computeFunnelGeometry(values, plot, gapWidth = 33) {
|
|
17361
|
+
const max = Math.max(...values.map((v) => Math.abs(v)), 1);
|
|
17362
|
+
const band = plot.height / Math.max(1, values.length);
|
|
17363
|
+
const gap = Number.isFinite(gapWidth) && gapWidth >= 0 ? gapWidth : 33;
|
|
17364
|
+
const height = band / (1 + gap / 100);
|
|
17365
|
+
const inset = (band - height) / 2;
|
|
17366
|
+
const center = plot.x + plot.width / 2;
|
|
17367
|
+
return values.map((value, index) => {
|
|
17368
|
+
const width = Math.abs(value) / max * plot.width;
|
|
17369
|
+
return {
|
|
17370
|
+
index,
|
|
17371
|
+
x: center - width / 2,
|
|
17372
|
+
y: plot.y + index * band + inset,
|
|
17373
|
+
width,
|
|
17374
|
+
height,
|
|
17375
|
+
center
|
|
17376
|
+
};
|
|
17377
|
+
});
|
|
17378
|
+
}
|
|
17379
|
+
|
|
17380
|
+
// chart/render/chart-svg-funnel.ts
|
|
17381
|
+
function funnelSvg(model, area) {
|
|
17382
|
+
const series = model.series[0];
|
|
17383
|
+
if (!series || series.hidden) return "";
|
|
17384
|
+
const attrs2 = chartTextAttributes(model, "categoryAxis", 10);
|
|
17385
|
+
const width = Math.min(
|
|
17386
|
+
area.w * 0.3,
|
|
17387
|
+
Math.max(32, ...model.categories.map((s) => s.length * (attrs2.size ?? 10) * 0.55 + 8))
|
|
15642
17388
|
);
|
|
15643
|
-
|
|
15644
|
-
|
|
15645
|
-
|
|
15646
|
-
|
|
15647
|
-
|
|
15648
|
-
|
|
15649
|
-
|
|
15650
|
-
|
|
15651
|
-
|
|
15652
|
-
|
|
15653
|
-
|
|
17389
|
+
const plot = { x: area.x + width, y: area.y, width: Math.max(1, area.w - width), height: area.h };
|
|
17390
|
+
const out = [
|
|
17391
|
+
chartAreaRect(model, "plotArea", { x: plot.x, y: plot.y, w: plot.width, h: plot.height })
|
|
17392
|
+
];
|
|
17393
|
+
for (const bar of computeFunnelGeometry(
|
|
17394
|
+
series.values.map((v) => v ?? 0),
|
|
17395
|
+
plot,
|
|
17396
|
+
model.funnelGapWidth
|
|
17397
|
+
)) {
|
|
17398
|
+
const value = series.values[bar.index];
|
|
17399
|
+
if (value === null || value === void 0) continue;
|
|
17400
|
+
out.push(`<g data-chart-series="${series.sourceIndex ?? 0}" data-chart-point="${bar.index}">`);
|
|
17401
|
+
out.push(
|
|
17402
|
+
rect2(bar.x, bar.y, bar.width, bar.height, series.pointColors?.[bar.index] ?? series.color)
|
|
17403
|
+
);
|
|
17404
|
+
const size = Math.min(10, bar.height * 0.4);
|
|
17405
|
+
const label = series.labels?.[bar.index];
|
|
17406
|
+
if (label)
|
|
15654
17407
|
out.push(
|
|
15655
|
-
text(
|
|
15656
|
-
|
|
15657
|
-
|
|
17408
|
+
text(bar.center, bar.y + bar.height / 2 + size * 0.35, label.text, {
|
|
17409
|
+
...chartTextAttributes(model, "dataLabel", size),
|
|
17410
|
+
size,
|
|
17411
|
+
anchor: "middle"
|
|
15658
17412
|
})
|
|
15659
17413
|
);
|
|
15660
|
-
});
|
|
15661
|
-
const frame2 = { plot, value, band, bandSize, ...dates ? { order: dates.order } : {} };
|
|
15662
|
-
if (second) {
|
|
15663
|
-
frame2.secondary = (v) => plot.y + plot.h - chartAxisRatio(v, second, model.axes?.secondary) * plot.h;
|
|
15664
17414
|
out.push(
|
|
15665
|
-
|
|
15666
|
-
|
|
15667
|
-
|
|
15668
|
-
"
|
|
15669
|
-
|
|
15670
|
-
plot.y,
|
|
15671
|
-
plot.x + plot.w,
|
|
15672
|
-
plot.y + plot.h
|
|
17415
|
+
text(
|
|
17416
|
+
plot.x - 8,
|
|
17417
|
+
bar.y + bar.height / 2 + (attrs2.size ?? 10) * 0.35,
|
|
17418
|
+
fit(model.categories[bar.index] ?? "", width - 8, attrs2.size ?? 10),
|
|
17419
|
+
{ ...attrs2, anchor: "end" }
|
|
15673
17420
|
)
|
|
15674
17421
|
);
|
|
15675
|
-
|
|
17422
|
+
out.push("</g>");
|
|
17423
|
+
}
|
|
17424
|
+
return out.join("");
|
|
17425
|
+
}
|
|
17426
|
+
|
|
17427
|
+
// chart/box-distribution.ts
|
|
17428
|
+
function boxWhiskerDistribution(values, method = "exclusive", trimOutliers = false) {
|
|
17429
|
+
const stats = computeBoxStats(values, method);
|
|
17430
|
+
if (!stats) return void 0;
|
|
17431
|
+
const iqr = stats.q3 - stats.q1;
|
|
17432
|
+
const lowerFence = stats.q1 - 1.5 * iqr;
|
|
17433
|
+
const upperFence = stats.q3 + 1.5 * iqr;
|
|
17434
|
+
const inliers = values.filter((v) => !trimOutliers || v >= lowerFence && v <= upperFence);
|
|
17435
|
+
return {
|
|
17436
|
+
stats,
|
|
17437
|
+
whiskerMin: inliers.length ? Math.min(...inliers) : stats.min,
|
|
17438
|
+
whiskerMax: inliers.length ? Math.max(...inliers) : stats.max,
|
|
17439
|
+
mean: values.reduce((a, b) => a + b, 0) / values.length
|
|
17440
|
+
};
|
|
17441
|
+
}
|
|
17442
|
+
function boxMeanMarkerPath(x, y, radius = 3) {
|
|
17443
|
+
return `M${x - radius},${y - radius} L${x + radius},${y + radius} M${x - radius},${y + radius} L${x + radius},${y - radius}`;
|
|
17444
|
+
}
|
|
17445
|
+
|
|
17446
|
+
// chart/render/chart-svg-box.ts
|
|
17447
|
+
function boxWhiskerSvg(model, frame2, out) {
|
|
17448
|
+
const visible = model.series.filter((s) => !s.hidden);
|
|
17449
|
+
const slot = frame2.bandSize / Math.max(1, visible.length);
|
|
17450
|
+
const width = slot * 0.7;
|
|
17451
|
+
visible.forEach((series, si) => {
|
|
17452
|
+
if (series.hidden) return;
|
|
17453
|
+
const groups = groupRowsByCategory(series.boxCategories ?? []);
|
|
17454
|
+
model.categories.forEach((category, ci) => {
|
|
17455
|
+
const observations = (groups.rowIndexesByCategory.get(category) ?? []).flatMap((row2) => {
|
|
17456
|
+
const value = series.values[row2];
|
|
17457
|
+
return value === null || value === void 0 ? [] : [{ row: row2, value }];
|
|
17458
|
+
});
|
|
17459
|
+
const options2 = series.boxWhisker;
|
|
17460
|
+
const rawMethod = options2?.statistics?.quartileMethod;
|
|
17461
|
+
const method = rawMethod === "inclusive" ? "inclusive" : "exclusive";
|
|
17462
|
+
const visibility = options2?.visibility;
|
|
17463
|
+
const trim = rawMethod === "inclusive" || rawMethod === "exclusive" || !!visibility && Object.values(visibility).some((v) => v !== void 0);
|
|
17464
|
+
const distribution = boxWhiskerDistribution(
|
|
17465
|
+
observations.map((p) => p.value),
|
|
17466
|
+
method,
|
|
17467
|
+
trim
|
|
17468
|
+
);
|
|
17469
|
+
if (!distribution) return;
|
|
17470
|
+
const { stats, whiskerMin, whiskerMax, mean } = distribution;
|
|
17471
|
+
const x = frame2.band(ci) - frame2.bandSize / 2 + si * slot + (slot - width) / 2;
|
|
17472
|
+
const mid = x + width / 2;
|
|
17473
|
+
const y = frame2.value;
|
|
15676
17474
|
out.push(
|
|
15677
|
-
|
|
17475
|
+
`<g data-chart-part="box" data-chart-series="${series.sourceIndex ?? si}" data-chart-point="${ci}">`
|
|
15678
17476
|
);
|
|
15679
|
-
|
|
15680
|
-
|
|
15681
|
-
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
|
|
15685
|
-
|
|
17477
|
+
out.push(line2(mid, y(whiskerMax), mid, y(stats.q3), "#64748b", 1));
|
|
17478
|
+
out.push(line2(mid, y(stats.q1), mid, y(whiskerMin), "#64748b", 1));
|
|
17479
|
+
out.push(
|
|
17480
|
+
line2(x + width * 0.25, y(whiskerMin), x + width * 0.75, y(whiskerMin), "#64748b", 1)
|
|
17481
|
+
);
|
|
17482
|
+
out.push(
|
|
17483
|
+
line2(x + width * 0.25, y(whiskerMax), x + width * 0.75, y(whiskerMax), "#64748b", 1)
|
|
17484
|
+
);
|
|
17485
|
+
out.push(
|
|
17486
|
+
rect2(
|
|
17487
|
+
x,
|
|
17488
|
+
Math.min(y(stats.q1), y(stats.q3)),
|
|
17489
|
+
width,
|
|
17490
|
+
Math.abs(y(stats.q1) - y(stats.q3)),
|
|
17491
|
+
series.pointColors?.[ci] ?? series.color
|
|
15686
17492
|
)
|
|
15687
17493
|
);
|
|
15688
|
-
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
|
|
15695
|
-
|
|
15696
|
-
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
|
|
15700
|
-
|
|
15701
|
-
const acc = new Array(model.categories.length).fill(0);
|
|
15702
|
-
const area = model.type === "area";
|
|
15703
|
-
const marks = [];
|
|
15704
|
-
const layers = [];
|
|
15705
|
-
model.series.forEach((s, si) => {
|
|
15706
|
-
const points = [];
|
|
15707
|
-
const lower = [];
|
|
15708
|
-
(frame2.order ?? model.categories.map((_, i) => i)).forEach((i) => {
|
|
15709
|
-
const v = values[si]?.[i] ?? null;
|
|
15710
|
-
if (v === null && !area) {
|
|
15711
|
-
points.push([NaN, NaN]);
|
|
15712
|
-
return;
|
|
15713
|
-
}
|
|
15714
|
-
const below2 = stacked ? acc[i] ?? 0 : 0;
|
|
15715
|
-
const top = below2 + (v ?? 0);
|
|
15716
|
-
if (stacked) acc[i] = top;
|
|
15717
|
-
points.push([frame2.band(i), frame2.value(top)]);
|
|
15718
|
-
marks.push({
|
|
15719
|
-
series: s,
|
|
15720
|
-
index: i,
|
|
15721
|
-
x: frame2.band(i),
|
|
15722
|
-
y: frame2.value(top),
|
|
15723
|
-
radius: area ? 0 : chartMarkerRadius(s, i, 2.5)
|
|
17494
|
+
out.push(line2(x, y(stats.median), x + width, y(stats.median), "#1e293b", 2));
|
|
17495
|
+
if (visibility?.meanLine) out.push(line2(x, y(mean), x + width, y(mean), "#0f766e", 1.5));
|
|
17496
|
+
if (visibility?.meanMarker !== false)
|
|
17497
|
+
out.push(
|
|
17498
|
+
`<path d="${boxMeanMarkerPath(mid, y(mean))}" fill="none" stroke="#0f766e" stroke-width="1.5" data-chart-part="mean"/>`
|
|
17499
|
+
);
|
|
17500
|
+
observations.forEach((point, index) => {
|
|
17501
|
+
const outlier = point.value < whiskerMin || point.value > whiskerMax;
|
|
17502
|
+
if (outlier ? !visibility?.outliers : !visibility?.nonoutliers) return;
|
|
17503
|
+
const px = x + width * (0.2 + 0.6 * (index + 1) / (observations.length + 1));
|
|
17504
|
+
out.push(
|
|
17505
|
+
`<circle cx="${n(px)}" cy="${n(y(point.value))}" r="2.25" fill="${outlier ? "#dc2626" : "#1e293b"}" data-chart-series="${series.sourceIndex ?? si}" data-chart-point="${point.row}" data-chart-part="${outlier ? "outlier" : "observation"}"/>`
|
|
17506
|
+
);
|
|
15724
17507
|
});
|
|
15725
|
-
|
|
15726
|
-
});
|
|
15727
|
-
layers.push({
|
|
15728
|
-
series: s,
|
|
15729
|
-
points,
|
|
15730
|
-
lower,
|
|
15731
|
-
color: s.color,
|
|
15732
|
-
filter: s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""
|
|
17508
|
+
out.push("</g>");
|
|
15733
17509
|
});
|
|
15734
17510
|
});
|
|
15735
|
-
for (const { points, lower, color, filter, series } of area ? [...layers].reverse() : layers) {
|
|
15736
|
-
if (area) {
|
|
15737
|
-
const poly = [...points, ...[...lower].reverse()].map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
15738
|
-
out.push(`<polygon points="${poly}" fill="${color}" fill-opacity="0.85"${filter}/>`);
|
|
15739
|
-
continue;
|
|
15740
|
-
}
|
|
15741
|
-
let segment2 = [];
|
|
15742
|
-
const flush = () => {
|
|
15743
|
-
out.push(chartLineSvg(segment2, series));
|
|
15744
|
-
segment2 = [];
|
|
15745
|
-
};
|
|
15746
|
-
for (const [x, y] of points) {
|
|
15747
|
-
if (Number.isNaN(x)) flush();
|
|
15748
|
-
else segment2.push({ x, y });
|
|
15749
|
-
}
|
|
15750
|
-
flush();
|
|
15751
|
-
points.forEach(([x, y], index) => {
|
|
15752
|
-
if (!Number.isNaN(x))
|
|
15753
|
-
out.push(chartSeriesMarkerSvg(series, frame2.order?.[index] ?? index, x, y, 2.5));
|
|
15754
|
-
});
|
|
15755
|
-
}
|
|
15756
|
-
pointLabels(model, marks, out);
|
|
15757
17511
|
}
|
|
15758
17512
|
|
|
15759
17513
|
// chart/render/chart-svg-xy.ts
|
|
@@ -16318,26 +18072,26 @@ function sunburstSvg(model, area) {
|
|
|
16318
18072
|
|
|
16319
18073
|
// chart/render/chart-svg-text-metrics.ts
|
|
16320
18074
|
var CHART_FONT_FAMILY = "Calibri, Carlito, Arial, sans-serif";
|
|
16321
|
-
function cssFont(
|
|
16322
|
-
return `${
|
|
18075
|
+
function cssFont(attrs2) {
|
|
18076
|
+
return `${attrs2.italic ? "italic" : "normal"} ${attrs2.weight ?? "normal"} ${attrs2.size ?? 10}px ${attrs2.family ?? CHART_FONT_FAMILY}`;
|
|
16323
18077
|
}
|
|
16324
|
-
function chartFontMetrics(
|
|
16325
|
-
const metrics = options2.measureFont?.(cssFont(
|
|
18078
|
+
function chartFontMetrics(attrs2, options2) {
|
|
18079
|
+
const metrics = options2.measureFont?.(cssFont(attrs2));
|
|
16326
18080
|
return metrics && Number.isFinite(metrics.ascent) && Number.isFinite(metrics.descent) && metrics.ascent >= 0 && metrics.descent >= 0 && metrics.ascent + metrics.descent > 0 ? metrics : void 0;
|
|
16327
18081
|
}
|
|
16328
|
-
function chartTextWidth(content,
|
|
16329
|
-
const width = options2.measureText?.(content, cssFont(
|
|
16330
|
-
return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content,
|
|
18082
|
+
function chartTextWidth(content, attrs2, options2) {
|
|
18083
|
+
const width = options2.measureText?.(content, cssFont(attrs2));
|
|
18084
|
+
return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content, attrs2.size);
|
|
16331
18085
|
}
|
|
16332
|
-
function fitChartText(content, maxWidth,
|
|
16333
|
-
if (!options2.measureText) return fit(content, maxWidth,
|
|
16334
|
-
if (chartTextWidth(content,
|
|
18086
|
+
function fitChartText(content, maxWidth, attrs2, options2) {
|
|
18087
|
+
if (!options2.measureText) return fit(content, maxWidth, attrs2.size);
|
|
18088
|
+
if (chartTextWidth(content, attrs2, options2) <= maxWidth) return content;
|
|
16335
18089
|
const points = [...content];
|
|
16336
18090
|
let low = 0;
|
|
16337
18091
|
let high = points.length;
|
|
16338
18092
|
while (low < high) {
|
|
16339
18093
|
const mid = Math.ceil((low + high) / 2);
|
|
16340
|
-
if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`,
|
|
18094
|
+
if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs2, options2) <= maxWidth) low = mid;
|
|
16341
18095
|
else high = mid - 1;
|
|
16342
18096
|
}
|
|
16343
18097
|
return `${points.slice(0, low).join("")}\u2026`;
|
|
@@ -16359,13 +18113,13 @@ function chartLegendSvg(model, area, frame2, options2) {
|
|
|
16359
18113
|
});
|
|
16360
18114
|
if (!manual) return { plot, markup: automatic.join(""), foreground: !!model.legendOverlay };
|
|
16361
18115
|
const entries = legendEntries(model);
|
|
16362
|
-
const
|
|
16363
|
-
const size =
|
|
16364
|
-
const font = chartFontMetrics(
|
|
18116
|
+
const attrs2 = chartTextAttributes(model, "legend");
|
|
18117
|
+
const size = attrs2.size ?? 10;
|
|
18118
|
+
const font = chartFontMetrics(attrs2, options2);
|
|
16365
18119
|
const keySize = size / 2;
|
|
16366
18120
|
const keyGap = size / 4;
|
|
16367
18121
|
const widths = entries.map(
|
|
16368
|
-
(entry) => chartTextWidth(entry.label,
|
|
18122
|
+
(entry) => chartTextWidth(entry.label, attrs2, options2) + keySize + keyGap
|
|
16369
18123
|
);
|
|
16370
18124
|
const horizontal = manual.width > manual.height && widths.reduce((sum, width) => sum + width, 0) + size <= manual.width;
|
|
16371
18125
|
const rowWidth = horizontal ? manual.width / entries.length : manual.width;
|
|
@@ -16381,13 +18135,13 @@ function chartLegendSvg(model, area, frame2, options2) {
|
|
|
16381
18135
|
const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
|
|
16382
18136
|
const widest = extentOf(widths).max;
|
|
16383
18137
|
entries.forEach((entry, i) => {
|
|
16384
|
-
const available = horizontal ? chartTextWidth(entry.label,
|
|
16385
|
-
const label = fitChartText(entry.label, available,
|
|
18138
|
+
const available = horizontal ? chartTextWidth(entry.label, attrs2, options2) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
|
|
18139
|
+
const label = fitChartText(entry.label, available, attrs2, options2);
|
|
16386
18140
|
const contentWidth = Math.min(horizontal ? widths[i] ?? 0 : widest, rowWidth - size / 2);
|
|
16387
18141
|
const x = horizontal ? horizontalX : manual.x + Math.max(size / 4, (rowWidth - contentWidth) / 2);
|
|
16388
18142
|
const centerY = manual.y + (horizontal ? 0 : i * rowHeight) + rowHeight / 2;
|
|
16389
18143
|
markup.push(rect2(x, centerY - keySize / 2, keySize, keySize, entry.color));
|
|
16390
|
-
markup.push(text(x + keySize + keyGap, centerY + baselineOffset, label,
|
|
18144
|
+
markup.push(text(x + keySize + keyGap, centerY + baselineOffset, label, attrs2));
|
|
16391
18145
|
if (horizontal) horizontalX += (widths[i] ?? 0) + horizontalGap;
|
|
16392
18146
|
});
|
|
16393
18147
|
return {
|
|
@@ -16426,12 +18180,12 @@ function automaticLegend(model, area, out, options2, bounds) {
|
|
|
16426
18180
|
const entries = legendEntries(model);
|
|
16427
18181
|
if (!model.showLegend || entries.length === 0) return area;
|
|
16428
18182
|
const pos = model.legendPosition;
|
|
16429
|
-
const
|
|
16430
|
-
const size =
|
|
18183
|
+
const attrs2 = chartTextAttributes(model, "legend");
|
|
18184
|
+
const size = attrs2.size ?? 10;
|
|
16431
18185
|
const rowH = Math.max(16, size * 1.4);
|
|
16432
18186
|
if (pos === "t" || pos === "b") {
|
|
16433
18187
|
const widths = entries.map(
|
|
16434
|
-
(e) => Math.min(chartTextWidth(e.label,
|
|
18188
|
+
(e) => Math.min(chartTextWidth(e.label, attrs2, options2) + 20, area.w / 2)
|
|
16435
18189
|
);
|
|
16436
18190
|
const total = widths.reduce((a, b) => a + b, 0);
|
|
16437
18191
|
let x2 = area.x + Math.max(0, (area.w - total) / 2);
|
|
@@ -16448,14 +18202,14 @@ function automaticLegend(model, area, out, options2, bounds) {
|
|
|
16448
18202
|
entries.forEach((e, i) => {
|
|
16449
18203
|
const w = widths[i] ?? 0;
|
|
16450
18204
|
out.push(rect2(x2, y, 8, 8, e.color));
|
|
16451
|
-
out.push(text(x2 + 12, y + 8, fitChartText(e.label, w - 16,
|
|
18205
|
+
out.push(text(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs2, options2), attrs2));
|
|
16452
18206
|
x2 += w;
|
|
16453
18207
|
});
|
|
16454
18208
|
return pos === "t" ? { x: area.x, y: area.y + rowH + 4, w: area.w, h: area.h - rowH - 4 } : { x: area.x, y: area.y, w: area.w, h: area.h - rowH - 4 };
|
|
16455
18209
|
}
|
|
16456
18210
|
const width = Math.min(
|
|
16457
18211
|
area.w * 0.35,
|
|
16458
|
-
extentOf(entries.map((e) => chartTextWidth(e.label,
|
|
18212
|
+
extentOf(entries.map((e) => chartTextWidth(e.label, attrs2, options2))).max + 22
|
|
16459
18213
|
);
|
|
16460
18214
|
const height = entries.length * rowH;
|
|
16461
18215
|
const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
|
|
@@ -16473,7 +18227,7 @@ function automaticLegend(model, area, out, options2, bounds) {
|
|
|
16473
18227
|
const y = y0 + i * rowH;
|
|
16474
18228
|
if (y + rowH > area.y + area.h + 2) return;
|
|
16475
18229
|
out.push(rect2(x, y + 3, 8, 8, e.color));
|
|
16476
|
-
out.push(text(x + 12, y + 11, fitChartText(e.label, width - 16,
|
|
18230
|
+
out.push(text(x + 12, y + 11, fitChartText(e.label, width - 16, attrs2, options2), attrs2));
|
|
16477
18231
|
});
|
|
16478
18232
|
return pos === "l" ? { x: area.x + width + 8, y: area.y, w: area.w - width - 8, h: area.h } : { x: area.x, y: area.y, w: area.w - width - 8, h: area.h };
|
|
16479
18233
|
}
|
|
@@ -16507,11 +18261,11 @@ function wrapStyledRuns(runs, maxWidth, measure2, options2 = {}) {
|
|
|
16507
18261
|
return sum + (Number.isFinite(advance) && advance >= 0 ? advance : 0);
|
|
16508
18262
|
}, 0);
|
|
16509
18263
|
const result = [];
|
|
16510
|
-
let
|
|
18264
|
+
let line4 = [];
|
|
16511
18265
|
let spaces = [];
|
|
16512
18266
|
const flush = () => {
|
|
16513
|
-
result.push(
|
|
16514
|
-
|
|
18267
|
+
result.push(line4.map((piece) => ({ ...piece.run, text: piece.text })));
|
|
18268
|
+
line4 = [];
|
|
16515
18269
|
spaces = [];
|
|
16516
18270
|
};
|
|
16517
18271
|
for (const group2 of groups) {
|
|
@@ -16523,20 +18277,20 @@ function wrapStyledRuns(runs, maxWidth, measure2, options2 = {}) {
|
|
|
16523
18277
|
spaces = group2.pieces;
|
|
16524
18278
|
continue;
|
|
16525
18279
|
}
|
|
16526
|
-
const separator =
|
|
18280
|
+
const separator = line4.length ? spaces : [];
|
|
16527
18281
|
const wordWidth = width(group2.pieces);
|
|
16528
|
-
if (
|
|
16529
|
-
else
|
|
18282
|
+
if (line4.length && width(merged(line4, [...separator, ...group2.pieces])) > maxWidth) flush();
|
|
18283
|
+
else line4 = merged(line4, separator);
|
|
16530
18284
|
spaces = [];
|
|
16531
18285
|
if (options2.breakWords && wordWidth > maxWidth) {
|
|
16532
18286
|
for (const piece of group2.pieces) {
|
|
16533
18287
|
for (const { segment: segment2 } of graphemes.segment(piece.text)) {
|
|
16534
18288
|
const next = { ...piece, text: segment2 };
|
|
16535
|
-
if (
|
|
16536
|
-
|
|
18289
|
+
if (line4.length && width(merged(line4, [next])) > maxWidth) flush();
|
|
18290
|
+
line4 = merged(line4, [next]);
|
|
16537
18291
|
}
|
|
16538
18292
|
}
|
|
16539
|
-
} else
|
|
18293
|
+
} else line4 = merged(line4, group2.pieces);
|
|
16540
18294
|
}
|
|
16541
18295
|
flush();
|
|
16542
18296
|
return result;
|
|
@@ -16559,25 +18313,25 @@ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
|
|
|
16559
18313
|
];
|
|
16560
18314
|
const hardLines = [];
|
|
16561
18315
|
for (const paragraph of paragraphs) {
|
|
16562
|
-
let
|
|
18316
|
+
let line4 = {
|
|
16563
18317
|
...paragraph,
|
|
16564
18318
|
runs: []
|
|
16565
18319
|
};
|
|
16566
|
-
hardLines.push(
|
|
18320
|
+
hardLines.push(line4);
|
|
16567
18321
|
for (const run of paragraph.runs) {
|
|
16568
18322
|
const pieces = run.text.split("\n");
|
|
16569
18323
|
for (const [index, piece] of pieces.entries()) {
|
|
16570
18324
|
if (index) {
|
|
16571
|
-
|
|
16572
|
-
hardLines.push(
|
|
18325
|
+
line4 = { ...paragraph, runs: [] };
|
|
18326
|
+
hardLines.push(line4);
|
|
16573
18327
|
}
|
|
16574
|
-
if (piece)
|
|
18328
|
+
if (piece) line4.runs.push({ ...run, text: piece });
|
|
16575
18329
|
}
|
|
16576
18330
|
}
|
|
16577
18331
|
}
|
|
16578
|
-
const lines = hardLines.flatMap((
|
|
18332
|
+
const lines = hardLines.flatMap((line4) => {
|
|
16579
18333
|
const wrapped = wrapStyledRuns(
|
|
16580
|
-
|
|
18334
|
+
line4.runs,
|
|
16581
18335
|
capacity,
|
|
16582
18336
|
(content, run) => chartTextWidth(
|
|
16583
18337
|
content,
|
|
@@ -16590,7 +18344,7 @@ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
|
|
|
16590
18344
|
),
|
|
16591
18345
|
{ breakWords: true }
|
|
16592
18346
|
);
|
|
16593
|
-
const { spaceBefore, spaceAfter, ...properties } =
|
|
18347
|
+
const { spaceBefore, spaceAfter, ...properties } = line4;
|
|
16594
18348
|
return wrapped.map((runs, index) => ({
|
|
16595
18349
|
...properties,
|
|
16596
18350
|
runs,
|
|
@@ -16598,8 +18352,8 @@ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
|
|
|
16598
18352
|
...index === wrapped.length - 1 && spaceAfter ? { spaceAfter } : {}
|
|
16599
18353
|
}));
|
|
16600
18354
|
});
|
|
16601
|
-
const metrics = lines.map((
|
|
16602
|
-
const runs =
|
|
18355
|
+
const metrics = lines.map((line4) => {
|
|
18356
|
+
const runs = line4.runs.map((run) => ({
|
|
16603
18357
|
...run,
|
|
16604
18358
|
attrs: chartTextAttributes(
|
|
16605
18359
|
{ ...model, appearance: { title: run.appearance } },
|
|
@@ -16608,43 +18362,43 @@ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
|
|
|
16608
18362
|
)
|
|
16609
18363
|
}));
|
|
16610
18364
|
return {
|
|
16611
|
-
...
|
|
18365
|
+
...line4,
|
|
16612
18366
|
runs,
|
|
16613
18367
|
width: runs.reduce((sum, run) => sum + chartTextWidth(run.text, run.attrs, options2), 0),
|
|
16614
18368
|
size: runs.length ? Math.max(...runs.map((run) => run.attrs.size ?? 14)) : base.size ?? 14,
|
|
16615
18369
|
fontMetrics: (runs.length ? runs.map((run) => run.attrs) : [base]).map(
|
|
16616
|
-
(
|
|
18370
|
+
(attrs2) => chartFontMetrics(attrs2, options2)
|
|
16617
18371
|
)
|
|
16618
18372
|
};
|
|
16619
18373
|
});
|
|
16620
|
-
const measured = metrics.every((
|
|
16621
|
-
const vertical = metrics.map((
|
|
16622
|
-
const ascent = measured ? Math.max(...
|
|
16623
|
-
const descent = measured ? Math.max(...
|
|
18374
|
+
const measured = metrics.every((line4) => line4.fontMetrics.every((font) => font !== void 0));
|
|
18375
|
+
const vertical = metrics.map((line4) => {
|
|
18376
|
+
const ascent = measured ? Math.max(...line4.fontMetrics.map((font) => font.ascent)) : line4.size;
|
|
18377
|
+
const descent = measured ? Math.max(...line4.fontMetrics.map((font) => font.descent)) : line4.size * 0.4 + 4;
|
|
16624
18378
|
const natural = ascent + descent;
|
|
16625
|
-
const height2 = spacing(
|
|
18379
|
+
const height2 = spacing(line4.lineSpacing, natural, natural);
|
|
16626
18380
|
const leading = (height2 - natural) / 2;
|
|
16627
18381
|
return {
|
|
16628
18382
|
ascent: ascent + leading,
|
|
16629
18383
|
descent: descent + leading,
|
|
16630
18384
|
height: height2,
|
|
16631
|
-
before: spacing(
|
|
16632
|
-
after: spacing(
|
|
18385
|
+
before: spacing(line4.spaceBefore, natural, 0),
|
|
18386
|
+
after: spacing(line4.spaceAfter, natural, 0),
|
|
16633
18387
|
leading
|
|
16634
18388
|
};
|
|
16635
18389
|
});
|
|
16636
|
-
const boxWidth = Math.min(width - 16, Math.max(0, ...metrics.map((
|
|
18390
|
+
const boxWidth = Math.min(width - 16, Math.max(0, ...metrics.map((line4) => line4.width)) + 8);
|
|
16637
18391
|
const height = vertical.reduce(
|
|
16638
|
-
(sum,
|
|
18392
|
+
(sum, line4) => sum + line4.height + line4.before + line4.after,
|
|
16639
18393
|
measured ? 4 : 0
|
|
16640
18394
|
);
|
|
16641
18395
|
let baseline = 8 + (metrics[0]?.size ?? base.size ?? 14) + (vertical[0]?.before ?? 0) + (vertical[0]?.leading ?? 0);
|
|
16642
18396
|
const spans = [];
|
|
16643
|
-
for (const [index,
|
|
18397
|
+
for (const [index, line4] of metrics.entries()) {
|
|
16644
18398
|
if (index)
|
|
16645
18399
|
baseline += vertical[index - 1].descent + vertical[index - 1].after + vertical[index].before + vertical[index].ascent;
|
|
16646
|
-
let x =
|
|
16647
|
-
for (const run of
|
|
18400
|
+
let x = line4.align === "l" ? (width - boxWidth) / 2 + 4 : line4.align === "r" ? (width + boxWidth) / 2 - 4 - line4.width : (width - line4.width) / 2;
|
|
18401
|
+
for (const run of line4.runs) {
|
|
16648
18402
|
spans.push(
|
|
16649
18403
|
text(x, baseline, run.text, {
|
|
16650
18404
|
...run.attrs,
|
|
@@ -16698,11 +18452,11 @@ function renderChartSvg(model, width, height, options2 = {}) {
|
|
|
16698
18452
|
if (!model.titleOverlay)
|
|
16699
18453
|
area = { ...area, y: area.y + richTitle.height, h: area.h - richTitle.height };
|
|
16700
18454
|
} else if (model.title) {
|
|
16701
|
-
const
|
|
16702
|
-
const size =
|
|
16703
|
-
const label = fitChartText(model.title, w - 16,
|
|
16704
|
-
const titleWidth = Math.min(w - 16, chartTextWidth(label,
|
|
16705
|
-
const font = chartFontMetrics(
|
|
18455
|
+
const attrs2 = chartTextAttributes(model, "title", 14);
|
|
18456
|
+
const size = attrs2.size ?? 14;
|
|
18457
|
+
const label = fitChartText(model.title, w - 16, attrs2, options2);
|
|
18458
|
+
const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs2, options2) + 8);
|
|
18459
|
+
const font = chartFontMetrics(attrs2, options2);
|
|
16706
18460
|
const titleHeight = Math.max(24, font ? font.ascent + font.descent + 4 : size * 1.4 + 4);
|
|
16707
18461
|
out.push(
|
|
16708
18462
|
chartAreaRect(model, "title", {
|
|
@@ -16716,7 +18470,7 @@ function renderChartSvg(model, width, height, options2 = {}) {
|
|
|
16716
18470
|
text(w / 2, 8 + size, label, {
|
|
16717
18471
|
anchor: "middle",
|
|
16718
18472
|
fill: "#404040",
|
|
16719
|
-
...
|
|
18473
|
+
...attrs2
|
|
16720
18474
|
})
|
|
16721
18475
|
);
|
|
16722
18476
|
if (!model.titleOverlay)
|
|
@@ -16730,11 +18484,14 @@ function renderChartSvg(model, width, height, options2 = {}) {
|
|
|
16730
18484
|
out.push("</svg>");
|
|
16731
18485
|
return out.join("");
|
|
16732
18486
|
}
|
|
16733
|
-
const legend = chartLegendSvg(model, area, { width: w, height: h }, options2);
|
|
18487
|
+
const legend = model.type === "regionMap" ? { plot: area, foreground: false, markup: "" } : chartLegendSvg(model, area, { width: w, height: h }, options2);
|
|
16734
18488
|
area = legend.plot;
|
|
16735
18489
|
if (!legend.foreground) out.push(legend.markup);
|
|
16736
18490
|
if (area.w > 4 && area.h > 4) {
|
|
16737
|
-
if (model
|
|
18491
|
+
if (chart3DApplies(model)) out.push(chart3DSvg(model, area));
|
|
18492
|
+
else if (model.type === "regionMap")
|
|
18493
|
+
out.push(regionMapSvg(model, area, options2.mapApproximationLabel));
|
|
18494
|
+
else if (model.type === "pie" || model.type === "doughnut") out.push(pieSvg(model, area));
|
|
16738
18495
|
else if (model.type === "funnel") out.push(funnelSvg(model, area));
|
|
16739
18496
|
else if (model.type === "radar") out.push(radarSvg(model, area));
|
|
16740
18497
|
else if (model.type === "treemap") out.push(treemapSvg(model, area));
|
|
@@ -16764,6 +18521,7 @@ var DRAWN_CHART_TYPES = /* @__PURE__ */ new Set([
|
|
|
16764
18521
|
"treemap",
|
|
16765
18522
|
"sunburst",
|
|
16766
18523
|
"funnel",
|
|
18524
|
+
"regionMap",
|
|
16767
18525
|
"boxWhisker"
|
|
16768
18526
|
]);
|
|
16769
18527
|
function chartThemePalette(theme, fonts = {}) {
|
|
@@ -16778,7 +18536,8 @@ function chartThemePalette(theme, fonts = {}) {
|
|
|
16778
18536
|
function chartSpaceKind(space) {
|
|
16779
18537
|
if (!space.plotArea.groups.length) return { drawn: false };
|
|
16780
18538
|
const type = chartSummaryFromSpace(space).chartType;
|
|
16781
|
-
|
|
18539
|
+
const summary3D = type === "surface" && chartSummaryFromSpace(space).view3D !== void 0;
|
|
18540
|
+
return { type, drawn: DRAWN_CHART_TYPES.has(type) || summary3D };
|
|
16782
18541
|
}
|
|
16783
18542
|
function renderChartSpaceSvg(space, options2) {
|
|
16784
18543
|
const { width, height, theme, fonts, formatting, colorPalette, styleDefinition, ...svg } = options2;
|
|
@@ -16995,8 +18754,8 @@ function parseDirectParagraphProperties(props) {
|
|
|
16995
18754
|
const value = onOffElement(first2(props, key));
|
|
16996
18755
|
if (value !== void 0) paragraph[key] = value;
|
|
16997
18756
|
}
|
|
16998
|
-
const
|
|
16999
|
-
if (
|
|
18757
|
+
const outline2 = parseOutlineLevel(first2(props, "outlineLvl"));
|
|
18758
|
+
if (outline2 !== void 0) paragraph.outlineLevel = outline2;
|
|
17000
18759
|
const frame2 = first2(props, "framePr");
|
|
17001
18760
|
const dropCap = getW(frame2, "dropCap");
|
|
17002
18761
|
if (dropCap === "drop" || dropCap === "margin") {
|
|
@@ -17016,19 +18775,19 @@ function parseDirectParagraphProperties(props) {
|
|
|
17016
18775
|
const spacing2 = first2(props, "spacing");
|
|
17017
18776
|
const before = twipValue(getW(spacing2, "before"));
|
|
17018
18777
|
const after = twipValue(getW(spacing2, "after"));
|
|
17019
|
-
const
|
|
18778
|
+
const line4 = signedTwipValue(getW(spacing2, "line"));
|
|
17020
18779
|
if (before !== void 0) paragraph.spacingBeforeTwips = before;
|
|
17021
18780
|
if (after !== void 0) paragraph.spacingAfterTwips = after;
|
|
17022
18781
|
const beforeAuto = parseOnOff(getW(spacing2, "beforeAutospacing"));
|
|
17023
18782
|
const afterAuto = parseOnOff(getW(spacing2, "afterAutospacing"));
|
|
17024
18783
|
if (beforeAuto !== void 0) paragraph.spacingBeforeAuto = beforeAuto;
|
|
17025
18784
|
if (afterAuto !== void 0) paragraph.spacingAfterAuto = afterAuto;
|
|
17026
|
-
if (
|
|
17027
|
-
paragraph.lineSpacingTwips =
|
|
18785
|
+
if (line4 !== void 0) {
|
|
18786
|
+
paragraph.lineSpacingTwips = line4;
|
|
17028
18787
|
}
|
|
17029
18788
|
const rule = getW(spacing2, "lineRule");
|
|
17030
18789
|
if (rule === "auto" || rule === "exact" || rule === "atLeast") paragraph.lineSpacingRule = rule;
|
|
17031
|
-
else if (
|
|
18790
|
+
else if (line4 !== void 0) paragraph.lineSpacingRule = "auto";
|
|
17032
18791
|
const indent = first2(props, "ind");
|
|
17033
18792
|
const indentLeft = signedTwipValue(getW(indent, "left"));
|
|
17034
18793
|
const indentRight = signedTwipValue(getW(indent, "right"));
|
|
@@ -17052,6 +18811,12 @@ function parseDirectParagraphProperties(props) {
|
|
|
17052
18811
|
return paragraph;
|
|
17053
18812
|
}
|
|
17054
18813
|
|
|
18814
|
+
// docx/numbering-picture.ts
|
|
18815
|
+
function pictureBulletSizePt(picture, fontSizePt) {
|
|
18816
|
+
const heightPt = picture.heightPt ?? picture.widthPt ?? fontSizePt;
|
|
18817
|
+
return { widthPt: picture.widthPt ?? heightPt, heightPt };
|
|
18818
|
+
}
|
|
18819
|
+
|
|
17055
18820
|
// docx/numbering-parse.ts
|
|
17056
18821
|
var own = (map, key) => Object.prototype.hasOwnProperty.call(map, key) ? map[key] : void 0;
|
|
17057
18822
|
function resolveNumberingLevel(catalog, numId, level2) {
|
|
@@ -17408,6 +19173,7 @@ function computeListLabels(model) {
|
|
|
17408
19173
|
if (def.numFmt === "none") continue;
|
|
17409
19174
|
counters.advance(numId, level2, def, catalog);
|
|
17410
19175
|
const text2 = def.numFmt === "bullet" ? def.lvlText : substituteLvlText(def.lvlText, numId, level2, catalog, counters, Boolean(def.isLgl));
|
|
19176
|
+
const picture = def.pictureBulletId !== void 0 ? catalog.pictureBullets?.[def.pictureBulletId] : void 0;
|
|
17411
19177
|
labels.set(paragraph.id, {
|
|
17412
19178
|
numId,
|
|
17413
19179
|
level: level2,
|
|
@@ -17419,7 +19185,8 @@ function computeListLabels(model) {
|
|
|
17419
19185
|
hangingTwips: def.hangingTwips,
|
|
17420
19186
|
firstLineTwips: def.firstLineTwips,
|
|
17421
19187
|
markerFormat: def.markerFormat,
|
|
17422
|
-
tabStopTwips: def.tabStopTwips
|
|
19188
|
+
tabStopTwips: def.tabStopTwips,
|
|
19189
|
+
picture
|
|
17423
19190
|
})
|
|
17424
19191
|
});
|
|
17425
19192
|
}
|
|
@@ -18160,12 +19927,12 @@ function fillPaint(fill, theme) {
|
|
|
18160
19927
|
return DEFAULT_SHAPE_FILL;
|
|
18161
19928
|
}
|
|
18162
19929
|
function shapeAppearance(spec, theme) {
|
|
18163
|
-
const
|
|
19930
|
+
const line4 = spec.line;
|
|
18164
19931
|
return {
|
|
18165
19932
|
fill: isLinePreset(spec.preset) ? "none" : fillPaint(spec.fill, theme),
|
|
18166
|
-
stroke: linePaint(
|
|
18167
|
-
strokeWidthPx: round((
|
|
18168
|
-
...
|
|
19933
|
+
stroke: linePaint(line4?.fill, theme),
|
|
19934
|
+
strokeWidthPx: round((line4?.widthEmu ?? DEFAULT_SHAPE_LINE_EMU) / EMU_PER_PIXEL),
|
|
19935
|
+
...line4?.dash && DASHES2[line4.dash] ? { dash: DASHES2[line4.dash] } : {}
|
|
18169
19936
|
};
|
|
18170
19937
|
}
|
|
18171
19938
|
var luminance = (css) => {
|
|
@@ -18178,11 +19945,11 @@ var shapeTextColor = (fill) => fill === "none" || luminance(fill) > 0.6 ? "#0000
|
|
|
18178
19945
|
var FONT_PX = 14.67;
|
|
18179
19946
|
function wrapShapeText(lines, widthPx) {
|
|
18180
19947
|
const perLine = Math.max(1, Math.floor(widthPx / (FONT_PX * 0.52)));
|
|
18181
|
-
return lines.flatMap((
|
|
18182
|
-
if (
|
|
19948
|
+
return lines.flatMap((line4) => {
|
|
19949
|
+
if (line4.length <= perLine) return [line4];
|
|
18183
19950
|
const out = [];
|
|
18184
19951
|
let current = "";
|
|
18185
|
-
for (const word of
|
|
19952
|
+
for (const word of line4.split(/\s+/)) {
|
|
18186
19953
|
if (current && current.length + 1 + word.length > perLine) {
|
|
18187
19954
|
out.push(current);
|
|
18188
19955
|
current = word;
|
|
@@ -18221,7 +19988,7 @@ function shapeSvg(spec, widthPx, heightPx, theme) {
|
|
|
18221
19988
|
const lineHeight = FONT_PX * 1.2;
|
|
18222
19989
|
const first3 = (textRect.t + textRect.b) / 2 - (lines.length - 1) * lineHeight / 2;
|
|
18223
19990
|
const text2 = lines.length ? `<text font-family="Calibri,Arial,sans-serif" font-size="${FONT_PX}" fill="${color}" text-anchor="middle" dominant-baseline="central">${lines.map(
|
|
18224
|
-
(
|
|
19991
|
+
(line4, index) => `<tspan x="${round((textRect.l + textRect.r) / 2)}" y="${round(first3 + index * lineHeight)}">${escapeXml(line4)}</tspan>`
|
|
18225
19992
|
).join("")}</text>` : "";
|
|
18226
19993
|
const transform = [
|
|
18227
19994
|
spec.rotation ? `rotate(${spec.rotation} ${round(w / 2)} ${round(h / 2)})` : "",
|
|
@@ -18239,8 +20006,8 @@ var NO_TWIPS = twips(0);
|
|
|
18239
20006
|
function pxToTwips(px) {
|
|
18240
20007
|
return roundSignedTwips(px * 1440 / 96);
|
|
18241
20008
|
}
|
|
18242
|
-
function ptToPx(
|
|
18243
|
-
return
|
|
20009
|
+
function ptToPx(pt2) {
|
|
20010
|
+
return pt2 * 96 / 72;
|
|
18244
20011
|
}
|
|
18245
20012
|
var DEFAULT_TAB_STOP_PX = twipsToPx(twips(720));
|
|
18246
20013
|
var DEFAULT_FONT_FAMILY = "Calibri";
|
|
@@ -18416,7 +20183,7 @@ function paragraphsByPage(pages, source) {
|
|
|
18416
20183
|
if (at === void 0) return;
|
|
18417
20184
|
const shown = found.get(at) ?? [];
|
|
18418
20185
|
if (!box.lines.length) shown.push([0, Number.POSITIVE_INFINITY]);
|
|
18419
|
-
for (const
|
|
20186
|
+
for (const line4 of box.lines) shown.push([line4.sourceStart, line4.sourceEnd]);
|
|
18420
20187
|
found.set(at, shown);
|
|
18421
20188
|
};
|
|
18422
20189
|
const visit = (blocks) => {
|
|
@@ -18824,12 +20591,18 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
|
|
|
18824
20591
|
);
|
|
18825
20592
|
};
|
|
18826
20593
|
const lineStart = (lineIndex) => leftPx + (lineIndex === 0 ? firstLineExtraPx : 0) + boxFor(lineIndex).leftInsetPx;
|
|
18827
|
-
const tokenWidth = (token) =>
|
|
18828
|
-
token.
|
|
18829
|
-
|
|
18830
|
-
|
|
18831
|
-
|
|
18832
|
-
|
|
20594
|
+
const tokenWidth = (token) => {
|
|
20595
|
+
const run = token.kind === "word" ? paragraph.runs[token.runIndex] : void 0;
|
|
20596
|
+
if (run?.marker?.widthPx !== void 0 && token.kind === "word" && token.sourceStart === 0) {
|
|
20597
|
+
if (token.text === run.text.slice(0, run.marker.length)) return run.marker.widthPx;
|
|
20598
|
+
}
|
|
20599
|
+
return token.kind === "word" || token.kind === "space" ? runTextWidth(
|
|
20600
|
+
token.text,
|
|
20601
|
+
expectDefined(paragraph.runs[token.runIndex], "token run"),
|
|
20602
|
+
measurer,
|
|
20603
|
+
fonts[token.runIndex]
|
|
20604
|
+
) : token.kind === "object" ? paragraph.runs[token.runIndex]?.object?.widthPx ?? 0 : 0;
|
|
20605
|
+
};
|
|
18833
20606
|
const widths = tokens.map(tokenWidth);
|
|
18834
20607
|
const ends = /* @__PURE__ */ new Set(["tab", "lineBreak", "pageBreak", "columnBreak"]);
|
|
18835
20608
|
function segmentAfter(index) {
|
|
@@ -18980,11 +20753,11 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
|
|
|
18980
20753
|
}
|
|
18981
20754
|
flushLine(lines.length === 0, void 0);
|
|
18982
20755
|
const lastIndex = lines.length - 1;
|
|
18983
|
-
for (const [index,
|
|
20756
|
+
for (const [index, line4] of lines.entries()) {
|
|
18984
20757
|
lines[index] = {
|
|
18985
|
-
...
|
|
20758
|
+
...line4,
|
|
18986
20759
|
fragments: alignFragments(
|
|
18987
|
-
|
|
20760
|
+
line4.fragments,
|
|
18988
20761
|
availableWidth(index),
|
|
18989
20762
|
index === lastIndex,
|
|
18990
20763
|
// A line that runs around a picture is not aligned across it.
|
|
@@ -18997,10 +20770,10 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
|
|
|
18997
20770
|
const insetTopPx = extent("top");
|
|
18998
20771
|
const insetBottomPx = extent("bottom");
|
|
18999
20772
|
let y = insetTopPx;
|
|
19000
|
-
for (const
|
|
19001
|
-
y +=
|
|
19002
|
-
|
|
19003
|
-
y +=
|
|
20773
|
+
for (const line4 of lines) {
|
|
20774
|
+
y += line4.gapBeforePx ?? 0;
|
|
20775
|
+
line4.yPx = y;
|
|
20776
|
+
y += line4.heightPx;
|
|
19004
20777
|
}
|
|
19005
20778
|
const frame2 = borders || paragraph.shading ? {
|
|
19006
20779
|
leftPx: leftPx - extent("left"),
|
|
@@ -19301,7 +21074,7 @@ function splitCellAtHeight(boxes, cutHeightPx, paragraphCuts) {
|
|
|
19301
21074
|
continue;
|
|
19302
21075
|
}
|
|
19303
21076
|
const beforeLines = box.lines.filter(
|
|
19304
|
-
(
|
|
21077
|
+
(line4) => box.yPx + line4.yPx + line4.heightPx + (box.tableFragmentBottomPx ?? box.tableFrameInsets?.bottom ?? 0) <= cut
|
|
19305
21078
|
);
|
|
19306
21079
|
const afterLines = box.lines.slice(beforeLines.length);
|
|
19307
21080
|
if (beforeLines.length) {
|
|
@@ -19318,7 +21091,7 @@ function splitCellAtHeight(boxes, cutHeightPx, paragraphCuts) {
|
|
|
19318
21091
|
...box,
|
|
19319
21092
|
yPx: box.yPx + shift,
|
|
19320
21093
|
heightPx: afterLines.at(-1).yPx + afterLines.at(-1).heightPx - shift,
|
|
19321
|
-
lines: afterLines.map((
|
|
21094
|
+
lines: afterLines.map((line4) => ({ ...line4, yPx: line4.yPx - shift }))
|
|
19322
21095
|
});
|
|
19323
21096
|
}
|
|
19324
21097
|
}
|
|
@@ -19415,7 +21188,7 @@ function stackParagraphs(paragraphs, widthPx, measurer, note, topPx = 0, startTo
|
|
|
19415
21188
|
);
|
|
19416
21189
|
y += layout.spacingBeforePx;
|
|
19417
21190
|
const top = y;
|
|
19418
|
-
const lines = layout.lines.map((
|
|
21191
|
+
const lines = layout.lines.map((line4) => ({ ...line4 }));
|
|
19419
21192
|
boxes.push({
|
|
19420
21193
|
kind: "paragraph",
|
|
19421
21194
|
blockId: paragraph.id,
|
|
@@ -19513,7 +21286,7 @@ function splitNote(note, budget) {
|
|
|
19513
21286
|
continue;
|
|
19514
21287
|
}
|
|
19515
21288
|
const count = paragraph.lines.filter(
|
|
19516
|
-
(
|
|
21289
|
+
(line4) => paragraph.yPx + line4.yPx + line4.heightPx <= budget + 1e-6
|
|
19517
21290
|
).length;
|
|
19518
21291
|
const head = paragraph.lines.slice(0, count);
|
|
19519
21292
|
const tail = paragraph.lines.slice(count);
|
|
@@ -19529,7 +21302,7 @@ function splitNote(note, budget) {
|
|
|
19529
21302
|
...paragraph,
|
|
19530
21303
|
yPx: 0,
|
|
19531
21304
|
heightPx: Math.max(0, paragraph.heightPx - (first3?.yPx ?? 0)),
|
|
19532
|
-
lines: tail.map((
|
|
21305
|
+
lines: tail.map((line4) => ({ ...line4, yPx: line4.yPx - (first3?.yPx ?? 0) }))
|
|
19533
21306
|
});
|
|
19534
21307
|
}
|
|
19535
21308
|
if (!before.length) return { after: note };
|
|
@@ -20118,7 +21891,7 @@ function placeParagraph(cursor, placement, note) {
|
|
|
20118
21891
|
let lineCursor = 0;
|
|
20119
21892
|
let nextToken = 0;
|
|
20120
21893
|
let firstSegment = true;
|
|
20121
|
-
const lineHeight = (
|
|
21894
|
+
const lineHeight = (line4, index) => placement.trimLeadingColumnBreak && layout.columnBreakAfterLine.has(index) && line4.fragments.every((fragment) => !fragment.text && !fragment.object) ? 0 : line4.heightPx;
|
|
20122
21895
|
const placedNotes = /* @__PURE__ */ new Set();
|
|
20123
21896
|
const notesFor = (lines) => (placement.footnotes?.(lines, firstSegment) ?? []).filter((item) => !placedNotes.has(item.id));
|
|
20124
21897
|
const hold = (lines, bodyMinimum) => {
|
|
@@ -20128,7 +21901,7 @@ function placeParagraph(cursor, placement, note) {
|
|
|
20128
21901
|
paragraph.id,
|
|
20129
21902
|
notes,
|
|
20130
21903
|
bodyMinimum,
|
|
20131
|
-
Math.max(0, ...lines.map((
|
|
21904
|
+
Math.max(0, ...lines.map((line4) => line4.heightPx))
|
|
20132
21905
|
);
|
|
20133
21906
|
return notes;
|
|
20134
21907
|
};
|
|
@@ -20161,9 +21934,9 @@ function placeParagraph(cursor, placement, note) {
|
|
|
20161
21934
|
let end = lineCursor;
|
|
20162
21935
|
let forced;
|
|
20163
21936
|
for (let i = lineCursor; i < layout.lines.length; i++) {
|
|
20164
|
-
const
|
|
20165
|
-
const gap = i === lineCursor && !firstSegment ? 0 :
|
|
20166
|
-
const height = lineHeight(
|
|
21937
|
+
const line4 = expectDefined(layout.lines[i], "paragraph line index");
|
|
21938
|
+
const gap = i === lineCursor && !firstSegment ? 0 : line4.gapBeforePx ?? 0;
|
|
21939
|
+
const height = lineHeight(line4, i) + gap;
|
|
20167
21940
|
hold(
|
|
20168
21941
|
layout.lines.slice(lineCursor, i + 1),
|
|
20169
21942
|
cumulative + height + (firstSegment ? spacingBeforePx : 0)
|
|
@@ -20201,10 +21974,10 @@ function placeParagraph(cursor, placement, note) {
|
|
|
20201
21974
|
);
|
|
20202
21975
|
const first3 = expectDefined(layout.lines[lineCursor], "first line of paragraph segment");
|
|
20203
21976
|
const origin = first3.yPx - (firstSegment ? (first3.gapBeforePx ?? 0) + layout.insetTopPx : 0);
|
|
20204
|
-
const segmentLines = layout.lines.slice(lineCursor, lineCursor + placedCount).map((
|
|
20205
|
-
...
|
|
20206
|
-
yPx:
|
|
20207
|
-
heightPx: lineHeight(
|
|
21977
|
+
const segmentLines = layout.lines.slice(lineCursor, lineCursor + placedCount).map((line4, index) => ({
|
|
21978
|
+
...line4,
|
|
21979
|
+
yPx: line4.yPx - origin,
|
|
21980
|
+
heightPx: lineHeight(line4, lineCursor + index)
|
|
20208
21981
|
}));
|
|
20209
21982
|
const isFinal = lineCursor + placedCount >= layout.lines.length;
|
|
20210
21983
|
const lastLine = segmentLines.at(-1);
|
|
@@ -20403,10 +22176,10 @@ function prefix(row2, cut, cellCuts, paragraphCuts) {
|
|
|
20403
22176
|
continue;
|
|
20404
22177
|
}
|
|
20405
22178
|
const lines = [];
|
|
20406
|
-
for (const
|
|
20407
|
-
if (box.yPx +
|
|
22179
|
+
for (const line4 of box.lines) {
|
|
22180
|
+
if (box.yPx + line4.yPx + line4.heightPx + (box.tableFrameInsets?.bottom ?? 0) > contentCut + 1e-6)
|
|
20408
22181
|
break;
|
|
20409
|
-
lines.push(
|
|
22182
|
+
lines.push(line4);
|
|
20410
22183
|
}
|
|
20411
22184
|
if (lines.length)
|
|
20412
22185
|
boxes.push({ ...box, lines, heightPx: lines.at(-1).yPx + lines.at(-1).heightPx });
|
|
@@ -20466,14 +22239,14 @@ var TableFootnotes = class {
|
|
|
20466
22239
|
(box.lines[0]?.sourceStart ?? 0) === 0
|
|
20467
22240
|
)) {
|
|
20468
22241
|
if (this.placed.has(note.id)) continue;
|
|
20469
|
-
const
|
|
20470
|
-
(
|
|
22242
|
+
const line4 = box.lines.find(
|
|
22243
|
+
(line5) => line5.fragments.some(
|
|
20471
22244
|
(fragment) => source.runs[fragment.runIndex]?.footnoteReferenceId === note.id
|
|
20472
22245
|
)
|
|
20473
22246
|
) ?? box.lines[0];
|
|
20474
22247
|
const bottom = Math.min(
|
|
20475
22248
|
row2.heightPx,
|
|
20476
|
-
box.yPx + (
|
|
22249
|
+
box.yPx + (line4?.yPx ?? 0) + (line4?.heightPx ?? box.heightPx) + (box.tableFrameInsets?.bottom ?? 0)
|
|
20477
22250
|
);
|
|
20478
22251
|
const prior = refs.get(note.id);
|
|
20479
22252
|
if (!prior || bottom < prior.bottom)
|
|
@@ -20481,7 +22254,7 @@ var TableFootnotes = class {
|
|
|
20481
22254
|
note,
|
|
20482
22255
|
bottom,
|
|
20483
22256
|
blockId: box.blockId,
|
|
20484
|
-
before: box.yPx + (
|
|
22257
|
+
before: box.yPx + (line4?.yPx ?? 0) + (box.tableFrameInsets?.bottom ?? 0)
|
|
20485
22258
|
});
|
|
20486
22259
|
}
|
|
20487
22260
|
}
|
|
@@ -20547,8 +22320,8 @@ var TableFootnotes = class {
|
|
|
20547
22320
|
for (const [index, cell] of row2.cells.entries())
|
|
20548
22321
|
for (const box of cell) {
|
|
20549
22322
|
if (box.yPx > available + 1e-6) break;
|
|
20550
|
-
for (const
|
|
20551
|
-
const bottom = box.yPx +
|
|
22323
|
+
for (const line4 of box.lines) {
|
|
22324
|
+
const bottom = box.yPx + line4.yPx + line4.heightPx + (box.tableFrameInsets?.bottom ?? 0) + (row2.cellPadding?.[index]?.bottom ?? 0);
|
|
20552
22325
|
if (bottom > available + 1e-6) break;
|
|
20553
22326
|
if (bottom > 0) cuts.add(bottom);
|
|
20554
22327
|
}
|
|
@@ -20957,7 +22730,7 @@ function createReferenceFootnotes(width, measurer, report) {
|
|
|
20957
22730
|
return (paragraph, lines, includeUnanchored) => {
|
|
20958
22731
|
const selected = new Set(
|
|
20959
22732
|
lines.flatMap(
|
|
20960
|
-
(
|
|
22733
|
+
(line4) => line4.fragments.map((fragment) => paragraph.runs[fragment.runIndex]?.footnoteReferenceId)
|
|
20961
22734
|
)
|
|
20962
22735
|
);
|
|
20963
22736
|
const anchored = new Set(paragraph.runs.map((run) => run.footnoteReferenceId));
|
|
@@ -21130,7 +22903,7 @@ var SectionFlow = class {
|
|
|
21130
22903
|
run.object.noteSeparator === "continuationSeparator" ? width : 192,
|
|
21131
22904
|
Math.max(
|
|
21132
22905
|
0,
|
|
21133
|
-
width - (probe?.lines.flatMap((
|
|
22906
|
+
width - (probe?.lines.flatMap((line4) => line4.fragments).find(
|
|
21134
22907
|
(fragment) => fragment.runIndex === index && fragment.object?.noteSeparator
|
|
21135
22908
|
)?.xPx ?? 0)
|
|
21136
22909
|
)
|
|
@@ -21803,6 +23576,7 @@ function paragraphFloats(paragraph, theme) {
|
|
|
21803
23576
|
index: floats.length,
|
|
21804
23577
|
...svg ? { chart: { svg, label: "Shape", shape: true } } : {},
|
|
21805
23578
|
partName: image.partName,
|
|
23579
|
+
...image.pictureFill ? { pictureFill: image.pictureFill } : {},
|
|
21806
23580
|
contentType: image.contentType,
|
|
21807
23581
|
widthPx: image.widthPx,
|
|
21808
23582
|
heightPx: image.heightPx,
|
|
@@ -22287,8 +24061,8 @@ function delimiterToLatex(emit, node) {
|
|
|
22287
24061
|
const endNode = childNode(dPr, "m:endChr");
|
|
22288
24062
|
const open = hasAttr(begNode) ? attrVal(begNode) : "(";
|
|
22289
24063
|
const close = hasAttr(endNode) ? attrVal(endNode) : ")";
|
|
22290
|
-
const
|
|
22291
|
-
const sole =
|
|
24064
|
+
const elements3 = ensureArr(node["m:e"]);
|
|
24065
|
+
const sole = elements3.length === 1 ? soleChild(elements3[0]) : null;
|
|
22292
24066
|
if (sole?.tag === "m:m") {
|
|
22293
24067
|
const env = matrixEnvFor(open, close);
|
|
22294
24068
|
if (env) {
|
|
@@ -22305,7 +24079,7 @@ function delimiterToLatex(emit, node) {
|
|
|
22305
24079
|
}
|
|
22306
24080
|
const sepNode = childNode(dPr, "m:sepChr");
|
|
22307
24081
|
const separator = hasAttr(sepNode) ? attrVal(sepNode) : "|";
|
|
22308
|
-
const inner =
|
|
24082
|
+
const inner = elements3.map((e) => emit.children(e)).join(escapeMathText(separator));
|
|
22309
24083
|
return `\\left${delimToLatex(open)}${inner}\\right${delimToLatex(close)}`;
|
|
22310
24084
|
}
|
|
22311
24085
|
|
|
@@ -22898,16 +24672,16 @@ function layoutStructure(tag, node, style, ctx) {
|
|
|
22898
24672
|
return val(child(pr, "m:pos")) === "top" ? above(arg2("m:e"), mark, style) : below(arg2("m:e"), mark, style);
|
|
22899
24673
|
}
|
|
22900
24674
|
case "m:eqArr": {
|
|
22901
|
-
const lines = ensureArray(node["m:e"]).map((
|
|
24675
|
+
const lines = ensureArray(node["m:e"]).map((line4) => ctx.layout(line4, style));
|
|
22902
24676
|
const result = emptyBox();
|
|
22903
24677
|
const gap = style.size * 0.25;
|
|
22904
|
-
const total = lines.reduce((sum,
|
|
24678
|
+
const total = lines.reduce((sum, line4) => sum + line4.ascent + line4.descent, 0) + gap * Math.max(0, lines.length - 1);
|
|
22905
24679
|
let y = -(total / 2) + style.size * AXIS;
|
|
22906
|
-
for (const
|
|
22907
|
-
y +=
|
|
22908
|
-
result.prims.push(...shifted(
|
|
22909
|
-
result.width = Math.max(result.width,
|
|
22910
|
-
y +=
|
|
24680
|
+
for (const line4 of lines) {
|
|
24681
|
+
y += line4.ascent;
|
|
24682
|
+
result.prims.push(...shifted(line4.prims, 0, y));
|
|
24683
|
+
result.width = Math.max(result.width, line4.width);
|
|
24684
|
+
y += line4.descent + gap;
|
|
22911
24685
|
}
|
|
22912
24686
|
result.ascent = total / 2 + style.size * AXIS;
|
|
22913
24687
|
result.descent = total / 2 - style.size * AXIS;
|
|
@@ -23067,14 +24841,14 @@ var FONT_FAMILY = "'Cambria Math','STIX Two Math','Latin Modern Math','Times New
|
|
|
23067
24841
|
function primMarkup(prim) {
|
|
23068
24842
|
switch (prim.kind) {
|
|
23069
24843
|
case "text": {
|
|
23070
|
-
const
|
|
24844
|
+
const attrs2 = [
|
|
23071
24845
|
`font-size="${round2(prim.size)}"`,
|
|
23072
24846
|
prim.italic ? 'font-style="italic"' : "",
|
|
23073
24847
|
prim.bold ? 'font-weight="bold"' : "",
|
|
23074
24848
|
Array.from(prim.text).length > 1 ? `textLength="${round2(prim.fit)}" lengthAdjust="spacing"` : ""
|
|
23075
24849
|
].filter(Boolean);
|
|
23076
24850
|
const at = prim.stretch ? `transform="translate(${round2(prim.x)} ${round2(prim.y)}) scale(1 ${round2(prim.stretch)})"` : `x="${round2(prim.x)}" y="${round2(prim.y)}"`;
|
|
23077
|
-
return `<text ${at} ${
|
|
24851
|
+
return `<text ${at} ${attrs2.join(" ")}>${escapeXml2(prim.text)}</text>`;
|
|
23078
24852
|
}
|
|
23079
24853
|
case "line":
|
|
23080
24854
|
return `<line x1="${round2(prim.x1)}" y1="${round2(prim.y1)}" x2="${round2(prim.x2)}" y2="${round2(prim.y2)}" stroke="currentColor" stroke-width="${round2(prim.width)}"/>`;
|
|
@@ -23264,9 +25038,9 @@ function paragraphBox(formatting, theme) {
|
|
|
23264
25038
|
let betweenBorder;
|
|
23265
25039
|
for (const side of ["top", "bottom", "left", "right", "between"]) {
|
|
23266
25040
|
const source = formatting.borders?.[side];
|
|
23267
|
-
const
|
|
23268
|
-
if (!
|
|
23269
|
-
const resolved = { ...
|
|
25041
|
+
const line4 = border(source, theme);
|
|
25042
|
+
if (!line4) continue;
|
|
25043
|
+
const resolved = { ...line4, spacePx: pointsToPx(source?.spacePoints ?? 0) };
|
|
23270
25044
|
if (side === "between") betweenBorder = resolved;
|
|
23271
25045
|
else borders[side] = resolved;
|
|
23272
25046
|
}
|
|
@@ -23289,8 +25063,8 @@ function groupParagraphBorders(blocks, between) {
|
|
|
23289
25063
|
const borders = { ...block.borders };
|
|
23290
25064
|
if (sameAsNext) delete borders.bottom;
|
|
23291
25065
|
if (sameAsPrevious) {
|
|
23292
|
-
const
|
|
23293
|
-
if (
|
|
25066
|
+
const line4 = between.get(block);
|
|
25067
|
+
if (line4) borders.top = line4;
|
|
23294
25068
|
else delete borders.top;
|
|
23295
25069
|
}
|
|
23296
25070
|
block.borders = borders;
|
|
@@ -23422,6 +25196,7 @@ function adaptDocumentModel(model, note = () => {
|
|
|
23422
25196
|
noteSeparator: run.noteSeparator
|
|
23423
25197
|
} : image && !image.anchored ? {
|
|
23424
25198
|
partName: image.partName,
|
|
25199
|
+
...image.pictureFill ? { pictureFill: image.pictureFill } : {},
|
|
23425
25200
|
contentType: image.contentType,
|
|
23426
25201
|
widthPx: image.widthPx,
|
|
23427
25202
|
heightPx: image.heightPx,
|
|
@@ -23459,10 +25234,18 @@ function adaptDocumentModel(model, note = () => {
|
|
|
23459
25234
|
const first3 = adaptRun(paragraph.runs[0] ?? { text: "" }, paragraph.style);
|
|
23460
25235
|
const marker = label.markerFormat;
|
|
23461
25236
|
const suffix = label.suffix === "tab" ? " " : label.suffix === "space" ? " " : "";
|
|
25237
|
+
const pictureWidthPx = label.picture ? pictureBulletSizePt(
|
|
25238
|
+
label.picture,
|
|
25239
|
+
marker?.fontSizeHalfPoints ? marker.fontSizeHalfPoints / 2 : first3.fontSizePt ?? 11
|
|
25240
|
+
).widthPt * 4 / 3 : void 0;
|
|
23462
25241
|
return {
|
|
23463
25242
|
text: `${displayListLabel(label.text)}${suffix}`,
|
|
23464
25243
|
synthetic: true,
|
|
23465
|
-
marker: {
|
|
25244
|
+
marker: {
|
|
25245
|
+
length: displayListLabel(label.text).length,
|
|
25246
|
+
alignment: label.alignment ?? "left",
|
|
25247
|
+
...pictureWidthPx !== void 0 ? { widthPx: pictureWidthPx } : {}
|
|
25248
|
+
},
|
|
23466
25249
|
...definedProps({
|
|
23467
25250
|
bold: marker?.bold ?? first3.bold,
|
|
23468
25251
|
italic: marker?.italic ?? first3.italic,
|
|
@@ -23766,6 +25549,7 @@ function positionFloats(input, pages) {
|
|
|
23766
25549
|
widthPx: float.widthPx,
|
|
23767
25550
|
heightPx: float.heightPx,
|
|
23768
25551
|
partName: float.partName,
|
|
25552
|
+
...float.pictureFill ? { pictureFill: float.pictureFill } : {},
|
|
23769
25553
|
contentType: float.contentType,
|
|
23770
25554
|
...float.chart ? { chart: float.chart } : {},
|
|
23771
25555
|
behindText: Boolean(float.behindText),
|
|
@@ -23856,8 +25640,8 @@ function describePages(pages, indexOf) {
|
|
|
23856
25640
|
for (const page of pages) {
|
|
23857
25641
|
const first3 = paragraphBoxes(page)[0];
|
|
23858
25642
|
firstBlock.push(first3 ? indexOf.get(first3.blockId) : void 0);
|
|
23859
|
-
const
|
|
23860
|
-
startsBlock.push(
|
|
25643
|
+
const line4 = first3?.kind === "paragraph" ? first3.lines[0] : void 0;
|
|
25644
|
+
startsBlock.push(line4 !== void 0 && line4.sourceStart === 0);
|
|
23861
25645
|
}
|
|
23862
25646
|
return { firstBlock, startsBlock };
|
|
23863
25647
|
}
|