allyhub 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/align.js +1 -1
- package/dist/commands/check.js +1 -1
- package/dist/commands/cloud-tools.js +5 -5
- package/dist/commands/cloud.js +1 -1
- package/dist/commands/dev.js +5 -5
- package/dist/commands/export.js +3 -0
- package/dist/commands/frames/doc.js +1 -1
- package/dist/commands/frames/piece.js +1 -1
- package/dist/commands/frames/sheet.js +1 -1
- package/dist/commands/frames.js +9 -9
- package/dist/commands/index.js +1 -1
- package/dist/commands/inspect/combos.js +1 -1
- package/dist/commands/inspect/common.js +2 -2
- package/dist/commands/inspect/facts.js +2 -2
- package/dist/commands/migrate.js +3 -0
- package/dist/commands/skills.js +3 -3
- package/dist/commands/upgrade.js +5 -0
- package/dist/commands.json +1 -1
- package/dist/help.js +3 -3
- package/dist/main.js +8 -7
- package/dist/node_modules/@allyhub/3d-extension/package.json +2 -2
- package/dist/node_modules/@allyhub/audio/package.json +1 -1
- package/dist/node_modules/@allyhub/blocks/LICENSE +241 -0
- package/dist/node_modules/@allyhub/blocks/dist/alt.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/elements.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/flow-resolve.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/flow-table.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/format.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/gantt.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/grids.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/html.js +75 -0
- package/dist/node_modules/@allyhub/blocks/dist/icons.generated.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/icons.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/layout.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/look.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/measure.js +3 -0
- package/dist/node_modules/@allyhub/blocks/dist/model.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/page.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/palette.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/path.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/resolve.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/samples.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/sankey.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/svg.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/tidy.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/trees.js +2 -0
- package/dist/node_modules/@allyhub/blocks/package.json +19 -0
- package/dist/node_modules/@allyhub/browser/dist/html.js +1 -1
- package/dist/node_modules/@allyhub/browser/package.json +1 -1
- package/dist/node_modules/@allyhub/build/dist/fonts.js +9 -3
- package/dist/node_modules/@allyhub/build/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/inspect-view.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/migrate.js +2 -0
- package/dist/node_modules/@allyhub/build/dist/prepare.js +3 -3
- package/dist/node_modules/@allyhub/build/dist/work.js +3 -3
- package/dist/node_modules/@allyhub/build/package.json +5 -1
- package/dist/node_modules/@allyhub/canvas-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-model/package.json +1 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-file.js +2 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +4 -3
- package/dist/node_modules/@allyhub/chart/dist/chart.js +4 -2
- package/dist/node_modules/@allyhub/chart/dist/chartex-xml.js +4 -0
- package/dist/node_modules/@allyhub/chart/dist/classic.js +2 -0
- package/dist/node_modules/@allyhub/chart/dist/embedded.js +2 -2
- package/dist/node_modules/@allyhub/chart/dist/extended.js +2 -0
- package/dist/node_modules/@allyhub/chart/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/chart/dist/svg.js +1 -1
- package/dist/node_modules/@allyhub/chart/dist/tree.js +2 -0
- package/dist/node_modules/@allyhub/chart/package.json +1 -1
- package/dist/node_modules/@allyhub/check/dist/check.js +1 -1
- package/dist/node_modules/@allyhub/check/package.json +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/blobs.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/call.js +4 -4
- package/dist/node_modules/@allyhub/cloud/dist/client.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/storage.js +2 -0
- package/dist/node_modules/@allyhub/cloud/dist/uploads.js +2 -2
- package/dist/node_modules/@allyhub/cloud/package.json +1 -1
- package/dist/node_modules/@allyhub/components/package.json +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/background.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/item-process.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/item-worker.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/live.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/pages.js +20 -1
- package/dist/node_modules/@allyhub/dev-server/dist/project.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/record.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/server.js +2 -2
- package/dist/node_modules/@allyhub/dev-server/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/validate.js +2 -2
- package/dist/node_modules/@allyhub/dev-server/dist/writer.js +3 -3
- package/dist/node_modules/@allyhub/dev-server/package.json +1 -1
- package/dist/node_modules/@allyhub/diagnostics/dist/rules.js +1 -1
- package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
- package/dist/node_modules/@allyhub/doc/dist/block-shapes.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/blocks.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/color.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/docx-read.js +12 -0
- package/dist/node_modules/@allyhub/doc/dist/docx.js +5 -4
- package/dist/node_modules/@allyhub/doc/dist/html.js +83 -48
- package/dist/node_modules/@allyhub/doc/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/markdown.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/merges.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/model.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/numbering.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/omml.js +3 -0
- package/dist/node_modules/@allyhub/doc/dist/page.js +2 -1
- package/dist/node_modules/@allyhub/doc/dist/paper.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/parse.js +5 -4
- package/dist/node_modules/@allyhub/doc/dist/redline.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/revisions.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/shapes.js +4 -0
- package/dist/node_modules/@allyhub/doc/dist/styles.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/table.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/write.js +65 -39
- package/dist/node_modules/@allyhub/doc/package.json +5 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/build.js +2 -2
- package/dist/node_modules/@allyhub/doc-extension/dist/cli/find.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/cli/import.js +3 -0
- package/dist/node_modules/@allyhub/doc-extension/dist/cli/index.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/cli/styles.js +4 -0
- package/dist/node_modules/@allyhub/doc-extension/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/inspect.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/project-tools.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/package.json +22 -2
- package/dist/node_modules/@allyhub/doc-print/dist/drawn.js +4 -4
- package/dist/node_modules/@allyhub/doc-print/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/doc-print/dist/layout.js +8 -7
- package/dist/node_modules/@allyhub/doc-print/dist/print.js +22 -16
- package/dist/node_modules/@allyhub/doc-print/package.json +1 -1
- package/dist/node_modules/@allyhub/export/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/export/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-api/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-host/dist/points.js +1 -1
- package/dist/node_modules/@allyhub/extension-host/package.json +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/blocks-flow.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/blocks.d.ts +146 -0
- package/dist/node_modules/@allyhub/formats/dist/data/blocks.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/cell-styles.d.ts +9 -0
- package/dist/node_modules/@allyhub/formats/dist/data/cell-styles.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/deck-code.d.ts +47 -40
- package/dist/node_modules/@allyhub/formats/dist/data/deck-code.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/diagram-kinds.d.ts +6 -0
- package/dist/node_modules/@allyhub/formats/dist/data/diagram-kinds.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/diagrams.d.ts +29 -0
- package/dist/node_modules/@allyhub/formats/dist/data/diagrams.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/faces.d.ts +18 -0
- package/dist/node_modules/@allyhub/formats/dist/data/faces.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/page-data.d.ts +67 -0
- package/dist/node_modules/@allyhub/formats/dist/data/page-data.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/reference.d.ts +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +698 -258
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +14104 -2167
- package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/themes.d.ts +82 -0
- package/dist/node_modules/@allyhub/formats/dist/data/themes.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/tokens.d.ts +67 -0
- package/dist/node_modules/@allyhub/formats/dist/data/tokens.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/work.d.ts +42 -0
- package/dist/node_modules/@allyhub/formats/dist/data/work.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/index.d.ts +7 -0
- package/dist/node_modules/@allyhub/formats/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/items.d.ts +12 -3
- package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +3260 -290
- package/dist/node_modules/@allyhub/formats/dist/schemas.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/tolerant.d.ts +45 -0
- package/dist/node_modules/@allyhub/formats/dist/tolerant.js +2 -0
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/html-extension/dist/project-tools.js +21 -9
- package/dist/node_modules/@allyhub/html-extension/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/html-extension/markup/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/html-extension/markup/markup.json +14 -4
- package/dist/node_modules/@allyhub/html-extension/markup/pages/budget.html +22 -1
- package/dist/node_modules/@allyhub/html-extension/package.json +9 -1
- package/dist/node_modules/@allyhub/i18n/package.json +1 -1
- package/dist/node_modules/@allyhub/image-draw/dist/fonts.js +1 -1
- package/dist/node_modules/@allyhub/image-draw/dist/inspect.js +2 -2
- package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/build-plugins.js +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/cli.js +1 -1
- package/dist/node_modules/@allyhub/image-extension/package.json +2 -2
- package/dist/node_modules/@allyhub/image-extension/skills/allyhub/references/images.md +2 -2
- package/dist/node_modules/@allyhub/image-measure/dist/layout.js +2 -2
- package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/image-psd/package.json +1 -1
- package/dist/node_modules/@allyhub/image-render/package.json +1 -1
- package/dist/node_modules/@allyhub/image-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/image-sdk/dist/block.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/blocks.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/jobs/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-extension/package.json +1 -3
- package/dist/node_modules/@allyhub/linkedin-extension/skills/allyhub/references/linkedin.md +3 -3
- package/dist/node_modules/@allyhub/linkedin-model/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-view/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-view/src/style.css +1 -1
- package/dist/node_modules/@allyhub/measure/package.json +1 -1
- package/dist/node_modules/@allyhub/media/package.json +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/analyses/faces.js +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/asr/transcribe.js +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/ocr/text.js +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/vision/faces.js +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/vision/index-media.js +3 -2
- package/dist/node_modules/@allyhub/media-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/model/package.json +1 -1
- package/dist/node_modules/@allyhub/office-extension/markup/csv/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/csv/markup.json +1 -1
- package/dist/node_modules/@allyhub/office-extension/markup/document/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/presentation/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/workbook/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/workbook/markup.json +1 -1
- package/dist/node_modules/@allyhub/office-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/ext.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/mce.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/node.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/ns.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/opc.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
- package/dist/node_modules/@allyhub/piece/dist/export.d.ts +1 -1
- package/dist/node_modules/@allyhub/piece/dist/layout.d.ts +2 -0
- package/dist/node_modules/@allyhub/piece/dist/look.d.ts +10 -2
- package/dist/node_modules/@allyhub/piece/dist/look.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/media.d.ts +8 -2
- package/dist/node_modules/@allyhub/piece/dist/script.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/source.d.ts +3 -0
- package/dist/node_modules/@allyhub/piece/package.json +1 -1
- package/dist/node_modules/@allyhub/project/dist/media-index.js +1 -1
- package/dist/node_modules/@allyhub/project/package.json +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cli.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/events.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/kinds.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/page-frame.js +2 -0
- package/dist/node_modules/@allyhub/protocol/package.json +1 -1
- package/dist/node_modules/@allyhub/registry/package.json +1 -1
- package/dist/node_modules/@allyhub/render/package.json +1 -1
- package/dist/node_modules/@allyhub/report-extension/LICENSE +241 -0
- package/dist/node_modules/@allyhub/report-extension/dist/build.js +3 -0
- package/dist/node_modules/@allyhub/report-extension/dist/check.js +37 -0
- package/dist/node_modules/@allyhub/report-extension/dist/cli/index.js +4 -0
- package/dist/node_modules/@allyhub/report-extension/dist/export.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/inline.js +58 -0
- package/dist/node_modules/@allyhub/report-extension/dist/page.js +23 -0
- package/dist/node_modules/@allyhub/report-extension/dist/project-tools.js +33 -0
- package/dist/node_modules/@allyhub/report-extension/dist/styles.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/theme.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/tools.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/workspace.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/package.json +185 -0
- package/dist/node_modules/@allyhub/report-extension/styles/allyhub/STYLE.md +180 -0
- package/dist/node_modules/@allyhub/report-extension/styles/allyhub/style.json +15 -0
- package/dist/node_modules/@allyhub/runtime/dist/footage.js +1 -1
- package/dist/node_modules/@allyhub/runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/dist/packages.js +2 -2
- package/dist/node_modules/@allyhub/runtimes/dist/runtimes.js +3 -3
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub/scaffold/dist/index.js +12 -8
- package/dist/node_modules/@allyhub/scaffold/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery-host/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/charts.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/index.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/engine.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/server.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/cell-styles.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/check.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/file.js +2 -2
- package/dist/node_modules/@allyhub/sheet/dist/heatmap.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/html.js +8 -8
- package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/inspect.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/paginate.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/printed.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/sdk.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/sparklines.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/table-style.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/table-styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/theme.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/tiles.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/units.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/write.js +14 -14
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/theme.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/tile-shapes.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
- package/dist/node_modules/@allyhub/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/build.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/cli/sheet.js +7 -7
- package/dist/node_modules/@allyhub/sheet-extension/dist/code.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/evaluate.js +2 -2
- package/dist/node_modules/@allyhub/sheet-extension/dist/export.js +2 -2
- package/dist/node_modules/@allyhub/sheet-extension/dist/inspect.js +2 -2
- package/dist/node_modules/@allyhub/sheet-extension/dist/migrations.js +4 -0
- package/dist/node_modules/@allyhub/sheet-extension/dist/project-tools.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/package.json +7 -3
- package/dist/node_modules/@allyhub/slides-core/dist/api.js +2 -2
- package/dist/node_modules/@allyhub/slides-core/dist/blocks.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/chart-api.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/code.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/file.js +3 -3
- package/dist/node_modules/@allyhub/slides-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/measure.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/model.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/office-layouts.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/office.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/script.js +2 -2
- package/dist/node_modules/@allyhub/slides-core/dist/styles/brief.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/editorial.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/index.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/kit.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/layouts.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/pitch.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/stage.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/tiles.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/theme.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/units.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/check.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/cli/slides.js +2 -2
- package/dist/node_modules/@allyhub/slides-extension/dist/deck-fonts.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/project-tools.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/package.json +24 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/charts.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/fonts.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/image-size.js +2 -0
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/code.js +3 -3
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/index.js +7 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/names.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/script.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/mtx.js +2 -0
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/chart.js +3 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/chartex.js +3 -0
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/common.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/index.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/shapes.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/table.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/text.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/timing.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/shapes.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/text.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/write.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/xml.js +3 -2
- package/dist/node_modules/@allyhub/slides-pptx/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/dist/draw.js +2 -2
- package/dist/node_modules/@allyhub/slides-runtime/dist/load.js +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/stage/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-ext-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-ext-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-ext-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo-black/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo-black/files/archivo-black-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo-black/files/archivo-black-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo-black/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo-black/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-ext-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-ext-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-ext-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-ext-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-ext-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-ext-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-ext-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-ext-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-ext-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-ext-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-ext-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-ext-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/host.js +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/runtime/stage.html +42 -0
- package/dist/node_modules/@allyhub/stage-page/dist/style-faces.js +2 -0
- package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-runtime/dist/runtime.js +96 -92
- package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/telemetry/dist/limit.js +2 -0
- package/dist/node_modules/@allyhub/telemetry/package.json +5 -1
- package/dist/node_modules/@allyhub/text-extension/markup/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/text-extension/markup-file/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/text-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/footage-motion.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/measure.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/seams.js +1 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/cli/reference-text.js +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/inspect/index.js +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/inspect/joins.js +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/inspect/loop.js +3 -0
- package/dist/node_modules/@allyhub/video-extension/package.json +2 -25
- package/dist/node_modules/@allyhub/video-measure/dist/check.js +2 -2
- package/dist/node_modules/@allyhub/video-measure/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/video-measure/dist/seams.js +1 -1
- package/dist/node_modules/@allyhub/video-measure/dist/version.js +1 -1
- package/dist/node_modules/@allyhub/video-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/video-sdk/dist/free.js +1 -1
- package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/website/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/website/dist/website.js +2 -2
- package/dist/node_modules/@allyhub/website/package.json +1 -1
- package/dist/node_modules/@allyhub/website-extension/package.json +3 -3
- package/dist/node_modules/@allyhub/x-extension/package.json +1 -3
- package/dist/node_modules/@allyhub/x-extension/skills/allyhub/references/x.md +3 -3
- package/dist/node_modules/@allyhub/x-model/package.json +1 -1
- package/dist/node_modules/@allyhub/x-view/package.json +1 -1
- package/dist/package.json +15 -14
- package/dist/self-upgrade.js +2 -0
- package/dist/text/batch-text.js +1 -1
- package/dist/text/facts-text.js +5 -5
- package/dist/text/format.js +2 -2
- package/dist/update-notice.js +3 -0
- package/dist/version.js +1 -1
- package/dist/works.js +1 -1
- package/editor-web/assets/{abnfDiagram-WEYOIA3C-DYaMS_BB.js → abnfDiagram-WEYOIA3C-B4tvwU6C.js} +1 -1
- package/editor-web/assets/{architecture-WOLXFQ4H-g_Tjfl_y.js → architecture-WOLXFQ4H-V2fA0vY2.js} +1 -1
- package/editor-web/assets/{architectureDiagram-ZHVYKT53-CqdhofOL.js → architectureDiagram-ZHVYKT53-B6B7XN0M.js} +1 -1
- package/editor-web/assets/arrow-down-D-QZrqcz.js +1 -0
- package/editor-web/assets/arrow-up-B1zjKUHX.js +1 -0
- package/editor-web/assets/article-DW4eD_8K.js +3 -0
- package/editor-web/assets/article-Dm2dIEwc.js +7 -0
- package/editor-web/assets/{audio-lines-PZj77e7t.js → audio-lines-BFoW_IeO.js} +1 -1
- package/editor-web/assets/{bar-button-J9vbfzTx.js → bar-button-CJmpgNg4.js} +1 -1
- package/editor-web/assets/{blockDiagram-RJAE7QA3-Bc-28Bci.js → blockDiagram-RJAE7QA3-BizcUGOM.js} +1 -1
- package/editor-web/assets/{browser-C9NP0ZYz.js → browser-DEGNhKTV.js} +1 -1
- package/editor-web/assets/{c4Diagram-XDPPPE54-CTGJb8FB.js → c4Diagram-XDPPPE54-CBHS0dQ0.js} +1 -1
- package/editor-web/assets/calc-worker-Cr4a0xmt.js +168 -0
- package/editor-web/assets/channel-dyUtlVPg.js +1 -0
- package/editor-web/assets/{chart-no-axes-column-Be0lFcGF.js → chart-no-axes-column-Dyy25XZ_.js} +1 -1
- package/editor-web/assets/chip-BdQRH3FL.js +1 -0
- package/editor-web/assets/{chunk-2E7WHVMD-B2MPOVTU.js → chunk-2E7WHVMD-CMPBck_Q.js} +1 -1
- package/editor-web/assets/{chunk-4EMNKR2T-BUV1ZHP0.js → chunk-4EMNKR2T-Df22Adpt.js} +1 -1
- package/editor-web/assets/{chunk-55XCU76K-BZlpspL5.js → chunk-55XCU76K-CYrZ6_Q7.js} +1 -1
- package/editor-web/assets/{chunk-7S6XSTFO-CpKeisWE.js → chunk-7S6XSTFO-BfdG9NNW.js} +1 -1
- package/editor-web/assets/{chunk-AQDTSKZB-BJqwAPyo.js → chunk-AQDTSKZB-BCzZMoTJ.js} +1 -1
- package/editor-web/assets/{chunk-DSNLSHJZ-D6oPWl_W.js → chunk-DSNLSHJZ-DT0xT8Wf.js} +1 -1
- package/editor-web/assets/{chunk-HAGFOTED-B5pk4MZF.js → chunk-HAGFOTED-Bg3-EotU.js} +1 -1
- package/editor-web/assets/{chunk-HNE4Q36P-DHbSPvxQ.js → chunk-HNE4Q36P-BrSym24V.js} +1 -1
- package/editor-web/assets/{chunk-NQOKRVIF-CcL_GcRA.js → chunk-NQOKRVIF-CMxgkJWF.js} +1 -1
- package/editor-web/assets/{chunk-UHW7PFBP-YgiOL6XE.js → chunk-UHW7PFBP-DWEwoyPy.js} +1 -1
- package/editor-web/assets/{chunk-VQ5W62QI-p14b4UYc.js → chunk-VQ5W62QI-eTFh5_T9.js} +1 -1
- package/editor-web/assets/{chunk-WQQL4CDK-BWW0x-XH.js → chunk-WQQL4CDK-4PTupr9T.js} +1 -1
- package/editor-web/assets/{chunk-YZO67HFG-oG3qd68C.js → chunk-YZO67HFG-D5XAAFWm.js} +1 -1
- package/editor-web/assets/{chunk-ZAUX2LTX-CpcheH0u.js → chunk-ZAUX2LTX-CPsdaisO.js} +1 -1
- package/editor-web/assets/{chunk-ZCHMQSOR-cWQvLl1w.js → chunk-ZCHMQSOR-ClnuUyfy.js} +1 -1
- package/editor-web/assets/{classDiagram-v2-4MYWR3UA-7PG7YcdU.js → classDiagram-v2-4MYWR3UA-CM21waNF.js} +1 -1
- package/editor-web/assets/code-Ch6AB5bZ.js +1 -0
- package/editor-web/assets/{collaborator-BU4qU7O3.js → collaborator-CbTacvkB.js} +1 -1
- package/editor-web/assets/color-picker-BmKFn2ww.js +1 -0
- package/editor-web/assets/{copy-CuJSs0nI.js → copy-SoaMYqsN.js} +1 -1
- package/editor-web/assets/{createLucideIcon-lm_6n8YT.js → createLucideIcon-euu7Wcd9.js} +1 -1
- package/editor-web/assets/{cynefin-EF2NZ3EQ-CtcknEQ_.js → cynefin-EF2NZ3EQ-CJUHTgee.js} +1 -1
- package/editor-web/assets/{cynefinDiagram-WF24UDRP-Ca7VIsjN.js → cynefinDiagram-WF24UDRP-C9RIfuIV.js} +1 -1
- package/editor-web/assets/{dagre-NK4GIZVX-BzcSLtsr.js → dagre-NK4GIZVX-g-01KdpO.js} +1 -1
- package/editor-web/assets/deck-C0VxrlzX.js +1 -0
- package/editor-web/assets/{diagram-CBK3MWTC-DpRmTGlG.js → diagram-CBK3MWTC-CbOjWUu-.js} +1 -1
- package/editor-web/assets/{diagram-I5XIIV2D-BTrs_AX8.js → diagram-I5XIIV2D-C6psNS8J.js} +1 -1
- package/editor-web/assets/{diagram-ODIL2UCW-CkIVjPqH.js → diagram-ODIL2UCW-C9PUE46P.js} +1 -1
- package/editor-web/assets/{diagram-PFBEJUXE-BlFMbAG1.js → diagram-PFBEJUXE-vJ_pnB33.js} +1 -1
- package/editor-web/assets/{diagram-RJA3I4VV-D3f8VJ-D.js → diagram-RJA3I4VV-FwYlEfJ-.js} +1 -1
- package/editor-web/assets/{diagram-TYUNFSNR-Bbpngj6F.js → diagram-TYUNFSNR-FKpIxeUc.js} +1 -1
- package/editor-web/assets/{dist-DruvDNQe.js → dist-B8_6sJ_V.js} +5 -5
- package/editor-web/assets/dist-BI_BaYhO.js +19 -0
- package/editor-web/assets/dist-BaWFMuvr.js +1 -0
- package/editor-web/assets/dist-BdmMT8fP.js +5 -0
- package/editor-web/assets/dist-BgKyM9U6.js +3 -0
- package/editor-web/assets/dist-BqijryYd.js +1 -0
- package/editor-web/assets/dist-ByguWp3a.js +16 -0
- package/editor-web/assets/dist-CB-_0-X4.js +41 -0
- package/editor-web/assets/dist-CCP24Lel.js +19 -0
- package/editor-web/assets/dist-Cg0Z26Kv.js +6 -0
- package/editor-web/assets/dist-CtYjYJdv.js +1 -0
- package/editor-web/assets/dist-D07Kj8GR.js +1 -0
- package/editor-web/assets/dist-D2rGVz9C.js +1 -0
- package/editor-web/assets/dist-D3DwRF1k.js +547 -0
- package/editor-web/assets/dist-DCI21ljp.js +6 -0
- package/editor-web/assets/dist-DH8oJJw9.js +35 -0
- package/editor-web/assets/dist-DIJnhQFK.js +9 -0
- package/editor-web/assets/dist-DJvfQvM7.js +24 -0
- package/editor-web/assets/{dist-Bd8IxQPP.js → dist-DQ6RpEJD.js} +2 -2
- package/editor-web/assets/dist-DmCDcb2_.js +4 -0
- package/editor-web/assets/dist-H0z_DXDz.js +19 -0
- package/editor-web/assets/dist-QLXI7XGS.js +82 -0
- package/editor-web/assets/{docx-draw-CoK1oqQD.js → docx-draw-Dxb67W2d.js} +1 -1
- package/editor-web/assets/{ebnfDiagram-V4P3TTPT-BaKj-yL6.js → ebnfDiagram-V4P3TTPT-DBymUM-F.js} +1 -1
- package/editor-web/assets/{elk-QONTBCTQ-Cn2qv1_U.js → elk-QONTBCTQ-BNYR3OlS.js} +1 -1
- package/editor-web/assets/{erDiagram-KYQIGQAA-Bd7AEIDo.js → erDiagram-KYQIGQAA-cTNyOqW6.js} +1 -1
- package/editor-web/assets/esm-Cl3GKSDd.js +21 -0
- package/editor-web/assets/{eventmodeling-K75KTNOO-Sfp7_461.js → eventmodeling-K75KTNOO-C6FUZeXP.js} +1 -1
- package/editor-web/assets/eye-DwfE1USj.js +1 -0
- package/editor-web/assets/{file-question-mark-DlIjUK37.js → file-question-mark-PeZgyqkK.js} +1 -1
- package/editor-web/assets/flowDiagram-IUGLLWBU-ukTovy07.js +1 -0
- package/editor-web/assets/{ganttDiagram-R7GPNTJY-CBqcGdHI.js → ganttDiagram-R7GPNTJY-LD9mqQ1x.js} +1 -1
- package/editor-web/assets/{gitGraph-VSP46ZUC-WTokXKTW.js → gitGraph-VSP46ZUC-CtCBcQFl.js} +1 -1
- package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-BIWZHD9q.js → gitGraphDiagram-PDYL7XHY-DYQpOozz.js} +1 -1
- package/editor-web/assets/{group-BdrTp7gi.js → group-DwM2yqU8.js} +1 -1
- package/editor-web/assets/{hint-rlht0uxG.js → hint-F4fIBnVU.js} +1 -1
- package/editor-web/assets/index-Cah2zchD.css +2 -0
- package/editor-web/assets/index-omhSywJb.js +28 -0
- package/editor-web/assets/{info-OHQRW6UA-COC6G-_J.js → info-OHQRW6UA-IXInKPRO.js} +1 -1
- package/editor-web/assets/{infoDiagram-MVDRKAX5-DpaqdKBD.js → infoDiagram-MVDRKAX5-Ds7Cei7T.js} +1 -1
- package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-Dyn2MAy1.js → ishikawaDiagram-HPEHV2GE-DWs3qtAX.js} +1 -1
- package/editor-web/assets/iso-UwGLGD3F.js +1 -0
- package/editor-web/assets/{italic-zw4_eUNF.js → italic-BV7iHxoP.js} +1 -1
- package/editor-web/assets/{journeyDiagram-BOSHW7O7-DeSVfmm7.js → journeyDiagram-BOSHW7O7-BkNKVYBA.js} +1 -1
- package/editor-web/assets/{kanban-definition-FNSA4HC5-Bfg0lj7B.js → kanban-definition-FNSA4HC5-D3dMswnI.js} +1 -1
- package/editor-web/assets/{link-DopSU3aa.js → link-CFOv3nz-.js} +1 -1
- package/editor-web/assets/{mermaid-parser.core-CyhovuYE.js → mermaid-parser.core-D_W_0X0N.js} +3 -3
- package/editor-web/assets/{mermaid.core-Dx1fBVUG.js → mermaid.core-Bkirj-s5.js} +4 -4
- package/editor-web/assets/{mindmap-definition-6OY57UG3-QEU2HF_m.js → mindmap-definition-6OY57UG3-CMKkAAvI.js} +1 -1
- package/editor-web/assets/minus-ngE8owxs.js +1 -0
- package/editor-web/assets/{packet-JDAUHWVQ-ReJTa_hw.js → packet-JDAUHWVQ-CzCkgCfg.js} +1 -1
- package/editor-web/assets/palette-DchDLJj6.js +1 -0
- package/editor-web/assets/panes-BexRuZd2.js +3 -0
- package/editor-web/assets/{pegDiagram-ECIUJNBX-Bo1jFrvb.js → pegDiagram-ECIUJNBX-C8qHkx7M.js} +1 -1
- package/editor-web/assets/{pie-XZMESJXO-BrtYafNA.js → pie-XZMESJXO-BJqgxMrD.js} +1 -1
- package/editor-web/assets/{pieDiagram-GNMPY74T-Cj0zQqs_.js → pieDiagram-GNMPY74T-DyNntV5y.js} +1 -1
- package/editor-web/assets/{progress-CwKcXARv.js → progress-D1Uv3d1b.js} +1 -1
- package/editor-web/assets/{quadrantDiagram-D57K4MC3-D5npDAVn.js → quadrantDiagram-D57K4MC3-BHa-69ir.js} +1 -1
- package/editor-web/assets/{radar-ABXABTNO-C8RDrRqi.js → radar-ABXABTNO-BeRPjBBR.js} +1 -1
- package/editor-web/assets/{railroad-I3PHUGI6-ebDrmYTK.js → railroad-I3PHUGI6-BaRQqRsK.js} +1 -1
- package/editor-web/assets/{railroad-abnf-LNEFI6M7-BxKuqg6V.js → railroad-abnf-LNEFI6M7-BZfwomxZ.js} +1 -1
- package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-DOclnfpr.js → railroad-ebnf-DWYD2UWJ-DbgqpEF5.js} +1 -1
- package/editor-web/assets/{railroad-peg-JR7BVNR7-DN0A1fpq.js → railroad-peg-JR7BVNR7-BYOf3PsQ.js} +1 -1
- package/editor-web/assets/{railroadDiagram-Y72NRBL7-B3PjoVWw.js → railroadDiagram-Y72NRBL7-B5OAzOsD.js} +1 -1
- package/editor-web/assets/react-Byupo4pA.js +1 -0
- package/editor-web/assets/replace-CLLMtF4e.js +1 -0
- package/editor-web/assets/{requirementDiagram-EQYSW5RA-DLdzkQk5.js → requirementDiagram-EQYSW5RA-wqYNoqO0.js} +1 -1
- package/editor-web/assets/ribbon-tabs-B3IC9WOt.js +1 -0
- package/editor-web/assets/row-DqS4-5b1.js +1 -0
- package/editor-web/assets/{sankeyDiagram-SY24JHO5-Dip4Piv_.js → sankeyDiagram-SY24JHO5-Crf6GRsa.js} +1 -1
- package/editor-web/assets/schemas-C21MyseF.js +1 -0
- package/editor-web/assets/{iso-DoC-ZoBr.js → schemas-DlRAoVtq.js} +1 -1
- package/editor-web/assets/{scissors-B_xOiUhd.js → scissors-m6QcoEf2.js} +1 -1
- package/editor-web/assets/search-D75Bi2GU.js +1 -0
- package/editor-web/assets/{sequenceDiagram-BLEHNHQU-QnPcoybL.js → sequenceDiagram-BLEHNHQU-DUcHz4_d.js} +1 -1
- package/editor-web/assets/{session-DMlLCFWg.js → session--OJYv_B7.js} +1 -1
- package/editor-web/assets/{sigma-DSUsJhMn.js → sigma-B4AWtnVA.js} +1 -1
- package/editor-web/assets/snapshots-DYooVfOx.js +1 -0
- package/editor-web/assets/sound-DkR3qxSt.js +1 -0
- package/editor-web/assets/{square-arrow-out-up-right-DF5dvsSp.js → square-arrow-out-up-right-1NqFsNDe.js} +1 -1
- package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-D103CiMX.js → stateDiagram-v2-A6IESKWZ-DbeLdnpS.js} +1 -1
- package/editor-web/assets/{sticky-note-BdkIu5_D.js → sticky-note-s4QfzaBB.js} +1 -1
- package/editor-web/assets/{surface-DtCjIlrq.js → surface-BUoi7cmR.js} +1 -1
- package/editor-web/assets/swatch-DCmD1gZl.js +1 -0
- package/editor-web/assets/{swimlanes-B3ENRKFQ-y4gCqEoa.js → swimlanes-B3ENRKFQ-BDi6AeJI.js} +1 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-2wwOmxbv.js +8 -0
- package/editor-web/assets/{switch-8MU4Nfxe.js → switch-b6GCy_ix.js} +1 -1
- package/editor-web/assets/syntax-Bqyhj0dw.js +1 -0
- package/editor-web/assets/table-BW43XXVd.js +1 -0
- package/editor-web/assets/tablet-C6oePHEW.js +1 -0
- package/editor-web/assets/text-wrap-Baus6l-V.js +1 -0
- package/editor-web/assets/{textarea-D7TnPwv1.js → textarea-Bu6uPEqT.js} +1 -1
- package/editor-web/assets/{timeline-definition-JXYKGLGB-BMp76v4V.js → timeline-definition-JXYKGLGB-B0awa2hh.js} +1 -1
- package/editor-web/assets/tolerant-DM9s0Mt1.js +1 -0
- package/editor-web/assets/trash-2-SFReAxVM.js +1 -0
- package/editor-web/assets/{treeView-D4JQ5SDB-Q_GYyk0b.js → treeView-D4JQ5SDB-C91G0IGm.js} +1 -1
- package/editor-web/assets/{treemap-SAJKECNS-B5lRWdQB.js → treemap-SAJKECNS-CiOWiwl2.js} +1 -1
- package/editor-web/assets/{undo-2-C47jrRp5.js → undo-2-DCbMWoug.js} +1 -1
- package/editor-web/assets/updating-D0GEtwnJ.js +1 -0
- package/editor-web/assets/{usecaseDiagram-WPOLBNNX--QRllA-U.js → usecaseDiagram-WPOLBNNX-DMYM1MRe.js} +1 -1
- package/editor-web/assets/{vennDiagram-Q3Y3IDCW-CzkATPA3.js → vennDiagram-Q3Y3IDCW-DQIJ5vvN.js} +1 -1
- package/editor-web/assets/video-mMOFXHYK.js +1 -0
- package/editor-web/assets/{wardley-7MLQ67FV-BXzwcdJa.js → wardley-7MLQ67FV-C3H9HG8r.js} +1 -1
- package/editor-web/assets/{wardleyDiagram-IVAIDKWA-BQvC8Agx.js → wardleyDiagram-IVAIDKWA-DgsjqY1Y.js} +1 -1
- package/editor-web/assets/{whole-word-D3ZAtnkw.js → whole-word-C9TkGBCY.js} +1 -1
- package/editor-web/assets/{words-CaUHhQHf.js → words-B2jQwWpp.js} +3 -3
- package/editor-web/assets/words-DgMuEmDO.js +3 -0
- package/editor-web/assets/workbook-NtMEyLgf.js +41 -0
- package/editor-web/assets/{x-DlhyIKuu.js → x-BAJilkKD.js} +1 -1
- package/editor-web/assets/{xychartDiagram-4URNHDU4-aY-lsD5o.js → xychartDiagram-4URNHDU4-DzsGI527.js} +1 -1
- package/editor-web/assets/{zoom-in-PgsC94hP.js → zoom-in-yAGKspfC.js} +1 -1
- package/editor-web/index.html +9 -9
- package/package.json +6 -3
- package/CHANGELOG.md +0 -251
- package/dist/commands/render.js +0 -3
- package/dist/node_modules/@allyhub/video-extension/dist/inspect/motion.js +0 -4
- package/dist/node_modules/@allyhub/video-measure/dist/still.js +0 -2
- package/editor-web/assets/arrow-down-B8VUPCGi.js +0 -1
- package/editor-web/assets/arrow-up-Ds4juY8X.js +0 -1
- package/editor-web/assets/article-8evPh712.js +0 -3
- package/editor-web/assets/article-BhRtWYMd.js +0 -7
- package/editor-web/assets/calc-worker-oEIqrrTM.js +0 -45
- package/editor-web/assets/channel-wIj_OqDm.js +0 -1
- package/editor-web/assets/chart-amT4lgX3.js +0 -2
- package/editor-web/assets/chart-file-dGiRgFcH.js +0 -1
- package/editor-web/assets/code-CD-CbJG9.js +0 -1
- package/editor-web/assets/deck-C7fN0Qtn.js +0 -1
- package/editor-web/assets/dist-3iovns9K.js +0 -16
- package/editor-web/assets/dist-BkHnbOEj.js +0 -4
- package/editor-web/assets/dist-BvOrNcK-.js +0 -19
- package/editor-web/assets/dist-CEIszq39.js +0 -1
- package/editor-web/assets/dist-CU5RbLNH.js +0 -1
- package/editor-web/assets/dist-CWZj8IAm.js +0 -1
- package/editor-web/assets/dist-C_Mtrnif.js +0 -17
- package/editor-web/assets/dist-CdqpwdCV.js +0 -24
- package/editor-web/assets/dist-CjT76RAw.js +0 -43
- package/editor-web/assets/dist-CpzEn9T8.js +0 -6
- package/editor-web/assets/dist-CrFYWl5-.js +0 -3
- package/editor-web/assets/dist-D3C6FyrO.js +0 -82
- package/editor-web/assets/dist-D4eBFGVL.js +0 -1
- package/editor-web/assets/dist-DTcjb3cP.js +0 -18
- package/editor-web/assets/dist-D_WSM29I.js +0 -17
- package/editor-web/assets/dist-Dp_9ISjP.js +0 -531
- package/editor-web/assets/dist-J-tPYKGS.js +0 -5
- package/editor-web/assets/dist-YW8hS4IM.js +0 -9
- package/editor-web/assets/esm-Cjv8ogpP.js +0 -21
- package/editor-web/assets/file-exclamation-point-_L3ElCJ5.js +0 -1
- package/editor-web/assets/flowDiagram-IUGLLWBU-BlVUglzw.js +0 -1
- package/editor-web/assets/index-BQWZnyAQ.js +0 -28
- package/editor-web/assets/index-Dvh1t1om.css +0 -2
- package/editor-web/assets/layout-SWqqA0yV.js +0 -1
- package/editor-web/assets/minus-CbPnUIOy.js +0 -1
- package/editor-web/assets/props-form-BpSXbrSF.js +0 -1
- package/editor-web/assets/react-Edyoga_4.js +0 -1
- package/editor-web/assets/row-C_svyL8o.js +0 -1
- package/editor-web/assets/schemas-CQ_UU8-Z.js +0 -1
- package/editor-web/assets/search-Ba2BbT6T.js +0 -1
- package/editor-web/assets/slides-7xWhREpt.js +0 -1
- package/editor-web/assets/snapshots-BLX4NTQC.js +0 -1
- package/editor-web/assets/sound-bTlco_K3.js +0 -1
- package/editor-web/assets/split-tFGKk-x8.js +0 -3
- package/editor-web/assets/strikethrough-BwXWi4zg.js +0 -1
- package/editor-web/assets/svg-CWIBMIQ9.js +0 -1
- package/editor-web/assets/swatch-DhztHwPU.js +0 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-DKzB_wSf.js +0 -8
- package/editor-web/assets/syntax-CU_WPKxt.js +0 -1
- package/editor-web/assets/table-DRbddzx0.js +0 -1
- package/editor-web/assets/tabs-CuEawka3.js +0 -1
- package/editor-web/assets/tag-CIfWT8B_.js +0 -1
- package/editor-web/assets/text-align-start-Cic2-TLh.js +0 -1
- package/editor-web/assets/video-D0uTbHWx.js +0 -1
- package/editor-web/assets/words-XlXG79Ur.js +0 -3
- package/editor-web/assets/workbook-CiCXkjmN.js +0 -45
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{CHART_COMBINED_TYPES as
|
|
3
|
-
`)??"";return
|
|
4
|
-
`)===a)?[`for (const level of ${e}) {`,...(r[0]??[]).map(l=>` ${l}`),"}"]:i.flatMap((l,f)=>H(`${e}[${String(f)}]`,l,!0,o[f]))}const B={margin_left:z.left,margin_top:z.top,margin_right:z.right,margin_bottom:z.bottom};export const MADE={placeholder:e=>({...pe(e),...B}),textbox:{vertical_anchor:"t",...he,...B},autoshape:{vertical_anchor:T.vertical_anchor,word_wrap:!0,auto_size:"none",...B}},FILE_TEXTBOX={...MADE.textbox,..._e};export function bodyLines(e,n,o={},i=[]){if(!n)return[];const r=_=>n[_]===void 0||n[_]===o[_]?void 0:n[_],a=r("vertical_anchor"),l=r("auto_size"),f=r("word_wrap"),s=r("orientation");return[...a===void 0?[]:[`${e}.vertical_anchor = ${ye[a]};`],...s===void 0?[]:[`${e}.orientation = ${str(s)};`],...l===void 0?[]:[`${e}.auto_size = ${be[l]};`],...f===void 0?[]:[`${e}.word_wrap = ${String(f)};`],...["margin_left","margin_top","margin_right","margin_bottom"].flatMap(_=>{const u=r(_);return u===void 0?[]:[`${e}.${_} = ${emu(u)};`]}),...levelLines(`${e}.list_style`,n.levels,i)]}export const sameColor=(e,n)=>JSON.stringify(e)===JSON.stringify(n);function U(e,n,o,i){const{fill:r,fill_transparency:a,gradient:l,pattern:f,picture_fill:s}=n,_=s&&i.path(s.part);if(s&&_){const u={...s.tile?{tile:s.tile}:{},...s.transparency===void 0?{}:{transparency:s.transparency}};return[`${e}.fill.picture(${str(_)}${Object.keys(u).length>0?`, ${JSON.stringify(u)}`:""});`]}return f?[`${e}.fill.patterned();`,`${e}.fill.pattern = ${str(f.preset)};`,...colorLines(`${e}.fill.fore_color`,f.fg),...colorLines(`${e}.fill.back_color`,f.bg)]:l?[`${e}.fill.gradient();`,...l.path===void 0?[`${e}.fill.gradient_angle = ${String(Math.round(l.angle*1e3)/1e3)};`]:[`${e}.fill.gradient_path = ${str(l.path)};`,...l.focus===void 0?[]:[`${e}.fill.gradient_focus = ${JSON.stringify(l.focus)};`]],`${e}.fill.gradient_stops = ${JSON.stringify(l.stops.map(u=>({at:Math.round(u.at*1e3)/1e3,color:m(u.color),...u.transparency===void 0?{}:{transparency:u.transparency}})))};`]:[...r===void 0||sameColor(r,o)?[]:r===null?[`${e}.fill.background();`]:[`${e}.fill.solid();`,...colorLines(`${e}.fill.fore_color`,r)],...a===void 0||r===null?[]:[`${e}.fill.transparency = ${String(a)};`]]}function C(e,n){return n===void 0?[]:n===null?[`${e}.shadow.inherit = false;`]:[`${e}.shadow.blur_radius = ${emu(n.blur)};`,`${e}.shadow.distance = ${emu(n.distance)};`,`${e}.shadow.angle = ${String(Math.round(n.angle*1e3)/1e3)};`,...n.transparency===q.transparency?[]:[`${e}.shadow.transparency = ${String(n.transparency)};`],...sameColor(n.color,q.color)?[]:colorLines(`${e}.shadow.color`,n.color)]}function I(e,n){const o=[],i=n.inner_shadow;i&&o.push(`${e}.inner_shadow.blur_radius = ${emu(i.blur)};`,`${e}.inner_shadow.distance = ${emu(i.distance)};`,`${e}.inner_shadow.angle = ${String(Math.round(i.angle*1e3)/1e3)};`,`${e}.inner_shadow.transparency = ${String(i.transparency)};`,...colorLines(`${e}.inner_shadow.color`,i.color));const r=n.glow;r&&o.push(`${e}.glow.radius = ${emu(r.size)};`,`${e}.glow.transparency = ${String(r.transparency)};`,...colorLines(`${e}.glow.color`,r.color)),n.soft_edges!==void 0&&o.push(`${e}.soft_edge.radius = ${emu(n.soft_edges)};`);const a=n.reflection;return a&&o.push(`${e}.reflection.transparency = ${String(a.transparency)};`,`${e}.reflection.size = ${String(a.size)};`,`${e}.reflection.offset = ${emu(a.distance)};`,`${e}.reflection.blur = ${emu(a.blur)};`),o}function v(e,n,o){return[...n.line===void 0||sameColor(n.line,o.line)?[]:n.line===null?[`${e}.line.fill.background();`]:colorLines(`${e}.line.color`,n.line),...n.line_width===void 0||n.line===null||n.line_width===o.line_width?[]:[`${e}.line.width = ${emu(n.line_width)};`],...n.line_dash===void 0?[]:[`${e}.line.dash_style = ${str(n.line_dash)};`],...n.line_cap===void 0?[]:[`${e}.line.cap_type = ${str(n.line_cap)};`],...n.line_join===void 0?[]:[`${e}.line.join_type = ${str(n.line_join)};`],...n.line_compound===void 0?[]:[`${e}.line.compound_type = ${str(n.line_compound)};`],...n.line_begin===void 0?[]:[`${e}.line.begin_arrow = ${str(n.line_begin)};`],...n.line_end===void 0?[]:[`${e}.line.end_arrow = ${str(n.line_end)};`],...["begin","end"].flatMap(i=>{const r=i==="begin"?n.line_begin_size:n.line_end_size;return[...r?.w===void 0?[]:[`${e}.line.${i}_arrow_width = ${str(r.w)};`],...r?.len===void 0?[]:[`${e}.line.${i}_arrow_length = ${str(r.len)};`]]})]}export const lineFile=e=>({...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_cap===void 0?{}:{line_cap:e.line_cap},...e.line_join===void 0?{}:{line_join:e.line_join},...e.line_compound===void 0?{}:{line_compound:e.line_compound},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.line_begin_size===void 0?{}:{line_begin_size:e.line_begin_size},...e.line_end_size===void 0?{}:{line_end_size:e.line_end_size}});function Ae(e,n,o){const i=n.frame??{left:0,top:0,width:0,height:0},r=o.w===0?1:i.width/o.w,a=o.h===0?1:i.height/o.h,l=o.steps.flatMap(d=>d.op==="close"?[]:d.op==="curve"?[[d.x1,d.y1],[d.x2,d.y2],[d.x,d.y]]:[[d.x,d.y]]),f=d=>Math.min(...l.map(t=>t[d]??0)),[s,..._]=o.steps,u=s?.op==="move"?`${String(s.x)}, ${String(s.y)}`:"0, 0",g=(s?.op==="move"?_:o.steps).map(d=>d.op==="close"?".add_line_segments([], true)":d.op==="move"?`.move_to(${String(d.x)}, ${String(d.y)})`:d.op==="line"?`.add_line_segments([[${String(d.x)}, ${String(d.y)}]], false)`:`.add_curve_segment(${[d.x1,d.y1,d.x2,d.y2,d.x,d.y].map(String).join(", ")})`);return`${e}.shapes.build_freeform(${u}, [${String(r)}, ${String(a)}])${g.join("")}.convert_to_shape(${emu(i.left-Math.round(f(0)*r))}, ${emu(i.top-Math.round(f(1)*a))})`}const R=(e,n)=>n.rotation===void 0?[]:[`${e}.rotation = ${String(Math.round(n.rotation*1e3)/1e3)};`];function je(e){const n=e.text?.levels??[],o=e.text_color??"dk1";return e.kind!=="autoshape"||sameColor(o,T.font_color)?n:Array.from({length:9},(i,r)=>{const a=n[r]??{};return a.font?.color!==void 0?a:{...a,font:{...a.font,color:o}}})}function ze(e,n,o,i={}){return o.flatMap((r,a)=>{const l=`${e}_p${String(a)}`,f=[...r.level>0?[`${l}.level = ${String(r.level)};`]:[],...H(l,r,!1,a===0?i:{}),...r.runs.flatMap((s,_)=>s.text==="\v"?[`${l}.add_line_break();`]:s.font?[`const ${l}r${String(_)} = ${l}.add_run();`,`${l}r${String(_)}.text = ${str(s.text)};`,...Q(`${l}r${String(_)}.font`,s.font),...s.font.link===void 0?[]:[`${l}r${String(_)}.hyperlink.address = ${str(s.font.link)};`]]:[`${l}.add_run().text = ${str(s.text)};`])];return a===0&&f.length===0?[]:[`const ${l} = ${a===0?`${n}.paragraphs[0]`:`${n}.add_paragraph()`};`,...f]})}const A=e=>`${emu(e.left)}, ${emu(e.top)}, ${emu(e.width)}, ${emu(e.height)}`;export class MediaFiles{files=new Map;byPart=new Map;bytes;taken;constructor(n,o=()=>!1){this.bytes=n,this.taken=o}path(n){const o=this.byPart.get(n);if(o)return o;const i=this.bytes(n);if(!i)return;const r=n.split("/").pop()??"file",a=r.lastIndexOf("."),[l,f]=a>0?[r.slice(0,a),r.slice(a)]:[r,""];let s=r;for(let _=2;this.files.has(s)||this.taken(s);_++)s=`${l}-${String(_)}${f}`;return this.files.set(s,i),this.byPart.set(n,`./${s}`),`./${s}`}}export const GLUE_MOVED="a glued connector is drawn with its ends on its shapes' sites, where the file has it off them";const ne=e=>({left:k(S(e.left)),top:k(S(e.top)),width:k(S(e.width)),height:k(S(e.height))});export function placedGlue(e,n=()=>{}){const o=new Map(e.flatMap(i=>i.id===void 0?[]:[[i.id,i]]));return e.map(i=>{if(!i.glue||!i.frame)return i;const r=g=>g===void 0?void 0:{shape:g.id,site:g.site},a=r(i.glue.begin),l=r(i.glue.end),f=$e({frame:ne(i.frame),flip:i.flip,rotation:i.rotation,connect:{...a?{begin:a}:{},...l?{end:l}:{}}},g=>{const d=o.get(g);return d?.frame?{frame:ne(d.frame),geometry:d.geometry,adjustments:d.adjustments,flip:d.flip,rotation:d.rotation,path:d.path}:void 0}),s=i.frame,_=f.frame;(Math.abs(s.left-_.left)>64||Math.abs(s.top-_.top)>64||Math.abs(s.width-_.width)>64||Math.abs(s.height-_.height)>64||!!i.flip?.h!=!!f.flip?.h||!!i.flip?.v!=!!f.flip?.v)&&n(i);const u={...i,frame:f.frame};return f.flip?u.flip=f.flip:delete u.flip,u})}export const CODE_UNMAPPED=!0;const te={picture:"add_picture",movie:"add_movie",audio:"add_audio"};export function shapeCode(e,n,o,i,r){const a=placedGlue(n,t=>{i(t,"p:cNvCxnSpPr",GLUE_MOVED,"approximated")}),l=[],f=new Set,s=new Map,_=new Map,u=new Set(a.flatMap(t=>[t.glue?.begin?.id,t.glue?.end?.id].filter(w=>w!==void 0))),g=new Map,d=[];a.forEach((t,w)=>{const c=`${e}_s${String(w)}`,M=t.id!==void 0&&u.has(t.id);M&&t.id!==void 0&&g.set(t.id,c);const O=p=>{const $=_.get(p);if($!==void 0)return $;const b=p.lastIndexOf("/"),D=b<0?e:O(p.slice(0,b)),x=`${e}_g${String(_.size)}`;return _.set(p,x),l.push(`const ${x} = ${D}.shapes.add_group_shape();`,`${x}.name = ${str(L(p.slice(b+1),f,"group"))};`),x},h=t.group===void 0?e:O(t.group);if(t.flip&&!W(t.geometry)&&i(t,"a:xfrm@flipH","a master's or a layout's shape mirrored: python-pptx's API has no flip"),t.locked&&i(t,"a:spLocks","a master's or a layout's shape locked"),t.link!==void 0&&i(t,"a:hlinkClick","a master's or a layout's shape's link"),t.playback&&i(t,"p:video","a master's or a layout's movie's playback"),t.alt!==void 0&&i(t,"p:cNvPr@descr","a master's or a layout's shape's alternative text"),(t.media||t.component)&&i(t,"p:sp","a master's or a layout's component or media"),t.kind==="placeholder"&&t.placeholder){const p=/^[A-Za-z0-9_-]+$/u.test(t.name)?L(t.name,f,"placeholder"):L(V[t.placeholder.type],f,"placeholder");s.set(t.placeholder.idx,p);const $=bodyLines(`${c}.text_frame`,t.text,r?MADE.placeholder(t.placeholder.type):{},ge(t.placeholder.type)),b=[...R(c,t),...U(c,t,void 0,o),...v(c,t,{line:void 0}),...C(c,t.shadow),...I(c,t)];t.geometry!==void 0&&t.geometry!=="rect"&&i(t,"a:prstGeom",`a master's or a layout's placeholder of its own shape (${t.geometry}): python-pptx's placeholders are rectangles`),l.push(`${$.length>0||b.length>0||M?`const ${c} = `:""}${h}.placeholders.add(PP_PLACEHOLDER.${Se[t.placeholder.type]}${t.frame?`, ${A(t.frame)}`:""}${Me(p===V[t.placeholder.type]?void 0:p,t.placeholder.orient)});`,...b,...$);return}const j=L(t.name,f,t.kind);if(!t.frame){i(t,"a:xfrm","a shape with no frame of its own is left out");return}if((t.kind==="picture"||t.kind==="movie"||t.kind==="audio")&&t.part){const p=o.path(t.part);if(!p){i(t,"p:pic","its file is not in the file");return}t.crop&&Object.values(t.crop).some($=>$>0)&&i(t,"a:srcRect","a picture's crop on a master or a layout"),l.push(...t.rotation===void 0&&t.shadow===void 0&&!M?[`${h}.shapes.${te[t.kind]}(${str(p)}, ${A(t.frame)}).name = ${str(j)};`]:[`const ${c} = ${h}.shapes.${te[t.kind]}(${str(p)}, ${A(t.frame)});`,`${c}.name = ${str(j)};`,...R(c,t),...C(c,t.shadow),...I(c,t)]);return}if(t.table||t.chart){i(t,t.table?"a:tbl":"c:chart","a table or a chart on a master or a layout: one goes on a slide");return}if(!t.path&&W(t.geometry)){const p=t.frame,[$,b]=t.flip?.h?[p.left+p.width,p.left]:[p.left,p.left+p.width],[D,x]=t.flip?.v?[p.top+p.height,p.top]:[p.top,p.top+p.height];l.push(`const ${c} = ${h}.shapes.add_connector(${Ee(t.geometry??"line")}, ${emu($)}, ${emu(D)}, ${emu(b)}, ${emu(x)});`,`${c}.name = ${str(j)};`,...K(c,t.adjustments),...R(c,t),...v(c,t,re),...C(c,t.shadow),...I(c,t)),t.glue&&d.push({v:c,s:t});return}const ie=t.path?Ae(h,t,t.path):t.kind==="textbox"?`${h}.shapes.add_textbox(${A(t.frame)})`:`${h}.shapes.add_shape(${Oe(t.geometry??"rect")}, ${A(t.frame)})`;l.push(`const ${c} = ${ie};`,`${c}.name = ${str(j)};`,...K(c,t.adjustments),...R(c,t),...t.kind==="textbox"?[...U(c,t,null,o),...v(c,t,{line:null})]:[...U(c,t,T.fill,o),...v(c,t,T)],...C(c,t.shadow),...I(c,t),...bodyLines(`${c}.text_frame`,t.text&&{...t.text,levels:je(t)},MADE[t.kind==="textbox"?"textbox":"autoshape"]),...t.text?ze(c,`${c}.text_frame`,t.text.paragraphs,t.kind==="autoshape"?{alignment:T.alignment}:{}):[])});for(const{v:t,s:w}of d)for(const[c,M]of[["begin","a:stCxn"],["end","a:endCxn"]]){const O=w.glue?.[c];if(!O)continue;const h=g.get(O.id);h===void 0?i(w,M,"a connector's end glued to a shape that is left out: it stays where it is"):l.push(`${t}.${c}_connect(${h}, ${String(O.site)});`)}return{lines:l,names:s}}export const frameFile=e=>({x:S(e.left),y:S(e.top),w:S(e.width),h:S(e.height)});export{m as colorFile};const G=e=>({...e.minimum_scale===void 0?{}:{min:e.minimum_scale},...e.maximum_scale===void 0?{}:{max:e.maximum_scale},...e.major_unit===void 0?{}:{major:e.major_unit},...e.has_major_gridlines===void 0?{}:{gridlines:e.has_major_gridlines},...e.visible===void 0?{}:{visible:e.visible},...e.number_format===void 0?{}:{format:e.number_format},...e.reverse_order===void 0?{}:{reverse:e.reverse_order},...e.gridline_color===void 0?{}:{gridline_color:m(e.gridline_color)},...e.line_color===void 0?{}:{line_color:m(e.line_color)}});function E(e,n){return Object.fromEntries(Object.entries(e).filter(([o,i])=>canonical(i)!==canonical(n[o])))}const J=(e,n,o)=>{const i=n&&o(n);return i&&Object.keys(i).length>0?{[e]:i}:{}};function ke(e){const n={gridline_color:{rgb:y.gridline},line_color:{rgb:y.axisLine}},o=e.font_size??y.fontSize,i=le(e.type)&&Y(e.type)!=="clustered",r=u=>(se(u)||de(u))&&ae(u),{value_axis:a,category_axis:l,secondary_axis:f,labels:s,..._}=e;return{...E(_,{gap_width:y.gapWidth,hole_size:y.holeSize,vary_by_categories:Z(e.type),category_colors:e.categories.map((u,g)=>X(g)),font_size:y.fontSize,title_size:Math.round(o*y.titleScale*100)/100,font_color:"dk1",...i?{overlap:100}:{}}),series:e.series.map((u,g)=>E(u,{color:X(g),line_width:r(u.type??e.type)?y.lineWidth:u.line_width,marker_size:y.marker})),...J("value_axis",a,u=>E(u,{...n,has_major_gridlines:!0,...Y(e.type)==="percentStacked"?{number_format:"0%"}:{}})),...J("category_axis",l,u=>E(u,{...n,has_major_gridlines:!1})),...J("secondary_axis",f,u=>E(u,{...n,has_major_gridlines:!1})),...s?{labels:E(s,{position:ce({type:e.type}),...Z(e.type)?{color:"lt1"}:{}})}:{}}}const Le=e=>oe.includes(e);export function chartFile(e){const n=ke(e),o=n.labels;return{type:n.type,...n.categories.length===0&&n.series.some(i=>i.x)?{}:{categories:n.categories},series:n.series.map(i=>({name:i.name,values:i.values,...i.x===void 0?{}:{x:i.x},...i.color===void 0?{}:{color:m(i.color)},...i.number_format===void 0?{}:{format:i.number_format},...i.smooth===void 0?{}:{smooth:i.smooth},...i.line_width===void 0?{}:{line_width:i.line_width},...i.marker_size===void 0?{}:{marker_size:i.marker_size},...i.type===void 0||!Le(i.type)?{}:{type:i.type},...i.secondary===!0?{secondary:!0}:{}})),...n.legend===void 0?{}:{legend:n.legend},...o?{labels:{...o.show_value===void 0?{}:{value:o.show_value},...o.show_percentage===void 0?{}:{percentage:o.show_percentage},...o.show_category_name===void 0?{}:{category:o.show_category_name},...o.show_series_name===void 0?{}:{series:o.show_series_name},...o.number_format===void 0?{}:{format:o.number_format},...o.position===void 0?{}:{position:o.position},...o.size===void 0?{}:{size:o.size},...o.color===void 0?{}:{color:m(o.color)}}}:{},...n.gap_width===void 0?{}:{gap_width:n.gap_width},...n.overlap===void 0?{}:{overlap:n.overlap},...n.vary_by_categories===void 0?{}:{vary_by_categories:n.vary_by_categories},...n.category_colors===void 0?{}:{category_colors:n.category_colors.map(m)},...n.hole_size===void 0?{}:{hole_size:n.hole_size},...n.value_axis?{value_axis:G(n.value_axis)}:{},...n.category_axis?{category_axis:G(n.category_axis)}:{},...n.secondary_axis?{secondary_axis:G(n.secondary_axis)}:{},...n.font_size===void 0?{}:{size:n.font_size},...n.title_size===void 0?{}:{title_size:n.title_size},...n.font_color===void 0?{}:{color:m(n.font_color)}}}export const canonical=e=>JSON.stringify(e,(n,o)=>o&&typeof o=="object"&&!Array.isArray(o)?Object.fromEntries(Object.entries(o).sort(([i],[r])=>i<r?-1:1)):o);
|
|
2
|
+
import{presetAdjustments as me}from"@allyhub/ooxml/geometry";import{CHART_COMBINED_TYPES as $e,colorFile as y}from"@allyhub/formats";import{accentOf as V,AUTOSHAPE_STYLE as j,CHART_AXIS as ye,BOX_LOOK as be,CHART_DEFAULTS as E,defaultLabels as Q,FUNNEL_GAP as xe,isBinned as we,isExtended as B,needsCategories as Se,PARETO_GAP as Oe,WATERFALL_GAP as Ee,waterfallSteps as ke,CHART_GRID as Ae,CHART_INK as Me,CONNECTOR_STYLE as Te,groupingOf as ee,hasLines as je,isBar as ve,isConnectorGeometry as ne,isLine as Le,isRound as U,isScatter as Ne,labelPositionOf as te,MSO_CONNECTOR as ze,MSO_SHAPE as Pe,NAME_OF_TYPE as ie,DRAWN_TEXTBOX_FRAME as Ce,placeholderFrame as Ie,placeholderLevels as Re,TEXT_INSETS as P,TEXTBOX_FRAME as De,SHADOW_DEFAULTS as oe,colorOfFile as re,glued as Fe,Pt as C,SEPIA as ae,toPt as w}from"@allyhub/slides-core";import{nameOf as I}from"./names.js";const He={l:"PP_ALIGN.LEFT",ctr:"PP_ALIGN.CENTER",r:"PP_ALIGN.RIGHT",just:"PP_ALIGN.JUSTIFY"},Ge={t:"MSO_ANCHOR.TOP",ctr:"MSO_ANCHOR.MIDDLE",b:"MSO_ANCHOR.BOTTOM"},Be={none:"MSO_AUTO_SIZE.NONE",shape:"MSO_AUTO_SIZE.SHAPE_TO_FIT_TEXT",text:"MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE"},Ue={title:"TITLE",ctrTitle:"CENTER_TITLE",subTitle:"SUBTITLE",body:"BODY",pic:"PICTURE",media:"MEDIA_CLIP",obj:"OBJECT",dt:"DATE",ftr:"FOOTER",sldNum:"SLIDE_NUMBER"},Xe=Object.fromEntries(Object.entries(Pe).map(([e,n])=>[n,e])),le=e=>{const n=Xe[e];return n===void 0?str(e):`MSO_SHAPE.${n}`},Je=Object.fromEntries(Object.entries(ze).map(([e,n])=>[n,e])),We=e=>{const n=Je[e];return n===void 0?str(e):`MSO_CONNECTOR.${n}`},Ye=(e,n)=>{const i=[...e===void 0?[]:[`name: ${str(e)}`],...n===void 0?[]:['orient: "vert"']];return i.length>0?`, { ${i.join(", ")} }`:""},X=(e,n=[])=>n.map((i,r)=>`${e}.adjustments[${String(r)}] = ${String(Math.round(i*1e5)/1e5)};`);export const emu=e=>`Emu(${String(Math.round(e))})`;const R=e=>`Pt(${String(Math.round(e/12700*100)/100)})`;export const str=e=>JSON.stringify(e);export function colorLines(e,n,i){const r=a=>`${e}.transforms = [${a.map(l=>`{ name: ${str(l.name)}, value: ${String(Math.round(l.value*1e5)/1e5)} }`).join(", ")}];`;if(typeof n=="object"&&"rgb"in n)return[`${e}.rgb = ${str(n.rgb)};`,...n.transforms?.length?[r(n.transforms)]:[]];if(typeof n=="object"&&"transforms"in n)return[`${e}.theme_color = ${str(n.theme_color)};`,...typeof i=="object"&&"brightness"in i?[`${e}.brightness = 0;`]:[],r(n.transforms)];const o=typeof n=="string"?0:n.brightness;return[`${e}.theme_color = ${str(typeof n=="string"?n:n.theme_color)};`,...o!==0||typeof i=="object"&&("brightness"in i||"transforms"in i)?[`${e}.brightness = ${String(Math.round(o*1e5)/1e5)};`]:[]]}function J(e,n,i,r){return Object.keys(r).flatMap(o=>{const a=n[o],l=r[o];return!l||canonical(a)===canonical(i[o])?[]:[`${e}.${o} = ${a==null?String(a):l(a)};`]})}const D=e=>String(e);function se(e,n,i={}){const r=n??{},o=r.color;return[...J(e,r,i,{name:str,size:R,bold:D,italic:D,spacing:R,underline:a=>typeof a=="boolean"?D(a):str(a),strike:a=>typeof a=="boolean"?D(a):str(a),caps:str,baseline:a=>String(Math.round(a*1e3)/1e3),highlight:str}),...canonical(o)===canonical(i.color)?[]:o===void 0?[`${e}.color.theme_color = undefined;`]:colorLines(`${e}.color`,o,i.color)]}const Ze=e=>"lines"in e?String(Math.round(e.lines*1e3)/1e3):R(e.fixed),de=e=>typeof e=="number"?R(e):String(Math.round(e.lines*1e3)/1e3);function W(e,n,i,r={}){return[...J(e,n,r,{alignment:o=>He[o],line_spacing:Ze,space_before:de,space_after:de}),...i?J(e,n,r,{bullet:str,bullet_font:str,numbered:str,start_at:String,bullet_size:o=>String(Math.round(o*1e3)/1e3),margin_left:emu,indent:emu}):[],...i&&canonical(n.bullet_color)!==canonical(r.bullet_color)?[`${e}.bullet_color = ${n.bullet_color===void 0||n.bullet_color===null?String(n.bullet_color):str(y(n.bullet_color))};`]:[],...se(`${e}.font`,n.font,r.font)]}export function levelLines(e,n,i=[]){const r=Array.from({length:Math.max(n?.length??0,i.length)},(l,u)=>n?.[u]??{}),o=r.map((l,u)=>W("level",l,!0,i[u])),a=o[0]?.join(`
|
|
3
|
+
`)??"";return o.length===9&&a!==""&&o.every(l=>l.join(`
|
|
4
|
+
`)===a)?[`for (const level of ${e}) {`,...(o[0]??[]).map(l=>` ${l}`),"}"]:r.flatMap((l,u)=>W(`${e}[${String(u)}]`,l,!0,i[u]))}const Y={margin_left:P.left,margin_top:P.top,margin_right:P.right,margin_bottom:P.bottom};export const MADE={placeholder:e=>({...Ie(e),...Y}),textbox:{vertical_anchor:"t",...De,...Y},autoshape:{vertical_anchor:j.vertical_anchor,word_wrap:!0,auto_size:"none",...Y}},FILE_TEXTBOX={...MADE.textbox,...Ce};export function bodyLines(e,n,i={},r=[]){if(!n)return[];const o=c=>n[c]===void 0||n[c]===i[c]?void 0:n[c],a=o("vertical_anchor"),l=o("auto_size"),u=o("word_wrap"),d=o("orientation");return[...a===void 0?[]:[`${e}.vertical_anchor = ${Ge[a]};`],...d===void 0?[]:[`${e}.orientation = ${str(d)};`],...l===void 0?[]:[`${e}.auto_size = ${Be[l]};`],...u===void 0?[]:[`${e}.word_wrap = ${String(u)};`],...["margin_left","margin_top","margin_right","margin_bottom"].flatMap(c=>{const f=o(c);return f===void 0?[]:[`${e}.${c} = ${emu(f)};`]}),...n.columns===void 0||n.columns===1?[]:[`${e}.columns = ${String(n.columns)};`],...n.column_spacing===void 0||n.column_spacing===0?[]:[`${e}.column_spacing = ${emu(n.column_spacing)};`],...levelLines(`${e}.list_style`,n.levels,r)]}export const sameColor=(e,n)=>JSON.stringify(e)===JSON.stringify(n);export function fillLines(e,n,i,r){const{fill:o,fill_transparency:a,gradient:l,pattern:u,picture_fill:d}=n,c=d&&r.path(d.part);if(d&&c){const f={...d.tile?{tile:d.tile}:{},...d.transparency===void 0?{}:{transparency:d.transparency}};return[`${e}.fill.picture(${str(c)}${Object.keys(f).length>0?`, ${JSON.stringify(f)}`:""});`]}return u?[`${e}.fill.patterned();`,`${e}.fill.pattern = ${str(u.preset)};`,...colorLines(`${e}.fill.fore_color`,u.fg),...colorLines(`${e}.fill.back_color`,u.bg)]:l?[`${e}.fill.gradient();`,...l.path===void 0?[`${e}.fill.gradient_angle = ${String(Math.round(l.angle*1e3)/1e3)};`]:[`${e}.fill.gradient_path = ${str(l.path)};`,...l.focus===void 0?[]:[`${e}.fill.gradient_focus = ${JSON.stringify(l.focus)};`]],`${e}.fill.gradient_stops = ${JSON.stringify(l.stops.map(f=>({at:Math.round(f.at*1e3)/1e3,color:y(f.color),...f.transparency===void 0?{}:{transparency:f.transparency}})))};`]:[...o===void 0||sameColor(o,i)?[]:o===null?[`${e}.fill.background();`]:[`${e}.fill.solid();`,...colorLines(`${e}.fill.fore_color`,o)],...a===void 0||o===null?[]:[`${e}.fill.transparency = ${String(a)};`]]}function F(e,n){return n===void 0?[]:n===null?[`${e}.shadow.inherit = false;`]:[`${e}.shadow.blur_radius = ${emu(n.blur)};`,`${e}.shadow.distance = ${emu(n.distance)};`,`${e}.shadow.angle = ${String(Math.round(n.angle*1e3)/1e3)};`,...n.transparency===oe.transparency?[]:[`${e}.shadow.transparency = ${String(n.transparency)};`],...sameColor(n.color,oe.color)?[]:colorLines(`${e}.shadow.color`,n.color)]}function v(e,n){const i=[],r=n.inner_shadow;r&&i.push(`${e}.inner_shadow.blur_radius = ${emu(r.blur)};`,`${e}.inner_shadow.distance = ${emu(r.distance)};`,`${e}.inner_shadow.angle = ${String(Math.round(r.angle*1e3)/1e3)};`,`${e}.inner_shadow.transparency = ${String(r.transparency)};`,...colorLines(`${e}.inner_shadow.color`,r.color));const o=n.glow;o&&i.push(`${e}.glow.radius = ${emu(o.size)};`,`${e}.glow.transparency = ${String(o.transparency)};`,...colorLines(`${e}.glow.color`,o.color)),n.soft_edges!==void 0&&i.push(`${e}.soft_edge.radius = ${emu(n.soft_edges)};`);const a=n.reflection;return a&&i.push(`${e}.reflection.transparency = ${String(a.transparency)};`,`${e}.reflection.size = ${String(a.size)};`,`${e}.reflection.offset = ${emu(a.distance)};`,`${e}.reflection.blur = ${emu(a.blur)};`),i}function H(e,n,i){return[...n.line===void 0||sameColor(n.line,i.line)?[]:n.line===null?[`${e}.line.fill.background();`]:colorLines(`${e}.line.color`,n.line),...n.line_width===void 0||n.line===null||n.line_width===i.line_width?[]:[`${e}.line.width = ${emu(n.line_width)};`],...n.line_dash===void 0?[]:[`${e}.line.dash_style = ${str(n.line_dash)};`],...n.line_cap===void 0?[]:[`${e}.line.cap_type = ${str(n.line_cap)};`],...n.line_join===void 0?[]:[`${e}.line.join_type = ${str(n.line_join)};`],...n.line_compound===void 0?[]:[`${e}.line.compound_type = ${str(n.line_compound)};`],...n.line_begin===void 0?[]:[`${e}.line.begin_arrow = ${str(n.line_begin)};`],...n.line_end===void 0?[]:[`${e}.line.end_arrow = ${str(n.line_end)};`],...["begin","end"].flatMap(r=>{const o=r==="begin"?n.line_begin_size:n.line_end_size;return[...o?.w===void 0?[]:[`${e}.line.${r}_arrow_width = ${str(o.w)};`],...o?.len===void 0?[]:[`${e}.line.${r}_arrow_length = ${str(o.len)};`]]})]}export const lineFile=e=>({...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_cap===void 0?{}:{line_cap:e.line_cap},...e.line_join===void 0?{}:{line_join:e.line_join},...e.line_compound===void 0?{}:{line_compound:e.line_compound},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.line_begin_size===void 0?{}:{line_begin_size:e.line_begin_size},...e.line_end_size===void 0?{}:{line_end_size:e.line_end_size}});const Z=e=>e.reduce((n,i)=>i<n?i:n,1/0),ue=e=>e.reduce((n,i)=>i>n?i:n,-1/0);function Ke(e){const n=e.steps.flatMap(i=>i.op==="close"?[]:i.op==="curve"?[`${String(i.x1)},${String(i.y1)}`,`${String(i.x2)},${String(i.y2)}`,`${String(i.x)},${String(i.y)}`]:[`${String(i.x)},${String(i.y)}`]);return new Set(n).size<=1}function qe(e){const n=[],i=[];for(const r of e.steps)r.op!=="close"&&(r.op==="curve"&&(n.push(r.x1,r.x2),i.push(r.y1,r.y2)),n.push(r.x),i.push(r.y));return n.length>0&&Z(n)===0&&ue(n)===e.w&&Z(i)===0&&ue(i)===e.h}function Ve(e,n,i,r){const o=n.frame??{left:0,top:0,width:0,height:0},a=i.w===0?1:o.width/i.w,l=i.h===0?1:o.height/i.h,u=i.steps.flatMap(t=>t.op==="close"?[]:t.op==="curve"?[[t.x1,t.y1],[t.x2,t.y2],[t.x,t.y]]:[[t.x,t.y]]),d=t=>Z(u.map(h=>h[t]??0)),[c,...f]=i.steps,m=c?.op==="move"?`${String(c.x)}, ${String(c.y)}`:"0, 0",p=(c?.op==="move"?f:i.steps).map(t=>t.op==="close"?".add_line_segments([], true)":t.op==="move"?`.move_to(${String(t.x)}, ${String(t.y)})`:t.op==="line"?`.add_line_segments([[${String(t.x)}, ${String(t.y)}]], false)`:`.add_curve_segment(${[t.x1,t.y1,t.x2,t.y2,t.x,t.y].map(String).join(", ")})`),g=`${e}.shapes.build_freeform(${m}, [${String(a)}, ${String(l)}])`,S=`.convert_to_shape(${emu(o.left-Math.round(d(0)*a))}, ${emu(o.top-Math.round(d(1)*l))})`;return r===void 0||p.length<=Qe?{lines:[],add:`${g}${p.join("")}${S}`}:{lines:[`const ${r} = ${g};`,...p.map(t=>`${r}${t};`)],add:`${r}${S}`}}const Qe=200,G=(e,n)=>[...n.rotation===void 0?[]:[`${e}.rotation = ${String(Math.round(n.rotation*1e3)/1e3)};`],...n.decorative?[`${e}.decorative = true;`]:[]];function en(e){const n=e.text?.levels??[],i=e.text_color??"dk1";return e.kind!=="autoshape"||sameColor(i,j.font_color)?n:Array.from({length:9},(r,o)=>{const a=n[o]??{};return a.font?.color!==void 0?a:{...a,font:{...a.font,color:i}}})}function nn(e){const n=e.find(l=>l.runs.some(u=>u.field!==void 0)),i=n?.runs.find(l=>l.field!==void 0);if(!n||!i)return[];const{runs:r,level:o,...a}=n;return r.length>0&&o===0&&Object.keys(a).length===0&&(i.font===void 0||Object.keys(i.font).length===0)?[]:[{...n,runs:[{text:"‹#›",...i.font?{font:i.font}:{}}]}]}function fe(e,n,i,r={}){return i.flatMap((o,a)=>{const l=`${e}_p${String(a)}`,u=[...o.level>0?[`${l}.level = ${String(o.level)};`]:[],...W(l,o,!1,a===0?r:{}),...o.runs.flatMap((d,c)=>d.text==="\v"?[`${l}.add_line_break();`]:d.font?[`const ${l}r${String(c)} = ${l}.add_run();`,`${l}r${String(c)}.text = ${str(d.text)};`,...se(`${l}r${String(c)}.font`,d.font),...d.font.link===void 0?[]:[`${l}r${String(c)}.hyperlink.address = ${str(d.font.link)};`]]:[`${l}.add_run().text = ${str(d.text)};`])];return a===0&&u.length===0?[]:[`const ${l} = ${a===0?`${n}.paragraphs[0]`:`${n}.add_paragraph()`};`,...u]})}const L=e=>`${emu(e.left)}, ${emu(e.top)}, ${emu(e.width)}, ${emu(e.height)}`,tn=[{exts:["png"],is:e=>e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71},{exts:["jpg","jpeg"],is:e=>e[0]===255&&e[1]===216&&e[2]===255},{exts:["gif"],is:e=>e[0]===71&&e[1]===73&&e[2]===70&&e[3]===56},{exts:["bmp"],is:e=>e[0]===66&&e[1]===77},{exts:["tif","tiff"],is:e=>e[0]===73&&e[1]===73&&e[2]===42&&e[3]===0||e[0]===77&&e[1]===77&&e[2]===0&&e[3]===42},{exts:["emf"],is:e=>e[0]===1&&e[1]===0&&e[40]===32&&e[41]===69&&e[42]===77&&e[43]===70},{exts:["wmf"],is:e=>e[0]===215&&e[1]===205&&e[2]===198&&e[3]===154||e[0]===1&&e[1]===0&&e[2]===9&&e[3]===0}],on=new Set(["mp3","m4a","wav","aac","wma","mid","midi","aif","aiff","mp4","m4v","mov","wmv","avi","mpg","mpeg","asf","swf"]);export function mediaExtension(e,n){const i=e.toLowerCase();if(on.has(i))return i;const r=tn.find(o=>o.is(n));return!r||r.exts.includes(i)?i:r.exts[0]??i}export class MediaFiles{files=new Map;byPart=new Map;bytes;taken;constructor(n,i=()=>!1){this.bytes=n,this.taken=i}path(n){const i=this.byPart.get(n);if(i)return i;const r=this.bytes(n);if(!r)return;const o=n.split("/").pop()??"file",a=o.lastIndexOf("."),l=a>0?o.slice(0,a):o,u=mediaExtension(a>0?o.slice(a+1):"",r),d=u===""?"":`.${u}`;let c=`${l}${d}`;for(let f=2;this.files.has(c)||this.taken(c);f++)c=`${l}-${String(f)}${d}`;return this.files.set(c,r),this.byPart.set(n,`./${c}`),`./${c}`}}export const NUMBER_WORDS="words beside a slide number: a slide number is its number alone",numberHasWords=e=>e.some(n=>n.runs.some(i=>i.field===void 0&&i.text!=="\v"&&i.text!=="")),FIELD_AS_TEXT="a slide number's field in a shape that is not a slide number's placeholder: its text (‹#›) is kept, not the number",hasField=e=>e.some(n=>n.runs.some(i=>i.field!==void 0)),GLUE_MOVED="a glued connector is drawn with its ends on its shapes' sites, where the file has it off them";const ce=e=>({left:C(w(e.left)),top:C(w(e.top)),width:C(w(e.width)),height:C(w(e.height))});export function placedGlue(e,n=()=>{},i=()=>{}){const r=new Map(e.flatMap(o=>o.id===void 0?[]:[[o.id,o]]));return e.map(o=>{if(!o.glue||!o.frame)return o;const a=p=>p===void 0?void 0:{shape:p.id,site:p.site},l=a(o.glue.begin),u=a(o.glue.end),d=Fe({frame:ce(o.frame),flip:o.flip,rotation:o.rotation,connect:{...l?{begin:l}:{},...u?{end:u}:{}}},p=>{if(p===o.id)return;const g=r.get(p);return g?.frame?{frame:ce(g.frame),geometry:g.kind==="textbox"?void 0:g.geometry,adjustments:g.adjustments,flip:g.flip,rotation:g.rotation,path:g.path}:void 0}),c=o.frame,f=d.frame;(Math.abs(c.left-f.left)>64||Math.abs(c.top-f.top)>64||Math.abs(c.width-f.width)>64||Math.abs(c.height-f.height)>64||!!o.flip?.h!=!!d.flip?.h||!!o.flip?.v!=!!d.flip?.v)&&n(o);const m={...o,frame:d.frame};if(d.flip?m.flip=d.flip:delete m.flip,d.lost.length>0){const p=d.lost.filter(h=>{const s=o.glue?.[h]?.id;return s!==void 0&&r.get(s)?.frame!==void 0});for(const h of p)i(o,h);const g=h=>p.includes(h)?void 0:o.glue?.[h],S=g("begin"),t=g("end");S===void 0&&t===void 0?delete m.glue:m.glue={...S?{begin:S}:{},...t?{end:t}:{}}}return m})}export const GLUE_LOST="a connector's end glued to a site its shape has not (a freeform's, a picture's): it is not glued, and stays where it is",CODE_UNMAPPED=!0;const _e={picture:"add_picture",movie:"add_movie",audio:"add_audio"};export function shapeCode(e,n,i,r,o){const a=placedGlue(n,t=>{r(t,"p:cNvCxnSpPr",GLUE_MOVED,"approximated")},(t,h)=>{r(t,h==="begin"?"a:stCxn":"a:endCxn",GLUE_LOST)}),l=t=>{const h=t.adjustments??[],s=t.path||t.kind==="textbox"?0:me(t.geometry??"rect").length;return h.length>s&&r(t,"a:avLst",`adjustments its shape (${t.geometry??"a text box"}) has not: they are left out`),h.slice(0,s)},u=[],d=new Set,c=new Map,f=new Map,m=new Set(a.flatMap(t=>[t.glue?.begin?.id,t.glue?.end?.id].filter(h=>h!==void 0))),p=new Map,g=[];a.filter(t=>!t.path||!Ke(t.path)?!0:(r(t,"a:custGeom","a freeform whose points are all one point draws nothing: it is left out"),!1)).forEach((t,h)=>{const s=`${e}_s${String(h)}`,T=t.id!==void 0&&m.has(t.id);T&&t.id!==void 0&&p.set(t.id,s);const A=_=>{const $=f.get(_);if($!==void 0)return $;const x=_.lastIndexOf("/"),O=x<0?e:A(_.slice(0,x)),M=`${e}_g${String(f.size)}`;return f.set(_,M),u.push(`const ${M} = ${O}.shapes.add_group_shape();`,`${M}.name = ${str(I(_.slice(x+1),d,"group"))};`),M},b=t.group===void 0?e:A(t.group);if(t.flip&&!ne(t.geometry)&&r(t,"a:xfrm@flipH","a master's or a layout's shape mirrored: python-pptx's API has no flip"),t.locked&&r(t,"a:spLocks","a master's or a layout's shape locked"),t.link!==void 0&&r(t,"a:hlinkClick","a master's or a layout's shape's link"),t.playback&&r(t,"p:video","a master's or a layout's movie's playback"),t.alt!==void 0&&r(t,"p:cNvPr@descr","a master's or a layout's shape's alternative text"),(t.media||t.component)&&r(t,"p:sp","a master's or a layout's component or media"),t.kind!=="placeholder"&&hasField(t.text?.paragraphs??[])&&r(t,"a:fld",FIELD_AS_TEXT),t.kind==="placeholder"&&t.placeholder){const _=/^[A-Za-z0-9_-]+$/u.test(t.name)?I(t.name,d,"placeholder"):I(ie[t.placeholder.type],d,"placeholder");let $=t.placeholder.idx;for(;c.has($);)$=-1-c.size;c.set($,_),t.placeholder.type==="sldNum"&&numberHasWords(t.text?.paragraphs??[])&&r(t,"a:fld",NUMBER_WORDS);const x=[...bodyLines(`${s}.text_frame`,t.text,o?MADE.placeholder(t.placeholder.type):{},Re(t.placeholder.type)),...t.placeholder.type==="sldNum"?fe(s,`${s}.text_frame`,nn(t.text?.paragraphs??[])):[]],O=[...G(s,t),...fillLines(s,t,void 0,i),...H(s,t,{line:void 0}),...F(s,t.shadow),...v(s,t)];t.geometry!==void 0&&t.geometry!=="rect"&&O.push(`${s}.auto_shape_type = ${le(t.geometry)};`,...X(s,l(t))),u.push(`${x.length>0||O.length>0||T?`const ${s} = `:""}${b}.placeholders.add(PP_PLACEHOLDER.${Ue[t.placeholder.type]}${t.frame?`, ${L(t.frame)}`:""}${Ye(_===ie[t.placeholder.type]?void 0:_,t.placeholder.orient)});`,...O,...x);return}const N=I(t.name,d,t.kind);if(!t.frame){r(t,"a:xfrm","a shape with no frame of its own is left out");return}if((t.kind==="picture"||t.kind==="movie"||t.kind==="audio")&&t.part){if(t.kind==="audio"){r(t,"p:pic","a master's or a layout's sound: it is left out");return}const _=i.path(t.part);if(!_){r(t,"p:pic","its file is not in the file");return}t.crop&&Object.values(t.crop).some($=>$!==0)&&r(t,"a:srcRect","a picture's crop on a master or a layout"),u.push(...t.rotation===void 0&&t.shadow===void 0&&v(s,t).length===0&&!T&&!t.look?[`${b}.shapes.${_e[t.kind]}(${str(_)}, ${L(t.frame)}).name = ${str(N)};`]:[`const ${s} = ${b}.shapes.${_e[t.kind]}(${str(_)}, ${L(t.frame)});`,`${s}.name = ${str(N)};`,...G(s,t),...F(s,t.shadow),...v(s,t),...Object.entries(lookFile(t.look)).map(([$,x])=>`${s}.${$} = ${JSON.stringify(x)};`)]);return}if(t.table||t.chart){r(t,t.table?"a:tbl":"c:chart","a table or a chart on a master or a layout: one goes on a slide");return}if(!t.path&&ne(t.geometry)){const _=t.frame,[$,x]=t.flip?.h?[_.left+_.width,_.left]:[_.left,_.left+_.width],[O,M]=t.flip?.v?[_.top+_.height,_.top]:[_.top,_.top+_.height];u.push(`const ${s} = ${b}.shapes.add_connector(${We(t.geometry??"line")}, ${emu($)}, ${emu(O)}, ${emu(x)}, ${emu(M)});`,`${s}.name = ${str(N)};`,...X(s,l(t)),...G(s,t),...H(s,t,Te),...F(s,t.shadow),...v(s,t)),t.glue&&g.push({v:s,s:t});return}if(t.path&&!qe(t.path))for(const _ of["a:custGeom","a:xfrm"])r(t,_,"a master's or a layout's freeform whose path does not span its frame is drawn in the frame its points span","approximated");const z=t.path?Ve(b,t,t.path,`${s}_b`):void 0;z&&u.push(...z.lines);const he=z?z.add:t.kind==="textbox"?`${b}.shapes.add_textbox(${L(t.frame)})`:`${b}.shapes.add_shape(${le(t.geometry??"rect")}, ${L(t.frame)})`;u.push(`const ${s} = ${he};`,`${s}.name = ${str(N)};`,...X(s,l(t)),...G(s,t),...t.kind==="textbox"?[...fillLines(s,t,null,i),...H(s,t,{line:null})]:[...fillLines(s,t,j.fill,i),...H(s,t,j)],...F(s,t.shadow),...v(s,t),...bodyLines(`${s}.text_frame`,t.text&&{...t.text,levels:en(t)},MADE[t.kind==="textbox"?"textbox":"autoshape"]),...t.text?fe(s,`${s}.text_frame`,t.text.paragraphs,t.kind==="autoshape"?{alignment:j.alignment}:{}):[])});for(const{v:t,s:h}of g)for(const[s,T]of[["begin","a:stCxn"],["end","a:endCxn"]]){const A=h.glue?.[s];if(!A)continue;const b=p.get(A.id);b===void 0?r(h,T,"a connector's end glued to a shape that is left out: it stays where it is"):u.push(`${t}.${s}_connect(${b}, ${String(A.site)});`)}return{lines:u,names:c}}export const frameFile=e=>({x:w(e.left),y:w(e.top),w:w(e.width),h:w(e.height)});export{y as colorFile};const K=e=>({...e.minimum_scale===void 0?{}:{min:e.minimum_scale},...e.maximum_scale===void 0?{}:{max:e.maximum_scale},...e.major_unit===void 0?{}:{major:e.major_unit},...e.has_major_gridlines===void 0?{}:{gridlines:e.has_major_gridlines},...e.visible===void 0?{}:{visible:e.visible},...e.number_format===void 0?{}:{format:e.number_format},...e.reverse_order===void 0?{}:{reverse:e.reverse_order},...e.gridline_color===void 0?{}:{gridline_color:y(e.gridline_color)},...e.line_color===void 0?{}:{line_color:y(e.line_color)},...e.tick_label_position===void 0?{}:{labels:e.tick_label_position},...e.major_tick_mark===void 0?{}:{tick_marks:e.major_tick_mark},...e.minor_tick_mark===void 0?{}:{minor_tick_marks:e.minor_tick_mark},...e.crosses===void 0?{}:{crosses:e.crosses},...e.crosses_at===void 0?{}:{crosses_at:e.crosses_at},...e.log_base===void 0?{}:{log_base:e.log_base},...e.display_units===void 0?{}:{units:e.display_units},...e.display_units_label===void 0?{}:{units_label:e.display_units_label},...e.minor_unit===void 0?{}:{minor:e.minor_unit},...e.has_minor_gridlines===void 0?{}:{minor_gridlines:e.has_minor_gridlines},...e.label_angle===void 0?{}:{label_angle:e.label_angle},...e.label_interval===void 0?{}:{label_every:e.label_interval}});function k(e,n){return Object.fromEntries(Object.entries(e).filter(([i,r])=>canonical(r)!==canonical(n[i])))}const q=(e,n,i)=>{const r=n&&i(n);return r&&Object.keys(r).length>0?{[e]:r}:{}},pe=e=>Object.fromEntries(Object.entries(e).filter(([,n])=>n!==!1));function rn(e){return e.type==="waterfall"?Ee*100:e.type==="box-whisker"?be.gap*100:e.type==="funnel"?xe*100:e.type==="pareto"&&!we(e)?Oe*100:0}function an(e){const n={gridline_color:Ae,line_color:ye},i=e.font_size??E.fontSize,r=ve(e.type)&&ee(e.type)!=="clustered",o=f=>(Le(f)||Ne(f))&&je(f),{value_axis:a,category_axis:l,secondary_axis:u,labels:d,...c}=e;return{...k(c,{gap_width:B(e.type)?rn(e):E.gapWidth,hole_size:E.holeSize,vary_by_categories:U(e.type),category_colors:e.categories.map((f,m)=>V(m)),font_size:E.fontSize,title_size:Math.round(i*E.titleScale*100)/100,font_color:Me,...r?{overlap:100}:{}}),series:e.series.map((f,m)=>{const p=k(f,{color:V(m),line_width:o(f.type??e.type)?E.lineWidth:f.line_width,marker_size:E.marker}),g=f.type??e.type;return p.labels?{...p,labels:k(p.labels,{position:te({type:g}),...U(g)?{color:"lt1"}:{}})}:p}),...q("value_axis",a,f=>k(f,{...n,has_major_gridlines:!0,...ee(e.type)==="percentStacked"?{number_format:"0%"}:{}})),...q("category_axis",l,f=>k(f,{...n,has_major_gridlines:!1})),...q("secondary_axis",u,f=>k(f,{...n,has_major_gridlines:!1})),...d?{labels:k(d,{position:te({type:e.type}),...U(e.type)?{color:"lt1"}:{}})}:{}}}const ln=e=>$e.includes(e);function ge(e,n,i){const r=(n??[]).flatMap((u,d)=>u===null?[]:[d]),o=r[0],a=r.at(-1),l=e.points;return l?.some(u=>u!==o&&u!==a)&&i?.("c:dLbl","a series' labels on points other than its first and last are on its ends"),{...e.show_value===void 0?{}:{value:e.show_value},...e.show_percentage===void 0?{}:{percentage:e.show_percentage},...e.show_category_name===void 0?{}:{category:e.show_category_name},...e.show_series_name===void 0?{}:{series:e.show_series_name},...e.number_format===void 0?{}:{format:e.number_format},...e.position===void 0?{}:{position:e.position},...e.size===void 0?{}:{size:e.size},...e.color===void 0?{}:{color:y(e.color)},...e.bold===void 0?{}:{bold:e.bold},...l?.includes(o??-1)===!0?{first:!0}:{},...l?.includes(a??-1)===!0&&a!==o?{last:!0}:{}}}export function chartFile(e,n){const i=an(e),r=i.labels;return{type:i.type,...i.categories.length===0&&i.series.some(o=>o.x)||i.categories.length===0&&!Se(i.type)?{}:{categories:i.categories},series:i.series.map((o,a)=>({name:o.name,values:a===0?sn(i,o.values):o.values,...o.x===void 0?{}:{x:o.x},...o.sizes===void 0?{}:{sizes:o.sizes},...o.color===void 0?{}:{color:y(o.color)},...o.number_format===void 0?{}:{format:o.number_format},...o.smooth===void 0?{}:{smooth:o.smooth},...o.line_width===void 0?{}:{line_width:o.line_width},...o.marker_size===void 0?{}:{marker_size:o.marker_size},...o.type===void 0||!ln(o.type)?{}:{type:o.type},...o.secondary===!0?{secondary:!0}:{},...o.line_dash===void 0?{}:{line_dash:o.line_dash},...o.marker_symbol===void 0?{}:{marker:o.marker_symbol},...o.transparency===void 0?{}:{transparency:o.transparency},...o.no_fill===!0?{fill:"none"}:{},...o.point_colors?.some(l=>l!=null)?{points:Object.fromEntries(o.point_colors.flatMap((l,u)=>{const d=i.categories[u];return l==null||d===void 0?[]:[[d,{color:y(l)}]]}))}:{},...o.labels===null?{labels:!1}:o.labels===void 0?{}:{labels:ge(o.labels,o.values,n)}})),...i.legend===void 0?{}:{legend:i.legend},...r&&!(B(i.type)&&canonical(pe(r))===canonical(pe(Q(i.type)??{})))?{labels:ge(r,void 0,n)}:!r&&Q(i.type)!==void 0?{labels:!1}:{},...i.gap_width===void 0?{}:{gap_width:i.gap_width},...i.overlap===void 0?{}:{overlap:i.overlap},...i.vary_by_categories===void 0?{}:{vary_by_categories:i.vary_by_categories},...i.category_colors===void 0?{}:{category_colors:i.category_colors.map(y)},...i.hole_size===void 0?{}:{hole_size:i.hole_size},...i.value_axis?{value_axis:K(i.value_axis)}:{},...i.category_axis?{category_axis:K(i.category_axis)}:{},...i.secondary_axis?{secondary_axis:K(i.secondary_axis)}:{},...i.font_size===void 0?{}:{size:i.font_size},...i.title_size===void 0?{}:{title_size:i.title_size},...i.font_color===void 0?{}:{color:y(i.font_color)},...i.high_low_lines===!0?{high_low_lines:!0}:{},...i.secondary_gap_width===void 0?{}:{secondary_gap_width:i.secondary_gap_width},...dn(i)}}function sn(e,n){const i=e.totals??[];if(e.type!=="waterfall"||i.length===0)return[...n];const r=ke(n.map((o,a)=>i.includes(a)&&a>0?null:o),i);return n.map((o,a)=>i.includes(a)&&a>0&&o===r[a]?.to?null:o)}function dn(e){return B(e.type)?{...e.category_levels?{categories:e.category_levels.map(n=>{const i=[...n];for(;i.length>1&&i.at(-1)==="";)i.pop();return i})}:{},...e.totals?.length?{totals:e.totals.map(n=>e.categories[n]??String(n))}:{},...e.connector_lines===!1?{connector_lines:!1}:{},...e.quartile_method==="inclusive"?{quartiles:"inclusive"}:{},...e.show_mean_markers===!1?{mean_markers:!1}:{},...e.show_mean_line===!0?{mean_line:!0}:{},...e.show_outliers===!1?{outliers:!1}:{},...e.show_inner_points===!0?{inner_points:!0}:{},...e.bin_count===void 0?{}:{bin_count:e.bin_count},...e.bin_width===void 0?{}:{bin_width:e.bin_width},...e.overflow===void 0?{}:{overflow:e.overflow},...e.underflow===void 0?{}:{underflow:e.underflow},...e.interval_closed==="left"?{interval_closed:"left"}:{},...e.parent_labels===void 0||e.parent_labels==="banner"?{}:{parent_labels:e.parent_labels}}:{}}export const canonical=e=>JSON.stringify(e,(n,i)=>i&&typeof i=="object"&&!Array.isArray(i)?Object.fromEntries(Object.entries(i).sort(([r],[o])=>r<o?-1:1)):i);export function lookFile(e){if(!e)return{};const n=l=>Math.round(l*1e3)/1e3,[i,r]=e.duotone??[],o=i!==void 0&&r!==void 0?[y(i),y(r)]:void 0,a=o!==void 0&&sameColor(i,re(ae[0]))&&sameColor(r,re(ae[1]));return{...e.brightness===void 0?{}:{brightness:n(e.brightness)},...e.contrast===void 0?{}:{contrast:n(e.contrast)},...e.grayscale===!0?{recolor:"grayscale"}:e.black_white!==void 0?{recolor:e.black_white===.5?"black_white":{black_white:n(e.black_white)}}:o?{recolor:a?"sepia":{duotone:o}}:{},...e.transparency===void 0?{}:{transparency:n(e.transparency)}}}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{stringify as Je}from"yaml";import{AUTOSHAPE_STYLE as he,CONNECTOR_STYLE as Ue,EAST_ASIAN_FONT as an,isConnectorGeometry as on,NAME_OF_TYPE as ln,OFFICE_TEXT_STYLES as we,pathText as rn,SHADOW_DEFAULTS as dn,SLIDE_SIZES as fn,styleKindOf as cn,toPt as I,tableStyleOf as un,TILE_DEFAULTS as Ee,INNER_SHADOW_DEFAULTS as Be,CHART_AXIS_WORDS as pn,chartScriptText as hn}from"@allyhub/slides-core";import{BODY_DEFAULTS as mn}from"../read/text.js";import{bodyLines as gn,chartFile as _n,colorFile as B,colorLines as Ye,emu as Ge,FILE_TEXTBOX as bn,frameFile as We,levelLines as yn,lineFile as Oe,MADE as wn,MediaFiles as On,placedGlue as kn,GLUE_MOVED as xn,sameColor as me,shapeCode as Xe,str as ge}from"./code.js";import{nameOf as ke}from"./names.js";import{lineOn as Ke,variesIn as je,wordsOf as Ae}from"./script.js";export const UNMAPPED=!0;const $n="{2D5ABB26-0587-4C30-8999-92F81FD0307C}",Ne=e=>({...e.angle===0||e.path!==void 0?{}:{angle:Math.round(e.angle*1e3)/1e3},...e.path===void 0?{}:{path:e.path},...e.focus===void 0?{}:{focus:e.focus},stops:e.stops.map(a=>({at:Math.round(a.at*1e3)/1e3,color:B(a.color),...a.transparency===void 0?{}:{transparency:a.transparency}}))}),pe=e=>({color:B(e.color),blur:I(e.blur),distance:I(e.distance),angle:Math.round(e.angle*1e3)/1e3,...e.transparency===dn.transparency?{}:{transparency:e.transparency}});function Ze(e,a,o,u){if(a){const c=o.path(a.part);if(c){const m=a.tile,r=m&&{...m.scale_x===Ee.scale_x?{}:{scale_x:m.scale_x},...m.scale_y===Ee.scale_y?{}:{scale_y:m.scale_y},...m.offset_x===0?{}:{x:I(m.offset_x)},...m.offset_y===0?{}:{y:I(m.offset_y)},...m.align===Ee.align?{}:{align:m.align}};return{picture_fill:{path:c,...r?{tile:r}:{},...a.transparency===void 0?{}:{transparency:a.transparency}}}}u("missing")("a:blipFill","its picture's file is not in the file")}if(e)return{pattern:{preset:e.preset,fg:B(e.fg),bg:B(e.bg)}}}function de(e){const a={},o=e.inner_shadow;o&&(a.inner_shadow={...me(o.color,Be.color)?{}:{color:B(o.color)},blur:I(o.blur),distance:I(o.distance),angle:Math.round(o.angle*1e3)/1e3,...o.transparency===Be.transparency?{}:{transparency:o.transparency}});const u=e.glow;u&&(a.glow={color:B(u.color),size:I(u.size),transparency:Math.round(u.transparency*1e3)/1e3}),e.soft_edges!==void 0&&(a.soft_edges=I(e.soft_edges));const c=e.reflection;return c&&(a.reflection={transparency:Math.round(c.transparency*1e3)/1e3,size:Math.round(c.size*1e3)/1e3,distance:I(c.distance),blur:I(c.blur)}),a}const Ve=e=>typeof e=="number"?I(e):{lines:Math.round(e.lines*1e5)/1e5};function qe(e){const a=Object.fromEntries(Object.entries(e??{}).filter(([,o])=>o>0));return Object.keys(a).length>0?a:void 0}const Qe=e=>({...e.locked?{locked:!0}:{},...e.link===void 0?{}:{link:e.link},...e.playback?{playback:e.playback}:{},...e.rotation===void 0?{}:{rotation:e.rotation},...e.flip?.h?{flip_h:!0}:{},...e.flip?.v?{flip_v:!0}:{}});function Fe(e,a,o,u=[],c){const m=e.flatMap(t=>t.runs.filter(b=>b.text!=="\v"&&b.text.trim()!==""));if(m.length===0)return c===void 0?void 0:{orientation:c};const r=(t,b)=>u.map(k=>k[t.level]?.[b]).find(k=>k!==void 0);for(const[t,b,k]of[["margin_left","a:pPr@marL","a paragraph's own left margin is its level's"],["indent","a:pPr@indent","a paragraph's own first-line indent is its level's"],["bullet_font","a:buFont","a bullet's own font is its level's"]])e.some(x=>x.runs.some(T=>T.text.trim()!=="")&&x[t]!==void 0&&x[t]!==r(x,t))&&a(b,k);const _=t=>{const b=m.map(t),k=b[0];return k!==void 0&&b.every(x=>x===k)?k:void 0},p=(t,b,k)=>{const x=e.map(T=>JSON.stringify(t(T)??null));if(x.every(T=>T===x[0]))return e[0]&&t(e[0]);a(b,k)},R=_(t=>t.font?.size),F=_(t=>t.font?.color===void 0?void 0:B(t.font.color)),S=_(t=>t.font?.name),Z=_(t=>Ke(t.font?.underline)===void 0?void 0:t.font?.underline),P=_(t=>Ke(t.font?.strike)===void 0?void 0:t.font?.strike),y=_(t=>t.font?.caps),s=e.every(t=>t.alignment===e[0]?.alignment)?e[0]?.alignment:void 0;s===void 0&&e.some(t=>t.alignment!==void 0)&&a("a:pPr@algn","paragraphs aligned differently take the first's");const h=e.every(t=>t.numbered===e[0]?.numbered)?e[0]?.numbered:void 0;h===void 0&&e.some(t=>t.numbered!==void 0)&&a("a:buAutoNum","paragraphs numbered and not, or numbered differently, take their levels'");const d=p(t=>t.line_spacing,"a:lnSpc","paragraphs with different line spacing take their levels'");d&&"fixed"in d&&a("a:lnSpc/a:spcPts","exact line spacing is its levels'");const L=p(t=>t.space_before,"a:spcBef","paragraphs with different space before take their levels'"),g=p(t=>t.space_after,"a:spcAft","paragraphs with different space after take their levels'"),f=h===void 0?p(t=>t.bullet,"a:buChar","paragraphs with different bullets take their levels'"):void 0;f!=null&&f.length>2&&a("a:buChar","a bullet of more than two characters is its levels'");const O=e.filter(t=>t.runs.some(b=>b.text.trim()!=="")),v=(t,b,k)=>{const x=O.map(i=>i[t]),T=x[0];if(x.every(i=>JSON.stringify(i)===JSON.stringify(T)))return T??void 0;a(b,k)},Y=v("bullet_color","a:buClr","paragraphs whose bullets differ in colour take their levels'"),V=v("bullet_size","a:buSzPct","paragraphs whose bullets differ in size take their levels'"),M=v("start_at","a:buAutoNum@startAt","lists that start at different numbers take their levels'"),G={...R===void 0?{}:{size:I(R)},...Z===void 0?{}:{underline:Z},...P===void 0?{}:{strike:P},...y===void 0?{}:{caps:y},...F===void 0?{}:{color:F},...S===void 0?{}:{font:S},...s===void 0?{}:{align:s},...d&&"lines"in d?{line_spacing:Math.round(d.lines*1e3)/1e3}:{},...L===void 0?{}:{space_before:Ve(L)},...g===void 0?{}:{space_after:Ve(g)},...o===void 0?{}:{anchor:o},...c===void 0?{}:{orientation:c},...f===void 0||f!==null&&f.length>2?{}:{bullet:f??!1},...h===void 0?{}:{numbered:h},...Y===void 0?{}:{bullet_color:B(Y)},...V===void 0?{}:{bullet_size:Math.min(4,Math.max(.25,Math.round(V*1e3)/1e3))},...M===void 0?{}:{start_at:Math.min(32767,Math.max(1,Math.round(M)))}};return Object.keys(G).length>0?G:void 0}export function flattened(e,a){return e.map(o=>{const u=a[o.level]??{},c=o.bullet!==void 0||o.numbered!==void 0,{font:m,bullet:r,numbered:_,...p}=u,R={...m,...o.font},F={...p,...c?{}:{...r===void 0?{}:{bullet:r},..._===void 0?{}:{numbered:_}},...o,runs:o.runs.map(S=>S.text==="\v"||Object.keys(R).length===0?S:{...S,font:{...R,...S.font}})};return Object.keys(R).length>0?F.font=R:delete F.font,F})}export function importDeck(e,a){const o=a.name??"deck",u=[...e.report],c=new On(e.bytes,a.taken),m=Object.entries(fn).find(([,[s,h]])=>s===e.width&&h===e.height)?.[0],r=[];Object.keys(e.theme).length>0&&r.push(`prs.theme.colors = ${JSON.stringify(e.theme)};`);const _=Object.fromEntries(Object.entries(e.fonts).filter(([s,h])=>!s.endsWith("_east_asian")||h!==an));Object.keys(_).length>0&&r.push(`prs.theme.fonts = ${JSON.stringify(_)};`);const p=new Map;e.masters.forEach((s,h)=>{const d=`master${String(h+1)}`,L=g=>(f,O,v,Y="cannot-hold")=>{u.push({kind:Y,part:"",where:f?`${g} › "${f.name}"`:g,what:O,detail:v})};r.push("",`const ${d} = prs.slide_masters.add(${ge(s.name)});`),s.color_map&&r.push(`${d}.color_map = ${JSON.stringify(s.color_map)};`),s.background&&!me(s.background,"bg1")&&r.push(`${d}.background.fill.solid();`,...Ye(`${d}.background.fill.fore_color`,s.background));for(const[g,f]of[["title","title_style"],["body","body_style"],["other","other_style"]])r.push(...yn(`${d}.text_styles.${f}`,s.text_styles[g],we[g]));r.push(...Xe(d,s.shapes,c,L(`master "${s.name}"`),!0).lines),s.layouts.forEach((g,f)=>{const O=`${d}_layout${String(f+1)}`;r.push("",`const ${O} = ${d}.slide_layouts.add(${ge(g.name)});`),g.display_master_shapes===!1&&r.push(`${O}.display_master_shapes = false;`),g.color_map&&r.push(`${O}.color_map = ${JSON.stringify(g.color_map)};`),g.background&&r.push(`${O}.background.fill.solid();`,...Ye(`${O}.background.fill.fore_color`,g.background));const v=Xe(O,g.shapes,c,L(`layout "${g.name}"`),!1);r.push(...v.lines),p.set(g.name,v.names)})});const R=new Set,F=[],S=[];e.slides.forEach((s,h)=>{const d=e.masters.find(O=>O.layouts.some(v=>v.name===s.layout)),L=d?.layouts.find(O=>O.name===s.layout),{slide:g,words:f}=vn(s,h,R,p.get(s.layout)??new Map,c,u,{...d?{master:d}:{},...L?{layout:L}:{}});F.push(g),S.push(f)});const Z=s=>{const h=F[Number(s)-1]?.id;return typeof h=="string"?h:void 0},P=s=>typeof s=="string"?s.replace(/(^|link=")#@(\d+)(?=["]|$)/gu,(h,d,L)=>{const g=Z(L);return g===void 0?h:`${d}#${g}`}):Array.isArray(s)?s.map(P):s!==null&&typeof s=="object"?Object.fromEntries(Object.entries(s).map(([h,d])=>[h,P(d)])):s;F.splice(0,F.length,...F.map(P)),S.splice(0,S.length,...S.map(P));const y=new Map;y.set(`${o}.ts`,['import { Emu, MSO_ANCHOR, MSO_AUTO_SIZE, MSO_CONNECTOR, MSO_SHAPE, PP_ALIGN, PP_PLACEHOLDER, Pt, presentation } from "@allyhub/sdk/slides";',"",`// ${a.source}, imported by allyhub slides import: its masters and layouts.`,`export default presentation({ slides: ${ge(`./${o}.yaml`)}, script: ${ge(`./${o}.{locale}.yaml`)}, size: ${m?ge(m):`{ width: ${Ge(e.width)}, height: ${Ge(e.height)} }`} }, (prs) => {`,...r.map(s=>s===""?"":` ${s}`),"});",""].join(`
|
|
3
|
-
`)),y.set(`${o}.yaml`,Je({slides:F},{lineWidth:0})),y.set(`${o}.${a.lang}.yaml`,Je({...e.title?{title:e.title}:{},slides:S},{lineWidth:0}));for(const[s,h]of c.files)y.set(s,h);for(const[s,h]of c.byPart){const d=/\.(emf|wmf|tiff?)$/iu.exec(h)?.[1];d&&u.push({kind:"cannot-hold",part:s,what:"a:blip",detail:`a picture as ${d.toUpperCase()}, which the stage cannot draw (its export keeps it)`})}return{files:y,report:u,reasons:e.reasons}}const Sn=new Set(["dt","ftr","sldNum"]);function vn(e,a,o,u,c,m,r){const _=r.master?.text_styles.other??we.other,p=`slide ${String(a+1)}`,F=e.shapes.find(i=>i.placeholder?.type==="title"||i.placeholder?.type==="ctrTitle")?.text?.paragraphs.map(i=>i.runs.map(n=>n.text).join("")).join(" ")??"",S=e.name!==void 0&&/^[A-Za-z0-9_-]+$/u.test(e.name)&&!o.has(e.name)?ke(e.name,o,"slide"):ke(F,o,`slide-${String(a+1)}`),Z=new Set(u.values()),P={},y={},s={},h=new Map,d=new Map,L=i=>{const n=d.get(i);if(n!==void 0)return n;const E=i.lastIndexOf("/"),z=E<0?void 0:L(i.slice(0,E)),H=ke(i.slice(E+1),Z,"group"),j=z===void 0?H:`${z}/${H}`;return d.set(i,j),j},g=new Set,f=[],O=new Map,v=[],Y=kn(e.shapes,i=>{m.push({kind:"approximated",part:e.part,where:`${p} › "${i.name}"`,what:"p:cNvCxnSpPr",detail:xn})});for(const i of Y){let n=i;const E=`${p} › "${n.name}"`,z=C=>(ee,K)=>{m.push({kind:C,part:e.part,where:E,what:ee,detail:K})},H=z("cannot-hold"),j=n.placeholder,X=j?u.get(j.idx)??[...u.values()].find(C=>C===ln[j.type]):void 0;if(j&&X!==void 0&&P[X]!==void 0){const C=n.frame??en(j,r).shapes.find(K=>K.frame)?.frame;z("approximated")("p:ph",`its layout's placeholder "${X}" is another's on this slide, so it is a shape of its own, its text in the master's other text style`);const ee={...n,...C?{frame:C}:{}};delete ee.placeholder,n=ee}if(n.placeholder){const C=X;if(!C){H("p:ph","its layout has no such placeholder; it is left out");continue}h.set(n.name,C),n.id!==void 0&&O.set(n.id,C),f.push({name:C,placeholder:!0});const ee=jn(n,C,en(n.placeholder,r),c,z,y);n.alt!==void 0&&(s[C]=n.alt),Sn.has(n.placeholder.type)&&g.add(C),P[C]=ee;continue}const q=ke(n.name,Z,n.kind);if(h.set(n.name,q),!n.frame){H("a:xfrm","a shape with no frame is left out");continue}const le=An(n,q,c,z,y,_);le&&(n.id!==void 0&&O.set(n.id,q),n.glue&&v.push({name:q,at:E,glue:n.glue}),n.group!==void 0&&(le.group=L(n.group)),n.alt!==void 0&&(s[q]=n.alt),P[q]=le,f.push({name:q,placeholder:!1}))}for(const i of v){const n={};for(const z of["begin","end"]){const H=i.glue[z];if(!H)continue;const j=O.get(H.id);j===void 0?m.push({kind:"cannot-hold",part:e.part,where:i.at,what:z==="begin"?"a:stCxn":"a:endCxn",detail:"a connector's end glued to a shape that is left out: it stays where it is"}):n[z]={shape:j,site:H.site}}const E=P[i.name];E&&Object.keys(n).length>0&&(E.connect=n)}const V=f.map(i=>i.placeholder).lastIndexOf(!0),M=f.findIndex(i=>i.placeholder),G=[...u.values()],t=f.filter(i=>i.placeholder).map(i=>G.indexOf(i.name)),b=f.some((i,n)=>!i.placeholder&&n>M&&n<V)||t.some((i,n)=>n>0&&i<(t[n-1]??-1));f.forEach((i,n)=>{const E=P[i.name]??(P[i.name]={});b?E.z=n-f.length:!i.placeholder&&M>=0&&n<M&&(E.z=-1)});const k=Object.fromEntries(Object.entries(P).filter(([i,n])=>Object.keys(n).length>0||g.has(i))),x=e.animations.flatMap(i=>{const n=h.get(i.shape);return n!==void 0?[{...i,shape:n}]:(m.push({kind:"cannot-hold",part:e.part,where:p,what:"p:spTgt",detail:`an animation of ${i.shape}, which is left out`}),[])}),T=e.background?e.background.picture!==void 0?(()=>{const i=c.path(e.background.picture);return i===void 0?void 0:{picture:i}})():e.background.gradient?{gradient:Ne(e.background.gradient)}:e.background.fill!==void 0?{fill:B(e.background.fill)}:void 0:void 0;return{slide:{id:S,layout:e.layout,...e.hidden?{hidden:!0}:{},...T?{background:T}:{},...Object.keys(k).length>0?{shapes:k}:{},...x.length>0?{animations:x}:{},...e.transition?{transition:e.transition}:{},...e.advance===void 0?{}:{advance_after:e.advance},...e.section===void 0?{}:{section:e.section}},words:{id:S,...Object.keys(y).length>0?{text:y}:{},...Object.keys(s).length>0?{alt:s}:{},...e.notes===void 0?{}:{notes:e.notes}}}}const Mn=e=>e==="title"||e==="ctrTitle"?"title":e==="dt"||e==="ftr"||e==="sldNum"?e:"body";function en(e,a){const o=p=>(p??[]).filter(R=>R.placeholder!==void 0),u=o(a.layout?.shapes).find(p=>p.placeholder?.idx===e.idx)??o(a.layout?.shapes).find(p=>p.placeholder?.type===e.type),c=Mn(u?.placeholder?.type??e.type),m=o(a.master?.shapes).find(p=>p.placeholder?.type===c),r=cn(e.type),_=[u,m].filter(p=>p!==void 0);return{shapes:_,levels:[..._.map(p=>p.text?.levels??[]),a.master?.text_styles[r]??[],we[r]]}}export const PLACEHOLDER_UNMAPPED=!0;const En=["word_wrap","auto_size","margin_left","margin_top","margin_right","margin_bottom"];function jn(e,a,o,u,c,m){const r=c("cannot-hold"),{kind:_,placeholder:p,frame:R,rotation:F,flip:S,locked:Z,link:P,playback:y,part:s,crop:h,text:d,fill:L,fill_transparency:g,gradient:f,pattern:O,picture_fill:v,shadow:Y,inner_shadow:V,glow:M,soft_edges:G,reflection:t,line:b,line_width:k,line_dash:x,line_cap:T,line_join:i,line_compound:n,line_begin:E,line_end:z,line_begin_size:H,line_end_size:j,geometry:X,adjustments:q,group:le,path:C,table:ee,chart:K}=e,J={};if(R&&(J.frame=We(R)),Object.assign(J,Qe({...F===void 0?{}:{rotation:F},...S?{flip:S}:{},...Z?{locked:Z}:{},...P===void 0?{}:{link:P},...y?{playback:y}:{}})),(_==="picture"||_==="movie"||_==="audio")&&s){const A=u.path(s);A?J[_==="picture"?"picture":_]=A:c("missing")("p:pic","its file is not in the file");const $=qe(h);$&&(J.crop=$)}if(d&&p?.type!=="sldNum"){const A=flattened(d.paragraphs,d.levels),$=Ae(A,je(A),r);$!==void 0&&(m[a]=$);const se=o.shapes.map(oe=>oe.text?.orientation).find(oe=>oe!==void 0)??"horz",ae=Fe(A,r,d.vertical_anchor,o.levels,(d.orientation??se)===se?void 0:d.orientation);ae&&(J.text=ae)}if(d){const A=En.filter($=>{const se=d[$];if(se===void 0)return!1;const ae=o.shapes.map(oe=>oe.text?.[$]).find(oe=>oe!==void 0)??mn[$];return typeof se=="number"&&typeof ae=="number"?Math.abs(se-ae)>64:se!==ae});A.length>0&&r("a:bodyPr",`its text frame (${A.join(", ")}) is its layout's placeholder's`)}const _e=Ze(O,v,u,c);_e?Object.assign(J,_e):f?J.gradient=Ne(f):L!==void 0&&(J.fill=L===null?"none":B(L)),g!==void 0&&L&&(J.fill_transparency=g),Y&&(J.shadow=pe(Y)),Object.assign(J,de({inner_shadow:V,glow:M,soft_edges:G,reflection:t})),b!==void 0&&(J.line=b===null?"none":B(b)),b!==null&&(k!==void 0&&(J.line_width=I(k)),Object.assign(J,Oe({...x===void 0?{}:{line_dash:x},...T===void 0?{}:{line_cap:T},...i===void 0?{}:{line_join:i},...n===void 0?{}:{line_compound:n},...E===void 0?{}:{line_begin:E},...z===void 0?{}:{line_end:z},...H===void 0?{}:{line_begin_size:H},...j===void 0?{}:{line_end_size:j}})));const be=o.shapes.find(A=>A.geometry!==void 0);return X!==void 0&&(X!==(be?.geometry??"rect")||JSON.stringify(q??null)!==JSON.stringify(be?.adjustments??null))&&r("a:prstGeom",`a placeholder of its own shape (${X}) is its layout's`),le!==void 0&&c("approximated")("p:grpSp","a placeholder in a group is the slide's, not the group's"),(C||ee||K)&&r("p:ph","a placeholder of a freeform, a table or a chart"),J}function An(e,a,o,u,c,m){const r=u("cannot-hold"),{kind:_,frame:p,rotation:R,flip:F,locked:S,link:Z,playback:P,text:y,fill:s,fill_transparency:h,gradient:d,pattern:L,picture_fill:g,shadow:f,inner_shadow:O,glow:v,soft_edges:Y,reflection:V,line:M,line_width:G,line_dash:t,line_cap:b,line_join:k,line_compound:x,line_begin:T,line_end:i,line_begin_size:n,line_end_size:E,geometry:z,path:H,table:j,chart:X,adjustments:q,part:le,crop:C,text_color:ee}=e;if(!p)return;const K={frame:We(p),...Qe({...R===void 0?{}:{rotation:R},...F?{flip:F}:{},...S?{locked:S}:{},...Z===void 0?{}:{link:Z},...P?{playback:P}:{}})},J=q?{adjustments:q.map(W=>Math.round(W*1e5)/1e5)}:{},_e={...d?{gradient:Ne(d)}:{},...f?{shadow:pe(f)}:{},...de({inner_shadow:O,glow:v,soft_edges:Y,reflection:V})};if(X){const W=hn({...X.title===void 0?{}:{title:X.title},...Object.fromEntries(pn.flatMap(ne=>{const fe=X[ne]?.title;return fe===void 0?[]:[[ne,fe]]}))});return W!==void 0&&(c[a]=W),{chart:_n(X),...K}}if(j){const W=j.rows.reduce((l,N)=>l+N.height,0),ne=j.rows.filter(l=>l.height<=0).length,fe=ne===0?0:Math.max(12700,(p.height-W)/ne),Q=j.rows.map(l=>l.height>0?l:{...l,height:fe}),re=Q.reduce((l,N)=>l+N.height,0),te=Q.map(l=>({...l,height:re>0?l.height*p.height/re:l.height})),Te=j.columns.map(I),Le=l=>Math.round(l.reduce((N,D)=>N+D,0)*100)/100,$e=l=>{const N=l.map(D=>JSON.stringify(D??null));return N.every(D=>D===N[0])?l[0]:void 0},ze=te.flatMap((l,N)=>l.cells.flatMap((D,ce)=>{const U=D.span_width??1,ie=D.span_height??1;return D.spanned||U*ie<2?[]:[{row:N,column:ce,...ie>1?{rows:ie}:{},...U>1?{columns:U}:{}}]})),Se={table:{columns:Te,rows:te.map(l=>{const N=l.cells.filter(w=>!w.spanned).map(w=>w.fill),D=$e(N);D===void 0&&N.some(w=>w!==void 0)&&u("approximated")("a:tcPr/a:solidFill","cells of a row filled differently take its first's");const ce=D??N.find(w=>w!=null),U=l.cells.map(w=>w.borders?.bottom?.color),ie=$e(U)??U.find(w=>w!==void 0);l.cells.some(w=>w.borders?.left!==void 0||w.borders?.right!==void 0||w.borders?.top!==void 0)&&u("approximated")("a:tcPr/a:lnL","a cell's edges are its row's foot");const ue=l.cells.filter(w=>!w.spanned).map(w=>w.text.vertical_anchor??"t"),Me=$e(ue);Me===void 0&&u("approximated")("a:tcPr@anchor","cells of a row whose text stands differently take its first's");const Ie=Fe(l.cells.flatMap(w=>w.text.paragraphs),r,(Me??ue[0])==="t"?void 0:Me??ue[0]),Re=l.cells.flatMap(w=>w.text.paragraphs.flatMap(sn=>sn.runs)).filter(w=>w.text.trim()!==""),He=Re.length>0&&Re.every(w=>w.font?.bold===!0);return{height:I(l.height),...ce===void 0?{}:{fill:B(ce)},...Ie??He?{text:{...Ie,...He?{bold:!0}:{}}}:{},...ie===void 0?{}:{line:B(ie)}}}),...ze.length>0?{merged:ze}:{}},...K,frame:{...K.frame,w:Le(Te),h:Le(te.map(l=>I(l.height)))}},Ce={margin_left:91440,margin_right:91440,margin_top:45720,margin_bottom:45720};te.some(l=>l.cells.some(N=>Object.keys(Ce).some(D=>N.text[D]!==void 0&&Math.abs((N.text[D]??0)-Ce[D])>64)))&&r("a:tcPr@marL","a cell's own margins: a table's cells have Office's"),te.some(l=>l.cells.some(N=>Object.values(N.borders??{}).some(D=>Math.abs(D.width-12700)>64)))&&u("approximated")("a:tcPr/a:ln@w","a cell's edge is a point wide");const De=["first_row","last_row","first_col","last_col","horz_banding","vert_banding"].filter(l=>j[l]===!0),ve=un(j.style);ve&&(ve.id!==$n||De.length>0)&&(Se.table.style=ve.name);for(const l of De)Se.table[l]=!0;return c[a]=te.map(l=>l.cells.map(N=>{const ce=l.cells.flatMap(U=>U.text.paragraphs.flatMap(ie=>ie.runs)).filter(U=>U.text.trim()!=="").every(U=>U.font?.bold===!0)?N.text.paragraphs.map(U=>({...U,runs:U.runs.map(ie=>{const ue={...ie.font};return delete ue.bold,{...ie,font:ue}})})):N.text.paragraphs;return Ae(ce,je(l.cells.flatMap(U=>U.text.paragraphs)),r)??""})),Se}if((_==="picture"||_==="movie"||_==="audio")&&le){const W=o.path(le);if(!W){u("missing")("p:pic","its file is not in the file: it is left out");return}const ne=_==="audio"?void 0:qe(C);return{[_]:W,...K,...ne?{crop:ne}:{},...f?{shadow:pe(f)}:{},...de({inner_shadow:O,glow:v,soft_edges:Y,reflection:V}),...de({inner_shadow:O,glow:v,soft_edges:Y,reflection:V})}}const be={...G===void 0||M===null?{}:{line_width:I(G)},...Oe({...t===void 0?{}:{line_dash:t},...b===void 0?{}:{line_cap:b},...k===void 0?{}:{line_join:k},...x===void 0?{}:{line_compound:x},...T===void 0?{}:{line_begin:T},...i===void 0?{}:{line_end:i},...n===void 0?{}:{line_begin_size:n},...E===void 0?{}:{line_end_size:E}})};if(!H&&z!==void 0&&on(z))return{geometry:z,...J,...K,...M===void 0||me(M,Ue.line)?{}:{line:M===null?"none":B(M)},...G===void 0||G===Ue.line_width?{}:{line_width:I(G)},...Oe({...t===void 0?{}:{line_dash:t},...b===void 0?{}:{line_cap:b},...k===void 0?{}:{line_join:k},...x===void 0?{}:{line_compound:x},...T===void 0?{}:{line_begin:T},...i===void 0?{}:{line_end:i},...n===void 0?{}:{line_begin_size:n},...E===void 0?{}:{line_end_size:E}}),...f?{shadow:pe(f)}:{},...de({inner_shadow:O,glow:v,soft_edges:Y,reflection:V}),...de({inner_shadow:O,glow:v,soft_edges:Y,reflection:V})};const A=_==="textbox",$=A?{textbox:!0,...K}:H?{path:{w:H.w,h:H.h,d:rn(H.steps)},...K}:{geometry:z??"rect",...J,...K},se=A?null:he.fill,ae=Ze(L,g,o,u);ae?Object.assign($,ae,f?{shadow:pe(f)}:{}):d?Object.assign($,_e):(s&&!me(s,se)&&($.fill=B(s)),h!==void 0&&s&&($.fill_transparency=h),s===null&&se!==null&&($.fill="none"),f&&($.shadow=pe(f))),Object.assign($,de({inner_shadow:O,glow:v,soft_edges:Y,reflection:V}));const oe=A?null:he.line;M!==void 0&&!me(M,oe)&&($.line=M===null?"none":B(M)),!A&&M!==null&&G!==void 0&&G!==he.line_width?Object.assign($,be):M!==null&&Object.assign($,Oe({...t===void 0?{}:{line_dash:t},...b===void 0?{}:{line_cap:b},...k===void 0?{}:{line_join:k},...x===void 0?{}:{line_compound:x},...T===void 0?{}:{line_begin:T},...i===void 0?{}:{line_end:i},...n===void 0?{}:{line_begin_size:n},...E===void 0?{}:{line_end_size:E}})),A&&M!==void 0&&M!==null&&G!==void 0&&($.line_width=I(G));const ye=A?bn:wn.autoshape,nn=y?.vertical_anchor===void 0||y.vertical_anchor===ye.vertical_anchor?void 0:y.vertical_anchor,tn=y?.orientation===void 0||y.orientation==="horz"?void 0:y.orientation,xe=y&&{...y,levels:[],...ye.vertical_anchor===void 0?{}:{vertical_anchor:ye.vertical_anchor}};xe&&delete xe.orientation;const Pe=gn("",xe,ye);if(Pe.length>0&&r("a:bodyPr",`its text frame (${Pe.map(W=>W.replace(/^\.(\w+) = .*$/u,"$1")).join(", ")}) is the basic ${A?"text box's":"shape's"}`),y){const W=flattened(y.paragraphs,y.levels),ne=Ae(W,je(W),r);ne!==void 0&&(c[a]=ne);const fe=W.map(re=>({...re,alignment:re.alignment??m[re.level]?.alignment??"l",runs:re.runs.map(te=>te.font?.color!==void 0||ee===void 0?te:{...te,font:{...te.font,color:ee}})})),Q=Fe(A?W:fe,r,nn,[m,we.other],tn);Q&&!A&&Q.color===B(he.font_color)&&delete Q.color,Q&&!A&&Q.align===he.alignment&&delete Q.align,Q&&Object.keys(Q).length>0&&($.text=Q)}return $}
|
|
2
|
+
import{stringify as We}from"yaml";import{AUTOSHAPE_STYLE as we,CONNECTOR_STYLE as Ye,EAST_ASIAN_FONT as un,isConnectorGeometry as pn,NAME_OF_TYPE as Ae,OFFICE_TEXT_STYLES as Oe,pathText as hn,SHADOW_DEFAULTS as mn,SLIDE_SIZES as gn,styleKindOf as _n,toPt as F,hungLevel as Xe,paragraphEntries as bn,tableStyleOf as yn,TILE_DEFAULTS as Ne,INNER_SHADOW_DEFAULTS as Ke,CHART_AXIS_WORDS as wn,chartScriptText as On}from"@allyhub/slides-core";import{BODY_DEFAULTS as kn}from"../read/text.js";import{chartFile as xn,colorFile as Y,colorLines as Ze,fillLines as Ve,lookFile as qe,emu as Qe,FILE_TEXTBOX as $n,frameFile as en,levelLines as Sn,lineFile as ke,MADE as vn,MediaFiles as jn,placedGlue as En,FIELD_AS_TEXT as Mn,GLUE_LOST as Fn,GLUE_MOVED as An,hasField as Nn,NUMBER_WORDS as Tn,numberHasWords as Ln,sameColor as xe,shapeCode as nn,str as $e}from"./code.js";import{asFace as zn}from"../fonts.js";import{nameOf as Se}from"./names.js";import{lineOn as tn,variesIn as Te,wordsOf as Le}from"./script.js";export const UNMAPPED=!0;const Cn="{2D5ABB26-0587-4C30-8999-92F81FD0307C}",ze=e=>({...e.angle===0||e.path!==void 0?{}:{angle:Math.round(e.angle*1e3)/1e3},...e.path===void 0?{}:{path:e.path},...e.focus===void 0?{}:{focus:e.focus},stops:e.stops.map(o=>({at:Math.round(o.at*1e3)/1e3,color:Y(o.color),...o.transparency===void 0?{}:{transparency:o.transparency}}))}),me=e=>({color:Y(e.color),blur:F(e.blur),distance:F(e.distance),angle:Math.round(e.angle*1e3)/1e3,...e.transparency===mn.transparency?{}:{transparency:e.transparency}});function Ce(e,o,i,c){if(o){const s=i.path(o.part);if(s){const a=o.tile,l=a&&{...a.scale_x===Ne.scale_x?{}:{scale_x:a.scale_x},...a.scale_y===Ne.scale_y?{}:{scale_y:a.scale_y},...a.offset_x===0?{}:{x:F(a.offset_x)},...a.offset_y===0?{}:{y:F(a.offset_y)},...a.align===Ne.align?{}:{align:a.align}};return{picture_fill:{path:s,...l?{tile:l}:{},...o.transparency===void 0?{}:{transparency:o.transparency}}}}c("missing")("a:blipFill","its picture's file is not in the file")}if(e)return{pattern:{preset:e.preset,fg:Y(e.fg),bg:Y(e.bg)}}}function ge(e){const o={},i=e.inner_shadow;i&&(o.inner_shadow={...xe(i.color,Ke.color)?{}:{color:Y(i.color)},blur:F(i.blur),distance:F(i.distance),angle:Math.round(i.angle*1e3)/1e3,...i.transparency===Ke.transparency?{}:{transparency:i.transparency}});const c=e.glow;c&&(o.glow={color:Y(c.color),size:F(c.size),transparency:Math.round(c.transparency*1e3)/1e3}),e.soft_edges!==void 0&&(o.soft_edges=F(e.soft_edges));const s=e.reflection;return s&&(o.reflection={transparency:Math.round(s.transparency*1e3)/1e3,size:Math.round(s.size*1e3)/1e3,distance:F(s.distance),blur:F(s.blur)}),o}const Ee=e=>typeof e=="number"?F(e):{lines:Math.round(e.lines*1e5)/1e5};function on(e){const o=Object.fromEntries(Object.entries(e??{}).filter(([,i])=>i!==0));return Object.keys(o).length>0?o:void 0}const sn=e=>({...e.locked?{locked:!0}:{},...e.decorative?{decorative:!0}:{},...e.link===void 0?{}:{link:e.link},...e.playback?{playback:e.playback}:{},...e.rotation===void 0?{}:{rotation:e.rotation},...e.flip?.h?{flip_h:!0}:{},...e.flip?.v?{flip_v:!0}:{}});function Pe(e,o,i,c=[],s){const a=e.flatMap(n=>n.runs.filter(t=>t.text!=="\v"&&t.text.trim()!==""));if(a.length===0)return s===void 0?void 0:{orientation:s};const l=(n,t)=>c.map(d=>d[n.level]?.[t]).find(d=>d!==void 0);for(const[n,t,d]of[["bullet_font","a:buFont","a bullet's own font is its level's"]])e.some(f=>f.runs.some(O=>O.text.trim()!=="")&&f[n]!==void 0&&f[n]!==l(f,n))&&o(t,d);const r=n=>{const t=a.map(n),d=t[0];return d!==void 0&&t.every(f=>f===d)?d:void 0},p=e.filter(n=>n.runs.some(t=>t.text!=="")),x=e.map(()=>({})),v=(n,t,d)=>{const f=e.indexOf(n),O=x[f];O&&d!==void 0&&(O[t]=d)},A=(n,t,d,f=e)=>{const O=f.map(g=>{const z=n(g);return z===void 0?"unset":JSON.stringify(z)});if(O.every(g=>g===O[0]))return f[0]&&n(f[0]);for(const g of f){const z=n(g);z!==void 0&&v(g,t,d(z))}},Z=r(n=>n.font?.size),L=r(n=>n.font?.color===void 0?void 0:Y(n.font.color)),T=r(n=>n.font?.name),y=r(n=>tn(n.font?.underline)===void 0?void 0:n.font?.underline),u=r(n=>tn(n.font?.strike)===void 0?void 0:n.font?.strike),j=r(n=>n.font?.caps),m=A(n=>n.alignment,"align",n=>n,p),P=n=>n.numbered!==void 0?`n${n.numbered}`:n.bullet!==void 0?`b${JSON.stringify(n.bullet)}`:"",h=new Map;for(const n of new Set(p.map(t=>t.level))){const t=p.filter(f=>f.level===n),d=t[0];if(d)if(t.every(f=>P(f)===P(d)))h.set(n,d);else{h.set(n,void 0);for(const f of t)f.numbered!==void 0?v(f,"numbered",f.numbered):f.bullet===null?v(f,"bullet",!1):f.bullet!==void 0&&f.bullet.length<=2?v(f,"bullet",f.bullet):f.bullet!==void 0&&o("a:buChar","a bullet of more than two characters is its levels'")}}const k=[...h.values()],E=k.length>0&&k.every(n=>n!==void 0&&P(n)===P(k[0]??n))?k[0]:void 0,I=E?.numbered,ee=A(n=>n.line_spacing,"line_spacing",an),le=A(n=>n.space_before,"space_before",Ee),N=A(n=>n.space_after,"space_after",Ee),$=I===void 0?E?.bullet:void 0;$!=null&&$.length>2&&o("a:buChar","a bullet of more than two characters is its levels'");const ne=e.filter(n=>n.runs.some(t=>t.text.trim()!=="")),U=(n,t)=>{const d=ne.map(O=>O[n]),f=d[0];if(d.every(O=>JSON.stringify(O)===JSON.stringify(f)))return f??void 0;for(const O of ne){const g=O[n];g!=null&&v(O,n,t(g))}},V=U("bullet_color",n=>Y(n)),K=U("bullet_size",ln),q=U("start_at",rn),te=I!==void 0||$!=null&&$.length<=2,w=[];for(let n=0;n<9;n++){const t=e.filter(B=>B.level===n&&B.runs.some(re=>re.text.trim()!=="")),d=t[0];if(!d)continue;const f=(B,re)=>B[re]??l(B,re)??0,O=t.every(B=>f(B,"margin_left")===f(d,"margin_left")&&f(B,"indent")===f(d,"indent")),g=E===void 0?h.get(n):void 0,z=g?.numbered!==void 0?{numbered:g.numbered}:g?.bullet!==void 0&&(g.bullet===null||g.bullet.length<=2)?{bullet:g.bullet??!1}:{};g?.bullet!==void 0&&g.bullet!==null&&g.bullet.length>2&&o("a:buChar","a bullet of more than two characters is its levels'");const H=te||"numbered"in z||typeof z.bullet=="string",S=I!==void 0||"numbered"in z,C={margin_left:l(d,"margin_left")??0,indent:l(d,"indent")??0},X=H?Xe(C,S):C,b=f(d,"margin_left"),M=f(d,"indent"),se=Math.abs(b-X.margin_left)>64||Math.abs(M-X.indent)>64?{margin_left:Math.max(0,F(b)),indent:F(M)}:{};Object.keys(se).length+Object.keys(z).length>0&&(w[n]={...se,...z});const ue="margin_left"in se?{margin_left:b,indent:M}:X;for(const B of t){const re=x[e.indexOf(B)],ve=re!==void 0&&("numbered"in re||typeof re.bullet=="string"),je=ve&&ue.indent>=0?Xe(ue,"numbered"in re):ue,be=f(B,"margin_left"),R=f(B,"indent");(!O||ve)&&(Math.abs(be-je.margin_left)>64||Math.abs(R-je.indent)>64)&&(v(B,"margin_left",Math.max(0,F(be))),v(B,"indent",F(R)))}}const ie=bn(x),W={...w.length>0?{levels:Array.from({length:w.length},(n,t)=>w[t]??{})}:{},...Z===void 0?{}:{size:F(Z)},...y===void 0?{}:{underline:y},...u===void 0?{}:{strike:u},...j===void 0?{}:{caps:j},...L===void 0?{}:{color:L},...T===void 0?{}:{font:T},...m===void 0?{}:{align:m},...ee===void 0?{}:{line_spacing:an(ee)},...le===void 0?{}:{space_before:Ee(le)},...N===void 0?{}:{space_after:Ee(N)},...i===void 0?{}:{anchor:i},...s===void 0?{}:{orientation:s},...$===void 0||$!==null&&$.length>2?{}:{bullet:$??!1},...I===void 0?{}:{numbered:I},...V===void 0?{}:{bullet_color:Y(V)},...K===void 0?{}:{bullet_size:ln(K)},...q===void 0?{}:{start_at:rn(q)},...ie.length>0?{paragraphs:ie}:{}};return Object.keys(W).length>0?W:void 0}const an=e=>"lines"in e?Math.round(e.lines*1e3)/1e3:{points:Math.max(.01,F(e.fixed))},ln=e=>Math.min(4,Math.max(.25,Math.round(e*1e3)/1e3)),rn=e=>Math.min(32767,Math.max(1,Math.round(e)));export function flattened(e,o){return e.map(i=>{const c=o[i.level]??{},s=i.bullet!==void 0||i.numbered!==void 0,{font:a,bullet:l,numbered:r,...p}=c,x={...a,...i.font},v={...p,...s?{}:{...l===void 0?{}:{bullet:l},...r===void 0?{}:{numbered:r}},...i,runs:i.runs.map(A=>A.text==="\v"||Object.keys(x).length===0?A:{...A,font:{...x,...A.font}})};return Object.keys(x).length>0?v.font=x:delete v.font,v})}export function importDeck(e,o){const i=o.name??"deck",c=[...e.report],s=new jn(e.bytes,o.taken),a=Object.entries(gn).find(([,[u,j]])=>u===e.width&&j===e.height)?.[0],l=[];Object.keys(e.theme).length>0&&l.push(`prs.theme.colors = ${JSON.stringify(e.theme)};`);const r=Object.fromEntries(Object.entries(e.fonts).filter(([u,j])=>!u.endsWith("_east_asian")||j!==un));Object.keys(r).length>0&&l.push(`prs.theme.fonts = ${JSON.stringify(r)};`);const p=new Map;e.masters.forEach((u,j)=>{const m=`master${String(j+1)}`,P=h=>(k,E,I,ee="cannot-hold")=>{c.push({kind:ee,part:"",where:k?`${h} › "${k.name}"`:h,what:E,detail:I})};l.push("",`const ${m} = prs.slide_masters.add(${$e(u.name)});`),u.color_map&&l.push(`${m}.color_map = ${JSON.stringify(u.color_map)};`),u.background_fill?l.push(...Ve(`${m}.background`,u.background_fill,void 0,s)):u.background&&!xe(u.background,"bg1")&&l.push(`${m}.background.fill.solid();`,...Ze(`${m}.background.fill.fore_color`,u.background));for(const[h,k]of[["title","title_style"],["body","body_style"],["other","other_style"]])l.push(...Sn(`${m}.text_styles.${k}`,u.text_styles[h],Oe[h]));l.push(...nn(m,u.shapes,s,P(`master "${u.name}"`),!0).lines),u.layouts.forEach((h,k)=>{const E=`${m}_layout${String(k+1)}`;l.push("",`const ${E} = ${m}.slide_layouts.add(${$e(h.name)});`),h.display_master_shapes===!1&&l.push(`${E}.display_master_shapes = false;`),h.color_map&&l.push(`${E}.color_map = ${JSON.stringify(h.color_map)};`),h.background_fill?l.push(...Ve(`${E}.background`,h.background_fill,void 0,s)):h.background&&l.push(`${E}.background.fill.solid();`,...Ze(`${E}.background.fill.fore_color`,h.background));const I=nn(E,h.shapes,s,P(`layout "${h.name}"`),!1);l.push(...I.lines),p.set(h.name,I.names)})});const x=new Set,v=[],A=[];e.slides.forEach((u,j)=>{const m=e.masters.find(E=>E.layouts.some(I=>I.name===u.layout)),P=m?.layouts.find(E=>E.name===u.layout),{slide:h,words:k}=Jn(u,j,x,p.get(u.layout)??new Map,s,c,{...m?{master:m}:{},...P?{layout:P}:{}});v.push(h),A.push(k)});const Z=u=>{const j=v[Number(u)-1]?.id;return typeof j=="string"?j:void 0},L=u=>typeof u=="string"?u.replace(/(^|link=")#@(\d+)(?=["]|$)/gu,(j,m,P)=>{const h=Z(P);return h===void 0?j:`${m}#${h}`}):Array.isArray(u)?u.map(L):u!==null&&typeof u=="object"?Object.fromEntries(Object.entries(u).map(([j,m])=>[j,L(m)])):u;v.splice(0,v.length,...v.map(L)),A.splice(0,A.length,...A.map(L));const T=new Map;T.set(`${i}.ts`,['import { Emu, MSO_ANCHOR, MSO_AUTO_SIZE, MSO_CONNECTOR, MSO_SHAPE, PP_ALIGN, PP_PLACEHOLDER, Pt, presentation } from "@allyhub/sdk/slides";',"",`// ${o.source}, imported by allyhub slides import: its masters and layouts.`,`export default presentation({ slides: ${$e(`./${i}.yaml`)}, script: ${$e(`./${i}.{locale}.yaml`)}, size: ${a?$e(a):`{ width: ${Qe(e.width)}, height: ${Qe(e.height)} }`} }, (prs) => {`,...l.map(u=>u===""?"":` ${u}`),"});",""].join(`
|
|
3
|
+
`)),T.set(`${i}.yaml`,We({slides:v},{lineWidth:0})),T.set(`${i}.${o.lang}.yaml`,We({...e.title?{title:e.title}:{},slides:A},{lineWidth:0}));for(const[u,j]of s.files)T.set(u,j);for(const[u,j]of s.byPart){const m=/\.(emf|wmf|tiff?)$/iu.exec(j)?.[1];m&&c.push({kind:"cannot-hold",part:u,what:"a:blip",detail:`a picture as ${m.toUpperCase()}, which the stage cannot draw (its export keeps it)`})}const y=In(e.embedded_fonts??[],i,T,o.taken);return{files:T,report:c,reasons:e.reasons,...y===void 0?{}:{stylesheet:y}}}const Pn={regular:{weight:400,style:"normal",face:"Regular"},bold:{weight:700,style:"normal",face:"Bold"},italic:{weight:400,style:"italic",face:"Italic"},boldItalic:{weight:700,style:"italic",face:"Bold Italic"}};function In(e,o,i,c=()=>!1){const s=[],a=new Set;for(const r of e)for(const[p,x]of Object.entries(Pn)){const v=r[p];if(!v)continue;const A=zn(v,r.typeface,x.face),Z=String.fromCharCode(...A.subarray(0,4))==="OTTO",L=Z?"otf":"ttf",T=Se(`${r.typeface} ${p}`,a,"font");let y=`fonts/${T}.${L}`;for(let u=2;i.has(y)||c(y);u++)y=`fonts/${T}-${String(u)}.${L}`;i.set(y,A),s.push(["@font-face {",` font-family: ${JSON.stringify(r.typeface)};`,` src: url("./${y}") format("${Z?"opentype":"truetype"}");`,` font-weight: ${String(x.weight)};`,` font-style: ${x.style};`,"}"].join(`
|
|
4
|
+
`))}if(s.length===0)return;const l=`${o}.fonts.css`;return i.set(l,`/* The fonts the PowerPoint file carried, as its decks draw and export them. */
|
|
5
|
+
${s.join(`
|
|
6
|
+
|
|
7
|
+
`)}
|
|
8
|
+
`),l}const dn=new Set(["dt","ftr","sldNum"]),Dn=new Set(Object.values(Ae));function Rn(e,o){return o.get(e.idx)??[...o.values()].find(i=>i===Ae[e.type])}function Jn(e,o,i,c,s,a,l){const r=l.master?.text_styles.other??Oe.other,p=`slide ${String(o+1)}`,v=e.shapes.find(n=>n.placeholder?.type==="title"||n.placeholder?.type==="ctrTitle")?.text?.paragraphs.map(n=>n.runs.map(t=>t.text).join("")).join(" ")??"",A=e.name!==void 0&&/^[A-Za-z0-9_-]+$/u.test(e.name)&&!i.has(e.name)?Se(e.name,i,"slide"):Se(v,i,`slide-${String(o+1)}`),Z=new Set(c.values()),L={},T={},y={},u=new Map,j=new Map,m=n=>{const t=j.get(n);if(t!==void 0)return t;const d=n.lastIndexOf("/"),f=d<0?void 0:m(n.slice(0,d)),O=Se(n.slice(d+1),Z,"group"),g=f===void 0?O:`${f}/${O}`;return j.set(n,g),g},P=new Set,h=[],k=new Map,E=[],I=En(e.shapes,n=>{a.push({kind:"approximated",part:e.part,where:`${p} › "${n.name}"`,what:"p:cNvCxnSpPr",detail:An})},(n,t)=>{a.push({kind:"cannot-hold",part:e.part,where:`${p} › "${n.name}"`,what:t==="begin"?"a:stCxn":"a:endCxn",detail:Fn})});for(const n of I){let t=n;const d=`${p} › "${t.name}"`,f=C=>(X,b)=>{a.push({kind:C,part:e.part,where:d,what:X,detail:b})},O=f("cannot-hold"),g=t.placeholder,z=g?Rn(g,c):void 0;if(g&&dn.has(g.type)&&z!==void 0&&z!==Ae[g.type]&&Dn.has(z)&&O("p:ph@type",`a ${g.type} on its layout's ${z}'s place (its idx): it is that placeholder, as PowerPoint links them`),g&&t.kind==="audio"){const C=t.frame??Ie(g,l).shapes.find(b=>b.frame)?.frame;f("approximated")("p:ph","a sound in a placeholder is a shape of its own, where the placeholder is");const X={...t,...C?{frame:C}:{}};delete X.placeholder,t=X}else if(g&&z!==void 0&&L[z]!==void 0){const C=t.frame??Ie(g,l).shapes.find(b=>b.frame)?.frame;f("approximated")("p:ph",`its layout's placeholder "${z}" is another's on this slide, so it is a shape of its own, its text in the master's other text style`);const X={...t,...C?{frame:C}:{}};delete X.placeholder,t=X}if(t.placeholder){const C=z;if(!C){O("p:ph","its layout has no such placeholder; it is left out");continue}u.set(t.name,C),t.id!==void 0&&k.set(t.id,C),h.push({name:C,placeholder:!0});const X=qn(t,C,Ie(t.placeholder,l),s,f,T);t.alt!==void 0&&(y[C]=t.alt),dn.has(t.placeholder.type)&&P.add(C),L[C]=X;continue}const H=Se(t.name,Z,t.kind);if(u.set(t.name,H),!t.frame){O("a:xfrm","a shape with no frame is left out");continue}const S=Qn(t,H,s,f,T,r);S&&(t.id!==void 0&&k.set(t.id,H),t.glue&&E.push({name:H,at:d,glue:t.glue}),t.group!==void 0&&(S.group=m(t.group)),t.alt!==void 0&&(y[H]=t.alt),L[H]=S,h.push({name:H,placeholder:!1}))}for(const n of E){const t={};for(const f of["begin","end"]){const O=n.glue[f];if(!O)continue;const g=k.get(O.id);g===void 0?a.push({kind:"cannot-hold",part:e.part,where:n.at,what:f==="begin"?"a:stCxn":"a:endCxn",detail:"a connector's end glued to a shape that is left out: it stays where it is"}):t[f]={shape:g,site:O.site}}const d=L[n.name];d&&Object.keys(t).length>0&&(d.connect=t)}const ee=new Set(e.animations.map(n=>u.get(n.shape)??n.shape)),le=h.filter(n=>!n.placeholder||Object.keys(L[n.name]??{}).length>0||T[n.name]!==void 0||y[n.name]!==void 0||P.has(n.name)||ee.has(n.name));h.splice(0,h.length,...le);const N=h.map(n=>n.placeholder).lastIndexOf(!0),$=h.findIndex(n=>n.placeholder),ne=[...c.values()],U=h.filter(n=>n.placeholder).map(n=>ne.indexOf(n.name)),V=h.some((n,t)=>!n.placeholder&&t>$&&t<N)||U.some((n,t)=>t>0&&n<(U[t-1]??-1));h.forEach((n,t)=>{const d=L[n.name]??(L[n.name]={});V?d.z=t-h.length:!n.placeholder&&$>=0&&t<$&&(d.z=-1)});const K=Object.fromEntries(Object.entries(L).filter(([n,t])=>Object.keys(t).length>0||P.has(n))),q=n=>n===void 0?0:Array.isArray(n)?n.reduce((t,d)=>t+q(d),0):1,te=e.animations.flatMap(n=>{const t=u.get(n.shape);if(t!==void 0&&n.paragraph!==void 0&&n.paragraph>=q(T[t]))return a.push({kind:"cannot-hold",part:e.part,where:`${p} › "${n.shape}"`,what:"p:txEl",detail:`an animation of paragraph ${String(n.paragraph+1)}, which has no words: it is left out`}),[];if(t!==void 0&&n.animate_text!==void 0&&q(T[t])===0){a.push({kind:"cannot-hold",part:e.part,where:`${p} › "${n.shape}"`,what:"p:iterate",detail:"an animation by word or letter of a shape with no words: it plays as one"});const d={...n,shape:t};return delete d.animate_text,delete d.text_delay,[d]}return t!==void 0?[{...n,shape:t}]:(a.push({kind:"cannot-hold",part:e.part,where:p,what:"p:spTgt",detail:`an animation of ${n.shape}, which is left out`}),[])}),w=e.background,ie=n=>(t,d)=>{a.push({kind:n,part:e.part,where:p,what:t,detail:d})},W=w?w.picture!==void 0&&w.tile===void 0&&w.transparency===void 0?(()=>{const n=s.path(w.picture);return n===void 0?void 0:{picture:n}})():w.picture!==void 0||w.pattern?Ce(w.pattern,w.picture===void 0?void 0:{part:w.picture,...w.tile?{tile:w.tile}:{},...w.transparency===void 0?{}:{transparency:w.transparency}},s,ie):w.gradient?{gradient:ze(w.gradient)}:w.fill!==void 0?{fill:Y(w.fill)}:void 0:void 0;return{slide:{id:A,layout:e.layout,...e.hidden?{hidden:!0}:{},...W?{background:W}:{},...Object.keys(K).length>0?{shapes:K}:{},...te.length>0?{animations:te}:{},...e.transition?{transition:e.transition}:{},...e.advance===void 0?{}:{advance_after:e.advance},...e.section===void 0?{}:{section:e.section}},words:{id:A,...Object.keys(T).length>0?{text:T}:{},...Object.keys(y).length>0?{alt:y}:{},...e.notes===void 0?{}:{notes:e.notes}}}}const Un=e=>e==="title"||e==="ctrTitle"?"title":e==="dt"||e==="ftr"||e==="sldNum"?e:"body";function Ie(e,o){const i=p=>(p??[]).filter(x=>x.placeholder!==void 0),c=i(o.layout?.shapes).find(p=>p.placeholder?.idx===e.idx)??i(o.layout?.shapes).find(p=>p.placeholder?.type===e.type),s=Un(c?.placeholder?.type??e.type),a=i(o.master?.shapes).find(p=>p.placeholder?.type===s),l=_n(e.type),r=[c,a].filter(p=>p!==void 0);return{shapes:r,levels:[...r.map(p=>p.text?.levels??[]),o.master?.text_styles[l]??[],Oe[l]]}}export const PLACEHOLDER_UNMAPPED=!0;const lt=["word_wrap","auto_size","margin_left","margin_top","margin_right","margin_bottom"],Hn={margin_left:91440,margin_right:91440,margin_top:45720,margin_bottom:45720},Bn=["left","right","top","bottom"];function Gn(e){if(e===null)return"none";const o=Y(e.color);return Math.abs(e.width-12700)<=64?o:{color:o,width:F(e.width)}}function Wn(e,o){const i=e.text.vertical_anchor??"t",c=Pe(e.text.paragraphs,o,i==="t"?void 0:i)??{};Object.assign(c,De({...e.text,word_wrap:!0,auto_size:"none"},a=>a==="word_wrap"?!0:a==="auto_size"?"none":Hn[a]));const s={};for(const a of Bn){const l=e.borders?.[a];l!==void 0&&(s[a]=Gn(l))}return{...e.fill===void 0?{}:{fill:e.fill===null?"none":Y(e.fill)},...Object.keys(c).length>0?{text:c}:{},...Object.keys(s).length>0?{borders:s}:{}}}const _e=(e,o)=>JSON.stringify(e)===JSON.stringify(o);function Yn(e){const o=e[0];if(!o)return{};const i={};o.fill!==void 0&&e.every(c=>_e(c.fill,o.fill))&&(i.fill=o.fill);for(const c of["text","borders"]){const s={};for(const[a,l]of Object.entries(o[c]??{}))e.every(r=>_e(r[c]?.[a],l))&&(s[a]=l);Object.keys(s).length>0&&(i[c]=s)}return i}function Xn(e,o){const i={};e.fill!==void 0&&!_e(e.fill,o.fill)&&(i.fill=e.fill);for(const c of["text","borders"]){const s={};for(const[a,l]of Object.entries(e[c]??{}))_e(o[c]?.[a],l)||(s[a]=l);Object.keys(s).length>0&&(i[c]=s)}return i}function Kn(e){const{borders:o,...i}=e,c={...i};if(o){const{bottom:s,...a}=o;typeof s=="string"&&s!=="none"?c.line=s:s!==void 0&&(a.bottom=s),Object.keys(a).length>0&&(c.borders=a)}return c}function Zn(e,o){const i=[],c=[];for(let s=0;s<o;s++){const a=e.map(r=>r[s]??{}),l=a[0];if(l&&Object.keys(l).length>0&&a.every(r=>_e(r,l))){i[s]=l;continue}for(let r=0;r<a.length;){const p=a[r]??{};let x=1;for(;r+x<a.length&&_e(a[r+x],p);)x++;Object.keys(p).length>0&&c.push({row:r,column:s,...x>1?{rows:x}:{},...p}),r+=x}}return c.sort((s,a)=>Number(s.row)-Number(a.row)),{columnLooks:i,cells:c}}const Vn={none:"none",text:"shrink",shape:"grow"};function De(e,o){const i={},c=a=>{const l=e[a],r=o(a);return l===void 0?!1:typeof l=="number"&&typeof r=="number"?Math.abs(l-r)>64:l!==r};c("auto_size")&&e.auto_size!==void 0&&(i.autofit=Vn[e.auto_size]),c("word_wrap")&&e.word_wrap!==void 0&&(i.wrap=e.word_wrap);const s=["left","top","right","bottom"].filter(a=>c(`margin_${a}`));if(s.length>0){const a=r=>{const p=e[`margin_${r}`];return p===void 0?void 0:F(p)},l=["left","top","right","bottom"].map(a);if(s.length===4&&l.every(r=>r===l[0]))i.margin=l[0];else for(const r of s)i[`margin_${r}`]=a(r)}return e.columns!==void 0&&e.columns>1&&(i.columns=e.columns,e.column_spacing!==void 0&&e.column_spacing>0&&(i.column_spacing=F(e.column_spacing))),i}function qn(e,o,i,c,s,a){const l=s("cannot-hold"),{kind:r,placeholder:p,frame:x,rotation:v,flip:A,locked:Z,decorative:L,link:T,playback:y,part:u,crop:j,text:m,fill:P,fill_transparency:h,gradient:k,pattern:E,picture_fill:I,shadow:ee,inner_shadow:le,glow:N,soft_edges:$,reflection:ne,line:U,line_width:V,line_dash:K,line_cap:q,line_join:te,line_compound:w,line_begin:ie,line_end:W,line_begin_size:n,line_end_size:t,geometry:d,adjustments:f,group:O,path:g,table:z,chart:H}=e,S={};if(x&&(S.frame=en(x)),Object.assign(S,sn({...v===void 0?{}:{rotation:v},...A?{flip:A}:{},...Z?{locked:Z}:{},...L?{decorative:L}:{},...T===void 0?{}:{link:T},...y?{playback:y}:{}})),(r==="picture"||r==="movie"||r==="audio")&&u){const b=c.path(u);b?S[r==="picture"?"picture":r]=b:s("missing")("p:pic","its file is not in the file");const M=on(j);M&&(S.crop=M),r==="picture"&&Object.assign(S,qe(e.look))}if(m&&p?.type==="sldNum"&&Ln(m.paragraphs)&&l("a:fld",Tn),m){const b=flattened(m.paragraphs,m.levels),M=p?.type==="sldNum"?void 0:Le(b,Te(b));M!==void 0&&(a[o]=M);const se=i.shapes.map(B=>B.text?.orientation).find(B=>B!==void 0)??"horz",ue=Pe(b,l,m.vertical_anchor,i.levels,(m.orientation??se)===se?void 0:m.orientation);ue&&(S.text=ue)}if(m){const b=De(m,M=>i.shapes.map(se=>se.text?.[M]).find(se=>se!==void 0)??kn[M]);Object.keys(b).length>0&&(S.text={...S.text,...b})}const C=Ce(E,I,c,s);C?Object.assign(S,C):k?S.gradient=ze(k):P!==void 0&&(S.fill=P===null?"none":Y(P)),h!==void 0&&P&&(S.fill_transparency=h),ee&&(S.shadow=me(ee)),Object.assign(S,ge({inner_shadow:le,glow:N,soft_edges:$,reflection:ne})),U!==void 0&&(S.line=U===null?"none":Y(U)),U!==null&&(V!==void 0&&(S.line_width=F(V)),Object.assign(S,ke({...K===void 0?{}:{line_dash:K},...q===void 0?{}:{line_cap:q},...te===void 0?{}:{line_join:te},...w===void 0?{}:{line_compound:w},...ie===void 0?{}:{line_begin:ie},...W===void 0?{}:{line_end:W},...n===void 0?{}:{line_begin_size:n},...t===void 0?{}:{line_end_size:t}})));const X=i.shapes.find(b=>b.geometry!==void 0);return d!==void 0&&(d!==(X?.geometry??"rect")||JSON.stringify(f??null)!==JSON.stringify(X?.adjustments??null))&&(S.geometry=d,f?.length&&(S.adjustments=f.map(b=>Math.round(b*1e5)/1e5))),O!==void 0&&s("approximated")("p:grpSp","a placeholder in a group is the slide's, not the group's"),(g||z||H)&&l("p:ph","a placeholder of a freeform, a table or a chart"),S}function Qn(e,o,i,c,s,a){const l=c("cannot-hold"),{kind:r,frame:p,rotation:x,flip:v,locked:A,decorative:Z,link:L,playback:T,text:y,fill:u,fill_transparency:j,gradient:m,pattern:P,picture_fill:h,shadow:k,inner_shadow:E,glow:I,soft_edges:ee,reflection:le,line:N,line_width:$,line_dash:ne,line_cap:U,line_join:V,line_compound:K,line_begin:q,line_end:te,line_begin_size:w,line_end_size:ie,geometry:W,path:n,table:t,chart:d,adjustments:f,part:O,crop:g,text_color:z}=e;if(!p)return;Nn(y?.paragraphs??[])&&l("a:fld",Mn);const H={frame:en(p),...sn({...x===void 0?{}:{rotation:x},...v?{flip:v}:{},...A?{locked:A}:{},...Z?{decorative:Z}:{},...L===void 0?{}:{link:L},...T?{playback:T}:{}})},S=f?{adjustments:f.map(R=>Math.round(R*1e5)/1e5)}:{},C={...m?{gradient:ze(m)}:{},...k?{shadow:me(k)}:{},...ge({inner_shadow:E,glow:I,soft_edges:ee,reflection:le})};if(d){const R=On({...d.title===void 0?{}:{title:d.title},...Object.fromEntries(wn.flatMap(G=>{const oe=d[G]?.title;return oe===void 0?[]:[[G,oe]]}))}),ae={};d.series.forEach((G,oe)=>{const de=Object.fromEntries((G.point_labels??[]).flatMap(fe=>{const ye=d.categories[fe.index];return ye===void 0?[]:[[ye,fe.text]]}));Object.keys(de).length!==0&&(oe===0?Object.assign(ae,de):ae[G.name]=de)});const pe=Object.keys(ae).length===0?R:{...typeof R=="string"?{title:R}:R,points:ae};return pe!==void 0&&(s[o]=pe),{chart:xn(d,l),...H}}if(t){const R=t.rows.reduce((_,J)=>_+J.height,0),ae=t.rows.filter(_=>_.height<=0).length,pe=ae===0?0:Math.max(12700,(p.height-R)/ae),G=t.rows.map(_=>_.height>0?_:{..._,height:pe}),oe=G.reduce((_,J)=>_+J.height,0),de=G.map(_=>({..._,height:oe>0?_.height*p.height/oe:_.height})),fe=t.columns.map(F),ye=_=>Math.round(_.reduce((J,Q)=>J+Q,0)*100)/100,Re=de.flatMap((_,J)=>_.cells.flatMap((Q,he)=>{const D=Q.span_width??1,ce=Q.span_height??1;return Q.spanned||D*ce<2?[]:[{row:J,column:he,...ce>1?{rows:ce}:{},...D>1?{columns:D}:{}}]})),Je=de.map(_=>_.cells.map(J=>J.spanned?void 0:Wn(J,l))),Ue=Je.map((_,J)=>{const Q=Yn(_.filter(D=>D!==void 0)),he=(de[J]?.cells??[]).flatMap(D=>D.text.paragraphs.flatMap(ce=>ce.runs)).filter(D=>D.text.trim()!=="");return he.length>0&&he.every(D=>D.font?.bold===!0)&&(Q.text={...Q.text,bold:!0}),Q}),fn=Je.map((_,J)=>_.map(Q=>Q===void 0?{}:Xn(Q,Ue[J]??{}))),{columnLooks:cn,cells:He}=Zn(fn,fe.length),Me={table:{columns:fe.map((_,J)=>{const Q=cn[J];return Q?{width:_,...Q}:_}),rows:de.map((_,J)=>({height:F(_.height),...Kn(Ue[J]??{})})),...Re.length>0?{merged:Re}:{},...He.length>0?{cells:He}:{}},...H,frame:{...H.frame,w:ye(fe),h:ye(de.map(_=>F(_.height)))}},Be=["first_row","last_row","first_col","last_col","horz_banding","vert_banding"].filter(_=>t[_]===!0),Fe=yn(t.style);Fe&&(Fe.id!==Cn||Be.length>0)&&(Me.table.style=Fe.name);for(const _ of Be)Me.table[_]=!0;return s[o]=de.map(_=>_.cells.map(J=>{const he=_.cells.flatMap(D=>D.text.paragraphs.flatMap(ce=>ce.runs)).filter(D=>D.text.trim()!=="").every(D=>D.font?.bold===!0)?J.text.paragraphs.map(D=>({...D,runs:D.runs.map(ce=>{const Ge={...ce.font};return delete Ge.bold,{...ce,font:Ge}})})):J.text.paragraphs;return Le(he,Te(_.cells.flatMap(D=>D.text.paragraphs)))??""})),Me}if((r==="picture"||r==="movie"||r==="audio")&&O){const R=i.path(O);if(!R){c("missing")("p:pic","its file is not in the file: it is left out");return}const ae=r==="audio"?void 0:on(g),pe=r==="picture"&&W!==void 0&&W!=="rect"?{geometry:W,...S}:{},G=r==="picture"&&N!==void 0&&N!==null?{line:Y(N),...$===void 0?{}:{line_width:F($)},...ke({...ne===void 0?{}:{line_dash:ne},...U===void 0?{}:{line_cap:U},...V===void 0?{}:{line_join:V},...K===void 0?{}:{line_compound:K}})}:{};return{[r]:R,...H,...pe,...G,...ae?{crop:ae}:{},...r==="picture"?qe(e.look):{},...k?{shadow:me(k)}:{},...ge({inner_shadow:E,glow:I,soft_edges:ee,reflection:le})}}const X={...$===void 0||N===null?{}:{line_width:F($)},...ke({...ne===void 0?{}:{line_dash:ne},...U===void 0?{}:{line_cap:U},...V===void 0?{}:{line_join:V},...K===void 0?{}:{line_compound:K},...q===void 0?{}:{line_begin:q},...te===void 0?{}:{line_end:te},...w===void 0?{}:{line_begin_size:w},...ie===void 0?{}:{line_end_size:ie}})};if(!n&&W!==void 0&&pn(W))return N!=null&&$===void 0&&c("approximated")("a:ln@w","a line with no width of its own nor its style's is drawn at a connector's, 1 pt"),{geometry:W,...S,...H,...N===void 0||xe(N,Ye.line)?{}:{line:N===null?"none":Y(N)},...$===void 0||$===Ye.line_width?{}:{line_width:F($)},...ke({...ne===void 0?{}:{line_dash:ne},...U===void 0?{}:{line_cap:U},...V===void 0?{}:{line_join:V},...K===void 0?{}:{line_compound:K},...q===void 0?{}:{line_begin:q},...te===void 0?{}:{line_end:te},...w===void 0?{}:{line_begin_size:w},...ie===void 0?{}:{line_end_size:ie}}),...k?{shadow:me(k)}:{},...ge({inner_shadow:E,glow:I,soft_edges:ee,reflection:le}),...ge({inner_shadow:E,glow:I,soft_edges:ee,reflection:le})};const b=r==="textbox";b&&(n||W!==void 0&&W!=="rect")&&l(n?"a:custGeom":"a:prstGeom",`a text box's own shape (${W??"a freeform"}): a deck's text box is a rectangle`);const M=b?{textbox:!0,...H}:n?{path:{w:n.w,h:n.h,d:hn(n.steps)},...H}:{geometry:W??"rect",...S,...H},se=b?null:we.fill,ue=Ce(P,h,i,c);ue?Object.assign(M,ue,k?{shadow:me(k)}:{}):m?Object.assign(M,C):(u&&!xe(u,se)&&(M.fill=Y(u)),j!==void 0&&u&&(M.fill_transparency=j),u===null&&se!==null&&(M.fill="none"),k&&(M.shadow=me(k))),Object.assign(M,ge({inner_shadow:E,glow:I,soft_edges:ee,reflection:le}));const B=b?null:we.line;N!==void 0&&!xe(N,B)&&(M.line=N===null?"none":Y(N)),!b&&N!==null&&$!==void 0&&$!==we.line_width?Object.assign(M,X):N!==null&&Object.assign(M,ke({...ne===void 0?{}:{line_dash:ne},...U===void 0?{}:{line_cap:U},...V===void 0?{}:{line_join:V},...K===void 0?{}:{line_compound:K},...q===void 0?{}:{line_begin:q},...te===void 0?{}:{line_end:te},...w===void 0?{}:{line_begin_size:w},...ie===void 0?{}:{line_end_size:ie}})),b&&N!==void 0&&N!==null&&$!==void 0&&(M.line_width=F($)),!b&&N!==void 0&&N!==null&&$===void 0&&c("approximated")("a:ln@w","an outline with no width of its own nor its style's is drawn at an autoshape's, 0.5 pt");const re=b?$n:vn.autoshape,ve=y?.vertical_anchor===void 0||y.vertical_anchor===re.vertical_anchor?void 0:y.vertical_anchor,je=y?.orientation===void 0||y.orientation==="horz"?void 0:y.orientation,be=y?De(y,R=>re[R]):{};if(y){const R=flattened(y.paragraphs,y.levels),ae=Le(R,Te(R));ae!==void 0&&(s[o]=ae);const pe=R.map(oe=>{const de=z??a[oe.level]?.font?.color??Oe.other[oe.level]?.font?.color??"tx1";return{...oe,alignment:oe.alignment??a[oe.level]?.alignment??"l",runs:oe.runs.map(fe=>fe.font?.color!==void 0||fe.text==="\v"?fe:{...fe,font:{...fe.font,color:de}})}}),G=Pe(b?R:pe,l,ve,[a,Oe.other],je);G&&!b&&G.color===Y(we.font_color)&&delete G.color,G&&!b&&G.align===we.alignment&&delete G.align,G&&Object.keys(G).length>0&&(M.text=G)}return Object.keys(be).length>0&&(M.text={...M.text,...be}),M}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{SCRIPT_NAME as
|
|
2
|
+
import{SCRIPT_NAME as c}from"@allyhub/formats";export function nameOf(e,t,i){const r=o=>/^\d+$/u.test(o);if(c.test(e)&&!r(e)&&!t.has(e))return t.add(e),e;const n=e.normalize("NFKD").toLowerCase().replace(/[^a-z0-9_-]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,40)||i,d=r(n)?`${i||"shape"}-${n}`:n;let s=d;for(let o=2;t.has(s);o++)s=`${d}-${String(o)}`;return t.add(s),s}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{colorFile as
|
|
2
|
+
import{colorFile as g}from"@allyhub/formats";import{writeMarks as m}from"@allyhub/piece";import{EMU_PER_PT as p}from"@allyhub/slides-core";const a=e=>e.font?.color===void 0?void 0:g(e.font.color);export const lineOn=e=>e===!0?"true":typeof e=="string"?e:void 0;const l=e=>e.length>0&&(e[0]===void 0||e.some(i=>i!==e[0]));function x(e,i){const n=e.font,s=[],t=a(e);i.color&&t!==void 0&&s.push(`color="${t}"`),i.font&&n?.name!==void 0&&s.push(`font="${n.name}"`),i.size&&n?.size!==void 0&&s.push(`size="${String(Math.round(n.size/p*100)/100)}"`),n?.bold===!1&&s.push('bold="false"'),n?.italic===!1&&s.push('italic="false"');const u=lineOn(n?.underline);i.underline&&u!==void 0&&s.push(`underline="${u}"`),n?.link!==void 0&&s.push(`link="${n.link.replace(/"/gu,"%22")}"`),n?.highlight!==void 0&&s.push(`highlight="${n.highlight}"`),n?.baseline!==void 0&&n.baseline!==0&&s.push(`baseline="${String(Math.round(n.baseline*1e3)/1e3)}"`);const o=lineOn(n?.strike);return i.strike&&o!==void 0&&s.push(`strike="${o}"`),i.caps&&n?.caps!==void 0&&s.push(`caps="${n.caps}"`),n?.spacing!==void 0&&n.spacing!==0&&s.push(`spacing="${String(Math.round(n.spacing/p*100)/100)}"`),s.join(" ")}function c(e,i){const n=e.runs.map(o=>{const r=o.text.replace(/\r\n|\r|\n/gu,"\v");return r==="\v"?{text:r}:r===o.text?o:{...o,text:r}}),s=[];let t;const u=()=>{if(!t)return;const o=m(t.runs);s.push(t.span===""?o:`<span ${t.span}>${o}</span>`),t=void 0};for(const o of n){const r=x(o,i);t?.span!==r&&u(),t??={span:r,runs:[]},t.runs.push({text:o.text,...o.font?.bold===!0?{strong:!0}:{},...o.font?.italic===!0?{em:!0}:{}})}return u(),s.join("").replaceAll("\v","<br>")}export function wordsOf(e,i){const n=e.length===1&&!e.some(t=>t.runs.some(u=>u.text!==""))?[]:e;if(n.length===0)return;if(n.every(t=>t.level===0)){const t=n.map(u=>c(u,i));return t.length===1?t[0]:t}const s=(t,u)=>{const o=[];let r=t;for(;r<n.length;){const f=n[r];if(!f||f.level<u)break;if(f.level>u){const[d,h]=s(r,u+1);o.push(d),r=h;continue}o.push(c(f,i)),r++}return[o,r]};return s(0,0)[0]}export function variesIn(e){const i=e.flatMap(n=>n.runs).filter(n=>n.text.trim()!==""&&n.text!=="\v");return{color:new Set(i.map(n=>JSON.stringify(a(n)??null))).size>1,font:new Set(i.map(n=>n.font?.name??"")).size>1,size:new Set(i.map(n=>n.font?.size??0)).size>1,underline:l(i.map(n=>lineOn(n.font?.underline))),strike:l(i.map(n=>lineOn(n.font?.strike))),caps:l(i.map(n=>n.font?.caps))}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
export{filesOf,picturedShapes,pptxParts,writePptx}from"./write.js";export{readPptx}from"./read/index.js";export{importDeck}from"./import/index.js";export{nameOf}from"./import/names.js";export{variesIn,wordsOf}from"./import/script.js";export{asFace,eotOf,fontInfo,refusedEmbedding}from"./fonts.js";
|
|
2
|
+
export{faceHint,filesOf,picturedShapes,pptxParts,writePptx}from"./write.js";export{readPptx}from"./read/index.js";export{importDeck}from"./import/index.js";export{nameOf}from"./import/names.js";export{variesIn,wordsOf}from"./import/script.js";export{asFace,eotOf,fontInfo,refusedEmbedding}from"./fonts.js";export{eotFont,mtxFont,tableSum}from"./mtx.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
class J{at=0;b;constructor(t){this.b=t}bit(){const t=this.b[this.at>>3];if(t===void 0)throw new RangeError("past the end of the stream");const e=t>>7-(this.at&7)&1;return this.at++,e}bits(t){let e=0;for(let o=0;o<t;o++)e=e*2+this.bit();return e}}class j{up;left;right;code;weight;leaf;bits;constructor(t,e){this.bits=e;const o=2*t;this.up=new Int32Array(o),this.left=new Int32Array(o),this.right=new Int32Array(o),this.code=new Int32Array(o),this.weight=new Float64Array(o),this.leaf=new Int32Array(t);for(let s=2;s<o;s++)this.up[s]=s>>1,this.weight[s]=1;for(let s=1;s<t;s++)this.left[s]=2*s,this.right[s]=2*s+1;for(let s=0;s<t;s++)this.code[s]=-1,this.left[t+s]=-1,this.right[t+s]=-1,this.code[t+s]=s,this.leaf[s]=t+s;if(this.sum(1),t>256&&t<512){this.update(this.leaf[256]??0),this.update(this.leaf[257]??0);for(let s=0;s<12;s++)this.update(this.leaf[t-3]??0);for(let s=0;s<6;s++)this.update(this.leaf[t-2]??0)}else for(let s=0;s<2;s++)for(let r=0;r<t;r++)this.update(this.leaf[r]??0)}sum(t){if((this.code[t]??-1)>=0)return this.weight[t]??0;const e=this.sum(this.left[t]??0)+this.sum(this.right[t]??0);return this.weight[t]=e,e}swap(t,e){for(const s of[this.left,this.right,this.code]){const r=s[t]??0;s[t]=s[e]??0,s[e]=r}const o=this.weight[t]??0;this.weight[t]=this.weight[e]??0,this.weight[e]=o;for(const s of[t,e]){const r=this.code[s]??-1;r<0?(this.up[this.left[s]??0]=s,this.up[this.right[s]??0]=s):this.leaf[r]=s}}update(t){let e=t;for(;e!==1;){const o=this.weight[e]??0;let s=e-1;if(this.weight[s]===o){do s--;while(this.weight[s]===o);s++,s>1&&(this.swap(e,s),e=s)}this.weight[e]=o+1,e=this.up[e]??1}this.weight[1]=(this.weight[1]??0)+1}read(){let t=1;do t=(this.bits.bit()?this.right[t]:this.left[t])??0;while((this.code[t]??0)<0);const e=this.code[t]??0;return this.update(t),e}}const F=(()=>{const n=new Uint8Array(7168);let t=0;for(let e=0;e<32;e++)for(let o=0;o<96;o++)n[t++]=e,n[t++]=o;for(let e=0;e<256;e++)for(let o=0;o<4;o++)n[t++]=e;return n})();export function lzcomp(n,t=!0){const e=new J(n),o=t?e.bit()===1:!1,s=e.bits(24);let r=1;for(;8**r<s;)r++;const i=256+8*r,h=new j(i+3,e),u=new j(8,e),p=new j(8,e),a=new Uint8Array(F.length+s);a.set(F);let l=F.length;const y=F.length+s;for(;l<y;){const d=h.read();if(d<256)a[l++]=d;else if(d>=i){const b=2*(d-i+1);a[l]=a[l-b]??0,l++}else{const b=d-256,x=Math.floor(b/8)+1;let A=b%8,m=0;for(;m=m*4+(A&3),(A&4)!==0;)A=p.read();m+=2;let U=0;for(let B=0;B<x;B++)U=U*8+u.read();U+=1,U>=512&&(m+=1);const O=l-U-m+1;if(O<0||l+m>y)throw new RangeError("a copy outside");for(let B=0;B<m;B++)a[l++]=a[O+B]??0}}const g=a.subarray(F.length);if(!o)return g;const w=[],R=g[0]??0;for(let d=1;d<g.length;d++){const b=g[d]??0;if(b!==R)w.push(b);else{const x=g[++d]??0;if(x===0)w.push(R);else{const A=g[++d]??0;for(let m=0;m<x;m++)w.push(A)}}}return Uint8Array.from(w)}class I{at=0;b;constructor(t){this.b=t}get done(){return this.at>=this.b.length}u8(){const t=this.b[this.at++];if(t===void 0)throw new RangeError("past the end of the data");return t}u16(){return this.u8()*256+this.u8()}i16(){const t=this.u16();return t>=32768?t-65536:t}u255(){const t=this.u8();return t===253?this.u16():t===254?this.u8()+506:t===255?this.u8()+253:t}s255(){let t=this.u8();if(t===253)return this.i16();let e=1;return t===250&&(e=-1,t=this.u8()),t===255?e*(this.u8()+250):t===254?e*(this.u8()+500):e*t}bytes(t){if(this.at+t>this.b.length)throw new RangeError("past the end of the data");const e=this.b.subarray(this.at,this.at+t);return this.at+=t,e}}const K=Array.from({length:128},(n,t)=>{const e=o=>({xs:o&1?1:-1,ys:o&2?1:-1});if(t<10)return{bytes:1,xBits:0,yBits:8,dx:0,dy:256*(t>>1),xs:1,ys:t%2?1:-1};if(t<20)return{bytes:1,xBits:8,yBits:0,dx:256*(t-10>>1),dy:0,xs:(t-10)%2?1:-1,ys:1};if(t<84){const o=t-20;return{bytes:1,xBits:4,yBits:4,dx:1+16*(o>>4),dy:1+16*(o%16>>2),...e(o%4)}}if(t<120){const o=t-84;return{bytes:2,xBits:8,yBits:8,dx:1+256*Math.floor(o/12),dy:1+256*(o%12>>2),...e(o%4)}}return t<124?{bytes:3,xBits:12,yBits:12,dx:0,dy:0,...e(t-120)}:{bytes:4,xBits:16,yBits:16,dx:0,dy:0,...e(t-124)}});class k{out=[];get length(){return this.out.length}u8(t){this.out.push(t&255)}u16(t){this.u8(t>>8),this.u8(t)}u32(t){this.u16(Math.floor(t/65536)&65535),this.u16(t&65535)}bytes(t){for(const e of t)this.out.push(e)}pad(t){for(;this.out.length%t!==0;)this.out.push(0)}done(){return Uint8Array.from(this.out)}}function _(n,t){const e=new k;for(let o=0;o<n.length;o+=255){const s=n.slice(o,o+255),r=s.every(i=>i>=0&&i<=255);e.u8(r?64:65),e.u8(s.length);for(const i of s)r?e.u8(i):e.u16(i&65535)}return e.bytes(t),e.done()}function $(n,t){const e=[];for(;e.length<t;){const o=n.b[n.at];if(o===251||o===252){n.at++;const s=e[e.length-2]??0,r=n.s255();o===251?e.push(s,r,s):e.push(s,r,s,n.s255(),s)}else e.push(n.s255())}return e.slice(0,t)}function N(n,t,e,o){const s=[];for(let r=0;r<t;r++){let i=n.i16();const h=new k;if(i===0){s.push(new Uint8Array(0));continue}if(i===-1){h.u16(65535);for(let f=0;f<4;f++)h.u16(n.u16());let c=0;do{c=n.u16(),h.u16(c),h.u16(n.u16());const f=c&1?4:2,E=c&128?8:c&64?4:c&8?2:0;h.bytes(n.bytes(f+E))}while(c&32);if(c&256){const f=n.u255(),E=n.u255(),M=_($(e,f),o.bytes(E));h.u16(M.length),h.bytes(M)}h.pad(4),s.push(h.done());continue}let u;i===32767&&(i=n.i16(),u=[n.i16(),n.i16(),n.i16(),n.i16()]);const p=[];let a=-1;for(let c=0;c<i;c++)a=c===0?n.u255():a+n.u255(),p.push(a);const l=a+1,y=Array.from(n.bytes(l)),g=[],w=[];let R=0,d=0;for(const c of y){const f=K[c&127];if(!f)throw new RangeError("a flag past the table");let E=0;for(let v=0;v<f.bytes;v++)E=E*256+n.u8();const M=8*f.bytes,z=Math.floor(E/2**(M-f.xBits))%2**f.xBits,C=Math.floor(E/2**(M-f.xBits-f.yBits))%2**f.yBits;R+=f.xs*(z+f.dx),d+=f.ys*(C+f.dy),g.push(R),w.push(d)}const b=n.u255(),x=n.u255(),A=_($(e,b),o.bytes(x)),[m,U,O,B]=u??[Math.min(...g),Math.min(...w),Math.max(...g),Math.max(...w)];h.u16(i&65535);for(const c of[m,U,O,B])h.u16((c??0)&65535);for(const c of p)h.u16(c);h.u16(A.length),h.bytes(A);const T=[],V=[],G=(c,f,E,M)=>f===0?M:Math.abs(f)<256?(c.push(Math.abs(f)),E|(f>0?M:0)):(c.push(f),0),S=[],D={x:[],y:[]};let P=0,H=0;y.forEach((c,f)=>{const E=(g[f]??0)-P,M=(w[f]??0)-H;P=g[f]??0,H=w[f]??0;const z=T.length,C=V.length,v=((c&128)===0?1:0)|G(T,E,2,16)|G(V,M,4,32);D.x.push(T.length>z&&(v&2)===0),D.y.push(V.length>C&&(v&4)===0),S.push(v)});for(const c of S)h.u8(c);let W=0;S.forEach((c,f)=>{c&2?h.u8(T[W++]??0):D.x[f]&&h.u16((T[W++]??0)&65535)});let X=0;S.forEach((c,f)=>{c&4?h.u8(V[X++]??0):D.y[f]&&h.u16((V[X++]??0)&65535)}),h.pad(4),s.push(h.done())}return s}function Q(n){const t=n.u16(),e=new k;let o=0;for(let s=0;s<t;s++){const r=n.u8();let i;r<238?i=r:r===238?i=n.i16():r<248?i=-(238*(r-239)+n.u8()):i=238*(r-247)+n.u8(),o=((o+i)%65536+65536+32768)%65536-32768,e.u16(o&65535)}return e.done()}export function tableSum(n){let t=0;for(let e=0;e<n.length;e+=4)t=t+((n[e]??0)<<24|(n[e+1]??0)<<16|(n[e+2]??0)<<8|(n[e+3]??0))>>>0;return t}function Y(n,t=65536){const e=[...n.keys()].sort(),o=e.length;let s=0;for(;2**(s+1)<=o;)s++;const r=16*2**s,i=new k;i.u32(t),i.u16(o),i.u16(r),i.u16(s),i.u16(o*16-r);let h=12+16*o;const u=[];for(const l of e){const y=n.get(l)??new Uint8Array(0);for(let g=0;g<4;g++)i.u8(l.charCodeAt(g));i.u32(tableSum(y)),i.u32(h),i.u32(y.length),u.push({at:h,b:y}),h+=Math.ceil(y.length/4)*4}for(const l of u)i.bytes(l.b),i.pad(4);const p=i.done(),a=u[e.indexOf("head")];if(a){const l=2981146554-tableSum(p)>>>0;new DataView(p.buffer).setUint32(a.at+8,l)}return p}export function mtxFont(n){if(n.length<10||n[0]!==3)throw new RangeError("not MicroType Express 1.0");const t=x=>(n[x]??0)*65536+(n[x+1]??0)*256+(n[x+2]??0),e=t(4),o=t(7);if(!(e>=10&&e<=o&&o<=n.length))throw new RangeError("its blocks are not where it says");const s=(x,A)=>A>x?lzcomp(n.subarray(x,A)):new Uint8Array(0),r=s(10,e),i=new I(s(e,o)),h=new I(s(o,n.length)),u=q(r),p=u.get("maxp"),a=u.get("head"),l=u.get("glyf");if(!p||!a)throw new RangeError("it has no glyphs");if(!l){if(!u.has("CFF "))throw new RangeError("it has no glyphs");return L(u)}const y=(p[4]??0)*256+(p[5]??0),g=N(new I(l),y,i,h);if(!i.done||!h.done)throw new RangeError("its pushes and instructions are not its glyphs'");const w=new k,R=new k;for(const x of g)R.u32(w.length),w.bytes(x);R.u32(w.length);const d=a.slice();d[50]=0,d[51]=1,u.set("head",d),u.set("glyf",w.done()),u.set("loca",R.done());const b=u.get("cvt ");return b&&u.set("cvt ",Q(new I(b))),L(u)}function q(n){const t=new I(n);t.at=4;const e=t.u16();t.at=12;const o=new Map;for(let s=0;s<e;s++){const r=String.fromCharCode(...t.bytes(4));t.u16(),t.u16();const i=t.u16()*65536+t.u16(),h=t.u16()*65536+t.u16();if(i+h>n.length)throw new RangeError(`its ${r} is outside`);o.set(r,n.slice(i,i+h))}return o}function L(n){for(const o of["hdmx","VDMX","DSIG"])n.delete(o);for(const o of["fvar","gvar","avar","cvar","HVAR","VVAR","MVAR","STAT"])n.delete(o);const t=n.get("head");if(t){const o=t.slice();o.fill(0,8,12),n.set("head",o)}const e=n.get("cmap")?.slice();if(e){const o=new DataView(e.buffer),s=e.length>=4?o.getUint16(2):0;for(let r=0;r<s&&12+r*8<=e.length;r++){const i=o.getUint16(4+r*8),h=o.getUint32(8+r*8);if(i===1||h+12>e.length)continue;const u=o.getUint16(h);(u===12||u===13)&&o.setUint32(h+8,0)}n.set("cmap",e)}return Y(n,n.has("CFF ")?1330926671:65536)}export function eotFont(n){if(n.length<16)throw new RangeError("not an Embedded OpenType file");const t=new DataView(n.buffer,n.byteOffset,n.byteLength),e=t.getUint32(0,!0),o=t.getUint32(4,!0),s=t.getUint32(12,!0);if(t.getUint16(34,!0)!==20556)throw new RangeError("not an Embedded OpenType file");const r=Math.min(e,n.length);if(o>r)throw new RangeError("its font is not all there");let i=n.slice(r-o,r);return s&268435456&&(i=i.map(h=>h^80)),s&4?mtxFont(i):L(q(i))}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{as as
|
|
3
|
-
`),size:s[0]?.all("a:r")[0]?.one("a:rPr")?.attr("sz")}}function se(t,a,s=!0){for(const T of Xe)t.one(T)?.skip("an axis's id, place, ticks, crossing and label alignment: the deck draws its own");const r=t.one("c:scaling"),o=r?.one("c:min")?.attr("val"),b=r?.one("c:max")?.attr("val"),m=t.one("c:majorUnit")?.attr("val"),D=t.one("c:numFmt"),g=D?.attr("formatCode"),V=D?.attr("sourceLinked"),P=l(t.one("c:delete"))===!0,_=(T,z=!0)=>{const w=T?.one("a:ln"),E=w?.attr("w");return!P&&E!==void 0&&Math.abs(E-Me.gridWidth*Re)>64&&c(a,"approximated","c:spPr/a:ln@w",`an axis's or its gridlines' width is the deck's own, ${String(Me.gridWidth)} pt`),w?.one("a:noFill")&&!P&&z&&c(a,"cannot-hold","c:spPr/a:ln/a:noFill","an axis or its gridlines with no line: a deck draws them"),w?.one("a:round")?.skip("a chart line's join"),M(w?.one("a:solidFill"),a,"c:spPr")?.color},L=t.one("c:majorGridlines"),$=_(L?.one("c:spPr")),p=_(t.one("c:spPr"),s),k=t.one("c:title"),{text:R}=De(k);return k?.one("c:overlay")?.attr("val"),k?.one("c:layout")?.skip("an axis title's own place"),k&&R===""&&c(a,"cannot-hold","c:title","an axis's automatic title: a deck's axis title is words of its own"),{...R===""?{}:{title:R},...o===void 0?{}:{minimum_scale:o},...b===void 0?{}:{maximum_scale:b},...m===void 0?{}:{major_unit:m},has_major_gridlines:L!==void 0,...P?{visible:!1}:{},...g===void 0||g==="General"||V===!0?{}:{number_format:g},...r?.one("c:orientation")?.attr("val")==="maxMin"?{reverse_order:!0}:{},...$===void 0?{}:{gridline_color:$},...p===void 0?{}:{line_color:p}}}export function chartOf(t,a){const s=a.read.pkg,r=s.open(t);if(!r)return"its part is not in the file";const o={...a,part:t};r.one("c:date1904")?.attr("val"),r.one("c:lang")?.skip("a chart's language"),r.one("c:style")?.skip("a chart's style number: its colours are read where it sets them"),r.one("c:roundedCorners")?.attr("val")===!0&&c(o,"cannot-hold","c:roundedCorners","a chart's rounded corners"),r.one("c:printSettings")?.skip("a chart's print settings");const b=r.one("c:externalData");if(b){const e=s.rel(t,b.attr("r:id"));e&&!e.external&&s.leave(e.target,"a chart's workbook: the deck writes one from its numbers"),b.one("c:autoUpdate")?.attr("val")}const m=r.one("c:chart"),D=l(m?.one("c:autoTitleDeleted"));m?.one("c:plotVisOnly")?.attr("val"),m?.one("c:showDLblsOverMax")?.skip("labels over a chart's maximum"),m?.one("c:dispBlanksAs")?.skip("how a chart draws a blank value");const g=m?.one("c:plotArea");g?.one("c:layout")?.skip("a chart's plot area's own layout");const V=e=>e?.kids().find(n=>n.key==="c:spPr");for(const e of[V(r),V(g)]){const n=e?.kids()??[];n.some(i=>i.key==="a:noFill")&&n.every(i=>i.key==="a:noFill"||i.key==="a:ln"&&i.kids().length===1&&i.kids()[0]?.key==="a:noFill")&&e?.consume()}const P=(g?.kids()??[]).filter(e=>e.key.endsWith("Chart")),_=e=>(r.consume(),e);if(P.length===0)return _("it has no plot");const L=e=>e.all("c:ser"),$=e=>{const n=e.key,h=L(e),i=e.one("c:grouping")?.attr("val"),y=i==="percentStacked"?"-stacked-100":i==="stacked"?"-stacked":"",u=h.map(x=>x.one("c:marker")?.one("c:symbol")?.attr("val")).some(x=>x!=="none");if(e.one("c:marker"),n==="c:barChart")return`${e.one("c:barDir")?.attr("val")==="bar"?"bar":"column"}${y===""?"-clustered":y}`;if(n==="c:lineChart")return y===""?u?"line-markers":"line":void 0;if(n==="c:areaChart")return`area${y}`;if(n==="c:pieChart")return"pie";if(n==="c:doughnutChart")return"doughnut";if(n==="c:scatterChart"){Ie(e).one("c:scatterStyle")?.attr("val");const x=h.every(A=>A.one("c:spPr")?.one("a:ln")?.el.children.some(H=>H.local==="noFill")),K=h.every(A=>l(A.one("c:smooth"))===!0);return x?"scatter":K&&!u?"scatter-smooth":"scatter-lines"}};for(const e of P){e.use();for(const n of e.all("c:axId"))n.attr("val")}const p=g?.all("c:valAx")??[],k=g?.all("c:catAx")??[],R=e=>e.all("c:axId").map(n=>n.attr("val")),T=e=>e.one("c:axId")?.attr("val"),z=e=>n=>R(e).includes(T(n)??-1),w=P.length>1,E=e=>w&&p.some(n=>z(e)(n)&&n.one("c:axPos")?.attr("val")==="r"),N=P.map(e=>({plot:e,type:$(e),secondary:E(e)}));if(w&&N.some(e=>e.type===void 0||!Be(e.type)))return _("it combines several kinds of chart, not columns, lines and areas");const ce=e=>Math.min(...L(e).map((n,h)=>n.one("c:order")?.attr("val")??h),1/0),q=N.filter(e=>!e.secondary).sort((e,n)=>ce(e.plot)-ce(n.plot))[0]??N[0];if(!q)return _("it has no plot");const f=q.plot,ie=f.key,j=q.type;if(!j)return _(`a deck has no ${ie.slice(2)} chart`);const le=N.flatMap(e=>L(e.plot).map(n=>({ser:n,of:e}))).map((e,n)=>({...e,order:e.ser.one("c:order")?.attr("val")??n})).sort((e,n)=>e.order-n.order),J=le.map(e=>e.ser),de=[];if(J.length===0)return _("it has no series");const C=ie==="c:scatterChart",[ue]=J,Ve=C?void 0:ue?.one("c:cat"),Q=X(ae(Ve)),$e=le.map(({ser:e,of:n})=>{const h=n.plot.key;e.one("c:idx")?.attr("val"),e.one("c:order")?.attr("val"),e!==ue&&!C&&ae(e.one("c:cat"))?.consume();const i=Ie(e),y=He(C?i.one("c:yVal"):e.one("c:val")),u=y?.one("c:formatCode")?.text()??"",x=X(y),K=C?ae(i.one("c:xVal")):void 0;K?.one("c:formatCode");const A=C?X(K):void 0,H=A?Math.max(A.length,x.length):Q.length,F=e.one("c:spPr"),Ce=M(F?.one("a:solidFill"),o,"c:spPr")?.color??M(F?.one("a:ln")?.one("a:solidFill"),o,"c:spPr")?.color,Se=l(e.one("c:smooth")),Ae=F?.one("a:ln")?.attr("w");F?.one("a:ln")?.one("a:noFill"),F?.one("a:ln")?.one("a:round")?.skip("a chart line's join"),Te(j)&&F?.one("a:ln")?.consume();const ze=e.one("c:marker"),Le=ze?.one("c:size")?.attr("val");ze?.one("c:spPr")?.consume(),l(e.one("c:invertIfNegative"))&&c(o,"cannot-hold","c:invertIfNegative","a bar of a negative value drawn in the inverse of its colour");const Ne=[];for(const O of e.all("c:dPt")){const I=O.one("c:idx")?.attr("val"),v=O.one("c:spPr"),Oe=M(v?.one("a:solidFill"),o,"c:spPr")?.color;I===void 0||Oe===void 0||(Ne[I]=Oe,l(O.one("c:invertIfNegative"))&&c(o,"cannot-hold","c:dPt/c:invertIfNegative","a bar of a negative value drawn in the inverse of its colour"),O.one("c:bubble3D")?.attr("val"),Te(j)&&v?.one("a:ln")?.consume())}de.push(Ne);const Fe=e.one("c:tx");return{name:Ke(X(je(Fe?.one("c:strRef")))[0]??Fe?.one("c:v")?.text(),`Series ${String(J.indexOf(e)+1)}`),values:Array.from({length:H},(O,I)=>{const v=x[I];return v===void 0||v===""?null:Number(v)}),...A?{x:Array.from({length:H},(O,I)=>{const v=A[I];return v===void 0||v===""?null:Number(v)})}:{},...u===""||u==="General"?{}:{number_format:u},...Ce===void 0?{}:{color:Ce},...Se===!0?{smooth:Se}:{},...Ae===void 0||h!=="c:lineChart"&&!C?{}:{line_width:Ae/Re},...Le===void 0?{}:{marker_size:Le},...n.type!==void 0&&n.type!==j?{type:n.type}:{},...n.secondary?{secondary:!0}:{}}}),U=m?.one("c:title"),{text:Y,size:fe}=De(U);U&&Y===""&&D!==!0&&c(o,"cannot-hold","c:title","a chart's automatic title (its series' name): a deck's chart title is words of its own"),l(U?.one("c:overlay"))===!0&&c(o,"cannot-hold","c:title/c:overlay","a chart's title drawn over its plot"),U?.one("c:layout")?.skip("a chart title's own place");const W=m?.one("c:legend"),B=W?.one("c:legendPos")?.attr("val");l(W?.one("c:overlay"))===!0&&c(o,"cannot-hold","c:legend/c:overlay","a chart's legend drawn over its plot"),W?.one("c:layout")?.skip("a legend's own place");const he=re(W?.one("c:txPr"))?.attr("sz"),Ee={b:"bottom",t:"top",l:"left",r:"right"}[B==="b"||B==="t"||B==="l"?B:"r"],S=f.one("c:dLbls"),d=e=>l(S?.one(e))===!0;l(S?.one("c:showLegendKey"))===!0&&c(o,"cannot-hold","c:showLegendKey","a chart's labels with their legend keys"),S?.one("c:showBubbleSize")?.attr("val"),l(S?.one("c:showLeaderLines"))===!0&&(d("c:showVal")||d("c:showPercent")||d("c:showCatName")||d("c:showSerName"))&&c(o,"cannot-hold","c:showLeaderLines","lines from a chart's labels to their points");const me=S?.one("c:numFmt")?.attr("formatCode"),pe=S?.one("c:dLblPos")?.attr("val"),ve=re(S?.one("c:txPr")),ge=ve?.attr("sz"),ke=M(ve?.one("a:solidFill"),o,"c:dLbls")?.color,Z=f.one("c:gapWidth")?.attr("val"),ee=f.one("c:overlap")?.attr("val"),we=f.one("c:holeSize")?.attr("val"),ye=l(f.one("c:varyColors"));f.one("c:varyColors")?.attr("val");const te=f.one("c:firstSliceAng")?.attr("val");te!==void 0&&te!==0&&c(o,"cannot-hold","c:firstSliceAng",`a round chart's first slice turned ${String(te)}°`);const xe=re(r.one("c:txPr")),ne=xe?.attr("sz");he!==void 0&&he!==ne&&c(o,"cannot-hold","c:legend/c:txPr","a legend's own text size: a chart's text is one size");const be=M(xe?.one("a:solidFill"),o,"c:txPr")?.color;for(const{plot:e}of N){if(e===f)continue;const n=u=>e.one(u)?.attr("val");n("c:gapWidth")!==void 0&&n("c:gapWidth")!==Z&&c(o,"cannot-hold","c:gapWidth","a combination chart's plot's own gap width: its plots share the first's"),n("c:overlap")!==void 0&&n("c:overlap")!==ee&&c(o,"cannot-hold","c:overlap","a combination chart's plot's own overlap: its plots share the first's"),e.one("c:varyColors")?.attr("val"),e.one("c:barDir")?.attr("val"),e.one("c:grouping")?.attr("val");const h=e.one("c:dLbls"),i=u=>l(h?.one(u))===!0,y=["c:showVal","c:showPercent","c:showCatName","c:showSerName"].some(u=>i(u)!==d(u));h?.consume(),y&&c(o,"cannot-hold","c:dLbls","a combination chart's plot's own data labels: its plots share the first's")}const Pe=C?p[1]:w?p.find(z(f))??p[0]:p[0],oe=C?p[0]:w?k.find(z(f))??k[0]:k[0],G=N.find(e=>e.secondary)?.plot,_e=G?p.find(e=>z(G)(e)&&e.one("c:axPos")?.attr("val")==="r"):void 0;for(const e of k)e===oe||!G||!z(G)(e)||(l(e.one("c:delete"))!==!0&&c(o,"cannot-hold","c:catAx","a second category axis that shows: a deck's second value axis crosses a hidden one"),e.consume());return{type:j,categories:Q,series:$e,...Y===""?{}:{title:Y},...W?{legend:Ee}:{},...S&&(d("c:showVal")||d("c:showPercent")||d("c:showCatName")||d("c:showSerName"))?{labels:{show_value:d("c:showVal"),show_percentage:d("c:showPercent"),show_category_name:d("c:showCatName"),show_series_name:d("c:showSerName"),...me===void 0?{}:{number_format:me},...pe===void 0?{}:{position:pe},...ge===void 0?{}:{size:ge/100},...ke===void 0?{}:{color:ke}}}:{},...Z===void 0?{}:{gap_width:Number(Z)},...ee===void 0?{}:{overlap:Number(ee)},...we===void 0?{}:{hole_size:Number(we)},...ye===void 0?{}:{vary_by_categories:ye},...Ge(de,Q.length),...Pe?{value_axis:se(Pe,o,!1)}:{},...oe?{category_axis:se(oe,o)}:{},..._e?{secondary_axis:se(_e,o,!1)}:{},...ne===void 0?{}:{font_size:ne/100},...fe===void 0?{}:{title_size:fe/100},...be===void 0?{}:{font_color:be}}}
|
|
2
|
+
import{as as q}from"@allyhub/ooxml";import{accentOf as yn,acrossFrom as wn,CHART_DEFAULTS as sn,EMU_PER_PT as cn,hasMarkers as xn,isCombinable as _n,isLine as Pn,isRound as te}from"@allyhub/slides-core";import{colorAt as T,say as u}from"./common.js";const Se={"c:bar3DChart":"c:barChart","c:line3DChart":"c:lineChart","c:pie3DChart":"c:pieChart","c:area3DChart":"c:areaChart","c:ofPieChart":"c:pieChart"},fe=n=>Se[n]??n;function Cn(n,r){const a=n.key;if(Se[a]===void 0)return;const s=n;if(a==="c:ofPieChart"){u(r,"approximated","c:ofPieChart","a pie of pie or a bar of pie is one pie, its second plot's slices in it");for(const i of["c:ofPieType","c:splitType","c:splitPos","c:custSplit","c:secondPieSize","c:serLines","c:gapWidth"])s.one(i)?.consume();return}const t={"c:bar3DChart":"column or bar","c:line3DChart":"line","c:pie3DChart":"pie","c:area3DChart":"area"}[a];u(r,"approximated",a,`a 3-D ${t??"chart"} chart is its 2-D kind`);for(const i of["c:gapDepth","c:shape"])s.one(i)?.consume();for(const i of s.all("c:ser"))i.one("c:shape")?.consume()}function Ln(n,r){const a=n.find(s=>s.some(t=>t!==void 0));return a?{category_colors:Array.from({length:r>0?r:a.length},(s,t)=>a[t]??yn(t))}:{}}const Sn=(n,r)=>n===void 0||n===""?r:n,g=n=>n===void 0?void 0:n.attr("val")??!0,J=n=>{n?.one("c:ptCount")?.attr("val");const r=[];for(const a of n?.all("c:pt")??[])r[a.attr("idx")??r.length]=a.one("c:v")?.text()??"";return Array.from(r,a=>a??"")};function ze(n){return n?.one("c:f")?.skip("a series' formula into its workbook: the deck writes its own"),n?.one("c:strCache")}function ln(n){return n?.one("c:f")?.skip("a series' formula into its workbook: the deck writes its own"),n?.one("c:numCache")}function he(n){return ze(n?.one("c:strRef"))??ln(n?.one("c:numRef"))??n?.one("c:strLit")??n?.one("c:numLit")}function Ne(n){return ln(n?.one("c:numRef"))??n?.one("c:numLit")}function zn(n,r){const a=q(n).all("c:ser"),s=[];for(const t of a){const i=t.all("c:errBars"),l=i[0]?.one("c:errDir")?.attr("val"),w=t.one("c:marker")?.one("c:symbol")?.attr("val"),c=i.length===1&&l==="x"?"actual":i.length===1&&l==="y"?"target":i.length>0?void 0:t.one("c:tx")===void 0&&w==="none"?"join":w!=="none"?"dot":void 0;if(c===void 0)return;const L=t.one("c:tx"),d=L?.one("c:v")?.text()??J(ze(L?.one("c:strRef"))).join(" "),x=J(he(t.one("c:xVal"))).map(f=>f===""||!Number.isFinite(Number(f))?null:Number(f)),D=c==="dot"?t.one("c:marker")?.one("c:spPr")?.one("a:solidFill"):i[0]?.one("c:spPr")?.one("a:ln")?.one("a:solidFill"),p=D?T(D,r,"c:ser"):void 0,_=t.one("c:marker")?.one("c:size")?.attr("val");s.push({kind:c,name:d,values:x,...p?{color:p.color}:{},...p&&p.alpha<1?{transparency:1-p.alpha}:{},...c==="dot"&&_!==void 0?{marker_size:_}:{}})}return s}const Nn=["c:axId","c:crossAx","c:axPos","c:crossBetween","c:auto","c:lblAlgn","c:lblOffset","c:noMultiLvlLbl"];function dn(n){const r=n?.one("c:crossesAt")?.attr("val");if(r!==void 0)return{crosses_at:r};const a=n?.one("c:crosses")?.attr("val");return a==="min"||a==="max"?{crosses:a}:{}}function An(n){if(!n)return;if(n.alpha>=1)return n.color;const r={name:"alpha",value:Math.round(n.alpha*1e3)/1e3},a=n.color;return typeof a=="string"?{theme_color:a,transforms:[r]}:"rgb"in a?{rgb:a.rgb,transforms:[...a.transforms??[],r]}:"transforms"in a?{theme_color:a.theme_color,transforms:[...a.transforms,r]}:a}function oe(n){n?.one("a:bodyPr")?.skip("a chart text's body: the deck sets its own"),n?.one("a:lstStyle")?.skip("a chart text's list style");const r=n?.all("a:p")[0];return r?.one("a:endParaRPr")?.skip("the font of a paragraph's end"),r?.one("a:pPr")?.one("a:defRPr")}function un(n,r){const a=d=>g(n.one(d))===!0;g(n.one("c:showLegendKey"))===!0&&u(r,"cannot-hold","c:showLegendKey","a chart's labels with their legend keys"),n.one("c:showBubbleSize")?.attr("val"),n.one("c:showLeaderLines")?.attr("val");const s=n.one("c:numFmt")?.attr("formatCode");n.one("c:numFmt")?.attr("sourceLinked");const t=n.one("c:dLblPos")?.attr("val"),i=oe(n.one("c:txPr")),l=i?.attr("sz"),w=i?.attr("b"),c=T(i?.one("a:solidFill"),r,"c:dLbls")?.color;if(a("c:showVal")||a("c:showPercent")||a("c:showCatName")||a("c:showSerName"))return{show_value:a("c:showVal"),show_percentage:a("c:showPercent"),show_category_name:a("c:showCatName"),show_series_name:a("c:showSerName"),...s===void 0?{}:{number_format:s},...t===void 0?{}:{position:t},...l===void 0?{}:{size:l/100},...w===void 0?{}:{bold:w},...c===void 0?{}:{color:c}}}function Dn(n,r,a){if(!n)return{};const s=[],t=[];let i;for(const c of n.all("c:dLbl")){const L=c.one("c:idx")?.attr("val");if(g(c.one("c:delete"))===!0||L===void 0){c.consume();continue}const d=c.one("c:tx")?.one("c:rich");if(d){d.one("a:bodyPr")?.skip("a data label's body: the deck sets its own"),d.one("a:lstStyle")?.skip("a data label's list style");const D=d.all("a:p").map(b=>(b.one("a:pPr")?.consume(),b.one("a:endParaRPr")?.consume(),b.all("a:r").map(N=>(N.one("a:rPr")?.consume(),N.one("a:t")?.text()??"")).join(""))).join(`
|
|
3
|
+
`),p=c.one("c:layout")?.one("c:manualLayout"),_=p?.one("c:x")?.attr("val"),f=p?.one("c:y")?.attr("val");p?.one("c:xMode")?.attr("val"),p?.one("c:yMode")?.attr("val");const F=c.one("c:dLblPos")?.attr("val");oe(c.one("c:txPr"))?.consume();for(const b of["c:showLegendKey","c:showVal","c:showCatName","c:showSerName","c:showPercent","c:showBubbleSize"])c.one(b)?.attr("val");s.push({index:L,text:D,position:F==="b"||F==="l"||F==="r"?F:"t",..._===void 0||_===0?{}:{dx:_},...f===void 0||f===0?{}:{dy:f}});continue}c.one("c:layout")?.skip("a data label's own place");const x=un(c,r);x&&(t.push(L),i??=x)}const l=un(n,r),w=s.length>0?{point_labels:s}:{};return l?JSON.stringify(l)!==JSON.stringify(a)&&(w.labels=l):t.length>0&&i?w.labels={...i,points:t}:a&&(w.labels=null),w}function fn(n){const r=n?.one("c:tx")?.one("c:rich");r?.one("a:bodyPr")?.skip("a chart title's text body"),r?.one("a:lstStyle");const a=r?.all("a:p")??[];return{text:a.map(t=>t.all("a:r").map(i=>i.one("a:t")?.text()??"").join("")).join(`
|
|
4
|
+
`),size:a[0]?.all("a:r")[0]?.one("a:rPr")?.attr("sz")}}function Ae(n,r,a=!0){for(const H of Nn)n.one(H)?.skip("an axis's id, place, ticks, crossing and label alignment: the deck draws its own");const s=n.one("c:scaling"),t=s?.one("c:min")?.attr("val"),i=s?.one("c:max")?.attr("val"),l=n.one("c:majorUnit")?.attr("val"),w=n.one("c:numFmt"),c=w?.attr("formatCode"),L=w?.attr("sourceLinked"),d=g(n.one("c:delete"))===!0,x=(H,ee=!0)=>{const B=H?.one("a:ln"),S=B?.attr("w");return!d&&S!==void 0&&Math.abs(S-sn.gridWidth*cn)>64&&u(r,"approximated","c:spPr/a:ln@w",`an axis's or its gridlines' width is the deck's own, ${String(sn.gridWidth)} pt`),B?.one("a:noFill")&&!d&&ee&&u(r,"cannot-hold","c:spPr/a:ln/a:noFill","an axis or its gridlines with no line: a deck draws them"),B?.one("a:round")?.skip("a chart line's join"),An(T(B?.one("a:solidFill"),r,"c:spPr"))},D=n.one("c:majorGridlines"),p=x(D?.one("c:spPr")),_=x(n.one("c:spPr"),a),f=n,F=f.one("c:majorTickMark")?.attr("val"),b=f.one("c:minorTickMark")?.attr("val"),N=f.one("c:tickLblPos")?.attr("val"),Q=Fn(f.one("c:txPr"))?.attr("rot"),ae=s?.one("c:logBase")?.attr("val"),R=f.one("c:minorUnit")?.attr("val"),E=f.one("c:minorGridlines");x(E?.one("c:spPr"));const Y=f.one("c:dispUnits"),W=Y?.one("c:builtInUnit")?.attr("val");Y?.one("c:custUnit")&&u(r,"cannot-hold","c:custUnit","an axis's own display unit");const Z=Y?.one("c:dispUnitsLbl");Z?.consume();const $=n.one("c:tickLblSkip")?.attr("val");n.one("c:tickMarkSkip")?.skip("an axis's tick marks' interval: a deck marks every category"),f.one("c:crosses")?.attr("val"),f.one("c:crossesAt")?.attr("val");const y=d?{}:{...N===void 0||N==="nextTo"?{}:{tick_label_position:N},...F===void 0||F==="none"?{}:{major_tick_mark:F},...b===void 0||b==="none"?{}:{minor_tick_mark:b},...Q===void 0||Q===0?{}:{label_angle:Math.round(Q/6e4)},...ae===void 0?{}:{log_base:ae},...R===void 0?{}:{minor_unit:R},...E?{has_minor_gridlines:!0}:{},...W===void 0?{}:{display_units:W,...Z?{}:{display_units_label:!1}},...$===void 0||$===1?{}:{label_interval:$}},M=n.one("c:title"),{text:k}=fn(M);return M?.one("c:overlay")?.attr("val"),M?.one("c:layout")?.skip("an axis title's own place"),M&&k===""&&u(r,"cannot-hold","c:title","an axis's automatic title: a deck's axis title is words of its own"),{...k===""?{}:{title:k},...t===void 0?{}:{minimum_scale:t},...i===void 0?{}:{maximum_scale:i},...l===void 0?{}:{major_unit:l},has_major_gridlines:D!==void 0,...d?{visible:!1}:{},...c===void 0||c==="General"||L===!0?{}:{number_format:c},...s?.one("c:orientation")?.attr("val")==="maxMin"?{reverse_order:!0}:{},...p===void 0?{}:{gridline_color:p},..._===void 0?{}:{line_color:_},...y}}function Fn(n){const r=n?.one("a:bodyPr");r?.ignore(["spcFirstLastPara","vertOverflow","horzOverflow","vert","wrap","anchor","anchorCtr"],"a chart text's body: the deck sets its own"),n?.one("a:lstStyle")?.skip("a chart text's list style");for(const a of n?.all("a:p")??[])a.skip("an axis's own text look: a chart's text is one size and colour");return r}export function chartOf(n,r){const a=r.read.pkg,s=a.open(n);if(!s)return"its part is not in the file";const t={...r,part:n};s.one("c:date1904")?.attr("val"),s.one("c:lang")?.skip("a chart's language"),s.one("c:style")?.skip("a chart's style number: its colours are read where it sets them"),s.one("c:roundedCorners")?.attr("val")===!0&&u(t,"cannot-hold","c:roundedCorners","a chart's rounded corners"),s.one("c:printSettings")?.skip("a chart's print settings");const i=s.one("c:externalData");if(i){const e=a.rel(n,i.attr("r:id"));e&&!e.external&&a.leave(e.target,"a chart's workbook: the deck writes one from its numbers"),i.one("c:autoUpdate")?.attr("val")}const l=s.one("c:chart"),w=g(l?.one("c:autoTitleDeleted"));l?.one("c:plotVisOnly")?.attr("val"),l?.one("c:showDLblsOverMax")?.skip("labels over a chart's maximum"),l?.one("c:dispBlanksAs")?.skip("how a chart draws a blank value");const c=l?.one("c:plotArea");c?.one("c:layout")?.skip("a chart's plot area's own layout");const L=e=>e?.kids().find(o=>o.key==="c:spPr");for(const e of[L(s),L(c)]){const o=e?.kids()??[];o.some(m=>m.key==="a:noFill")&&o.every(m=>m.key==="a:noFill"||m.key==="a:ln"&&m.kids().length===1&&m.kids()[0]?.key==="a:noFill")&&e?.consume()}const d=(c?.kids()??[]).filter(e=>e.key.endsWith("Chart")),x=e=>(s.consume(),e);if(d.length===0)return x("it has no plot");const[D,p]=d,_=d.length===2&&D?.key==="c:barChart"&&D.one("c:barDir")?.attr("val")==="bar"&&p?.key==="c:scatterChart"?zn(p,t):void 0;if(_&&p){const e=p.all("c:axId").map(o=>o.attr("val"));for(const o of c?.all("c:valAx")??[])e.includes(o.one("c:axId")?.attr("val")??-1)&&o.consume();p.consume(),d.pop();for(const o of l?.one("c:legend")?.all("c:legendEntry")??[])o.consume()}const f=e=>e.all("c:ser"),F=e=>{const o=fe(e.key),h=f(e),m=e.one("c:grouping")?.attr("val"),I=m==="percentStacked"?"-stacked-100":m==="stacked"?"-stacked":"",U=h.map(O=>O.one("c:marker")?.one("c:symbol")?.attr("val")),C=U.length>0&&U.every(O=>O!=="none");if(e.one("c:marker"),o==="c:barChart")return`${e.one("c:barDir")?.attr("val")==="bar"?"bar":"column"}${I===""?"-clustered":I}`;if(o==="c:lineChart")return I===""?C?"line-markers":"line":void 0;if(o==="c:areaChart")return`area${I}`;if(o==="c:pieChart")return"pie";if(o==="c:doughnutChart")return"doughnut";if(o==="c:scatterChart"){q(e).one("c:scatterStyle")?.attr("val");const O=h.every(G=>G.one("c:spPr")?.one("a:ln")?.el.children.some(j=>j.local==="noFill")),X=h.every(G=>g(G.one("c:smooth"))===!0);return O?"scatter":X&&!C?"scatter-smooth":"scatter-lines"}if(o==="c:radarChart")return q(e).one("c:radarStyle")?.attr("val")==="filled"?"radar-filled":C?"radar-markers":"radar";if(o==="c:bubbleChart")return"bubble";if(o==="c:stockChart")return h.length>=4&&q(e).one("c:upDownBars")!==void 0?"stock-ohlc":"stock-hlc"};for(const e of d){e.use();for(const o of e.all("c:axId"))o.attr("val");Cn(e,t)}if(d.some(e=>Se[e.key]!==void 0)){for(const e of["c:view3D","c:floor","c:sideWall","c:backWall"])l?.one(e)?.consume();for(const e of c?.all("c:serAx")??[])e.consume()}const b=c?.all("c:valAx")??[],N=c?.all("c:catAx")??[],Q=e=>e.all("c:axId").map(o=>o.attr("val")),ae=e=>e.one("c:axId")?.attr("val"),R=e=>o=>Q(e).includes(ae(o)??-1),E=d.length>1,Y=e=>E&&b.some(o=>R(e)(o)&&o.one("c:axPos")?.attr("val")==="r"),W=d.map(e=>({plot:e,type:F(e),secondary:Y(e)}));if(E&&W.some(e=>e.type===void 0||!_n(e.type)))return x("it combines several kinds of chart, not columns, lines and areas");const Z=e=>Math.min(...f(e).map((o,h)=>o.one("c:order")?.attr("val")??h),1/0),$=W.filter(e=>!e.secondary).sort((e,o)=>Z(e.plot)-Z(o.plot))[0]??W[0];if(!$)return x("it has no plot");const y=$.plot,M=fe(y.key),k=$.type;if(!k)return x(`a deck has no ${M.slice(2)} chart`);const H=W.flatMap(e=>f(e.plot).map(o=>({ser:o,of:e}))).map((e,o)=>({...e,order:e.ser.one("c:order")?.attr("val")??o})).sort((e,o)=>e.order-o.order),ee=H.map(e=>e.ser),B=[];if(ee.length===0)return x("it has no series");const S=M==="c:scatterChart"||M==="c:bubbleChart",De=M==="c:bubbleChart",[Fe]=ee,hn=S?void 0:Fe?.one("c:cat"),me=J(he(hn)),Me=[],Oe=[],je=H.map(({ser:e,of:o})=>{const h=fe(o.plot.key);e.one("c:idx")?.attr("val"),e.one("c:order")?.attr("val"),e!==Fe&&!S&&he(e.one("c:cat"))?.consume();const m=q(e),I=Ne(S?m.one("c:yVal"):e.one("c:val")),U=I?.one("c:formatCode")?.text()??"",C=J(I),O=S?he(m.one("c:xVal")):void 0;O?.one("c:formatCode");const X=S?J(O):void 0,G=X?Math.max(X.length,C.length):me.length,j=e.one("c:spPr"),pn=T(j?.one("a:solidFill"),t,"c:spPr"),bn=T(j?.one("a:ln")?.one("a:solidFill"),t,"c:spPr"),_e=Pn(o.type??k)||S&&!De||k==="radar"||k==="radar-markers"||k.startsWith("stock"),Pe=q(e),Xe=De?J(Ne(Pe.one("c:bubbleSize"))):void 0;Ne(Pe.one("c:bubbleSize"))?.one("c:formatCode")?.text(),Pe.one("c:bubble3D")?.attr("val");const kn=!_e&&!te(k)&&j?.one("a:noFill")!==void 0,ue=pn??bn,qe=ue?.color,Qe=ue===void 0||ue.alpha>=1?void 0:Math.round((1-ue.alpha)*1e3)/1e3,Ce=j?.one("a:ln")?.one("a:prstDash")?.attr("val"),Ye=g(e.one("c:smooth")),Ze=j?.one("a:ln")?.attr("w"),vn=j?.one("a:ln")?.one("a:noFill")!==void 0;j?.one("a:ln")?.one("a:round")?.skip("a chart line's join"),te(k)&&j?.one("a:ln")?.consume();const Le=e.one("c:marker"),en=Le?.one("c:size")?.attr("val"),K=Le?.one("c:symbol")?.attr("val"),gn=xn(o.type??k)?"circle":"none",nn=K===void 0||K===gn||K==="auto"||K==="picture"||!_e&&K==="none"?void 0:K;K==="picture"&&u(t,"cannot-hold","c:marker/c:symbol","a picture as a marker"),Le?.one("c:spPr")?.consume(),g(e.one("c:invertIfNegative"))&&u(t,"cannot-hold","c:invertIfNegative","a bar of a negative value drawn in the inverse of its colour");const tn=[];for(const z of e.all("c:dPt")){const A=z.one("c:idx")?.attr("val"),v=z.one("c:spPr"),an=_e?z.one("c:marker")?.one("c:spPr"):void 0,rn=T(v?.one("a:solidFill"),t,"c:spPr")?.color??T(an?.one("a:solidFill"),t,"c:spPr")?.color;A===void 0||rn===void 0||(tn[A]=rn,an&&z.one("c:marker")?.consume(),g(z.one("c:invertIfNegative"))&&u(t,"cannot-hold","c:dPt/c:invertIfNegative","a bar of a negative value drawn in the inverse of its colour"),z.one("c:bubble3D")?.attr("val"),te(k)&&v?.one("a:ln")?.consume())}B.push(tn),Me.push(e.one("c:dLbls")),Oe.push(new Map(e.all("c:dPt").flatMap(z=>{const A=z.one("c:idx")?.attr("val"),v=z.one("c:marker");return A===void 0||!v?[]:[[A,v]]})));const on=e.one("c:tx");return{name:Sn(J(ze(on?.one("c:strRef")))[0]??on?.one("c:v")?.text(),`Series ${String(ee.indexOf(e)+1)}`),values:Array.from({length:G},(z,A)=>{const v=C[A];return v===void 0||v===""?null:Number(v)}),...X?{x:Array.from({length:G},(z,A)=>{const v=X[A];return v===void 0||v===""?null:Number(v)})}:{},...U===""||U==="General"?{}:{number_format:U},...qe===void 0?{}:{color:qe},...Ye===!0?{smooth:Ye}:{},...Xe?{sizes:Array.from({length:G},(z,A)=>{const v=Xe[A];return v===void 0||v===""?null:Number(v)})}:{},...vn&&h==="c:lineChart"?{line_width:0}:Ze===void 0||h!=="c:lineChart"&&!S?{}:{line_width:Ze/cn},...en===void 0?{}:{marker_size:en},...o.type!==void 0&&o.type!==k?{type:o.type}:{},...o.secondary?{secondary:!0}:{},...Ce===void 0||Ce==="solid"?{}:{line_dash:Ce},...nn===void 0?{}:{marker_symbol:nn},...Qe===void 0?{}:{transparency:Qe},...kn?{no_fill:!0}:{}}}),re=l?.one("c:title"),{text:pe,size:We}=fn(re);re&&pe===""&&w!==!0&&u(t,"cannot-hold","c:title","a chart's automatic title (its series' name): a deck's chart title is words of its own"),g(re?.one("c:overlay"))===!0&&u(t,"cannot-hold","c:title/c:overlay","a chart's title drawn over its plot"),re?.one("c:layout")?.skip("a chart title's own place");const ne=l?.one("c:legend"),se=ne?.one("c:legendPos")?.attr("val");g(ne?.one("c:overlay"))===!0&&u(t,"cannot-hold","c:legend/c:overlay","a chart's legend drawn over its plot"),ne?.one("c:layout")?.skip("a legend's own place");const Ie=oe(ne?.one("c:txPr"))?.attr("sz"),mn={b:"bottom",t:"top",l:"left",r:"right"}[se==="b"||se==="t"||se==="l"?se:"r"],V=y.one("c:dLbls"),P=e=>g(V?.one(e))===!0;g(V?.one("c:showLegendKey"))===!0&&u(t,"cannot-hold","c:showLegendKey","a chart's labels with their legend keys"),V?.one("c:showBubbleSize")?.attr("val"),g(V?.one("c:showLeaderLines"))===!0&&(P("c:showVal")||P("c:showPercent")||P("c:showCatName")||P("c:showSerName"))&&u(t,"cannot-hold","c:showLeaderLines","lines from a chart's labels to their points");const Te=V?.one("c:numFmt")?.attr("formatCode"),Re=V?.one("c:dLblPos")?.attr("val"),Be=oe(V?.one("c:txPr")),Ve=Be?.attr("sz"),Ue=T(Be?.one("a:solidFill"),t,"c:dLbls")?.color,ce=y.one("c:gapWidth")?.attr("val"),be=y.one("c:overlap")?.attr("val"),Ee=y.one("c:holeSize")?.attr("val"),$e=y.one("c:hiLowLines");$e?.consume(),y.one("c:upDownBars")?.consume();const ke=y;ke.one("c:bubbleScale")?.attr("val"),ke.one("c:showNegBubbles")?.attr("val"),ke.one("c:bubble3D")?.attr("val");const ie=g(y.one("c:varyColors"));y.one("c:varyColors")?.attr("val");const ve=y.one("c:firstSliceAng")?.attr("val");ve!==void 0&&ve!==0&&u(t,"cannot-hold","c:firstSliceAng",`a round chart's first slice turned ${String(ve)}°`);const Ge=oe(s.one("c:txPr")),ge=Ge?.attr("sz");Ie!==void 0&&Ie!==ge&&u(t,"cannot-hold","c:legend/c:txPr","a legend's own text size: a chart's text is one size");const Ke=T(Ge?.one("a:solidFill"),t,"c:txPr")?.color;let ye;for(const{plot:e,secondary:o}of W){if(e===y)continue;const h=C=>e.one(C)?.attr("val");o&&fe(e.key)==="c:barChart"&&h("c:gapWidth")!==void 0&&h("c:gapWidth")!==ce?ye=Number(h("c:gapWidth")):h("c:gapWidth")!==void 0&&h("c:gapWidth")!==ce&&u(t,"cannot-hold","c:gapWidth","a combination chart's plot's own gap width: its plots share the first's"),h("c:overlap")!==void 0&&h("c:overlap")!==be&&u(t,"cannot-hold","c:overlap","a combination chart's plot's own overlap: its plots share the first's"),e.one("c:varyColors")?.attr("val"),e.one("c:barDir")?.attr("val"),e.one("c:grouping")?.attr("val");const m=e.one("c:dLbls"),I=C=>g(m?.one(C))===!0,U=["c:showVal","c:showPercent","c:showCatName","c:showSerName"].some(C=>I(C)!==P(C));m?.consume(),U&&u(t,"cannot-hold","c:dLbls","a combination chart's plot's own data labels: its plots share the first's")}const we=S?b[1]:E?b.find(R(y))??b[0]:b[0],le=S?b[0]:E?N.find(R(y))??N[0]:N[0],de=W.find(e=>e.secondary)?.plot,Je=de?b.find(e=>R(de)(e)&&e.one("c:axPos")?.attr("val")==="r"):void 0;for(const e of N)e===le||!de||!R(de)(e)||(g(e.one("c:delete"))!==!0&&u(t,"cannot-hold","c:catAx","a second category axis that shows: a deck's second value axis crosses a hidden one"),e.consume());const xe=V&&(P("c:showVal")||P("c:showPercent")||P("c:showCatName")||P("c:showSerName"))?{show_value:P("c:showVal"),show_percentage:P("c:showPercent"),show_category_name:P("c:showCatName"),show_series_name:P("c:showSerName"),...Te===void 0?{}:{number_format:Te},...Re===void 0?{}:{position:Re},...Ve===void 0?{}:{size:Ve/100},...Ue===void 0?{}:{color:Ue}}:void 0;je.forEach((e,o)=>{const h=B[o]??[];!(ie??te(k))&&h.some(m=>m!==void 0)&&(e.point_colors=Array.from(h,m=>m)),Object.assign(e,Dn(Me[o],t,xe));for(const m of e.point_labels??[])Oe[o]?.get(m.index)?.consume()});const He={type:k,categories:me,series:je,...pe===""?{}:{title:pe},...ne?{legend:mn}:{},...xe?{labels:xe}:{},...ce===void 0?{}:{gap_width:Number(ce)},...be===void 0?{}:{overlap:Number(be)},...Ee===void 0?{}:{hole_size:Number(Ee)},...$e&&M==="c:lineChart"?{high_low_lines:!0}:{},...ye===void 0?{}:{secondary_gap_width:ye},...ie===void 0?{}:{vary_by_categories:ie},...ie??te(k)?Ln(B,me.length):{},...we?{value_axis:{...Ae(we,t,!1),...dn(le)}}:{},...le?{category_axis:{...Ae(le,t),...dn(we)}}:{},...Je?{secondary_axis:Ae(Je,t,!1)}:{},...ge===void 0?{}:{font_size:ge/100},...We===void 0?{}:{title_size:We/100},...Ke===void 0?{}:{font_color:Ke}};return(_&&wn(He,_))??He}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{needsCategories as tt}from"@allyhub/slides-core";import{colorAt as Q,say as et}from"./common.js";const nt={waterfall:"waterfall",boxWhisker:"box-whisker",clusteredColumn:"histogram",treemap:"treemap",sunburst:"sunburst",funnel:"funnel"},V={b:"bottom",t:"top",l:"left",r:"right"};function j(o){const c=o?.one("cx:txData");c?.one("cx:f")?.text();const l=c?.one("cx:v")?.text();if(l!==void 0)return l;const a=o?.one("cx:rich");a?.one("a:bodyPr")?.skip("a chart title's text body"),a?.one("a:lstStyle");const d=(a?.all("a:p")??[]).map(g=>g.all("a:r").map(x=>x.one("a:t")?.text()??"").join(""));return a?.consume(),d.length===0?void 0:d.join(`
|
|
3
|
+
`)}const _=o=>{if(o===void 0||o.trim()==="")return;const c=Number(o);return Number.isFinite(c)?c:void 0};function X(o){if(!o)return;const c=o.one("cx:visibility"),l=c?.attr("value")===!0,a=c?.attr("categoryName")===!0,d=c?.attr("seriesName")===!0,g=o.one("cx:numFmt")?.attr("formatCode");o.one("cx:numFmt")?.attr("sourceLinked");const x=o.attr("pos");if(o.one("cx:separator")?.text(),!(!l&&!a&&!d))return{show_value:l,show_category_name:a,...d?{show_series_name:!0}:{},...g===void 0?{}:{number_format:g},...x===void 0||!["outEnd","inEnd","ctr","inBase","t","b","l","r","bestFit"].includes(x)?{}:{position:x}}}const Y=(o,c)=>Q(o?.one("a:solidFill"),c,"cx:spPr")?.color;export function chartExOf(o,c){const l=c.read.pkg,a=l.open(o);if(!a)return"its part is not in the file";const d={...c,part:o},g=a.one("cx:chartData"),x=g?.one("cx:externalData");if(x){const t=l.rel(o,x.attr("r:id"));t&&!t.external&&l.leave(t.target,"a chart's workbook: the deck writes one from its numbers"),x.attr("cx:autoUpdate")}for(const t of l.rels(o))/chartStyle|chartColorStyle/u.test(t.type)&&l.leave(t.target,"a chart's style: the deck writes its own");a.one("cx:spPr")?.consume(),a.one("cx:txPr")?.consume(),a.one("cx:clrMapOvr")?.skip("a chart's own colour map");const S=a.one("cx:chart"),E=S?.one("cx:plotArea")?.one("cx:plotAreaRegion");E?.one("cx:plotSurface")?.consume();const q=E?.all("cx:series")??[],A=q.filter(t=>t.attr("layoutId")!=="paretoLine"),$=q.find(t=>t.attr("layoutId")==="paretoLine"),v=A[0],z=v?.attr("layoutId")??"",G=nt[z],U=t=>(a.consume(),t);if(!v)return U("it has no series");if(G===void 0)return U(`a deck has no ${z} chart`);const i=$?"pareto":G;$?.consume();const D=new Map;for(const t of g?.all("cx:data")??[]){const e=t.attr("id")??0,r=t.one("cx:strDim");r?.one("cx:f")?.text(),r?.attr("type");const u=(r?.all("cx:lvl")??[]).map(h=>{const F=h.attr("ptCount")??0,H=Array.from({length:F},()=>"");for(const J of h.all("cx:pt"))H[J.attr("idx")??0]=J.text();return H}),m=t.one("cx:numDim");m?.one("cx:f")?.text(),m?.attr("type");const s=m?.all("cx:lvl")[0],b=s?.attr("ptCount")??0,f=Array.from({length:b},()=>null);for(const h of s?.all("cx:pt")??[]){const F=Number(h.text());f[h.attr("idx")??0]=Number.isFinite(F)?F:null}const p=s?.attr("formatCode");D.set(e,{levels:u.reverse(),values:f,...p===void 0||p==="General"?{}:{code:p}})}const W=i==="histogram"||i==="pareto"||i==="treemap"||i==="sunburst"||i==="funnel"||i==="waterfall",C=W?[v]:A,B=D.get(v.one("cx:dataId")?.attr("val")??0),k=B?.levels??[],K=k.length>1,R=Math.max(0,...k.map(t=>t.length)),M=K?Array.from({length:R},(t,e)=>[...k].reverse().map(r=>r[e]??"").find(r=>r!=="")??""):[...k[0]??[]];M.length===0&&tt(i)&&M.push(...Array.from({length:B?.values.length??0},(t,e)=>String(e+1)));const Z=C.map((t,e)=>{const r=D.get(t.one("cx:dataId")?.attr("val")??e);j(t.one("cx:tx"));const u=j(t.one("cx:tx"))??`Series ${String(e+1)}`;t.attr("uniqueId"),t.attr("formatIdx"),t.attr("ownerIdx"),t.one("cx:axisId")?.attr("val");const m=Y(t.one("cx:spPr"),d);t.one("cx:spPr")?.one("a:ln")?.consume();const s=[];for(const f of t.all("cx:dataPt")){const p=Y(f.one("cx:spPr"),d);p!==void 0&&(s[f.attr("idx")??0]=p)}const b=X(t.one("cx:dataLabels"));return{name:u,values:r?.values??[],...r?.code===void 0?{}:{number_format:r.code},...i==="box-whisker"?(()=>{const f=Q(t.one("cx:spPr")?.one("a:ln")?.one("a:solidFill"),d,"cx:spPr")?.color;return f===void 0?{}:{color:f}})():m===void 0||i==="waterfall"?{}:{color:m},...s.length>0?{point_colors:Array.from(s)}:{},...e>0&&b?{labels:b}:{}}});for(const t of A.slice(C.length))t.consume();for(const t of C.slice(1))t.one("cx:layoutPr")?.consume();const y=v.one("cx:layoutPr"),n={type:i,categories:M,series:Z,...K?{category_levels:Array.from({length:R},(t,e)=>k.map(r=>r[e]??""))}:{}},T=X(v.one("cx:dataLabels"));T&&(n.labels=T);const P=y?.one("cx:visibility");if(i==="waterfall"){const t=(y?.one("cx:subtotals")?.all("cx:idx")??[]).map(e=>e.attr("val")??0);t.length>0&&(n.totals=t),P?.attr("connectorLines")===!1&&(n.connector_lines=!1)}i==="box-whisker"&&(y?.one("cx:statistics")?.attr("quartileMethod")==="inclusive"&&(n.quartile_method="inclusive"),P?.attr("meanLine")===!0&&(n.show_mean_line=!0),P?.attr("meanMarker")===!1&&(n.show_mean_markers=!1),P?.attr("outliers")===!1&&(n.show_outliers=!1),P?.attr("nonoutliers")===!0&&(n.show_inner_points=!0));const w=y?.one("cx:binning");if(w){const t=w.one("cx:binSize")?.attr("val"),e=w.one("cx:binCount")?.attr("val");t!==void 0&&t>0?n.bin_width=t:e!==void 0&&e>0&&(n.bin_count=Math.round(e));const r=_(w.attr("overflow")),u=_(w.attr("underflow"));r!==void 0&&(n.overflow=r),u!==void 0&&(n.underflow=u),w.attr("intervalClosed")==="l"&&(n.interval_closed="left")}y?.one("cx:aggregation")?.use();const N=y?.one("cx:parentLabelLayout")?.attr("val");(N==="overlapping"||N==="none")&&(n.parent_labels=N);const I=S?.one("cx:title"),O=j(I?.one("cx:tx"));I?.attr("pos"),I?.attr("align"),I?.attr("overlay"),I?.one("cx:txPr")?.consume(),O!==void 0&&O!==""&&(n.title=O);const L=S?.one("cx:legend");if(L){const t=L.attr("pos")??"r";n.legend=t in V?V[t]:"right",L.attr("align"),L.attr("overlay")===!0&&(n.legend_overlay=!0),L.one("cx:txPr")?.consume()}for(const t of S?.one("cx:plotArea")?.all("cx:axis")??[]){const e=t.attr("id");if(e===2){t.consume();continue}t.one("cx:tickLabels")?.use(),t.one("cx:spPr")?.consume(),t.one("cx:txPr")?.consume(),t.one("cx:majorGridlines")?.consume(),t.one("cx:units")?.consume();const r=_(t.one("cx:catScaling")?.attr("gapWidth")),u=t.one("cx:valScaling"),m=j(t.one("cx:title")?.one("cx:tx"));t.one("cx:title")?.consume(),r!==void 0&&e===0&&(n.gap_width=Math.round(r*100));const s={...m===void 0?{}:{title:m},...t.attr("hidden")===!0?{visible:!1}:{}};if(u&&e===1){const b=_(u.attr("min")),f=_(u.attr("max")),p=_(u.attr("majorUnit"));b!==void 0&&(s.minimum_scale=b),f!==void 0&&(s.maximum_scale=f),p!==void 0&&(s.major_unit=p);const h=t.one("cx:numFmt")?.attr("formatCode");t.one("cx:numFmt")?.attr("sourceLinked"),h!==void 0&&(s.number_format=h)}Object.keys(s).length>0&&(e===0?n.category_axis=s:n.value_axis=s)}return A.length>C.length&&W&&et(d,"cannot-hold","cx:series",`a ${i} chart's series after its first: Office draws only its first`),n}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{as as p,colorIn as L}from"@allyhub/ooxml";import{COLOR_NAMES as M,COLOR_TRANSFORMS as N,THEME_COLORS as v,LINE_DASHES as T,PATTERNS as j,TILE_ALIGNMENTS as C}from"@allyhub/formats";export const SLIDE_PLACE=/^#@(\d+)$/u;export function linkOf(t,i,e){const n=t.attr("action")??"",a=t.attr("r:id")??"",r=a===""?void 0:i.read.pkg.rel(i.part,a);if(t.ignore(["tooltip","history","highlightClick","endSnd","tgtFrame","invalidUrl"],"a link's tooltip and browser settings"),t.one("a:snd")?.skip("a sound a link plays"),t.one("a:extLst")?.skip("a link's extensions"),n===""&&r?.external)return r.target;if(n==="ppaction://hlinksldjump"&&r&&!r.external){const s=i.read.slides?.get(r.target);if(s!==void 0)return`#@${String(s)}`;say(i,"missing",e,"a link to a slide that is not in the file");return}if(/^ppaction:\/\/hlinkshowjump\?jump=(firstslide|lastslide|nextslide|previousslide|endshow)$/u.test(n))return n;n!==""?say(i,"cannot-hold",`${e}@action`,n):a!==""&&say(i,"missing",e,"a link whose target is not in the file")}export function say(t,i,e,n){t.read.pkg.entries.push({kind:i,part:t.part,where:t.where,what:e,...n===void 0?{}:{detail:n}})}const D=new Set(v),z=new Set(M),$=new Set(N),I=new Set(["hue","hueOff"]);function H(t){const i=[];for(const e of t)if(!e.name.startsWith("alpha")){if(!$.has(e.name)||e.val===void 0)return;i.push({name:e.name,value:e.val/(I.has(e.name)?6e4:1e5)})}return i}export function modelColor(t,i,e){const n=H(t.steps??[]);if(t.name!==void 0&&z.has(t.name)&&n){const a=i.colors.map[t.name]??t.name,r=i.named===!0?t.name:a;return n.length===0?r:t.brightness!==void 0?{theme_color:r,brightness:t.brightness}:{theme_color:r,transforms:n}}return t.name===void 0&&t.base!==void 0&&n?n.length===0?{rgb:t.base}:{rgb:t.base,transforms:n}:t.scheme!==void 0&&D.has(t.scheme)?t.brightness===void 0?t.scheme:{theme_color:t.scheme,brightness:t.brightness}:(t.transformed&&say(i,"approximated",e,"a colour inverted, greyed or changed by gamma or a channel is kept as the colour it makes, no longer following the theme"),{rgb:t.rgb})}export function withAlpha(t,i){if(i>=1)return t;const e={name:"alpha",value:Math.round(i*1e5)/1e5};if(typeof t=="string")return{theme_color:t,transforms:[e]};if("rgb"in t)return{rgb:t.rgb,transforms:[...t.transforms??[],e]};if("transforms"in t)return{theme_color:t.theme_color,transforms:[...t.transforms,e]};const n=t.brightness>0?[{name:"lumMod",value:1-t.brightness},{name:"lumOff",value:t.brightness}]:[{name:"lumMod",value:1+t.brightness}];return{theme_color:t.theme_color,transforms:[...n,e]}}export function colorAt(t,i,e){const n=L(t,i.colors);return n?{color:modelColor(n,i,e),alpha:n.alpha}:void 0}export const transparencyOf=t=>t>=1?void 0:Math.round((1-t)*1e3)/1e3;const P=new Set(j),W=new Set(C);function G(t,i){const e=p(t);e.ignore(["dpi","rotWithShape"],"a picture's resolution and turning with its fill");const n=e.one("a:blip");n?.ignore(["cstate"],"a picture's compression state");const a=i.read.pkg.rel(i.part,n?.attr("r:embed"));n?.attr("r:link")&&say(i,"missing","a:blip@r:link","a picture linked from outside the file");let r;for(const l of n?.kids()??[]){if(l.key==="a:extLst"){l.skip("a picture's extensions (its SVG, its own resolution)");continue}if(l.key==="a:alphaModFix"){l.use();const u=p(l).attr("amt")??1e5;r=transparencyOf(u/1e5);continue}l.use(),say(i,"cannot-hold",l.key,"a picture fill's own effect (recolouring, brightness)"),l.consume()}const s=e.one("a:srcRect");s&&["l","t","r","b"].some(l=>(s.attr(l)??0)!==0)&&say(i,"cannot-hold","a:srcRect","a picture fill's crop");const d=e.one("a:stretch")?.one("a:fillRect");d&&["l","t","r","b"].some(l=>(d.attr(l)??0)!==0)&&say(i,"approximated","a:fillRect","a stretched picture's insets: it fills the whole shape");const o=e.one("a:tile");if(o&&(o.attr("flip")??"none")!=="none"&&say(i,"approximated","a:tile@flip","a tiled picture's mirroring"),!a||a.external){say(i,"missing","a:blipFill","a picture filling a shape whose file is not in the file");return}i.read.pkg.bytes(a.target);const f=o?.attr("algn");return{part:a.target,...o?{tile:{scale_x:(o.attr("sx")??1e5)/1e5,scale_y:(o.attr("sy")??1e5)/1e5,offset_x:o.attr("tx")??0,offset_y:o.attr("ty")??0,align:f!==void 0&&W.has(f)?f:"tl"}}:{},...r===void 0?{}:{transparency:r}}}export function gradientOf(t,i){const e=p(t),n=(e.one("a:gsLst")?.all("a:gs")??[]).flatMap(l=>{const u=colorAt(l,i,"a:gs");if(!u)return[];const g=transparencyOf(u.alpha);return[{at:Math.min(1,Math.max(0,(l.attr("pos")??0)/1e5)),color:u.color,...g===void 0?{}:{transparency:g}}]});if(n.length<2){say(i,"cannot-hold","a:gradFill","a gradient of fewer than two colours");return}const a=e.one("a:lin"),r=e.one("a:path"),s=r?.attr("path"),c=r?.one("a:fillToRect"),d=l=>Math.round((c?.attr(l)??0)/1e5*1e5)/1e5,o=c?{left:d("l"),top:d("t"),right:d("r"),bottom:d("b")}:void 0;a?.ignore(["scaled"],"a linear gradient's scaling with its shape"),e.ignore(["rotWithShape"],"a gradient's turning with its shape");const f=e.one("a:tileRect");return f&&["l","t","r","b"].some(l=>f.attr(l))&&say(i,"cannot-hold","a:tileRect","a gradient tiled in a rectangle of its own"),n.length>10&&say(i,"approximated","a:gsLst",`a gradient of ${String(n.length)} colours keeps its first ten`),{angle:(a?.attr("ang")??0)/6e4%360,...s===void 0?{}:{path:s},...s===void 0||!o||o.left===.5&&o.top===.5&&o.right===.5&&o.bottom===.5?{}:{focus:o},stops:[...n].sort((l,u)=>l.at-u.at).slice(0,10)}}const J=["a:noFill","a:solidFill","a:gradFill","a:blipFill","a:pattFill","a:grpFill"];export function fillOf(t,i,e=!1){const n=t&&p(t).choice(...J);return n?fillElement(n,i,e):void 0}export function fillElement(t,i,e=!1){if(t.use(),!e&&t.key==="a:pattFill"){const n=p(t);say(i,"approximated","a:pattFill",`a pattern (${n.attr("prst")??"pct5"}) is filled with its foreground colour`);const a=colorAt(n.one("a:fgClr"),i,"a:pattFill");return n.one("a:bgClr")?.consume(),a?{fill:a.color}:void 0}if(!e&&t.key==="a:blipFill"){say(i,"cannot-hold",t.key,"a picture filling it"),t.consume();return}switch(t.key){case"a:noFill":return{fill:null};case"a:solidFill":{const n=colorAt(t,i,"a:solidFill");if(!n)return;const a=transparencyOf(n.alpha);return{fill:n.color,...a===void 0?{}:{fill_transparency:a}}}case"a:gradFill":{const n=gradientOf(t,i);return n?{gradient:n}:void 0}case"a:pattFill":{const n=p(t),a=n.attr("prst")??"pct5",r=(s,c)=>{const d=colorAt(n.one(s),i,"a:pattFill");return d?withAlpha(d.color,d.alpha):c};return{pattern:{preset:P.has(a)?a:"pct5",fg:r("a:fgClr","dk1"),bg:r("a:bgClr","lt1")}}}case"a:grpFill":return{group:!0};default:{const n=G(t,i);return n?{picture_fill:n}:void 0}}}const A=new Set(T);export function lineOf(t,i){if(!t)return{};const e=p(t),n=fillOf(e,i);n?.gradient&&say(i,"approximated","a:ln/a:gradFill","a gradient line is drawn in its first colour");const a=n?.fill!==void 0?n.fill===null||n.fill_transparency===void 0?n.fill:withAlpha(n.fill,1-n.fill_transparency):n?.gradient?n.gradient.stops[0]?.color:void 0,r=e.attr("w"),s=e.one("a:prstDash")?.attr("val"),c=s==="solid"?void 0:s;c!==void 0&&!A.has(c)&&say(i,"approximated","a:prstDash",`${c} is drawn as dashes`);const d=w=>{const m=w?.attr("type");return m===void 0||m==="none"?void 0:m},o=w=>{const m=w?.attr("w"),E=w?.attr("len"),R={...m===void 0||m==="med"?{}:{w:m},...E===void 0||E==="med"?{}:{len:E}};return Object.keys(R).length===0?void 0:R},f=e.one("a:headEnd"),l=e.one("a:tailEnd"),u=d(f),g=d(l),_=o(f),h=o(l),F=u===void 0?void 0:_,O=g===void 0?void 0:h,x=e.choice("a:round","a:bevel","a:miter");x?.use(),x?.key==="a:miter"&&p(x).attr("lim");const b=x?.key.slice(2),y=e.attr("cap"),S=e.attr("cmpd"),k=e.one("a:custDash");return k&&(say(i,"approximated","a:custDash","a line's own dashes are drawn as dashes"),k.consume()),{...a===void 0?{}:{line:a},...r===void 0?{}:{line_width:r},...c===void 0?k?{line_dash:"dash"}:{}:{line_dash:A.has(c)?c:"dash"},...y===void 0||y==="flat"?{}:{line_cap:y},...b===void 0||b==="miter"?{}:{line_join:b},...S===void 0||S==="sng"?{}:{line_compound:S},...u===void 0?{}:{line_begin:u},...g===void 0?{}:{line_end:g},...F===void 0?{}:{line_begin_size:F},...O===void 0?{}:{line_end_size:O}}}export function shadowOf(t,i){const e=t&&p(t).one("a:outerShdw");if(!e)return;const n=colorAt(e,i,"a:outerShdw");return e.ignore(["algn","rotWithShape"],"a shadow's alignment and turning with its shape"),((e.attr("sx")??1e5)!==1e5||(e.attr("sy")??1e5)!==1e5)&&say(i,"cannot-hold","a:outerShdw@sx","a shadow's scale"),((e.attr("kx")??0)!==0||(e.attr("ky")??0)!==0)&&say(i,"cannot-hold","a:outerShdw@kx","a shadow's skew"),{color:n?.color??"dk1",blur:e.attr("blurRad")??0,distance:e.attr("dist")??0,angle:(e.attr("dir")??0)/6e4%360,transparency:n?transparencyOf(n.alpha)??0:0}}export function effectsOf(t,i){const e=t&&p(t);if(!e)return{};const n={},a=e.one("a:innerShdw");if(a){const d=colorAt(a,i,"a:innerShdw");n.inner_shadow={color:d?.color??"dk1",blur:a.attr("blurRad")??0,distance:a.attr("dist")??0,angle:(a.attr("dir")??0)/6e4%360,transparency:d?transparencyOf(d.alpha)??0:0}}const r=e.one("a:glow");if(r){const d=colorAt(r,i,"a:glow");n.glow={color:d?.color??"accent1",size:r.attr("rad")??0,transparency:d?transparencyOf(d.alpha)??0:0}}const s=e.one("a:reflection");s&&(s.ignore(["algn","rotWithShape","stPos","fadeDir"],"a reflection's alignment, turning and where its fade starts"),(s.attr("endA")??0)>1e3&&say(i,"approximated","a:reflection@endA","a reflection fades to nothing"),((s.attr("dir")??54e5)!==54e5||(s.attr("sy")??1e5)!==-1e5||(s.attr("sx")??1e5)!==1e5||(s.attr("kx")??0)!==0||(s.attr("ky")??0)!==0)&&say(i,"approximated","a:reflection@dir","a reflection is mirrored under its shape"),n.reflection={transparency:1-(s.attr("stA")??1e5)/1e5,size:(s.attr("endPos")??1e5)/1e5,distance:s.attr("dist")??0,blur:s.attr("blurRad")??0});const c=e.one("a:softEdge");return c&&(n.soft_edges=c.attr("rad")??0),n}export function sayEffects(t,i){for(const e of t.effects??[])say(i,"cannot-hold",`p:style/a:effectRef/${e}`,`an effect of the theme's effect style (${e.slice(2)})`)}export function styleOf(t,i){const e=t&&p(t);if(!e)return{};const n=o=>{if(!o)return;const f=L(o,i.colors);return{idx:o.attr("idx")??0,ctx:{...i,colors:{...i.colors,...f?{placeholder:f}:{}}}}},a={},r=n(e.one("a:fillRef"));if(r){const o=r.idx>=1001?i.read.matrix.background[r.idx-1001]:r.idx>0?i.read.matrix.fill[r.idx-1]:void 0,f=o?fillElement(o,r.ctx,!0):{fill:null};Object.assign(a,f??{})}const s=n(e.one("a:lnRef"));if(s){const o=s.idx>0?i.read.matrix.line[s.idx-1]:void 0;Object.assign(a,o?lineOf(o,s.ctx):{line:null})}const c=n(e.one("a:effectRef"));if(c&&c.idx>0){const o=i.read.matrix.effect[c.idx-1],f=o&&p(o),l=f?.one("a:effectLst"),u=shadowOf(l,c.ctx);u&&(a.shadow=u),Object.assign(a,effectsOf(l,c.ctx));const g=new Set(["a:outerShdw","a:innerShdw","a:glow","a:reflection","a:softEdge"]),_=[...(l?.kids()??[]).filter(h=>!g.has(h.key)),...(f?.kids()??[]).filter(h=>h.key!=="a:effectLst"&&h.key!=="a:extLst")].map(h=>h.key);_.length>0&&(a.effects=_)}const d=e.one("a:fontRef");if(d){const o=colorAt(d,i,"a:fontRef");o&&(a.text_color=o.color);const f=d.attr("idx");f==="major"?a.font="+mj-lt":f==="minor"&&(a.font="+mn-lt")}return a}export const sameColor=(t,i)=>JSON.stringify(t)===JSON.stringify(i);
|
|
2
|
+
import{as as g,colorIn as R}from"@allyhub/ooxml";import{COLOR_NAMES as A,COLOR_TRANSFORMS as v,THEME_COLORS as N,LINE_DASHES as T,PATTERNS as j,TILE_ALIGNMENTS as C}from"@allyhub/formats";export const SLIDE_PLACE=/^#@(\d+)$/u;export function linkOf(t,n,a){const e=t.attr("action")??"",i=t.attr("r:id")??"",o=i===""?void 0:n.read.pkg.rel(n.part,i);if(t.ignore(["tooltip","history","highlightClick","endSnd","tgtFrame","invalidUrl"],"a link's tooltip and browser settings"),t.one("a:snd")?.skip("a sound a link plays"),t.one("a:extLst")?.skip("a link's extensions"),e===""&&o?.external)return o.target;if(e==="ppaction://hlinksldjump"&&o&&!o.external){const r=n.read.slides?.get(o.target);if(r!==void 0)return`#@${String(r)}`;say(n,"missing",a,"a link to a slide that is not in the file");return}if(/^ppaction:\/\/hlinkshowjump\?jump=(firstslide|lastslide|nextslide|previousslide|endshow)$/u.test(e))return e;e!==""?say(n,"cannot-hold",`${a}@action`,e):i!==""&&say(n,"missing",a,"a link whose target is not in the file")}export function say(t,n,a,e){t.read.pkg.entries.push({kind:n,part:t.part,where:t.where,what:a,...e===void 0?{}:{detail:e}})}const D=new Set(N),z=new Set(A),$=new Set(v),I=new Set(["hue","hueOff"]);function H(t){const n=[];for(const a of t)if(!a.name.startsWith("alpha")){if(!$.has(a.name)||a.val===void 0)return;n.push({name:a.name,value:a.val/(I.has(a.name)?6e4:1e5)})}return n}export function modelColor(t,n,a){const e=H(t.steps??[]);if(t.name!==void 0&&z.has(t.name)&&e){const i=n.colors.map[t.name]??t.name,o=n.named===!0?t.name:i;return e.length===0?o:t.brightness!==void 0?{theme_color:o,brightness:t.brightness}:{theme_color:o,transforms:e}}return t.name===void 0&&t.base!==void 0&&e?e.length===0?{rgb:t.base}:{rgb:t.base,transforms:e}:t.scheme!==void 0&&D.has(t.scheme)?t.brightness===void 0?t.scheme:{theme_color:t.scheme,brightness:t.brightness}:(t.transformed&&say(n,"approximated",a,"a colour inverted, greyed or changed by gamma or a channel is kept as the colour it makes, no longer following the theme"),{rgb:t.rgb})}export function withAlpha(t,n){if(n>=1)return t;const a={name:"alpha",value:Math.round(n*1e5)/1e5};if(typeof t=="string")return{theme_color:t,transforms:[a]};if("rgb"in t)return{rgb:t.rgb,transforms:[...t.transforms??[],a]};if("transforms"in t)return{theme_color:t.theme_color,transforms:[...t.transforms,a]};const e=t.brightness>0?[{name:"lumMod",value:1-t.brightness},{name:"lumOff",value:t.brightness}]:[{name:"lumMod",value:1+t.brightness}];return{theme_color:t.theme_color,transforms:[...e,a]}}export function colorAt(t,n,a){const e=R(t,n.colors);return e?{color:modelColor(e,n,a),alpha:e.alpha}:void 0}export const transparencyOf=t=>t>=1?void 0:Math.round((1-t)*1e3)/1e3;const P=new Set(j),W=new Set(C);function G(t,n){const a=g(t);a.ignore(["dpi","rotWithShape"],"a picture's resolution and turning with its fill");const e=a.one("a:blip");e?.ignore(["cstate"],"a picture's compression state");const i=e?.one("a:extLst")?.all("a:ext").flatMap(l=>{const p=l.one("asvg:svgBlip");return l.one("a14:useLocalDpi")?.skip("a picture kept at its own resolution"),p?[p]:[]})[0],o=n.read.pkg.rel(n.part,i?.attr("r:embed"))??n.read.pkg.rel(n.part,e?.attr("r:embed"));i&&n.read.pkg.rel(n.part,e.attr("r:embed")),e?.attr("r:link")&&say(n,"missing","a:blip@r:link","a picture linked from outside the file");let r;for(const l of e?.kids()??[]){if(l.key==="a:extLst"){i||l.skip("a picture's extensions (its own resolution)");continue}if(l.key==="a:alphaModFix"){l.use();const p=g(l).attr("amt")??1e5;r=transparencyOf(p/1e5);continue}l.use(),say(n,"cannot-hold",l.key,"a picture fill's own effect (recolouring, brightness)"),l.consume()}const f=a.one("a:srcRect");f&&["l","t","r","b"].some(l=>(f.attr(l)??0)!==0)&&say(n,"cannot-hold","a:srcRect","a picture fill's crop");const s=a.one("a:stretch")?.one("a:fillRect");s&&["l","t","r","b"].some(l=>(s.attr(l)??0)!==0)&&say(n,"approximated","a:fillRect","a stretched picture's insets: it fills the whole shape");const d=a.one("a:tile");if(d&&(d.attr("flip")??"none")!=="none"&&say(n,"approximated","a:tile@flip","a tiled picture's mirroring"),!o||o.external){say(n,"missing","a:blipFill","a picture filling a shape whose file is not in the file");return}n.read.pkg.bytes(o.target);const u=d?.attr("algn");return{part:o.target,...d?{tile:{scale_x:(d.attr("sx")??1e5)/1e5,scale_y:(d.attr("sy")??1e5)/1e5,offset_x:d.attr("tx")??0,offset_y:d.attr("ty")??0,align:u!==void 0&&W.has(u)?u:"tl"}}:{},...r===void 0?{}:{transparency:r}}}export function gradientOf(t,n){const a=g(t),e=(a.one("a:gsLst")?.all("a:gs")??[]).flatMap(u=>{const l=colorAt(u,n,"a:gs");if(!l)return[];const p=transparencyOf(l.alpha);return[{at:Math.min(1,Math.max(0,(u.attr("pos")??0)/1e5)),color:l.color,...p===void 0?{}:{transparency:p}}]});if(e.length<2){say(n,"cannot-hold","a:gradFill","a gradient of fewer than two colours");return}const i=a.one("a:lin"),o=a.one("a:path"),r=o?.attr("path"),f=o?.one("a:fillToRect"),c=u=>Math.round((f?.attr(u)??0)/1e5*1e5)/1e5,s=f?{left:c("l"),top:c("t"),right:c("r"),bottom:c("b")}:void 0;i?.ignore(["scaled"],"a linear gradient's scaling with its shape"),a.ignore(["rotWithShape"],"a gradient's turning with its shape");const d=a.one("a:tileRect");return d&&["l","t","r","b"].some(u=>d.attr(u))&&say(n,"cannot-hold","a:tileRect","a gradient tiled in a rectangle of its own"),e.length>10&&say(n,"approximated","a:gsLst",`a gradient of ${String(e.length)} colours keeps its first ten`),{angle:(i?.attr("ang")??0)/6e4%360,...r===void 0?{}:{path:r},...r===void 0||!s||s.left===.5&&s.top===.5&&s.right===.5&&s.bottom===.5?{}:{focus:s},stops:[...e].sort((u,l)=>u.at-l.at).slice(0,10)}}const J=["a:noFill","a:solidFill","a:gradFill","a:blipFill","a:pattFill","a:grpFill"];export function fillOf(t,n,a=!1){const e=t&&g(t).choice(...J);return e?fillElement(e,n,a):void 0}export function fillElement(t,n,a=!1){if(t.use(),!a&&t.key==="a:pattFill"){const e=g(t);say(n,"approximated","a:pattFill",`a pattern (${e.attr("prst")??"pct5"}) is filled with its foreground colour`);const i=colorAt(e.one("a:fgClr"),n,"a:pattFill");return e.one("a:bgClr")?.consume(),i?{fill:i.color}:void 0}if(!a&&t.key==="a:blipFill"){say(n,"cannot-hold",t.key,"a picture filling it"),t.consume();return}switch(t.key){case"a:noFill":return{fill:null};case"a:solidFill":{const e=colorAt(t,n,"a:solidFill");if(!e)return;const i=transparencyOf(e.alpha);return{fill:e.color,...i===void 0?{}:{fill_transparency:i}}}case"a:gradFill":{const e=gradientOf(t,n);return e?{gradient:e}:void 0}case"a:pattFill":{const e=g(t),i=e.attr("prst")??"pct5",o=(r,f)=>{const c=colorAt(e.one(r),n,"a:pattFill");return c?withAlpha(c.color,c.alpha):f};return{pattern:{preset:P.has(i)?i:"pct5",fg:o("a:fgClr","dk1"),bg:o("a:bgClr","lt1")}}}case"a:grpFill":return{group:!0};default:{const e=G(t,n);return e?{picture_fill:e}:void 0}}}const M=new Set(T);export function lineOf(t,n){if(!t)return{};const a=g(t),e=fillOf(a,n);e?.gradient&&say(n,"approximated","a:ln/a:gradFill","a gradient line is drawn in its first colour");const i=e?.fill!==void 0?e.fill===null||e.fill_transparency===void 0?e.fill:withAlpha(e.fill,1-e.fill_transparency):e?.gradient?e.gradient.stops[0]?.color:void 0,o=a.attr("w"),r=a.one("a:prstDash")?.attr("val"),f=r==="solid"?void 0:r;f!==void 0&&!M.has(f)&&say(n,"approximated","a:prstDash",`${f} is drawn as dashes`);const c=b=>{const h=b?.attr("type");return h===void 0||h==="none"?void 0:h},s=b=>{const h=b?.attr("w"),E=b?.attr("len"),L={...h===void 0||h==="med"?{}:{w:h},...E===void 0||E==="med"?{}:{len:E}};return Object.keys(L).length===0?void 0:L},d=a.one("a:headEnd"),u=a.one("a:tailEnd"),l=c(d),p=c(u),_=s(d),m=s(u),F=l===void 0?void 0:_,O=p===void 0?void 0:m,x=a.choice("a:round","a:bevel","a:miter");x?.use(),x?.key==="a:miter"&&g(x).attr("lim");const w=x?.key.slice(2),k=a.attr("cap"),y=a.attr("cmpd"),S=a.one("a:custDash");return S&&(say(n,"approximated","a:custDash","a line's own dashes are drawn as dashes"),S.consume()),{...i===void 0?{}:{line:i},...o===void 0?{}:{line_width:o},...f===void 0?S?{line_dash:"dash"}:{}:{line_dash:M.has(f)?f:"dash"},...k===void 0||k==="flat"?{}:{line_cap:k},...w===void 0||w==="miter"?{}:{line_join:w},...y===void 0||y==="sng"?{}:{line_compound:y},...l===void 0?{}:{line_begin:l},...p===void 0?{}:{line_end:p},...F===void 0?{}:{line_begin_size:F},...O===void 0?{}:{line_end_size:O}}}export function shadowOf(t,n){const a=t&&g(t).one("a:outerShdw");if(!a)return;const e=colorAt(a,n,"a:outerShdw");return a.ignore(["algn","rotWithShape"],"a shadow's alignment and turning with its shape"),((a.attr("sx")??1e5)!==1e5||(a.attr("sy")??1e5)!==1e5)&&say(n,"cannot-hold","a:outerShdw@sx","a shadow's scale"),((a.attr("kx")??0)!==0||(a.attr("ky")??0)!==0)&&say(n,"cannot-hold","a:outerShdw@kx","a shadow's skew"),{color:e?.color??"dk1",blur:a.attr("blurRad")??0,distance:a.attr("dist")??0,angle:(a.attr("dir")??0)/6e4%360,transparency:e?transparencyOf(e.alpha)??0:0}}export function effectsOf(t,n){const a=t&&g(t);if(!a)return{};const e={},i=a.one("a:innerShdw");if(i){const c=colorAt(i,n,"a:innerShdw");e.inner_shadow={color:c?.color??"dk1",blur:i.attr("blurRad")??0,distance:i.attr("dist")??0,angle:(i.attr("dir")??0)/6e4%360,transparency:c?transparencyOf(c.alpha)??0:0}}const o=a.one("a:glow");if(o){const c=colorAt(o,n,"a:glow");e.glow={color:c?.color??"accent1",size:o.attr("rad")??0,transparency:c?transparencyOf(c.alpha)??0:0}}const r=a.one("a:reflection");r&&(r.ignore(["algn","rotWithShape","stPos","fadeDir"],"a reflection's alignment, turning and where its fade starts"),(r.attr("endA")??0)>1e3&&say(n,"approximated","a:reflection@endA","a reflection fades to nothing"),((r.attr("dir")??54e5)!==54e5||(r.attr("sy")??1e5)!==-1e5||(r.attr("sx")??1e5)!==1e5||(r.attr("kx")??0)!==0||(r.attr("ky")??0)!==0)&&say(n,"approximated","a:reflection@dir","a reflection is mirrored under its shape"),e.reflection={transparency:1-(r.attr("stA")??1e5)/1e5,size:(r.attr("endPos")??1e5)/1e5,distance:r.attr("dist")??0,blur:r.attr("blurRad")??0});const f=a.one("a:softEdge")?.attr("rad")??0;return f>0&&(e.soft_edges=f),e}export function sayEffects(t,n){for(const a of t.effects??[])say(n,"cannot-hold",`p:style/a:effectRef/${a}`,`an effect of the theme's effect style (${a.slice(2)})`)}export function styleOf(t,n){const a=t&&g(t);if(!a)return{};const e=s=>{if(!s)return;const d=R(s,n.colors);return{idx:s.attr("idx")??0,ctx:{...n,colors:{...n.colors,...d?{placeholder:d}:{}}}}},i={},o=e(a.one("a:fillRef"));if(o){const s=o.idx>=1001?n.read.matrix.background[o.idx-1001]:o.idx>0?n.read.matrix.fill[o.idx-1]:void 0,d=s?fillElement(s,{...o.ctx,part:n.read.matrix.part??o.ctx.part},!0):{fill:null};Object.assign(i,d??{})}const r=e(a.one("a:lnRef"));if(r){const s=r.idx>0?n.read.matrix.line[r.idx-1]:void 0;Object.assign(i,s?lineOf(s,r.ctx):{line:null})}const f=e(a.one("a:effectRef"));if(f&&f.idx>0){const s=n.read.matrix.effect[f.idx-1],d=s&&g(s),u=d?.one("a:effectLst"),l=shadowOf(u,f.ctx);l&&(i.shadow=l),Object.assign(i,effectsOf(u,f.ctx));const p=new Set(["a:outerShdw","a:innerShdw","a:glow","a:reflection","a:softEdge"]),_=[...(u?.kids()??[]).filter(m=>!p.has(m.key)),...(d?.kids()??[]).filter(m=>m.key!=="a:effectLst"&&m.key!=="a:extLst")].map(m=>m.key);_.length>0&&(i.effects=_)}const c=a.one("a:fontRef");if(c){const s=colorAt(c,n,"a:fontRef");s&&(i.text_color=s.color);const d=c.attr("idx");d==="major"?i.font="+mj-lt":d==="minor"&&(i.font="+mn-lt")}return i}export const sameColor=(t,n)=>JSON.stringify(t)===JSON.stringify(n);
|