allyhub 0.6.0 → 0.7.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/audio-text.js +1 -1
- package/dist/commands/add.js +2 -2
- package/dist/commands/cloud-tools.js +5 -5
- package/dist/commands/dev.js +1 -1
- package/dist/commands/frames/piece.js +1 -1
- package/dist/commands/frames/sheet.js +1 -1
- package/dist/commands/frames.js +8 -8
- package/dist/commands/index.js +1 -1
- package/dist/commands/inspect/common.js +1 -1
- package/dist/commands/inspect/layout.js +1 -1
- package/dist/commands/render.js +1 -1
- package/dist/commands/sheet.js +5 -5
- package/dist/commands/site.js +3 -2
- package/dist/commands/skills.js +3 -3
- package/dist/commands/slides.js +2 -2
- package/dist/node_modules/@allyhub-next/audio/dist/node/index.js +1 -1
- package/dist/node_modules/@allyhub-next/audio/dist/node/master.js +1 -1
- package/dist/node_modules/@allyhub-next/audio/package.json +1 -1
- package/dist/node_modules/@allyhub-next/browser/dist/html.js +1 -1
- package/dist/node_modules/@allyhub-next/browser/package.json +1 -1
- package/dist/node_modules/@allyhub-next/build/dist/content.d.ts +4 -0
- package/dist/node_modules/@allyhub-next/build/dist/content.js +1 -1
- package/dist/node_modules/@allyhub-next/build/dist/index.d.ts +2 -2
- package/dist/node_modules/@allyhub-next/build/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/build/dist/meta-worker.d.ts +2 -2
- package/dist/node_modules/@allyhub-next/build/dist/meta-worker.js +3 -3
- package/dist/node_modules/@allyhub-next/build/dist/move-refs.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/build/dist/move-refs.js +1 -1
- package/dist/node_modules/@allyhub-next/build/dist/plugin.d.ts +12 -3
- package/dist/node_modules/@allyhub-next/build/dist/plugin.js +7 -6
- package/dist/node_modules/@allyhub-next/build/dist/prepare.d.ts +9 -5
- package/dist/node_modules/@allyhub-next/build/dist/prepare.js +2 -2
- package/dist/node_modules/@allyhub-next/build/dist/vite.d.ts +10 -0
- package/dist/node_modules/@allyhub-next/build/dist/vite.js +2 -2
- package/dist/node_modules/@allyhub-next/build/package.json +1 -1
- package/dist/node_modules/@allyhub-next/chart/dist/chart-xml.js +2 -2
- package/dist/node_modules/@allyhub-next/chart/dist/chart.d.ts +14 -5
- package/dist/node_modules/@allyhub-next/chart/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub-next/chart/package.json +1 -1
- package/dist/node_modules/@allyhub-next/check/dist/check.js +3 -3
- package/dist/node_modules/@allyhub-next/check/package.json +1 -1
- package/dist/node_modules/@allyhub-next/cloud/dist/blobs.js +2 -0
- package/dist/node_modules/@allyhub-next/cloud/dist/call.js +4 -2
- package/dist/node_modules/@allyhub-next/cloud/dist/client.js +1 -1
- package/dist/node_modules/@allyhub-next/cloud/dist/errors.js +1 -1
- package/dist/node_modules/@allyhub-next/cloud/dist/hashes.js +2 -0
- package/dist/node_modules/@allyhub-next/cloud/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/cloud/dist/sites.js +2 -0
- package/dist/node_modules/@allyhub-next/cloud/dist/voice.js +1 -1
- package/dist/node_modules/@allyhub-next/cloud/package.json +1 -1
- package/dist/node_modules/@allyhub-next/components/package.json +1 -1
- package/dist/node_modules/@allyhub-next/components/r/caption-subtitle.json +1 -1
- package/dist/node_modules/@allyhub-next/components/src/caption-subtitle.ts +54 -16
- package/dist/node_modules/@allyhub-next/dev-server/dist/background.js +1 -1
- package/dist/node_modules/@allyhub-next/dev-server/dist/fonts.js +2 -0
- package/dist/node_modules/@allyhub-next/dev-server/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/dev-server/dist/live.js +1 -1
- package/dist/node_modules/@allyhub-next/dev-server/dist/project.js +1 -1
- package/dist/node_modules/@allyhub-next/dev-server/dist/reach.js +2 -0
- package/dist/node_modules/@allyhub-next/dev-server/dist/record.js +2 -0
- package/dist/node_modules/@allyhub-next/dev-server/dist/server.js +2 -2
- package/dist/node_modules/@allyhub-next/dev-server/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub-next/dev-server/dist/tree.js +2 -0
- package/dist/node_modules/@allyhub-next/dev-server/package.json +1 -1
- package/dist/node_modules/@allyhub-next/doc/package.json +1 -1
- package/dist/node_modules/@allyhub-next/export/dist/deck-pptx.js +1 -1
- package/dist/node_modules/@allyhub-next/export/dist/export.js +5 -5
- package/dist/node_modules/@allyhub-next/export/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/export/package.json +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/deck-code.d.ts +205 -0
- package/dist/node_modules/@allyhub-next/formats/dist/data/deck-code.js +2 -0
- package/dist/node_modules/@allyhub-next/formats/dist/data/script.d.ts +4 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/script.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.d.ts +69 -18
- package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/slides.d.ts +847 -116
- package/dist/node_modules/@allyhub-next/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/website.d.ts +20 -0
- package/dist/node_modules/@allyhub-next/formats/dist/data/website.js +2 -0
- package/dist/node_modules/@allyhub-next/formats/dist/index.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/formats/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/items.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/items.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/media-type.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/formats/dist/media-type.js +2 -0
- package/dist/node_modules/@allyhub-next/formats/dist/schemas.d.ts +501 -38
- package/dist/node_modules/@allyhub-next/formats/dist/schemas.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/strict.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/formats/dist/strict.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/package.json +2 -1
- package/dist/node_modules/@allyhub-next/measure/package.json +1 -1
- package/dist/node_modules/@allyhub-next/media/dist/index.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/media/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/media/dist/sheet.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/media/dist/sheet.js +7 -7
- package/dist/node_modules/@allyhub-next/media/package.json +1 -1
- package/dist/node_modules/@allyhub-next/model/package.json +1 -1
- package/dist/node_modules/@allyhub-next/ooxml/dist/brightness.d.ts +31 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/brightness.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/color.d.ts +33 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/color.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/enums.d.ts +13 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/enums.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/ext.d.ts +79 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/ext.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/enums.d.ts +132 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/enums.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/presets.d.ts +28 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/presets.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/spec.d.ts +4708 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/spec.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/geometry/index.d.ts +57 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/geometry/index.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/index.d.ts +10 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/index.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/mce.d.ts +12 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/mce.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/node.d.ts +111 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/node.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/ns.d.ts +45 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/ns.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/opc.d.ts +48 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/opc.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/report.d.ts +45 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/report.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/xml.d.ts +28 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/xml.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/package.json +26 -0
- package/dist/node_modules/@allyhub-next/project/dist/deck-keys.js +2 -0
- package/dist/node_modules/@allyhub-next/project/dist/deck-measure.js +2 -0
- package/dist/node_modules/@allyhub-next/project/dist/deck-pool.js +2 -0
- package/dist/node_modules/@allyhub-next/project/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/project/dist/session.js +1 -1
- package/dist/node_modules/@allyhub-next/project/dist/stills.js +2 -0
- package/dist/node_modules/@allyhub-next/project/package.json +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/account.d.ts +338 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/account.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/auth.d.ts +12 -13
- package/dist/node_modules/@allyhub-next/protocol/dist/auth.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/blobs.d.ts +35 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/blobs.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/cloud.d.ts +101 -32
- package/dist/node_modules/@allyhub-next/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/editor.d.ts +79 -5
- package/dist/node_modules/@allyhub-next/protocol/dist/editor.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/files.d.ts +2 -2
- package/dist/node_modules/@allyhub-next/protocol/dist/index.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/notes.d.ts +21 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/notes.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/open.d.ts +13 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/open.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/registry.d.ts +73 -59
- package/dist/node_modules/@allyhub-next/protocol/dist/registry.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/routes.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/routes.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/shares.d.ts +115 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/shares.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/sites.d.ts +293 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/sites.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.d.ts +377 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/teams.d.ts +27 -9
- package/dist/node_modules/@allyhub-next/protocol/dist/teams.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/tools.d.ts +53 -14
- package/dist/node_modules/@allyhub-next/protocol/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/package.json +2 -1
- package/dist/node_modules/@allyhub-next/registry/package.json +1 -1
- package/dist/node_modules/@allyhub-next/render/dist/doc/fonts.js +3 -2
- package/dist/node_modules/@allyhub-next/render/dist/doc/index.js +1 -1
- package/dist/node_modules/@allyhub-next/render/dist/doc/pdf.js +34 -0
- package/dist/node_modules/@allyhub-next/render/dist/doc/print.js +4 -4
- package/dist/node_modules/@allyhub-next/render/dist/exports.js +2 -2
- package/dist/node_modules/@allyhub-next/render/dist/pdf.js +2 -0
- package/dist/node_modules/@allyhub-next/render/package.json +1 -1
- package/dist/node_modules/@allyhub-next/runtime/dist/fonts.js +1 -1
- package/dist/node_modules/@allyhub-next/runtime/dist/music.js +1 -1
- package/dist/node_modules/@allyhub-next/runtime/package.json +1 -1
- package/dist/node_modules/@allyhub-next/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub-next/runtimes/schemas/runtimes.schema.json +25 -5
- package/dist/node_modules/@allyhub-next/scaffold/dist/index.js +4 -4
- package/dist/node_modules/@allyhub-next/scaffold/package.json +1 -1
- package/dist/node_modules/@allyhub-next/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub-next/scenery-host/dist/bundle.d.ts +10 -0
- package/dist/node_modules/@allyhub-next/scenery-host/dist/bundle.js +3 -3
- package/dist/node_modules/@allyhub-next/scenery-host/package.json +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.d.ts +9 -3
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.d.ts +5 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.d.ts +60 -13
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/aggregate.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/convert.d.ts +4 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/convert.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/criteria.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/database.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/date.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.d.ts +27 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/delimiters.d.ts +16 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/delimiters.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.d.ts +18 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/finance.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/info.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/kernels.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/logical.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/lookup.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/maths.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/modern.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/modern.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/text.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/graph.d.ts +38 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/graph.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/indexes.d.ts +19 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/indexes.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/remote.d.ts +49 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/remote.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/server.d.ts +82 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/server.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.d.ts +6 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/check.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/diff.d.ts +15 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/diff.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/export.d.ts +29 -8
- package/dist/node_modules/@allyhub-next/sheet/dist/export.js +3 -4
- package/dist/node_modules/@allyhub-next/sheet/dist/file.js +2 -2
- package/dist/node_modules/@allyhub-next/sheet/dist/format.d.ts +8 -2
- package/dist/node_modules/@allyhub-next/sheet/dist/format.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/html.d.ts +52 -4
- package/dist/node_modules/@allyhub-next/sheet/dist/html.js +43 -11
- package/dist/node_modules/@allyhub-next/sheet/dist/index.d.ts +7 -3
- package/dist/node_modules/@allyhub-next/sheet/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/inspect.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/paginate.d.ts +98 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/paginate.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/structure.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/table-style.d.ts +32 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/table-style.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/table-styles.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/table-styles.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/values.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/workbook.d.ts +10 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/workbook.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.d.ts +10 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.d.ts +14 -4
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.js +2 -2
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.d.ts +11 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.js +36 -16
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.d.ts +3 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.d.ts +42 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.js +2 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/sax.d.ts +23 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/sax.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/zip.d.ts +40 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/zip.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/animation.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/api.d.ts +59 -39
- package/dist/node_modules/@allyhub-next/slides-core/dist/api.js +2 -2
- package/dist/node_modules/@allyhub-next/slides-core/dist/capabilities.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.d.ts +27 -13
- package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/check.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/code.d.ts +33 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/code.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/components.d.ts +31 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/components.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/enums.d.ts +179 -16
- package/dist/node_modules/@allyhub-next/slides-core/dist/enums.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/file.d.ts +43 -21
- package/dist/node_modules/@allyhub-next/slides-core/dist/file.js +3 -3
- package/dist/node_modules/@allyhub-next/slides-core/dist/identity.d.ts +17 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/identity.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/index.d.ts +5 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/lang.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/lang.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/measure.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/merge.d.ts +58 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/merge.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/model.d.ts +2 -4
- package/dist/node_modules/@allyhub-next/slides-core/dist/office.d.ts +17 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/office.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.d.ts +21 -5
- package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/script.d.ts +18 -16
- package/dist/node_modules/@allyhub-next/slides-core/dist/script.js +2 -2
- package/dist/node_modules/@allyhub-next/slides-core/dist/stage.d.ts +51 -53
- package/dist/node_modules/@allyhub-next/slides-core/dist/strict.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/units.d.ts +27 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/units.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/values.d.ts +7 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/values.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/code.js +4 -0
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/index.js +3 -0
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/names.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/script.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/chart.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/common.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/index.js +4 -0
- package/dist/{site.js → node_modules/@allyhub-next/slides-pptx/dist/read/model.js} +1 -1
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/shapes.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/table.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/text.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/timing.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/shapes.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/text.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/theme.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/timing.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/write.js +2 -2
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/xml.js +2 -2
- package/dist/node_modules/@allyhub-next/slides-pptx/package.json +1 -1
- package/dist/node_modules/@allyhub-next/slides-runtime/dist/component.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-runtime/dist/draw.js +2 -2
- package/dist/node_modules/@allyhub-next/slides-runtime/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-runtime/dist/load.js +5 -5
- package/dist/node_modules/@allyhub-next/slides-runtime/package.json +5 -1
- package/dist/node_modules/@allyhub-next/stage/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/stage/dist/page.js +22 -12
- package/dist/node_modules/@allyhub-next/stage/dist/scenery-page.js +5 -5
- package/dist/node_modules/@allyhub-next/stage/dist/server.js +1 -1
- package/dist/node_modules/@allyhub-next/stage/package.json +1 -1
- package/dist/node_modules/@allyhub-next/stage-page/dist/host.js +1 -20
- package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/probe.html +8 -0
- package/dist/{astro.js → node_modules/@allyhub-next/stage-page/dist/runtime/probe.js} +1 -1
- package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/runtime.js +79 -0
- package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/stage.html +21 -0
- package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/stage.js +3 -0
- package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/viewer.html +9 -0
- package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/viewer.js +3 -0
- package/dist/node_modules/@allyhub-next/stage-page/package.json +2 -3
- package/dist/node_modules/@allyhub-next/video-core/dist/captions.js +6 -6
- package/dist/node_modules/@allyhub-next/video-core/dist/fact.d.ts +47 -8
- package/dist/node_modules/@allyhub-next/video-core/dist/fact.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/index.d.ts +1 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/marks.d.ts +14 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/marks.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/music.d.ts +2 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/piece.d.ts +11 -2
- package/dist/node_modules/@allyhub-next/video-core/dist/problem.d.ts +4 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/problem.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/schema.d.ts +2 -2
- package/dist/node_modules/@allyhub-next/video-core/dist/schema.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/script.d.ts +2 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/script.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/source.d.ts +7 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/source.js +2 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/timeline.d.ts +10 -33
- package/dist/node_modules/@allyhub-next/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub-next/website/LICENSE +241 -0
- package/dist/node_modules/@allyhub-next/website/dist/index.js +2 -0
- package/dist/node_modules/@allyhub-next/website/dist/publish.js +3 -0
- package/dist/node_modules/@allyhub-next/website/dist/rules.js +2 -0
- package/dist/node_modules/@allyhub-next/website/dist/website.js +4 -0
- package/dist/node_modules/@allyhub-next/website/package.json +13 -0
- package/dist/text/facts-text.js +4 -4
- package/dist/works.js +1 -1
- package/editor-web/assets/calc-worker-Bz9r26p1.js +158 -0
- package/editor-web/assets/dist-0emakyZE.js +36 -0
- package/editor-web/assets/dist-B3UoDUa5.js +37 -0
- package/editor-web/assets/dist-B6KzR3pN.js +10 -0
- package/editor-web/assets/dist-Bc5iA5k1.js +1 -0
- package/editor-web/assets/dist-CTQIm8Im.js +10 -0
- package/editor-web/assets/dist-CiHNHwyq.js +2 -0
- package/editor-web/assets/dist-DNZ8PQ-E.js +224 -0
- package/editor-web/assets/index-CFt3ovRY.js +69 -0
- package/editor-web/assets/index-ujKjdu_s.css +2 -0
- package/editor-web/assets/minus-BhoPZC5P.js +1 -0
- package/editor-web/assets/react-C_-rEEBU.js +101 -0
- package/editor-web/assets/tabs-Den4gHrU.js +105 -0
- package/editor-web/assets/text-align-start-CsW4nqqL.js +1 -0
- package/editor-web/index.html +5 -5
- package/package.json +8 -14
- package/dist/astro.d.ts +0 -2
- package/dist/node_modules/@allyhub-next/audio/dist/at-cut.d.ts +0 -52
- package/dist/node_modules/@allyhub-next/audio/dist/decode.d.ts +0 -33
- package/dist/node_modules/@allyhub-next/audio/dist/envelope.d.ts +0 -37
- package/dist/node_modules/@allyhub-next/audio/dist/index.d.ts +0 -17
- package/dist/node_modules/@allyhub-next/audio/dist/levels.d.ts +0 -97
- package/dist/node_modules/@allyhub-next/audio/dist/master.d.ts +0 -29
- package/dist/node_modules/@allyhub-next/audio/dist/music.d.ts +0 -11
- package/dist/node_modules/@allyhub-next/audio/dist/node/decode.d.ts +0 -39
- package/dist/node_modules/@allyhub-next/audio/dist/node/ebur128.d.ts +0 -25
- package/dist/node_modules/@allyhub-next/audio/dist/node/ffmpeg.d.ts +0 -31
- package/dist/node_modules/@allyhub-next/audio/dist/node/index.d.ts +0 -8
- package/dist/node_modules/@allyhub-next/audio/dist/node/loudness.d.ts +0 -18
- package/dist/node_modules/@allyhub-next/audio/dist/node/master.d.ts +0 -42
- package/dist/node_modules/@allyhub-next/audio/dist/node/measure.d.ts +0 -60
- package/dist/node_modules/@allyhub-next/audio/dist/node/mix.d.ts +0 -31
- package/dist/node_modules/@allyhub-next/audio/dist/plan.d.ts +0 -143
- package/dist/node_modules/@allyhub-next/audio/dist/recorded.d.ts +0 -26
- package/dist/node_modules/@allyhub-next/audio/dist/recording/bandwidth.d.ts +0 -47
- package/dist/node_modules/@allyhub-next/audio/dist/recording/chain.d.ts +0 -89
- package/dist/node_modules/@allyhub-next/audio/dist/recording/dynamics.d.ts +0 -64
- package/dist/node_modules/@allyhub-next/audio/dist/recording/fft.d.ts +0 -26
- package/dist/node_modules/@allyhub-next/audio/dist/recording/filters.d.ts +0 -42
- package/dist/node_modules/@allyhub-next/audio/dist/recording/fit.d.ts +0 -56
- package/dist/node_modules/@allyhub-next/audio/dist/recording/index.d.ts +0 -10
- package/dist/node_modules/@allyhub-next/audio/dist/recording/loudness.d.ts +0 -12
- package/dist/node_modules/@allyhub-next/audio/dist/recording/measure.d.ts +0 -67
- package/dist/node_modules/@allyhub-next/audio/dist/recording/mic.d.ts +0 -32
- package/dist/node_modules/@allyhub-next/audio/dist/recording/noise.d.ts +0 -27
- package/dist/node_modules/@allyhub-next/audio/dist/recording/presets.d.ts +0 -64
- package/dist/node_modules/@allyhub-next/audio/dist/recording/room.d.ts +0 -78
- package/dist/node_modules/@allyhub-next/audio/dist/recording/setup.d.ts +0 -111
- package/dist/node_modules/@allyhub-next/audio/dist/recording/vec.d.ts +0 -3
- package/dist/node_modules/@allyhub-next/audio/dist/render.d.ts +0 -26
- package/dist/node_modules/@allyhub-next/audio/dist/sfx.d.ts +0 -10
- package/dist/node_modules/@allyhub-next/audio/dist/shape.d.ts +0 -118
- package/dist/node_modules/@allyhub-next/audio/dist/voice.d.ts +0 -45
- package/dist/node_modules/@allyhub-next/browser/dist/browser.d.ts +0 -24
- package/dist/node_modules/@allyhub-next/browser/dist/capture.d.ts +0 -61
- package/dist/node_modules/@allyhub-next/browser/dist/cdp.d.ts +0 -51
- package/dist/node_modules/@allyhub-next/browser/dist/flags.d.ts +0 -13
- package/dist/node_modules/@allyhub-next/browser/dist/frames.d.ts +0 -35
- package/dist/node_modules/@allyhub-next/browser/dist/html.d.ts +0 -19
- package/dist/node_modules/@allyhub-next/browser/dist/index.d.ts +0 -10
- package/dist/node_modules/@allyhub-next/browser/dist/launch.d.ts +0 -35
- package/dist/node_modules/@allyhub-next/browser/dist/page.d.ts +0 -67
- package/dist/node_modules/@allyhub-next/browser/dist/server.d.ts +0 -26
- package/dist/node_modules/@allyhub-next/check/dist/cache.d.ts +0 -46
- package/dist/node_modules/@allyhub-next/check/dist/check.d.ts +0 -142
- package/dist/node_modules/@allyhub-next/check/dist/generated.d.ts +0 -22
- package/dist/node_modules/@allyhub-next/check/dist/index.d.ts +0 -7
- package/dist/node_modules/@allyhub-next/check/dist/plans.d.ts +0 -111
- package/dist/node_modules/@allyhub-next/check/dist/result.d.ts +0 -12
- package/dist/node_modules/@allyhub-next/check/dist/scenery.d.ts +0 -23
- package/dist/node_modules/@allyhub-next/dev-server/dist/background.d.ts +0 -50
- package/dist/node_modules/@allyhub-next/dev-server/dist/card.d.ts +0 -17
- package/dist/node_modules/@allyhub-next/dev-server/dist/exports.d.ts +0 -18
- package/dist/node_modules/@allyhub-next/dev-server/dist/index.d.ts +0 -11
- package/dist/node_modules/@allyhub-next/dev-server/dist/live.d.ts +0 -77
- package/dist/node_modules/@allyhub-next/dev-server/dist/mime.d.ts +0 -2
- package/dist/node_modules/@allyhub-next/dev-server/dist/mime.js +0 -2
- package/dist/node_modules/@allyhub-next/dev-server/dist/paths.d.ts +0 -27
- package/dist/node_modules/@allyhub-next/dev-server/dist/project.d.ts +0 -153
- package/dist/node_modules/@allyhub-next/dev-server/dist/reveal.d.ts +0 -6
- package/dist/node_modules/@allyhub-next/dev-server/dist/server.d.ts +0 -47
- package/dist/node_modules/@allyhub-next/dev-server/dist/sound.d.ts +0 -21
- package/dist/node_modules/@allyhub-next/dev-server/dist/stage.d.ts +0 -82
- package/dist/node_modules/@allyhub-next/dev-server/dist/stage.js +0 -121
- package/dist/node_modules/@allyhub-next/dev-server/dist/tools.d.ts +0 -24
- package/dist/node_modules/@allyhub-next/dev-server/dist/validate.d.ts +0 -6
- package/dist/node_modules/@allyhub-next/dev-server/dist/watcher.d.ts +0 -47
- package/dist/node_modules/@allyhub-next/dev-server/dist/writer.d.ts +0 -51
- package/dist/node_modules/@allyhub-next/export/dist/batch.d.ts +0 -70
- package/dist/node_modules/@allyhub-next/export/dist/deck-fonts.d.ts +0 -24
- package/dist/node_modules/@allyhub-next/export/dist/deck-pptx.d.ts +0 -12
- package/dist/node_modules/@allyhub-next/export/dist/export.d.ts +0 -123
- package/dist/node_modules/@allyhub-next/export/dist/index.d.ts +0 -5
- package/dist/node_modules/@allyhub-next/export/dist/names.d.ts +0 -36
- package/dist/node_modules/@allyhub-next/measure/dist/compare.d.ts +0 -195
- package/dist/node_modules/@allyhub-next/measure/dist/contrast.d.ts +0 -14
- package/dist/node_modules/@allyhub-next/measure/dist/cut-sheet.d.ts +0 -90
- package/dist/node_modules/@allyhub-next/measure/dist/cuts.d.ts +0 -108
- package/dist/node_modules/@allyhub-next/measure/dist/facts.d.ts +0 -60
- package/dist/node_modules/@allyhub-next/measure/dist/fidelity.d.ts +0 -40
- package/dist/node_modules/@allyhub-next/measure/dist/flat.d.ts +0 -42
- package/dist/node_modules/@allyhub-next/measure/dist/index.d.ts +0 -24
- package/dist/node_modules/@allyhub-next/measure/dist/loop.d.ts +0 -22
- package/dist/node_modules/@allyhub-next/measure/dist/overlay.d.ts +0 -57
- package/dist/node_modules/@allyhub-next/measure/dist/recording-report.d.ts +0 -66
- package/dist/node_modules/@allyhub-next/measure/dist/reference/compare.d.ts +0 -118
- package/dist/node_modules/@allyhub-next/measure/dist/reference/folder.d.ts +0 -75
- package/dist/node_modules/@allyhub-next/measure/dist/reference/interpret.d.ts +0 -39
- package/dist/node_modules/@allyhub-next/measure/dist/reference/piece.d.ts +0 -53
- package/dist/node_modules/@allyhub-next/measure/dist/reference/sections.d.ts +0 -53
- package/dist/node_modules/@allyhub-next/measure/dist/reference/sets.d.ts +0 -84
- package/dist/node_modules/@allyhub-next/measure/dist/reference/text.d.ts +0 -27
- package/dist/node_modules/@allyhub-next/measure/dist/reference/video.d.ts +0 -55
- package/dist/node_modules/@allyhub-next/measure/dist/seams.d.ts +0 -46
- package/dist/node_modules/@allyhub-next/measure/dist/sound-measures.d.ts +0 -74
- package/dist/node_modules/@allyhub-next/measure/dist/sound-report.d.ts +0 -156
- package/dist/node_modules/@allyhub-next/measure/dist/still.d.ts +0 -58
- package/dist/node_modules/@allyhub-next/measure/dist/version-voice.d.ts +0 -12
- package/dist/node_modules/@allyhub-next/project/dist/console.d.ts +0 -34
- package/dist/node_modules/@allyhub-next/project/dist/digest.d.ts +0 -9
- package/dist/node_modules/@allyhub-next/project/dist/index.d.ts +0 -11
- package/dist/node_modules/@allyhub-next/project/dist/ledger.d.ts +0 -17
- package/dist/node_modules/@allyhub-next/project/dist/media-index.d.ts +0 -27
- package/dist/node_modules/@allyhub-next/project/dist/page.d.ts +0 -119
- package/dist/node_modules/@allyhub-next/project/dist/says.d.ts +0 -15
- package/dist/node_modules/@allyhub-next/project/dist/scenery.d.ts +0 -35
- package/dist/node_modules/@allyhub-next/project/dist/session.d.ts +0 -37
- package/dist/node_modules/@allyhub-next/project/dist/stretch.d.ts +0 -38
- package/dist/node_modules/@allyhub-next/project/dist/version.d.ts +0 -114
- package/dist/node_modules/@allyhub-next/render/dist/cap.d.ts +0 -41
- package/dist/node_modules/@allyhub-next/render/dist/capture.d.ts +0 -78
- package/dist/node_modules/@allyhub-next/render/dist/clip.d.ts +0 -27
- package/dist/node_modules/@allyhub-next/render/dist/composite.d.ts +0 -106
- package/dist/node_modules/@allyhub-next/render/dist/delivery.d.ts +0 -18
- package/dist/node_modules/@allyhub-next/render/dist/doc/fonts.d.ts +0 -3
- package/dist/node_modules/@allyhub-next/render/dist/doc/index.d.ts +0 -3
- package/dist/node_modules/@allyhub-next/render/dist/doc/print.d.ts +0 -51
- package/dist/node_modules/@allyhub-next/render/dist/encode.d.ts +0 -111
- package/dist/node_modules/@allyhub-next/render/dist/errors.d.ts +0 -15
- package/dist/node_modules/@allyhub-next/render/dist/exports.d.ts +0 -67
- package/dist/node_modules/@allyhub-next/render/dist/ffmpeg.d.ts +0 -75
- package/dist/node_modules/@allyhub-next/render/dist/footage.d.ts +0 -169
- package/dist/node_modules/@allyhub-next/render/dist/image.d.ts +0 -16
- package/dist/node_modules/@allyhub-next/render/dist/index.d.ts +0 -26
- package/dist/node_modules/@allyhub-next/render/dist/junction.d.ts +0 -70
- package/dist/node_modules/@allyhub-next/render/dist/look.d.ts +0 -21
- package/dist/node_modules/@allyhub-next/render/dist/page.d.ts +0 -178
- package/dist/node_modules/@allyhub-next/render/dist/parts.d.ts +0 -140
- package/dist/node_modules/@allyhub-next/render/dist/png.d.ts +0 -37
- package/dist/node_modules/@allyhub-next/render/dist/pool.d.ts +0 -54
- package/dist/node_modules/@allyhub-next/render/dist/post-probe.d.ts +0 -27
- package/dist/node_modules/@allyhub-next/render/dist/post.d.ts +0 -27
- package/dist/node_modules/@allyhub-next/render/dist/render.d.ts +0 -151
- package/dist/node_modules/@allyhub-next/render/dist/segments.d.ts +0 -40
- package/dist/node_modules/@allyhub-next/render/dist/sound.d.ts +0 -24
- package/dist/node_modules/@allyhub-next/render/dist/stills.d.ts +0 -41
- package/dist/node_modules/@allyhub-next/render/dist/tools.d.ts +0 -25
- package/dist/node_modules/@allyhub-next/render/dist/webp.d.ts +0 -17
- package/dist/node_modules/@allyhub-next/runtime/dist/bridge.d.ts +0 -211
- package/dist/node_modules/@allyhub-next/runtime/dist/captions.d.ts +0 -24
- package/dist/node_modules/@allyhub-next/runtime/dist/clock.d.ts +0 -32
- package/dist/node_modules/@allyhub-next/runtime/dist/compose.d.ts +0 -149
- package/dist/node_modules/@allyhub-next/runtime/dist/console.d.ts +0 -21
- package/dist/node_modules/@allyhub-next/runtime/dist/contrast.d.ts +0 -13
- package/dist/node_modules/@allyhub-next/runtime/dist/embed.d.ts +0 -50
- package/dist/node_modules/@allyhub-next/runtime/dist/env.d.ts +0 -101
- package/dist/node_modules/@allyhub-next/runtime/dist/errors.d.ts +0 -21
- package/dist/node_modules/@allyhub-next/runtime/dist/facade.d.ts +0 -42
- package/dist/node_modules/@allyhub-next/runtime/dist/fonts.d.ts +0 -110
- package/dist/node_modules/@allyhub-next/runtime/dist/footage.d.ts +0 -52
- package/dist/node_modules/@allyhub-next/runtime/dist/frame.d.ts +0 -61
- package/dist/node_modules/@allyhub-next/runtime/dist/guards.d.ts +0 -32
- package/dist/node_modules/@allyhub-next/runtime/dist/index.d.ts +0 -14
- package/dist/node_modules/@allyhub-next/runtime/dist/inspect.d.ts +0 -112
- package/dist/node_modules/@allyhub-next/runtime/dist/locate.d.ts +0 -11
- package/dist/node_modules/@allyhub-next/runtime/dist/measure.d.ts +0 -41
- package/dist/node_modules/@allyhub-next/runtime/dist/mix-plan.d.ts +0 -42
- package/dist/node_modules/@allyhub-next/runtime/dist/music.d.ts +0 -29
- package/dist/node_modules/@allyhub-next/runtime/dist/output.d.ts +0 -5
- package/dist/node_modules/@allyhub-next/runtime/dist/pictures.d.ts +0 -39
- package/dist/node_modules/@allyhub-next/runtime/dist/piece.d.ts +0 -34
- package/dist/node_modules/@allyhub-next/runtime/dist/player/clips.d.ts +0 -41
- package/dist/node_modules/@allyhub-next/runtime/dist/player/cutout.d.ts +0 -57
- package/dist/node_modules/@allyhub-next/runtime/dist/player/player.d.ts +0 -78
- package/dist/node_modules/@allyhub-next/runtime/dist/reads.d.ts +0 -132
- package/dist/node_modules/@allyhub-next/runtime/dist/sound.d.ts +0 -22
- package/dist/node_modules/@allyhub-next/runtime/dist/speech.d.ts +0 -107
- package/dist/node_modules/@allyhub-next/runtime/dist/stage-kit.d.ts +0 -12
- package/dist/node_modules/@allyhub-next/runtime/dist/stage.d.ts +0 -34
- package/dist/node_modules/@allyhub-next/runtime/dist/styles.d.ts +0 -35
- package/dist/node_modules/@allyhub-next/runtime/dist/takes.d.ts +0 -72
- package/dist/node_modules/@allyhub-next/runtime/dist/titles.d.ts +0 -10
- package/dist/node_modules/@allyhub-next/runtime/dist/transitions.d.ts +0 -26
- package/dist/node_modules/@allyhub-next/site/dist/assets.d.ts +0 -59
- package/dist/node_modules/@allyhub-next/site/dist/assets.js +0 -2
- package/dist/node_modules/@allyhub-next/site/dist/astro.d.ts +0 -22
- package/dist/node_modules/@allyhub-next/site/dist/astro.js +0 -3
- package/dist/node_modules/@allyhub-next/site/dist/lockfile.d.ts +0 -40
- package/dist/node_modules/@allyhub-next/site/dist/lockfile.js +0 -3
- package/dist/node_modules/@allyhub-next/site/dist/media.d.ts +0 -24
- package/dist/node_modules/@allyhub-next/site/dist/media.js +0 -4
- package/dist/node_modules/@allyhub-next/site/package.json +0 -25
- package/dist/node_modules/@allyhub-next/slides-core/dist/preset.d.ts +0 -5
- package/dist/node_modules/@allyhub-next/slides-core/dist/preset.js +0 -2
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/charts.d.ts +0 -6
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/fonts.d.ts +0 -45
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/import.d.ts +0 -18
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/import.js +0 -3
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/index.d.ts +0 -5
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/read.d.ts +0 -56
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/read.js +0 -4
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/shapes.d.ts +0 -72
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/text.d.ts +0 -32
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/theme.d.ts +0 -4
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/timing.d.ts +0 -32
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/write.d.ts +0 -32
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/xml.d.ts +0 -32
- package/dist/node_modules/@allyhub-next/slides-runtime/dist/draw.d.ts +0 -43
- package/dist/node_modules/@allyhub-next/slides-runtime/dist/edit.d.ts +0 -4
- package/dist/node_modules/@allyhub-next/slides-runtime/dist/edit.js +0 -2
- package/dist/node_modules/@allyhub-next/slides-runtime/dist/index.d.ts +0 -4
- package/dist/node_modules/@allyhub-next/slides-runtime/dist/ink.d.ts +0 -10
- package/dist/node_modules/@allyhub-next/slides-runtime/dist/load.d.ts +0 -6
- package/dist/node_modules/@allyhub-next/stage/dist/bakes.d.ts +0 -42
- package/dist/node_modules/@allyhub-next/stage/dist/graphics.d.ts +0 -7
- package/dist/node_modules/@allyhub-next/stage/dist/identity.d.ts +0 -2
- package/dist/node_modules/@allyhub-next/stage/dist/index.d.ts +0 -9
- package/dist/node_modules/@allyhub-next/stage/dist/page.d.ts +0 -87
- package/dist/node_modules/@allyhub-next/stage/dist/scenery-page.d.ts +0 -69
- package/dist/node_modules/@allyhub-next/stage/dist/scenery-solve.d.ts +0 -49
- package/dist/node_modules/@allyhub-next/stage/dist/scenery.d.ts +0 -8
- package/dist/node_modules/@allyhub-next/stage/dist/server.d.ts +0 -21
- package/dist/node_modules/@allyhub-next/stage-page/dist/host.d.ts +0 -22
- package/dist/node_modules/@allyhub-next/stage-page/dist/page.js +0 -79
- package/dist/site.d.ts +0 -2
- package/editor-web/assets/dist-BW2s9FMO.js +0 -4
- package/editor-web/assets/dist-C-6JmebI.js +0 -233
- package/editor-web/assets/dist-CCYMLMKN.js +0 -6
- package/editor-web/assets/dist-CHzurjMx.js +0 -33
- package/editor-web/assets/dist-DF7H1dxw.js +0 -1
- package/editor-web/assets/dist-Da5AUSKX.js +0 -2
- package/editor-web/assets/index-B7S9RZhL.css +0 -2
- package/editor-web/assets/index-CovQYWvD.js +0 -69
- package/editor-web/assets/minus-BrvjaJyO.js +0 -1
- package/editor-web/assets/react-DV5fPdiH.js +0 -101
- package/editor-web/assets/textarea-B0vCGdZI.js +0 -105
- package/editor-web/assets/trash-2-B0dvc1cZ.js +0 -1
- package/editor-web/assets/undo-2-A1EPubPO.js +0 -1
- /package/dist/node_modules/@allyhub-next/{site → ooxml}/LICENSE +0 -0
|
@@ -157,6 +157,8 @@ export declare class Worksheet {
|
|
|
157
157
|
readonly filters: Filter[];
|
|
158
158
|
/** Its charts, the last on top. */
|
|
159
159
|
readonly charts: Chart[];
|
|
160
|
+
/** Names that hold on this sheet alone, over the workbook's, in lower case. */
|
|
161
|
+
readonly names: Map<string, DefinedName>;
|
|
160
162
|
freeze: Place | undefined;
|
|
161
163
|
/** sheet.ts makes it: what is on it is not changed by hand. */
|
|
162
164
|
generated: boolean;
|
|
@@ -246,6 +248,10 @@ export interface DefinedName {
|
|
|
246
248
|
value?: Scalar;
|
|
247
249
|
formula?: SharedFormula;
|
|
248
250
|
source: Source;
|
|
251
|
+
/** The sheet it holds on alone; absent: the workbook. */
|
|
252
|
+
sheet?: Worksheet;
|
|
253
|
+
/** Excel's Name Manager does not list it. */
|
|
254
|
+
hidden?: boolean;
|
|
249
255
|
}
|
|
250
256
|
export interface Check {
|
|
251
257
|
name: string;
|
|
@@ -269,7 +275,10 @@ export declare class Workbook {
|
|
|
269
275
|
respec(file: SheetFile): void;
|
|
270
276
|
sheet(name: string): Worksheet | undefined;
|
|
271
277
|
table(name: string): Table | undefined;
|
|
272
|
-
name
|
|
278
|
+
/** A defined name as a formula on `sheet` reads it: the sheet's own first, then the workbook's. */
|
|
279
|
+
name(name: string, sheet?: Worksheet): DefinedName | undefined;
|
|
280
|
+
/** Every definition of a name: the workbook's and each sheet's own. */
|
|
281
|
+
definitions(name: string): DefinedName[];
|
|
273
282
|
get tables(): Table[];
|
|
274
283
|
addSheet(sheet: Worksheet): void;
|
|
275
284
|
addTable(table: Table): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{SHEET_CODE as C,SHEET_SEPARATOR as P}from"@allyhub-next/formats";import{MAX_ROWS as B,cellName as H,columnIndex as j,columnLetter as z,contains as y,overlaps as v,rangeName as U,readAddress as x,readArea as $,readAreas as _}from"./address.js";import{readCsv as R}from"./csv.js";import{ENTRY as E,readSheetFile as D}from"./file.js";import{withGenerated as O}from"./generated.js";import{moveFormula as G}from"./formula/move.js";import{parseFormula as X}from"./formula/parse.js";import{printFormula as Y}from"./formula/print.js";import{readTyped as A}from"./values.js";export class SharedFormula{node;error;analysis;text;row;col;source;constructor(e,t,s,n){this.text=e,this.row=t,this.col=s,this.source=n;const i=X(e);i.ok?this.node=i.node:this.error=i.error}}export class FormulaCell{value=null;array;spill;blocked;state=1;mark=0;shared;sheet;row;col;constructor(e,t,s,n){this.shared=e,this.sheet=t,this.row=s,this.col=n}get moved(){const{node:e,row:t,col:s}=this.shared;if(!e)throw new Error(`${this.shared.text} does not parse.`);return G(e,this.row-t,this.col-s)}get text(){const{node:e,text:t,row:s,col:n}=this.shared;return!e||s===this.row&&n===this.col?t:Y(this.moved)}}class Z{columns=[];firsts=[];lasts=[];formulas=[];get(e,t){return this.columns[t]?.[e]}set(e,t,s){let n=this.columns[t];n||(n=[],this.columns[t]=n,this.firsts[t]=e,this.lasts[t]=e),n[e]instanceof FormulaCell&&(this.formulas[t]=(this.formulas[t]??1)-1),s instanceof FormulaCell&&(this.formulas[t]=(this.formulas[t]??0)+1),n[e]=s,e<(this.firsts[t]??e)&&(this.firsts[t]=e),e>(this.lasts[t]??e)&&(this.lasts[t]=e)}get width(){return this.columns.length}holds(e,t,s){const n=Math.min(e.right,this.columns.length-1);for(let i=e.left;i<=n;i++){const r=this.columns[i];if(!r)continue;const l=Math.min(e.bottom,this.last(i));for(let o=Math.max(e.top,this.first(i));o<=l;o++)if(r[o]!==void 0&&!(o===t&&i===s))return!0}return!1}first(e){return this.firsts[e]??1/0}last(e){return this.lasts[e]??-1}hasFormulas(e){return(this.formulas[e]??0)>0}}export class Table{columns=[];rows=0;lines=[];places=[];records=[];name;sheet;at;file;spec;constructor(e,t,s,n,i){this.name=e,this.sheet=t,this.at=s,this.file=n,this.spec=i}get area(){return{top:this.at.row,left:this.at.col,bottom:this.at.row+this.rows,right:this.at.col+Math.max(this.columns.length,1)-1}}get data(){const e=this.area;return{...e,top:e.top+1}}column(e){const t=e.toLowerCase();return this.columns.find(s=>s.name.toLowerCase()===t)}}export const placeKey=(a,e)=>a*16384+e;function T(a,e){a.bottom=Math.max(a.bottom,e.bottom),a.right=Math.max(a.right,e.right);for(let t=e.left;t<=e.right;t++){const s=a.columns.get(t);a.columns.set(t,[Math.min(s?.[0]??e.top,e.top),Math.max(s?.[1]??e.bottom,e.bottom)])}}export class Worksheet{tables=[];blocks=[];merges=[];formulas=new Set;implied=new Map;keys=new Map;fills=[];blanks=new Set;conditions=[];validations=[];filters=[];charts=[];freeze;generated=!1;grid=new Z;expanded=!1;lowest=-1;ghosts=new Map;spills=new Set;stopped=new Set;reach;lookAreas;name;index;spec;constructor(e,t,s){this.name=e,this.index=t,this.spec=s}respec(e){const t=e.charts!==this.spec.charts;this.spec=e,this.lookAreas=void 0,t&&(this.charts.length=0,e.charts?.forEach((s,n)=>{const i=W(s,n,[],()=>{});i&&this.charts.push(i)}))}put(e,t,s){s instanceof FormulaCell&&this.formulas.add(s),this.grid.set(e,t,s),e>this.lowest&&(this.lowest=e)}replace(e,t,s){this.expand();const n=this.grid.get(e,t);n instanceof FormulaCell&&this.formulas.delete(n),s instanceof FormulaCell&&this.formulas.add(s),this.grid.set(e,t,s),e>this.lowest&&(this.lowest=e)}expand(){if(!this.expanded){this.expanded=!0;for(let e=this.fills.length-1;e>=0;e--){const t=this.fills[e];if(!t)continue;const{area:s,shared:n,value:i,format:r}=t;for(let l=s.top;l<=s.bottom;l++)for(let o=s.left;o<=s.right;o++)this.grid.get(l,o)===void 0&&(this.blanks.has(placeKey(l,o))||(n?this.put(l,o,new FormulaCell(n,this,l,o)):i!=null&&(this.put(l,o,i),r!==void 0&&this.implied.set(placeKey(l,o),r))))}}}at(e,t){return this.expand(),this.grid.get(e,t)}spillAt(e,t){return this.ghosts.size===0?void 0:this.ghosts.get(placeKey(e,t))}holds(e,t){return this.expand(),this.grid.holds(e,t.row,t.col)}spillsIn(e){if(this.spills.size===0)return[];if((e.bottom-e.top+1)*(e.right-e.left+1)>=this.spills.size)return[...this.spills].filter(n=>n.spill!==void 0&&v(n.spill,e));const s=new Set;for(let n=e.top;n<=e.bottom;n++)for(let i=e.left;i<=e.right;i++){const r=this.ghosts.get(placeKey(n,i));r&&s.add(r)}return[...s]}blockedBy(e){if(this.stopped.size===0)return[];const t=[];for(const s of this.stopped)s.blocked&&v(s.blocked,e)&&t.push(s);return t}placeSpill(e,t){e.spill=t,this.spills.add(e);for(let s=t.top;s<=t.bottom;s++)for(let n=t.left;n<=t.right;n++)(s!==e.row||n!==e.col)&&this.ghosts.set(placeKey(s,n),e);this.reach&&T(this.reach,t)}blockSpill(e,t){e.blocked=t,this.stopped.add(e)}clearSpill(e){const t=e.spill;if(t)for(let s=t.top;s<=t.bottom;s++)for(let n=t.left;n<=t.right;n++)this.ghosts.get(placeKey(s,n))===e&&this.ghosts.delete(placeKey(s,n));e.spill=void 0,e.blocked=void 0,this.spills.delete(e),this.stopped.delete(e)}clearSpills(){for(const e of[...this.spills,...this.stopped])e.spill=void 0,e.blocked=void 0;this.spills.clear(),this.stopped.clear(),this.ghosts.clear(),this.reach=void 0}tighten(){this.reach=void 0}spillReach(){if(this.reach)return this.reach;const e={columns:new Map,bottom:-1,right:-1};for(const{spill:t}of this.spills)t&&T(e,t);return this.reach=e,e}hasFormulas(e){return this.expand(),this.grid.hasFormulas(e)}span(e,t,s){this.expand();const n=this.grid.first(e),i=this.grid.last(e);if(this.spills.size===0)return[Math.max(t,n),Math.min(s,i)];const[r,l]=this.spillReach().columns.get(e)??[1/0,-1];return[Math.max(t,Math.min(n,r)),Math.min(s,Math.max(i,l))]}get columnsUsed(){return this.expand(),this.spills.size===0?this.grid.width:Math.max(this.grid.width,this.spillReach().right+1)}get lastRow(){return this.expand(),this.spills.size===0?this.lowest:Math.max(this.lowest,this.spillReach().bottom)}get used(){const e=this.lastRow,t=this.columnsUsed-1;return e<0||t<0?void 0:{top:0,left:0,bottom:e,right:t}}tableAt(e,t){return this.tables.find(s=>y(s.area,e,t))}blockAt(e,t){return this.blocks.find(s=>y(s.area,e,t))}looks(){if(this.lookAreas)return this.lookAreas;const e=[];for(const s of this.spec.format??[]){const n=$(s.range);n&&e.push({area:n,entry:s})}const t=[];for(const[s,n]of Object.entries(this.spec.cells??{})){if(!s.includes(":")||n===null||typeof n!="object")continue;const i=$(s);i&&t.push({area:i,entry:n})}return this.lookAreas={formats:e,ranges:t},this.lookAreas}styledAreas(){const{formats:e,ranges:t}=this.looks();return[...e,...t.filter(s=>Object.keys(s.entry).some(n=>F.has(n)))]}lookAt(e,t){const s={},n=c=>{if(c)for(const[b,w]of Object.entries(c))F.has(b)&&w!==void 0&&(s[b]=b==="border"?{...s.border,...w}:w)},i=this.implied.get(placeKey(e,t));i!==void 0&&(s.format=i);const r=this.ghosts.size===0?void 0:this.spillAt(e,t),l=r&&this.lookAt(r.row,r.col).format;l!==void 0&&(s.format=l),this.spec.columns&&n(this.spec.columns[z(t)]),this.spec.rows&&n(this.spec.rows[String(e+1)]);const o=this.tableAt(e,t);o&&e>o.at.row&&n(o.columns[t-o.at.col]?.spec);const{formats:f,ranges:h}=this.looks();for(const c of f)y(c.area,e,t)&&n(c.entry);for(const c of h)y(c.area,e,t)&&n(c.entry);const m=this.keys.get(placeKey(e,t)),g=m===void 0?void 0:this.spec.cells?.[m];if(g!==null&&typeof g=="object"&&n(g),s.border){const c=Object.entries(s.border).filter(([,b])=>b?.style!=="none");c.length===0?delete s.border:s.border=Object.fromEntries(c)}return s}mergeAt(e,t){return this.merges.find(s=>y(s,e,t))}validationAt(e,t){return this.validations.find(s=>s.areas.some(n=>y(n,e,t)))}filterHeadAt(e,t){return this.filters.find(s=>e===s.area.top&&t>=s.area.left&&t<=s.area.right)}filterAt(e,t){return this.filters.find(s=>y(s.area,e,t))}filesAt(e,t){const s=this.tableAt(e,t);if(s&&e>s.at.row){const n=s.columns[t-s.at.col]?.spec?.files;if(n!==void 0)return n}return s?.at.row===e?void 0:this.spec.columns?.[z(t)]?.files}}export const filesSeparator=a=>(typeof a=="object"?a.separator:void 0)??P;export function filesIn(a,e){const t=filesSeparator(e);return a.split(t.trim()===""?t:t.trim()).map(s=>s.trim()).filter(s=>s!=="")}const F=new Set(["bold","italic","underline","strike","font","size","color","fill","align","valign","wrap","shrink","indent","rotation","border","format"]);export class Workbook{title;sheets=[];names=new Map;checks=[];bySheet=new Map;byTable=new Map;file;generated;ordinary=[];constructor(e,t){this.file=e,this.title=e.title,this.generated=t}respec(e){this.file=O(e,this.generated).file,this.title=e.title,this.sheets.forEach(t=>{const s=e.sheets.find(n=>n.name===t.name);s&&t.respec(s)})}sheet(e){return this.bySheet.get(e.toLowerCase())}table(e){return this.byTable.get(e.toLowerCase())}name(e){return this.names.get(e.toLowerCase())}get tables(){return[...this.byTable.values()]}addSheet(e){this.sheets.push(e),this.bySheet.set(e.name.toLowerCase(),e)}addTable(e){e.sheet.tables.push(e),this.byTable.set(e.name.toLowerCase(),e)}sourceOf(e,t,s){if(e.generated)return{file:C};const n=this.sheets.indexOf(e),i=e.tableAt(t,s);if(i){const o=i.columns[s-i.at.col],f=t-i.at.row-1,h=o?.csv!==void 0&&(i.records[f]?.[o.csv]??"")!=="";return f>=0&&o?.formula&&!h?o.formula.source:{file:i.file,line:f<0?1:i.lines[f]??1}}const r=e.blockAt(t,s);if(r)return{file:r.file,line:r.lines[t-r.area.top]??1};const l=e.keys.get(placeKey(t,s));if(l!==void 0)return{file:E,path:["sheets",n,"cells",l]};for(const o of Object.keys(e.spec.cells??{})){if(!o.includes(":"))continue;const f=$(o);if(f&&y(f,t,s))return{file:E,path:["sheets",n,"cells",o]}}}}export const MAX_FILL_CELLS=5e6;const q=/^[\p{L}_\\][\p{L}\p{N}_.\\?]*$/u;export function validName(a){return q.test(a)&&x(a)===void 0&&!/^(?:TRUE|FALSE)$/iu.test(a)&&!/^[Rr](?:\d+)?(?:[Cc]\d*)?$/u.test(a)&&!/^[Cc]\d*$/u.test(a)}const M="made",k=a=>a[0]===M?C:E;class N{problems=[];wb;read_;lineOf;own;madeNames;constructor(e,t,s,n,i){this.wb=e,this.read_=t,this.lineOf=s,this.own=n,this.madeNames=i}yaml(e,t){const s=this.lineOf(e);this.problems.push({file:k(e),...s===void 0?{}:{line:s},message:t})}sheetPath(e){return e<this.own?["sheets",e]:[M,"sheets",e-this.own]}read(){const{file:e}=this.wb;e.sheets.forEach((t,s)=>{const n=this.sheetPath(s);if(this.wb.sheet(t.name)){this.yaml([...n,"name"],`two sheets are named ${t.name}`);return}(/[\\/?*[\]:]/u.test(t.name)||t.name.length>31)&&this.yaml([...n,"name"],`${t.name} cannot be a sheet's name: at most 31 characters, none of \\ / ? * [ ] :`);const i=new Worksheet(t.name,this.wb.sheets.length,t);i.generated=s>=this.own,this.wb.addSheet(i)}),this.names();for(const[t,s]of e.sheets.entries()){const n=this.wb.sheets[t];n?.spec===s&&this.sheet(n,this.sheetPath(t))}e.checks?.forEach((t,s)=>{const n={file:E,path:["checks",s,"formula"]};this.wb.checks.push({name:t.name,formula:new SharedFormula(t.formula,0,0,n),source:n})})}names(){for(const[e,t]of Object.entries(this.wb.file.names??{})){const s=this.madeNames.has(e)?[M,"names",e]:["names",e];if(!validName(e)){this.yaml(s,`${e} cannot be a name`);continue}const n={file:k(s),path:s},i=typeof t=="string"&&t.startsWith("=")?{name:e,formula:new SharedFormula(t,0,0,n),source:n}:{name:e,value:typeof t=="string"?A(t).value:t,source:n};this.wb.names.set(e.toLowerCase(),i)}}sheet(e,t){const{spec:s}=e;if(s.freeze!==void 0){const n=x(s.freeze);n?e.freeze=n:this.yaml([...t,"freeze"],`${s.freeze} is not a cell`)}s.tables?.forEach((n,i)=>{this.table(e,n,[...t,"tables",i])});for(const[n,i]of e.tables.entries())for(const r of e.tables.slice(n+1))v(i.area,r.area)&&this.problems.push({file:E,message:`tables ${i.name} and ${r.name} overlap on ${e.name}`});s.blocks?.forEach((n,i)=>{this.block(e,n.at,n.rows,[...t,"blocks",i])}),this.cells(e,s.cells??{},[...t,"cells"]),s.merges?.forEach((n,i)=>{const r=$(n);r?e.merges.push(r):this.yaml([...t,"merges",i],`${n} is not a range`)}),s.format?.forEach((n,i)=>{$(n.range)||this.yaml([...t,"format",i,"range"],`${n.range} is not a range`)}),s.conditional?.forEach((n,i)=>{this.condition(e,n,[...t,"conditional",i])}),s.validations?.forEach((n,i)=>{this.validation(e,n,[...t,"validations",i])}),this.filters(e,t),s.charts?.forEach((n,i)=>{this.chart(e,n,i,[...t,"charts",i])});for(const n of Object.keys(s.columns??{}))j(n)===void 0&&this.yaml([...t,"columns",n],`${n} is not a column`);for(const n of Object.keys(s.rows??{}))(!/^[1-9]\d*$/u.test(n)||Number(n)>B)&&this.yaml([...t,"rows",n],`${n} is not a row`)}chart(e,t,s,n){const i=W(t,s,n,(r,l)=>{this.yaml(r,l)});i&&e.charts.push(i)}bound(e,t,s){if(!(typeof e!="string"||!e.startsWith("=")||e.length<2))return new SharedFormula(e,t?.top??0,t?.left??0,{file:k(s),path:s})}condition(e,t,s){const n=_(t.range);if(!n){this.yaml([...s,"range"],`${t.range} is not a range`);return}const[i]=n,r=[],l=(o,f)=>{const h=this.bound(o,i,f);h&&r.push(h)};if(t.type==="expression"){const o=t.formula.startsWith("=")?t.formula:`=${t.formula}`;l(o,[...s,"formula"])}if(t.type==="cellIs"&&t.formula.forEach((o,f)=>{l(o,[...s,"formula",f])}),t.type==="dataBar")for(const o of["min","max"])l(t[o]?.value,[...s,o,"value"]);(t.type==="colorScale"||t.type==="iconSet")&&t.stops?.forEach((o,f)=>{l(o.value,[...s,"stops",f,"value"])}),e.conditions.push({spec:t,areas:n,formulas:r})}validation(e,t,s){const n=_(t.range);if(!n){this.yaml([...s,"range"],`${t.range} is not a range`);return}const i=(t.formula??[]).map((o,f)=>this.bound(o,n[0],[...s,"formula",f])),r=t.formula?.length??0,l=t.type!=="list"&&t.type!=="custom"&&(t.operator===void 0||t.operator==="between"||t.operator==="notBetween");!(t.type==="list"&&t.values!==void 0)&&r<(l?2:1)&&this.yaml(s,`a ${t.type} validation needs its bounds`),e.validations.push({spec:t,areas:n,formulas:i})}filters(e,t){const{spec:s}=e;if(s.filter){const n=[...t,"filter"],i=$(s.filter.range);if(!i)this.yaml([...n,"range"],`${s.filter.range} is not a range`);else{const r=new Map;for(const[o,f]of Object.entries(s.filter.columns??{})){const h=j(o);h===void 0||h<i.left||h>i.right?this.yaml([...n,"columns",o],`${o} is not a column of ${s.filter.range}`):r.set(h,f)}const l=e.tables.find(o=>v(o.area,i));l&&this.yaml(n,`a filter over table ${l.name}: a table has its own`),e.filters.push({area:i,columns:r})}}e.tables.forEach((n,i)=>{const{filter:r}=n.spec;if(r===!1)return;const l=new Map;for(const[o,f]of Object.entries(r?.columns??{})){const h=n.column(o);h?l.set(n.at.col+h.index,f):this.yaml([...t,"tables",i,"filter","columns",o],`table ${n.name} has no column ${o}`)}e.filters.push({area:n.area,table:n,columns:l})})}csv(e,t,s){const n=this.read_(e);return n||this.yaml(t,`${s}: ${e} is not there`),n}overlapping(e,t){const s=e.tables.find(i=>v(i.area,t));if(s)return`table ${s.name}`;const n=e.blocks.find(i=>v(i.area,t));return n?`the block of ${n.file}`:void 0}typed(e,t,s,n,i){if(n.formula!==void 0){const r=new SharedFormula(n.formula,t,s,i);e.put(t,s,new FormulaCell(r,e,t,s));return}n.value!==null&&(e.put(t,s,n.value),n.format!==void 0&&e.implied.set(placeKey(t,s),n.format))}table(e,t,s){const n=x(t.at);if(!n){this.yaml([...s,"at"],`${t.at} is not a cell`);return}if(!validName(t.name)){this.yaml([...s,"name"],`${t.name} cannot be a table's name`);return}if(this.wb.table(t.name)){this.yaml([...s,"name"],`two tables are named ${t.name}`);return}this.wb.name(t.name)&&this.yaml([...s,"name"],`${t.name} is a defined name and a table's`);const i=new Table(t.name,e,n,t.rows,t),r=this.csv(t.rows,[...s,"rows"],`table ${t.name}`),l=r?.rows??[],o=r?.lines??[],f=l[0],h=o[0]??1,m=new Set,g=f?.length===0?[""]:f??[];g.forEach((u,d)=>{const p=u.trim();p===""&&this.problems.push({file:t.rows,line:h,message:`column ${String(d+1)} has no name`}),m.has(p.toLowerCase())&&this.problems.push({file:t.rows,line:h,message:`two columns are named ${p}`}),m.add(p.toLowerCase()),i.columns.push({name:p,index:i.columns.length,csv:d})});for(const[u,d]of Object.entries(t.columns??{})){const p=i.column(u),S=p??{name:u,index:i.columns.length};p||(d.formula===void 0&&this.yaml([...s,"columns",u],`table ${t.name} has no column ${u}`),i.columns.push(S)),S.spec=d}const c=g.length;for(let u=1;u<l.length;u++){const d=l[u];if(!d||d.length===0)continue;const p=o[u]??u+1;i.places.push(u),i.records.push(d),i.lines.push(p),d.length>c&&this.problems.push({file:t.rows,line:p,message:`this row has ${String(d.length)} fields and the header ${String(c)}`})}i.rows=i.records.length;const b=this.overlapping(e,i.area);b&&this.yaml(s,`table ${t.name} overlaps ${b} on ${e.name}`),this.wb.addTable(i),this.tableKey(i,s);const w=n.row+1;i.columns.forEach(u=>{const d=n.col+u.index;e.put(n.row,d,u.name);const p=u.spec?.formula;p!==void 0&&(u.formula=new SharedFormula(p,w,d,{file:k(s),path:[...s,"columns",u.name,"formula"]}),i.rows>0&&e.fills.push({area:{top:w,left:d,bottom:w+i.rows-1,right:d},shared:u.formula})),u.csv!==void 0&&i.records.forEach((S,L)=>{this.typed(e,w+L,d,A(S[u.csv??0]??""),{file:t.rows,line:i.lines[L]??1})})})}tableKey(e,t){const{key:s}=e.spec;if(s===void 0)return;const n=e.column(s);if(n?.csv===void 0){this.yaml([...t,"key"],`table ${e.name} has no column ${s} in ${e.file}`);return}const i=new Set;e.records.forEach((r,l)=>{const o=r[n.csv??0]??"",f=e.lines[l]??1;o===""?this.problems.push({file:e.file,line:f,message:`this row has no ${s}, table ${e.name}'s key`}):i.has(o)&&this.problems.push({file:e.file,line:f,message:`two rows have the key ${o}`}),i.add(o)})}block(e,t,s,n){const i=x(t);if(!i){this.yaml([...n,"at"],`${t} is not a cell`);return}const r=this.csv(s,[...n,"rows"],"a block");if(!r)return;const l=r.rows,o=l.map((g,c)=>r.lines[c]??c+1),f=l.reduce((g,c)=>Math.max(g,c.length),1),h={top:i.row,left:i.col,bottom:i.row+Math.max(l.length,1)-1,right:i.col+f-1},m=this.overlapping(e,h);m&&this.yaml(n,`the block of ${s} overlaps ${m} on ${e.name}`),e.blocks.push({area:h,file:s,lines:o}),l.forEach((g,c)=>{g.forEach((b,w)=>{this.typed(e,i.row+c,i.col+w,A(b),{file:s,line:o[c]??c+1})})})}cells(e,t,s){const n=[];for(const[i,r]of Object.entries(t)){const l=[...s,i],o=$(i);if(!o){this.yaml(l,`${i} is not a cell or a range`);continue}const f=this.overlapping(e,o);if(f&&this.yaml(l,`${i} overlaps ${f}`),i.includes(":")){const h=(o.bottom-o.top+1)*(o.right-o.left+1);h>MAX_FILL_CELLS?this.yaml(l,`${i} is ${String(h)} cells`):this.fill(e,o,r,l)}else n.push([i,r,{row:o.top,col:o.left}])}for(const[i,r,l]of n){const o=[...s,i],f=K(r),h=placeKey(l.row,l.col);e.keys.set(h,i),f.value===null&&f.formula===void 0&&e.blanks.add(h),this.typed(e,l.row,l.col,f,{file:k(o),path:o});const m=r!==null&&typeof r=="object"?r.name:void 0;m!==void 0&&this.cellName(e,l,m,o)}}cellName(e,t,s,n){if(!validName(s)){this.yaml(n,`${s} cannot be a name`);return}if(this.wb.name(s)){this.yaml(n,`two places are named ${s}`);return}const i={file:k(n),path:n},r=H(t).replace(/^([A-Z]+)(\d+)$/u,"$$$1$$$2"),l=`='${e.name.replaceAll("'","''")}'!${r}`;this.wb.names.set(s.toLowerCase(),{name:s,formula:new SharedFormula(l,0,0,i),source:i})}fill(e,t,s,n){const i=K(s),r={file:k(n),path:n};e.fills.push(i.formula===void 0?{area:t,value:i.value,...i.format===void 0?{}:{format:i.format}}:{area:t,shared:new SharedFormula(i.formula,t.top,t.left,r)})}}function W(a,e,t,s){const n=x(a.at);if(!n){s([...t,"at"],`${a.at} is not a cell`);return}const i=(o,f)=>{const h=new SharedFormula(chartFormula(o),0,0,{file:k(f),path:f});return h.node&&!I(h.node)&&s(f,`${o} is not a range or a table's column`),h},r=(o,f)=>o?.startsWith("=")===!0?i(o,f):void 0,l=r(a.title,[...t,"title"]);return{spec:a,at:n,index:e,...a.categories===void 0?{}:{categories:i(a.categories,[...t,"categories"])},...l?{title:l}:{},series:a.series.map((o,f)=>{const h=[...t,"series",f],m=r(o.name,[...h,"name"]);return{values:i(o.values,[...h,"values"]),...o.x===void 0?{}:{x:i(o.x,[...h,"x"])},...m?{name:m}:{}}})}}export const chartFormula=a=>a.startsWith("=")?a:`=${a}`;function I(a){switch(a.kind){case"error":case"ref":case"structured":case"name":return!0;case"paren":case"postfix":return I(a.arg);case"binary":return a.op===":"||a.op===",";default:return!1}}function K(a){if(a===null)return{value:null};if(typeof a=="string")return A(a);if(typeof a!="object")return{value:a};if(a.formula!==void 0)return{value:null,formula:a.formula.startsWith("=")?a.formula:`=${a.formula}`};const{value:e}=a;return typeof e=="string"?A(e):{value:e??null}}export function readWorkbook(a){const e=D(a.text),t=l=>l[0]===M?void 0:e.lineOf(l);if(!e.file)return{problems:e.problems,lineOf:t};const s=O(e.file,a.generated),n=new Workbook(s.file,a.generated);n.ordinary=s.ordinary;const i=[],r=new N(n,l=>{const o=a.generated?.csv[l]??a.read(l);if(o===void 0)return;const f=R(o);for(const h of f.problems)i.push({file:l,line:h.line,message:h.message});return{rows:f.records.map(h=>h.end===h.start?[]:h.fields),lines:f.records.map(h=>h.line)}},t,s.own,s.names);return r.read(),{workbook:n,problems:[...i,...r.problems],lineOf:t}}export function workbookOf(a){const e=O(a.file,a.generated),t=new Workbook(e.file,a.generated);return t.ordinary=e.ordinary,new N(t,s=>{const n=a.generated?.csv[s];if(n!==void 0)return{rows:R(n).records.map(r=>r.end===r.start?[]:r.fields),lines:[]};const i=a.rows(s);return i&&{rows:i,lines:[]}},()=>{},e.own,e.names).read(),t}export{U as rangeName};
|
|
2
|
+
import{SHEET_CODE as C,SHEET_SEPARATOR as P}from"@allyhub-next/formats";import{MAX_ROWS as B,cellName as H,columnIndex as z,columnLetter as j,contains as y,overlaps as v,rangeName as U,readAddress as x,readArea as $,readAreas as _}from"./address.js";import{readCsv as R}from"./csv.js";import{ENTRY as E,readSheetFile as D}from"./file.js";import{withGenerated as O}from"./generated.js";import{moveFormula as G}from"./formula/move.js";import{parseFormula as X}from"./formula/parse.js";import{printFormula as Y}from"./formula/print.js";import{readTyped as S}from"./values.js";export class SharedFormula{node;error;analysis;text;row;col;source;constructor(e,t,s,n){this.text=e,this.row=t,this.col=s,this.source=n;const i=X(e);i.ok?this.node=i.node:this.error=i.error}}export class FormulaCell{value=null;array;spill;blocked;state=1;mark=0;shared;sheet;row;col;constructor(e,t,s,n){this.shared=e,this.sheet=t,this.row=s,this.col=n}get moved(){const{node:e,row:t,col:s}=this.shared;if(!e)throw new Error(`${this.shared.text} does not parse.`);return G(e,this.row-t,this.col-s)}get text(){const{node:e,text:t,row:s,col:n}=this.shared;return!e||s===this.row&&n===this.col?t:Y(this.moved)}}class Z{columns=[];firsts=[];lasts=[];formulas=[];get(e,t){return this.columns[t]?.[e]}set(e,t,s){let n=this.columns[t];n||(n=[],this.columns[t]=n,this.firsts[t]=e,this.lasts[t]=e),n[e]instanceof FormulaCell&&(this.formulas[t]=(this.formulas[t]??1)-1),s instanceof FormulaCell&&(this.formulas[t]=(this.formulas[t]??0)+1),n[e]=s,e<(this.firsts[t]??e)&&(this.firsts[t]=e),e>(this.lasts[t]??e)&&(this.lasts[t]=e)}get width(){return this.columns.length}holds(e,t,s){const n=Math.min(e.right,this.columns.length-1);for(let i=e.left;i<=n;i++){const a=this.columns[i];if(!a)continue;const r=Math.min(e.bottom,this.last(i));for(let o=Math.max(e.top,this.first(i));o<=r;o++)if(a[o]!==void 0&&!(o===t&&i===s))return!0}return!1}first(e){return this.firsts[e]??1/0}last(e){return this.lasts[e]??-1}hasFormulas(e){return(this.formulas[e]??0)>0}}export class Table{columns=[];rows=0;lines=[];places=[];records=[];name;sheet;at;file;spec;constructor(e,t,s,n,i){this.name=e,this.sheet=t,this.at=s,this.file=n,this.spec=i}get area(){return{top:this.at.row,left:this.at.col,bottom:this.at.row+this.rows,right:this.at.col+Math.max(this.columns.length,1)-1}}get data(){const e=this.area;return{...e,top:e.top+1}}column(e){const t=e.toLowerCase();return this.columns.find(s=>s.name.toLowerCase()===t)}}export const placeKey=(l,e)=>l*16384+e;function T(l,e){l.bottom=Math.max(l.bottom,e.bottom),l.right=Math.max(l.right,e.right);for(let t=e.left;t<=e.right;t++){const s=l.columns.get(t);l.columns.set(t,[Math.min(s?.[0]??e.top,e.top),Math.max(s?.[1]??e.bottom,e.bottom)])}}export class Worksheet{tables=[];blocks=[];merges=[];formulas=new Set;implied=new Map;keys=new Map;fills=[];blanks=new Set;conditions=[];validations=[];filters=[];charts=[];names=new Map;freeze;generated=!1;grid=new Z;expanded=!1;lowest=-1;ghosts=new Map;spills=new Set;stopped=new Set;reach;lookAreas;name;index;spec;constructor(e,t,s){this.name=e,this.index=t,this.spec=s}respec(e){const t=e.charts!==this.spec.charts;this.spec=e,this.lookAreas=void 0,t&&(this.charts.length=0,e.charts?.forEach((s,n)=>{const i=W(s,n,[],()=>{});i&&this.charts.push(i)}))}put(e,t,s){s instanceof FormulaCell&&this.formulas.add(s),this.grid.set(e,t,s),e>this.lowest&&(this.lowest=e)}replace(e,t,s){this.expand();const n=this.grid.get(e,t);n instanceof FormulaCell&&this.formulas.delete(n),s instanceof FormulaCell&&this.formulas.add(s),this.grid.set(e,t,s),e>this.lowest&&(this.lowest=e)}expand(){if(!this.expanded){this.expanded=!0;for(let e=this.fills.length-1;e>=0;e--){const t=this.fills[e];if(!t)continue;const{area:s,shared:n,value:i,format:a}=t;for(let r=s.top;r<=s.bottom;r++)for(let o=s.left;o<=s.right;o++)this.grid.get(r,o)===void 0&&(this.blanks.has(placeKey(r,o))||(n?this.put(r,o,new FormulaCell(n,this,r,o)):i!=null&&(this.put(r,o,i),a!==void 0&&this.implied.set(placeKey(r,o),a))))}}}at(e,t){return this.expand(),this.grid.get(e,t)}spillAt(e,t){return this.ghosts.size===0?void 0:this.ghosts.get(placeKey(e,t))}holds(e,t){return this.expand(),this.grid.holds(e,t.row,t.col)}spillsIn(e){if(this.spills.size===0)return[];if((e.bottom-e.top+1)*(e.right-e.left+1)>=this.spills.size)return[...this.spills].filter(n=>n.spill!==void 0&&v(n.spill,e));const s=new Set;for(let n=e.top;n<=e.bottom;n++)for(let i=e.left;i<=e.right;i++){const a=this.ghosts.get(placeKey(n,i));a&&s.add(a)}return[...s]}blockedBy(e){if(this.stopped.size===0)return[];const t=[];for(const s of this.stopped)s.blocked&&v(s.blocked,e)&&t.push(s);return t}placeSpill(e,t){e.spill=t,this.spills.add(e);for(let s=t.top;s<=t.bottom;s++)for(let n=t.left;n<=t.right;n++)(s!==e.row||n!==e.col)&&this.ghosts.set(placeKey(s,n),e);this.reach&&T(this.reach,t)}blockSpill(e,t){e.blocked=t,this.stopped.add(e)}clearSpill(e){const t=e.spill;if(t)for(let s=t.top;s<=t.bottom;s++)for(let n=t.left;n<=t.right;n++)this.ghosts.get(placeKey(s,n))===e&&this.ghosts.delete(placeKey(s,n));e.spill=void 0,e.blocked=void 0,this.spills.delete(e),this.stopped.delete(e)}clearSpills(){for(const e of[...this.spills,...this.stopped])e.spill=void 0,e.blocked=void 0;this.spills.clear(),this.stopped.clear(),this.ghosts.clear(),this.reach=void 0}tighten(){this.reach=void 0}spillReach(){if(this.reach)return this.reach;const e={columns:new Map,bottom:-1,right:-1};for(const{spill:t}of this.spills)t&&T(e,t);return this.reach=e,e}hasFormulas(e){return this.expand(),this.grid.hasFormulas(e)}span(e,t,s){this.expand();const n=this.grid.first(e),i=this.grid.last(e);if(this.spills.size===0)return[Math.max(t,n),Math.min(s,i)];const[a,r]=this.spillReach().columns.get(e)??[1/0,-1];return[Math.max(t,Math.min(n,a)),Math.min(s,Math.max(i,r))]}get columnsUsed(){return this.expand(),this.spills.size===0?this.grid.width:Math.max(this.grid.width,this.spillReach().right+1)}get lastRow(){return this.expand(),this.spills.size===0?this.lowest:Math.max(this.lowest,this.spillReach().bottom)}get used(){const e=this.lastRow,t=this.columnsUsed-1;return e<0||t<0?void 0:{top:0,left:0,bottom:e,right:t}}tableAt(e,t){return this.tables.find(s=>y(s.area,e,t))}blockAt(e,t){return this.blocks.find(s=>y(s.area,e,t))}looks(){if(this.lookAreas)return this.lookAreas;const e=[];for(const s of this.spec.format??[]){const n=$(s.range);n&&e.push({area:n,entry:s})}const t=[];for(const[s,n]of Object.entries(this.spec.cells??{})){if(!s.includes(":")||n===null||typeof n!="object")continue;const i=$(s);i&&t.push({area:i,entry:n})}return this.lookAreas={formats:e,ranges:t},this.lookAreas}styledAreas(){const{formats:e,ranges:t}=this.looks();return[...e,...t.filter(s=>Object.keys(s.entry).some(n=>F.has(n)))]}lookAt(e,t){const s={},n=c=>{if(c)for(const[b,w]of Object.entries(c))F.has(b)&&w!==void 0&&(s[b]=b==="border"?{...s.border,...w}:w)},i=this.implied.get(placeKey(e,t));i!==void 0&&(s.format=i);const a=this.ghosts.size===0?void 0:this.spillAt(e,t),r=a&&this.lookAt(a.row,a.col).format;r!==void 0&&(s.format=r),this.spec.columns&&n(this.spec.columns[j(t)]),this.spec.rows&&n(this.spec.rows[String(e+1)]);const o=this.tableAt(e,t);o&&e>o.at.row&&n(o.columns[t-o.at.col]?.spec);const{formats:f,ranges:h}=this.looks();for(const c of f)y(c.area,e,t)&&n(c.entry);for(const c of h)y(c.area,e,t)&&n(c.entry);const d=this.keys.get(placeKey(e,t)),g=d===void 0?void 0:this.spec.cells?.[d];if(g!==null&&typeof g=="object"&&n(g),s.border){const c=Object.entries(s.border).filter(([,b])=>b?.style!=="none");c.length===0?delete s.border:s.border=Object.fromEntries(c)}return s}mergeAt(e,t){return this.merges.find(s=>y(s,e,t))}validationAt(e,t){return this.validations.find(s=>s.areas.some(n=>y(n,e,t)))}filterHeadAt(e,t){return this.filters.find(s=>e===s.area.top&&t>=s.area.left&&t<=s.area.right)}filterAt(e,t){return this.filters.find(s=>y(s.area,e,t))}filesAt(e,t){const s=this.tableAt(e,t);if(s&&e>s.at.row){const n=s.columns[t-s.at.col]?.spec?.files;if(n!==void 0)return n}return s?.at.row===e?void 0:this.spec.columns?.[j(t)]?.files}}export const filesSeparator=l=>(typeof l=="object"?l.separator:void 0)??P;export function filesIn(l,e){const t=filesSeparator(e);return l.split(t.trim()===""?t:t.trim()).map(s=>s.trim()).filter(s=>s!=="")}const F=new Set(["bold","italic","underline","strike","font","size","color","fill","align","valign","wrap","shrink","indent","rotation","border","format"]);export class Workbook{title;sheets=[];names=new Map;checks=[];bySheet=new Map;byTable=new Map;file;generated;ordinary=[];constructor(e,t){this.file=e,this.title=e.title,this.generated=t}respec(e){this.file=O(e,this.generated).file,this.title=e.title,this.sheets.forEach(t=>{const s=e.sheets.find(n=>n.name===t.name);s&&t.respec(s)})}sheet(e){return this.bySheet.get(e.toLowerCase())}table(e){return this.byTable.get(e.toLowerCase())}name(e,t){const s=e.toLowerCase();return(t?.names.size?t.names.get(s):void 0)??this.names.get(s)}definitions(e){const t=e.toLowerCase(),s=[],n=this.names.get(t);n&&s.push(n);for(const i of this.sheets){const a=i.names.get(t);a&&s.push(a)}return s}get tables(){return[...this.byTable.values()]}addSheet(e){this.sheets.push(e),this.bySheet.set(e.name.toLowerCase(),e)}addTable(e){e.sheet.tables.push(e),this.byTable.set(e.name.toLowerCase(),e)}sourceOf(e,t,s){if(e.generated)return{file:C};const n=this.sheets.indexOf(e),i=e.tableAt(t,s);if(i){const o=i.columns[s-i.at.col],f=t-i.at.row-1,h=o?.csv!==void 0&&(i.records[f]?.[o.csv]??"")!=="";return f>=0&&o?.formula&&!h?o.formula.source:{file:i.file,line:f<0?1:i.lines[f]??1}}const a=e.blockAt(t,s);if(a)return{file:a.file,line:a.lines[t-a.area.top]??1};const r=e.keys.get(placeKey(t,s));if(r!==void 0)return{file:E,path:["sheets",n,"cells",r]};for(const o of Object.keys(e.spec.cells??{})){if(!o.includes(":"))continue;const f=$(o);if(f&&y(f,t,s))return{file:E,path:["sheets",n,"cells",o]}}}}export const MAX_FILL_CELLS=5e6;const q=/^[\p{L}_\\][\p{L}\p{N}_.\\?]*$/u;export function validName(l){return q.test(l)&&x(l)===void 0&&!/^(?:TRUE|FALSE)$/iu.test(l)&&!/^[Rr](?:\d+)?(?:[Cc]\d*)?$/u.test(l)&&!/^[Cc]\d*$/u.test(l)}const M="made",k=l=>l[0]===M?C:E;class N{problems=[];wb;read_;lineOf;own;madeNames;constructor(e,t,s,n,i){this.wb=e,this.read_=t,this.lineOf=s,this.own=n,this.madeNames=i}yaml(e,t){const s=this.lineOf(e);this.problems.push({file:k(e),...s===void 0?{}:{line:s},message:t})}sheetPath(e){return e<this.own?["sheets",e]:[M,"sheets",e-this.own]}read(){const{file:e}=this.wb;e.sheets.forEach((t,s)=>{const n=this.sheetPath(s);if(this.wb.sheet(t.name)){this.yaml([...n,"name"],`two sheets are named ${t.name}`);return}(/[\\/?*[\]:]/u.test(t.name)||t.name.length>31)&&this.yaml([...n,"name"],`${t.name} cannot be a sheet's name: at most 31 characters, none of \\ / ? * [ ] :`);const i=new Worksheet(t.name,this.wb.sheets.length,t);i.generated=s>=this.own,this.wb.addSheet(i)}),this.names();for(const[t,s]of e.sheets.entries()){const n=this.wb.sheets[t];n?.spec===s&&this.sheet(n,this.sheetPath(t))}e.checks?.forEach((t,s)=>{const n={file:E,path:["checks",s,"formula"]};this.wb.checks.push({name:t.name,formula:new SharedFormula(t.formula,0,0,n),source:n})})}names(){const{file:e}=this.wb;this.namesOf(e.names,e.hidden_names,t=>this.madeNames.has(t)?[M,"names",t]:["names",t],this.wb.names,void 0),e.sheets.forEach((t,s)=>{const n=this.wb.sheets[s];n?.spec===t&&this.namesOf(t.names,t.hidden_names,i=>[...this.sheetPath(s),"names",i],n.names,n)})}namesOf(e,t,s,n,i){const a=new Set(t?.map(r=>r.toLowerCase()));for(const[r,o]of Object.entries(e??{})){const f=s(r);if(!validName(r)){this.yaml(f,`${r} cannot be a name`);continue}const h={file:k(f),path:f},d=typeof o=="string"&&o.startsWith("=")?{name:r,formula:new SharedFormula(o,0,0,h),source:h}:{name:r,value:typeof o=="string"?S(o).value:o,source:h};i&&(d.sheet=i),a.has(r.toLowerCase())&&(d.hidden=!0),n.set(r.toLowerCase(),d)}}sheet(e,t){const{spec:s}=e;if(s.freeze!==void 0){const n=x(s.freeze);n?e.freeze=n:this.yaml([...t,"freeze"],`${s.freeze} is not a cell`)}s.tables?.forEach((n,i)=>{this.table(e,n,[...t,"tables",i])});for(const[n,i]of e.tables.entries())for(const a of e.tables.slice(n+1))v(i.area,a.area)&&this.problems.push({file:E,message:`tables ${i.name} and ${a.name} overlap on ${e.name}`});s.blocks?.forEach((n,i)=>{this.block(e,n.at,n.rows,[...t,"blocks",i])}),this.cells(e,s.cells??{},[...t,"cells"]),s.merges?.forEach((n,i)=>{const a=$(n);a?e.merges.push(a):this.yaml([...t,"merges",i],`${n} is not a range`)}),s.format?.forEach((n,i)=>{$(n.range)||this.yaml([...t,"format",i,"range"],`${n.range} is not a range`)}),s.conditional?.forEach((n,i)=>{this.condition(e,n,[...t,"conditional",i])}),s.validations?.forEach((n,i)=>{this.validation(e,n,[...t,"validations",i])}),this.filters(e,t),s.charts?.forEach((n,i)=>{this.chart(e,n,i,[...t,"charts",i])});for(const n of Object.keys(s.columns??{}))z(n)===void 0&&this.yaml([...t,"columns",n],`${n} is not a column`);for(const n of Object.keys(s.rows??{}))(!/^[1-9]\d*$/u.test(n)||Number(n)>B)&&this.yaml([...t,"rows",n],`${n} is not a row`)}chart(e,t,s,n){const i=W(t,s,n,(a,r)=>{this.yaml(a,r)});i&&e.charts.push(i)}bound(e,t,s){if(!(typeof e!="string"||!e.startsWith("=")||e.length<2))return new SharedFormula(e,t?.top??0,t?.left??0,{file:k(s),path:s})}condition(e,t,s){const n=_(t.range);if(!n){this.yaml([...s,"range"],`${t.range} is not a range`);return}const[i]=n,a=[],r=(o,f)=>{const h=this.bound(o,i,f);h&&a.push(h)};if(t.type==="expression"){const o=t.formula.startsWith("=")?t.formula:`=${t.formula}`;r(o,[...s,"formula"])}if(t.type==="cellIs"&&t.formula.forEach((o,f)=>{r(o,[...s,"formula",f])}),t.type==="dataBar")for(const o of["min","max"])r(t[o]?.value,[...s,o,"value"]);(t.type==="colorScale"||t.type==="iconSet")&&t.stops?.forEach((o,f)=>{r(o.value,[...s,"stops",f,"value"])}),e.conditions.push({spec:t,areas:n,formulas:a})}validation(e,t,s){const n=_(t.range);if(!n){this.yaml([...s,"range"],`${t.range} is not a range`);return}const i=(t.formula??[]).map((o,f)=>this.bound(o,n[0],[...s,"formula",f])),a=t.formula?.length??0,r=t.type!=="list"&&t.type!=="custom"&&(t.operator===void 0||t.operator==="between"||t.operator==="notBetween");!(t.type==="list"&&t.values!==void 0)&&a<(r?2:1)&&this.yaml(s,`a ${t.type} validation needs its bounds`),e.validations.push({spec:t,areas:n,formulas:i})}filters(e,t){const{spec:s}=e;if(s.filter){const n=[...t,"filter"],i=$(s.filter.range);if(!i)this.yaml([...n,"range"],`${s.filter.range} is not a range`);else{const a=new Map;for(const[o,f]of Object.entries(s.filter.columns??{})){const h=z(o);h===void 0||h<i.left||h>i.right?this.yaml([...n,"columns",o],`${o} is not a column of ${s.filter.range}`):a.set(h,f)}const r=e.tables.find(o=>v(o.area,i));r&&this.yaml(n,`a filter over table ${r.name}: a table has its own`),e.filters.push({area:i,columns:a})}}e.tables.forEach((n,i)=>{const{filter:a}=n.spec;if(a===!1)return;const r=new Map;for(const[o,f]of Object.entries(a?.columns??{})){const h=n.column(o);h?r.set(n.at.col+h.index,f):this.yaml([...t,"tables",i,"filter","columns",o],`table ${n.name} has no column ${o}`)}e.filters.push({area:n.area,table:n,columns:r})})}csv(e,t,s){const n=this.read_(e);return n||this.yaml(t,`${s}: ${e} is not there`),n}overlapping(e,t){const s=e.tables.find(i=>v(i.area,t));if(s)return`table ${s.name}`;const n=e.blocks.find(i=>v(i.area,t));return n?`the block of ${n.file}`:void 0}typed(e,t,s,n,i){if(n.formula!==void 0){const a=new SharedFormula(n.formula,t,s,i);e.put(t,s,new FormulaCell(a,e,t,s));return}n.value!==null&&(e.put(t,s,n.value),n.format!==void 0&&e.implied.set(placeKey(t,s),n.format))}table(e,t,s){const n=x(t.at);if(!n){this.yaml([...s,"at"],`${t.at} is not a cell`);return}if(!validName(t.name)){this.yaml([...s,"name"],`${t.name} cannot be a table's name`);return}if(this.wb.table(t.name)){this.yaml([...s,"name"],`two tables are named ${t.name}`);return}this.wb.name(t.name)&&this.yaml([...s,"name"],`${t.name} is a defined name and a table's`);const i=new Table(t.name,e,n,t.rows,t),a=this.csv(t.rows,[...s,"rows"],`table ${t.name}`),r=a?.rows??[],o=a?.lines??[],f=r[0],h=o[0]??1,d=new Set,g=f?.length===0?[""]:f??[];g.forEach((u,m)=>{const p=u.trim();p===""&&this.problems.push({file:t.rows,line:h,message:`column ${String(m+1)} has no name`}),d.has(p.toLowerCase())&&this.problems.push({file:t.rows,line:h,message:`two columns are named ${p}`}),d.add(p.toLowerCase()),i.columns.push({name:p,index:i.columns.length,csv:m})});for(const[u,m]of Object.entries(t.columns??{})){const p=i.column(u),A=p??{name:u,index:i.columns.length};p||(m.formula===void 0&&this.yaml([...s,"columns",u],`table ${t.name} has no column ${u}`),i.columns.push(A)),A.spec=m}const c=g.length;for(let u=1;u<r.length;u++){const m=r[u];if(!m||m.length===0)continue;const p=o[u]??u+1;i.places.push(u),i.records.push(m),i.lines.push(p),m.length>c&&this.problems.push({file:t.rows,line:p,message:`this row has ${String(m.length)} fields and the header ${String(c)}`})}i.rows=i.records.length;const b=this.overlapping(e,i.area);b&&this.yaml(s,`table ${t.name} overlaps ${b} on ${e.name}`),this.wb.addTable(i),this.tableKey(i,s);const w=n.row+1;i.columns.forEach(u=>{const m=n.col+u.index;e.put(n.row,m,u.name);const p=u.spec?.formula;p!==void 0&&(u.formula=new SharedFormula(p,w,m,{file:k(s),path:[...s,"columns",u.name,"formula"]}),i.rows>0&&e.fills.push({area:{top:w,left:m,bottom:w+i.rows-1,right:m},shared:u.formula})),u.csv!==void 0&&i.records.forEach((A,L)=>{this.typed(e,w+L,m,S(A[u.csv??0]??""),{file:t.rows,line:i.lines[L]??1})})})}tableKey(e,t){const{key:s}=e.spec;if(s===void 0)return;const n=e.column(s);if(n?.csv===void 0){this.yaml([...t,"key"],`table ${e.name} has no column ${s} in ${e.file}`);return}const i=new Set;e.records.forEach((a,r)=>{const o=a[n.csv??0]??"",f=e.lines[r]??1;o===""?this.problems.push({file:e.file,line:f,message:`this row has no ${s}, table ${e.name}'s key`}):i.has(o)&&this.problems.push({file:e.file,line:f,message:`two rows have the key ${o}`}),i.add(o)})}block(e,t,s,n){const i=x(t);if(!i){this.yaml([...n,"at"],`${t} is not a cell`);return}const a=this.csv(s,[...n,"rows"],"a block");if(!a)return;const r=a.rows,o=r.map((g,c)=>a.lines[c]??c+1),f=r.reduce((g,c)=>Math.max(g,c.length),1),h={top:i.row,left:i.col,bottom:i.row+Math.max(r.length,1)-1,right:i.col+f-1},d=this.overlapping(e,h);d&&this.yaml(n,`the block of ${s} overlaps ${d} on ${e.name}`),e.blocks.push({area:h,file:s,lines:o}),r.forEach((g,c)=>{g.forEach((b,w)=>{this.typed(e,i.row+c,i.col+w,S(b),{file:s,line:o[c]??c+1})})})}cells(e,t,s){const n=[];for(const[i,a]of Object.entries(t)){const r=[...s,i],o=$(i);if(!o){this.yaml(r,`${i} is not a cell or a range`);continue}const f=this.overlapping(e,o);if(f&&this.yaml(r,`${i} overlaps ${f}`),i.includes(":")){const h=(o.bottom-o.top+1)*(o.right-o.left+1);h>MAX_FILL_CELLS?this.yaml(r,`${i} is ${String(h)} cells`):this.fill(e,o,a,r)}else n.push([i,a,{row:o.top,col:o.left}])}for(const[i,a,r]of n){const o=[...s,i],f=K(a),h=placeKey(r.row,r.col);e.keys.set(h,i),f.value===null&&f.formula===void 0&&e.blanks.add(h),this.typed(e,r.row,r.col,f,{file:k(o),path:o});const d=a!==null&&typeof a=="object"?a.name:void 0;d!==void 0&&this.cellName(e,r,d,o)}}cellName(e,t,s,n){if(!validName(s)){this.yaml(n,`${s} cannot be a name`);return}if(this.wb.name(s)){this.yaml(n,`two places are named ${s}`);return}const i={file:k(n),path:n},a=H(t).replace(/^([A-Z]+)(\d+)$/u,"$$$1$$$2"),r=`='${e.name.replaceAll("'","''")}'!${a}`;this.wb.names.set(s.toLowerCase(),{name:s,formula:new SharedFormula(r,0,0,i),source:i})}fill(e,t,s,n){const i=K(s),a={file:k(n),path:n};e.fills.push(i.formula===void 0?{area:t,value:i.value,...i.format===void 0?{}:{format:i.format}}:{area:t,shared:new SharedFormula(i.formula,t.top,t.left,a)})}}function W(l,e,t,s){const n=x(l.at);if(!n){s([...t,"at"],`${l.at} is not a cell`);return}const i=(o,f)=>{const h=new SharedFormula(chartFormula(o),0,0,{file:k(f),path:f});return h.node&&!I(h.node)&&s(f,`${o} is not a range or a table's column`),h},a=(o,f)=>o?.startsWith("=")===!0?i(o,f):void 0,r=a(l.title,[...t,"title"]);return{spec:l,at:n,index:e,...l.categories===void 0?{}:{categories:i(l.categories,[...t,"categories"])},...r?{title:r}:{},series:l.series.map((o,f)=>{const h=[...t,"series",f],d=a(o.name,[...h,"name"]);return{values:i(o.values,[...h,"values"]),...o.x===void 0?{}:{x:i(o.x,[...h,"x"])},...d?{name:d}:{}}})}}export const chartFormula=l=>l.startsWith("=")?l:`=${l}`;function I(l){switch(l.kind){case"error":case"ref":case"structured":case"name":return!0;case"paren":case"postfix":return I(l.arg);case"binary":return l.op===":"||l.op===",";default:return!1}}function K(l){if(l===null)return{value:null};if(typeof l=="string")return S(l);if(typeof l!="object")return{value:l};if(l.formula!==void 0)return{value:null,formula:l.formula.startsWith("=")?l.formula:`=${l.formula}`};const{value:e}=l;return typeof e=="string"?S(e):{value:e??null}}export function readWorkbook(l){const e=D(l.text),t=r=>r[0]===M?void 0:e.lineOf(r);if(!e.file)return{problems:e.problems,lineOf:t};const s=O(e.file,l.generated),n=new Workbook(s.file,l.generated);n.ordinary=s.ordinary;const i=[],a=new N(n,r=>{const o=l.generated?.csv[r]??l.read(r);if(o===void 0)return;const f=R(o);for(const h of f.problems)i.push({file:r,line:h.line,message:h.message});return{rows:f.records.map(h=>h.end===h.start?[]:h.fields),lines:f.records.map(h=>h.line)}},t,s.own,s.names);return a.read(),{workbook:n,problems:[...i,...a.problems],lineOf:t}}export function workbookOf(l){const e=O(l.file,l.generated),t=new Workbook(e.file,l.generated);return t.ordinary=e.ordinary,new N(t,s=>{const n=l.generated?.csv[s];if(n!==void 0)return{rows:R(n).records.map(a=>a.end===a.start?[]:a.fields),lines:[]};const i=l.rows(s);return i&&{rows:i,lines:[]}},()=>{},e.own,e.names).read(),t}export{U as rangeName};
|
|
@@ -15,6 +15,8 @@ export interface DrawnPicture {
|
|
|
15
15
|
width: number;
|
|
16
16
|
height: number;
|
|
17
17
|
name: string;
|
|
18
|
+
/** Its file's path from the sheet's folder, kept as its description so a reader finds it again. */
|
|
19
|
+
path: string;
|
|
18
20
|
file: string;
|
|
19
21
|
bytes: Uint8Array;
|
|
20
22
|
}
|
|
@@ -36,9 +38,16 @@ export interface Anchored {
|
|
|
36
38
|
width: number;
|
|
37
39
|
height: number;
|
|
38
40
|
}
|
|
39
|
-
/**
|
|
41
|
+
/** A picture of a drawing: its image by relationship, and what it is called. */
|
|
42
|
+
export interface AnchoredPicture extends Anchored {
|
|
43
|
+
name?: string;
|
|
44
|
+
/** Its description: the path of the file it was, when this writer wrote it. */
|
|
45
|
+
descr?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Each chart and picture of a drawing where it sits, sizes in pixels, and how many other things it holds. */
|
|
40
48
|
export declare function chartAnchors(root: Tag | undefined, columnWidth: (col: number) => number, rowHeight: (row: number) => number): {
|
|
41
49
|
anchors: Anchored[];
|
|
50
|
+
pictures: AnchoredPicture[];
|
|
42
51
|
others: number;
|
|
43
52
|
};
|
|
44
53
|
//# sourceMappingURL=charts.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{CHART_DEFAULTS as Q,chartSpaceXml as ce}from"@allyhub-next/chart";import{columnLetter as Y}from"../address.js";import{Reference as Z,Union as ae}from"../calc/types.js";import{chartDef as fe,chartSize as de}from"../chart.js";import{sheetPrefix as le}from"../formula/print.js";import{HEAD as ue,attr as
|
|
2
|
+
import{CHART_DEFAULTS as Q,chartSpaceXml as ce}from"@allyhub-next/chart";import{columnLetter as Y}from"../address.js";import{Reference as Z,Union as ae}from"../calc/types.js";import{chartDef as fe,chartSize as de}from"../chart.js";import{sheetPrefix as le}from"../formula/print.js";import{HEAD as ue,attr as y,el as s,flag as ee,numberAttr as M,tag as r,tags as R,textOf as O}from"./xml.js";const he="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",me="http://schemas.openxmlformats.org/drawingml/2006/main",te="http://schemas.openxmlformats.org/drawingml/2006/chart",re="http://schemas.openxmlformats.org/officeDocument/2006/relationships",g=9525,xe=(e,t)=>`${le(e.sheet.name)}$${Y(e.left)}$${String(e.top+1)}${e.single?"":`:$${Y(e.right)}$${String(t+1)}`}`;function _(e,t,n){if(!n?.node)return;const o=e.eval(n.node,{sheet:t,row:0,col:0,dr:0,dc:0}),i=a=>xe(a,Math.min(a.bottom,Math.max(a.top,a.sheet.lastRow)));if(o instanceof Z)return i(o);if(o instanceof ae)return`(${o.parts.map(i).join(",")})`}function pe(e,t,n){if(!n?.node)return!1;const o=e.eval(n.node,{sheet:t,row:0,col:0,dr:0,dc:0});return o instanceof Z&&typeof e.value(o.sheet,o.top,o.left)=="number"}export function chartPart(e,t,n){const o=fe(e,t,n),i={name:l=>_(e,t,n.series[l]?.name),categories:_(e,t,n.categories),numeric:pe(e,t,n.categories),values:l=>_(e,t,n.series[l]?.values)??"",x:l=>_(e,t,n.series[l]?.x??n.categories)},a=_(e,t,n.title);return ce(o,{refs:i,...a===void 0?{}:{titleRef:a}})}const ge=(e,t,n)=>s("xdr:oneCellAnchor",{},s("xdr:from",{},`<xdr:col>${String(e.col)}</xdr:col>`,`<xdr:colOff>${String(Math.round(e.x*g))}</xdr:colOff>`,`<xdr:row>${String(e.row)}</xdr:row>`,`<xdr:rowOff>${String(Math.round((e.y??0)*g))}</xdr:rowOff>`),s("xdr:ext",{cx:Math.round(e.width*g),cy:Math.round(e.height*g)}),s("xdr:pic",{},s("xdr:nvPicPr",{},s("xdr:cNvPr",{id:t,name:e.name,descr:e.path}),s("xdr:cNvPicPr",{},s("a:picLocks",{noChangeAspect:!0}))),s("xdr:blipFill",{},s("a:blip",{"xmlns:r":re,"r:embed":`rId${String(n)}`}),s("a:stretch",{},s("a:fillRect"))),s("xdr:spPr",{},s("a:xfrm",{},s("a:off",{x:0,y:0}),s("a:ext",{cx:Math.round(e.width*g),cy:Math.round(e.height*g)})),s("a:prstGeom",{prst:"rect"},s("a:avLst")))),s("xdr:clientData"));export function drawingPart(e,t=[]){const n=(o,i)=>{const{width:a,height:l}=de(o.spec);return s("xdr:oneCellAnchor",{},s("xdr:from",{},`<xdr:col>${String(o.at.col)}</xdr:col>`,`<xdr:colOff>${String(Math.round((o.spec.x??0)*g))}</xdr:colOff>`,`<xdr:row>${String(o.at.row)}</xdr:row>`,`<xdr:rowOff>${String(Math.round((o.spec.y??0)*g))}</xdr:rowOff>`),s("xdr:ext",{cx:Math.round(a*g),cy:Math.round(l*g)}),s("xdr:graphicFrame",{macro:""},s("xdr:nvGraphicFramePr",{},s("xdr:cNvPr",{id:i+2,name:`Chart ${String(i+1)}`}),s("xdr:cNvGraphicFramePr")),s("xdr:xfrm",{},s("a:off",{x:0,y:0}),s("a:ext",{cx:0,cy:0})),s("a:graphic",{},s("a:graphicData",{uri:te},s("c:chart",{"xmlns:c":te,"xmlns:r":re,"r:id":`rId${String(i+1)}`})))),s("xdr:clientData"))};return ue+s("xdr:wsDr",{"xmlns:xdr":he,"xmlns:a":me},...e.map(n),...t.map((o,i)=>ge(o,e.length+i+2,e.length+i+1)))}function I(e){if(Array.isArray(e))return e.map(I).join("");if(typeof e!="object"||e===null)return"";const t=e,n=[];for(const[o,i]of Object.entries(t))o==="t"?n.push(O(i)):typeof i=="object"&&n.push(I(i));return n.join("")}const V=e=>{const t=r(e?.solidFill),n=y(r(t?.srgbClr),"val");return n!==void 0?`#${n.toUpperCase()}`:we[y(r(t?.schemeClr),"val")??""]},we={accent1:"#4472C4",accent2:"#ED7D31",accent3:"#A5A5A5",accent4:"#FFC000",accent5:"#5B9BD5",accent6:"#70AD47"},$=(e,t)=>y(r(e?.[t]),"val"),A=(e,t)=>M(r(e?.[t]),"val"),F=(e,t)=>ee(r(e?.[t]),"val");function ne(e){if(!e)return;const t=r(e.tx),n=r(t?.strRef);if(n)return`=${O(n.f)}`;const o=I(t?.rich);return o===""?void 0:o}function oe(e){if(!e)return;const t=r(e.scaling),n=r(e.numFmt),o=y(n,"formatCode"),i={},a=ne(r(e.title));a!==void 0&&(i.title=a);const l=A(t,"min"),x=A(t,"max"),u=A(e,"majorUnit");return l!==void 0&&(i.min=l),x!==void 0&&(i.max=x),u!==void 0&&u>0&&(i.major=u),F(e,"delete")===!0&&(i.visible=!1),$(t,"orientation")==="maxMin"&&(i.reverse=!0),o!==void 0&&o!=="General"&&ee(n,"sourceLinked")!==!0&&(i.format=o),i}const j=e=>{const t=r(e?.numRef)??r(e?.strRef),n=t?O(t.f):"";return n===""?void 0:n};function be(e,t){const n=j(r(e[t?"yVal":"val"]));if(n===void 0)return"its numbers are written in the chart";const o={values:n},i=r(e.tx),a=j(i);if(a!==void 0)o.name=`=${a}`;else{const d=O(i?.v);d!==""&&(o.name=d)}const l=r(e.spPr),x=r(l?.ln),u=r(e.marker),w=t||u!==void 0,c=V(l)??(w?V(x)??V(r(u?.spPr)):void 0);c!==void 0&&(o.color=c);const f=M(x,"w");if(w&&f!==void 0&&x?.noFill===void 0){const d=Number((f/12700).toFixed(2));d!==Q.lineWidth&&(o.line_width=d)}F(e,"smooth")===!0&&(o.smooth=!0);const m=A(u,"size");m!==void 0&&m!==Q.marker&&(o.marker_size=m);const v=t?j(r(e.xVal)):void 0;v!==void 0&&(o.x=v);const b=t?void 0:j(r(e.cat));return{series:o,...b===void 0?{}:{categories:b}}}function ve(e){const t=$(e,"barDir")==="bar"?"bar":"column",n=$(e,"grouping");return n==="stacked"?`${t}-stacked`:n==="percentStacked"?`${t}-stacked-100`:`${t}-clustered`}function ye(e){const t=$(e,"grouping");return t==="stacked"?"area-stacked":t==="percentStacked"?"area-stacked-100":"area"}export function readChart(e){const t=r(e?.chartSpace),n=r(t?.chart),o=r(n?.plotArea);if(!n||!o)return"it has no plot";const i=Object.entries(o).filter(([h])=>h.endsWith("Chart")),[a]=i;if(!a)return"it has no plot";if(i.length>1||Array.isArray(a[1])&&a[1].length>1)return"it combines several kinds of chart";const[l,x]=a,u=r(x);if(!u)return"it has no plot";const w=R(u.ser),c=l==="scatterChart",f=[];let m;for(const h of w){const P=be(h,c);if(typeof P=="string")return P;f.push(P.series),m??=P.categories}if(f.length===0)return"it has no series";const v=h=>r(r(h.spPr)?.ln)?.noFill!==void 0,b=h=>$(r(h.marker),"symbol")==="none",d=(()=>{switch(l){case"barChart":return ve(u);case"lineChart":return w.every(b)?"line":"line-markers";case"areaChart":return ye(u);case"pieChart":return"pie";case"doughnutChart":return"doughnut";case"scatterChart":return w.every(v)?"scatter":w.some(h=>F(h,"smooth")===!0)?"scatter-smooth":"scatter-lines";default:return}})();if(!d)return`a sheet has no ${l.replace(/Chart$/u,"")} chart`;const S=ne(r(n.title)),k=r(n.legend),C=$(k,"legendPos"),D=r(u.dLbls),p=h=>F(D,h)===!0,se=p("showVal")||p("showPercent")||p("showCatName")||p("showSerName"),H=$(D,"dLblPos"),z=A(u,"gapWidth"),W=A(u,"overlap"),E=A(u,"holeSize"),X=F(u,"varyColors"),B=d==="pie"||d==="doughnut",N={value:R(o.valAx).find((h,P,ie)=>c?P===ie.length-1:!0),category:c?R(o.valAx)[0]:r(o.catAx)??r(o.dateAx)},G=oe(N.value),T=oe(N.category);G&&N.value?.majorGridlines===void 0&&(G.gridlines=!1),T&&N.category?.majorGridlines!==void 0&&(T.gridlines=!0);const U=M(r(r(r(r(t?.txPr)?.p)?.pPr)?.defRPr),"sz"),q=h=>h&&Object.keys(h).length>0?h:void 0,J=q(G),K=q(T);return{type:d,at:"A1",...S===void 0?{}:{title:S},...m===void 0?{}:{categories:m},series:B?f.slice(0,1):f,...k?{legend:C==="b"?"bottom":C==="t"?"top":C==="l"?"left":"right"}:{},...se?{labels:{...p("showVal")?{value:!0}:{},...p("showPercent")?{percentage:!0}:{},...p("showCatName")?{category:!0}:{},...p("showSerName")?{series:!0}:{},...H===void 0?{}:{position:H}}}:{},...z===void 0||z===150?{}:{gap_width:z},...W===void 0||d.includes("stacked")?{}:{overlap:W},...E===void 0||E===50?{}:{hole_size:E},...X===!0&&l==="barChart"?{vary_by_categories:!0}:{},...X===!1&&B?{vary_by_categories:!1}:{},...J?{value_axis:J}:{},...K?{category_axis:K}:{},...U===void 0||U===900?{}:{size:U/100}}}const L=e=>Math.round(e/g);export function chartAnchors(e,t,n){const o=r(e?.wsDr),i=[],a=[];let l=0;const x=c=>({col:Number(O(c?.col)),row:Number(O(c?.row)),colOff:L(Number(O(c?.colOff))),rowOff:L(Number(O(c?.rowOff)))}),u=c=>y(r(r(r(r(c.graphicFrame)?.graphic)?.graphicData)?.chart),"id"),w=(c,f,m,v)=>{const b={at:{row:f.row,col:f.col},...f.colOff>0?{x:f.colOff}:{},...f.rowOff>0?{y:f.rowOff}:{},width:m,height:v},d=r(c.pic),S=y(r(r(d?.blipFill)?.blip),"embed");if(d&&S!==void 0){const C=r(r(d.nvPicPr)?.cNvPr),D=y(C,"name"),p=y(C,"descr");a.push({id:S,...b,...D===void 0?{}:{name:D},...p===void 0?{}:{descr:p}});return}const k=u(c);if(k===void 0){l+=1;return}i.push({id:k,...b})};for(const c of R(o?.oneCellAnchor)){const f=r(c.ext);w(c,x(r(c.from)),L(M(f,"cx")??0),L(M(f,"cy")??0))}for(const c of R(o?.twoCellAnchor)){const f=x(r(c.from)),m=x(r(c.to));let v=m.colOff-f.colOff;for(let d=f.col;d<m.col;d++)v+=t(d);let b=m.rowOff-f.rowOff;for(let d=f.row;d<m.row;d++)b+=n(d);w(c,f,v,b)}return{anchors:i,pictures:a,others:l}}
|
|
@@ -4,8 +4,12 @@ import type { Node, Parsed } from "../formula/ast.js";
|
|
|
4
4
|
* is expected. `isRangeName` says whether a name stands for several cells.
|
|
5
5
|
*/
|
|
6
6
|
export declare function needsArray(node: Node, isRangeName?: (name: string) => boolean): boolean;
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* A formula with the narrowing an ordinary <f> does written out with @:
|
|
9
|
+
* wherever one value is expected, its whole body too. `isRangeName` says
|
|
10
|
+
* whether a defined name stands for several cells.
|
|
11
|
+
*/
|
|
12
|
+
export declare function narrowed(n: Node, isRangeName?: (name: string) => boolean): Node;
|
|
9
13
|
export interface FileFormulaContext {
|
|
10
14
|
/** The table the formula is in: the name a bare [@x] leaves out. */
|
|
11
15
|
table?: string | undefined;
|
|
@@ -16,6 +20,12 @@ export interface FileFormulaContext {
|
|
|
16
20
|
}
|
|
17
21
|
/** A formula's text as a file stores it: no =. */
|
|
18
22
|
export declare const fileFormula: (node: Node, c: FileFormulaContext) => string;
|
|
19
|
-
/**
|
|
20
|
-
|
|
23
|
+
/**
|
|
24
|
+
* A formula as a file stores it, parsed. `array`: it is an array formula,
|
|
25
|
+
* so nothing narrows. `isRangeName` says whether a defined name stands for
|
|
26
|
+
* several cells.
|
|
27
|
+
*/
|
|
28
|
+
export declare function readFileFormula(text: string, array: boolean, isRangeName?: (name: string) => boolean): Parsed;
|
|
29
|
+
/** Whether a defined name's text, as a file stores it, is several cells. */
|
|
30
|
+
export declare function isRangeText(text: string): boolean;
|
|
21
31
|
//# sourceMappingURL=formula.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{parseFormula as
|
|
2
|
+
import{parseFormula as p}from"../formula/parse.js";import{printFormula as w}from"../formula/print.js";import{FUNCTIONS as S}from"../calc/functions/index.js";import{fileName as k,plainName as O}from"./functions.js";function c(r){switch(r.kind){case"ref":return r.col2!==void 0||r.row2!==void 0;case"structured":return!r.thisRow||r.columns.length>1;case"paren":return c(r.arg);case"binary":return r.op===":"||r.op===",";default:return!1}}const l=new Set(["+","-","*","/","^","&","=","<>","<","<=",">",">="]),y=new Set(`BYCOL BYROW CHOOSECOLS CHOOSEROWS DROP EXPAND FILTER HSTACK MAKEARRAY MAP
|
|
3
3
|
RANDARRAY SCAN SEQUENCE SORT SORTBY TAKE TEXTSPLIT TOCOL TOROW UNIQUE VSTACK
|
|
4
|
-
WRAPCOLS WRAPROWS`.split(/\s+/u)),
|
|
4
|
+
WRAPCOLS WRAPROWS`.split(/\s+/u)),d=new Set(["IF","IFERROR","IFNA"]),R=r=>S.get(r)?.kind==="scalar";export function needsArray(r,t=()=>!1){const a=e=>c(e)||e.kind==="array"||e.kind==="name"&&t(e.name)||e.kind==="paren"&&a(e.arg);if(r.kind!=="array"&&a(r))return!0;const s=e=>{switch(e.kind){case"unary":return e.op==="@"?!1:a(e.arg)||s(e.arg);case"postfix":return e.op==="%"?a(e.arg)||s(e.arg):!1;case"paren":return s(e.arg);case"binary":return l.has(e.op)&&(a(e.left)||a(e.right))?!0:s(e.left)||s(e.right);case"call":return e.name==="LET"||e.name==="LAMBDA"||y.has(e.name)||R(e.name)&&e.args.some(a)||d.has(e.name)&&e.args[0]&&a(e.args[0])?!0:e.args.some(s);case"invoke":return s(e.callee)||e.args.some(s);default:return!1}};return s(r)}export function narrowed(r,t=()=>!1){const a=e=>e.kind!=="array"&&(c(e)||e.kind==="name"&&t(e.name))?{kind:"unary",op:"@",arg:e}:s(e),s=e=>{switch(e.kind){case"unary":return e.op==="@"?e:{...e,arg:a(e.arg)};case"postfix":return e.op==="%"?{...e,arg:a(e.arg)}:e;case"paren":return{...e,arg:s(e.arg)};case"binary":return l.has(e.op)?{...e,left:a(e.left),right:a(e.right)}:e;case"call":{if(R(e.name))return{...e,args:e.args.map(a)};const[n,...u]=e.args;return d.has(e.name)&&n?{...e,args:[a(n),...u]}:e}default:return e}};return a(r)}const A=(r,t)=>({kind:"call",name:r,written:r,args:t});function E(r,t){return{...r,...r.table===void 0&&t!==void 0?{table:t}:{},sections:r.thisRow?["#This Row"]:r.sections,thisRow:!1}}function g(r,t,a,s){const e=(n,u=!1)=>g(n,t,a,u&&s);switch(r.kind){case"name":{const n=r.name.toLowerCase();return a.has(n)?{...r,name:`_xlpm.${r.name}`}:t.isTable(r.name)?{...r,name:`${r.name}[]`}:r}case"structured":return E(r,t.table);case"unary":return r.op==="@"?s?e(r.arg,!0):A("_xlfn.SINGLE",[e(r.arg)]):{...r,arg:e(r.arg,!0)};case"postfix":return r.op==="#"?A("_xlfn.ANCHORARRAY",[e(r.arg)]):{...r,arg:e(r.arg,!0)};case"paren":return{...r,arg:e(r.arg,!0)};case"binary":return{...r,left:e(r.left,l.has(r.op)),right:e(r.right,l.has(r.op))};case"call":{const n=k(r.name);if(r.name==="LET"||r.name==="LAMBDA"){const u=new Set(a),m=r.args.length-1,h=r.args.map((i,f)=>(r.name==="LAMBDA"||f%2===0)&&f<m&&i.kind==="name"?(u.add(i.name.toLowerCase()),{...i,name:`_xlpm.${i.name}`}):g(i,t,u,!1));return{...r,written:n,args:h}}return{...r,written:n,args:r.args.map(u=>e(u))}}case"invoke":return{...r,callee:e(r.callee),args:r.args.map(n=>e(n))};case"array":return{...r,rows:r.rows.map(n=>n.map(u=>e(u)))};default:return r}}export const fileFormula=(r,t)=>w(g(r,t,new Set,!t.array)).slice(1);function o(r){switch(r.kind){case"name":return r.name.toLowerCase().startsWith("_xlpm.")?{...r,name:r.name.slice(6)}:r;case"structured":return r;case"unary":case"postfix":case"paren":return{...r,arg:o(r.arg)};case"binary":return{...r,left:o(r.left),right:o(r.right)};case"call":{const a=O(r.written).toUpperCase(),s=r.args.map(o),[e]=s;return a==="ANCHORARRAY"&&e&&s.length===1?{kind:"postfix",op:"#",arg:e}:a==="SINGLE"&&e&&s.length===1?{kind:"unary",op:"@",arg:e}:{...r,name:a,written:a,args:s}}case"invoke":return{...r,callee:o(r.callee),args:r.args.map(o)};case"array":return{...r,rows:r.rows.map(t=>t.map(o))};default:return r}}export function readFileFormula(r,t,a){const s=p(`=${r}`);if(!s.ok)return s;const e=o(s.node);return{ok:!0,node:t?e:narrowed(e,a)}}export function isRangeText(r){const t=p(`=${r}`);return t.ok&&c(o(t.node))}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [MS-XLSX] 2.2.2.1 Functions, "future functions", as Microsoft publishes
|
|
3
|
+
* them (learn.microsoft.com/openspecs/office_standards/ms-xlsx/5d1b6d44,
|
|
4
|
+
* revised 2024-04-16), every entry as its table writes it. Its formula
|
|
5
|
+
* grammar sets ECMA.CEILING, ISO.CEILING, NETWORKDAYS.INTL, WORKDAY.INTL
|
|
6
|
+
* and the FORECAST functions outside the `_xlfn.` group by a misplaced
|
|
7
|
+
* parenthesis; Excel, LibreOffice and the table's own FORECAST entries
|
|
8
|
+
* store all of them with it, so every entry here has it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const PUBLISHED_FUTURE_FUNCTIONS = "_xlfn._xlws.FILTER _xlfn._xlws.PY\n_xlfn._xlws.SORT _xlfn.ACOT _xlfn.ACOTH _xlfn.AGGREGATE _xlfn.ARABIC _xlfn.BASE\n_xlfn.BETA.DIST _xlfn.BETA.INV _xlfn.BINOM.DIST _xlfn.BINOM.DIST.RANGE\n_xlfn.BINOM.INV _xlfn.BITAND _xlfn.BITLSHIFT _xlfn.BITOR _xlfn.BITRSHIFT\n_xlfn.BITXOR _xlfn.BYCOL _xlfn.BYROW _xlfn.CEILING.MATH _xlfn.CEILING.PRECISE\n_xlfn.CHISQ.DIST _xlfn.CHISQ.DIST.RT _xlfn.CHISQ.INV _xlfn.CHISQ.INV.RT\n_xlfn.CHISQ.TEST _xlfn.CHOOSECOLS _xlfn.CHOOSEROWS _xlfn.COMBINA _xlfn.CONCAT\n_xlfn.CONFIDENCE.NORM _xlfn.CONFIDENCE.T _xlfn.COT _xlfn.COTH\n_xlfn.COVARIANCE.P _xlfn.COVARIANCE.S _xlfn.CSC _xlfn.CSCH _xlfn.DAYS\n_xlfn.DECIMAL _xlfn.DROP ECMA.CEILING _xlfn.ERF.PRECISE _xlfn.ERFC.PRECISE\n_xlfn.EXPAND _xlfn.EXPON.DIST _xlfn.F.DIST _xlfn.F.DIST.RT _xlfn.F.INV\n_xlfn.F.INV.RT _xlfn.F.TEST _xlfn.FIELDVALUE _xlfn.FILTERXML _xlfn.FLOOR.MATH\n_xlfn.FLOOR.PRECISE _xlfn.FORECAST.ETS _xlfn.FORECAST.ETS.CONFINT\n_xlfn.FORECAST.ETS.SEASONALITY _xlfn.FORECAST.ETS.STAT _xlfn.FORECAST.LINEAR\n_xlfn.FORMULATEXT _xlfn.GAMMA _xlfn.GAMMA.DIST _xlfn.GAMMA.INV\n_xlfn.GAMMALN.PRECISE _xlfn.GAUSS _xlfn.HSTACK _xlfn.HYPGEOM.DIST _xlfn.IFNA\n_xlfn.IFS _xlfn.IMCOSH _xlfn.IMCOT _xlfn.IMCSC _xlfn.IMCSCH _xlfn.IMSEC\n_xlfn.IMSECH _xlfn.IMSINH _xlfn.IMTAN _xlfn.ISFORMULA ISO.CEILING\n_xlfn.ISOMITTED _xlfn.ISOWEEKNUM _xlfn.LAMBDA _xlfn.LET _xlfn.LOGNORM.DIST\n_xlfn.LOGNORM.INV _xlfn.MAKEARRAY _xlfn.MAP _xlfn.MAXIFS _xlfn.MINIFS\n_xlfn.MODE.MULT _xlfn.MODE.SNGL _xlfn.MUNIT _xlfn.NEGBINOM.DIST\nNETWORKDAYS.INTL _xlfn.NORM.DIST _xlfn.NORM.INV _xlfn.NORM.S.DIST\n_xlfn.NORM.S.INV _xlfn.NUMBERVALUE _xlfn.PDURATION _xlfn.PERCENTILE.EXC\n_xlfn.PERCENTILE.INC _xlfn.PERCENTRANK.EXC _xlfn.PERCENTRANK.INC\n_xlfn.PERMUTATIONA _xlfn.PHI _xlfn.POISSON.DIST _xlfn.PQSOURCE\n_xlfn.PYTHON_STR _xlfn.PYTHON_TYPE _xlfn.PYTHON_TYPENAME _xlfn.QUARTILE.EXC\n_xlfn.QUARTILE.INC _xlfn.QUERYSTRING _xlfn.RANDARRAY _xlfn.RANK.AVG\n_xlfn.RANK.EQ _xlfn.REDUCE _xlfn.RRI _xlfn.SCAN _xlfn.SEC _xlfn.SECH\n_xlfn.SEQUENCE _xlfn.SHEET _xlfn.SHEETS _xlfn.SKEW.P _xlfn.SORTBY\n_xlfn.STDEV.P _xlfn.STDEV.S _xlfn.SWITCH _xlfn.T.DIST _xlfn.T.DIST.2T\n_xlfn.T.DIST.RT _xlfn.T.INV _xlfn.T.INV.2T _xlfn.T.TEST _xlfn.TAKE\n_xlfn.TEXTAFTER _xlfn.TEXTBEFORE _xlfn.TEXTJOIN _xlfn.TEXTSPLIT _xlfn.TOCOL\n_xlfn.TOROW _xlfn.UNICHAR _xlfn.UNICODE _xlfn.UNIQUE _xlfn.VAR.P _xlfn.VAR.S\n_xlfn.VSTACK _xlfn.WEBSERVICE _xlfn.WEIBULL.DIST WORKDAY.INTL _xlfn.WRAPCOLS\n_xlfn.WRAPROWS _xlfn.XLOOKUP _xlfn.XOR _xlfn.Z.TEST";
|
|
1
11
|
/** A function's name as a file stores it. */
|
|
2
12
|
export declare function fileName(name: string): string;
|
|
3
13
|
/** A name as a formula writes it, whatever prefix a file stored it under. */
|
|
4
|
-
export declare
|
|
14
|
+
export declare function plainName(name: string): string;
|
|
5
15
|
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -1,17 +1,37 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
export const PUBLISHED_FUTURE_FUNCTIONS=`_xlfn._xlws.FILTER _xlfn._xlws.PY
|
|
3
|
+
_xlfn._xlws.SORT _xlfn.ACOT _xlfn.ACOTH _xlfn.AGGREGATE _xlfn.ARABIC _xlfn.BASE
|
|
4
|
+
_xlfn.BETA.DIST _xlfn.BETA.INV _xlfn.BINOM.DIST _xlfn.BINOM.DIST.RANGE
|
|
5
|
+
_xlfn.BINOM.INV _xlfn.BITAND _xlfn.BITLSHIFT _xlfn.BITOR _xlfn.BITRSHIFT
|
|
6
|
+
_xlfn.BITXOR _xlfn.BYCOL _xlfn.BYROW _xlfn.CEILING.MATH _xlfn.CEILING.PRECISE
|
|
7
|
+
_xlfn.CHISQ.DIST _xlfn.CHISQ.DIST.RT _xlfn.CHISQ.INV _xlfn.CHISQ.INV.RT
|
|
8
|
+
_xlfn.CHISQ.TEST _xlfn.CHOOSECOLS _xlfn.CHOOSEROWS _xlfn.COMBINA _xlfn.CONCAT
|
|
9
|
+
_xlfn.CONFIDENCE.NORM _xlfn.CONFIDENCE.T _xlfn.COT _xlfn.COTH
|
|
10
|
+
_xlfn.COVARIANCE.P _xlfn.COVARIANCE.S _xlfn.CSC _xlfn.CSCH _xlfn.DAYS
|
|
11
|
+
_xlfn.DECIMAL _xlfn.DROP ECMA.CEILING _xlfn.ERF.PRECISE _xlfn.ERFC.PRECISE
|
|
12
|
+
_xlfn.EXPAND _xlfn.EXPON.DIST _xlfn.F.DIST _xlfn.F.DIST.RT _xlfn.F.INV
|
|
13
|
+
_xlfn.F.INV.RT _xlfn.F.TEST _xlfn.FIELDVALUE _xlfn.FILTERXML _xlfn.FLOOR.MATH
|
|
14
|
+
_xlfn.FLOOR.PRECISE _xlfn.FORECAST.ETS _xlfn.FORECAST.ETS.CONFINT
|
|
15
|
+
_xlfn.FORECAST.ETS.SEASONALITY _xlfn.FORECAST.ETS.STAT _xlfn.FORECAST.LINEAR
|
|
16
|
+
_xlfn.FORMULATEXT _xlfn.GAMMA _xlfn.GAMMA.DIST _xlfn.GAMMA.INV
|
|
17
|
+
_xlfn.GAMMALN.PRECISE _xlfn.GAUSS _xlfn.HSTACK _xlfn.HYPGEOM.DIST _xlfn.IFNA
|
|
18
|
+
_xlfn.IFS _xlfn.IMCOSH _xlfn.IMCOT _xlfn.IMCSC _xlfn.IMCSCH _xlfn.IMSEC
|
|
19
|
+
_xlfn.IMSECH _xlfn.IMSINH _xlfn.IMTAN _xlfn.ISFORMULA ISO.CEILING
|
|
20
|
+
_xlfn.ISOMITTED _xlfn.ISOWEEKNUM _xlfn.LAMBDA _xlfn.LET _xlfn.LOGNORM.DIST
|
|
21
|
+
_xlfn.LOGNORM.INV _xlfn.MAKEARRAY _xlfn.MAP _xlfn.MAXIFS _xlfn.MINIFS
|
|
22
|
+
_xlfn.MODE.MULT _xlfn.MODE.SNGL _xlfn.MUNIT _xlfn.NEGBINOM.DIST
|
|
23
|
+
NETWORKDAYS.INTL _xlfn.NORM.DIST _xlfn.NORM.INV _xlfn.NORM.S.DIST
|
|
24
|
+
_xlfn.NORM.S.INV _xlfn.NUMBERVALUE _xlfn.PDURATION _xlfn.PERCENTILE.EXC
|
|
25
|
+
_xlfn.PERCENTILE.INC _xlfn.PERCENTRANK.EXC _xlfn.PERCENTRANK.INC
|
|
26
|
+
_xlfn.PERMUTATIONA _xlfn.PHI _xlfn.POISSON.DIST _xlfn.PQSOURCE
|
|
27
|
+
_xlfn.PYTHON_STR _xlfn.PYTHON_TYPE _xlfn.PYTHON_TYPENAME _xlfn.QUARTILE.EXC
|
|
28
|
+
_xlfn.QUARTILE.INC _xlfn.QUERYSTRING _xlfn.RANDARRAY _xlfn.RANK.AVG
|
|
29
|
+
_xlfn.RANK.EQ _xlfn.REDUCE _xlfn.RRI _xlfn.SCAN _xlfn.SEC _xlfn.SECH
|
|
30
|
+
_xlfn.SEQUENCE _xlfn.SHEET _xlfn.SHEETS _xlfn.SKEW.P _xlfn.SORTBY
|
|
31
|
+
_xlfn.STDEV.P _xlfn.STDEV.S _xlfn.SWITCH _xlfn.T.DIST _xlfn.T.DIST.2T
|
|
32
|
+
_xlfn.T.DIST.RT _xlfn.T.INV _xlfn.T.INV.2T _xlfn.T.TEST _xlfn.TAKE
|
|
33
|
+
_xlfn.TEXTAFTER _xlfn.TEXTBEFORE _xlfn.TEXTJOIN _xlfn.TEXTSPLIT _xlfn.TOCOL
|
|
34
|
+
_xlfn.TOROW _xlfn.UNICHAR _xlfn.UNICODE _xlfn.UNIQUE _xlfn.VAR.P _xlfn.VAR.S
|
|
35
|
+
_xlfn.VSTACK _xlfn.WEBSERVICE _xlfn.WEIBULL.DIST WORKDAY.INTL _xlfn.WRAPCOLS
|
|
36
|
+
_xlfn.WRAPROWS _xlfn.XLOOKUP _xlfn.XOR _xlfn.Z.TEST`;const x=`ENCODEURL ARRAYTOTEXT VALUETOTEXT IMAGE REGEXTEST
|
|
37
|
+
REGEXEXTRACT REGEXREPLACE GROUPBY PIVOTBY PERCENTOF TRIMRANGE`,_=new Map;for(const n of PUBLISHED_FUTURE_FUNCTIONS.split(/\s+/u)){const l=plainName(n);_.set(l,n.startsWith("_xlfn._xlws.")?n:`_xlfn.${l}`)}for(const n of x.split(/\s+/u))_.set(n,`_xlfn.${n}`);export function fileName(n){return _.get(n)??n}export function plainName(n){return n.replace(/^(?:_xlfn\.|_xlws\.|_xludf\.)+/iu,"")}
|
|
@@ -24,6 +24,8 @@ export interface Compared {
|
|
|
24
24
|
export interface ImportedXlsx {
|
|
25
25
|
/** Paths from the sheet's folder, sheet.yaml first, and their text. */
|
|
26
26
|
files: Map<string, string>;
|
|
27
|
+
/** Pictures, from the sheet's folder: what `pictures` and `files` columns name. */
|
|
28
|
+
assets: Map<string, Uint8Array>;
|
|
27
29
|
/** What was not carried over, a line each. */
|
|
28
30
|
lost: string[];
|
|
29
31
|
/** What is wrong with the workbook as it now is. */
|
|
@@ -33,7 +35,7 @@ export interface ImportedXlsx {
|
|
|
33
35
|
tables: number;
|
|
34
36
|
}
|
|
35
37
|
export interface ImportOptions {
|
|
36
|
-
/** The workbook's title. */
|
|
38
|
+
/** The workbook's title, when the file has none of its own. */
|
|
37
39
|
name: string;
|
|
38
40
|
/** See COMPARE_TOLERANCE. */
|
|
39
41
|
tolerance?: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{SHEET_DATA as G,SHEET_FILE as Q}from"@allyhub-next/formats";import{cellName as $,columnLetter as z,contains as A,overlaps as D,rangeName as x,readAddress as Z,readArea as ee}from"../address.js";import{rectangles as _}from"../api/rectangles.js";import{chartAfter as te}from"../chart.js";import{analyse as oe}from"../calc/analyse.js";import{FUNCTIONS as ne}from"../calc/functions/index.js";import{checkWorkbook as se}from"../check.js";import{writeCsv as I}from"../csv.js";import{isDateCode as W}from"../format.js";import{moveFormula as re,relativeKey as B}from"../formula/move.js";import{printFormula as M,sheetPrefix as ie}from"../formula/print.js";import{mapNode as le,walk as N}from"../formula/walk.js";import{CellError as T,isoOfSerial as fe,readTyped as F,writeTyped as P}from"../values.js";import{FormulaCell as ae,placeKey as g,validName as R}from"../workbook.js";import{writeYaml as ce}from"../write.js";import{readFileFormula as ue}from"./formula.js";import{hasDate as H}from"./numfmt.js";import{placesLine as J,readXlsx as de}from"./read.js";const K=100,he=.5,q=1462;export const COMPARE_TOLERANCE=1e-9;const me=f=>f.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/gu,"")||"rows",b=f=>Object.keys(f).length===0,V=(f,e)=>`${String(f)} ${e}${f===1?"":"s"}`,C=f=>({row:f.row,col:f.col});function X(f,e){const o=e.toLowerCase();return le(f,n=>n.kind!=="structured"||n.table?.toLowerCase()!==o?n:Object.fromEntries(Object.entries(n).filter(([i])=>i!=="table")))}function Y(f){return f.headers===0?"has no header row":f.columns.length!==f.ref.right-f.ref.left+1||!R(f.name)?"cannot be held as a table":new Set(f.columns.map(e=>e.name.toLowerCase())).size===f.columns.length?void 0:"has two columns of one name"}function U(f,e,o){let n;const i=new Set;N(f,t=>{t.kind==="call"&&(t.name==="LET"||t.name==="LAMBDA")&&t.args.forEach(r=>{r.kind==="name"&&i.add(r.name.toLowerCase())})});const s=t=>i.has(t)||o===void 0||o.names.has(t)||o.tables.has(t);return N(f,t=>{n===void 0&&(t.kind==="call"&&!ne.has(t.name)&&(s(t.written.toLowerCase())||(n=`no function ${t.name}`)),t.kind==="name"&&!s(t.name.toLowerCase())&&(n=`no name ${t.name}`),t.kind==="structured"&&t.table!==void 0&&!s(t.table.toLowerCase())&&(n=`no table ${t.table}`),(t.kind==="ref"||t.kind==="name"||t.kind==="error")&&t.sheet!==void 0&&(t.sheet.startsWith("[")?n="it reads another workbook":e.has(t.sheet.toLowerCase())||(n=`no sheet ${t.sheet}`)))}),n}function pe(f){const e=new Set(f.book.sheets.map(o=>o.name.toLowerCase()));for(const o of f.book.sheets){const n=new Map,i=(t,r)=>{const l=n.get(r),c=$(t);l?l.push(c):n.set(r,[c])},s=[];for(const t of o.cells){if(t.unread!==void 0){i(t,/^\[|[!']\[|\[\d+\]/u.test(t.unread)?"it reads another workbook":`it could not be read: ${t.unread}`);continue}if(!t.node)continue;const r=U(t.node,e,f);r!==void 0?(delete t.node,i(t,r)):(f.carried.set(t,o),t.array&&x(t.array)!==$(t)&&s.push(t))}we(f,o,s);for(const[t,r]of n)f.lost.push(`${o.name}: ${V(r.length,"formula")} kept as ${r.length===1?"its value":"their values"}, as ${t} (${J(r)})`)}}function we(f,e,o){if(o.length===0)return;const n=new Set;for(const i of o){const{array:s}=i;if(s)for(const t of e.cells)t!==i&&!t.node&&A(s,t.row,t.col)&&n.add(t)}e.cells=e.cells.filter(i=>!n.has(i));for(const i of n)f.spilled.set(i,e)}function O(f,e){const{value:o}=e;if(!f.book.date1904||typeof o!="number")return o;const n=f.book.looks[e.style]?.format;return W(n)&&n!==void 0&&H(n)?o+q:o}function j(f,e){if(typeof f!="number"||e===void 0||!W(e)||!H(e)||f<1)return;const o=fe(f);return F(o).value===f?o:void 0}const ge=(f,e)=>j(f,e)??P(f??null);function ke(f,e){const o=j(f,e);return o!==void 0?o:f==null?null:typeof f=="number"||typeof f=="boolean"?f:P(f)}function be(f){const e={top:1/0,left:1/0,bottom:-1,right:-1};for(const{row:o,col:n}of f)e.top=Math.min(e.top,o),e.left=Math.min(e.left,n),e.bottom=Math.max(e.bottom,o),e.right=Math.max(e.right,n);return e}class ye{ctx;read;byPlace=new Map;inTables=new Set;columnLooks=new Map;rowLooks=new Map;lookDone=new Set;tables=[];areas=[];filtered=[];constructor(e,o){this.ctx=e,this.read=o;for(const n of o.cells)this.byPlace.set(g(n.row,n.col),n)}look(e){return this.ctx.book.looks[e.style]??{}}code(e){return this.look(e).format}text(e){return e.node?M(e.node):ge(O(this.ctx,e),this.code(e))}baseLooks(){const{read:e}=this,{looks:o}=this.ctx.book,n=e.cells.reduce((s,t)=>Math.max(s,t.col),-1);for(const s of e.columns){if(s.style===void 0)continue;const t=o[s.style];if(!(!t||b(t)))for(let r=s.min;r<=Math.min(s.max,n);r++)this.columnLooks.set(r,t)}for(const s of e.rows){const t=s.style===void 0?void 0:o[s.style];t&&!b(t)&&this.rowLooks.set(s.row,t)}const i=(s,t)=>Object.keys(t).every(r=>r in s);for(const s of e.cells){const t=this.look(s),r=this.columnLooks.get(s.col);r&&!i(t,r)&&this.columnLooks.delete(s.col);const l=this.rowLooks.get(s.row);l&&!i(t,l)&&this.rowLooks.delete(s.row)}}ownLook(e){const o={...this.columnLooks.get(e.col),...this.rowLooks.get(e.row)},n={};for(const[s,t]of Object.entries(this.look(e)))JSON.stringify(t)!==JSON.stringify(o[s])&&(n[s]=t);const i=n.format;if(typeof i=="string"){const s=e.node?void 0:j(O(this.ctx,e),i);s!==void 0&&F(s).format===i&&delete n.format}return n}columnFormula(e,o,n){const i=new Map,s=n-o+1;for(let r=o;r<=n;r++){const l=this.byPlace.get(g(r,e));if(!l||l.value===void 0&&!l.node||l.value===null&&!l.node)return;if(!l.node)continue;l.key??=B(l.node,l.row,l.col);const c=i.get(l.key);c?c.n+=1:i.set(l.key,{n:1,cell:l})}let t;for(const r of i.values())(!t||r.n>t.n)&&(t=r);return t&&t.n*2>s?t.cell:void 0}table(e){const{read:o,ctx:n}=this,i=h=>n.lost.push(`${o.name}: table ${e.name} ${h}`),s=e.ref.right-e.ref.left+1,t=Y(e);if(t!==void 0)return i(`${t}, so its cells are kept and it is no table`),!1;const r=e.ref.top,l=r+1,c=e.ref.bottom-e.totals;e.totals>0&&i("has a totals row, kept as plain cells under it");const a=e.columns.map((h,m)=>c>=l?this.columnFormula(e.ref.left+m,l,c):void 0),u=h=>{const m=a[h];if(!m)return!1;for(let k=l;k<=c;k++)if(this.byPlace.get(g(k,e.ref.left+h))?.key!==m.key)return!1;return!0};let d=s;for(;d>1&&u(d-1);)d-=1;const w=[e.columns.slice(0,d).map(h=>h.name)],p={};for(let h=l;h<=c;h++){const m=[];for(let k=0;k<d;k++){const y=this.byPlace.get(g(h,e.ref.left+k)),v=a[k];y?v&&y.key===v.key?m.push(""):y.node?m.push(M(X(y.node,e.name))):m.push(this.text(y)):m.push("")}w.push(m)}for(let h=e.ref.top;h<=c;h++)for(let m=e.ref.left;m<=e.ref.right;m++)this.inTables.add(g(h,m));e.columns.forEach((h,m)=>{const k=e.ref.left+m,y=this.columnLook(k,l,c),v=a[m];v?.node&&(y.formula=M(X(re(v.node,l-v.row,0),e.name))),b(y)||(p[h.name]=y)});const L=this.path(e.name);n.files.set(L,I(w));const E=new Map;for(const[h,m]of e.filter?.columns??[]){const k=e.columns[h]?.name;k!==void 0&&E.set(k,m)}return(e.filter?.unread??0)>0&&i(`has ${V(e.filter?.unread??0,"filter")} by condition, its rows left as they were hidden`),this.tables.push({name:e.name,at:$({row:r,col:e.ref.left}),rows:L,...e.style!==void 0&&e.style!=="TableStyleMedium2"?{style:e.style}:{},...b(p)?{}:{columns:p},...e.filter===void 0?{filter:!1}:E.size>0?{filter:{columns:Object.fromEntries(E)}}:{}}),e.filter?.unread===0&&e.filter.columns.size>0&&this.filtered.push({...e.ref,bottom:c}),this.areas.push({...e.ref,bottom:c}),!0}columnLook(e,o,n){let i,s={};for(let t=o;t<=n;t++){const r=this.byPlace.get(g(t,e)),l=r?this.ownLook(r):{},c=JSON.stringify(l);if(i===void 0)i=c,s=l;else if(i!==c)return{}}if(b(s))return{};for(let t=o;t<=n;t++)this.lookDone.add(g(t,e));return{...s}}path(e){const o=`${G}/${me(e)}`;let n=`${o}.csv`;for(let i=2;this.ctx.files.has(n);i++)n=`${o}-${String(i)}.csv`;return n}loose(){const e=[],o=[];for(const n of this.read.cells)this.inTables.has(g(n.row,n.col))||(n.node?e.push(n):n.value!==void 0&&n.value!==null&&o.push(n));return{formulas:e,typed:o}}blockAreas(e,o){const n=new Map;e.forEach((a,u)=>n.set(g(a.row,a.col),u));const i=e.map((a,u)=>u),s=a=>{let u=a;for(;i[u]!==u;){const d=i[i[u]??u]??u;i[u]=d,u=d}return u};e.forEach((a,u)=>{for(const d of[n.get(g(a.row,a.col-1)),n.get(g(a.row-1,a.col))])d!==void 0&&(i[s(u)]=s(d))});const t=new Map;e.forEach((a,u)=>{const d=s(u),w=t.get(d);w?w.push(a):t.set(d,[a])});const r=[],l=a=>!r.some(u=>D(u,a))&&!this.areas.some(u=>D(u,a))&&!o.some(u=>A(a,u.row,u.col)),c=a=>(a.bottom-a.top+1)*(a.right-a.left+1);for(const a of t.values()){const u=be(a);if(!(c(u)<K)){if(a.length/c(u)>=he&&l(u)){r.push(u);continue}for(const d of _(a.map(C)))c(d)>=K&&l(d)&&r.push(d)}}return r.sort((a,u)=>a.top-u.top||a.left-u.left)}cells(e){const{formulas:o,typed:n}=this.loose(),i=this.blockAreas(n,o),s=l=>i.some(c=>A(c,l.row,l.col));i.length>0&&(e.blocks=i.map(l=>{const c=[];for(let u=l.top;u<=l.bottom;u++){const d=[];for(let w=l.left;w<=l.right;w++){const p=this.byPlace.get(g(u,w));d.push(p?this.text(p):"")}c.push(d)}const a=this.path(this.read.name);return this.ctx.files.set(a,I(c)),{at:$({row:l.top,col:l.left}),rows:a}}));const t=[],r=new Map;for(const l of o){if(!l.node)continue;l.key??=B(l.node,l.row,l.col);const c=r.get(l.key);c?c.push(l):r.set(l.key,[l])}for(const l of r.values())for(const c of _(l.map(C))){const a=this.byPlace.get(g(c.top,c.left));a?.node&&t.push([{row:c.top,col:c.left},x(c),M(a.node)])}for(const l of n)i.length>0&&s(l)||t.push([C(l),$(l),ke(O(this.ctx,l),this.code(l))]);t.sort(([l],[c])=>l.row-c.row||l.col-c.col),t.length>0&&(e.cells=Object.fromEntries(t.map(([,l,c])=>[l,c])))}formats(e){const o=new Map;for(const i of this.read.cells){if(this.lookDone.has(g(i.row,i.col)))continue;const s=this.ownLook(i);if(b(s))continue;const t=JSON.stringify(s),r=o.get(t);r?r.places.push(C(i)):o.set(t,{look:s,places:[C(i)]})}const n=[];for(const{look:i,places:s}of o.values())for(const t of _(s))n.push({range:x(t),...i});n.length>0&&(e.format=n)}columns(e){const{read:o}=this,n=new Map,i=o.cells.reduce((t,r)=>Math.max(t,r.col),0),s=[];for(const t of o.columns)if(!(t.width===void 0&&t.hidden!==!0)){t.max>i&&s.push(z(Math.max(t.min,i+1)));for(let r=t.min;r<=Math.min(t.max,i);r++)n.set(r,{...t.width===void 0?{}:{width:t.width},...t.hidden===!0?{hidden:!0}:{}})}for(const[t,r]of this.columnLooks)n.set(t,{...n.get(t),...r});n.size>0&&(e.columns=Object.fromEntries([...n.keys()].sort((t,r)=>t-r).map(t=>[z(t),n.get(t)??{}]))),s.some(Boolean)&&o.columns.some(t=>t.max>i&&t.hidden===!0)&&this.ctx.lost.push(`${o.name}: the size of the columns past its last used one`)}rows(e){const o={};for(const n of this.read.rows){const i=this.rowLooks.get(n.row),s=this.filtered.some(r=>n.row>r.top&&n.row<=r.bottom),t={...n.height===void 0?{}:{height:n.height},...n.hidden===!0&&!s?{hidden:!0}:{},...i};b(t)||(o[String(n.row+1)]=t)}b(o)||(e.rows=o)}build(){const{read:e}=this;this.baseLooks();for(const n of e.tables)this.table(n);const o={name:e.name};return e.state!=="visible"&&(o.hidden=!0),e.gridlines===!1&&(o.gridlines=!1),e.tab!==void 0&&(o.tab=e.tab),e.state==="veryHidden"&&this.ctx.lost.push(`${e.name}: being very hidden; it is hidden`),e.freeze&&(e.freeze.row>0||e.freeze.col>0)&&(o.freeze=$(e.freeze)),this.tables.length>0&&(o.tables=this.tables),this.filter(o),this.columns(o),this.rows(o),this.cells(o),e.merges.length>0&&(o.merges=e.merges.map(x)),this.formats(o),e.conditional.length>0&&(o.conditional=e.conditional),e.validations.length>0&&(o.validations=e.validations),e.charts.length>0&&(o.charts=e.charts.map(n=>this.chart(n))),o}chart(e){return te(e,o=>{const n=this.chartReference(o.replace(/^=/u,""));return o.startsWith("=")?`=${n}`:n})}chartReference(e){const o=e.lastIndexOf("!"),i=(o<0?this.read.name:e.slice(0,o)).replace(/^'|'$/gu,"").replaceAll("''","'"),s=ee(e.slice(o+1).replaceAll("$",""));if(!s)return e;const t=this.ctx.book.sheets.find(r=>r.name.toLowerCase()===i.toLowerCase());for(const r of t?.tables??[]){const l=r.ref.top+1,a=s.left===s.right&&s.top===l&&s.bottom===r.ref.bottom&&s.left>=r.ref.left&&s.left<=r.ref.right?r.columns[s.left-r.ref.left]:void 0;if(a&&this.ctx.tables.has(r.name.toLowerCase()))return`${r.name}[${a.name}]`}return`${t===this.read||o<0?"":`${e.slice(0,o)}!`}${x(s)}`}filter(e){const{filter:o}=this.read;if(!o)return;const n={};for(const[i,s]of o.columns)n[z(o.ref.left+i)]=s;e.filter={range:x(o.ref),...b(n)?{}:{columns:n}},o.unread===0&&!b(n)&&this.filtered.push(o.ref)}}function $e(f){const e={},{book:o,lost:n}=f,i=new Set(o.sheets.map(r=>r.name.toLowerCase())),s=new Set,t=new Set;for(const r of o.names){if(r.name.startsWith("_xlnm.")){r.name==="_xlnm.Print_Area"?t.add("print areas"):r.name==="_xlnm.Print_Titles"?t.add("print titles"):r.name!=="_xlnm._FilterDatabase"&&n.push(`Excel's name ${r.name}`);continue}if(/^_xl(?:fn|pm|ws|udf)/iu.test(r.name))continue;const l=r.name.toLowerCase();if(!R(r.name)||f.tables.has(l)){n.push(`the name ${r.name}, which cannot be held here`);continue}if(s.has(l)){n.push(`a second name ${r.name}, for one sheet: names here are the workbook's`);continue}const c=xe(r.text);if(c!==void 0)e[r.name]=typeof c=="string"?P(c):c,s.add(l),f.names.add(l);else{const a=ue(r.text,!0),u=a.ok?U(a.node,i):"it could not be read";if(!a.ok||u!==void 0||ve(a.node)){n.push(`the name ${r.name} (${r.text})${u===void 0?"":`: ${u}`}`);continue}e[r.name]=M(a.node),s.add(l),f.names.add(l)}r.sheet!==void 0&&n.push(`the name ${r.name} belonging to one sheet: here it is the workbook's`)}return t.size>0&&n.push([...t].join(" and ")),e}function Le(f,e){const o={},n=new Map;for(const[i,s]of Object.entries(e))typeof s=="string"&&s.startsWith("=")&&n.set(s.slice(1).replaceAll("$","").toLowerCase(),i);for(const i of f.book.sheets)for(const s of i.scenarios){const t={};let r=!0;for(const{at:l,value:c}of s.cells){const a=Z(l),u=a&&i.cells.find(p=>p.row===a.row&&p.col===a.col);String(u?.value??"")!==c&&(r=!1);const d=n.get(`${ie(i.name)}${l}`.toLowerCase())??n.get(l.toLowerCase()),w=F(c);d===void 0?f.lost.push(`${i.name}: scenario ${s.name}'s cell ${l}, which has no name`):t[d]=typeof w.value=="number"?w.value:c}!r&&!b(t)&&(o[s.name]={...o[s.name],...t})}return o}function ve(f){let e=!1;return N(f,o=>{e||=o.kind==="error"&&o.code==="#REF!"}),e}function xe(f){const e=f.trim();return/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/u.test(e)?Number(e):/^true$/iu.test(e)?!0:/^false$/iu.test(e)?!1:/^"((?:[^"]|"")*)"$/u.exec(e)?.[1]?.replaceAll('""','"')}const S=f=>f instanceof T?f.code:f??null;export function sameValue(f,e,o){if(typeof f=="number"&&typeof e=="number")return f===e?!0:Math.abs(f-e)<=Math.max(Math.abs(f),Math.abs(e))*o;if(f instanceof T||e instanceof T)return f?.code===e?.code;if(f===null||e===null){const n=f??e;return n===null||n===""||n===0||n===!1}return f===e}function Me(f,e){const o=[];for(const s of e.sheets)for(const t of s.formulas)t.shared.node&&oe(e,t.shared).volatile&&o.push(t);const n=new Set(o),i=[...o];for(;;){const s=i.pop();if(!s)return n;for(const t of f.readers(s.sheet,s.row,s.col))n.has(t)||(n.add(t),i.push(t))}}function Ce(f,e,o,n){const i={formulas:0,same:0,uncached:0,moving:0,differences:[]},s=Me(o,e);for(const[t,r]of f.carried){if(!t.node)continue;const l=e.sheet(r.name);if(!l)continue;i.formulas+=1;const c=l.at(t.row,t.col);if(c instanceof ae&&s.has(c)){i.moving+=1;continue}const a=O(f,t);if(a===void 0){i.uncached+=1;continue}const u=o.value(l,t.row,t.col);sameValue(a,u,n)?i.same+=1:i.differences.push({sheet:r.name,cell:$(t),formula:M(t.node),file:S(a),engine:S(u)})}for(const[t,r]of f.spilled){const l=e.sheet(r.name);if(!l)continue;i.formulas+=1;const c=l.spillAt(t.row,t.col);if(c&&s.has(c)){i.moving+=1;continue}const a=O(f,t),u=o.value(l,t.row,t.col);a===void 0?i.uncached+=1:sameValue(a,u,n)?i.same+=1:i.differences.push({sheet:r.name,cell:$(t),formula:c?`${$(c)}#`:"",file:S(a),engine:S(u)})}return i}function Oe(f,e){const o=new Map,n=[];for(const i of f){const s=e.find(l=>i.startsWith(`${l}: `));if(s===void 0){n.push(i);continue}const t=i.slice(s.length+2),r=o.get(t);r?r.push(s):o.set(t,[s])}for(const[i,s]of o)n.push(s.length===1?`${s[0]??""}: ${i}`:`${i}, on ${String(s.length)} sheets (${J(s)})`);return n}export function importXlsx(f,e){const o=de(f,e.zip);if(o.sheets.length===0)throw new Error("It holds no sheets.");const n={book:o,files:new Map,lost:[...o.lost],tables:new Set(o.sheets.flatMap(p=>p.tables.filter(L=>Y(L)===void 0).map(L=>L.name.toLowerCase()))),names:new Set,carried:new Map,spilled:new Map};o.date1904&&n.lost.push(`the 1904 date system: dates are moved to the 1900 one, ${String(q)} days on`),(o.font.name!==void 0&&o.font.name!=="Calibri"||o.font.size!==void 0&&o.font.size!==11)&&n.lost.push(`its default font, ${o.font.name??""} ${String(o.font.size??"")}`);const i=$e(n);pe(n);const s=o.sheets.map(p=>new ye(n,p).build()),t=Le(n,i),r={title:e.name,...b(i)?{}:{names:i},sheets:s,...b(t)?{}:{scenarios:t}},l=ce(r),c=new Map([[Q,l],...n.files]),a=se({text:l,read:p=>c.get(p)}),{workbook:u,calc:d,problems:w}=a;return{files:c,lost:Oe(n.lost,o.sheets.map(p=>p.name)),problems:w,compared:u&&d?Ce(n,u,d,e.tolerance??COMPARE_TOLERANCE):{formulas:0,same:0,uncached:0,moving:0,differences:[]},sheets:o.sheets.length,tables:n.tables.size}}
|
|
2
|
+
import{SHEET_DATA as re,SHEET_FILE as ie,SHEET_FILES as j,SHEET_NOTE_AUTHOR as le,SHEET_PICTURE_HEIGHT as P,SHEET_SEPARATOR as fe}from"@allyhub-next/formats";import{cellName as y,columnLetter as M,contains as T,overlaps as A,rangeName as v,readAddress as ae,readArea as W}from"../address.js";import{rectangles as O}from"../api/rectangles.js";import{chartAfter as ce}from"../chart.js";import{analyse as ue}from"../calc/analyse.js";import{FUNCTIONS as he}from"../calc/functions/index.js";import{checkWorkbook as de}from"../check.js";import{writeCsv as me}from"../csv.js";import{pictureSize as pe}from"../files.js";import{isDateCode as z}from"../format.js";import{moveFormula as we,relativeKey as B}from"../formula/move.js";import{printFormula as E,sheetPrefix as U}from"../formula/print.js";import{mapNode as ge,walk as H}from"../formula/walk.js";import{CellError as N,isoOfSerial as ke,readTyped as F,writeTyped as I}from"../values.js";import{FormulaCell as be,validName as V}from"../workbook.js";import{writeYaml as ye}from"../write.js";import{readFileFormula as $e}from"./formula.js";import{hasDate as q}from"./numfmt.js";import{placesLine as D,readXlsx as xe}from"./read.js";import{LISTS_SHEET as Le}from"./write.js";const J=100,ve=.5,K=1462,Z=64,X=1e4;export const COMPARE_TOLERANCE=1e-9;const Y=a=>a.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/gu,"")||"rows",k=a=>{for(const e in a)if(Object.hasOwn(a,e))return!1;return!0},G=(a,e)=>`${String(a)} ${e}${a===1?"":"s"}`,S=a=>({row:a.row,col:a.col});function Q(a){return a===""||a.length>255||/^[/\\]|^[A-Za-z]:|\\|\0/u.test(a)?!1:a.split("/").every(e=>e!==""&&e!=="."&&e!=="..")}class Ee{cells;starts;first;constructor(e){let o=!0;for(let t=1;t<e.length&&o;t++){const n=e[t-1],r=e[t];n&&r&&(r.row<n.row||r.row===n.row&&r.col<=n.col)&&(o=!1)}if(!o){e.sort((t,n)=>t.row-n.row||t.col-n.col);for(let t=e.length-1;t>0;t--){const n=e[t-1],r=e[t];r&&n?.row===r.row&&n.col===r.col&&e.splice(t-1,1)}}this.cells=e;const s=e[0]?.row??0,l=e[e.length-1]?.row??-1;this.first=s,this.starts=new Int32Array(Math.max(0,l-s+2));let i=0;for(let t=0;t<this.starts.length;t++){for(;i<e.length&&(e[i]?.row??0)<s+t;)i++;this.starts[t]=i}}get(e,o){const s=e-this.first;if(s<0||s>=this.starts.length-1)return;let l=this.starts[s]??0,i=(this.starts[s+1]??0)-1;for(;l<=i;){const t=l+i>>1,n=this.cells[t];if(!n)return;if(n.col===o)return n;n.col<o?l=t+1:i=t-1}}}class ee{list=[];add(e){this.list.push(e)}has(e,o){for(const s of this.list)if(T(s,e,o))return!0;return!1}}function te(a,e){const o=e.toLowerCase();return ge(a,s=>s.kind!=="structured"||s.table?.toLowerCase()!==o?s:Object.fromEntries(Object.entries(s).filter(([l])=>l!=="table")))}function oe(a){return a.headers===0?"has no header row":a.columns.length!==a.ref.right-a.ref.left+1||!V(a.name)?"cannot be held as a table":new Set(a.columns.map(e=>e.name.toLowerCase())).size===a.columns.length?void 0:"has two columns of one name"}function ne(a,e,o){let s;const l=new Set;H(a,t=>{t.kind==="call"&&(t.name==="LET"||t.name==="LAMBDA")&&t.args.forEach(n=>{n.kind==="name"&&l.add(n.name.toLowerCase())})});const i=t=>l.has(t)||o===void 0||o.names.has(t)||o.tables.has(t);return H(a,t=>{s===void 0&&(t.kind==="call"&&!he.has(t.name)&&(i(t.written.toLowerCase())||(s=`no function ${t.name}`)),t.kind==="name"&&!i(t.name.toLowerCase())&&(s=`no name ${t.name}`),t.kind==="structured"&&t.table!==void 0&&!i(t.table.toLowerCase())&&(s=`no table ${t.table}`),(t.kind==="ref"||t.kind==="name"||t.kind==="error")&&t.sheet!==void 0&&(t.sheet.startsWith("[")?s="it reads another workbook":e.has(t.sheet.toLowerCase())||(s=`no sheet ${t.sheet}`)))}),s}function Se(a){const e=new Set(a.book.sheets.map(o=>o.name.toLowerCase()));for(const o of a.book.sheets){const s=new Map,l=(t,n)=>{const r=s.get(n),f=y(t);r?r.push(f):s.set(n,[f])},i=[];for(const t of o.cells){if(t.unread!==void 0){l(t,/^\[|[!']\[|\[\d+\]/u.test(t.unread)?"it reads another workbook":`it could not be read: ${t.unread}`);continue}if(!t.node)continue;const n=ne(t.node,e,a);n!==void 0?(delete t.node,l(t,n)):(a.carried.set(t,o),t.array&&v(t.array)!==y(t)&&i.push(t))}Ce(a,o,i);for(const[t,n]of s)a.lost.push(`${o.name}: ${G(n.length,"formula")} kept as ${n.length===1?"its value":"their values"}, as ${t} (${D(n)})`)}}function Ce(a,e,o){if(o.length===0)return;const s=new Set;for(const l of o){const{array:i}=l;if(i)for(const t of e.cells)t!==l&&!t.node&&T(i,t.row,t.col)&&s.add(t)}e.cells=e.cells.filter(l=>!s.has(l));for(const l of s)a.spilled.set(l,e)}function C(a,e){const{value:o}=e;if(!a.book.date1904||typeof o!="number")return o;const s=a.book.looks[e.style]?.format;return z(s)&&s!==void 0&&q(s)?o+K:o}function R(a,e){if(typeof a!="number"||e===void 0||!z(e)||!q(e)||a<1)return;const o=ke(a);return F(o).value===a?o:void 0}const Me=(a,e)=>R(a,e)??I(a??null);function Oe(a,e){const o=R(a,e);return o!==void 0?o:a==null?null:typeof a=="number"||typeof a=="boolean"?a:I(a)}function _e(a){const e=[];for(let n=0;n<a.length;n++){const r=a[n];if(!r)continue;const f=e[e.length-1];f?.row===r.row&&f.right===r.col-1?(f.right=r.col,f.last=n):e.push({row:r.row,left:r.col,right:r.col,first:n,last:n})}const o=e.map((n,r)=>r),s=n=>{let r=n;for(;o[r]!==r;){const f=o[o[r]??r]??r;o[r]=f,r=f}return r};let l=0,i=0;for(let n=0;n<e.length;n++){const r=e[n];if(r){n>0&&e[n-1]?.row!==r.row&&(l=e[n-1]?.row===r.row-1?i:n,i=n);for(let f=l;f<i;f++){const c=e[f];c?.row===r.row-1&&c.right>=r.left&&c.left<=r.right&&(o[s(n)]=s(f))}}}const t=new Map;return e.forEach((n,r)=>{const f=s(r),c=t.get(f),u=n.right-n.left+1;c?(c.box.top=Math.min(c.box.top,n.row),c.box.bottom=Math.max(c.box.bottom,n.row),c.box.left=Math.min(c.box.left,n.left),c.box.right=Math.max(c.box.right,n.right),c.count+=u,c.runs.push(r)):t.set(f,{box:{top:n.row,bottom:n.row,left:n.left,right:n.right},count:u,runs:[r]})}),[...t.values()].map(n=>({box:n.box,count:n.count,cells:()=>n.runs.flatMap(r=>{const f=e[r];return f?a.slice(f.first,f.last+1):[]})}))}const se=a=>JSON.stringify(a);class Te{ctx;read;cells;inTables=new ee;columnLooks=new Map;rowLooks=new Map;lookDone=new ee;tables=[];areas=[];filtered=[];ownLooks=new Map;fileColumns=new Map;pictured=new Map;over=[];constructor(e,o){this.ctx=e,this.read=o,this.cells=new Ee(o.cells)}at(e,o){return this.cells.get(e,o)}look(e){return this.ctx.book.looks[e.style]??{}}code(e){return this.look(e).format}text(e){return e.node?E(e.node):Me(C(this.ctx,e),this.code(e))}baseLooks(){const{read:e}=this,{looks:o}=this.ctx.book;let s=-1;for(const i of e.cells)i.col>s&&(s=i.col);for(const i of e.columns){if(i.style===void 0)continue;const t=o[i.style];if(!(!t||k(t)))for(let n=i.min;n<=Math.min(i.max,s);n++)this.columnLooks.set(n,t)}for(const i of e.rows){const t=i.style===void 0?void 0:o[i.style];t&&!k(t)&&this.rowLooks.set(i.row,t)}const l=(i,t)=>{for(const n in t)if(!(n in i))return!1;return!0};for(const i of e.cells){const t=this.look(i),n=this.columnLooks.get(i.col);n&&!l(t,n)&&this.columnLooks.delete(i.col);const r=this.rowLooks.get(i.row);r&&!l(t,r)&&this.rowLooks.delete(i.row)}}ownLook(e){const o=this.columnLooks.get(e.col),s=this.rowLooks.get(e.row),l=this.look(e),i=l.format!==void 0&&z(l.format);if(!o&&!s&&!i){let f=this.ownLooks.get(e.style);return f||(f={look:l,key:se(l)},this.ownLooks.set(e.style,f)),f}const t={...o,...s},n={};for(const[f,c]of Object.entries(l))JSON.stringify(c)!==JSON.stringify(t[f])&&(n[f]=c);const r=n.format;if(typeof r=="string"){const f=e.node?void 0:R(C(this.ctx,e),r);f!==void 0&&F(f).format===r&&delete n.format}return{look:n,key:se(n)}}columnFormula(e,o,s){const l=new Map,i=s-o+1;for(let n=o;n<=s;n++){const r=this.at(n,e);if(!r||r.value===void 0&&!r.node||r.value===null&&!r.node)return;if(!r.node)continue;r.key??=B(r.node,r.row,r.col);const f=l.get(r.key);f?f.n+=1:l.set(r.key,{n:1,cell:r})}let t;for(const n of l.values())(!t||n.n>t.n)&&(t=n);return t&&t.n*2>i?t.cell:void 0}csv(e,o){const s=[];for(let l=0;l<e;l+=X){const i=[];for(let t=l;t<Math.min(e,l+X);t++)i.push(o(t));s.push(me(i))}return s.join("")}table(e){const{read:o,ctx:s}=this,l=p=>s.lost.push(`${o.name}: table ${e.name} ${p}`),i=e.ref.right-e.ref.left+1,t=oe(e);if(t!==void 0)return l(`${t}, so its cells are kept and it is no table`),!1;const n=e.ref.top,r=n+1,f=e.ref.bottom-e.totals;e.totals>0&&l("has a totals row, kept as plain cells under it");const c=e.columns.map((p,d)=>f>=r?this.columnFormula(e.ref.left+d,r,f):void 0),u=p=>{const d=c[p];if(!d)return!1;for(let g=r;g<=f;g++)if(this.at(g,e.ref.left+p)?.key!==d.key)return!1;return!0};let h=i;for(;h>1&&u(h-1);)h-=1;const w={},m=this.path(e.name);s.files.set(m,this.csv(f-r+2,p=>{if(p===0)return e.columns.slice(0,h).map(b=>b.name);const d=r+p-1,g=[];for(let b=0;b<h;b++){const x=this.at(d,e.ref.left+b),L=c[b];x?L&&x.key===L.key?g.push(""):x.node?g.push(E(te(x.node,e.name))):g.push(this.text(x)):g.push("")}return g})),this.inTables.add({...e.ref,bottom:f}),e.columns.forEach((p,d)=>{const g=e.ref.left+d,b=this.columnLook(g,r,f),x=c[d];x?.node&&(b.formula=E(te(we(x.node,r-x.row,0),e.name)));const L=this.fileColumns.get(g);L!==void 0&&r<=f&&(b.files=L===P?!0:{height:L}),k(b)||(w[p.name]=b)});const $=new Map;for(const[p,d]of e.filter?.columns??[]){const g=e.columns[p]?.name;g!==void 0&&$.set(g,d)}return(e.filter?.unread??0)>0&&l(`has ${G(e.filter?.unread??0,"filter")} by condition, its rows left as they were hidden`),this.tables.push({name:e.name,at:y({row:n,col:e.ref.left}),rows:m,...e.style!==void 0&&e.style!=="TableStyleMedium2"?{style:e.style}:{},...k(w)?{}:{columns:w},...e.filter===void 0?{filter:!1}:$.size>0?{filter:{columns:Object.fromEntries($)}}:{}}),e.filter?.unread===0&&e.filter.columns.size>0&&this.filtered.push({...e.ref,bottom:f}),this.areas.push({...e.ref,bottom:f}),!0}columnLook(e,o,s){let l,i={};for(let t=o;t<=s;t++){const n=this.at(t,e),r=n?this.ownLook(n):{look:{},key:"{}"};if(l===void 0)l=r.key,i=r.look;else if(l!==r.key)return{}}return k(i)?{}:(this.lookDone.add({top:o,bottom:s,left:e,right:e}),{...i})}path(e){const o=`${re}/${Y(e)}`;let s=`${o}.csv`;for(let l=2;this.ctx.files.has(s);l++)s=`${o}-${String(l)}.csv`;return s}loose(){const e=[],o=[];for(const s of this.read.cells)this.inTables.has(s.row,s.col)||(s.node?e.push(s):s.value!==void 0&&s.value!==null&&o.push(s));return{formulas:e,typed:o}}blockAreas(e,o){const s=[],l=O(o.map(S)),i=n=>!s.some(r=>A(r,n))&&!this.areas.some(r=>A(r,n))&&!l.some(r=>A(r,n)),t=n=>(n.bottom-n.top+1)*(n.right-n.left+1);for(const n of _e(e)){const{box:r}=n;if(!(t(r)<J)){if(n.count/t(r)>=ve&&i(r)){s.push(r);continue}for(const f of O(n.cells().map(S)))t(f)>=J&&i(f)&&s.push(f)}}return s.sort((n,r)=>n.top-r.top||n.left-r.left)}cells_(e){const{formulas:o,typed:s}=this.loose(),l=this.blockAreas(s,o),i=r=>l.some(f=>T(f,r.row,r.col));l.length>0&&(e.blocks=l.map(r=>{const f=this.path(this.read.name);return this.ctx.files.set(f,this.csv(r.bottom-r.top+1,c=>{const u=[];for(let h=r.left;h<=r.right;h++){const w=this.at(r.top+c,h);u.push(w?this.text(w):"")}return u})),{at:y({row:r.top,col:r.left}),rows:f}}));const t=[],n=new Map;for(const r of o){if(!r.node)continue;r.key??=B(r.node,r.row,r.col);const f=n.get(r.key);f?f.push(r):n.set(r.key,[r])}for(const r of n.values())for(const f of O(r.map(S))){const c=this.at(f.top,f.left);c?.node&&t.push([{row:f.top,col:f.left},v(f),E(c.node)])}for(const r of s)l.length>0&&i(r)||t.push([S(r),y(r),Oe(C(this.ctx,r),this.code(r))]);t.sort(([r],[f])=>r.row-f.row||r.col-f.col),t.length>0&&(e.cells=Object.fromEntries(t.map(([,r,f])=>[r,f])))}formats(e){const o=new Map,s=this.lookDone.list.length>0;for(const i of this.read.cells){if(s&&this.lookDone.has(i.row,i.col))continue;const t=this.ownLook(i);if(k(t.look))continue;const n=o.get(t.key);n?n.places.push(S(i)):o.set(t.key,{look:t.look,places:[S(i)]})}const l=[];for(const{look:i,places:t}of o.values())for(const n of O(t))l.push({range:v(n),...i});l.length>0&&(e.format=l)}columns(e){const{read:o}=this,s=new Map;let l=0;for(const t of o.cells)t.col>l&&(l=t.col);const i=[];for(const t of o.columns){if(t.width===void 0&&t.hidden!==!0&&t.level===void 0)continue;const n=t.max-Math.max(t.min,l+1)+1>Z?Math.max(l,t.min+Z-1):t.max;n<t.max&&i.push(`${M(n+1)}:${M(t.max)}`);for(let r=t.min;r<=n;r++)s.set(r,{...t.width===void 0?{}:{width:t.width},...t.hidden===!0?{hidden:!0}:{},...t.level===void 0?{}:{level:t.level}})}for(const[t,n]of this.columnLooks)s.set(t,{...s.get(t),...n});for(const[t,n]of this.fileColumns)this.tableColumn(t)||s.set(t,{...s.get(t),files:n===P?!0:{height:n}});s.size>0&&(e.columns=Object.fromEntries([...s.keys()].sort((t,n)=>t-n).map(t=>[M(t),s.get(t)??{}]))),i.length>0&&this.ctx.lost.push(`${o.name}: the size of columns ${D(i)}, past those that hold anything`)}tableColumn(e){return this.areas.some(o=>e>=o.left&&e<=o.right)}rows(e){const o={};for(const s of this.read.rows){const l=this.rowLooks.get(s.row),i=this.filtered.some(r=>s.row>r.top&&s.row<=r.bottom),t=s.height!==void 0&&this.pictured.get(s.row)!==s.height?s.height:void 0,n={...t===void 0?{}:{height:t},...s.hidden===!0&&!i?{hidden:!0}:{},...s.level===void 0?{}:{level:s.level},...l};k(n)||(o[String(s.row+1)]=n)}k(o)||(e.rows=o)}assetPath(e,o){const s=t=>{const n=this.ctx.assets.get(t);return!n||Ae(n,o.bytes)};if(e!==void 0&&Q(e)&&s(e))return e;const l=Y((o.name??"picture").replace(/\.[A-Za-z0-9]+$/u,""));let i=`${j}/${l}.${o.type}`;for(let t=2;!s(i);t++)i=`${j}/${l}-${String(t)}.${o.type}`;return i}pictures(){const e=this.over;for(const o of this.read.pictures){const s=this.at(o.row,o.col),l=typeof s?.value=="string"?s.value:"";if(o.y===void 0&&o.descr!==void 0&&Q(o.descr)&&l.split(fe).includes(o.descr)&&o.descr!==void 0){this.ctx.assets.set(o.descr,o.bytes),this.fileColumns.set(o.col,Math.max(this.fileColumns.get(o.col)??0,o.height)),this.pictured.set(o.row,Math.max(this.pictured.get(o.row)??0,o.height));continue}const t=this.assetPath(o.descr,o);this.ctx.assets.set(t,o.bytes);const n=pe(o.bytes),r=n?.width===o.width&&n.height===o.height;e.push({file:t,at:y({row:o.row,col:o.col}),...o.x===void 0?{}:{x:o.x},...o.y===void 0?{}:{y:o.y},...r?{}:{width:o.width,height:o.height}})}}build(){const{read:e}=this;this.baseLooks(),this.pictures();for(const s of e.tables)this.table(s);const o={name:e.name};return e.state!=="visible"&&(o.hidden=!0),e.gridlines===!1&&(o.gridlines=!1),e.tab!==void 0&&(o.tab=e.tab),e.state==="veryHidden"&&this.ctx.lost.push(`${e.name}: being very hidden; it is hidden`),e.freeze&&(e.freeze.row>0||e.freeze.col>0)&&(o.freeze=y(e.freeze)),this.tables.length>0&&(o.tables=this.tables),this.filter(o),this.columns(o),this.rows(o),this.cells_(o),e.merges.length>0&&(o.merges=e.merges.map(v)),this.formats(o),e.conditional.length>0&&(o.conditional=e.conditional),e.validations.length>0&&(o.validations=e.validations),e.charts.length>0&&(o.charts=e.charts.map(s=>this.chart(s))),this.over.length>0&&(o.pictures=this.over),k(e.links)||(o.links=e.links),e.notes.length>0&&(o.notes=Object.fromEntries(e.notes.map(s=>[s.ref,s.author===void 0||s.author===le?s.text:{text:s.text,author:s.author}]))),e.print&&(o.print=e.print),e.protect===!0&&(o.protect=!0),o}chart(e){return ce(e,o=>{const s=this.chartReference(o.replace(/^=/u,""));return o.startsWith("=")?`=${s}`:s})}chartReference(e){const o=e.lastIndexOf("!"),l=(o<0?this.read.name:e.slice(0,o)).replace(/^'|'$/gu,"").replaceAll("''","'"),i=W(e.slice(o+1).replaceAll("$",""));if(!i)return e;const t=this.ctx.book.sheets.find(n=>n.name.toLowerCase()===l.toLowerCase());for(const n of t?.tables??[]){const r=n.ref.top+1,c=i.left===i.right&&i.top===r&&i.bottom===n.ref.bottom&&i.left>=n.ref.left&&i.left<=n.ref.right?n.columns[i.left-n.ref.left]:void 0;if(c&&this.ctx.tables.has(n.name.toLowerCase()))return`${n.name}[${c.name}]`}return`${t===this.read||o<0?"":`${e.slice(0,o)}!`}${v(i)}`}filter(e){const{filter:o}=this.read;if(!o)return;const s={};for(const[l,i]of o.columns)s[M(o.ref.left+l)]=i;e.filter={range:v(o.ref),...k(s)?{}:{columns:s}},o.unread===0&&!k(s)&&this.filtered.push(o.ref)}}const Ae=(a,e)=>a.length===e.length&&a.every((o,s)=>o===e[s]),ze=new Set(["_xlnm._FilterDatabase","_xlnm.Print_Area","_xlnm.Print_Titles"]);function He(a){const e={},o=[],s=new Map,{book:l,lost:i}=a,t=new Set(l.sheets.map(f=>f.name.toLowerCase())),n=new Set,r=f=>{const c=Ie(f.text);if(c!==void 0)return typeof c=="string"?I(c):c;const u=$e(f.text,!0),h=u.ok?ne(u.node,t):"it could not be read";if(!u.ok||h!==void 0||Fe(u.node)){i.push(`the name ${f.name} (${f.text})${h===void 0?"":`: ${h}`}`);return}return E(u.node)};for(const f of l.names){if(f.name.startsWith("_xlnm.")){ze.has(f.name)||i.push(`Excel's name ${f.name}`);continue}if(/^_xl(?:fn|pm|ws|udf)/iu.test(f.name))continue;const c=f.name.toLowerCase(),u=f.sheet===void 0?"":String(f.sheet);if(!V(f.name)||a.tables.has(c)){i.push(`the name ${f.name}, which cannot be held here`);continue}if(n.has(`${u}|${c}`)){i.push(`a second name ${f.name}${u===""?"":` of ${l.sheets[f.sheet??0]?.name??""}`}`);continue}const h=r(f);if(h!==void 0)if(n.add(`${u}|${c}`),a.names.add(c),f.sheet===void 0)e[f.name]=h,f.hidden===!0&&o.push(f.name);else{const w=s.get(f.sheet)??{names:{},hidden:[]};w.names[f.name]=h,f.hidden===!0&&w.hidden.push(f.name),s.set(f.sheet,w)}}return{names:e,hidden:o,sheets:s}}function Ne(a,e){const o={},s=new Map;for(const[l,i]of Object.entries(e))typeof i=="string"&&i.startsWith("=")&&s.set(i.slice(1).replaceAll("$","").toLowerCase(),l);for(const l of a.book.sheets)for(const i of l.scenarios){const t={};let n=!0;for(const{at:r,value:f}of i.cells){const c=ae(r),u=c&&l.cells.find(m=>m.row===c.row&&m.col===c.col);String(u?.value??"")!==f&&(n=!1);const h=s.get(`${U(l.name)}${r}`.toLowerCase())??s.get(r.toLowerCase()),w=F(f);h===void 0?a.lost.push(`${l.name}: scenario ${i.name}'s cell ${r}, which has no name`):t[h]=typeof w.value=="number"?w.value:f}!n&&!k(t)&&(o[i.name]={...o[i.name],...t})}return o}function Fe(a){let e=!1;return H(a,o=>{e||=o.kind==="error"&&o.code==="#REF!"}),e}function Ie(a){const e=a.trim();return/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/u.test(e)?Number(e):/^true$/iu.test(e)?!0:/^false$/iu.test(e)?!1:/^"((?:[^"]|"")*)"$/u.exec(e)?.[1]?.replaceAll('""','"')}const De=new RegExp(`^${Le.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}(?: \\(\\d+\\))?$`,"u");function Re(a){const e=a.sheets.find(i=>i.state==="veryHidden"&&De.test(i.name));if(!e)return;const o=U(e.name).toLowerCase(),s=i=>{const t=i.replace(/^=/u,"");if(!t.toLowerCase().startsWith(o))return;const n=W(t.slice(o.length).replaceAll("$",""));if(!n||n.left!==n.right)return;const r=[];for(let f=n.top;f<=n.bottom;f++){const c=e.cells.find(u=>u.row===f&&u.col===n.left);r.push(typeof c?.value=="string"?c.value:"")}return r};for(const i of a.sheets)i.validations=i.validations.map(t=>{const[n]=t.formula??[],r=t.type==="list"&&typeof n=="string"?s(n):void 0;if(!r)return t;const f={...t,values:r};return delete f.formula,f});const l=a.sheets.indexOf(e);a.sheets=a.sheets.filter(i=>i!==e),a.names=a.names.flatMap(i=>i.sheet===void 0||i.sheet<l?[i]:i.sheet===l?[]:[{...i,sheet:i.sheet-1}])}const _=a=>a instanceof N?a.code:a??null;export function sameValue(a,e,o){if(typeof a=="number"&&typeof e=="number")return a===e?!0:Math.abs(a-e)<=Math.max(Math.abs(a),Math.abs(e))*o;if(a instanceof N||e instanceof N)return a?.code===e?.code;if(a===null||e===null){const s=a??e;return s===null||s===""||s===0||s===!1}return a===e}function je(a,e){const o=[];for(const i of e.sheets)for(const t of i.formulas)t.shared.node&&ue(e,t.shared,i).volatile&&o.push(t);const s=new Set(o),l=[...o];for(;;){const i=l.pop();if(!i)return s;for(const t of a.readers(i.sheet,i.row,i.col))s.has(t)||(s.add(t),l.push(t))}}function Pe(a,e,o,s){const l={formulas:0,same:0,uncached:0,moving:0,differences:[]},i=je(o,e);for(const[t,n]of a.carried){if(!t.node)continue;const r=e.sheet(n.name);if(!r)continue;l.formulas+=1;const f=r.at(t.row,t.col);if(f instanceof be&&i.has(f)){l.moving+=1;continue}const c=C(a,t);if(c===void 0){l.uncached+=1;continue}const u=o.value(r,t.row,t.col);sameValue(c,u,s)?l.same+=1:l.differences.push({sheet:n.name,cell:y(t),formula:E(t.node),file:_(c),engine:_(u)})}for(const[t,n]of a.spilled){const r=e.sheet(n.name);if(!r)continue;l.formulas+=1;const f=r.spillAt(t.row,t.col);if(f&&i.has(f)){l.moving+=1;continue}const c=C(a,t),u=o.value(r,t.row,t.col);c===void 0?l.uncached+=1:sameValue(c,u,s)?l.same+=1:l.differences.push({sheet:n.name,cell:y(t),formula:f?`${y(f)}#`:"",file:_(c),engine:_(u)})}return l}function We(a,e){const o=new Map,s=[];for(const l of a){const i=e.find(r=>l.startsWith(`${r}: `));if(i===void 0){s.push(l);continue}const t=l.slice(i.length+2),n=o.get(t);n?n.push(i):o.set(t,[i])}for(const[l,i]of o)s.push(i.length===1?`${i[0]??""}: ${l}`:`${l}, on ${String(i.length)} sheets (${D(i)})`);return s}export function importXlsx(a,e){const o=xe(a,e.zip);if(Re(o),o.sheets.length===0)throw new Error("It holds no sheets.");const s={book:o,files:new Map,assets:new Map,lost:[...o.lost],tables:new Set(o.sheets.flatMap(m=>m.tables.filter($=>oe($)===void 0).map($=>$.name.toLowerCase()))),names:new Set,carried:new Map,spilled:new Map};o.date1904&&s.lost.push(`the 1904 date system: dates are moved to the 1900 one, ${String(K)} days on`),(o.font.name!==void 0&&o.font.name!=="Calibri"||o.font.size!==void 0&&o.font.size!==11)&&s.lost.push(`its default font, ${o.font.name??""} ${String(o.font.size??"")}`);const l=He(s);Se(s);const i=o.sheets.map((m,$)=>{const p=new Te(s,m).build(),d=l.sheets.get($);return d&&!k(d.names)&&(p.names=d.names),d&&d.hidden.length>0&&(p.hidden_names=d.hidden),p}),t=Ne(s,l.names),n={title:o.title??e.name,...k(l.names)?{}:{names:l.names},...l.hidden.length>0?{hidden_names:l.hidden}:{},sheets:i,...k(t)?{}:{scenarios:t}},r=ye(n),f=new Map([[ie,r],...s.files]),c=de({text:r,read:m=>f.get(m),exists:m=>f.has(m)||s.assets.has(m)}),{workbook:u,calc:h,problems:w}=c;return{files:f,assets:s.assets,lost:We(s.lost,o.sheets.map(m=>m.name)),problems:w,compared:u&&h?Pe(s,u,h,e.tolerance??COMPARE_TOLERANCE):{formulas:0,same:0,uncached:0,moving:0,differences:[]},sheets:o.sheets.length,tables:s.tables.size}}
|