ooxml-core 1.29.0 → 1.30.1
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-CZG6ISCZ.cjs → PptxHandler-DHQPVTUI.cjs} +3 -3
- package/dist/PptxHandler-E4DDV3FQ.mjs +4 -0
- package/dist/{PptxHandler-QIHYALOV.mjs → PptxHandler-KKLAYUGQ.mjs} +2 -2
- package/dist/{PresentationBuilder-66EU3N3O.cjs → PresentationBuilder-JORMF5CP.cjs} +5 -5
- package/dist/{PresentationBuilder-5YM2L7DA.mjs → PresentationBuilder-Q2Z33LLM.mjs} +2 -2
- package/dist/{PresentationBuilder-UAINQZA2.mjs → PresentationBuilder-YYZYCKTZ.mjs} +2 -2
- package/dist/automation/index.cjs +4250 -3145
- package/dist/automation/index.mjs +4250 -3145
- package/dist/chart/box-distribution.d.ts +10 -0
- package/dist/chart/box-distribution.d.ts.map +1 -0
- package/dist/chart/data-table-layout.d.ts +8 -0
- package/dist/chart/data-table-layout.d.ts.map +1 -0
- package/dist/chart/date-axis.d.ts +3 -0
- package/dist/chart/date-axis.d.ts.map +1 -0
- package/dist/chart/date-format.d.ts +39 -0
- package/dist/chart/date-format.d.ts.map +1 -0
- package/dist/chart/edit/chartex-action.d.ts.map +1 -1
- package/dist/chart/edit/chartex-axis.d.ts.map +1 -1
- package/dist/chart/edit/chartex-structure.d.ts.map +1 -1
- package/dist/chart/edit/chartex.d.ts +3 -1
- package/dist/chart/edit/chartex.d.ts.map +1 -1
- package/dist/chart/edit/draft.d.ts.map +1 -1
- package/dist/chart/funnel-geometry.d.ts +15 -0
- package/dist/chart/funnel-geometry.d.ts.map +1 -0
- package/dist/chart/index.cjs +1392 -404
- package/dist/chart/index.d.ts +6 -0
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.mjs +1379 -405
- package/dist/chart/line-path.d.ts +30 -0
- package/dist/chart/line-path.d.ts.map +1 -0
- package/dist/chart/manual-layout.d.ts +15 -0
- package/dist/chart/manual-layout.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-analysis.d.ts +2 -0
- package/dist/chart/render/chart-svg-analysis.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-bars.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-box.d.ts +5 -0
- package/dist/chart/render/chart-svg-box.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-cartesian.d.ts +3 -1
- package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-data-table.d.ts +11 -0
- package/dist/chart/render/chart-svg-data-table.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-date-axis.d.ts +9 -0
- package/dist/chart/render/chart-svg-date-axis.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-funnel.d.ts +4 -0
- package/dist/chart/render/chart-svg-funnel.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-labels.d.ts +16 -16
- package/dist/chart/render/chart-svg-labels.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-line.d.ts +5 -0
- package/dist/chart/render/chart-svg-line.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-plot-layout.d.ts +6 -0
- package/dist/chart/render/chart-svg-plot-layout.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-plots.d.ts +2 -1
- package/dist/chart/render/chart-svg-plots.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-radial.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-slice-labels.d.ts +18 -0
- package/dist/chart/render/chart-svg-slice-labels.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-xy.d.ts +2 -1
- package/dist/chart/render/chart-svg-xy.d.ts.map +1 -1
- package/dist/chart/render/chart-svg.d.ts.map +1 -1
- package/dist/chart/render/chart-title-text.d.ts +3 -1
- package/dist/chart/render/chart-title-text.d.ts.map +1 -1
- package/dist/chart/render/chart-view-analysis.d.ts +2 -1
- package/dist/chart/render/chart-view-analysis.d.ts.map +1 -1
- package/dist/chart/render/chart-view-data-table.d.ts +13 -0
- package/dist/chart/render/chart-view-data-table.d.ts.map +1 -0
- package/dist/chart/render/chart-view-labels.d.ts +6 -1
- package/dist/chart/render/chart-view-labels.d.ts.map +1 -1
- package/dist/chart/render/chart-view-series.d.ts.map +1 -1
- package/dist/chart/render/chart-view.d.ts +13 -0
- package/dist/chart/render/chart-view.d.ts.map +1 -1
- package/dist/chart/render/render-space.d.ts.map +1 -1
- package/dist/chart/render/summary-ex-series.d.ts +5 -0
- package/dist/chart/render/summary-ex-series.d.ts.map +1 -0
- package/dist/chart/render/summary-from-chartex.d.ts.map +1 -1
- package/dist/chart/render/summary-from-space.d.ts +1 -1
- package/dist/chart/render/summary-from-space.d.ts.map +1 -1
- package/dist/chart/render/summary-labels.d.ts.map +1 -1
- package/dist/chart/render/summary.d.ts +14 -1
- package/dist/chart/render/summary.d.ts.map +1 -1
- package/dist/{chunk-6C4NLBLB.mjs → chunk-6FXOAMNL.mjs} +1 -1
- package/dist/{chunk-T7HBA3CW.cjs → chunk-7T3SJQA6.cjs} +11 -9
- package/dist/{chunk-XROY25LN.cjs → chunk-7XYVFUB3.cjs} +4 -0
- package/dist/{chunk-I2CGNAP2.cjs → chunk-B4LXDHBX.cjs} +1409 -1389
- package/dist/{chunk-GUNTIFGT.cjs → chunk-CZXM4ZJH.cjs} +158 -26
- package/dist/{chunk-RYOJHYA3.mjs → chunk-DJ3CDTMX.mjs} +157 -27
- package/dist/{chunk-BBK3UB7M.mjs → chunk-FFJBOR2Y.mjs} +4 -4
- package/dist/{chunk-DWEQWFQU.mjs → chunk-GJDFCP2T.mjs} +248 -228
- package/dist/{chunk-KBER3RAP.mjs → chunk-KWJYMAEF.mjs} +248 -228
- package/dist/{chunk-XCRDAVFN.mjs → chunk-MKDONWNO.mjs} +237 -95
- package/dist/{chunk-3UMDVJRN.mjs → chunk-NBMXEVHL.mjs} +4 -1
- package/dist/{chunk-TVJL7QIG.cjs → chunk-OGEL4Z4S.cjs} +8 -1
- package/dist/{chunk-HRU3KOE5.mjs → chunk-OORQCSVA.mjs} +5 -3
- package/dist/{chunk-7RJYOVQU.mjs → chunk-R7NS42KQ.mjs} +5 -2
- package/dist/{chunk-DXOBT2JE.mjs → chunk-UZWV2HAJ.mjs} +8 -2
- package/dist/{chunk-PDZ4GQLI.mjs → chunk-WZJ25K7P.mjs} +1 -1
- package/dist/{chunk-IETFPVLN.cjs → chunk-XTUX5RMG.cjs} +15 -12
- package/dist/diagram/drawing.d.ts.map +1 -1
- package/dist/diagram/index.cjs +1218 -592
- package/dist/diagram/index.mjs +1218 -592
- package/dist/diagram/load.d.ts.map +1 -1
- package/dist/diagram/relationships.d.ts +1 -0
- package/dist/diagram/relationships.d.ts.map +1 -1
- package/dist/diagram/types.d.ts +2 -0
- package/dist/diagram/types.d.ts.map +1 -1
- package/dist/docx/diagram.d.ts.map +1 -1
- package/dist/docx/drawing.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +1850 -1138
- package/dist/docx/embedded.mjs +1850 -1138
- package/dist/docx/index.cjs +3312 -1713
- package/dist/docx/index.mjs +3312 -1713
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/fonts.d.ts +1 -1
- package/dist/docx/layout/fonts.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +1933 -518
- package/dist/docx/layout/index.mjs +1933 -518
- package/dist/docx/layout/script-fonts.d.ts +6 -0
- package/dist/docx/layout/script-fonts.d.ts.map +1 -0
- package/dist/docx/load/index.cjs +1853 -1141
- package/dist/docx/load/index.mjs +1853 -1141
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/shape-model.d.ts +2 -0
- package/dist/docx/shape-model.d.ts.map +1 -1
- package/dist/docx/shape-parse.d.ts.map +1 -1
- package/dist/docx/shape-svg.d.ts.map +1 -1
- package/dist/docx/ui/index.cjs +1763 -593
- package/dist/docx/ui/index.mjs +1763 -593
- package/dist/docx/write-shape.d.ts.map +1 -1
- package/dist/drawingml/custom-geometry.d.ts +5 -0
- package/dist/drawingml/custom-geometry.d.ts.map +1 -0
- package/dist/drawingml/drawing-fill.d.ts.map +1 -1
- package/dist/drawingml/drawing-geometry.d.ts.map +1 -1
- package/dist/drawingml/image-content-type.d.ts +2 -0
- package/dist/drawingml/image-content-type.d.ts.map +1 -0
- package/dist/drawingml/index.cjs +1128 -179
- package/dist/drawingml/index.d.ts +9 -0
- package/dist/drawingml/index.d.ts.map +1 -1
- package/dist/drawingml/index.mjs +1110 -180
- package/dist/drawingml/path-data.d.ts +4 -0
- package/dist/drawingml/path-data.d.ts.map +1 -0
- package/dist/drawingml/picture-crop.d.ts +8 -0
- package/dist/drawingml/picture-crop.d.ts.map +1 -0
- package/dist/drawingml/picture-effects.d.ts +37 -0
- package/dist/drawingml/picture-effects.d.ts.map +1 -0
- package/dist/drawingml/picture-fill.d.ts +7 -0
- package/dist/drawingml/picture-fill.d.ts.map +1 -0
- package/dist/drawingml/read-3d-values.d.ts +8 -0
- package/dist/drawingml/read-3d-values.d.ts.map +1 -0
- package/dist/drawingml/read-text-3d.d.ts +8 -0
- package/dist/drawingml/read-text-3d.d.ts.map +1 -0
- package/dist/drawingml/read-text-body.d.ts.map +1 -1
- package/dist/drawingml/scene3d-coordinate.d.ts +45 -0
- package/dist/drawingml/scene3d-coordinate.d.ts.map +1 -0
- package/dist/drawingml/scene3d-presets.d.ts +12 -0
- package/dist/drawingml/scene3d-presets.d.ts.map +1 -0
- package/dist/drawingml/text-3d-model.d.ts +71 -0
- package/dist/drawingml/text-3d-model.d.ts.map +1 -0
- package/dist/drawingml/text-model.d.ts +3 -0
- package/dist/drawingml/text-model.d.ts.map +1 -1
- package/dist/drawingml/types.d.ts +3 -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-text-3d.d.ts +6 -0
- package/dist/drawingml/write-text-3d.d.ts.map +1 -0
- package/dist/drawingml/write-text-body.d.ts.map +1 -1
- package/dist/geometry/element-transform.d.ts +3 -0
- package/dist/geometry/element-transform.d.ts.map +1 -1
- package/dist/geometry/index.cjs +69 -4
- package/dist/geometry/index.d.ts +2 -0
- package/dist/geometry/index.d.ts.map +1 -1
- package/dist/geometry/index.mjs +66 -5
- package/dist/geometry/picture-crop.d.ts +21 -0
- package/dist/geometry/picture-crop.d.ts.map +1 -0
- package/dist/geometry/resize-aspect.d.ts +12 -0
- package/dist/geometry/resize-aspect.d.ts.map +1 -0
- package/dist/index.cjs +4201 -2058
- package/dist/index.mjs +4201 -2058
- package/dist/opc/index.cjs +9 -6
- package/dist/opc/index.mjs +9 -6
- package/dist/opc/safe-href.d.ts +10 -3
- package/dist/opc/safe-href.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +634 -361
- package/dist/pptx/automation/index.d.ts +6 -6
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{elements-CCEghtE_.d.ts → elements-mSCZ84Tc.d.ts} +4 -4
- package/dist/pptx/chunks/elements-mSCZ84Tc.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-D90lhgiE.d.ts → index-BQDcu_0a.d.ts} +19 -111
- package/dist/pptx/chunks/index-BQDcu_0a.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CmnbpSCL.d.ts → index-CBV1oHN7.d.ts} +5 -5
- package/dist/pptx/chunks/{index-CmnbpSCL.d.ts.map → index-CBV1oHN7.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-DJIPX0Ge.d.ts → index-PdM5zpmu.d.ts} +5 -5
- package/dist/pptx/chunks/{index-DJIPX0Ge.d.ts.map → index-PdM5zpmu.d.ts.map} +1 -1
- package/dist/pptx/chunks/{smart-art-BLBSej3J.d.ts → smart-art-DLumQo90.d.ts} +135 -103
- package/dist/pptx/chunks/smart-art-DLumQo90.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-D49FKllA.d.ts → text-P9xVnXXf.d.ts} +49 -60
- package/dist/pptx/chunks/text-P9xVnXXf.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-DZ1IgDJN.d.ts → text-operations-hyPODwIQ.d.ts} +4 -4
- package/dist/pptx/chunks/{text-operations-DZ1IgDJN.d.ts.map → text-operations-hyPODwIQ.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +630 -357
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +102 -67
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/collaboration-assets.cjs +15 -11
- package/dist/pptx/editor/render/collaboration-assets.d.ts +2 -2
- package/dist/pptx/editor/render/collaboration-assets.mjs +1 -1
- package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +5 -5
- package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +3 -3
- package/dist/pptx/editor/render/collaboration-reconcile.cjs +9 -9
- package/dist/pptx/editor/render/collaboration-reconcile.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-reconcile.mjs +3 -3
- package/dist/pptx/editor/render/collaboration-sync.cjs +29 -25
- package/dist/pptx/editor/render/collaboration-sync.d.ts +7 -0
- package/dist/pptx/editor/render/collaboration-sync.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-sync.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.cjs +14 -14
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +1 -1
- package/dist/pptx/editor/render/font-family-update.d.ts +1 -1
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +8 -8
- package/dist/pptx/editor/render/slide-operations.mjs +2 -2
- package/dist/pptx/editor/render/table-cell-edit.cjs +8 -4
- package/dist/pptx/editor/render/table-cell-edit.d.ts +5 -0
- package/dist/pptx/editor/render/table-cell-edit.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-cell-edit.mjs +1 -1
- package/dist/pptx/editor/render/table-cell-merge.cjs +3 -3
- package/dist/pptx/editor/render/table-cell-merge.mjs +1 -1
- package/dist/pptx/editor/render/table-data-grid-ops.cjs +2 -2
- package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
- package/dist/pptx/editor/render/table-merge.cjs +5 -5
- package/dist/pptx/editor/render/table-merge.mjs +1 -1
- package/dist/pptx/editor/render/text-content-style.d.ts +1 -1
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +2 -2
- package/dist/pptx/editor/render/text-style-scope.d.ts +2 -2
- package/dist/pptx/editor/render/update-text-segment-style.d.ts +1 -1
- package/dist/pptx/index.cjs +696 -419
- package/dist/pptx/index.d.ts +8 -8
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/pptx/smartart-layouts/index.d.ts +1 -1
- package/dist/teams/index.cjs +1816 -1049
- package/dist/teams/index.mjs +1816 -1049
- package/dist/text/font-style-name.d.ts +11 -0
- package/dist/text/font-style-name.d.ts.map +1 -0
- package/dist/text/font-substitution-map.d.ts +3 -0
- package/dist/text/font-substitution-map.d.ts.map +1 -0
- package/dist/text/font-substitution.d.ts +34 -0
- package/dist/text/font-substitution.d.ts.map +1 -0
- package/dist/text/index.cjs +460 -0
- package/dist/text/index.d.ts +3 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.mjs +443 -1
- package/dist/text/metric-font-family.d.ts +7 -0
- package/dist/text/metric-font-family.d.ts.map +1 -0
- package/dist/text/panose.d.ts +55 -0
- package/dist/text/panose.d.ts.map +1 -0
- package/dist/text/script-fonts.d.ts +26 -0
- package/dist/text/script-fonts.d.ts.map +1 -0
- package/dist/visio/edit-geometry-admission.d.ts +1 -1
- package/dist/visio/edit-geometry-admission.d.ts.map +1 -1
- package/dist/visio/edit-group-resize.d.ts +26 -0
- package/dist/visio/edit-group-resize.d.ts.map +1 -0
- package/dist/visio/edit-recalculate-index.d.ts +2 -0
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-resize-anchor.d.ts.map +1 -1
- package/dist/visio/edit-resize-plan.d.ts +14 -0
- package/dist/visio/edit-resize-plan.d.ts.map +1 -0
- package/dist/visio/edit-scope.d.ts.map +1 -1
- package/dist/visio/index.cjs +1326 -389
- package/dist/visio/index.mjs +1326 -389
- package/dist/visio/ui/geometry-expectation.d.ts +17 -0
- package/dist/visio/ui/geometry-expectation.d.ts.map +1 -0
- package/dist/visio/ui/guides.d.ts +2 -0
- package/dist/visio/ui/guides.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +1582 -411
- package/dist/visio/ui/index.d.ts +2 -0
- package/dist/visio/ui/index.d.ts.map +1 -1
- package/dist/visio/ui/index.mjs +1579 -412
- package/dist/visio/ui/selection-resize.d.ts +19 -0
- package/dist/visio/ui/selection-resize.d.ts.map +1 -0
- package/dist/visio/ui/shape-move.d.ts +1 -1
- package/dist/visio/ui/shape-move.d.ts.map +1 -1
- package/dist/visio/ui/shape-resize.d.ts.map +1 -1
- package/dist/xlsx/edit/drawings.d.ts +5 -0
- package/dist/xlsx/edit/drawings.d.ts.map +1 -1
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/types.d.ts +4 -0
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +3908 -2256
- package/dist/xlsx/index.mjs +3908 -2256
- package/dist/xlsx/layout/chart-view.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +2003 -1239
- package/dist/xlsx/load/index.mjs +2003 -1239
- package/dist/xlsx/model.d.ts +4 -0
- 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/smart-art.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +3880 -2228
- package/dist/xlsx/ui/index.mjs +3880 -2228
- package/dist/xlsx/write/drawing.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/PptxHandler-DSXSXMEG.mjs +0 -4
- package/dist/pptx/chunks/elements-CCEghtE_.d.ts.map +0 -1
- package/dist/pptx/chunks/index-D90lhgiE.d.ts.map +0 -1
- package/dist/pptx/chunks/smart-art-BLBSej3J.d.ts.map +0 -1
- package/dist/pptx/chunks/text-D49FKllA.d.ts.map +0 -1
package/dist/visio/index.mjs
CHANGED
|
@@ -145,8 +145,8 @@ function parseXml(xml, options2 = {}) {
|
|
|
145
145
|
let parsed;
|
|
146
146
|
try {
|
|
147
147
|
parsed = new DOMParser({
|
|
148
|
-
onError: (
|
|
149
|
-
if (
|
|
148
|
+
onError: (level3, message) => {
|
|
149
|
+
if (level3 !== "warning") parseError = message;
|
|
150
150
|
}
|
|
151
151
|
}).parseFromString(xml, "application/xml");
|
|
152
152
|
} catch (error) {
|
|
@@ -264,15 +264,15 @@ function* liteChildElements(xml, namespaces) {
|
|
|
264
264
|
function* topLevelNodes(xml, namespaces) {
|
|
265
265
|
const source = hasLineEnds(xml) ? xml.replace(/\r[\n\u0085]/g, "\n").replace(/[\r\u0085\u2028\u2029]/g, "\n") : xml;
|
|
266
266
|
const root2 = new LiteElement("", "", null);
|
|
267
|
-
const
|
|
267
|
+
const level3 = root2.childNodes;
|
|
268
268
|
const stack = [root2];
|
|
269
269
|
let top = root2;
|
|
270
270
|
const n = source.length;
|
|
271
271
|
let pos = 0;
|
|
272
272
|
while (pos < n) {
|
|
273
|
-
if (
|
|
274
|
-
yield*
|
|
275
|
-
|
|
273
|
+
if (level3.length && stack.length === 1) {
|
|
274
|
+
yield* level3;
|
|
275
|
+
level3.length = 0;
|
|
276
276
|
}
|
|
277
277
|
const lt = source.indexOf("<", pos);
|
|
278
278
|
const end = lt < 0 ? n : lt;
|
|
@@ -308,7 +308,7 @@ function* topLevelNodes(xml, namespaces) {
|
|
|
308
308
|
pos = parsed.end;
|
|
309
309
|
}
|
|
310
310
|
if (stack.length !== 1) return false;
|
|
311
|
-
yield*
|
|
311
|
+
yield* level3;
|
|
312
312
|
return true;
|
|
313
313
|
}
|
|
314
314
|
var DECLARATIONS = /<!DOCTYPE|<!ENTITY/i;
|
|
@@ -372,14 +372,14 @@ function startTag(source, from, namespaces) {
|
|
|
372
372
|
while (q < n && isSpace(source.charCodeAt(q))) q++;
|
|
373
373
|
const quote = source[q];
|
|
374
374
|
if (quote !== '"' && quote !== "'") return void 0;
|
|
375
|
-
const
|
|
376
|
-
if (
|
|
377
|
-
const raw2 = source.slice(q + 1,
|
|
375
|
+
const close3 = source.indexOf(quote, q + 1);
|
|
376
|
+
if (close3 < 0) return void 0;
|
|
377
|
+
const raw2 = source.slice(q + 1, close3);
|
|
378
378
|
if (raw2.includes("<") || element2.hasAttribute(name3)) return void 0;
|
|
379
379
|
const value3 = decode(/[\t\n\r]/.test(raw2) ? raw2.replace(/[\t\n\r]/g, " ") : raw2);
|
|
380
380
|
if (value3 === void 0) return void 0;
|
|
381
381
|
element2.attrs.push(name3, value3);
|
|
382
|
-
i =
|
|
382
|
+
i = close3 + 1;
|
|
383
383
|
const after = source.charCodeAt(i);
|
|
384
384
|
if (i < n && !isSpace(after) && after !== 62 && after !== 47) return void 0;
|
|
385
385
|
}
|
|
@@ -4364,7 +4364,11 @@ function indexCells(roots, options2) {
|
|
|
4364
4364
|
const unsafe2 = inherited || nested || node3.hasAttribute("Master") || node3.hasAttribute("MasterShape") || attribute2(node3, "Type") === "Group" || !isLocalForeignFrameShape(node3) && (attribute2(node3, "Type") !== void 0 && attribute2(node3, "Type") !== "Shape" || children2(node3, "ForeignData").length > 0 || children2(node3, "Rel").length > 0) || connected.has(shapeId2) && !options2.glueShapes?.has(node3) || !options2.lineEditShapes?.has(node3) && children2(node3, "Cell").some(
|
|
4365
4365
|
(cell) => /^(BeginX|BeginY|EndX|EndY)$/i.test(attribute2(cell, "N") ?? "") || attribute2(cell, "N")?.toLowerCase() === "oned" && (attribute2(cell, "V") !== "0" || !!executableCellFormula(attribute2(cell, "F")) || attribute2(cell, "F") === "Inh")
|
|
4366
4366
|
) || children2(node3, "Shapes").length > 0 || ["1", "true"].includes(attribute2(node3, "Del") ?? "");
|
|
4367
|
-
sheets.push({
|
|
4367
|
+
sheets.push({
|
|
4368
|
+
node: node3,
|
|
4369
|
+
shapeId: shapeId2,
|
|
4370
|
+
unsafe: options2.groupResizeShapes?.has(node3) ? false : unsafe2
|
|
4371
|
+
});
|
|
4368
4372
|
visit(node3, unsafe2, true);
|
|
4369
4373
|
}
|
|
4370
4374
|
};
|
|
@@ -4785,7 +4789,7 @@ function protectedShape(shape, document, masterMovePins = /* @__PURE__ */ new Se
|
|
|
4785
4789
|
}
|
|
4786
4790
|
return local.has("LockRotate") ? numeric(local.get("LockRotate"), 0) !== 0 : inheritedRotationLocked;
|
|
4787
4791
|
}
|
|
4788
|
-
function resizeGeometry(shape, roots, edit, check, lineEditShapes = /* @__PURE__ */ new Set(), glueShapes = /* @__PURE__ */ new Set()) {
|
|
4792
|
+
function resizeGeometry(shape, roots, edit, check, lineEditShapes = /* @__PURE__ */ new Set(), glueShapes = /* @__PURE__ */ new Set(), groupResizeShapes = /* @__PURE__ */ new Set()) {
|
|
4789
4793
|
const sections2 = children2(shape, "Section").filter((node3) => attribute2(node3, "N") === "Geometry");
|
|
4790
4794
|
let depends;
|
|
4791
4795
|
if (!sections2.length)
|
|
@@ -4827,7 +4831,12 @@ function resizeGeometry(shape, roots, edit, check, lineEditShapes = /* @__PURE__
|
|
|
4827
4831
|
const analysis = analyzeVisioFormula(formula2);
|
|
4828
4832
|
if (!analysis.references.length && numeric(node3) === 0) continue;
|
|
4829
4833
|
const cell = `Geometry${Number(attribute2(section3, "IX") ?? "0") + 1}.${attribute2(node3, "N")}${attribute2(row2, "IX")}`;
|
|
4830
|
-
depends ??= createVisioDependencyQuery(roots, {
|
|
4834
|
+
depends ??= createVisioDependencyQuery(roots, {
|
|
4835
|
+
check,
|
|
4836
|
+
lineEditShapes,
|
|
4837
|
+
glueShapes,
|
|
4838
|
+
groupResizeShapes
|
|
4839
|
+
});
|
|
4831
4840
|
if (!depends(
|
|
4832
4841
|
{ pageId: edit.pageId, shapeId: edit.shapeId, cell },
|
|
4833
4842
|
["Width", "Height"].map((cell2) => ({
|
|
@@ -6827,7 +6836,7 @@ function pathCommands(value3, limits, budget) {
|
|
|
6827
6836
|
const whitespace = () => {
|
|
6828
6837
|
while (position < data.length && WSP.test(data[position])) position++;
|
|
6829
6838
|
};
|
|
6830
|
-
function
|
|
6839
|
+
function operand2(separator, flag) {
|
|
6831
6840
|
whitespace();
|
|
6832
6841
|
if (separator && data[position] === ",") {
|
|
6833
6842
|
position++;
|
|
@@ -6857,7 +6866,7 @@ function pathCommands(value3, limits, budget) {
|
|
|
6857
6866
|
if (budget.commands >= limits.maxPathCommands) limit("Path command limit exceeded.");
|
|
6858
6867
|
const values = [];
|
|
6859
6868
|
for (let i = 0; i < arity; i++)
|
|
6860
|
-
values.push(
|
|
6869
|
+
values.push(operand2(i > 0 || !explicit, command2 === "A" && (i === 3 || i === 4)));
|
|
6861
6870
|
const px = (i) => values[i] + (relative ? x : 0);
|
|
6862
6871
|
const py = (i) => values[i] + (relative ? y : 0);
|
|
6863
6872
|
let output;
|
|
@@ -8033,6 +8042,141 @@ function resolveDrawingColor(color2, theme2, options2) {
|
|
|
8033
8042
|
};
|
|
8034
8043
|
}
|
|
8035
8044
|
|
|
8045
|
+
// drawingml/picture-crop.ts
|
|
8046
|
+
var SIDES = { l: "cropLeft", t: "cropTop", r: "cropRight", b: "cropBottom" };
|
|
8047
|
+
function parsePictureCrop(blipFill) {
|
|
8048
|
+
const rect = first(blipFill, "srcRect", NS.a);
|
|
8049
|
+
if (!rect) return void 0;
|
|
8050
|
+
const result2 = {};
|
|
8051
|
+
for (const [attr2, key2] of Object.entries(SIDES)) {
|
|
8052
|
+
const raw2 = rect.getAttribute(attr2);
|
|
8053
|
+
if (raw2 === null || !raw2.trim()) continue;
|
|
8054
|
+
const percent = raw2.endsWith("%");
|
|
8055
|
+
const value3 = Number(percent ? raw2.slice(0, -1) : raw2) / (percent ? 100 : 1e5);
|
|
8056
|
+
if (Number.isFinite(value3)) result2[key2] = value3;
|
|
8057
|
+
}
|
|
8058
|
+
return result2;
|
|
8059
|
+
}
|
|
8060
|
+
function applyPictureCrop(blipFill, crop) {
|
|
8061
|
+
let rect = first(blipFill, "srcRect", NS.a);
|
|
8062
|
+
if (!rect && crop && Object.values(crop).some((value3) => value3 !== void 0)) {
|
|
8063
|
+
rect = blipFill.ownerDocument.createElementNS(NS.a, "a:srcRect");
|
|
8064
|
+
const blip = first(blipFill, "blip", NS.a);
|
|
8065
|
+
blipFill.insertBefore(rect, blip?.nextSibling ?? blipFill.firstChild);
|
|
8066
|
+
}
|
|
8067
|
+
if (!rect) return;
|
|
8068
|
+
for (const [attr2, key2] of Object.entries(SIDES)) {
|
|
8069
|
+
const value3 = crop?.[key2];
|
|
8070
|
+
if (value3 === void 0) rect.removeAttribute(attr2);
|
|
8071
|
+
else {
|
|
8072
|
+
if (!Number.isFinite(value3)) throw new RangeError("Picture crop must be finite");
|
|
8073
|
+
rect.setAttribute(attr2, String(Math.round(value3 * 1e5)));
|
|
8074
|
+
}
|
|
8075
|
+
}
|
|
8076
|
+
}
|
|
8077
|
+
|
|
8078
|
+
// drawingml/picture-effects.ts
|
|
8079
|
+
function picturePercentage(value3) {
|
|
8080
|
+
const text5 = String(value3 ?? "").trim();
|
|
8081
|
+
if (!text5) return void 0;
|
|
8082
|
+
const percent = text5.endsWith("%");
|
|
8083
|
+
const n = Number(percent ? text5.slice(0, -1) : text5) / (percent ? 100 : 1e5);
|
|
8084
|
+
return Number.isFinite(n) ? n : void 0;
|
|
8085
|
+
}
|
|
8086
|
+
function readPictureEffect(name3, attribute4) {
|
|
8087
|
+
if (name3 === "grayscl") return { kind: "grayscale" };
|
|
8088
|
+
if (name3 === "lum") {
|
|
8089
|
+
const brightness = picturePercentage(attribute4("bright"));
|
|
8090
|
+
const contrast = picturePercentage(attribute4("contrast"));
|
|
8091
|
+
for (const [name4, value3] of [
|
|
8092
|
+
["bright", brightness],
|
|
8093
|
+
["contrast", contrast]
|
|
8094
|
+
]) {
|
|
8095
|
+
const raw2 = attribute4(name4);
|
|
8096
|
+
if (raw2 !== void 0 && raw2 !== null && (value3 === void 0 || Math.abs(value3) > 1))
|
|
8097
|
+
return void 0;
|
|
8098
|
+
}
|
|
8099
|
+
return {
|
|
8100
|
+
kind: "luminance",
|
|
8101
|
+
...brightness !== void 0 ? { brightness } : {},
|
|
8102
|
+
...contrast !== void 0 ? { contrast } : {}
|
|
8103
|
+
};
|
|
8104
|
+
}
|
|
8105
|
+
if (name3 === "alphaModFix") {
|
|
8106
|
+
const raw2 = attribute4("amt");
|
|
8107
|
+
const amount = raw2 === void 0 || raw2 === null ? 1 : picturePercentage(raw2);
|
|
8108
|
+
if (amount !== void 0 && amount >= 0) return { kind: "alphaModFix", amount };
|
|
8109
|
+
}
|
|
8110
|
+
return void 0;
|
|
8111
|
+
}
|
|
8112
|
+
function parsePictureEffects(blip) {
|
|
8113
|
+
if (!blip) return [];
|
|
8114
|
+
return elements(blip).map((node3) => ({
|
|
8115
|
+
...(node3.namespaceURI === NS.a ? readPictureEffect(node3.localName, (name3) => node3.getAttribute(name3)) : void 0) ?? { kind: "unsupported", name: node3.localName },
|
|
8116
|
+
sourceXml: buildXml(node3)
|
|
8117
|
+
}));
|
|
8118
|
+
}
|
|
8119
|
+
function applyPictureEffects(blip, effects) {
|
|
8120
|
+
if (JSON.stringify(parsePictureEffects(blip)) === JSON.stringify(effects)) return;
|
|
8121
|
+
const nodes = effects.map((effect) => {
|
|
8122
|
+
const name3 = effect.kind === "grayscale" ? "grayscl" : effect.kind === "luminance" ? "lum" : effect.kind === "unsupported" ? effect.name : effect.kind;
|
|
8123
|
+
const source = effect.sourceXml ? parseXml(effect.sourceXml).documentElement : void 0;
|
|
8124
|
+
if (effect.kind === "unsupported" && !source)
|
|
8125
|
+
throw new Error("An unsupported picture effect needs source XML");
|
|
8126
|
+
const node3 = source ? blip.ownerDocument.importNode(source, true) : blip.ownerDocument.createElementNS(NS.a, `a:${name3}`);
|
|
8127
|
+
if (effect.kind !== "unsupported" && (node3.namespaceURI !== NS.a || node3.localName !== name3))
|
|
8128
|
+
throw new Error("Picture effect source does not match its kind");
|
|
8129
|
+
const set = (name4, value3) => {
|
|
8130
|
+
const original = picturePercentage(node3.getAttribute(name4));
|
|
8131
|
+
if (value3 === void 0) node3.removeAttribute(name4);
|
|
8132
|
+
else if (value3 !== original) {
|
|
8133
|
+
if (!Number.isFinite(value3)) throw new RangeError("Picture effect must be finite");
|
|
8134
|
+
node3.setAttribute(name4, String(Math.round(value3 * 1e5)));
|
|
8135
|
+
}
|
|
8136
|
+
};
|
|
8137
|
+
if (effect.kind === "luminance") {
|
|
8138
|
+
if ([effect.brightness, effect.contrast].some(
|
|
8139
|
+
(value3) => value3 !== void 0 && (!Number.isFinite(value3) || Math.abs(value3) > 1)
|
|
8140
|
+
))
|
|
8141
|
+
throw new RangeError("Picture luminance must be between -1 and 1");
|
|
8142
|
+
set("bright", effect.brightness);
|
|
8143
|
+
set("contrast", effect.contrast);
|
|
8144
|
+
}
|
|
8145
|
+
if (effect.kind === "alphaModFix") {
|
|
8146
|
+
if (effect.amount < 0) throw new RangeError("Picture alpha must be nonnegative");
|
|
8147
|
+
set("amt", effect.amount);
|
|
8148
|
+
}
|
|
8149
|
+
return node3;
|
|
8150
|
+
});
|
|
8151
|
+
for (const node3 of elements(blip)) blip.removeChild(node3);
|
|
8152
|
+
for (const node3 of nodes) blip.appendChild(node3);
|
|
8153
|
+
}
|
|
8154
|
+
|
|
8155
|
+
// drawingml/picture-fill.ts
|
|
8156
|
+
function parseDrawingPictureFill(fill) {
|
|
8157
|
+
const blip = first(fill, "blip", NS.a);
|
|
8158
|
+
const relId = blip?.getAttributeNS(NS.r, "embed") || blip?.getAttribute("r:embed") || void 0;
|
|
8159
|
+
const linkRelId = blip?.getAttributeNS(NS.r, "link") || void 0;
|
|
8160
|
+
const crop = parsePictureCrop(fill);
|
|
8161
|
+
const effects = parsePictureEffects(blip);
|
|
8162
|
+
const tile = first(fill, "tile", NS.a);
|
|
8163
|
+
const rect = first(first(fill, "stretch", NS.a), "fillRect", NS.a);
|
|
8164
|
+
const unsupported4 = [
|
|
8165
|
+
...tile ? ["tile"] : [],
|
|
8166
|
+
...rect && ["l", "t", "r", "b"].some((key2) => Number(rect.getAttribute(key2) ?? 0) !== 0) ? ["fillRect"] : [],
|
|
8167
|
+
...fill.getAttribute("rotWithShape") === "0" || fill.getAttribute("rotWithShape") === "false" ? ["rotWithShape"] : []
|
|
8168
|
+
];
|
|
8169
|
+
return {
|
|
8170
|
+
kind: "picture",
|
|
8171
|
+
sourceXml: buildXml(fill),
|
|
8172
|
+
...relId ? { relId } : {},
|
|
8173
|
+
...linkRelId ? { linkRelId } : {},
|
|
8174
|
+
...crop ? { crop } : {},
|
|
8175
|
+
...effects.length ? { effects } : {},
|
|
8176
|
+
...unsupported4.length ? { unsupportedPicture: unsupported4 } : {}
|
|
8177
|
+
};
|
|
8178
|
+
}
|
|
8179
|
+
|
|
8036
8180
|
// drawingml/drawing-fill.ts
|
|
8037
8181
|
var FILL_ELEMENTS = /* @__PURE__ */ new Set([
|
|
8038
8182
|
"noFill",
|
|
@@ -8042,13 +8186,13 @@ var FILL_ELEMENTS = /* @__PURE__ */ new Set([
|
|
|
8042
8186
|
"blipFill",
|
|
8043
8187
|
"grpFill"
|
|
8044
8188
|
]);
|
|
8045
|
-
function fillElementOf(
|
|
8046
|
-
return
|
|
8189
|
+
function fillElementOf(properties) {
|
|
8190
|
+
return properties ? elements(properties).find(
|
|
8047
8191
|
(element2) => FILL_ELEMENTS.has(element2.localName) && (!element2.namespaceURI || element2.namespaceURI === NS.a)
|
|
8048
8192
|
) : void 0;
|
|
8049
8193
|
}
|
|
8050
|
-
function parseDrawingFill(
|
|
8051
|
-
const fill = fillElementOf(
|
|
8194
|
+
function parseDrawingFill(properties) {
|
|
8195
|
+
const fill = fillElementOf(properties);
|
|
8052
8196
|
if (!fill) return void 0;
|
|
8053
8197
|
switch (fill.localName) {
|
|
8054
8198
|
case "noFill":
|
|
@@ -8103,17 +8247,8 @@ function parseDrawingFill(properties2) {
|
|
|
8103
8247
|
...background2 ? { background: background2 } : {}
|
|
8104
8248
|
};
|
|
8105
8249
|
}
|
|
8106
|
-
case "blipFill":
|
|
8107
|
-
|
|
8108
|
-
const relId = blip?.getAttributeNS(NS.r, "embed") || blip?.getAttribute("r:embed") || void 0;
|
|
8109
|
-
const linkRelId = blip?.getAttributeNS(NS.r, "link") || void 0;
|
|
8110
|
-
return {
|
|
8111
|
-
kind: "picture",
|
|
8112
|
-
sourceXml: buildXml(fill),
|
|
8113
|
-
...relId ? { relId } : {},
|
|
8114
|
-
...linkRelId ? { linkRelId } : {}
|
|
8115
|
-
};
|
|
8116
|
-
}
|
|
8250
|
+
case "blipFill":
|
|
8251
|
+
return parseDrawingPictureFill(fill);
|
|
8117
8252
|
default:
|
|
8118
8253
|
return { kind: "unsupported", element: fill.localName };
|
|
8119
8254
|
}
|
|
@@ -8300,6 +8435,10 @@ function drawingPatternPictureXml(fill) {
|
|
|
8300
8435
|
else if (blip.getAttributeNS(NS.r, attribute4) !== value3)
|
|
8301
8436
|
blip.setAttributeNS(NS.r, `r:${attribute4}`, value3);
|
|
8302
8437
|
}
|
|
8438
|
+
if (fill.crop !== void 0 && JSON.stringify(before?.kind === "picture" ? before.crop : void 0) !== JSON.stringify(fill.crop))
|
|
8439
|
+
applyPictureCrop(root2, fill.crop);
|
|
8440
|
+
if (fill.effects !== void 0 && JSON.stringify(before?.kind === "picture" ? before.effects ?? [] : []) !== JSON.stringify(fill.effects ?? []))
|
|
8441
|
+
applyPictureEffects(blip, fill.effects ?? []);
|
|
8303
8442
|
if (!fill.sourceXml) {
|
|
8304
8443
|
const stretch = doc.createElementNS(NS.a, "a:stretch");
|
|
8305
8444
|
stretch.appendChild(doc.createElementNS(NS.a, "a:fillRect"));
|
|
@@ -8310,26 +8449,26 @@ function drawingPatternPictureXml(fill) {
|
|
|
8310
8449
|
}
|
|
8311
8450
|
|
|
8312
8451
|
// drawingml/write-fill.ts
|
|
8313
|
-
function setDrawingFillXml(
|
|
8314
|
-
const doc =
|
|
8452
|
+
function setDrawingFillXml(properties, xml) {
|
|
8453
|
+
const doc = properties.ownerDocument;
|
|
8315
8454
|
const wrapper = parseXml(`<w xmlns:a="${NS.a}">${xml}</w>`);
|
|
8316
8455
|
const fill = elements(wrapper.documentElement)[0];
|
|
8317
8456
|
const names = ["solidFill", "gradFill", "pattFill", "blipFill", "grpFill", "noFill"];
|
|
8318
8457
|
if (elements(wrapper.documentElement).length !== 1 || !fill || fill.namespaceURI !== NS.a || !names.includes(fill.localName))
|
|
8319
8458
|
throw new Error("Invalid DrawingML fill XML");
|
|
8320
|
-
const existing = elements(
|
|
8459
|
+
const existing = elements(properties).filter(
|
|
8321
8460
|
(node3) => node3.namespaceURI === NS.a && names.includes(node3.localName)
|
|
8322
8461
|
);
|
|
8323
8462
|
const next = doc.importNode(fill, true);
|
|
8324
|
-
if (existing[0])
|
|
8463
|
+
if (existing[0]) properties.replaceChild(next, existing[0]);
|
|
8325
8464
|
else
|
|
8326
|
-
|
|
8465
|
+
properties.insertBefore(
|
|
8327
8466
|
next,
|
|
8328
|
-
elements(
|
|
8467
|
+
elements(properties).find(
|
|
8329
8468
|
(node3) => node3.namespaceURI === NS.a && ["ln", "effectLst", "effectDag", "scene3d", "sp3d", "extLst"].includes(node3.localName)
|
|
8330
8469
|
) ?? null
|
|
8331
8470
|
);
|
|
8332
|
-
for (const extra of existing.slice(1))
|
|
8471
|
+
for (const extra of existing.slice(1)) properties.removeChild(extra);
|
|
8333
8472
|
}
|
|
8334
8473
|
function drawingFillXml(fill) {
|
|
8335
8474
|
if (fill.kind === "none") return "<a:noFill/>";
|
|
@@ -11218,18 +11357,18 @@ function pivotColumnEntries(pivot) {
|
|
|
11218
11357
|
const root2 = { children: /* @__PURE__ */ new Map() };
|
|
11219
11358
|
for (const record5 of pivot.records) {
|
|
11220
11359
|
let current = root2;
|
|
11221
|
-
indices.forEach((field2,
|
|
11360
|
+
indices.forEach((field2, level3) => {
|
|
11222
11361
|
const value3 = record5[field2] ?? null;
|
|
11223
11362
|
const key2 = pivotValueKey(value3);
|
|
11224
11363
|
let child4 = current.children.get(key2);
|
|
11225
11364
|
if (!child4) {
|
|
11226
|
-
child4 = { index: order[
|
|
11365
|
+
child4 = { index: order[level3].get(key2), value: value3, children: /* @__PURE__ */ new Map() };
|
|
11227
11366
|
current.children.set(key2, child4);
|
|
11228
11367
|
}
|
|
11229
11368
|
current = child4;
|
|
11230
11369
|
});
|
|
11231
11370
|
}
|
|
11232
|
-
const visit = (node3,
|
|
11371
|
+
const visit = (node3, level3, path3, values, keys) => {
|
|
11233
11372
|
for (const child4 of [...node3.children.entries()].sort((a2, b) => a2[1].index - b[1].index)) {
|
|
11234
11373
|
const here = {
|
|
11235
11374
|
path: [...path3, child4[1].index],
|
|
@@ -11241,10 +11380,10 @@ function pivotColumnEntries(pivot) {
|
|
|
11241
11380
|
key: columnKey(here.keys, here.keys.length),
|
|
11242
11381
|
values: here.values
|
|
11243
11382
|
};
|
|
11244
|
-
if (
|
|
11383
|
+
if (level3 === names.length - 1) entries.push({ kind: "leaf", ...entry3 });
|
|
11245
11384
|
else {
|
|
11246
|
-
visit(child4[1],
|
|
11247
|
-
const own = functions[
|
|
11385
|
+
visit(child4[1], level3 + 1, here.path, here.values, here.keys);
|
|
11386
|
+
const own = functions[level3];
|
|
11248
11387
|
if (own === "auto") entries.push({ kind: "subtotal", ...entry3 });
|
|
11249
11388
|
else for (const fn of own) entries.push({ kind: "subtotal", ...entry3, fn });
|
|
11250
11389
|
}
|
|
@@ -11290,9 +11429,9 @@ function pivotColumnHeaders(pivot, columns, rowLabels, valuesOnRows = false) {
|
|
|
11290
11429
|
columns.entries.forEach((entry3, j) => {
|
|
11291
11430
|
const at2 = labelColumns + j * count;
|
|
11292
11431
|
if (entry3.kind === "leaf") {
|
|
11293
|
-
entry3.path.forEach((_index,
|
|
11294
|
-
const continued = entry3.path.slice(0,
|
|
11295
|
-
if (!continued) grid[1 +
|
|
11432
|
+
entry3.path.forEach((_index, level3) => {
|
|
11433
|
+
const continued = entry3.path.slice(0, level3 + 1).every((p, i) => p === previous[i]);
|
|
11434
|
+
if (!continued) grid[1 + level3][at2] = labelOf(columns.names[level3], entry3.values[level3]);
|
|
11296
11435
|
});
|
|
11297
11436
|
previous = entry3.path;
|
|
11298
11437
|
if (count > 1) measures2.forEach((measure2, m) => grid[rows - 1][at2 + m] = measure2.caption);
|
|
@@ -11323,7 +11462,7 @@ function nestedPivotGrid(pivot) {
|
|
|
11323
11462
|
const valuesAt = pivotValuesIndex(pivot);
|
|
11324
11463
|
const onRows = valuesAt >= 0;
|
|
11325
11464
|
const levels = depth + (onRows ? 1 : 0);
|
|
11326
|
-
const fieldOf = (
|
|
11465
|
+
const fieldOf = (level3) => !onRows || level3 < valuesAt ? level3 : level3 === valuesAt ? -1 : level3 - 1;
|
|
11327
11466
|
const axisItems = names.map((name3) => pivotItems(pivot, name3));
|
|
11328
11467
|
const itemIndices = axisItems.map(
|
|
11329
11468
|
(items) => new Map(items.map((item2, index2) => [pivotValueKey(item2), index2]))
|
|
@@ -11383,13 +11522,13 @@ function nestedPivotGrid(pivot) {
|
|
|
11383
11522
|
(one) => fn ? aggregateValues(records, pivot.fields.indexOf(one.field), fn) : pivotMeasureNumber(pivot, records, one)
|
|
11384
11523
|
);
|
|
11385
11524
|
});
|
|
11386
|
-
const labelCells = (path3, shown,
|
|
11525
|
+
const labelCells = (path3, shown, level3, text5) => {
|
|
11387
11526
|
if (compact) return [text5];
|
|
11388
11527
|
const row2 = Array(levels).fill(null);
|
|
11389
11528
|
path3.labels.forEach((value3, at2) => {
|
|
11390
11529
|
if (shown[at2]) row2[at2] = value3;
|
|
11391
11530
|
});
|
|
11392
|
-
row2[
|
|
11531
|
+
row2[level3] = text5;
|
|
11393
11532
|
return row2;
|
|
11394
11533
|
};
|
|
11395
11534
|
const push = (indent, build2) => {
|
|
@@ -11408,11 +11547,11 @@ function nestedPivotGrid(pivot) {
|
|
|
11408
11547
|
...measure2 !== void 0 ? { measure: measure2 } : {},
|
|
11409
11548
|
...type ? { type } : {}
|
|
11410
11549
|
});
|
|
11411
|
-
const walk = (
|
|
11412
|
-
const field2 = fieldOf(
|
|
11413
|
-
const last =
|
|
11550
|
+
const walk = (level3, group2, measure2, path3) => {
|
|
11551
|
+
const field2 = fieldOf(level3);
|
|
11552
|
+
const last = level3 === levels - 1;
|
|
11414
11553
|
const repeated = Array.from(
|
|
11415
|
-
{ length:
|
|
11554
|
+
{ length: level3 },
|
|
11416
11555
|
(_v, k) => !!pivot.repeatLabels && fieldOf(k) >= 0
|
|
11417
11556
|
);
|
|
11418
11557
|
const leafShown = (firsts) => repeated.map((repeat, k) => repeat || tabular && firsts.slice(k + 1).every(Boolean));
|
|
@@ -11424,23 +11563,23 @@ function nestedPivotGrid(pivot) {
|
|
|
11424
11563
|
firsts: [...path3.firsts, m === 0]
|
|
11425
11564
|
};
|
|
11426
11565
|
if (last)
|
|
11427
|
-
return push(
|
|
11428
|
-
labelCells(path3, leafShown(here.firsts),
|
|
11566
|
+
return push(level3, () => [
|
|
11567
|
+
labelCells(path3, leafShown(here.firsts), level3, one.caption),
|
|
11429
11568
|
cells4(group2, void 0, m),
|
|
11430
11569
|
entryOf(here.indices, m)
|
|
11431
11570
|
]);
|
|
11432
11571
|
if (!tabular)
|
|
11433
|
-
push(
|
|
11434
|
-
labelCells(path3, repeated,
|
|
11572
|
+
push(level3, () => [
|
|
11573
|
+
labelCells(path3, repeated, level3, one.caption),
|
|
11435
11574
|
blanks(),
|
|
11436
11575
|
entryOf(here.indices, m)
|
|
11437
11576
|
]);
|
|
11438
|
-
walk(
|
|
11577
|
+
walk(level3 + 1, group2, m, here);
|
|
11439
11578
|
});
|
|
11440
11579
|
return;
|
|
11441
11580
|
}
|
|
11442
11581
|
const own = functions[field2];
|
|
11443
|
-
const valuesAbove = !onRows || valuesAt <
|
|
11582
|
+
const valuesAbove = !onRows || valuesAt < level3;
|
|
11444
11583
|
const showsValue = above && own === "auto" && valuesAbove;
|
|
11445
11584
|
const children5 = [...group2.children.values()].sort((a2, b) => a2.index - b.index);
|
|
11446
11585
|
children5.forEach((child4, position) => {
|
|
@@ -11451,22 +11590,22 @@ function nestedPivotGrid(pivot) {
|
|
|
11451
11590
|
};
|
|
11452
11591
|
const text5 = labelOf(names[field2], child4.value);
|
|
11453
11592
|
if (last)
|
|
11454
|
-
return push(
|
|
11455
|
-
labelCells(path3, leafShown(here.firsts),
|
|
11593
|
+
return push(level3, () => [
|
|
11594
|
+
labelCells(path3, leafShown(here.firsts), level3, text5),
|
|
11456
11595
|
cells4(child4, void 0, measure2),
|
|
11457
11596
|
entryOf(here.indices, measure2)
|
|
11458
11597
|
]);
|
|
11459
11598
|
if (!tabular)
|
|
11460
|
-
push(
|
|
11461
|
-
labelCells(path3, repeated,
|
|
11599
|
+
push(level3, () => [
|
|
11600
|
+
labelCells(path3, repeated, level3, text5),
|
|
11462
11601
|
showsValue ? cells4(child4, void 0, measure2) : blanks(),
|
|
11463
11602
|
entryOf(here.indices, measure2)
|
|
11464
11603
|
]);
|
|
11465
|
-
walk(
|
|
11604
|
+
walk(level3 + 1, child4, measure2, here);
|
|
11466
11605
|
if (field2 === depth - 1) return;
|
|
11467
11606
|
const caption = String(text5);
|
|
11468
|
-
const subtotal = (title, fn, one) => push(
|
|
11469
|
-
labelCells(path3, repeated,
|
|
11607
|
+
const subtotal = (title, fn, one) => push(level3, () => [
|
|
11608
|
+
labelCells(path3, repeated, level3, title),
|
|
11470
11609
|
cells4(child4, fn, one),
|
|
11471
11610
|
entryOf(here.indices, one, fn ?? "default")
|
|
11472
11611
|
]);
|
|
@@ -12571,8 +12710,8 @@ function parseSlicer(node3, sheet, partName) {
|
|
|
12571
12710
|
if (start !== void 0) slicer.startItem = start;
|
|
12572
12711
|
const locked = boolAttr(node3, "lockedPosition");
|
|
12573
12712
|
if (locked !== void 0) slicer.lockedPosition = locked;
|
|
12574
|
-
const
|
|
12575
|
-
if (
|
|
12713
|
+
const level3 = numAttr(node3, "level");
|
|
12714
|
+
if (level3 !== void 0) slicer.level = level3;
|
|
12576
12715
|
if (extLst) slicer.extLstXml = selfContainedXml(extLst);
|
|
12577
12716
|
return slicer;
|
|
12578
12717
|
}
|
|
@@ -13899,10 +14038,10 @@ function blankComments(xml) {
|
|
|
13899
14038
|
const at2 = match.index;
|
|
13900
14039
|
const section3 = SECTIONS.find(([open2]) => xml.startsWith(open2, at2));
|
|
13901
14040
|
if (!section3) return void 0;
|
|
13902
|
-
const [open,
|
|
13903
|
-
const end = xml.indexOf(
|
|
14041
|
+
const [open, close3] = section3;
|
|
14042
|
+
const end = xml.indexOf(close3, at2 + open.length);
|
|
13904
14043
|
if (end < 0) return void 0;
|
|
13905
|
-
const after = end +
|
|
14044
|
+
const after = end + close3.length;
|
|
13906
14045
|
if (open !== "<?") {
|
|
13907
14046
|
pieces.push(xml.slice(copied, at2), " ".repeat(after - at2));
|
|
13908
14047
|
copied = after;
|
|
@@ -13920,9 +14059,9 @@ function rootChildren(xml) {
|
|
|
13920
14059
|
const namespaces = rootNamespaces(plain4);
|
|
13921
14060
|
const root2 = ROOT.exec(plain4.slice(0, 8192));
|
|
13922
14061
|
if (!namespaces || !root2 || (root2[2] ?? "").trimEnd().endsWith("/")) return void 0;
|
|
13923
|
-
const
|
|
13924
|
-
if (
|
|
13925
|
-
const content2 = xml.slice(root2[0].length,
|
|
14062
|
+
const close3 = plain4.lastIndexOf(`</${root2[1] ?? ""}`);
|
|
14063
|
+
if (close3 < root2[0].length || !/^<\/[^\s>]+\s*>\s*$/.test(plain4.slice(close3))) return void 0;
|
|
14064
|
+
const content2 = xml.slice(root2[0].length, close3);
|
|
13926
14065
|
return { [Symbol.iterator]: () => liteChildElements(content2, namespaces) };
|
|
13927
14066
|
}
|
|
13928
14067
|
function findSheetData(plain4) {
|
|
@@ -13943,11 +14082,11 @@ function splitSheetData(xml) {
|
|
|
13943
14082
|
const start = plain4 === void 0 ? void 0 : findSheetData(plain4);
|
|
13944
14083
|
if (plain4 === void 0 || !start) return void 0;
|
|
13945
14084
|
const { namespaces, tagName: tagName2, contentStart } = start;
|
|
13946
|
-
const
|
|
13947
|
-
if (
|
|
13948
|
-
const data = xml.slice(contentStart,
|
|
14085
|
+
const close3 = plain4.indexOf(`</${tagName2}`, contentStart);
|
|
14086
|
+
if (close3 < 0 || OPEN.test(plain4.slice(contentStart - 1))) return void 0;
|
|
14087
|
+
const data = xml.slice(contentStart, close3);
|
|
13949
14088
|
return {
|
|
13950
|
-
xml: xml.slice(0, contentStart) + xml.slice(
|
|
14089
|
+
xml: xml.slice(0, contentStart) + xml.slice(close3),
|
|
13951
14090
|
rows: { [Symbol.iterator]: () => liteChildElements(data, namespaces) }
|
|
13952
14091
|
};
|
|
13953
14092
|
}
|
|
@@ -14278,14 +14417,14 @@ function fromStoredSyntax(formula2) {
|
|
|
14278
14417
|
if (name3 !== "ANCHORARRAY" && name3 !== "SINGLE") continue;
|
|
14279
14418
|
const open = nextIndex(list2, i + 1);
|
|
14280
14419
|
const arg = nextIndex(list2, open + 1);
|
|
14281
|
-
const
|
|
14420
|
+
const close3 = nextIndex(list2, arg + 1);
|
|
14282
14421
|
const target2 = list2[arg];
|
|
14283
|
-
if (list2[open]?.kind !== "open" || list2[
|
|
14422
|
+
if (list2[open]?.kind !== "open" || list2[close3]?.kind !== "close" || !target2) continue;
|
|
14284
14423
|
const single2 = target2.kind === "ref" || target2.kind === "name" || target2.kind === "structured";
|
|
14285
14424
|
if (name3 === "ANCHORARRAY" && !(target2.kind === "ref" && target2.ref?.kind === "cell")) continue;
|
|
14286
14425
|
if (name3 === "SINGLE" && !single2) continue;
|
|
14287
14426
|
const text5 = name3 === "ANCHORARRAY" ? `${target2.text}#` : `@${target2.text}`;
|
|
14288
|
-
for (let k = i; k <=
|
|
14427
|
+
for (let k = i; k <= close3; k++) list2[k].text = "";
|
|
14289
14428
|
token.text = text5;
|
|
14290
14429
|
changed = true;
|
|
14291
14430
|
}
|
|
@@ -14431,6 +14570,142 @@ function parseDocProps(core, app, custom) {
|
|
|
14431
14570
|
};
|
|
14432
14571
|
}
|
|
14433
14572
|
|
|
14573
|
+
// geometry/guide-formula-eval.ts
|
|
14574
|
+
var ANGLE_SCALE = 6e4;
|
|
14575
|
+
function angleToRadians(ooxmlAngle) {
|
|
14576
|
+
return ooxmlAngle / ANGLE_SCALE * (Math.PI / 180);
|
|
14577
|
+
}
|
|
14578
|
+
function parseFormula(fmla) {
|
|
14579
|
+
const parts = fmla.trim().split(/\s+/);
|
|
14580
|
+
const op = parts[0] ?? "";
|
|
14581
|
+
const args = parts.slice(1);
|
|
14582
|
+
return { op, args };
|
|
14583
|
+
}
|
|
14584
|
+
function resolveOperand(token, variables) {
|
|
14585
|
+
const num = Number(token);
|
|
14586
|
+
if (Number.isFinite(num)) {
|
|
14587
|
+
return num;
|
|
14588
|
+
}
|
|
14589
|
+
const value3 = variables.get(token);
|
|
14590
|
+
if (value3 !== void 0) {
|
|
14591
|
+
return value3;
|
|
14592
|
+
}
|
|
14593
|
+
return 0;
|
|
14594
|
+
}
|
|
14595
|
+
function evaluateFormula(parsed, vars) {
|
|
14596
|
+
const r = (idx) => resolveOperand(parsed.args[idx] ?? "0", vars);
|
|
14597
|
+
switch (parsed.op) {
|
|
14598
|
+
// val x — literal value
|
|
14599
|
+
case "val":
|
|
14600
|
+
return r(0);
|
|
14601
|
+
// abs x — absolute value
|
|
14602
|
+
case "abs":
|
|
14603
|
+
return Math.abs(r(0));
|
|
14604
|
+
// sqrt x — square root
|
|
14605
|
+
case "sqrt":
|
|
14606
|
+
return Math.sqrt(Math.max(r(0), 0));
|
|
14607
|
+
// +- x y z — x + y - z
|
|
14608
|
+
case "+-":
|
|
14609
|
+
return r(0) + r(1) - r(2);
|
|
14610
|
+
// */ x y z — (x * y) / z
|
|
14611
|
+
case "*/": {
|
|
14612
|
+
const z = r(2);
|
|
14613
|
+
if (z === 0) {
|
|
14614
|
+
return 0;
|
|
14615
|
+
}
|
|
14616
|
+
return r(0) * r(1) / z;
|
|
14617
|
+
}
|
|
14618
|
+
// +/ x y z — (x + y) / z
|
|
14619
|
+
case "+/": {
|
|
14620
|
+
const z = r(2);
|
|
14621
|
+
if (z === 0) {
|
|
14622
|
+
return 0;
|
|
14623
|
+
}
|
|
14624
|
+
return (r(0) + r(1)) / z;
|
|
14625
|
+
}
|
|
14626
|
+
// ?: x y z — if x > 0 then y else z
|
|
14627
|
+
case "?:":
|
|
14628
|
+
case "if":
|
|
14629
|
+
return r(0) > 0 ? r(1) : r(2);
|
|
14630
|
+
// min x y — minimum
|
|
14631
|
+
case "min":
|
|
14632
|
+
return Math.min(r(0), r(1));
|
|
14633
|
+
// max x y — maximum
|
|
14634
|
+
case "max":
|
|
14635
|
+
return Math.max(r(0), r(1));
|
|
14636
|
+
// mod x y z — sqrt(x² + y² + z²)
|
|
14637
|
+
case "mod": {
|
|
14638
|
+
const a2 = r(0);
|
|
14639
|
+
const b = r(1);
|
|
14640
|
+
const c2 = r(2);
|
|
14641
|
+
return Math.sqrt(a2 * a2 + b * b + c2 * c2);
|
|
14642
|
+
}
|
|
14643
|
+
// pin x y z — clamp y between x and z
|
|
14644
|
+
case "pin": {
|
|
14645
|
+
const lo = r(0);
|
|
14646
|
+
const val = r(1);
|
|
14647
|
+
const hi = r(2);
|
|
14648
|
+
return Math.max(lo, Math.min(val, hi));
|
|
14649
|
+
}
|
|
14650
|
+
// sin x y — x * sin(y) where y is in OOXML angle units
|
|
14651
|
+
case "sin": {
|
|
14652
|
+
const sinVal = Math.sin(angleToRadians(r(1)));
|
|
14653
|
+
if (!Number.isFinite(sinVal)) {
|
|
14654
|
+
return 0;
|
|
14655
|
+
}
|
|
14656
|
+
return r(0) * sinVal;
|
|
14657
|
+
}
|
|
14658
|
+
// cos x y — x * cos(y) where y is in OOXML angle units
|
|
14659
|
+
case "cos": {
|
|
14660
|
+
const cosVal = Math.cos(angleToRadians(r(1)));
|
|
14661
|
+
if (!Number.isFinite(cosVal)) {
|
|
14662
|
+
return 0;
|
|
14663
|
+
}
|
|
14664
|
+
return r(0) * cosVal;
|
|
14665
|
+
}
|
|
14666
|
+
// tan x y — x * tan(y) where y is in OOXML angle units
|
|
14667
|
+
case "tan": {
|
|
14668
|
+
const angle = angleToRadians(r(1));
|
|
14669
|
+
const tanVal = Math.tan(angle);
|
|
14670
|
+
if (!Number.isFinite(tanVal)) {
|
|
14671
|
+
return 0;
|
|
14672
|
+
}
|
|
14673
|
+
return r(0) * tanVal;
|
|
14674
|
+
}
|
|
14675
|
+
// atan x — atan(x) result in OOXML angle units
|
|
14676
|
+
// x is a ratio scaled by the shape coordinate space
|
|
14677
|
+
case "atan": {
|
|
14678
|
+
const radians = Math.atan(r(0));
|
|
14679
|
+
return radians * 180 * ANGLE_SCALE / Math.PI;
|
|
14680
|
+
}
|
|
14681
|
+
// at2 x y -> arctan(y / x), i.e. Math.atan2(y, x), result in OOXML angle
|
|
14682
|
+
// units. ECMA-376 / ISO-IEC-29500-1 section 20.1.9.6 defines the operand
|
|
14683
|
+
// order as (x, y) with the ARGUMENTS REVERSED relative to Math.atan2, so
|
|
14684
|
+
// the first operand is the horizontal component and the second is the
|
|
14685
|
+
// vertical one. This matches the companion `cat2`/`sat2` operators below,
|
|
14686
|
+
// which take (x, y, z) and compute atan2(z, y).
|
|
14687
|
+
case "at2":
|
|
14688
|
+
case "atan2": {
|
|
14689
|
+
const radians = Math.atan2(r(1), r(0));
|
|
14690
|
+
return radians * 180 * ANGLE_SCALE / Math.PI;
|
|
14691
|
+
}
|
|
14692
|
+
// cat2 x y z — x * cos(atan2(z, y))
|
|
14693
|
+
// Computes the cosine-component of a vector scaled by x
|
|
14694
|
+
case "cat2": {
|
|
14695
|
+
const angle = Math.atan2(r(2), r(1));
|
|
14696
|
+
return r(0) * Math.cos(angle);
|
|
14697
|
+
}
|
|
14698
|
+
// sat2 x y z — x * sin(atan2(z, y))
|
|
14699
|
+
// Computes the sine-component of a vector scaled by x
|
|
14700
|
+
case "sat2": {
|
|
14701
|
+
const angle = Math.atan2(r(2), r(1));
|
|
14702
|
+
return r(0) * Math.sin(angle);
|
|
14703
|
+
}
|
|
14704
|
+
default:
|
|
14705
|
+
return Number(parsed.op) || 0;
|
|
14706
|
+
}
|
|
14707
|
+
}
|
|
14708
|
+
|
|
14434
14709
|
// geometry/indexed.ts
|
|
14435
14710
|
function at(items, index2) {
|
|
14436
14711
|
const value3 = items[index2];
|
|
@@ -14440,6 +14715,251 @@ function at(items, index2) {
|
|
|
14440
14715
|
return value3;
|
|
14441
14716
|
}
|
|
14442
14717
|
|
|
14718
|
+
// geometry/guide-formula-api.ts
|
|
14719
|
+
function createBuiltinVariables(ctx) {
|
|
14720
|
+
const { w, h } = ctx;
|
|
14721
|
+
const vars = /* @__PURE__ */ new Map();
|
|
14722
|
+
vars.set("w", w);
|
|
14723
|
+
vars.set("h", h);
|
|
14724
|
+
vars.set("l", 0);
|
|
14725
|
+
vars.set("t", 0);
|
|
14726
|
+
vars.set("r", w);
|
|
14727
|
+
vars.set("b", h);
|
|
14728
|
+
vars.set("hc", w / 2);
|
|
14729
|
+
vars.set("vc", h / 2);
|
|
14730
|
+
const widthDivisors = [2, 3, 4, 5, 6, 8, 10, 12, 16, 32];
|
|
14731
|
+
for (const d of widthDivisors) {
|
|
14732
|
+
vars.set(`wd${d}`, w / d);
|
|
14733
|
+
}
|
|
14734
|
+
const heightDivisors = [2, 3, 4, 5, 6, 8, 10, 12, 16, 32];
|
|
14735
|
+
for (const d of heightDivisors) {
|
|
14736
|
+
vars.set(`hd${d}`, h / d);
|
|
14737
|
+
}
|
|
14738
|
+
const ss = Math.min(w, h);
|
|
14739
|
+
const ls = Math.max(w, h);
|
|
14740
|
+
vars.set("ss", ss);
|
|
14741
|
+
vars.set("ls", ls);
|
|
14742
|
+
const ssDivisors = [2, 4, 6, 8, 16, 32];
|
|
14743
|
+
for (const d of ssDivisors) {
|
|
14744
|
+
vars.set(`ssd${d}`, ss / d);
|
|
14745
|
+
}
|
|
14746
|
+
vars.set("cd2", 180 * ANGLE_SCALE);
|
|
14747
|
+
vars.set("cd4", 90 * ANGLE_SCALE);
|
|
14748
|
+
vars.set("cd8", 45 * ANGLE_SCALE);
|
|
14749
|
+
vars.set("3cd4", 270 * ANGLE_SCALE);
|
|
14750
|
+
vars.set("3cd8", 135 * ANGLE_SCALE);
|
|
14751
|
+
vars.set("5cd8", 225 * ANGLE_SCALE);
|
|
14752
|
+
vars.set("7cd8", 315 * ANGLE_SCALE);
|
|
14753
|
+
return vars;
|
|
14754
|
+
}
|
|
14755
|
+
|
|
14756
|
+
// drawingml/scene3d-presets.ts
|
|
14757
|
+
var CAMERA_PRESETS = /* @__PURE__ */ new Set([
|
|
14758
|
+
"legacyObliqueTopLeft",
|
|
14759
|
+
"legacyObliqueTop",
|
|
14760
|
+
"legacyObliqueTopRight",
|
|
14761
|
+
"legacyObliqueLeft",
|
|
14762
|
+
"legacyObliqueFront",
|
|
14763
|
+
"legacyObliqueRight",
|
|
14764
|
+
"legacyObliqueBottomLeft",
|
|
14765
|
+
"legacyObliqueBottom",
|
|
14766
|
+
"legacyObliqueBottomRight",
|
|
14767
|
+
"legacyPerspectiveTopLeft",
|
|
14768
|
+
"legacyPerspectiveTop",
|
|
14769
|
+
"legacyPerspectiveTopRight",
|
|
14770
|
+
"legacyPerspectiveLeft",
|
|
14771
|
+
"legacyPerspectiveFront",
|
|
14772
|
+
"legacyPerspectiveRight",
|
|
14773
|
+
"legacyPerspectiveBottomLeft",
|
|
14774
|
+
"legacyPerspectiveBottom",
|
|
14775
|
+
"legacyPerspectiveBottomRight",
|
|
14776
|
+
"orthographicFront",
|
|
14777
|
+
"isometricTopUp",
|
|
14778
|
+
"isometricTopDown",
|
|
14779
|
+
"isometricBottomUp",
|
|
14780
|
+
"isometricBottomDown",
|
|
14781
|
+
"isometricLeftUp",
|
|
14782
|
+
"isometricLeftDown",
|
|
14783
|
+
"isometricRightUp",
|
|
14784
|
+
"isometricRightDown",
|
|
14785
|
+
"isometricOffAxis1Left",
|
|
14786
|
+
"isometricOffAxis1Right",
|
|
14787
|
+
"isometricOffAxis1Top",
|
|
14788
|
+
"isometricOffAxis2Left",
|
|
14789
|
+
"isometricOffAxis2Right",
|
|
14790
|
+
"isometricOffAxis2Top",
|
|
14791
|
+
"isometricOffAxis3Left",
|
|
14792
|
+
"isometricOffAxis3Right",
|
|
14793
|
+
"isometricOffAxis3Bottom",
|
|
14794
|
+
"isometricOffAxis4Left",
|
|
14795
|
+
"isometricOffAxis4Right",
|
|
14796
|
+
"isometricOffAxis4Bottom",
|
|
14797
|
+
"obliqueTopLeft",
|
|
14798
|
+
"obliqueTop",
|
|
14799
|
+
"obliqueTopRight",
|
|
14800
|
+
"obliqueLeft",
|
|
14801
|
+
"obliqueRight",
|
|
14802
|
+
"obliqueBottomLeft",
|
|
14803
|
+
"obliqueBottom",
|
|
14804
|
+
"obliqueBottomRight",
|
|
14805
|
+
"perspectiveFront",
|
|
14806
|
+
"perspectiveLeft",
|
|
14807
|
+
"perspectiveRight",
|
|
14808
|
+
"perspectiveAbove",
|
|
14809
|
+
"perspectiveBelow",
|
|
14810
|
+
"perspectiveAboveLeftFacing",
|
|
14811
|
+
"perspectiveAboveRightFacing",
|
|
14812
|
+
"perspectiveContrastingLeftFacing",
|
|
14813
|
+
"perspectiveContrastingRightFacing",
|
|
14814
|
+
"perspectiveHeroicLeftFacing",
|
|
14815
|
+
"perspectiveHeroicRightFacing",
|
|
14816
|
+
"perspectiveHeroicExtremeLeftFacing",
|
|
14817
|
+
"perspectiveHeroicExtremeRightFacing",
|
|
14818
|
+
"perspectiveRelaxed",
|
|
14819
|
+
"perspectiveRelaxedModerately"
|
|
14820
|
+
]);
|
|
14821
|
+
var LIGHT_RIGS = /* @__PURE__ */ new Set([
|
|
14822
|
+
"legacyFlat1",
|
|
14823
|
+
"legacyFlat2",
|
|
14824
|
+
"legacyFlat3",
|
|
14825
|
+
"legacyFlat4",
|
|
14826
|
+
"legacyNormal1",
|
|
14827
|
+
"legacyNormal2",
|
|
14828
|
+
"legacyNormal3",
|
|
14829
|
+
"legacyNormal4",
|
|
14830
|
+
"legacyHarsh1",
|
|
14831
|
+
"legacyHarsh2",
|
|
14832
|
+
"legacyHarsh3",
|
|
14833
|
+
"legacyHarsh4",
|
|
14834
|
+
"threePt",
|
|
14835
|
+
"balanced",
|
|
14836
|
+
"soft",
|
|
14837
|
+
"harsh",
|
|
14838
|
+
"flood",
|
|
14839
|
+
"contrasting",
|
|
14840
|
+
"morning",
|
|
14841
|
+
"sunrise",
|
|
14842
|
+
"sunset",
|
|
14843
|
+
"chilly",
|
|
14844
|
+
"freezing",
|
|
14845
|
+
"flat",
|
|
14846
|
+
"twoPt",
|
|
14847
|
+
"glow",
|
|
14848
|
+
"brightRoom"
|
|
14849
|
+
]);
|
|
14850
|
+
var LIGHT_DIRECTIONS = /* @__PURE__ */ new Set(["tl", "t", "tr", "l", "r", "bl", "b", "br"]);
|
|
14851
|
+
|
|
14852
|
+
// drawingml/read-3d-values.ts
|
|
14853
|
+
var integer3 = (value3) => {
|
|
14854
|
+
if (value3 === void 0 || value3 === null || String(value3).trim() === "") return void 0;
|
|
14855
|
+
const n = Number(value3);
|
|
14856
|
+
return Number.isSafeInteger(n) ? n : void 0;
|
|
14857
|
+
};
|
|
14858
|
+
function readScene3DValues(node3, read) {
|
|
14859
|
+
const out = {};
|
|
14860
|
+
const camera = read.child(node3, "camera");
|
|
14861
|
+
const light = read.child(node3, "lightRig");
|
|
14862
|
+
for (const [key2, source, attribute4, choices] of [
|
|
14863
|
+
["cameraPreset", camera, "prst", CAMERA_PRESETS],
|
|
14864
|
+
["lightRigType", light, "rig", LIGHT_RIGS],
|
|
14865
|
+
["lightRigDirection", light, "dir", LIGHT_DIRECTIONS]
|
|
14866
|
+
]) {
|
|
14867
|
+
const token = String(read.attribute(source, attribute4) ?? "").trim();
|
|
14868
|
+
if (choices.has(token)) out[key2] = token;
|
|
14869
|
+
}
|
|
14870
|
+
const fov = integer3(read.attribute(camera, "fov"));
|
|
14871
|
+
if (fov !== void 0 && fov >= 0 && fov <= 108e5) out.cameraFieldOfView = fov;
|
|
14872
|
+
const zoom = picturePercentage(read.attribute(camera, "zoom"));
|
|
14873
|
+
if (zoom !== void 0 && zoom > 0) out.cameraZoom = zoom;
|
|
14874
|
+
for (const [prefix2, source] of [
|
|
14875
|
+
["camera", camera],
|
|
14876
|
+
["lightRig", light]
|
|
14877
|
+
]) {
|
|
14878
|
+
const rot = read.child(source, "rot");
|
|
14879
|
+
for (const [axis, key2] of [
|
|
14880
|
+
["lat", "RotX"],
|
|
14881
|
+
["lon", "RotY"],
|
|
14882
|
+
["rev", "RotZ"]
|
|
14883
|
+
]) {
|
|
14884
|
+
const value3 = integer3(read.attribute(rot, axis));
|
|
14885
|
+
if (value3 !== void 0 && value3 >= 0 && value3 < 216e5) out[`${prefix2}${key2}`] = value3;
|
|
14886
|
+
}
|
|
14887
|
+
}
|
|
14888
|
+
const backdrop = read.child(node3, "backdrop");
|
|
14889
|
+
if (backdrop !== void 0) {
|
|
14890
|
+
out.hasBackdrop = true;
|
|
14891
|
+
for (const [name3, prefix2, attr2] of [
|
|
14892
|
+
["anchor", "backdropAnchor", ""],
|
|
14893
|
+
["norm", "backdropNormal", "d"],
|
|
14894
|
+
["up", "backdropUp", "d"]
|
|
14895
|
+
]) {
|
|
14896
|
+
const point2 = read.child(backdrop, name3);
|
|
14897
|
+
for (const [axis, suffix] of [
|
|
14898
|
+
["x", "X"],
|
|
14899
|
+
["y", "Y"],
|
|
14900
|
+
["z", "Z"]
|
|
14901
|
+
]) {
|
|
14902
|
+
const value3 = integer3(read.attribute(point2, `${attr2}${axis}`));
|
|
14903
|
+
if (value3 !== void 0) out[`${prefix2}${suffix}`] = value3;
|
|
14904
|
+
}
|
|
14905
|
+
}
|
|
14906
|
+
}
|
|
14907
|
+
return out;
|
|
14908
|
+
}
|
|
14909
|
+
function readText3DValues(node3, read) {
|
|
14910
|
+
const out = {};
|
|
14911
|
+
for (const [key2, attribute4] of [
|
|
14912
|
+
["extrusionHeight", "extrusionH"],
|
|
14913
|
+
["contourWidth", "contourW"],
|
|
14914
|
+
["z", "z"]
|
|
14915
|
+
]) {
|
|
14916
|
+
const value3 = integer3(read.attribute(node3, attribute4));
|
|
14917
|
+
if (value3 !== void 0) out[key2] = value3;
|
|
14918
|
+
}
|
|
14919
|
+
const material = String(read.attribute(node3, "prstMaterial") ?? "").trim();
|
|
14920
|
+
if (material) out.presetMaterial = material;
|
|
14921
|
+
for (const [name3, prefix2] of [
|
|
14922
|
+
["bevelT", "bevelTop"],
|
|
14923
|
+
["bevelB", "bevelBottom"]
|
|
14924
|
+
]) {
|
|
14925
|
+
const bevel = read.child(node3, name3);
|
|
14926
|
+
if (!bevel) continue;
|
|
14927
|
+
out[`${prefix2}Type`] = String(read.attribute(bevel, "prst") || "circle").trim();
|
|
14928
|
+
for (const [attribute4, suffix] of [
|
|
14929
|
+
["w", "Width"],
|
|
14930
|
+
["h", "Height"]
|
|
14931
|
+
]) {
|
|
14932
|
+
const value3 = integer3(read.attribute(bevel, attribute4));
|
|
14933
|
+
if (value3 !== void 0) out[`${prefix2}${suffix}`] = value3;
|
|
14934
|
+
}
|
|
14935
|
+
}
|
|
14936
|
+
return out;
|
|
14937
|
+
}
|
|
14938
|
+
|
|
14939
|
+
// drawingml/read-text-3d.ts
|
|
14940
|
+
var DOM_3D_READER = {
|
|
14941
|
+
attribute: (node3, name3) => node3?.getAttribute(name3),
|
|
14942
|
+
child: (node3, name3) => first(node3, name3, NS.a)
|
|
14943
|
+
};
|
|
14944
|
+
function parseDrawingTextScene3D(node3) {
|
|
14945
|
+
return { ...readScene3DValues(node3, DOM_3D_READER), sourceXml: buildXml(node3) };
|
|
14946
|
+
}
|
|
14947
|
+
function parseDrawingTextShape3D(node3) {
|
|
14948
|
+
const extrusionColor = parseDrawingColorIn(first(node3, "extrusionClr", NS.a));
|
|
14949
|
+
const contourColor = parseDrawingColorIn(first(node3, "contourClr", NS.a));
|
|
14950
|
+
return {
|
|
14951
|
+
...readText3DValues(node3, DOM_3D_READER),
|
|
14952
|
+
sourceXml: buildXml(node3),
|
|
14953
|
+
...extrusionColor ? { extrusionColor } : {},
|
|
14954
|
+
...contourColor ? { contourColor } : {}
|
|
14955
|
+
};
|
|
14956
|
+
}
|
|
14957
|
+
function parseDrawingFlatText3D(node3) {
|
|
14958
|
+
const raw2 = node3.getAttribute("z");
|
|
14959
|
+
const z = raw2 === null || !raw2.trim() ? NaN : Number(raw2);
|
|
14960
|
+
return { sourceXml: buildXml(node3), ...Number.isSafeInteger(z) ? { z } : {} };
|
|
14961
|
+
}
|
|
14962
|
+
|
|
14443
14963
|
// drawingml/read-run-properties.ts
|
|
14444
14964
|
function outerXml2(element2) {
|
|
14445
14965
|
return buildXml(element2);
|
|
@@ -14601,8 +15121,8 @@ var BOOLEAN_ATTRIBUTES2 = [
|
|
|
14601
15121
|
["hangingPunctuation", "hangingPunct"]
|
|
14602
15122
|
];
|
|
14603
15123
|
function readAttributes2(element2, out) {
|
|
14604
|
-
const
|
|
14605
|
-
if (
|
|
15124
|
+
const level3 = integerAttribute(element2, "lvl");
|
|
15125
|
+
if (level3 !== void 0) out.level = Math.min(Math.max(level3, 0), 8);
|
|
14606
15126
|
const align = stringAttribute(element2, "algn");
|
|
14607
15127
|
if (align) out.align = align;
|
|
14608
15128
|
for (const [key2, name3] of EMU_ATTRIBUTES) {
|
|
@@ -14761,7 +15281,13 @@ function parseDrawingBodyProperties(element2) {
|
|
|
14761
15281
|
...read("fontScale") !== void 0 && fontScale !== void 0 ? { fontScale } : {},
|
|
14762
15282
|
...read("lnSpcReduction") !== void 0 && reduction !== void 0 ? { lineSpacingReduction: reduction } : {}
|
|
14763
15283
|
};
|
|
14764
|
-
} else
|
|
15284
|
+
} else if (name3 === "scene3d" && children(element2, "scene3d", NS.a).length === 1)
|
|
15285
|
+
out.scene3d = parseDrawingTextScene3D(child4);
|
|
15286
|
+
else if (name3 === "sp3d" && children(element2, "sp3d", NS.a).length === 1 && !first(element2, "flatTx", NS.a))
|
|
15287
|
+
out.shape3d = parseDrawingTextShape3D(child4);
|
|
15288
|
+
else if (name3 === "flatTx" && children(element2, "flatTx", NS.a).length === 1 && !first(element2, "sp3d", NS.a))
|
|
15289
|
+
out.flatText3d = parseDrawingFlatText3D(child4);
|
|
15290
|
+
else extra.push(outerXml2(child4));
|
|
14765
15291
|
}
|
|
14766
15292
|
if (extra.length) out.extraXml = extra;
|
|
14767
15293
|
return out;
|
|
@@ -14771,8 +15297,8 @@ function parseDrawingListStyle(element2) {
|
|
|
14771
15297
|
const style2 = { levels: [] };
|
|
14772
15298
|
const extra = [];
|
|
14773
15299
|
for (const child4 of elements(element2)) {
|
|
14774
|
-
const
|
|
14775
|
-
if (
|
|
15300
|
+
const level3 = isDrawingElement(child4) ? /^lvl([1-9])pPr$/u.exec(child4.localName) : null;
|
|
15301
|
+
if (level3) style2.levels[Number(level3[1]) - 1] = parseDrawingParagraphProperties(child4);
|
|
14776
15302
|
else if (isDrawingElement(child4) && child4.localName === "defPPr")
|
|
14777
15303
|
style2.default = parseDrawingParagraphProperties(child4) ?? {};
|
|
14778
15304
|
else extra.push(outerXml2(child4));
|
|
@@ -14788,15 +15314,15 @@ function readItem(child4) {
|
|
|
14788
15314
|
const name3 = isDrawingElement(child4) ? child4.localName : "";
|
|
14789
15315
|
if (name3 === "pPr" || name3 === "endParaRPr") return void 0;
|
|
14790
15316
|
if (name3 === "r") {
|
|
14791
|
-
const
|
|
14792
|
-
return { kind: "run", text: textOf(child4), ...
|
|
15317
|
+
const properties = parseDrawingRunProperties(first(child4, "rPr", NS.a));
|
|
15318
|
+
return { kind: "run", text: textOf(child4), ...properties ? { properties } : {} };
|
|
14793
15319
|
}
|
|
14794
15320
|
if (name3 === "br") {
|
|
14795
|
-
const
|
|
14796
|
-
return { kind: "break", ...
|
|
15321
|
+
const properties = parseDrawingRunProperties(first(child4, "rPr", NS.a));
|
|
15322
|
+
return { kind: "break", ...properties ? { properties } : {} };
|
|
14797
15323
|
}
|
|
14798
15324
|
if (name3 === "fld") {
|
|
14799
|
-
const
|
|
15325
|
+
const properties = parseDrawingRunProperties(first(child4, "rPr", NS.a));
|
|
14800
15326
|
const paragraphProperties = parseDrawingParagraphProperties(first(child4, "pPr", NS.a));
|
|
14801
15327
|
const type = child4.getAttribute("type");
|
|
14802
15328
|
return {
|
|
@@ -14804,7 +15330,7 @@ function readItem(child4) {
|
|
|
14804
15330
|
id: child4.getAttribute("id") ?? "",
|
|
14805
15331
|
...type ? { type } : {},
|
|
14806
15332
|
text: textOf(child4),
|
|
14807
|
-
...
|
|
15333
|
+
...properties ? { properties } : {},
|
|
14808
15334
|
...paragraphProperties ? { paragraphProperties } : {}
|
|
14809
15335
|
};
|
|
14810
15336
|
}
|
|
@@ -14816,10 +15342,10 @@ function parseDrawingParagraph(element2) {
|
|
|
14816
15342
|
const item2 = readItem(child4);
|
|
14817
15343
|
if (item2) items.push(item2);
|
|
14818
15344
|
}
|
|
14819
|
-
const
|
|
15345
|
+
const properties = parseDrawingParagraphProperties(first(element2, "pPr", NS.a));
|
|
14820
15346
|
const endProperties = parseDrawingRunProperties(first(element2, "endParaRPr", NS.a));
|
|
14821
15347
|
return {
|
|
14822
|
-
...
|
|
15348
|
+
...properties ? { properties } : {},
|
|
14823
15349
|
items,
|
|
14824
15350
|
...endProperties ? { endProperties } : {}
|
|
14825
15351
|
};
|
|
@@ -15225,9 +15751,9 @@ function parsePoint(element2) {
|
|
|
15225
15751
|
text: paragraphs.join("\n"),
|
|
15226
15752
|
...textParagraphs2 ? { textParagraphs: textParagraphs2 } : {}
|
|
15227
15753
|
};
|
|
15228
|
-
const
|
|
15229
|
-
const fill = parseDrawingFill(
|
|
15230
|
-
const line = parseDrawingLine(first(
|
|
15754
|
+
const properties = first(element2, "spPr", NS.dgm);
|
|
15755
|
+
const fill = parseDrawingFill(properties);
|
|
15756
|
+
const line = parseDrawingLine(first(properties, "ln", NS.a));
|
|
15231
15757
|
if (fill) point2.fill = fill;
|
|
15232
15758
|
if (line) point2.line = line;
|
|
15233
15759
|
const optional = [
|
|
@@ -15503,19 +16029,19 @@ function parseSpacing(parent) {
|
|
|
15503
16029
|
}
|
|
15504
16030
|
return void 0;
|
|
15505
16031
|
}
|
|
15506
|
-
function parseProperties(
|
|
16032
|
+
function parseProperties(properties) {
|
|
15507
16033
|
const parsed = {};
|
|
15508
|
-
const size3 = Number.parseInt(
|
|
16034
|
+
const size3 = Number.parseInt(properties?.getAttribute("sz") ?? "", 10);
|
|
15509
16035
|
if (Number.isFinite(size3)) parsed.sizePt = size3 / 100;
|
|
15510
|
-
const bold = booleanAttribute(
|
|
16036
|
+
const bold = booleanAttribute(properties, "b");
|
|
15511
16037
|
if (bold !== void 0) parsed.bold = bold;
|
|
15512
|
-
const italic = booleanAttribute(
|
|
16038
|
+
const italic = booleanAttribute(properties, "i");
|
|
15513
16039
|
if (italic !== void 0) parsed.italic = italic;
|
|
15514
|
-
const underline =
|
|
16040
|
+
const underline = properties?.getAttribute("u");
|
|
15515
16041
|
if (underline) parsed.underline = underline !== "none";
|
|
15516
|
-
const color2 = parseDrawingColorIn(first(
|
|
16042
|
+
const color2 = parseDrawingColorIn(first(properties, "solidFill", NS.a));
|
|
15517
16043
|
if (color2) parsed.color = color2;
|
|
15518
|
-
const typeface2 = first(
|
|
16044
|
+
const typeface2 = first(properties, "latin", NS.a)?.getAttribute("typeface");
|
|
15519
16045
|
if (typeface2) parsed.typeface = typeface2;
|
|
15520
16046
|
return parsed;
|
|
15521
16047
|
}
|
|
@@ -15530,12 +16056,12 @@ function parseParagraph(paragraph2) {
|
|
|
15530
16056
|
for (const child4 of elements(paragraph2))
|
|
15531
16057
|
if (child4.namespaceURI === NS.a && ["r", "fld", "br"].includes(child4.localName))
|
|
15532
16058
|
runs.push(parseRun(child4));
|
|
15533
|
-
const
|
|
15534
|
-
const align =
|
|
15535
|
-
const defaults = parseProperties(first(
|
|
15536
|
-
const lineSpacing = parseSpacing(first(
|
|
15537
|
-
const spaceBefore = parseSpacing(first(
|
|
15538
|
-
const spaceAfter = parseSpacing(first(
|
|
16059
|
+
const properties = first(paragraph2, "pPr", NS.a);
|
|
16060
|
+
const align = properties?.getAttribute("algn");
|
|
16061
|
+
const defaults = parseProperties(first(properties, "defRPr", NS.a));
|
|
16062
|
+
const lineSpacing = parseSpacing(first(properties, "lnSpc", NS.a));
|
|
16063
|
+
const spaceBefore = parseSpacing(first(properties, "spcBef", NS.a));
|
|
16064
|
+
const spaceAfter = parseSpacing(first(properties, "spcAft", NS.a));
|
|
15539
16065
|
return {
|
|
15540
16066
|
...align ? { align } : {},
|
|
15541
16067
|
...Object.keys(defaults).length ? { defaultProperties: defaults } : {},
|
|
@@ -15547,13 +16073,13 @@ function parseParagraph(paragraph2) {
|
|
|
15547
16073
|
}
|
|
15548
16074
|
function parseDrawingTextBody(body) {
|
|
15549
16075
|
if (!body) return void 0;
|
|
15550
|
-
const
|
|
16076
|
+
const properties = first(body, "bodyPr", NS.a);
|
|
15551
16077
|
const paragraphs = children(body, "p", NS.a).map(parseParagraph);
|
|
15552
16078
|
const result2 = {
|
|
15553
16079
|
paragraphs,
|
|
15554
16080
|
text: paragraphs.map((paragraph2) => paragraph2.runs.map((run2) => run2.text).join("")).join("\n")
|
|
15555
16081
|
};
|
|
15556
|
-
const anchor =
|
|
16082
|
+
const anchor = properties?.getAttribute("anchor");
|
|
15557
16083
|
if (anchor) result2.anchor = anchor;
|
|
15558
16084
|
const insets = {};
|
|
15559
16085
|
for (const [key2, attribute4] of [
|
|
@@ -15562,13 +16088,115 @@ function parseDrawingTextBody(body) {
|
|
|
15562
16088
|
["right", "rIns"],
|
|
15563
16089
|
["bottom", "bIns"]
|
|
15564
16090
|
]) {
|
|
15565
|
-
const value3 = Number.parseInt(
|
|
16091
|
+
const value3 = Number.parseInt(properties?.getAttribute(attribute4) ?? "", 10);
|
|
15566
16092
|
if (Number.isFinite(value3)) insets[key2] = value3;
|
|
15567
16093
|
}
|
|
15568
16094
|
if (Object.keys(insets).length > 0) result2.insetsEmu = insets;
|
|
15569
16095
|
return result2;
|
|
15570
16096
|
}
|
|
15571
16097
|
|
|
16098
|
+
// drawingml/custom-geometry.ts
|
|
16099
|
+
var ARITY3 = {
|
|
16100
|
+
val: 1,
|
|
16101
|
+
abs: 1,
|
|
16102
|
+
sqrt: 1,
|
|
16103
|
+
"+-": 3,
|
|
16104
|
+
"*/": 3,
|
|
16105
|
+
"+/": 3,
|
|
16106
|
+
"?:": 3,
|
|
16107
|
+
at2: 2,
|
|
16108
|
+
cat2: 3,
|
|
16109
|
+
cos: 2,
|
|
16110
|
+
max: 2,
|
|
16111
|
+
min: 2,
|
|
16112
|
+
mod: 3,
|
|
16113
|
+
pin: 3,
|
|
16114
|
+
sat2: 3,
|
|
16115
|
+
sin: 2,
|
|
16116
|
+
tan: 2
|
|
16117
|
+
};
|
|
16118
|
+
function operand(value3, vars) {
|
|
16119
|
+
if (value3 === null || !value3.trim()) return NaN;
|
|
16120
|
+
const literal2 = Number(value3);
|
|
16121
|
+
return Number.isFinite(literal2) ? literal2 : vars.get(value3) ?? NaN;
|
|
16122
|
+
}
|
|
16123
|
+
function parseCustomGeometry(custom, width, height) {
|
|
16124
|
+
const pathList = first(custom, "pathLst", NS.a);
|
|
16125
|
+
if (!pathList) return void 0;
|
|
16126
|
+
const pathNodes = children(pathList, "path", NS.a);
|
|
16127
|
+
const contextWidth = width;
|
|
16128
|
+
const contextHeight = height;
|
|
16129
|
+
const vars = createBuiltinVariables({ w: contextWidth, h: contextHeight });
|
|
16130
|
+
for (const list2 of ["avLst", "gdLst"]) {
|
|
16131
|
+
const parent = first(custom, list2, NS.a);
|
|
16132
|
+
if (!parent) continue;
|
|
16133
|
+
for (const guide of children(parent, "gd", NS.a)) {
|
|
16134
|
+
const name3 = guide.getAttribute("name");
|
|
16135
|
+
const formula2 = parseFormula(guide.getAttribute("fmla") ?? "");
|
|
16136
|
+
if (!name3 || ARITY3[formula2.op] !== formula2.args.length || formula2.args.some((arg) => !Number.isFinite(operand(arg, vars))))
|
|
16137
|
+
return void 0;
|
|
16138
|
+
const result2 = evaluateFormula(formula2, vars);
|
|
16139
|
+
if (!Number.isFinite(result2)) return void 0;
|
|
16140
|
+
vars.set(name3, result2);
|
|
16141
|
+
}
|
|
16142
|
+
}
|
|
16143
|
+
const paths = [];
|
|
16144
|
+
for (const path3 of pathNodes) {
|
|
16145
|
+
const commands = [];
|
|
16146
|
+
const value3 = (node3, name3) => operand(node3.getAttribute(name3), vars);
|
|
16147
|
+
for (const node3 of elements(path3)) {
|
|
16148
|
+
if (node3.namespaceURI !== NS.a) return void 0;
|
|
16149
|
+
const points = children(node3, "pt", NS.a).map((point2) => ({
|
|
16150
|
+
x: value3(point2, "x"),
|
|
16151
|
+
y: value3(point2, "y")
|
|
16152
|
+
}));
|
|
16153
|
+
if (points.some((point2) => !Number.isFinite(point2.x) || !Number.isFinite(point2.y)))
|
|
16154
|
+
return void 0;
|
|
16155
|
+
const [p0, p1, p2] = points;
|
|
16156
|
+
switch (node3.localName) {
|
|
16157
|
+
case "moveTo":
|
|
16158
|
+
case "lnTo":
|
|
16159
|
+
if (points.length !== 1 || !p0) return void 0;
|
|
16160
|
+
commands.push({ op: node3.localName === "moveTo" ? "M" : "L", ...p0 });
|
|
16161
|
+
break;
|
|
16162
|
+
case "quadBezTo":
|
|
16163
|
+
if (points.length !== 2 || !p0 || !p1) return void 0;
|
|
16164
|
+
commands.push({ op: "Q", x1: p0.x, y1: p0.y, ...p1 });
|
|
16165
|
+
break;
|
|
16166
|
+
case "cubicBezTo":
|
|
16167
|
+
if (points.length !== 3 || !p0 || !p1 || !p2) return void 0;
|
|
16168
|
+
commands.push({ op: "C", x1: p0.x, y1: p0.y, x2: p1.x, y2: p1.y, ...p2 });
|
|
16169
|
+
break;
|
|
16170
|
+
case "arcTo": {
|
|
16171
|
+
const wR = value3(node3, "wR");
|
|
16172
|
+
const hR = value3(node3, "hR");
|
|
16173
|
+
const start = value3(node3, "stAng");
|
|
16174
|
+
const swing = value3(node3, "swAng");
|
|
16175
|
+
if (![wR, hR, start, swing].every(Number.isFinite)) return void 0;
|
|
16176
|
+
commands.push({ op: "A", wR, hR, startAngle: start / 6e4, swingAngle: swing / 6e4 });
|
|
16177
|
+
break;
|
|
16178
|
+
}
|
|
16179
|
+
case "close":
|
|
16180
|
+
commands.push({ op: "Z" });
|
|
16181
|
+
break;
|
|
16182
|
+
default:
|
|
16183
|
+
return void 0;
|
|
16184
|
+
}
|
|
16185
|
+
}
|
|
16186
|
+
const pathWidth = path3.hasAttribute("w") ? Number(path3.getAttribute("w")) : contextWidth;
|
|
16187
|
+
const pathHeight = path3.hasAttribute("h") ? Number(path3.getAttribute("h")) : contextHeight;
|
|
16188
|
+
if (![pathWidth, pathHeight].every((n) => Number.isFinite(n) && n > 0)) return void 0;
|
|
16189
|
+
paths.push({
|
|
16190
|
+
commands,
|
|
16191
|
+
width: pathWidth,
|
|
16192
|
+
height: pathHeight,
|
|
16193
|
+
...path3.getAttribute("fill") ? { fill: path3.getAttribute("fill") } : {},
|
|
16194
|
+
...["0", "false"].includes(path3.getAttribute("stroke") ?? "") ? { stroke: false } : {}
|
|
16195
|
+
});
|
|
16196
|
+
}
|
|
16197
|
+
return paths.length ? paths : void 0;
|
|
16198
|
+
}
|
|
16199
|
+
|
|
15572
16200
|
// drawingml/drawing-geometry.ts
|
|
15573
16201
|
var int = (element2, name3) => Number.parseInt(element2?.getAttribute(name3) ?? "", 10);
|
|
15574
16202
|
function parseFrame(container) {
|
|
@@ -15593,74 +16221,13 @@ function parseTransform(xfrm) {
|
|
|
15593
16221
|
...booleanAttribute(xfrm, "flipV") ? { flipVertical: true } : {}
|
|
15594
16222
|
};
|
|
15595
16223
|
}
|
|
15596
|
-
function parsePathCommands(path3) {
|
|
15597
|
-
const commands = [];
|
|
15598
|
-
const point2 = (element2) => {
|
|
15599
|
-
const x = int(element2, "x");
|
|
15600
|
-
const y = int(element2, "y");
|
|
15601
|
-
return Number.isFinite(x) && Number.isFinite(y) ? { x, y } : void 0;
|
|
15602
|
-
};
|
|
15603
|
-
for (const element2 of Array.from(path3.childNodes)) {
|
|
15604
|
-
if (element2.nodeType !== 1) continue;
|
|
15605
|
-
const node3 = element2;
|
|
15606
|
-
const points = children(node3, "pt", NS.a).map(point2);
|
|
15607
|
-
if (points.some((entry3) => entry3 === void 0)) return void 0;
|
|
15608
|
-
const [p0, p1, p2] = points;
|
|
15609
|
-
switch (node3.localName) {
|
|
15610
|
-
case "moveTo":
|
|
15611
|
-
case "lnTo":
|
|
15612
|
-
if (!p0) return void 0;
|
|
15613
|
-
commands.push({ op: node3.localName === "moveTo" ? "M" : "L", ...p0 });
|
|
15614
|
-
break;
|
|
15615
|
-
case "cubicBezTo":
|
|
15616
|
-
if (!p0 || !p1 || !p2) return void 0;
|
|
15617
|
-
commands.push({ op: "C", x1: p0.x, y1: p0.y, x2: p1.x, y2: p1.y, x: p2.x, y: p2.y });
|
|
15618
|
-
break;
|
|
15619
|
-
case "quadBezTo":
|
|
15620
|
-
if (!p0 || !p1) return void 0;
|
|
15621
|
-
commands.push({ op: "Q", x1: p0.x, y1: p0.y, x: p1.x, y: p1.y });
|
|
15622
|
-
break;
|
|
15623
|
-
case "arcTo": {
|
|
15624
|
-
const wR = int(node3, "wR");
|
|
15625
|
-
const hR = int(node3, "hR");
|
|
15626
|
-
const startAngle = int(node3, "stAng");
|
|
15627
|
-
const swingAngle = int(node3, "swAng");
|
|
15628
|
-
if (![wR, hR, startAngle, swingAngle].every(Number.isFinite)) return void 0;
|
|
15629
|
-
commands.push({
|
|
15630
|
-
op: "A",
|
|
15631
|
-
wR,
|
|
15632
|
-
hR,
|
|
15633
|
-
startAngle: startAngle / 6e4,
|
|
15634
|
-
swingAngle: swingAngle / 6e4
|
|
15635
|
-
});
|
|
15636
|
-
break;
|
|
15637
|
-
}
|
|
15638
|
-
case "close":
|
|
15639
|
-
commands.push({ op: "Z" });
|
|
15640
|
-
break;
|
|
15641
|
-
}
|
|
15642
|
-
}
|
|
15643
|
-
return commands;
|
|
15644
|
-
}
|
|
15645
16224
|
function parseDrawingGeometry(spPr) {
|
|
15646
16225
|
const preset = first(spPr, "prstGeom", NS.a);
|
|
15647
16226
|
const custom = first(spPr, "custGeom", NS.a);
|
|
15648
16227
|
if (custom) {
|
|
15649
|
-
const
|
|
15650
|
-
|
|
15651
|
-
|
|
15652
|
-
if (!commands) return { geometry: "custom", issue: "CUSTOM_GEOMETRY_GUIDES_UNSUPPORTED" };
|
|
15653
|
-
const width = int(path3, "w");
|
|
15654
|
-
const height = int(path3, "h");
|
|
15655
|
-
paths.push({
|
|
15656
|
-
commands,
|
|
15657
|
-
...Number.isFinite(width) ? { width } : {},
|
|
15658
|
-
...Number.isFinite(height) ? { height } : {},
|
|
15659
|
-
...path3.getAttribute("fill") ? { fill: path3.getAttribute("fill") } : {},
|
|
15660
|
-
...path3.getAttribute("stroke") === "0" || path3.getAttribute("stroke") === "false" ? { stroke: false } : {}
|
|
15661
|
-
});
|
|
15662
|
-
}
|
|
15663
|
-
return { geometry: "custom", paths };
|
|
16228
|
+
const frame = parseFrame(first(spPr, "xfrm", NS.a));
|
|
16229
|
+
const paths = parseCustomGeometry(custom, frame?.width ?? 21600, frame?.height ?? 21600);
|
|
16230
|
+
return paths ? { geometry: "custom", paths } : { geometry: "custom", issue: "CUSTOM_GEOMETRY_UNSUPPORTED" };
|
|
15664
16231
|
}
|
|
15665
16232
|
const geometry = preset?.getAttribute("prst") || "rect";
|
|
15666
16233
|
const adjustments = {};
|
|
@@ -15732,7 +16299,8 @@ function parseShape(sp, index2, group2, issues) {
|
|
|
15732
16299
|
if (transform2.flipVertical) shape.flipVertical = true;
|
|
15733
16300
|
if (adjustments) shape.adjustments = adjustments;
|
|
15734
16301
|
if (paths) shape.paths = paths;
|
|
15735
|
-
const
|
|
16302
|
+
const picture = first(sp, "blipFill", NS.dsp);
|
|
16303
|
+
const fill = picture ? parseDrawingPictureFill(picture) : parseDrawingFill(spPr);
|
|
15736
16304
|
if (fill) shape.fill = fill;
|
|
15737
16305
|
const line = parseDrawingLine(first(spPr, "ln", NS.a));
|
|
15738
16306
|
if (line) shape.line = line;
|
|
@@ -15761,15 +16329,15 @@ function parseDiagramDrawing(source, part) {
|
|
|
15761
16329
|
for (const child4 of Array.from(container.childNodes)) {
|
|
15762
16330
|
if (child4.nodeType !== 1) continue;
|
|
15763
16331
|
const element2 = child4;
|
|
15764
|
-
if (element2.localName === "sp") {
|
|
16332
|
+
if (element2.localName === "sp" || element2.localName === "pic") {
|
|
15765
16333
|
const shape = parseShape(element2, counter++, group2, issues);
|
|
15766
16334
|
if (shape) shapes.push(shape);
|
|
16335
|
+
else if (element2.localName === "pic")
|
|
16336
|
+
issues.push({
|
|
16337
|
+
code: "DIAGRAM_DRAWING_PICTURE_UNREADABLE",
|
|
16338
|
+
message: "A cached picture has no usable frame; its source is retained in the drawing part."
|
|
16339
|
+
});
|
|
15767
16340
|
} else if (element2.localName === "grpSp") visit(element2, groupTransform(element2, group2));
|
|
15768
|
-
else if (element2.localName === "pic")
|
|
15769
|
-
issues.push({
|
|
15770
|
-
code: "DIAGRAM_DRAWING_PICTURE_SKIPPED",
|
|
15771
|
-
message: "A dsp:pic in the cached drawing is not modelled; the part still holds it."
|
|
15772
|
-
});
|
|
15773
16341
|
}
|
|
15774
16342
|
};
|
|
15775
16343
|
if (tree) visit(tree, IDENTITY2);
|
|
@@ -15864,7 +16432,29 @@ async function loadDiagram(hostPart, relationshipIds, host) {
|
|
|
15864
16432
|
);
|
|
15865
16433
|
return parseDiagramDrawing(xml, part);
|
|
15866
16434
|
});
|
|
15867
|
-
if (drawing)
|
|
16435
|
+
if (drawing) {
|
|
16436
|
+
try {
|
|
16437
|
+
const entries = await host.readRelationshipEntries(
|
|
16438
|
+
diagramRelationshipsPart(drawingResolution.path)
|
|
16439
|
+
);
|
|
16440
|
+
const pictures = (entries ?? []).filter(
|
|
16441
|
+
(entry3) => entry3.type.endsWith("/image") && entry3.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry3.target)
|
|
16442
|
+
);
|
|
16443
|
+
if (pictures.length)
|
|
16444
|
+
drawing.pictureParts = Object.fromEntries(
|
|
16445
|
+
pictures.map((entry3) => [
|
|
16446
|
+
entry3.id,
|
|
16447
|
+
host.resolvePath(drawingResolution.path, entry3.target)
|
|
16448
|
+
])
|
|
16449
|
+
);
|
|
16450
|
+
} catch {
|
|
16451
|
+
issues.push({
|
|
16452
|
+
code: "DIAGRAM_PICTURE_RELATIONSHIPS_UNREADABLE",
|
|
16453
|
+
message: "Picture relationships in the cached drawing could not be read."
|
|
16454
|
+
});
|
|
16455
|
+
}
|
|
16456
|
+
issues.push(...drawing.issues);
|
|
16457
|
+
}
|
|
15868
16458
|
} else if (data)
|
|
15869
16459
|
issues.push({
|
|
15870
16460
|
code: "DIAGRAM_DRAWING_ABSENT",
|
|
@@ -15939,10 +16529,11 @@ async function resolveOne(object, info, source) {
|
|
|
15939
16529
|
const xml = source.text(relsPart);
|
|
15940
16530
|
if (!xml) return void 0;
|
|
15941
16531
|
try {
|
|
15942
|
-
return [...parseRelationships(xml).values()].map(({ id: id3, type, target: target2 }) => ({
|
|
16532
|
+
return [...parseRelationships(xml).values()].map(({ id: id3, type, target: target2, mode }) => ({
|
|
15943
16533
|
id: id3,
|
|
15944
16534
|
type,
|
|
15945
|
-
target: target2
|
|
16535
|
+
target: target2,
|
|
16536
|
+
...mode ? { mode } : {}
|
|
15946
16537
|
}));
|
|
15947
16538
|
} catch {
|
|
15948
16539
|
return void 0;
|
|
@@ -16392,7 +16983,7 @@ function readConditionalExtensions(sheet) {
|
|
|
16392
16983
|
}
|
|
16393
16984
|
|
|
16394
16985
|
// chart/read-appearance.ts
|
|
16395
|
-
function readChartAppearance(text5,
|
|
16986
|
+
function readChartAppearance(text5, properties) {
|
|
16396
16987
|
const out = {};
|
|
16397
16988
|
const size3 = Number(text5?.getAttribute("sz") ?? NaN);
|
|
16398
16989
|
if (Number.isFinite(size3) && size3 > 0) out.fontSize = size3 / 100;
|
|
@@ -16409,8 +17000,8 @@ function readChartAppearance(text5, properties2) {
|
|
|
16409
17000
|
if (typeface2) out.typeface = typeface2;
|
|
16410
17001
|
const color2 = parseDrawingColorIn(first(text5, "solidFill", NS.a));
|
|
16411
17002
|
if (color2) out.textColor = color2;
|
|
16412
|
-
const fill = parseDrawingFill(
|
|
16413
|
-
const line = parseDrawingLine(first(
|
|
17003
|
+
const fill = parseDrawingFill(properties);
|
|
17004
|
+
const line = parseDrawingLine(first(properties, "ln", NS.a));
|
|
16414
17005
|
if (fill) out.fill = fill;
|
|
16415
17006
|
if (line) out.line = line;
|
|
16416
17007
|
const effects = first(text5, "effectLst", NS.a);
|
|
@@ -17617,8 +18208,8 @@ function parseChartSpace(source) {
|
|
|
17617
18208
|
}
|
|
17618
18209
|
|
|
17619
18210
|
// chart/write-text-body.ts
|
|
17620
|
-
function runProperties(local,
|
|
17621
|
-
const p =
|
|
18211
|
+
function runProperties(local, properties) {
|
|
18212
|
+
const p = properties ?? {};
|
|
17622
18213
|
const attributes = [
|
|
17623
18214
|
p.sizePt === void 0 ? "" : ` sz="${Math.round(p.sizePt * 100)}"`,
|
|
17624
18215
|
p.bold === void 0 ? "" : ` b="${p.bold ? 1 : 0}"`,
|
|
@@ -17634,16 +18225,16 @@ function spacing(local, value3) {
|
|
|
17634
18225
|
return `<a:${local}>${inner}</a:${local}>`;
|
|
17635
18226
|
}
|
|
17636
18227
|
function run(value3) {
|
|
17637
|
-
const { text: text5, ...
|
|
17638
|
-
const hasProperties = Object.keys(
|
|
18228
|
+
const { text: text5, ...properties } = value3;
|
|
18229
|
+
const hasProperties = Object.keys(properties).length > 0;
|
|
17639
18230
|
if (text5 === "\n")
|
|
17640
|
-
return hasProperties ? `<a:br>${runProperties("rPr",
|
|
17641
|
-
return `<a:r>${hasProperties ? runProperties("rPr",
|
|
18231
|
+
return hasProperties ? `<a:br>${runProperties("rPr", properties)}</a:br>` : "<a:br/>";
|
|
18232
|
+
return `<a:r>${hasProperties ? runProperties("rPr", properties) : ""}<a:t>${escapeText2(text5)}</a:t></a:r>`;
|
|
17642
18233
|
}
|
|
17643
18234
|
function paragraph(value3) {
|
|
17644
18235
|
const align = value3.align ? ` algn="${escapeAttribute(value3.align)}"` : "";
|
|
17645
|
-
const
|
|
17646
|
-
return `<a:p><a:pPr${align}>${
|
|
18236
|
+
const properties = spacing("lnSpc", value3.lineSpacing) + spacing("spcBef", value3.spaceBefore) + spacing("spcAft", value3.spaceAfter) + runProperties("defRPr", value3.defaultProperties);
|
|
18237
|
+
return `<a:p><a:pPr${align}>${properties}</a:pPr>${value3.runs.map(run).join("")}</a:p>`;
|
|
17647
18238
|
}
|
|
17648
18239
|
function writeTextBody(body) {
|
|
17649
18240
|
const insets = body.insetsEmu ?? {};
|
|
@@ -17780,7 +18371,7 @@ function dataSourceInner(source) {
|
|
|
17780
18371
|
case "multiLvlStrRef": {
|
|
17781
18372
|
const levels = source.levels ? elementXml(
|
|
17782
18373
|
"multiLvlStrCache",
|
|
17783
|
-
valXml("ptCount", source.levelPointCount) + source.levels.map((
|
|
18374
|
+
valXml("ptCount", source.levelPointCount) + source.levels.map((level3) => elementXml("lvl", cachePoints(level3))).join("")
|
|
17784
18375
|
) : "";
|
|
17785
18376
|
return `<c:multiLvlStrRef>${formula2}${levels}</c:multiLvlStrRef>`;
|
|
17786
18377
|
}
|
|
@@ -18172,13 +18763,13 @@ function parsePattern(code) {
|
|
|
18172
18763
|
continue;
|
|
18173
18764
|
}
|
|
18174
18765
|
if (ch === "[") {
|
|
18175
|
-
const
|
|
18176
|
-
const token = code.slice(i + 1,
|
|
18766
|
+
const close3 = code.indexOf("]", i);
|
|
18767
|
+
const token = code.slice(i + 1, close3 === -1 ? code.length : close3);
|
|
18177
18768
|
const named2 = NAMED_FORMAT_COLORS[token.trim().toLowerCase()];
|
|
18178
18769
|
if (named2 && color2 === void 0) {
|
|
18179
18770
|
color2 = named2;
|
|
18180
18771
|
}
|
|
18181
|
-
i =
|
|
18772
|
+
i = close3 === -1 ? code.length : close3;
|
|
18182
18773
|
continue;
|
|
18183
18774
|
}
|
|
18184
18775
|
chars.push({ ch, literal: false });
|
|
@@ -18408,6 +18999,9 @@ function composeDataLabelText(input) {
|
|
|
18408
18999
|
// chart/render/summary-labels.ts
|
|
18409
19000
|
function level(options2, custom) {
|
|
18410
19001
|
const out = {};
|
|
19002
|
+
if (options2.layout) out.layout = options2.layout;
|
|
19003
|
+
if (options2.showLeaderLines !== void 0) out.showLeaderLines = options2.showLeaderLines;
|
|
19004
|
+
if (options2.leaderLines?.spPr?.line) out.leaderLine = options2.leaderLines.spPr.line;
|
|
18411
19005
|
if (options2.deleted !== void 0) out.deleted = options2.deleted;
|
|
18412
19006
|
if (options2.showValue !== void 0) out.showValue = options2.showValue;
|
|
18413
19007
|
if (options2.showCategoryName !== void 0) out.showCategory = options2.showCategoryName;
|
|
@@ -18457,7 +19051,7 @@ var GROUP_TYPES = {
|
|
|
18457
19051
|
surface: "surface"
|
|
18458
19052
|
};
|
|
18459
19053
|
var GROUPINGS = /* @__PURE__ */ new Set(["clustered", "stacked", "percentStacked", "standard"]);
|
|
18460
|
-
function chartSummarySeries(source, chartType, groupLabels) {
|
|
19054
|
+
function chartSummarySeries(source, chartType, groupLabels, groupSmooth) {
|
|
18461
19055
|
const categories = source.categories ?? source.xValues;
|
|
18462
19056
|
const values = source.values ?? source.yValues;
|
|
18463
19057
|
const numeric5 = (v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null;
|
|
@@ -18465,6 +19059,9 @@ function chartSummarySeries(source, chartType, groupLabels) {
|
|
|
18465
19059
|
categories: chartSourceValues(categories),
|
|
18466
19060
|
values: chartSourceValues(values).map(numeric5)
|
|
18467
19061
|
};
|
|
19062
|
+
const smooth = source.smooth ?? groupSmooth;
|
|
19063
|
+
if (smooth !== void 0) out.smooth = smooth;
|
|
19064
|
+
if (source.spPr?.line) out.line = source.spPr.line;
|
|
18468
19065
|
if (values?.cache?.formatCode !== void 0) out.numberFormat = values.cache.formatCode;
|
|
18469
19066
|
if (source.bubbleSizes) {
|
|
18470
19067
|
out.bubbleSizes = chartSourceValues(source.bubbleSizes).map(numeric5);
|
|
@@ -18485,12 +19082,12 @@ function chartSummarySeries(source, chartType, groupLabels) {
|
|
|
18485
19082
|
const points = {};
|
|
18486
19083
|
const pointFills = {};
|
|
18487
19084
|
for (const point2 of source.dataPoints) {
|
|
18488
|
-
const
|
|
19085
|
+
const properties = point2.spPr ?? point2.marker?.spPr;
|
|
18489
19086
|
if (point2.index === void 0) continue;
|
|
18490
|
-
const pointColor = solidColor(
|
|
19087
|
+
const pointColor = solidColor(properties?.fill);
|
|
18491
19088
|
if (pointColor) points[point2.index] = pointColor;
|
|
18492
|
-
if (
|
|
18493
|
-
pointFills[point2.index] =
|
|
19089
|
+
if (properties?.fill && properties.fill.kind !== "solid")
|
|
19090
|
+
pointFills[point2.index] = properties.fill;
|
|
18494
19091
|
}
|
|
18495
19092
|
if (Object.keys(points).length) out.pointColors = points;
|
|
18496
19093
|
if (Object.keys(pointFills).length) out.pointFills = pointFills;
|
|
@@ -18524,7 +19121,12 @@ function extraGroups(chartSpace, firstType) {
|
|
|
18524
19121
|
const entry3 = {
|
|
18525
19122
|
chartType: type,
|
|
18526
19123
|
series: group2.series.map((source, index2) => ({
|
|
18527
|
-
...chartSummarySeries(
|
|
19124
|
+
...chartSummarySeries(
|
|
19125
|
+
source,
|
|
19126
|
+
type,
|
|
19127
|
+
group2.dataLabels,
|
|
19128
|
+
group2.smooth ?? (group2.scatterStyle ? ["smooth", "smoothMarker"].includes(group2.scatterStyle) : void 0)
|
|
19129
|
+
),
|
|
18528
19130
|
...summaryMarkers(source, group2, index2)
|
|
18529
19131
|
})),
|
|
18530
19132
|
secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
|
|
@@ -18545,8 +19147,14 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
|
18545
19147
|
let chartType = group2 ? GROUP_TYPES[group2.kind] : "column";
|
|
18546
19148
|
if (chartType === "bar" && group2?.barDirection !== "bar") chartType = "column";
|
|
18547
19149
|
const series = (group2?.series ?? []).map((source, index2) => ({
|
|
18548
|
-
...chartSummarySeries(
|
|
18549
|
-
|
|
19150
|
+
...chartSummarySeries(
|
|
19151
|
+
source,
|
|
19152
|
+
chartType,
|
|
19153
|
+
group2?.dataLabels,
|
|
19154
|
+
group2?.smooth ?? (group2?.scatterStyle ? ["smooth", "smoothMarker"].includes(group2.scatterStyle) : void 0)
|
|
19155
|
+
),
|
|
19156
|
+
...group2 ? summaryMarkers(source, group2, index2) : {},
|
|
19157
|
+
...group2?.kind === "scatter" ? { showLine: !["marker", "none"].includes(group2.scatterStyle ?? "marker") } : {}
|
|
18550
19158
|
}));
|
|
18551
19159
|
const summary = {
|
|
18552
19160
|
chartType,
|
|
@@ -18555,6 +19163,9 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
|
18555
19163
|
axes: chartSpace.plotArea.axes,
|
|
18556
19164
|
axisIds: group2?.axisIds ?? []
|
|
18557
19165
|
};
|
|
19166
|
+
if (chartSpace.plotArea.dataTable) summary.dataTable = chartSpace.plotArea.dataTable;
|
|
19167
|
+
if (chartSpace.date1904 !== void 0) summary.date1904 = chartSpace.date1904;
|
|
19168
|
+
if (chartSpace.plotArea.layout) summary.plotLayout = chartSpace.plotArea.layout;
|
|
18558
19169
|
const combined = extraGroups(chartSpace, chartType);
|
|
18559
19170
|
if (combined.length) summary.extraGroups = combined;
|
|
18560
19171
|
if (chartType === "stock" && group2) summary.stock = stockStyle(group2);
|
|
@@ -18634,6 +19245,9 @@ function chartObjectFromSpace(space, frame, root2) {
|
|
|
18634
19245
|
showLegend: summary.showLegend
|
|
18635
19246
|
};
|
|
18636
19247
|
if (frame.partName !== void 0) object.partName = frame.partName;
|
|
19248
|
+
if (summary.dataTable) object.dataTable = summary.dataTable;
|
|
19249
|
+
if (summary.date1904 !== void 0) object.date1904 = summary.date1904;
|
|
19250
|
+
if (summary.plotLayout) object.plotLayout = summary.plotLayout;
|
|
18637
19251
|
if (summary.axes) object.axes = summary.axes;
|
|
18638
19252
|
if (summary.axisIds) object.axisIds = summary.axisIds;
|
|
18639
19253
|
if (summary.grouping) object.grouping = summary.grouping;
|
|
@@ -18783,7 +19397,7 @@ function parseDimension(context, element2) {
|
|
|
18783
19397
|
return assignDefined(
|
|
18784
19398
|
{
|
|
18785
19399
|
kind: element2.localName,
|
|
18786
|
-
levels: cxChildren(element2, "lvl").map((
|
|
19400
|
+
levels: cxChildren(element2, "lvl").map((level3) => parseLevel(context, level3))
|
|
18787
19401
|
},
|
|
18788
19402
|
{
|
|
18789
19403
|
type: attribute3(element2, "type"),
|
|
@@ -19194,6 +19808,41 @@ function parseChartExSpace(source) {
|
|
|
19194
19808
|
return { chartExSpace, issues: context.issues };
|
|
19195
19809
|
}
|
|
19196
19810
|
|
|
19811
|
+
// chart/render/summary-ex-series.ts
|
|
19812
|
+
var level2 = (source) => ({
|
|
19813
|
+
...source.visibility?.value === void 0 ? {} : { showValue: source.visibility.value },
|
|
19814
|
+
...source.visibility?.categoryName === void 0 ? {} : { showCategory: source.visibility.categoryName },
|
|
19815
|
+
...source.visibility?.seriesName === void 0 ? {} : { showSeriesName: source.visibility.seriesName },
|
|
19816
|
+
...source.position ? { position: source.position } : {},
|
|
19817
|
+
...source.numberFormat?.formatCode ? { numberFormat: source.numberFormat.formatCode } : {},
|
|
19818
|
+
...source.separator === void 0 ? {} : { separator: source.separator }
|
|
19819
|
+
});
|
|
19820
|
+
function chartExSeriesPaint(source, series, defaultValues = false) {
|
|
19821
|
+
const fill = source.spPr?.fill;
|
|
19822
|
+
if (fill) series.fill = fill;
|
|
19823
|
+
const points = {};
|
|
19824
|
+
const fills = {};
|
|
19825
|
+
for (const point2 of source.dataPoints) {
|
|
19826
|
+
if (point2.index === void 0) continue;
|
|
19827
|
+
const fill2 = point2.spPr?.fill;
|
|
19828
|
+
if (fill2?.kind === "solid") points[point2.index] = fill2.color;
|
|
19829
|
+
else if (fill2) fills[point2.index] = fill2;
|
|
19830
|
+
}
|
|
19831
|
+
if (Object.keys(points).length) series.pointColors = points;
|
|
19832
|
+
if (Object.keys(fills).length) series.pointFills = fills;
|
|
19833
|
+
const labels = source.dataLabels;
|
|
19834
|
+
if (!labels && !defaultValues) return;
|
|
19835
|
+
const overrides = {};
|
|
19836
|
+
for (const label of labels?.labels ?? [])
|
|
19837
|
+
if (label.index !== void 0) overrides[label.index] = level2(label);
|
|
19838
|
+
for (const index2 of labels?.hidden ?? [])
|
|
19839
|
+
overrides[index2] = { ...overrides[index2], deleted: true };
|
|
19840
|
+
series.dataLabels = {
|
|
19841
|
+
series: { showValue: defaultValues, ...labels ? level2(labels) : {} },
|
|
19842
|
+
points: overrides
|
|
19843
|
+
};
|
|
19844
|
+
}
|
|
19845
|
+
|
|
19197
19846
|
// chart/render/summary-from-chartex.ts
|
|
19198
19847
|
function seriesData(space, series) {
|
|
19199
19848
|
if (series.data) return series.data;
|
|
@@ -19201,17 +19850,17 @@ function seriesData(space, series) {
|
|
|
19201
19850
|
return series.dataId === void 0 ? shared[0] : shared.find((data) => data.id === series.dataId);
|
|
19202
19851
|
}
|
|
19203
19852
|
var findDimension = (data, kind, type) => data?.dimensions.find((d) => d.kind === kind && (d.type ?? "") === type);
|
|
19204
|
-
function levelPoints(
|
|
19853
|
+
function levelPoints(level3) {
|
|
19205
19854
|
const points = [];
|
|
19206
|
-
for (const point2 of
|
|
19207
|
-
for (let i = 0; i < Math.max(
|
|
19855
|
+
for (const point2 of level3.points) points[point2.index ?? points.length] = point2.value.trim();
|
|
19856
|
+
for (let i = 0; i < Math.max(level3.pointCount ?? 0, points.length); i++) points[i] ??= "";
|
|
19208
19857
|
return points;
|
|
19209
19858
|
}
|
|
19210
19859
|
function dimension(data, kind, type) {
|
|
19211
19860
|
const element2 = findDimension(data, kind, type);
|
|
19212
19861
|
if (!element2) return void 0;
|
|
19213
|
-
const
|
|
19214
|
-
const out = { points:
|
|
19862
|
+
const level3 = element2.levels[0];
|
|
19863
|
+
const out = { points: level3 ? levelPoints(level3) : [] };
|
|
19215
19864
|
const formula2 = element2.formula?.formula.trim();
|
|
19216
19865
|
if (formula2) out.formula = formula2;
|
|
19217
19866
|
return out;
|
|
@@ -19275,13 +19924,8 @@ function chartExFormatting() {
|
|
|
19275
19924
|
}
|
|
19276
19925
|
};
|
|
19277
19926
|
}
|
|
19278
|
-
function
|
|
19279
|
-
const
|
|
19280
|
-
const primary = all.find((s) => s.layoutId !== "paretoLine") ?? all[0];
|
|
19281
|
-
const layoutId = primary?.layoutId ?? "";
|
|
19282
|
-
const chartType = layoutId === "waterfall" ? "waterfall" : layoutId === "clusteredColumn" ? "histogram" : layoutId === "treemap" || layoutId === "sunburst" ? layoutId : void 0;
|
|
19283
|
-
if (!primary || !chartType) return { layoutId };
|
|
19284
|
-
const data = seriesData(space, primary);
|
|
19927
|
+
function summarySeries(space, source, chartType) {
|
|
19928
|
+
const data = seriesData(space, source);
|
|
19285
19929
|
const categories = dimension(data, "strDim", "cat");
|
|
19286
19930
|
const values = dimension(
|
|
19287
19931
|
data,
|
|
@@ -19293,17 +19937,63 @@ function chartExSummaryFromModel(space) {
|
|
|
19293
19937
|
values: (values?.points ?? []).map(
|
|
19294
19938
|
(p) => p !== "" && Number.isFinite(Number(p)) ? Number(p) : null
|
|
19295
19939
|
),
|
|
19296
|
-
...seriesFill(
|
|
19940
|
+
...seriesFill(source)
|
|
19297
19941
|
};
|
|
19298
|
-
|
|
19942
|
+
if (chartType === "funnel" || chartType === "boxWhisker") {
|
|
19943
|
+
chartExSeriesPaint(source, series, chartType === "funnel" && source.dataLabels !== void 0);
|
|
19944
|
+
if (source.hidden !== void 0) series.hidden = source.hidden;
|
|
19945
|
+
}
|
|
19946
|
+
if (chartType === "boxWhisker") series.boxWhisker = source.layoutProperties ?? {};
|
|
19947
|
+
const name3 = source.tx?.value?.trim();
|
|
19299
19948
|
if (name3) series.name = name3;
|
|
19300
|
-
const nameRef =
|
|
19949
|
+
const nameRef = source.tx?.formula?.formula.trim();
|
|
19301
19950
|
if (nameRef) series.nameRef = nameRef;
|
|
19302
19951
|
if (categories?.formula) series.categoriesRef = categories.formula;
|
|
19303
19952
|
if (values?.formula) series.valuesRef = values.formula;
|
|
19953
|
+
return series;
|
|
19954
|
+
}
|
|
19955
|
+
function chartExSummaryFromModel(space) {
|
|
19956
|
+
const all = space.plotArea.series;
|
|
19957
|
+
const primary = all.find((s) => s.layoutId !== "paretoLine") ?? all[0];
|
|
19958
|
+
const layoutId = primary?.layoutId ?? "";
|
|
19959
|
+
const chartType = layoutId === "waterfall" ? "waterfall" : layoutId === "clusteredColumn" ? "histogram" : layoutId === "treemap" || layoutId === "sunburst" || layoutId === "funnel" || layoutId === "boxWhisker" ? layoutId : void 0;
|
|
19960
|
+
if (!primary || !chartType) return { layoutId };
|
|
19961
|
+
const series = summarySeries(space, primary, chartType);
|
|
19304
19962
|
const layout = primary.layoutProperties;
|
|
19305
19963
|
const legend = space.legend;
|
|
19306
|
-
const summary = {
|
|
19964
|
+
const summary = {
|
|
19965
|
+
chartType,
|
|
19966
|
+
series: chartType === "boxWhisker" ? all.filter((s) => s.layoutId === "boxWhisker").map((source) => summarySeries(space, source, chartType)) : [series],
|
|
19967
|
+
showLegend: legend !== void 0
|
|
19968
|
+
};
|
|
19969
|
+
if (chartType === "boxWhisker") {
|
|
19970
|
+
summary.axes = space.plotArea.axes.flatMap((axis) => {
|
|
19971
|
+
const scaling = axis.scaling;
|
|
19972
|
+
if (!scaling) return [];
|
|
19973
|
+
const value3 = scaling.kind === "val";
|
|
19974
|
+
return [
|
|
19975
|
+
{
|
|
19976
|
+
kind: value3 ? "val" : "cat",
|
|
19977
|
+
...axis.id === void 0 ? {} : { id: axis.id },
|
|
19978
|
+
position: value3 ? "l" : "b",
|
|
19979
|
+
deleted: axis.hidden ?? false,
|
|
19980
|
+
scaling: {
|
|
19981
|
+
...value3 && typeof scaling.min === "number" ? { min: scaling.min } : {},
|
|
19982
|
+
...value3 && typeof scaling.max === "number" ? { max: scaling.max } : {}
|
|
19983
|
+
},
|
|
19984
|
+
majorGridlines: !!axis.majorGridlines,
|
|
19985
|
+
minorGridlines: !!axis.minorGridlines,
|
|
19986
|
+
...axis.majorGridlines?.spPr ? { majorGridlinesSpPr: axis.majorGridlines.spPr } : {},
|
|
19987
|
+
...axis.minorGridlines?.spPr ? { minorGridlinesSpPr: axis.minorGridlines.spPr } : {},
|
|
19988
|
+
...value3 && typeof scaling.majorUnit === "number" ? { majorUnit: scaling.majorUnit } : {},
|
|
19989
|
+
...value3 && typeof scaling.minorUnit === "number" ? { minorUnit: scaling.minorUnit } : {},
|
|
19990
|
+
...axis.spPr ? { spPr: axis.spPr } : {},
|
|
19991
|
+
...axis.numberFormat ? { numberFormat: axis.numberFormat } : {},
|
|
19992
|
+
...axis.tickLabels ? {} : { tickLabelPosition: "none" }
|
|
19993
|
+
}
|
|
19994
|
+
];
|
|
19995
|
+
});
|
|
19996
|
+
}
|
|
19307
19997
|
summary.formatting = chartExFormatting();
|
|
19308
19998
|
const title = titleOf(space);
|
|
19309
19999
|
if (title) summary.title = title;
|
|
@@ -19318,11 +20008,11 @@ function chartExSummaryFromModel(space) {
|
|
|
19318
20008
|
} else if (chartType === "treemap" || chartType === "sunburst") {
|
|
19319
20009
|
const parentLayout = layout?.parentLabelLayout;
|
|
19320
20010
|
summary.hierarchy = {
|
|
19321
|
-
levels: categoryLevels(
|
|
20011
|
+
levels: categoryLevels(seriesData(space, primary)),
|
|
19322
20012
|
dataLabels: primary.dataLabels !== void 0,
|
|
19323
20013
|
...parentLayout === "none" || parentLayout === "banner" || parentLayout === "overlapping" ? { parentLabelLayout: parentLayout } : {}
|
|
19324
20014
|
};
|
|
19325
|
-
} else summary.histogram = histogramOptions(primary);
|
|
20015
|
+
} else if (chartType === "histogram") summary.histogram = histogramOptions(primary);
|
|
19326
20016
|
return { layoutId, summary };
|
|
19327
20017
|
}
|
|
19328
20018
|
|
|
@@ -19530,7 +20220,8 @@ function parseDrawing(source, partName, warn) {
|
|
|
19530
20220
|
const cNvPr = nonVisual(content2);
|
|
19531
20221
|
const name3 = att(cNvPr, "name");
|
|
19532
20222
|
if (content2.localName === "pic") {
|
|
19533
|
-
const
|
|
20223
|
+
const blipFill = xdr(content2, "blipFill");
|
|
20224
|
+
const blip = first(blipFill, "blip", NS.a);
|
|
19534
20225
|
const rel = rels.get(relAttr(blip, "embed") ?? "");
|
|
19535
20226
|
const target2 = rel ? source.target(partName, rel) : void 0;
|
|
19536
20227
|
if (!target2 || !source.has(target2)) {
|
|
@@ -19540,6 +20231,9 @@ function parseDrawing(source, partName, warn) {
|
|
|
19540
20231
|
const image = {
|
|
19541
20232
|
kind: "image",
|
|
19542
20233
|
anchor,
|
|
20234
|
+
sourceXml: selfContainedXml(anchorEl),
|
|
20235
|
+
...parsePictureCrop(blipFill) ? { crop: parsePictureCrop(blipFill) } : {},
|
|
20236
|
+
...parsePictureEffects(blip).length ? { effects: parsePictureEffects(blip) } : {},
|
|
19543
20237
|
partName: target2,
|
|
19544
20238
|
contentType: source.contentType(target2) ?? "application/octet-stream"
|
|
19545
20239
|
};
|
|
@@ -20170,7 +20864,7 @@ async function loadXlsx(input, options2 = {}) {
|
|
|
20170
20864
|
const corePart = source.targetOfType("", RELATIONSHIP_TYPES.coreProperties);
|
|
20171
20865
|
const appPart = source.targetOfType("", RELATIONSHIP_TYPES.extendedProperties);
|
|
20172
20866
|
const customPart = source.targetOfType("", RELATIONSHIP_TYPES.customProperties);
|
|
20173
|
-
const
|
|
20867
|
+
const properties = readProperties(
|
|
20174
20868
|
corePart ? source.text(corePart) : void 0,
|
|
20175
20869
|
appPart ? source.text(appPart) : void 0,
|
|
20176
20870
|
customPart ? source.text(customPart) : void 0,
|
|
@@ -20184,7 +20878,7 @@ async function loadXlsx(input, options2 = {}) {
|
|
|
20184
20878
|
theme: parseTheme2(themePart ? source.text(themePart) : void 0),
|
|
20185
20879
|
activeSheet: Math.min(Math.max(0, book.activeTab), Math.max(0, sheets.length - 1)),
|
|
20186
20880
|
date1904: book.date1904,
|
|
20187
|
-
properties
|
|
20881
|
+
properties,
|
|
20188
20882
|
source: { parts },
|
|
20189
20883
|
format: MACRO_TYPES.has(contentType2) ? "xlsm" : "xlsx",
|
|
20190
20884
|
warnings
|
|
@@ -20514,10 +21208,10 @@ var STOCK_DEFAULT_WICK_COLOR = "#334155";
|
|
|
20514
21208
|
|
|
20515
21209
|
// chart/hierarchy.ts
|
|
20516
21210
|
function normalizeLevels(levels, pointCount) {
|
|
20517
|
-
return levels.map((
|
|
21211
|
+
return levels.map((level3) => {
|
|
20518
21212
|
let previous = "";
|
|
20519
21213
|
return Array.from({ length: pointCount }, (_, index2) => {
|
|
20520
|
-
const label =
|
|
21214
|
+
const label = level3[index2]?.trim() ?? "";
|
|
20521
21215
|
if (label) previous = label;
|
|
20522
21216
|
return label || previous;
|
|
20523
21217
|
});
|
|
@@ -20703,9 +21397,6 @@ function resolveChartGradient(fill, resolve) {
|
|
|
20703
21397
|
};
|
|
20704
21398
|
}
|
|
20705
21399
|
|
|
20706
|
-
// chart/render/chart-svg-util.ts
|
|
20707
|
-
var TEXT_COLOR = "#595959";
|
|
20708
|
-
|
|
20709
21400
|
// chart/render/chart-colors.ts
|
|
20710
21401
|
function chartColorScheme(theme2) {
|
|
20711
21402
|
const slots = Object.fromEntries(
|
|
@@ -20812,6 +21503,9 @@ function chartAppearance(chart, theme2) {
|
|
|
20812
21503
|
return out;
|
|
20813
21504
|
}
|
|
20814
21505
|
|
|
21506
|
+
// chart/render/chart-svg-util.ts
|
|
21507
|
+
var TEXT_COLOR = "#595959";
|
|
21508
|
+
|
|
20815
21509
|
// chart/render/chart-scale.ts
|
|
20816
21510
|
var clean = (n) => Number(n.toPrecision(12));
|
|
20817
21511
|
function* units2(raw2) {
|
|
@@ -21065,6 +21759,50 @@ function applyChartAxes(model2, chart, color2) {
|
|
|
21065
21759
|
model2.axes = out;
|
|
21066
21760
|
}
|
|
21067
21761
|
|
|
21762
|
+
// chart/render/chart-title-text.ts
|
|
21763
|
+
function chartRunStyle(run2) {
|
|
21764
|
+
return {
|
|
21765
|
+
...run2.sizePt === void 0 ? {} : { fontSize: run2.sizePt },
|
|
21766
|
+
...run2.bold === void 0 ? {} : { bold: run2.bold },
|
|
21767
|
+
...run2.italic === void 0 ? {} : { italic: run2.italic },
|
|
21768
|
+
...run2.underline === void 0 ? {} : { underline: run2.underline },
|
|
21769
|
+
...run2.typeface === void 0 ? {} : { typeface: run2.typeface },
|
|
21770
|
+
...run2.color === void 0 ? {} : { textColor: run2.color }
|
|
21771
|
+
};
|
|
21772
|
+
}
|
|
21773
|
+
function chartTitleText(chart, theme2) {
|
|
21774
|
+
const formatting = chart.formatting;
|
|
21775
|
+
const entry3 = formatting?.entries.title;
|
|
21776
|
+
const body = entry3?.textBody;
|
|
21777
|
+
if (!formatting || !body || body.text !== chart.title) return void 0;
|
|
21778
|
+
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)
|
|
21779
|
+
return void 0;
|
|
21780
|
+
return {
|
|
21781
|
+
paragraphs: body.paragraphs.map((paragraph2) => ({
|
|
21782
|
+
...paragraph2.align ? { align: paragraph2.align } : {},
|
|
21783
|
+
...paragraph2.lineSpacing ? { lineSpacing: paragraph2.lineSpacing } : {},
|
|
21784
|
+
...paragraph2.spaceBefore ? { spaceBefore: paragraph2.spaceBefore } : {},
|
|
21785
|
+
...paragraph2.spaceAfter ? { spaceAfter: paragraph2.spaceAfter } : {},
|
|
21786
|
+
runs: paragraph2.runs.map((run2) => {
|
|
21787
|
+
const direct = {
|
|
21788
|
+
sourceXml: "",
|
|
21789
|
+
...entry3.textBodyStyle,
|
|
21790
|
+
...chartRunStyle(paragraph2.defaultProperties ?? {}),
|
|
21791
|
+
...chartRunStyle(run2)
|
|
21792
|
+
};
|
|
21793
|
+
const appearance = chartAppearance(
|
|
21794
|
+
{
|
|
21795
|
+
...chart,
|
|
21796
|
+
formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
|
|
21797
|
+
},
|
|
21798
|
+
theme2
|
|
21799
|
+
)?.title ?? {};
|
|
21800
|
+
return { text: run2.text, appearance };
|
|
21801
|
+
})
|
|
21802
|
+
}))
|
|
21803
|
+
};
|
|
21804
|
+
}
|
|
21805
|
+
|
|
21068
21806
|
// chart/render/chart-view-analysis.ts
|
|
21069
21807
|
function strokeOf(line, fallback, resolve) {
|
|
21070
21808
|
if (line?.fill?.kind === "none") return void 0;
|
|
@@ -21092,6 +21830,40 @@ function analysisView(source, seriesColor, resolve) {
|
|
|
21092
21830
|
};
|
|
21093
21831
|
}
|
|
21094
21832
|
|
|
21833
|
+
// chart/render/chart-view-data-table.ts
|
|
21834
|
+
function chartDataTableView(chart, theme2, color2) {
|
|
21835
|
+
const source = chart.dataTable;
|
|
21836
|
+
if (!source) return void 0;
|
|
21837
|
+
const props = source.txPr?.paragraphs[0];
|
|
21838
|
+
const direct = {
|
|
21839
|
+
sourceXml: "",
|
|
21840
|
+
...chartRunStyle(props?.defaultProperties ?? {}),
|
|
21841
|
+
...chartRunStyle(props?.runs[0] ?? {})
|
|
21842
|
+
};
|
|
21843
|
+
const formatting = chart.formatting;
|
|
21844
|
+
const appearance = chartAppearance(
|
|
21845
|
+
{
|
|
21846
|
+
...chart,
|
|
21847
|
+
formatting: {
|
|
21848
|
+
...formatting,
|
|
21849
|
+
sourceXml: formatting?.sourceXml ?? "",
|
|
21850
|
+
entries: { ...formatting?.entries, categoryAxis: direct }
|
|
21851
|
+
}
|
|
21852
|
+
},
|
|
21853
|
+
theme2
|
|
21854
|
+
);
|
|
21855
|
+
const fill = source.spPr?.fill;
|
|
21856
|
+
return {
|
|
21857
|
+
source,
|
|
21858
|
+
stroke: strokeOf(source.spPr?.line, { color: "#D9D9D9", width: 1 }, color2) ?? {
|
|
21859
|
+
color: "none",
|
|
21860
|
+
width: 0
|
|
21861
|
+
},
|
|
21862
|
+
...fill?.kind === "solid" && color2(fill.color) ? { fill: color2(fill.color) } : {},
|
|
21863
|
+
...appearance?.categoryAxis ? { text: appearance.categoryAxis } : {}
|
|
21864
|
+
};
|
|
21865
|
+
}
|
|
21866
|
+
|
|
21095
21867
|
// chart/render/chart-view-series.ts
|
|
21096
21868
|
var isRefError = (value3) => typeof value3 === "object" && value3 !== null && "error" in value3;
|
|
21097
21869
|
function toText(value3) {
|
|
@@ -21133,7 +21905,8 @@ function seriesContext(chart, theme2, options2) {
|
|
|
21133
21905
|
function seriesView(ctx, s, index2, total, categoriesOf) {
|
|
21134
21906
|
const { theme: theme2, scheme, palette, evaluateRef: evaluateRef2 } = ctx;
|
|
21135
21907
|
const values = resolveRef(s.valuesRef, evaluateRef2)?.map(toNumber) ?? s.values.map(toNumber);
|
|
21136
|
-
|
|
21908
|
+
const categoryValues = resolveRef(s.categoriesRef, evaluateRef2) ?? s.categories;
|
|
21909
|
+
categoriesOf(categoryValues);
|
|
21137
21910
|
const paletteColor2 = palette && chartPaletteSeriesColor(palette, index2, total, scheme);
|
|
21138
21911
|
const color2 = s.fill?.kind === "none" ? "none" : ctx.drawingColor(s.fill?.kind === "solid" ? s.fill.color : s.drawingColor) ?? ctx.seriesColor?.(s, index2) ?? paletteColor2 ?? autoSeriesColor(theme2, index2);
|
|
21139
21912
|
const view2 = {
|
|
@@ -21142,6 +21915,19 @@ function seriesView(ctx, s, index2, total, categoriesOf) {
|
|
|
21142
21915
|
color: color2,
|
|
21143
21916
|
sourceIndex: index2
|
|
21144
21917
|
};
|
|
21918
|
+
if (s.hidden !== void 0) view2.hidden = s.hidden;
|
|
21919
|
+
if (s.boxWhisker) {
|
|
21920
|
+
view2.boxWhisker = s.boxWhisker;
|
|
21921
|
+
view2.boxCategories = categoryValues.map(toText);
|
|
21922
|
+
}
|
|
21923
|
+
if (s.numberFormat !== void 0) view2.numberFormat = s.numberFormat;
|
|
21924
|
+
if (s.showLine !== void 0) view2.showLine = s.showLine;
|
|
21925
|
+
if (s.smooth !== void 0) view2.smooth = s.smooth;
|
|
21926
|
+
if (s.line)
|
|
21927
|
+
view2.stroke = strokeOf(s.line, { color: color2, width: 2.25 }, ctx.drawingColor) ?? {
|
|
21928
|
+
color: "none",
|
|
21929
|
+
width: 0
|
|
21930
|
+
};
|
|
21145
21931
|
const shadow = resolveDrawingShadowXml(s.effectsXml, { scheme: (name3) => scheme[name3] });
|
|
21146
21932
|
if (shadow) view2.shadow = shadow;
|
|
21147
21933
|
const resolvedGradient = ctx.gradient(s.fill);
|
|
@@ -21281,52 +22067,8 @@ function valueAxis(model2) {
|
|
|
21281
22067
|
return { ...niceScale(min, max), percent: false };
|
|
21282
22068
|
}
|
|
21283
22069
|
|
|
21284
|
-
// chart/render/chart-title-text.ts
|
|
21285
|
-
function properties(run2) {
|
|
21286
|
-
return {
|
|
21287
|
-
...run2.sizePt === void 0 ? {} : { fontSize: run2.sizePt },
|
|
21288
|
-
...run2.bold === void 0 ? {} : { bold: run2.bold },
|
|
21289
|
-
...run2.italic === void 0 ? {} : { italic: run2.italic },
|
|
21290
|
-
...run2.underline === void 0 ? {} : { underline: run2.underline },
|
|
21291
|
-
...run2.typeface === void 0 ? {} : { typeface: run2.typeface },
|
|
21292
|
-
...run2.color === void 0 ? {} : { textColor: run2.color }
|
|
21293
|
-
};
|
|
21294
|
-
}
|
|
21295
|
-
function chartTitleText(chart, theme2) {
|
|
21296
|
-
const formatting = chart.formatting;
|
|
21297
|
-
const entry3 = formatting?.entries.title;
|
|
21298
|
-
const body = entry3?.textBody;
|
|
21299
|
-
if (!formatting || !body || body.text !== chart.title) return void 0;
|
|
21300
|
-
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)
|
|
21301
|
-
return void 0;
|
|
21302
|
-
return {
|
|
21303
|
-
paragraphs: body.paragraphs.map((paragraph2) => ({
|
|
21304
|
-
...paragraph2.align ? { align: paragraph2.align } : {},
|
|
21305
|
-
...paragraph2.lineSpacing ? { lineSpacing: paragraph2.lineSpacing } : {},
|
|
21306
|
-
...paragraph2.spaceBefore ? { spaceBefore: paragraph2.spaceBefore } : {},
|
|
21307
|
-
...paragraph2.spaceAfter ? { spaceAfter: paragraph2.spaceAfter } : {},
|
|
21308
|
-
runs: paragraph2.runs.map((run2) => {
|
|
21309
|
-
const direct = {
|
|
21310
|
-
sourceXml: "",
|
|
21311
|
-
...entry3.textBodyStyle,
|
|
21312
|
-
...properties(paragraph2.defaultProperties ?? {}),
|
|
21313
|
-
...properties(run2)
|
|
21314
|
-
};
|
|
21315
|
-
const appearance = chartAppearance(
|
|
21316
|
-
{
|
|
21317
|
-
...chart,
|
|
21318
|
-
formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
|
|
21319
|
-
},
|
|
21320
|
-
theme2
|
|
21321
|
-
)?.title ?? {};
|
|
21322
|
-
return { text: run2.text, appearance };
|
|
21323
|
-
})
|
|
21324
|
-
}))
|
|
21325
|
-
};
|
|
21326
|
-
}
|
|
21327
|
-
|
|
21328
22070
|
// chart/render/chart-view-labels.ts
|
|
21329
|
-
function labelsOf(source, view2, categories, numberFormat3) {
|
|
22071
|
+
function labelsOf(source, view2, categories, numberFormat3, resolveColor2) {
|
|
21330
22072
|
const { chart, series, points } = source;
|
|
21331
22073
|
if ((series?.deleted ?? chart?.deleted) === true) return void 0;
|
|
21332
22074
|
const percentBase = view2.values.reduce(
|
|
@@ -21362,19 +22104,35 @@ function labelsOf(source, view2, categories, numberFormat3) {
|
|
|
21362
22104
|
});
|
|
21363
22105
|
}
|
|
21364
22106
|
if (!built) return;
|
|
22107
|
+
const layout = point2?.layout;
|
|
22108
|
+
const showLeaderLines = series?.showLeaderLines ?? chart?.showLeaderLines;
|
|
22109
|
+
const leaderLine = strokeOf(
|
|
22110
|
+
series?.leaderLine ?? chart?.leaderLine,
|
|
22111
|
+
{ color: "#94a3b8", width: 0.75 },
|
|
22112
|
+
resolveColor2
|
|
22113
|
+
) ?? { color: "none", width: 0 };
|
|
21365
22114
|
any = true;
|
|
21366
22115
|
out[i] = {
|
|
21367
22116
|
text: built.text,
|
|
22117
|
+
...layout ? { layout } : {},
|
|
22118
|
+
...showLeaderLines !== void 0 ? { showLeaderLines } : {},
|
|
22119
|
+
...leaderLine ? { leaderLine } : {},
|
|
21368
22120
|
...position ? { position } : {},
|
|
21369
22121
|
...built.color ? { color: built.color } : {}
|
|
21370
22122
|
};
|
|
21371
22123
|
});
|
|
21372
22124
|
return any ? out : void 0;
|
|
21373
22125
|
}
|
|
21374
|
-
function applyDataLabels(model2, sources, extra) {
|
|
22126
|
+
function applyDataLabels(model2, sources, extra, resolveColor2) {
|
|
21375
22127
|
const apply3 = (source, view2) => {
|
|
21376
22128
|
if (!source?.dataLabels) return;
|
|
21377
|
-
const labels = labelsOf(
|
|
22129
|
+
const labels = labelsOf(
|
|
22130
|
+
source.dataLabels,
|
|
22131
|
+
view2,
|
|
22132
|
+
model2.categories,
|
|
22133
|
+
source.numberFormat,
|
|
22134
|
+
resolveColor2
|
|
22135
|
+
);
|
|
21378
22136
|
if (labels) view2.labels = labels;
|
|
21379
22137
|
};
|
|
21380
22138
|
model2.series.forEach((view2, i) => apply3(sources[i], view2));
|
|
@@ -21479,7 +22237,9 @@ var SUPPORTED = /* @__PURE__ */ new Set([
|
|
|
21479
22237
|
"bubble",
|
|
21480
22238
|
"stock",
|
|
21481
22239
|
"treemap",
|
|
21482
|
-
"sunburst"
|
|
22240
|
+
"sunburst",
|
|
22241
|
+
"funnel",
|
|
22242
|
+
"boxWhisker"
|
|
21483
22243
|
]);
|
|
21484
22244
|
function chartSummaryView(chart, theme2, options2 = {}) {
|
|
21485
22245
|
const type = chart.chartType;
|
|
@@ -21537,10 +22297,17 @@ function chartSummaryView(chart, theme2, options2 = {}) {
|
|
|
21537
22297
|
showLegend: chart.showLegend,
|
|
21538
22298
|
legendPosition: chart.legendPosition ?? "r",
|
|
21539
22299
|
categories,
|
|
21540
|
-
series,
|
|
22300
|
+
series: type === "boxWhisker" ? series.filter((s) => !s.hidden) : series,
|
|
21541
22301
|
horizontal: type === "bar",
|
|
21542
22302
|
supported: SUPPORTED.has(type)
|
|
21543
22303
|
};
|
|
22304
|
+
const table2 = chartDataTableView(chart, theme2, ctx.drawingColor);
|
|
22305
|
+
if (table2) model2.dataTable = table2;
|
|
22306
|
+
if (chart.date1904 !== void 0) model2.date1904 = chart.date1904;
|
|
22307
|
+
if (chart.axes?.some((a2) => a2.kind === "date")) model2.dateCategories = firstCats.map(toNumber);
|
|
22308
|
+
if (chart.plotLayout) model2.plotLayout = chart.plotLayout;
|
|
22309
|
+
if (type === "boxWhisker")
|
|
22310
|
+
model2.categories = [...new Set(model2.series.flatMap((s) => s.boxCategories ?? []))];
|
|
21544
22311
|
if (chart.title) model2.title = chart.title;
|
|
21545
22312
|
const titleFormatting = chart.formatting?.entries.title;
|
|
21546
22313
|
if (titleFormatting?.layout) model2.titleLayout = titleFormatting.layout;
|
|
@@ -21562,6 +22329,11 @@ function chartSummaryView(chart, theme2, options2 = {}) {
|
|
|
21562
22329
|
const range2 = extentOf(xs);
|
|
21563
22330
|
model2.xAxis = xs.length ? niceScale(range2.min, range2.max) : niceScale(0, 1);
|
|
21564
22331
|
}
|
|
22332
|
+
if (type === "funnel" || type === "boxWhisker")
|
|
22333
|
+
series.forEach((s, i) => {
|
|
22334
|
+
const points = chart.series[i]?.pointColors;
|
|
22335
|
+
if (points) s.pointColors = s.values.map((_, j) => drawingColor2(points[j]) ?? s.color);
|
|
22336
|
+
});
|
|
21565
22337
|
if (type === "stock") model2.stock = stockView(chart.stock, ctx);
|
|
21566
22338
|
if (type === "bubble") bubbleView(chart, model2, ctx.evaluateRef);
|
|
21567
22339
|
if (type === "treemap" || type === "sunburst") hierarchyView(chart, model2, ctx.evaluateRef);
|
|
@@ -21570,7 +22342,7 @@ function chartSummaryView(chart, theme2, options2 = {}) {
|
|
|
21570
22342
|
chartExtraView(chart, model2, ctx, total, collect);
|
|
21571
22343
|
if (type === "waterfall") waterfallView(chart, model2, ctx);
|
|
21572
22344
|
else if (!byPoint) model2.valueAxis = valueAxis(model2);
|
|
21573
|
-
applyDataLabels(model2, chart.series, extra);
|
|
22345
|
+
applyDataLabels(model2, chart.series, extra, ctx.drawingColor);
|
|
21574
22346
|
chartExtraAxes(model2);
|
|
21575
22347
|
applyChartAxes(model2, chart, ctx.drawingColor);
|
|
21576
22348
|
return model2;
|
|
@@ -21634,10 +22406,14 @@ function withHierarchyRanges(workbook, chart) {
|
|
|
21634
22406
|
}
|
|
21635
22407
|
function chartView(workbook, sheetIndex, chart, evaluateRef2) {
|
|
21636
22408
|
const theme2 = workbook.theme;
|
|
21637
|
-
return chartSummaryView(
|
|
21638
|
-
|
|
21639
|
-
|
|
21640
|
-
|
|
22409
|
+
return chartSummaryView(
|
|
22410
|
+
{ ...withHierarchyRanges(workbook, chart), date1904: chart.date1904 ?? workbook.date1904 },
|
|
22411
|
+
theme2,
|
|
22412
|
+
{
|
|
22413
|
+
evaluateRef: evaluateRef2,
|
|
22414
|
+
seriesColor: (series) => resolveColor(series.color, theme2)
|
|
22415
|
+
}
|
|
22416
|
+
);
|
|
21641
22417
|
}
|
|
21642
22418
|
|
|
21643
22419
|
// xlsx/ui/dialogs/insert-chart-model.ts
|
|
@@ -22301,7 +23077,7 @@ function extension(node3, name3) {
|
|
|
22301
23077
|
(ext) => themeChildren(ext, name3, THEME_NS)
|
|
22302
23078
|
)[0];
|
|
22303
23079
|
}
|
|
22304
|
-
function
|
|
23080
|
+
function integer4(value3) {
|
|
22305
23081
|
if (!value3 || !/^\d{1,6}$/.test(value3)) return void 0;
|
|
22306
23082
|
return Number(value3);
|
|
22307
23083
|
}
|
|
@@ -22327,7 +23103,7 @@ function drawingPaint(node3, colors, placeholder3, depth = 0) {
|
|
|
22327
23103
|
if (!color2 || color2.transforms.length > 32) return void 0;
|
|
22328
23104
|
const transforms = color2.transforms.filter((transform2) => transform2.name !== "hueMod");
|
|
22329
23105
|
if (transforms.some(
|
|
22330
|
-
(transform2) => !SUPPORTED_TRANSFORMS.has(transform2.name) || (
|
|
23106
|
+
(transform2) => !SUPPORTED_TRANSFORMS.has(transform2.name) || (integer4(transform2.value) ?? 100001) > 1e5
|
|
22331
23107
|
))
|
|
22332
23108
|
return void 0;
|
|
22333
23109
|
let rgb6;
|
|
@@ -22359,7 +23135,7 @@ function drawingColor(node3, colors, placeholder3) {
|
|
|
22359
23135
|
}
|
|
22360
23136
|
|
|
22361
23137
|
// visio/theme-resolve.ts
|
|
22362
|
-
var cellNumber = (cells4, name3) =>
|
|
23138
|
+
var cellNumber = (cells4, name3) => integer4(cells4?.get(name3)?.value);
|
|
22363
23139
|
function rootThemeSelected(cells4, resources) {
|
|
22364
23140
|
const local = cellNumber(cells4, "ColorSchemeIndex");
|
|
22365
23141
|
return local === 0 || local === 65534 && cellNumber(resources.pageCells, "ColorSchemeIndex") === 0;
|
|
@@ -22417,7 +23193,7 @@ function themeFormat(cells4, category, resources) {
|
|
|
22417
23193
|
if (matrix3 !== void 0 && matrix3 >= 100 && matrix3 <= 103) {
|
|
22418
23194
|
const variant = inheritedIndex(cells4, resources.pageCells, "VariationStyleIndex", 0);
|
|
22419
23195
|
const style2 = variant === void 0 ? void 0 : effect.variationStyles[variant]?.[matrix3 - 100];
|
|
22420
|
-
matrix3 =
|
|
23196
|
+
matrix3 = integer4(
|
|
22421
23197
|
style2?.getAttribute(`${category === "Effects" ? "effect" : category.toLowerCase()}Idx`)
|
|
22422
23198
|
);
|
|
22423
23199
|
}
|
|
@@ -22511,7 +23287,7 @@ function themeLinearGradient(sheet, resources, width, height, report) {
|
|
|
22511
23287
|
return reject2();
|
|
22512
23288
|
const stops = [];
|
|
22513
23289
|
for (const node3 of nodes) {
|
|
22514
|
-
const position =
|
|
23290
|
+
const position = integer4(node3.getAttribute("pos"));
|
|
22515
23291
|
const paint2 = drawingPaint(colorChoice(node3), context.colors, context.base);
|
|
22516
23292
|
if (position === void 0 || position > 1e5 || !paint2 || position / 1e5 < (stops.at(-1)?.offset ?? 0))
|
|
22517
23293
|
return reject2();
|
|
@@ -24855,12 +25631,12 @@ function visioThemeVariantColors(source, variant) {
|
|
|
24855
25631
|
|
|
24856
25632
|
// visio/page-theme.ts
|
|
24857
25633
|
function visioPageTheme(themes, pageCells) {
|
|
24858
|
-
const id3 =
|
|
25634
|
+
const id3 = integer4(pageCells.get("ColorSchemeIndex")?.value);
|
|
24859
25635
|
if (!themes || id3 === void 0 || id3 === 0 || id3 >= 65534) return void 0;
|
|
24860
25636
|
const matches2 = themes.filter((theme3) => theme3.colorId === id3);
|
|
24861
25637
|
if (matches2.length !== 1) return void 0;
|
|
24862
25638
|
const theme2 = matches2[0];
|
|
24863
|
-
const variant = Math.min(3,
|
|
25639
|
+
const variant = Math.min(3, integer4(pageCells.get("VariationColorIndex")?.value) ?? 0);
|
|
24864
25640
|
const accents = [1, 2, 3, 4, 5, 6].map(
|
|
24865
25641
|
(index2) => drawingColor(theme2.colors.get(`accent${index2}`), theme2.colors) ?? "#808080"
|
|
24866
25642
|
);
|
|
@@ -25117,7 +25893,7 @@ var VISIO_SCHEME_SLOTS = [
|
|
|
25117
25893
|
"accent5",
|
|
25118
25894
|
"accent6"
|
|
25119
25895
|
];
|
|
25120
|
-
var componentId = (node3) =>
|
|
25896
|
+
var componentId = (node3) => integer4(themeChild(node3, "schemeID", THEME_NS)?.getAttribute("schemeEnum"));
|
|
25121
25897
|
async function loadVisioThemes(pkg, source, report) {
|
|
25122
25898
|
const result2 = [];
|
|
25123
25899
|
for (const rel of (await pkg.relationships(source)).values()) {
|
|
@@ -25158,7 +25934,7 @@ async function loadVisioThemes(pkg, source, report) {
|
|
|
25158
25934
|
const name3 = root2.getAttribute("name");
|
|
25159
25935
|
result2.push({
|
|
25160
25936
|
...name3 ? { name: name3.slice(0, 256) } : {},
|
|
25161
|
-
colorId:
|
|
25937
|
+
colorId: integer4(extension(palette, "schemeID")?.getAttribute("schemeEnum")),
|
|
25162
25938
|
effectId: componentId(extension(base2, "fmtSchemeEx")),
|
|
25163
25939
|
connectorId: componentId(extension(base2, "fmtConnectorSchemeEx")),
|
|
25164
25940
|
colors,
|
|
@@ -25630,8 +26406,8 @@ function rootThemeSheet(sheet, resources, report) {
|
|
|
25630
26406
|
const root2 = resources.rootSheet;
|
|
25631
26407
|
if (!root2) return sheet;
|
|
25632
26408
|
const colorRoot = rootThemeSelected(sheet.cells, resources);
|
|
25633
|
-
const lineRoot = colorRoot ||
|
|
25634
|
-
const fillRoot = colorRoot ||
|
|
26409
|
+
const lineRoot = colorRoot || integer4(sheet.cells.get("QuickStyleLineMatrix")?.value) === 0;
|
|
26410
|
+
const fillRoot = colorRoot || integer4(sheet.cells.get("QuickStyleFillMatrix")?.value) === 0;
|
|
25635
26411
|
let cells4 = sheet.cells;
|
|
25636
26412
|
if (colorRoot)
|
|
25637
26413
|
cells4 = replaceThemed(cells4, root2.cells, ["LineColor", "FillForegnd", "FillBkgnd"], report);
|
|
@@ -26673,13 +27449,13 @@ async function parseVsdx(input, options2 = {}) {
|
|
|
26673
27449
|
const cache2 = options2.documentCache;
|
|
26674
27450
|
const cached5 = cacheMatches(cache2?.entry, pkg, options2) ? cache2.entry : void 0;
|
|
26675
27451
|
const stopRecording = cache2 && !cached5 ? pkg.record() : void 0;
|
|
26676
|
-
let
|
|
27452
|
+
let level3;
|
|
26677
27453
|
if (cached5) {
|
|
26678
|
-
|
|
26679
|
-
for (const args of
|
|
26680
|
-
} else
|
|
26681
|
-
const { documentRoot, styles, readPrintSettings, masters, masterRecords } =
|
|
26682
|
-
const resources = { ...
|
|
27454
|
+
level3 = cached5.level;
|
|
27455
|
+
for (const args of level3.reports) report(...args);
|
|
27456
|
+
} else level3 = await readDocumentLevel(pkg, documentPart2, options2, checkTime, report);
|
|
27457
|
+
const { documentRoot, styles, readPrintSettings, masters, masterRecords } = level3;
|
|
27458
|
+
const resources = { ...level3.resources };
|
|
26683
27459
|
delete resources.pageCells;
|
|
26684
27460
|
delete resources.fieldContext;
|
|
26685
27461
|
let geometryCount = 0, textCount = 0, expansionCount = 0, textRuns = 0, paragraphCount = 0;
|
|
@@ -26758,7 +27534,7 @@ async function parseVsdx(input, options2 = {}) {
|
|
|
26758
27534
|
options: optionsKey(options2),
|
|
26759
27535
|
converter: options2.metafileConverter,
|
|
26760
27536
|
reads: stopRecording(),
|
|
26761
|
-
level: { ...
|
|
27537
|
+
level: { ...level3, resources: { ...resources } },
|
|
26762
27538
|
listed: {
|
|
26763
27539
|
documentMasters,
|
|
26764
27540
|
counters: {
|
|
@@ -29513,9 +30289,9 @@ function writeExclusiveOperand(input, cpStart, cpEnd, opcode, value3) {
|
|
|
29513
30289
|
const operands = row2.prls.filter((p) => p.opcode === opcode);
|
|
29514
30290
|
if (operands.length !== 1)
|
|
29515
30291
|
throw new Error("inherited-formatting");
|
|
29516
|
-
const
|
|
29517
|
-
const previous =
|
|
29518
|
-
if (size3 ?
|
|
30292
|
+
const operand2 = operands[0], size3 = opcode === 19011;
|
|
30293
|
+
const previous = operand2.operand[0] + (size3 ? operand2.operand[1] * 256 : 0);
|
|
30294
|
+
if (size3 ? operand2.operand.length !== 2 || previous < 2 || previous > 3276 : opcode === 10814 ? ![0, 1, 3].includes(previous) : ![0, 1, 128, 129].includes(previous))
|
|
29519
30295
|
throw new Error("inherited-formatting");
|
|
29520
30296
|
const piece = parsed.pieces.find((p) => p.cpStart <= cpStart && p.cpEnd >= cpEnd);
|
|
29521
30297
|
const unit3 = piece.compressed ? 1 : 2, start = piece.fc + (cpStart - piece.cpStart) * unit3;
|
|
@@ -29547,9 +30323,9 @@ function writeExclusiveOperand(input, cpStart, cpEnd, opcode, value3) {
|
|
|
29547
30323
|
if (previous === value3)
|
|
29548
30324
|
return input;
|
|
29549
30325
|
const word = parsed.word.slice();
|
|
29550
|
-
word[
|
|
30326
|
+
word[operand2.at] = value3 & 255;
|
|
29551
30327
|
if (size3)
|
|
29552
|
-
word[
|
|
30328
|
+
word[operand2.at + 1] = value3 >>> 8;
|
|
29553
30329
|
return parsed.doc.rewrap(word, parsed.doc.tableBytes);
|
|
29554
30330
|
}
|
|
29555
30331
|
|
|
@@ -29877,8 +30653,8 @@ var DocDocument = class extends Ole2DocumentBase {
|
|
|
29877
30653
|
else
|
|
29878
30654
|
size3 = value3;
|
|
29879
30655
|
const opcode = flag === "bold" ? 2101 : flag === "italic" ? 2102 : flag === "underline" ? 10814 : 19011;
|
|
29880
|
-
const
|
|
29881
|
-
sprms = Object.freeze(sprms.map((p) => p.opcode === opcode ? Object.freeze({ opcode: p.opcode, operand: Object.freeze(
|
|
30656
|
+
const operand2 = flag === "size" ? [value3 * 2 & 255, value3 * 2 >>> 8] : flag === "underline" ? [value3 === "none" ? 0 : value3 === "single" ? 1 : 3] : [Number(value3)];
|
|
30657
|
+
sprms = Object.freeze(sprms.map((p) => p.opcode === opcode ? Object.freeze({ opcode: p.opcode, operand: Object.freeze(operand2) }) : p));
|
|
29882
30658
|
};
|
|
29883
30659
|
return Object.freeze({
|
|
29884
30660
|
cpStart,
|
|
@@ -29968,14 +30744,14 @@ function buildDirectoryTree(entryCount) {
|
|
|
29968
30744
|
let redLevel = 0;
|
|
29969
30745
|
for (let remaining = entryCount - 2; remaining >= 0; remaining = Math.floor(remaining / 2) - 1)
|
|
29970
30746
|
redLevel++;
|
|
29971
|
-
const build = (low, high,
|
|
30747
|
+
const build = (low, high, level3) => {
|
|
29972
30748
|
if (low > high)
|
|
29973
30749
|
return 4294967295;
|
|
29974
30750
|
const id3 = Math.floor((low + high) / 2);
|
|
29975
30751
|
links.set(id3, {
|
|
29976
|
-
left: build(low, id3 - 1,
|
|
29977
|
-
right: build(id3 + 1, high,
|
|
29978
|
-
color:
|
|
30752
|
+
left: build(low, id3 - 1, level3 + 1),
|
|
30753
|
+
right: build(id3 + 1, high, level3 + 1),
|
|
30754
|
+
color: level3 === redLevel ? 0 : 1
|
|
29979
30755
|
});
|
|
29980
30756
|
return id3;
|
|
29981
30757
|
};
|
|
@@ -35490,11 +36266,11 @@ function readVsdDrawing(input) {
|
|
|
35490
36266
|
if (++records > 1e5)
|
|
35491
36267
|
throw new VsdError("record-count");
|
|
35492
36268
|
bounded3(bytes, cursor, 19);
|
|
35493
|
-
const cv = view(bytes), chunk = cv.getUint32(cursor, true), chunkId = cv.getUint32(cursor + 4, true), list2 = cv.getUint32(cursor + 8, true), length2 = cv.getUint32(cursor + 12, true),
|
|
36269
|
+
const cv = view(bytes), chunk = cv.getUint32(cursor, true), chunkId = cv.getUint32(cursor + 4, true), list2 = cv.getUint32(cursor + 8, true), length2 = cv.getUint32(cursor + 12, true), level3 = cv.getUint16(cursor + 16, true), marker3 = bytes[cursor + 18];
|
|
35494
36270
|
if (chunk === 77)
|
|
35495
36271
|
throw new VsdError("unsupported-guide");
|
|
35496
36272
|
let trailer = list2 || [113, 112, 107, 106, 105, 102, 101, 44].includes(chunk) ? 8 : 0;
|
|
35497
|
-
if (list2 ||
|
|
36273
|
+
if (list2 || level3 === 2 && marker3 === 85 || level3 === 2 && marker3 === 84 && chunk === 170 || level3 === 3 && marker3 !== 80 && marker3 !== 84)
|
|
35498
36274
|
trailer += 4;
|
|
35499
36275
|
if ([100, 101, 102, 105, 106, 107, 111, 113, 146, 169, 180, 182, 185, 199].includes(chunk) && trailer !== 12 && trailer !== 4)
|
|
35500
36276
|
trailer += 4;
|
|
@@ -35503,22 +36279,22 @@ function readVsdDrawing(input) {
|
|
|
35503
36279
|
const start = cursor + 19;
|
|
35504
36280
|
if (length2 + trailer > bytes.length - start)
|
|
35505
36281
|
throw new VsdError(`chunk-bounds-${offset}-${cursor}-${chunk}-${length2}-${trailer}-${bytes.length}`);
|
|
35506
|
-
while (stack.length &&
|
|
36282
|
+
while (stack.length && level3 <= stack[stack.length - 1].level)
|
|
35507
36283
|
stack.pop();
|
|
35508
36284
|
let current = stack[stack.length - 1]?.shape ?? shape;
|
|
35509
36285
|
if (current && [70, 74].includes(chunk))
|
|
35510
36286
|
throw new VsdError("unsupported-sheet-owner");
|
|
35511
|
-
while (orderStack.length &&
|
|
36287
|
+
while (orderStack.length && level3 <= orderStack[orderStack.length - 1].level)
|
|
35512
36288
|
orderStack.pop();
|
|
35513
36289
|
if (page && chunk === 70) {
|
|
35514
36290
|
if (sheetIds.has(page))
|
|
35515
36291
|
page.shapeOrderIssue = "ambiguous-page-owner";
|
|
35516
|
-
sheetIds.set(page, length2 >= 54 &&
|
|
36292
|
+
sheetIds.set(page, length2 >= 54 && level3 === 1 && [10, 18, 26].every((o) => cv.getUint32(start + o, true) === 4294967295) ? chunkId : void 0);
|
|
35517
36293
|
}
|
|
35518
36294
|
if (page && chunk === 101) {
|
|
35519
36295
|
const orders = shapeOrders.get(page) ?? /* @__PURE__ */ new Map();
|
|
35520
36296
|
shapeOrders.set(page, orders);
|
|
35521
|
-
const order = { owner: current, elements: [], ids: /* @__PURE__ */ new Map(), level:
|
|
36297
|
+
const order = { owner: current, elements: [], ids: /* @__PURE__ */ new Map(), level: level3 };
|
|
35522
36298
|
if (orders.has(current))
|
|
35523
36299
|
order.issue = "duplicate-shape-order";
|
|
35524
36300
|
orders.set(current, order);
|
|
@@ -35550,7 +36326,7 @@ function readVsdDrawing(input) {
|
|
|
35550
36326
|
const order = orderStack[orderStack.length - 1];
|
|
35551
36327
|
if (!order)
|
|
35552
36328
|
page.shapeOrderIssue = "orphan-shape-id";
|
|
35553
|
-
else if (
|
|
36329
|
+
else if (level3 !== order.level + 1)
|
|
35554
36330
|
order.issue = "shape-id-owner-level";
|
|
35555
36331
|
else if (length2 < 4)
|
|
35556
36332
|
order.issue = "shape-id-bounds";
|
|
@@ -35567,7 +36343,7 @@ function readVsdDrawing(input) {
|
|
|
35567
36343
|
current.masterPageId = cv.getUint32(start + 18, true);
|
|
35568
36344
|
current.masterShapeId = cv.getUint32(start + 26, true);
|
|
35569
36345
|
page.shapes.push(current);
|
|
35570
|
-
stack.push({ level:
|
|
36346
|
+
stack.push({ level: level3, shape: current });
|
|
35571
36347
|
}
|
|
35572
36348
|
if (chunk === 146 && page) {
|
|
35573
36349
|
if (length2 < 54)
|
|
@@ -41624,13 +42400,13 @@ async function pageContext(pkg, pageId2) {
|
|
|
41624
42400
|
const page = pages.find((node3) => attribute2(node3, "ID") === pageId2);
|
|
41625
42401
|
const foreground = pages.filter((node3) => !yes(attribute2(node3, "Background")));
|
|
41626
42402
|
const number5 = page ? foreground.indexOf(page) + 1 : 0;
|
|
41627
|
-
const
|
|
41628
|
-
for (const key2 of STRING_PROPERTIES)
|
|
42403
|
+
const properties = await readVisioFieldProperties(pkg);
|
|
42404
|
+
for (const key2 of STRING_PROPERTIES) properties[key2] ??= "";
|
|
41629
42405
|
return {
|
|
41630
42406
|
pageName: attribute2(page, "Name") ?? attribute2(page, "NameU") ?? `Page ${pageId2}`,
|
|
41631
42407
|
...number5 ? { pageNumber: number5 } : {},
|
|
41632
42408
|
pageCount: foreground.length,
|
|
41633
|
-
properties
|
|
42409
|
+
properties,
|
|
41634
42410
|
now: visioWallClock(/* @__PURE__ */ new Date())
|
|
41635
42411
|
};
|
|
41636
42412
|
}
|
|
@@ -42497,8 +43273,8 @@ function valid(key2, value3) {
|
|
|
42497
43273
|
fail("INVALID_EDIT", `Invalid page layout value for ${key2}.`);
|
|
42498
43274
|
return number5;
|
|
42499
43275
|
}
|
|
42500
|
-
const
|
|
42501
|
-
const ok = key2 === "lineJumpDirectionX" || key2 === "lineJumpDirectionY" ?
|
|
43276
|
+
const integer6 = Number.isSafeInteger(number5);
|
|
43277
|
+
const ok = key2 === "lineJumpDirectionX" || key2 === "lineJumpDirectionY" ? integer6 && number5 >= 0 && number5 <= 2 : key2 === "lineJumpCode" ? integer6 && number5 >= 0 && number5 <= 5 : key2 === "lineJumpStyle" ? integer6 && number5 >= 0 && number5 <= 9 : key2.startsWith("gridDensity") ? VISIO_GRID_DENSITIES.includes(number5) : key2.startsWith("rulerDensity") ? VISIO_RULER_DENSITIES.includes(number5) : key2.startsWith("gridSpacing") ? number5 >= 0 && number5 <= 1e4 : Math.abs(number5) <= 1e6;
|
|
42502
43278
|
if (!ok) fail("INVALID_EDIT", `Invalid page layout value for ${key2}.`);
|
|
42503
43279
|
return number5;
|
|
42504
43280
|
}
|
|
@@ -44330,7 +45106,7 @@ function visioThemeColorFormula(ref) {
|
|
|
44330
45106
|
const base2 = slot2 ? `THEMEVAL("${slot2[1]}")` : `RGB(${[1, 3, 5].map((index2) => parseInt(ref.base.slice(index2, index2 + 2), 16)).join(",")})`;
|
|
44331
45107
|
return `THEMEGUARD(${ref.tint ? `MSOTINT(${base2},${ref.tint})` : base2})`;
|
|
44332
45108
|
}
|
|
44333
|
-
var
|
|
45109
|
+
var integer5 = (node3) => {
|
|
44334
45110
|
const value3 = node3?.kind === "unary" && node3.operator === "-" && node3.operand.kind === "number" ? -node3.operand.value : node3?.kind === "number" ? node3.value : void 0;
|
|
44335
45111
|
return value3 !== void 0 && Number.isInteger(value3) ? value3 : void 0;
|
|
44336
45112
|
};
|
|
@@ -44341,7 +45117,7 @@ function base(node3) {
|
|
|
44341
45117
|
return SLOTS.find(([, native]) => native.toLowerCase() === name3)?.[0];
|
|
44342
45118
|
}
|
|
44343
45119
|
if (node3.name !== "RGB" || node3.args.length !== 3) return void 0;
|
|
44344
|
-
const channels = node3.args.map(
|
|
45120
|
+
const channels = node3.args.map(integer5);
|
|
44345
45121
|
if (channels.some((value3) => value3 === void 0 || value3 < 0 || value3 > 255)) return void 0;
|
|
44346
45122
|
return `#${channels.map((value3) => value3.toString(16).padStart(2, "0")).join("")}`;
|
|
44347
45123
|
}
|
|
@@ -44357,7 +45133,7 @@ function parseVisioThemeColorFormula(source) {
|
|
|
44357
45133
|
const inner = ast.args[0];
|
|
44358
45134
|
if (inner.kind === "call" && inner.name === "MSOTINT" && inner.args.length === 2) {
|
|
44359
45135
|
const from2 = base(inner.args[0]);
|
|
44360
|
-
const tint =
|
|
45136
|
+
const tint = integer5(inner.args[1]);
|
|
44361
45137
|
return from2 && tint !== void 0 && tint !== 0 && Math.abs(tint) <= 100 ? { base: from2, tint } : void 0;
|
|
44362
45138
|
}
|
|
44363
45139
|
const from = base(inner);
|
|
@@ -45118,9 +45894,39 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
|
|
|
45118
45894
|
});
|
|
45119
45895
|
}
|
|
45120
45896
|
|
|
45121
|
-
// visio/edit-resize-
|
|
45122
|
-
var
|
|
45123
|
-
function
|
|
45897
|
+
// visio/edit-resize-plan.ts
|
|
45898
|
+
var resizeClose = (a2, b) => Math.abs(a2 - b) <= 1e-10 * Math.max(1, Math.abs(a2), Math.abs(b));
|
|
45899
|
+
function assertCanonicalResizeCells(shape) {
|
|
45900
|
+
const canonical2 = [
|
|
45901
|
+
"Width",
|
|
45902
|
+
"Height",
|
|
45903
|
+
"PinX",
|
|
45904
|
+
"PinY",
|
|
45905
|
+
"LocPinX",
|
|
45906
|
+
"LocPinY",
|
|
45907
|
+
"Angle",
|
|
45908
|
+
"FlipX",
|
|
45909
|
+
"FlipY",
|
|
45910
|
+
"LockMoveX",
|
|
45911
|
+
"LockMoveY",
|
|
45912
|
+
"LockWidth",
|
|
45913
|
+
"LockHeight",
|
|
45914
|
+
"LockAspect",
|
|
45915
|
+
"LockDelete",
|
|
45916
|
+
"ResizeMode"
|
|
45917
|
+
];
|
|
45918
|
+
for (const cell of children2(shape, "Cell")) {
|
|
45919
|
+
const name3 = attribute2(cell, "N") ?? "";
|
|
45920
|
+
if (canonical2.some(
|
|
45921
|
+
(expected) => expected.toLowerCase() === name3.toLowerCase() && expected !== name3
|
|
45922
|
+
))
|
|
45923
|
+
fail(
|
|
45924
|
+
"EDIT_AMBIGUOUS_CELL",
|
|
45925
|
+
"Noncanonical transform and protection cell names are unsupported."
|
|
45926
|
+
);
|
|
45927
|
+
}
|
|
45928
|
+
}
|
|
45929
|
+
function resizeClosure(graph, changed, check) {
|
|
45124
45930
|
const reverse = /* @__PURE__ */ new Map();
|
|
45125
45931
|
for (const [id3, item2] of graph) {
|
|
45126
45932
|
check();
|
|
@@ -45143,40 +45949,128 @@ function closure(graph, changed, check) {
|
|
|
45143
45949
|
}
|
|
45144
45950
|
return affected;
|
|
45145
45951
|
}
|
|
45952
|
+
|
|
45953
|
+
// visio/edit-group-resize.ts
|
|
45954
|
+
function localGroupResize(root2, id3, document, check) {
|
|
45955
|
+
const candidates = children2(children2(root2, "Shapes")[0], "Shape").filter(
|
|
45956
|
+
(shape) => attribute2(shape, "ID") === id3
|
|
45957
|
+
);
|
|
45958
|
+
if (candidates.length !== 1 || attribute2(candidates[0], "Type") !== "Group") return void 0;
|
|
45959
|
+
const group2 = candidates[0];
|
|
45960
|
+
const members3 = children2(children2(group2, "Shapes")[0], "Shape");
|
|
45961
|
+
if ([group2, ...members3].some(
|
|
45962
|
+
(shape) => shape.hasAttribute("Master") || shape.hasAttribute("MasterShape")
|
|
45963
|
+
) || !members3.length || members3.length > 500 || members3.some(
|
|
45964
|
+
(shape) => attribute2(shape, "Type") !== "Shape" || children2(shape, "Shapes").length
|
|
45965
|
+
))
|
|
45966
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Group resizing requires a flat local group of 2D shapes.");
|
|
45967
|
+
const ids = proveLocalShapeTree(group2, check);
|
|
45968
|
+
assertUngluedTree(root2, ids, "Group resizing cannot update glued members or group connections.");
|
|
45969
|
+
const shapes = /* @__PURE__ */ new Set([group2, ...members3]);
|
|
45970
|
+
for (const shape of shapes) {
|
|
45971
|
+
check();
|
|
45972
|
+
assertCanonicalResizeCells(shape);
|
|
45973
|
+
protectedShape(shape, document);
|
|
45974
|
+
assertUnlayeredShape(shape, document);
|
|
45975
|
+
if (shape !== group2 && Math.abs(Math.sin(numeric(cells(shape).get("Angle"), 0))) > 1e-10)
|
|
45976
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Group resizing requires axis-aligned local members.");
|
|
45977
|
+
for (const node3 of Array.from(shape.childNodes).filter(
|
|
45978
|
+
(node4) => node4.nodeType === 1 && node4.localName !== "Shapes"
|
|
45979
|
+
)) {
|
|
45980
|
+
for (const cell of [node3, ...Array.from(node3.getElementsByTagName("*"))]) {
|
|
45981
|
+
const formula2 = executableCellFormula(attribute2(cell, "F"));
|
|
45982
|
+
if (formula2 && analyzeVisioFormula(formula2).unsupportedFunctions.length)
|
|
45983
|
+
fail(
|
|
45984
|
+
"EDIT_UNSUPPORTED_FORMULA",
|
|
45985
|
+
"Group resize cannot refresh unsupported or text-measured formulas."
|
|
45986
|
+
);
|
|
45987
|
+
}
|
|
45988
|
+
}
|
|
45989
|
+
}
|
|
45990
|
+
return { group: group2, members: members3, shapes, groups: /* @__PURE__ */ new Set([group2]) };
|
|
45991
|
+
}
|
|
45992
|
+
function planGroupResize(scope, roots, edit, source, check) {
|
|
45993
|
+
const writes = [];
|
|
45994
|
+
const expected = /* @__PURE__ */ new Map();
|
|
45995
|
+
const read = (shape, name3, fallback) => {
|
|
45996
|
+
const local = cells(shape);
|
|
45997
|
+
return local.has(name3) || ["LocPinX", "LocPinY"].includes(name3) ? source(key({ pageId: edit.pageId, shapeId: attribute2(shape, "ID"), cell: name3 })).value : numeric(local.get(name3), fallback);
|
|
45998
|
+
};
|
|
45999
|
+
const mode = (shape, fallback) => {
|
|
46000
|
+
const cell = cells(shape).get("ResizeMode");
|
|
46001
|
+
if (!cell) return fallback;
|
|
46002
|
+
const formula2 = executableCellFormula(attribute2(cell, "F"));
|
|
46003
|
+
if (attribute2(cell, "F") === "Inh" || formula2 && analyzeVisioFormula(formula2).references.length || visioFormulaCachedValue("0", attribute2(cell, "U")).unit !== "scalar")
|
|
46004
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Group resize needs a constant local ResizeMode.");
|
|
46005
|
+
const value3 = read(shape, "ResizeMode");
|
|
46006
|
+
if (![0, 1, 2].includes(value3))
|
|
46007
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Unsupported group ResizeMode.");
|
|
46008
|
+
return value3 || fallback;
|
|
46009
|
+
};
|
|
46010
|
+
const width = read(scope.group, "Width"), height = read(scope.group, "Height");
|
|
46011
|
+
const sx = edit.width / width, sy = edit.height / height, groupMode = mode(scope.group, 2);
|
|
46012
|
+
for (const shape of scope.members) {
|
|
46013
|
+
check();
|
|
46014
|
+
const id3 = attribute2(shape, "ID"), local = cells(shape), scaling = mode(shape, groupMode) === 2;
|
|
46015
|
+
const childW = read(shape, "Width"), childH = read(shape, "Height");
|
|
46016
|
+
const sizeX = scaling ? sx : 1, sizeY = scaling ? sy : 1;
|
|
46017
|
+
if (numeric(local.get("LockAspect"), 0) !== 0 && !resizeClose(sizeX, sizeY))
|
|
46018
|
+
fail("EDIT_PROTECTED_CELL", "A group member LockAspect prevents resizing.");
|
|
46019
|
+
if (scaling && (!resizeClose(sx, 1) || !resizeClose(sy, 1)))
|
|
46020
|
+
resizeGeometry(
|
|
46021
|
+
shape,
|
|
46022
|
+
roots,
|
|
46023
|
+
{ ...edit, shapeId: id3 },
|
|
46024
|
+
check,
|
|
46025
|
+
/* @__PURE__ */ new Set(),
|
|
46026
|
+
/* @__PURE__ */ new Set(),
|
|
46027
|
+
scope.shapes
|
|
46028
|
+
);
|
|
46029
|
+
for (const [name3, factor, formula2, lock] of [
|
|
46030
|
+
["PinX", sx, `Sheet.${edit.shapeId}!Width*${read(shape, "PinX") / width}`, "LockMoveX"],
|
|
46031
|
+
["PinY", sy, `Sheet.${edit.shapeId}!Height*${read(shape, "PinY") / height}`, "LockMoveY"],
|
|
46032
|
+
["Width", sizeX, `Sheet.${edit.shapeId}!Width*${childW / width}`, "LockWidth"],
|
|
46033
|
+
["Height", sizeY, `Sheet.${edit.shapeId}!Height*${childH / height}`, "LockHeight"],
|
|
46034
|
+
["LocPinX", sizeX, `Width*${read(shape, "LocPinX") / childW}`, ""],
|
|
46035
|
+
["LocPinY", sizeY, `Height*${read(shape, "LocPinY") / childH}`, ""]
|
|
46036
|
+
]) {
|
|
46037
|
+
const old = read(shape, name3), value3 = old * factor;
|
|
46038
|
+
if (!Number.isFinite(value3) || Math.abs(value3) > 1e6 || ["Width", "Height"].includes(name3) && value3 <= 0)
|
|
46039
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Resized group member exceeds coordinate limits.");
|
|
46040
|
+
expected.set(key({ pageId: edit.pageId, shapeId: id3, cell: name3 }), value3);
|
|
46041
|
+
if (resizeClose(value3, old)) continue;
|
|
46042
|
+
if (lock && numeric(local.get(lock), 0) !== 0)
|
|
46043
|
+
fail("EDIT_PROTECTED_CELL", `A group member ${lock} prevents resizing.`);
|
|
46044
|
+
const node3 = local.get(name3);
|
|
46045
|
+
const existing = executableCellFormula(attribute2(node3, "F"));
|
|
46046
|
+
if (guardedCell(node3) || existing && analyzeVisioFormula(existing).references.length)
|
|
46047
|
+
continue;
|
|
46048
|
+
editableCell(
|
|
46049
|
+
node3,
|
|
46050
|
+
(reference2) => source(
|
|
46051
|
+
key({ pageId: edit.pageId, shapeId: reference2.shapeId ?? id3, cell: reference2.cell })
|
|
46052
|
+
)
|
|
46053
|
+
);
|
|
46054
|
+
writes.push({ shape, name: name3, value: value3, formula: formula2 });
|
|
46055
|
+
}
|
|
46056
|
+
for (const name3 of ["Angle", "FlipX", "FlipY"])
|
|
46057
|
+
expected.set(key({ pageId: edit.pageId, shapeId: id3, cell: name3 }), read(shape, name3, 0));
|
|
46058
|
+
}
|
|
46059
|
+
return { writes, expected };
|
|
46060
|
+
}
|
|
46061
|
+
|
|
46062
|
+
// visio/edit-resize-anchor.ts
|
|
45146
46063
|
function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /* @__PURE__ */ new Set()) {
|
|
45147
46064
|
check();
|
|
45148
46065
|
const root2 = roots.get(edit.pageId);
|
|
45149
46066
|
if (!root2) fail("EDIT_TARGET_NOT_FOUND", "Page does not exist.");
|
|
45150
|
-
const
|
|
46067
|
+
const group2 = localGroupResize(root2, edit.shapeId, document, check);
|
|
46068
|
+
const shape = admitted(root2, edit.shapeId, /* @__PURE__ */ new Set(), /* @__PURE__ */ new Map(), void 0, group2?.groups);
|
|
45151
46069
|
const local = cells(shape);
|
|
45152
|
-
|
|
45153
|
-
"Width",
|
|
45154
|
-
"Height",
|
|
45155
|
-
"PinX",
|
|
45156
|
-
"PinY",
|
|
45157
|
-
"LocPinX",
|
|
45158
|
-
"LocPinY",
|
|
45159
|
-
"Angle",
|
|
45160
|
-
"FlipX",
|
|
45161
|
-
"FlipY",
|
|
45162
|
-
"LockMoveX",
|
|
45163
|
-
"LockMoveY",
|
|
45164
|
-
"LockWidth",
|
|
45165
|
-
"LockHeight",
|
|
45166
|
-
"LockAspect",
|
|
45167
|
-
"LockDelete"
|
|
45168
|
-
];
|
|
45169
|
-
for (const name3 of local.keys())
|
|
45170
|
-
if (canonical2.some(
|
|
45171
|
-
(expected) => expected.toLowerCase() === name3.toLowerCase() && expected !== name3
|
|
45172
|
-
))
|
|
45173
|
-
fail(
|
|
45174
|
-
"EDIT_AMBIGUOUS_CELL",
|
|
45175
|
-
"Noncanonical transform and protection cell names are unsupported."
|
|
45176
|
-
);
|
|
46070
|
+
assertCanonicalResizeCells(shape);
|
|
45177
46071
|
if (!edit.anchor || isLineSheet(cells(shape)) || edit.height <= 0)
|
|
45178
46072
|
fail("UNSUPPORTED_GEOMETRY_EDIT", "Anchored resizing requires an ordinary local 2D shape.");
|
|
45179
|
-
if (Array.from(shape.getElementsByTagName("*")).some(
|
|
46073
|
+
if (!group2 && Array.from(shape.getElementsByTagName("*")).some(
|
|
45180
46074
|
(node3) => node3.localName === "Shape" && [VISIO_NS, VISIO_LEGACY_NS].includes(node3.namespaceURI ?? "")
|
|
45181
46075
|
))
|
|
45182
46076
|
fail("UNSUPPORTED_GEOMETRY_EDIT", "Nested shape identities cannot be resized as a local leaf.");
|
|
@@ -45186,7 +46080,11 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
|
|
|
45186
46080
|
for (const connection of children2(container, "Connect"))
|
|
45187
46081
|
if (!glueShapes.has(shape) && ["FromSheet", "ToSheet"].some((name3) => attribute2(connection, name3) === edit.shapeId))
|
|
45188
46082
|
fail("UNSUPPORTED_GEOMETRY_EDIT", "Glued shapes require routing outside this subset.");
|
|
45189
|
-
const graph = indexCells(roots, {
|
|
46083
|
+
const graph = indexCells(roots, {
|
|
46084
|
+
check,
|
|
46085
|
+
glueShapes,
|
|
46086
|
+
...group2 ? { groupResizeShapes: group2.shapes } : {}
|
|
46087
|
+
});
|
|
45190
46088
|
const id3 = (cell) => key({ pageId: edit.pageId, shapeId: edit.shapeId, cell });
|
|
45191
46089
|
const source = createVisioCellEvaluator(graph, { check, glueShapes }, true);
|
|
45192
46090
|
const read = (name3, fallback) => graph.has(id3(name3)) ? source(id3(name3)).value : numeric(local.get(name3), fallback);
|
|
@@ -45202,8 +46100,9 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
|
|
|
45202
46100
|
if (![0, 1].includes(flipX) || ![0, 1].includes(flipY))
|
|
45203
46101
|
fail("EDIT_FORMULA_UNIT", "Flip cells must be scalar booleans.");
|
|
45204
46102
|
if (width === edit.width && height === edit.height) return [];
|
|
45205
|
-
|
|
45206
|
-
|
|
46103
|
+
if (!group2 || children2(shape, "Section").some((section3) => attribute2(section3, "N") === "Geometry"))
|
|
46104
|
+
resizeGeometry(shape, roots, edit, check, /* @__PURE__ */ new Set(), glueShapes, group2?.shapes);
|
|
46105
|
+
if (numeric(local.get("LockAspect"), 0) !== 0 && !resizeClose(edit.width / width, edit.height / height))
|
|
45207
46106
|
fail("EDIT_PROTECTED_CELL", "LockAspect prevents changing the aspect ratio.");
|
|
45208
46107
|
const geometry = visioAnchoredResizeGeometry(
|
|
45209
46108
|
{
|
|
@@ -45245,19 +46144,21 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
|
|
|
45245
46144
|
writes.push({ name: name3, value: value3 });
|
|
45246
46145
|
}
|
|
45247
46146
|
const changedDimensions = writes.map((write2) => id3(write2.name));
|
|
45248
|
-
const dimensionClosure =
|
|
46147
|
+
const dimensionClosure = resizeClosure(graph, changedDimensions, check);
|
|
45249
46148
|
for (const [name3, value3, old] of [
|
|
45250
46149
|
["PinX", geometry.pinX, pinX],
|
|
45251
46150
|
["PinY", geometry.pinY, pinY]
|
|
45252
46151
|
])
|
|
45253
|
-
if (!local.has(name3) || !
|
|
45254
|
-
if (!
|
|
46152
|
+
if (!local.has(name3) || !resizeClose(value3, old) || dimensionClosure.has(id3(name3)) && !guardedCell(local.get(name3))) {
|
|
46153
|
+
if (!resizeClose(value3, old)) unlocked(name3 === "PinX" ? "LockMoveX" : "LockMoveY");
|
|
45255
46154
|
writable(name3);
|
|
45256
|
-
writes.push({ name: name3, value:
|
|
46155
|
+
writes.push({ name: name3, value: resizeClose(value3, old) ? old : value3 });
|
|
45257
46156
|
}
|
|
45258
46157
|
const projected = new Map(graph);
|
|
46158
|
+
const writeId = (write2) => key({ pageId: edit.pageId, shapeId: attribute2(write2.shape ?? shape, "ID"), cell: write2.name });
|
|
45259
46159
|
const install = (write2) => {
|
|
45260
|
-
const
|
|
46160
|
+
const owner = write2.shape ?? shape, ownerId2 = attribute2(owner, "ID");
|
|
46161
|
+
const original = cells(owner).get(write2.name);
|
|
45261
46162
|
const node3 = original ? original.cloneNode(true) : shape.ownerDocument.createElementNS(shape.namespaceURI, "Cell");
|
|
45262
46163
|
node3.setAttribute("N", write2.name);
|
|
45263
46164
|
node3.setAttribute("V", String(write2.value));
|
|
@@ -45265,7 +46166,7 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
|
|
|
45265
46166
|
else node3.removeAttribute("F");
|
|
45266
46167
|
const cell = {
|
|
45267
46168
|
pageId: edit.pageId,
|
|
45268
|
-
shapeId:
|
|
46169
|
+
shapeId: ownerId2,
|
|
45269
46170
|
cell: write2.name,
|
|
45270
46171
|
node: node3,
|
|
45271
46172
|
unsafe: false,
|
|
@@ -45274,9 +46175,11 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
|
|
|
45274
46175
|
};
|
|
45275
46176
|
if (write2.formula) {
|
|
45276
46177
|
cell.formula = parseVisioFormula(write2.formula);
|
|
45277
|
-
cell.dependencies =
|
|
46178
|
+
cell.dependencies = analyzeVisioFormula(cell.formula).references.map(
|
|
46179
|
+
(reference2) => key({ pageId: edit.pageId, shapeId: reference2.shapeId ?? ownerId2, cell: reference2.cell })
|
|
46180
|
+
);
|
|
45278
46181
|
}
|
|
45279
|
-
projected.set(
|
|
46182
|
+
projected.set(writeId(write2), cell);
|
|
45280
46183
|
};
|
|
45281
46184
|
for (const write2 of writes) install(write2);
|
|
45282
46185
|
const guardedPins = [];
|
|
@@ -45296,16 +46199,17 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
|
|
|
45296
46199
|
}
|
|
45297
46200
|
const projectedPins = createVisioCellEvaluator(projected, { check });
|
|
45298
46201
|
for (const pin of guardedPins)
|
|
45299
|
-
if (!
|
|
46202
|
+
if (!resizeClose(projectedPins(id3(pin.name)).value, pin.value))
|
|
45300
46203
|
fail(
|
|
45301
46204
|
"EDIT_PROTECTED_CELL",
|
|
45302
46205
|
"Guarded local pin does not scale proportionally with the requested dimension."
|
|
45303
46206
|
);
|
|
45304
|
-
const
|
|
45305
|
-
|
|
45306
|
-
writes.
|
|
45307
|
-
|
|
45308
|
-
|
|
46207
|
+
const members3 = group2 && planGroupResize(group2, roots, edit, source, check);
|
|
46208
|
+
for (const write2 of members3?.writes ?? []) {
|
|
46209
|
+
writes.push(write2);
|
|
46210
|
+
install(write2);
|
|
46211
|
+
}
|
|
46212
|
+
const affected = resizeClosure(projected, writes.map(writeId), check);
|
|
45309
46213
|
for (const name3 of ["Angle", "FlipX", "FlipY"])
|
|
45310
46214
|
if (affected.has(id3(name3)))
|
|
45311
46215
|
fail(
|
|
@@ -45331,17 +46235,23 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
|
|
|
45331
46235
|
["LocPinX", geometry.locPinX],
|
|
45332
46236
|
["LocPinY", geometry.locPinY]
|
|
45333
46237
|
])
|
|
45334
|
-
if (!
|
|
46238
|
+
if (!resizeClose(projected.has(id3(name3)) ? evaluate(id3(name3)).value : read(name3), expected))
|
|
45335
46239
|
fail(
|
|
45336
46240
|
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
45337
46241
|
"Dependent formulas would violate the requested anchor or dimensions."
|
|
45338
46242
|
);
|
|
46243
|
+
for (const [cellId, expected] of members3?.expected ?? [])
|
|
46244
|
+
if (!resizeClose(projected.has(cellId) ? evaluate(cellId).value : 0, expected))
|
|
46245
|
+
fail(
|
|
46246
|
+
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
46247
|
+
"Dependent formulas would violate a resized group member pose."
|
|
46248
|
+
);
|
|
45339
46249
|
check();
|
|
45340
|
-
for (const write2 of writes) setCell(shape, write2.name, write2.value, write2.formula);
|
|
46250
|
+
for (const write2 of writes) setCell(write2.shape ?? shape, write2.name, write2.value, write2.formula);
|
|
45341
46251
|
const dirty = /* @__PURE__ */ new Set([edit.pageId]);
|
|
45342
46252
|
for (const [cellId, value3] of values) {
|
|
45343
46253
|
const item2 = graph.get(cellId);
|
|
45344
|
-
if (!item2?.node || !item2.formula || writes.some((write2) =>
|
|
46254
|
+
if (!item2?.node || !item2.formula || writes.some((write2) => writeId(write2) === cellId)) continue;
|
|
45345
46255
|
if (attribute2(item2.node, "V") !== String(value3)) {
|
|
45346
46256
|
item2.node.setAttribute("V", String(value3));
|
|
45347
46257
|
dirty.add(item2.pageId);
|
|
@@ -46169,6 +47079,23 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
|
|
|
46169
47079
|
cell
|
|
46170
47080
|
}))
|
|
46171
47081
|
);
|
|
47082
|
+
const groupResizeShapes = /* @__PURE__ */ new Set();
|
|
47083
|
+
const groupResizePages = /* @__PURE__ */ new Set();
|
|
47084
|
+
for (const command2 of commands) {
|
|
47085
|
+
if (command2.type !== "resize-shape" || !command2.anchor) continue;
|
|
47086
|
+
const group2 = children2(children2(roots.get(command2.pageId), "Shapes")[0], "Shape").find(
|
|
47087
|
+
(shape) => attribute2(shape, "ID") === command2.shapeId && attribute2(shape, "Type") === "Group" && !shape.hasAttribute("Master")
|
|
47088
|
+
);
|
|
47089
|
+
if (!group2) continue;
|
|
47090
|
+
groupResizePages.add(command2.pageId);
|
|
47091
|
+
groupResizeShapes.add(group2);
|
|
47092
|
+
for (const member of Array.from(group2.getElementsByTagNameNS(group2.namespaceURI, "Shape"))) {
|
|
47093
|
+
check();
|
|
47094
|
+
groupResizeShapes.add(member);
|
|
47095
|
+
for (const cell of ["PinX", "PinY", "Width", "Height", "LocPinX", "LocPinY"])
|
|
47096
|
+
changed.push({ pageId: command2.pageId, shapeId: attribute2(member, "ID"), cell });
|
|
47097
|
+
}
|
|
47098
|
+
}
|
|
46172
47099
|
const deleting = commands.filter((command2) => command2.type === "delete-shape");
|
|
46173
47100
|
let query;
|
|
46174
47101
|
const hasMasterInstances = [...roots.values()].some(
|
|
@@ -46181,7 +47108,7 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
|
|
|
46181
47108
|
const key2 = JSON.stringify([pageId2, shapeId2, cell.toLowerCase()]);
|
|
46182
47109
|
let result2 = dependencyCache.get(key2);
|
|
46183
47110
|
if (result2 === void 0) {
|
|
46184
|
-
query ??= createVisioDependencyQuery(roots, { check });
|
|
47111
|
+
query ??= createVisioDependencyQuery(roots, { check, groupResizeShapes });
|
|
46185
47112
|
result2 = query({ pageId: pageId2, shapeId: shapeId2, cell }, changed);
|
|
46186
47113
|
dependencyCache.set(key2, result2);
|
|
46187
47114
|
}
|
|
@@ -46237,6 +47164,11 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
|
|
|
46237
47164
|
const item2 = pending2.pop(), node3 = item2.node;
|
|
46238
47165
|
const pageId2 = admitted2(node3) && node3.localName === "Page" && root2.localName === "Pages" ? attribute2(node3, "ID") : item2.pageId;
|
|
46239
47166
|
const style2 = item2.style || admitted2(node3) && node3.localName === "StyleSheets";
|
|
47167
|
+
if (pageId2 && groupResizePages.has(pageId2) && node3.localName === "Cell" && attribute2(node3, "N")?.toLowerCase() === "resizemode" && node3.parentNode?.nodeName.endsWith("PageSheet") && (node3.hasAttribute("E") || visioFormulaCachedValue("0", attribute2(node3, "U")).unit !== "scalar" || executableCellFormula(attribute2(node3, "F")) || attribute2(node3, "F") === "Inh" || !["0", "2"].includes(attribute2(node3, "V") ?? "")))
|
|
47168
|
+
fail(
|
|
47169
|
+
"UNSUPPORTED_GEOMETRY_EDIT",
|
|
47170
|
+
"Nondefault page-level ResizeMode is not supported for group resizing."
|
|
47171
|
+
);
|
|
46240
47172
|
if (admitted2(node3) && !style2) {
|
|
46241
47173
|
inspectFormula(node3, path3, pageId2);
|
|
46242
47174
|
if (deleting.some(
|
|
@@ -50902,6 +51834,11 @@ async function editVsdxTransaction(input, edits, options2, clock = {
|
|
|
50902
51834
|
dirty.set(pages.get(pageId2), roots.get(pageId2));
|
|
50903
51835
|
duplicateChanged = true;
|
|
50904
51836
|
} else if (command2.type !== "insert-picture" && !isVisioChartObjectEdit(command2) && command2.type !== "set-page-theme" && command2.type !== "create-subprocess" && !isVisioCommentEdit(command2) && !isVisioDataEdit(command2) && command2.type !== "assign-layers" && command2.type !== "set-layer-properties" && !isVisioMasterDrop(command2)) {
|
|
51837
|
+
if (command2.type === "resize-shape" && command2.anchor) {
|
|
51838
|
+
const target2 = topShape(root2, command2.shapeId);
|
|
51839
|
+
if (attribute2(target2, "Type") === "Group" && !target2?.hasAttribute("Master"))
|
|
51840
|
+
await assertGeometryPackageScope(pkg, new Set(pages.values()), [command2], check, roots);
|
|
51841
|
+
}
|
|
50905
51842
|
const changedPages = instanceCommands.has(command2) && isInstanceGeometryEdit(roots, command2) ? await applyInstanceGeometryEdit(roots, command2, masterTemplate(pkg), check) : applyGeometryEdit(roots, document, command2, check, masterMovePins);
|
|
50906
51843
|
for (const pageId2 of changedPages) dirty.set(pages.get(pageId2), roots.get(pageId2));
|
|
50907
51844
|
if (changedPages.length && ["move-shape", "resize-shape", "rotate-shape", "flip-shape"].includes(command2.type))
|