ooxml-core 1.29.0 → 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PptxHandler-CZG6ISCZ.cjs → PptxHandler-3OLZT5YW.cjs} +3 -3
- package/dist/{PptxHandler-QIHYALOV.mjs → PptxHandler-FJHKJEZU.mjs} +2 -2
- package/dist/PptxHandler-LOFY2PRO.mjs +4 -0
- package/dist/{PresentationBuilder-UAINQZA2.mjs → PresentationBuilder-23M6WQK3.mjs} +2 -2
- package/dist/{PresentationBuilder-66EU3N3O.cjs → PresentationBuilder-LVIVJZIL.cjs} +5 -5
- package/dist/{PresentationBuilder-5YM2L7DA.mjs → PresentationBuilder-W5VRPFLM.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-BBK3UB7M.mjs → chunk-5YZFO55V.mjs} +4 -4
- package/dist/{chunk-T7HBA3CW.cjs → chunk-7T3SJQA6.cjs} +11 -9
- package/dist/{chunk-XROY25LN.cjs → chunk-7XYVFUB3.cjs} +4 -0
- package/dist/{chunk-GUNTIFGT.cjs → chunk-CZXM4ZJH.cjs} +158 -26
- package/dist/{chunk-RYOJHYA3.mjs → chunk-DJ3CDTMX.mjs} +157 -27
- package/dist/{chunk-KBER3RAP.mjs → chunk-HDHUJM5M.mjs} +229 -227
- package/dist/{chunk-XCRDAVFN.mjs → chunk-HK7DVTEF.mjs} +237 -95
- package/dist/{chunk-6C4NLBLB.mjs → chunk-JZ64GVIB.mjs} +1 -1
- 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-I2CGNAP2.cjs → chunk-SCK5U362.cjs} +1390 -1388
- package/dist/{chunk-DWEQWFQU.mjs → chunk-SCTM27HK.mjs} +229 -227
- package/dist/{chunk-PDZ4GQLI.mjs → chunk-UVYWAI4M.mjs} +1 -1
- package/dist/{chunk-DXOBT2JE.mjs → chunk-UZWV2HAJ.mjs} +8 -2
- 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 +615 -360
- 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 +611 -356
- 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 +677 -418
- 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/ui/index.cjs
CHANGED
|
@@ -1266,8 +1266,8 @@ function parseXml(xml, options2 = {}) {
|
|
|
1266
1266
|
let parsed;
|
|
1267
1267
|
try {
|
|
1268
1268
|
parsed = new xmldom.DOMParser({
|
|
1269
|
-
onError: (
|
|
1270
|
-
if (
|
|
1269
|
+
onError: (level3, message) => {
|
|
1270
|
+
if (level3 !== "warning") parseError = message;
|
|
1271
1271
|
}
|
|
1272
1272
|
}).parseFromString(xml, "application/xml");
|
|
1273
1273
|
} catch (error) {
|
|
@@ -1385,15 +1385,15 @@ function* liteChildElements(xml, namespaces) {
|
|
|
1385
1385
|
function* topLevelNodes(xml, namespaces) {
|
|
1386
1386
|
const source = hasLineEnds(xml) ? xml.replace(/\r[\n\u0085]/g, "\n").replace(/[\r\u0085\u2028\u2029]/g, "\n") : xml;
|
|
1387
1387
|
const root2 = new LiteElement("", "", null);
|
|
1388
|
-
const
|
|
1388
|
+
const level3 = root2.childNodes;
|
|
1389
1389
|
const stack = [root2];
|
|
1390
1390
|
let top = root2;
|
|
1391
1391
|
const n = source.length;
|
|
1392
1392
|
let pos = 0;
|
|
1393
1393
|
while (pos < n) {
|
|
1394
|
-
if (
|
|
1395
|
-
yield*
|
|
1396
|
-
|
|
1394
|
+
if (level3.length && stack.length === 1) {
|
|
1395
|
+
yield* level3;
|
|
1396
|
+
level3.length = 0;
|
|
1397
1397
|
}
|
|
1398
1398
|
const lt = source.indexOf("<", pos);
|
|
1399
1399
|
const end = lt < 0 ? n : lt;
|
|
@@ -1429,7 +1429,7 @@ function* topLevelNodes(xml, namespaces) {
|
|
|
1429
1429
|
pos = parsed.end;
|
|
1430
1430
|
}
|
|
1431
1431
|
if (stack.length !== 1) return false;
|
|
1432
|
-
yield*
|
|
1432
|
+
yield* level3;
|
|
1433
1433
|
return true;
|
|
1434
1434
|
}
|
|
1435
1435
|
var DECLARATIONS = /<!DOCTYPE|<!ENTITY/i;
|
|
@@ -1493,14 +1493,14 @@ function startTag(source, from, namespaces) {
|
|
|
1493
1493
|
while (q < n && isSpace(source.charCodeAt(q))) q++;
|
|
1494
1494
|
const quote = source[q];
|
|
1495
1495
|
if (quote !== '"' && quote !== "'") return void 0;
|
|
1496
|
-
const
|
|
1497
|
-
if (
|
|
1498
|
-
const raw2 = source.slice(q + 1,
|
|
1496
|
+
const close3 = source.indexOf(quote, q + 1);
|
|
1497
|
+
if (close3 < 0) return void 0;
|
|
1498
|
+
const raw2 = source.slice(q + 1, close3);
|
|
1499
1499
|
if (raw2.includes("<") || element2.hasAttribute(name3)) return void 0;
|
|
1500
1500
|
const value3 = decode(/[\t\n\r]/.test(raw2) ? raw2.replace(/[\t\n\r]/g, " ") : raw2);
|
|
1501
1501
|
if (value3 === void 0) return void 0;
|
|
1502
1502
|
element2.attrs.push(name3, value3);
|
|
1503
|
-
i =
|
|
1503
|
+
i = close3 + 1;
|
|
1504
1504
|
const after = source.charCodeAt(i);
|
|
1505
1505
|
if (i < n && !isSpace(after) && after !== 62 && after !== 47) return void 0;
|
|
1506
1506
|
}
|
|
@@ -4894,7 +4894,11 @@ function indexCells(roots2, options2) {
|
|
|
4894
4894
|
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(
|
|
4895
4895
|
(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")
|
|
4896
4896
|
) || children2(node3, "Shapes").length > 0 || ["1", "true"].includes(attribute2(node3, "Del") ?? "");
|
|
4897
|
-
sheets.push({
|
|
4897
|
+
sheets.push({
|
|
4898
|
+
node: node3,
|
|
4899
|
+
shapeId: shapeId2,
|
|
4900
|
+
unsafe: options2.groupResizeShapes?.has(node3) ? false : unsafe2
|
|
4901
|
+
});
|
|
4898
4902
|
visit(node3, unsafe2, true);
|
|
4899
4903
|
}
|
|
4900
4904
|
};
|
|
@@ -5188,12 +5192,12 @@ function admitted(root2, shapeId2, masterMovePins = /* @__PURE__ */ new Set(), m
|
|
|
5188
5192
|
const containers = children2(root2, "Shapes");
|
|
5189
5193
|
if (containers.length !== 1)
|
|
5190
5194
|
fail("UNSUPPORTED_GEOMETRY_EDIT", "One local Shapes container is required.");
|
|
5191
|
-
const
|
|
5195
|
+
const candidates2 = children2(containers[0], "Shape").filter(
|
|
5192
5196
|
(node3) => attribute2(node3, "ID") === shapeId2
|
|
5193
5197
|
);
|
|
5194
|
-
if (
|
|
5198
|
+
if (candidates2.length !== 1)
|
|
5195
5199
|
fail("EDIT_TARGET_NOT_FOUND", "A unique top-level local shape is required.");
|
|
5196
|
-
const shape =
|
|
5200
|
+
const shape = candidates2[0];
|
|
5197
5201
|
if ((shape.hasAttribute("Master") || shape.hasAttribute("MasterShape")) && !["PinX", "PinY"].every((name3) => {
|
|
5198
5202
|
const cell = cells(shape).get(name3);
|
|
5199
5203
|
return cell && masterMovePins.has(cell);
|
|
@@ -5315,7 +5319,7 @@ function protectedShape(shape, document, masterMovePins = /* @__PURE__ */ new Se
|
|
|
5315
5319
|
}
|
|
5316
5320
|
return local.has("LockRotate") ? numeric(local.get("LockRotate"), 0) !== 0 : inheritedRotationLocked;
|
|
5317
5321
|
}
|
|
5318
|
-
function resizeGeometry(shape, roots2, edit, check, lineEditShapes = /* @__PURE__ */ new Set(), glueShapes = /* @__PURE__ */ new Set()) {
|
|
5322
|
+
function resizeGeometry(shape, roots2, edit, check, lineEditShapes = /* @__PURE__ */ new Set(), glueShapes = /* @__PURE__ */ new Set(), groupResizeShapes = /* @__PURE__ */ new Set()) {
|
|
5319
5323
|
const sections2 = children2(shape, "Section").filter((node3) => attribute2(node3, "N") === "Geometry");
|
|
5320
5324
|
let depends;
|
|
5321
5325
|
if (!sections2.length)
|
|
@@ -5357,7 +5361,12 @@ function resizeGeometry(shape, roots2, edit, check, lineEditShapes = /* @__PURE_
|
|
|
5357
5361
|
const analysis = analyzeVisioFormula(formula2);
|
|
5358
5362
|
if (!analysis.references.length && numeric(node3) === 0) continue;
|
|
5359
5363
|
const cell = `Geometry${Number(attribute2(section3, "IX") ?? "0") + 1}.${attribute2(node3, "N")}${attribute2(row2, "IX")}`;
|
|
5360
|
-
depends ??= createVisioDependencyQuery(roots2, {
|
|
5364
|
+
depends ??= createVisioDependencyQuery(roots2, {
|
|
5365
|
+
check,
|
|
5366
|
+
lineEditShapes,
|
|
5367
|
+
glueShapes,
|
|
5368
|
+
groupResizeShapes
|
|
5369
|
+
});
|
|
5361
5370
|
if (!depends(
|
|
5362
5371
|
{ pageId: edit.pageId, shapeId: edit.shapeId, cell },
|
|
5363
5372
|
["Width", "Height"].map((cell2) => ({
|
|
@@ -5996,8 +6005,8 @@ function valid(key2, value3) {
|
|
|
5996
6005
|
fail("INVALID_EDIT", `Invalid page layout value for ${key2}.`);
|
|
5997
6006
|
return number5;
|
|
5998
6007
|
}
|
|
5999
|
-
const
|
|
6000
|
-
const ok = key2 === "lineJumpDirectionX" || key2 === "lineJumpDirectionY" ?
|
|
6008
|
+
const integer6 = Number.isSafeInteger(number5);
|
|
6009
|
+
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;
|
|
6001
6010
|
if (!ok) fail("INVALID_EDIT", `Invalid page layout value for ${key2}.`);
|
|
6002
6011
|
return number5;
|
|
6003
6012
|
}
|
|
@@ -9977,7 +9986,7 @@ function pathCommands(value3, limits, budget) {
|
|
|
9977
9986
|
const whitespace = () => {
|
|
9978
9987
|
while (position < data.length && WSP.test(data[position])) position++;
|
|
9979
9988
|
};
|
|
9980
|
-
function
|
|
9989
|
+
function operand2(separator, flag) {
|
|
9981
9990
|
whitespace();
|
|
9982
9991
|
if (separator && data[position] === ",") {
|
|
9983
9992
|
position++;
|
|
@@ -10007,7 +10016,7 @@ function pathCommands(value3, limits, budget) {
|
|
|
10007
10016
|
if (budget.commands >= limits.maxPathCommands) limit("Path command limit exceeded.");
|
|
10008
10017
|
const values = [];
|
|
10009
10018
|
for (let i = 0; i < arity; i++)
|
|
10010
|
-
values.push(
|
|
10019
|
+
values.push(operand2(i > 0 || !explicit, command2 === "A" && (i === 3 || i === 4)));
|
|
10011
10020
|
const px = (i) => values[i] + (relative ? x : 0);
|
|
10012
10021
|
const py = (i) => values[i] + (relative ? y : 0);
|
|
10013
10022
|
let output;
|
|
@@ -11461,6 +11470,141 @@ function resolveDrawingColor(color2, theme2, options2) {
|
|
|
11461
11470
|
};
|
|
11462
11471
|
}
|
|
11463
11472
|
|
|
11473
|
+
// drawingml/picture-crop.ts
|
|
11474
|
+
var SIDES = { l: "cropLeft", t: "cropTop", r: "cropRight", b: "cropBottom" };
|
|
11475
|
+
function parsePictureCrop(blipFill) {
|
|
11476
|
+
const rect = first(blipFill, "srcRect", NS.a);
|
|
11477
|
+
if (!rect) return void 0;
|
|
11478
|
+
const result2 = {};
|
|
11479
|
+
for (const [attr2, key2] of Object.entries(SIDES)) {
|
|
11480
|
+
const raw2 = rect.getAttribute(attr2);
|
|
11481
|
+
if (raw2 === null || !raw2.trim()) continue;
|
|
11482
|
+
const percent = raw2.endsWith("%");
|
|
11483
|
+
const value3 = Number(percent ? raw2.slice(0, -1) : raw2) / (percent ? 100 : 1e5);
|
|
11484
|
+
if (Number.isFinite(value3)) result2[key2] = value3;
|
|
11485
|
+
}
|
|
11486
|
+
return result2;
|
|
11487
|
+
}
|
|
11488
|
+
function applyPictureCrop(blipFill, crop) {
|
|
11489
|
+
let rect = first(blipFill, "srcRect", NS.a);
|
|
11490
|
+
if (!rect && crop && Object.values(crop).some((value3) => value3 !== void 0)) {
|
|
11491
|
+
rect = blipFill.ownerDocument.createElementNS(NS.a, "a:srcRect");
|
|
11492
|
+
const blip = first(blipFill, "blip", NS.a);
|
|
11493
|
+
blipFill.insertBefore(rect, blip?.nextSibling ?? blipFill.firstChild);
|
|
11494
|
+
}
|
|
11495
|
+
if (!rect) return;
|
|
11496
|
+
for (const [attr2, key2] of Object.entries(SIDES)) {
|
|
11497
|
+
const value3 = crop?.[key2];
|
|
11498
|
+
if (value3 === void 0) rect.removeAttribute(attr2);
|
|
11499
|
+
else {
|
|
11500
|
+
if (!Number.isFinite(value3)) throw new RangeError("Picture crop must be finite");
|
|
11501
|
+
rect.setAttribute(attr2, String(Math.round(value3 * 1e5)));
|
|
11502
|
+
}
|
|
11503
|
+
}
|
|
11504
|
+
}
|
|
11505
|
+
|
|
11506
|
+
// drawingml/picture-effects.ts
|
|
11507
|
+
function picturePercentage(value3) {
|
|
11508
|
+
const text7 = String(value3 ?? "").trim();
|
|
11509
|
+
if (!text7) return void 0;
|
|
11510
|
+
const percent = text7.endsWith("%");
|
|
11511
|
+
const n = Number(percent ? text7.slice(0, -1) : text7) / (percent ? 100 : 1e5);
|
|
11512
|
+
return Number.isFinite(n) ? n : void 0;
|
|
11513
|
+
}
|
|
11514
|
+
function readPictureEffect(name3, attribute4) {
|
|
11515
|
+
if (name3 === "grayscl") return { kind: "grayscale" };
|
|
11516
|
+
if (name3 === "lum") {
|
|
11517
|
+
const brightness = picturePercentage(attribute4("bright"));
|
|
11518
|
+
const contrast = picturePercentage(attribute4("contrast"));
|
|
11519
|
+
for (const [name4, value3] of [
|
|
11520
|
+
["bright", brightness],
|
|
11521
|
+
["contrast", contrast]
|
|
11522
|
+
]) {
|
|
11523
|
+
const raw2 = attribute4(name4);
|
|
11524
|
+
if (raw2 !== void 0 && raw2 !== null && (value3 === void 0 || Math.abs(value3) > 1))
|
|
11525
|
+
return void 0;
|
|
11526
|
+
}
|
|
11527
|
+
return {
|
|
11528
|
+
kind: "luminance",
|
|
11529
|
+
...brightness !== void 0 ? { brightness } : {},
|
|
11530
|
+
...contrast !== void 0 ? { contrast } : {}
|
|
11531
|
+
};
|
|
11532
|
+
}
|
|
11533
|
+
if (name3 === "alphaModFix") {
|
|
11534
|
+
const raw2 = attribute4("amt");
|
|
11535
|
+
const amount = raw2 === void 0 || raw2 === null ? 1 : picturePercentage(raw2);
|
|
11536
|
+
if (amount !== void 0 && amount >= 0) return { kind: "alphaModFix", amount };
|
|
11537
|
+
}
|
|
11538
|
+
return void 0;
|
|
11539
|
+
}
|
|
11540
|
+
function parsePictureEffects(blip) {
|
|
11541
|
+
if (!blip) return [];
|
|
11542
|
+
return elements(blip).map((node3) => ({
|
|
11543
|
+
...(node3.namespaceURI === NS.a ? readPictureEffect(node3.localName, (name3) => node3.getAttribute(name3)) : void 0) ?? { kind: "unsupported", name: node3.localName },
|
|
11544
|
+
sourceXml: buildXml(node3)
|
|
11545
|
+
}));
|
|
11546
|
+
}
|
|
11547
|
+
function applyPictureEffects(blip, effects) {
|
|
11548
|
+
if (JSON.stringify(parsePictureEffects(blip)) === JSON.stringify(effects)) return;
|
|
11549
|
+
const nodes = effects.map((effect) => {
|
|
11550
|
+
const name3 = effect.kind === "grayscale" ? "grayscl" : effect.kind === "luminance" ? "lum" : effect.kind === "unsupported" ? effect.name : effect.kind;
|
|
11551
|
+
const source = effect.sourceXml ? parseXml(effect.sourceXml).documentElement : void 0;
|
|
11552
|
+
if (effect.kind === "unsupported" && !source)
|
|
11553
|
+
throw new Error("An unsupported picture effect needs source XML");
|
|
11554
|
+
const node3 = source ? blip.ownerDocument.importNode(source, true) : blip.ownerDocument.createElementNS(NS.a, `a:${name3}`);
|
|
11555
|
+
if (effect.kind !== "unsupported" && (node3.namespaceURI !== NS.a || node3.localName !== name3))
|
|
11556
|
+
throw new Error("Picture effect source does not match its kind");
|
|
11557
|
+
const set = (name4, value3) => {
|
|
11558
|
+
const original = picturePercentage(node3.getAttribute(name4));
|
|
11559
|
+
if (value3 === void 0) node3.removeAttribute(name4);
|
|
11560
|
+
else if (value3 !== original) {
|
|
11561
|
+
if (!Number.isFinite(value3)) throw new RangeError("Picture effect must be finite");
|
|
11562
|
+
node3.setAttribute(name4, String(Math.round(value3 * 1e5)));
|
|
11563
|
+
}
|
|
11564
|
+
};
|
|
11565
|
+
if (effect.kind === "luminance") {
|
|
11566
|
+
if ([effect.brightness, effect.contrast].some(
|
|
11567
|
+
(value3) => value3 !== void 0 && (!Number.isFinite(value3) || Math.abs(value3) > 1)
|
|
11568
|
+
))
|
|
11569
|
+
throw new RangeError("Picture luminance must be between -1 and 1");
|
|
11570
|
+
set("bright", effect.brightness);
|
|
11571
|
+
set("contrast", effect.contrast);
|
|
11572
|
+
}
|
|
11573
|
+
if (effect.kind === "alphaModFix") {
|
|
11574
|
+
if (effect.amount < 0) throw new RangeError("Picture alpha must be nonnegative");
|
|
11575
|
+
set("amt", effect.amount);
|
|
11576
|
+
}
|
|
11577
|
+
return node3;
|
|
11578
|
+
});
|
|
11579
|
+
for (const node3 of elements(blip)) blip.removeChild(node3);
|
|
11580
|
+
for (const node3 of nodes) blip.appendChild(node3);
|
|
11581
|
+
}
|
|
11582
|
+
|
|
11583
|
+
// drawingml/picture-fill.ts
|
|
11584
|
+
function parseDrawingPictureFill(fill) {
|
|
11585
|
+
const blip = first(fill, "blip", NS.a);
|
|
11586
|
+
const relId = blip?.getAttributeNS(NS.r, "embed") || blip?.getAttribute("r:embed") || void 0;
|
|
11587
|
+
const linkRelId = blip?.getAttributeNS(NS.r, "link") || void 0;
|
|
11588
|
+
const crop = parsePictureCrop(fill);
|
|
11589
|
+
const effects = parsePictureEffects(blip);
|
|
11590
|
+
const tile = first(fill, "tile", NS.a);
|
|
11591
|
+
const rect = first(first(fill, "stretch", NS.a), "fillRect", NS.a);
|
|
11592
|
+
const unsupported4 = [
|
|
11593
|
+
...tile ? ["tile"] : [],
|
|
11594
|
+
...rect && ["l", "t", "r", "b"].some((key2) => Number(rect.getAttribute(key2) ?? 0) !== 0) ? ["fillRect"] : [],
|
|
11595
|
+
...fill.getAttribute("rotWithShape") === "0" || fill.getAttribute("rotWithShape") === "false" ? ["rotWithShape"] : []
|
|
11596
|
+
];
|
|
11597
|
+
return {
|
|
11598
|
+
kind: "picture",
|
|
11599
|
+
sourceXml: buildXml(fill),
|
|
11600
|
+
...relId ? { relId } : {},
|
|
11601
|
+
...linkRelId ? { linkRelId } : {},
|
|
11602
|
+
...crop ? { crop } : {},
|
|
11603
|
+
...effects.length ? { effects } : {},
|
|
11604
|
+
...unsupported4.length ? { unsupportedPicture: unsupported4 } : {}
|
|
11605
|
+
};
|
|
11606
|
+
}
|
|
11607
|
+
|
|
11464
11608
|
// drawingml/drawing-fill.ts
|
|
11465
11609
|
var FILL_ELEMENTS = /* @__PURE__ */ new Set([
|
|
11466
11610
|
"noFill",
|
|
@@ -11470,13 +11614,13 @@ var FILL_ELEMENTS = /* @__PURE__ */ new Set([
|
|
|
11470
11614
|
"blipFill",
|
|
11471
11615
|
"grpFill"
|
|
11472
11616
|
]);
|
|
11473
|
-
function fillElementOf(
|
|
11474
|
-
return
|
|
11617
|
+
function fillElementOf(properties) {
|
|
11618
|
+
return properties ? elements(properties).find(
|
|
11475
11619
|
(element2) => FILL_ELEMENTS.has(element2.localName) && (!element2.namespaceURI || element2.namespaceURI === NS.a)
|
|
11476
11620
|
) : void 0;
|
|
11477
11621
|
}
|
|
11478
|
-
function parseDrawingFill(
|
|
11479
|
-
const fill = fillElementOf(
|
|
11622
|
+
function parseDrawingFill(properties) {
|
|
11623
|
+
const fill = fillElementOf(properties);
|
|
11480
11624
|
if (!fill) return void 0;
|
|
11481
11625
|
switch (fill.localName) {
|
|
11482
11626
|
case "noFill":
|
|
@@ -11531,17 +11675,8 @@ function parseDrawingFill(properties2) {
|
|
|
11531
11675
|
...background2 ? { background: background2 } : {}
|
|
11532
11676
|
};
|
|
11533
11677
|
}
|
|
11534
|
-
case "blipFill":
|
|
11535
|
-
|
|
11536
|
-
const relId = blip?.getAttributeNS(NS.r, "embed") || blip?.getAttribute("r:embed") || void 0;
|
|
11537
|
-
const linkRelId = blip?.getAttributeNS(NS.r, "link") || void 0;
|
|
11538
|
-
return {
|
|
11539
|
-
kind: "picture",
|
|
11540
|
-
sourceXml: buildXml(fill),
|
|
11541
|
-
...relId ? { relId } : {},
|
|
11542
|
-
...linkRelId ? { linkRelId } : {}
|
|
11543
|
-
};
|
|
11544
|
-
}
|
|
11678
|
+
case "blipFill":
|
|
11679
|
+
return parseDrawingPictureFill(fill);
|
|
11545
11680
|
default:
|
|
11546
11681
|
return { kind: "unsupported", element: fill.localName };
|
|
11547
11682
|
}
|
|
@@ -11728,6 +11863,10 @@ function drawingPatternPictureXml(fill) {
|
|
|
11728
11863
|
else if (blip.getAttributeNS(NS.r, attribute4) !== value3)
|
|
11729
11864
|
blip.setAttributeNS(NS.r, `r:${attribute4}`, value3);
|
|
11730
11865
|
}
|
|
11866
|
+
if (fill.crop !== void 0 && JSON.stringify(before?.kind === "picture" ? before.crop : void 0) !== JSON.stringify(fill.crop))
|
|
11867
|
+
applyPictureCrop(root2, fill.crop);
|
|
11868
|
+
if (fill.effects !== void 0 && JSON.stringify(before?.kind === "picture" ? before.effects ?? [] : []) !== JSON.stringify(fill.effects ?? []))
|
|
11869
|
+
applyPictureEffects(blip, fill.effects ?? []);
|
|
11731
11870
|
if (!fill.sourceXml) {
|
|
11732
11871
|
const stretch = doc.createElementNS(NS.a, "a:stretch");
|
|
11733
11872
|
stretch.appendChild(doc.createElementNS(NS.a, "a:fillRect"));
|
|
@@ -11738,26 +11877,26 @@ function drawingPatternPictureXml(fill) {
|
|
|
11738
11877
|
}
|
|
11739
11878
|
|
|
11740
11879
|
// drawingml/write-fill.ts
|
|
11741
|
-
function setDrawingFillXml(
|
|
11742
|
-
const doc =
|
|
11880
|
+
function setDrawingFillXml(properties, xml) {
|
|
11881
|
+
const doc = properties.ownerDocument;
|
|
11743
11882
|
const wrapper = parseXml(`<w xmlns:a="${NS.a}">${xml}</w>`);
|
|
11744
11883
|
const fill = elements(wrapper.documentElement)[0];
|
|
11745
11884
|
const names = ["solidFill", "gradFill", "pattFill", "blipFill", "grpFill", "noFill"];
|
|
11746
11885
|
if (elements(wrapper.documentElement).length !== 1 || !fill || fill.namespaceURI !== NS.a || !names.includes(fill.localName))
|
|
11747
11886
|
throw new Error("Invalid DrawingML fill XML");
|
|
11748
|
-
const existing = elements(
|
|
11887
|
+
const existing = elements(properties).filter(
|
|
11749
11888
|
(node3) => node3.namespaceURI === NS.a && names.includes(node3.localName)
|
|
11750
11889
|
);
|
|
11751
11890
|
const next = doc.importNode(fill, true);
|
|
11752
|
-
if (existing[0])
|
|
11891
|
+
if (existing[0]) properties.replaceChild(next, existing[0]);
|
|
11753
11892
|
else
|
|
11754
|
-
|
|
11893
|
+
properties.insertBefore(
|
|
11755
11894
|
next,
|
|
11756
|
-
elements(
|
|
11895
|
+
elements(properties).find(
|
|
11757
11896
|
(node3) => node3.namespaceURI === NS.a && ["ln", "effectLst", "effectDag", "scene3d", "sp3d", "extLst"].includes(node3.localName)
|
|
11758
11897
|
) ?? null
|
|
11759
11898
|
);
|
|
11760
|
-
for (const extra of existing.slice(1))
|
|
11899
|
+
for (const extra of existing.slice(1)) properties.removeChild(extra);
|
|
11761
11900
|
}
|
|
11762
11901
|
function drawingFillXml(fill) {
|
|
11763
11902
|
if (fill.kind === "none") return "<a:noFill/>";
|
|
@@ -14649,18 +14788,18 @@ function pivotColumnEntries(pivot) {
|
|
|
14649
14788
|
const root2 = { children: /* @__PURE__ */ new Map() };
|
|
14650
14789
|
for (const record2 of pivot.records) {
|
|
14651
14790
|
let current = root2;
|
|
14652
|
-
indices.forEach((field3,
|
|
14791
|
+
indices.forEach((field3, level3) => {
|
|
14653
14792
|
const value3 = record2[field3] ?? null;
|
|
14654
14793
|
const key2 = pivotValueKey(value3);
|
|
14655
14794
|
let child3 = current.children.get(key2);
|
|
14656
14795
|
if (!child3) {
|
|
14657
|
-
child3 = { index: order[
|
|
14796
|
+
child3 = { index: order[level3].get(key2), value: value3, children: /* @__PURE__ */ new Map() };
|
|
14658
14797
|
current.children.set(key2, child3);
|
|
14659
14798
|
}
|
|
14660
14799
|
current = child3;
|
|
14661
14800
|
});
|
|
14662
14801
|
}
|
|
14663
|
-
const visit = (node3,
|
|
14802
|
+
const visit = (node3, level3, path3, values, keys) => {
|
|
14664
14803
|
for (const child3 of [...node3.children.entries()].sort((a2, b) => a2[1].index - b[1].index)) {
|
|
14665
14804
|
const here = {
|
|
14666
14805
|
path: [...path3, child3[1].index],
|
|
@@ -14672,10 +14811,10 @@ function pivotColumnEntries(pivot) {
|
|
|
14672
14811
|
key: columnKey(here.keys, here.keys.length),
|
|
14673
14812
|
values: here.values
|
|
14674
14813
|
};
|
|
14675
|
-
if (
|
|
14814
|
+
if (level3 === names.length - 1) entries.push({ kind: "leaf", ...entry3 });
|
|
14676
14815
|
else {
|
|
14677
|
-
visit(child3[1],
|
|
14678
|
-
const own = functions[
|
|
14816
|
+
visit(child3[1], level3 + 1, here.path, here.values, here.keys);
|
|
14817
|
+
const own = functions[level3];
|
|
14679
14818
|
if (own === "auto") entries.push({ kind: "subtotal", ...entry3 });
|
|
14680
14819
|
else for (const fn of own) entries.push({ kind: "subtotal", ...entry3, fn });
|
|
14681
14820
|
}
|
|
@@ -14721,9 +14860,9 @@ function pivotColumnHeaders(pivot, columns, rowLabels, valuesOnRows = false) {
|
|
|
14721
14860
|
columns.entries.forEach((entry3, j) => {
|
|
14722
14861
|
const at2 = labelColumns + j * count;
|
|
14723
14862
|
if (entry3.kind === "leaf") {
|
|
14724
|
-
entry3.path.forEach((_index,
|
|
14725
|
-
const continued = entry3.path.slice(0,
|
|
14726
|
-
if (!continued) grid[1 +
|
|
14863
|
+
entry3.path.forEach((_index, level3) => {
|
|
14864
|
+
const continued = entry3.path.slice(0, level3 + 1).every((p, i) => p === previous[i]);
|
|
14865
|
+
if (!continued) grid[1 + level3][at2] = labelOf(columns.names[level3], entry3.values[level3]);
|
|
14727
14866
|
});
|
|
14728
14867
|
previous = entry3.path;
|
|
14729
14868
|
if (count > 1) measures2.forEach((measure2, m) => grid[rows - 1][at2 + m] = measure2.caption);
|
|
@@ -14754,7 +14893,7 @@ function nestedPivotGrid(pivot) {
|
|
|
14754
14893
|
const valuesAt = pivotValuesIndex(pivot);
|
|
14755
14894
|
const onRows = valuesAt >= 0;
|
|
14756
14895
|
const levels = depth + (onRows ? 1 : 0);
|
|
14757
|
-
const fieldOf = (
|
|
14896
|
+
const fieldOf = (level3) => !onRows || level3 < valuesAt ? level3 : level3 === valuesAt ? -1 : level3 - 1;
|
|
14758
14897
|
const axisItems = names.map((name3) => pivotItems(pivot, name3));
|
|
14759
14898
|
const itemIndices = axisItems.map(
|
|
14760
14899
|
(items) => new Map(items.map((item2, index2) => [pivotValueKey(item2), index2]))
|
|
@@ -14814,13 +14953,13 @@ function nestedPivotGrid(pivot) {
|
|
|
14814
14953
|
(one) => fn ? aggregateValues(records2, pivot.fields.indexOf(one.field), fn) : pivotMeasureNumber(pivot, records2, one)
|
|
14815
14954
|
);
|
|
14816
14955
|
});
|
|
14817
|
-
const labelCells = (path3, shown,
|
|
14956
|
+
const labelCells = (path3, shown, level3, text7) => {
|
|
14818
14957
|
if (compact) return [text7];
|
|
14819
14958
|
const row2 = Array(levels).fill(null);
|
|
14820
14959
|
path3.labels.forEach((value3, at2) => {
|
|
14821
14960
|
if (shown[at2]) row2[at2] = value3;
|
|
14822
14961
|
});
|
|
14823
|
-
row2[
|
|
14962
|
+
row2[level3] = text7;
|
|
14824
14963
|
return row2;
|
|
14825
14964
|
};
|
|
14826
14965
|
const push = (indent, build2) => {
|
|
@@ -14839,11 +14978,11 @@ function nestedPivotGrid(pivot) {
|
|
|
14839
14978
|
...measure2 !== void 0 ? { measure: measure2 } : {},
|
|
14840
14979
|
...type ? { type } : {}
|
|
14841
14980
|
});
|
|
14842
|
-
const walk = (
|
|
14843
|
-
const field3 = fieldOf(
|
|
14844
|
-
const last =
|
|
14981
|
+
const walk = (level3, group2, measure2, path3) => {
|
|
14982
|
+
const field3 = fieldOf(level3);
|
|
14983
|
+
const last = level3 === levels - 1;
|
|
14845
14984
|
const repeated = Array.from(
|
|
14846
|
-
{ length:
|
|
14985
|
+
{ length: level3 },
|
|
14847
14986
|
(_v, k) => !!pivot.repeatLabels && fieldOf(k) >= 0
|
|
14848
14987
|
);
|
|
14849
14988
|
const leafShown = (firsts) => repeated.map((repeat, k) => repeat || tabular && firsts.slice(k + 1).every(Boolean));
|
|
@@ -14855,23 +14994,23 @@ function nestedPivotGrid(pivot) {
|
|
|
14855
14994
|
firsts: [...path3.firsts, m === 0]
|
|
14856
14995
|
};
|
|
14857
14996
|
if (last)
|
|
14858
|
-
return push(
|
|
14859
|
-
labelCells(path3, leafShown(here.firsts),
|
|
14997
|
+
return push(level3, () => [
|
|
14998
|
+
labelCells(path3, leafShown(here.firsts), level3, one.caption),
|
|
14860
14999
|
cells4(group2, void 0, m),
|
|
14861
15000
|
entryOf(here.indices, m)
|
|
14862
15001
|
]);
|
|
14863
15002
|
if (!tabular)
|
|
14864
|
-
push(
|
|
14865
|
-
labelCells(path3, repeated,
|
|
15003
|
+
push(level3, () => [
|
|
15004
|
+
labelCells(path3, repeated, level3, one.caption),
|
|
14866
15005
|
blanks(),
|
|
14867
15006
|
entryOf(here.indices, m)
|
|
14868
15007
|
]);
|
|
14869
|
-
walk(
|
|
15008
|
+
walk(level3 + 1, group2, m, here);
|
|
14870
15009
|
});
|
|
14871
15010
|
return;
|
|
14872
15011
|
}
|
|
14873
15012
|
const own = functions[field3];
|
|
14874
|
-
const valuesAbove = !onRows || valuesAt <
|
|
15013
|
+
const valuesAbove = !onRows || valuesAt < level3;
|
|
14875
15014
|
const showsValue = above && own === "auto" && valuesAbove;
|
|
14876
15015
|
const children3 = [...group2.children.values()].sort((a2, b) => a2.index - b.index);
|
|
14877
15016
|
children3.forEach((child3, position) => {
|
|
@@ -14882,22 +15021,22 @@ function nestedPivotGrid(pivot) {
|
|
|
14882
15021
|
};
|
|
14883
15022
|
const text7 = labelOf(names[field3], child3.value);
|
|
14884
15023
|
if (last)
|
|
14885
|
-
return push(
|
|
14886
|
-
labelCells(path3, leafShown(here.firsts),
|
|
15024
|
+
return push(level3, () => [
|
|
15025
|
+
labelCells(path3, leafShown(here.firsts), level3, text7),
|
|
14887
15026
|
cells4(child3, void 0, measure2),
|
|
14888
15027
|
entryOf(here.indices, measure2)
|
|
14889
15028
|
]);
|
|
14890
15029
|
if (!tabular)
|
|
14891
|
-
push(
|
|
14892
|
-
labelCells(path3, repeated,
|
|
15030
|
+
push(level3, () => [
|
|
15031
|
+
labelCells(path3, repeated, level3, text7),
|
|
14893
15032
|
showsValue ? cells4(child3, void 0, measure2) : blanks(),
|
|
14894
15033
|
entryOf(here.indices, measure2)
|
|
14895
15034
|
]);
|
|
14896
|
-
walk(
|
|
15035
|
+
walk(level3 + 1, child3, measure2, here);
|
|
14897
15036
|
if (field3 === depth - 1) return;
|
|
14898
15037
|
const caption = String(text7);
|
|
14899
|
-
const subtotal = (title, fn, one) => push(
|
|
14900
|
-
labelCells(path3, repeated,
|
|
15038
|
+
const subtotal = (title, fn, one) => push(level3, () => [
|
|
15039
|
+
labelCells(path3, repeated, level3, title),
|
|
14901
15040
|
cells4(child3, fn, one),
|
|
14902
15041
|
entryOf(here.indices, one, fn ?? "default")
|
|
14903
15042
|
]);
|
|
@@ -16002,8 +16141,8 @@ function parseSlicer(node3, sheet, partName) {
|
|
|
16002
16141
|
if (start !== void 0) slicer.startItem = start;
|
|
16003
16142
|
const locked = boolAttr(node3, "lockedPosition");
|
|
16004
16143
|
if (locked !== void 0) slicer.lockedPosition = locked;
|
|
16005
|
-
const
|
|
16006
|
-
if (
|
|
16144
|
+
const level3 = numAttr(node3, "level");
|
|
16145
|
+
if (level3 !== void 0) slicer.level = level3;
|
|
16007
16146
|
if (extLst) slicer.extLstXml = selfContainedXml(extLst);
|
|
16008
16147
|
return slicer;
|
|
16009
16148
|
}
|
|
@@ -17330,10 +17469,10 @@ function blankComments(xml) {
|
|
|
17330
17469
|
const at2 = match.index;
|
|
17331
17470
|
const section3 = SECTIONS.find(([open2]) => xml.startsWith(open2, at2));
|
|
17332
17471
|
if (!section3) return void 0;
|
|
17333
|
-
const [open,
|
|
17334
|
-
const end = xml.indexOf(
|
|
17472
|
+
const [open, close3] = section3;
|
|
17473
|
+
const end = xml.indexOf(close3, at2 + open.length);
|
|
17335
17474
|
if (end < 0) return void 0;
|
|
17336
|
-
const after = end +
|
|
17475
|
+
const after = end + close3.length;
|
|
17337
17476
|
if (open !== "<?") {
|
|
17338
17477
|
pieces.push(xml.slice(copied, at2), " ".repeat(after - at2));
|
|
17339
17478
|
copied = after;
|
|
@@ -17351,9 +17490,9 @@ function rootChildren(xml) {
|
|
|
17351
17490
|
const namespaces = rootNamespaces(plain4);
|
|
17352
17491
|
const root2 = ROOT.exec(plain4.slice(0, 8192));
|
|
17353
17492
|
if (!namespaces || !root2 || (root2[2] ?? "").trimEnd().endsWith("/")) return void 0;
|
|
17354
|
-
const
|
|
17355
|
-
if (
|
|
17356
|
-
const content2 = xml.slice(root2[0].length,
|
|
17493
|
+
const close3 = plain4.lastIndexOf(`</${root2[1] ?? ""}`);
|
|
17494
|
+
if (close3 < root2[0].length || !/^<\/[^\s>]+\s*>\s*$/.test(plain4.slice(close3))) return void 0;
|
|
17495
|
+
const content2 = xml.slice(root2[0].length, close3);
|
|
17357
17496
|
return { [Symbol.iterator]: () => liteChildElements(content2, namespaces) };
|
|
17358
17497
|
}
|
|
17359
17498
|
function findSheetData(plain4) {
|
|
@@ -17374,11 +17513,11 @@ function splitSheetData(xml) {
|
|
|
17374
17513
|
const start = plain4 === void 0 ? void 0 : findSheetData(plain4);
|
|
17375
17514
|
if (plain4 === void 0 || !start) return void 0;
|
|
17376
17515
|
const { namespaces, tagName: tagName2, contentStart } = start;
|
|
17377
|
-
const
|
|
17378
|
-
if (
|
|
17379
|
-
const data = xml.slice(contentStart,
|
|
17516
|
+
const close3 = plain4.indexOf(`</${tagName2}`, contentStart);
|
|
17517
|
+
if (close3 < 0 || OPEN.test(plain4.slice(contentStart - 1))) return void 0;
|
|
17518
|
+
const data = xml.slice(contentStart, close3);
|
|
17380
17519
|
return {
|
|
17381
|
-
xml: xml.slice(0, contentStart) + xml.slice(
|
|
17520
|
+
xml: xml.slice(0, contentStart) + xml.slice(close3),
|
|
17382
17521
|
rows: { [Symbol.iterator]: () => liteChildElements(data, namespaces) }
|
|
17383
17522
|
};
|
|
17384
17523
|
}
|
|
@@ -17709,14 +17848,14 @@ function fromStoredSyntax(formula2) {
|
|
|
17709
17848
|
if (name3 !== "ANCHORARRAY" && name3 !== "SINGLE") continue;
|
|
17710
17849
|
const open = nextIndex(list2, i + 1);
|
|
17711
17850
|
const arg = nextIndex(list2, open + 1);
|
|
17712
|
-
const
|
|
17851
|
+
const close3 = nextIndex(list2, arg + 1);
|
|
17713
17852
|
const target2 = list2[arg];
|
|
17714
|
-
if (list2[open]?.kind !== "open" || list2[
|
|
17853
|
+
if (list2[open]?.kind !== "open" || list2[close3]?.kind !== "close" || !target2) continue;
|
|
17715
17854
|
const single2 = target2.kind === "ref" || target2.kind === "name" || target2.kind === "structured";
|
|
17716
17855
|
if (name3 === "ANCHORARRAY" && !(target2.kind === "ref" && target2.ref?.kind === "cell")) continue;
|
|
17717
17856
|
if (name3 === "SINGLE" && !single2) continue;
|
|
17718
17857
|
const text7 = name3 === "ANCHORARRAY" ? `${target2.text}#` : `@${target2.text}`;
|
|
17719
|
-
for (let k = i; k <=
|
|
17858
|
+
for (let k = i; k <= close3; k++) list2[k].text = "";
|
|
17720
17859
|
token.text = text7;
|
|
17721
17860
|
changed = true;
|
|
17722
17861
|
}
|
|
@@ -17862,6 +18001,142 @@ function parseDocProps(core, app, custom) {
|
|
|
17862
18001
|
};
|
|
17863
18002
|
}
|
|
17864
18003
|
|
|
18004
|
+
// geometry/guide-formula-eval.ts
|
|
18005
|
+
var ANGLE_SCALE = 6e4;
|
|
18006
|
+
function angleToRadians(ooxmlAngle) {
|
|
18007
|
+
return ooxmlAngle / ANGLE_SCALE * (Math.PI / 180);
|
|
18008
|
+
}
|
|
18009
|
+
function parseFormula(fmla) {
|
|
18010
|
+
const parts = fmla.trim().split(/\s+/);
|
|
18011
|
+
const op = parts[0] ?? "";
|
|
18012
|
+
const args = parts.slice(1);
|
|
18013
|
+
return { op, args };
|
|
18014
|
+
}
|
|
18015
|
+
function resolveOperand(token, variables) {
|
|
18016
|
+
const num = Number(token);
|
|
18017
|
+
if (Number.isFinite(num)) {
|
|
18018
|
+
return num;
|
|
18019
|
+
}
|
|
18020
|
+
const value3 = variables.get(token);
|
|
18021
|
+
if (value3 !== void 0) {
|
|
18022
|
+
return value3;
|
|
18023
|
+
}
|
|
18024
|
+
return 0;
|
|
18025
|
+
}
|
|
18026
|
+
function evaluateFormula(parsed, vars) {
|
|
18027
|
+
const r = (idx) => resolveOperand(parsed.args[idx] ?? "0", vars);
|
|
18028
|
+
switch (parsed.op) {
|
|
18029
|
+
// val x — literal value
|
|
18030
|
+
case "val":
|
|
18031
|
+
return r(0);
|
|
18032
|
+
// abs x — absolute value
|
|
18033
|
+
case "abs":
|
|
18034
|
+
return Math.abs(r(0));
|
|
18035
|
+
// sqrt x — square root
|
|
18036
|
+
case "sqrt":
|
|
18037
|
+
return Math.sqrt(Math.max(r(0), 0));
|
|
18038
|
+
// +- x y z — x + y - z
|
|
18039
|
+
case "+-":
|
|
18040
|
+
return r(0) + r(1) - r(2);
|
|
18041
|
+
// */ x y z — (x * y) / z
|
|
18042
|
+
case "*/": {
|
|
18043
|
+
const z = r(2);
|
|
18044
|
+
if (z === 0) {
|
|
18045
|
+
return 0;
|
|
18046
|
+
}
|
|
18047
|
+
return r(0) * r(1) / z;
|
|
18048
|
+
}
|
|
18049
|
+
// +/ x y z — (x + y) / z
|
|
18050
|
+
case "+/": {
|
|
18051
|
+
const z = r(2);
|
|
18052
|
+
if (z === 0) {
|
|
18053
|
+
return 0;
|
|
18054
|
+
}
|
|
18055
|
+
return (r(0) + r(1)) / z;
|
|
18056
|
+
}
|
|
18057
|
+
// ?: x y z — if x > 0 then y else z
|
|
18058
|
+
case "?:":
|
|
18059
|
+
case "if":
|
|
18060
|
+
return r(0) > 0 ? r(1) : r(2);
|
|
18061
|
+
// min x y — minimum
|
|
18062
|
+
case "min":
|
|
18063
|
+
return Math.min(r(0), r(1));
|
|
18064
|
+
// max x y — maximum
|
|
18065
|
+
case "max":
|
|
18066
|
+
return Math.max(r(0), r(1));
|
|
18067
|
+
// mod x y z — sqrt(x² + y² + z²)
|
|
18068
|
+
case "mod": {
|
|
18069
|
+
const a2 = r(0);
|
|
18070
|
+
const b = r(1);
|
|
18071
|
+
const c2 = r(2);
|
|
18072
|
+
return Math.sqrt(a2 * a2 + b * b + c2 * c2);
|
|
18073
|
+
}
|
|
18074
|
+
// pin x y z — clamp y between x and z
|
|
18075
|
+
case "pin": {
|
|
18076
|
+
const lo = r(0);
|
|
18077
|
+
const val = r(1);
|
|
18078
|
+
const hi = r(2);
|
|
18079
|
+
return Math.max(lo, Math.min(val, hi));
|
|
18080
|
+
}
|
|
18081
|
+
// sin x y — x * sin(y) where y is in OOXML angle units
|
|
18082
|
+
case "sin": {
|
|
18083
|
+
const sinVal = Math.sin(angleToRadians(r(1)));
|
|
18084
|
+
if (!Number.isFinite(sinVal)) {
|
|
18085
|
+
return 0;
|
|
18086
|
+
}
|
|
18087
|
+
return r(0) * sinVal;
|
|
18088
|
+
}
|
|
18089
|
+
// cos x y — x * cos(y) where y is in OOXML angle units
|
|
18090
|
+
case "cos": {
|
|
18091
|
+
const cosVal = Math.cos(angleToRadians(r(1)));
|
|
18092
|
+
if (!Number.isFinite(cosVal)) {
|
|
18093
|
+
return 0;
|
|
18094
|
+
}
|
|
18095
|
+
return r(0) * cosVal;
|
|
18096
|
+
}
|
|
18097
|
+
// tan x y — x * tan(y) where y is in OOXML angle units
|
|
18098
|
+
case "tan": {
|
|
18099
|
+
const angle = angleToRadians(r(1));
|
|
18100
|
+
const tanVal = Math.tan(angle);
|
|
18101
|
+
if (!Number.isFinite(tanVal)) {
|
|
18102
|
+
return 0;
|
|
18103
|
+
}
|
|
18104
|
+
return r(0) * tanVal;
|
|
18105
|
+
}
|
|
18106
|
+
// atan x — atan(x) result in OOXML angle units
|
|
18107
|
+
// x is a ratio scaled by the shape coordinate space
|
|
18108
|
+
case "atan": {
|
|
18109
|
+
const radians = Math.atan(r(0));
|
|
18110
|
+
return radians * 180 * ANGLE_SCALE / Math.PI;
|
|
18111
|
+
}
|
|
18112
|
+
// at2 x y -> arctan(y / x), i.e. Math.atan2(y, x), result in OOXML angle
|
|
18113
|
+
// units. ECMA-376 / ISO-IEC-29500-1 section 20.1.9.6 defines the operand
|
|
18114
|
+
// order as (x, y) with the ARGUMENTS REVERSED relative to Math.atan2, so
|
|
18115
|
+
// the first operand is the horizontal component and the second is the
|
|
18116
|
+
// vertical one. This matches the companion `cat2`/`sat2` operators below,
|
|
18117
|
+
// which take (x, y, z) and compute atan2(z, y).
|
|
18118
|
+
case "at2":
|
|
18119
|
+
case "atan2": {
|
|
18120
|
+
const radians = Math.atan2(r(1), r(0));
|
|
18121
|
+
return radians * 180 * ANGLE_SCALE / Math.PI;
|
|
18122
|
+
}
|
|
18123
|
+
// cat2 x y z — x * cos(atan2(z, y))
|
|
18124
|
+
// Computes the cosine-component of a vector scaled by x
|
|
18125
|
+
case "cat2": {
|
|
18126
|
+
const angle = Math.atan2(r(2), r(1));
|
|
18127
|
+
return r(0) * Math.cos(angle);
|
|
18128
|
+
}
|
|
18129
|
+
// sat2 x y z — x * sin(atan2(z, y))
|
|
18130
|
+
// Computes the sine-component of a vector scaled by x
|
|
18131
|
+
case "sat2": {
|
|
18132
|
+
const angle = Math.atan2(r(2), r(1));
|
|
18133
|
+
return r(0) * Math.sin(angle);
|
|
18134
|
+
}
|
|
18135
|
+
default:
|
|
18136
|
+
return Number(parsed.op) || 0;
|
|
18137
|
+
}
|
|
18138
|
+
}
|
|
18139
|
+
|
|
17865
18140
|
// geometry/indexed.ts
|
|
17866
18141
|
function at(items, index2) {
|
|
17867
18142
|
const value3 = items[index2];
|
|
@@ -17871,6 +18146,251 @@ function at(items, index2) {
|
|
|
17871
18146
|
return value3;
|
|
17872
18147
|
}
|
|
17873
18148
|
|
|
18149
|
+
// geometry/guide-formula-api.ts
|
|
18150
|
+
function createBuiltinVariables(ctx) {
|
|
18151
|
+
const { w, h } = ctx;
|
|
18152
|
+
const vars = /* @__PURE__ */ new Map();
|
|
18153
|
+
vars.set("w", w);
|
|
18154
|
+
vars.set("h", h);
|
|
18155
|
+
vars.set("l", 0);
|
|
18156
|
+
vars.set("t", 0);
|
|
18157
|
+
vars.set("r", w);
|
|
18158
|
+
vars.set("b", h);
|
|
18159
|
+
vars.set("hc", w / 2);
|
|
18160
|
+
vars.set("vc", h / 2);
|
|
18161
|
+
const widthDivisors = [2, 3, 4, 5, 6, 8, 10, 12, 16, 32];
|
|
18162
|
+
for (const d of widthDivisors) {
|
|
18163
|
+
vars.set(`wd${d}`, w / d);
|
|
18164
|
+
}
|
|
18165
|
+
const heightDivisors = [2, 3, 4, 5, 6, 8, 10, 12, 16, 32];
|
|
18166
|
+
for (const d of heightDivisors) {
|
|
18167
|
+
vars.set(`hd${d}`, h / d);
|
|
18168
|
+
}
|
|
18169
|
+
const ss = Math.min(w, h);
|
|
18170
|
+
const ls = Math.max(w, h);
|
|
18171
|
+
vars.set("ss", ss);
|
|
18172
|
+
vars.set("ls", ls);
|
|
18173
|
+
const ssDivisors = [2, 4, 6, 8, 16, 32];
|
|
18174
|
+
for (const d of ssDivisors) {
|
|
18175
|
+
vars.set(`ssd${d}`, ss / d);
|
|
18176
|
+
}
|
|
18177
|
+
vars.set("cd2", 180 * ANGLE_SCALE);
|
|
18178
|
+
vars.set("cd4", 90 * ANGLE_SCALE);
|
|
18179
|
+
vars.set("cd8", 45 * ANGLE_SCALE);
|
|
18180
|
+
vars.set("3cd4", 270 * ANGLE_SCALE);
|
|
18181
|
+
vars.set("3cd8", 135 * ANGLE_SCALE);
|
|
18182
|
+
vars.set("5cd8", 225 * ANGLE_SCALE);
|
|
18183
|
+
vars.set("7cd8", 315 * ANGLE_SCALE);
|
|
18184
|
+
return vars;
|
|
18185
|
+
}
|
|
18186
|
+
|
|
18187
|
+
// drawingml/scene3d-presets.ts
|
|
18188
|
+
var CAMERA_PRESETS = /* @__PURE__ */ new Set([
|
|
18189
|
+
"legacyObliqueTopLeft",
|
|
18190
|
+
"legacyObliqueTop",
|
|
18191
|
+
"legacyObliqueTopRight",
|
|
18192
|
+
"legacyObliqueLeft",
|
|
18193
|
+
"legacyObliqueFront",
|
|
18194
|
+
"legacyObliqueRight",
|
|
18195
|
+
"legacyObliqueBottomLeft",
|
|
18196
|
+
"legacyObliqueBottom",
|
|
18197
|
+
"legacyObliqueBottomRight",
|
|
18198
|
+
"legacyPerspectiveTopLeft",
|
|
18199
|
+
"legacyPerspectiveTop",
|
|
18200
|
+
"legacyPerspectiveTopRight",
|
|
18201
|
+
"legacyPerspectiveLeft",
|
|
18202
|
+
"legacyPerspectiveFront",
|
|
18203
|
+
"legacyPerspectiveRight",
|
|
18204
|
+
"legacyPerspectiveBottomLeft",
|
|
18205
|
+
"legacyPerspectiveBottom",
|
|
18206
|
+
"legacyPerspectiveBottomRight",
|
|
18207
|
+
"orthographicFront",
|
|
18208
|
+
"isometricTopUp",
|
|
18209
|
+
"isometricTopDown",
|
|
18210
|
+
"isometricBottomUp",
|
|
18211
|
+
"isometricBottomDown",
|
|
18212
|
+
"isometricLeftUp",
|
|
18213
|
+
"isometricLeftDown",
|
|
18214
|
+
"isometricRightUp",
|
|
18215
|
+
"isometricRightDown",
|
|
18216
|
+
"isometricOffAxis1Left",
|
|
18217
|
+
"isometricOffAxis1Right",
|
|
18218
|
+
"isometricOffAxis1Top",
|
|
18219
|
+
"isometricOffAxis2Left",
|
|
18220
|
+
"isometricOffAxis2Right",
|
|
18221
|
+
"isometricOffAxis2Top",
|
|
18222
|
+
"isometricOffAxis3Left",
|
|
18223
|
+
"isometricOffAxis3Right",
|
|
18224
|
+
"isometricOffAxis3Bottom",
|
|
18225
|
+
"isometricOffAxis4Left",
|
|
18226
|
+
"isometricOffAxis4Right",
|
|
18227
|
+
"isometricOffAxis4Bottom",
|
|
18228
|
+
"obliqueTopLeft",
|
|
18229
|
+
"obliqueTop",
|
|
18230
|
+
"obliqueTopRight",
|
|
18231
|
+
"obliqueLeft",
|
|
18232
|
+
"obliqueRight",
|
|
18233
|
+
"obliqueBottomLeft",
|
|
18234
|
+
"obliqueBottom",
|
|
18235
|
+
"obliqueBottomRight",
|
|
18236
|
+
"perspectiveFront",
|
|
18237
|
+
"perspectiveLeft",
|
|
18238
|
+
"perspectiveRight",
|
|
18239
|
+
"perspectiveAbove",
|
|
18240
|
+
"perspectiveBelow",
|
|
18241
|
+
"perspectiveAboveLeftFacing",
|
|
18242
|
+
"perspectiveAboveRightFacing",
|
|
18243
|
+
"perspectiveContrastingLeftFacing",
|
|
18244
|
+
"perspectiveContrastingRightFacing",
|
|
18245
|
+
"perspectiveHeroicLeftFacing",
|
|
18246
|
+
"perspectiveHeroicRightFacing",
|
|
18247
|
+
"perspectiveHeroicExtremeLeftFacing",
|
|
18248
|
+
"perspectiveHeroicExtremeRightFacing",
|
|
18249
|
+
"perspectiveRelaxed",
|
|
18250
|
+
"perspectiveRelaxedModerately"
|
|
18251
|
+
]);
|
|
18252
|
+
var LIGHT_RIGS = /* @__PURE__ */ new Set([
|
|
18253
|
+
"legacyFlat1",
|
|
18254
|
+
"legacyFlat2",
|
|
18255
|
+
"legacyFlat3",
|
|
18256
|
+
"legacyFlat4",
|
|
18257
|
+
"legacyNormal1",
|
|
18258
|
+
"legacyNormal2",
|
|
18259
|
+
"legacyNormal3",
|
|
18260
|
+
"legacyNormal4",
|
|
18261
|
+
"legacyHarsh1",
|
|
18262
|
+
"legacyHarsh2",
|
|
18263
|
+
"legacyHarsh3",
|
|
18264
|
+
"legacyHarsh4",
|
|
18265
|
+
"threePt",
|
|
18266
|
+
"balanced",
|
|
18267
|
+
"soft",
|
|
18268
|
+
"harsh",
|
|
18269
|
+
"flood",
|
|
18270
|
+
"contrasting",
|
|
18271
|
+
"morning",
|
|
18272
|
+
"sunrise",
|
|
18273
|
+
"sunset",
|
|
18274
|
+
"chilly",
|
|
18275
|
+
"freezing",
|
|
18276
|
+
"flat",
|
|
18277
|
+
"twoPt",
|
|
18278
|
+
"glow",
|
|
18279
|
+
"brightRoom"
|
|
18280
|
+
]);
|
|
18281
|
+
var LIGHT_DIRECTIONS = /* @__PURE__ */ new Set(["tl", "t", "tr", "l", "r", "bl", "b", "br"]);
|
|
18282
|
+
|
|
18283
|
+
// drawingml/read-3d-values.ts
|
|
18284
|
+
var integer3 = (value3) => {
|
|
18285
|
+
if (value3 === void 0 || value3 === null || String(value3).trim() === "") return void 0;
|
|
18286
|
+
const n = Number(value3);
|
|
18287
|
+
return Number.isSafeInteger(n) ? n : void 0;
|
|
18288
|
+
};
|
|
18289
|
+
function readScene3DValues(node3, read) {
|
|
18290
|
+
const out = {};
|
|
18291
|
+
const camera = read.child(node3, "camera");
|
|
18292
|
+
const light = read.child(node3, "lightRig");
|
|
18293
|
+
for (const [key2, source, attribute4, choices] of [
|
|
18294
|
+
["cameraPreset", camera, "prst", CAMERA_PRESETS],
|
|
18295
|
+
["lightRigType", light, "rig", LIGHT_RIGS],
|
|
18296
|
+
["lightRigDirection", light, "dir", LIGHT_DIRECTIONS]
|
|
18297
|
+
]) {
|
|
18298
|
+
const token = String(read.attribute(source, attribute4) ?? "").trim();
|
|
18299
|
+
if (choices.has(token)) out[key2] = token;
|
|
18300
|
+
}
|
|
18301
|
+
const fov = integer3(read.attribute(camera, "fov"));
|
|
18302
|
+
if (fov !== void 0 && fov >= 0 && fov <= 108e5) out.cameraFieldOfView = fov;
|
|
18303
|
+
const zoom = picturePercentage(read.attribute(camera, "zoom"));
|
|
18304
|
+
if (zoom !== void 0 && zoom > 0) out.cameraZoom = zoom;
|
|
18305
|
+
for (const [prefix2, source] of [
|
|
18306
|
+
["camera", camera],
|
|
18307
|
+
["lightRig", light]
|
|
18308
|
+
]) {
|
|
18309
|
+
const rot = read.child(source, "rot");
|
|
18310
|
+
for (const [axis, key2] of [
|
|
18311
|
+
["lat", "RotX"],
|
|
18312
|
+
["lon", "RotY"],
|
|
18313
|
+
["rev", "RotZ"]
|
|
18314
|
+
]) {
|
|
18315
|
+
const value3 = integer3(read.attribute(rot, axis));
|
|
18316
|
+
if (value3 !== void 0 && value3 >= 0 && value3 < 216e5) out[`${prefix2}${key2}`] = value3;
|
|
18317
|
+
}
|
|
18318
|
+
}
|
|
18319
|
+
const backdrop = read.child(node3, "backdrop");
|
|
18320
|
+
if (backdrop !== void 0) {
|
|
18321
|
+
out.hasBackdrop = true;
|
|
18322
|
+
for (const [name3, prefix2, attr2] of [
|
|
18323
|
+
["anchor", "backdropAnchor", ""],
|
|
18324
|
+
["norm", "backdropNormal", "d"],
|
|
18325
|
+
["up", "backdropUp", "d"]
|
|
18326
|
+
]) {
|
|
18327
|
+
const point2 = read.child(backdrop, name3);
|
|
18328
|
+
for (const [axis, suffix] of [
|
|
18329
|
+
["x", "X"],
|
|
18330
|
+
["y", "Y"],
|
|
18331
|
+
["z", "Z"]
|
|
18332
|
+
]) {
|
|
18333
|
+
const value3 = integer3(read.attribute(point2, `${attr2}${axis}`));
|
|
18334
|
+
if (value3 !== void 0) out[`${prefix2}${suffix}`] = value3;
|
|
18335
|
+
}
|
|
18336
|
+
}
|
|
18337
|
+
}
|
|
18338
|
+
return out;
|
|
18339
|
+
}
|
|
18340
|
+
function readText3DValues(node3, read) {
|
|
18341
|
+
const out = {};
|
|
18342
|
+
for (const [key2, attribute4] of [
|
|
18343
|
+
["extrusionHeight", "extrusionH"],
|
|
18344
|
+
["contourWidth", "contourW"],
|
|
18345
|
+
["z", "z"]
|
|
18346
|
+
]) {
|
|
18347
|
+
const value3 = integer3(read.attribute(node3, attribute4));
|
|
18348
|
+
if (value3 !== void 0) out[key2] = value3;
|
|
18349
|
+
}
|
|
18350
|
+
const material = String(read.attribute(node3, "prstMaterial") ?? "").trim();
|
|
18351
|
+
if (material) out.presetMaterial = material;
|
|
18352
|
+
for (const [name3, prefix2] of [
|
|
18353
|
+
["bevelT", "bevelTop"],
|
|
18354
|
+
["bevelB", "bevelBottom"]
|
|
18355
|
+
]) {
|
|
18356
|
+
const bevel = read.child(node3, name3);
|
|
18357
|
+
if (!bevel) continue;
|
|
18358
|
+
out[`${prefix2}Type`] = String(read.attribute(bevel, "prst") || "circle").trim();
|
|
18359
|
+
for (const [attribute4, suffix] of [
|
|
18360
|
+
["w", "Width"],
|
|
18361
|
+
["h", "Height"]
|
|
18362
|
+
]) {
|
|
18363
|
+
const value3 = integer3(read.attribute(bevel, attribute4));
|
|
18364
|
+
if (value3 !== void 0) out[`${prefix2}${suffix}`] = value3;
|
|
18365
|
+
}
|
|
18366
|
+
}
|
|
18367
|
+
return out;
|
|
18368
|
+
}
|
|
18369
|
+
|
|
18370
|
+
// drawingml/read-text-3d.ts
|
|
18371
|
+
var DOM_3D_READER = {
|
|
18372
|
+
attribute: (node3, name3) => node3?.getAttribute(name3),
|
|
18373
|
+
child: (node3, name3) => first(node3, name3, NS.a)
|
|
18374
|
+
};
|
|
18375
|
+
function parseDrawingTextScene3D(node3) {
|
|
18376
|
+
return { ...readScene3DValues(node3, DOM_3D_READER), sourceXml: buildXml(node3) };
|
|
18377
|
+
}
|
|
18378
|
+
function parseDrawingTextShape3D(node3) {
|
|
18379
|
+
const extrusionColor = parseDrawingColorIn(first(node3, "extrusionClr", NS.a));
|
|
18380
|
+
const contourColor = parseDrawingColorIn(first(node3, "contourClr", NS.a));
|
|
18381
|
+
return {
|
|
18382
|
+
...readText3DValues(node3, DOM_3D_READER),
|
|
18383
|
+
sourceXml: buildXml(node3),
|
|
18384
|
+
...extrusionColor ? { extrusionColor } : {},
|
|
18385
|
+
...contourColor ? { contourColor } : {}
|
|
18386
|
+
};
|
|
18387
|
+
}
|
|
18388
|
+
function parseDrawingFlatText3D(node3) {
|
|
18389
|
+
const raw2 = node3.getAttribute("z");
|
|
18390
|
+
const z = raw2 === null || !raw2.trim() ? NaN : Number(raw2);
|
|
18391
|
+
return { sourceXml: buildXml(node3), ...Number.isSafeInteger(z) ? { z } : {} };
|
|
18392
|
+
}
|
|
18393
|
+
|
|
17874
18394
|
// drawingml/read-run-properties.ts
|
|
17875
18395
|
function outerXml2(element2) {
|
|
17876
18396
|
return buildXml(element2);
|
|
@@ -18032,8 +18552,8 @@ var BOOLEAN_ATTRIBUTES2 = [
|
|
|
18032
18552
|
["hangingPunctuation", "hangingPunct"]
|
|
18033
18553
|
];
|
|
18034
18554
|
function readAttributes2(element2, out) {
|
|
18035
|
-
const
|
|
18036
|
-
if (
|
|
18555
|
+
const level3 = integerAttribute(element2, "lvl");
|
|
18556
|
+
if (level3 !== void 0) out.level = Math.min(Math.max(level3, 0), 8);
|
|
18037
18557
|
const align = stringAttribute(element2, "algn");
|
|
18038
18558
|
if (align) out.align = align;
|
|
18039
18559
|
for (const [key2, name3] of EMU_ATTRIBUTES) {
|
|
@@ -18192,7 +18712,13 @@ function parseDrawingBodyProperties(element2) {
|
|
|
18192
18712
|
...read("fontScale") !== void 0 && fontScale !== void 0 ? { fontScale } : {},
|
|
18193
18713
|
...read("lnSpcReduction") !== void 0 && reduction !== void 0 ? { lineSpacingReduction: reduction } : {}
|
|
18194
18714
|
};
|
|
18195
|
-
} else
|
|
18715
|
+
} else if (name3 === "scene3d" && children(element2, "scene3d", NS.a).length === 1)
|
|
18716
|
+
out.scene3d = parseDrawingTextScene3D(child3);
|
|
18717
|
+
else if (name3 === "sp3d" && children(element2, "sp3d", NS.a).length === 1 && !first(element2, "flatTx", NS.a))
|
|
18718
|
+
out.shape3d = parseDrawingTextShape3D(child3);
|
|
18719
|
+
else if (name3 === "flatTx" && children(element2, "flatTx", NS.a).length === 1 && !first(element2, "sp3d", NS.a))
|
|
18720
|
+
out.flatText3d = parseDrawingFlatText3D(child3);
|
|
18721
|
+
else extra.push(outerXml2(child3));
|
|
18196
18722
|
}
|
|
18197
18723
|
if (extra.length) out.extraXml = extra;
|
|
18198
18724
|
return out;
|
|
@@ -18202,8 +18728,8 @@ function parseDrawingListStyle(element2) {
|
|
|
18202
18728
|
const style2 = { levels: [] };
|
|
18203
18729
|
const extra = [];
|
|
18204
18730
|
for (const child3 of elements(element2)) {
|
|
18205
|
-
const
|
|
18206
|
-
if (
|
|
18731
|
+
const level3 = isDrawingElement(child3) ? /^lvl([1-9])pPr$/u.exec(child3.localName) : null;
|
|
18732
|
+
if (level3) style2.levels[Number(level3[1]) - 1] = parseDrawingParagraphProperties(child3);
|
|
18207
18733
|
else if (isDrawingElement(child3) && child3.localName === "defPPr")
|
|
18208
18734
|
style2.default = parseDrawingParagraphProperties(child3) ?? {};
|
|
18209
18735
|
else extra.push(outerXml2(child3));
|
|
@@ -18219,15 +18745,15 @@ function readItem(child3) {
|
|
|
18219
18745
|
const name3 = isDrawingElement(child3) ? child3.localName : "";
|
|
18220
18746
|
if (name3 === "pPr" || name3 === "endParaRPr") return void 0;
|
|
18221
18747
|
if (name3 === "r") {
|
|
18222
|
-
const
|
|
18223
|
-
return { kind: "run", text: textOf(child3), ...
|
|
18748
|
+
const properties = parseDrawingRunProperties(first(child3, "rPr", NS.a));
|
|
18749
|
+
return { kind: "run", text: textOf(child3), ...properties ? { properties } : {} };
|
|
18224
18750
|
}
|
|
18225
18751
|
if (name3 === "br") {
|
|
18226
|
-
const
|
|
18227
|
-
return { kind: "break", ...
|
|
18752
|
+
const properties = parseDrawingRunProperties(first(child3, "rPr", NS.a));
|
|
18753
|
+
return { kind: "break", ...properties ? { properties } : {} };
|
|
18228
18754
|
}
|
|
18229
18755
|
if (name3 === "fld") {
|
|
18230
|
-
const
|
|
18756
|
+
const properties = parseDrawingRunProperties(first(child3, "rPr", NS.a));
|
|
18231
18757
|
const paragraphProperties = parseDrawingParagraphProperties(first(child3, "pPr", NS.a));
|
|
18232
18758
|
const type = child3.getAttribute("type");
|
|
18233
18759
|
return {
|
|
@@ -18235,7 +18761,7 @@ function readItem(child3) {
|
|
|
18235
18761
|
id: child3.getAttribute("id") ?? "",
|
|
18236
18762
|
...type ? { type } : {},
|
|
18237
18763
|
text: textOf(child3),
|
|
18238
|
-
...
|
|
18764
|
+
...properties ? { properties } : {},
|
|
18239
18765
|
...paragraphProperties ? { paragraphProperties } : {}
|
|
18240
18766
|
};
|
|
18241
18767
|
}
|
|
@@ -18247,10 +18773,10 @@ function parseDrawingParagraph(element2) {
|
|
|
18247
18773
|
const item2 = readItem(child3);
|
|
18248
18774
|
if (item2) items.push(item2);
|
|
18249
18775
|
}
|
|
18250
|
-
const
|
|
18776
|
+
const properties = parseDrawingParagraphProperties(first(element2, "pPr", NS.a));
|
|
18251
18777
|
const endProperties = parseDrawingRunProperties(first(element2, "endParaRPr", NS.a));
|
|
18252
18778
|
return {
|
|
18253
|
-
...
|
|
18779
|
+
...properties ? { properties } : {},
|
|
18254
18780
|
items,
|
|
18255
18781
|
...endProperties ? { endProperties } : {}
|
|
18256
18782
|
};
|
|
@@ -18656,9 +19182,9 @@ function parsePoint(element2) {
|
|
|
18656
19182
|
text: paragraphs.join("\n"),
|
|
18657
19183
|
...textParagraphs2 ? { textParagraphs: textParagraphs2 } : {}
|
|
18658
19184
|
};
|
|
18659
|
-
const
|
|
18660
|
-
const fill = parseDrawingFill(
|
|
18661
|
-
const line2 = parseDrawingLine(first(
|
|
19185
|
+
const properties = first(element2, "spPr", NS.dgm);
|
|
19186
|
+
const fill = parseDrawingFill(properties);
|
|
19187
|
+
const line2 = parseDrawingLine(first(properties, "ln", NS.a));
|
|
18662
19188
|
if (fill) point2.fill = fill;
|
|
18663
19189
|
if (line2) point2.line = line2;
|
|
18664
19190
|
const optional = [
|
|
@@ -18934,19 +19460,19 @@ function parseSpacing(parent) {
|
|
|
18934
19460
|
}
|
|
18935
19461
|
return void 0;
|
|
18936
19462
|
}
|
|
18937
|
-
function parseProperties(
|
|
19463
|
+
function parseProperties(properties) {
|
|
18938
19464
|
const parsed = {};
|
|
18939
|
-
const size3 = Number.parseInt(
|
|
19465
|
+
const size3 = Number.parseInt(properties?.getAttribute("sz") ?? "", 10);
|
|
18940
19466
|
if (Number.isFinite(size3)) parsed.sizePt = size3 / 100;
|
|
18941
|
-
const bold = booleanAttribute(
|
|
19467
|
+
const bold = booleanAttribute(properties, "b");
|
|
18942
19468
|
if (bold !== void 0) parsed.bold = bold;
|
|
18943
|
-
const italic = booleanAttribute(
|
|
19469
|
+
const italic = booleanAttribute(properties, "i");
|
|
18944
19470
|
if (italic !== void 0) parsed.italic = italic;
|
|
18945
|
-
const underline =
|
|
19471
|
+
const underline = properties?.getAttribute("u");
|
|
18946
19472
|
if (underline) parsed.underline = underline !== "none";
|
|
18947
|
-
const color2 = parseDrawingColorIn(first(
|
|
19473
|
+
const color2 = parseDrawingColorIn(first(properties, "solidFill", NS.a));
|
|
18948
19474
|
if (color2) parsed.color = color2;
|
|
18949
|
-
const typeface2 = first(
|
|
19475
|
+
const typeface2 = first(properties, "latin", NS.a)?.getAttribute("typeface");
|
|
18950
19476
|
if (typeface2) parsed.typeface = typeface2;
|
|
18951
19477
|
return parsed;
|
|
18952
19478
|
}
|
|
@@ -18961,12 +19487,12 @@ function parseParagraph(paragraph2) {
|
|
|
18961
19487
|
for (const child3 of elements(paragraph2))
|
|
18962
19488
|
if (child3.namespaceURI === NS.a && ["r", "fld", "br"].includes(child3.localName))
|
|
18963
19489
|
runs.push(parseRun(child3));
|
|
18964
|
-
const
|
|
18965
|
-
const align =
|
|
18966
|
-
const defaults = parseProperties(first(
|
|
18967
|
-
const lineSpacing = parseSpacing(first(
|
|
18968
|
-
const spaceBefore = parseSpacing(first(
|
|
18969
|
-
const spaceAfter = parseSpacing(first(
|
|
19490
|
+
const properties = first(paragraph2, "pPr", NS.a);
|
|
19491
|
+
const align = properties?.getAttribute("algn");
|
|
19492
|
+
const defaults = parseProperties(first(properties, "defRPr", NS.a));
|
|
19493
|
+
const lineSpacing = parseSpacing(first(properties, "lnSpc", NS.a));
|
|
19494
|
+
const spaceBefore = parseSpacing(first(properties, "spcBef", NS.a));
|
|
19495
|
+
const spaceAfter = parseSpacing(first(properties, "spcAft", NS.a));
|
|
18970
19496
|
return {
|
|
18971
19497
|
...align ? { align } : {},
|
|
18972
19498
|
...Object.keys(defaults).length ? { defaultProperties: defaults } : {},
|
|
@@ -18978,13 +19504,13 @@ function parseParagraph(paragraph2) {
|
|
|
18978
19504
|
}
|
|
18979
19505
|
function parseDrawingTextBody(body) {
|
|
18980
19506
|
if (!body) return void 0;
|
|
18981
|
-
const
|
|
19507
|
+
const properties = first(body, "bodyPr", NS.a);
|
|
18982
19508
|
const paragraphs = children(body, "p", NS.a).map(parseParagraph);
|
|
18983
19509
|
const result2 = {
|
|
18984
19510
|
paragraphs,
|
|
18985
19511
|
text: paragraphs.map((paragraph2) => paragraph2.runs.map((run2) => run2.text).join("")).join("\n")
|
|
18986
19512
|
};
|
|
18987
|
-
const anchor =
|
|
19513
|
+
const anchor = properties?.getAttribute("anchor");
|
|
18988
19514
|
if (anchor) result2.anchor = anchor;
|
|
18989
19515
|
const insets = {};
|
|
18990
19516
|
for (const [key2, attribute4] of [
|
|
@@ -18993,13 +19519,115 @@ function parseDrawingTextBody(body) {
|
|
|
18993
19519
|
["right", "rIns"],
|
|
18994
19520
|
["bottom", "bIns"]
|
|
18995
19521
|
]) {
|
|
18996
|
-
const value3 = Number.parseInt(
|
|
19522
|
+
const value3 = Number.parseInt(properties?.getAttribute(attribute4) ?? "", 10);
|
|
18997
19523
|
if (Number.isFinite(value3)) insets[key2] = value3;
|
|
18998
19524
|
}
|
|
18999
19525
|
if (Object.keys(insets).length > 0) result2.insetsEmu = insets;
|
|
19000
19526
|
return result2;
|
|
19001
19527
|
}
|
|
19002
19528
|
|
|
19529
|
+
// drawingml/custom-geometry.ts
|
|
19530
|
+
var ARITY3 = {
|
|
19531
|
+
val: 1,
|
|
19532
|
+
abs: 1,
|
|
19533
|
+
sqrt: 1,
|
|
19534
|
+
"+-": 3,
|
|
19535
|
+
"*/": 3,
|
|
19536
|
+
"+/": 3,
|
|
19537
|
+
"?:": 3,
|
|
19538
|
+
at2: 2,
|
|
19539
|
+
cat2: 3,
|
|
19540
|
+
cos: 2,
|
|
19541
|
+
max: 2,
|
|
19542
|
+
min: 2,
|
|
19543
|
+
mod: 3,
|
|
19544
|
+
pin: 3,
|
|
19545
|
+
sat2: 3,
|
|
19546
|
+
sin: 2,
|
|
19547
|
+
tan: 2
|
|
19548
|
+
};
|
|
19549
|
+
function operand(value3, vars) {
|
|
19550
|
+
if (value3 === null || !value3.trim()) return NaN;
|
|
19551
|
+
const literal2 = Number(value3);
|
|
19552
|
+
return Number.isFinite(literal2) ? literal2 : vars.get(value3) ?? NaN;
|
|
19553
|
+
}
|
|
19554
|
+
function parseCustomGeometry(custom, width, height) {
|
|
19555
|
+
const pathList = first(custom, "pathLst", NS.a);
|
|
19556
|
+
if (!pathList) return void 0;
|
|
19557
|
+
const pathNodes = children(pathList, "path", NS.a);
|
|
19558
|
+
const contextWidth = width;
|
|
19559
|
+
const contextHeight = height;
|
|
19560
|
+
const vars = createBuiltinVariables({ w: contextWidth, h: contextHeight });
|
|
19561
|
+
for (const list2 of ["avLst", "gdLst"]) {
|
|
19562
|
+
const parent = first(custom, list2, NS.a);
|
|
19563
|
+
if (!parent) continue;
|
|
19564
|
+
for (const guide of children(parent, "gd", NS.a)) {
|
|
19565
|
+
const name3 = guide.getAttribute("name");
|
|
19566
|
+
const formula2 = parseFormula(guide.getAttribute("fmla") ?? "");
|
|
19567
|
+
if (!name3 || ARITY3[formula2.op] !== formula2.args.length || formula2.args.some((arg) => !Number.isFinite(operand(arg, vars))))
|
|
19568
|
+
return void 0;
|
|
19569
|
+
const result2 = evaluateFormula(formula2, vars);
|
|
19570
|
+
if (!Number.isFinite(result2)) return void 0;
|
|
19571
|
+
vars.set(name3, result2);
|
|
19572
|
+
}
|
|
19573
|
+
}
|
|
19574
|
+
const paths = [];
|
|
19575
|
+
for (const path3 of pathNodes) {
|
|
19576
|
+
const commands = [];
|
|
19577
|
+
const value3 = (node3, name3) => operand(node3.getAttribute(name3), vars);
|
|
19578
|
+
for (const node3 of elements(path3)) {
|
|
19579
|
+
if (node3.namespaceURI !== NS.a) return void 0;
|
|
19580
|
+
const points2 = children(node3, "pt", NS.a).map((point2) => ({
|
|
19581
|
+
x: value3(point2, "x"),
|
|
19582
|
+
y: value3(point2, "y")
|
|
19583
|
+
}));
|
|
19584
|
+
if (points2.some((point2) => !Number.isFinite(point2.x) || !Number.isFinite(point2.y)))
|
|
19585
|
+
return void 0;
|
|
19586
|
+
const [p0, p1, p2] = points2;
|
|
19587
|
+
switch (node3.localName) {
|
|
19588
|
+
case "moveTo":
|
|
19589
|
+
case "lnTo":
|
|
19590
|
+
if (points2.length !== 1 || !p0) return void 0;
|
|
19591
|
+
commands.push({ op: node3.localName === "moveTo" ? "M" : "L", ...p0 });
|
|
19592
|
+
break;
|
|
19593
|
+
case "quadBezTo":
|
|
19594
|
+
if (points2.length !== 2 || !p0 || !p1) return void 0;
|
|
19595
|
+
commands.push({ op: "Q", x1: p0.x, y1: p0.y, ...p1 });
|
|
19596
|
+
break;
|
|
19597
|
+
case "cubicBezTo":
|
|
19598
|
+
if (points2.length !== 3 || !p0 || !p1 || !p2) return void 0;
|
|
19599
|
+
commands.push({ op: "C", x1: p0.x, y1: p0.y, x2: p1.x, y2: p1.y, ...p2 });
|
|
19600
|
+
break;
|
|
19601
|
+
case "arcTo": {
|
|
19602
|
+
const wR = value3(node3, "wR");
|
|
19603
|
+
const hR = value3(node3, "hR");
|
|
19604
|
+
const start = value3(node3, "stAng");
|
|
19605
|
+
const swing = value3(node3, "swAng");
|
|
19606
|
+
if (![wR, hR, start, swing].every(Number.isFinite)) return void 0;
|
|
19607
|
+
commands.push({ op: "A", wR, hR, startAngle: start / 6e4, swingAngle: swing / 6e4 });
|
|
19608
|
+
break;
|
|
19609
|
+
}
|
|
19610
|
+
case "close":
|
|
19611
|
+
commands.push({ op: "Z" });
|
|
19612
|
+
break;
|
|
19613
|
+
default:
|
|
19614
|
+
return void 0;
|
|
19615
|
+
}
|
|
19616
|
+
}
|
|
19617
|
+
const pathWidth = path3.hasAttribute("w") ? Number(path3.getAttribute("w")) : contextWidth;
|
|
19618
|
+
const pathHeight = path3.hasAttribute("h") ? Number(path3.getAttribute("h")) : contextHeight;
|
|
19619
|
+
if (![pathWidth, pathHeight].every((n) => Number.isFinite(n) && n > 0)) return void 0;
|
|
19620
|
+
paths.push({
|
|
19621
|
+
commands,
|
|
19622
|
+
width: pathWidth,
|
|
19623
|
+
height: pathHeight,
|
|
19624
|
+
...path3.getAttribute("fill") ? { fill: path3.getAttribute("fill") } : {},
|
|
19625
|
+
...["0", "false"].includes(path3.getAttribute("stroke") ?? "") ? { stroke: false } : {}
|
|
19626
|
+
});
|
|
19627
|
+
}
|
|
19628
|
+
return paths.length ? paths : void 0;
|
|
19629
|
+
}
|
|
19630
|
+
|
|
19003
19631
|
// drawingml/drawing-geometry.ts
|
|
19004
19632
|
var int = (element2, name3) => Number.parseInt(element2?.getAttribute(name3) ?? "", 10);
|
|
19005
19633
|
function parseFrame(container) {
|
|
@@ -19024,74 +19652,13 @@ function parseTransform(xfrm) {
|
|
|
19024
19652
|
...booleanAttribute(xfrm, "flipV") ? { flipVertical: true } : {}
|
|
19025
19653
|
};
|
|
19026
19654
|
}
|
|
19027
|
-
function parsePathCommands(path3) {
|
|
19028
|
-
const commands = [];
|
|
19029
|
-
const point2 = (element2) => {
|
|
19030
|
-
const x = int(element2, "x");
|
|
19031
|
-
const y = int(element2, "y");
|
|
19032
|
-
return Number.isFinite(x) && Number.isFinite(y) ? { x, y } : void 0;
|
|
19033
|
-
};
|
|
19034
|
-
for (const element2 of Array.from(path3.childNodes)) {
|
|
19035
|
-
if (element2.nodeType !== 1) continue;
|
|
19036
|
-
const node3 = element2;
|
|
19037
|
-
const points2 = children(node3, "pt", NS.a).map(point2);
|
|
19038
|
-
if (points2.some((entry3) => entry3 === void 0)) return void 0;
|
|
19039
|
-
const [p0, p1, p2] = points2;
|
|
19040
|
-
switch (node3.localName) {
|
|
19041
|
-
case "moveTo":
|
|
19042
|
-
case "lnTo":
|
|
19043
|
-
if (!p0) return void 0;
|
|
19044
|
-
commands.push({ op: node3.localName === "moveTo" ? "M" : "L", ...p0 });
|
|
19045
|
-
break;
|
|
19046
|
-
case "cubicBezTo":
|
|
19047
|
-
if (!p0 || !p1 || !p2) return void 0;
|
|
19048
|
-
commands.push({ op: "C", x1: p0.x, y1: p0.y, x2: p1.x, y2: p1.y, x: p2.x, y: p2.y });
|
|
19049
|
-
break;
|
|
19050
|
-
case "quadBezTo":
|
|
19051
|
-
if (!p0 || !p1) return void 0;
|
|
19052
|
-
commands.push({ op: "Q", x1: p0.x, y1: p0.y, x: p1.x, y: p1.y });
|
|
19053
|
-
break;
|
|
19054
|
-
case "arcTo": {
|
|
19055
|
-
const wR = int(node3, "wR");
|
|
19056
|
-
const hR = int(node3, "hR");
|
|
19057
|
-
const startAngle = int(node3, "stAng");
|
|
19058
|
-
const swingAngle = int(node3, "swAng");
|
|
19059
|
-
if (![wR, hR, startAngle, swingAngle].every(Number.isFinite)) return void 0;
|
|
19060
|
-
commands.push({
|
|
19061
|
-
op: "A",
|
|
19062
|
-
wR,
|
|
19063
|
-
hR,
|
|
19064
|
-
startAngle: startAngle / 6e4,
|
|
19065
|
-
swingAngle: swingAngle / 6e4
|
|
19066
|
-
});
|
|
19067
|
-
break;
|
|
19068
|
-
}
|
|
19069
|
-
case "close":
|
|
19070
|
-
commands.push({ op: "Z" });
|
|
19071
|
-
break;
|
|
19072
|
-
}
|
|
19073
|
-
}
|
|
19074
|
-
return commands;
|
|
19075
|
-
}
|
|
19076
19655
|
function parseDrawingGeometry(spPr) {
|
|
19077
19656
|
const preset = first(spPr, "prstGeom", NS.a);
|
|
19078
19657
|
const custom = first(spPr, "custGeom", NS.a);
|
|
19079
19658
|
if (custom) {
|
|
19080
|
-
const
|
|
19081
|
-
|
|
19082
|
-
|
|
19083
|
-
if (!commands) return { geometry: "custom", issue: "CUSTOM_GEOMETRY_GUIDES_UNSUPPORTED" };
|
|
19084
|
-
const width = int(path3, "w");
|
|
19085
|
-
const height = int(path3, "h");
|
|
19086
|
-
paths.push({
|
|
19087
|
-
commands,
|
|
19088
|
-
...Number.isFinite(width) ? { width } : {},
|
|
19089
|
-
...Number.isFinite(height) ? { height } : {},
|
|
19090
|
-
...path3.getAttribute("fill") ? { fill: path3.getAttribute("fill") } : {},
|
|
19091
|
-
...path3.getAttribute("stroke") === "0" || path3.getAttribute("stroke") === "false" ? { stroke: false } : {}
|
|
19092
|
-
});
|
|
19093
|
-
}
|
|
19094
|
-
return { geometry: "custom", paths };
|
|
19659
|
+
const frame = parseFrame(first(spPr, "xfrm", NS.a));
|
|
19660
|
+
const paths = parseCustomGeometry(custom, frame?.width ?? 21600, frame?.height ?? 21600);
|
|
19661
|
+
return paths ? { geometry: "custom", paths } : { geometry: "custom", issue: "CUSTOM_GEOMETRY_UNSUPPORTED" };
|
|
19095
19662
|
}
|
|
19096
19663
|
const geometry = preset?.getAttribute("prst") || "rect";
|
|
19097
19664
|
const adjustments = {};
|
|
@@ -19163,7 +19730,8 @@ function parseShape(sp, index2, group2, issues) {
|
|
|
19163
19730
|
if (transform2.flipVertical) shape.flipVertical = true;
|
|
19164
19731
|
if (adjustments) shape.adjustments = adjustments;
|
|
19165
19732
|
if (paths) shape.paths = paths;
|
|
19166
|
-
const
|
|
19733
|
+
const picture = first(sp, "blipFill", NS.dsp);
|
|
19734
|
+
const fill = picture ? parseDrawingPictureFill(picture) : parseDrawingFill(spPr);
|
|
19167
19735
|
if (fill) shape.fill = fill;
|
|
19168
19736
|
const line2 = parseDrawingLine(first(spPr, "ln", NS.a));
|
|
19169
19737
|
if (line2) shape.line = line2;
|
|
@@ -19192,15 +19760,15 @@ function parseDiagramDrawing(source, part) {
|
|
|
19192
19760
|
for (const child3 of Array.from(container.childNodes)) {
|
|
19193
19761
|
if (child3.nodeType !== 1) continue;
|
|
19194
19762
|
const element2 = child3;
|
|
19195
|
-
if (element2.localName === "sp") {
|
|
19763
|
+
if (element2.localName === "sp" || element2.localName === "pic") {
|
|
19196
19764
|
const shape = parseShape(element2, counter++, group2, issues);
|
|
19197
19765
|
if (shape) shapes.push(shape);
|
|
19766
|
+
else if (element2.localName === "pic")
|
|
19767
|
+
issues.push({
|
|
19768
|
+
code: "DIAGRAM_DRAWING_PICTURE_UNREADABLE",
|
|
19769
|
+
message: "A cached picture has no usable frame; its source is retained in the drawing part."
|
|
19770
|
+
});
|
|
19198
19771
|
} else if (element2.localName === "grpSp") visit(element2, groupTransform(element2, group2));
|
|
19199
|
-
else if (element2.localName === "pic")
|
|
19200
|
-
issues.push({
|
|
19201
|
-
code: "DIAGRAM_DRAWING_PICTURE_SKIPPED",
|
|
19202
|
-
message: "A dsp:pic in the cached drawing is not modelled; the part still holds it."
|
|
19203
|
-
});
|
|
19204
19772
|
}
|
|
19205
19773
|
};
|
|
19206
19774
|
if (tree) visit(tree, IDENTITY2);
|
|
@@ -19295,7 +19863,29 @@ async function loadDiagram(hostPart, relationshipIds, host) {
|
|
|
19295
19863
|
);
|
|
19296
19864
|
return parseDiagramDrawing(xml, part);
|
|
19297
19865
|
});
|
|
19298
|
-
if (drawing2)
|
|
19866
|
+
if (drawing2) {
|
|
19867
|
+
try {
|
|
19868
|
+
const entries = await host.readRelationshipEntries(
|
|
19869
|
+
diagramRelationshipsPart(drawingResolution.path)
|
|
19870
|
+
);
|
|
19871
|
+
const pictures = (entries ?? []).filter(
|
|
19872
|
+
(entry3) => entry3.type.endsWith("/image") && entry3.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry3.target)
|
|
19873
|
+
);
|
|
19874
|
+
if (pictures.length)
|
|
19875
|
+
drawing2.pictureParts = Object.fromEntries(
|
|
19876
|
+
pictures.map((entry3) => [
|
|
19877
|
+
entry3.id,
|
|
19878
|
+
host.resolvePath(drawingResolution.path, entry3.target)
|
|
19879
|
+
])
|
|
19880
|
+
);
|
|
19881
|
+
} catch {
|
|
19882
|
+
issues.push({
|
|
19883
|
+
code: "DIAGRAM_PICTURE_RELATIONSHIPS_UNREADABLE",
|
|
19884
|
+
message: "Picture relationships in the cached drawing could not be read."
|
|
19885
|
+
});
|
|
19886
|
+
}
|
|
19887
|
+
issues.push(...drawing2.issues);
|
|
19888
|
+
}
|
|
19299
19889
|
} else if (data)
|
|
19300
19890
|
issues.push({
|
|
19301
19891
|
code: "DIAGRAM_DRAWING_ABSENT",
|
|
@@ -19370,10 +19960,11 @@ async function resolveOne(object, info, source) {
|
|
|
19370
19960
|
const xml = source.text(relsPart);
|
|
19371
19961
|
if (!xml) return void 0;
|
|
19372
19962
|
try {
|
|
19373
|
-
return [...parseRelationships(xml).values()].map(({ id: id3, type, target: target2 }) => ({
|
|
19963
|
+
return [...parseRelationships(xml).values()].map(({ id: id3, type, target: target2, mode }) => ({
|
|
19374
19964
|
id: id3,
|
|
19375
19965
|
type,
|
|
19376
|
-
target: target2
|
|
19966
|
+
target: target2,
|
|
19967
|
+
...mode ? { mode } : {}
|
|
19377
19968
|
}));
|
|
19378
19969
|
} catch {
|
|
19379
19970
|
return void 0;
|
|
@@ -19823,7 +20414,7 @@ function readConditionalExtensions(sheet) {
|
|
|
19823
20414
|
}
|
|
19824
20415
|
|
|
19825
20416
|
// chart/read-appearance.ts
|
|
19826
|
-
function readChartAppearance(text7,
|
|
20417
|
+
function readChartAppearance(text7, properties) {
|
|
19827
20418
|
const out = {};
|
|
19828
20419
|
const size3 = Number(text7?.getAttribute("sz") ?? NaN);
|
|
19829
20420
|
if (Number.isFinite(size3) && size3 > 0) out.fontSize = size3 / 100;
|
|
@@ -19840,8 +20431,8 @@ function readChartAppearance(text7, properties2) {
|
|
|
19840
20431
|
if (typeface2) out.typeface = typeface2;
|
|
19841
20432
|
const color2 = parseDrawingColorIn(first(text7, "solidFill", NS.a));
|
|
19842
20433
|
if (color2) out.textColor = color2;
|
|
19843
|
-
const fill = parseDrawingFill(
|
|
19844
|
-
const line2 = parseDrawingLine(first(
|
|
20434
|
+
const fill = parseDrawingFill(properties);
|
|
20435
|
+
const line2 = parseDrawingLine(first(properties, "ln", NS.a));
|
|
19845
20436
|
if (fill) out.fill = fill;
|
|
19846
20437
|
if (line2) out.line = line2;
|
|
19847
20438
|
const effects = first(text7, "effectLst", NS.a);
|
|
@@ -19853,11 +20444,11 @@ function readChartAppearance(text7, properties2) {
|
|
|
19853
20444
|
function chartDataLabelNode(root2) {
|
|
19854
20445
|
const plot = first(first(root2, "chart", NS.c), "plotArea", NS.c);
|
|
19855
20446
|
const groups = plot ? elements(plot).filter((node3) => node3.localName.endsWith("Chart")) : [];
|
|
19856
|
-
const
|
|
20447
|
+
const candidates2 = groups.flatMap((group2) => [
|
|
19857
20448
|
...children(group2, "ser", NS.c).map((ser) => first(ser, "dLbls", NS.c)),
|
|
19858
20449
|
first(group2, "dLbls", NS.c)
|
|
19859
20450
|
]);
|
|
19860
|
-
return
|
|
20451
|
+
return candidates2.find(
|
|
19861
20452
|
(node3) => node3 !== void 0 && (first(node3, "txPr", NS.c) !== void 0 || elements(node3).some(
|
|
19862
20453
|
(child3) => child3.localName.startsWith("show") && child3.getAttribute("val") === "1"
|
|
19863
20454
|
))
|
|
@@ -21048,8 +21639,8 @@ function parseChartSpace(source) {
|
|
|
21048
21639
|
}
|
|
21049
21640
|
|
|
21050
21641
|
// chart/write-text-body.ts
|
|
21051
|
-
function runProperties(local,
|
|
21052
|
-
const p =
|
|
21642
|
+
function runProperties(local, properties) {
|
|
21643
|
+
const p = properties ?? {};
|
|
21053
21644
|
const attributes = [
|
|
21054
21645
|
p.sizePt === void 0 ? "" : ` sz="${Math.round(p.sizePt * 100)}"`,
|
|
21055
21646
|
p.bold === void 0 ? "" : ` b="${p.bold ? 1 : 0}"`,
|
|
@@ -21065,16 +21656,16 @@ function spacing(local, value3) {
|
|
|
21065
21656
|
return `<a:${local}>${inner}</a:${local}>`;
|
|
21066
21657
|
}
|
|
21067
21658
|
function run(value3) {
|
|
21068
|
-
const { text: text7, ...
|
|
21069
|
-
const hasProperties = Object.keys(
|
|
21659
|
+
const { text: text7, ...properties } = value3;
|
|
21660
|
+
const hasProperties = Object.keys(properties).length > 0;
|
|
21070
21661
|
if (text7 === "\n")
|
|
21071
|
-
return hasProperties ? `<a:br>${runProperties("rPr",
|
|
21072
|
-
return `<a:r>${hasProperties ? runProperties("rPr",
|
|
21662
|
+
return hasProperties ? `<a:br>${runProperties("rPr", properties)}</a:br>` : "<a:br/>";
|
|
21663
|
+
return `<a:r>${hasProperties ? runProperties("rPr", properties) : ""}<a:t>${escapeText2(text7)}</a:t></a:r>`;
|
|
21073
21664
|
}
|
|
21074
21665
|
function paragraph(value3) {
|
|
21075
21666
|
const align = value3.align ? ` algn="${escapeAttribute(value3.align)}"` : "";
|
|
21076
|
-
const
|
|
21077
|
-
return `<a:p><a:pPr${align}>${
|
|
21667
|
+
const properties = spacing("lnSpc", value3.lineSpacing) + spacing("spcBef", value3.spaceBefore) + spacing("spcAft", value3.spaceAfter) + runProperties("defRPr", value3.defaultProperties);
|
|
21668
|
+
return `<a:p><a:pPr${align}>${properties}</a:pPr>${value3.runs.map(run).join("")}</a:p>`;
|
|
21078
21669
|
}
|
|
21079
21670
|
function writeTextBody(body) {
|
|
21080
21671
|
const insets = body.insetsEmu ?? {};
|
|
@@ -21211,7 +21802,7 @@ function dataSourceInner(source) {
|
|
|
21211
21802
|
case "multiLvlStrRef": {
|
|
21212
21803
|
const levels = source.levels ? elementXml(
|
|
21213
21804
|
"multiLvlStrCache",
|
|
21214
|
-
valXml("ptCount", source.levelPointCount) + source.levels.map((
|
|
21805
|
+
valXml("ptCount", source.levelPointCount) + source.levels.map((level3) => elementXml("lvl", cachePoints(level3))).join("")
|
|
21215
21806
|
) : "";
|
|
21216
21807
|
return `<c:multiLvlStrRef>${formula2}${levels}</c:multiLvlStrRef>`;
|
|
21217
21808
|
}
|
|
@@ -21603,13 +22194,13 @@ function parsePattern(code) {
|
|
|
21603
22194
|
continue;
|
|
21604
22195
|
}
|
|
21605
22196
|
if (ch === "[") {
|
|
21606
|
-
const
|
|
21607
|
-
const token = code.slice(i + 1,
|
|
22197
|
+
const close3 = code.indexOf("]", i);
|
|
22198
|
+
const token = code.slice(i + 1, close3 === -1 ? code.length : close3);
|
|
21608
22199
|
const named2 = NAMED_FORMAT_COLORS[token.trim().toLowerCase()];
|
|
21609
22200
|
if (named2 && color2 === void 0) {
|
|
21610
22201
|
color2 = named2;
|
|
21611
22202
|
}
|
|
21612
|
-
i =
|
|
22203
|
+
i = close3 === -1 ? code.length : close3;
|
|
21613
22204
|
continue;
|
|
21614
22205
|
}
|
|
21615
22206
|
chars.push({ ch, literal: false });
|
|
@@ -21839,6 +22430,9 @@ function composeDataLabelText(input) {
|
|
|
21839
22430
|
// chart/render/summary-labels.ts
|
|
21840
22431
|
function level(options2, custom) {
|
|
21841
22432
|
const out = {};
|
|
22433
|
+
if (options2.layout) out.layout = options2.layout;
|
|
22434
|
+
if (options2.showLeaderLines !== void 0) out.showLeaderLines = options2.showLeaderLines;
|
|
22435
|
+
if (options2.leaderLines?.spPr?.line) out.leaderLine = options2.leaderLines.spPr.line;
|
|
21842
22436
|
if (options2.deleted !== void 0) out.deleted = options2.deleted;
|
|
21843
22437
|
if (options2.showValue !== void 0) out.showValue = options2.showValue;
|
|
21844
22438
|
if (options2.showCategoryName !== void 0) out.showCategory = options2.showCategoryName;
|
|
@@ -21888,7 +22482,7 @@ var GROUP_TYPES = {
|
|
|
21888
22482
|
surface: "surface"
|
|
21889
22483
|
};
|
|
21890
22484
|
var GROUPINGS = /* @__PURE__ */ new Set(["clustered", "stacked", "percentStacked", "standard"]);
|
|
21891
|
-
function chartSummarySeries(source, chartType, groupLabels) {
|
|
22485
|
+
function chartSummarySeries(source, chartType, groupLabels, groupSmooth) {
|
|
21892
22486
|
const categories = source.categories ?? source.xValues;
|
|
21893
22487
|
const values = source.values ?? source.yValues;
|
|
21894
22488
|
const numeric4 = (v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null;
|
|
@@ -21896,6 +22490,9 @@ function chartSummarySeries(source, chartType, groupLabels) {
|
|
|
21896
22490
|
categories: chartSourceValues(categories),
|
|
21897
22491
|
values: chartSourceValues(values).map(numeric4)
|
|
21898
22492
|
};
|
|
22493
|
+
const smooth = source.smooth ?? groupSmooth;
|
|
22494
|
+
if (smooth !== void 0) out.smooth = smooth;
|
|
22495
|
+
if (source.spPr?.line) out.line = source.spPr.line;
|
|
21899
22496
|
if (values?.cache?.formatCode !== void 0) out.numberFormat = values.cache.formatCode;
|
|
21900
22497
|
if (source.bubbleSizes) {
|
|
21901
22498
|
out.bubbleSizes = chartSourceValues(source.bubbleSizes).map(numeric4);
|
|
@@ -21916,12 +22513,12 @@ function chartSummarySeries(source, chartType, groupLabels) {
|
|
|
21916
22513
|
const points2 = {};
|
|
21917
22514
|
const pointFills = {};
|
|
21918
22515
|
for (const point2 of source.dataPoints) {
|
|
21919
|
-
const
|
|
22516
|
+
const properties = point2.spPr ?? point2.marker?.spPr;
|
|
21920
22517
|
if (point2.index === void 0) continue;
|
|
21921
|
-
const pointColor = solidColor(
|
|
22518
|
+
const pointColor = solidColor(properties?.fill);
|
|
21922
22519
|
if (pointColor) points2[point2.index] = pointColor;
|
|
21923
|
-
if (
|
|
21924
|
-
pointFills[point2.index] =
|
|
22520
|
+
if (properties?.fill && properties.fill.kind !== "solid")
|
|
22521
|
+
pointFills[point2.index] = properties.fill;
|
|
21925
22522
|
}
|
|
21926
22523
|
if (Object.keys(points2).length) out.pointColors = points2;
|
|
21927
22524
|
if (Object.keys(pointFills).length) out.pointFills = pointFills;
|
|
@@ -21955,7 +22552,12 @@ function extraGroups(chartSpace, firstType) {
|
|
|
21955
22552
|
const entry3 = {
|
|
21956
22553
|
chartType: type,
|
|
21957
22554
|
series: group2.series.map((source, index2) => ({
|
|
21958
|
-
...chartSummarySeries(
|
|
22555
|
+
...chartSummarySeries(
|
|
22556
|
+
source,
|
|
22557
|
+
type,
|
|
22558
|
+
group2.dataLabels,
|
|
22559
|
+
group2.smooth ?? (group2.scatterStyle ? ["smooth", "smoothMarker"].includes(group2.scatterStyle) : void 0)
|
|
22560
|
+
),
|
|
21959
22561
|
...summaryMarkers(source, group2, index2)
|
|
21960
22562
|
})),
|
|
21961
22563
|
secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
|
|
@@ -21976,8 +22578,14 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
|
21976
22578
|
let chartType = group2 ? GROUP_TYPES[group2.kind] : "column";
|
|
21977
22579
|
if (chartType === "bar" && group2?.barDirection !== "bar") chartType = "column";
|
|
21978
22580
|
const series = (group2?.series ?? []).map((source, index2) => ({
|
|
21979
|
-
...chartSummarySeries(
|
|
21980
|
-
|
|
22581
|
+
...chartSummarySeries(
|
|
22582
|
+
source,
|
|
22583
|
+
chartType,
|
|
22584
|
+
group2?.dataLabels,
|
|
22585
|
+
group2?.smooth ?? (group2?.scatterStyle ? ["smooth", "smoothMarker"].includes(group2.scatterStyle) : void 0)
|
|
22586
|
+
),
|
|
22587
|
+
...group2 ? summaryMarkers(source, group2, index2) : {},
|
|
22588
|
+
...group2?.kind === "scatter" ? { showLine: !["marker", "none"].includes(group2.scatterStyle ?? "marker") } : {}
|
|
21981
22589
|
}));
|
|
21982
22590
|
const summary = {
|
|
21983
22591
|
chartType,
|
|
@@ -21986,6 +22594,9 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
|
21986
22594
|
axes: chartSpace.plotArea.axes,
|
|
21987
22595
|
axisIds: group2?.axisIds ?? []
|
|
21988
22596
|
};
|
|
22597
|
+
if (chartSpace.plotArea.dataTable) summary.dataTable = chartSpace.plotArea.dataTable;
|
|
22598
|
+
if (chartSpace.date1904 !== void 0) summary.date1904 = chartSpace.date1904;
|
|
22599
|
+
if (chartSpace.plotArea.layout) summary.plotLayout = chartSpace.plotArea.layout;
|
|
21989
22600
|
const combined = extraGroups(chartSpace, chartType);
|
|
21990
22601
|
if (combined.length) summary.extraGroups = combined;
|
|
21991
22602
|
if (chartType === "stock" && group2) summary.stock = stockStyle(group2);
|
|
@@ -22065,6 +22676,9 @@ function chartObjectFromSpace(space3, frame, root2) {
|
|
|
22065
22676
|
showLegend: summary.showLegend
|
|
22066
22677
|
};
|
|
22067
22678
|
if (frame.partName !== void 0) object.partName = frame.partName;
|
|
22679
|
+
if (summary.dataTable) object.dataTable = summary.dataTable;
|
|
22680
|
+
if (summary.date1904 !== void 0) object.date1904 = summary.date1904;
|
|
22681
|
+
if (summary.plotLayout) object.plotLayout = summary.plotLayout;
|
|
22068
22682
|
if (summary.axes) object.axes = summary.axes;
|
|
22069
22683
|
if (summary.axisIds) object.axisIds = summary.axisIds;
|
|
22070
22684
|
if (summary.grouping) object.grouping = summary.grouping;
|
|
@@ -22214,7 +22828,7 @@ function parseDimension(context, element2) {
|
|
|
22214
22828
|
return assignDefined(
|
|
22215
22829
|
{
|
|
22216
22830
|
kind: element2.localName,
|
|
22217
|
-
levels: cxChildren(element2, "lvl").map((
|
|
22831
|
+
levels: cxChildren(element2, "lvl").map((level3) => parseLevel(context, level3))
|
|
22218
22832
|
},
|
|
22219
22833
|
{
|
|
22220
22834
|
type: attribute3(element2, "type"),
|
|
@@ -22625,6 +23239,41 @@ function parseChartExSpace(source) {
|
|
|
22625
23239
|
return { chartExSpace, issues: context.issues };
|
|
22626
23240
|
}
|
|
22627
23241
|
|
|
23242
|
+
// chart/render/summary-ex-series.ts
|
|
23243
|
+
var level2 = (source) => ({
|
|
23244
|
+
...source.visibility?.value === void 0 ? {} : { showValue: source.visibility.value },
|
|
23245
|
+
...source.visibility?.categoryName === void 0 ? {} : { showCategory: source.visibility.categoryName },
|
|
23246
|
+
...source.visibility?.seriesName === void 0 ? {} : { showSeriesName: source.visibility.seriesName },
|
|
23247
|
+
...source.position ? { position: source.position } : {},
|
|
23248
|
+
...source.numberFormat?.formatCode ? { numberFormat: source.numberFormat.formatCode } : {},
|
|
23249
|
+
...source.separator === void 0 ? {} : { separator: source.separator }
|
|
23250
|
+
});
|
|
23251
|
+
function chartExSeriesPaint(source, series, defaultValues = false) {
|
|
23252
|
+
const fill = source.spPr?.fill;
|
|
23253
|
+
if (fill) series.fill = fill;
|
|
23254
|
+
const points2 = {};
|
|
23255
|
+
const fills = {};
|
|
23256
|
+
for (const point2 of source.dataPoints) {
|
|
23257
|
+
if (point2.index === void 0) continue;
|
|
23258
|
+
const fill2 = point2.spPr?.fill;
|
|
23259
|
+
if (fill2?.kind === "solid") points2[point2.index] = fill2.color;
|
|
23260
|
+
else if (fill2) fills[point2.index] = fill2;
|
|
23261
|
+
}
|
|
23262
|
+
if (Object.keys(points2).length) series.pointColors = points2;
|
|
23263
|
+
if (Object.keys(fills).length) series.pointFills = fills;
|
|
23264
|
+
const labels = source.dataLabels;
|
|
23265
|
+
if (!labels && !defaultValues) return;
|
|
23266
|
+
const overrides = {};
|
|
23267
|
+
for (const label2 of labels?.labels ?? [])
|
|
23268
|
+
if (label2.index !== void 0) overrides[label2.index] = level2(label2);
|
|
23269
|
+
for (const index2 of labels?.hidden ?? [])
|
|
23270
|
+
overrides[index2] = { ...overrides[index2], deleted: true };
|
|
23271
|
+
series.dataLabels = {
|
|
23272
|
+
series: { showValue: defaultValues, ...labels ? level2(labels) : {} },
|
|
23273
|
+
points: overrides
|
|
23274
|
+
};
|
|
23275
|
+
}
|
|
23276
|
+
|
|
22628
23277
|
// chart/render/summary-from-chartex.ts
|
|
22629
23278
|
function seriesData(space3, series) {
|
|
22630
23279
|
if (series.data) return series.data;
|
|
@@ -22632,17 +23281,17 @@ function seriesData(space3, series) {
|
|
|
22632
23281
|
return series.dataId === void 0 ? shared[0] : shared.find((data) => data.id === series.dataId);
|
|
22633
23282
|
}
|
|
22634
23283
|
var findDimension = (data, kind, type) => data?.dimensions.find((d) => d.kind === kind && (d.type ?? "") === type);
|
|
22635
|
-
function levelPoints(
|
|
23284
|
+
function levelPoints(level3) {
|
|
22636
23285
|
const points2 = [];
|
|
22637
|
-
for (const point2 of
|
|
22638
|
-
for (let i = 0; i < Math.max(
|
|
23286
|
+
for (const point2 of level3.points) points2[point2.index ?? points2.length] = point2.value.trim();
|
|
23287
|
+
for (let i = 0; i < Math.max(level3.pointCount ?? 0, points2.length); i++) points2[i] ??= "";
|
|
22639
23288
|
return points2;
|
|
22640
23289
|
}
|
|
22641
23290
|
function dimension(data, kind, type) {
|
|
22642
23291
|
const element2 = findDimension(data, kind, type);
|
|
22643
23292
|
if (!element2) return void 0;
|
|
22644
|
-
const
|
|
22645
|
-
const out = { points:
|
|
23293
|
+
const level3 = element2.levels[0];
|
|
23294
|
+
const out = { points: level3 ? levelPoints(level3) : [] };
|
|
22646
23295
|
const formula2 = element2.formula?.formula.trim();
|
|
22647
23296
|
if (formula2) out.formula = formula2;
|
|
22648
23297
|
return out;
|
|
@@ -22706,13 +23355,8 @@ function chartExFormatting() {
|
|
|
22706
23355
|
}
|
|
22707
23356
|
};
|
|
22708
23357
|
}
|
|
22709
|
-
function
|
|
22710
|
-
const
|
|
22711
|
-
const primary = all.find((s) => s.layoutId !== "paretoLine") ?? all[0];
|
|
22712
|
-
const layoutId = primary?.layoutId ?? "";
|
|
22713
|
-
const chartType = layoutId === "waterfall" ? "waterfall" : layoutId === "clusteredColumn" ? "histogram" : layoutId === "treemap" || layoutId === "sunburst" ? layoutId : void 0;
|
|
22714
|
-
if (!primary || !chartType) return { layoutId };
|
|
22715
|
-
const data = seriesData(space3, primary);
|
|
23358
|
+
function summarySeries(space3, source, chartType) {
|
|
23359
|
+
const data = seriesData(space3, source);
|
|
22716
23360
|
const categories = dimension(data, "strDim", "cat");
|
|
22717
23361
|
const values = dimension(
|
|
22718
23362
|
data,
|
|
@@ -22724,17 +23368,63 @@ function chartExSummaryFromModel(space3) {
|
|
|
22724
23368
|
values: (values?.points ?? []).map(
|
|
22725
23369
|
(p) => p !== "" && Number.isFinite(Number(p)) ? Number(p) : null
|
|
22726
23370
|
),
|
|
22727
|
-
...seriesFill(
|
|
23371
|
+
...seriesFill(source)
|
|
22728
23372
|
};
|
|
22729
|
-
|
|
23373
|
+
if (chartType === "funnel" || chartType === "boxWhisker") {
|
|
23374
|
+
chartExSeriesPaint(source, series, chartType === "funnel" && source.dataLabels !== void 0);
|
|
23375
|
+
if (source.hidden !== void 0) series.hidden = source.hidden;
|
|
23376
|
+
}
|
|
23377
|
+
if (chartType === "boxWhisker") series.boxWhisker = source.layoutProperties ?? {};
|
|
23378
|
+
const name3 = source.tx?.value?.trim();
|
|
22730
23379
|
if (name3) series.name = name3;
|
|
22731
|
-
const nameRef =
|
|
23380
|
+
const nameRef = source.tx?.formula?.formula.trim();
|
|
22732
23381
|
if (nameRef) series.nameRef = nameRef;
|
|
22733
23382
|
if (categories?.formula) series.categoriesRef = categories.formula;
|
|
22734
23383
|
if (values?.formula) series.valuesRef = values.formula;
|
|
23384
|
+
return series;
|
|
23385
|
+
}
|
|
23386
|
+
function chartExSummaryFromModel(space3) {
|
|
23387
|
+
const all = space3.plotArea.series;
|
|
23388
|
+
const primary = all.find((s) => s.layoutId !== "paretoLine") ?? all[0];
|
|
23389
|
+
const layoutId = primary?.layoutId ?? "";
|
|
23390
|
+
const chartType = layoutId === "waterfall" ? "waterfall" : layoutId === "clusteredColumn" ? "histogram" : layoutId === "treemap" || layoutId === "sunburst" || layoutId === "funnel" || layoutId === "boxWhisker" ? layoutId : void 0;
|
|
23391
|
+
if (!primary || !chartType) return { layoutId };
|
|
23392
|
+
const series = summarySeries(space3, primary, chartType);
|
|
22735
23393
|
const layout = primary.layoutProperties;
|
|
22736
23394
|
const legend = space3.legend;
|
|
22737
|
-
const summary = {
|
|
23395
|
+
const summary = {
|
|
23396
|
+
chartType,
|
|
23397
|
+
series: chartType === "boxWhisker" ? all.filter((s) => s.layoutId === "boxWhisker").map((source) => summarySeries(space3, source, chartType)) : [series],
|
|
23398
|
+
showLegend: legend !== void 0
|
|
23399
|
+
};
|
|
23400
|
+
if (chartType === "boxWhisker") {
|
|
23401
|
+
summary.axes = space3.plotArea.axes.flatMap((axis) => {
|
|
23402
|
+
const scaling = axis.scaling;
|
|
23403
|
+
if (!scaling) return [];
|
|
23404
|
+
const value3 = scaling.kind === "val";
|
|
23405
|
+
return [
|
|
23406
|
+
{
|
|
23407
|
+
kind: value3 ? "val" : "cat",
|
|
23408
|
+
...axis.id === void 0 ? {} : { id: axis.id },
|
|
23409
|
+
position: value3 ? "l" : "b",
|
|
23410
|
+
deleted: axis.hidden ?? false,
|
|
23411
|
+
scaling: {
|
|
23412
|
+
...value3 && typeof scaling.min === "number" ? { min: scaling.min } : {},
|
|
23413
|
+
...value3 && typeof scaling.max === "number" ? { max: scaling.max } : {}
|
|
23414
|
+
},
|
|
23415
|
+
majorGridlines: !!axis.majorGridlines,
|
|
23416
|
+
minorGridlines: !!axis.minorGridlines,
|
|
23417
|
+
...axis.majorGridlines?.spPr ? { majorGridlinesSpPr: axis.majorGridlines.spPr } : {},
|
|
23418
|
+
...axis.minorGridlines?.spPr ? { minorGridlinesSpPr: axis.minorGridlines.spPr } : {},
|
|
23419
|
+
...value3 && typeof scaling.majorUnit === "number" ? { majorUnit: scaling.majorUnit } : {},
|
|
23420
|
+
...value3 && typeof scaling.minorUnit === "number" ? { minorUnit: scaling.minorUnit } : {},
|
|
23421
|
+
...axis.spPr ? { spPr: axis.spPr } : {},
|
|
23422
|
+
...axis.numberFormat ? { numberFormat: axis.numberFormat } : {},
|
|
23423
|
+
...axis.tickLabels ? {} : { tickLabelPosition: "none" }
|
|
23424
|
+
}
|
|
23425
|
+
];
|
|
23426
|
+
});
|
|
23427
|
+
}
|
|
22738
23428
|
summary.formatting = chartExFormatting();
|
|
22739
23429
|
const title = titleOf(space3);
|
|
22740
23430
|
if (title) summary.title = title;
|
|
@@ -22749,11 +23439,11 @@ function chartExSummaryFromModel(space3) {
|
|
|
22749
23439
|
} else if (chartType === "treemap" || chartType === "sunburst") {
|
|
22750
23440
|
const parentLayout = layout?.parentLabelLayout;
|
|
22751
23441
|
summary.hierarchy = {
|
|
22752
|
-
levels: categoryLevels(
|
|
23442
|
+
levels: categoryLevels(seriesData(space3, primary)),
|
|
22753
23443
|
dataLabels: primary.dataLabels !== void 0,
|
|
22754
23444
|
...parentLayout === "none" || parentLayout === "banner" || parentLayout === "overlapping" ? { parentLabelLayout: parentLayout } : {}
|
|
22755
23445
|
};
|
|
22756
|
-
} else summary.histogram = histogramOptions(primary);
|
|
23446
|
+
} else if (chartType === "histogram") summary.histogram = histogramOptions(primary);
|
|
22757
23447
|
return { layoutId, summary };
|
|
22758
23448
|
}
|
|
22759
23449
|
|
|
@@ -22961,7 +23651,8 @@ function parseDrawing(source, partName, warn) {
|
|
|
22961
23651
|
const cNvPr = nonVisual(content2);
|
|
22962
23652
|
const name3 = att(cNvPr, "name");
|
|
22963
23653
|
if (content2.localName === "pic") {
|
|
22964
|
-
const
|
|
23654
|
+
const blipFill = xdr(content2, "blipFill");
|
|
23655
|
+
const blip = first(blipFill, "blip", NS.a);
|
|
22965
23656
|
const rel = rels.get(relAttr(blip, "embed") ?? "");
|
|
22966
23657
|
const target2 = rel ? source.target(partName, rel) : void 0;
|
|
22967
23658
|
if (!target2 || !source.has(target2)) {
|
|
@@ -22971,6 +23662,9 @@ function parseDrawing(source, partName, warn) {
|
|
|
22971
23662
|
const image = {
|
|
22972
23663
|
kind: "image",
|
|
22973
23664
|
anchor,
|
|
23665
|
+
sourceXml: selfContainedXml(anchorEl),
|
|
23666
|
+
...parsePictureCrop(blipFill) ? { crop: parsePictureCrop(blipFill) } : {},
|
|
23667
|
+
...parsePictureEffects(blip).length ? { effects: parsePictureEffects(blip) } : {},
|
|
22974
23668
|
partName: target2,
|
|
22975
23669
|
contentType: source.contentType(target2) ?? "application/octet-stream"
|
|
22976
23670
|
};
|
|
@@ -23601,7 +24295,7 @@ async function loadXlsx(input, options2 = {}) {
|
|
|
23601
24295
|
const corePart = source.targetOfType("", RELATIONSHIP_TYPES.coreProperties);
|
|
23602
24296
|
const appPart = source.targetOfType("", RELATIONSHIP_TYPES.extendedProperties);
|
|
23603
24297
|
const customPart = source.targetOfType("", RELATIONSHIP_TYPES.customProperties);
|
|
23604
|
-
const
|
|
24298
|
+
const properties = readProperties(
|
|
23605
24299
|
corePart ? source.text(corePart) : void 0,
|
|
23606
24300
|
appPart ? source.text(appPart) : void 0,
|
|
23607
24301
|
customPart ? source.text(customPart) : void 0,
|
|
@@ -23615,7 +24309,7 @@ async function loadXlsx(input, options2 = {}) {
|
|
|
23615
24309
|
theme: parseTheme2(themePart ? source.text(themePart) : void 0),
|
|
23616
24310
|
activeSheet: Math.min(Math.max(0, book.activeTab), Math.max(0, sheets.length - 1)),
|
|
23617
24311
|
date1904: book.date1904,
|
|
23618
|
-
properties
|
|
24312
|
+
properties,
|
|
23619
24313
|
source: { parts },
|
|
23620
24314
|
format: MACRO_TYPES.has(contentType2) ? "xlsm" : "xlsx",
|
|
23621
24315
|
warnings
|
|
@@ -23945,10 +24639,10 @@ var STOCK_DEFAULT_WICK_COLOR = "#334155";
|
|
|
23945
24639
|
|
|
23946
24640
|
// chart/hierarchy.ts
|
|
23947
24641
|
function normalizeLevels(levels, pointCount) {
|
|
23948
|
-
return levels.map((
|
|
24642
|
+
return levels.map((level3) => {
|
|
23949
24643
|
let previous = "";
|
|
23950
24644
|
return Array.from({ length: pointCount }, (_, index2) => {
|
|
23951
|
-
const label2 =
|
|
24645
|
+
const label2 = level3[index2]?.trim() ?? "";
|
|
23952
24646
|
if (label2) previous = label2;
|
|
23953
24647
|
return label2 || previous;
|
|
23954
24648
|
});
|
|
@@ -24134,9 +24828,6 @@ function resolveChartGradient(fill, resolve) {
|
|
|
24134
24828
|
};
|
|
24135
24829
|
}
|
|
24136
24830
|
|
|
24137
|
-
// chart/render/chart-svg-util.ts
|
|
24138
|
-
var TEXT_COLOR = "#595959";
|
|
24139
|
-
|
|
24140
24831
|
// chart/render/chart-colors.ts
|
|
24141
24832
|
function chartColorScheme(theme2) {
|
|
24142
24833
|
const slots = Object.fromEntries(
|
|
@@ -24243,6 +24934,9 @@ function chartAppearance(chart, theme2) {
|
|
|
24243
24934
|
return out;
|
|
24244
24935
|
}
|
|
24245
24936
|
|
|
24937
|
+
// chart/render/chart-svg-util.ts
|
|
24938
|
+
var TEXT_COLOR = "#595959";
|
|
24939
|
+
|
|
24246
24940
|
// chart/render/chart-scale.ts
|
|
24247
24941
|
var clean2 = (n) => Number(n.toPrecision(12));
|
|
24248
24942
|
function* units2(raw2) {
|
|
@@ -24422,10 +25116,10 @@ function applyChartAxes(model, chart, color2) {
|
|
|
24422
25116
|
if (!chart.axes?.length) return;
|
|
24423
25117
|
const axes = chart.axes;
|
|
24424
25118
|
const linked = axes.filter((axis) => axis.id !== void 0 && chart.axisIds?.includes(axis.id));
|
|
24425
|
-
const
|
|
25119
|
+
const candidates2 = linked.length ? linked : axes;
|
|
24426
25120
|
const xy = model.type === "scatter" || model.type === "bubble";
|
|
24427
|
-
const value3 =
|
|
24428
|
-
const category =
|
|
25121
|
+
const value3 = candidates2.find((axis) => axis.kind === "val" && !["b", "t"].includes(axis.position ?? "")) ?? candidates2.find((axis) => axis.kind === "val");
|
|
25122
|
+
const category = candidates2.find(
|
|
24429
25123
|
(axis) => xy ? axis.kind === "val" && axis !== value3 : axis.kind === "cat" || axis.kind === "date"
|
|
24430
25124
|
);
|
|
24431
25125
|
const secondary = axes.find((axis) => axis.kind === "val" && axis !== value3 && axis !== category);
|
|
@@ -24496,6 +25190,50 @@ function applyChartAxes(model, chart, color2) {
|
|
|
24496
25190
|
model.axes = out;
|
|
24497
25191
|
}
|
|
24498
25192
|
|
|
25193
|
+
// chart/render/chart-title-text.ts
|
|
25194
|
+
function chartRunStyle(run2) {
|
|
25195
|
+
return {
|
|
25196
|
+
...run2.sizePt === void 0 ? {} : { fontSize: run2.sizePt },
|
|
25197
|
+
...run2.bold === void 0 ? {} : { bold: run2.bold },
|
|
25198
|
+
...run2.italic === void 0 ? {} : { italic: run2.italic },
|
|
25199
|
+
...run2.underline === void 0 ? {} : { underline: run2.underline },
|
|
25200
|
+
...run2.typeface === void 0 ? {} : { typeface: run2.typeface },
|
|
25201
|
+
...run2.color === void 0 ? {} : { textColor: run2.color }
|
|
25202
|
+
};
|
|
25203
|
+
}
|
|
25204
|
+
function chartTitleText(chart, theme2) {
|
|
25205
|
+
const formatting = chart.formatting;
|
|
25206
|
+
const entry3 = formatting?.entries.title;
|
|
25207
|
+
const body = entry3?.textBody;
|
|
25208
|
+
if (!formatting || !body || body.text !== chart.title) return void 0;
|
|
25209
|
+
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)
|
|
25210
|
+
return void 0;
|
|
25211
|
+
return {
|
|
25212
|
+
paragraphs: body.paragraphs.map((paragraph2) => ({
|
|
25213
|
+
...paragraph2.align ? { align: paragraph2.align } : {},
|
|
25214
|
+
...paragraph2.lineSpacing ? { lineSpacing: paragraph2.lineSpacing } : {},
|
|
25215
|
+
...paragraph2.spaceBefore ? { spaceBefore: paragraph2.spaceBefore } : {},
|
|
25216
|
+
...paragraph2.spaceAfter ? { spaceAfter: paragraph2.spaceAfter } : {},
|
|
25217
|
+
runs: paragraph2.runs.map((run2) => {
|
|
25218
|
+
const direct = {
|
|
25219
|
+
sourceXml: "",
|
|
25220
|
+
...entry3.textBodyStyle,
|
|
25221
|
+
...chartRunStyle(paragraph2.defaultProperties ?? {}),
|
|
25222
|
+
...chartRunStyle(run2)
|
|
25223
|
+
};
|
|
25224
|
+
const appearance = chartAppearance(
|
|
25225
|
+
{
|
|
25226
|
+
...chart,
|
|
25227
|
+
formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
|
|
25228
|
+
},
|
|
25229
|
+
theme2
|
|
25230
|
+
)?.title ?? {};
|
|
25231
|
+
return { text: run2.text, appearance };
|
|
25232
|
+
})
|
|
25233
|
+
}))
|
|
25234
|
+
};
|
|
25235
|
+
}
|
|
25236
|
+
|
|
24499
25237
|
// chart/render/chart-view-analysis.ts
|
|
24500
25238
|
function strokeOf(line2, fallback, resolve) {
|
|
24501
25239
|
if (line2?.fill?.kind === "none") return void 0;
|
|
@@ -24523,6 +25261,40 @@ function analysisView(source, seriesColor, resolve) {
|
|
|
24523
25261
|
};
|
|
24524
25262
|
}
|
|
24525
25263
|
|
|
25264
|
+
// chart/render/chart-view-data-table.ts
|
|
25265
|
+
function chartDataTableView(chart, theme2, color2) {
|
|
25266
|
+
const source = chart.dataTable;
|
|
25267
|
+
if (!source) return void 0;
|
|
25268
|
+
const props = source.txPr?.paragraphs[0];
|
|
25269
|
+
const direct = {
|
|
25270
|
+
sourceXml: "",
|
|
25271
|
+
...chartRunStyle(props?.defaultProperties ?? {}),
|
|
25272
|
+
...chartRunStyle(props?.runs[0] ?? {})
|
|
25273
|
+
};
|
|
25274
|
+
const formatting = chart.formatting;
|
|
25275
|
+
const appearance = chartAppearance(
|
|
25276
|
+
{
|
|
25277
|
+
...chart,
|
|
25278
|
+
formatting: {
|
|
25279
|
+
...formatting,
|
|
25280
|
+
sourceXml: formatting?.sourceXml ?? "",
|
|
25281
|
+
entries: { ...formatting?.entries, categoryAxis: direct }
|
|
25282
|
+
}
|
|
25283
|
+
},
|
|
25284
|
+
theme2
|
|
25285
|
+
);
|
|
25286
|
+
const fill = source.spPr?.fill;
|
|
25287
|
+
return {
|
|
25288
|
+
source,
|
|
25289
|
+
stroke: strokeOf(source.spPr?.line, { color: "#D9D9D9", width: 1 }, color2) ?? {
|
|
25290
|
+
color: "none",
|
|
25291
|
+
width: 0
|
|
25292
|
+
},
|
|
25293
|
+
...fill?.kind === "solid" && color2(fill.color) ? { fill: color2(fill.color) } : {},
|
|
25294
|
+
...appearance?.categoryAxis ? { text: appearance.categoryAxis } : {}
|
|
25295
|
+
};
|
|
25296
|
+
}
|
|
25297
|
+
|
|
24526
25298
|
// chart/render/chart-view-series.ts
|
|
24527
25299
|
var isRefError = (value3) => typeof value3 === "object" && value3 !== null && "error" in value3;
|
|
24528
25300
|
function toText(value3) {
|
|
@@ -24564,7 +25336,8 @@ function seriesContext(chart, theme2, options2) {
|
|
|
24564
25336
|
function seriesView(ctx, s, index2, total, categoriesOf) {
|
|
24565
25337
|
const { theme: theme2, scheme, palette, evaluateRef: evaluateRef2 } = ctx;
|
|
24566
25338
|
const values = resolveRef(s.valuesRef, evaluateRef2)?.map(toNumber) ?? s.values.map(toNumber);
|
|
24567
|
-
|
|
25339
|
+
const categoryValues = resolveRef(s.categoriesRef, evaluateRef2) ?? s.categories;
|
|
25340
|
+
categoriesOf(categoryValues);
|
|
24568
25341
|
const paletteColor = palette && chartPaletteSeriesColor(palette, index2, total, scheme);
|
|
24569
25342
|
const color2 = s.fill?.kind === "none" ? "none" : ctx.drawingColor(s.fill?.kind === "solid" ? s.fill.color : s.drawingColor) ?? ctx.seriesColor?.(s, index2) ?? paletteColor ?? autoSeriesColor(theme2, index2);
|
|
24570
25343
|
const view = {
|
|
@@ -24573,6 +25346,19 @@ function seriesView(ctx, s, index2, total, categoriesOf) {
|
|
|
24573
25346
|
color: color2,
|
|
24574
25347
|
sourceIndex: index2
|
|
24575
25348
|
};
|
|
25349
|
+
if (s.hidden !== void 0) view.hidden = s.hidden;
|
|
25350
|
+
if (s.boxWhisker) {
|
|
25351
|
+
view.boxWhisker = s.boxWhisker;
|
|
25352
|
+
view.boxCategories = categoryValues.map(toText);
|
|
25353
|
+
}
|
|
25354
|
+
if (s.numberFormat !== void 0) view.numberFormat = s.numberFormat;
|
|
25355
|
+
if (s.showLine !== void 0) view.showLine = s.showLine;
|
|
25356
|
+
if (s.smooth !== void 0) view.smooth = s.smooth;
|
|
25357
|
+
if (s.line)
|
|
25358
|
+
view.stroke = strokeOf(s.line, { color: color2, width: 2.25 }, ctx.drawingColor) ?? {
|
|
25359
|
+
color: "none",
|
|
25360
|
+
width: 0
|
|
25361
|
+
};
|
|
24576
25362
|
const shadow = resolveDrawingShadowXml(s.effectsXml, { scheme: (name3) => scheme[name3] });
|
|
24577
25363
|
if (shadow) view.shadow = shadow;
|
|
24578
25364
|
const resolvedGradient = ctx.gradient(s.fill);
|
|
@@ -24712,52 +25498,8 @@ function valueAxis(model) {
|
|
|
24712
25498
|
return { ...niceScale(min, max), percent: false };
|
|
24713
25499
|
}
|
|
24714
25500
|
|
|
24715
|
-
// chart/render/chart-title-text.ts
|
|
24716
|
-
function properties(run2) {
|
|
24717
|
-
return {
|
|
24718
|
-
...run2.sizePt === void 0 ? {} : { fontSize: run2.sizePt },
|
|
24719
|
-
...run2.bold === void 0 ? {} : { bold: run2.bold },
|
|
24720
|
-
...run2.italic === void 0 ? {} : { italic: run2.italic },
|
|
24721
|
-
...run2.underline === void 0 ? {} : { underline: run2.underline },
|
|
24722
|
-
...run2.typeface === void 0 ? {} : { typeface: run2.typeface },
|
|
24723
|
-
...run2.color === void 0 ? {} : { textColor: run2.color }
|
|
24724
|
-
};
|
|
24725
|
-
}
|
|
24726
|
-
function chartTitleText(chart, theme2) {
|
|
24727
|
-
const formatting = chart.formatting;
|
|
24728
|
-
const entry3 = formatting?.entries.title;
|
|
24729
|
-
const body = entry3?.textBody;
|
|
24730
|
-
if (!formatting || !body || body.text !== chart.title) return void 0;
|
|
24731
|
-
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)
|
|
24732
|
-
return void 0;
|
|
24733
|
-
return {
|
|
24734
|
-
paragraphs: body.paragraphs.map((paragraph2) => ({
|
|
24735
|
-
...paragraph2.align ? { align: paragraph2.align } : {},
|
|
24736
|
-
...paragraph2.lineSpacing ? { lineSpacing: paragraph2.lineSpacing } : {},
|
|
24737
|
-
...paragraph2.spaceBefore ? { spaceBefore: paragraph2.spaceBefore } : {},
|
|
24738
|
-
...paragraph2.spaceAfter ? { spaceAfter: paragraph2.spaceAfter } : {},
|
|
24739
|
-
runs: paragraph2.runs.map((run2) => {
|
|
24740
|
-
const direct = {
|
|
24741
|
-
sourceXml: "",
|
|
24742
|
-
...entry3.textBodyStyle,
|
|
24743
|
-
...properties(paragraph2.defaultProperties ?? {}),
|
|
24744
|
-
...properties(run2)
|
|
24745
|
-
};
|
|
24746
|
-
const appearance = chartAppearance(
|
|
24747
|
-
{
|
|
24748
|
-
...chart,
|
|
24749
|
-
formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
|
|
24750
|
-
},
|
|
24751
|
-
theme2
|
|
24752
|
-
)?.title ?? {};
|
|
24753
|
-
return { text: run2.text, appearance };
|
|
24754
|
-
})
|
|
24755
|
-
}))
|
|
24756
|
-
};
|
|
24757
|
-
}
|
|
24758
|
-
|
|
24759
25501
|
// chart/render/chart-view-labels.ts
|
|
24760
|
-
function labelsOf(source, view, categories, numberFormat3) {
|
|
25502
|
+
function labelsOf(source, view, categories, numberFormat3, resolveColor2) {
|
|
24761
25503
|
const { chart, series, points: points2 } = source;
|
|
24762
25504
|
if ((series?.deleted ?? chart?.deleted) === true) return void 0;
|
|
24763
25505
|
const percentBase = view.values.reduce(
|
|
@@ -24793,19 +25535,35 @@ function labelsOf(source, view, categories, numberFormat3) {
|
|
|
24793
25535
|
});
|
|
24794
25536
|
}
|
|
24795
25537
|
if (!built) return;
|
|
25538
|
+
const layout = point2?.layout;
|
|
25539
|
+
const showLeaderLines = series?.showLeaderLines ?? chart?.showLeaderLines;
|
|
25540
|
+
const leaderLine = strokeOf(
|
|
25541
|
+
series?.leaderLine ?? chart?.leaderLine,
|
|
25542
|
+
{ color: "#94a3b8", width: 0.75 },
|
|
25543
|
+
resolveColor2
|
|
25544
|
+
) ?? { color: "none", width: 0 };
|
|
24796
25545
|
any = true;
|
|
24797
25546
|
out[i] = {
|
|
24798
25547
|
text: built.text,
|
|
25548
|
+
...layout ? { layout } : {},
|
|
25549
|
+
...showLeaderLines !== void 0 ? { showLeaderLines } : {},
|
|
25550
|
+
...leaderLine ? { leaderLine } : {},
|
|
24799
25551
|
...position ? { position } : {},
|
|
24800
25552
|
...built.color ? { color: built.color } : {}
|
|
24801
25553
|
};
|
|
24802
25554
|
});
|
|
24803
25555
|
return any ? out : void 0;
|
|
24804
25556
|
}
|
|
24805
|
-
function applyDataLabels(model, sources, extra) {
|
|
25557
|
+
function applyDataLabels(model, sources, extra, resolveColor2) {
|
|
24806
25558
|
const apply5 = (source, view) => {
|
|
24807
25559
|
if (!source?.dataLabels) return;
|
|
24808
|
-
const labels = labelsOf(
|
|
25560
|
+
const labels = labelsOf(
|
|
25561
|
+
source.dataLabels,
|
|
25562
|
+
view,
|
|
25563
|
+
model.categories,
|
|
25564
|
+
source.numberFormat,
|
|
25565
|
+
resolveColor2
|
|
25566
|
+
);
|
|
24809
25567
|
if (labels) view.labels = labels;
|
|
24810
25568
|
};
|
|
24811
25569
|
model.series.forEach((view, i) => apply5(sources[i], view));
|
|
@@ -24910,7 +25668,9 @@ var SUPPORTED = /* @__PURE__ */ new Set([
|
|
|
24910
25668
|
"bubble",
|
|
24911
25669
|
"stock",
|
|
24912
25670
|
"treemap",
|
|
24913
|
-
"sunburst"
|
|
25671
|
+
"sunburst",
|
|
25672
|
+
"funnel",
|
|
25673
|
+
"boxWhisker"
|
|
24914
25674
|
]);
|
|
24915
25675
|
function chartSummaryView(chart, theme2, options2 = {}) {
|
|
24916
25676
|
const type = chart.chartType;
|
|
@@ -24968,10 +25728,17 @@ function chartSummaryView(chart, theme2, options2 = {}) {
|
|
|
24968
25728
|
showLegend: chart.showLegend,
|
|
24969
25729
|
legendPosition: chart.legendPosition ?? "r",
|
|
24970
25730
|
categories,
|
|
24971
|
-
series,
|
|
25731
|
+
series: type === "boxWhisker" ? series.filter((s) => !s.hidden) : series,
|
|
24972
25732
|
horizontal: type === "bar",
|
|
24973
25733
|
supported: SUPPORTED.has(type)
|
|
24974
25734
|
};
|
|
25735
|
+
const table2 = chartDataTableView(chart, theme2, ctx.drawingColor);
|
|
25736
|
+
if (table2) model.dataTable = table2;
|
|
25737
|
+
if (chart.date1904 !== void 0) model.date1904 = chart.date1904;
|
|
25738
|
+
if (chart.axes?.some((a2) => a2.kind === "date")) model.dateCategories = firstCats.map(toNumber);
|
|
25739
|
+
if (chart.plotLayout) model.plotLayout = chart.plotLayout;
|
|
25740
|
+
if (type === "boxWhisker")
|
|
25741
|
+
model.categories = [...new Set(model.series.flatMap((s) => s.boxCategories ?? []))];
|
|
24975
25742
|
if (chart.title) model.title = chart.title;
|
|
24976
25743
|
const titleFormatting = chart.formatting?.entries.title;
|
|
24977
25744
|
if (titleFormatting?.layout) model.titleLayout = titleFormatting.layout;
|
|
@@ -24993,6 +25760,11 @@ function chartSummaryView(chart, theme2, options2 = {}) {
|
|
|
24993
25760
|
const range2 = extentOf(xs);
|
|
24994
25761
|
model.xAxis = xs.length ? niceScale(range2.min, range2.max) : niceScale(0, 1);
|
|
24995
25762
|
}
|
|
25763
|
+
if (type === "funnel" || type === "boxWhisker")
|
|
25764
|
+
series.forEach((s, i) => {
|
|
25765
|
+
const points2 = chart.series[i]?.pointColors;
|
|
25766
|
+
if (points2) s.pointColors = s.values.map((_, j) => drawingColor2(points2[j]) ?? s.color);
|
|
25767
|
+
});
|
|
24996
25768
|
if (type === "stock") model.stock = stockView(chart.stock, ctx);
|
|
24997
25769
|
if (type === "bubble") bubbleView(chart, model, ctx.evaluateRef);
|
|
24998
25770
|
if (type === "treemap" || type === "sunburst") hierarchyView(chart, model, ctx.evaluateRef);
|
|
@@ -25001,7 +25773,7 @@ function chartSummaryView(chart, theme2, options2 = {}) {
|
|
|
25001
25773
|
chartExtraView(chart, model, ctx, total, collect);
|
|
25002
25774
|
if (type === "waterfall") waterfallView(chart, model, ctx);
|
|
25003
25775
|
else if (!byPoint) model.valueAxis = valueAxis(model);
|
|
25004
|
-
applyDataLabels(model, chart.series, extra);
|
|
25776
|
+
applyDataLabels(model, chart.series, extra, ctx.drawingColor);
|
|
25005
25777
|
chartExtraAxes(model);
|
|
25006
25778
|
applyChartAxes(model, chart, ctx.drawingColor);
|
|
25007
25779
|
return model;
|
|
@@ -25065,10 +25837,14 @@ function withHierarchyRanges(workbook, chart) {
|
|
|
25065
25837
|
}
|
|
25066
25838
|
function chartView(workbook, sheetIndex, chart, evaluateRef2) {
|
|
25067
25839
|
const theme2 = workbook.theme;
|
|
25068
|
-
return chartSummaryView(
|
|
25069
|
-
|
|
25070
|
-
|
|
25071
|
-
|
|
25840
|
+
return chartSummaryView(
|
|
25841
|
+
{ ...withHierarchyRanges(workbook, chart), date1904: chart.date1904 ?? workbook.date1904 },
|
|
25842
|
+
theme2,
|
|
25843
|
+
{
|
|
25844
|
+
evaluateRef: evaluateRef2,
|
|
25845
|
+
seriesColor: (series) => resolveColor(series.color, theme2)
|
|
25846
|
+
}
|
|
25847
|
+
);
|
|
25072
25848
|
}
|
|
25073
25849
|
|
|
25074
25850
|
// xlsx/ui/dialogs/insert-chart-model.ts
|
|
@@ -25695,7 +26471,7 @@ function extension(node3, name3) {
|
|
|
25695
26471
|
(ext) => themeChildren(ext, name3, THEME_NS)
|
|
25696
26472
|
)[0];
|
|
25697
26473
|
}
|
|
25698
|
-
function
|
|
26474
|
+
function integer4(value3) {
|
|
25699
26475
|
if (!value3 || !/^\d{1,6}$/.test(value3)) return void 0;
|
|
25700
26476
|
return Number(value3);
|
|
25701
26477
|
}
|
|
@@ -25721,7 +26497,7 @@ function drawingPaint(node3, colors, placeholder3, depth = 0) {
|
|
|
25721
26497
|
if (!color2 || color2.transforms.length > 32) return void 0;
|
|
25722
26498
|
const transforms = color2.transforms.filter((transform2) => transform2.name !== "hueMod");
|
|
25723
26499
|
if (transforms.some(
|
|
25724
|
-
(transform2) => !SUPPORTED_TRANSFORMS.has(transform2.name) || (
|
|
26500
|
+
(transform2) => !SUPPORTED_TRANSFORMS.has(transform2.name) || (integer4(transform2.value) ?? 100001) > 1e5
|
|
25725
26501
|
))
|
|
25726
26502
|
return void 0;
|
|
25727
26503
|
let rgb6;
|
|
@@ -25753,7 +26529,7 @@ function drawingColor(node3, colors, placeholder3) {
|
|
|
25753
26529
|
}
|
|
25754
26530
|
|
|
25755
26531
|
// visio/theme-resolve.ts
|
|
25756
|
-
var cellNumber = (cells4, name3) =>
|
|
26532
|
+
var cellNumber = (cells4, name3) => integer4(cells4?.get(name3)?.value);
|
|
25757
26533
|
function rootThemeSelected(cells4, resources) {
|
|
25758
26534
|
const local = cellNumber(cells4, "ColorSchemeIndex");
|
|
25759
26535
|
return local === 0 || local === 65534 && cellNumber(resources.pageCells, "ColorSchemeIndex") === 0;
|
|
@@ -25811,7 +26587,7 @@ function themeFormat(cells4, category, resources) {
|
|
|
25811
26587
|
if (matrix4 !== void 0 && matrix4 >= 100 && matrix4 <= 103) {
|
|
25812
26588
|
const variant = inheritedIndex(cells4, resources.pageCells, "VariationStyleIndex", 0);
|
|
25813
26589
|
const style2 = variant === void 0 ? void 0 : effect.variationStyles[variant]?.[matrix4 - 100];
|
|
25814
|
-
matrix4 =
|
|
26590
|
+
matrix4 = integer4(
|
|
25815
26591
|
style2?.getAttribute(`${category === "Effects" ? "effect" : category.toLowerCase()}Idx`)
|
|
25816
26592
|
);
|
|
25817
26593
|
}
|
|
@@ -25905,7 +26681,7 @@ function themeLinearGradient(sheet, resources, width, height, report) {
|
|
|
25905
26681
|
return reject();
|
|
25906
26682
|
const stops = [];
|
|
25907
26683
|
for (const node3 of nodes) {
|
|
25908
|
-
const position =
|
|
26684
|
+
const position = integer4(node3.getAttribute("pos"));
|
|
25909
26685
|
const paint2 = drawingPaint(colorChoice(node3), context.colors, context.base);
|
|
25910
26686
|
if (position === void 0 || position > 1e5 || !paint2 || position / 1e5 < (stops.at(-1)?.offset ?? 0))
|
|
25911
26687
|
return reject();
|
|
@@ -28117,12 +28893,12 @@ function shapeLayers(sheet, layers2, report, budget = createLayerBudget()) {
|
|
|
28117
28893
|
|
|
28118
28894
|
// visio/page-theme.ts
|
|
28119
28895
|
function visioPageTheme(themes, pageCells) {
|
|
28120
|
-
const id3 =
|
|
28896
|
+
const id3 = integer4(pageCells.get("ColorSchemeIndex")?.value);
|
|
28121
28897
|
if (!themes || id3 === void 0 || id3 === 0 || id3 >= 65534) return void 0;
|
|
28122
28898
|
const matches2 = themes.filter((theme3) => theme3.colorId === id3);
|
|
28123
28899
|
if (matches2.length !== 1) return void 0;
|
|
28124
28900
|
const theme2 = matches2[0];
|
|
28125
|
-
const variant = Math.min(3,
|
|
28901
|
+
const variant = Math.min(3, integer4(pageCells.get("VariationColorIndex")?.value) ?? 0);
|
|
28126
28902
|
const accents = [1, 2, 3, 4, 5, 6].map(
|
|
28127
28903
|
(index2) => drawingColor(theme2.colors.get(`accent${index2}`), theme2.colors) ?? "#808080"
|
|
28128
28904
|
);
|
|
@@ -28379,7 +29155,7 @@ var VISIO_SCHEME_SLOTS = [
|
|
|
28379
29155
|
"accent5",
|
|
28380
29156
|
"accent6"
|
|
28381
29157
|
];
|
|
28382
|
-
var componentId = (node3) =>
|
|
29158
|
+
var componentId = (node3) => integer4(themeChild(node3, "schemeID", THEME_NS)?.getAttribute("schemeEnum"));
|
|
28383
29159
|
async function loadVisioThemes(pkg, source, report) {
|
|
28384
29160
|
const result2 = [];
|
|
28385
29161
|
for (const rel of (await pkg.relationships(source)).values()) {
|
|
@@ -28420,7 +29196,7 @@ async function loadVisioThemes(pkg, source, report) {
|
|
|
28420
29196
|
const name3 = root2.getAttribute("name");
|
|
28421
29197
|
result2.push({
|
|
28422
29198
|
...name3 ? { name: name3.slice(0, 256) } : {},
|
|
28423
|
-
colorId:
|
|
29199
|
+
colorId: integer4(extension(palette, "schemeID")?.getAttribute("schemeEnum")),
|
|
28424
29200
|
effectId: componentId(extension(base2, "fmtSchemeEx")),
|
|
28425
29201
|
connectorId: componentId(extension(base2, "fmtConnectorSchemeEx")),
|
|
28426
29202
|
colors,
|
|
@@ -28809,8 +29585,8 @@ function rootThemeSheet(sheet, resources, report) {
|
|
|
28809
29585
|
const root2 = resources.rootSheet;
|
|
28810
29586
|
if (!root2) return sheet;
|
|
28811
29587
|
const colorRoot = rootThemeSelected(sheet.cells, resources);
|
|
28812
|
-
const lineRoot = colorRoot ||
|
|
28813
|
-
const fillRoot = colorRoot ||
|
|
29588
|
+
const lineRoot = colorRoot || integer4(sheet.cells.get("QuickStyleLineMatrix")?.value) === 0;
|
|
29589
|
+
const fillRoot = colorRoot || integer4(sheet.cells.get("QuickStyleFillMatrix")?.value) === 0;
|
|
28814
29590
|
let cells4 = sheet.cells;
|
|
28815
29591
|
if (colorRoot)
|
|
28816
29592
|
cells4 = replaceThemed(cells4, root2.cells, ["LineColor", "FillForegnd", "FillBkgnd"], report);
|
|
@@ -29656,13 +30432,13 @@ async function parseVsdx(input, options2 = {}) {
|
|
|
29656
30432
|
const cache2 = options2.documentCache;
|
|
29657
30433
|
const cached5 = cacheMatches(cache2?.entry, pkg, options2) ? cache2.entry : void 0;
|
|
29658
30434
|
const stopRecording = cache2 && !cached5 ? pkg.record() : void 0;
|
|
29659
|
-
let
|
|
30435
|
+
let level3;
|
|
29660
30436
|
if (cached5) {
|
|
29661
|
-
|
|
29662
|
-
for (const args of
|
|
29663
|
-
} else
|
|
29664
|
-
const { documentRoot, styles, readPrintSettings, masters, masterRecords } =
|
|
29665
|
-
const resources = { ...
|
|
30437
|
+
level3 = cached5.level;
|
|
30438
|
+
for (const args of level3.reports) report(...args);
|
|
30439
|
+
} else level3 = await readDocumentLevel(pkg, documentPart2, options2, checkTime, report);
|
|
30440
|
+
const { documentRoot, styles, readPrintSettings, masters, masterRecords } = level3;
|
|
30441
|
+
const resources = { ...level3.resources };
|
|
29666
30442
|
delete resources.pageCells;
|
|
29667
30443
|
delete resources.fieldContext;
|
|
29668
30444
|
let geometryCount = 0, textCount = 0, expansionCount = 0, textRuns = 0, paragraphCount = 0;
|
|
@@ -29741,7 +30517,7 @@ async function parseVsdx(input, options2 = {}) {
|
|
|
29741
30517
|
options: optionsKey(options2),
|
|
29742
30518
|
converter: options2.metafileConverter,
|
|
29743
30519
|
reads: stopRecording(),
|
|
29744
|
-
level: { ...
|
|
30520
|
+
level: { ...level3, resources: { ...resources } },
|
|
29745
30521
|
listed: {
|
|
29746
30522
|
documentMasters,
|
|
29747
30523
|
counters: {
|
|
@@ -30806,7 +31582,7 @@ function visioThemeColorFormula(ref) {
|
|
|
30806
31582
|
const base2 = slot2 ? `THEMEVAL("${slot2[1]}")` : `RGB(${[1, 3, 5].map((index2) => parseInt(ref.base.slice(index2, index2 + 2), 16)).join(",")})`;
|
|
30807
31583
|
return `THEMEGUARD(${ref.tint ? `MSOTINT(${base2},${ref.tint})` : base2})`;
|
|
30808
31584
|
}
|
|
30809
|
-
var
|
|
31585
|
+
var integer5 = (node3) => {
|
|
30810
31586
|
const value3 = node3?.kind === "unary" && node3.operator === "-" && node3.operand.kind === "number" ? -node3.operand.value : node3?.kind === "number" ? node3.value : void 0;
|
|
30811
31587
|
return value3 !== void 0 && Number.isInteger(value3) ? value3 : void 0;
|
|
30812
31588
|
};
|
|
@@ -30817,7 +31593,7 @@ function base(node3) {
|
|
|
30817
31593
|
return SLOTS.find(([, native]) => native.toLowerCase() === name3)?.[0];
|
|
30818
31594
|
}
|
|
30819
31595
|
if (node3.name !== "RGB" || node3.args.length !== 3) return void 0;
|
|
30820
|
-
const channels = node3.args.map(
|
|
31596
|
+
const channels = node3.args.map(integer5);
|
|
30821
31597
|
if (channels.some((value3) => value3 === void 0 || value3 < 0 || value3 > 255)) return void 0;
|
|
30822
31598
|
return `#${channels.map((value3) => value3.toString(16).padStart(2, "0")).join("")}`;
|
|
30823
31599
|
}
|
|
@@ -30833,7 +31609,7 @@ function parseVisioThemeColorFormula(source) {
|
|
|
30833
31609
|
const inner = ast.args[0];
|
|
30834
31610
|
if (inner.kind === "call" && inner.name === "MSOTINT" && inner.args.length === 2) {
|
|
30835
31611
|
const from2 = base(inner.args[0]);
|
|
30836
|
-
const tint =
|
|
31612
|
+
const tint = integer5(inner.args[1]);
|
|
30837
31613
|
return from2 && tint !== void 0 && tint !== 0 && Math.abs(tint) <= 100 ? { base: from2, tint } : void 0;
|
|
30838
31614
|
}
|
|
30839
31615
|
const from = base(inner);
|
|
@@ -32783,10 +33559,10 @@ function writeInstanceCell(sheet, cell, value3, options2 = {}) {
|
|
|
32783
33559
|
async function instanceTarget(root2, shapeId2, template, code = "UNSUPPORTED_INSTANCE_EDIT") {
|
|
32784
33560
|
const containers = children2(root2, "Shapes");
|
|
32785
33561
|
if (containers.length !== 1) return void 0;
|
|
32786
|
-
const
|
|
33562
|
+
const candidates2 = children2(containers[0], "Shape").filter(
|
|
32787
33563
|
(shape) => attribute2(shape, "ID") === shapeId2
|
|
32788
33564
|
);
|
|
32789
|
-
const instance =
|
|
33565
|
+
const instance = candidates2.length === 1 ? candidates2[0] : void 0;
|
|
32790
33566
|
const masterId = instance && attribute2(instance, "Master");
|
|
32791
33567
|
if (!instance || masterId === void 0) return void 0;
|
|
32792
33568
|
try {
|
|
@@ -32918,8 +33694,8 @@ async function groupScope(instance, template, code = "UNSUPPORTED_INSTANCE_EDIT"
|
|
|
32918
33694
|
}
|
|
32919
33695
|
async function instanceScope(root2, shapeId2, template, code = "UNSUPPORTED_INSTANCE_EDIT") {
|
|
32920
33696
|
const containers = children2(root2, "Shapes");
|
|
32921
|
-
const
|
|
32922
|
-
const instance =
|
|
33697
|
+
const candidates2 = containers.length === 1 ? children2(containers[0], "Shape").filter((shape) => attribute2(shape, "ID") === shapeId2) : [];
|
|
33698
|
+
const instance = candidates2.length === 1 ? candidates2[0] : void 0;
|
|
32923
33699
|
if (!instance || !instance.hasAttribute("Master")) return void 0;
|
|
32924
33700
|
if (isGroupInstance(instance)) return groupScope(instance, template, code);
|
|
32925
33701
|
const target2 = await instanceTarget(root2, shapeId2, template, code);
|
|
@@ -35764,12 +36540,12 @@ function assertUngluedTree(root2, ids, message) {
|
|
|
35764
36540
|
function proveLocalGroupRotation(root2, edit, check) {
|
|
35765
36541
|
const groups = /* @__PURE__ */ new Set(), angleCells = /* @__PURE__ */ new Set();
|
|
35766
36542
|
if (edit.type !== "rotate-shape" && edit.type !== "move-shape") return { groups, angleCells };
|
|
35767
|
-
const
|
|
36543
|
+
const candidates2 = children2(children2(root2, "Shapes")[0], "Shape").filter(
|
|
35768
36544
|
(node3) => attribute2(node3, "ID") === edit.shapeId
|
|
35769
36545
|
);
|
|
35770
|
-
if (
|
|
36546
|
+
if (candidates2.length !== 1 || attribute2(candidates2[0], "Type") !== "Group")
|
|
35771
36547
|
return { groups, angleCells };
|
|
35772
|
-
const group2 =
|
|
36548
|
+
const group2 = candidates2[0];
|
|
35773
36549
|
assertUngluedTree(
|
|
35774
36550
|
root2,
|
|
35775
36551
|
proveLocalShapeTree(group2, check),
|
|
@@ -36240,13 +37016,13 @@ async function pageContext(pkg, pageId2) {
|
|
|
36240
37016
|
const page = pages.find((node3) => attribute2(node3, "ID") === pageId2);
|
|
36241
37017
|
const foreground = pages.filter((node3) => !yes(attribute2(node3, "Background")));
|
|
36242
37018
|
const number5 = page ? foreground.indexOf(page) + 1 : 0;
|
|
36243
|
-
const
|
|
36244
|
-
for (const key2 of STRING_PROPERTIES)
|
|
37019
|
+
const properties = await readVisioFieldProperties(pkg);
|
|
37020
|
+
for (const key2 of STRING_PROPERTIES) properties[key2] ??= "";
|
|
36245
37021
|
return {
|
|
36246
37022
|
pageName: attribute2(page, "Name") ?? attribute2(page, "NameU") ?? `Page ${pageId2}`,
|
|
36247
37023
|
...number5 ? { pageNumber: number5 } : {},
|
|
36248
37024
|
pageCount: foreground.length,
|
|
36249
|
-
properties
|
|
37025
|
+
properties,
|
|
36250
37026
|
now: visioWallClock(/* @__PURE__ */ new Date())
|
|
36251
37027
|
};
|
|
36252
37028
|
}
|
|
@@ -36418,9 +37194,39 @@ async function insertVisioTextField(pkg, pagePaths, roots2, document, edit, chec
|
|
|
36418
37194
|
return true;
|
|
36419
37195
|
}
|
|
36420
37196
|
|
|
36421
|
-
// visio/edit-resize-
|
|
36422
|
-
var
|
|
36423
|
-
function
|
|
37197
|
+
// visio/edit-resize-plan.ts
|
|
37198
|
+
var resizeClose = (a2, b) => Math.abs(a2 - b) <= 1e-10 * Math.max(1, Math.abs(a2), Math.abs(b));
|
|
37199
|
+
function assertCanonicalResizeCells(shape) {
|
|
37200
|
+
const canonical2 = [
|
|
37201
|
+
"Width",
|
|
37202
|
+
"Height",
|
|
37203
|
+
"PinX",
|
|
37204
|
+
"PinY",
|
|
37205
|
+
"LocPinX",
|
|
37206
|
+
"LocPinY",
|
|
37207
|
+
"Angle",
|
|
37208
|
+
"FlipX",
|
|
37209
|
+
"FlipY",
|
|
37210
|
+
"LockMoveX",
|
|
37211
|
+
"LockMoveY",
|
|
37212
|
+
"LockWidth",
|
|
37213
|
+
"LockHeight",
|
|
37214
|
+
"LockAspect",
|
|
37215
|
+
"LockDelete",
|
|
37216
|
+
"ResizeMode"
|
|
37217
|
+
];
|
|
37218
|
+
for (const cell of children2(shape, "Cell")) {
|
|
37219
|
+
const name3 = attribute2(cell, "N") ?? "";
|
|
37220
|
+
if (canonical2.some(
|
|
37221
|
+
(expected) => expected.toLowerCase() === name3.toLowerCase() && expected !== name3
|
|
37222
|
+
))
|
|
37223
|
+
fail(
|
|
37224
|
+
"EDIT_AMBIGUOUS_CELL",
|
|
37225
|
+
"Noncanonical transform and protection cell names are unsupported."
|
|
37226
|
+
);
|
|
37227
|
+
}
|
|
37228
|
+
}
|
|
37229
|
+
function resizeClosure(graph, changed, check) {
|
|
36424
37230
|
const reverse = /* @__PURE__ */ new Map();
|
|
36425
37231
|
for (const [id3, item2] of graph) {
|
|
36426
37232
|
check();
|
|
@@ -36443,40 +37249,128 @@ function closure(graph, changed, check) {
|
|
|
36443
37249
|
}
|
|
36444
37250
|
return affected;
|
|
36445
37251
|
}
|
|
37252
|
+
|
|
37253
|
+
// visio/edit-group-resize.ts
|
|
37254
|
+
function localGroupResize(root2, id3, document, check) {
|
|
37255
|
+
const candidates2 = children2(children2(root2, "Shapes")[0], "Shape").filter(
|
|
37256
|
+
(shape) => attribute2(shape, "ID") === id3
|
|
37257
|
+
);
|
|
37258
|
+
if (candidates2.length !== 1 || attribute2(candidates2[0], "Type") !== "Group") return void 0;
|
|
37259
|
+
const group2 = candidates2[0];
|
|
37260
|
+
const members3 = children2(children2(group2, "Shapes")[0], "Shape");
|
|
37261
|
+
if ([group2, ...members3].some(
|
|
37262
|
+
(shape) => shape.hasAttribute("Master") || shape.hasAttribute("MasterShape")
|
|
37263
|
+
) || !members3.length || members3.length > 500 || members3.some(
|
|
37264
|
+
(shape) => attribute2(shape, "Type") !== "Shape" || children2(shape, "Shapes").length
|
|
37265
|
+
))
|
|
37266
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Group resizing requires a flat local group of 2D shapes.");
|
|
37267
|
+
const ids = proveLocalShapeTree(group2, check);
|
|
37268
|
+
assertUngluedTree(root2, ids, "Group resizing cannot update glued members or group connections.");
|
|
37269
|
+
const shapes = /* @__PURE__ */ new Set([group2, ...members3]);
|
|
37270
|
+
for (const shape of shapes) {
|
|
37271
|
+
check();
|
|
37272
|
+
assertCanonicalResizeCells(shape);
|
|
37273
|
+
protectedShape(shape, document);
|
|
37274
|
+
assertUnlayeredShape(shape, document);
|
|
37275
|
+
if (shape !== group2 && Math.abs(Math.sin(numeric(cells(shape).get("Angle"), 0))) > 1e-10)
|
|
37276
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Group resizing requires axis-aligned local members.");
|
|
37277
|
+
for (const node3 of Array.from(shape.childNodes).filter(
|
|
37278
|
+
(node4) => node4.nodeType === 1 && node4.localName !== "Shapes"
|
|
37279
|
+
)) {
|
|
37280
|
+
for (const cell of [node3, ...Array.from(node3.getElementsByTagName("*"))]) {
|
|
37281
|
+
const formula2 = executableCellFormula(attribute2(cell, "F"));
|
|
37282
|
+
if (formula2 && analyzeVisioFormula(formula2).unsupportedFunctions.length)
|
|
37283
|
+
fail(
|
|
37284
|
+
"EDIT_UNSUPPORTED_FORMULA",
|
|
37285
|
+
"Group resize cannot refresh unsupported or text-measured formulas."
|
|
37286
|
+
);
|
|
37287
|
+
}
|
|
37288
|
+
}
|
|
37289
|
+
}
|
|
37290
|
+
return { group: group2, members: members3, shapes, groups: /* @__PURE__ */ new Set([group2]) };
|
|
37291
|
+
}
|
|
37292
|
+
function planGroupResize(scope2, roots2, edit, source, check) {
|
|
37293
|
+
const writes = [];
|
|
37294
|
+
const expected = /* @__PURE__ */ new Map();
|
|
37295
|
+
const read = (shape, name3, fallback) => {
|
|
37296
|
+
const local = cells(shape);
|
|
37297
|
+
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);
|
|
37298
|
+
};
|
|
37299
|
+
const mode = (shape, fallback) => {
|
|
37300
|
+
const cell = cells(shape).get("ResizeMode");
|
|
37301
|
+
if (!cell) return fallback;
|
|
37302
|
+
const formula2 = executableCellFormula(attribute2(cell, "F"));
|
|
37303
|
+
if (attribute2(cell, "F") === "Inh" || formula2 && analyzeVisioFormula(formula2).references.length || visioFormulaCachedValue("0", attribute2(cell, "U")).unit !== "scalar")
|
|
37304
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Group resize needs a constant local ResizeMode.");
|
|
37305
|
+
const value3 = read(shape, "ResizeMode");
|
|
37306
|
+
if (![0, 1, 2].includes(value3))
|
|
37307
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Unsupported group ResizeMode.");
|
|
37308
|
+
return value3 || fallback;
|
|
37309
|
+
};
|
|
37310
|
+
const width = read(scope2.group, "Width"), height = read(scope2.group, "Height");
|
|
37311
|
+
const sx = edit.width / width, sy = edit.height / height, groupMode = mode(scope2.group, 2);
|
|
37312
|
+
for (const shape of scope2.members) {
|
|
37313
|
+
check();
|
|
37314
|
+
const id3 = attribute2(shape, "ID"), local = cells(shape), scaling = mode(shape, groupMode) === 2;
|
|
37315
|
+
const childW = read(shape, "Width"), childH = read(shape, "Height");
|
|
37316
|
+
const sizeX = scaling ? sx : 1, sizeY = scaling ? sy : 1;
|
|
37317
|
+
if (numeric(local.get("LockAspect"), 0) !== 0 && !resizeClose(sizeX, sizeY))
|
|
37318
|
+
fail("EDIT_PROTECTED_CELL", "A group member LockAspect prevents resizing.");
|
|
37319
|
+
if (scaling && (!resizeClose(sx, 1) || !resizeClose(sy, 1)))
|
|
37320
|
+
resizeGeometry(
|
|
37321
|
+
shape,
|
|
37322
|
+
roots2,
|
|
37323
|
+
{ ...edit, shapeId: id3 },
|
|
37324
|
+
check,
|
|
37325
|
+
/* @__PURE__ */ new Set(),
|
|
37326
|
+
/* @__PURE__ */ new Set(),
|
|
37327
|
+
scope2.shapes
|
|
37328
|
+
);
|
|
37329
|
+
for (const [name3, factor, formula2, lock] of [
|
|
37330
|
+
["PinX", sx, `Sheet.${edit.shapeId}!Width*${read(shape, "PinX") / width}`, "LockMoveX"],
|
|
37331
|
+
["PinY", sy, `Sheet.${edit.shapeId}!Height*${read(shape, "PinY") / height}`, "LockMoveY"],
|
|
37332
|
+
["Width", sizeX, `Sheet.${edit.shapeId}!Width*${childW / width}`, "LockWidth"],
|
|
37333
|
+
["Height", sizeY, `Sheet.${edit.shapeId}!Height*${childH / height}`, "LockHeight"],
|
|
37334
|
+
["LocPinX", sizeX, `Width*${read(shape, "LocPinX") / childW}`, ""],
|
|
37335
|
+
["LocPinY", sizeY, `Height*${read(shape, "LocPinY") / childH}`, ""]
|
|
37336
|
+
]) {
|
|
37337
|
+
const old = read(shape, name3), value3 = old * factor;
|
|
37338
|
+
if (!Number.isFinite(value3) || Math.abs(value3) > 1e6 || ["Width", "Height"].includes(name3) && value3 <= 0)
|
|
37339
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Resized group member exceeds coordinate limits.");
|
|
37340
|
+
expected.set(key({ pageId: edit.pageId, shapeId: id3, cell: name3 }), value3);
|
|
37341
|
+
if (resizeClose(value3, old)) continue;
|
|
37342
|
+
if (lock && numeric(local.get(lock), 0) !== 0)
|
|
37343
|
+
fail("EDIT_PROTECTED_CELL", `A group member ${lock} prevents resizing.`);
|
|
37344
|
+
const node3 = local.get(name3);
|
|
37345
|
+
const existing = executableCellFormula(attribute2(node3, "F"));
|
|
37346
|
+
if (guardedCell(node3) || existing && analyzeVisioFormula(existing).references.length)
|
|
37347
|
+
continue;
|
|
37348
|
+
editableCell(
|
|
37349
|
+
node3,
|
|
37350
|
+
(reference2) => source(
|
|
37351
|
+
key({ pageId: edit.pageId, shapeId: reference2.shapeId ?? id3, cell: reference2.cell })
|
|
37352
|
+
)
|
|
37353
|
+
);
|
|
37354
|
+
writes.push({ shape, name: name3, value: value3, formula: formula2 });
|
|
37355
|
+
}
|
|
37356
|
+
for (const name3 of ["Angle", "FlipX", "FlipY"])
|
|
37357
|
+
expected.set(key({ pageId: edit.pageId, shapeId: id3, cell: name3 }), read(shape, name3, 0));
|
|
37358
|
+
}
|
|
37359
|
+
return { writes, expected };
|
|
37360
|
+
}
|
|
37361
|
+
|
|
37362
|
+
// visio/edit-resize-anchor.ts
|
|
36446
37363
|
function resizeVisioShapeAtAnchor(roots2, document, edit, check, glueShapes = /* @__PURE__ */ new Set()) {
|
|
36447
37364
|
check();
|
|
36448
37365
|
const root2 = roots2.get(edit.pageId);
|
|
36449
37366
|
if (!root2) fail("EDIT_TARGET_NOT_FOUND", "Page does not exist.");
|
|
36450
|
-
const
|
|
37367
|
+
const group2 = localGroupResize(root2, edit.shapeId, document, check);
|
|
37368
|
+
const shape = admitted(root2, edit.shapeId, /* @__PURE__ */ new Set(), /* @__PURE__ */ new Map(), void 0, group2?.groups);
|
|
36451
37369
|
const local = cells(shape);
|
|
36452
|
-
|
|
36453
|
-
"Width",
|
|
36454
|
-
"Height",
|
|
36455
|
-
"PinX",
|
|
36456
|
-
"PinY",
|
|
36457
|
-
"LocPinX",
|
|
36458
|
-
"LocPinY",
|
|
36459
|
-
"Angle",
|
|
36460
|
-
"FlipX",
|
|
36461
|
-
"FlipY",
|
|
36462
|
-
"LockMoveX",
|
|
36463
|
-
"LockMoveY",
|
|
36464
|
-
"LockWidth",
|
|
36465
|
-
"LockHeight",
|
|
36466
|
-
"LockAspect",
|
|
36467
|
-
"LockDelete"
|
|
36468
|
-
];
|
|
36469
|
-
for (const name3 of local.keys())
|
|
36470
|
-
if (canonical2.some(
|
|
36471
|
-
(expected) => expected.toLowerCase() === name3.toLowerCase() && expected !== name3
|
|
36472
|
-
))
|
|
36473
|
-
fail(
|
|
36474
|
-
"EDIT_AMBIGUOUS_CELL",
|
|
36475
|
-
"Noncanonical transform and protection cell names are unsupported."
|
|
36476
|
-
);
|
|
37370
|
+
assertCanonicalResizeCells(shape);
|
|
36477
37371
|
if (!edit.anchor || isLineSheet(cells(shape)) || edit.height <= 0)
|
|
36478
37372
|
fail("UNSUPPORTED_GEOMETRY_EDIT", "Anchored resizing requires an ordinary local 2D shape.");
|
|
36479
|
-
if (Array.from(shape.getElementsByTagName("*")).some(
|
|
37373
|
+
if (!group2 && Array.from(shape.getElementsByTagName("*")).some(
|
|
36480
37374
|
(node3) => node3.localName === "Shape" && [VISIO_NS, VISIO_LEGACY_NS].includes(node3.namespaceURI ?? "")
|
|
36481
37375
|
))
|
|
36482
37376
|
fail("UNSUPPORTED_GEOMETRY_EDIT", "Nested shape identities cannot be resized as a local leaf.");
|
|
@@ -36486,7 +37380,11 @@ function resizeVisioShapeAtAnchor(roots2, document, edit, check, glueShapes = /*
|
|
|
36486
37380
|
for (const connection of children2(container, "Connect"))
|
|
36487
37381
|
if (!glueShapes.has(shape) && ["FromSheet", "ToSheet"].some((name3) => attribute2(connection, name3) === edit.shapeId))
|
|
36488
37382
|
fail("UNSUPPORTED_GEOMETRY_EDIT", "Glued shapes require routing outside this subset.");
|
|
36489
|
-
const graph = indexCells(roots2, {
|
|
37383
|
+
const graph = indexCells(roots2, {
|
|
37384
|
+
check,
|
|
37385
|
+
glueShapes,
|
|
37386
|
+
...group2 ? { groupResizeShapes: group2.shapes } : {}
|
|
37387
|
+
});
|
|
36490
37388
|
const id3 = (cell) => key({ pageId: edit.pageId, shapeId: edit.shapeId, cell });
|
|
36491
37389
|
const source = createVisioCellEvaluator(graph, { check, glueShapes }, true);
|
|
36492
37390
|
const read = (name3, fallback) => graph.has(id3(name3)) ? source(id3(name3)).value : numeric(local.get(name3), fallback);
|
|
@@ -36502,8 +37400,9 @@ function resizeVisioShapeAtAnchor(roots2, document, edit, check, glueShapes = /*
|
|
|
36502
37400
|
if (![0, 1].includes(flipX) || ![0, 1].includes(flipY))
|
|
36503
37401
|
fail("EDIT_FORMULA_UNIT", "Flip cells must be scalar booleans.");
|
|
36504
37402
|
if (width === edit.width && height === edit.height) return [];
|
|
36505
|
-
|
|
36506
|
-
|
|
37403
|
+
if (!group2 || children2(shape, "Section").some((section3) => attribute2(section3, "N") === "Geometry"))
|
|
37404
|
+
resizeGeometry(shape, roots2, edit, check, /* @__PURE__ */ new Set(), glueShapes, group2?.shapes);
|
|
37405
|
+
if (numeric(local.get("LockAspect"), 0) !== 0 && !resizeClose(edit.width / width, edit.height / height))
|
|
36507
37406
|
fail("EDIT_PROTECTED_CELL", "LockAspect prevents changing the aspect ratio.");
|
|
36508
37407
|
const geometry = visioAnchoredResizeGeometry(
|
|
36509
37408
|
{
|
|
@@ -36545,19 +37444,21 @@ function resizeVisioShapeAtAnchor(roots2, document, edit, check, glueShapes = /*
|
|
|
36545
37444
|
writes.push({ name: name3, value: value3 });
|
|
36546
37445
|
}
|
|
36547
37446
|
const changedDimensions = writes.map((write2) => id3(write2.name));
|
|
36548
|
-
const dimensionClosure =
|
|
37447
|
+
const dimensionClosure = resizeClosure(graph, changedDimensions, check);
|
|
36549
37448
|
for (const [name3, value3, old] of [
|
|
36550
37449
|
["PinX", geometry.pinX, pinX],
|
|
36551
37450
|
["PinY", geometry.pinY, pinY]
|
|
36552
37451
|
])
|
|
36553
|
-
if (!local.has(name3) || !
|
|
36554
|
-
if (!
|
|
37452
|
+
if (!local.has(name3) || !resizeClose(value3, old) || dimensionClosure.has(id3(name3)) && !guardedCell(local.get(name3))) {
|
|
37453
|
+
if (!resizeClose(value3, old)) unlocked(name3 === "PinX" ? "LockMoveX" : "LockMoveY");
|
|
36555
37454
|
writable(name3);
|
|
36556
|
-
writes.push({ name: name3, value:
|
|
37455
|
+
writes.push({ name: name3, value: resizeClose(value3, old) ? old : value3 });
|
|
36557
37456
|
}
|
|
36558
37457
|
const projected = new Map(graph);
|
|
37458
|
+
const writeId = (write2) => key({ pageId: edit.pageId, shapeId: attribute2(write2.shape ?? shape, "ID"), cell: write2.name });
|
|
36559
37459
|
const install = (write2) => {
|
|
36560
|
-
const
|
|
37460
|
+
const owner = write2.shape ?? shape, ownerId2 = attribute2(owner, "ID");
|
|
37461
|
+
const original = cells(owner).get(write2.name);
|
|
36561
37462
|
const node3 = original ? original.cloneNode(true) : shape.ownerDocument.createElementNS(shape.namespaceURI, "Cell");
|
|
36562
37463
|
node3.setAttribute("N", write2.name);
|
|
36563
37464
|
node3.setAttribute("V", String(write2.value));
|
|
@@ -36565,7 +37466,7 @@ function resizeVisioShapeAtAnchor(roots2, document, edit, check, glueShapes = /*
|
|
|
36565
37466
|
else node3.removeAttribute("F");
|
|
36566
37467
|
const cell = {
|
|
36567
37468
|
pageId: edit.pageId,
|
|
36568
|
-
shapeId:
|
|
37469
|
+
shapeId: ownerId2,
|
|
36569
37470
|
cell: write2.name,
|
|
36570
37471
|
node: node3,
|
|
36571
37472
|
unsafe: false,
|
|
@@ -36574,9 +37475,11 @@ function resizeVisioShapeAtAnchor(roots2, document, edit, check, glueShapes = /*
|
|
|
36574
37475
|
};
|
|
36575
37476
|
if (write2.formula) {
|
|
36576
37477
|
cell.formula = parseVisioFormula(write2.formula);
|
|
36577
|
-
cell.dependencies =
|
|
37478
|
+
cell.dependencies = analyzeVisioFormula(cell.formula).references.map(
|
|
37479
|
+
(reference2) => key({ pageId: edit.pageId, shapeId: reference2.shapeId ?? ownerId2, cell: reference2.cell })
|
|
37480
|
+
);
|
|
36578
37481
|
}
|
|
36579
|
-
projected.set(
|
|
37482
|
+
projected.set(writeId(write2), cell);
|
|
36580
37483
|
};
|
|
36581
37484
|
for (const write2 of writes) install(write2);
|
|
36582
37485
|
const guardedPins = [];
|
|
@@ -36596,16 +37499,17 @@ function resizeVisioShapeAtAnchor(roots2, document, edit, check, glueShapes = /*
|
|
|
36596
37499
|
}
|
|
36597
37500
|
const projectedPins = createVisioCellEvaluator(projected, { check });
|
|
36598
37501
|
for (const pin of guardedPins)
|
|
36599
|
-
if (!
|
|
37502
|
+
if (!resizeClose(projectedPins(id3(pin.name)).value, pin.value))
|
|
36600
37503
|
fail(
|
|
36601
37504
|
"EDIT_PROTECTED_CELL",
|
|
36602
37505
|
"Guarded local pin does not scale proportionally with the requested dimension."
|
|
36603
37506
|
);
|
|
36604
|
-
const
|
|
36605
|
-
|
|
36606
|
-
writes.
|
|
36607
|
-
|
|
36608
|
-
|
|
37507
|
+
const members3 = group2 && planGroupResize(group2, roots2, edit, source, check);
|
|
37508
|
+
for (const write2 of members3?.writes ?? []) {
|
|
37509
|
+
writes.push(write2);
|
|
37510
|
+
install(write2);
|
|
37511
|
+
}
|
|
37512
|
+
const affected = resizeClosure(projected, writes.map(writeId), check);
|
|
36609
37513
|
for (const name3 of ["Angle", "FlipX", "FlipY"])
|
|
36610
37514
|
if (affected.has(id3(name3)))
|
|
36611
37515
|
fail(
|
|
@@ -36631,17 +37535,23 @@ function resizeVisioShapeAtAnchor(roots2, document, edit, check, glueShapes = /*
|
|
|
36631
37535
|
["LocPinX", geometry.locPinX],
|
|
36632
37536
|
["LocPinY", geometry.locPinY]
|
|
36633
37537
|
])
|
|
36634
|
-
if (!
|
|
37538
|
+
if (!resizeClose(projected.has(id3(name3)) ? evaluate(id3(name3)).value : read(name3), expected))
|
|
36635
37539
|
fail(
|
|
36636
37540
|
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
36637
37541
|
"Dependent formulas would violate the requested anchor or dimensions."
|
|
36638
37542
|
);
|
|
37543
|
+
for (const [cellId, expected] of members3?.expected ?? [])
|
|
37544
|
+
if (!resizeClose(projected.has(cellId) ? evaluate(cellId).value : 0, expected))
|
|
37545
|
+
fail(
|
|
37546
|
+
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
37547
|
+
"Dependent formulas would violate a resized group member pose."
|
|
37548
|
+
);
|
|
36639
37549
|
check();
|
|
36640
|
-
for (const write2 of writes) setCell(shape, write2.name, write2.value, write2.formula);
|
|
37550
|
+
for (const write2 of writes) setCell(write2.shape ?? shape, write2.name, write2.value, write2.formula);
|
|
36641
37551
|
const dirty = /* @__PURE__ */ new Set([edit.pageId]);
|
|
36642
37552
|
for (const [cellId, value3] of values) {
|
|
36643
37553
|
const item2 = graph.get(cellId);
|
|
36644
|
-
if (!item2?.node || !item2.formula || writes.some((write2) =>
|
|
37554
|
+
if (!item2?.node || !item2.formula || writes.some((write2) => writeId(write2) === cellId)) continue;
|
|
36645
37555
|
if (attribute2(item2.node, "V") !== String(value3)) {
|
|
36646
37556
|
item2.node.setAttribute("V", String(value3));
|
|
36647
37557
|
dirty.add(item2.pageId);
|
|
@@ -37469,6 +38379,23 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
|
|
|
37469
38379
|
cell
|
|
37470
38380
|
}))
|
|
37471
38381
|
);
|
|
38382
|
+
const groupResizeShapes = /* @__PURE__ */ new Set();
|
|
38383
|
+
const groupResizePages = /* @__PURE__ */ new Set();
|
|
38384
|
+
for (const command2 of commands) {
|
|
38385
|
+
if (command2.type !== "resize-shape" || !command2.anchor) continue;
|
|
38386
|
+
const group2 = children2(children2(roots2.get(command2.pageId), "Shapes")[0], "Shape").find(
|
|
38387
|
+
(shape) => attribute2(shape, "ID") === command2.shapeId && attribute2(shape, "Type") === "Group" && !shape.hasAttribute("Master")
|
|
38388
|
+
);
|
|
38389
|
+
if (!group2) continue;
|
|
38390
|
+
groupResizePages.add(command2.pageId);
|
|
38391
|
+
groupResizeShapes.add(group2);
|
|
38392
|
+
for (const member2 of Array.from(group2.getElementsByTagNameNS(group2.namespaceURI, "Shape"))) {
|
|
38393
|
+
check();
|
|
38394
|
+
groupResizeShapes.add(member2);
|
|
38395
|
+
for (const cell of ["PinX", "PinY", "Width", "Height", "LocPinX", "LocPinY"])
|
|
38396
|
+
changed.push({ pageId: command2.pageId, shapeId: attribute2(member2, "ID"), cell });
|
|
38397
|
+
}
|
|
38398
|
+
}
|
|
37472
38399
|
const deleting = commands.filter((command2) => command2.type === "delete-shape");
|
|
37473
38400
|
let query;
|
|
37474
38401
|
const hasMasterInstances = [...roots2.values()].some(
|
|
@@ -37481,7 +38408,7 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
|
|
|
37481
38408
|
const key2 = JSON.stringify([pageId2, shapeId2, cell.toLowerCase()]);
|
|
37482
38409
|
let result2 = dependencyCache.get(key2);
|
|
37483
38410
|
if (result2 === void 0) {
|
|
37484
|
-
query ??= createVisioDependencyQuery(roots2, { check });
|
|
38411
|
+
query ??= createVisioDependencyQuery(roots2, { check, groupResizeShapes });
|
|
37485
38412
|
result2 = query({ pageId: pageId2, shapeId: shapeId2, cell }, changed);
|
|
37486
38413
|
dependencyCache.set(key2, result2);
|
|
37487
38414
|
}
|
|
@@ -37537,6 +38464,11 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
|
|
|
37537
38464
|
const item2 = pending2.pop(), node3 = item2.node;
|
|
37538
38465
|
const pageId2 = admitted2(node3) && node3.localName === "Page" && root2.localName === "Pages" ? attribute2(node3, "ID") : item2.pageId;
|
|
37539
38466
|
const style2 = item2.style || admitted2(node3) && node3.localName === "StyleSheets";
|
|
38467
|
+
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") ?? "")))
|
|
38468
|
+
fail(
|
|
38469
|
+
"UNSUPPORTED_GEOMETRY_EDIT",
|
|
38470
|
+
"Nondefault page-level ResizeMode is not supported for group resizing."
|
|
38471
|
+
);
|
|
37540
38472
|
if (admitted2(node3) && !style2) {
|
|
37541
38473
|
inspectFormula(node3, path3, pageId2);
|
|
37542
38474
|
if (deleting.some(
|
|
@@ -38972,12 +39904,12 @@ function targetShape(root2, shapeId2) {
|
|
|
38972
39904
|
const containers = children2(root2, "Shapes");
|
|
38973
39905
|
if (containers.length !== 1)
|
|
38974
39906
|
fail("UNSUPPORTED_FORMAT_EDIT", "One local Shapes container is required.");
|
|
38975
|
-
const
|
|
39907
|
+
const candidates2 = children2(containers[0], "Shape").filter(
|
|
38976
39908
|
(shape2) => attribute2(shape2, "ID") === shapeId2
|
|
38977
39909
|
);
|
|
38978
|
-
if (
|
|
39910
|
+
if (candidates2.length !== 1)
|
|
38979
39911
|
fail("EDIT_TARGET_NOT_FOUND", "A unique top-level local shape is required.");
|
|
38980
|
-
const shape =
|
|
39912
|
+
const shape = candidates2[0];
|
|
38981
39913
|
if (shape.hasAttribute("Master") || shape.hasAttribute("MasterShape") || shape.hasAttribute("Del") || children2(shape, "Shapes").length || children2(shape, "ForeignData").length || children2(shape, "Rel").length || !["Shape", void 0].includes(attribute2(shape, "Type")))
|
|
38982
39914
|
fail(
|
|
38983
39915
|
"UNSUPPORTED_FORMAT_EDIT",
|
|
@@ -40522,10 +41454,10 @@ function groupVisioShapes(root2, document, edit, check, instances = NONE) {
|
|
|
40522
41454
|
}
|
|
40523
41455
|
function ungroupVisioShape(root2, document, edit, check, instances = NONE) {
|
|
40524
41456
|
check();
|
|
40525
|
-
const
|
|
40526
|
-
if (
|
|
41457
|
+
const candidates2 = topLevel(root2).filter((shape) => attribute2(shape, "ID") === edit.shapeId);
|
|
41458
|
+
if (candidates2.length !== 1 || attribute2(candidates2[0], "Type") !== "Group")
|
|
40527
41459
|
fail("EDIT_TARGET_NOT_FOUND", "A unique top-level local group is required.");
|
|
40528
|
-
const group2 =
|
|
41460
|
+
const group2 = candidates2[0];
|
|
40529
41461
|
const members3 = children2(children2(group2, "Shapes")[0], "Shape");
|
|
40530
41462
|
if (!members3.length) fail("UNSUPPORTED_GROUP_EDIT", "The group has no member shapes.");
|
|
40531
41463
|
const subtree = proveLocalShapeTree(group2, check);
|
|
@@ -42202,6 +43134,11 @@ async function editVsdxTransaction(input, edits, options2, clock = {
|
|
|
42202
43134
|
dirty.set(pages.get(pageId2), roots2.get(pageId2));
|
|
42203
43135
|
duplicateChanged = true;
|
|
42204
43136
|
} 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)) {
|
|
43137
|
+
if (command2.type === "resize-shape" && command2.anchor) {
|
|
43138
|
+
const target2 = topShape(root2, command2.shapeId);
|
|
43139
|
+
if (attribute2(target2, "Type") === "Group" && !target2?.hasAttribute("Master"))
|
|
43140
|
+
await assertGeometryPackageScope(pkg, new Set(pages.values()), [command2], check, roots2);
|
|
43141
|
+
}
|
|
42205
43142
|
const changedPages = instanceCommands.has(command2) && isInstanceGeometryEdit(roots2, command2) ? await applyInstanceGeometryEdit(roots2, command2, masterTemplate(pkg), check) : applyGeometryEdit(roots2, document, command2, check, masterMovePins);
|
|
42206
43143
|
for (const pageId2 of changedPages) dirty.set(pages.get(pageId2), roots2.get(pageId2));
|
|
42207
43144
|
if (changedPages.length && ["move-shape", "resize-shape", "rotate-shape", "flip-shape"].includes(command2.type))
|
|
@@ -43645,9 +44582,9 @@ function visioNextShapeId(page) {
|
|
|
43645
44582
|
|
|
43646
44583
|
// visio/ui/formatting.ts
|
|
43647
44584
|
function visioLocalFormattingShape(page, shapeId2) {
|
|
43648
|
-
const
|
|
43649
|
-
if (
|
|
43650
|
-
const shape =
|
|
44585
|
+
const candidates2 = page.shapes.filter((shape2) => shape2.id === shapeId2);
|
|
44586
|
+
if (candidates2.length !== 1) return void 0;
|
|
44587
|
+
const shape = candidates2[0];
|
|
43651
44588
|
if (shape.hidden || shape.masterId || shape.layerIds?.length || shape.children.length || !["shape", "connector"].includes(shape.kind) || shape.image || shape.foreignVector)
|
|
43652
44589
|
return void 0;
|
|
43653
44590
|
return shape;
|
|
@@ -43662,8 +44599,8 @@ function holdsForeign(shape) {
|
|
|
43662
44599
|
return pending2.length > 0;
|
|
43663
44600
|
}
|
|
43664
44601
|
function visioStencilInstanceShape(page, shapeId2) {
|
|
43665
|
-
const
|
|
43666
|
-
const shape =
|
|
44602
|
+
const candidates2 = page.shapes.filter((shape2) => shape2.id === shapeId2);
|
|
44603
|
+
const shape = candidates2.length === 1 ? candidates2[0] : void 0;
|
|
43667
44604
|
if (!shape?.masterId || shape.hidden || (shape.kind === "group" ? !shape.children.length : shape.kind !== "shape") || shape.kind === "shape" && shape.children.length > 0 || holdsForeign(shape) || shape.layerIds?.some(
|
|
43668
44605
|
(layer) => page.layers?.find((entry3) => entry3.id === layer)?.locked !== false
|
|
43669
44606
|
))
|
|
@@ -43687,8 +44624,8 @@ function visioFormatTargetShape(page, shapeId2) {
|
|
|
43687
44624
|
return visioStyleFormattingShape(page, shapeId2) ?? visioStencilSubShape(page, shapeId2);
|
|
43688
44625
|
}
|
|
43689
44626
|
function visioStencilShape(page, shapeId2) {
|
|
43690
|
-
const
|
|
43691
|
-
const shape =
|
|
44627
|
+
const candidates2 = page.shapes.filter((shape2) => shape2.id === shapeId2);
|
|
44628
|
+
const shape = candidates2.length === 1 ? candidates2[0] : void 0;
|
|
43692
44629
|
if (!shape?.masterId || shape.hidden || !["shape", "group"].includes(shape.kind) || shape.image || shape.foreignVector || shape.layerIds?.some(
|
|
43693
44630
|
(layer) => page.layers?.find((entry3) => entry3.id === layer)?.locked !== false
|
|
43694
44631
|
))
|
|
@@ -44144,7 +45081,7 @@ function snapshotSelection(model, pageIndex, input, visible) {
|
|
|
44144
45081
|
if (length > VISIO_VISIBILITY_LIMITS.maxShapes)
|
|
44145
45082
|
throw new Error("Selection exceeds the supported shape count.");
|
|
44146
45083
|
const page = model?.pages[pageIndex];
|
|
44147
|
-
const
|
|
45084
|
+
const candidates2 = /* @__PURE__ */ new Map();
|
|
44148
45085
|
for (let index2 = 0; index2 < length; index2++) {
|
|
44149
45086
|
const item2 = input[index2];
|
|
44150
45087
|
const id3 = item2?.id, name3 = item2?.name, pageId2 = item2?.pageId;
|
|
@@ -44152,7 +45089,7 @@ function snapshotSelection(model, pageIndex, input, visible) {
|
|
|
44152
45089
|
throw new Error("Selection requires shape IDs, names and optional page IDs.");
|
|
44153
45090
|
const copied = Object.freeze({ id: id3, name: name3, ...pageId2 === void 0 ? {} : { pageId: pageId2 } });
|
|
44154
45091
|
const key2 = selectionKey(copied, page?.id ?? "");
|
|
44155
|
-
if (!
|
|
45092
|
+
if (!candidates2.has(key2)) candidates2.set(key2, copied);
|
|
44156
45093
|
}
|
|
44157
45094
|
if (!model || !page || !length) return EMPTY_SELECTION;
|
|
44158
45095
|
const accepted = /* @__PURE__ */ new Map();
|
|
@@ -44162,14 +45099,14 @@ function snapshotSelection(model, pageIndex, input, visible) {
|
|
|
44162
45099
|
while (pending2.length) {
|
|
44163
45100
|
const { shape, ancestors } = pending2.pop();
|
|
44164
45101
|
const key2 = selectionKey({ id: shape.id, pageId: source.id }, page.id);
|
|
44165
|
-
if (
|
|
45102
|
+
if (candidates2.has(key2) && hasVisibleShapeContent(shape, visible, content2))
|
|
44166
45103
|
accepted.set(key2, ancestors);
|
|
44167
45104
|
for (const child3 of shape.children)
|
|
44168
45105
|
pending2.push({ shape: child3, ancestors: [...ancestors, key2] });
|
|
44169
45106
|
}
|
|
44170
45107
|
}
|
|
44171
45108
|
const result2 = [];
|
|
44172
|
-
for (const [key2, item2] of
|
|
45109
|
+
for (const [key2, item2] of candidates2) {
|
|
44173
45110
|
const ancestors = accepted.get(key2);
|
|
44174
45111
|
if (!ancestors || ancestors.some((ancestor) => accepted.has(ancestor))) continue;
|
|
44175
45112
|
result2.push(item2);
|
|
@@ -44369,8 +45306,10 @@ function visioMovementShape(page, id3) {
|
|
|
44369
45306
|
return void 0;
|
|
44370
45307
|
return shape;
|
|
44371
45308
|
}
|
|
44372
|
-
function visioPageDragDelta(start, end) {
|
|
44373
|
-
|
|
45309
|
+
function visioPageDragDelta(start, end, constrain = false) {
|
|
45310
|
+
const x = end.x - start.x, y = start.y - end.y;
|
|
45311
|
+
if (!constrain || !Number.isFinite(x) || !Number.isFinite(y)) return { x, y };
|
|
45312
|
+
return Math.abs(x) >= Math.abs(y) ? { x, y: 0 } : { x: 0, y };
|
|
44374
45313
|
}
|
|
44375
45314
|
function visioMovePreviewTransform(shape, delta) {
|
|
44376
45315
|
if (![delta.x, delta.y, ...shape.transform].every(Number.isFinite)) return void 0;
|
|
@@ -44818,6 +45757,19 @@ function visioAutoConnectPlan(page, shapeId2, direction, target2, route = "right
|
|
|
44818
45757
|
}
|
|
44819
45758
|
|
|
44820
45759
|
// visio/ui/shape-resize.ts
|
|
45760
|
+
function resizableLocalGroup(page, shape) {
|
|
45761
|
+
if (shape.kind !== "group" || shape.masterId || !shape.children.length || shape.children.length > 500)
|
|
45762
|
+
return false;
|
|
45763
|
+
const ids = /* @__PURE__ */ new Set([shape.id]);
|
|
45764
|
+
for (const member2 of shape.children) {
|
|
45765
|
+
if (ids.has(member2.id) || member2.kind !== "shape" || member2.masterId || member2.children.length || member2.layerIds?.length || member2.image || member2.foreignVector || !member2.rotation || Math.abs(member2.transform[1]) > 1e-10 || Math.abs(member2.transform[2]) > 1e-10 || !visioResizeFrame(member2, member2, { x: 0, y: 0 }))
|
|
45766
|
+
return false;
|
|
45767
|
+
ids.add(member2.id);
|
|
45768
|
+
}
|
|
45769
|
+
return !page.connectors.some(
|
|
45770
|
+
(connection) => ids.has(connection.fromShapeId) || ids.has(connection.toShapeId)
|
|
45771
|
+
);
|
|
45772
|
+
}
|
|
44821
45773
|
var VISIO_RESIZE_HANDLES = [
|
|
44822
45774
|
{ id: "sw", x: 0, y: 0 },
|
|
44823
45775
|
{ id: "s", x: 0.5, y: 0 },
|
|
@@ -44830,7 +45782,7 @@ var VISIO_RESIZE_HANDLES = [
|
|
|
44830
45782
|
];
|
|
44831
45783
|
function visioResizeShape(page, id3) {
|
|
44832
45784
|
const shape = visioMovementShape(page, id3);
|
|
44833
|
-
return shape && (!shape.children.length || !!shape.masterId) && (!shape.layerIds?.length || !!shape.masterId) && visioResizeFrame(shape, { width: shape.width, height: shape.height }, { x: 0, y: 0 }) ? shape : void 0;
|
|
45785
|
+
return shape && (!shape.children.length || !!shape.masterId || resizableLocalGroup(page, shape)) && (!shape.layerIds?.length || !!shape.masterId) && visioResizeFrame(shape, { width: shape.width, height: shape.height }, { x: 0, y: 0 }) ? shape : void 0;
|
|
44834
45786
|
}
|
|
44835
45787
|
function visioResizeFrame(shape, size3, anchor) {
|
|
44836
45788
|
if (!shape.rotation) return void 0;
|
|
@@ -44876,6 +45828,218 @@ function visioResizeDrag(page, id3, handle, start, end) {
|
|
|
44876
45828
|
}
|
|
44877
45829
|
}
|
|
44878
45830
|
|
|
45831
|
+
// geometry/element-transform.ts
|
|
45832
|
+
var DEFAULT_INTERACTION_MIN_SIZE = 12;
|
|
45833
|
+
var DEG_TO_RAD = Math.PI / 180;
|
|
45834
|
+
function rotationOf(box5) {
|
|
45835
|
+
return box5.rotation ?? 0;
|
|
45836
|
+
}
|
|
45837
|
+
function rotateDelta(dx, dy, rotationDeg) {
|
|
45838
|
+
if (!rotationDeg) {
|
|
45839
|
+
return { x: dx, y: dy };
|
|
45840
|
+
}
|
|
45841
|
+
const rad = -rotationDeg * DEG_TO_RAD;
|
|
45842
|
+
const cos = Math.cos(rad);
|
|
45843
|
+
const sin = Math.sin(rad);
|
|
45844
|
+
return {
|
|
45845
|
+
x: dx * cos - dy * sin,
|
|
45846
|
+
y: dx * sin + dy * cos
|
|
45847
|
+
};
|
|
45848
|
+
}
|
|
45849
|
+
function applyResize(box5, handle, dxScreen, dyScreen, zoom, opts = {}) {
|
|
45850
|
+
const scale = zoom;
|
|
45851
|
+
const minSize = opts.minSize ?? DEFAULT_INTERACTION_MIN_SIZE;
|
|
45852
|
+
const minWidth = opts.minWidth ?? minSize;
|
|
45853
|
+
const minHeight = opts.minHeight ?? minSize;
|
|
45854
|
+
const rotation = rotationOf(box5);
|
|
45855
|
+
const local = rotateDelta(dxScreen / scale, dyScreen / scale, rotation);
|
|
45856
|
+
const dx = local.x;
|
|
45857
|
+
const dy = local.y;
|
|
45858
|
+
let newX = box5.x;
|
|
45859
|
+
let newY = box5.y;
|
|
45860
|
+
let newW = box5.width;
|
|
45861
|
+
let newH = box5.height;
|
|
45862
|
+
const affectsLeft = handle === "nw" || handle === "w" || handle === "sw";
|
|
45863
|
+
const affectsRight = handle === "ne" || handle === "e" || handle === "se";
|
|
45864
|
+
const affectsTop = handle === "nw" || handle === "n" || handle === "ne";
|
|
45865
|
+
const affectsBottom = handle === "sw" || handle === "s" || handle === "se";
|
|
45866
|
+
if (affectsRight) {
|
|
45867
|
+
newW = Math.max(minWidth, box5.width + dx);
|
|
45868
|
+
} else if (affectsLeft) {
|
|
45869
|
+
newW = Math.max(minWidth, box5.width - dx);
|
|
45870
|
+
newX = box5.x + (box5.width - newW);
|
|
45871
|
+
}
|
|
45872
|
+
if (affectsBottom) {
|
|
45873
|
+
newH = Math.max(minHeight, box5.height + dy);
|
|
45874
|
+
} else if (affectsTop) {
|
|
45875
|
+
newH = Math.max(minHeight, box5.height - dy);
|
|
45876
|
+
newY = box5.y + (box5.height - newH);
|
|
45877
|
+
}
|
|
45878
|
+
return { x: newX, y: newY, width: newW, height: newH, rotation };
|
|
45879
|
+
}
|
|
45880
|
+
|
|
45881
|
+
// visio/ui/selection-resize.ts
|
|
45882
|
+
function candidates(page, ids) {
|
|
45883
|
+
if (!ids.length || ids.length > 500 || new Set(ids).size !== ids.length) return void 0;
|
|
45884
|
+
const shapes = [];
|
|
45885
|
+
for (const id3 of ids) {
|
|
45886
|
+
const shape = visioResizeShape(page, id3);
|
|
45887
|
+
if (!shape) return void 0;
|
|
45888
|
+
if (ids.length > 1) {
|
|
45889
|
+
const [a2, b, c2, d] = shape.transform;
|
|
45890
|
+
if (shape.children.length || shape.masterId || shape.kind !== "shape" || Math.abs(b) > 1e-10 || Math.abs(c2) > 1e-10 || Math.abs(Math.abs(a2) - 1) > 1e-10 || Math.abs(Math.abs(d) - 1) > 1e-10 || page.connectors.some((edge) => edge.fromShapeId === id3 || edge.toShapeId === id3))
|
|
45891
|
+
return void 0;
|
|
45892
|
+
}
|
|
45893
|
+
shapes.push(shape);
|
|
45894
|
+
}
|
|
45895
|
+
return shapes;
|
|
45896
|
+
}
|
|
45897
|
+
function selectionFrame(shapes) {
|
|
45898
|
+
const first2 = shapes[0];
|
|
45899
|
+
if (shapes.length === 1) return visioResizeFrame(first2, first2, { x: 0, y: 0 });
|
|
45900
|
+
let left = Infinity, bottom = Infinity, right2 = -Infinity, top = -Infinity;
|
|
45901
|
+
for (const shape of shapes) {
|
|
45902
|
+
const [a2, , , d, x, y] = shape.transform;
|
|
45903
|
+
left = Math.min(left, x, x + a2 * shape.width);
|
|
45904
|
+
right2 = Math.max(right2, x, x + a2 * shape.width);
|
|
45905
|
+
bottom = Math.min(bottom, y, y + d * shape.height);
|
|
45906
|
+
top = Math.max(top, y, y + d * shape.height);
|
|
45907
|
+
}
|
|
45908
|
+
const width = right2 - left, height = top - bottom;
|
|
45909
|
+
return width > 0 && height > 0 && [left, bottom, width, height].every(Number.isFinite) ? {
|
|
45910
|
+
width,
|
|
45911
|
+
height,
|
|
45912
|
+
transform: [1, 0, 0, 1, left, bottom],
|
|
45913
|
+
pinX: left + width / 2,
|
|
45914
|
+
pinY: bottom + height / 2
|
|
45915
|
+
} : void 0;
|
|
45916
|
+
}
|
|
45917
|
+
function visioResizeSelectionFrame(page, ids) {
|
|
45918
|
+
const shapes = candidates(page, ids);
|
|
45919
|
+
return shapes && selectionFrame(shapes);
|
|
45920
|
+
}
|
|
45921
|
+
function visioResizeSelectionDrag(page, ids, handle, start, end) {
|
|
45922
|
+
const shapes = candidates(page, ids);
|
|
45923
|
+
if (!shapes || !VISIO_RESIZE_HANDLES.some((item2) => item2.id === handle)) return void 0;
|
|
45924
|
+
if (shapes.length === 1) {
|
|
45925
|
+
const result2 = visioResizeDrag(page, ids[0], handle, start, end);
|
|
45926
|
+
return result2 && {
|
|
45927
|
+
frame: result2.frame,
|
|
45928
|
+
commands: [result2.command],
|
|
45929
|
+
members: [{ id: ids[0], frame: result2.frame }]
|
|
45930
|
+
};
|
|
45931
|
+
}
|
|
45932
|
+
const original = selectionFrame(shapes);
|
|
45933
|
+
if (!original || ![start.x, start.y, end.x, end.y].every(Number.isFinite)) return void 0;
|
|
45934
|
+
const [, , , , left, bottom] = original.transform;
|
|
45935
|
+
const box5 = applyResize(
|
|
45936
|
+
{ x: left, y: -bottom - original.height, width: original.width, height: original.height },
|
|
45937
|
+
handle,
|
|
45938
|
+
end.x - start.x,
|
|
45939
|
+
end.y - start.y,
|
|
45940
|
+
1,
|
|
45941
|
+
{
|
|
45942
|
+
minWidth: original.width * Math.max(...shapes.map((shape) => Math.min(1 / 16, shape.width) / shape.width)),
|
|
45943
|
+
minHeight: original.height * Math.max(...shapes.map((shape) => Math.min(1 / 16, shape.height) / shape.height))
|
|
45944
|
+
}
|
|
45945
|
+
);
|
|
45946
|
+
const sx = box5.width / original.width, sy = box5.height / original.height;
|
|
45947
|
+
const nextBottom = -box5.y - box5.height;
|
|
45948
|
+
const frame = {
|
|
45949
|
+
width: box5.width,
|
|
45950
|
+
height: box5.height,
|
|
45951
|
+
transform: [1, 0, 0, 1, box5.x, nextBottom],
|
|
45952
|
+
pinX: box5.x + box5.width / 2,
|
|
45953
|
+
pinY: nextBottom + box5.height / 2
|
|
45954
|
+
};
|
|
45955
|
+
if (![...frame.transform, frame.width, frame.height, frame.pinX, frame.pinY].every(Number.isFinite))
|
|
45956
|
+
return void 0;
|
|
45957
|
+
const commands = [];
|
|
45958
|
+
const members3 = [];
|
|
45959
|
+
try {
|
|
45960
|
+
for (const shape of shapes) {
|
|
45961
|
+
const width = shape.width * sx, height = shape.height * sy;
|
|
45962
|
+
const x = box5.x + (shape.rotation.pinX - left) * sx;
|
|
45963
|
+
const y = nextBottom + (shape.rotation.pinY - bottom) * sy;
|
|
45964
|
+
const resized = visioResizeFrame(shape, { width, height }, { x: 0, y: 0 });
|
|
45965
|
+
if (!resized) return void 0;
|
|
45966
|
+
members3.push({
|
|
45967
|
+
id: shape.id,
|
|
45968
|
+
frame: {
|
|
45969
|
+
...resized,
|
|
45970
|
+
pinX: x,
|
|
45971
|
+
pinY: y,
|
|
45972
|
+
transform: [
|
|
45973
|
+
resized.transform[0],
|
|
45974
|
+
resized.transform[1],
|
|
45975
|
+
resized.transform[2],
|
|
45976
|
+
resized.transform[3],
|
|
45977
|
+
resized.transform[4] + x - resized.pinX,
|
|
45978
|
+
resized.transform[5] + y - resized.pinY
|
|
45979
|
+
]
|
|
45980
|
+
}
|
|
45981
|
+
});
|
|
45982
|
+
if (Math.abs(width - shape.width) > 1e-10 || Math.abs(height - shape.height) > 1e-10) {
|
|
45983
|
+
const command2 = visioPageEditToDrawing(page, {
|
|
45984
|
+
type: "resize-shape",
|
|
45985
|
+
pageId: page.id,
|
|
45986
|
+
shapeId: shape.id,
|
|
45987
|
+
width,
|
|
45988
|
+
height,
|
|
45989
|
+
anchor: { x: 0, y: 0 }
|
|
45990
|
+
});
|
|
45991
|
+
if (command2.type !== "resize-shape" || command2.width > 1e6 || command2.height > 1e6)
|
|
45992
|
+
return void 0;
|
|
45993
|
+
commands.push(command2);
|
|
45994
|
+
}
|
|
45995
|
+
if (Math.abs(x - resized.pinX) > 1e-10 || Math.abs(y - resized.pinY) > 1e-10) {
|
|
45996
|
+
const command2 = visioPageEditToDrawing(page, {
|
|
45997
|
+
type: "move-shape",
|
|
45998
|
+
pageId: page.id,
|
|
45999
|
+
shapeId: shape.id,
|
|
46000
|
+
x,
|
|
46001
|
+
y
|
|
46002
|
+
});
|
|
46003
|
+
if (command2.type !== "move-shape" || ![command2.x, command2.y].every(Number.isFinite))
|
|
46004
|
+
return void 0;
|
|
46005
|
+
commands.push(command2);
|
|
46006
|
+
}
|
|
46007
|
+
}
|
|
46008
|
+
} catch {
|
|
46009
|
+
return void 0;
|
|
46010
|
+
}
|
|
46011
|
+
return { frame, commands, members: members3 };
|
|
46012
|
+
}
|
|
46013
|
+
|
|
46014
|
+
// visio/ui/geometry-expectation.ts
|
|
46015
|
+
function snapshotVisioGeometryExpectation(expected) {
|
|
46016
|
+
if (!expected.members.length || expected.members.length > 500 || new Set(expected.members.map((member2) => member2.id)).size !== expected.members.length)
|
|
46017
|
+
throw new Error("Invalid selection geometry expectation.");
|
|
46018
|
+
return {
|
|
46019
|
+
pageId: expected.pageId,
|
|
46020
|
+
members: expected.members.map(({ id: id3, frame }) => {
|
|
46021
|
+
if (frame.transform.length !== 6 || ![frame.width, frame.height, frame.pinX, frame.pinY, ...frame.transform].every(
|
|
46022
|
+
Number.isFinite
|
|
46023
|
+
) || frame.width <= 0 || frame.height <= 0)
|
|
46024
|
+
throw new Error("Invalid selection geometry expectation.");
|
|
46025
|
+
return { id: id3, frame: { ...frame, transform: [...frame.transform] } };
|
|
46026
|
+
})
|
|
46027
|
+
};
|
|
46028
|
+
}
|
|
46029
|
+
function assertVisioGeometryExpectation(document, expected) {
|
|
46030
|
+
const pages = document.pages.filter((page2) => page2.id === expected.pageId);
|
|
46031
|
+
const page = pages.length === 1 ? pages[0] : void 0;
|
|
46032
|
+
const close3 = (actual, wanted) => Number.isFinite(actual) && Math.abs(actual - wanted) <= 1e-8 * Math.max(1, Math.abs(wanted));
|
|
46033
|
+
for (const { id: id3, frame } of expected.members) {
|
|
46034
|
+
const shapes = page?.shapes.filter((shape2) => shape2.id === id3);
|
|
46035
|
+
const shape = shapes?.length === 1 ? shapes[0] : void 0;
|
|
46036
|
+
if (!shape?.rotation || !close3(shape.width, frame.width) || !close3(shape.height, frame.height) || !close3(shape.rotation.pinX, frame.pinX) || !close3(shape.rotation.pinY, frame.pinY) || shape.transform.some((value3, index2) => !close3(value3, frame.transform[index2])))
|
|
46037
|
+
throw new Error(
|
|
46038
|
+
"Dependent formulas changed the requested selection geometry. The resize was not applied."
|
|
46039
|
+
);
|
|
46040
|
+
}
|
|
46041
|
+
}
|
|
46042
|
+
|
|
44879
46043
|
// visio/ui/draw-path-plan.ts
|
|
44880
46044
|
var isVisioPathTool = (tool) => tool === "freeform" || tool === "pencil" || tool === "arc";
|
|
44881
46045
|
var VISIO_PATH_CLOSE_DISTANCE = 0.125;
|
|
@@ -45630,8 +46794,8 @@ var VISIO_RULER_DENSITY_CHOICES = Object.freeze([
|
|
|
45630
46794
|
function step2(density, spacing2, zoom) {
|
|
45631
46795
|
const base2 = density === 2 ? 1 : density === 4 ? 0.5 : 0.25;
|
|
45632
46796
|
if (density === 0 && spacing2 > 0) return spacing2;
|
|
45633
|
-
const
|
|
45634
|
-
let value3 = base2 / 2 **
|
|
46797
|
+
const level3 = Math.max(-6, Math.min(6, Math.floor(Math.log2(zoom > 0 ? zoom : 1) + 1e-9)));
|
|
46798
|
+
let value3 = base2 / 2 ** level3;
|
|
45635
46799
|
if (spacing2 > 0) {
|
|
45636
46800
|
while (value3 < spacing2 - 1e-9) value3 *= 2;
|
|
45637
46801
|
}
|
|
@@ -46607,8 +47771,8 @@ function layers(ids, forward, shortest) {
|
|
|
46607
47771
|
}
|
|
46608
47772
|
const result2 = [];
|
|
46609
47773
|
for (const id3 of ids) {
|
|
46610
|
-
const
|
|
46611
|
-
(result2[
|
|
47774
|
+
const level3 = rank.get(id3) ?? 0;
|
|
47775
|
+
(result2[level3] ??= []).push(id3);
|
|
46612
47776
|
}
|
|
46613
47777
|
return result2.filter((layer) => layer.length);
|
|
46614
47778
|
}
|
|
@@ -47230,8 +48394,11 @@ function visioSnapMoveDelta(page, ids, delta, options2) {
|
|
|
47230
48394
|
if (grid.x && !axes.has("x")) snapped.x = gridEdge(snapped.x, box5.width, grid.x, grid.originX);
|
|
47231
48395
|
if (grid.y && !axes.has("y")) snapped.y = gridEdge(snapped.y, box5.height, grid.y, -grid.originY);
|
|
47232
48396
|
return {
|
|
47233
|
-
delta: {
|
|
47234
|
-
|
|
48397
|
+
delta: {
|
|
48398
|
+
x: options2.axis === "y" ? delta.x : delta.x + snapped.x - box5.x,
|
|
48399
|
+
y: options2.axis === "x" ? delta.y : delta.y - (snapped.y - box5.y)
|
|
48400
|
+
},
|
|
48401
|
+
lines: snapped.guides.filter((line2) => !options2.axis || line2.axis === options2.axis)
|
|
47235
48402
|
};
|
|
47236
48403
|
}
|
|
47237
48404
|
function gridEdge(start, size3, grid, origin = 0) {
|
|
@@ -47848,6 +49015,7 @@ exports.VISIO_TEXT_REPLACE_LIMITS = VISIO_TEXT_REPLACE_LIMITS;
|
|
|
47848
49015
|
exports.VisioTextDraftError = VisioTextDraftError;
|
|
47849
49016
|
exports.assertShapeDetails = assertShapeDetails;
|
|
47850
49017
|
exports.assertViewableDocument = assertViewableDocument;
|
|
49018
|
+
exports.assertVisioGeometryExpectation = assertVisioGeometryExpectation;
|
|
47851
49019
|
exports.checkVisioDiagram = checkVisioDiagram;
|
|
47852
49020
|
exports.clampHistoryEntries = clampHistoryEntries;
|
|
47853
49021
|
exports.compatibilityNotes = compatibilityNotes;
|
|
@@ -47872,6 +49040,7 @@ exports.searchDocumentText = searchDocumentText;
|
|
|
47872
49040
|
exports.selectionKey = selectionKey;
|
|
47873
49041
|
exports.snapshotEdits = snapshotEdits;
|
|
47874
49042
|
exports.snapshotSelection = snapshotSelection;
|
|
49043
|
+
exports.snapshotVisioGeometryExpectation = snapshotVisioGeometryExpectation;
|
|
47875
49044
|
exports.textSearchStatus = textSearchStatus;
|
|
47876
49045
|
exports.validateSearchQuery = validateSearchQuery;
|
|
47877
49046
|
exports.visioAddConnectionPointCommand = visioAddConnectionPointCommand;
|
|
@@ -47987,6 +49156,8 @@ exports.visioRenderedGradientStopCount = visioRenderedGradientStopCount;
|
|
|
47987
49156
|
exports.visioRenderedGradientStops = visioRenderedGradientStops;
|
|
47988
49157
|
exports.visioResizeDrag = visioResizeDrag;
|
|
47989
49158
|
exports.visioResizeFrame = visioResizeFrame;
|
|
49159
|
+
exports.visioResizeSelectionDrag = visioResizeSelectionDrag;
|
|
49160
|
+
exports.visioResizeSelectionFrame = visioResizeSelectionFrame;
|
|
47990
49161
|
exports.visioResizeShape = visioResizeShape;
|
|
47991
49162
|
exports.visioRotationPreviewTransform = visioRotationPreviewTransform;
|
|
47992
49163
|
exports.visioRotationShape = visioRotationShape;
|