@allyhub/sdk 0.4.0 → 0.5.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/{node_modules → dist/node_modules}/@allyhub-next/audio/package.json +1 -1
- package/dist/node_modules/@allyhub-next/chart/dist/chart-xml.d.ts +31 -0
- package/dist/node_modules/@allyhub-next/chart/dist/chart-xml.js +3 -0
- package/{node_modules/@allyhub-next/slides-core → dist/node_modules/@allyhub-next/chart}/dist/chart.d.ts +26 -15
- package/dist/node_modules/@allyhub-next/chart/dist/chart.js +2 -0
- package/dist/node_modules/@allyhub-next/chart/dist/index.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/chart/dist/index.js +2 -0
- package/dist/node_modules/@allyhub-next/chart/package.json +14 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/reference.d.ts +0 -86
- package/dist/node_modules/@allyhub-next/formats/dist/data/reference.js +2 -0
- package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.d.ts +4908 -0
- package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.js +2 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/slides.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/formats/dist/data/slides.js +2 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/index.d.ts +1 -0
- package/dist/node_modules/@allyhub-next/formats/dist/index.js +2 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/items.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/items.js +2 -0
- package/dist/node_modules/@allyhub-next/formats/dist/schemas.d.ts +2146 -0
- package/dist/node_modules/@allyhub-next/formats/dist/schemas.js +2 -0
- package/dist/node_modules/@allyhub-next/formats/dist/strict.d.ts +28 -0
- package/dist/node_modules/@allyhub-next/formats/dist/strict.js +2 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/formats/package.json +1 -1
- package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/editor.d.ts +10 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/editor.js +1 -1
- package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/notes.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/notes.js +2 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/tools.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/tools.js +2 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/protocol/package.json +1 -1
- package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/lock.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/runtimes/dist/lock.js +2 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/runtimes.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/runtimes/dist/runtimes.js +4 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/package.json +1 -1
- package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/moire.d.ts +7 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/phone.d.ts +3 -1
- package/dist/node_modules/@allyhub-next/scenery/dist/phone.js +2 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/address.d.ts +32 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/address.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/capabilities.d.ts +23 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/capabilities.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/charts.d.ts +204 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/charts.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/code.d.ts +19 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/code.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/hint.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/hint.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/index.d.ts +7 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/index.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/rectangles.d.ts +4 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/rectangles.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/rules.d.ts +170 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/rules.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/styles.d.ts +117 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/styles.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/workbook.d.ts +323 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/workbook.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/arrange.d.ts +68 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/arrange.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.d.ts +21 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.d.ts +19 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.d.ts +152 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/aggregate.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/aggregate.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/criteria.d.ts +15 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/criteria.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/database.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/database.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/date.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/date.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.d.ts +69 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/distributions.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/distributions.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/finance.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/finance.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.d.ts +15 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/info.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/info.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/kernels.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/kernels.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/logical.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/logical.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/lookup.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/lookup.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/maths.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/maths.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/special.d.ts +29 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/special.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/text.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/text.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.d.ts +50 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/chart.d.ts +58 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/chart.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/check.d.ts +15 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/check.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/csv.d.ts +62 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/csv.js +12 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/diff.d.ts +64 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/diff.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/edit.d.ts +154 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/edit.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/export.d.ts +11 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/export.js +6 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/file.d.ts +19 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/file.js +3 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/files.d.ts +24 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/files.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/fill.d.ts +30 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/fill.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/filter.d.ts +29 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/filter.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/format.d.ts +9 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/format.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/formula/ast.d.ts +113 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/formula/ast.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/formula/move.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/formula/move.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/formula/parse.d.ts +4 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/formula/parse.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/formula/print.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/formula/print.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/formula/rewrite.d.ts +65 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/formula/rewrite.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/formula/walk.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/formula/walk.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/generated.d.ts +46 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/generated.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/html.d.ts +34 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/html.js +20 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/import.d.ts +11 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/import.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/index.d.ts +38 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/index.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/inspect.d.ts +25 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/inspect.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/patch.d.ts +4 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/patch.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/profile.d.ts +30 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/profile.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/rules.d.ts +56 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/rules.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/scenario.d.ts +42 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/scenario.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/series.d.ts +10 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/series.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/sort.d.ts +24 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/sort.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/structure.d.ts +38 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/structure.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/validate.d.ts +26 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/validate.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/values.d.ts +67 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/values.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/workbook.d.ts +315 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/workbook.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/write.d.ts +5 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/write.js +21 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.d.ts +42 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/colors.d.ts +19 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/colors.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.d.ts +21 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.js +4 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.d.ts +5 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.js +17 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.d.ts +44 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/index.d.ts +5 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/index.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/numfmt.d.ts +8 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/numfmt.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.d.ts +117 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.d.ts +23 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/theme.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/theme.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.d.ts +17 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/xml.d.ts +28 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/xml.js +3 -0
- package/dist/node_modules/@allyhub-next/sheet/package.json +21 -0
- package/dist/node_modules/@allyhub-next/slides-core/LICENSE +241 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/chart-api.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.js +2 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/chart-file.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/chart-file.js +2 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/index.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/index.js +2 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/model.d.ts +2 -5
- package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/resolve.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/strict.d.ts +7 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/strict.js +2 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub-next/video-core/LICENSE +241 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/fact.d.ts +8 -2
- package/dist/node_modules/@allyhub-next/video-core/dist/fact.js +2 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/formats.d.ts +0 -28
- package/dist/node_modules/@allyhub-next/video-core/dist/formats.js +2 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/measure.d.ts +10 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/measure.js +5 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/problem.d.ts +5 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/problem.js +2 -0
- package/{node_modules → dist/node_modules}/@allyhub-next/video-core/package.json +1 -1
- package/dist/phone.js +1 -1
- package/dist/sheets.d.ts +2 -0
- package/dist/sheets.js +2 -0
- package/docs/README.md +2 -2
- package/docs/defaults.md +1 -0
- package/docs/project.md +1 -1
- package/docs/scenery.md +1 -1
- package/docs/sheets.md +377 -84
- package/docs/slides.md +1 -1
- package/docs/speech.md +1 -1
- package/package.json +11 -19
- package/node_modules/@allyhub-next/formats/dist/data/reference.js +0 -2
- package/node_modules/@allyhub-next/formats/dist/data/sheet.d.ts +0 -214
- package/node_modules/@allyhub-next/formats/dist/data/sheet.js +0 -2
- package/node_modules/@allyhub-next/formats/dist/data/slides.js +0 -2
- package/node_modules/@allyhub-next/formats/dist/index.js +0 -2
- package/node_modules/@allyhub-next/formats/dist/items.js +0 -2
- package/node_modules/@allyhub-next/formats/dist/schemas.d.ts +0 -719
- package/node_modules/@allyhub-next/formats/dist/schemas.js +0 -2
- package/node_modules/@allyhub-next/protocol/dist/notes.js +0 -2
- package/node_modules/@allyhub-next/protocol/dist/tools.js +0 -2
- package/node_modules/@allyhub-next/runtimes/dist/lock.js +0 -2
- package/node_modules/@allyhub-next/runtimes/dist/runtimes.js +0 -3
- package/node_modules/@allyhub-next/runtimes/pins/exceljs/package-lock.json +0 -2533
- package/node_modules/@allyhub-next/runtimes/pins/exceljs/package.json +0 -8
- package/node_modules/@allyhub-next/scenery/dist/phone.js +0 -2
- package/node_modules/@allyhub-next/slides-core/dist/chart-api.js +0 -2
- package/node_modules/@allyhub-next/slides-core/dist/chart-file.js +0 -2
- package/node_modules/@allyhub-next/slides-core/dist/chart.js +0 -2
- package/node_modules/@allyhub-next/slides-core/dist/index.js +0 -2
- package/node_modules/@allyhub-next/slides-core/dist/strict.d.ts +0 -23
- package/node_modules/@allyhub-next/slides-core/dist/strict.js +0 -2
- package/node_modules/@allyhub-next/video-core/dist/fact.js +0 -2
- package/node_modules/@allyhub-next/video-core/dist/formats.js +0 -2
- package/node_modules/@allyhub-next/video-core/dist/measure.js +0 -5
- package/node_modules/@allyhub-next/video-core/dist/problem.js +0 -2
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/LICENSE +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/at-cut.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/at-cut.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/decode.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/decode.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/envelope.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/envelope.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/index.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/index.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/levels.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/levels.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/master.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/master.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/music.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/music.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/decode.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/decode.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/ebur128.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/ebur128.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/ffmpeg.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/ffmpeg.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/index.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/index.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/loudness.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/loudness.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/master.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/master.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/measure.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/measure.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/mix.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/node/mix.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/plan.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/plan.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recorded.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recorded.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/bandwidth.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/bandwidth.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/chain.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/chain.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/dynamics.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/dynamics.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/fft.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/fft.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/filters.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/filters.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/fit.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/fit.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/index.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/index.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/loudness.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/loudness.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/measure.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/measure.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/mic.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/mic.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/noise.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/noise.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/presets.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/presets.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/room.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/room.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/setup.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/setup.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/vec.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/recording/vec.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/render.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/render.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/sfx.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/sfx.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/shape.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/shape.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/voice.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/audio/dist/voice.js +0 -0
- /package/{node_modules/@allyhub-next/formats → dist/node_modules/@allyhub-next/chart}/LICENSE +0 -0
- /package/{node_modules/@allyhub-next/protocol → dist/node_modules/@allyhub-next/formats}/LICENSE +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/comments.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/comments.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/config.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/config.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/edits.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/edits.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/elements.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/elements.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/faces.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/faces.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/file.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/file.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/gen.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/gen.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/messages.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/messages.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/script.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/script.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/words.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/data/words.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/layout.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/layout.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/note-shape.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/formats/dist/note-shape.js +0 -0
- /package/{node_modules/@allyhub-next/runtimes → dist/node_modules/@allyhub-next/protocol}/LICENSE +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/app.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/app.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/auth.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/auth.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/cli.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/cli.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/cloud.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/cloud.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/files.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/files.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/index.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/index.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/jsonrpc.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/jsonrpc.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/registry.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/registry.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/routes.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/routes.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/runtimes.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/runtimes.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/teams.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/protocol/dist/teams.js +0 -0
- /package/{node_modules/@allyhub-next/scenery → dist/node_modules/@allyhub-next/runtimes}/LICENSE +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/bundled.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/bundled.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/download.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/download.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/errors.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/errors.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/home.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/home.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/index.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/index.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/manifest.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/manifest.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/node-program.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/node-program.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/packages.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/packages.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/unpack.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/dist/unpack.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/manifest.json +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/pins/docx/package-lock.json +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/pins/docx/package.json +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/pins/gltf-tools/package-lock.json +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/pins/gltf-tools/package.json +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/pins/manifold-3d/package-lock.json +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/pins/manifold-3d/package.json +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/pins/onnxruntime-node/package-lock.json +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/pins/onnxruntime-node/package.json +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/pins/sherpa-onnx-node/package-lock.json +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/pins/sherpa-onnx-node/package.json +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/pins/tesseract.js/package-lock.json +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/pins/tesseract.js/package.json +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/runtimes/schemas/runtimes.schema.json +0 -0
- /package/{node_modules/@allyhub-next/slides-core → dist/node_modules/@allyhub-next/scenery}/LICENSE +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/NOTICE +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/aim.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/aim.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/bake.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/bake.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/camera.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/camera.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/curve.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/curve.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/define.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/define.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/fit.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/fit.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/glass.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/glass.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/handheld.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/handheld.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/hull.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/hull.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/index.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/index.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/lens.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/lens.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/moire.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/motion.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/motion.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/move.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/move.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/noise.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/noise.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/report.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/report.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/screen-focus.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/screen-focus.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/screen.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/screen.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/solve.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/solve.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/timing.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/timing.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/vec.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/scenery/dist/vec.js +0 -0
- /package/{node_modules/@allyhub-next/video-core → dist/node_modules/@allyhub-next/sheet}/LICENSE +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/animation.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/animation.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/api.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/api.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/capabilities.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/capabilities.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/check.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/check.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/enums.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/enums.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/file.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/file.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/measure.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/measure.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/model.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/office.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/office.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/path.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/path.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/placeholders.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/placeholders.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/resolve.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/script.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/script.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/stage.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/stage.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/theme.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/theme.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/units.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/slides-core/dist/units.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/anchors.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/anchors.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/audio-types.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/audio-types.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/backdrop.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/backdrop.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/captions.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/captions.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/console.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/console.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/contrast.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/contrast.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/cut-report.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/cut-report.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/edit.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/edit.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/edits.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/edits.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/export.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/export.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/footage-motion.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/footage-motion.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/gen.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/gen.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/index.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/index.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/look.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/look.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/marks.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/marks.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/matrix.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/matrix.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/media.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/media.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/messages.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/messages.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/motion.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/motion.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/music.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/music.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/piece.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/piece.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/placement.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/placement.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/render-types.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/render-types.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/schema.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/schema.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/script-edit.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/script-edit.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/script.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/script.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/seams.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/seams.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/sound-under.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/sound-under.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/speech.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/speech.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/timeline.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/timeline.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/timing.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/timing.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/transcript.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/transcript.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/transition.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/transition.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/voice.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/voice.js +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/words.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@allyhub-next/video-core/dist/words.js +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{SHEET_DATA as H,SHEET_FILE as z,strict as g}from"@allyhub-next/formats";import{columnIndex as E,columnLetter as N,cellName as C,contains as L,rangeName as x,readAddress as b,readArea as k}from"../address.js";import{Calc as U}from"../calc/engine.js";import{checkWorkbook as G}from"../check.js";import{readCsv as V,writeCsv as Y}from"../csv.js";import{GENERATED as q}from"../generated.js";import{moveFormula as Q,relativeKey as X}from"../formula/move.js";import{parseFormula as F}from"../formula/parse.js";import{printFormula as A}from"../formula/print.js";import{rewriteFormula as Z}from"../formula/rewrite.js";import{isDateCode as S}from"../format.js";import{patchCsv as ee}from"../patch.js";import{CellError as P,dateOfSerial as te,isoOfSerial as se,readTyped as M,serialOfDate as oe,writeTyped as ne}from"../values.js";import{FormulaCell as re,readWorkbook as B,validName as W}from"../workbook.js";import{restructure as ie,tableShape as le}from"../structure.js";import{patchYaml as ae}from"../write.js";import{anchorOf as he,chartOfSpec as fe}from"./charts.js";import{HINT as w}from"./hint.js";import{rectangles as T}from"./rectangles.js";import{AutoFilter as I,ConditionalFormattingList as ce,DataValidationList as ue,validationOf as _e,validationSpec as de}from"./rules.js";import{alignmentLook as me,alignmentOf as pe,borderLook as we,borderOf as ge,fillLook as ke,fillOf as ye,fontLook as be,fontOf as ve}from"./styles.js";const K=()=>process.getBuiltinModule("node:fs"),$=(...l)=>process.getBuiltinModule("node:path").join(...l);export const BLOCK_CELLS=100;const xe=l=>Math.round(l*7+5),Ee=l=>(l-5)/7,Se=l=>l*4/3,$e=l=>l*3/4;function Ce(l,e){const t={},s=l,o=e;for(const n of new Set([...Object.keys(s),...Object.keys(o)])){const r=o[n];JSON.stringify(r??!1)!==JSON.stringify(s[n]??!1)&&(t[n]=r??!1)}return t}const p=l=>Object.keys(l).length===0,y=(l,e)=>{if(!Number.isInteger(l)||l<1)throw new RangeError(`A ${e} is a whole number from 1: ${String(l)}.`);return l},j=(l,e)=>Object.fromEntries(Object.entries(l).filter(([t])=>t!==e));export class Cell{row;column;_ws;_value;_formula=void 0;_look;_changed=!1;_styled=!1;_fresh=!1;constructor(e,t,s){this._ws=e,this.row=t,this.column=s;const o=t-1,n=s-1,r=e._model?.at(o,n);return this._value=null,r instanceof re?this._formula=r.text:r!==void 0&&(this._value=r),this._look=e._model?.lookAt(o,n)??{},this._fresh=r===void 0,g(this,"Cell",w)}get parent(){return this._ws}get coordinate(){return C({row:this.row-1,col:this.column-1})}get column_letter(){return N(this.column-1)}get col_idx(){return this.column}get value(){return this._ws.parent.data_only?this.computed:this._formula!==void 0?this._formula:this._shown(this._value)}set value(e){if(e===void 0)throw new TypeError(`${this.coordinate}: a value is not undefined.`);if(this._formula=void 0,this._changed=!0,this._ws.parent._pending=!0,e instanceof Date){if(Number.isNaN(e.getTime()))throw new TypeError(`${this.coordinate}: the date is not valid.`);this._value=oe(e),S(this._look.format)||(this._look={...this._look,format:Number.isInteger(this._value)?"yyyy-mm-dd":"yyyy-mm-dd hh:mm"});return}if(typeof e=="string"&&e.length>1&&e.startsWith("=")){this._formula=e,this._value=null;return}this._value=e}_shown(e){return typeof e=="number"&&S(this._look.format)?te(e)??e:e instanceof P?e.code:e}get computed(){const{calc:e,model:t}=this._ws.parent._computed(),s=t.sheet(this._ws.title);return s?this._shown(e.value(s,this.row-1,this.column-1)):null}get data_type(){if(this._formula!==void 0)return"f";const e=this._value;return e===null?"n":typeof e=="number"?S(this._look.format)?"d":"n":typeof e=="boolean"?"b":e instanceof P?"e":"s"}get is_date(){return this.data_type==="d"}get number_format(){return this._look.format??"General"}set number_format(e){this._setLook({format:e})}_setLook(e){this._look={...this._look,...e},this._styled=!0,this._ws.parent._pending=!0}get font(){return ve(this._look)}set font(e){this._setLook(be(e))}get fill(){return ye(this._look)}set fill(e){this._setLook(ke(e))}get border(){return ge(this._look)}set border(e){this._setLook(we(e))}get alignment(){return pe(this._look)}set alignment(e){this._setLook(me(e))}get has_style(){return!p(this._look)}offset(e=0,t=0){return this._ws.cell(this.row+e,this.column+t)}}export class ColumnDimension{index;_width;_hidden;_files;_ws;constructor(e,t){this._ws=e,this.index=t;const s=e._spec()?.columns?.[t];return this._width=s?.width,this._hidden=s?.hidden,this._files=s?.files,g(this,"ColumnDimension",w)}get files(){return this._files}set files(e){this._files=e,this._ws._dimensions=!0}get width(){return this._width===void 0?void 0:Ee(this._width)}set width(e){this._width=e===void 0?void 0:xe(e),this._ws._dimensions=!0}get hidden(){return this._hidden??!1}set hidden(e){this._hidden=e,this._ws._dimensions=!0}}export class RowDimension{index;_height;_hidden;_ws;constructor(e,t){this._ws=e,this.index=t;const s=e._spec()?.rows?.[String(t)];return this._height=s?.height,this._hidden=s?.hidden,g(this,"RowDimension",w)}get height(){return this._height===void 0?void 0:$e(this._height)}set height(e){this._height=e===void 0?void 0:Se(e),this._ws._dimensions=!0}get hidden(){return this._hidden??!1}set hidden(e){this._hidden=e,this._ws._dimensions=!0}}export class Table{displayName;ref;key;_spec;autoFilter;constructor(e){for(const t of Object.keys(e))if(!["displayName","ref","key"].includes(t))throw new TypeError(`Table takes displayName, ref and key; it has no ${t}. ${w}`);if(!W(e.displayName))throw new TypeError(`${e.displayName} cannot be a table's name.`);if(!k(e.ref))throw new TypeError(`${e.ref} is not a range.`);return this.displayName=e.displayName,this.ref=e.ref,this.key=e.key,this.autoFilter=new I(e.ref,()=>{}),g(this,"Table",w)}get name(){return this.displayName}}export class TableList{_items=new Map;constructor(){return g(this,"TableList",w,{key:e=>this._items.get(e)})}add(e){this._items.set(e.name,e)}get(e){return this._items.get(e)}keys(){return[...this._items.keys()]}values(){return[...this._items.values()]}items(){return[...this._items.entries()]}pop(e){const t=this._items.get(e);return this._items.delete(e),t}}export class DefinedName{name;attr_text;constructor(e,t){if(!W(e))throw new TypeError(`${e} cannot be a name.`);return this.name=e,this.attr_text=t.attr_text.replace(/^=/u,""),g(this,"DefinedName",w)}get value(){return this.attr_text}set value(e){this.attr_text=e.replace(/^=/u,"")}}export class DefinedNameDict{_items=new Map;constructor(){return g(this,"DefinedNameDict",w,{key:e=>this._items.get(e),setKey:(e,t)=>t instanceof DefinedName?(this._items.set(e,t),!0):!1})}add(e){this._items.set(e.name,e)}get(e){return this._items.get(e)}keys(){return[...this._items.keys()]}values(){return[...this._items.values()]}items(){return[...this._items.entries()]}pop(e){const t=this._items.get(e);return this._items.delete(e),t}}const v=l=>{if(l._formula!==void 0)return l._formula;const e=l._value;return typeof e=="number"&&S(l._look.format)?se(e):ne(e)};function J(l){if(l._formula!==void 0)return l._formula;const e=l._value;return e===null?null:typeof e=="number"&&!S(l._look.format)||typeof e=="boolean"?e:v(l)}const Te=l=>l.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/gu,"")||"rows";export class Worksheet{_parent;_title;_was;_model;_cells=new Map;_columns=new Map;_rows=new Map;_tables=new TableList;_freeze;_merges=[];_state="visible";_dimensions=!1;_lastRow=0;_rules=[];_validations=[];_filter;_charts=[];constructor(e,t,s){if(this._parent=e,this._title=t,this._filter=new I(void 0,()=>{this._parent._pending=!0}),s){this._model=s,this._was=t,this._freeze=s.spec.freeze,this._merges=[...s.spec.merges??[]],this._state=s.spec.hidden===!0?"hidden":"visible",this._lastRow=(s.used?.bottom??-1)+1,this._heldRules(s.spec);for(const o of s.tables){const n=new Table({displayName:o.name,ref:x(o.area),...o.spec.key===void 0?{}:{key:o.spec.key}});n._spec=o.spec;const{filter:r}=o.spec;if(r)for(const[a,f]of Object.entries(r.columns)){const u=o.column(a);u&&n.autoFilter._columns.set(u.index,f)}this._tables.add(n)}}return g(this,"Worksheet",w,{index:o=>this._rowCells(o),key:o=>this._at(o),setKey:(o,n)=>{const r=b(o);return r?(this.cell(r.row+1,r.col+1).value=n,!0):!1}})}_spec(){return this._parent._file.sheets.find(e=>e.name===(this._was??this._title))}_heldRules(e){this._rules=[...e?.conditional??[]],this._validations=(e?.validations??[]).map(_e),this._charts=(e?.charts??[]).map(fe),this._filter.ref=e?.filter?.range,this._filter._columns.clear();const t=e?.filter?k(e.filter.range):void 0;for(const[s,o]of Object.entries(e?.filter?.columns??{})){const n=E(s);t&&n!==void 0&&this._filter._columns.set(n-t.left,o)}}_at(e){const t=b(e);if(t)return this.cell(t.row+1,t.col+1);const s=k(e);if(s)return this._area(s);const o=E(e);if(o!==void 0){const n=[];for(let r=1;r<=this.max_row;r++)n.push(this.cell(r,o+1));return n}}_rowCells(e){const t=[];for(let s=1;s<=this.max_column;s++)t.push(this.cell(e,s));return t}_area(e){const t=[];for(let s=e.top;s<=e.bottom;s++){const o=[];for(let n=e.left;n<=e.right;n++)o.push(this.cell(s+1,n+1));t.push(o)}return t}get parent(){return this._parent}get title(){return this._title}set title(e){const t=this._title;e!==t&&this._parent._renameSheet(this,t,e)}get sheet_state(){return this._state}set sheet_state(e){this._state=e}cell(e,t,s){if(e<1||t<1)throw new RangeError(`Row and column values must be at least 1: ${String(e)}, ${String(t)}.`);const o=(e-1)*16384+t-1;let n=this._cells.get(o);return n||(n=new Cell(this,e,t),this._cells.set(o,n)),s!==void 0&&(n.value=s),e>this._lastRow&&(this._lastRow=e),n}append(e){const t=this._lastRow+1,s=(o,n)=>{n!=null&&this.cell(t,o,n)};if(Array.isArray(e))e.forEach((o,n)=>{s(n+1,o)});else for(const[o,n]of Object.entries(e)){const r=/^\d+$/u.test(o)?Number(o)-1:E(o);if(r===void 0)throw new TypeError(`${o} is not a column.`);s(r+1,n)}this._lastRow=t}get max_row(){return Math.max(1,this._lastRow)}get max_column(){let e=this._model?.columnsUsed??0;for(const t of this._cells.values())(t._value!==null||t._formula!==void 0)&&t.column>e&&(e=t.column);return Math.max(1,e)}min_row=1;min_column=1;get dimensions(){return x({top:0,left:0,bottom:this.max_row-1,right:this.max_column-1})}iter_rows(e={}){const t=this._area({top:(e.min_row??1)-1,left:(e.min_col??1)-1,bottom:(e.max_row??this.max_row)-1,right:(e.max_col??this.max_column)-1});return e.values_only===!0?t.map(s=>s.map(o=>o.value)):t}iter_cols(e={}){const t=this.iter_rows(e);return(t[0]??[]).map((o,n)=>t.map(r=>r[n]))}get rows(){return this.iter_rows()}get columns(){return this.iter_cols()}get values(){return this.iter_rows({values_only:!0})}insert_rows(e,t=1){this._parent._restructure({op:"insert-rows",sheet:this._title,at:y(e,"row")-1,count:y(t,"amount")})}delete_rows(e,t=1){this._parent._restructure({op:"delete-rows",sheet:this._title,at:y(e,"row")-1,count:y(t,"amount")})}insert_cols(e,t=1){this._parent._restructure({op:"insert-columns",sheet:this._title,at:y(e,"column")-1,count:y(t,"amount")})}delete_cols(e,t=1){this._parent._restructure({op:"delete-columns",sheet:this._title,at:y(e,"column")-1,count:y(t,"amount")})}merge_cells(e){if(!k(e))throw new TypeError(`${e} is not a range.`);this._merges.includes(e)||this._merges.push(e),this._parent._pending=!0}unmerge_cells(e){this._merges=this._merges.filter(t=>t!==e),this._parent._pending=!0}get merged_cells(){return[...this._merges]}get freeze_panes(){return this._freeze}set freeze_panes(e){const t=e instanceof Cell?e.coordinate:e;if(t!==void 0&&!b(t))throw new TypeError(`${t} is not a cell.`);this._freeze=t,this._parent._pending=!0}get column_dimensions(){return new Proxy({},{get:(e,t)=>{if(typeof t!="string")return;const s=t.toUpperCase();if(E(s)===void 0)throw new TypeError(`${t} is not a column.`);let o=this._columns.get(s);return o||(o=new ColumnDimension(this,s),this._columns.set(s,o)),o}})}get row_dimensions(){return new Proxy({},{get:(e,t)=>{if(typeof t!="string"||!/^[1-9]\d*$/u.test(t))throw new TypeError(`${String(t)} is not a row.`);const s=Number(t);let o=this._rows.get(s);return o||(o=new RowDimension(this,s),this._rows.set(s,o)),o}})}get tables(){return this._tables}get conditional_formatting(){return new ce(this._rules,()=>{this._parent._pending=!0})}get data_validations(){return new ue(this._validations,()=>{this._parent._pending=!0})}add_data_validation(e){this._validations.push(e),this._parent._pending=!0}get auto_filter(){return this._filter}add_chart(e,t){e.anchor=he(t)??e.anchor,this._charts.push(e),this._parent._pending=!0}add_table(e){if(this._parent._tableNamed(e.name))throw new Error(`There is already a table named ${e.name}.`);this._tables.add(e),this._parent._pending=!0}}export class Workbook{worksheets=[];defined_names=new DefinedNameDict;data_only;title;path;block_cells=BLOCK_CELLS;_file={sheets:[]};_text="";_disk={text:"",csv:new Map};_csv=new Map;_model;_names=new Map;_active=0;_pending=!1;_making=!1;_calc=void 0;constructor(e={}){this.data_only=e.data_only??!1;const t=g(this,"Workbook",w,{key:s=>this.worksheets.find(o=>o.title===s),index:s=>this.worksheets[s]});return t.worksheets=[new Worksheet(t,"Sheet")],t}static open(e,t={}){const s=new Workbook(t);return s.path=e,s._read(e),s}_read(e){const{readFileSync:t}=K(),s=t($(e,z),"utf8"),o=new Map,n=r=>{try{const a=t($(e,r),"utf8");return o.set(r,a),a}catch{return}};this._load(s,n);for(const[r,a]of o)this._keepCsv(r,a);this._disk={text:s,csv:o}}_keepCsv(e,t){const s=V(t);this._csv.set(e,{parsed:s,rows:s.records.map(o=>o.end===o.start?[]:[...o.fields])})}_load(e,t){const{workbook:s,problems:o}=B({text:e,read:t});if(!s)throw new Error(`sheet.yaml cannot be opened: ${o.map(n=>n.message).join("; ")}`);this._text=e,this._file=structuredClone(s.file),this._model=s,this.title=s.title,this.worksheets=s.sheets.map(n=>new Worksheet(this,n.name,n));for(const n of s.names.values()){if(n.source.path?.[0]!=="names")continue;const r=n.formula?n.formula.text:n.value??null;this._names.set(n.name,r),this.defined_names.add(new DefinedName(n.name,{attr_text:String(r)}))}}get active(){const e=this.worksheets[this._active]??this.worksheets[0];if(!e)throw new Error("The workbook has no sheets.");return e}set active(e){this._active=this.worksheets.indexOf(e)}get sheetnames(){return this.worksheets.map(e=>e.title)}get_sheet_by_name(e){return this.worksheets.find(t=>t.title===e)}index(e){return this.worksheets.indexOf(e)}create_sheet(e,t){let s=e??"Sheet";for(let n=1;this.worksheets.some(r=>r.title===s);n++)s=`${e??"Sheet"}${String(n)}`;const o=new Worksheet(this,s);return this.worksheets.splice(t??this.worksheets.length,0,o),this._pending=!0,o}remove(e){this.worksheets=this.worksheets.filter(t=>t!==e),this._pending=!0}move_sheet(e,t=0){const s=this.worksheets.indexOf(e);this.worksheets.splice(s,1),this.worksheets.splice(s+t,0,e),this._pending=!0}_tableNamed(e){for(const t of this.worksheets){const s=t._tables.get(e);if(s)return s}}_renameSheet(e,t,s){if(this.worksheets.some(n=>n!==e&&n.title===s))throw new Error(`There is already a sheet named ${s}.`);this._apply(),this._rewrite({op:"rename-sheet",from:t,to:s}),e._title=s,e._was=s;const o=this._file.sheets.find(n=>n.name===t);o&&(o.name=s),this._apply()}_restructure(e){this._apply();const t=ie({file:this._file,rows:new Map([...this._csv].map(([o,n])=>[o,n.rows]))},e);if(t.refused!==void 0)throw new Error(t.refused==="table-header"?"A table's header row is not deleted: delete the table's rows, or all of it.":"That sheet is not there.");this._file=t.file;for(const[o,n]of t.rows){const r=this._csv.get(o);r&&(r.rows=n.map(a=>[...a]))}for(const o of this.worksheets){const n=this._file.sheets.find(r=>r.name===o._title);o._cells.clear(),o._columns.clear(),o._rows.clear(),o._merges=[...n?.merges??[]],o._freeze=n?.freeze,o._heldRules(n)}const s=this._build();this._rebase(s.text,s.files);for(const o of this.worksheets){const n=this._model?.sheet(o._title);if(n){o._lastRow=(n.used?.bottom??-1)+1;for(const r of n.tables){const a=o._tables.get(r.name);a&&(a.ref=x(r.area))}}}}_rewrite(e){const t=(o,n)=>{const r=F(o);if(!r.ok)return o;const a=Z(r.node,e,n);return a===r.node?o:A(a)},{_file:s}=this;if(s.names){for(const[o,n]of Object.entries(s.names))if(typeof n=="string"&&n.startsWith("=")){const r=t(n,s.sheets[0]?.name??"");s.names[o]=r,this._names.set(o,r);const a=this.defined_names.get(o);a&&(a.attr_text=r.slice(1))}}for(const o of s.checks??[])o.formula=t(o.formula,s.sheets[0]?.name??"");for(const o of s.sheets){for(const[n,r]of Object.entries(o.cells??{}))typeof r=="string"&&r.startsWith("=")?o.cells[n]=t(r,o.name):r!==null&&typeof r=="object"&&r.formula!==void 0&&(r.formula=t(r.formula,o.name));for(const n of o.tables??[]){for(const r of Object.values(n.columns??{}))r.formula!==void 0&&(r.formula=t(r.formula,o.name));this._rewriteCsv(n.rows,o.name,t)}for(const n of o.blocks??[])this._rewriteCsv(n.rows,o.name,t)}}_rewriteCsv(e,t,s){const o=this._csv.get(e);o&&(o.rows=o.rows.map(n=>n.map(r=>M(r).formula!==void 0?s(r,t):r)))}_sheetEntry(e){const t=e._was??e._title;let s=this._file.sheets.find(o=>o.name===t);return s||(s={name:e._title},this._file.sheets.push(s)),s.name=e._title,s}_dataPath(e){const t=`${H}/${Te(e)}`;let s=`${t}.csv`;const o=n=>this._csv.has(n)||this._file.sheets.some(r=>r.tables?.some(a=>a.rows===n)??r.blocks?.some(a=>a.rows===n));for(let n=2;o(s);n++)s=`${t}-${String(n)}.csv`;return s}_writeNewTable(e,t,s){const o=k(s.ref);if(!o)throw new Error(`${s.ref} is not a range.`);const n=[];for(let i=o.left;i<=o.right;i++){const h=e.cell(o.top+1,i+1).value;if(h===null||h==="")throw new Error(`Table ${s.name}'s header has no name at ${C({row:o.top,col:i})}.`);n.push(String(h))}const r={},a=[];n.forEach((i,h)=>{const c=o.left+h,d=this._columnFormula(e,o,c);d===void 0?a.push(h):r[i]={formula:d};const m=this._columnFormat(e,o,c);m!==void 0&&(r[i]={...r[i],format:m})}),this._columnsStyled(e,o);const f=[a.map(i=>n[i]??"")];for(let i=o.top+1;i<=o.bottom;i++)f.push(a.map(h=>v(e.cell(i+1,o.left+h+1))));t.cells&&(t.cells=Object.fromEntries(Object.entries(t.cells).filter(([i])=>{const h=b(i);return!h||!L(o,h.row,h.col)})));const u=this._dataPath(s.name);this._csv.set(u,{parsed:void 0,rows:f});const _={name:s.name,at:C({row:o.top,col:o.left}),rows:u,...s.key===void 0?{}:{key:s.key},...p(r)?{}:{columns:r}};(t.tables??=[]).push(_),s._spec=_}_columnsStyled(e,t){for(let s=t.left;s<=t.right;s++)for(let o=t.top+1;o<=t.bottom;o++){const n=e.cell(o+1,s+1),{format:r,...a}=this._ownLook(n);r!==void 0&&p(a)&&(n._styled=!1)}}_columnFormula(e,t,s){if(t.bottom<=t.top)return;const o=e.cell(t.top+2,s+1),n=D(o);if(n!==void 0){for(let r=t.top+2;r<=t.bottom;r++)if(D(e.cell(r+1,s+1))!==n)return;return o._formula}}_columnFormat(e,t,s){if(t.bottom<=t.top)return;const o=r=>this._ownLook(e.cell(r+1,s+1)).format,n=o(t.top+1);for(let r=t.top+2;r<=t.bottom;r++)if(o(r)!==n)return;return n}_held(e){const t=this._csv.get(e);if(!t)throw new Error(`${e} was not read.`);return t}_setCsvCell(e,t,s,o){const{rows:n}=this._held(e);for(;n.length<=t;)n.push([]);const r=n[t];if(r){for(;r.length<=s;)r.push("");r[s]=o}}_recordOf(e,t){let s=0;for(let o=0;o<t;){if(s+=1,s>=e.length)return s+t-o-1;e[s]?.length!==0&&(o+=1)}return s}_writeTableCell(e,t,s){const o=this._held(e.rows),n=o.rows[0]??[],r=s.column-1-t.left,a=this._recordOf(o.rows,s.row-1-t.top),f=Object.keys(e.columns??{}).filter(c=>!n.some(d=>d.trim().toLowerCase()===c.toLowerCase())),_=[...n.map(c=>c.trim()),...f][r];if(_===void 0)return;if(a===0){r<n.length&&(n[r]=v(s));return}const i=e.columns?.[_]?.formula;if(i!==void 0){const c=this._movedColumn(i,t,s);if(s._formula===c){const d=n.findIndex(m=>m.trim()===_);d>=0&&this._setCsvCell(e.rows,a,d,"");return}}let h=n.findIndex(c=>c.trim()===_);h<0&&(h=n.length,this._setCsvCell(e.rows,0,h,_)),this._setCsvCell(e.rows,a,h,v(s))}_movedColumn(e,t,s){const o=F(e);if(!o.ok)return e;const n=s.row-1-(t.top+1);return n===0?e:A(Q(o.node,n,0))}_apply(){this.title===void 0?delete this._file.title:this._file.title=this.title;const e=new Set(this.worksheets.map(s=>s._was??s._title));this._file.sheets=this._file.sheets.filter(s=>e.has(s.name));for(const s of this.worksheets)this._applySheet(s);this._file.sheets=this.worksheets.map(s=>this._sheetEntry(s)),this._applyNames();const t=this._build();this._rebase(t.text,t.files)}_applyNames(){const e={};for(const t of this.defined_names.values()){const s=M(t.attr_text),o=this._names.get(t.name);e[t.name]=o!==void 0&&String(o).replace(/^=/u,"")===t.attr_text?o:typeof s.value=="number"||typeof s.value=="boolean"?s.value:/^"[^"]*"$/u.test(t.attr_text)?t.attr_text.slice(1,-1):`=${t.attr_text}`}p(e)?delete this._file.names:this._file.names=e}_applySheet(e){const t=this._sheetEntry(e);e._freeze===void 0?delete t.freeze:t.freeze=e._freeze,e._merges.length===0?delete t.merges:t.merges=[...e._merges],e._state==="hidden"?t.hidden=!0:delete t.hidden,e._rules.length===0?delete t.conditional:t.conditional=[...e._rules],e._validations.length===0?delete t.validations:t.validations=e._validations.map(de),e._charts.length===0?delete t.charts:t.charts=e._charts.map(o=>o._spec(e._title)),this._applyFilter(e,t);const s=new Set(t.tables?.map(o=>o.name.toLowerCase()));for(const o of e._tables.values())s.has(o.name.toLowerCase())||this._writeNewTable(e,t,o);this._applyTableFilters(e,t),this._applyCells(e,t),this._applyDimensions(e,t),t.cells&&p(t.cells)&&delete t.cells,t.columns&&p(t.columns)&&delete t.columns,t.rows&&p(t.rows)&&delete t.rows,t.format?.length===0&&delete t.format,t.tables?.length===0&&delete t.tables,t.blocks?.length===0&&delete t.blocks}_applyFilter(e,t){const{ref:s,_columns:o}=e._filter;if(s===void 0){delete t.filter;return}const n=k(s);if(!n)throw new TypeError(`${s} is not a range.`);const r={};for(const[a,f]of o)r[N(n.left+a)]=f;t.filter={range:s,...p(r)?{}:{columns:r}}}_applyTableFilters(e,t){for(const s of t.tables??[]){const o=e._tables.get(s.name);if(!o||o.autoFilter._columns.size===0)continue;const n=this._csv.get(s.rows)?.rows??[],r=le(s,n)?.names??[],a={};for(const[f,u]of o.autoFilter._columns){const _=r[f];if(_===void 0)throw new RangeError(`Table ${s.name} has no column at ${String(f)}.`);a[_]=u}s.filter={columns:a}}}_applyDimensions(e,t){if(e._dimensions){for(const[s,o]of e._columns){const n={...t.columns?.[s]};o._width===void 0?delete n.width:n.width=o._width,o._hidden===void 0?delete n.hidden:n.hidden=o._hidden,o._files===void 0?delete n.files:n.files=o._files;const r=j(t.columns??{},s);t.columns=p(n)?r:{...r,[s]:n}}for(const[s,o]of e._rows){const n={...t.rows?.[String(s)]};o._height===void 0?delete n.height:n.height=o._height,o._hidden===void 0?delete n.hidden:n.hidden=o._hidden;const r=j(t.rows??{},String(s));t.rows=p(n)?r:{...r,[String(s)]:n}}e._dimensions=!1}}_applyCells(e,t){const s=(t.tables??[]).flatMap(r=>{const a=b(r.at),f=e._tables.get(r.name),u=f?k(f.ref):void 0;return a&&u?[{entry:r,area:u}]:[]}),o=(t.blocks??[]).flatMap(r=>{const a=e._model?.blocks.find(f=>f.file===r.rows);return a?[{entry:r,area:a.area}]:[]}),n=[];for(const r of e._cells.values()){if(!r._changed&&!r._styled)continue;const a=r.row-1,f=r.column-1,u=s.find(i=>L(i.area,a,f)),_=o.find(i=>L(i.area,a,f));u?(r._changed&&this._writeTableCell(u.entry,u.area,r),r._styled&&this._styleByFormat(t,r)):_?(r._changed&&this._setCsvCell(_.entry.rows,a-_.area.top,f-_.area.left,v(r)),r._styled&&this._styleByFormat(t,r)):r._fresh&&!e._model?.keys.has(a*16384+f)?n.push(r):this._writeLoose(e,t,r),r._changed=!1,r._styled=!1}this._consolidate(e,t,n),Oe(t)}_styleByFormat(e,t){(e.format??=[]).push({range:t.coordinate,...this._ownLook(t)})}_ownLook(e){const t=e._ws._model?.lookAt(e.row-1,e.column-1)??{},s=Ce(t,e._look);return s.format!==void 0&&e._formula===void 0&&M(v(e)).format===s.format&&delete s.format,s}_writeLoose(e,t,s){const o=s.coordinate,n=t.cells??={},r=J(s),a=this._ownLook(s),f=n[o],_={...f!==null&&typeof f=="object"?Object.fromEntries(Object.entries(f).filter(([c])=>c!=="value"&&c!=="formula"&&c!=="name")):{},...a},i=f!==null&&typeof f=="object"&&f.name!==void 0?{name:f.name}:{},h=e._model?.at(s.row-1,s.column-1)!==void 0;if(r===null&&p(_)&&!h){t.cells=j(n,o);return}n[o]=p(_)&&p(i)?r:{...typeof r=="string"&&r.startsWith("=")?{formula:r}:r===null?{}:{value:r},...i,..._}}_consolidate(e,t,s){const o=s.filter(i=>i._value!==null||i._formula!==void 0),n=new Map;for(const i of s){const h=this._ownLook(i);if(p(h))continue;const c=JSON.stringify(h),d=n.get(c);d?d.push(i):n.set(c,[i])}const r=new Map(o.map(i=>[`${String(i.row)}:${String(i.column)}`,i])),a=i=>r.get(`${String(i.row+1)}:${String(i.col+1)}`)??e.cell(i.row+1,i.col+1),f=new Map,u=[];for(const i of o){const h={row:i.row-1,col:i.column-1},c=i._formula===void 0?void 0:D(i);if(c===void 0){u.push(h);continue}const d=f.get(c);d?d.push(h):f.set(c,[h])}const _=t.cells??={};for(const i of f.values())for(const h of T(i))_[x(h)]=a({row:h.top,col:h.left})._formula??null;for(const i of T(u))if((i.bottom-i.top+1)*(i.right-i.left+1)>=this.block_cells){const c=[];for(let m=i.top;m<=i.bottom;m++){const R=[];for(let O=i.left;O<=i.right;O++)R.push(v(a({row:m,col:O})));c.push(R)}const d=this._dataPath(e._title);this._csv.set(d,{parsed:void 0,rows:c}),(t.blocks??=[]).push({at:C({row:i.top,col:i.left}),rows:d})}else for(let c=i.top;c<=i.bottom;c++)for(let d=i.left;d<=i.right;d++){const m=a({row:c,col:d});_[m.coordinate]=J(m)}for(const i of n.values()){const[h]=i;if(!h)continue;const c=this._ownLook(h),d=i.map(m=>({row:m.row-1,col:m.column-1}));for(const m of T(d))(t.format??=[]).push({range:x(m),...c})}}_build(){const e=new Map;for(const[t,s]of this._csv)e.set(t,s.parsed?ee(s.parsed,s.rows):Y(s.rows));return{text:ae(this._text,this._file),files:e}}_rebase(e,t){const{workbook:s,problems:o}=B({text:e,read:n=>t.get(n)});if(!s)throw new Error(`The workbook is not one: ${o.map(n=>n.message).join("; ")}`);this._text=e,this._file=structuredClone(s.file),this._model=s;for(const[n,r]of t)this._keepCsv(n,r);this._calc=void 0,this._pending=!1;for(const n of this.worksheets){n._was=n._title;const r=s.sheet(n._title);r&&(n._model=r);for(const a of n._cells.values())a._fresh=r?.at(a.row-1,a.column-1)===void 0}this._names=new Map;for(const n of s.names.values())n.source.path?.[0]==="names"&&this._names.set(n.name,n.formula?n.formula.text:n.value??null)}_computed(){const e=[...this.defined_names.values()];if((this._pending||e.length!==this._names.size||e.some(t=>String(this._names.get(t.name)).replace(/^=/u,"")!==t.attr_text))&&this._apply(),!this._calc){const t=this._model;if(!t)throw new Error("The workbook has no sheets.");this._calc={calc:new U(t).calculate(),model:t}}return this._calc}check(){this._apply();const{text:e,files:t}=this._build();return G({text:e,read:s=>t.get(s)}).problems}_generated(){if(this.worksheets.length===0)return this._applyNames(),{sheets:[],csv:{},...this._file.names?{names:this._file.names}:{}};this._apply();const e=structuredClone(this._file.sheets),t=o=>`${q}${o}`;for(const o of e){for(const n of o.tables??[])n.rows=t(n.rows);for(const n of o.blocks??[])n.rows=t(n.rows)}const s={};for(const[o,n]of this._build().files)s[t(o)]=n;return{sheets:e,csv:s,...this._file.names?{names:this._file.names}:{}}}save(e){if(this._making)throw new Error("sheet.ts makes sheets and saves nothing: what it adds to wb is what it makes.");const t=e??this.path;if(t===void 0)throw new TypeError("A new workbook is saved to a folder: wb.save('content/budget').");if(this.worksheets.length===0)throw new Error("A workbook has at least one sheet.");const{text:s,csv:o}=this._disk;this._apply();const n=new Set(this._file.sheets.flatMap(i=>[...(i.tables??[]).map(h=>h.rows),...(i.blocks??[]).map(h=>h.rows)])),r=[...this._csv.keys()].filter(i=>!n.has(i));for(const i of r)this._csv.delete(i);const{mkdirSync:a,rmSync:f,writeFileSync:u}=K(),_=process.getBuiltinModule("node:path");a(t,{recursive:!0}),(this._text!==s||e!==void 0)&&u($(t,z),this._text);for(const[i,h]of this._csv){const c=h.parsed?.source??"";if(e===void 0&&o.get(i)===c)continue;const d=$(t,i);a(_.dirname(d),{recursive:!0}),u(d,c)}if(e===void 0||t===this.path)for(const i of r)f($(t,i),{force:!0});this._disk={text:this._text,csv:new Map([...this._csv].map(([i,h])=>[i,h.parsed?.source??""]))},this.path=t}}function D(l){if(l._formula===void 0)return;const e=F(l._formula);if(e.ok)return X(e.node,l.row-1,l.column-1)}function Oe(l){const e=l.format;if(!e||e.length<2)return;const t=[],s=new Map;for(const o of e){const{range:n,...r}=o,a=b(n);if(!a){t.push(o);continue}const f=JSON.stringify(r),u=s.get(f);u?u.places.push(a):s.set(f,{look:r,places:[a]})}for(const{look:o,places:n}of s.values())for(const r of T(n))t.push({range:x(r),...o});l.format=t}export function load_workbook(l,e={}){return Workbook.open(l,e)}export const get_column_letter=l=>N(l-1);export function column_index_from_string(l){const e=E(l);if(e===void 0)throw new TypeError(`${l} is not a column.`);return e+1}export function coordinate_to_tuple(l){const e=b(l);if(!e)throw new TypeError(`${l} is not a cell.`);return[e.row+1,e.col+1]}export function range_boundaries(l){const e=k(l);if(!e)throw new TypeError(`${l} is not a range.`);return[e.left+1,e.top+1,e.right+1,e.bottom+1]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { SheetChart, SheetConditional, SheetFilterColumn, SheetSide, SheetValidation } from "@allyhub-next/formats";
|
|
2
|
+
import { type Area, type Place } from "./address.js";
|
|
3
|
+
import { Draft, type BookEdit, type EditBook } from "./edit.js";
|
|
4
|
+
import type { CellLook, Filter, Worksheet } from "./workbook.js";
|
|
5
|
+
/** Excel's Borders list. */
|
|
6
|
+
export declare const BORDER_PRESETS: readonly ["bottom", "top", "left", "right", "none", "all", "outside", "thickOutside", "bottomDouble", "thickBottom", "topBottom", "topThickBottom", "topDoubleBottom"];
|
|
7
|
+
export type BorderPreset = (typeof BORDER_PRESETS)[number];
|
|
8
|
+
type Sides = NonNullable<CellLook["border"]>;
|
|
9
|
+
/** Sides drawn on an area, in `format`: later entries win side by side. */
|
|
10
|
+
export declare function drawSides(d: Draft, sheet: Worksheet, area: Area, sides: Sides): void;
|
|
11
|
+
/** A preset of Excel's Borders list on an area. */
|
|
12
|
+
export declare function setBorders(book: EditBook, sheetName: string, area: Area, preset: BorderPreset, o?: {
|
|
13
|
+
style?: SheetSide["style"];
|
|
14
|
+
color?: string;
|
|
15
|
+
}): BookEdit;
|
|
16
|
+
/** What Format Cells' Border tab says of each side of a selection, and between its cells. */
|
|
17
|
+
export declare function setBorderSides(book: EditBook, sheetName: string, area: Area, sides: {
|
|
18
|
+
top?: SheetSide | null;
|
|
19
|
+
bottom?: SheetSide | null;
|
|
20
|
+
left?: SheetSide | null;
|
|
21
|
+
right?: SheetSide | null;
|
|
22
|
+
/** Between its rows. */
|
|
23
|
+
horizontal?: SheetSide | null;
|
|
24
|
+
/** Between its columns. */
|
|
25
|
+
vertical?: SheetSide | null;
|
|
26
|
+
}): BookEdit;
|
|
27
|
+
export type MergeHow = "center" | "across" | "cells";
|
|
28
|
+
/** Whether merging would take a value away: cells other than the first of each merge hold something. */
|
|
29
|
+
export declare function mergeLoses(sheet: Worksheet, area: Area, how: MergeHow): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Cells merged as Excel's Merge & Center, Merge Across and Merge Cells: the
|
|
32
|
+
* first value stays, in the first cell, and the others go. Tables hold no merges.
|
|
33
|
+
*/
|
|
34
|
+
export declare function mergeCells(book: EditBook, sheetName: string, area: Area, how: MergeHow): BookEdit;
|
|
35
|
+
/** Every merge that touches an area taken out. */
|
|
36
|
+
export declare function unmergeCells(book: EditBook, sheetName: string, area: Area): BookEdit;
|
|
37
|
+
/** The panes frozen above and left of a cell; nothing unfreezes them. */
|
|
38
|
+
export declare function setFreeze(book: EditBook, sheetName: string, at: Place | undefined): BookEdit;
|
|
39
|
+
/** Rows or columns hidden, or shown again. */
|
|
40
|
+
export declare function setHidden(book: EditBook, sheetName: string, what: "rows" | "columns", from: number, to: number, hidden: boolean): BookEdit;
|
|
41
|
+
/** A sheet hidden or shown; at least one stays. */
|
|
42
|
+
export declare function setSheetHidden(book: EditBook, sheetName: string, hidden: boolean): BookEdit;
|
|
43
|
+
/** A sheet's tab given a colour, or none. */
|
|
44
|
+
export declare function setTabColor(book: EditBook, sheetName: string, color: string | undefined): BookEdit;
|
|
45
|
+
/** Cmd+Shift+L: a filter on the selection's region, or off. A table's buttons go and come. */
|
|
46
|
+
export declare function toggleFilter(book: EditBook, sheetName: string, area: Area): BookEdit;
|
|
47
|
+
/** What one column of a filter keeps; nothing clears it. */
|
|
48
|
+
export declare function setFilterColumn(book: EditBook, sheetName: string, filter: Filter, col: number, keep: SheetFilterColumn | undefined): BookEdit;
|
|
49
|
+
/** Every filter of a sheet shows all its rows again. */
|
|
50
|
+
export declare function clearFilters(book: EditBook, sheetName: string): BookEdit;
|
|
51
|
+
/** A rule added, first of all, as Excel puts a new one. */
|
|
52
|
+
export declare function addConditional(book: EditBook, sheetName: string, rule: SheetConditional): BookEdit;
|
|
53
|
+
/** Conditional formats cleared from an area, or from all the sheet. */
|
|
54
|
+
export declare function clearConditional(book: EditBook, sheetName: string, area: Area | undefined): BookEdit;
|
|
55
|
+
/** The data validation of an area: what was there goes, and `rule` holds. */
|
|
56
|
+
export declare function setValidation(book: EditBook, sheetName: string, area: Area, rule: Omit<SheetValidation, "range"> | undefined): BookEdit;
|
|
57
|
+
/** A sheet's whole grid, for what covers all of it. */
|
|
58
|
+
export declare const WHOLE_SHEET: Area;
|
|
59
|
+
/** A chart put on a sheet. */
|
|
60
|
+
export declare function addChart(book: EditBook, sheetName: string, chart: SheetChart): BookEdit;
|
|
61
|
+
/** A chart changed: what `patch` says, an undefined field taken away. */
|
|
62
|
+
export declare function setChart(book: EditBook, sheetName: string, index: number, patch: {
|
|
63
|
+
[K in keyof SheetChart]?: SheetChart[K] | undefined;
|
|
64
|
+
}): BookEdit;
|
|
65
|
+
/** A chart taken off its sheet. */
|
|
66
|
+
export declare function removeChart(book: EditBook, sheetName: string, index: number): BookEdit;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=arrange.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{MAX_COLUMNS as S,MAX_ROWS as A,cellName as E,columnIndex as _,columnLetter as O,overlaps as k,rangeName as w,readArea as y,readAreas as v}from"./address.js";import{Draft as g,applyLook as x,blankEdit as M,refused as d,tidied as D,writeOne as B,inputOf as j}from"./edit.js";import{regionAround as R}from"./filter.js";export const BORDER_PRESETS=["bottom","top","left","right","none","all","outside","thickOutside","bottomDouble","thickBottom","topBottom","topThickBottom","topDoubleBottom"];const a=(o,s)=>Object.fromEntries(Object.entries(o).filter(([t])=>t!==s)),p={top:o=>({...o,bottom:o.top}),bottom:o=>({...o,top:o.bottom}),left:o=>({...o,right:o.left}),right:o=>({...o,left:o.right})};function L(o,s,t){const n=e=>({...t,style:e});switch(o){case"bottom":return[{area:p.bottom(s),sides:{bottom:t}}];case"top":return[{area:p.top(s),sides:{top:t}}];case"left":return[{area:p.left(s),sides:{left:t}}];case"right":return[{area:p.right(s),sides:{right:t}}];case"all":return[{area:s,sides:{left:t,right:t,top:t,bottom:t}}];case"outside":case"thickOutside":{const e=o==="outside"?t:n("thick");return[{area:p.top(s),sides:{top:e}},{area:p.bottom(s),sides:{bottom:e}},{area:p.left(s),sides:{left:e}},{area:p.right(s),sides:{right:e}}]}case"bottomDouble":return[{area:p.bottom(s),sides:{bottom:n("double")}}];case"thickBottom":return[{area:p.bottom(s),sides:{bottom:n("thick")}}];case"topBottom":return[{area:p.top(s),sides:{top:t}},{area:p.bottom(s),sides:{bottom:t}}];case"topThickBottom":return[{area:p.top(s),sides:{top:t}},{area:p.bottom(s),sides:{bottom:n("thick")}}];case"topDoubleBottom":return[{area:p.top(s),sides:{top:t}},{area:p.bottom(s),sides:{bottom:n("double")}}];case"none":return[]}}export function drawSides(o,s,t,n){const e=o.spec(s),r=w(t),i=e.format?.find(c=>c.range===r)?.border;x(o,s,t,{border:{...i,...n}})}export function setBorders(o,s,t,n,e={}){const r=o.workbook.sheet(s);if(!r)return d("no-sheet");const i=new g(o);if(n==="none")return x(i,r,t,{border:void 0}),i.finish();const c={style:e.style??"thin",...e.color===void 0?{}:{color:e.color}};for(const f of L(n,t,c))drawSides(i,r,f.area,f.sides);return i.finish()}export function setBorderSides(o,s,t,n){const e=o.workbook.sheet(s);if(!e)return d("no-sheet");const r=new g(o),i=b=>b??{style:"none"},{top:c,bottom:f,left:u,right:l,horizontal:h,vertical:m}=n;return c!==void 0&&drawSides(r,e,p.top(t),{top:i(c)}),f!==void 0&&drawSides(r,e,p.bottom(t),{bottom:i(f)}),u!==void 0&&drawSides(r,e,p.left(t),{left:i(u)}),l!==void 0&&drawSides(r,e,p.right(t),{right:i(l)}),h!==void 0&&t.bottom>t.top&&drawSides(r,e,{...t,bottom:t.bottom-1},{bottom:i(h)}),m!==void 0&&t.right>t.left&&drawSides(r,e,{...t,right:t.right-1},{right:i(m)}),r.finish()}export function mergeLoses(o,s,t){const n=Math.min(s.right,o.columnsUsed-1),e=Math.min(s.bottom,o.lastRow);for(let r=s.top;r<=e;r++){let i=!0;for(let c=s.left;c<=n;c++)if(o.at(r,c)!==void 0)if(i&&(t==="across"||r===s.top))i=!1;else return!0;if(t!=="across"&&!i&&r>=s.top){for(let c=r+1;c<=e;c++)for(let f=s.left;f<=n;f++)if(o.at(c,f)!==void 0)return!0;return!1}}return!1}export function mergeCells(o,s,t,n){const e=o.workbook.sheet(s);if(!e)return d("no-sheet");if(e.tables.some(l=>k(l.area,t)))return d("merge-table");const r=new g(o),i=r.spec(e),c=(i.merges??[]).filter(l=>{const h=y(l);return!h||!k(h,t)}),f=n==="across"?Array.from({length:t.bottom-t.top+1},(l,h)=>({...t,top:t.top+h,bottom:t.top+h})):[t],u=[];for(const l of f)l.top===l.bottom&&l.left===l.right||(u.push(w(l)),T(r,o,e,l));return u.length===0?M():(i.merges=[...c,...u],n==="center"&&x(r,e,t,{align:"center"}),r.edit.whole=!0,r.finish())}function T(o,s,t,n){let e="";const r=Math.min(n.right,t.columnsUsed-1),i=Math.min(n.bottom,t.lastRow);for(let c=n.top;c<=i;c++)for(let f=n.left;f<=r;f++)t.at(c,f)!==void 0&&(e===""&&(e=j(s,t,c,f)),(c!==n.top||f!==n.left)&&B(o,s,t,c,f,""));e!==j(s,t,n.top,n.left)&&B(o,s,t,n.top,n.left,e)}export function unmergeCells(o,s,t){const n=o.workbook.sheet(s);if(!n)return d("no-sheet");const e=new g(o),r=e.spec(n),i=(r.merges??[]).filter(c=>{const f=y(c);return!f||!k(f,t)});return i.length===0?delete r.merges:r.merges=i,e.edit.whole=!0,e.finish()}export function setFreeze(o,s,t){const n=o.workbook.sheet(s);if(!n)return d("no-sheet");const e=new g(o),r=e.spec(n);return t&&(t.row>0||t.col>0)?r.freeze=E(t):delete r.freeze,e.edit.whole=!0,e.finish()}export function setHidden(o,s,t,n,e,r){const i=o.workbook.sheet(s);if(!i)return d("no-sheet");const c=new g(o),f=c.spec(i),u=(l,h)=>{const m=a(l[h]??{},"hidden");return r?{...l,[h]:{...m,hidden:!0}}:Object.keys(m).length===0?a(l,h):{...l,[h]:m}};if(t==="columns"){let l={...f.columns};const h=r?Array.from({length:e-n+1},(m,b)=>O(n+b)):Object.keys(l).filter(m=>{const b=_(m);return b!==void 0&&b>=n&&b<=e});for(const m of h)l=u(l,m);f.columns=l}else{let l={...f.rows};const h=r?Array.from({length:e-n+1},(m,b)=>String(n+b+1)):Object.keys(l).filter(m=>{const b=Number(m)-1;return b>=n&&b<=e});for(const m of h)l=u(l,m);f.rows=l}return D(f),c.edit.whole=!0,c.finish()}export function setSheetHidden(o,s,t){const n=o.file.sheets,e=n.filter(u=>u.hidden!==!0),r=n.findIndex(u=>u.name===s),i=n[r];if(!i)return d("no-sheet");if(t&&e.length<=1)return d("last-sheet");const c=a(i,"hidden"),f=t?{...c,hidden:!0}:c;return{...M(),file:{...o.file,sheets:n.map((u,l)=>l===r?f:u)},whole:!0}}export function setTabColor(o,s,t){const n=o.workbook.sheet(s);if(!n)return d("no-sheet");const e=new g(o),r=e.spec(n);return t===void 0?delete r.tab:r.tab=t,e.finish()}export function toggleFilter(o,s,t){const n=o.workbook.sheet(s);if(!n)return d("no-sheet");const e=new g(o),r={row:t.top,col:t.left},i=n.tableAt(r.row,r.col);if(i){const h=e.table(n,i);return h.filter===!1?delete h.filter:h.filter=!1,e.edit.whole=!0,e.finish()}const c=e.spec(n);if(c.filter)return delete c.filter,e.edit.whole=!0,e.finish();const u=t.top===t.bottom&&t.left===t.right?R(n,r):t;if(!u)return d("no-data");const l=n.used;return c.filter={range:w({...u,bottom:Math.min(u.bottom,l?.bottom??u.bottom),right:Math.min(u.right,l?.right??u.right)})},e.edit.whole=!0,e.finish()}export function setFilterColumn(o,s,t,n,e){const r=o.workbook.sheet(s);if(!r)return d("no-sheet");const i=new g(o),{table:c}=t;if(c){const f=i.table(r,c),u=c.columns[n-c.at.col]?.name??"",l=a(f.filter===!1||!f.filter?{}:f.filter.columns,u),h=e?{...l,[u]:e}:l;Object.keys(h).length===0?delete f.filter:f.filter={columns:h}}else{const f=i.spec(r);if(!f.filter)return d("no-sheet");const u=O(n),l=a(f.filter.columns??{},u),h=e?{...l,[u]:e}:l;f.filter={range:f.filter.range,...Object.keys(h).length===0?{}:{columns:h}}}return i.edit.whole=!0,i.finish()}export function clearFilters(o,s){const t=o.workbook.sheet(s);if(!t)return d("no-sheet");const n=new g(o),e=n.spec(t);e.filter&&(e.filter={range:e.filter.range});for(const r of t.tables)r.spec.filter&&delete n.table(t,r).filter;return n.edit.whole=!0,n.finish()}export function addConditional(o,s,t){const n=o.workbook.sheet(s);if(!n)return d("no-sheet");const e=new g(o),r=e.spec(n);return r.conditional=[t,...r.conditional??[]],e.edit.whole=!0,e.finish()}function z(o,s){if(!k(o,s))return[o];const t=[];s.top>o.top&&t.push({...o,bottom:s.top-1}),s.bottom<o.bottom&&t.push({...o,top:s.bottom+1});const n=Math.max(o.top,s.top),e=Math.min(o.bottom,s.bottom);return s.left>o.left&&t.push({...o,top:n,bottom:e,right:s.left-1}),s.right<o.right&&t.push({...o,top:n,bottom:e,left:s.right+1}),t}function C(o,s){const t=v(o);if(!t)return o;const n=t.flatMap(e=>z(e,s));return n.length===0?void 0:n.map(w).join(" ")}export function clearConditional(o,s,t){const n=o.workbook.sheet(s);if(!n)return d("no-sheet");const e=new g(o),r=e.spec(n),i=t?(r.conditional??[]).flatMap(c=>{const f=C(c.range,t);return f===void 0?[]:[{...c,range:f}]}):[];return i.length===0?delete r.conditional:r.conditional=i,e.edit.whole=!0,e.finish()}export function setValidation(o,s,t,n){const e=o.workbook.sheet(s);if(!e)return d("no-sheet");const r=new g(o),i=r.spec(e),c=(i.validations??[]).flatMap(u=>{const l=C(u.range,t);return l===void 0?[]:[{...u,range:l}]}),f=n?[...c,{...n,range:w(t)}]:c;return f.length===0?delete i.validations:i.validations=f,r.edit.whole=!0,r.finish()}export const WHOLE_SHEET={top:0,left:0,bottom:A-1,right:S-1};export function addChart(o,s,t){const n=o.workbook.sheet(s);if(!n)return d("no-sheet");const e=new g(o),r=e.spec(n);return r.charts=[...r.charts??[],t],e.finish()}export function setChart(o,s,t,n){const e=o.workbook.sheet(s),r=e?.spec.charts?.[t];if(!e||!r)return d("no-sheet");const i=new g(o),c=i.spec(e),f=Object.fromEntries(Object.entries({...r,...n}).filter(([,u])=>u!==void 0));return c.charts=(c.charts??[]).map((u,l)=>l===t?f:u),i.finish()}export function removeChart(o,s,t){const n=o.workbook.sheet(s);if(!n)return d("no-sheet");const e=new g(o),r=e.spec(n),i=(r.charts??[]).filter((c,f)=>f!==t);return i.length>0?r.charts=i:delete r.charts,e.finish()}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RefNode, StructuredNode } from "../formula/ast.js";
|
|
2
|
+
import type { SharedFormula, Workbook } from "../workbook.js";
|
|
3
|
+
export interface Analysis {
|
|
4
|
+
reads: (RefNode | StructuredNode)[];
|
|
5
|
+
/** Defined names, in lower case. */
|
|
6
|
+
names: Set<string>;
|
|
7
|
+
volatile: boolean;
|
|
8
|
+
/** Names that are nothing here. */
|
|
9
|
+
unknownNames: string[];
|
|
10
|
+
/** Functions that are nothing here. */
|
|
11
|
+
unknownFunctions: string[];
|
|
12
|
+
/** Functions given too few or too many arguments. */
|
|
13
|
+
arguments: {
|
|
14
|
+
name: string;
|
|
15
|
+
given: number;
|
|
16
|
+
min: number;
|
|
17
|
+
max: number;
|
|
18
|
+
}[];
|
|
19
|
+
}
|
|
20
|
+
export declare function analyse(wb: Workbook, shared: SharedFormula): Analysis;
|
|
21
|
+
//# sourceMappingURL=analyse.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{FUNCTIONS as g}from"./functions/index.js";export function analyse(o,f){const s={reads:[],names:new Set,volatile:!1,unknownNames:[],unknownFunctions:[],arguments:[]},m=new Set,c=(e,t)=>{const n=e.toLowerCase();if(t.has(n))return!0;const a=o.name(n);if(a)return s.names.add(n),m.has(n)||(m.add(n),a.formula?.node&&r(a.formula.node,new Set)),!0;const u=o.table(n);return u?(s.reads.push({kind:"structured",table:u.name,sections:[],columns:[],thisRow:!1}),!0):!1},r=(e,t)=>{switch(e.kind){case"ref":case"structured":s.reads.push(e);return;case"name":c(e.name,t)||s.unknownNames.push(e.name);return;case"unary":case"postfix":case"paren":r(e.arg,t);return;case"binary":r(e.left,t),r(e.right,t);return;case"array":return;case"invoke":r(e.callee,t);for(const n of e.args)r(n,t);return;case"call":{const n=g.get(e.name);if(e.name==="LET"||e.name==="LAMBDA"){const a=new Set(t),u=e.args[e.args.length-1];e.args.forEach((i,d)=>{if(i!==u){if(e.name==="LET"&&d%2===1){r(i,a);return}i.kind==="name"&&a.add(i.name.toLowerCase())}}),u&&r(u,a);return}n?(n.volatile===!0&&(s.volatile=!0),(e.args.length<n.min||e.args.length>n.max)&&s.arguments.push({name:e.name,given:e.args.length,min:n.min,max:n.max})):c(e.written,t)||s.unknownFunctions.push(e.name);for(const a of e.args)r(a,t);return}default:return}};return f.node&&r(f.node,new Set),s}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CellError, Matrix, type Scalar } from "../values.js";
|
|
2
|
+
/** The number text reads as: VALUE's rules, dates and times included. */
|
|
3
|
+
export declare function numberOfText(text: string): number | undefined;
|
|
4
|
+
export declare function toNumber(v: Scalar | undefined): number | CellError;
|
|
5
|
+
export declare function toText(v: Scalar | undefined): string | CellError;
|
|
6
|
+
export declare function toBool(v: Scalar | undefined): boolean | CellError;
|
|
7
|
+
/** Equal to 15 significant digits, as Excel compares numbers. */
|
|
8
|
+
export declare const sameNumber: (a: number, b: number) => boolean;
|
|
9
|
+
/** Excel's order of two values that are not errors: numbers, then text, then TRUE and FALSE. */
|
|
10
|
+
export declare function compare(a: Scalar, b: Scalar): number;
|
|
11
|
+
/** A result that is not a finite number is an error. */
|
|
12
|
+
export declare const finite: (n: number) => number | CellError;
|
|
13
|
+
/** Result rounding after an addition, as Excel does it: what is left of a cancelled sum is 0. */
|
|
14
|
+
export declare function snap(result: number, a: number, b: number): number;
|
|
15
|
+
export declare function arithmetic(op: string, a: Scalar, b: Scalar): Scalar;
|
|
16
|
+
export declare function binary(op: string, a: Scalar, b: Scalar): Scalar;
|
|
17
|
+
/** Two shapes as one array's: 1 stretches, and past a shorter side is #N/A. */
|
|
18
|
+
export declare function mapBoth(a: Matrix, b: Matrix, each: (x: Scalar, y: Scalar) => Scalar): Matrix;
|
|
19
|
+
//# sourceMappingURL=coerce.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{parseValue as d}from"numfmt";import{CellError as f,ERR as s,Matrix as x,numberText as h,readTyped as b}from"../values.js";export function numberOfText(e){const r=b(e.trim());if(typeof r.value=="number")return r.value;if(e.trim()==="")return;const t=d(e);return typeof t?.value=="number"?t.value:void 0}export function toNumber(e){return typeof e=="number"?e:e==null?0:typeof e=="boolean"?e?1:0:e instanceof f?e:numberOfText(e)??s.VALUE}export function toText(e){return typeof e=="string"?e:e==null?"":typeof e=="number"?h(e):typeof e=="boolean"?e?"TRUE":"FALSE":e}export function toBool(e){if(typeof e=="boolean")return e;if(e==null)return!1;if(typeof e=="number")return e!==0;if(e instanceof f)return e;const r=e.trim().toUpperCase();return r==="TRUE"?!0:r==="FALSE"?!1:s.VALUE}const m=e=>typeof e=="number"?0:typeof e=="string"?1:2;export const sameNumber=(e,r)=>e===r||Number(e.toPrecision(15))===Number(r.toPrecision(15));export function compare(e,r){const t=e??(typeof r=="string"?"":typeof r=="boolean"?!1:0),n=r??(typeof e=="string"?"":typeof e=="boolean"?!1:0),o=m(t),c=m(n);if(o!==c)return o<c?-1:1;if(typeof t=="number"&&typeof n=="number")return sameNumber(t,n)?0:t<n?-1:1;if(typeof t=="string"&&typeof n=="string"){const a=t.toUpperCase(),u=n.toUpperCase();return a===u?0:a<u?-1:1}return t===n?0:t===!1?-1:1}export const finite=e=>Number.isFinite(e)?e:s.NUM;export function snap(e,r,t){return Math.abs(e)<=Math.max(Math.abs(r),Math.abs(t))*89e-17?0:e}export function arithmetic(e,r,t){const n=toNumber(r);if(n instanceof f)return n;const o=toNumber(t);if(o instanceof f)return o;switch(e){case"+":return finite(snap(n+o,n,o));case"-":return finite(snap(n-o,n,o));case"*":return finite(n*o);case"/":return o===0?s.DIV0:finite(n/o);default:return n===0&&o===0?s.NUM:n===0&&o<0?s.DIV0:finite(n**o)}}export function binary(e,r,t){if(r instanceof f)return r;if(t instanceof f)return t;switch(e){case"&":{const n=toText(r);if(n instanceof f)return n;const o=toText(t);return o instanceof f?o:`${n}${o}`}case"=":return compare(r,t)===0;case"<>":return compare(r,t)!==0;case"<":return compare(r,t)<0;case"<=":return compare(r,t)<=0;case">":return compare(r,t)>0;case">=":return compare(r,t)>=0;default:return arithmetic(e,r,t)}}export function mapBoth(e,r,t){const n=Math.max(e.rows,r.rows),o=Math.max(e.cols,r.cols),c=new Array(n*o),a=(u,i,l)=>{const p=u.rows===1?0:i,y=u.cols===1?0:l;return p<u.rows&&y<u.cols?u.at(p,y):void 0};for(let u=0;u<n;u++)for(let i=0;i<o;i++){const l=a(e,u,i),p=a(r,u,i);c[u*o+i]=l===void 0||p===void 0?s.NA:t(l,p)}return new x(n,o,c)}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { Node, RefNode, StructuredNode } from "../formula/ast.js";
|
|
2
|
+
import { CellError, Matrix, type Scalar } from "../values.js";
|
|
3
|
+
import { FormulaCell, SharedFormula, type Slot, type Workbook, type Worksheet } from "../workbook.js";
|
|
4
|
+
import { Lambda, Reference, Union, type Frame, type Value } from "./types.js";
|
|
5
|
+
export interface CalcOptions {
|
|
6
|
+
/** The moment NOW and TODAY read. Default: the clock. */
|
|
7
|
+
now?: Date;
|
|
8
|
+
/** What RAND reads, values from 0 up to 1. Default: Math.random. */
|
|
9
|
+
random?: () => number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Random numbers that are the same for the same seed, for a result that must
|
|
13
|
+
* not change from one run to the next: mulberry32 over the seed's FNV-1a hash.
|
|
14
|
+
*/
|
|
15
|
+
export declare function seededRandom(seed: string): () => number;
|
|
16
|
+
/** A cell put in the workbook. */
|
|
17
|
+
export interface CellChange {
|
|
18
|
+
sheet: Worksheet;
|
|
19
|
+
row: number;
|
|
20
|
+
col: number;
|
|
21
|
+
slot: Slot | undefined;
|
|
22
|
+
}
|
|
23
|
+
export declare class Calc {
|
|
24
|
+
/** Each circular reference found, as the cells around it. */
|
|
25
|
+
cycles: FormulaCell[][];
|
|
26
|
+
/** How many formula cells the last pass computed. */
|
|
27
|
+
computed: number;
|
|
28
|
+
readonly nowSerial: () => number;
|
|
29
|
+
readonly random: () => number;
|
|
30
|
+
private pass;
|
|
31
|
+
private readonly stack;
|
|
32
|
+
private readonly inCycle;
|
|
33
|
+
private readonly namesAt;
|
|
34
|
+
private readonly dependents;
|
|
35
|
+
private readonly watches;
|
|
36
|
+
/** Watches by the column they are on, and those too wide to list by column. */
|
|
37
|
+
private readonly watchesAt;
|
|
38
|
+
private readonly wideWatches;
|
|
39
|
+
private graph;
|
|
40
|
+
/** What spills changed since it was last looked at. */
|
|
41
|
+
private moved;
|
|
42
|
+
/** Formula cells whose spill's size turned out to depend on itself. */
|
|
43
|
+
private readonly unsettled;
|
|
44
|
+
private readonly hiddenBy;
|
|
45
|
+
/** What reads what no reference shows (OFFSET, INDIRECT) or changes by itself (NOW, RAND): computed with every change, as Excel's are. */
|
|
46
|
+
private volatiles;
|
|
47
|
+
/** Lookup indexes of ranges, while nothing has changed. */
|
|
48
|
+
readonly indexes: Map<string, Map<string, number[]>>;
|
|
49
|
+
readonly wb: Workbook;
|
|
50
|
+
constructor(wb: Workbook, o?: CalcOptions);
|
|
51
|
+
private allCells;
|
|
52
|
+
/**
|
|
53
|
+
* The rows a sheet's filters hide. As in Excel they are worked out once and
|
|
54
|
+
* stay until the filter is applied again, whatever is typed in them, and no
|
|
55
|
+
* formula depends on them but SUBTOTAL and AGGREGATE, which leave them out.
|
|
56
|
+
*/
|
|
57
|
+
filtered(sheet: Worksheet): ReadonlySet<number>;
|
|
58
|
+
/** Computes every formula. */
|
|
59
|
+
calculate(): this;
|
|
60
|
+
/** What filters hide, from the rows computed; what leaves those out is computed again. */
|
|
61
|
+
private applyFilters;
|
|
62
|
+
/** The value at a place. */
|
|
63
|
+
value(sheet: Worksheet, row: number, col: number): Scalar;
|
|
64
|
+
read(sheet: Worksheet, row: number, col: number): Scalar;
|
|
65
|
+
/** What an empty place reads: nothing, or the value a formula spilled into it. */
|
|
66
|
+
private ghost;
|
|
67
|
+
private circular;
|
|
68
|
+
private run;
|
|
69
|
+
/**
|
|
70
|
+
* What reads a spill's cells computed again until nothing moves: who reads
|
|
71
|
+
* a place does not say who spills into it, so a spill that came, went or
|
|
72
|
+
* changed is seen only once it is computed.
|
|
73
|
+
*/
|
|
74
|
+
private spread;
|
|
75
|
+
/** Puts a formula's array result on its sheet, or says what stands in its way. */
|
|
76
|
+
private spillOut;
|
|
77
|
+
/** A spill gives way to one before it, and says #SPILL! instead. */
|
|
78
|
+
private evict;
|
|
79
|
+
private analysisOf;
|
|
80
|
+
/** What a formula cell reads, by what evaluating its references gives. */
|
|
81
|
+
private readsOf;
|
|
82
|
+
/** What a formula that is in no cell reads: a chart's, a rule's, a check's. */
|
|
83
|
+
readsOfFormula(shared: SharedFormula, sheet: Worksheet): Reference[];
|
|
84
|
+
/** `seeds`, and what they read that is to be computed, each after what it reads. */
|
|
85
|
+
private order;
|
|
86
|
+
/** The formula cells yet to compute that a cell reads. */
|
|
87
|
+
private pending;
|
|
88
|
+
private compute;
|
|
89
|
+
/** What a formula computed, in its cell and those it spills into. */
|
|
90
|
+
private settleResult;
|
|
91
|
+
/** What a formula's last value is in a cell: an empty cell read is 0. */
|
|
92
|
+
private top;
|
|
93
|
+
/** A value with no reference left in it. */
|
|
94
|
+
flat(value: Value): Scalar | Matrix;
|
|
95
|
+
/** The cells of a reference: a whole column or row only as far as its sheet uses it. */
|
|
96
|
+
matrix(r: Reference): Matrix;
|
|
97
|
+
/** Visits what a reference holds: empty cells are skipped. */
|
|
98
|
+
each(r: Reference, visit: (value: Scalar, row: number, col: number) => void): void;
|
|
99
|
+
/** A formula's text evaluated on a sheet, as a check's or a question's is. */
|
|
100
|
+
evaluate(shared: SharedFormula, sheet: Worksheet): Scalar | Matrix;
|
|
101
|
+
/** A formula as it reads at a place, moved from the place it is written for: a rule's. */
|
|
102
|
+
evaluateAt(shared: SharedFormula, sheet: Worksheet, row: number, col: number): Scalar | Matrix;
|
|
103
|
+
private bound;
|
|
104
|
+
resolveRef(n: RefNode, f: Frame): Reference | Union | CellError;
|
|
105
|
+
structured(n: StructuredNode, f: Frame): Reference | Union | CellError;
|
|
106
|
+
private nameValue;
|
|
107
|
+
private intersect;
|
|
108
|
+
private unary;
|
|
109
|
+
private operate;
|
|
110
|
+
private rangeOf;
|
|
111
|
+
private intersection;
|
|
112
|
+
private union;
|
|
113
|
+
eval(n: Node, f: Frame): Value;
|
|
114
|
+
private invoke;
|
|
115
|
+
/** A LAMBDA given its arguments' values. */
|
|
116
|
+
apply(l: Lambda, args: readonly Value[]): Value;
|
|
117
|
+
private call;
|
|
118
|
+
/** A function of single values given ranges or arrays: over each of their cells. */
|
|
119
|
+
private lifted;
|
|
120
|
+
/** One scalar from a value: a range in a place for one gives the cell in the formula's row or column. */
|
|
121
|
+
scalar(v: Value, f: Frame): Scalar;
|
|
122
|
+
/** Lets NOW, TODAY, RAND and whatever else is volatile change on the next pass. */
|
|
123
|
+
recalculate(): this;
|
|
124
|
+
private key;
|
|
125
|
+
private addEdges;
|
|
126
|
+
private removeEdges;
|
|
127
|
+
/** The graph of who reads whom: made the first time something changes. */
|
|
128
|
+
private build;
|
|
129
|
+
/** Who reads any place of an area. */
|
|
130
|
+
private readersIn;
|
|
131
|
+
/** Who reads a place. */
|
|
132
|
+
readers(sheet: Worksheet, row: number, col: number): FormulaCell[];
|
|
133
|
+
/** What a cell reads, as the file writes its places. */
|
|
134
|
+
precedents(cell: FormulaCell): Reference[];
|
|
135
|
+
/** Marks cells and what reads them, then computes them. */
|
|
136
|
+
private mark;
|
|
137
|
+
private settle;
|
|
138
|
+
/**
|
|
139
|
+
* Changes a cell and computes what that touches: a number, text, TRUE or
|
|
140
|
+
* FALSE, nothing (null), or a formula's text after =.
|
|
141
|
+
*/
|
|
142
|
+
set(sheet: Worksheet, row: number, col: number, value: Scalar): void;
|
|
143
|
+
/** Makes the graph of who reads whom now, so the first change does not wait for it. */
|
|
144
|
+
prepare(): void;
|
|
145
|
+
/** Changes cells at once, and computes what they touch, each once. */
|
|
146
|
+
change(cells: readonly CellChange[]): void;
|
|
147
|
+
/** Sets a defined name's constant (a scenario's) and computes what reads it. */
|
|
148
|
+
setName(name: string, value: Scalar): void;
|
|
149
|
+
/** Numbers of a value, for code outside a formula. */
|
|
150
|
+
numberOf(v: Scalar): number | CellError;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{MAX_COLUMNS as A,MAX_ROWS as M,overlaps as L}from"../address.js";import{CellError as m,ERR as f,Matrix as d,serialOfDate as U}from"../values.js";import{filteredRows as N}from"../filter.js";import{FormulaCell as b,SharedFormula as F,placeKey as _}from"../workbook.js";import{analyse as V}from"./analyse.js";import{binary as k,mapBoth as I,toNumber as T}from"./coerce.js";import{FUNCTIONS as B}from"./functions/index.js";import{Lambda as S,MISSING as O,Missing as x,Reference as u,Union as g}from"./types.js";export function seededRandom(h){let t=2166136261;for(let e=0;e<h.length;e++)t=Math.imul(t^h.charCodeAt(e),16777619);return()=>{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const $=new Set,W=/\b(?:SUBTOTAL|AGGREGATE)\(/iu,D=2e3,z=32,R=12,G=(h,t)=>!h||!t?h===t:h.rows!==t.rows||h.cols!==t.cols?!1:h.data.every((e,s)=>e===t.data[s]),H=(h,t)=>h.row<t.row||h.row===t.row&&h.col<t.col;class P{cells=new Set;reference;constructor(t){this.reference=t}}export class Calc{cycles=[];computed=0;nowSerial;random;pass=0;stack=[];inCycle=new Set;namesAt=new Set;dependents=new Map;watches=new Map;watchesAt=new Map;wideWatches=[];graph=!1;moved=[];unsettled=new Set;hiddenBy=new Map;volatiles=new Set;indexes=new Map;wb;constructor(t,e={}){this.wb=t;const{now:s,random:n}=e;this.nowSerial=()=>U(s??new Date),this.random=n??Math.random;for(const o of t.sheets)o.expand()}allCells(){return this.wb.sheets.flatMap(t=>[...t.formulas])}filtered(t){return this.hiddenBy.get(t)??$}calculate(){this.hiddenBy.clear();for(const e of this.wb.sheets)e.clearSpills();this.moved=[],this.unsettled.clear();const t=this.allCells();for(const e of t)e.state=1;return this.cycles=[],this.inCycle.clear(),this.run(t),this.applyFilters(t),this}applyFilters(t){for(const e of this.wb.sheets){if(e.filters.every(n=>n.columns.size===0))continue;const s=N(e,this);s.size>0&&this.hiddenBy.set(e,s)}if(this.hiddenBy.size!==0&&t.some(e=>W.test(e.shared.text))){for(const e of t)e.state=1;this.cycles=[],this.inCycle.clear(),this.run([...t])}}value(t,e,s){return this.read(t,e,s)}read(t,e,s){const n=t.at(e,s);return n===void 0?this.ghost(t,e,s):typeof n!="object"||n instanceof m?n:(n.state===1?this.compute(n):n.state===2&&this.circular(n),n.value)}ghost(t,e,s){const n=t.spillAt(e,s);if(!n)return null;if(n.state===1)this.compute(n);else if(n.state===2)return this.circular(n),null;const{array:o}=n;return o&&t.spillAt(e,s)===n?o.at(e-n.row,s-n.col):null}circular(t){const e=this.stack.indexOf(t),s=e<0?[t]:this.stack.slice(e);s.some(n=>this.inCycle.has(n))||this.cycles.push(s);for(const n of s)this.inCycle.add(n)}run(t){this.indexes.clear(),this.computed=0;for(const e of this.order(t))e.state===1&&this.compute(e);this.spread()}spread(){for(let t=0;this.moved.length>0;t++){const e=this.moved;if(this.moved=[],t>=R*2)break;if(t>=R)for(const{sheet:o,area:r}of e)for(const i of o.spillsIn(r))this.unsettled.add(i);this.build();const s=new Set,n=[...this.unsettled];for(const{sheet:o,area:r}of e)n.push(...this.readersIn(o,r),...o.blockedBy(r));for(;;){const o=n.pop();if(!o)break;s.has(o)||(s.add(o),n.push(...this.readers(o.sheet,o.row,o.col)))}if(s.size!==0){for(const o of s)o.state=1,this.inCycle.delete(o);this.cycles=this.cycles.filter(o=>!o.some(r=>s.has(r))),this.indexes.clear();for(const o of this.order([...s]))o.state===1&&this.compute(o)}}for(const t of this.wb.sheets)t.tighten()}spillOut(t,e){const{sheet:s,row:n,col:o}=t,r={top:n,left:o,bottom:n+e.rows-1,right:o+e.cols-1},i=s.spillsIn(r).filter(c=>c!==t);if(r.bottom>=M||r.right>=A||s.holds(r,t)||s.tables.some(c=>L(c.area,r))||s.merges.some(c=>L(c,r))||i.some(c=>H(c,t)))return s.blockSpill(t,r),!1;for(const c of i)this.evict(c,r);return s.placeSpill(t,r),!0}evict(t,e){const{sheet:s,spill:n}=t;n&&(s.clearSpill(t),s.blockSpill(t,e),t.array=void 0,t.value=f.SPILL,this.moved.push({sheet:s,area:n}))}analysisOf(t){return t.analysis??=V(this.wb,t)}readsOf(t){const e=[],s=v(t);for(const n of this.analysisOf(t.shared).reads){const o=n.kind==="ref"?this.resolveRef(n,s):this.structured(n,s);o instanceof u?e.push(o):o instanceof g&&e.push(...o.parts)}return e}readsOfFormula(t,e){const s=[],n={sheet:e,row:t.row,col:t.col,dr:0,dc:0};for(const o of this.analysisOf(t).reads){const r=o.kind==="ref"?this.resolveRef(o,n):this.structured(o,n);r instanceof u?s.push(r):r instanceof g&&s.push(...r.parts)}return s}order(t){this.pass+=1;const{pass:e}=this,s=[],n=new Set,o=[],r=i=>{i.mark=e,o.push({cell:i,reads:this.pending(i,n),next:0})};for(const i of t)if(i.mark!==e)for(r(i);;){const a=o[o.length-1];if(!a)break;const c=a.reads[a.next];a.next+=1,c===void 0?(s.push(a.cell),o.pop()):c.mark!==e&&c.state===1&&r(c)}return s}pending(t,e){const s=[];for(const n of this.readsOf(t)){const{sheet:o}=n;if(n.single){const i=o.at(n.top,n.left);i instanceof b&&s.push(i);continue}if(e.has(n.key))continue;e.add(n.key);const r=Math.min(n.right,o.columnsUsed-1);for(let i=n.left;i<=r;i++){if(!o.hasFormulas(i))continue;const[a,c]=o.span(i,n.top,n.bottom);for(let l=a;l<=c;l++){const p=o.at(l,i);p instanceof b&&s.push(p)}}}return s}compute(t){if(this.stack.length>=D){t.value=f.CALC,t.state=0;return}t.state=2,this.stack.push(t),this.computed+=1;const{node:e}=t.shared,s=e?this.top(this.eval(e,v(t))):f.NAME;this.stack.pop(),this.unsettled.has(t)&&!this.inCycle.has(t)&&(this.inCycle.add(t),this.cycles.push([t])),this.settleResult(t,s),t.state=0}settleResult(t,e){const{sheet:s}=t,n=t.spill,o=t.array;if(s.clearSpill(t),t.array=void 0,e instanceof d){const i=j(e);i.rows*i.cols<=1||this.spillOut(t,i)?(t.array=i,t.value=i.at(0,0)??0):t.value=f.SPILL}else t.value=e;this.inCycle.has(t)&&(s.clearSpill(t),t.value=f.CYCLE,t.array=void 0);const r=t.spill;(!G(o,t.array)||!q(n,r))&&(n&&this.moved.push({sheet:s,area:n}),r&&this.moved.push({sheet:s,area:r}))}top(t){const e=this.flat(t);return e===null?0:e}flat(t){return t instanceof u?t.single?this.read(t.sheet,t.top,t.left):this.matrix(t):t instanceof g?f.VALUE:t instanceof S?f.CALC:t instanceof x?null:t}matrix(t){const e=t.bottom===M-1?Math.min(t.bottom,t.sheet.lastRow):t.bottom,s=t.right===A-1?Math.min(t.right,t.sheet.columnsUsed-1):t.right,n=Math.max(0,e-t.top+1),o=Math.max(0,s-t.left+1),r=new Array(n*o);for(let i=0;i<n;i++)for(let a=0;a<o;a++)r[i*o+a]=this.read(t.sheet,t.top+i,t.left+a);return new d(n,o,r)}each(t,e){const{sheet:s}=t,n=Math.min(t.right,s.columnsUsed-1);for(let o=t.left;o<=n;o++){const[r,i]=s.span(o,t.top,t.bottom);for(let a=r;a<=i;a++){const c=s.at(a,o);if(c===void 0){s.spillAt(a,o)&&e(this.read(s,a,o),a,o);continue}e(typeof c=="object"&&!(c instanceof m)?this.read(s,a,o):c,a,o)}}}evaluate(t,e){const{node:s}=t;return s?this.top(this.eval(s,{sheet:e,row:t.row,col:t.col,dr:0,dc:0})):f.NAME}evaluateAt(t,e,s,n){const{node:o}=t;return o?this.top(this.eval(o,{sheet:e,row:s,col:n,dr:s-t.row,dc:n-t.col})):f.NAME}bound(t,e,s){const n=t.abs?t.index:t.index+e;return n<0||n>=s?void 0:n}resolveRef(t,e){const s=t.sheet===void 0?e.sheet:this.wb.sheet(t.sheet);if(!s)return f.REF;let n=0,o=A-1,r=0,i=M-1;if(t.col){const a=this.bound(t.col,e.dc,A),c=this.bound(t.col2??t.col,e.dc,A);if(a===void 0||c===void 0)return f.REF;n=Math.min(a,c),o=Math.max(a,c)}if(t.row){const a=this.bound(t.row,e.dr,M),c=this.bound(t.row2??t.row,e.dr,M);if(a===void 0||c===void 0)return f.REF;r=Math.min(a,c),i=Math.max(a,c)}if(t.lastSheet!==void 0){const a=this.wb.sheet(t.lastSheet);if(!a)return f.REF;const[c,l]=[Math.min(s.index,a.index),Math.max(s.index,a.index)];return new g(this.wb.sheets.slice(c,l+1).map(p=>new u(p,r,n,i,o)))}return new u(s,r,n,i,o)}structured(t,e){const s=t.table===void 0?e.sheet.tableAt(e.row,e.col):this.wb.table(t.table);return s?X(s,t,e):t.table===void 0?f.REF:f.NAME}nameValue(t,e){const s=t.toLowerCase();for(let r=e.scope;r;r=r.parent){const i=r.names.get(s);if(i!==void 0)return i}const n=this.wb.name(t);if(n){if(!n.formula)return n.value??null;const{node:r}=n.formula;if(!r)return f.NAME;if(this.namesAt.has(s))return f.CYCLE;this.namesAt.add(s);try{return this.eval(r,{sheet:e.sheet,row:0,col:0,dr:0,dc:0})}finally{this.namesAt.delete(s)}}const o=this.wb.table(t);if(o){const{top:r,left:i,bottom:a,right:c}=o.data;return new u(o.sheet,r,i,a,c)}return f.NAME}intersect(t,e){return!(t instanceof u)||t.single?t:t.cols===1&&e.row>=t.top&&e.row<=t.bottom?new u(t.sheet,e.row,t.left,e.row,t.left):t.rows===1&&e.col>=t.left&&e.col<=t.right?new u(t.sheet,t.top,e.col,t.top,e.col):f.VALUE}unary(t,e){const s=this.flat(t);return s instanceof d?new d(s.rows,s.cols,s.data.map(e)):e(s)}operate(t,e,s){const n=this.flat(e),o=this.flat(s);if(n instanceof d||o instanceof d){const r=(i,a)=>k(t,i,a);return I(n instanceof d?n:new d(1,1,[n]),o instanceof d?o:new d(1,1,[o]),r)}return k(t,n,o)}rangeOf(t,e){return t instanceof m?t:e instanceof m?e:!(t instanceof u)||!(e instanceof u)||t.sheet!==e.sheet?f.REF:new u(t.sheet,Math.min(t.top,e.top),Math.min(t.left,e.left),Math.max(t.bottom,e.bottom),Math.max(t.right,e.right))}intersection(t,e){if(t instanceof m)return t;if(e instanceof m)return e;if(!(t instanceof u)||!(e instanceof u))return f.REF;const s=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.bottom,e.bottom),r=Math.min(t.right,e.right);return t.sheet!==e.sheet||s>o||n>r?f.NULL:new u(t.sheet,s,n,o,r)}union(t,e){if(t instanceof m)return t;if(e instanceof m)return e;const s=o=>o instanceof u?[o]:o instanceof g?o.parts:[],n=[...s(t),...s(e)];return n.length===0?f.VALUE:new g(n)}eval(t,e){switch(t.kind){case"number":case"string":case"boolean":return t.value;case"error":return m.of(t.code);case"missing":return O;case"ref":return this.resolveRef(t,e);case"structured":return this.structured(t,e);case"name":return this.nameValue(t.name,e);case"paren":return this.eval(t.arg,e);case"unary":{const s=this.eval(t.arg,e);return t.op==="@"?this.intersect(s,e):t.op==="+"?s:this.unary(s,n=>k("*",n,-1))}case"postfix":{const s=this.eval(t.arg,e);if(t.op==="%")return this.unary(s,n=>k("/",n,100));if(s instanceof u&&s.single){const n=s.sheet.at(s.top,s.left);if(n instanceof b){this.read(s.sheet,s.top,s.left);const{spill:o}=n;if(o)return new u(s.sheet,o.top,o.left,o.bottom,o.right);if(n.array)return s}}return f.REF}case"binary":{const s=this.eval(t.left,e),n=this.eval(t.right,e);return t.op===":"?this.rangeOf(s,n):t.op===" "?this.intersection(s,n):t.op===","?this.union(s,n):this.operate(t.op,s,n)}case"array":return new d(t.rows.length,t.rows[0]?.length??0,t.rows.flatMap(s=>s.map(n=>{const o=this.eval(n,e);return o instanceof d||o instanceof u||o instanceof g||o instanceof S||o instanceof x?f.VALUE:o})));case"invoke":{const s=this.eval(t.callee,e);return s instanceof S?this.invoke(s,t.args,e):s instanceof m?s:f.VALUE}case"call":return this.call(t.name,t.args,e)}}invoke(t,e,s){return this.apply(t,e.map(n=>this.eval(n,s)))}apply(t,e){if(e.length>t.params.length)return f.VALUE;const s=new Map;return t.params.forEach((n,o)=>{s.set(n,e[o]??O)}),this.eval(t.body,{...t.frame,scope:{names:s,...t.frame.scope?{parent:t.frame.scope}:{}}})}call(t,e,s){const n=B.get(t);if(!n){const i=this.nameValue(t,s);return i instanceof S?this.invoke(i,e,s):f.NAME}const o={calc:this,frame:s};if(e.length<n.min||e.length>n.max)return f.VALUE;if(n.kind==="lazy")return n.call(e,o);const r=e.map(i=>this.eval(i,s));return n.kind==="raw"?n.call(r,o):this.lifted(n.call,n.errors===!0,r)}lifted(t,e,s){const n=s.map(l=>l instanceof x?void 0:this.flat(l)),o=l=>{if(!e){for(const p of l)if(p instanceof m)return p}return t(...l)};if(!n.some(l=>l instanceof d))return o(n);const r=n.filter(l=>l instanceof d),i=Math.max(...r.map(l=>l.rows)),a=Math.max(...r.map(l=>l.cols)),c=new Array(i*a);for(let l=0;l<i;l++)for(let p=0;p<a;p++)c[l*a+p]=o(n.map(w=>{if(!(w instanceof d))return w;const E=w.rows===1?0:l,y=w.cols===1?0:p;return E<w.rows&&y<w.cols?w.at(E,y):f.NA}));return new d(i,a,c)}scalar(t,e){if(t instanceof x)return null;if(t instanceof u){const s=this.intersect(t,e);return s instanceof u?this.read(s.sheet,s.top,s.left):f.VALUE}return t instanceof d?t.at(0,0):t instanceof g||t instanceof S?f.VALUE:t}recalculate(){const t=this.allCells().filter(e=>this.analysisOf(e.shared).volatile);return this.mark(t),this}key(t,e,s){return`${String(t.index)}:${String(_(e,s))}`}addEdges(t){this.analysisOf(t.shared).volatile&&this.volatiles.add(t);for(const e of this.readsOf(t))if(e.single){const s=this.key(e.sheet,e.top,e.left);let n=this.dependents.get(s);n||(n=new Set,this.dependents.set(s,n)),n.add(t)}else{let s=this.watches.get(e.key);if(!s)if(s=new P(e),this.watches.set(e.key,s),e.cols>z)this.wideWatches.push(s);else for(let n=e.left;n<=e.right;n++){const o=`${String(e.sheet.index)}:${String(n)}`,r=this.watchesAt.get(o);r?r.push(s):this.watchesAt.set(o,[s])}s.cells.add(t)}}removeEdges(t){this.volatiles.delete(t);for(const e of this.readsOf(t))e.single?this.dependents.get(this.key(e.sheet,e.top,e.left))?.delete(t):this.watches.get(e.key)?.cells.delete(t)}build(){if(!this.graph){this.graph=!0;for(const t of this.allCells())this.addEdges(t)}}readersIn(t,e){const s=new Set,n=e.right;for(let i=e.top;i<=e.bottom;i++)for(let a=e.left;a<=n;a++)for(const c of this.dependents.get(this.key(t,i,a))??[])s.add(c);const o=new Set,r=i=>{if(o.has(i))return;o.add(i);const{reference:a,cells:c}=i;if(a.sheet===t&&L(a,e))for(const l of c)s.add(l)};this.wideWatches.forEach(r);for(let i=e.left;i<=n;i++)this.watchesAt.get(`${String(t.index)}:${String(i)}`)?.forEach(r);return[...s]}readers(t,e,s){this.build();const n=new Set(this.dependents.get(this.key(t,e,s))),o=`${String(t.index)}:${String(s)}`,r=this.watchesAt.get(o)??[];for(const i of[r,this.wideWatches])for(const{reference:a,cells:c}of i)if(a.sheet===t&&e>=a.top&&e<=a.bottom&&s>=a.left&&s<=a.right)for(const l of c)n.add(l);return[...n]}precedents(t){return this.readsOf(t)}mark(t){this.build();const e=new Set(t),s=[...t];for(;;){const n=s.pop();if(!n)break;for(const o of this.readers(n.sheet,n.row,n.col))e.has(o)||(e.add(o),s.push(o))}this.settle(e)}settle(t){for(const e of t)e.state=1,this.inCycle.delete(e);this.cycles=this.cycles.filter(e=>!e.some(s=>t.has(s))),this.run([...t])}set(t,e,s,n){const o=typeof n=="string"&&n.length>1&&n.startsWith("=")?new b(new F(n,e,s,{file:""}),t,e,s):void 0;this.change([{sheet:t,row:e,col:s,slot:o??n??void 0}])}prepare(){this.build()}change(t){this.build();const e=new Set,s=[...this.unsettled];this.unsettled.clear();for(const{sheet:n,row:o,col:r,slot:i}of t){const a=n.at(o,r);a instanceof b&&(this.removeEdges(a),e.delete(a),a.spill&&this.moved.push({sheet:n,area:a.spill}),n.clearSpill(a));const c=n.spillAt(o,r);c&&s.push(c),s.push(...n.blockedBy({top:o,left:r,bottom:o,right:r})),n.replace(o,r,i),i instanceof b&&(this.addEdges(i),e.add(i))}for(const{sheet:n,row:o,col:r}of t)s.push(...this.readers(n,o,r));for(s.push(...this.volatiles);;){const n=s.pop();if(!n)break;e.has(n)||(e.add(n),s.push(...this.readers(n.sheet,n.row,n.col)))}this.settle(e)}setName(t,e){const s=this.wb.name(t);if(!s)throw new Error(`There is no name ${t}.`);s.value=e,delete s.formula;const n=t.toLowerCase();this.mark(this.allCells().filter(o=>this.analysisOf(o.shared).names.has(n)))}numberOf(t){return T(t)}}const q=(h,t)=>h?.top===t?.top&&h?.left===t?.left&&h?.bottom===t?.bottom&&h?.right===t?.right;function j(h){return h.data.some(t=>t===null)?new d(h.rows,h.cols,h.data.map(t=>t??0)):h}function v(h){return{sheet:h.sheet,row:h.row,col:h.col,dr:h.row-h.shared.row,dc:h.col-h.shared.col}}function X(h,t,e){const{sheet:s}=h,n=h.area;let o=n.left,r=n.right;const[i,a]=t.columns;if(i!==void 0){const y=h.column(i),C=a===void 0?y:h.column(a);if(!y||!C)return f.REF;o=n.left+Math.min(y.index,C.index),r=n.left+Math.max(y.index,C.index)}if(t.thisRow)return e.sheet!==s||e.row<=n.top||e.row>n.bottom?f.VALUE:new u(s,e.row,o,e.row,r);const c=t.sections;if(c.includes("#Totals"))return f.REF;const l=c.includes("#All")||c.includes("#Headers"),p=c.length===0||c.includes("#All")||c.includes("#Data"),w=l?n.top:n.top+1,E=p?n.bottom:n.top;return new u(s,w,o,E,r)}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{MAX_ROWS as b}from"../../address.js";import{CellError as s,ERR as m,Matrix as g}from"../../values.js";import{FormulaCell as D}from"../../workbook.js";import{finite as E,snap as w}from"../coerce.js";import{Reference as R,Union as y}from"../types.js";import{FUNCTIONS as I,cellsOf as P,eachArg as O,many as c,numbersOf as h,numbersOfA as M,raw as i}from"./define.js";function V(n){let t=0;for(const e of n)t=w(t+e,t,e);return t}i("SUM",1,c,(n,t)=>{let e=0,o;return O(n,t,(f,l)=>{if(!o){if(typeof f=="number")e=w(e+f,e,f);else if(f instanceof s)o=f;else if(l){const a=h([f],t);a instanceof s?o=a:e+=a[0]??0}}}),o??E(e)}),i("AVERAGE",1,c,(n,t)=>{const e=h(n,t);return e instanceof s?e:e.length===0?m.DIV0:V(e)/e.length}),i("AVERAGEA",1,c,(n,t)=>{const e=M(n,t);return e instanceof s?e:e.length===0?m.DIV0:V(e)/e.length}),i("COUNT",1,c,(n,t)=>{let e=0;return O(n,t,(o,f)=>{typeof o=="number"?e+=1:f&&!(o instanceof s)&&o!==null&&(h([o],t)instanceof s||(e+=1))}),e}),i("COUNTA",1,c,(n,t)=>{let e=0;return O(n,t,()=>{e+=1}),e}),i("COUNTBLANK",1,1,(n,t)=>{const e=n[0];if(e instanceof s)return e;if(e instanceof R){let f=0;return t.calc.each(e,l=>{l!==""&&(f+=1)}),e.rows*e.cols-f}const o=t.calc.flat(e);return o instanceof g?o.data.filter(f=>f===null||f==="").length:o===null||o===""?1:0});const C=n=>t=>{if(t instanceof s)return t;if(t.length===0)return 0;let e=t[0]??0;for(const o of t)e=n(e,o);return e},N=C((n,t)=>t<n?t:n),L=C((n,t)=>t>n?t:n);i("MIN",1,c,(n,t)=>N(h(n,t))),i("MAX",1,c,(n,t)=>L(h(n,t))),i("MINA",1,c,(n,t)=>N(M(n,t))),i("MAXA",1,c,(n,t)=>L(M(n,t))),i("PRODUCT",1,c,(n,t)=>{const e=h(n,t);return e instanceof s?e:e.length===0?0:E(e.reduce((o,f)=>o*f,1))}),i("SUMSQ",1,c,(n,t)=>{const e=h(n,t);return e instanceof s?e:E(V(e.map(o=>o*o)))}),i("SUMPRODUCT",1,c,(n,t)=>{const e=n.map(r=>P(r,t)),o=e[0];if(o===void 0||o instanceof s)return o??m.VALUE;let{rows:f}=o;const{cols:l}=o,a=r=>r.reference&&r.reference.bottom<b-1?r.reference.rows:r.rows;for(const r of e){if(r instanceof s)return r;if(r.cols!==l||a(r)!==a(o))return m.VALUE;f=Math.min(f,r.rows)}let d=0;for(let r=0;r<f;r++)for(let U=0;U<l;U++){let T=1;for(const p of e){const A=p.at(r,U);if(A instanceof s)return A;T*=typeof A=="number"?A:0}d+=T}return E(d)});const k={1:"AVERAGE",2:"COUNT",3:"COUNTA",4:"MAX",5:"MIN",6:"PRODUCT",7:"STDEV.S",8:"STDEV.P",9:"SUM",10:"VAR.S",11:"VAR.P"};function B(n){if(!(n instanceof D))return!1;const{node:t}=n.shared;return t?.kind==="call"&&t.name==="SUBTOTAL"}i("SUBTOTAL",2,c,(n,t)=>{const e=t.calc.scalar(n[0],t.frame);if(e instanceof s)return e;if(typeof e!="number")return m.VALUE;const o=e<100,f=k[o?e:e-100],l=f===void 0?void 0:I.get(f);if(l?.kind!=="raw")return m.VALUE;const a=[],d=r=>{const U=u=>r.sheet.spec.rows?.[String(u+1)]?.hidden===!0,T=Math.min(r.bottom,r.sheet.lastRow),p=[],A=t.calc.filtered(r.sheet);for(let u=r.top;u<=T;u++)if(!A.has(u)&&!(!o&&U(u)))for(let S=r.left;S<=r.right;S++)p.push(B(r.sheet.at(u,S))?null:t.calc.read(r.sheet,u,S));a.push(new g(p.length,1,p))};for(const r of n.slice(1)){if(r instanceof s)return r;if(r instanceof R)d(r);else if(r instanceof y)r.parts.forEach(d);else return m.VALUE}return l.call(a,t)});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Scalar } from "../../values.js";
|
|
2
|
+
export type Test = (v: Scalar) => boolean;
|
|
3
|
+
export interface Criterion {
|
|
4
|
+
test: Test;
|
|
5
|
+
/** What a value equal to it is found by: a lookup by this key finds every match. */
|
|
6
|
+
key?: string;
|
|
7
|
+
}
|
|
8
|
+
/** The key a value is found under in an index. */
|
|
9
|
+
export declare function indexKey(v: Scalar): string | undefined;
|
|
10
|
+
/** A wildcard pattern as a test: * any text, ? one character, ~ takes the next as it is. */
|
|
11
|
+
export declare function wildcard(pattern: string): (text: string) => boolean;
|
|
12
|
+
export declare const hasWildcard: (text: string) => boolean;
|
|
13
|
+
/** A criterion read from what a formula gives it. */
|
|
14
|
+
export declare function criterion(raw: Scalar): Criterion;
|
|
15
|
+
//# sourceMappingURL=criteria.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{CellError as d,ERR as g,Matrix as U}from"../../values.js";import{compare as W,numberOfText as A,sameNumber as N}from"../coerce.js";import{Reference as R}from"../types.js";import{cellsOf as h,many as w,raw as p}from"./define.js";export function indexKey(e){if(typeof e=="number")return`n${String(Number(e.toPrecision(15)))}`;if(typeof e=="string")return`t${e.toUpperCase()}`;if(typeof e=="boolean")return e?"bT":"bF"}export function wildcard(e){let n="";for(let t=0;t<e.length;t++){const s=e.charAt(t);s==="~"&&/[*?~]/u.test(e.charAt(t+1))?(t+=1,n+=e.charAt(t).replace(/[*?]/u,"\\$&")):s==="*"?n+="[\\s\\S]*":s==="?"?n+="[\\s\\S]":n+=s.replace(/[.+^${}()|[\]\\/-]/gu,"\\$&")}const r=new RegExp(`^${n}$`,"iu");return t=>r.test(t)}export const hasWildcard=e=>/[*?~]/u.test(e);function b(e){return n=>{if(typeof n=="number")return N(n,e);if(typeof n!="string")return!1;const r=A(n);return r!==void 0&&N(r,e)}}function q(e,n){const r=t=>e===">"?t>0:e===">="?t>=0:e==="<"?t<0:t<=0;return t=>typeof t==typeof n&&r(W(t,n))}export function criterion(e){if(e===null)return{test:b(0),key:"n0"};if(typeof e=="number")return{test:b(e),key:`n${String(Number(e.toPrecision(15)))}`};if(typeof e=="boolean")return{test:o=>o===e,key:e?"bT":"bF"};if(e instanceof d)return{test:o=>o===e};const n=/^(<>|>=|<=|=|>|<)/u.exec(e),r=n?.[1]??"=",t=n?e.slice(r.length):e,s=o=>o===null;if(t==="")return r==="="?{test:n?s:o=>o===null||o===""}:r==="<>"?{test:o=>o!==null}:{test:()=>!1};const c=A(t),f=/^(?:TRUE|FALSE)$/iu.test(t)?t.toUpperCase()==="TRUE":void 0,l=c??f;if(r==="="||r==="<>"){let o,i;if(c!==void 0)o=b(c),i=indexKey(c);else if(f!==void 0)o=u=>u===f,i=indexKey(f);else if(t.startsWith("#"))o=u=>u instanceof d&&u.code===t.toUpperCase();else if(hasWildcard(t)){const u=wildcard(t);o=a=>typeof a=="string"&&u(a)}else{const u=t.toUpperCase();o=a=>typeof a=="string"&&a.toUpperCase()===u,i=indexKey(t)}return r==="="?i===void 0?{test:o}:{test:o,key:i}:{test:u=>!o(u)}}return{test:q(r,l??t)}}function D(e,n){const r=e.reference;if(r?.cols!==1||e.rows<64)return;const t=`crit:${r.key}`,s=n.calc.indexes.get(t);if(s)return s;const c=new Map;for(let f=0;f<e.rows;f++){const l=e.at(f,0),o=i=>{if(i===void 0)return;const u=c.get(i);u?u.push(f):c.set(i,[f])};if(o(indexKey(l)),typeof l=="string"){const i=A(l);i!==void 0&&o(indexKey(i))}}return n.calc.indexes.set(t,c),c}function I(e,n){const r=n.calc.scalar(e,n.frame);return criterion(r)}function T(e,n){const r=[];for(let s=0;s+1<e.length;s+=2){const c=h(e[s],n);if(c instanceof d)return c;const f=I(e[s+1],n);if(f instanceof d)return f;r.push({cells:c,crit:f})}const t=r[0]?.cells;return t&&r.some(s=>!V(s.cells,t))?g.VALUE:r}const V=(e,n)=>e.cols===n.cols&&(e.reference?.rows??e.rows)===(n.reference?.rows??n.rows);function F(e,n,r){const t=e[0];if(!t)return;const s=e.slice(1),c=(o,i)=>s.every(u=>u.crit.test(u.cells.at(o,i))),f=t.crit.key===void 0?void 0:D(t.cells,n);if(f&&t.crit.key!==void 0){for(const o of f.get(t.crit.key)??[])c(o,0)&&r(o,0);return}const l=Math.max(...e.map(o=>o.cells.rows));for(let o=0;o<l;o++)for(let i=0;i<t.cells.cols;i++)t.crit.test(t.cells.at(o,i))&&c(o,i)&&r(o,i)}function K(e,n){return e instanceof R?(e.rows-n.rows)*e.cols:0}function O(e,n,r,t){let s;return F(n,r,(c,f)=>{if(s)return;const l=e.at(c,f);l instanceof d?s=l:typeof l=="number"&&t(l)}),s}function X(e,n){const r=h(e[0],n);if(r instanceof d)return r;const t=e[2];return t===void 0?r:h(t,n)}const L=e=>(n,r)=>{const t=h(n[0],r);if(t instanceof d)return t;const s=I(n[1],r);if(s instanceof d)return s;const c=X(n,r);if(c instanceof d)return c;const f=[];return O(c,[{cells:t,crit:s}],r,o=>{f.push(o)})??e(f)},x=e=>(n,r)=>{if(n.length%2===0)return g.VALUE;const t=h(n[0],r);if(t instanceof d)return t;const s=T(n.slice(1),r);if(s instanceof d)return s;const c=s[0]?.cells;if(c&&!V(t,c))return g.VALUE;const f=[];return O(t,s,r,o=>{f.push(o)})??e(f)},m=(e,n)=>(r,t)=>{const s=new Map;for(const[i,u]of r.entries()){if(!e(i)||!(u instanceof U||u instanceof R&&!u.single))continue;const a=h(u,t);if(a instanceof d)return a;s.set(i,a)}if(s.size===0)return n(r,t);const c=[...s.values()],f=Math.max(...c.map(i=>i.rows)),l=Math.max(...c.map(i=>i.cols)),o=[];for(let i=0;i<f;i++)for(let u=0;u<l;u++){const a=r.map((G,P)=>{const y=s.get(P);if(!y)return G;const $=y.rows===1?0:i,C=y.cols===1?0:u;return $<y.rows&&C<y.cols?y.at($,C):g.NA}),S=n(a,t);o.push(S instanceof U?S.at(0,0):S)}return new U(f,l,o)},k=e=>e===1,E=e=>e>=2&&e%2===0,j=e=>e%2===1,M=e=>e.reduce((n,r)=>n+r,0),z=e=>e.length===0?g.DIV0:M(e)/e.length,B=e=>e.length===0?0:e.reduce((n,r)=>r<n?r:n),H=e=>e.length===0?0:e.reduce((n,r)=>r>n?r:n);p("SUMIF",2,3,m(k,L(M))),p("AVERAGEIF",2,3,m(k,L(z))),p("SUMIFS",3,w,m(E,x(M))),p("AVERAGEIFS",3,w,m(E,x(z))),p("MINIFS",3,w,m(E,x(B))),p("MAXIFS",3,w,m(E,x(H))),p("COUNTIF",2,2,m(k,(e,n)=>{const r=h(e[0],n);if(r instanceof d)return r;const t=I(e[1],n);if(t instanceof d)return t;let s=0;return F([{cells:r,crit:t}],n,()=>{s+=1}),s+(t.test(null)?K(e[0],r):0)})),p("COUNTIFS",2,w,m(j,(e,n)=>{if(e.length%2===1)return g.VALUE;const r=T(e,n);if(r instanceof d)return r;let t=0;return F(r,n,()=>{t+=1}),t}));
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{CellError as s,ERR as c}from"../../values.js";import{compare as U,toText as E}from"../coerce.js";import{FUNCTIONS as p,cellsOf as h,raw as u}from"./define.js";import{criterion as T}from"./criteria.js";function w(n,e){const t=[];for(let o=0;o<n.cols;o++){const f=E(n.at(0,o));if(f instanceof s)return f;t.push(f.toLowerCase())}const r=[];for(let o=1;o<n.rows;o++){let f=e.rows<2;for(let i=1;i<e.rows&&!f;i++){let l=!0;for(let m=0;m<e.cols&&l;m++){const D=e.at(i,m);if(D===null||D==="")continue;const d=E(e.at(0,m));if(d instanceof s)return d;const V=t.indexOf(d.toLowerCase());if(V<0){l=!1;continue}const A=T(D);if(A instanceof s)return A;A.test(n.at(o,V))||(l=!1)}l&&(f=!0)}f&&r.push(o)}return r}function R(n,e){if(typeof e=="number"){const r=Math.trunc(e)-1;return r<0||r>=n.cols?c.VALUE:r}const t=E(e);if(t instanceof s)return t;for(let r=0;r<n.cols;r++){const o=n.at(0,r);if(typeof o=="string"&&U(o,t)===0)return r}return c.VALUE}function a(n,e){const t=h(n[0],e);if(t instanceof s)return t;const r=h(n[2],e);if(r instanceof s)return r;const o=w(t,r);if(o instanceof s)return o;const f=n[1];if(f===void 0)return{list:o.map(()=>null),db:t};const i=R(t,e.calc.scalar(f,e.frame));return i instanceof s?i:{list:o.map(l=>t.at(l,i)),db:t}}function S(n,e){u(n,3,3,(t,r)=>{const o=a(t,r);if(o instanceof s)return o;const f=p.get(e);if(f?.kind!=="raw")return c.VALUE;const i=o.list.filter(l=>typeof l=="number");return f.call([...i.length>0?i:[0]],r)})}for(const[n,e]of[["DSUM","SUM"],["DMAX","MAX"],["DMIN","MIN"],["DPRODUCT","PRODUCT"]])S(n,e);for(const[n,e]of[["DAVERAGE","AVERAGE"],["DSTDEV","STDEV.S"],["DSTDEVP","STDEV.P"],["DVAR","VAR.S"],["DVARP","VAR.P"]])u(n,3,3,(t,r)=>{const o=a(t,r);if(o instanceof s)return o;const f=p.get(e);if(f?.kind!=="raw")return c.VALUE;const i=o.list.filter(l=>typeof l=="number");return i.length===0?c.DIV0:f.call(i,r)});u("DCOUNT",2,3,(n,e)=>{const t=a(n.length===2?[n[0],void 0,n[1]]:n,e);return t instanceof s?t:t.list.filter(r=>typeof r=="number").length}),u("DCOUNTA",2,3,(n,e)=>{const t=a(n.length===2?[n[0],void 0,n[1]]:n,e);return t instanceof s?t:t.list.filter(r=>r!==null).length}),u("DGET",3,3,(n,e)=>{const t=a(n,e);return t instanceof s?t:t.list.length===0?c.VALUE:t.list.length>1?c.NUM:t.list[0]??null});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{parseDate as B,parseTime as H,parseValue as I}from"numfmt";import{CellError as c,ERR as i,dateOf as h,serialOf as U}from"../../values.js";import{toBool as X,toNumber as m,toText as Y}from"../coerce.js";import{Missing as O}from"../types.js";import{number as V,numbersOf as b,raw as p,scalar as l}from"./define.js";const d=r=>{const n=m(r);return n instanceof c?n:n<0?i.NUM:Math.floor(n)},R=r=>r%4===0&&r%100!==0||r%400===0,A=(r,n)=>n===2?R(r)?29:28:[4,6,9,11].includes(n)?30:31,W=r=>r.month===2&&r.day===A(r.year,2);l("DATE",3,3,V((r=0,n=1,e=1)=>{const t=Math.trunc(r);if(t<0||t>9999)return i.NUM;const o=U(t<1900?t+1900:t,Math.trunc(n),Math.trunc(e));return o<0?i.NUM:o})),l("TIME",3,3,V((r=0,n=0,e=0)=>{const t=Math.trunc(r)*3600+Math.trunc(n)*60+Math.trunc(e);return t<0?i.NUM:t%86400/86400})),l("YEAR",1,1,r=>{const n=d(r);return n instanceof c?n:h(n).year}),l("MONTH",1,1,r=>{const n=d(r);return n instanceof c?n:h(n).month}),l("DAY",1,1,r=>{const n=d(r);return n instanceof c?n:h(n).day});const L=r=>{const n=m(r);return n instanceof c?n:n<0?i.NUM:Math.round((n-Math.floor(n))*86400)%86400};l("HOUR",1,1,r=>{const n=L(r);return n instanceof c?n:Math.floor(n/3600)}),l("MINUTE",1,1,r=>{const n=L(r);return n instanceof c?n:Math.floor(n/60)%60}),l("SECOND",1,1,r=>{const n=L(r);return n instanceof c?n:n%60}),l("DATEVALUE",1,1,r=>{const n=Y(r);if(n instanceof c)return n;const e=B(n)??I(n);return typeof e?.value=="number"?Math.floor(e.value):i.VALUE}),l("TIMEVALUE",1,1,r=>{const n=Y(r);if(n instanceof c)return n;const e=H(n)??I(n);return typeof e?.value!="number"?i.VALUE:e.value-Math.floor(e.value)});const D=r=>(r%7+6)%7;l("WEEKDAY",1,2,(r,n)=>{const e=d(r);if(e instanceof c)return e;const t=n==null?1:m(n);if(t instanceof c)return t;const o=D(e);return t===1?o+1:t===2?(o+6)%7+1:t===3?(o+6)%7:t>=11&&t<=17?(o+7-(t-10)%7)%7+1:i.NUM});const k=r=>{const n=(D(r)+6)%7,e=r-n+3,{year:t}=h(e);return Math.floor((e-U(t,1,1))/7)+1};l("ISOWEEKNUM",1,1,r=>{const n=d(r);return n instanceof c?n:k(n)}),l("WEEKNUM",1,2,(r,n)=>{const e=d(r);if(e instanceof c)return e;const t=n==null?1:m(n);if(t instanceof c)return t;if(t===21)return k(e);const o=t===1?0:t===2?1:t>=11&&t<=17?(t-10)%7:-1;if(o<0)return i.NUM;const a=U(h(e).year,1,1),s=(D(a)+7-o)%7;return Math.floor((e-a+s)/7)+1});const S=(r,n)=>{const{year:e,month:t,day:o}=h(r),a=e*12+t-1+n,s=Math.floor(a/12),f=a-s*12+1;return U(s,f,Math.min(o,A(s,f)))};l("EDATE",2,2,(r,n)=>{const e=d(r),t=m(n);if(e instanceof c)return e;if(t instanceof c)return t;const o=S(e,Math.trunc(t));return o<0?i.NUM:o}),l("EOMONTH",2,2,(r,n)=>{const e=d(r),t=m(n);if(e instanceof c)return e;if(t instanceof c)return t;const o=h(S(e,Math.trunc(t))),a=U(o.year,o.month,A(o.year,o.month));return a<0?i.NUM:a}),l("DAYS",2,2,(r,n)=>{const e=d(r),t=d(n);return e instanceof c?e:t instanceof c?t:e-t}),l("DATEDIF",3,3,(r,n,e)=>{const t=d(r),o=d(n),a=Y(e);if(t instanceof c)return t;if(o instanceof c)return o;if(a instanceof c)return a;if(t>o)return i.NUM;const s=h(t),f=h(o),u=(f.year-s.year)*12+f.month-s.month-(f.day<s.day?1:0);switch(a.toUpperCase()){case"D":return o-t;case"M":return u;case"Y":return Math.floor(u/12);case"YM":return u%12;case"MD":{if(f.day>=s.day)return f.day-s.day;const y=f.month===1?12:f.month-1,N=f.month===1?f.year-1:f.year;return A(N,y)-s.day+f.day}case"YD":{const y=f.year-s.year-(u%12<0?1:0),N=Math.floor(u/12),M=S(t,N*12);return y>=0?o-M:i.NUM}default:return i.NUM}});function K(r,n,e){const t=h(r),o=h(n);let a=t.day,s=o.day,f=o.month,u=o.year;return e?(a=Math.min(a,30),s=Math.min(s,30)):(a===A(t.year,t.month)&&(a=30),s===31&&(a<30?(s=1,f+=1,f>12&&(f=1,u+=1)):s=30)),(u-t.year)*360+(f-t.month)*30+s-a}l("DAYS360",2,3,(r,n,e)=>{const t=d(r),o=d(n),a=e===void 0?!1:X(e);return t instanceof c?t:o instanceof c?o:a instanceof c?a:K(t,o,a)});export function yearFrac(r,n,e){const[t,o]=r<=n?[r,n]:[n,r],a=h(t),s=h(o),f=o-t;switch(e){case 0:{let u=a.day,y=s.day;return W(a)&&(W(s)&&(y=30),u=30),y===31&&u>=30&&(y=30),u===31&&(u=30),((s.year-a.year)*360+(s.month-a.month)*30+y-u)/360}case 2:return f/360;case 3:return f/365;case 4:return K(t,o,!0)/360;default:{if(a.year===s.year||s.year===a.year+1&&(a.month>s.month||a.month===s.month&&a.day>=s.day)){let M;if(a.year===s.year)M=R(a.year);else{const E=w=>R(w)?U(w,2,29):1/0;M=E(a.year)>=t&&E(a.year)<=o||E(s.year)>=t&&E(s.year)<=o}return f/(M?366:365)}const y=s.year-a.year+1,N=U(s.year+1,1,1)-U(a.year,1,1);return f/(N/y)}}}l("YEARFRAC",2,3,(r,n,e)=>{const t=d(r),o=d(n),a=e==null?0:m(e);if(t instanceof c)return t;if(o instanceof c)return o;if(a instanceof c)return a;const s=Math.trunc(a);return s<0||s>4?i.NUM:yearFrac(t,o,s)});function x(r){const n=(...t)=>[0,1,2,3,4,5,6].map(o=>t.includes(o));if(r==null)return n(0,6);if(typeof r=="string"){if(!/^[01]{7}$/u.test(r)||r==="1111111")return i.VALUE;const t=r.split("").map(o=>o==="1");return[t[6]??!1,...t.slice(0,6)]}const e=m(r);return e instanceof c?e:e>=1&&e<=7?n((e+5)%7,(e+6)%7):e>=11&&e<=17?n(e-11):i.NUM}function _(r,n){if(r===void 0||r instanceof O)return new Set;const e=b([r],n);return e instanceof c?e:new Set(e.map(t=>Math.floor(t)))}function j(r,n,e,t){const o=r<=n?1:-1;let a=0;for(let s=r;o>0?s<=n:s>=n;s+=o)e[D(s)]!==!0&&!t.has(s)&&(a+=o);return a}function P(r,n,e,t){if(e.every(Boolean))return i.VALUE;const o=n<0?-1:1;let a=r;for(let s=Math.abs(n);s>0;)a+=o,e[D(a)]!==!0&&!t.has(a)&&(s-=1);return a<0?i.NUM:a}const v=r=>(n,e)=>{const t=d(e.calc.scalar(n[0],e.frame)),o=d(e.calc.scalar(n[1],e.frame));if(t instanceof c)return t;if(o instanceof c)return o;const a=r?n[2]:void 0,s=x(a===void 0||a instanceof O?void 0:e.calc.scalar(a,e.frame));if(s instanceof c)return s;const f=_(n[r?3:2],e);return f instanceof c?f:j(t,o,s,f)},F=r=>(n,e)=>{const t=d(e.calc.scalar(n[0],e.frame)),o=m(e.calc.scalar(n[1],e.frame));if(t instanceof c)return t;if(o instanceof c)return o;const a=r?n[2]:void 0,s=x(a===void 0||a instanceof O?void 0:e.calc.scalar(a,e.frame));if(s instanceof c)return s;const f=_(n[r?3:2],e);return f instanceof c?f:P(t,Math.trunc(o),s,f)};p("NETWORKDAYS",2,3,v(!1)),p("NETWORKDAYS.INTL",2,4,v(!0)),p("WORKDAY",2,3,F(!1)),p("WORKDAY.INTL",2,4,F(!0)),p("NOW",0,0,(r,n)=>n.calc.nowSerial(),{volatile:!0}),p("TODAY",0,0,(r,n)=>Math.floor(n.calc.nowSerial()),{volatile:!0});function $(r,n,e){const t=e[0]??0;let o=0;return n.forEach((a,s)=>{o+=a/(1+r)**(((e[s]??t)-t)/365)}),o}const C=(r,n)=>{const e=b([r[0]],n);if(e instanceof c)return e;const t=b([r[1]],n);return t instanceof c?t:e.length!==t.length||e.length===0?i.NUM:{values:e,dates:t.map(Math.floor)}};p("XNPV",3,3,(r,n)=>{const e=m(n.calc.scalar(r[0],n.frame));if(e instanceof c)return e;const t=C(r.slice(1),n);return t instanceof c?t:e<=0?i.NUM:$(e,t.values,t.dates)}),p("XIRR",2,3,(r,n)=>{const e=C(r,n);if(e instanceof c)return e;const{values:t,dates:o}=e;if(!t.some(u=>u>0)||!t.some(u=>u<0))return i.NUM;const a=r[2]===void 0||r[2]instanceof O?.1:m(n.calc.scalar(r[2],n.frame));if(a instanceof c)return a;const s=o[0]??0;let f=a;for(let u=0;u<100;u++){let y=0,N=0;t.forEach((E,w)=>{const T=((o[w]??s)-s)/365;y+=E/(1+f)**T,N-=T*E/(1+f)**(T+1)});const M=f-y/N;if(!Number.isFinite(M))return i.NUM;if(Math.abs(M-f)<1e-10)return M;f=M<=-1?(f-1)/2:M}return i.NUM});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Node } from "../../formula/ast.js";
|
|
2
|
+
import { CellError, type Scalar } from "../../values.js";
|
|
3
|
+
import type { Calc } from "../engine.js";
|
|
4
|
+
import { Reference, type Frame, type Value } from "../types.js";
|
|
5
|
+
export interface Call {
|
|
6
|
+
calc: Calc;
|
|
7
|
+
frame: Frame;
|
|
8
|
+
}
|
|
9
|
+
interface Base {
|
|
10
|
+
name: string;
|
|
11
|
+
min: number;
|
|
12
|
+
max: number;
|
|
13
|
+
/** A new value each pass, whatever it reads. */
|
|
14
|
+
volatile?: boolean;
|
|
15
|
+
/** Where it comes from: this repository, or @formulajs/formulajs. */
|
|
16
|
+
from: "allyhub" | "formulajs";
|
|
17
|
+
}
|
|
18
|
+
export type FunctionDef = Base & ({
|
|
19
|
+
kind: "scalar";
|
|
20
|
+
call: (...args: (Scalar | undefined)[]) => Scalar;
|
|
21
|
+
/** Given errors, rather than giving back the first. */
|
|
22
|
+
errors?: boolean;
|
|
23
|
+
} | {
|
|
24
|
+
kind: "raw";
|
|
25
|
+
call: (args: readonly Value[], c: Call) => Value;
|
|
26
|
+
} | {
|
|
27
|
+
kind: "lazy";
|
|
28
|
+
call: (args: readonly Node[], c: Call) => Value;
|
|
29
|
+
});
|
|
30
|
+
export declare const FUNCTIONS: Map<string, FunctionDef>;
|
|
31
|
+
/** A function that takes any number of arguments from `min`. */
|
|
32
|
+
export declare const many = 255;
|
|
33
|
+
export declare function scalar(name: string, min: number, max: number, call: (...args: (Scalar | undefined)[]) => Scalar, o?: {
|
|
34
|
+
errors?: boolean;
|
|
35
|
+
volatile?: boolean;
|
|
36
|
+
from?: Base["from"];
|
|
37
|
+
}): void;
|
|
38
|
+
export declare function raw(name: string, min: number, max: number, call: (args: readonly Value[], c: Call) => Value, o?: {
|
|
39
|
+
volatile?: boolean;
|
|
40
|
+
from?: Base["from"];
|
|
41
|
+
}): void;
|
|
42
|
+
export declare function lazy(name: string, min: number, max: number, call: (args: readonly Node[], c: Call) => Value): void;
|
|
43
|
+
/** Another name for a function, as Excel's older and newer ones are. */
|
|
44
|
+
export declare function alias(name: string, of: string): void;
|
|
45
|
+
/** A value as cells in rows, whatever it is. */
|
|
46
|
+
export interface Cells {
|
|
47
|
+
rows: number;
|
|
48
|
+
cols: number;
|
|
49
|
+
at: (row: number, col: number) => Scalar;
|
|
50
|
+
/** Its reference, when it is one. */
|
|
51
|
+
reference?: Reference;
|
|
52
|
+
}
|
|
53
|
+
/** A range's cells, down to the last row its sheet uses. */
|
|
54
|
+
export declare function cellsOf(v: Value, c: Call): Cells | CellError;
|
|
55
|
+
/** Every value of a function's arguments, and whether it was given directly rather than in a range. */
|
|
56
|
+
export declare function eachArg(args: readonly Value[], c: Call, visit: (value: Scalar, direct: boolean) => void): void;
|
|
57
|
+
/** Every cell of a function's arguments row by row, empty ones too, as text functions join them. */
|
|
58
|
+
export declare function eachRow(args: readonly Value[], c: Call, visit: (value: Scalar, direct: boolean) => void): void;
|
|
59
|
+
/** The numbers of arguments, as SUM and AVERAGE read them: text and TRUE count when given directly. */
|
|
60
|
+
export declare function numbersOf(args: readonly Value[], c: Call): number[] | CellError;
|
|
61
|
+
/** As numbersOf, with a range's text as 0 and TRUE as 1: AVERAGEA's and the like's. */
|
|
62
|
+
export declare function numbersOfA(args: readonly Value[], c: Call): number[] | CellError;
|
|
63
|
+
export declare const number: (fn: (...n: number[]) => Scalar) => (...args: (Scalar | undefined)[]) => Scalar;
|
|
64
|
+
/** Text, or the error converting gave. */
|
|
65
|
+
export declare function textArg(v: Scalar | undefined): string | CellError;
|
|
66
|
+
export declare function boolArg(v: Scalar | undefined, otherwise: boolean): boolean | CellError;
|
|
67
|
+
export declare function numberArg(v: Scalar | undefined, otherwise: number): number | CellError;
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=define.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{CellError as a,ERR as c,Matrix as u}from"../../values.js";import{toBool as h,toNumber as l,toText as b}from"../coerce.js";import{Lambda as i,Missing as p,Reference as m,Union as x}from"../types.js";export const FUNCTIONS=new Map;const d=255;export const many=d;export function scalar(e,r,o,n,t={}){FUNCTIONS.set(e,{name:e,min:r,max:o,kind:"scalar",call:n,from:t.from??"allyhub",...t.errors===!0?{errors:!0}:{},...t.volatile===!0?{volatile:!0}:{}})}export function raw(e,r,o,n,t={}){FUNCTIONS.set(e,{name:e,min:r,max:o,kind:"raw",call:n,from:t.from??"allyhub",...t.volatile===!0?{volatile:!0}:{}})}export function lazy(e,r,o,n){FUNCTIONS.set(e,{name:e,min:r,max:o,kind:"lazy",call:n,from:"allyhub"})}export function alias(e,r){const o=FUNCTIONS.get(r);o&&FUNCTIONS.set(e,{...o,name:e})}export function cellsOf(e,r){if(e instanceof a)return e;if(e instanceof x)return c.VALUE;if(e instanceof m){const n=Math.min(e.bottom,e.sheet.lastRow);return{rows:Math.max(0,n-e.top+1),cols:e.cols,at:(t,f)=>r.calc.read(e.sheet,e.top+t,e.left+f),reference:e}}if(e instanceof u)return{rows:e.rows,cols:e.cols,at:(n,t)=>e.at(n,t)};if(e instanceof i)return c.VALUE;const o=e instanceof p?null:e;return{rows:1,cols:1,at:()=>o}}export function eachArg(e,r,o){for(const n of e)if(n instanceof m)r.calc.each(n,t=>{o(t,!1)});else if(n instanceof x)for(const t of n.parts)r.calc.each(t,f=>{o(f,!1)});else if(n instanceof u)for(const t of n.data)t!==null&&o(t,!1);else n instanceof p?o(null,!0):n instanceof i?o(c.VALUE,!0):o(n,!0)}export function eachRow(e,r,o){const n=t=>{for(const f of r.calc.matrix(t).data)o(f,!1)};for(const t of e)if(t instanceof m)n(t);else if(t instanceof x)t.parts.forEach(n);else if(t instanceof u)for(const f of t.data)o(f,!1);else t instanceof p?o(null,!0):t instanceof i?o(c.VALUE,!0):o(t,!0)}export function numbersOf(e,r){const o=[];let n;return eachArg(e,r,(t,f)=>{if(!n){if(t instanceof a)n=t;else if(typeof t=="number")o.push(t);else if(f){const s=l(t);s instanceof a?n=s:o.push(s)}}}),n??o}export function numbersOfA(e,r){const o=[];let n;return eachArg(e,r,(t,f)=>{if(!n)if(t instanceof a)n=t;else if(typeof t=="number")o.push(t);else if(typeof t=="boolean")o.push(t?1:0);else if(f){const s=l(t);s instanceof a?n=s:o.push(s)}else typeof t=="string"&&o.push(0)}),n??o}export const number=e=>(...r)=>{const o=[];for(const n of r){const t=l(n);if(t instanceof a)return t;o.push(t)}return e(...o)};export function textArg(e){return b(e)}export function boolArg(e,r){return e==null?r:h(e)}export function numberArg(e,r){return e===void 0?r:l(e)}
|