ooxml-core 1.8.3 → 1.9.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-AT7FVG5Q.mjs +2 -0
- package/dist/{PptxHandler-BL4B7CZO.mjs → PptxHandler-EX4WBIQQ.mjs} +2 -2
- package/dist/PptxHandler-VFSCECPL.cjs +11 -0
- package/dist/automation/index.cjs +7380 -4682
- package/dist/automation/index.mjs +7380 -4682
- package/dist/chunk-AT66SA5M.cjs +44423 -0
- package/dist/{chunk-TTPZITQN.mjs → chunk-FIELY5PI.mjs} +1 -1
- package/dist/{chunk-ZAP5WLEN.mjs → chunk-IGOA57LE.mjs} +1 -1
- package/dist/chunk-LCS3J3QI.mjs +87604 -0
- package/dist/{chunk-NIHPA63A.mjs → chunk-M76PHYRR.mjs} +54 -37
- package/dist/chunk-OB277ZGE.mjs +44107 -0
- package/dist/{chunk-GAGSCAR3.mjs → chunk-OXHMZS7B.mjs} +552 -178
- package/dist/chunk-SWF7KVL5.cjs +87610 -0
- package/dist/{chunk-Z7IQR4S4.mjs → chunk-WSO4T2LJ.mjs} +246 -21
- package/dist/docx/block-parser.d.ts.map +1 -1
- package/dist/docx/cell-blocks.d.ts +4 -0
- package/dist/docx/cell-blocks.d.ts.map +1 -0
- package/dist/docx/document-paragraphs.d.ts.map +1 -1
- package/dist/docx/document-parts.d.ts +2 -0
- package/dist/docx/document-parts.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +189 -20
- package/dist/docx/embedded.mjs +189 -20
- package/dist/docx/index.cjs +219 -24
- package/dist/docx/index.mjs +219 -24
- package/dist/docx/layout/adapt-table.d.ts.map +1 -1
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/flow-paragraph.d.ts +5 -0
- package/dist/docx/layout/flow-paragraph.d.ts.map +1 -1
- package/dist/docx/layout/flow-table.d.ts +2 -1
- package/dist/docx/layout/flow-table.d.ts.map +1 -1
- package/dist/docx/layout/footnote-columns.d.ts +22 -0
- package/dist/docx/layout/footnote-columns.d.ts.map +1 -0
- package/dist/docx/layout/footnote-flow.d.ts +27 -0
- package/dist/docx/layout/footnote-flow.d.ts.map +1 -0
- package/dist/docx/layout/footnote-split.d.ts +7 -0
- package/dist/docx/layout/footnote-split.d.ts.map +1 -0
- package/dist/docx/layout/index.cjs +1099 -92
- package/dist/docx/layout/index.mjs +1099 -92
- package/dist/docx/layout/input.d.ts +17 -1
- package/dist/docx/layout/input.d.ts.map +1 -1
- package/dist/docx/layout/legacy-footnote-flow.d.ts +18 -0
- package/dist/docx/layout/legacy-footnote-flow.d.ts.map +1 -0
- package/dist/docx/layout/line-metrics.d.ts.map +1 -1
- package/dist/docx/layout/page-cursor.d.ts +13 -8
- package/dist/docx/layout/page-cursor.d.ts.map +1 -1
- package/dist/docx/layout/page-flow.d.ts.map +1 -1
- package/dist/docx/layout/paragraph-layout.d.ts.map +1 -1
- package/dist/docx/layout/paragraph-tokens.d.ts +2 -0
- package/dist/docx/layout/paragraph-tokens.d.ts.map +1 -1
- package/dist/docx/layout/reference-footnotes.d.ts +7 -0
- package/dist/docx/layout/reference-footnotes.d.ts.map +1 -0
- package/dist/docx/layout/result.d.ts +31 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/layout/section-flow.d.ts +2 -0
- package/dist/docx/layout/section-flow.d.ts.map +1 -1
- package/dist/docx/layout/table-cell-layout.d.ts +11 -0
- package/dist/docx/layout/table-cell-layout.d.ts.map +1 -0
- package/dist/docx/layout/table-footnotes.d.ts +27 -0
- package/dist/docx/layout/table-footnotes.d.ts.map +1 -0
- package/dist/docx/layout/table-layout.d.ts +10 -4
- package/dist/docx/layout/table-layout.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +194 -25
- package/dist/docx/load/index.mjs +194 -25
- package/dist/docx/model-run.d.ts +2 -0
- package/dist/docx/model-run.d.ts.map +1 -1
- package/dist/docx/model.d.ts +7 -0
- package/dist/docx/model.d.ts.map +1 -1
- package/dist/docx/notes.d.ts +5 -0
- package/dist/docx/notes.d.ts.map +1 -1
- package/dist/docx/parse-table.d.ts.map +1 -1
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/save.d.ts.map +1 -1
- package/dist/docx/section-model.d.ts +2 -0
- package/dist/docx/section-model.d.ts.map +1 -1
- package/dist/docx/sections.d.ts.map +1 -1
- package/dist/docx/settings.d.ts +2 -0
- package/dist/docx/settings.d.ts.map +1 -1
- package/dist/docx/table-model.d.ts +3 -1
- package/dist/docx/table-model.d.ts.map +1 -1
- package/dist/docx/ui/index.cjs +55 -0
- package/dist/docx/ui/index.d.ts +1 -0
- package/dist/docx/ui/index.d.ts.map +1 -1
- package/dist/docx/ui/index.mjs +55 -1
- package/dist/docx/ui/table-structure-guard.d.ts +4 -0
- package/dist/docx/ui/table-structure-guard.d.ts.map +1 -0
- package/dist/docx/write-footnote-columns.d.ts +3 -0
- package/dist/docx/write-footnote-columns.d.ts.map +1 -0
- package/dist/docx/write-notes.d.ts.map +1 -1
- package/dist/docx/write-run.d.ts.map +1 -1
- package/dist/docx/write-sections.d.ts.map +1 -1
- package/dist/index.cjs +8 -5
- package/dist/index.mjs +8 -5
- package/dist/opc/clone-part-graph.d.ts +4 -0
- package/dist/opc/clone-part-graph.d.ts.map +1 -1
- package/dist/opc/index.cjs +8 -5
- package/dist/opc/index.mjs +8 -5
- package/dist/pptx/automation/index.cjs +621 -207
- package/dist/pptx/automation/index.d.ts +3 -3
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-Cn-GzYGp.d.ts → index-B4cnSPNz.d.ts} +33 -4
- package/dist/pptx/chunks/index-B4cnSPNz.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CKIUurnd.d.ts → index-BZh-IMkN.d.ts} +14 -9
- package/dist/pptx/chunks/{index-CKIUurnd.d.ts.map → index-BZh-IMkN.d.ts.map} +1 -1
- package/dist/pptx/chunks/{text-operations-BHfAm5K9.d.ts → text-operations-BLodkuXE.d.ts} +29 -12
- package/dist/pptx/chunks/text-operations-BLodkuXE.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +622 -213
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +53 -36
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.cjs +416 -45
- package/dist/pptx/editor/render/find-replace.d.ts +35 -4
- package/dist/pptx/editor/render/find-replace.d.ts.map +1 -1
- package/dist/pptx/editor/render/find-replace.mjs +416 -46
- package/dist/pptx/editor/render/slide-operations.cjs +87 -0
- package/dist/pptx/editor/render/slide-operations.d.ts +17 -1
- package/dist/pptx/editor/render/slide-operations.d.ts.map +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +83 -1
- package/dist/pptx/editor/render/slide-search.cjs +6 -10
- package/dist/pptx/editor/render/slide-search.d.ts +1 -1
- package/dist/pptx/editor/render/slide-search.mjs +6 -10
- package/dist/pptx/editor/render/template-editing.d.ts +1 -1
- package/dist/pptx/editor/render/template-editing.d.ts.map +1 -1
- package/dist/pptx/index.cjs +889 -237
- package/dist/pptx/index.d.ts +4 -4
- package/dist/pptx/index.mjs +5 -5
- package/dist/teams/index.cjs +672 -37
- package/dist/teams/index.mjs +672 -37
- package/dist/visio/accessibility.d.ts +10 -0
- package/dist/visio/accessibility.d.ts.map +1 -0
- package/dist/visio/cell-formula.d.ts +2 -0
- package/dist/visio/cell-formula.d.ts.map +1 -1
- package/dist/visio/connector-curve-aligned.d.ts +5 -0
- package/dist/visio/connector-curve-aligned.d.ts.map +1 -0
- package/dist/visio/connector-curve-spans.d.ts +14 -0
- package/dist/visio/connector-curve-spans.d.ts.map +1 -0
- package/dist/visio/connector-jumps.d.ts +5 -0
- package/dist/visio/connector-jumps.d.ts.map +1 -0
- package/dist/visio/connector-route-walk.d.ts +2 -1
- package/dist/visio/connector-route-walk.d.ts.map +1 -1
- package/dist/visio/edit-alt-text-scope.d.ts +5 -0
- package/dist/visio/edit-alt-text-scope.d.ts.map +1 -0
- package/dist/visio/edit-alt-text.d.ts +3 -0
- package/dist/visio/edit-alt-text.d.ts.map +1 -0
- package/dist/visio/edit-commands.d.ts +7 -2
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-commands.d.ts +5 -0
- package/dist/visio/edit-formatting-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-paint.d.ts.map +1 -1
- package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
- package/dist/visio/edit-line-jump-cache.d.ts +4 -0
- package/dist/visio/edit-line-jump-cache.d.ts.map +1 -0
- package/dist/visio/edit-master-index.d.ts.map +1 -1
- package/dist/visio/edit-metadata-commands.d.ts +10 -2
- package/dist/visio/edit-metadata-commands.d.ts.map +1 -1
- package/dist/visio/edit-metadata.d.ts +3 -1
- package/dist/visio/edit-metadata.d.ts.map +1 -1
- package/dist/visio/edit-page-alt-text.d.ts +4 -0
- package/dist/visio/edit-page-alt-text.d.ts.map +1 -0
- package/dist/visio/edit-page-layout.d.ts.map +1 -1
- package/dist/visio/edit-page-rename.d.ts.map +1 -1
- package/dist/visio/edit-page-setup-commands.d.ts +7 -1
- package/dist/visio/edit-page-setup-commands.d.ts.map +1 -1
- package/dist/visio/edit-page-size.d.ts.map +1 -1
- package/dist/visio/edit-pages.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-scope.d.ts.map +1 -1
- package/dist/visio/edit-shape-create.d.ts.map +1 -1
- package/dist/visio/edit-stencil-connector-write.d.ts.map +1 -1
- package/dist/visio/edit-style-admission.d.ts.map +1 -1
- package/dist/visio/edit-text.d.ts.map +1 -1
- package/dist/visio/edit.d.ts +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/index.cjs +1091 -233
- package/dist/visio/index.d.ts +2 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +1091 -234
- package/dist/visio/line-jumps.d.ts +1 -5
- package/dist/visio/line-jumps.d.ts.map +1 -1
- package/dist/visio/model.d.ts +13 -0
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/page-layout.d.ts +11 -2
- package/dist/visio/page-layout.d.ts.map +1 -1
- package/dist/visio/parser.d.ts.map +1 -1
- package/dist/visio/shape-metadata.d.ts +6 -0
- package/dist/visio/shape-metadata.d.ts.map +1 -1
- package/dist/visio/shapes.d.ts.map +1 -1
- package/dist/visio/text-field-case.d.ts +2 -0
- package/dist/visio/text-field-case.d.ts.map +1 -0
- package/dist/visio/text-field-display.d.ts.map +1 -1
- package/dist/visio/text-field-numeric.d.ts +4 -0
- package/dist/visio/text-field-numeric.d.ts.map +1 -0
- package/dist/visio/ui/connector-preview.d.ts +1 -1
- package/dist/visio/ui/connector-preview.d.ts.map +1 -1
- package/dist/visio/ui/data-graphic-rules.d.ts +2 -0
- package/dist/visio/ui/data-graphic-rules.d.ts.map +1 -1
- package/dist/visio/ui/data-graphics.d.ts +3 -2
- package/dist/visio/ui/data-graphics.d.ts.map +1 -1
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +16898 -15855
- package/dist/visio/ui/index.mjs +16898 -15856
- package/dist/visio/ui/scene-details.d.ts.map +1 -1
- package/dist/visio/ui/scene-validation.d.ts.map +1 -1
- package/dist/visio/ui/snapshot-scene.d.ts +2 -1
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
- package/dist/visio/xml-attribute-whitespace.d.ts +5 -0
- package/dist/visio/xml-attribute-whitespace.d.ts.map +1 -0
- package/dist/xlsx/edit/index.d.ts +1 -0
- package/dist/xlsx/edit/index.d.ts.map +1 -1
- package/dist/xlsx/edit/insert-guard.d.ts.map +1 -1
- package/dist/xlsx/edit/merge.d.ts.map +1 -1
- package/dist/xlsx/edit/page-breaks.d.ts +5 -0
- package/dist/xlsx/edit/page-breaks.d.ts.map +1 -0
- package/dist/xlsx/edit/pivots.d.ts +8 -0
- package/dist/xlsx/edit/pivots.d.ts.map +1 -0
- package/dist/xlsx/edit/print-titles.d.ts +7 -0
- package/dist/xlsx/edit/print-titles.d.ts.map +1 -0
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/sheets.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-formulas.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-sheet.d.ts.map +1 -1
- package/dist/xlsx/edit/sparkline-ranges.d.ts +11 -0
- package/dist/xlsx/edit/sparkline-ranges.d.ts.map +1 -0
- package/dist/xlsx/edit/sparkline-xml.d.ts +13 -0
- package/dist/xlsx/edit/sparkline-xml.d.ts.map +1 -0
- package/dist/xlsx/edit/sparklines.d.ts +16 -0
- package/dist/xlsx/edit/sparklines.d.ts.map +1 -0
- package/dist/xlsx/edit/table-edits.d.ts.map +1 -1
- package/dist/xlsx/edit/tables.d.ts.map +1 -1
- package/dist/xlsx/edit/types.d.ts +22 -1
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/text-regex.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +3415 -1374
- package/dist/xlsx/index.d.ts +1 -0
- package/dist/xlsx/index.d.ts.map +1 -1
- package/dist/xlsx/index.mjs +3396 -1375
- package/dist/xlsx/layout/cell-view.d.ts +2 -0
- package/dist/xlsx/layout/cell-view.d.ts.map +1 -1
- package/dist/xlsx/layout/header-footer.d.ts +58 -0
- package/dist/xlsx/layout/header-footer.d.ts.map +1 -0
- package/dist/xlsx/layout/index.d.ts +5 -0
- package/dist/xlsx/layout/index.d.ts.map +1 -1
- package/dist/xlsx/layout/print-breaks.d.ts +11 -0
- package/dist/xlsx/layout/print-breaks.d.ts.map +1 -0
- package/dist/xlsx/layout/print-layout.d.ts +34 -0
- package/dist/xlsx/layout/print-layout.d.ts.map +1 -0
- package/dist/xlsx/layout/print-merges.d.ts +18 -0
- package/dist/xlsx/layout/print-merges.d.ts.map +1 -0
- package/dist/xlsx/layout/print-repeat.d.ts +12 -0
- package/dist/xlsx/layout/print-repeat.d.ts.map +1 -0
- package/dist/xlsx/layout/print-titles.d.ts +20 -0
- package/dist/xlsx/layout/print-titles.d.ts.map +1 -0
- package/dist/xlsx/layout/sparkline-data.d.ts.map +1 -1
- package/dist/xlsx/layout/sparkline-view.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +7831 -6961
- package/dist/xlsx/load/index.mjs +7831 -6961
- package/dist/xlsx/model-pivots.d.ts +46 -0
- package/dist/xlsx/model-pivots.d.ts.map +1 -0
- package/dist/xlsx/model.d.ts +5 -0
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/pivot/admission.d.ts +5 -0
- package/dist/xlsx/pivot/admission.d.ts.map +1 -0
- package/dist/xlsx/pivot/aggregate.d.ts +19 -0
- package/dist/xlsx/pivot/aggregate.d.ts.map +1 -0
- package/dist/xlsx/pivot/cache-xml.d.ts +9 -0
- package/dist/xlsx/pivot/cache-xml.d.ts.map +1 -0
- package/dist/xlsx/pivot/data.d.ts +12 -0
- package/dist/xlsx/pivot/data.d.ts.map +1 -0
- package/dist/xlsx/pivot/hierarchy.d.ts +7 -0
- package/dist/xlsx/pivot/hierarchy.d.ts.map +1 -0
- package/dist/xlsx/pivot/index.d.ts +3 -0
- package/dist/xlsx/pivot/index.d.ts.map +1 -0
- package/dist/xlsx/pivot/read.d.ts +5 -0
- package/dist/xlsx/pivot/read.d.ts.map +1 -0
- package/dist/xlsx/pivot/table-xml.d.ts +5 -0
- package/dist/xlsx/pivot/table-xml.d.ts.map +1 -0
- package/dist/xlsx/pivot/write.d.ts +11 -0
- package/dist/xlsx/pivot/write.d.ts.map +1 -0
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/pivots.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/print-layout.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/print-layout.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/sparklines.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/sparklines.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/tools.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/page-breaks.d.ts +3 -0
- package/dist/xlsx/ui/commands/page-breaks.d.ts.map +1 -0
- package/dist/xlsx/ui/index.cjs +2451 -737
- package/dist/xlsx/ui/index.d.ts +1 -0
- package/dist/xlsx/ui/index.d.ts.map +1 -1
- package/dist/xlsx/ui/index.mjs +2451 -738
- package/dist/xlsx/write/chart-cache.d.ts +8 -0
- package/dist/xlsx/write/chart-cache.d.ts.map +1 -0
- package/dist/xlsx/write/page-setup.d.ts.map +1 -1
- package/dist/xlsx/write/save.d.ts.map +1 -1
- package/dist/xlsx/write/sheet-parts.d.ts +1 -0
- package/dist/xlsx/write/sheet-parts.d.ts.map +1 -1
- package/dist/xlsx/write/workbook-part.d.ts +1 -1
- package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/write/worksheet.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/pptx/chunks/index-Cn-GzYGp.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-BHfAm5K9.d.ts.map +0 -1
package/dist/visio/index.mjs
CHANGED
|
@@ -1308,15 +1308,16 @@ function inspect(bytes, limits) {
|
|
|
1308
1308
|
// visio/edit-metadata-commands.ts
|
|
1309
1309
|
var VISIO_METADATA_TEXT_LIMIT = 4096;
|
|
1310
1310
|
var VISIO_PICTURE_MAX_BYTES = VISIO_RASTER_IMAGE_LIMITS.maxImageBytes;
|
|
1311
|
-
var isVisioMetadataEdit = (edit) => edit.type === "set-shape-hyperlink" || edit.type === "set-shape-screentip";
|
|
1311
|
+
var isVisioMetadataEdit = (edit) => edit.type === "set-shape-hyperlink" || edit.type === "set-shape-screentip" || edit.type === "set-shape-alt-text";
|
|
1312
1312
|
var invalidText = /[\u0000-\u0008\u000b\u000c\u000e-\u001f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/u;
|
|
1313
|
-
function
|
|
1313
|
+
function metadataText(value, singleLine2) {
|
|
1314
1314
|
if (typeof value !== "string" || value.length > VISIO_METADATA_TEXT_LIMIT)
|
|
1315
|
-
fail("INVALID_EDIT", "
|
|
1316
|
-
if (invalidText.test(value) || /[\r\n\t]/.test(value))
|
|
1317
|
-
fail("INVALID_EDIT_TEXT", "
|
|
1315
|
+
fail("INVALID_EDIT", "Shape metadata text must be strings within the length limit.");
|
|
1316
|
+
if (invalidText.test(value) || singleLine2 && /[\r\n\t]/.test(value))
|
|
1317
|
+
fail("INVALID_EDIT_TEXT", "Shape metadata text contains invalid characters.");
|
|
1318
1318
|
return value;
|
|
1319
1319
|
}
|
|
1320
|
+
var field = metadataText;
|
|
1320
1321
|
function target(edit) {
|
|
1321
1322
|
if (typeof edit.pageId !== "string" || !edit.pageId || edit.pageId.length > 256 || typeof edit.shapeId !== "string" || !/^[1-9]\d{0,9}$/.test(edit.shapeId) || Number(edit.shapeId) > 4294967295)
|
|
1322
1323
|
fail("INVALID_EDIT", "Invalid edit shape target.");
|
|
@@ -1324,8 +1325,15 @@ function target(edit) {
|
|
|
1324
1325
|
}
|
|
1325
1326
|
function snapshotMetadataEdit(edit) {
|
|
1326
1327
|
const base2 = target(edit);
|
|
1328
|
+
if (edit.type === "set-shape-alt-text")
|
|
1329
|
+
return {
|
|
1330
|
+
...base2,
|
|
1331
|
+
type: edit.type,
|
|
1332
|
+
title: field(edit.title, true),
|
|
1333
|
+
description: field(edit.description, false)
|
|
1334
|
+
};
|
|
1327
1335
|
if (edit.type === "set-shape-screentip")
|
|
1328
|
-
return { ...base2, type: edit.type, text: field(edit.text) };
|
|
1336
|
+
return { ...base2, type: edit.type, text: field(edit.text, true) };
|
|
1329
1337
|
if (edit.row !== void 0 && (typeof edit.row !== "string" || !/^[A-Za-z_]\w{0,63}$/.test(edit.row)))
|
|
1330
1338
|
fail("INVALID_EDIT", "Hyperlink row names must be ShapeSheet row names.");
|
|
1331
1339
|
const link = edit.hyperlink;
|
|
@@ -1335,9 +1343,9 @@ function snapshotMetadataEdit(edit) {
|
|
|
1335
1343
|
}
|
|
1336
1344
|
if (!link || typeof link !== "object") fail("INVALID_EDIT", "Invalid hyperlink fields.");
|
|
1337
1345
|
const hyperlink2 = {
|
|
1338
|
-
address: field(link.address).trim(),
|
|
1339
|
-
subAddress: field(link.subAddress).trim(),
|
|
1340
|
-
description: field(link.description)
|
|
1346
|
+
address: field(link.address, true).trim(),
|
|
1347
|
+
subAddress: field(link.subAddress, true).trim(),
|
|
1348
|
+
description: field(link.description, true)
|
|
1341
1349
|
};
|
|
1342
1350
|
if (!hyperlink2.address && !hyperlink2.subAddress)
|
|
1343
1351
|
fail("INVALID_EDIT", "A hyperlink needs an address or a page target.");
|
|
@@ -1573,6 +1581,20 @@ function writeEditedPackage(parts, maxBytes, deadline, check) {
|
|
|
1573
1581
|
});
|
|
1574
1582
|
}
|
|
1575
1583
|
|
|
1584
|
+
// visio/xml-attribute-whitespace.ts
|
|
1585
|
+
function preserveAttributeWhitespace(xml) {
|
|
1586
|
+
return xml.replace(
|
|
1587
|
+
/<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<\/?[^!?\s>][^"'>]*(?:(?:"[^"]*"|'[^']*')[^"'>]*)*>/g,
|
|
1588
|
+
(token) => {
|
|
1589
|
+
if (token.startsWith("<!") || token.startsWith("<?")) return token;
|
|
1590
|
+
return token.replace(
|
|
1591
|
+
/"[^"]*"|'[^']*'/g,
|
|
1592
|
+
(value) => value.replace(/[\t\r\n]/g, (character) => `&#${character.charCodeAt(0)};`)
|
|
1593
|
+
);
|
|
1594
|
+
}
|
|
1595
|
+
);
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1576
1598
|
// visio/cell-formula.ts
|
|
1577
1599
|
function executableCellFormula(source) {
|
|
1578
1600
|
return !source || source === "No Formula" || source === "Inh" ? void 0 : source;
|
|
@@ -1580,6 +1602,7 @@ function executableCellFormula(source) {
|
|
|
1580
1602
|
function inertDoubleClickFormula(cell, source) {
|
|
1581
1603
|
return cell === "EventDblClick" && /^\s*=?\s*(OPENTEXTWIN|DEFAULTEVENT)\(\s*\)\s*$/i.test(source);
|
|
1582
1604
|
}
|
|
1605
|
+
var shapeDataFormulaSection = (name3) => name3 === "Property" ? "Prop" : name3;
|
|
1583
1606
|
|
|
1584
1607
|
// visio/formula-theme.ts
|
|
1585
1608
|
var themeInputs = [
|
|
@@ -2969,6 +2992,19 @@ function createBox(root2, document, edit) {
|
|
|
2969
2992
|
value,
|
|
2970
2993
|
name3 === "LocPinX" ? "Width*0.5" : name3 === "LocPinY" ? "Height*0.5" : void 0
|
|
2971
2994
|
);
|
|
2995
|
+
if (edit.followShapeId !== void 0) {
|
|
2996
|
+
const owner = admitted(root2, edit.followShapeId);
|
|
2997
|
+
const local = cells(owner);
|
|
2998
|
+
if (isLineSheet(local))
|
|
2999
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Position followers require a 2D owner.");
|
|
3000
|
+
for (const [name3, value] of [
|
|
3001
|
+
["PinX", edit.x],
|
|
3002
|
+
["PinY", edit.y]
|
|
3003
|
+
]) {
|
|
3004
|
+
const offset = value - numeric(local.get(name3));
|
|
3005
|
+
setCell(shape, name3, value, `Sheet.${edit.followShapeId}!${name3}+(${offset}IN)`);
|
|
3006
|
+
}
|
|
3007
|
+
}
|
|
2972
3008
|
return shape;
|
|
2973
3009
|
}
|
|
2974
3010
|
function createRectangle(root2, document, edit) {
|
|
@@ -3552,7 +3588,7 @@ function indexCells(roots, options) {
|
|
|
3552
3588
|
for (const node2 of children2(sheet.node, "Cell"))
|
|
3553
3589
|
addNode(node2, attribute2(node2, "N") ?? "", false, false, glue);
|
|
3554
3590
|
for (const section3 of children2(sheet.node, "Section")) {
|
|
3555
|
-
const name3 = attribute2(section3, "N") ?? "";
|
|
3591
|
+
const name3 = shapeDataFormulaSection(attribute2(section3, "N") ?? "");
|
|
3556
3592
|
const prefix2 = name3 === "Geometry" ? `Geometry${Number(attribute2(section3, "IX") ?? "0") + 1}` : name3;
|
|
3557
3593
|
const deleted4 = ["1", "true"].includes(attribute2(section3, "Del") ?? "");
|
|
3558
3594
|
for (const node2 of children2(section3, "Cell"))
|
|
@@ -4148,6 +4184,7 @@ function effectiveShapeCell(shape, document, name3, category, rows) {
|
|
|
4148
4184
|
if (delegatedLocal && !(category === "TextStyle" && cellName && ["Character", "Paragraph"].includes(section3)))
|
|
4149
4185
|
fail("EDIT_PROTECTED_CELL", "Inherited formatting cells cannot be overwritten.");
|
|
4150
4186
|
if (local && !cellName) return local;
|
|
4187
|
+
if (/^ConLineJump(?:Code|Style|DirX|DirY)$/.test(name3)) return void 0;
|
|
4151
4188
|
if (cellName) {
|
|
4152
4189
|
const sources = rows?.source ?? effectiveFormattingRows(shape, document, section3);
|
|
4153
4190
|
const cells4 = sources.get(index) ?? sources.get("0");
|
|
@@ -4388,14 +4425,9 @@ function serializeEditedXml(root2, limits, check) {
|
|
|
4388
4425
|
const node2 = pending.pop();
|
|
4389
4426
|
if ((node2.nodeType === 3 || node2.nodeType === 4) && node2.nodeValue?.includes("\r"))
|
|
4390
4427
|
fail("UNSUPPORTED_XML_EDIT", "Carriage-return text cannot be preserved by this writer.");
|
|
4391
|
-
if (node2.nodeType === 1) {
|
|
4392
|
-
for (const attr2 of Array.from(node2.attributes))
|
|
4393
|
-
if (/[\t\r\n]/.test(attr2.value))
|
|
4394
|
-
fail("UNSUPPORTED_XML_EDIT", "Attribute whitespace cannot be preserved by this writer.");
|
|
4395
|
-
}
|
|
4396
4428
|
for (const child3 of Array.from(node2.childNodes)) pending.push(child3);
|
|
4397
4429
|
}
|
|
4398
|
-
let xml = buildXml(root2.ownerDocument);
|
|
4430
|
+
let xml = preserveAttributeWhitespace(buildXml(root2.ownerDocument));
|
|
4399
4431
|
xml = xml.replace(
|
|
4400
4432
|
/^<\?xml\s[^?]*\?>/,
|
|
4401
4433
|
(declaration) => declaration.replace(/encoding\s*=\s*(['"])[^'"]*\1/, 'encoding="UTF-8"')
|
|
@@ -7263,10 +7295,10 @@ function orderedColorTransforms(channels, transforms) {
|
|
|
7263
7295
|
else if (name3 === "inv") [r, g, b] = [255 - r, 255 - g, 255 - b];
|
|
7264
7296
|
else if (name3 === "gray") r = g = b = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
7265
7297
|
else if ((name3 === "shade" || name3 === "tint") && fraction !== void 0) {
|
|
7266
|
-
const
|
|
7298
|
+
const mix3 = (channel) => linearToSrgb255(
|
|
7267
7299
|
name3 === "shade" ? srgb255ToLinear(channel) * fraction : 1 - (1 - srgb255ToLinear(channel)) * fraction
|
|
7268
7300
|
);
|
|
7269
|
-
[r, g, b] = [
|
|
7301
|
+
[r, g, b] = [mix3(r), mix3(g), mix3(b)];
|
|
7270
7302
|
} else {
|
|
7271
7303
|
const hsl = rgbToHsl(r, g, b);
|
|
7272
7304
|
if (name3 === "comp") hsl.h = wrap(hsl.h + 180);
|
|
@@ -8619,6 +8651,230 @@ function characterExtras(cells4, report) {
|
|
|
8619
8651
|
};
|
|
8620
8652
|
}
|
|
8621
8653
|
|
|
8654
|
+
// visio/text-field-case.ts
|
|
8655
|
+
var LOWER = [
|
|
8656
|
+
[65, 90, 1, 32],
|
|
8657
|
+
[192, 214, 1, 32],
|
|
8658
|
+
[216, 222, 1, 32],
|
|
8659
|
+
[256, 302, 2, 1],
|
|
8660
|
+
[304, 304, 2, -199],
|
|
8661
|
+
[306, 310, 2, 1],
|
|
8662
|
+
[313, 327, 2, 1],
|
|
8663
|
+
[330, 374, 2, 1],
|
|
8664
|
+
[376, 376, 1, -121],
|
|
8665
|
+
[377, 381, 2, 1],
|
|
8666
|
+
[385, 385, 1, 210],
|
|
8667
|
+
[386, 388, 2, 1],
|
|
8668
|
+
[390, 390, 1, 206],
|
|
8669
|
+
[391, 391, 2, 1],
|
|
8670
|
+
[393, 394, 1, 205],
|
|
8671
|
+
[395, 395, 1, 1],
|
|
8672
|
+
[398, 398, 1, 79],
|
|
8673
|
+
[399, 399, 1, 202],
|
|
8674
|
+
[400, 400, 1, 203],
|
|
8675
|
+
[401, 401, 2, 1],
|
|
8676
|
+
[403, 403, 1, 205],
|
|
8677
|
+
[404, 404, 2, 207],
|
|
8678
|
+
[406, 406, 1, 211],
|
|
8679
|
+
[407, 407, 1, 209],
|
|
8680
|
+
[408, 408, 1, 1],
|
|
8681
|
+
[412, 412, 1, 211],
|
|
8682
|
+
[413, 413, 2, 213],
|
|
8683
|
+
[415, 415, 1, 214],
|
|
8684
|
+
[416, 420, 2, 1],
|
|
8685
|
+
[422, 422, 1, 218],
|
|
8686
|
+
[423, 423, 2, 1],
|
|
8687
|
+
[425, 425, 1, 218],
|
|
8688
|
+
[428, 428, 2, 1],
|
|
8689
|
+
[430, 430, 1, 218],
|
|
8690
|
+
[431, 431, 2, 1],
|
|
8691
|
+
[433, 434, 1, 217],
|
|
8692
|
+
[435, 437, 2, 1],
|
|
8693
|
+
[439, 439, 1, 219],
|
|
8694
|
+
[440, 440, 1, 1],
|
|
8695
|
+
[444, 444, 1, 1],
|
|
8696
|
+
[452, 452, 1, 2],
|
|
8697
|
+
[453, 453, 2, 1],
|
|
8698
|
+
[455, 455, 1, 2],
|
|
8699
|
+
[456, 456, 2, 1],
|
|
8700
|
+
[458, 458, 1, 2],
|
|
8701
|
+
[459, 475, 2, 1],
|
|
8702
|
+
[478, 494, 2, 1],
|
|
8703
|
+
[497, 497, 1, 2],
|
|
8704
|
+
[498, 500, 2, 1],
|
|
8705
|
+
[502, 502, 1, -97],
|
|
8706
|
+
[503, 503, 1, -56],
|
|
8707
|
+
[504, 542, 2, 1],
|
|
8708
|
+
[544, 544, 2, -130],
|
|
8709
|
+
[546, 562, 2, 1],
|
|
8710
|
+
[570, 570, 1, 10795],
|
|
8711
|
+
[571, 571, 2, 1],
|
|
8712
|
+
[573, 573, 1, -163],
|
|
8713
|
+
[574, 574, 1, 10792],
|
|
8714
|
+
[577, 577, 2, 1],
|
|
8715
|
+
[579, 579, 1, -195],
|
|
8716
|
+
[580, 580, 1, 69],
|
|
8717
|
+
[581, 581, 1, 71],
|
|
8718
|
+
[582, 590, 2, 1],
|
|
8719
|
+
[902, 902, 2, 38],
|
|
8720
|
+
[904, 906, 1, 37],
|
|
8721
|
+
[908, 908, 2, 64],
|
|
8722
|
+
[910, 911, 1, 63],
|
|
8723
|
+
[913, 929, 1, 32],
|
|
8724
|
+
[931, 939, 1, 32],
|
|
8725
|
+
[986, 1006, 2, 1],
|
|
8726
|
+
[1024, 1039, 1, 80],
|
|
8727
|
+
[1040, 1071, 1, 32],
|
|
8728
|
+
[1120, 1152, 2, 1],
|
|
8729
|
+
[1162, 1214, 2, 1],
|
|
8730
|
+
[1216, 1216, 1, 15],
|
|
8731
|
+
[1217, 1229, 2, 1],
|
|
8732
|
+
[1232, 1298, 2, 1],
|
|
8733
|
+
[1329, 1366, 1, 48],
|
|
8734
|
+
[4256, 4293, 1, 48],
|
|
8735
|
+
[7680, 7828, 2, 1],
|
|
8736
|
+
[7840, 7928, 2, 1],
|
|
8737
|
+
[8498, 8498, 1, 28],
|
|
8738
|
+
[8579, 8579, 1, 1],
|
|
8739
|
+
[9398, 9423, 1, 26],
|
|
8740
|
+
[11360, 11360, 2, 1],
|
|
8741
|
+
[11362, 11362, 1, -10743],
|
|
8742
|
+
[11363, 11363, 1, -3814],
|
|
8743
|
+
[11364, 11364, 1, -10727],
|
|
8744
|
+
[11367, 11371, 2, 1],
|
|
8745
|
+
[11381, 11381, 1, 1],
|
|
8746
|
+
[65313, 65338, 1, 32],
|
|
8747
|
+
[66560, 66599, 1, 40],
|
|
8748
|
+
[66736, 66771, 1, 40],
|
|
8749
|
+
[68736, 68786, 1, 64],
|
|
8750
|
+
[71840, 71871, 1, 32],
|
|
8751
|
+
[93760, 93791, 1, 32],
|
|
8752
|
+
[125184, 125217, 1, 34]
|
|
8753
|
+
];
|
|
8754
|
+
var UPPER = [
|
|
8755
|
+
[97, 122, 1, -32],
|
|
8756
|
+
[224, 246, 1, -32],
|
|
8757
|
+
[248, 254, 1, -32],
|
|
8758
|
+
[255, 255, 2, 121],
|
|
8759
|
+
[257, 303, 2, -1],
|
|
8760
|
+
[305, 305, 2, -232],
|
|
8761
|
+
[307, 311, 2, -1],
|
|
8762
|
+
[314, 328, 2, -1],
|
|
8763
|
+
[331, 375, 2, -1],
|
|
8764
|
+
[378, 382, 2, -1],
|
|
8765
|
+
[384, 384, 1, 195],
|
|
8766
|
+
[387, 389, 2, -1],
|
|
8767
|
+
[392, 392, 1, -1],
|
|
8768
|
+
[396, 396, 1, -1],
|
|
8769
|
+
[402, 402, 1, -1],
|
|
8770
|
+
[405, 405, 1, 97],
|
|
8771
|
+
[409, 409, 1, -1],
|
|
8772
|
+
[410, 410, 1, 163],
|
|
8773
|
+
[414, 414, 1, 130],
|
|
8774
|
+
[417, 421, 2, -1],
|
|
8775
|
+
[424, 424, 1, -1],
|
|
8776
|
+
[429, 429, 1, -1],
|
|
8777
|
+
[432, 432, 1, -1],
|
|
8778
|
+
[436, 438, 2, -1],
|
|
8779
|
+
[441, 441, 1, -1],
|
|
8780
|
+
[445, 445, 2, -1],
|
|
8781
|
+
[447, 447, 1, 56],
|
|
8782
|
+
[453, 453, 1, -1],
|
|
8783
|
+
[454, 454, 2, -2],
|
|
8784
|
+
[456, 456, 1, -1],
|
|
8785
|
+
[457, 457, 2, -2],
|
|
8786
|
+
[459, 459, 1, -1],
|
|
8787
|
+
[460, 460, 2, -2],
|
|
8788
|
+
[462, 476, 2, -1],
|
|
8789
|
+
[477, 477, 2, -79],
|
|
8790
|
+
[479, 495, 2, -1],
|
|
8791
|
+
[498, 498, 1, -1],
|
|
8792
|
+
[499, 499, 2, -2],
|
|
8793
|
+
[501, 501, 1, -1],
|
|
8794
|
+
[505, 543, 2, -1],
|
|
8795
|
+
[547, 563, 2, -1],
|
|
8796
|
+
[572, 572, 1, -1],
|
|
8797
|
+
[578, 578, 1, -1],
|
|
8798
|
+
[583, 591, 2, -1],
|
|
8799
|
+
[595, 595, 1, -210],
|
|
8800
|
+
[596, 596, 2, -206],
|
|
8801
|
+
[598, 599, 1, -205],
|
|
8802
|
+
[601, 601, 2, -202],
|
|
8803
|
+
[603, 603, 1, -203],
|
|
8804
|
+
[608, 608, 1, -205],
|
|
8805
|
+
[611, 611, 1, -207],
|
|
8806
|
+
[616, 616, 1, -209],
|
|
8807
|
+
[617, 617, 2, -211],
|
|
8808
|
+
[619, 619, 1, 10743],
|
|
8809
|
+
[623, 623, 1, -211],
|
|
8810
|
+
[626, 626, 1, -213],
|
|
8811
|
+
[629, 629, 1, -214],
|
|
8812
|
+
[637, 637, 1, 10727],
|
|
8813
|
+
[640, 640, 1, -218],
|
|
8814
|
+
[643, 643, 1, -218],
|
|
8815
|
+
[648, 648, 1, -218],
|
|
8816
|
+
[649, 649, 1, -69],
|
|
8817
|
+
[650, 651, 1, -217],
|
|
8818
|
+
[652, 652, 1, -71],
|
|
8819
|
+
[658, 658, 1, -219],
|
|
8820
|
+
[912, 912, 1, 26],
|
|
8821
|
+
[940, 940, 1, -38],
|
|
8822
|
+
[941, 943, 1, -37],
|
|
8823
|
+
[944, 944, 1, -5],
|
|
8824
|
+
[945, 961, 1, -32],
|
|
8825
|
+
[962, 962, 1, -31],
|
|
8826
|
+
[963, 971, 1, -32],
|
|
8827
|
+
[972, 972, 1, -64],
|
|
8828
|
+
[973, 974, 1, -63],
|
|
8829
|
+
[976, 976, 1, -62],
|
|
8830
|
+
[977, 977, 1, -57],
|
|
8831
|
+
[981, 981, 1, -47],
|
|
8832
|
+
[982, 982, 1, -54],
|
|
8833
|
+
[987, 1007, 2, -1],
|
|
8834
|
+
[1008, 1008, 1, -86],
|
|
8835
|
+
[1009, 1009, 1, -80],
|
|
8836
|
+
[1072, 1103, 1, -32],
|
|
8837
|
+
[1104, 1119, 1, -80],
|
|
8838
|
+
[1121, 1153, 2, -1],
|
|
8839
|
+
[1163, 1215, 2, -1],
|
|
8840
|
+
[1218, 1230, 2, -1],
|
|
8841
|
+
[1231, 1231, 2, -15],
|
|
8842
|
+
[1233, 1299, 2, -1],
|
|
8843
|
+
[1377, 1414, 1, -48],
|
|
8844
|
+
[7549, 7549, 1, 3814],
|
|
8845
|
+
[7681, 7829, 2, -1],
|
|
8846
|
+
[7841, 7929, 2, -1],
|
|
8847
|
+
[8526, 8526, 1, -28],
|
|
8848
|
+
[8580, 8580, 1, -1],
|
|
8849
|
+
[9424, 9449, 1, -26],
|
|
8850
|
+
[11361, 11361, 1, -1],
|
|
8851
|
+
[11365, 11365, 1, -10795],
|
|
8852
|
+
[11366, 11366, 2, -10792],
|
|
8853
|
+
[11368, 11372, 2, -1],
|
|
8854
|
+
[11382, 11382, 1, -1],
|
|
8855
|
+
[65345, 65370, 1, -32],
|
|
8856
|
+
[66600, 66639, 1, -40],
|
|
8857
|
+
[66776, 66811, 1, -40],
|
|
8858
|
+
[68800, 68850, 1, -64],
|
|
8859
|
+
[71872, 71903, 1, -32],
|
|
8860
|
+
[93792, 93823, 1, -32],
|
|
8861
|
+
[125218, 125251, 1, -34]
|
|
8862
|
+
];
|
|
8863
|
+
function visioFieldCase(text5, upper) {
|
|
8864
|
+
const ranges = upper ? UPPER : LOWER;
|
|
8865
|
+
return Array.from(text5, (character) => {
|
|
8866
|
+
const point2 = character.codePointAt(0);
|
|
8867
|
+
let low = 0, high = ranges.length;
|
|
8868
|
+
while (low < high) {
|
|
8869
|
+
const middle = low + high >>> 1;
|
|
8870
|
+
if (ranges[middle][1] < point2) low = middle + 1;
|
|
8871
|
+
else high = middle;
|
|
8872
|
+
}
|
|
8873
|
+
const range2 = ranges[low];
|
|
8874
|
+
return range2 && point2 >= range2[0] && (point2 - range2[0]) % range2[2] === 0 ? String.fromCodePoint(point2 + range2[3]) : character;
|
|
8875
|
+
}).join("");
|
|
8876
|
+
}
|
|
8877
|
+
|
|
8622
8878
|
// visio/text-fields.ts
|
|
8623
8879
|
var PROPERTY_FUNCTIONS = {
|
|
8624
8880
|
TITLE: "title",
|
|
@@ -8805,6 +9061,30 @@ function formatVisioFieldValue(value, format4 = "") {
|
|
|
8805
9061
|
return units2 || body === "" ? `${text5}${suffix}` : text5;
|
|
8806
9062
|
}
|
|
8807
9063
|
|
|
9064
|
+
// visio/text-field-numeric.ts
|
|
9065
|
+
function numericFieldPicture(value, code, displayUnit) {
|
|
9066
|
+
if (value.kind !== "number" || code < 2 || code > 9 || !Number.isInteger(code)) return void 0;
|
|
9067
|
+
const unit3 = displayUnit?.toUpperCase() ?? "NUM";
|
|
9068
|
+
const units2 = {
|
|
9069
|
+
NUM: ["scalar", 1, ""],
|
|
9070
|
+
IN: ["length", 1, " in."],
|
|
9071
|
+
MM: ["length", 25.4, " mm."],
|
|
9072
|
+
CM: ["length", 2.54, " cm."],
|
|
9073
|
+
FT: ["length", 1 / 12, " ft."],
|
|
9074
|
+
DEG: ["angle", 180 / Math.PI, " deg."],
|
|
9075
|
+
RAD: ["angle", 1, " rad."]
|
|
9076
|
+
};
|
|
9077
|
+
const definition = Object.hasOwn(units2, unit3) ? units2[unit3] : void 0;
|
|
9078
|
+
if (!definition || definition[0] !== value.unit) return void 0;
|
|
9079
|
+
const decimals = Math.floor((code - 2) / 2);
|
|
9080
|
+
const picture = decimals ? `0.${"0".repeat(decimals)}` : "0";
|
|
9081
|
+
const text5 = formatVisioFieldValue(
|
|
9082
|
+
{ kind: "number", value: value.value * definition[1], unit: "scalar" },
|
|
9083
|
+
picture
|
|
9084
|
+
);
|
|
9085
|
+
return text5 === void 0 ? void 0 : text5 + (code % 2 ? definition[2] : "");
|
|
9086
|
+
}
|
|
9087
|
+
|
|
8808
9088
|
// visio/text-field-display.ts
|
|
8809
9089
|
function cachedValue(value, unit3) {
|
|
8810
9090
|
if (value === void 0) return void 0;
|
|
@@ -8827,11 +9107,21 @@ function textFieldDisplay(element2, sheet, context) {
|
|
|
8827
9107
|
const value = row2?.cells.get("Value"), format4 = row2?.cells.get("Format");
|
|
8828
9108
|
const formula = value?.formula && value.formula !== "Inh" ? value.formula : void 0;
|
|
8829
9109
|
const result = { cached: cached5, ...formula ? { formula } : {} };
|
|
8830
|
-
if (!row2 || !context
|
|
8831
|
-
return { text: cached5, ...result };
|
|
9110
|
+
if (!row2 || !context) return { text: cached5, ...result };
|
|
8832
9111
|
const picture = format4?.value ?? "";
|
|
8833
9112
|
const evaluated = formula ? evaluateVisioTextField(formula, context) : void 0;
|
|
8834
9113
|
const source = evaluated ?? cachedValue(value?.value, value?.unit);
|
|
9114
|
+
if (format4?.formula && /^\s*FIELDPICTURE\s*\(/i.test(format4.formula)) {
|
|
9115
|
+
const code = /^\s*FIELDPICTURE\s*\(\s*(\d+)\s*\)\s*$/i.exec(format4.formula)?.[1];
|
|
9116
|
+
let text6 = cached5;
|
|
9117
|
+
if (source?.kind === "string") {
|
|
9118
|
+
if (code === "0" || code === "37") text6 = source.text;
|
|
9119
|
+
else if (code === "38" || code === "39") text6 = visioFieldCase(source.text, code === "39");
|
|
9120
|
+
}
|
|
9121
|
+
if (source?.kind === "number" && code !== void 0)
|
|
9122
|
+
text6 = numericFieldPicture(source, Number(code), value?.unit) ?? cached5;
|
|
9123
|
+
return { text: text6, ...result };
|
|
9124
|
+
}
|
|
8835
9125
|
const text5 = source ? formatVisioFieldValue(source, picture) : void 0;
|
|
8836
9126
|
return { text: text5 ?? cached5, ...result };
|
|
8837
9127
|
}
|
|
@@ -9426,7 +9716,7 @@ function geometryPaths(sheet, width, height, report, consume, consumeWork = () =
|
|
|
9426
9716
|
else {
|
|
9427
9717
|
const radius = chord * chord / (8 * Math.abs(bow)) + Math.abs(bow) / 2;
|
|
9428
9718
|
commands.push(
|
|
9429
|
-
`A ${point(radius, radius)} 0 ${Math.abs(bow) > chord / 2 ? 1 : 0} ${bow < 0 ?
|
|
9719
|
+
`A ${point(radius, radius)} 0 ${Math.abs(bow) > chord / 2 ? 1 : 0} ${bow < 0 ? 0 : 1} ${point(x, y)}`
|
|
9430
9720
|
);
|
|
9431
9721
|
}
|
|
9432
9722
|
break;
|
|
@@ -10402,6 +10692,21 @@ function hyperlink(row2, budget, report) {
|
|
|
10402
10692
|
...sortKey === void 0 ? {} : { sortKey }
|
|
10403
10693
|
};
|
|
10404
10694
|
}
|
|
10695
|
+
function alternativeTextMetadata(sheet, report, budget) {
|
|
10696
|
+
const result = {};
|
|
10697
|
+
for (const section3 of sheet.sections.values()) {
|
|
10698
|
+
if (section3.deleted || section3.name !== "User") continue;
|
|
10699
|
+
for (const row2 of section3.rows.values()) {
|
|
10700
|
+
if (row2.deleted || !["visAltText", "visAltDescription"].includes(row2.name ?? row2.index))
|
|
10701
|
+
continue;
|
|
10702
|
+
budget.consumeRow();
|
|
10703
|
+
const value = cached(row2.cells, "Value", budget, report);
|
|
10704
|
+
if (value !== void 0)
|
|
10705
|
+
result[(row2.name ?? row2.index) === "visAltText" ? "accessibilityTitle" : "alternativeText"] = value;
|
|
10706
|
+
}
|
|
10707
|
+
}
|
|
10708
|
+
return result;
|
|
10709
|
+
}
|
|
10405
10710
|
function shapeMetadata(sheet, report, budget = createMetadataBudget()) {
|
|
10406
10711
|
const shapeData = [], hyperlinks = [];
|
|
10407
10712
|
let count = 0;
|
|
@@ -10418,7 +10723,12 @@ function shapeMetadata(sheet, report, budget = createMetadataBudget()) {
|
|
|
10418
10723
|
}
|
|
10419
10724
|
const comment = sheet.cells.get("Comment");
|
|
10420
10725
|
const screenTip = comment?.value && comment.error === void 0 ? budget.retain(comment.value) : void 0;
|
|
10421
|
-
return {
|
|
10726
|
+
return {
|
|
10727
|
+
shapeData,
|
|
10728
|
+
hyperlinks,
|
|
10729
|
+
...alternativeTextMetadata(sheet, report, budget),
|
|
10730
|
+
...screenTip === void 0 ? {} : { screenTip }
|
|
10731
|
+
};
|
|
10422
10732
|
}
|
|
10423
10733
|
|
|
10424
10734
|
// visio/theme-root.ts
|
|
@@ -10777,6 +11087,31 @@ function shapeConnections(sheet, local, inheritedSheet, transform2, oneD, report
|
|
|
10777
11087
|
return result;
|
|
10778
11088
|
}
|
|
10779
11089
|
|
|
11090
|
+
// visio/connector-jumps.ts
|
|
11091
|
+
function readConnectorJumps(cells4, report) {
|
|
11092
|
+
const result = {};
|
|
11093
|
+
for (const [key2, name3, maximum] of [
|
|
11094
|
+
["lineJumpCode", "ConLineJumpCode", 4],
|
|
11095
|
+
["lineJumpStyle", "ConLineJumpStyle", 9],
|
|
11096
|
+
["lineJumpDirectionX", "ConLineJumpDirX", 2],
|
|
11097
|
+
["lineJumpDirectionY", "ConLineJumpDirY", 2]
|
|
11098
|
+
]) {
|
|
11099
|
+
const cell = cells4.get(name3);
|
|
11100
|
+
if (!cell || cell.formula === "Inh") continue;
|
|
11101
|
+
const raw = cell.value?.trim();
|
|
11102
|
+
const value = raw && raw.length <= 64 && /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(raw) ? Number(raw) : NaN;
|
|
11103
|
+
if (cell.error !== void 0 || !Number.isInteger(value) || value < 0 || value > maximum) {
|
|
11104
|
+
report(
|
|
11105
|
+
"unsupported-connector-jump",
|
|
11106
|
+
`${name3} has no supported cached value; the page setting is used.`
|
|
11107
|
+
);
|
|
11108
|
+
continue;
|
|
11109
|
+
}
|
|
11110
|
+
result[key2] = value;
|
|
11111
|
+
}
|
|
11112
|
+
return result;
|
|
11113
|
+
}
|
|
11114
|
+
|
|
10780
11115
|
// visio/shapes.ts
|
|
10781
11116
|
function mergeShape(base2, local, context) {
|
|
10782
11117
|
context.consumeExpansion();
|
|
@@ -10939,6 +11274,7 @@ function normalizeShapes(raw, context, depth = 0, masterStack = []) {
|
|
|
10939
11274
|
report("missing-geometry", "Shape has no supported cached geometry.");
|
|
10940
11275
|
return {
|
|
10941
11276
|
...shapeMetadata(sheet, report, context.metadataBudget),
|
|
11277
|
+
...oneD ? readConnectorJumps(sheet.cells, report) : {},
|
|
10942
11278
|
...structureOf(sheet),
|
|
10943
11279
|
id: shape.id,
|
|
10944
11280
|
name: shape.attributes.get("Name") ?? shape.attributes.get("NameU") ?? `Shape ${shape.id}`,
|
|
@@ -11162,6 +11498,12 @@ var VISIO_RULER_DENSITIES = Object.freeze([8, 16, 32]);
|
|
|
11162
11498
|
var VISIO_PAGE_LAYOUT_DEFAULTS = Object.freeze({
|
|
11163
11499
|
lineJumpCode: 1,
|
|
11164
11500
|
lineJumpStyle: 0,
|
|
11501
|
+
lineJumpDirectionX: 0,
|
|
11502
|
+
lineJumpDirectionY: 0,
|
|
11503
|
+
lineJumpFactorX: 2 / 3,
|
|
11504
|
+
lineJumpFactorY: 2 / 3,
|
|
11505
|
+
lineToLineX: 0.125,
|
|
11506
|
+
lineToLineY: 0.125,
|
|
11165
11507
|
gridDensityX: 8,
|
|
11166
11508
|
gridDensityY: 8,
|
|
11167
11509
|
gridSpacingX: 0,
|
|
@@ -11176,6 +11518,12 @@ var VISIO_PAGE_LAYOUT_DEFAULTS = Object.freeze({
|
|
|
11176
11518
|
var NAMES = {
|
|
11177
11519
|
lineJumpCode: "LineJumpCode",
|
|
11178
11520
|
lineJumpStyle: "LineJumpStyle",
|
|
11521
|
+
lineJumpDirectionX: "PageLineJumpDirX",
|
|
11522
|
+
lineJumpDirectionY: "PageLineJumpDirY",
|
|
11523
|
+
lineJumpFactorX: "LineJumpFactorX",
|
|
11524
|
+
lineJumpFactorY: "LineJumpFactorY",
|
|
11525
|
+
lineToLineX: "LineToLineX",
|
|
11526
|
+
lineToLineY: "LineToLineY",
|
|
11179
11527
|
gridDensityX: "XGridDensity",
|
|
11180
11528
|
gridDensityY: "YGridDensity",
|
|
11181
11529
|
gridSpacingX: "XGridSpacing",
|
|
@@ -12037,6 +12385,7 @@ async function parseVsdx(input, options = {}) {
|
|
|
12037
12385
|
localReport("dangling-connection", "A connection references a missing shape.");
|
|
12038
12386
|
pages.push({
|
|
12039
12387
|
id: id3,
|
|
12388
|
+
...alternativeTextMetadata(sheet, localReport, context.metadataBudget),
|
|
12040
12389
|
...pageModes,
|
|
12041
12390
|
...drawingToPageScale === 1 ? {} : { drawingToPageScale },
|
|
12042
12391
|
...pageSetup ? { pageSetup } : {},
|
|
@@ -21574,6 +21923,9 @@ async function assertFormattingDependencies(pkg, pagePaths, roots, pageId2, shap
|
|
|
21574
21923
|
indexCells(roots, { check });
|
|
21575
21924
|
const shapeId2 = attribute2(shape, "ID");
|
|
21576
21925
|
const changedNames = new Set([...changed.keys()].map((name3) => name3.toLowerCase()));
|
|
21926
|
+
const jumpOnly = [...changedNames].every(
|
|
21927
|
+
(name3) => /^conlinejump(code|style|dirx|diry)$/.test(name3)
|
|
21928
|
+
);
|
|
21577
21929
|
const canonical2 = (name3) => name3.toLowerCase().replace(/^char\.([a-z]+)$/, "character.0.$1").replace(/^para\.([a-z]+)$/, "paragraph.0.$1");
|
|
21578
21930
|
const replaced = new Set(changed.values());
|
|
21579
21931
|
const textEdit = [...changedNames].some(
|
|
@@ -21594,6 +21946,9 @@ async function assertFormattingDependencies(pkg, pagePaths, roots, pageId2, shap
|
|
|
21594
21946
|
if (!source || inertDoubleClickFormula(attribute2(node2, "N") ?? "", source)) continue;
|
|
21595
21947
|
if (attribute2(node2, "V") === "Themed" && isThemeLookupFormula(source)) continue;
|
|
21596
21948
|
if (isConnectedGlueCell(node2, source)) continue;
|
|
21949
|
+
const owner = node2.parentNode;
|
|
21950
|
+
if (jumpOnly && node2.localName === "Cell" && /^(BegTrigger|EndTrigger)$/.test(attribute2(node2, "N") ?? "") && owner?.localName === "Shape" && owner.parentNode?.parentNode?.localName === "PageContents" && visioGlueTriggerTarget(source) === attribute2(owner, "ID"))
|
|
21951
|
+
continue;
|
|
21597
21952
|
let localShapeId;
|
|
21598
21953
|
let parent = node2;
|
|
21599
21954
|
while (parent?.nodeType === 1) {
|
|
@@ -21676,7 +22031,7 @@ function masterCells(sheet, charge = () => {
|
|
|
21676
22031
|
};
|
|
21677
22032
|
for (const node2 of children2(sheet, "Cell")) add(attribute2(node2, "N") ?? "", node2);
|
|
21678
22033
|
for (const section3 of children2(sheet, "Section")) {
|
|
21679
|
-
const name3 = attribute2(section3, "N") ?? "";
|
|
22034
|
+
const name3 = shapeDataFormulaSection(attribute2(section3, "N") ?? "");
|
|
21680
22035
|
const prefix2 = name3 === "Geometry" ? `Geometry${Number(attribute2(section3, "IX") ?? "0") + 1}` : name3 === "Control" ? "Controls" : name3;
|
|
21681
22036
|
for (const node2 of children2(section3, "Cell"))
|
|
21682
22037
|
add(`${prefix2}.${attribute2(node2, "N") ?? ""}`, node2);
|
|
@@ -23218,6 +23573,99 @@ function connectorObstacles(root2, exclude) {
|
|
|
23218
23573
|
return result;
|
|
23219
23574
|
}
|
|
23220
23575
|
|
|
23576
|
+
// visio/connector-curve-aligned.ts
|
|
23577
|
+
function alignedVisioCurve(begin, end) {
|
|
23578
|
+
const a = begin.shape;
|
|
23579
|
+
const b = end.shape;
|
|
23580
|
+
if (!a || !b) return void 0;
|
|
23581
|
+
for (const shape of [a, b])
|
|
23582
|
+
if (shape.corners.some(
|
|
23583
|
+
(p) => Math.abs(p.x - shape.bounds.minX) > 1e-9 && Math.abs(p.x - shape.bounds.maxX) > 1e-9 || Math.abs(p.y - shape.bounds.minY) > 1e-9 && Math.abs(p.y - shape.bounds.maxY) > 1e-9
|
|
23584
|
+
))
|
|
23585
|
+
return void 0;
|
|
23586
|
+
for (const axis of ["x", "y"]) {
|
|
23587
|
+
const horizontal2 = axis === "x";
|
|
23588
|
+
const low = horizontal2 ? "minY" : "minX";
|
|
23589
|
+
const high = horizontal2 ? "maxY" : "maxX";
|
|
23590
|
+
const overlapLow = Math.max(a.bounds[low], b.bounds[low]);
|
|
23591
|
+
const overlapHigh = Math.min(a.bounds[high], b.bounds[high]);
|
|
23592
|
+
if (overlapHigh - overlapLow <= 1e-9) continue;
|
|
23593
|
+
const forward = b.center[axis] > a.center[axis];
|
|
23594
|
+
const from = horizontal2 ? a.bounds[forward ? "maxX" : "minX"] : a.bounds[forward ? "maxY" : "minY"];
|
|
23595
|
+
const to = horizontal2 ? b.bounds[forward ? "minX" : "maxX"] : b.bounds[forward ? "minY" : "maxY"];
|
|
23596
|
+
if ((to - from) * (forward ? 1 : -1) <= 1e-9) continue;
|
|
23597
|
+
const middle = (overlapLow + overlapHigh) / 2;
|
|
23598
|
+
return [0, 0.25, 0.75, 1].map((t) => {
|
|
23599
|
+
const along = from + (to - from) * t;
|
|
23600
|
+
return horizontal2 ? { x: along, y: middle } : { x: middle, y: along };
|
|
23601
|
+
});
|
|
23602
|
+
}
|
|
23603
|
+
return void 0;
|
|
23604
|
+
}
|
|
23605
|
+
|
|
23606
|
+
// visio/connector-curve-spans.ts
|
|
23607
|
+
var mix = (a, b, t) => ({
|
|
23608
|
+
x: a.x + (b.x - a.x) * t,
|
|
23609
|
+
y: a.y + (b.y - a.y) * t
|
|
23610
|
+
});
|
|
23611
|
+
function cornerCurve(path) {
|
|
23612
|
+
const [begin, corner, end] = path;
|
|
23613
|
+
return [begin, mix(begin, corner, 0.25), corner, mix(corner, end, 0.75), end];
|
|
23614
|
+
}
|
|
23615
|
+
function cornerCurveKnots(points) {
|
|
23616
|
+
const distance4 = (a, b) => Math.hypot(points[b].x - points[a].x, points[b].y - points[a].y) / 3;
|
|
23617
|
+
const internal = distance4(0, 3);
|
|
23618
|
+
return [internal, internal + distance4(1, 4)];
|
|
23619
|
+
}
|
|
23620
|
+
function connectorCurveSpans(points) {
|
|
23621
|
+
if (points.length === 4) return [[...points]];
|
|
23622
|
+
if (points.length !== 5) return [];
|
|
23623
|
+
const [internal, last] = cornerCurveKnots(points);
|
|
23624
|
+
const ratio = internal / last;
|
|
23625
|
+
const left = mix(points[1], points[2], ratio);
|
|
23626
|
+
const right2 = mix(points[2], points[3], ratio);
|
|
23627
|
+
const join = mix(left, right2, ratio);
|
|
23628
|
+
return [
|
|
23629
|
+
[points[0], points[1], left, join],
|
|
23630
|
+
[join, right2, points[3], points[4]]
|
|
23631
|
+
];
|
|
23632
|
+
}
|
|
23633
|
+
function connectorPolylineMiddle(points) {
|
|
23634
|
+
const lengths = points.slice(1).map((p, i) => Math.hypot(p.x - points[i].x, p.y - points[i].y));
|
|
23635
|
+
let remaining = lengths.reduce((sum, length) => sum + length, 0) / 2;
|
|
23636
|
+
for (const [i, length] of lengths.entries()) {
|
|
23637
|
+
if (remaining <= length && length > 0)
|
|
23638
|
+
return mix(points[i], points[i + 1], remaining / length);
|
|
23639
|
+
remaining -= length;
|
|
23640
|
+
}
|
|
23641
|
+
return points.at(-1);
|
|
23642
|
+
}
|
|
23643
|
+
function flattenCornerCurve(points) {
|
|
23644
|
+
const [internal, last] = cornerCurveKnots(points);
|
|
23645
|
+
const flattened = flattenNurbs(
|
|
23646
|
+
points.map((p) => ({ ...p, weight: 1 })),
|
|
23647
|
+
[0, 0, 0, 0, internal, last, last, last, last],
|
|
23648
|
+
3,
|
|
23649
|
+
() => {
|
|
23650
|
+
},
|
|
23651
|
+
() => {
|
|
23652
|
+
}
|
|
23653
|
+
);
|
|
23654
|
+
return flattened ? [points[0], ...flattened] : void 0;
|
|
23655
|
+
}
|
|
23656
|
+
function connectorCurveMiddle(points) {
|
|
23657
|
+
const spans = connectorCurveSpans(points);
|
|
23658
|
+
if (points.length === 5) {
|
|
23659
|
+
const flattened = flattenCornerCurve(points);
|
|
23660
|
+
if (flattened) return connectorPolylineMiddle(flattened);
|
|
23661
|
+
return mix(points[0], points.at(-1), 0.5);
|
|
23662
|
+
}
|
|
23663
|
+
const row2 = [...spans[0]];
|
|
23664
|
+
for (let count = row2.length - 1; count > 0; count--)
|
|
23665
|
+
for (let i = 0; i < count; i++) row2[i] = mix(row2[i], row2[i + 1], 0.5);
|
|
23666
|
+
return row2[0];
|
|
23667
|
+
}
|
|
23668
|
+
|
|
23221
23669
|
// visio/connector-route-walk.ts
|
|
23222
23670
|
var EPSILON3 = 1e-9;
|
|
23223
23671
|
var CHANNEL = 2 * VISIO_ROUTE_CLEARANCE;
|
|
@@ -23286,9 +23734,25 @@ function visioWalkRoute(begin, end, route, obstacles = []) {
|
|
|
23286
23734
|
const q = end.shape ? exit(end.shape, center(begin)) : end.point;
|
|
23287
23735
|
return Math.hypot(q.x - p.x, q.y - p.y) > EPSILON3 ? [p, q] : void 0;
|
|
23288
23736
|
}
|
|
23737
|
+
if (route === "curved") {
|
|
23738
|
+
const aligned = alignedVisioCurve(begin, end);
|
|
23739
|
+
if (aligned && !routeCrossings(aligned, obstacles)) return aligned;
|
|
23740
|
+
}
|
|
23289
23741
|
const path = visioWalkPath(begin, end);
|
|
23290
23742
|
if (!path || routeCrossings(path, obstacles)) return void 0;
|
|
23291
23743
|
if (route === "right-angle") return path;
|
|
23744
|
+
if (path.length === 3 && begin.shape && end.shape && [begin.shape, end.shape].every(
|
|
23745
|
+
(shape) => shape.sites.every(
|
|
23746
|
+
(site) => Math.abs(site.normal.x) < EPSILON3 || Math.abs(site.normal.y) < EPSILON3
|
|
23747
|
+
)
|
|
23748
|
+
)) {
|
|
23749
|
+
const curve = cornerCurve(path);
|
|
23750
|
+
if (obstacles.length) {
|
|
23751
|
+
const sampled = flattenCornerCurve(curve);
|
|
23752
|
+
if (!sampled || routeCrossings(sampled, obstacles)) return void 0;
|
|
23753
|
+
}
|
|
23754
|
+
return curve;
|
|
23755
|
+
}
|
|
23292
23756
|
const unit3 = (p, q) => {
|
|
23293
23757
|
const length = Math.hypot(q.x - p.x, q.y - p.y) || 1;
|
|
23294
23758
|
return { x: (q.x - p.x) / length, y: (q.y - p.y) / length };
|
|
@@ -23337,26 +23801,6 @@ function put(parent, inherited, name3, value, formula) {
|
|
|
23337
23801
|
node2.removeAttribute("E");
|
|
23338
23802
|
if (formula !== void 0) node2.setAttribute("F", formula);
|
|
23339
23803
|
}
|
|
23340
|
-
function midpoint(points) {
|
|
23341
|
-
const lengths = points.slice(1).map((point2, index) => Math.hypot(point2.x - points[index].x, point2.y - points[index].y));
|
|
23342
|
-
let left = lengths.reduce((sum, value) => sum + value, 0) / 2;
|
|
23343
|
-
for (const [index, length] of lengths.entries()) {
|
|
23344
|
-
if (left <= length && length > 0) {
|
|
23345
|
-
const from = points[index], to = points[index + 1];
|
|
23346
|
-
return {
|
|
23347
|
-
x: from.x + (to.x - from.x) * left / length,
|
|
23348
|
-
y: from.y + (to.y - from.y) * left / length
|
|
23349
|
-
};
|
|
23350
|
-
}
|
|
23351
|
-
left -= length;
|
|
23352
|
-
}
|
|
23353
|
-
return points.at(-1);
|
|
23354
|
-
}
|
|
23355
|
-
var bezier = (p, t) => {
|
|
23356
|
-
const u = 1 - t;
|
|
23357
|
-
const mix2 = (key2) => u * u * u * p[0][key2] + 3 * u * u * t * p[1][key2] + 3 * u * t * t * p[2][key2] + t * t * t * p[3][key2];
|
|
23358
|
-
return { x: mix2("x"), y: mix2("y") };
|
|
23359
|
-
};
|
|
23360
23804
|
function section(shape, name3, index) {
|
|
23361
23805
|
let node2 = children2(shape, "Section").find((item) => attribute2(item, "N") === name3);
|
|
23362
23806
|
if (!node2) {
|
|
@@ -23412,8 +23856,9 @@ function writeStencilConnector(shape, route, vertices) {
|
|
|
23412
23856
|
x: point2.x - (begin.x + end.x) / 2 + width / 2,
|
|
23413
23857
|
y: point2.y - (begin.y + end.y) / 2 + height / 2
|
|
23414
23858
|
});
|
|
23415
|
-
const curved2 = route === "curved" && !flatX && !flatY && vertices.length === 4;
|
|
23859
|
+
const curved2 = route === "curved" && (vertices.length === 5 || !flatX && !flatY && vertices.length === 4);
|
|
23416
23860
|
const local = (curved2 || route !== "curved" ? vertices : [begin, end]).map(at2);
|
|
23861
|
+
const [internalKnot, lastKnot] = local.length === 5 ? cornerCurveKnots(local) : [0, 1];
|
|
23417
23862
|
const masterGeometry = children2(template, "Section").find(
|
|
23418
23863
|
(item) => attribute2(item, "N") === "Geometry"
|
|
23419
23864
|
);
|
|
@@ -23438,15 +23883,15 @@ function writeStencilConnector(shape, route, vertices) {
|
|
|
23438
23883
|
{
|
|
23439
23884
|
type: "NURBSTo",
|
|
23440
23885
|
cells: [
|
|
23441
|
-
["X", local
|
|
23442
|
-
["Y", local
|
|
23443
|
-
["A",
|
|
23886
|
+
["X", local.at(-1).x, flatX ? void 0 : "Width*1"],
|
|
23887
|
+
["Y", local.at(-1).y, flatY ? void 0 : "Height*1"],
|
|
23888
|
+
["A", internalKnot],
|
|
23444
23889
|
["B", 1],
|
|
23445
23890
|
["C", 0],
|
|
23446
23891
|
["D", 1],
|
|
23447
23892
|
[
|
|
23448
23893
|
"E",
|
|
23449
|
-
`NURBS(
|
|
23894
|
+
`NURBS(${text2(lastKnot)},3,1,1,${local.slice(1, -1).map((point2) => `${text2(point2.x)},${text2(point2.y)},0,1`).join(",")})`
|
|
23450
23895
|
]
|
|
23451
23896
|
]
|
|
23452
23897
|
}
|
|
@@ -23483,7 +23928,7 @@ function writeStencilConnector(shape, route, vertices) {
|
|
|
23483
23928
|
}
|
|
23484
23929
|
}
|
|
23485
23930
|
drop(shape, geometry);
|
|
23486
|
-
const middle = curved2 ?
|
|
23931
|
+
const middle = curved2 ? connectorCurveMiddle(local) : connectorPolylineMiddle(local);
|
|
23487
23932
|
const masterControl = children2(template, "Section").filter((item) => attribute2(item, "N") === "Control").flatMap((item) => children2(item, "Row")).find((row2) => attribute2(row2, "N") === "TextPosition");
|
|
23488
23933
|
const control = section(shape, "Control");
|
|
23489
23934
|
let position = children2(control, "Row").find((row2) => attribute2(row2, "N") === "TextPosition");
|
|
@@ -24613,6 +25058,344 @@ async function refreshTextSizes(targets, result, options, deadline) {
|
|
|
24613
25058
|
return { ...result, diagnostics };
|
|
24614
25059
|
}
|
|
24615
25060
|
|
|
25061
|
+
// visio/line-jumps.ts
|
|
25062
|
+
var VISIO_LINE_JUMP_WIDTH = 2 / 3 * 0.125;
|
|
25063
|
+
var VISIO_LINE_JUMP_LIMITS = Object.freeze({ connectors: 2e3, segments: 2e4 });
|
|
25064
|
+
var TOKEN = /([MLZmlz]|[A-Za-z])|([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)/g;
|
|
25065
|
+
function polylines(path) {
|
|
25066
|
+
const result = [];
|
|
25067
|
+
let command2 = "";
|
|
25068
|
+
let pending;
|
|
25069
|
+
for (const match of path.matchAll(TOKEN)) {
|
|
25070
|
+
if (match[1]) {
|
|
25071
|
+
if (match[1] !== "M" && match[1] !== "L") return void 0;
|
|
25072
|
+
if (pending !== void 0) return void 0;
|
|
25073
|
+
command2 = match[1];
|
|
25074
|
+
continue;
|
|
25075
|
+
}
|
|
25076
|
+
const value = Number(match[2]);
|
|
25077
|
+
if (!Number.isFinite(value) || !command2) return void 0;
|
|
25078
|
+
if (pending === void 0) {
|
|
25079
|
+
pending = value;
|
|
25080
|
+
continue;
|
|
25081
|
+
}
|
|
25082
|
+
const point2 = { x: pending, y: value };
|
|
25083
|
+
pending = void 0;
|
|
25084
|
+
if (command2 === "M") {
|
|
25085
|
+
result.push([point2]);
|
|
25086
|
+
command2 = "L";
|
|
25087
|
+
} else result.at(-1)?.push(point2);
|
|
25088
|
+
}
|
|
25089
|
+
return pending === void 0 && result.every((line) => line.length > 1) ? result : void 0;
|
|
25090
|
+
}
|
|
25091
|
+
var apply2 = (m, p) => ({
|
|
25092
|
+
x: m[0] * p.x + m[2] * p.y + m[4],
|
|
25093
|
+
y: m[1] * p.x + m[3] * p.y + m[5]
|
|
25094
|
+
});
|
|
25095
|
+
function invert(m) {
|
|
25096
|
+
const det = m[0] * m[3] - m[1] * m[2];
|
|
25097
|
+
if (!Number.isFinite(det) || Math.abs(det) < 1e-12) return void 0;
|
|
25098
|
+
return [
|
|
25099
|
+
m[3] / det,
|
|
25100
|
+
-m[1] / det,
|
|
25101
|
+
-m[2] / det,
|
|
25102
|
+
m[0] / det,
|
|
25103
|
+
(m[2] * m[5] - m[3] * m[4]) / det,
|
|
25104
|
+
(m[1] * m[4] - m[0] * m[5]) / det
|
|
25105
|
+
];
|
|
25106
|
+
}
|
|
25107
|
+
var clean2 = (value) => Math.abs(value) < 1e-9 ? 0 : Number(value.toFixed(6));
|
|
25108
|
+
var text3 = (p) => `${clean2(p.x)} ${clean2(p.y)}`;
|
|
25109
|
+
var horizontal = (s) => Math.abs(s.b.x - s.a.x) > Math.abs(s.b.y - s.a.y);
|
|
25110
|
+
var vertical = (s) => Math.abs(s.b.y - s.a.y) > Math.abs(s.b.x - s.a.x);
|
|
25111
|
+
function crossing(s, other, margin) {
|
|
25112
|
+
const dx = s.b.x - s.a.x, dy = s.b.y - s.a.y, ox = other.b.x - other.a.x, oy = other.b.y - other.a.y;
|
|
25113
|
+
const det = dx * oy - dy * ox;
|
|
25114
|
+
const length = Math.hypot(dx, dy), otherLength = Math.hypot(ox, oy);
|
|
25115
|
+
if (Math.abs(det) < 1e-9 || Math.abs(det) / (length * otherLength) < 0.2) return void 0;
|
|
25116
|
+
const t = ((other.a.x - s.a.x) * oy - (other.a.y - s.a.y) * ox) / det;
|
|
25117
|
+
const u = ((other.a.x - s.a.x) * dy - (other.a.y - s.a.y) * dx) / det;
|
|
25118
|
+
if (u * otherLength < 1e-6 || (1 - u) * otherLength < 1e-6) return void 0;
|
|
25119
|
+
if (t * length < margin || (1 - t) * length < margin) return void 0;
|
|
25120
|
+
return t;
|
|
25121
|
+
}
|
|
25122
|
+
function jumps(code, s, other, shapes) {
|
|
25123
|
+
const own = shapes[s.owner]?.lineJumpCode ?? 0;
|
|
25124
|
+
const peer = shapes[other.owner]?.lineJumpCode ?? 0;
|
|
25125
|
+
if (own === 4 || peer === 4 || own === 1) return false;
|
|
25126
|
+
if (own !== peer) {
|
|
25127
|
+
if (own === 2 || peer === 3) return true;
|
|
25128
|
+
if (own === 3 || peer === 2) return false;
|
|
25129
|
+
}
|
|
25130
|
+
if (code === 1) return horizontal(s) && !horizontal(other);
|
|
25131
|
+
if (code === 2) return vertical(s) && !vertical(other);
|
|
25132
|
+
if (code === 3 || code === 4) return s.owner > other.owner;
|
|
25133
|
+
return code === 5 && s.owner < other.owner;
|
|
25134
|
+
}
|
|
25135
|
+
function jump(style2, from, to, local, reverse) {
|
|
25136
|
+
const half = Math.hypot(to.x - from.x, to.y - from.y) / 2;
|
|
25137
|
+
const ux = (to.x - from.x) / (2 * half), uy = (to.y - from.y) / (2 * half);
|
|
25138
|
+
let nx = -uy, ny = ux;
|
|
25139
|
+
if (ny < -1e-9 || Math.abs(ny) <= 1e-9 && nx > 0) {
|
|
25140
|
+
nx = -nx;
|
|
25141
|
+
ny = -ny;
|
|
25142
|
+
}
|
|
25143
|
+
if (reverse) {
|
|
25144
|
+
nx = -nx;
|
|
25145
|
+
ny = -ny;
|
|
25146
|
+
}
|
|
25147
|
+
const centre = { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2 };
|
|
25148
|
+
const at2 = (along, out) => local({ x: centre.x + ux * along + nx * out, y: centre.y + uy * along + ny * out });
|
|
25149
|
+
const end = local(to);
|
|
25150
|
+
if (style2 === 1) return `M ${text3(end)}`;
|
|
25151
|
+
if (style2 === 2) return `L ${text3(at2(-half, half))} L ${text3(at2(half, half))} L ${text3(end)}`;
|
|
25152
|
+
if (style2 >= 3) {
|
|
25153
|
+
const sides = style2 - 1;
|
|
25154
|
+
let out = "";
|
|
25155
|
+
for (let index = 1; index < sides; ++index) {
|
|
25156
|
+
const angle = Math.PI - Math.PI * index / sides;
|
|
25157
|
+
out += `L ${text3(at2(Math.cos(angle) * half, Math.sin(angle) * half))} `;
|
|
25158
|
+
}
|
|
25159
|
+
return `${out}L ${text3(end)}`;
|
|
25160
|
+
}
|
|
25161
|
+
const start = local(from), top = at2(0, half);
|
|
25162
|
+
const radius = Math.hypot(end.x - start.x, end.y - start.y) / 2;
|
|
25163
|
+
const sweep = (end.x - start.x) * (top.y - start.y) - (end.y - start.y) * (top.x - start.x) > 0 ? 0 : 1;
|
|
25164
|
+
return `A ${clean2(radius)} ${clean2(radius)} 0 0 ${sweep} ${text3(end)}`;
|
|
25165
|
+
}
|
|
25166
|
+
var connector = (shape, glued) => shape.kind === "connector" && !shape.hidden && !shape.children.length && (shape.connectorRoute !== void 0 || glued.has(shape.id));
|
|
25167
|
+
function visioLineJumpPaths(page) {
|
|
25168
|
+
const result = /* @__PURE__ */ new Map();
|
|
25169
|
+
const layout = visioPageLayout(page);
|
|
25170
|
+
const code = layout.lineJumpCode;
|
|
25171
|
+
const glued = new Set(page.connectors.map((connection) => connection.fromShapeId));
|
|
25172
|
+
const shapes = page.shapes.filter((shape) => connector(shape, glued)).slice(0, VISIO_LINE_JUMP_LIMITS.connectors);
|
|
25173
|
+
for (const shape of shapes) {
|
|
25174
|
+
if (shape.connectorRoute !== "straight" || !shape.lineEnds) continue;
|
|
25175
|
+
if (shape.geometry.length !== 1) continue;
|
|
25176
|
+
const geometry = shape.geometry[0];
|
|
25177
|
+
if (!geometry.stroke || geometry.fill) continue;
|
|
25178
|
+
const { begin, end } = shape.lineEnds;
|
|
25179
|
+
if (![begin.x, begin.y, end.x, end.y].every(Number.isFinite)) continue;
|
|
25180
|
+
const path = `M ${text3(begin)} L ${text3(end)}`;
|
|
25181
|
+
if (geometry.path !== path) result.set(shape, [path]);
|
|
25182
|
+
}
|
|
25183
|
+
if (shapes.length < 2) return result;
|
|
25184
|
+
if ((code < 1 || code > 5) && !shapes.some((shape) => shape.lineJumpCode === 2 || shape.lineJumpCode === 3))
|
|
25185
|
+
return result;
|
|
25186
|
+
const lines2 = [];
|
|
25187
|
+
const segments = [];
|
|
25188
|
+
shapes.forEach((shape, owner) => {
|
|
25189
|
+
shape.geometry.forEach((geometry, index) => {
|
|
25190
|
+
if (!geometry.stroke || geometry.fill) return;
|
|
25191
|
+
for (const line of polylines(result.get(shape)?.[index] ?? geometry.path) ?? []) {
|
|
25192
|
+
const points = line.map((point2) => apply2(shape.transform, point2));
|
|
25193
|
+
lines2.push({ shape, owner, geometry: index, points });
|
|
25194
|
+
for (let i = 1; i < points.length; ++i)
|
|
25195
|
+
segments.push({ a: points[i - 1], b: points[i], owner });
|
|
25196
|
+
}
|
|
25197
|
+
});
|
|
25198
|
+
});
|
|
25199
|
+
if (segments.length > VISIO_LINE_JUMP_LIMITS.segments) return result;
|
|
25200
|
+
const bounded6 = (value, fallback, max) => typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= max ? value : fallback;
|
|
25201
|
+
const scale = bounded6(page.drawingToPageScale, 1, Number.MAX_VALUE);
|
|
25202
|
+
const halfX = bounded6(layout.lineJumpFactorX, 2 / 3, 10) * bounded6(layout.lineToLineX, 0.125, 1e4) * scale / 2;
|
|
25203
|
+
const halfY = bounded6(layout.lineJumpFactorY, 2 / 3, 10) * bounded6(layout.lineToLineY, 0.125, 1e4) * scale / 2;
|
|
25204
|
+
const paths = /* @__PURE__ */ new Map();
|
|
25205
|
+
const any = /* @__PURE__ */ new Set();
|
|
25206
|
+
for (const line of lines2) {
|
|
25207
|
+
const inverse = invert(line.shape.transform);
|
|
25208
|
+
if (!inverse) continue;
|
|
25209
|
+
const local = (point2) => apply2(inverse, point2);
|
|
25210
|
+
let out = `M ${text3(local(line.points[0]))}`;
|
|
25211
|
+
for (let i = 1; i < line.points.length; ++i) {
|
|
25212
|
+
const s = { a: line.points[i - 1], b: line.points[i], owner: line.owner };
|
|
25213
|
+
const length = Math.hypot(s.b.x - s.a.x, s.b.y - s.a.y);
|
|
25214
|
+
const half = vertical(s) ? halfY : halfX;
|
|
25215
|
+
if (half <= 0) {
|
|
25216
|
+
out += ` L ${text3(local(s.b))}`;
|
|
25217
|
+
continue;
|
|
25218
|
+
}
|
|
25219
|
+
const hits = segments.filter((other) => other.owner !== s.owner && jumps(code, s, other, shapes)).flatMap((other) => crossing(s, other, half * 1.5) ?? []).sort((a, b) => a - b);
|
|
25220
|
+
let last = -Infinity;
|
|
25221
|
+
for (const t of hits) {
|
|
25222
|
+
if ((t - last) * length < half * 2.5) continue;
|
|
25223
|
+
last = t;
|
|
25224
|
+
const at2 = (offset) => ({
|
|
25225
|
+
x: s.a.x + (s.b.x - s.a.x) * (t * length + offset) / length,
|
|
25226
|
+
y: s.a.y + (s.b.y - s.a.y) * (t * length + offset) / length
|
|
25227
|
+
});
|
|
25228
|
+
const override = line.shape.lineJumpStyle ?? 0;
|
|
25229
|
+
const savedStyle = override >= 1 && override <= 9 ? override : layout.lineJumpStyle;
|
|
25230
|
+
const style2 = savedStyle >= 1 && savedStyle <= 9 ? savedStyle - 1 : 0;
|
|
25231
|
+
const direction = horizontal(s) ? line.shape.lineJumpDirectionX || layout.lineJumpDirectionX : vertical(s) ? line.shape.lineJumpDirectionY || layout.lineJumpDirectionY : 0;
|
|
25232
|
+
out += ` L ${text3(local(at2(-half)))} ${jump(style2, at2(-half), at2(half), local, direction === 2)}`;
|
|
25233
|
+
any.add(line.shape);
|
|
25234
|
+
}
|
|
25235
|
+
out += ` L ${text3(local(s.b))}`;
|
|
25236
|
+
}
|
|
25237
|
+
const byGeometry = paths.get(line.shape) ?? /* @__PURE__ */ new Map();
|
|
25238
|
+
byGeometry.set(line.geometry, [...byGeometry.get(line.geometry) ?? [], out]);
|
|
25239
|
+
paths.set(line.shape, byGeometry);
|
|
25240
|
+
}
|
|
25241
|
+
for (const shape of any) {
|
|
25242
|
+
const byGeometry = paths.get(shape);
|
|
25243
|
+
result.set(
|
|
25244
|
+
shape,
|
|
25245
|
+
shape.geometry.map(
|
|
25246
|
+
(geometry, index) => byGeometry.get(index)?.join(" ") ?? result.get(shape)?.[index] ?? geometry.path
|
|
25247
|
+
)
|
|
25248
|
+
);
|
|
25249
|
+
}
|
|
25250
|
+
return result;
|
|
25251
|
+
}
|
|
25252
|
+
|
|
25253
|
+
// visio/edit-line-jump-cache.ts
|
|
25254
|
+
var jumpState = (page) => JSON.stringify([
|
|
25255
|
+
Object.entries(visioPageLayout(page)).filter(([key2]) => /^lineJump|^lineToLine/.test(key2)),
|
|
25256
|
+
page.shapes.map((shape) => [
|
|
25257
|
+
shape.id,
|
|
25258
|
+
shape.lineJumpCode,
|
|
25259
|
+
shape.lineJumpStyle,
|
|
25260
|
+
shape.lineJumpDirectionX,
|
|
25261
|
+
shape.lineJumpDirectionY
|
|
25262
|
+
])
|
|
25263
|
+
]);
|
|
25264
|
+
function plainRows(section3) {
|
|
25265
|
+
return children2(section3, "Row").every(
|
|
25266
|
+
(row2) => ["MoveTo", "LineTo", "ArcTo"].includes(attribute2(row2, "T") ?? "") && Array.from(row2.attributes).every((attr2) => ["IX", "T", "Del"].includes(attr2.name)) && Array.from(row2.children ?? row2.childNodes).filter((node2) => node2.nodeType === 1).every((node2) => {
|
|
25267
|
+
const cell = node2;
|
|
25268
|
+
return cell.localName === "Cell" && cell.namespaceURI === section3.namespaceURI && ["X", "Y", ...attribute2(row2, "T") === "ArcTo" ? ["A"] : []].includes(
|
|
25269
|
+
attribute2(cell, "N") ?? ""
|
|
25270
|
+
) && Array.from(cell.attributes).every((attr2) => ["N", "V", "U", "F"].includes(attr2.name)) && !executableCellFormula(attribute2(cell, "F")) && !Array.from(cell.childNodes).some((child3) => child3.nodeType === 1);
|
|
25271
|
+
})
|
|
25272
|
+
);
|
|
25273
|
+
}
|
|
25274
|
+
function cacheRows(path) {
|
|
25275
|
+
const tokens2 = path.trim().split(/\s+/);
|
|
25276
|
+
const rows = [];
|
|
25277
|
+
while (tokens2.length) {
|
|
25278
|
+
const command2 = tokens2.shift();
|
|
25279
|
+
if (command2 === "M" || command2 === "L") {
|
|
25280
|
+
rows.push({
|
|
25281
|
+
type: command2 === "M" ? "MoveTo" : "LineTo",
|
|
25282
|
+
x: Number(tokens2.shift()),
|
|
25283
|
+
y: Number(tokens2.shift())
|
|
25284
|
+
});
|
|
25285
|
+
} else if (command2 === "A") {
|
|
25286
|
+
const [rx, ry, rotation, large, sweep, x, y] = tokens2.splice(0, 7).map(Number);
|
|
25287
|
+
if (rx === void 0 || ry !== rx || rotation !== 0 || large !== 0 || sweep !== 0 && sweep !== 1 || x === void 0 || y === void 0)
|
|
25288
|
+
return [];
|
|
25289
|
+
rows.push({ type: "ArcTo", x, y, bow: sweep ? rx : -rx });
|
|
25290
|
+
} else return [];
|
|
25291
|
+
if (rows.length > 1e4) return [];
|
|
25292
|
+
}
|
|
25293
|
+
return rows.every((row2) => Number.isFinite(row2.x) && Number.isFinite(row2.y)) ? rows : [];
|
|
25294
|
+
}
|
|
25295
|
+
async function refreshLineJumpCaches(pageIds2, source, result, options, deadline) {
|
|
25296
|
+
if (!pageIds2.size || !result.changedParts.length) return result;
|
|
25297
|
+
const check = () => {
|
|
25298
|
+
if (Date.now() >= deadline) fail("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
|
|
25299
|
+
};
|
|
25300
|
+
const limits = {
|
|
25301
|
+
...DEFAULTS,
|
|
25302
|
+
...options.limits,
|
|
25303
|
+
maxRuntimeMs: Math.max(1, deadline - Date.now())
|
|
25304
|
+
};
|
|
25305
|
+
const { pkg, parts, pages } = await openEditablePackage(result.bytes, limits, check);
|
|
25306
|
+
const model2 = await parseVsdx(result.bytes, { limits });
|
|
25307
|
+
const before = source ? await parseVsdx(source, { limits }) : void 0;
|
|
25308
|
+
const template = masterTemplate(pkg);
|
|
25309
|
+
const changed = new Set(result.changedParts);
|
|
25310
|
+
const kept = [];
|
|
25311
|
+
let referenced = false;
|
|
25312
|
+
for (const path of pkg.paths()) {
|
|
25313
|
+
check();
|
|
25314
|
+
if (!/^visio\/.*\.xml$/i.test(path)) continue;
|
|
25315
|
+
const root2 = await pkg.readXml(path);
|
|
25316
|
+
for (const node2 of Array.from(root2.getElementsByTagName("*")))
|
|
25317
|
+
if (/\b(?:Geometry|Geom)\d*\./i.test(attribute2(node2, "F") ?? "")) referenced = true;
|
|
25318
|
+
}
|
|
25319
|
+
for (const page of model2.pages) {
|
|
25320
|
+
if (!pageIds2.has(page.id)) continue;
|
|
25321
|
+
const prior = before?.pages.find((item) => item.id === page.id);
|
|
25322
|
+
if (prior && jumpState(prior) === jumpState(page)) continue;
|
|
25323
|
+
const path = pages.get(page.id);
|
|
25324
|
+
const root2 = await visioXml(pkg, path, "PageContents");
|
|
25325
|
+
let dirty = false;
|
|
25326
|
+
for (const [shape, paths] of visioLineJumpPaths(page)) {
|
|
25327
|
+
check();
|
|
25328
|
+
if (shape.connectorRoute !== "straight" || paths.length !== 1) continue;
|
|
25329
|
+
const target2 = children2(children2(root2, "Shapes")[0], "Shape").find(
|
|
25330
|
+
(node2) => attribute2(node2, "ID") === shape.id
|
|
25331
|
+
);
|
|
25332
|
+
if (!target2) continue;
|
|
25333
|
+
const sections = children2(target2, "Section").filter(
|
|
25334
|
+
(node2) => attribute2(node2, "N") === "Geometry"
|
|
25335
|
+
);
|
|
25336
|
+
const section3 = sections[0];
|
|
25337
|
+
const rows = cacheRows(paths[0]);
|
|
25338
|
+
if (referenced || !section3 || sections.length !== 1 || !rows.length || !plainRows(section3) || Array.from(section3.getElementsByTagName("*")).some(
|
|
25339
|
+
(node2) => executableCellFormula(attribute2(node2, "F"))
|
|
25340
|
+
)) {
|
|
25341
|
+
kept.push(shape.id);
|
|
25342
|
+
continue;
|
|
25343
|
+
}
|
|
25344
|
+
const indices = /* @__PURE__ */ new Map();
|
|
25345
|
+
const masterId = attribute2(target2, "Master");
|
|
25346
|
+
if (masterId) {
|
|
25347
|
+
const master2 = await template(masterId, attribute2(target2, "MasterShape"));
|
|
25348
|
+
const base2 = children2(master2, "Section").find(
|
|
25349
|
+
(node2) => attribute2(node2, "N") === "Geometry" && attribute2(node2, "IX") === attribute2(section3, "IX")
|
|
25350
|
+
);
|
|
25351
|
+
for (const row2 of children2(base2, "Row"))
|
|
25352
|
+
indices.set(attribute2(row2, "IX"), attribute2(row2, "T"));
|
|
25353
|
+
}
|
|
25354
|
+
for (const row2 of children2(section3, "Row")) section3.removeChild(row2);
|
|
25355
|
+
for (const [index, value] of rows.entries()) {
|
|
25356
|
+
const row2 = root2.ownerDocument.createElementNS(root2.namespaceURI, "Row");
|
|
25357
|
+
row2.setAttribute("IX", String(index + 1));
|
|
25358
|
+
row2.setAttribute("T", value.type);
|
|
25359
|
+
setCell(row2, "X", value.x);
|
|
25360
|
+
setCell(row2, "Y", value.y);
|
|
25361
|
+
if (value.bow !== void 0) setCell(row2, "A", value.bow);
|
|
25362
|
+
section3.appendChild(row2);
|
|
25363
|
+
indices.delete(String(index + 1));
|
|
25364
|
+
}
|
|
25365
|
+
for (const [index, type] of indices) {
|
|
25366
|
+
const row2 = root2.ownerDocument.createElementNS(root2.namespaceURI, "Row");
|
|
25367
|
+
row2.setAttribute("IX", index);
|
|
25368
|
+
row2.setAttribute("T", type);
|
|
25369
|
+
row2.setAttribute("Del", "1");
|
|
25370
|
+
section3.appendChild(row2);
|
|
25371
|
+
}
|
|
25372
|
+
dirty = true;
|
|
25373
|
+
}
|
|
25374
|
+
if (dirty) {
|
|
25375
|
+
parts.set(path, serializeEditedXml(root2, limits, check).bytes);
|
|
25376
|
+
changed.add(path);
|
|
25377
|
+
}
|
|
25378
|
+
}
|
|
25379
|
+
return {
|
|
25380
|
+
bytes: await writeEditedPackage(
|
|
25381
|
+
parts,
|
|
25382
|
+
options.maxOutputBytes ?? limits.maxInputBytes,
|
|
25383
|
+
deadline,
|
|
25384
|
+
check
|
|
25385
|
+
),
|
|
25386
|
+
changedParts: [...changed].sort(),
|
|
25387
|
+
diagnostics: [
|
|
25388
|
+
...result.diagnostics,
|
|
25389
|
+
...kept.length ? [
|
|
25390
|
+
{
|
|
25391
|
+
code: "edit-line-jump-cache-kept",
|
|
25392
|
+
message: `Connector ${kept.join(", ")} retains its saved geometry because formula dependencies prevent refreshing native jump caches.`
|
|
25393
|
+
}
|
|
25394
|
+
] : []
|
|
25395
|
+
]
|
|
25396
|
+
};
|
|
25397
|
+
}
|
|
25398
|
+
|
|
24616
25399
|
// visio/resize-anchor.ts
|
|
24617
25400
|
function snapshotResizeAnchor(value) {
|
|
24618
25401
|
if (value === void 0) return void 0;
|
|
@@ -26548,6 +27331,9 @@ function assertDependencies(roots, pagesPart, pages, pagePaths, pageId2, changed
|
|
|
26548
27331
|
"gi"
|
|
26549
27332
|
) : void 0;
|
|
26550
27333
|
const paths = new Map([...pagePaths].map(([id3, path]) => [path, id3]));
|
|
27334
|
+
const jumpDecorationOnly = changed.every(
|
|
27335
|
+
(name3) => /^(LineJumpCode|LineJumpStyle|PageLineJumpDir[XY]|LineJumpFactor[XY])$/.test(name3)
|
|
27336
|
+
);
|
|
26551
27337
|
for (const [path, root2] of roots)
|
|
26552
27338
|
for (const node2 of [root2, ...Array.from(root2.getElementsByTagName("*"))]) {
|
|
26553
27339
|
check();
|
|
@@ -26568,8 +27354,10 @@ function assertDependencies(roots, pagesPart, pages, pagePaths, pageId2, changed
|
|
|
26568
27354
|
const nativeGlue = paths.has(path) && connected && node2.localName === "Cell" && node2.namespaceURI === root2.namespaceURI && (/^(BeginX|BeginY|EndX|EndY)$/.test(name3) && /^\s*_WALKGLUE\((?:BegTrigger,EndTrigger|EndTrigger,BegTrigger),WalkPreference\)\s*$/i.test(
|
|
26569
27355
|
code
|
|
26570
27356
|
) || /^(BegTrigger|EndTrigger)$/.test(name3) && /^\s*_XFTRIGGER\(Sheet\.[1-9]\d*!EventXFMod\)\s*$/i.test(code));
|
|
27357
|
+
const nativeJumpTrigger = jumpDecorationOnly && paths.has(path) && node2.localName === "Cell" && node2.namespaceURI === root2.namespaceURI && /^(BegTrigger|EndTrigger)$/.test(name3) && owner?.localName === "Shape" && owner.namespaceURI === root2.namespaceURI && container?.localName === "Shapes" && container.parentNode === root2 && !!ownerId2 && visioGlueTriggerTarget(formula) === ownerId2;
|
|
27358
|
+
const nativeJumpText = jumpDecorationOnly && node2.localName === "Cell" && node2.namespaceURI === root2.namespaceURI && (/^(TxtPinX|TxtPinY)$/.test(name3) && /^\s*SETATREF\(Controls\.TextPosition(?:\.Y)?\)\s*$/i.test(formula) || !!textSizeFormula(formula) || name3 === "XCon" && /^\s*IF\(OR\(STRSAME\(SHAPETEXT\(TheText\),""\),HideText\),5,0\)\s*$/i.test(formula));
|
|
26571
27359
|
let dynamic2 = false;
|
|
26572
|
-
if (!nativeGlue) {
|
|
27360
|
+
if (!nativeGlue && !nativeJumpTrigger && !nativeJumpText) {
|
|
26573
27361
|
try {
|
|
26574
27362
|
dynamic2 = analyzeVisioFormula(
|
|
26575
27363
|
mapVisioFormulaSyntax(
|
|
@@ -26584,7 +27372,7 @@ function assertDependencies(roots, pagesPart, pages, pagePaths, pageId2, changed
|
|
|
26584
27372
|
if (dynamic2)
|
|
26585
27373
|
fail(
|
|
26586
27374
|
"EDIT_UNSUPPORTED_PAGE_SIZE_DEPENDENCY",
|
|
26587
|
-
|
|
27375
|
+
`Dynamic or unknown page-size dependencies cannot be safely refreshed (${path}, ${name3}).`
|
|
26588
27376
|
);
|
|
26589
27377
|
let local = paths.get(path);
|
|
26590
27378
|
if (path === pagesPart) {
|
|
@@ -26802,6 +27590,12 @@ function setVisioPageProperties(pagesPart, pages, dirty, command2) {
|
|
|
26802
27590
|
var CELLS = [
|
|
26803
27591
|
["lineJumpCode", "LineJumpCode", false],
|
|
26804
27592
|
["lineJumpStyle", "LineJumpStyle", false],
|
|
27593
|
+
["lineJumpDirectionX", "PageLineJumpDirX", false],
|
|
27594
|
+
["lineJumpDirectionY", "PageLineJumpDirY", false],
|
|
27595
|
+
["lineJumpFactorX", "LineJumpFactorX", false],
|
|
27596
|
+
["lineJumpFactorY", "LineJumpFactorY", false],
|
|
27597
|
+
["lineToLineX", "LineToLineX", true],
|
|
27598
|
+
["lineToLineY", "LineToLineY", true],
|
|
26805
27599
|
["gridDensityX", "XGridDensity", false],
|
|
26806
27600
|
["gridDensityY", "YGridDensity", false],
|
|
26807
27601
|
["gridSpacingX", "XGridSpacing", true],
|
|
@@ -26815,8 +27609,13 @@ var CELLS = [
|
|
|
26815
27609
|
];
|
|
26816
27610
|
function valid(key2, value) {
|
|
26817
27611
|
const number5 = typeof value === "number" && Number.isFinite(value) ? value : Number.NaN;
|
|
27612
|
+
if (key2.startsWith("lineJumpFactor") || key2.startsWith("lineToLine")) {
|
|
27613
|
+
if (!(number5 >= 0 && number5 <= (key2.startsWith("lineJumpFactor") ? 10 : 1e4)))
|
|
27614
|
+
fail("INVALID_EDIT", `Invalid page layout value for ${key2}.`);
|
|
27615
|
+
return number5;
|
|
27616
|
+
}
|
|
26818
27617
|
const integer3 = Number.isSafeInteger(number5);
|
|
26819
|
-
const ok = key2 === "lineJumpCode" ? integer3 && number5 >= 0 && number5 <= 5 : key2 === "lineJumpStyle" ? integer3 && number5 >= 0 && number5 <=
|
|
27618
|
+
const ok = key2 === "lineJumpDirectionX" || key2 === "lineJumpDirectionY" ? integer3 && number5 >= 0 && number5 <= 2 : key2 === "lineJumpCode" ? integer3 && number5 >= 0 && number5 <= 5 : key2 === "lineJumpStyle" ? integer3 && 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;
|
|
26820
27619
|
if (!ok) fail("INVALID_EDIT", `Invalid page layout value for ${key2}.`);
|
|
26821
27620
|
return number5;
|
|
26822
27621
|
}
|
|
@@ -27043,7 +27842,7 @@ function visioBorderShapes(style2, width, height, title = VISIO_DEFAULT_TITLE) {
|
|
|
27043
27842
|
|
|
27044
27843
|
// visio/edit-page-setup-commands.ts
|
|
27045
27844
|
var VISIO_SCALE_UNITS = Object.freeze(["IN", "FT", "MM", "CM", "M"]);
|
|
27046
|
-
var isVisioPageSetupEdit = (edit) => edit.type === "set-page-setup" || edit.type === "set-page-properties" || edit.type === "set-page-decoration" || edit.type === "set-page-layout" || edit.type === "set-snap-glue";
|
|
27845
|
+
var isVisioPageSetupEdit = (edit) => edit.type === "set-page-alt-text" || edit.type === "set-page-setup" || edit.type === "set-page-properties" || edit.type === "set-page-decoration" || edit.type === "set-page-layout" || edit.type === "set-snap-glue";
|
|
27047
27846
|
var pageId = (value, label) => {
|
|
27048
27847
|
if (typeof value !== "string" || !value || value.length > 256)
|
|
27049
27848
|
fail("INVALID_EDIT", `Invalid ${label}.`);
|
|
@@ -27063,6 +27862,13 @@ function snapshotPageSetupEdit(edit) {
|
|
|
27063
27862
|
if (edit.type === "set-page-layout") return snapshotPageLayoutEdit(edit);
|
|
27064
27863
|
if (edit.type === "set-snap-glue") return snapshotSnapGlueEdit(edit);
|
|
27065
27864
|
const id3 = pageId(edit.pageId, "page");
|
|
27865
|
+
if (edit.type === "set-page-alt-text")
|
|
27866
|
+
return {
|
|
27867
|
+
type: edit.type,
|
|
27868
|
+
pageId: id3,
|
|
27869
|
+
title: metadataText(edit.title, true),
|
|
27870
|
+
description: metadataText(edit.description, false)
|
|
27871
|
+
};
|
|
27066
27872
|
if (edit.type === "set-page-setup") {
|
|
27067
27873
|
const result = { type: edit.type, pageId: id3 };
|
|
27068
27874
|
if (edit.printOrientation !== void 0) {
|
|
@@ -28756,7 +29562,7 @@ var OFFICE_FALLBACK = [
|
|
|
28756
29562
|
"#4472c4",
|
|
28757
29563
|
"#70ad47"
|
|
28758
29564
|
];
|
|
28759
|
-
function
|
|
29565
|
+
function mix2(color2, target2, amount) {
|
|
28760
29566
|
return `#${[1, 3, 5].map((index) => {
|
|
28761
29567
|
const value = parseInt(color2.slice(index, index + 2), 16);
|
|
28762
29568
|
return Math.round(value + (target2 - value) * amount).toString(16).padStart(2, "0");
|
|
@@ -28769,15 +29575,15 @@ function visioFallbackQuickStyle(style2) {
|
|
|
28769
29575
|
case 1:
|
|
28770
29576
|
return { fill: light, line: base2, font: dark };
|
|
28771
29577
|
case 2:
|
|
28772
|
-
return { fill:
|
|
29578
|
+
return { fill: mix2(base2, 255, 0.8), line: base2, font: dark };
|
|
28773
29579
|
case 3:
|
|
28774
|
-
return { fill:
|
|
29580
|
+
return { fill: mix2(base2, 255, 0.6), line: base2, font: dark };
|
|
28775
29581
|
case 4:
|
|
28776
|
-
return { fill: base2, line:
|
|
29582
|
+
return { fill: base2, line: mix2(base2, 0, 0.25), font: light };
|
|
28777
29583
|
case 5:
|
|
28778
|
-
return { fill:
|
|
29584
|
+
return { fill: mix2(base2, 0, 0.25), line: mix2(base2, 0, 0.5), font: light };
|
|
28779
29585
|
default:
|
|
28780
|
-
return { fill:
|
|
29586
|
+
return { fill: mix2(base2, 0, 0.5), line: mix2(base2, 0, 0.5), font: light };
|
|
28781
29587
|
}
|
|
28782
29588
|
}
|
|
28783
29589
|
var rgb = (color2) => `RGB(${[1, 3, 5].map((index) => parseInt(color2.slice(index, index + 2), 16)).join(",")})`;
|
|
@@ -29081,7 +29887,11 @@ function snapshotFormatting(edit) {
|
|
|
29081
29887
|
["endArrow", 45, "Arrowheads are numbered 0 to 45."],
|
|
29082
29888
|
["beginArrowSize", 6, "Arrowhead sizes are numbered 0 to 6."],
|
|
29083
29889
|
["endArrowSize", 6, "Arrowhead sizes are numbered 0 to 6."],
|
|
29084
|
-
["lineCap", 2, "Line caps are 0 (round), 1 (square) or 2 (extended)."]
|
|
29890
|
+
["lineCap", 2, "Line caps are 0 (round), 1 (square) or 2 (extended)."],
|
|
29891
|
+
["lineJumpCode", 4, "Connector jump policies are numbered 0 to 4."],
|
|
29892
|
+
["lineJumpStyle", 9, "Connector jump styles are numbered 0 to 9."],
|
|
29893
|
+
["lineJumpDirectionX", 2, "Connector jump directions are numbered 0 to 2."],
|
|
29894
|
+
["lineJumpDirectionY", 2, "Connector jump directions are numbered 0 to 2."]
|
|
29085
29895
|
]) {
|
|
29086
29896
|
const value = edit[name3];
|
|
29087
29897
|
if (value === void 0) continue;
|
|
@@ -29160,6 +29970,12 @@ function geometryChangedCells(edit) {
|
|
|
29160
29970
|
if (edit.type === "flip-shape") return ["Angle", edit.axis === "horizontal" ? "FlipX" : "FlipY"];
|
|
29161
29971
|
return ["PinX", "PinY", "Width", "Height"];
|
|
29162
29972
|
}
|
|
29973
|
+
function snapshotPositionFollower(value, own) {
|
|
29974
|
+
if (value === void 0) return {};
|
|
29975
|
+
if (typeof value !== "string" || !/^[1-9]\d{0,9}$/.test(value) || Number(value) > 4294967295 || value === own)
|
|
29976
|
+
fail("INVALID_EDIT", "A distinct numeric owner shape ID is required.");
|
|
29977
|
+
return { followShapeId: value };
|
|
29978
|
+
}
|
|
29163
29979
|
function snapshotVisioEdits(edits, maxEdits, maxText) {
|
|
29164
29980
|
if (!Array.isArray(edits) || edits.length > maxEdits)
|
|
29165
29981
|
fail("LIMIT_EDITS", "Edit command count exceeds limit.");
|
|
@@ -29251,6 +30067,7 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
|
|
|
29251
30067
|
case "create-text-box":
|
|
29252
30068
|
return {
|
|
29253
30069
|
...target2,
|
|
30070
|
+
...snapshotPositionFollower(edit.followShapeId, edit.shapeId),
|
|
29254
30071
|
type: edit.type,
|
|
29255
30072
|
x: numeric5(edit.x),
|
|
29256
30073
|
y: numeric5(edit.y),
|
|
@@ -29282,6 +30099,7 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
|
|
|
29282
30099
|
fail("INVALID_EDIT", "Unknown outline shape.");
|
|
29283
30100
|
return {
|
|
29284
30101
|
...target2,
|
|
30102
|
+
...snapshotPositionFollower(edit.followShapeId, edit.shapeId),
|
|
29285
30103
|
type: edit.type,
|
|
29286
30104
|
x: numeric5(edit.x),
|
|
29287
30105
|
y: numeric5(edit.y),
|
|
@@ -30308,7 +31126,7 @@ function cells2(sheet) {
|
|
|
30308
31126
|
};
|
|
30309
31127
|
for (const node2 of children2(sheet, "Cell")) add(attribute2(node2, "N") ?? "", node2);
|
|
30310
31128
|
for (const section3 of children2(sheet, "Section")) {
|
|
30311
|
-
const name3 = attribute2(section3, "N") ?? "";
|
|
31129
|
+
const name3 = shapeDataFormulaSection(attribute2(section3, "N") ?? "");
|
|
30312
31130
|
const prefix2 = name3 === "Geometry" ? `Geometry${Number(attribute2(section3, "IX") ?? "0") + 1}` : name3;
|
|
30313
31131
|
for (const node2 of children2(section3, "Cell"))
|
|
30314
31132
|
add(`${prefix2}.${attribute2(node2, "N") ?? ""}`, node2);
|
|
@@ -30672,7 +31490,7 @@ function localCell(node2) {
|
|
|
30672
31490
|
const row2 = node2.parentNode;
|
|
30673
31491
|
const section3 = row2?.parentNode;
|
|
30674
31492
|
if (row2?.localName === "Row" && section3?.localName === "Section") {
|
|
30675
|
-
const name3 = attribute2(section3, "N"), rowName = attribute2(row2, "N") ?? attribute2(row2, "IX");
|
|
31493
|
+
const name3 = shapeDataFormulaSection(attribute2(section3, "N") ?? ""), rowName = attribute2(row2, "N") ?? attribute2(row2, "IX");
|
|
30676
31494
|
if (!name3 || !rowName) return void 0;
|
|
30677
31495
|
return `${name3}.${rowName}${attribute2(node2, "N") === "Value" && ["User", "Prop"].includes(name3) ? "" : `.${attribute2(node2, "N")}`}`;
|
|
30678
31496
|
}
|
|
@@ -31009,6 +31827,87 @@ function addReplacementPage(pagesPart, pages, rels, types, pagePaths, parts, dir
|
|
|
31009
31827
|
);
|
|
31010
31828
|
}
|
|
31011
31829
|
|
|
31830
|
+
// visio/edit-alt-text.ts
|
|
31831
|
+
function writeShapeAltText(shape, title, description, inherited = false) {
|
|
31832
|
+
const sections = children2(shape, "Section").filter(
|
|
31833
|
+
(section4) => attribute2(section4, "N") === "User"
|
|
31834
|
+
);
|
|
31835
|
+
if (sections.length > 1 || sections[0]?.hasAttribute("Del"))
|
|
31836
|
+
fail("UNSUPPORTED_METADATA_EDIT", "Ambiguous or deleted User sections cannot be edited.");
|
|
31837
|
+
let section3 = sections[0];
|
|
31838
|
+
let changed = false;
|
|
31839
|
+
for (const [name3, value] of [
|
|
31840
|
+
["visAltText", title],
|
|
31841
|
+
["visAltDescription", description]
|
|
31842
|
+
]) {
|
|
31843
|
+
const rows = children2(section3, "Row").filter((row3) => attribute2(row3, "N") === name3);
|
|
31844
|
+
if (rows.length > 1 || rows[0]?.hasAttribute("Del"))
|
|
31845
|
+
fail(
|
|
31846
|
+
"UNSUPPORTED_METADATA_EDIT",
|
|
31847
|
+
"Ambiguous or deleted accessibility rows cannot be edited."
|
|
31848
|
+
);
|
|
31849
|
+
let row2 = rows[0];
|
|
31850
|
+
const cells4 = children2(row2, "Cell").filter((cell2) => attribute2(cell2, "N") === "Value");
|
|
31851
|
+
if (cells4.length > 1 || cells4[0]?.hasAttribute("E") || executableCellFormula(attribute2(cells4[0], "F")))
|
|
31852
|
+
fail("UNSUPPORTED_METADATA_EDIT", "Formula-driven alternative text cannot be replaced.");
|
|
31853
|
+
let cell = cells4[0];
|
|
31854
|
+
if (attribute2(cell, "V") === value || !row2 && !value && !inherited) continue;
|
|
31855
|
+
const create2 = (tag) => shape.ownerDocument.createElementNS(shape.namespaceURI, tag);
|
|
31856
|
+
if (!section3) {
|
|
31857
|
+
section3 = create2("Section");
|
|
31858
|
+
section3.setAttribute("N", "User");
|
|
31859
|
+
const after = Array.from(shape.childNodes).find(
|
|
31860
|
+
(node2) => node2.nodeType === 1 && ["Text", "Data1", "Data2", "Data3", "ForeignData", "Shapes"].includes(
|
|
31861
|
+
node2.localName
|
|
31862
|
+
)
|
|
31863
|
+
);
|
|
31864
|
+
shape.insertBefore(section3, after ?? null);
|
|
31865
|
+
}
|
|
31866
|
+
if (!row2) {
|
|
31867
|
+
row2 = create2("Row");
|
|
31868
|
+
row2.setAttribute("N", name3);
|
|
31869
|
+
section3.appendChild(row2);
|
|
31870
|
+
}
|
|
31871
|
+
if (!cell) {
|
|
31872
|
+
cell = create2("Cell");
|
|
31873
|
+
cell.setAttribute("N", "Value");
|
|
31874
|
+
row2.insertBefore(cell, row2.firstChild);
|
|
31875
|
+
}
|
|
31876
|
+
cell.setAttribute("V", value);
|
|
31877
|
+
cell.setAttribute("U", "STR");
|
|
31878
|
+
cell.removeAttribute("F");
|
|
31879
|
+
changed = true;
|
|
31880
|
+
}
|
|
31881
|
+
return changed;
|
|
31882
|
+
}
|
|
31883
|
+
|
|
31884
|
+
// visio/edit-page-alt-text.ts
|
|
31885
|
+
async function setVisioPageAltText(pkg, pagesPart, pages, dirty, command2, check) {
|
|
31886
|
+
const page = pageById(pages, command2.pageId);
|
|
31887
|
+
const sheets = children2(page, "PageSheet");
|
|
31888
|
+
if (sheets.length > 1) fail("UNSUPPORTED_METADATA_EDIT", "Ambiguous PageSheet metadata.");
|
|
31889
|
+
for (const path of pkg.paths()) {
|
|
31890
|
+
if (!/^visio\/.*\.xml$/i.test(path)) continue;
|
|
31891
|
+
const part = path === pagesPart ? pages : dirty.get(path) ?? await pkg.readXml(path);
|
|
31892
|
+
for (const cell of Array.from(part.getElementsByTagNameNS(part.namespaceURI, "Cell"))) {
|
|
31893
|
+
check();
|
|
31894
|
+
const formula = executableCellFormula(attribute2(cell, "F"));
|
|
31895
|
+
if (formula && /\bUser\s*\.\s*visAlt(?:Text|Description)\b/i.test(formula))
|
|
31896
|
+
fail(
|
|
31897
|
+
"UNSUPPORTED_METADATA_EDIT",
|
|
31898
|
+
"A formula reads alternative text; dependent caches cannot be recalculated."
|
|
31899
|
+
);
|
|
31900
|
+
}
|
|
31901
|
+
}
|
|
31902
|
+
let sheet = sheets[0];
|
|
31903
|
+
if (!sheet) {
|
|
31904
|
+
if (!command2.title && !command2.description) return;
|
|
31905
|
+
sheet = page.ownerDocument.createElementNS(page.namespaceURI, "PageSheet");
|
|
31906
|
+
page.insertBefore(sheet, page.firstChild);
|
|
31907
|
+
}
|
|
31908
|
+
if (writeShapeAltText(sheet, command2.title, command2.description)) dirty.set(pagesPart, pages);
|
|
31909
|
+
}
|
|
31910
|
+
|
|
31012
31911
|
// visio/edit-page-create.ts
|
|
31013
31912
|
var officeRel2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
31014
31913
|
var pageType2 = "http://schemas.microsoft.com/visio/2010/relationships/page";
|
|
@@ -31090,7 +31989,7 @@ function removeDecoration(root2, pageName, kind, pageRoots, check) {
|
|
|
31090
31989
|
for (const shape of targets) container.removeChild(shape);
|
|
31091
31990
|
return true;
|
|
31092
31991
|
}
|
|
31093
|
-
function
|
|
31992
|
+
function text4(shape, cellName, value) {
|
|
31094
31993
|
const node2 = shape.ownerDocument.createElementNS(shape.namespaceURI, "Cell");
|
|
31095
31994
|
node2.setAttribute("N", cellName);
|
|
31096
31995
|
node2.setAttribute("V", value);
|
|
@@ -31126,10 +32025,10 @@ function decorationShape(root2, document, id3, spec, ratio) {
|
|
|
31126
32025
|
setCell(shape, "LocPinY", height / 2, "Height*0.5");
|
|
31127
32026
|
setCell(shape, "Angle", 0);
|
|
31128
32027
|
setCell(shape, "FillPattern", spec.fill ? 1 : 0);
|
|
31129
|
-
if (spec.fill)
|
|
32028
|
+
if (spec.fill) text4(shape, "FillForegnd", spec.fill);
|
|
31130
32029
|
setCell(shape, "LinePattern", spec.line ? 1 : 0);
|
|
31131
32030
|
if (spec.line) {
|
|
31132
|
-
|
|
32031
|
+
text4(shape, "LineColor", spec.line);
|
|
31133
32032
|
setCell(shape, "LineWeight", 1 / 72);
|
|
31134
32033
|
}
|
|
31135
32034
|
setCell(shape, "ShdwPattern", 0);
|
|
@@ -31286,6 +32185,10 @@ async function editVsdxPages(original, pkg, parts, commands, limits, maxOutput,
|
|
|
31286
32185
|
for (const command2 of commands) {
|
|
31287
32186
|
check();
|
|
31288
32187
|
const existing = children2(pages, "Page");
|
|
32188
|
+
if (command2.type === "set-page-alt-text") {
|
|
32189
|
+
await setVisioPageAltText(pkg, pagesPart, pages, dirty, command2, check);
|
|
32190
|
+
continue;
|
|
32191
|
+
}
|
|
31289
32192
|
if (command2.type === "set-page-setup") {
|
|
31290
32193
|
await setVisioPageSetup(pkg, pagesPart, pages, pagePaths, dirty, command2, check);
|
|
31291
32194
|
continue;
|
|
@@ -31381,7 +32284,7 @@ async function editVsdxPages(original, pkg, parts, commands, limits, maxOutput,
|
|
|
31381
32284
|
return { bytes: original, changedParts: [], diagnostics: [] };
|
|
31382
32285
|
}
|
|
31383
32286
|
if (commands.some(
|
|
31384
|
-
(command2) => command2.type !== "set-page-size" && command2.type !== "set-page-setup" && command2.type !== "set-page-layout" && command2.type !== "set-snap-glue"
|
|
32287
|
+
(command2) => command2.type !== "set-page-size" && command2.type !== "set-page-setup" && command2.type !== "set-page-layout" && command2.type !== "set-page-alt-text" && command2.type !== "set-snap-glue"
|
|
31385
32288
|
)) {
|
|
31386
32289
|
await updatePageAppProperties(pkg, pages, priorCount, dirty, limits, check);
|
|
31387
32290
|
await recalculatePageFormulas(pkg, pagesPart, pages, pagePaths, dirty, check);
|
|
@@ -31709,7 +32612,11 @@ function shapeFormattingWrites(edit) {
|
|
|
31709
32612
|
["endArrow", "EndArrow"],
|
|
31710
32613
|
["beginArrowSize", "BeginArrowSize"],
|
|
31711
32614
|
["endArrowSize", "EndArrowSize"],
|
|
31712
|
-
["lineCap", "LineCap"]
|
|
32615
|
+
["lineCap", "LineCap"],
|
|
32616
|
+
["lineJumpCode", "ConLineJumpCode"],
|
|
32617
|
+
["lineJumpStyle", "ConLineJumpStyle"],
|
|
32618
|
+
["lineJumpDirectionX", "ConLineJumpDirX"],
|
|
32619
|
+
["lineJumpDirectionY", "ConLineJumpDirY"]
|
|
31713
32620
|
])
|
|
31714
32621
|
if (edit[name3] !== void 0) add(cell, edit[name3], "LineStyle");
|
|
31715
32622
|
if (edit.rounding !== void 0) add("Rounding", edit.rounding / 72, "LineStyle", "PT");
|
|
@@ -31782,6 +32689,14 @@ async function applyFormattingEdit(pkg, pagePaths, roots, document, edit, check)
|
|
|
31782
32689
|
}
|
|
31783
32690
|
async function formatTarget(pkg, pagePaths, roots, document, edit, check, instance, root2, lenient) {
|
|
31784
32691
|
const shape = instance?.view ?? targetShape(root2, edit.shapeId);
|
|
32692
|
+
if (edit.type === "format-shape" && [edit.lineJumpCode, edit.lineJumpStyle, edit.lineJumpDirectionX, edit.lineJumpDirectionY].some(
|
|
32693
|
+
(value) => value !== void 0
|
|
32694
|
+
) && !(children2(shape, "Cell").some(
|
|
32695
|
+
(cell) => attribute2(cell, "N") === "OneD" && Number(attribute2(cell, "V")) === 1
|
|
32696
|
+
) || ["BeginX", "EndX"].every(
|
|
32697
|
+
(name3) => children2(shape, "Cell").some((cell) => attribute2(cell, "N") === name3)
|
|
32698
|
+
)))
|
|
32699
|
+
fail("INVALID_EDIT", "Line jump settings require a connector.");
|
|
31785
32700
|
if (instance) {
|
|
31786
32701
|
const layers = children2(shape, "Cell").find((cell) => attribute2(cell, "N") === "LayerMember");
|
|
31787
32702
|
await assertInstanceLayersUnlocked(pkg, edit.pageId, attribute2(layers, "V"));
|
|
@@ -31815,7 +32730,7 @@ async function formatTarget(pkg, pagePaths, roots, document, edit, check, instan
|
|
|
31815
32730
|
continue;
|
|
31816
32731
|
throw error;
|
|
31817
32732
|
}
|
|
31818
|
-
if (/^(LinePattern|FillPattern|FillGradientEnabled|LineGradientEnabled|LineColorTrans|FillForegndTrans|FillBkgndTrans|FillBkgnd|ShdwPattern|ShdwForegndTrans|ShapeShdwType|GlowColorTrans|ReflectionTrans|ReflectionSize|QuickStyle[A-Za-z]+)$/.test(
|
|
32733
|
+
if (/^(ConLineJump(?:Code|Style|DirX|DirY)|LinePattern|FillPattern|FillGradientEnabled|LineGradientEnabled|LineColorTrans|FillForegndTrans|FillBkgndTrans|FillBkgnd|ShdwPattern|ShdwForegndTrans|ShapeShdwType|GlowColorTrans|ReflectionTrans|ReflectionSize|QuickStyle[A-Za-z]+)$/.test(
|
|
31819
32734
|
write2.name
|
|
31820
32735
|
) && effective?.hasAttribute("U") && visioFormulaCachedValue("0", attribute2(effective, "U")).unit !== "scalar")
|
|
31821
32736
|
fail(
|
|
@@ -32707,6 +33622,56 @@ function applyMetadataEdit(roots, edit, check) {
|
|
|
32707
33622
|
return true;
|
|
32708
33623
|
}
|
|
32709
33624
|
|
|
33625
|
+
// visio/edit-alt-text-scope.ts
|
|
33626
|
+
async function applyShapeAltText(pkg, pagePaths, roots, edit, check) {
|
|
33627
|
+
const root2 = roots.get(edit.pageId);
|
|
33628
|
+
if (!root2) fail("EDIT_TARGET_NOT_FOUND", "Page does not exist.");
|
|
33629
|
+
const target2 = textTarget(root2, edit.shapeId, check);
|
|
33630
|
+
const inspect6 = (part) => {
|
|
33631
|
+
for (const cell of Array.from(part.getElementsByTagNameNS(part.namespaceURI, "Cell"))) {
|
|
33632
|
+
check();
|
|
33633
|
+
const formula = executableCellFormula(attribute2(cell, "F"));
|
|
33634
|
+
if (formula && /\bUser\s*\.\s*visAlt(?:Text|Description)\b/i.test(formula))
|
|
33635
|
+
fail(
|
|
33636
|
+
"UNSUPPORTED_METADATA_EDIT",
|
|
33637
|
+
"A formula reads alternative text; dependent caches cannot be recalculated."
|
|
33638
|
+
);
|
|
33639
|
+
}
|
|
33640
|
+
};
|
|
33641
|
+
for (const page of roots.values()) inspect6(page);
|
|
33642
|
+
for (const path of pkg.paths()) {
|
|
33643
|
+
if (/^visio\/.*\.xml$/i.test(path) && !pagePaths.has(path)) inspect6(await pkg.readXml(path));
|
|
33644
|
+
}
|
|
33645
|
+
if (target2.masterId !== void 0) {
|
|
33646
|
+
const template = await masterTemplate(pkg)(target2.masterId, target2.masterShapeId);
|
|
33647
|
+
if (template.hasAttribute("Master") || template.hasAttribute("MasterShape"))
|
|
33648
|
+
fail("UNSUPPORTED_METADATA_EDIT", "Chained master accessibility metadata is not supported.");
|
|
33649
|
+
const inherited = template.cloneNode(true);
|
|
33650
|
+
for (const section3 of children2(inherited, "Section").filter(
|
|
33651
|
+
(section4) => attribute2(section4, "N") === "User"
|
|
33652
|
+
)) {
|
|
33653
|
+
for (const row2 of children2(section3, "Row")) {
|
|
33654
|
+
const localRow = children2(target2.node, "Section").filter((s) => attribute2(s, "N") === "User").flatMap((s) => children2(s, "Row")).find((r) => attribute2(r, "N") === attribute2(row2, "N"));
|
|
33655
|
+
const local = children2(localRow, "Cell").find((cell) => attribute2(cell, "N") === "Value");
|
|
33656
|
+
if (local && attribute2(local, "F") !== "Inh") {
|
|
33657
|
+
for (const cell of children2(row2, "Cell").filter(
|
|
33658
|
+
(cell2) => attribute2(cell2, "N") === "Value"
|
|
33659
|
+
))
|
|
33660
|
+
row2.removeChild(cell);
|
|
33661
|
+
row2.appendChild(local.cloneNode(true));
|
|
33662
|
+
}
|
|
33663
|
+
}
|
|
33664
|
+
}
|
|
33665
|
+
writeShapeAltText(inherited, edit.title, edit.description, true);
|
|
33666
|
+
}
|
|
33667
|
+
return writeShapeAltText(
|
|
33668
|
+
target2.node,
|
|
33669
|
+
edit.title,
|
|
33670
|
+
edit.description,
|
|
33671
|
+
target2.masterId !== void 0
|
|
33672
|
+
);
|
|
33673
|
+
}
|
|
33674
|
+
|
|
32710
33675
|
// visio/edit-picture.ts
|
|
32711
33676
|
var FORMATS = {
|
|
32712
33677
|
"image/png": { extension: "png", compression: "PNG" },
|
|
@@ -32918,7 +33883,7 @@ function assertParentIndependent(facts, from, ids) {
|
|
|
32918
33883
|
}
|
|
32919
33884
|
|
|
32920
33885
|
// visio/edit-group.ts
|
|
32921
|
-
var
|
|
33886
|
+
var clean3 = (value) => Math.abs(value) < 1e-12 ? 0 : value;
|
|
32922
33887
|
var NONE = /* @__PURE__ */ new Map();
|
|
32923
33888
|
function topLevel(root2) {
|
|
32924
33889
|
const containers = children2(root2, "Shapes");
|
|
@@ -33038,7 +34003,7 @@ function groupVisioShapes(root2, document, edit, check, instances = NONE) {
|
|
|
33038
34003
|
const topmost = members3[members3.length - 1];
|
|
33039
34004
|
topmost.parentNode.insertBefore(group, topmost);
|
|
33040
34005
|
for (const plan of plans) {
|
|
33041
|
-
const x =
|
|
34006
|
+
const x = clean3(plan.pinX - minX), y = clean3(plan.pinY - minY);
|
|
33042
34007
|
const instance = instances.get(plan.member);
|
|
33043
34008
|
if (instance) placeInstance(instance, x, y, check);
|
|
33044
34009
|
else {
|
|
@@ -33111,9 +34076,9 @@ function ungroupVisioShape(root2, document, edit, check, instances = NONE) {
|
|
|
33111
34076
|
if (Math.abs(Math.abs(angle) - Math.PI) < 1e-12) angle = Math.PI;
|
|
33112
34077
|
const plan = {
|
|
33113
34078
|
member,
|
|
33114
|
-
pinX:
|
|
33115
|
-
pinY:
|
|
33116
|
-
angle:
|
|
34079
|
+
pinX: clean3(a * box4.pinX + c * box4.pinY + e),
|
|
34080
|
+
pinY: clean3(b * box4.pinX + d * box4.pinY + f),
|
|
34081
|
+
angle: clean3(angle),
|
|
33117
34082
|
flipX: box4.flipX !== parent.flipX ? 1 : 0,
|
|
33118
34083
|
flipY: box4.flipY !== parent.flipY ? 1 : 0,
|
|
33119
34084
|
box: box4
|
|
@@ -34330,9 +35295,22 @@ function positive2(value) {
|
|
|
34330
35295
|
return value;
|
|
34331
35296
|
}
|
|
34332
35297
|
async function editVsdx(input, edits, options = {}) {
|
|
34333
|
-
const clock = {
|
|
35298
|
+
const clock = {
|
|
35299
|
+
deadline: 0,
|
|
35300
|
+
autoSize: /* @__PURE__ */ new Set(),
|
|
35301
|
+
textSizes: [],
|
|
35302
|
+
jumpPages: /* @__PURE__ */ new Set(),
|
|
35303
|
+
jumpSource: void 0
|
|
35304
|
+
};
|
|
34334
35305
|
const edited = await editVsdxTransaction(input, edits, options, clock);
|
|
34335
|
-
const
|
|
35306
|
+
const resized = await refreshTextSizes(clock.textSizes, edited, options, clock.deadline);
|
|
35307
|
+
const result = await refreshLineJumpCaches(
|
|
35308
|
+
clock.jumpPages,
|
|
35309
|
+
clock.jumpSource,
|
|
35310
|
+
resized,
|
|
35311
|
+
options,
|
|
35312
|
+
clock.deadline
|
|
35313
|
+
);
|
|
34336
35314
|
return growAutoSizePages(
|
|
34337
35315
|
clock.autoSize,
|
|
34338
35316
|
result,
|
|
@@ -34342,7 +35320,13 @@ async function editVsdx(input, edits, options = {}) {
|
|
|
34342
35320
|
})
|
|
34343
35321
|
);
|
|
34344
35322
|
}
|
|
34345
|
-
async function editVsdxTransaction(input, edits, options, clock = {
|
|
35323
|
+
async function editVsdxTransaction(input, edits, options, clock = {
|
|
35324
|
+
deadline: 0,
|
|
35325
|
+
autoSize: /* @__PURE__ */ new Set(),
|
|
35326
|
+
textSizes: [],
|
|
35327
|
+
jumpPages: /* @__PURE__ */ new Set(),
|
|
35328
|
+
jumpSource: void 0
|
|
35329
|
+
}) {
|
|
34346
35330
|
const limits = { ...DEFAULTS, ...options.limits };
|
|
34347
35331
|
for (const value of Object.values(limits)) positive2(value);
|
|
34348
35332
|
const maxEdits = positive2(options.maxEdits ?? 1e3);
|
|
@@ -34354,10 +35338,14 @@ async function editVsdxTransaction(input, edits, options, clock = { deadline: 0,
|
|
|
34354
35338
|
if (Date.now() >= deadline) fail("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
|
|
34355
35339
|
};
|
|
34356
35340
|
const allCommands = snapshotVisioEdits(edits, maxEdits, maxText);
|
|
35341
|
+
for (const command2 of allCommands)
|
|
35342
|
+
if ((command2.type === "set-page-layout" || command2.type === "format-shape") && Object.keys(command2).some((key2) => /^lineJump|^lineToLine/.test(key2)))
|
|
35343
|
+
clock.jumpPages.add(command2.pageId);
|
|
34357
35344
|
const commands = allCommands.filter((command2) => !isVisioPageEdit(command2));
|
|
34358
35345
|
const source = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
34359
35346
|
if (source.length > limits.maxInputBytes) fail("LIMIT_INPUT", "ZIP input exceeds limit.");
|
|
34360
35347
|
const original = new Uint8Array(source);
|
|
35348
|
+
if (clock.jumpPages.size) clock.jumpSource ??= original;
|
|
34361
35349
|
const subprocess = allCommands.find((command2) => command2.type === "create-subprocess");
|
|
34362
35350
|
if (subprocess) {
|
|
34363
35351
|
if (allCommands.length !== 1)
|
|
@@ -34624,7 +35612,7 @@ async function editVsdxTransaction(input, edits, options, clock = { deadline: 0,
|
|
|
34624
35612
|
if (command2.type === "format-text") await noteTextSize(command2, root2);
|
|
34625
35613
|
}
|
|
34626
35614
|
} else if (isVisioMetadataEdit(command2)) {
|
|
34627
|
-
if (applyMetadataEdit(roots, command2, check)) {
|
|
35615
|
+
if (command2.type === "set-shape-alt-text" ? await applyShapeAltText(pkg, new Set(pages.values()), roots, command2, check) : applyMetadataEdit(roots, command2, check)) {
|
|
34628
35616
|
dirty.set(path, root2);
|
|
34629
35617
|
metadataChanged = true;
|
|
34630
35618
|
}
|
|
@@ -35009,162 +35997,6 @@ async function createVsdx(options = {}) {
|
|
|
35009
35997
|
return writeEditedPackage(parts, DEFAULTS.maxInputBytes, deadline, check);
|
|
35010
35998
|
}
|
|
35011
35999
|
|
|
35012
|
-
// visio/line-jumps.ts
|
|
35013
|
-
var VISIO_LINE_JUMP_WIDTH = 2 / 3 * (1 / 6);
|
|
35014
|
-
var VISIO_LINE_JUMP_LIMITS = Object.freeze({ connectors: 2e3, segments: 2e4 });
|
|
35015
|
-
var TOKEN = /([MLZmlz]|[A-Za-z])|([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)/g;
|
|
35016
|
-
function polylines(path) {
|
|
35017
|
-
const result = [];
|
|
35018
|
-
let command2 = "";
|
|
35019
|
-
let pending;
|
|
35020
|
-
for (const match of path.matchAll(TOKEN)) {
|
|
35021
|
-
if (match[1]) {
|
|
35022
|
-
if (match[1] !== "M" && match[1] !== "L") return void 0;
|
|
35023
|
-
if (pending !== void 0) return void 0;
|
|
35024
|
-
command2 = match[1];
|
|
35025
|
-
continue;
|
|
35026
|
-
}
|
|
35027
|
-
const value = Number(match[2]);
|
|
35028
|
-
if (!Number.isFinite(value) || !command2) return void 0;
|
|
35029
|
-
if (pending === void 0) {
|
|
35030
|
-
pending = value;
|
|
35031
|
-
continue;
|
|
35032
|
-
}
|
|
35033
|
-
const point2 = { x: pending, y: value };
|
|
35034
|
-
pending = void 0;
|
|
35035
|
-
if (command2 === "M") {
|
|
35036
|
-
result.push([point2]);
|
|
35037
|
-
command2 = "L";
|
|
35038
|
-
} else result.at(-1)?.push(point2);
|
|
35039
|
-
}
|
|
35040
|
-
return pending === void 0 && result.every((line) => line.length > 1) ? result : void 0;
|
|
35041
|
-
}
|
|
35042
|
-
var apply2 = (m, p) => ({
|
|
35043
|
-
x: m[0] * p.x + m[2] * p.y + m[4],
|
|
35044
|
-
y: m[1] * p.x + m[3] * p.y + m[5]
|
|
35045
|
-
});
|
|
35046
|
-
function invert(m) {
|
|
35047
|
-
const det = m[0] * m[3] - m[1] * m[2];
|
|
35048
|
-
if (!Number.isFinite(det) || Math.abs(det) < 1e-12) return void 0;
|
|
35049
|
-
return [
|
|
35050
|
-
m[3] / det,
|
|
35051
|
-
-m[1] / det,
|
|
35052
|
-
-m[2] / det,
|
|
35053
|
-
m[0] / det,
|
|
35054
|
-
(m[2] * m[5] - m[3] * m[4]) / det,
|
|
35055
|
-
(m[1] * m[4] - m[0] * m[5]) / det
|
|
35056
|
-
];
|
|
35057
|
-
}
|
|
35058
|
-
var clean3 = (value) => Math.abs(value) < 1e-9 ? 0 : Number(value.toFixed(6));
|
|
35059
|
-
var text4 = (p) => `${clean3(p.x)} ${clean3(p.y)}`;
|
|
35060
|
-
var horizontal = (s) => Math.abs(s.a.y - s.b.y) < 1e-6 && Math.abs(s.a.x - s.b.x) > 1e-6;
|
|
35061
|
-
var vertical = (s) => Math.abs(s.a.x - s.b.x) < 1e-6 && Math.abs(s.a.y - s.b.y) > 1e-6;
|
|
35062
|
-
function crossing(s, other, margin) {
|
|
35063
|
-
const dx = s.b.x - s.a.x, dy = s.b.y - s.a.y, ox = other.b.x - other.a.x, oy = other.b.y - other.a.y;
|
|
35064
|
-
const det = dx * oy - dy * ox;
|
|
35065
|
-
const length = Math.hypot(dx, dy), otherLength = Math.hypot(ox, oy);
|
|
35066
|
-
if (Math.abs(det) < 1e-9 || Math.abs(det) / (length * otherLength) < 0.2) return void 0;
|
|
35067
|
-
const t = ((other.a.x - s.a.x) * oy - (other.a.y - s.a.y) * ox) / det;
|
|
35068
|
-
const u = ((other.a.x - s.a.x) * dy - (other.a.y - s.a.y) * dx) / det;
|
|
35069
|
-
if (u * otherLength < 1e-6 || (1 - u) * otherLength < 1e-6) return void 0;
|
|
35070
|
-
if (t * length < margin || (1 - t) * length < margin) return void 0;
|
|
35071
|
-
return t;
|
|
35072
|
-
}
|
|
35073
|
-
function jumps(code, s, other) {
|
|
35074
|
-
if (code === 1) return horizontal(s) && !horizontal(other);
|
|
35075
|
-
if (code === 2) return vertical(s) && !vertical(other);
|
|
35076
|
-
if (code === 3 || code === 4) return s.owner > other.owner;
|
|
35077
|
-
return code === 5 && s.owner < other.owner;
|
|
35078
|
-
}
|
|
35079
|
-
function jump(style2, from, to, local) {
|
|
35080
|
-
const half = Math.hypot(to.x - from.x, to.y - from.y) / 2;
|
|
35081
|
-
const ux = (to.x - from.x) / (2 * half), uy = (to.y - from.y) / (2 * half);
|
|
35082
|
-
let nx = -uy, ny = ux;
|
|
35083
|
-
if (ny < -1e-9 || Math.abs(ny) <= 1e-9 && nx > 0) {
|
|
35084
|
-
nx = -nx;
|
|
35085
|
-
ny = -ny;
|
|
35086
|
-
}
|
|
35087
|
-
const centre = { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2 };
|
|
35088
|
-
const at2 = (along, out) => local({ x: centre.x + ux * along + nx * out, y: centre.y + uy * along + ny * out });
|
|
35089
|
-
const end = local(to);
|
|
35090
|
-
if (style2 === 1) return `M ${text4(end)}`;
|
|
35091
|
-
if (style2 === 2) return `L ${text4(at2(-half, half))} L ${text4(at2(half, half))} L ${text4(end)}`;
|
|
35092
|
-
if (style2 >= 3) {
|
|
35093
|
-
const sides = style2 - 1;
|
|
35094
|
-
let out = "";
|
|
35095
|
-
for (let index = 1; index < sides; ++index) {
|
|
35096
|
-
const angle = Math.PI - Math.PI * index / sides;
|
|
35097
|
-
out += `L ${text4(at2(Math.cos(angle) * half, Math.sin(angle) * half))} `;
|
|
35098
|
-
}
|
|
35099
|
-
return `${out}L ${text4(end)}`;
|
|
35100
|
-
}
|
|
35101
|
-
const start = local(from), top = at2(0, half);
|
|
35102
|
-
const radius = Math.hypot(end.x - start.x, end.y - start.y) / 2;
|
|
35103
|
-
const sweep = (end.x - start.x) * (top.y - start.y) - (end.y - start.y) * (top.x - start.x) > 0 ? 0 : 1;
|
|
35104
|
-
return `A ${clean3(radius)} ${clean3(radius)} 0 0 ${sweep} ${text4(end)}`;
|
|
35105
|
-
}
|
|
35106
|
-
var connector = (shape, glued) => shape.kind === "connector" && !shape.hidden && !shape.children.length && (shape.connectorRoute !== void 0 || glued.has(shape.id));
|
|
35107
|
-
function visioLineJumpPaths(page) {
|
|
35108
|
-
const result = /* @__PURE__ */ new Map();
|
|
35109
|
-
const layout = visioPageLayout(page);
|
|
35110
|
-
const code = layout.lineJumpCode;
|
|
35111
|
-
if (code < 1 || code > 5) return result;
|
|
35112
|
-
const glued = new Set(page.connectors.map((connection) => connection.fromShapeId));
|
|
35113
|
-
const shapes = page.shapes.filter((shape) => connector(shape, glued)).slice(0, VISIO_LINE_JUMP_LIMITS.connectors);
|
|
35114
|
-
if (shapes.length < 2) return result;
|
|
35115
|
-
const lines2 = [];
|
|
35116
|
-
const segments = [];
|
|
35117
|
-
shapes.forEach((shape, owner) => {
|
|
35118
|
-
shape.geometry.forEach((geometry, index) => {
|
|
35119
|
-
if (!geometry.stroke || geometry.fill) return;
|
|
35120
|
-
for (const line of polylines(geometry.path) ?? []) {
|
|
35121
|
-
const points = line.map((point2) => apply2(shape.transform, point2));
|
|
35122
|
-
lines2.push({ shape, owner, geometry: index, points });
|
|
35123
|
-
for (let i = 1; i < points.length; ++i)
|
|
35124
|
-
segments.push({ a: points[i - 1], b: points[i], owner });
|
|
35125
|
-
}
|
|
35126
|
-
});
|
|
35127
|
-
});
|
|
35128
|
-
if (segments.length > VISIO_LINE_JUMP_LIMITS.segments) return result;
|
|
35129
|
-
const half = VISIO_LINE_JUMP_WIDTH / 2;
|
|
35130
|
-
const paths = /* @__PURE__ */ new Map();
|
|
35131
|
-
const any = /* @__PURE__ */ new Set();
|
|
35132
|
-
for (const line of lines2) {
|
|
35133
|
-
const inverse = invert(line.shape.transform);
|
|
35134
|
-
if (!inverse) continue;
|
|
35135
|
-
const local = (point2) => apply2(inverse, point2);
|
|
35136
|
-
let out = `M ${text4(local(line.points[0]))}`;
|
|
35137
|
-
for (let i = 1; i < line.points.length; ++i) {
|
|
35138
|
-
const s = { a: line.points[i - 1], b: line.points[i], owner: line.owner };
|
|
35139
|
-
const length = Math.hypot(s.b.x - s.a.x, s.b.y - s.a.y);
|
|
35140
|
-
const hits = segments.filter((other) => other.owner !== s.owner && jumps(code, s, other)).flatMap((other) => crossing(s, other, half * 1.5) ?? []).sort((a, b) => a - b);
|
|
35141
|
-
let last = -Infinity;
|
|
35142
|
-
for (const t of hits) {
|
|
35143
|
-
if ((t - last) * length < half * 2.5) continue;
|
|
35144
|
-
last = t;
|
|
35145
|
-
const at2 = (offset) => ({
|
|
35146
|
-
x: s.a.x + (s.b.x - s.a.x) * (t * length + offset) / length,
|
|
35147
|
-
y: s.a.y + (s.b.y - s.a.y) * (t * length + offset) / length
|
|
35148
|
-
});
|
|
35149
|
-
out += ` L ${text4(local(at2(-half)))} ${jump(layout.lineJumpStyle, at2(-half), at2(half), local)}`;
|
|
35150
|
-
any.add(line.shape);
|
|
35151
|
-
}
|
|
35152
|
-
out += ` L ${text4(local(s.b))}`;
|
|
35153
|
-
}
|
|
35154
|
-
const byGeometry = paths.get(line.shape) ?? /* @__PURE__ */ new Map();
|
|
35155
|
-
byGeometry.set(line.geometry, [...byGeometry.get(line.geometry) ?? [], out]);
|
|
35156
|
-
paths.set(line.shape, byGeometry);
|
|
35157
|
-
}
|
|
35158
|
-
for (const shape of any) {
|
|
35159
|
-
const byGeometry = paths.get(shape);
|
|
35160
|
-
result.set(
|
|
35161
|
-
shape,
|
|
35162
|
-
shape.geometry.map((geometry, index) => byGeometry.get(index)?.join(" ") ?? geometry.path)
|
|
35163
|
-
);
|
|
35164
|
-
}
|
|
35165
|
-
return result;
|
|
35166
|
-
}
|
|
35167
|
-
|
|
35168
36000
|
// visio/open-arrow.ts
|
|
35169
36001
|
function visioOpenArrowExtent(size3, lineWidth) {
|
|
35170
36002
|
const index = Number.isFinite(size3) ? Math.max(0, Math.min(6, Math.trunc(size3))) : 2;
|
|
@@ -35257,4 +36089,29 @@ function trimVisioArrowLine(path, start, end, beginExtension = 0) {
|
|
|
35257
36089
|
return `M ${point2(start)}${base2 > start ? ` L ${point2(base2)}` : ""} L ${point2(length - end)}`;
|
|
35258
36090
|
}
|
|
35259
36091
|
|
|
35260
|
-
|
|
36092
|
+
// visio/accessibility.ts
|
|
36093
|
+
function checkVisioAlternativeText(document) {
|
|
36094
|
+
const issues = [];
|
|
36095
|
+
for (const page of document.pages) {
|
|
36096
|
+
const visit = (shapes) => {
|
|
36097
|
+
for (const shape of shapes) {
|
|
36098
|
+
if (shape.hidden) continue;
|
|
36099
|
+
const named2 = [shape.accessibilityTitle, shape.alternativeText, shape.text.plainText].some(
|
|
36100
|
+
(value) => value?.trim()
|
|
36101
|
+
);
|
|
36102
|
+
if (!named2 && shape.kind !== "group")
|
|
36103
|
+
issues.push({
|
|
36104
|
+
pageId: page.id,
|
|
36105
|
+
shapeId: shape.id,
|
|
36106
|
+
shapeName: shape.name,
|
|
36107
|
+
code: "missing-alternative-text"
|
|
36108
|
+
});
|
|
36109
|
+
if (!named2) visit(shape.children);
|
|
36110
|
+
}
|
|
36111
|
+
};
|
|
36112
|
+
visit(page.shapes);
|
|
36113
|
+
}
|
|
36114
|
+
return issues;
|
|
36115
|
+
}
|
|
36116
|
+
|
|
36117
|
+
export { VISIO_ARROW_SHAPES, VISIO_BACKGROUND_STYLES, VISIO_BASIC_SHAPES, VISIO_BASIC_STENCIL, VISIO_BORDER_STYLES, VISIO_BUILT_IN_STENCILS, VISIO_BUILT_IN_THEMES, VISIO_BUILT_IN_THEME_IDS, VISIO_CALLOUT_STYLES, VISIO_CLIPBOARD_MAGIC, VISIO_CLIPBOARD_MAX_CHARS, VISIO_COMMENT_AUTHOR_LIMIT, VISIO_COMMENT_LIMIT, VISIO_COMMENT_TEXT_LIMIT, VISIO_CONNECTOR_ROUTES, VISIO_CONTAINER_HEADING, VISIO_CONTAINER_MARGIN, VISIO_CONTAINER_STYLES, VISIO_DATA_LIMITS, VISIO_EMF_ADMISSION_LIMITS, VISIO_FIELD_FORMATS, VISIO_FIELD_FUNCTIONS, VISIO_FLOWCHART_SHAPES, VISIO_FOREIGN_VECTOR_LIMITS, VISIO_GLOW_SIZES, VISIO_GLOW_TRANSPARENCY, VISIO_GLUE, VISIO_GRID_DENSITIES, VISIO_LAYER_NAME_LIMIT, VISIO_LINE_JUMP_LIMITS, VISIO_LINE_JUMP_WIDTH, VISIO_MANAGED_BACKGROUND, VISIO_METADATA_TEXT_LIMIT, VISIO_PAGE_LAYOUT_DEFAULTS, VISIO_PATH_SEGMENT_LIMIT, VISIO_PICTURE_MAX_BYTES, VISIO_QUICK_STYLE_COLORS, VISIO_QUICK_STYLE_VARIANT_COLORS, VISIO_RASTER_IMAGE_LIMITS, VISIO_REFLECTION_PRESETS, VISIO_RULER_DENSITIES, VISIO_SCALE_UNITS, VISIO_SHADOW_PRESETS, VISIO_SHAPE_DATA_TYPES, VISIO_SNAP, VISIO_SNAP_GLUE_DEFAULTS, VISIO_SOFT_EDGE_SIZES, VISIO_STENCILS, VISIO_STENCIL_FILES, VISIO_TEXT_CASES, VISIO_TEXT_POSITIONS, VISIO_THEME_COLOR_SLOTS, VISIO_UNTHEMED_COLORS, VISIO_VISIBILITY_LIMITS, VisioForeignVectorError, VisioFormulaError, VisioImageError, VisioPackageError, analyzeVisioFormula, canonicalShapeDataValue, captureVisioClipboard, checkVisioAlternativeText, convertVisioMetafile, createVsdx, deserializeVisioClipboard, designTextMeasurer, editVsdx, evaluateVisioFormula, evaluateVisioTextField, formatVisioFieldValue, getVisioPageLayers, inspectVisioEmfAdmission, inspectVisioRasterImage, isVisioBasicShape, isVisioBuiltInThemeId, isVisioChangeShapeTarget, isVisioDiagramPartEdit, isVisioLayerName, isVisioOutlineShape, isVisioQuickStyleColor, isVisioShadowPreset, isVisioStencilShape, isVisioThemeColorRef, layoutVisioFilledArrowLine, loadVisio, parseLegacyVsd, parseVisioFormula, parseVisioThemeColorFormula, parseVsdx, resolveVisioPageVisibility, resolveVisioThemeColor, sanitizeVisioForeignVectorTree, serializeVisioClipboard, setVisioTextMeasurer, trimVisioArrowLine, validateVisioForeignVector, visioBackgroundShapes, visioBasicShapeOutline, visioBorderShapes, visioBuiltInMaster, visioBuiltInStencil, visioBuiltInTheme, visioCircleThrough, visioCurvedRoute, visioDecorationName, visioFallbackQuickStyle, visioFilledArrow, visioFitFreeform, visioFitPencil, visioFontAssumed, visioFormulaCachedValue, visioLineJumpPaths, visioLinkedRowNames, visioOpenArrowExtent, visioOpenArrowPath, visioOrthogonalRoute, visioOutlineShape, visioPageLayout, visioPageThemeColors, visioPathBounds, visioPathSamples, visioQuarterArc, visioShade, visioShadowPresetGeometry, visioShapeDataRowName, visioShapeStructure, visioSimplifyPath, visioSnapGlue, visioStencilMaster, visioStencilShapeOutline, visioTextExtents, visioThemeColorFormula, visioThemeVariantColors, visioThemeXml };
|