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,8 +1,8 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{existsSync as
|
|
3
|
-
`)}}});const
|
|
4
|
-
`)}}});function Ie(e,
|
|
5
|
-
`)}}const
|
|
6
|
-
`)}}}),sheetCapabilities=
|
|
7
|
-
`)}}});const
|
|
8
|
-
`)}}let
|
|
2
|
+
import{existsSync as ce}from"node:fs";import{mkdir as he,readFile as X,stat as de,writeFile as fe}from"node:fs/promises";import{basename as k,dirname as me,extname as F,join as D,posix as I,resolve as Y}from"node:path";import{z as f}from"zod";import{PROJECT_DIR as C,defineCliCommand as j,listWork as q,projectRoot as A}from"@allyhub/build";import{ZIP_LIMITS as ue,dirOf as we,itemIdOf as pe}from"@allyhub/formats";import{CommandError as y,EXIT as x}from"@allyhub/protocol";import{CellError as be,DIFF_DEFAULTS as $e,FormulaCell as O,Matrix as ge,PROFILE_TOP as ye,SHEET_ENTRY as xe,SharedFormula as ve,cellName as R,checkWorkbook as ke,dataValue as _,diffWorkbooks as Se,importRows as je,profileTable as Oe,rangeName as G,readAddress as Z,readArea as Ee,scenarioNames as K,shownValue as E}from"@allyhub/sheet";import{CAPABILITIES as Q}from"@allyhub/sheet/api";import{COMPARE_TOLERANCE as Te,importXlsx as ee}from"@allyhub/sheet/xlsx";import{openSheet as T}from"./open.js";const L=xe;export const CALC_ROWS=50,TRACE_CELLS=50;function Ce(e,n,s){const t=K(e);if(!t.includes(s))throw new y("not-found",`There is no scenario ${s}.`,{exit:x.notFound,hint:t.length>0?`It has ${t.join(", ")}.`:`${k(n)}'s scenarios holds none.`})}const u=e=>e.toLocaleString("en-US"),B=e=>e.toLocaleString("en-US",{maximumFractionDigits:4}),P=e=>e>0?["",`The workbook has ${String(e)} problem${e===1?"":"s"}: allyhub check lists them.`]:[];function Ae(e,n){const s=[`${u(e.empty)} empty`,`${u(e.distinct)} distinct`];e.errors>0&&s.push(`${u(e.errors)} errors`),e.min!==void 0&&e.max!==void 0&&s.push(`${B(e.min)} to ${B(e.max)}`),e.sum!==void 0&&s.push(`sum ${B(e.sum)}`),e.mean!==void 0&&s.push(`mean ${B(e.mean)}`),e.shortest!==void 0&&e.longest!==void 0&&s.push(`${String(e.shortest)} to ${String(e.longest)} characters`);const t=[`${e.name.padEnd(n)} ${s.join(", ")}`];return e.formula!==void 0&&t.push(`${"".padEnd(n)} ${e.formula}`),e.top.some(o=>o.count>1)&&t.push(`${"".padEnd(n)} most: ${e.top.map(o=>`${JSON.stringify(o.value.length>40?`${o.value.slice(0,39)}…`:o.value)} ${u(o.count)}`).join(", ")}`),t}export const sheet=j({input:f.strictObject({sheet:f.string().describe("The sheet, by its file or its id in allyhub.yaml"),dir:C}),positional:["sheet"],output:f.looseObject({}),examples:["allyhub sheet research/leads"],run:async(e,n)=>{const s=await A(n.cwd,e.dir),{file:t,workbook:o,calc:a,problems:r}=await T(s,n,e.sheet),i=o.tables.map(l=>({name:l.name,rows:l.rows,columns:Oe(a,l)})),h=i.flatMap(l=>{const d=Math.min(24,Math.max(4,...l.columns.map(p=>p.name.length)));return["",`${l.name}: ${u(l.rows)} rows, ${String(l.columns.length)} columns; each column's ${String(ye)} most frequent values`,...l.columns.flatMap(p=>Ae(p,d))]});return{value:{file:t,tables:i,problems:r},text:[`${t}: ${String(o.sheets.length)} sheet${o.sheets.length===1?"":"s"}, ${String(i.length)} table${i.length===1?"":"s"}`,...h,...P(r)].join(`
|
|
3
|
+
`)}}});const te=e=>{const n=e.sheets[0];if(!n)throw new y("bad-file","The workbook has no sheets.",{exit:x.usage});return n};function se(e,n){const s=n.lastIndexOf("!");if(s<0)return{sheet:te(e),address:n};const t=n.slice(0,s).replace(/^'|'$/gu,"").replaceAll("''","'"),o=e.sheet(t);if(!o)throw new y("not-found",`There is no sheet ${t}.`,{exit:x.notFound,hint:`It has ${e.sheets.map(a=>a.name).join(", ")}.`});return{sheet:o,address:n.slice(s+1)}}function N(e,n,s,t){const o=[];for(let a=n.top;a<=n.bottom;a++){const r=[];for(let i=n.left;i<=n.right;i++){const h=t.value(e,a,i),l=e.lookAt(a,i).format,d=e.at(a,i);r.push({address:R({row:a,col:i}),value:_(h,l),shown:E(h,l),...d instanceof O?{formula:d.text}:{}})}o.push(r)}return{sheet:e.name,what:s,area:G(n),rows:o}}function Me(e,n,s){const t=a=>({address:"",value:_(a,void 0),shown:E(a)});if(!(s instanceof ge))return{sheet:e.name,what:n,rows:[[t(s)]]};const o=[];for(let a=0;a<s.rows;a++){const r=[];for(let i=0;i<s.cols;i++)r.push(t(s.at(a,i)));o.push(r)}return{sheet:e.name,what:n,rows:o}}function z(e,n){const{wb:s}=e;if(n===void 0)return s.sheets.flatMap(l=>{const d=l.used;return d?[N(l,d,l.name,e)]:[]});const t=s.table(n);if(t)return[N(t.sheet,t.area,n,e)];const o=s.name(n);if(o){const l=new ve(o.formula?.text??`=${n}`,0,0,{file:""}),d=te(s);return[Me(d,n,e.evaluate(l,d))]}const a=s.sheet(n);if(a){const l=a.used;return[l?N(a,l,n,e):{sheet:a.name,what:n,rows:[]}]}const{sheet:r,address:i}=se(s,n),h=Ee(i);if(!h)throw new y("not-found",`${n} is not a sheet, a table, a name or a range of this workbook.`,{exit:x.notFound,hint:[`Sheets: ${s.sheets.map(l=>l.name).join(", ")}.`,s.tables.length>0?`Tables: ${s.tables.map(l=>l.name).join(", ")}.`:"",s.names.size>0?`Names: ${[...s.names.values()].map(l=>l.name).join(", ")}.`:"","A range is Summary!B3:D3, or B3 on the first sheet."].filter(Boolean).join(" ")});return[N(r,h,n,e)]}function U(e){const n=[];for(const s of e)s.forEach((t,o)=>{n[o]=Math.max(n[o]??0,t.length)});return e.map(s=>s.map((t,o)=>o===s.length-1?t:t.padEnd(n[o]??0)).join(" ").trimEnd())}function Fe(e,n){const s=e.area===void 0?e.what:`${e.sheet}!${e.area}`,t=e.rows.slice(0,n),o=e.area!==void 0,a=t.map(i=>[...o?[/\d+$/u.exec(i[0]?.address??"")?.[0]??""]:[],...i.map(h=>h.shown)]),r=(e.rows[0]??[]).map(i=>i.address.replace(/\d+$/u,""));return[s,...U(o?[["",...r],...a]:a),...e.rows.length>t.length?[`… ${u(e.rows.length-t.length)} more rows (--all)`]:[]]}export const sheetCalc=j({input:f.strictObject({sheet:f.string().describe("The sheet, by its file or its id in allyhub.yaml"),what:f.string().optional().describe("A sheet (its used range), a range (Summary!B3:D3, or B3 on the first sheet), a table or a name; default every sheet"),all:f.boolean().default(!1).describe(`Every row, not the first ${String(CALC_ROWS)}`),scenario:f.string().optional().describe("Compute it with this scenario's inputs (the sheet's scenarios); nothing is written"),scenarios:f.boolean().default(!1).describe("Compare the base case and every scenario: what is names, cells or ranges, apart by commas, a row each; default the names no scenario sets"),dir:C}),positional:["sheet","what"],output:f.looseObject({}),examples:["allyhub sheet calc finance/budget","allyhub sheet calc finance/budget Summary","allyhub sheet calc finance/budget orders","allyhub sheet calc finance/budget 'Summary!B3:M3' --json","allyhub sheet calc finance/budget revenue --scenario high","allyhub sheet calc finance/budget 'revenue,Summary!B4' --scenarios"],run:async(e,n)=>{const s=await A(n.cwd,e.dir);if(e.scenarios)return Be(s,n,e.sheet,e.what);const{file:t,calc:o,problems:a,workbook:r}=await T(s,n,e.sheet,e.scenario);e.scenario!==void 0&&Ce(r,t,e.scenario);const i=z(o,e.what),h=e.all?1/0:CALC_ROWS;return{value:{file:t,grids:i,problems:a},text:[...i.flatMap((l,d)=>[...d>0?[""]:[],...Fe(l,h)]),...P(a)].join(`
|
|
4
|
+
`)}}});function Ie(e,n){return z(e,n.trim()).flatMap(s=>s.rows.flat().map(t=>({...t,address:t.address===""?n.trim():`${s.sheet}!${t.address}`})))}const Re=40;function Le(e){const n=e.map(r=>z(r,void 0)),s=e[0],t=(r,i)=>{const h=s?.wb.sheet(r),l=Z(i);if(!s||!h||!l||s.readers(h,l.row,l.col).length>0)return;const d=h.at(l.row,l.col);return d instanceof O?s.precedents(d).reduce((p,w)=>p+(w.bottom-w.top+1)*(w.right-w.left+1),0):0},o=[],a=[];for(const[r,i]of(n[0]??[]).entries())for(const[h,l]of i.rows.entries())for(const[d,p]of l.entries()){if(p.formula===void 0||new Set(n.map($=>$[r]?.rows[h]?.[d]?.shown)).size<2)continue;const g=`${i.sheet}!${p.address}`,c=t(i.sheet,p.address);c===void 0?a.push(g):o.push({at:g,reads:c})}return[...o.sort((r,i)=>i.reads-r.reads).map(r=>r.at),...a]}async function Be(e,n,s,t){const o=await T(e,n,s),a=K(o.workbook);if(a.length===0)throw new y("not-found",`${o.file} has no scenarios.`,{exit:x.notFound,hint:`${k(o.file)}'s scenarios: { high: { growth: 0.2 } } names some.`});const r=new Set(a.flatMap(c=>Object.keys(o.workbook.file.scenarios?.[c]??{}).map($=>$.toLowerCase()))),i=["Base case",...a],h=[o,...await Promise.all(a.map(c=>T(e,n,s,c)))],l=t===void 0?Le(h.map(c=>c.calc)):[],d=t?.split(",")??[...[...o.workbook.names.values()].map(c=>c.name).filter(c=>!r.has(c.toLowerCase())),...l].slice(0,Re);if(d.length===0)throw new y("bad-input","Its scenarios change nothing it computes. Say what to compare: names, cells or ranges, apart by commas.",{exit:x.usage});const w=d.map(c=>h.map($=>Ie($.calc,c))).flatMap(c=>(c[0]??[]).map(($,b)=>({output:$.address,values:Object.fromEntries(i.map((v,S)=>[v,c[S]?.[b]?.value??null])),shown:Object.fromEntries(i.map((v,S)=>[v,c[S]?.[b]?.shown??""]))}))),g=t===void 0?w.filter(c=>new Set(Object.values(c.shown)).size>1):w;return{value:{file:o.file,scenarios:i,outputs:g},text:[...U([["",...i],...g.map(c=>[c.output,...i.map($=>c.shown[$]??"")])]),...P(o.problems)].join(`
|
|
5
|
+
`)}}const Ne=(e,n)=>`${e.sheet===n?"":`${e.sheet.name}!`}${G({top:e.top,left:e.left,bottom:Math.min(e.bottom,Math.max(e.top,e.sheet.lastRow)),right:e.right})}`;export const sheetTrace=j({input:f.strictObject({sheet:f.string().describe("The sheet, by its file or its id in allyhub.yaml"),cell:f.string().describe("The cell: Summary!B5, or B5 on the first sheet"),all:f.boolean().default(!1).describe(`Every cell that reads it, not the first ${String(TRACE_CELLS)}`),dir:C}),positional:["sheet","cell"],output:f.looseObject({}),examples:["allyhub sheet trace finance/budget 'Summary!B1'"],run:async(e,n)=>{const s=await A(n.cwd,e.dir),{file:t,workbook:o,calc:a}=await T(s,n,e.sheet),{sheet:r,address:i}=se(o,e.cell),h=Z(i);if(!h)throw new y("bad-input",`${e.cell} is not a cell.`,{exit:x.usage});const{row:l,col:d}=h,p=a.value(r,l,d),w=r.lookAt(l,d).format,g=r.at(l,d),c=o.sourceOf(r,l,d),$=g instanceof O?a.precedents(g).map(m=>{const ie=m.single?E(a.value(m.sheet,m.top,m.left),m.sheet.lookAt(m.top,m.left).format):`${u(m.cols)} × ${u(Math.max(0,Math.min(m.bottom,m.sheet.lastRow)-m.top+1))}`,J=m.single?m.sheet.at(m.top,m.left):void 0,V=J instanceof O?J.text:void 0;return{address:Ne(m,r),shown:ie,...V===void 0?{}:{formula:V}}}):[],b=a.readers(r,l,d),v=e.all?b:b.slice(0,TRACE_CELLS),S=v.map(m=>({address:`${m.sheet===r?"":`${m.sheet.name}!`}${R(m)}`,shown:E(m.value,m.sheet.lookAt(m.row,m.col).format),formula:m.text})),W=m=>[` ${m.address}`,m.shown,m.formula].filter(Boolean).join(" "),H=c===void 0?void 0:c.file===L||c.file===""?t:I.join(we(t),c.file),M=c?.line===void 0?H:`${H??""}:${String(c.line)}`;return{value:{file:t,cell:`${r.name}!${R(h)}`,value:_(p,w),shown:E(p,w),...p instanceof be?{error:p.code}:{},...g instanceof O?{formula:g.text}:{},...M===void 0?{}:{written:M},reads:$,readBy:S,readers:b.length},text:[`${r.name}!${R(h)} ${E(p,w)}`,...g instanceof O?[` ${g.text}`]:[],...M===void 0?[]:[` written in ${M}`],...$.length>0?["reads:",...$.map(W)]:[],...b.length>0?[`read by ${u(b.length)}:`,...S.map(W),...b.length>v.length?[` … ${u(b.length-v.length)} more (--all)`]:[]]:["read by nothing"]].join(`
|
|
6
|
+
`)}}}),sheetCapabilities=j({input:f.strictObject({}),output:f.looseObject({}),examples:["allyhub sheet capabilities"],run:()=>Promise.resolve({value:{...Q},text:JSON.stringify(Q,null,2)})});const ne=new Set([".xlsx",".xlsm",".xltx",".xltm"]);export const DIFF_ROWS=50;const oe={value:"Value changed, formula the same",formula:"Formula changed, value the same",both:"Formula and value changed",added:"Added",removed:"Removed"},De=e=>{const n=(e.now??e.was)?.cell??"",s=e.table===void 0?n:`${e.table}[${e.key??n}]`,t=e.column===void 0?"":` ${e.column}`;return`${e.sheet}!${s}${t}`},_e=e=>{const n=e.was?.formula??"",s=e.now?.formula??"";return[De(e),e.was?.shown??"","→",e.now?.shown??"",e.kind==="value"?s:e.kind==="formula"||e.kind==="both"?`${n} → ${s}`:s===""?n:s]};function Pe(e,n){const s=[];for(const t of e.sheets)s.push(`Sheet ${t.name} ${t.added?"added":"removed"}`);for(const t of e.tables){const o=[t.rowsAdded.length>0?`rows added: ${t.rowsAdded.slice(0,20).join(", ")}`:"",t.rowsRemoved.length>0?`rows removed: ${t.rowsRemoved.slice(0,20).join(", ")}`:"",t.columnsAdded.length>0?`columns added: ${t.columnsAdded.join(", ")}`:"",t.columnsRemoved.length>0?`columns removed: ${t.columnsRemoved.join(", ")}`:""].filter(Boolean);s.push(`Table ${t.name}, rows lined up by ${t.by==="key"?t.key??"its key":"their place"}${o.length>0?`: ${o.join("; ")}`:""}`)}for(const t of e.names)s.push(`Name ${t.name}: ${t.was??"(none)"} → ${t.now??"(none)"}`);for(const t of e.parts)s.push(`${t.sheet??"Workbook"} ${t.part}${t.key===void 0?"":` ${t.key}`}: ${t.was??"(none)"} → ${t.now??"(none)"}`);for(const t of e.charts)s.push(`Charts of ${t} changed`);for(const t of Object.keys(oe)){const o=e.cells.filter(r=>r.kind===t);if(o.length===0)continue;const a=n?o:o.slice(0,DIFF_ROWS);s.push("",`${oe[t]}: ${u(o.length)}`,...U(a.map(_e)).map(r=>` ${r}`),...o.length>a.length?[` … ${u(o.length-a.length)} more (--all)`]:[])}return s}async function ae(e,n,s){const t=Y(n.cwd,s);if(ne.has(F(t).toLowerCase())){const r=await X(t).catch(()=>{throw new y("not-found",`There is no file ${t}.`,{exit:x.notFound})}),i=ee(new Uint8Array(r),{name:k(t,F(t))}),{calc:h}=ke({text:i.files.get(L)??"",read:l=>i.files.get(l)});if(!h)throw new y("bad-file",`${s} cannot be read.`,{exit:x.usage});return{calc:h,file:s}}const{calc:o,file:a}=await T(e,n,s);return{calc:o,file:a}}export const sheetDiff=j({input:f.strictObject({was:f.string().describe("The version before: a sheet (its file or its id) or an .xlsx"),now:f.string().describe("The version after: a sheet (its file or its id) or an .xlsx"),tolerance:f.number().min(0).default($e.tolerance).describe("How far apart two numbers may be, as a share of the larger, and be the same"),all:f.boolean().default(!1).describe(`Every cell, not the first ${String(DIFF_ROWS)} of each kind`),dir:C}),positional:["was","now"],output:f.looseObject({}),examples:["allyhub sheet diff finance/budget finance/budget-v2","allyhub sheet diff finance/budget ~/Downloads/budget.xlsx --json"],run:async(e,n)=>{const s=await A(n.cwd,e.dir),t=await ae(s,n,e.was),o=await ae(s,n,e.now),a=Se(t.calc,o.calc,{tolerance:e.tolerance}),{counts:r}=a,i=a.cells.length;return{value:{was:t.file,now:o.file,...a},text:[`${t.file} → ${o.file}: ${u(i)} cell${i===1?"":"s"} differ (${u(r.value)} value, ${u(r.formula)} formula, ${u(r.both)} both, ${u(r.added)} added, ${u(r.removed)} removed); ${u(a.names.length+a.parts.length)} other thing${a.names.length+a.parts.length===1?"":"s"} differ${a.names.length+a.parts.length===1?"s":""}`,...Pe(a,e.all)].join(`
|
|
7
|
+
`)}}});const ze=f.string().transform(e=>e.replace(/^\/+/gu,"")).refine(e=>e.endsWith(".yaml")&&!e.split("/").some(n=>n===""||n==="."||n===".."),{message:"a .yaml file from the project's root, such as research/leads.yaml"});export const IMPORT_DIFFERENCES=50;const re=e=>e===null?"empty":typeof e=="string"?JSON.stringify(e):String(e);function Ue(e,n){const{formulas:s,same:t,uncached:o,moving:a,differences:r}=e,i=[`${u(t)} of ${u(s)} formulas compute what the file holds`,...a>0?[`${u(a)} read the clock or a random number, not compared`]:[],...o>0?[`${u(o)} have no value in the file`]:[]],h=n?r:r.slice(0,IMPORT_DIFFERENCES);return[`Computed here against the file: ${i.join("; ")}.`,...r.length>0?[`${u(r.length)} differ${r.length===1?"s":""}:`,...h.map(l=>` ${l.sheet}!${l.cell} ${l.formula} file ${re(l.file)} here ${re(l.engine)}`),...r.length>h.length?[` … ${u(r.length-h.length)} more (--all)`]:[]]:[]]}async function le(e,n,s){const t=I.dirname(n),o=[...s].map(([a,r])=>({path:a===L?n:t==="."?a:`${t}/${a}`,content:r}));for(const{path:a}of o)if(await de(D(e,a)).catch(()=>{}))throw new y("place-taken",`${a} is already there.`,{exit:x.conflict,hint:"Name another file with --to."});for(const{path:a,content:r}of o){const i=D(e,a);await he(me(i),{recursive:!0}),await fe(i,r,{flag:"wx"})}return o.map(a=>a.path)}export const sheetImport=j({input:f.strictObject({file:f.string().describe("The file to make a sheet of: .xlsx, .xlsm, .csv or .tsv"),to:ze.optional().describe("The sheet's file, from the project's root (default <the file's name>.yaml); its tables' CSV files go beside it, under names no file there has"),maxUnzipped:f.number().positive().default(ue.bytes/1024/1024).describe("The most MB the file may unzip to"),tolerance:f.number().min(0).default(Te).describe("How far apart a computed number and the file's may be, as a share of the larger, and count as the same; 0 lists every difference"),all:f.boolean().default(!1).describe(`Every difference, not the first ${String(IMPORT_DIFFERENCES)}`),dir:C}),positional:["file"],output:f.looseObject({}),examples:["allyhub sheet import ~/Downloads/forecast.xlsx --to finance/forecast.yaml","allyhub sheet import ~/Downloads/leads.csv --to research/leads.yaml"],run:async(e,n)=>{const s=await A(n.cwd,e.dir),t=Y(n.cwd,e.file),o=F(t).toLowerCase(),a=ne.has(o);if(o===".xls"||o===".xlsb")throw new y("bad-file",`${k(t)} is Excel's binary format.`,{exit:x.usage,hint:"Save it as .xlsx, then import that."});if(!a&&o!==".csv"&&o!==".tsv")throw new y("bad-file",`${k(t)} is not an .xlsx, .xlsm, .csv or .tsv file.`,{exit:x.usage});const r=await X(t).catch(()=>{throw new y("not-found",`There is no file ${t}.`,{exit:x.notFound})}),i=k(t,F(t)),h=e.to??`${i}.yaml`,l=I.basename(h,".yaml"),d=pe(h),p=c=>ce(D(s,I.dirname(h),c));if(a){let c;try{c=ee(new Uint8Array(r),{name:l,tolerance:e.tolerance,zip:{bytes:e.maxUnzipped*1024*1024},taken:p})}catch(b){throw new y("bad-file",`${k(t)} cannot be read: ${b.message}`,{exit:x.usage})}const $=await le(s,h,new Map([...c.files,...c.assets]));return await q(s,{kind:"sheet",file:h},n.kinds(s)),{value:{id:d,files:$,sheets:c.sheets,tables:c.tables,lost:c.lost,problems:c.problems,compared:c.compared},text:[`Made ${$.join(", ")}; listed in allyhub.yaml as ${d}.`,...c.lost.length>0?["Not carried over:",...c.lost.map(b=>` ${b}`)]:["Nothing was left out."],...Ue(c.compared,e.all),...c.problems.length>0?["Problems:",...c.problems.map(b=>` ${b.file}${b.line===void 0?"":`:${String(b.line)}`}: ${b.message}`)]:[]].join(`
|
|
8
|
+
`)}}let w;try{w=je(l,r.toString("utf8"),o===".tsv"?" ":",",p)}catch(c){throw new y("bad-file",c.message,{exit:x.usage})}const g=await le(s,h,new Map([[L,w.text],[w.path,w.csv]]));return await q(s,{kind:"sheet",file:h},n.kinds(s)),{value:{id:d,files:g,rows:w.rows,lost:[]},text:`Made ${g.join(" and ")}, listed in allyhub.yaml as ${d}: ${u(w.rows)} row${w.rows===1?"":"s"}`}}});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{builtinModules as
|
|
2
|
+
import{builtinModules as b}from"node:module";import{existsSync as T,readFileSync as x,realpathSync as y}from"node:fs";import{readFile as p}from"node:fs/promises";import{dirname as v,isAbsolute as P,join as u,posix as E,relative as I}from"node:path";import{MetaLoader as j,besideModule as A,dependenciesOf as D,lineAt as F,nodeStackPlace as M,parse as N,projectTheme as R,walk as C}from"@allyhub/build";import{dirOf as g}from"@allyhub/formats";import{Calc as W,SHEET_CODE as k,SHEET_ENTRY as H,codeOf as K,dataFilesOf as L,placesOf as m,readWorkbook as _,tableRows as q}from"@allyhub/sheet";import{problem as S}from"@allyhub/diagnostics";import{repoPath as $}from"@allyhub/piece";const B=new Set([...b,...b.map(e=>`node:${e}`)]);export const sheetFilePath=e=>t=>t===H||t===""?e.file:t===k||t.startsWith(`${k}/`)?e.code??e.file:E.join(e.dir,t);export function sheetCodeOf(e,t){const n=K(t);return n===void 0?void 0:$(e,n)}async function U(e,t){const n=[],o=new Set,a=async r=>{if(o.has(r))return;o.add(r);const c=await p(u(e,r),"utf8").catch(()=>{});if(c===void 0)return;const l=N(r,c),d=[];C(l.program,s=>{if(s.type!=="ImportDeclaration"&&s.type!=="ImportExpression"&&s.type!=="ExportNamedDeclaration"&&s.type!=="ExportAllDeclaration")return;const i=s.source?.value;typeof i=="string"&&d.push({spec:i,node:s})});for(const{spec:s,node:i}of d){if(B.has(s)){n.push(S("AK-M012",`${r} imports ${s}. A sheet's code reads the project's files with data(), and reaches nothing else.`,{where:{file:r,line:F(c,i.start)}}));continue}if(s.startsWith(".")){const f=$(r,s);f!==void 0&&await a(f)}}};return await a(t),n}export async function runSheetCode(e,t,n){const o=await U(e,t),a=await n.request({type:"run",module:A(import.meta.url,"evaluate"),file:t});if(o.push(...a.problems),!a.ok){if(a.error!=="timeout"){const r=M(a.stack,e);o.push(S("AK-R001",`Failed to run ${t}: ${a.error??""}${r?` (at ${r.file}:${String(r.line)})`:""}`,{where:r?{file:r.file,line:r.line}:{file:t}}))}return{failed:!0,problems:o}}return{generated:a.value,failed:!1,problems:o}}export async function readSheetSource(e,t,n={}){const o=g(t),a=await p(u(e,t),"utf8"),r=new Map,c=new Map;for(const i of L(a))for(const f of m(o,i)){const h=await p(u(e,f),"utf8").catch(w=>{if(!O(w))throw w});if(h!==void 0){r.set(i,h),c.set(i,f);break}}const l=sheetCodeOf(t,a),d={file:t,dir:o,text:a,csv:r,at:c,...l===void 0?{}:{code:l},failed:!1,problems:[]};if(l===void 0)return d;const s=n.meta??new j({root:e,media:{},dependencies:[...await D(e)],user:!0,...n.lend?.lent?{lent:{...n.lend.lent}}:{},...n.lend?.sdk?{sdk:{...n.lend.sdk}}:{},...n.lend?.bound?{bound:{...n.lend.bound}}:{},...n.lend?.parts?{parts:{...n.lend.parts}}:{},...n.lend?.buildPlugins?{buildPlugins:[...n.lend.buildPlugins]}:{}});try{const i=await runSheetCode(e,l,s);d.failed=i.failed,d.problems=i.problems,i.generated&&(d.generated=i.generated)}finally{n.meta||await s.close()}return d}export function sheetRoot(e,t){const n=I(y(e),y(t));return n.startsWith("..")||P(n)?{root:v(t),file:E.basename(t)}:{root:e,file:n.split("\\").join("/")}}export function workbookFiles(e,t){return{text:t.text,read:n=>t.csv.get(n),generated:t.generated,theme:R(e),exists:n=>m(t.dir,n).some(o=>T(u(e,o)))}}export function readTable(e,t){const[n="",o=""]=t.split("#"),a=g(n),{workbook:r}=_({text:x(u(e,n),"utf8"),read:l=>readPlaced(e,a,l,d=>x(d,"utf8"))}),c=r?.table(o);if(!r||!c)throw new Error(`${t} is not a table of a sheet.`);return q(new W(r).calculate(),c)}const O=e=>e instanceof Error&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR"||e.code==="EISDIR");export function readPlaced(e,t,n,o){for(const a of m(t,n))try{return o(u(e,a))}catch(r){if(!O(r))throw r}}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readFileSync as
|
|
3
|
-
`)[4];return
|
|
2
|
+
import{existsSync as b,readFileSync as y}from"node:fs";import{join as n,posix as j}from"node:path";import{fromFolder as k,nodeStackPlace as x,parseData as N}from"@allyhub/build";import{problem as f}from"@allyhub/diagnostics";import{isSheetCode as v}from"@allyhub/sheet/api";import{typedNumbers as M}from"@allyhub/sheet";function O(e){const{stack:o}=new Error,r=o?.split(`
|
|
3
|
+
`)[4];return x(r,e)}function D(e){return o=>{const r=O(e.root);r&&e.report(f("AK-M012",`${r.file}:${String(r.line)} uses ${o}. A sheet's code makes the same workbook from the same files: a date or a random number is the data's, or a formula's (TODAY, RAND).`,{where:{file:r.file,line:r.line}}))}}function d(e,o){if(typeof e=="number")o.add(e);else if(Array.isArray(e))for(const r of e)d(r,o);else if(typeof e=="object"&&e!==null)for(const r of Object.values(e))d(r,o)}const E=async e=>{const{file:o}=e,r=D(e),m=`running ${o}`,u=(await e.import(o,{doing:m,strict:r})).default;if(!v(u))throw new Error("The default export is not a workbook: a sheet's code exports workbook((wb, { data }) => { … }) from @allyhub/sdk/sheets");const g=j.dirname(o),i=new Set,A=t=>{const a=k(g,t),l=k("",t),c=a!==void 0&&b(n(e.root,a))?a:l!==void 0&&b(n(e.root,l))?l:a;if(c===void 0||t.includes("#"))throw e.report(f("AK-M012",`${o} reads ${t}: data() reads a file of the project, from its module's folder.`,{where:{file:o}})),new Error(`${t} is not a file of the project.`);const w=N(c,y(n(e.root,c),"utf8"));return d(w,i),w},h=()=>e.guarded(()=>Promise.resolve(u.generate({data:A})),{doing:m,strict:r}),s=await h(),S=await h();JSON.stringify(s)!==JSON.stringify(S)&&e.report(f("AK-M012",`${o} made other sheets the second time it ran: what it keeps between runs is not the project's files.`,{where:{file:o}}));const $=y(n(e.root,o),"utf8");for(const t of $.matchAll(/(?<![\w.])-?\d[\d_]*(?:\.\d+)?(?:e[+-]?\d+)?/giu))i.add(Number(t[0].replaceAll("_","")));const p=M(s.sheets,s.csv).filter(t=>!i.has(t.value)).flatMap(t=>t.cell===void 0?[{sheet:t.sheet,cell:t.file??"",value:t.value}]:[{sheet:t.sheet,cell:t.cell,value:t.value}]);return{...s,...p.length>0?{typed:p}:{}}};export default E;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readFileSync as
|
|
3
|
-
`))});if(!u||!
|
|
2
|
+
import{readFileSync as A}from"node:fs";import{mkdir as H,writeFile as O}from"node:fs/promises";import{basename as _,dirname as E,join as M}from"node:path";import{nodeLending as U}from"@allyhub/build";import{readPlaced as z,readSheetSource as D,workbookFiles as G}from"./code.js";import{checkWorkbook as I,csvOf as W,printedLines as T,seededRandom as J,sheetHtml as X,SheetPrint as Y,tileSvg as q}from"@allyhub/sheet";import{writeXlsx as B}from"@allyhub/sheet/xlsx";export const SHEET_TYPES=["xlsx","pdf","png","csv"];export function csvNames(n){const t=new Set;return n.map((e,c)=>{const s=e.normalize("NFC").replace(/[\\/:*?"<>|\p{Cc}]+/gu,"-").replace(/\s+/gu," ").trim().replace(/^\.+/u,"")||String(c+1);let l=s;for(let a=2;t.has(l.toLowerCase());a++)l=`${s} (${String(a)})`;return t.add(l.toLowerCase()),l})}export const PNG_ROWS=700,PNG_COLUMNS=200;const K=1e4,Q=40;function V(n){const t=n.values,e=n.bom;return{...t==="data"||t==="shown"?{values:t}:{},...typeof e=="boolean"?{bom:e}:{}}}function Z(n){const t=[];let e=0,c=0;return n.job.pages.forEach((s,l)=>{const a=(s.down.to-s.down.from+s.of.titleRows.length)*(s.across.to-s.across.from+s.of.titleCols.length);l>e&&(c+a>K||l-e>=Q)&&(t.push([e,l]),e=l,c=0),c+=a}),e<n.job.pages.length&&t.push([e,n.job.pages.length]),t}function tt(){const n=Number(process.env.SOURCE_DATE_EPOCH);return Number.isFinite(n)&&n>0?new Date(n*1e3):new Date}const P=()=>import("@allyhub/doc-print");export async function printSheet(n,t){const e=new Y(n,t.picture===void 0?{}:{file:t.picture}),c=Z(e),s=t.date??tt(),{printPdf:l,SHEET_FONT:a,sheetFontsCss:u}=await P();return await l({file:t.file,title:t.title,tagged:!1,...t.signal===void 0?{}:{signal:t.signal},parts:{count:Math.max(1,c.length),html:async d=>{const[S,g]=c[d]??[0,0],$=e.html(S,g,{name:t.name,date:s,font:a});return $.replace("<style>",`<style>${await u($)}`)}}}),e.job.pages.length}export async function renderSheet(n,t){const e=t.prepared.sheets.find(o=>o.place===n.id);if(!e||t.types.length===0)return[];const{root:c,log:s}=t,l=V(t.params);s?.(`Rendering ${e.file}…`);const a=await D(c,e.file,{lend:await U(t.prepared.kinds,c)});if(a.failed)return s?.(`${e.file}: its code does not run. allyhub check says why.`),[];const{workbook:u,calc:d}=I(G(c,a),{random:J([a.text,...a.csv.values(),a.generated?JSON.stringify(a.generated):""].join(`
|
|
3
|
+
`))});if(!u||!d)return[];const S=o=>z(c,e.dir,o,f=>new Uint8Array(A(f))),g=[],$=u.sheets.length>1,y=e.place;for(const o of t.types){const f=t.out(o);await H(E(f),{recursive:!0});const b=_(f,`.${o}`),L=u.title??e.title??_(e.place);if(o==="pdf"){await printSheet(d,{file:f,name:b,title:L,picture:S});for(const i of T(`${y}.pdf`,d))s?.(i);g.push({type:o,files:[f]});continue}if(o==="png"){const{printPage:i,SHEET_FONT:h,sheetFontsCss:F}=await P(),x=csvNames(u.sheets.map(p=>p.name)),r=[],m=[];for(const[p,w]of u.sheets.entries()){const N=$?`${b}-${x[p]??String(p+1)}`:b,v=X(d,{sheets:[w],font:h,file:S,rows:PNG_ROWS,columns:PNG_COLUMNS,headings:!1});m.push(...v.cut.map(k=>`${y}.png: ${k}`)),await i({html:v.html.replace("<style>",`<style>${await F(v.html)}`),out:E(f),name:N,types:["png"],width:v.width+48,height:100,pictureCss:"body{padding:24px}"}),r.push(M(E(f),`${N}.png`))}g.push({type:o,files:r,...m.length?{notes:m}:{}});continue}if(o==="xlsx"){const i=new Map;for(const r of u.sheets)for(const m of r.tiles){const{svg:p,alt:w}=q(d,r,m,{ground:"#FFFFFF"});p!==void 0&&i.set(`${r.name}\0${String(m.index)}`,{svg:p,alt:w??""})}const h=i.size===0?new Map:await(await P()).svgPictures([...i.values()].map(r=>r.svg)),{bytes:F,left:x}=B(d,{file:S,tile:(r,m)=>{const p=i.get(`${r.name}\0${String(m.index)}`),w=p&&h.get(p.svg);return p&&w?{png:new Uint8Array(w.data),alt:p.alt}:void 0}});await O(f,F);for(const r of T(`${y}.xlsx`,d))s?.(r);g.push({type:o,files:[f],...x.length?{notes:x.map(r=>`${y}.xlsx does not hold ${r}.`)}:{}});continue}if(o!=="csv")continue;const C=[],R=f.slice(0,-`.${o}`.length),j=csvNames(u.sheets.map(i=>i.name));u.sheets.forEach((i,h)=>{C.push([$?`${R}-${j[h]??String(h+1)}.csv`:f,W(d,i,l)])});for(const[i,h]of C)await O(i,h),g.push({type:o,files:[i]})}return g}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{relative as
|
|
3
|
-
`)}}});async function I(e,t,n,
|
|
2
|
+
import{relative as d,sep as h}from"node:path";import{z as s}from"zod";import{FACTS_HEAD as f,PROJECT_DIR as p,ProjectError as c,allFindings as b,defineView as k,nodeLending as g}from"@allyhub/build";import{countFacts as y,factOf as w,filterFacts as E}from"@allyhub/diagnostics";import{itemIdOf as S}from"@allyhub/formats";import{INSPECT_DEFAULTS as u,SHEET_FACT_KINDS as F,checkWorkbook as N,inspectWorkbook as T,seededRandom as $}from"@allyhub/sheet";import{findSheet as j,SHEET_NAMED as v}from"./cli/open.js";import{readSheetSource as _,sheetRoot as A,workbookFiles as D}from"./code.js";const O=(e,t)=>`${String(e)} ${t}${e===1?"":"s"}`,R=(e,t)=>w(t.kind,{piece:e},t.data),C=e=>e.split(",").map(t=>Number(t.trim())),H=k({input:s.strictObject({sheet:s.string().describe("The sheet, by its file or its id in allyhub.yaml"),kind:s.array(s.string()).optional().describe(`Only facts of these kinds: ${F.join(", ")}`),plain:s.string().default(u.plain.join(",")).describe("Numbers a formula may hold and not be said, by commas; --all says them too"),around:s.number().int().min(1).default(u.around).describe("How many neighbours each side must read alike for a cell to be unlike them"),all:b("what normal sheets have too (numbers in formulas, cells unlike their neighbours, inputs nothing reads…), every number in every formula, and a table's columns nothing reads"),dir:p}),positional:["sheet"],examples:["allyhub inspect sheet finance/budget","allyhub inspect sheet finance/budget --kind sheet-error,sheet-number","allyhub inspect sheet finance/budget --plain 0,1,100 --all"],async run(e,t){const n=await t.root(e.dir),r=await j(n,t.cwd,e.sheet);if(r===void 0)throw new c("not-found",`There is no sheet ${e.sheet}.`,"not-found",v);const o=C(e.plain);if(o.some(l=>Number.isNaN(l)))throw new c("bad-option",`${e.plain} is not numbers.`,"usage");const a=await I(n,r,t.kinds(n),{plain:o,around:e.around,all:e.all,normal:(e.kind??[]).length>0}),i=E(a,{kinds:t.factKinds(e.kind,n)});return{value:{file:d(n,r),facts:i,counts:y(i),total:a.length},text:[`${O(i.length,"fact")}: ${f}`,...t.factLines(i,{all:e.all})].join(`
|
|
3
|
+
`)}}});async function I(e,t,n,r){const o=A(e,t),a=await _(o.root,o.file,{lend:await g(n,o.root)}),{calc:i}=N(D(o.root,a),{random:$(a.text)});if(!i)return[];const l=S(d(e,t).split(h).join("/"));return T(i,r).map(m=>R(l,m))}const L={sheet:H};export default L;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{readFile as a,writeFile as o}from"node:fs/promises";import{join as s}from"node:path";import{defineMigrations as f}from"@allyhub/build";export function withPixelUnits(e){if(!/^sheets\s*:/mu.test(e)||/^units\s*:/mu.test(e))return;const t=e.split(`
|
|
3
|
+
`);let n=0;for(;n<t.length&&/^\s*(?:#.*|---\s*)?$/u.test(t[n]??"");)n++;return t.splice(n,0,"units: px"),t.join(`
|
|
4
|
+
`)}const d=async e=>a(s(e,".allyhub","migrated.json"),"utf8").then(t=>JSON.parse(t)["sheet-units"]!==void 0,()=>!1);export default f({migrations:[{to:2,about:"Sheets written in pixels say units: px, so they read as they were written.",async run({root:e,files:t}){if(await d(e))return[];const n=[];for(const i of t){if(!/\.ya?ml$/u.test(i))continue;const r=await a(s(e,i),"utf8").catch(()=>{}),u=r===void 0?void 0:withPixelUnits(r);u!==void 0&&(await o(s(e,i),u),n.push(i))}return n}}]});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{defineProjectTool as
|
|
2
|
+
import{defineProjectTool as n,projectTheme as r}from"@allyhub/build";import{SHEET_TOOLS as a}from"./tools.js";const i={"sheet/generated":n(a["sheet/generated"],async({item:d},t)=>{const e=await t.itemCode(d),o=r(t.root);return{failed:e.failed,...e.value===void 0?{}:{generated:e.value},...o===void 0?{}:{theme:o}}})};export default i;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{z as e}from"zod";import{PathSchema as t,method as o,toolCaller as a}from"@allyhub/protocol";export const SHEET_TOOLS={"sheet/generated":o(e.strictObject({item:t}),e.strictObject({generated:e.unknown().optional(),failed:e.boolean()}),"What a sheet's code makes now: sheets as the sheet's file would hold them. Never written to a file.")},callSheetTool=a(SHEET_TOOLS);
|
|
2
|
+
import{z as e}from"zod";import{PathSchema as t,method as o,toolCaller as a}from"@allyhub/protocol";export const SHEET_TOOLS={"sheet/generated":o(e.strictObject({item:t}),e.strictObject({generated:e.unknown().optional(),failed:e.boolean(),theme:e.unknown().optional()}),"What a sheet's code makes now: sheets as the sheet's file would hold them, and the project's theme. Never written to a file.")},callSheetTool=a(SHEET_TOOLS);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allyhub/sheet-extension",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./code": {
|
|
@@ -94,7 +94,11 @@
|
|
|
94
94
|
"entry": "{{name}}.yaml"
|
|
95
95
|
},
|
|
96
96
|
"share": true,
|
|
97
|
-
"build": "./dist/build.js"
|
|
97
|
+
"build": "./dist/build.js",
|
|
98
|
+
"migrations": {
|
|
99
|
+
"format": 2,
|
|
100
|
+
"module": "./dist/migrations.js"
|
|
101
|
+
}
|
|
98
102
|
}
|
|
99
103
|
],
|
|
100
104
|
"editors": [
|
|
@@ -160,7 +164,7 @@
|
|
|
160
164
|
"inspectViews": [
|
|
161
165
|
{
|
|
162
166
|
"name": "sheet",
|
|
163
|
-
"summary": "A workbook's facts
|
|
167
|
+
"summary": "A workbook's facts: error values by cell, numbers written into formulas, a cell unlike its neighbours, what nothing reads, exceptions in calculated columns, values under a validation that breaks them, the rounds iterative calculation ran",
|
|
164
168
|
"module": "./dist/inspect.js"
|
|
165
169
|
}
|
|
166
170
|
],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{themeColor as P,themeColorOf as
|
|
2
|
+
import{themeColor as P,themeColorOf as A}from"@allyhub/chart";import{presetAdjustments as ne}from"@allyhub/ooxml/geometry";import{connectorBetween as oe,connectorEnds as ae,siteOn as he,sitesOf as de}from"./connect.js";import{framedComponent as le}from"@allyhub/piece";import{addOfficeMaster as fe}from"./office-layouts.js";import{DECK_STYLES as F,STYLE_NAMES as ce,addStyleMaster as ue,isStyleName as pe}from"./styles/index.js";import{COLOR_TRANSFORMS as I,colorFile as z,colorOfFile as _e,GRADIENT_PATHS as C,inGroup as D,PictureRecolorSchema as ge,THEME_COLORS as M}from"@allyhub/formats";import{pictureLookOf as me,SEPIA as G}from"./resolve.js";import{MSO_ARROWHEAD as H,MSO_ARROWHEAD_SIZE as O,MSO_CONNECTOR as we,MSO_LINE as be,MSO_LINE_CAP as ye,MSO_LINE_COMPOUND as xe,MSO_LINE_JOIN as Ee,MSO_PATTERN_TYPE as Se,TILE_ALIGNMENT as Oe,MSO_SHAPE as U,MSO_SHAPE_TYPE as ke,MSO_TEXT_ORIENTATION as B,PP_PLACEHOLDER as Y}from"./enums.js";import{Chart as $e}from"./chart-api.js";import{AUTOSHAPE_STYLE as b,SHADOW_DEFAULTS as W,LINE_DEFAULTS as E,PATTERN_DEFAULTS as k,TILE_DEFAULTS as X,INNER_SHADOW_DEFAULTS as Te,GLOW_DEFAULTS as J,REFLECTION_DEFAULTS as Ae,PLAYBACK_DEFAULTS as Z,CONNECTOR_GEOMETRIES as Me,CONNECTOR_STYLE as K,FOOTER_IDX as Re,isConnectorGeometry as R,OFFICE_TEXT_STYLES as je,placeholderLevels as Le,TEXT_INSETS as x,TEXTBOX_FRAME as Ne,BULLET_HANG as Pe,NUMBER_HANG as Fe,LEVEL_STEP as Ie}from"./office.js";import{masterPlaceholder as q}from"./placeholders.js";import{strict as h}from"./strict.js";import{DEFAULT_TABLE_STYLE as ze,TABLE_STYLES as Ce,tableStyleOf as V}from"./table-style.js";import{EMU_PER_PT as j,SLIDE_SIZES as L,length as l,lengthOr as $}from"./units.js";class De extends Error{constructor(e){super(`${e} (allyhub slides capabilities lists what the API holds).`),this.name="Unsupported"}}export const refuse=i=>{throw new De(i)};const Ge=/^#?[0-9a-f]{6}$/iu,Q=i=>{if(!Ge.test(i))throw new Error(`rgb ${i} is not RRGGBB.`);return`#${i.replace("#","").toUpperCase()}`};function N(i,e){if(typeof i!="string")return i;const t=_e(i);if(t===void 0)throw new Error(`${e} is a theme colour (accent1), one lighter or darker (accent1 lighter 40%) or #RRGGBB, not ${i}.`);return t}export const OFFICE_COLOR_MAP={...Object.fromEntries(M.map(i=>[i,i])),tx1:"dk1",bg1:"lt1",tx2:"dk2",bg2:"lt2"};const He=["bg1","tx1","bg2","tx2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"];function v(i){const e={};for(const[t,s]of Object.entries(i))if(s!==void 0){if(!He.includes(t))throw new Error(`A colour map maps bg1, tx1, bg2, tx2, accent1 to accent6, hlink and folHlink, not ${t}.`);if(!M.includes(s))throw new Error(`A colour map's ${t} is one of the theme's colours (${M.join(", ")}), not ${s}.`);e[t]=s}return e}export const RGBColor=Object.assign(function(e,t,s){for(const o of[e,t,s])if(!Number.isInteger(o)||o<0||o>255)throw new Error(`RGBColor(${String(e)}, ${String(t)}, ${String(s)}): each is 0 to 255.`);const r=`#${[e,t,s].map(o=>o.toString(16).padStart(2,"0")).join("").toUpperCase()}`;return new.target===void 0?r:new String(r)},{from_string:i=>Q(i)});export class ColorFormat{read;write;constructor(e,t){return this.read=e,this.write=t,h(this,"ColorFormat")}get theme_color(){const e=this.read();return e===void 0?void 0:A(e)}set theme_color(e){const t=this.read();e!==void 0&&typeof t=="object"&&"transforms"in t?this.write(t.transforms.length>0?{theme_color:e,transforms:t.transforms}:e):this.write(e===void 0?void 0:P(e,this.brightness))}get transforms(){const e=this.read();return typeof e=="object"&&"transforms"in e?[...e.transforms??[]]:[]}set transforms(e){const t=this.read();if(t===void 0)throw new TypeError("There is no colour to transform: set theme_color or rgb first.");for(const r of e)if(!I.includes(r.name))throw new Error(`A colour's transform is one of ${I.join(", ")}, not ${r.name}.`);const s=e.map(r=>({name:r.name,value:r.value}));if(typeof t=="object"&&"rgb"in t)this.write(s.length>0?{rgb:t.rgb,transforms:s}:{rgb:t.rgb});else{const r=A(t)??"dk1";this.write(s.length>0?{theme_color:r,transforms:s}:r)}}get brightness(){const e=this.read();return typeof e=="object"&&"brightness"in e?e.brightness:0}set brightness(e){if(!(e>=-1&&e<=1))throw new RangeError(`brightness ${String(e)} is not a number from -1.0 to 1.0.`);const t=this.read();if(t===void 0)throw new TypeError("There is no colour to set the brightness of: set theme_color first.");const s=A(t);if(s!==void 0)this.write(P(s,e));else if(e!==0)throw new TypeError("Only a theme colour has a brightness here, so an RGB colour does not: set theme_color first, or rgb to the colour it makes.")}get rgb(){const e=this.read();return typeof e=="object"&&"rgb"in e?e.rgb:void 0}set rgb(e){this.write(e===void 0?void 0:{rgb:Q(e)})}}export class Font{def;constructor(e){return this.def=e,h(this,"Font")}_set(e,t){t===void 0?Reflect.deleteProperty(this.def,e):this.def[e]=t}get strike(){const e=this.def.strike;return e==="sngStrike"?!0:e}set strike(e){this._set("strike",e==="noStrike"?!1:e==="sngStrike"?!0:e)}get caps(){return this.def.caps}set caps(e){this._set("caps",e)}get baseline(){return this.def.baseline}set baseline(e){this._set("baseline",e)}get highlight(){return this.def.highlight}set highlight(e){this._set("highlight",e)}get name(){return this.def.name}set name(e){this._set("name",e)}get size(){return $(this.def.size)}set size(e){if(e!==void 0&&e<12700)throw new Error(`A font size is a Length of Pt(1) and over: Pt(${String(e)}) for ${String(e)} points; ${String(e)} alone is ${String(e)} EMU.`);this._set("size",e)}get bold(){return this.def.bold}set bold(e){this._set("bold",e)}get italic(){return this.def.italic}set italic(e){this._set("italic",e)}get underline(){const e=this.def.underline;return e==="sng"?!0:e}set underline(e){this._set("underline",e==="none"?!1:e==="sng"?!0:e)}get spacing(){return $(this.def.spacing)}set spacing(e){this._set("spacing",e)}get color(){return new ColorFormat(()=>this.def.color,e=>{this._set("color",e)})}}export class Hyperlink{def;constructor(e){return this.def=e,h(this,"_Hyperlink")}get address(){return this.def.font?.link}set address(e){this.def.font??={},e===void 0?Reflect.deleteProperty(this.def.font,"link"):this.def.font.link=e}}export class Run{def;constructor(e){return this.def=e,h(this,"_Run")}get text(){return this.def.text}set text(e){this.def.text=e}get font(){return this.def.font??={},new Font(this.def.font)}get hyperlink(){return new Hyperlink(this.def)}}const Ue=i=>{if(!Number.isFinite(i)||i<=0)throw new Error(`line_spacing ${String(i)} is not over 0.`);return Number.isInteger(i)&&i>=j?{fixed:i}:{lines:i}},Be=i=>i===void 0?void 0:"lines"in i?i.lines:l(i.fixed),ee=i=>{if(!Number.isFinite(i)||i<0)throw new Error(`A paragraph's space ${String(i)} is under 0.`);return i===0||Number.isInteger(i)&&i>=j?i:{lines:i}},te=i=>i===void 0?void 0:typeof i=="number"?l(i):i.lines,se=i=>i.split(/\n|\v/u).flatMap((e,t)=>[...t>0?[{text:"\v"}]:[],...e===""?[]:[{text:e}]]);class re{_set(e,t){t===void 0?Reflect.deleteProperty(this.fmt,e):this.fmt[e]=t}get alignment(){return this.fmt.alignment}set alignment(e){this._set("alignment",e)}get line_spacing(){return Be(this.fmt.line_spacing)}set line_spacing(e){this._set("line_spacing",e===void 0?void 0:Ue(e))}get space_before(){return te(this.fmt.space_before)}set space_before(e){this._set("space_before",e===void 0?void 0:ee(e))}get space_after(){return te(this.fmt.space_after)}set space_after(e){this._set("space_after",e===void 0?void 0:ee(e))}get font(){return this.fmt.font??={},new Font(this.fmt.font)}}export class Paragraph extends re{fmt;constructor(e){return super(),this.fmt=e,h(this,"_Paragraph")}get text(){return this.fmt.runs.map(e=>e.text).join("")}set text(e){this.fmt.runs=se(e)}get runs(){return this.fmt.runs.filter(e=>e.text!=="\v").map(e=>new Run(e))}add_run(){const e={text:""};return this.fmt.runs.push(e),new Run(e)}add_line_break(){this.fmt.runs.push({text:"\v"})}clear(){return this.fmt.runs=[],this}get level(){return this.fmt.level}set level(e){if(!Number.isInteger(e)||e<0||e>8)throw new Error(`level ${String(e)} is not 0 to 8.`);this.fmt.level=e}}export class ListLevel extends re{fmt;index;hangs;constructor(e,t=0,s=!1){return super(),this.fmt=e,this.index=t,this.hangs=s,h(this,"ListLevel")}hang(e){if(!this.hangs||this.fmt.margin_left!==void 0||this.fmt.indent!==void 0)return;const t=e?Fe:Pe;this.fmt.margin_left=this.index*Ie+t,this.fmt.indent=-t}get numbered(){return this.fmt.numbered}set numbered(e){this._set("numbered",e),e!==void 0&&this.hang(!0)}get bullet(){return this.fmt.bullet}set bullet(e){this._set("bullet",e),typeof e=="string"&&this.hang(!1)}get bullet_font(){return this.fmt.bullet_font}set bullet_font(e){this._set("bullet_font",e)}get bullet_color(){return this.fmt.bullet_color}set bullet_color(e){this._set("bullet_color",e==null?e:N(e,"bullet_color"))}get bullet_size(){return this.fmt.bullet_size}set bullet_size(e){if(typeof e=="number"&&!(e>=.25&&e<=4))throw new Error(`bullet_size is a share of the text's size, 0.25 to 4, not ${String(e)}.`);this._set("bullet_size",e)}get start_at(){return this.fmt.start_at}set start_at(e){if(e!==void 0&&!(Number.isInteger(e)&&e>=1&&e<=32767))throw new Error(`start_at is a whole number from 1 to 32767, not ${String(e)}.`);this._set("start_at",e)}get margin_left(){return $(this.fmt.margin_left)}set margin_left(e){this._set("margin_left",e)}get indent(){return $(this.fmt.indent)}set indent(e){this._set("indent",e)}}const T=(i,e=!1)=>Object.freeze(i.map((t,s)=>new ListLevel(t,s,e))),Ye=()=>Array.from({length:9},()=>({})),S=()=>({paragraphs:[],levels:Ye()});export class TextFrame{def;hangs;constructor(e,t=!1){return this.def=e,this.hangs=t,h(this,"TextFrame")}_set(e,t){t===void 0?Reflect.deleteProperty(this.def,e):this.def[e]=t}get text(){return this.def.paragraphs.map(e=>e.runs.map(t=>t.text).join("")).join(`
|
|
3
3
|
`)}set text(e){this.def.paragraphs=e.split(`
|
|
4
|
-
`).map(t=>({runs:V(t),level:0}))}get paragraphs(){return this.def.paragraphs.length===0&&this.def.paragraphs.push({runs:[],level:0}),this.def.paragraphs.map(e=>new Paragraph(e))}add_paragraph(){this.def.paragraphs.length===0&&this.def.paragraphs.push({runs:[],level:0});const e={runs:[],level:0};return this.def.paragraphs.push(e),new Paragraph(e)}clear(){const e=this.def.paragraphs[0];this.def.paragraphs=e?[{...e,runs:[]}]:[]}fit_text(e,t=18,r,s){this.def.auto_size="text",this.def.word_wrap=!0;for(const n of this.def.paragraphs)for(const o of n.runs)o.font={...o.font,size:Math.trunc(t*R),...e===void 0?{}:{name:e},...r===void 0?{}:{bold:r},...s===void 0?{}:{italic:s}}}get list_style(){return k(this.def.levels)}get vertical_anchor(){return this.def.vertical_anchor}set vertical_anchor(e){this._set("vertical_anchor",e)}get orientation(){return this.def.orientation}set orientation(e){if(e!==void 0&&!Object.values(G).includes(e))throw new Error(`orientation is one of MSO_TEXT_ORIENTATION's ${Object.values(G).join(", ")}, not ${e}.`);this._set("orientation",e)}get auto_size(){return this.def.auto_size}set auto_size(e){this._set("auto_size",e)}get word_wrap(){return this.def.word_wrap}set word_wrap(e){this._set("word_wrap",e)}get margin_left(){return l(this.def.margin_left??w.left)}set margin_left(e){this.def.margin_left=e}get margin_top(){return l(this.def.margin_top??w.top)}set margin_top(e){this.def.margin_top=e}get margin_right(){return l(this.def.margin_right??w.right)}set margin_right(e){this.def.margin_right=e}get margin_bottom(){return l(this.def.margin_bottom??w.bottom)}set margin_bottom(e){this.def.margin_bottom=e}}export class FillFormat{read;write;start;shape;base;constructor(e,t,r="lt1",s,n=""){return this.read=e,this.write=t,this.start=r,this.shape=s,this.base=n,a(this,"FillFormat")}_only(e){if(this.shape)for(const t of["gradient","pattern","picture_fill"])t!==e&&Reflect.deleteProperty(this.shape,t)}solid(){const e=this.read();this._only("solid"),e==null&&this.write(this.start)}background(){this._only("solid"),this.write(null)}patterned(){const e=this._shape("a pattern");this._only("pattern"),e.pattern??={preset:"pct5",fg:O.fg,bg:O.bg}}get pattern(){return this._pattern().preset}set pattern(e){this._pattern().preset=p(ue,"MSO_PATTERN_TYPE","pattern",e)}_pattern(){const{pattern:e}=this._shape("a pattern");if(!e)throw new TypeError("This fill is no pattern: call fill.patterned() first.");return e}get back_color(){const e=this._pattern();return new ColorFormat(()=>e.bg,t=>{e.bg=t??O.bg})}picture(e,t={}){const r=this._shape("a picture");this._only("picture_fill"),r.picture_fill={path:e,base:this.base,...t.tile?{tile:{...B,...t.tile,align:p(pe,"TILE_ALIGNMENT","tile.align",t.tile.align??B.align)}}:{},...t.transparency===void 0?{}:{transparency:t.transparency}}}_shape(e){if(!this.shape)throw new TypeError(`Only a shape's fill has ${e}.`);return this.shape}gradient(){this._only("gradient"),this._shape("a gradient").gradient??={angle:90,stops:[{at:0,color:"accent1"},{at:1,color:"accent2"}]}}get gradient_path(){return this._gradient().path??"linear"}set gradient_path(e){const t=this._gradient();e==="linear"?delete t.path:z.includes(e)?t.path=e:refuse(`gradient_path is "linear", ${z.map(r=>`"${r}"`).join(", ")}, not ${e}.`)}get gradient_focus(){return{...this._gradient().focus??{left:.5,top:.5,right:.5,bottom:.5}}}set gradient_focus(e){this._gradient().focus={...e}}get gradient_angle(){return this._gradient().angle}set gradient_angle(e){this._gradient().angle=e}get gradient_stops(){return this._gradient().stops.map(e=>new GradientStop(e))}set gradient_stops(e){if(e.length<2)throw new Error("A gradient has two stops at least.");this._gradient().stops=e.map(t=>t instanceof GradientStop?GradientStop.defOf(t):{...t,color:N(t.color,"A gradient stop's colour")})}_gradient(){const{gradient:e}=this._shape("a gradient");if(!e)throw new TypeError("This fill is no gradient: call fill.gradient() first.");return e}get transparency(){return this._shape("a transparency").fill_transparency??0}set transparency(e){if(!(e>=0&&e<=1))throw new Error(`A transparency is a share, 0 to 1, not ${String(e)}.`);this._shape("a transparency").fill_transparency=e}get type(){if(this.shape?.picture_fill)return"picture";if(this.shape?.pattern)return"patterned";if(this.shape?.gradient)return"gradient";const e=this.read();return e===void 0?void 0:e===null?"background":"solid"}get fore_color(){const e=this.shape?.pattern;if(e)return new ColorFormat(()=>e.fg,r=>{e.fg=r??O.fg});const t=this.read();if(t==null)throw new TypeError("This fill is not solid, so it has no fore_color: call fill.solid() first.");return new ColorFormat(()=>this.read()??void 0,r=>{this.write(r??this.start)})}}export class GradientStop{stop;constructor(e){return this.stop=e,a(this,"GradientStop")}static defOf(e){return{...e.stop}}get color(){return new ColorFormat(()=>this.stop.color,e=>{e!==void 0&&(this.stop.color=e)})}get position(){return this.stop.at}set position(e){if(!(e>=0&&e<=1))throw new Error(`A stop's position is a share, 0 to 1, not ${String(e)}.`);this.stop.at=e}get transparency(){return this.stop.transparency??0}set transparency(e){if(!(e>=0&&e<=1))throw new Error(`A transparency is a share, 0 to 1, not ${String(e)}.`);e===0?Reflect.deleteProperty(this.stop,"transparency"):this.stop.transparency=e}}export class ShadowFormat{def;inner;constructor(e,t=!1){return this.def=e,this.inner=t,a(this,"ShadowFormat")}_shadow(){return this.inner?(this.def.inner_shadow??={...me},this.def.inner_shadow):(this.def.shadow??={...U},this.def.shadow)}get visible(){return this.inner?this.def.inner_shadow!==void 0:this.def.shadow!==void 0&&this.def.shadow!==null}set visible(e){e?this._shadow():this.inner?Reflect.deleteProperty(this.def,"inner_shadow"):this.def.shadow=null}get inherit(){return this.def.shadow===void 0}set inherit(e){e?Reflect.deleteProperty(this.def,"shadow"):this.def.shadow??=null}get blur_radius(){return l(this._shadow().blur)}set blur_radius(e){this._shadow().blur=e}get distance(){return l(this._shadow().distance)}set distance(e){this._shadow().distance=e}get angle(){return this._shadow().angle}set angle(e){this._shadow().angle=e}get transparency(){return this._shadow().transparency}set transparency(e){this._shadow().transparency=e}get color(){const e=this._shadow();return new ColorFormat(()=>e.color,t=>{e.color=t??U.color})}}export class GlowFormat{def;constructor(e){return this.def=e,a(this,"GlowFormat")}_glow(){return this.def.glow??={...v},this.def.glow}get visible(){return this.def.glow!==void 0}set visible(e){e?this._glow():Reflect.deleteProperty(this.def,"glow")}get radius(){return l(this.def.glow?.size??0)}set radius(e){e<=0?Reflect.deleteProperty(this.def,"glow"):this._glow().size=e}get transparency(){return this._glow().transparency}set transparency(e){this._glow().transparency=e}get color(){const e=this._glow();return new ColorFormat(()=>e.color,t=>{e.color=t??v.color})}}export class SoftEdgeFormat{def;constructor(e){return this.def=e,a(this,"SoftEdgeFormat")}get radius(){return l(this.def.soft_edges??0)}set radius(e){e<=0?Reflect.deleteProperty(this.def,"soft_edges"):this.def.soft_edges=e}}export class ReflectionFormat{def;constructor(e){return this.def=e,a(this,"ReflectionFormat")}_reflection(){return this.def.reflection??={...we},this.def.reflection}get visible(){return this.def.reflection!==void 0}set visible(e){e?this._reflection():Reflect.deleteProperty(this.def,"reflection")}get transparency(){return this._reflection().transparency}set transparency(e){this._reflection().transparency=e}get size(){return this._reflection().size}set size(e){this._reflection().size=e}get offset(){return l(this._reflection().distance)}set offset(e){this._reflection().distance=e}get blur(){return l(this._reflection().blur)}set blur(e){this._reflection().blur=e}}export class LineFormat{def;constructor(e){return this.def=e,a(this,"LineFormat")}get color(){return new ColorFormat(()=>this.def.line??void 0,e=>{this.def.line=e??null})}get fill(){return new FillFormat(()=>this.def.line,e=>{this.def.line=e},"dk1")}get width(){return l(this.def.line_width??0)}set width(e){this.def.line_width=e}get dash_style(){return this.def.line_dash??null}set dash_style(e){e===null?delete this.def.line_dash:this.def.line_dash=p(de,"MSO_LINE","dash_style",e)}get cap_type(){return this.def.line_cap??x.cap}set cap_type(e){const t=p(le,"MSO_LINE_CAP","cap_type",e);t===x.cap?delete this.def.line_cap:this.def.line_cap=t}get join_type(){return this.def.line_join??x.join}set join_type(e){const t=p(ce,"MSO_LINE_JOIN","join_type",e);t===x.join?delete this.def.line_join:this.def.line_join=t}get compound_type(){return this.def.line_compound??x.compound}set compound_type(e){const t=p(fe,"MSO_LINE_COMPOUND","compound_type",e);t===x.compound?delete this.def.line_compound:this.def.line_compound=t}get begin_arrow(){return this.def.line_begin??"none"}set begin_arrow(e){this.def.line_begin=p(C,"MSO_ARROWHEAD","begin_arrow",e)}get end_arrow(){return this.def.line_end??"none"}set end_arrow(e){this.def.line_end=p(C,"MSO_ARROWHEAD","end_arrow",e)}get begin_arrow_width(){return this.def.line_begin_size?.w??"med"}set begin_arrow_width(e){this.def.line_begin_size={...this.def.line_begin_size,w:p(S,"MSO_ARROWHEAD_SIZE","begin_arrow_width",e)}}get begin_arrow_length(){return this.def.line_begin_size?.len??"med"}set begin_arrow_length(e){this.def.line_begin_size={...this.def.line_begin_size,len:p(S,"MSO_ARROWHEAD_SIZE","begin_arrow_length",e)}}get end_arrow_width(){return this.def.line_end_size?.w??"med"}set end_arrow_width(e){this.def.line_end_size={...this.def.line_end_size,w:p(S,"MSO_ARROWHEAD_SIZE","end_arrow_width",e)}}get end_arrow_length(){return this.def.line_end_size?.len??"med"}set end_arrow_length(e){this.def.line_end_size={...this.def.line_end_size,len:p(S,"MSO_ARROWHEAD_SIZE","end_arrow_length",e)}}}function p(i,e,t,r){if(Object.values(i).includes(r))return r;throw new Error(`${t}: ${String(r)} is not one of ${e}'s ${Object.keys(i).join(", ")}.`)}export class Background{holder;constructor(e){return this.holder=e,a(this,"_Background")}get fill(){return new FillFormat(()=>this.holder.background,e=>{this.holder.background=e??"bg1"})}}export const adjustmentDefaults=i=>te(i).map(e=>e.value/1e5);export class Adjustments{def;constructor(e){return this.def=e,a(this,"Adjustments",{index:t=>this._values()[t],setIndex:(t,r)=>{this._set(t,Number(r))}})}_values(){return this.def.adjustments??adjustmentDefaults(this.def.geometry??"rect")}get length(){return this._values().length}_set(e,t){const r=this._values();if(e<0||e>=r.length)throw new RangeError(`adjustments[${String(e)}]: ${this.def.geometry??"this shape"} has ${String(r.length)}.`);if(!Number.isFinite(t))throw new Error(`adjustments[${String(e)}] = ${String(t)} is not a number.`);r[e]=t,this.def.adjustments=r}}const Ne={left:0,top:0,width:0,height:0};export class Shape{def;inherit;base;constructor(e,t=()=>{},r=""){return this.def=e,this.inherit=t,this.base=r,a(this,"Shape")}get _def(){return this.def}_frame(){return this.def.frame??this.inherit()??Ne}_own(){return this.def.frame??={...this._frame()},this.def.frame}get name(){return this.def.name}set name(e){this.def.name=e}get shape_type(){return this.def.path?"freeform":this.def.kind==="audio"||this.def.kind==="item"?"movie":M(this.def.geometry)?"line":this.def.kind}get is_placeholder(){return this.def.kind==="placeholder"}get has_table(){return this.def.table!==void 0}get has_chart(){return this.def.chart!==void 0}get chart(){if(!this.def.chart)throw new Error(`${this.def.name} is not a chart.`);return new ge(this.def.chart)}get table(){if(!this.def.table)throw new Error(`${this.def.name} is not a table.`);return new Table(this.def.table)}get placeholder_format(){if(!this.def.placeholder)throw new Error(`${this.def.name} is not a placeholder.`);return a({...this.def.placeholder},"_PlaceholderFormat")}get left(){return l(this._frame().left)}set left(e){this._own().left=e}get top(){return l(this._frame().top)}set top(e){this._own().top=e}get width(){return l(this._frame().width)}set width(e){this._own().width=e}get height(){return l(this._frame().height)}set height(e){this._own().height=e}get rotation(){return this.def.rotation??0}set rotation(e){if(!Number.isFinite(e))throw new Error(`${this.def.name}: rotation is a number of degrees.`);const t=(Math.trunc(e*6e4)%216e5+216e5)%216e5/6e4;t===0?Reflect.deleteProperty(this.def,"rotation"):this.def.rotation=t}get flip_h(){return this.def.flip?.h===!0}set flip_h(e){this._flip("h",e)}get flip_v(){return this.def.flip?.v===!0}set flip_v(e){this._flip("v",e)}_flip(e,t){const r={...this.def.flip};t?r[e]=!0:Reflect.deleteProperty(r,e),Object.keys(r).length===0?Reflect.deleteProperty(this.def,"flip"):this.def.flip=r}get has_text_frame(){return this.def.text!==void 0}get text_frame(){if(!this.def.text)throw new Error(`${this.def.name} (a ${this.shape_type}) has no text frame: has_text_frame is false.`);return new TextFrame(this.def.text)}get text(){return this.text_frame.text}set text(e){this.text_frame.text=e}get fill(){return new FillFormat(()=>this.def.fill,e=>{this.def.fill=e},"lt1",this.def,this.base)}get line(){return new LineFormat(this.def)}get shadow(){return new ShadowFormat(this.def)}get inner_shadow(){return new ShadowFormat(this.def,!0)}get glow(){return new GlowFormat(this.def)}get soft_edge(){return new SoftEdgeFormat(this.def)}get reflection(){return new ReflectionFormat(this.def)}get adjustments(){return new Adjustments(this.def)}_ends(e){if(this.def.path||!M(this.def.geometry))throw new Error(`${this.def.name}.${e}: it is not a connector (add_connector makes one).`);return se(this._frame(),this.def.flip,this.def.rotation)}_move(e,t){const r=re(e,t,this.def.rotation);this.def.frame=r.frame,r.flip?this.def.flip=r.flip:Reflect.deleteProperty(this.def,"flip")}get begin_x(){return l(Math.round(this._ends("begin_x")[0][0]))}set begin_x(e){const[t,r]=this._ends("begin_x");this._move([e,t[1]],r)}get begin_y(){return l(Math.round(this._ends("begin_y")[0][1]))}set begin_y(e){const[t,r]=this._ends("begin_y");this._move([t[0],e],r)}get end_x(){return l(Math.round(this._ends("end_x")[1][0]))}set end_x(e){const[t,r]=this._ends("end_x");this._move(t,[e,r[1]])}get end_y(){return l(Math.round(this._ends("end_y")[1][1]))}set end_y(e){const[t,r]=this._ends("end_y");this._move(t,[r[0],e])}begin_connect(e,t){this._connect("begin",e,t)}end_connect(e,t){this._connect("end",e,t)}_connect(e,t,r){const s=`${e}_connect`,[n,o]=this._ends(s);if(!(t instanceof Shape))throw new Error(`${this.def.name}.${s}(): its shape is a Shape.`);const h=t._def,f={frame:t._frame(),geometry:h.geometry,adjustments:h.adjustments,flip:h.flip,rotation:h.rotation,path:h.path},c=ne(f).length;if(!Number.isInteger(r)||r<0||r>=c)throw new Error(`${this.def.name}.${s}(): ${h.name} has connection sites 0 to ${String(c-1)}; ${String(r)} is not one.`);const u=ie(f,r)??(e==="begin"?n:o);this.def.connect={...this.def.connect,[e]:{shape:h.name,site:r}},this._move(e==="begin"?u:n,e==="begin"?o:u)}}const Le=i=>typeof i=="number"&&Number.isFinite(i),_=(i,e,t,r)=>{for(const[s,n]of Object.entries({left:i,top:e,width:t,height:r}))if(!Le(n))throw new Error(`${s} ${String(n)} is not a length (Emu, Inches, Pt, Cm, Mm).`);if(t<0||r<0)throw new Error("A shape's width and height are 0 or more.");return{left:Math.trunc(i),top:Math.trunc(e),width:Math.trunc(t),height:Math.trunc(r)}},Pe=new Set(Object.values(D));export class FreeformBuilder{steps;sx;sy;make;constructor(e,t,r){return this.steps=[{op:"move",x:e[0],y:e[1]}],[this.sx,this.sy]=typeof t=="number"?[t,t]:t,this.make=r,a(this,"FreeformBuilder")}add_line_segments(e,t=!0){for(const[r,s]of e)this.steps.push({op:"line",x:r,y:s});return t&&this.steps.push({op:"close"}),this}add_curve_segment(e,t,r,s,n,o){if(![e,t,r,s,n,o].every(h=>Number.isFinite(h)))throw new Error("add_curve_segment(x1, y1, x2, y2, x, y) takes six numbers in local units: its two control points and the point it ends at.");return this.steps.push({op:"curve",x1:e,y1:t,x2:r,y2:s,x:n,y:o}),this}move_to(e,t){return this.steps.push({op:"move",x:e,y:t}),this}convert_to_shape(e=0,t=0){this.steps.length<2&&refuse("convert_to_shape(): a freeform needs a segment.");const r=this.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]]),s=r.map(d=>d[0]),n=r.map(d=>d[1]),o=Math.min(...s),h=Math.min(...n),f=Math.max(...s)-o,c=Math.max(...n)-h;f===0&&c===0&&refuse("convert_to_shape(): a freeform's points are all one point.");const u=(d,m)=>({x:d-o,y:m-h});return this.make({w:f,h:c,steps:this.steps.map(d=>{if(d.op==="close")return d;if(d.op!=="curve")return{op:d.op,...u(d.x,d.y)};const m=u(d.x1,d.y1),y=u(d.x2,d.y2);return{op:"curve",x1:m.x,y1:m.y,x2:y.x,y2:y.y,...u(d.x,d.y)}})},_(Math.round(o*this.sx)+e,Math.round(h*this.sy)+t,Math.round(f*this.sx),Math.round(c*this.sy)))}}export class GroupShape{list;_name;make;constructor(e,t,r){return this.list=e,this._name=t,this.make=r,a(this,"GroupShape")}members(){return this.list.filter(e=>I(e.group,this._name))}box(){const e=this.members().flatMap(s=>s.frame?[s.frame]:[]),t=Math.min(...e.map(s=>s.left)),r=Math.min(...e.map(s=>s.top));return{left:e.length>0?t:0,top:e.length>0?r:0,right:Math.max(0,...e.map(s=>s.left+s.width)),bottom:Math.max(0,...e.map(s=>s.top+s.height))}}get shapes(){return this.make(this._name)}get shape_type(){return _e.GROUP}get name(){return this._name.split("/").pop()??this._name}set name(e){const t=this._name.lastIndexOf("/"),r=t<0?e:`${this._name.slice(0,t)}/${e}`;for(const s of this.members())s.group=`${r}${(s.group??"").slice(this._name.length)}`;this._name=r}get left(){return l(this.box().left)}set left(e){const t=e-this.box().left;for(const r of this.members())r.frame&&(r.frame.left+=t)}get top(){return l(this.box().top)}set top(e){const t=e-this.box().top;for(const r of this.members())r.frame&&(r.frame.top+=t)}get width(){const e=this.box();return l(e.right-e.left)}get height(){const e=this.box();return l(e.bottom-e.top)}}export class Cell{def;table;row;col;constructor(e,t,r,s){return this.def=e,this.table=t,this.row=r,this.col=s,a(this,"_Cell")}get text_frame(){return new TextFrame(this.def.text)}get text(){return this.text_frame.text}set text(e){this.text_frame.text=e}get fill(){return new FillFormat(()=>this.def.fill,e=>{this.def.fill=e})}get borders(){return this.def.borders??{}}set borders(e){this.def.borders=Object.fromEntries(Object.entries(e).map(([t,r])=>[t,{...r,color:N(r.color,`A cell's ${t} border`)}]))}get margin_left(){return l(this.def.text.margin_left??w.left)}set margin_left(e){this.def.text.margin_left=e}get margin_right(){return l(this.def.text.margin_right??w.right)}set margin_right(e){this.def.text.margin_right=e}get margin_top(){return l(this.def.text.margin_top??w.top)}set margin_top(e){this.def.text.margin_top=e}get margin_bottom(){return l(this.def.text.margin_bottom??w.bottom)}set margin_bottom(e){this.def.text.margin_bottom=e}get vertical_anchor(){return this.def.text.vertical_anchor}set vertical_anchor(e){e===void 0?delete this.def.text.vertical_anchor:this.def.text.vertical_anchor=e}get is_merge_origin(){return(this.def.span_width??1)>1||(this.def.span_height??1)>1}get is_spanned(){return this.def.spanned===!0}get span_width(){return this.def.span_width??1}get span_height(){return this.def.span_height??1}merge(e){const t=[this.row,e.row].sort((f,c)=>f-c),r=[this.col,e.col].sort((f,c)=>f-c),[s=0,n=0]=t,[o=0,h=0]=r;for(let f=s;f<=n;f++)for(let c=o;c<=h;c++){const u=this.table.rows[f]?.cells[c];u&&(f===s&&c===o?(h>o&&(u.span_width=h-o+1),n>s&&(u.span_height=n-s+1)):u.spanned=!0)}}split(){const e=this.span_width,t=this.span_height;delete this.def.span_width,delete this.def.span_height;for(let r=this.row;r<this.row+t;r++)for(let s=this.col;s<this.col+e;s++){const n=this.table.rows[r]?.cells[s];n&&delete n.spanned}}}export class Column{def;at;constructor(e,t){return this.def=e,this.at=t,a(this,"_Column")}get width(){return l(this.def.columns[this.at]??0)}set width(e){this.def.columns[this.at]=e}}export class Row{def;at;constructor(e,t){return this.def=e,this.at=t,a(this,"_Row")}get row(){const e=this.def.rows[this.at];if(!e)throw new Error(`The table has no row ${String(this.at)}.`);return e}get height(){return l(this.row.height)}set height(e){this.row.height=e}}export class Table{def;constructor(e){return this.def=e,a(this,"Table")}cell(e,t){const r=this.def.rows[e]?.cells[t];if(!r)throw new Error(`cell(): the table has ${String(this.def.rows.length)} rows and ${String(this.def.columns.length)} columns.`);return new Cell(r,this.def,e,t)}*iter_cells(){for(let e=0;e<this.def.rows.length;e++)for(let t=0;t<this.def.columns.length;t++)yield this.cell(e,t)}get columns(){return this.def.columns.map((e,t)=>new Column(this.def,t))}get rows(){return this.def.rows.map((e,t)=>new Row(this.def,t))}get style(){return Z(this.def.style)?.name??null}set style(e){if(e===null){delete this.def.style;return}const t=Z(e)??refuse(`Table.style: ${e} is none of PowerPoint's built-in table styles (${$e.slice(0,3).map(r=>r.name).join(", ")}…).`);this.def.style=t.id}flag(e){return this.def[e]===!0}get first_row(){return this.flag("first_row")}set first_row(e){this.def.first_row=e}get first_col(){return this.flag("first_col")}set first_col(e){this.def.first_col=e}get last_row(){return this.flag("last_row")}set last_row(e){this.def.last_row=e}get last_col(){return this.flag("last_col")}set last_col(e){this.def.last_col=e}get horz_banding(){return this.flag("horz_banding")}set horz_banding(e){this.def.horz_banding=e}get vert_banding(){return this.flag("vert_banding")}set vert_banding(e){this.def.vert_banding=e}}function Fe(i,e,t=[]){const r=new Set([...i,...t].map(n=>n.name));let s=1;for(;r.has(`${e}-${String(s)}`);)s++;return`${e}-${String(s)}`}export class ShapeCollection{list;base;components;inherit;group;under;constructor(e,t,r,s=()=>{},n=()=>[],o){return this.list=e,this.base=t,this.components=r,this.inherit=s,this.under=n,this.group=o,a(this,"SlideShapes",{index:h=>this._at(h)})}_wrap(e){return new Shape(e,()=>this.inherit(e))}_at(e){const t=this.list[e];return t?this._wrap(t):void 0}*[Symbol.iterator](){for(const e of this.list)yield this._wrap(e)}get length(){return this.list.length}get(e){const t=this.list.find(r=>r.name===e);return t?this._wrap(t):void 0}get title(){const e=this.list.find(t=>t.placeholder?.type==="title"||t.placeholder?.type==="ctrTitle");return e?this._wrap(e):void 0}get placeholders(){return new Placeholders(this.list,this.inherit)}_add(e,t){const r={name:Fe(this.list,e,this.under()),...t,...this.group===void 0?{}:{group:this.group}};return this.list.push(r),this._wrap(r)}add_textbox(e,t,r,s){return this._add("textbox",{kind:"textbox",frame:_(e,t,r,s),text:{...E(),...Se}})}add_picture(e,t,r,s,n){return(s===void 0||n===void 0)&&refuse("add_picture() takes a width and a height here: a picture's own size is not read while a deck's code runs"),this._add("picture",{kind:"picture",frame:_(t,r,s??0,n??0),media:{path:e,base:this.base}})}add_movie(e,t,r,s,n,o={}){return this._add("movie",{kind:"movie",frame:_(t,r,s,n),media:{path:e,base:this.base,...o.poster_frame_time===void 0?{}:{poster:o.poster_frame_time},...o.playback?{playback:{...o.playback}}:{}}})}add_audio(e,t,r,s=W.icon,n=W.icon,o={}){return this._add("audio",{kind:"audio",frame:_(t,r,s,n),media:{path:e,base:this.base,...o.playback?{playback:{...o.playback}}:{}}})}add_shape(e,t,r,s,n){Pe.has(e)||refuse(`add_shape(): ${e} is not one of MSO_SHAPE's ${Object.keys(D).join(", ")}`);const o=E();return o.vertical_anchor=g.vertical_anchor,o.paragraphs=[{runs:[],level:0,alignment:g.alignment}],this._add("shape",{kind:"autoshape",frame:_(t,r,s,n),geometry:e,fill:g.fill,line:g.line,line_width:g.line_width,text:o})}add_table(e,t,r,s,n,o){(e<1||t<1)&&refuse("add_table(): a table has at least a row and a column.");const h=Math.floor(n/t),f=Math.floor(o/e);return this._add("table",{kind:"table",frame:_(r,s,n,o),table:{style:Oe,first_row:!0,horz_banding:!0,columns:Array.from({length:t},()=>h),rows:Array.from({length:e},()=>({height:f,cells:Array.from({length:t},()=>({text:E()}))}))}})}add_chart(e,t,r,s,n,o){return this._add("chart",{kind:"chart",frame:_(t,r,s,n),chart:{type:e,categories:[...o.categories],series:o._series()}})}add_group_shape(){const e=this.group===void 0?"":`${this.group}/`;let t=1;for(;this.list.some(r=>I(r.group,`${e}group-${String(t)}`));)t++;return new GroupShape(this.list,`${e}group-${String(t)}`,r=>new ShapeCollection(this.list,this.base,this.components,this.inherit,this.under,r))}build_freeform(e=0,t=0,r=1){return new FreeformBuilder([e,t],r,(s,n)=>{const o=E();return o.vertical_anchor=g.vertical_anchor,o.paragraphs=[{runs:[],level:0,alignment:g.alignment}],this._add("freeform",{kind:"autoshape",frame:n,path:s,fill:g.fill,line:g.line,line_width:g.line_width,text:o})})}add_connector(e,t,r,s,n){M(e)||refuse(`add_connector(): ${e} is not one of MSO_CONNECTOR's ${Object.keys(he).join(", ")}, nor a connector's preset (${be.join(", ")})`);const o=_(Math.min(t,s),Math.min(r,n),Math.abs(s-t),Math.abs(n-r)),h=s<t,f=n<r;return this._add("connector",{kind:"autoshape",frame:o,geometry:e,...h||f?{flip:{...h?{h}:{},...f?{v:f}:{}}}:{},line:Y.line,line_width:Y.line_width})}add_component(e,t,r,s,n,o={},h={}){if(!Object.hasOwn(this.components(),e))throw new Error(`add_component(): the presentation has no component ${e}; add it with prs.components.add("${e}", { … }) first.`);if(h.dur!==void 0&&!(Number.isFinite(h.dur)&&h.dur>0))throw new Error(`add_component(): dur is how long ${e} moves, seconds over 0; it was ${String(h.dur)}.`);return this._add(e,{kind:"component",frame:_(t,r,s,n),component:{name:e,props:o,...h.dur===void 0?{}:{dur:h.dur}}})}}export const NAME_OF_TYPE={title:"title",ctrTitle:"title",subTitle:"subtitle",body:"body",pic:"picture",media:"media",obj:"content",dt:"date",ftr:"footer",sldNum:"slide-number"};export class Placeholders{list;inherit;constructor(e,t=()=>{}){return this.list=e,this.inherit=t,a(this,"placeholders",{index:r=>this.get(r)})}_wrap(e){return new Shape(e,()=>this.inherit(e))}*[Symbol.iterator](){for(const e of this.list)e.kind==="placeholder"&&(yield this._wrap(e))}get length(){return this.list.filter(e=>e.kind==="placeholder").length}get(e){const t=this.list.find(r=>r.kind==="placeholder"&&(typeof e=="number"?r.placeholder?.idx===e:r.name===e||r.placeholder?.type===e));return t?this._wrap(t):void 0}add(e,t,r,s,n,o={}){const h=typeof t=="object"?t:o,f=typeof t=="object"?void 0:t;Object.values(H).includes(e)||refuse(`placeholders.add(): ${e} is not one of PP_PLACEHOLDER's ${Object.keys(H).join(", ")}`);const c=this.list.filter(b=>b.kind==="placeholder"),u=new Set(c.map(b=>b.placeholder?.idx));let d=e==="title"||e==="ctrTitle"?0:ye[e]??1;for(u.has(d)&&d===0&&(d=1);u.has(d);)d++;const m=h.name??NAME_OF_TYPE[e];if(this.list.some(b=>b.name===m))throw new Error(`Two shapes are ${m}: give the placeholder a name ({ name }).`);const y=[f,r,s,n].filter(b=>b!==void 0);if(y.length!==0&&y.length!==4)throw new Error("placeholders.add(type, left, top, width, height): give all four, or none to take the master's frame.");const L={name:m,kind:"placeholder",placeholder:{type:e,idx:d,...h.orient==="vert"?{orient:"vert"}:{}},...y.length===4?{frame:_(f??0,r??0,s??0,n??0)}:{},text:{paragraphs:[],levels:Ee(e)}};return this.list.push(L),this._wrap(L)}}export class SlideLayout{def;master;ctx;constructor(e,t,r){return this.def=e,this.master=t,this.ctx=r,a(this,"SlideLayout")}get _def(){return this.def}inherit=e=>e.placeholder?X(this.master._def,e.placeholder.type)?.frame:void 0;get name(){return this.def.name}get slide_master(){return this.master}get display_master_shapes(){return this.def.display_master_shapes??!0}set display_master_shapes(e){e?delete this.def.display_master_shapes:this.def.display_master_shapes=!1}get color_map(){return this.def.color_map&&{...this.def.color_map}}set color_map(e){e===void 0?delete this.def.color_map:this.def.color_map=K(e)}get background(){return new Background(this.def)}get placeholders(){return new Placeholders(this.def.shapes,this.inherit)}get shapes(){return new ShapeCollection(this.def.shapes,this.ctx.base,this.ctx.components,this.inherit,()=>this.master._def.shapes)}}export class SlideLayouts{list;make;constructor(e,t){return this.list=e,this.make=t,a(this,"SlideLayouts",{index:r=>this.list[r]})}*[Symbol.iterator](){yield*this.list}get length(){return this.list.length}get_by_name(e,t){return this.list.find(r=>r.name===e)??t}index(e){const t=this.list.indexOf(e);if(t<0)throw new Error(`${e.name} is not among these layouts.`);return t}add(e,t){if(!this.make)throw new Error("A layout is added to a master: master.slide_layouts.add(name).");const r=this.make(e);return t?.(r),r}}export class TextStyles{def;constructor(e){return this.def=e,a(this,"text_styles")}get title_style(){return k(this.def.title)}get body_style(){return k(this.def.body)}get other_style(){return k(this.def.other)}}export class SlideMaster{def;layouts=[];ctx;allLayouts;constructor(e,t,r){return this.def=e,this.ctx=t,this.allLayouts=r,a(this,"SlideMaster")}get _def(){return this.def}get name(){return this.def.name}get color_map(){return{...OFFICE_COLOR_MAP,...this.def.color_map}}set color_map(e){const t=K(e),r=Object.fromEntries(Object.entries(t).filter(([s,n])=>OFFICE_COLOR_MAP[s]!==n));Object.keys(r).length===0?delete this.def.color_map:this.def.color_map=r}get background(){return new Background(this.def)}get placeholders(){return new Placeholders(this.def.shapes)}get shapes(){return new ShapeCollection(this.def.shapes,this.ctx.base,this.ctx.components)}get text_styles(){return new TextStyles(this.def.text_styles)}get slide_layouts(){return new SlideLayouts(this.layouts,e=>{if(this.allLayouts.some(s=>s.name===e))throw new Error(`Two layouts are "${e}": a layout's name is unique in the deck, as its slides file names it.`);const t={name:e,master:this.def.name,shapes:[]};this.def.layouts.push(t);const r=new SlideLayout(t,this,this.ctx);return this.layouts.push(r),this.allLayouts.push(r),r})}}export class SlideMasters{list;make;constructor(e,t){return this.list=e,this.make=t,a(this,"SlideMasters",{index:r=>this.list[r]})}*[Symbol.iterator](){yield*this.list}get length(){return this.list.length}index(e){return this.list.indexOf(e)}add(e,t){const r=this.make(e);return t?.(r),r}}export class GeneratedSlide{own;def;layout;constructor(e,t,r){this.def=e,this.layout=t,this.own=t._def.shapes.filter(n=>n.kind==="placeholder").map(n=>({name:n.name,kind:"placeholder",...n.placeholder?{placeholder:{...n.placeholder}}:{},text:E()}));const s=n=>{const o=t._def.shapes.find(h=>h.kind==="placeholder"&&h.placeholder?.idx===n.placeholder?.idx);return o?o.frame??(o.placeholder?X(t.slide_master._def,o.placeholder.type)?.frame:void 0):void 0};return this._shapes=new ShapeCollection(this.own,r.base,r.components,s,()=>[...t.slide_master._def.shapes,...t._def.shapes]),this._placeholders=new Placeholders(this.own,s),a(this,"Slide")}_shapes;_placeholders;get shapes(){return this._shapes}get placeholders(){return this._placeholders}get slide_id(){return this.def.id}get slide_layout(){return this.layout}get has_notes_slide(){return this.def.notes!==void 0}get notes_slide(){const e=this.def;return a({notes_text_frame:a({get text(){return e.notes??""},set text(t){e.notes=t}},"TextFrame")},"NotesSlide")}get transition(){return this.def.transition}set transition(e){e===void 0?delete this.def.transition:this.def.transition=e}get animations(){return new Animations(this.def.animations??=[])}_done(){const e={},t=[];for(const r of this.own)r.kind==="placeholder"&&r.placeholder?(r.text?.paragraphs.some(s=>s.runs.length>0)&&(e[r.placeholder.idx]=r.text.paragraphs),r.frame&&t.push({...r,text:E()})):t.push(r);return{...this.def,shapes:t,text:e}}}export class Animations{list;constructor(e){return this.list=e,a(this,"Animations")}add(e,t,r={}){this.list.push({shape:typeof e=="string"?e:e.name,effect:t,...r})}get length(){return this.list.length}}class ze{gen;constructor(e){return this.gen=e,a(this,"slides")}add_slide(e,t){return this.gen._add(e,t)}}export class Generator{list=[];prs;ctx;constructor(e,t){return this.prs=e,this.ctx=t,a(this,"Generator")}data(e){return this.ctx.data(e)}get slides(){return new ze(this)}_add(e,t){const r=typeof e=="string"?this.prs._layout(e):e;if(!r)throw new Error(`add_slide(): the presentation has no layout ${typeof e=="string"?e:e.name}.`);if(!/^[A-Za-z0-9_-]+$/u.test(t))throw new Error(`add_slide(): ${t} is not an id of letters, digits, _ and -.`);if(this.list.some(n=>n.slide_id===t))throw new Error(`add_slide(): two slides are ${t}.`);const s=new GeneratedSlide({id:t,layout:r.name,shapes:[],text:{}},r,this.prs._ctx);return this.list.push(s),s}_made(){return this.list.map(e=>e._done())}}const Ie=()=>JSON.parse(JSON.stringify(xe));export class Presentation{masters=[];layouts=[];def;_ctx;constructor(e,t){return this.def={slide_width:e[0],slide_height:e[1],masters:[],components:{},generators:{}},this._ctx={base:t,components:()=>this.def.components},a(this,"Presentation")}get _def(){return this.def}get slide_width(){return l(this.def.slide_width)}set slide_width(e){this.def.slide_width=e}get slide_height(){return l(this.def.slide_height)}set slide_height(e){this.def.slide_height=e}get slide_masters(){return new SlideMasters(this.masters,e=>{if(this.masters.some(s=>s.name===e))throw new Error(`Two masters are "${e}".`);const t={name:e,background:"bg1",text_styles:Ie(),shapes:[],layouts:[]};this.def.masters.push(t);const r=new SlideMaster(t,this._ctx,this.layouts);return this.masters.push(r),r})}get slide_master(){const e=this.masters[0];if(!e)throw new Error("The presentation has no master yet: prs.slide_masters.add(name) makes one.");return e}get slide_layouts(){const e=this.masters[0];return e?e.slide_layouts:new SlideLayouts([])}get slides(){return refuse("A deck's slides are in the slides file presentation({ slides }) names, in order, each on a layout, and their words in its script; slides made from data are a generator's (prs.generators.add)")}save(){return refuse("A deck is not saved by its code: allyhub render writes its PDF, pictures and PPTX")}get theme(){return this.def.theme??={},this.def.theme}set theme(e){this.def.theme=e}get components(){return a({add:(e,t)=>{if(Object.hasOwn(this.def.components,e))throw new Error(`Two components are "${e}".`);const r=oe(e,t);if(!r)throw new Error(`Component ${e} is not a component: give what defineComponent makes, or { props, layers }.`);this.def.components[e]=r}},"components")}get generators(){return a({add:(e,t)=>{if(Object.hasOwn(this.def.generators,e))throw new Error(`Two generators are "${e}".`);this.def.generators[e]={name:e,make:r=>{const s=new Generator(this,r);return t(s),s._made()}}}},"generators")}_layout(e){return this.layouts.find(t=>t.name===e)}}export const DECK_BRAND="__allyhubDeck";export function isDeck(i){return typeof i=="object"&&i!==null&&DECK_BRAND in i}export const presentationFor=i=>(e,t)=>{const[r,s]=typeof e=="function"?[{},e]:[e,t];if(typeof s!="function")throw new Error(`A deck's module exports one deck: export default presentation({ slides: "./deck.yaml", script: "./deck.{locale}.yaml", size }, (prs) => { … masters, layouts, components … }), its slides and its script named from its folder.`);if(r.script!==void 0&&!r.script.includes("{locale}"))throw new Error(`presentation(): script ${r.script} names one file: write {locale} in its name for each language (./deck.{locale}.yaml).`);if(typeof r.size=="string"&&!Object.hasOwn(j,r.size))throw new Error(`presentation(): size ${r.size} is not one of ${Object.keys(j).join(", ")}, or { width, height } in EMU.`);return{[DECK_BRAND]:!0,kind:"slides",options:r,build:s,written:{file:i}}};export function evaluateDeck(i){const e=i.options.size??"16:9",t=typeof e=="string"?j[e]:[e.width,e.height],r=i.written.file.split("/").slice(0,-1).join("/"),s=new Presentation(t,r);return i.options.theme&&(s.theme=JSON.parse(JSON.stringify(i.options.theme))),i.build(s),s._def}
|
|
4
|
+
`).map(t=>({runs:se(t),level:0}))}get paragraphs(){return this.def.paragraphs.length===0&&this.def.paragraphs.push({runs:[],level:0}),this.def.paragraphs.map(e=>new Paragraph(e))}add_paragraph(){this.def.paragraphs.length===0&&this.def.paragraphs.push({runs:[],level:0});const e={runs:[],level:0};return this.def.paragraphs.push(e),new Paragraph(e)}clear(){const e=this.def.paragraphs[0];this.def.paragraphs=e?[{...e,runs:[]}]:[]}fit_text(e,t=18,s,r){this.def.auto_size="text",this.def.word_wrap=!0;for(const n of this.def.paragraphs)for(const o of n.runs)o.font={...o.font,size:Math.trunc(t*j),...e===void 0?{}:{name:e},...s===void 0?{}:{bold:s},...r===void 0?{}:{italic:r}}}get list_style(){return T(this.def.levels,this.hangs)}get vertical_anchor(){return this.def.vertical_anchor}set vertical_anchor(e){this._set("vertical_anchor",e)}get orientation(){return this.def.orientation}set orientation(e){if(e!==void 0&&!Object.values(B).includes(e))throw new Error(`orientation is one of MSO_TEXT_ORIENTATION's ${Object.values(B).join(", ")}, not ${e}.`);this._set("orientation",e)}get auto_size(){return this.def.auto_size}set auto_size(e){this._set("auto_size",e)}get word_wrap(){return this.def.word_wrap}set word_wrap(e){this._set("word_wrap",e)}get margin_left(){return l(this.def.margin_left??x.left)}set margin_left(e){this.def.margin_left=e}get margin_top(){return l(this.def.margin_top??x.top)}set margin_top(e){this.def.margin_top=e}get margin_right(){return l(this.def.margin_right??x.right)}set margin_right(e){this.def.margin_right=e}get margin_bottom(){return l(this.def.margin_bottom??x.bottom)}set margin_bottom(e){this.def.margin_bottom=e}get columns(){return this.def.columns??1}set columns(e){if(!(Number.isInteger(e)&&e>=1&&e<=16))throw new Error(`columns is a whole number from 1 to 16, not ${String(e)}.`);this._set("columns",e===1?void 0:e)}get column_spacing(){return l(this.def.column_spacing??0)}set column_spacing(e){this.def.column_spacing=e}}export class FillFormat{read;write;start;shape;base;constructor(e,t,s="lt1",r,n=""){return this.read=e,this.write=t,this.start=s,this.shape=r,this.base=n,h(this,"FillFormat")}_only(e){if(this.shape)for(const t of["gradient","pattern","picture_fill"])t!==e&&Reflect.deleteProperty(this.shape,t)}solid(){const e=this.read();this._only("solid"),e==null&&this.write(this.start)}background(){this._only("solid"),this.write(null)}patterned(){const e=this._shape("a pattern");this._only("pattern"),e.pattern??={preset:"pct5",fg:k.fg,bg:k.bg}}get pattern(){return this._pattern().preset}set pattern(e){this._pattern().preset=g(Se,"MSO_PATTERN_TYPE","pattern",e)}_pattern(){const{pattern:e}=this._shape("a pattern");if(!e)throw new TypeError("This fill is no pattern: call fill.patterned() first.");return e}get back_color(){const e=this._pattern();return new ColorFormat(()=>e.bg,t=>{e.bg=t??k.bg})}picture(e,t={}){const s=this._shape("a picture");this._only("picture_fill"),s.picture_fill={path:e,base:this.base,...t.tile?{tile:{...X,...t.tile,align:g(Oe,"TILE_ALIGNMENT","tile.align",t.tile.align??X.align)}}:{},...t.transparency===void 0?{}:{transparency:t.transparency}}}_shape(e){if(!this.shape)throw new TypeError(`Only a shape's or a background's fill has ${e}.`);return this.shape}gradient(){this._only("gradient"),this._shape("a gradient").gradient??={angle:90,stops:[{at:0,color:"accent1"},{at:1,color:"accent2"}]}}get gradient_path(){return this._gradient().path??"linear"}set gradient_path(e){const t=this._gradient();e==="linear"?delete t.path:C.includes(e)?t.path=e:refuse(`gradient_path is "linear", ${C.map(s=>`"${s}"`).join(", ")}, not ${e}.`)}get gradient_focus(){return{...this._gradient().focus??{left:.5,top:.5,right:.5,bottom:.5}}}set gradient_focus(e){this._gradient().focus={...e}}get gradient_angle(){return this._gradient().angle}set gradient_angle(e){this._gradient().angle=e}get gradient_stops(){return this._gradient().stops.map(e=>new GradientStop(e))}set gradient_stops(e){if(e.length<2)throw new Error("A gradient has two stops at least.");this._gradient().stops=e.map(t=>t instanceof GradientStop?GradientStop.defOf(t):{...t,color:N(t.color,"A gradient stop's colour")})}_gradient(){const{gradient:e}=this._shape("a gradient");if(!e)throw new TypeError("This fill is no gradient: call fill.gradient() first.");return e}get transparency(){return this._shape("a transparency").fill_transparency??0}set transparency(e){if(!(e>=0&&e<=1))throw new Error(`A transparency is a share, 0 to 1, not ${String(e)}.`);this._shape("a transparency").fill_transparency=e}get type(){if(this.shape?.picture_fill)return"picture";if(this.shape?.pattern)return"patterned";if(this.shape?.gradient)return"gradient";const e=this.read();return e===void 0?void 0:e===null?"background":"solid"}get fore_color(){const e=this.shape?.pattern;if(e)return new ColorFormat(()=>e.fg,s=>{e.fg=s??k.fg});const t=this.read();if(t==null)throw new TypeError("This fill is not solid, so it has no fore_color: call fill.solid() first.");return new ColorFormat(()=>this.read()??void 0,s=>{this.write(s??this.start)})}}export class GradientStop{stop;constructor(e){return this.stop=e,h(this,"GradientStop")}static defOf(e){return{...e.stop}}get color(){return new ColorFormat(()=>this.stop.color,e=>{e!==void 0&&(this.stop.color=e)})}get position(){return this.stop.at}set position(e){if(!(e>=0&&e<=1))throw new Error(`A stop's position is a share, 0 to 1, not ${String(e)}.`);this.stop.at=e}get transparency(){return this.stop.transparency??0}set transparency(e){if(!(e>=0&&e<=1))throw new Error(`A transparency is a share, 0 to 1, not ${String(e)}.`);e===0?Reflect.deleteProperty(this.stop,"transparency"):this.stop.transparency=e}}export class ShadowFormat{def;inner;constructor(e,t=!1){return this.def=e,this.inner=t,h(this,"ShadowFormat")}_shadow(){return this.inner?(this.def.inner_shadow??={...Te},this.def.inner_shadow):(this.def.shadow??={...W},this.def.shadow)}get visible(){return this.inner?this.def.inner_shadow!==void 0:this.def.shadow!==void 0&&this.def.shadow!==null}set visible(e){e?this._shadow():this.inner?Reflect.deleteProperty(this.def,"inner_shadow"):this.def.shadow=null}get inherit(){return this.def.shadow===void 0}set inherit(e){e?Reflect.deleteProperty(this.def,"shadow"):this.def.shadow??=null}get blur_radius(){return l(this._shadow().blur)}set blur_radius(e){this._shadow().blur=e}get distance(){return l(this._shadow().distance)}set distance(e){this._shadow().distance=e}get angle(){return this._shadow().angle}set angle(e){this._shadow().angle=e}get transparency(){return this._shadow().transparency}set transparency(e){this._shadow().transparency=e}get color(){const e=this._shadow();return new ColorFormat(()=>e.color,t=>{e.color=t??W.color})}}export class GlowFormat{def;constructor(e){return this.def=e,h(this,"GlowFormat")}_glow(){return this.def.glow??={...J},this.def.glow}get visible(){return this.def.glow!==void 0}set visible(e){e?this._glow():Reflect.deleteProperty(this.def,"glow")}get radius(){return l(this.def.glow?.size??0)}set radius(e){e<=0?Reflect.deleteProperty(this.def,"glow"):this._glow().size=e}get transparency(){return this._glow().transparency}set transparency(e){this._glow().transparency=e}get color(){const e=this._glow();return new ColorFormat(()=>e.color,t=>{e.color=t??J.color})}}export class SoftEdgeFormat{def;constructor(e){return this.def=e,h(this,"SoftEdgeFormat")}get radius(){return l(this.def.soft_edges??0)}set radius(e){e<=0?Reflect.deleteProperty(this.def,"soft_edges"):this.def.soft_edges=e}}export class ReflectionFormat{def;constructor(e){return this.def=e,h(this,"ReflectionFormat")}_reflection(){return this.def.reflection??={...Ae},this.def.reflection}get visible(){return this.def.reflection!==void 0}set visible(e){e?this._reflection():Reflect.deleteProperty(this.def,"reflection")}get transparency(){return this._reflection().transparency}set transparency(e){this._reflection().transparency=e}get size(){return this._reflection().size}set size(e){this._reflection().size=e}get offset(){return l(this._reflection().distance)}set offset(e){this._reflection().distance=e}get blur(){return l(this._reflection().blur)}set blur(e){this._reflection().blur=e}}export class LineFormat{def;constructor(e){return this.def=e,h(this,"LineFormat")}get color(){return new ColorFormat(()=>this.def.line??void 0,e=>{this.def.line=e??null})}get fill(){return new FillFormat(()=>this.def.line,e=>{this.def.line=e},"dk1")}get width(){return l(this.def.line_width??0)}set width(e){this.def.line_width=e}get dash_style(){return this.def.line_dash??null}set dash_style(e){e===null?delete this.def.line_dash:this.def.line_dash=g(be,"MSO_LINE","dash_style",e)}get cap_type(){return this.def.line_cap??E.cap}set cap_type(e){const t=g(ye,"MSO_LINE_CAP","cap_type",e);t===E.cap?delete this.def.line_cap:this.def.line_cap=t}get join_type(){return this.def.line_join??E.join}set join_type(e){const t=g(Ee,"MSO_LINE_JOIN","join_type",e);t===E.join?delete this.def.line_join:this.def.line_join=t}get compound_type(){return this.def.line_compound??E.compound}set compound_type(e){const t=g(xe,"MSO_LINE_COMPOUND","compound_type",e);t===E.compound?delete this.def.line_compound:this.def.line_compound=t}get begin_arrow(){return this.def.line_begin??"none"}set begin_arrow(e){this.def.line_begin=g(H,"MSO_ARROWHEAD","begin_arrow",e)}get end_arrow(){return this.def.line_end??"none"}set end_arrow(e){this.def.line_end=g(H,"MSO_ARROWHEAD","end_arrow",e)}get begin_arrow_width(){return this.def.line_begin_size?.w??"med"}set begin_arrow_width(e){this.def.line_begin_size={...this.def.line_begin_size,w:g(O,"MSO_ARROWHEAD_SIZE","begin_arrow_width",e)}}get begin_arrow_length(){return this.def.line_begin_size?.len??"med"}set begin_arrow_length(e){this.def.line_begin_size={...this.def.line_begin_size,len:g(O,"MSO_ARROWHEAD_SIZE","begin_arrow_length",e)}}get end_arrow_width(){return this.def.line_end_size?.w??"med"}set end_arrow_width(e){this.def.line_end_size={...this.def.line_end_size,w:g(O,"MSO_ARROWHEAD_SIZE","end_arrow_width",e)}}get end_arrow_length(){return this.def.line_end_size?.len??"med"}set end_arrow_length(e){this.def.line_end_size={...this.def.line_end_size,len:g(O,"MSO_ARROWHEAD_SIZE","end_arrow_length",e)}}}function g(i,e,t,s){if(Object.values(i).includes(s))return s;throw new Error(`${t}: ${String(s)} is not one of ${e}'s ${Object.keys(i).join(", ")}.`)}export class Background{holder;base;constructor(e,t=""){return this.holder=e,this.base=t,h(this,"_Background")}get fill(){const e=this.holder.background_fill??={};return new FillFormat(()=>this.holder.background,t=>{this.holder.background=t??"bg1"},"lt1",e,this.base)}}export const adjustmentDefaults=i=>ne(i).map(e=>e.value/1e5);export class Adjustments{def;constructor(e){return this.def=e,h(this,"Adjustments",{index:t=>this._values()[t],setIndex:(t,s)=>{this._set(t,Number(s))}})}_values(){return this.def.adjustments??adjustmentDefaults(this.def.geometry??"rect")}get length(){return this._values().length}_set(e,t){const s=this._values();if(e<0||e>=s.length)throw new RangeError(`adjustments[${String(e)}]: ${this.def.geometry??"this shape"} has ${String(s.length)}.`);if(!Number.isFinite(t))throw new Error(`adjustments[${String(e)}] = ${String(t)} is not a number.`);s[e]=t,this.def.adjustments=s}}const We={left:0,top:0,width:0,height:0};export class Shape{def;inherit;base;constructor(e,t=()=>{},s=""){return this.def=e,this.inherit=t,this.base=s,h(this,"Shape")}get _def(){return this.def}_frame(){return this.def.frame??this.inherit()??We}_own(){return this.def.frame??={...this._frame()},this.def.frame}get name(){return this.def.name}set name(e){this.def.name=e}get shape_type(){return this.def.path?"freeform":this.def.kind==="audio"||this.def.kind==="item"?"movie":this.def.kind==="block"?"component":R(this.def.geometry)?"line":this.def.kind}get is_placeholder(){return this.def.kind==="placeholder"}get has_table(){return this.def.table!==void 0}get has_chart(){return this.def.chart!==void 0}get chart(){if(!this.def.chart)throw new Error(`${this.def.name} is not a chart.`);return new $e(this.def.chart)}get table(){if(!this.def.table)throw new Error(`${this.def.name} is not a table.`);return new Table(this.def.table)}get placeholder_format(){if(!this.def.placeholder)throw new Error(`${this.def.name} is not a placeholder.`);return h({...this.def.placeholder},"_PlaceholderFormat")}get left(){return l(this._frame().left)}set left(e){this._own().left=e}get top(){return l(this._frame().top)}set top(e){this._own().top=e}get width(){return l(this._frame().width)}set width(e){this._own().width=e}get height(){return l(this._frame().height)}set height(e){this._own().height=e}get rotation(){return this.def.rotation??0}set rotation(e){if(!Number.isFinite(e))throw new Error(`${this.def.name}: rotation is a number of degrees.`);const t=(Math.trunc(e*6e4)%216e5+216e5)%216e5/6e4;t===0?Reflect.deleteProperty(this.def,"rotation"):this.def.rotation=t}get flip_h(){return this.def.flip?.h===!0}set flip_h(e){this._flip("h",e)}get flip_v(){return this.def.flip?.v===!0}set flip_v(e){this._flip("v",e)}_flip(e,t){const s={...this.def.flip};t?s[e]=!0:Reflect.deleteProperty(s,e),Object.keys(s).length===0?Reflect.deleteProperty(this.def,"flip"):this.def.flip=s}get decorative(){return this.def.decorative===!0}set decorative(e){e?this.def.decorative=!0:delete this.def.decorative}get auto_shape_type(){return this.def.kind==="picture"||this.def.kind==="placeholder"?this.def.geometry??"rect":this.def.geometry}set auto_shape_type(e){this.def.kind!=="picture"&&this.def.kind!=="placeholder"&&refuse(`auto_shape_type: a ${this.shape_type}'s preset is set where it is made (add_shape); a picture's is the shape it is cut to, a placeholder's its own shape.`),e!==void 0&&!ie.has(e)&&refuse(`auto_shape_type: ${e} is not one of MSO_SHAPE's.`),e===void 0||e==="rect"?delete this.def.geometry:this.def.geometry=e}_look(e){(this.def.kind!=="picture"||!this.def.media)&&refuse(`${e} is a picture's (PowerPoint's Picture Format).`);const t=this.def.media??{path:"",base:""};return t.look??={},t.look}_setLook(e,t,s){const r=this._look(e);s===void 0||s===0?Reflect.deleteProperty(r,t):(t==="transparency"?s>=0&&s<=1:s>=-1&&s<=1)?r[t]=s:refuse(`${e} is ${t==="transparency"?"0 to 1":"-1 to 1"}, not ${String(s)}.`),Object.keys(r).length===0&&this.def.media&&delete this.def.media.look}get brightness(){return this._look("brightness").brightness??0}set brightness(e){this._setLook("brightness","brightness",e)}get contrast(){return this._look("contrast").contrast??0}set contrast(e){this._setLook("contrast","contrast",e)}get transparency(){return this._look("transparency").transparency??0}set transparency(e){this._setLook("transparency","transparency",e)}get recolor(){const e=this._look("recolor");if(e.grayscale===!0)return"grayscale";if(e.black_white!==void 0)return e.black_white===.5?"black_white":{black_white:e.black_white};if(e.duotone){const t=[z(e.duotone[0]),z(e.duotone[1])];return t[0]===G[0]&&t[1]===G[1]?"sepia":{duotone:t}}}set recolor(e){const t=this._look("recolor");if(delete t.grayscale,delete t.duotone,delete t.black_white,e!==void 0){const s=ge.safeParse(e);s.success||refuse(`recolor is "grayscale", "sepia", "washout", "black_white", { duotone: [dark, light] } or { black_white: threshold }, not ${JSON.stringify(e)}.`),Object.assign(t,me({recolor:s.data}).look)}Object.keys(t).length===0&&this.def.media&&delete this.def.media.look}get has_text_frame(){return this.def.text!==void 0}get text_frame(){if(!this.def.text)throw new Error(`${this.def.name} (a ${this.shape_type}) has no text frame: has_text_frame is false.`);return new TextFrame(this.def.text,this.def.kind!=="placeholder")}get text(){return this.text_frame.text}set text(e){this.text_frame.text=e}get fill(){return new FillFormat(()=>this.def.fill,e=>{this.def.fill=e},"lt1",this.def,this.base)}get line(){return new LineFormat(this.def)}get shadow(){return new ShadowFormat(this.def)}get inner_shadow(){return new ShadowFormat(this.def,!0)}get glow(){return new GlowFormat(this.def)}get soft_edge(){return new SoftEdgeFormat(this.def)}get reflection(){return new ReflectionFormat(this.def)}get adjustments(){return new Adjustments(this.def)}_ends(e){if(this.def.path||!R(this.def.geometry))throw new Error(`${this.def.name}.${e}: it is not a connector (add_connector makes one).`);return ae(this._frame(),this.def.flip,this.def.rotation)}_move(e,t){const s=oe(e,t,this.def.rotation);this.def.frame=s.frame,s.flip?this.def.flip=s.flip:Reflect.deleteProperty(this.def,"flip")}get begin_x(){return l(Math.round(this._ends("begin_x")[0][0]))}set begin_x(e){const[t,s]=this._ends("begin_x");this._move([e,t[1]],s)}get begin_y(){return l(Math.round(this._ends("begin_y")[0][1]))}set begin_y(e){const[t,s]=this._ends("begin_y");this._move([t[0],e],s)}get end_x(){return l(Math.round(this._ends("end_x")[1][0]))}set end_x(e){const[t,s]=this._ends("end_x");this._move(t,[e,s[1]])}get end_y(){return l(Math.round(this._ends("end_y")[1][1]))}set end_y(e){const[t,s]=this._ends("end_y");this._move(t,[s[0],e])}begin_connect(e,t){this._connect("begin",e,t)}end_connect(e,t){this._connect("end",e,t)}_connect(e,t,s){const r=`${e}_connect`,[n,o]=this._ends(r);if(!(t instanceof Shape))throw new Error(`${this.def.name}.${r}(): its shape is a Shape.`);const a=t._def,f={frame:t._frame(),geometry:a.geometry,adjustments:a.adjustments,flip:a.flip,rotation:a.rotation,path:a.path},c=de(f).length;if(!Number.isInteger(s)||s<0||s>=c)throw new Error(`${this.def.name}.${r}(): ${a.name} has connection sites 0 to ${String(c-1)}; ${String(s)} is not one.`);const p=he(f,s)??(e==="begin"?n:o);this.def.connect={...this.def.connect,[e]:{shape:a.name,site:s}},this._move(e==="begin"?p:n,e==="begin"?o:p)}}const Xe=i=>typeof i=="number"&&Number.isFinite(i),m=(i,e,t,s)=>{for(const[r,n]of Object.entries({left:i,top:e,width:t,height:s}))if(!Xe(n))throw new Error(`${r} ${String(n)} is not a length (Emu, Inches, Pt, Cm, Mm).`);if(t<0||s<0)throw new Error("A shape's width and height are 0 or more.");return{left:Math.trunc(i),top:Math.trunc(e),width:Math.trunc(t),height:Math.trunc(s)}},ie=new Set(Object.values(U));export class FreeformBuilder{steps;sx;sy;make;constructor(e,t,s){return this.steps=[{op:"move",x:e[0],y:e[1]}],[this.sx,this.sy]=typeof t=="number"?[t,t]:t,this.make=s,h(this,"FreeformBuilder")}add_line_segments(e,t=!0){for(const[s,r]of e)this.steps.push({op:"line",x:s,y:r});return t&&this.steps.push({op:"close"}),this}add_curve_segment(e,t,s,r,n,o){if(![e,t,s,r,n,o].every(a=>Number.isFinite(a)))throw new Error("add_curve_segment(x1, y1, x2, y2, x, y) takes six numbers in local units: its two control points and the point it ends at.");return this.steps.push({op:"curve",x1:e,y1:t,x2:s,y2:r,x:n,y:o}),this}move_to(e,t){return this.steps.push({op:"move",x:e,y:t}),this}convert_to_shape(e=0,t=0){this.steps.length<2&&refuse("convert_to_shape(): a freeform needs a segment.");const s=this.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]]),r=s.map(d=>d[0]),n=s.map(d=>d[1]),o=d=>d.reduce((_,u)=>u<_?u:_,1/0),a=d=>d.reduce((_,u)=>u>_?u:_,-1/0),f=o(r),c=o(n),p=a(r)-f,w=a(n)-c;p===0&&w===0&&refuse("convert_to_shape(): a freeform's points are all one point.");const y=(d,_)=>({x:d-f,y:_-c});return this.make({w:p,h:w,steps:this.steps.map(d=>{if(d.op==="close")return d;if(d.op!=="curve")return{op:d.op,...y(d.x,d.y)};const _=y(d.x1,d.y1),u=y(d.x2,d.y2);return{op:"curve",x1:_.x,y1:_.y,x2:u.x,y2:u.y,...y(d.x,d.y)}})},m(Math.round(f*this.sx)+e,Math.round(c*this.sy)+t,Math.round(p*this.sx),Math.round(w*this.sy)))}}export class GroupShape{list;_name;make;constructor(e,t,s){return this.list=e,this._name=t,this.make=s,h(this,"GroupShape")}members(){return this.list.filter(e=>D(e.group,this._name))}box(){const e=this.members().flatMap(r=>r.frame?[r.frame]:[]),t=Math.min(...e.map(r=>r.left)),s=Math.min(...e.map(r=>r.top));return{left:e.length>0?t:0,top:e.length>0?s:0,right:Math.max(0,...e.map(r=>r.left+r.width)),bottom:Math.max(0,...e.map(r=>r.top+r.height))}}get shapes(){return this.make(this._name)}get shape_type(){return ke.GROUP}get name(){return this._name.split("/").pop()??this._name}set name(e){const t=this._name.lastIndexOf("/"),s=t<0?e:`${this._name.slice(0,t)}/${e}`;for(const r of this.members())r.group=`${s}${(r.group??"").slice(this._name.length)}`;this._name=s}get left(){return l(this.box().left)}set left(e){const t=e-this.box().left;for(const s of this.members())s.frame&&(s.frame.left+=t)}get top(){return l(this.box().top)}set top(e){const t=e-this.box().top;for(const s of this.members())s.frame&&(s.frame.top+=t)}get width(){const e=this.box();return l(e.right-e.left)}get height(){const e=this.box();return l(e.bottom-e.top)}}export class Cell{def;table;row;col;constructor(e,t,s,r){return this.def=e,this.table=t,this.row=s,this.col=r,h(this,"_Cell")}get text_frame(){return new TextFrame(this.def.text,!0)}get text(){return this.text_frame.text}set text(e){this.text_frame.text=e}get fill(){return new FillFormat(()=>this.def.fill,e=>{this.def.fill=e})}get borders(){return this.def.borders??{}}set borders(e){this.def.borders=Object.fromEntries(Object.entries(e).map(([t,s])=>[t,s===null?null:{...s,color:N(s.color,`A cell's ${t} border`)}]))}get margin_left(){return l(this.def.text.margin_left??x.left)}set margin_left(e){this.def.text.margin_left=e}get margin_right(){return l(this.def.text.margin_right??x.right)}set margin_right(e){this.def.text.margin_right=e}get margin_top(){return l(this.def.text.margin_top??x.top)}set margin_top(e){this.def.text.margin_top=e}get margin_bottom(){return l(this.def.text.margin_bottom??x.bottom)}set margin_bottom(e){this.def.text.margin_bottom=e}get vertical_anchor(){return this.def.text.vertical_anchor}set vertical_anchor(e){e===void 0?delete this.def.text.vertical_anchor:this.def.text.vertical_anchor=e}get is_merge_origin(){return(this.def.span_width??1)>1||(this.def.span_height??1)>1}get is_spanned(){return this.def.spanned===!0}get span_width(){return this.def.span_width??1}get span_height(){return this.def.span_height??1}merge(e){const t=[this.row,e.row].sort((f,c)=>f-c),s=[this.col,e.col].sort((f,c)=>f-c),[r=0,n=0]=t,[o=0,a=0]=s;for(let f=r;f<=n;f++)for(let c=o;c<=a;c++){const p=this.table.rows[f]?.cells[c];p&&(f===r&&c===o?(a>o&&(p.span_width=a-o+1),n>r&&(p.span_height=n-r+1)):p.spanned=!0)}}split(){const e=this.span_width,t=this.span_height;delete this.def.span_width,delete this.def.span_height;for(let s=this.row;s<this.row+t;s++)for(let r=this.col;r<this.col+e;r++){const n=this.table.rows[s]?.cells[r];n&&delete n.spanned}}}export class Column{def;at;constructor(e,t){return this.def=e,this.at=t,h(this,"_Column")}get width(){return l(this.def.columns[this.at]??0)}set width(e){this.def.columns[this.at]=e}}export class Row{def;at;constructor(e,t){return this.def=e,this.at=t,h(this,"_Row")}get row(){const e=this.def.rows[this.at];if(!e)throw new Error(`The table has no row ${String(this.at)}.`);return e}get height(){return l(this.row.height)}set height(e){this.row.height=e}}export class Table{def;constructor(e){return this.def=e,h(this,"Table")}cell(e,t){const s=this.def.rows[e]?.cells[t];if(!s)throw new Error(`cell(): the table has ${String(this.def.rows.length)} rows and ${String(this.def.columns.length)} columns.`);return new Cell(s,this.def,e,t)}*iter_cells(){for(let e=0;e<this.def.rows.length;e++)for(let t=0;t<this.def.columns.length;t++)yield this.cell(e,t)}get columns(){return this.def.columns.map((e,t)=>new Column(this.def,t))}get rows(){return this.def.rows.map((e,t)=>new Row(this.def,t))}get style(){return V(this.def.style)?.name??null}set style(e){if(e===null){delete this.def.style;return}const t=V(e)??refuse(`Table.style: ${e} is none of PowerPoint's built-in table styles (${Ce.slice(0,3).map(s=>s.name).join(", ")}…).`);this.def.style=t.id}flag(e){return this.def[e]===!0}get first_row(){return this.flag("first_row")}set first_row(e){this.def.first_row=e}get first_col(){return this.flag("first_col")}set first_col(e){this.def.first_col=e}get last_row(){return this.flag("last_row")}set last_row(e){this.def.last_row=e}get last_col(){return this.flag("last_col")}set last_col(e){this.def.last_col=e}get horz_banding(){return this.flag("horz_banding")}set horz_banding(e){this.def.horz_banding=e}get vert_banding(){return this.flag("vert_banding")}set vert_banding(e){this.def.vert_banding=e}}function Je(i,e,t=[]){const s=new Set([...i,...t].map(n=>n.name));let r=1;for(;s.has(`${e}-${String(r)}`);)r++;return`${e}-${String(r)}`}export class ShapeCollection{list;base;components;inherit;group;under;constructor(e,t,s,r=()=>{},n=()=>[],o){return this.list=e,this.base=t,this.components=s,this.inherit=r,this.under=n,this.group=o,h(this,"SlideShapes",{index:a=>this._at(a)})}_wrap(e){return new Shape(e,()=>this.inherit(e),this.base)}_at(e){const t=this.list[e];return t?this._wrap(t):void 0}*[Symbol.iterator](){for(const e of this.list)yield this._wrap(e)}get length(){return this.list.length}get(e){const t=this.list.find(s=>s.name===e);return t?this._wrap(t):void 0}get title(){const e=this.list.find(t=>t.placeholder?.type==="title"||t.placeholder?.type==="ctrTitle");return e?this._wrap(e):void 0}get placeholders(){return new Placeholders(this.list,this.inherit,this.base)}_add(e,t){const s={name:Je(this.list,e,this.under()),...t,...this.group===void 0?{}:{group:this.group}};return this.list.push(s),this._wrap(s)}add_textbox(e,t,s,r){return this._add("textbox",{kind:"textbox",frame:m(e,t,s,r),text:{...S(),...Ne}})}add_picture(e,t,s,r,n){return(r===void 0||n===void 0)&&refuse("add_picture() takes a width and a height here: a picture's own size is not read while a deck's code runs"),this._add("picture",{kind:"picture",frame:m(t,s,r??0,n??0),media:{path:e,base:this.base}})}add_movie(e,t,s,r,n,o={}){return this._add("movie",{kind:"movie",frame:m(t,s,r,n),media:{path:e,base:this.base,...o.poster_frame_time===void 0?{}:{poster:o.poster_frame_time},...o.playback?{playback:{...o.playback}}:{}}})}add_audio(e,t,s,r=Z.icon,n=Z.icon,o={}){return this._add("audio",{kind:"audio",frame:m(t,s,r,n),media:{path:e,base:this.base,...o.playback?{playback:{...o.playback}}:{}}})}add_shape(e,t,s,r,n){ie.has(e)||refuse(`add_shape(): ${e} is not one of MSO_SHAPE's ${Object.keys(U).join(", ")}`);const o=S();return o.vertical_anchor=b.vertical_anchor,o.paragraphs=[{runs:[],level:0,alignment:b.alignment}],this._add("shape",{kind:"autoshape",frame:m(t,s,r,n),geometry:e,fill:b.fill,line:b.line,line_width:b.line_width,text:o})}add_table(e,t,s,r,n,o){(e<1||t<1)&&refuse("add_table(): a table has at least a row and a column.");const a=Math.floor(n/t),f=Math.floor(o/e);return this._add("table",{kind:"table",frame:m(s,r,n,o),table:{style:ze,first_row:!0,horz_banding:!0,columns:Array.from({length:t},()=>a),rows:Array.from({length:e},()=>({height:f,cells:Array.from({length:t},()=>({text:S()}))}))}})}add_chart(e,t,s,r,n,o){return this._add("chart",{kind:"chart",frame:m(t,s,r,n),chart:{type:e,categories:[...o.categories],series:o._series()}})}add_group_shape(){const e=this.group===void 0?"":`${this.group}/`;let t=1;for(;this.list.some(s=>D(s.group,`${e}group-${String(t)}`));)t++;return new GroupShape(this.list,`${e}group-${String(t)}`,s=>new ShapeCollection(this.list,this.base,this.components,this.inherit,this.under,s))}build_freeform(e=0,t=0,s=1){return new FreeformBuilder([e,t],s,(r,n)=>{const o=S();return o.vertical_anchor=b.vertical_anchor,o.paragraphs=[{runs:[],level:0,alignment:b.alignment}],this._add("freeform",{kind:"autoshape",frame:n,path:r,fill:b.fill,line:b.line,line_width:b.line_width,text:o})})}add_connector(e,t,s,r,n){R(e)||refuse(`add_connector(): ${e} is not one of MSO_CONNECTOR's ${Object.keys(we).join(", ")}, nor a connector's preset (${Me.join(", ")})`);const o=m(Math.min(t,r),Math.min(s,n),Math.abs(r-t),Math.abs(n-s)),a=r<t,f=n<s;return this._add("connector",{kind:"autoshape",frame:o,geometry:e,...a||f?{flip:{...a?{h:a}:{},...f?{v:f}:{}}}:{},line:K.line,line_width:K.line_width})}add_component(e,t,s,r,n,o={},a={}){if(!Object.hasOwn(this.components(),e))throw new Error(`add_component(): the presentation has no component ${e}; add it with prs.components.add("${e}", { … }) first.`);if(a.dur!==void 0&&!(Number.isFinite(a.dur)&&a.dur>0))throw new Error(`add_component(): dur is how long ${e} moves, seconds over 0; it was ${String(a.dur)}.`);return this._add(e,{kind:"component",frame:m(t,s,r,n),component:{name:e,props:o,...a.dur===void 0?{}:{dur:a.dur}}})}}export const NAME_OF_TYPE={title:"title",ctrTitle:"title",subTitle:"subtitle",body:"body",pic:"picture",media:"media",obj:"content",dt:"date",ftr:"footer",sldNum:"slide-number"};export class Placeholders{list;inherit;base;constructor(e,t=()=>{},s=""){return this.list=e,this.inherit=t,this.base=s,h(this,"placeholders",{index:r=>this.get(r)})}_wrap(e){return new Shape(e,()=>this.inherit(e),this.base)}*[Symbol.iterator](){for(const e of this.list)e.kind==="placeholder"&&(yield this._wrap(e))}get length(){return this.list.filter(e=>e.kind==="placeholder").length}get(e){const t=this.list.find(s=>s.kind==="placeholder"&&(typeof e=="number"?s.placeholder?.idx===e:s.name===e||s.placeholder?.type===e));return t?this._wrap(t):void 0}add(e,t,s,r,n,o={}){const a=typeof t=="object"?t:o,f=typeof t=="object"?void 0:t;Object.values(Y).includes(e)||refuse(`placeholders.add(): ${e} is not one of PP_PLACEHOLDER's ${Object.keys(Y).join(", ")}`);const c=this.list.filter(u=>u.kind==="placeholder"),p=new Set(c.map(u=>u.placeholder?.idx));let w=e==="title"||e==="ctrTitle"?0:Re[e]??1;for(p.has(w)&&w===0&&(w=1);p.has(w);)w++;const y=a.name??NAME_OF_TYPE[e];if(this.list.some(u=>u.name===y))throw new Error(`Two shapes are ${y}: give the placeholder a name ({ name }).`);const d=[f,s,r,n].filter(u=>u!==void 0);if(d.length!==0&&d.length!==4)throw new Error("placeholders.add(type, left, top, width, height): give all four, or none to take the master's frame.");const _={name:y,kind:"placeholder",placeholder:{type:e,idx:w,...a.orient==="vert"?{orient:"vert"}:{}},...d.length===4?{frame:m(f??0,s??0,r??0,n??0)}:{},text:{paragraphs:[],levels:Le(e)}};return this.list.push(_),this._wrap(_)}}export class SlideLayout{def;master;ctx;constructor(e,t,s){return this.def=e,this.master=t,this.ctx=s,h(this,"SlideLayout")}get _def(){return this.def}inherit=e=>e.placeholder?q(this.master._def,e.placeholder.type)?.frame:void 0;get name(){return this.def.name}get slide_master(){return this.master}get display_master_shapes(){return this.def.display_master_shapes??!0}set display_master_shapes(e){e?delete this.def.display_master_shapes:this.def.display_master_shapes=!1}get color_map(){return this.def.color_map&&{...this.def.color_map}}set color_map(e){e===void 0?delete this.def.color_map:this.def.color_map=v(e)}get background(){return new Background(this.def,this.ctx.base)}get placeholders(){return new Placeholders(this.def.shapes,this.inherit,this.ctx.base)}get shapes(){return new ShapeCollection(this.def.shapes,this.ctx.base,this.ctx.components,this.inherit,()=>this.master._def.shapes)}}export class SlideLayouts{list;make;constructor(e,t){return this.list=e,this.make=t,h(this,"SlideLayouts",{index:s=>this.list[s]})}*[Symbol.iterator](){yield*this.list}get length(){return this.list.length}get_by_name(e,t){return this.list.find(s=>s.name===e)??t}index(e){const t=this.list.indexOf(e);if(t<0)throw new Error(`${e.name} is not among these layouts.`);return t}add(e,t){if(!this.make)throw new Error("A layout is added to a master: master.slide_layouts.add(name).");const s=this.make(e);return t?.(s),s}}export class TextStyles{def;constructor(e){return this.def=e,h(this,"text_styles")}get title_style(){return T(this.def.title)}get body_style(){return T(this.def.body)}get other_style(){return T(this.def.other,!0)}}export class SlideMaster{def;layouts=[];ctx;allLayouts;constructor(e,t,s){return this.def=e,this.ctx=t,this.allLayouts=s,h(this,"SlideMaster")}get _def(){return this.def}get name(){return this.def.name}get color_map(){return{...OFFICE_COLOR_MAP,...this.def.color_map}}set color_map(e){const t=v(e),s=Object.fromEntries(Object.entries(t).filter(([r,n])=>OFFICE_COLOR_MAP[r]!==n));Object.keys(s).length===0?delete this.def.color_map:this.def.color_map=s}get background(){return new Background(this.def,this.ctx.base)}get placeholders(){return new Placeholders(this.def.shapes,void 0,this.ctx.base)}get shapes(){return new ShapeCollection(this.def.shapes,this.ctx.base,this.ctx.components)}get text_styles(){return new TextStyles(this.def.text_styles)}get slide_layouts(){return new SlideLayouts(this.layouts,e=>{if(this.allLayouts.some(r=>r.name===e))throw new Error(`Two layouts are "${e}": a layout's name is unique in the deck, as its slides file names it.`);const t={name:e,master:this.def.name,shapes:[]};this.def.layouts.push(t);const s=new SlideLayout(t,this,this.ctx);return this.layouts.push(s),this.allLayouts.push(s),s})}}export class SlideMasters{list;make;constructor(e,t){return this.list=e,this.make=t,h(this,"SlideMasters",{index:s=>this.list[s]})}*[Symbol.iterator](){yield*this.list}get length(){return this.list.length}index(e){return this.list.indexOf(e)}add(e,t){const s=this.make(e);return t?.(s),s}}export class GeneratedSlide{own;def;layout;constructor(e,t,s){this.def=e,this.layout=t,this.own=t._def.shapes.filter(n=>n.kind==="placeholder").map(n=>({name:n.name,kind:"placeholder",...n.placeholder?{placeholder:{...n.placeholder}}:{},text:S()}));const r=n=>{const o=t._def.shapes.find(a=>a.kind==="placeholder"&&a.placeholder?.idx===n.placeholder?.idx);return o?o.frame??(o.placeholder?q(t.slide_master._def,o.placeholder.type)?.frame:void 0):void 0};return this._shapes=new ShapeCollection(this.own,s.base,s.components,r,()=>[...t.slide_master._def.shapes,...t._def.shapes]),this._placeholders=new Placeholders(this.own,r,s.base),h(this,"Slide")}_shapes;_placeholders;get shapes(){return this._shapes}get placeholders(){return this._placeholders}get slide_id(){return this.def.id}get slide_layout(){return this.layout}get has_notes_slide(){return this.def.notes!==void 0}get notes_slide(){const e=this.def;return h({notes_text_frame:h({get text(){return e.notes??""},set text(t){e.notes=t}},"TextFrame")},"NotesSlide")}get transition(){return this.def.transition}set transition(e){e===void 0?delete this.def.transition:this.def.transition=e}get animations(){return new Animations(this.def.animations??=[])}_done(){const e={},t=[];for(const s of this.own)s.kind==="placeholder"&&s.placeholder?(s.text?.paragraphs.some(r=>r.runs.length>0)&&(e[s.placeholder.idx]=s.text.paragraphs),s.frame&&t.push({...s,text:S()})):t.push(s);return{...this.def,shapes:t,text:e}}}export class Animations{list;constructor(e){return this.list=e,h(this,"Animations")}add(e,t,s={}){this.list.push({shape:typeof e=="string"?e:e.name,effect:t,...s})}get length(){return this.list.length}}class Ze{gen;constructor(e){return this.gen=e,h(this,"slides")}add_slide(e,t){return this.gen._add(e,t)}}export class Generator{list=[];prs;ctx;constructor(e,t){return this.prs=e,this.ctx=t,h(this,"Generator")}data(e){return this.ctx.data(e)}get slides(){return new Ze(this)}_add(e,t){const s=typeof e=="string"?this.prs._layout(e):e;if(!s)throw new Error(`add_slide(): the presentation has no layout ${typeof e=="string"?e:e.name}.`);if(!/^[A-Za-z0-9_-]+$/u.test(t))throw new Error(`add_slide(): ${t} is not an id of letters, digits, _ and -.`);if(this.list.some(n=>n.slide_id===t))throw new Error(`add_slide(): two slides are ${t}.`);const r=new GeneratedSlide({id:t,layout:s.name,shapes:[],text:{}},s,this.prs._ctx);return this.list.push(r),r}_made(){return this.list.map(e=>e._done())}}const Ke=()=>JSON.parse(JSON.stringify(je));export class Presentation{masters=[];layouts=[];def;_ctx;constructor(e,t){return this.def={slide_width:e[0],slide_height:e[1],masters:[],components:{},generators:{}},this._ctx={base:t,components:()=>this.def.components},h(this,"Presentation")}get _def(){return this.def}get slide_width(){return l(this.def.slide_width)}set slide_width(e){this.def.slide_width=e}get slide_height(){return l(this.def.slide_height)}set slide_height(e){this.def.slide_height=e}get slide_masters(){return new SlideMasters(this.masters,e=>{if(this.masters.some(r=>r.name===e))throw new Error(`Two masters are "${e}".`);const t={name:e,background:"bg1",text_styles:Ke(),shapes:[],layouts:[]};this.def.masters.push(t);const s=new SlideMaster(t,this._ctx,this.layouts);return this.masters.push(s),s})}_withOfficeMaster(){if(this.masters.length>0)return;const e=this.def.style;e===void 0?fe(this):ue(this,F[e.name])}get slide_master(){this._withOfficeMaster();const e=this.masters[0];if(!e)throw new Error("The presentation has no master yet: prs.slide_masters.add(name) makes one.");return e}get slide_layouts(){this._withOfficeMaster();const e=this.masters[0];return e?e.slide_layouts:new SlideLayouts([])}get slides(){return refuse("A deck's slides are in the slides file presentation({ slides }) names, in order, each on a layout, and their words in its script; slides made from data are a generator's (prs.generators.add)")}save(){return refuse("A deck is not saved by its code: allyhub export writes its PDF, pictures and PPTX")}get theme(){return this.def.theme??={},this.def.theme}set theme(e){this.def.theme=typeof e=="string"?{name:e}:e}get components(){return h({add:(e,t)=>{if(Object.hasOwn(this.def.components,e))throw new Error(`Two components are "${e}".`);const s=le(e,t);if(!s)throw new Error(`Component ${e} is not a component: give what defineComponent makes, or { props, layers }.`);this.def.components[e]=s}},"components")}get generators(){return h({add:(e,t)=>{if(Object.hasOwn(this.def.generators,e))throw new Error(`Two generators are "${e}".`);this.def.generators[e]={name:e,make:s=>{const r=new Generator(this,s);return t(r),r._made()}}}},"generators")}_layout(e){return this.layouts.find(t=>t.name===e)}}export const DECK_BRAND="__allyhubDeck";export function isDeck(i){return typeof i=="object"&&i!==null&&DECK_BRAND in i}export const presentationFor=i=>(e,t)=>{const[s,r]=typeof e=="function"?[{},e]:[e,t];if(r!==void 0&&typeof r!="function")throw new Error(`A deck's module exports one deck: export default presentation({ slides: "./deck.yaml", script: "./deck.{locale}.yaml", size }, (prs) => { … masters, layouts, components … }), its slides and its script named from its folder; the build is left out for Office's layouts alone.`);if(s.script!==void 0&&!s.script.includes("{locale}"))throw new Error(`presentation(): script ${s.script} names one file: write {locale} in its name for each language (./deck.{locale}.yaml).`);if(s.style!==void 0&&!pe(s.style))throw new Error(`presentation(): style ${String(s.style)} is not one of ${ce.join(", ")}.`);const n=s.fonts;if(n!==void 0&&n!=="style"&&n!=="system")throw new Error(`presentation(): fonts ${String(s.fonts)} is "style" (the style's own faces, in its file) or "system" (faces every computer has, for Keynote).`);if(typeof s.size=="string"&&!Object.hasOwn(L,s.size))throw new Error(`presentation(): size ${s.size} is not one of ${Object.keys(L).join(", ")}, or { width, height } in EMU.`);return{[DECK_BRAND]:!0,kind:"slides",options:s,build:r??(()=>{}),written:{file:i}}};export function evaluateDeck(i){const e=i.options.size??"16:9",t=typeof e=="string"?L[e]:[e.width,e.height],s=i.written.file.split("/").slice(0,-1).join("/"),r=new Presentation(t,s);i.options.theme&&(r.theme=typeof i.options.theme=="string"?i.options.theme:JSON.parse(JSON.stringify(i.options.theme)));const n=i.options.style;if(n!==void 0){const o=i.options.fonts??"style";r._def.style={name:n,fonts:o};const a=F[n].fonts,f=o==="system"?a.system:a,c=r.theme;c.fonts={major:f.major,minor:f.minor,...c.fonts}}return i.build(r),r._withOfficeMaster(),r._def}
|