allyhub 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/align.js +1 -1
- package/dist/commands/check.js +1 -1
- package/dist/commands/cloud-tools.js +1 -1
- package/dist/commands/cloud.js +1 -1
- package/dist/commands/dev.js +5 -5
- package/dist/commands/export.js +3 -0
- package/dist/commands/frames/doc.js +1 -1
- package/dist/commands/frames/piece.js +1 -1
- package/dist/commands/frames/sheet.js +1 -1
- package/dist/commands/frames.js +9 -9
- package/dist/commands/index.js +1 -1
- package/dist/commands/inspect/combos.js +1 -1
- package/dist/commands/inspect/common.js +2 -2
- package/dist/commands/inspect/facts.js +2 -2
- package/dist/commands/migrate.js +3 -0
- package/dist/commands/skills.js +3 -3
- package/dist/commands/upgrade.js +5 -0
- package/dist/commands.json +1 -1
- package/dist/help.js +3 -3
- package/dist/main.js +8 -7
- package/dist/node_modules/@allyhub/3d-extension/package.json +2 -2
- package/dist/node_modules/@allyhub/audio/package.json +1 -1
- package/dist/node_modules/@allyhub/blocks/LICENSE +241 -0
- package/dist/node_modules/@allyhub/blocks/dist/alt.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/elements.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/flow-resolve.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/flow-table.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/format.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/gantt.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/grids.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/html.js +75 -0
- package/dist/node_modules/@allyhub/blocks/dist/icons.generated.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/icons.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/layout.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/look.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/measure.js +3 -0
- package/dist/node_modules/@allyhub/blocks/dist/model.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/page.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/palette.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/path.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/resolve.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/samples.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/sankey.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/svg.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/tidy.js +2 -0
- package/dist/node_modules/@allyhub/blocks/dist/trees.js +2 -0
- package/dist/node_modules/@allyhub/blocks/package.json +19 -0
- package/dist/node_modules/@allyhub/browser/dist/html.js +1 -1
- package/dist/node_modules/@allyhub/browser/package.json +1 -1
- package/dist/node_modules/@allyhub/build/dist/fonts.js +9 -3
- package/dist/node_modules/@allyhub/build/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/inspect-view.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/migrate.js +2 -0
- package/dist/node_modules/@allyhub/build/dist/prepare.js +3 -3
- package/dist/node_modules/@allyhub/build/dist/work.js +3 -3
- package/dist/node_modules/@allyhub/build/package.json +5 -1
- package/dist/node_modules/@allyhub/canvas-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-model/package.json +1 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-file.js +2 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +4 -3
- package/dist/node_modules/@allyhub/chart/dist/chart.js +4 -2
- package/dist/node_modules/@allyhub/chart/dist/chartex-xml.js +4 -0
- package/dist/node_modules/@allyhub/chart/dist/classic.js +2 -0
- package/dist/node_modules/@allyhub/chart/dist/embedded.js +2 -2
- package/dist/node_modules/@allyhub/chart/dist/extended.js +2 -0
- package/dist/node_modules/@allyhub/chart/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/chart/dist/svg.js +1 -1
- package/dist/node_modules/@allyhub/chart/dist/tree.js +2 -0
- package/dist/node_modules/@allyhub/chart/package.json +1 -1
- package/dist/node_modules/@allyhub/check/dist/check.js +1 -1
- package/dist/node_modules/@allyhub/check/package.json +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/blobs.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/call.js +4 -4
- package/dist/node_modules/@allyhub/cloud/dist/client.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/storage.js +2 -0
- package/dist/node_modules/@allyhub/cloud/dist/uploads.js +2 -2
- package/dist/node_modules/@allyhub/cloud/package.json +1 -1
- package/dist/node_modules/@allyhub/components/package.json +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/background.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/item-process.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/item-worker.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/live.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/pages.js +20 -1
- package/dist/node_modules/@allyhub/dev-server/dist/project.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/record.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/server.js +2 -2
- package/dist/node_modules/@allyhub/dev-server/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/validate.js +2 -2
- package/dist/node_modules/@allyhub/dev-server/dist/writer.js +3 -3
- package/dist/node_modules/@allyhub/dev-server/package.json +1 -1
- package/dist/node_modules/@allyhub/diagnostics/dist/rules.js +1 -1
- package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
- package/dist/node_modules/@allyhub/doc/dist/blocks.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/color.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/docx-read.js +12 -0
- package/dist/node_modules/@allyhub/doc/dist/docx.js +5 -4
- package/dist/node_modules/@allyhub/doc/dist/html.js +83 -48
- package/dist/node_modules/@allyhub/doc/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/markdown.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/merges.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/model.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/numbering.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/omml.js +3 -0
- package/dist/node_modules/@allyhub/doc/dist/page.js +2 -1
- package/dist/node_modules/@allyhub/doc/dist/paper.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/parse.js +5 -4
- package/dist/node_modules/@allyhub/doc/dist/redline.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/revisions.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/shapes.js +4 -0
- package/dist/node_modules/@allyhub/doc/dist/styles.js +2 -0
- package/dist/node_modules/@allyhub/doc/dist/table.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/write.js +65 -39
- package/dist/node_modules/@allyhub/doc/package.json +5 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/build.js +2 -2
- package/dist/node_modules/@allyhub/doc-extension/dist/cli/find.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/cli/import.js +3 -0
- package/dist/node_modules/@allyhub/doc-extension/dist/cli/index.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/cli/styles.js +4 -0
- package/dist/node_modules/@allyhub/doc-extension/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/inspect.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/project-tools.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/package.json +22 -2
- package/dist/node_modules/@allyhub/doc-print/dist/drawn.js +4 -4
- package/dist/node_modules/@allyhub/doc-print/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/doc-print/dist/layout.js +8 -7
- package/dist/node_modules/@allyhub/doc-print/dist/print.js +22 -16
- package/dist/node_modules/@allyhub/doc-print/package.json +1 -1
- package/dist/node_modules/@allyhub/export/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/export/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-api/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-host/dist/points.js +1 -1
- package/dist/node_modules/@allyhub/extension-host/package.json +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/blocks-flow.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/blocks.d.ts +146 -0
- package/dist/node_modules/@allyhub/formats/dist/data/blocks.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/cell-styles.d.ts +9 -0
- package/dist/node_modules/@allyhub/formats/dist/data/cell-styles.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/deck-code.d.ts +47 -40
- package/dist/node_modules/@allyhub/formats/dist/data/deck-code.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/diagram-kinds.d.ts +6 -0
- package/dist/node_modules/@allyhub/formats/dist/data/diagram-kinds.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/diagrams.d.ts +29 -0
- package/dist/node_modules/@allyhub/formats/dist/data/diagrams.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/faces.d.ts +18 -0
- package/dist/node_modules/@allyhub/formats/dist/data/faces.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/page-data.d.ts +59 -0
- package/dist/node_modules/@allyhub/formats/dist/data/page-data.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/reference.d.ts +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +698 -258
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +14104 -2167
- package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/themes.d.ts +82 -0
- package/dist/node_modules/@allyhub/formats/dist/data/themes.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/tokens.d.ts +67 -0
- package/dist/node_modules/@allyhub/formats/dist/data/tokens.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/work.d.ts +42 -0
- package/dist/node_modules/@allyhub/formats/dist/data/work.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/index.d.ts +7 -0
- package/dist/node_modules/@allyhub/formats/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/items.d.ts +12 -3
- package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +3260 -290
- package/dist/node_modules/@allyhub/formats/dist/schemas.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/tolerant.d.ts +45 -0
- package/dist/node_modules/@allyhub/formats/dist/tolerant.js +2 -0
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/html-extension/dist/project-tools.js +21 -9
- package/dist/node_modules/@allyhub/html-extension/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/html-extension/markup/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/html-extension/markup/markup.json +14 -4
- package/dist/node_modules/@allyhub/html-extension/markup/pages/budget.html +22 -1
- package/dist/node_modules/@allyhub/html-extension/package.json +9 -1
- package/dist/node_modules/@allyhub/i18n/package.json +1 -1
- package/dist/node_modules/@allyhub/image-draw/dist/fonts.js +1 -1
- package/dist/node_modules/@allyhub/image-draw/dist/inspect.js +2 -2
- package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/build-plugins.js +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/cli.js +1 -1
- package/dist/node_modules/@allyhub/image-extension/package.json +2 -2
- package/dist/node_modules/@allyhub/image-extension/skills/allyhub/references/images.md +1 -1
- package/dist/node_modules/@allyhub/image-measure/dist/layout.js +2 -2
- package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/image-psd/package.json +1 -1
- package/dist/node_modules/@allyhub/image-render/package.json +1 -1
- package/dist/node_modules/@allyhub/image-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/image-sdk/dist/block.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/blocks.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/jobs/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-extension/package.json +1 -3
- package/dist/node_modules/@allyhub/linkedin-extension/skills/allyhub/references/linkedin.md +3 -3
- package/dist/node_modules/@allyhub/linkedin-model/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-view/package.json +1 -1
- package/dist/node_modules/@allyhub/measure/package.json +1 -1
- package/dist/node_modules/@allyhub/media/package.json +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/analyses/faces.js +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/asr/transcribe.js +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/ocr/text.js +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/vision/faces.js +1 -1
- package/dist/node_modules/@allyhub/media-extension/dist/vision/index-media.js +3 -2
- package/dist/node_modules/@allyhub/media-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/model/package.json +1 -1
- package/dist/node_modules/@allyhub/office-extension/markup/csv/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/csv/markup.json +1 -1
- package/dist/node_modules/@allyhub/office-extension/markup/document/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/presentation/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/workbook/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/workbook/markup.json +1 -1
- package/dist/node_modules/@allyhub/office-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/ext.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/mce.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/node.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/ns.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/opc.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
- package/dist/node_modules/@allyhub/piece/dist/export.d.ts +1 -1
- package/dist/node_modules/@allyhub/piece/dist/layout.d.ts +2 -0
- package/dist/node_modules/@allyhub/piece/dist/look.d.ts +10 -2
- package/dist/node_modules/@allyhub/piece/dist/look.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/media.d.ts +8 -2
- package/dist/node_modules/@allyhub/piece/dist/script.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/source.d.ts +3 -0
- package/dist/node_modules/@allyhub/piece/package.json +1 -1
- package/dist/node_modules/@allyhub/project/dist/media-index.js +1 -1
- package/dist/node_modules/@allyhub/project/package.json +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cli.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/events.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/kinds.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/page-frame.js +2 -0
- package/dist/node_modules/@allyhub/protocol/package.json +1 -1
- package/dist/node_modules/@allyhub/registry/package.json +1 -1
- package/dist/node_modules/@allyhub/render/package.json +1 -1
- package/dist/node_modules/@allyhub/runtime/dist/footage.js +1 -1
- package/dist/node_modules/@allyhub/runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/dist/packages.js +2 -2
- package/dist/node_modules/@allyhub/runtimes/dist/runtimes.js +3 -3
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub/scaffold/dist/index.js +12 -8
- package/dist/node_modules/@allyhub/scaffold/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery-host/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/charts.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/index.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/engine.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/server.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/cell-styles.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/check.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/file.js +2 -2
- package/dist/node_modules/@allyhub/sheet/dist/heatmap.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/html.js +10 -10
- package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/inspect.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/paginate.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/printed.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/sdk.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/sparklines.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/table-style.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/table-styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/theme.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/tiles.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/units.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/write.js +14 -14
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/theme.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
- package/dist/node_modules/@allyhub/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/build.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/cli/sheet.js +7 -7
- package/dist/node_modules/@allyhub/sheet-extension/dist/code.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/evaluate.js +2 -2
- package/dist/node_modules/@allyhub/sheet-extension/dist/export.js +2 -2
- package/dist/node_modules/@allyhub/sheet-extension/dist/inspect.js +2 -2
- package/dist/node_modules/@allyhub/sheet-extension/dist/migrations.js +4 -0
- package/dist/node_modules/@allyhub/sheet-extension/dist/project-tools.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/package.json +7 -3
- package/dist/node_modules/@allyhub/slides-core/dist/api.js +2 -2
- package/dist/node_modules/@allyhub/slides-core/dist/blocks.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/chart-api.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/code.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/file.js +3 -3
- package/dist/node_modules/@allyhub/slides-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/measure.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/model.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/office-layouts.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/office.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/script.js +2 -2
- package/dist/node_modules/@allyhub/slides-core/dist/styles/brief.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/editorial.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/index.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/kit.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/layouts.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/pitch.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/stage.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/styles/tiles.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/theme.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/units.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/check.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/cli/slides.js +2 -2
- package/dist/node_modules/@allyhub/slides-extension/dist/deck-fonts.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/project-tools.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/package.json +24 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/charts.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/fonts.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/image-size.js +2 -0
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/code.js +3 -3
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/index.js +7 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/names.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/script.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/mtx.js +2 -0
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/chart.js +3 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/chartex.js +3 -0
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/common.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/index.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/shapes.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/table.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/text.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/timing.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/shapes.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/text.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/write.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/xml.js +3 -2
- package/dist/node_modules/@allyhub/slides-pptx/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/dist/draw.js +2 -2
- package/dist/node_modules/@allyhub/slides-runtime/dist/load.js +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/stage/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/files/archivo-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-ext-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-ext-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo/latin-ext-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo-black/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo-black/files/archivo-black-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo-black/files/archivo-black-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo-black/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/archivo-black/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/files/ibm-plex-sans-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-ext-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-ext-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/ibm-plex-sans/latin-ext-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/files/inter-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-ext-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-ext-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/inter-static/latin-ext-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/files/newsreader-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-ext-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-ext-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/newsreader/latin-ext-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/files/plus-jakarta-sans-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-ext-400-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-ext-400.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-ext-700-italic.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/plus-jakarta-sans/latin-ext-700.css +1 -0
- package/dist/node_modules/@allyhub/stage-page/dist/host.js +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/runtime/stage.html +42 -0
- package/dist/node_modules/@allyhub/stage-page/dist/style-faces.js +2 -0
- package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-runtime/dist/runtime.js +96 -92
- package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/telemetry/dist/limit.js +2 -0
- package/dist/node_modules/@allyhub/telemetry/package.json +5 -1
- package/dist/node_modules/@allyhub/text-extension/markup/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/text-extension/markup-file/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/text-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/footage-motion.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/measure.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/seams.js +1 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/cli/reference-text.js +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/inspect/index.js +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/inspect/joins.js +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/inspect/loop.js +3 -0
- package/dist/node_modules/@allyhub/video-extension/package.json +2 -25
- package/dist/node_modules/@allyhub/video-measure/dist/check.js +2 -2
- package/dist/node_modules/@allyhub/video-measure/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/video-measure/dist/seams.js +1 -1
- package/dist/node_modules/@allyhub/video-measure/dist/version.js +1 -1
- package/dist/node_modules/@allyhub/video-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/video-sdk/dist/free.js +1 -1
- package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/website/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/website/dist/website.js +2 -2
- package/dist/node_modules/@allyhub/website/package.json +1 -1
- package/dist/node_modules/@allyhub/website-extension/package.json +3 -3
- package/dist/node_modules/@allyhub/x-extension/package.json +1 -3
- package/dist/node_modules/@allyhub/x-extension/skills/allyhub/references/x.md +3 -3
- package/dist/node_modules/@allyhub/x-model/package.json +1 -1
- package/dist/node_modules/@allyhub/x-view/package.json +1 -1
- package/dist/package.json +14 -14
- package/dist/self-upgrade.js +2 -0
- package/dist/text/batch-text.js +1 -1
- package/dist/text/facts-text.js +5 -5
- package/dist/text/format.js +2 -2
- package/dist/update-notice.js +3 -0
- package/dist/version.js +1 -1
- package/dist/works.js +1 -1
- package/editor-web/assets/{abnfDiagram-WEYOIA3C-DYaMS_BB.js → abnfDiagram-WEYOIA3C-BkVJMd53.js} +1 -1
- package/editor-web/assets/{architecture-WOLXFQ4H-g_Tjfl_y.js → architecture-WOLXFQ4H-C6rnaynZ.js} +1 -1
- package/editor-web/assets/{architectureDiagram-ZHVYKT53-CqdhofOL.js → architectureDiagram-ZHVYKT53-D3vrh8LK.js} +1 -1
- package/editor-web/assets/arrow-down-D-QZrqcz.js +1 -0
- package/editor-web/assets/arrow-up-B1zjKUHX.js +1 -0
- package/editor-web/assets/article-DHf6mOY_.js +7 -0
- package/editor-web/assets/article-Dns1-Xh-.js +3 -0
- package/editor-web/assets/{audio-lines-PZj77e7t.js → audio-lines-BFoW_IeO.js} +1 -1
- package/editor-web/assets/bar-button-CKPfx2AB.js +1 -0
- package/editor-web/assets/{blockDiagram-RJAE7QA3-Bc-28Bci.js → blockDiagram-RJAE7QA3-BKngt8H7.js} +1 -1
- package/editor-web/assets/{browser-C9NP0ZYz.js → browser-DEGNhKTV.js} +1 -1
- package/editor-web/assets/{c4Diagram-XDPPPE54-CTGJb8FB.js → c4Diagram-XDPPPE54-j7sUELqF.js} +1 -1
- package/editor-web/assets/calc-worker-Cr4a0xmt.js +168 -0
- package/editor-web/assets/channel-CVWSV3su.js +1 -0
- package/editor-web/assets/{chart-no-axes-column-Be0lFcGF.js → chart-no-axes-column-Dyy25XZ_.js} +1 -1
- package/editor-web/assets/chip-Bn_9JRRG.js +1 -0
- package/editor-web/assets/{chunk-2E7WHVMD-B2MPOVTU.js → chunk-2E7WHVMD-BXa-uRSi.js} +1 -1
- package/editor-web/assets/{chunk-4EMNKR2T-BUV1ZHP0.js → chunk-4EMNKR2T-B3ntcsZN.js} +1 -1
- package/editor-web/assets/{chunk-55XCU76K-BZlpspL5.js → chunk-55XCU76K-AMvnFwUg.js} +1 -1
- package/editor-web/assets/{chunk-7S6XSTFO-CpKeisWE.js → chunk-7S6XSTFO-BA6esfFu.js} +1 -1
- package/editor-web/assets/{chunk-AQDTSKZB-BJqwAPyo.js → chunk-AQDTSKZB-BT_vANXs.js} +1 -1
- package/editor-web/assets/{chunk-DSNLSHJZ-D6oPWl_W.js → chunk-DSNLSHJZ-DoUgmzGB.js} +1 -1
- package/editor-web/assets/{chunk-HAGFOTED-B5pk4MZF.js → chunk-HAGFOTED-DtnIrCZb.js} +1 -1
- package/editor-web/assets/{chunk-HNE4Q36P-DHbSPvxQ.js → chunk-HNE4Q36P-BlPwQx3_.js} +1 -1
- package/editor-web/assets/{chunk-NQOKRVIF-CcL_GcRA.js → chunk-NQOKRVIF-D2r7jp2r.js} +1 -1
- package/editor-web/assets/{chunk-UHW7PFBP-YgiOL6XE.js → chunk-UHW7PFBP-Cmc0_F5o.js} +1 -1
- package/editor-web/assets/{chunk-VQ5W62QI-p14b4UYc.js → chunk-VQ5W62QI-nJSMqAr0.js} +1 -1
- package/editor-web/assets/{chunk-WQQL4CDK-BWW0x-XH.js → chunk-WQQL4CDK-Btq2nbF6.js} +1 -1
- package/editor-web/assets/{chunk-YZO67HFG-oG3qd68C.js → chunk-YZO67HFG-DTbcCoGt.js} +1 -1
- package/editor-web/assets/{chunk-ZAUX2LTX-CpcheH0u.js → chunk-ZAUX2LTX-DVwkg-2N.js} +1 -1
- package/editor-web/assets/{chunk-ZCHMQSOR-cWQvLl1w.js → chunk-ZCHMQSOR-BV39jOOE.js} +1 -1
- package/editor-web/assets/{classDiagram-v2-4MYWR3UA-7PG7YcdU.js → classDiagram-v2-4MYWR3UA-Cj74-fhM.js} +1 -1
- package/editor-web/assets/code-Ch6AB5bZ.js +1 -0
- package/editor-web/assets/collaborator-XiHOxwGM.js +1 -0
- package/editor-web/assets/{copy-CuJSs0nI.js → copy-SoaMYqsN.js} +1 -1
- package/editor-web/assets/{createLucideIcon-lm_6n8YT.js → createLucideIcon-euu7Wcd9.js} +1 -1
- package/editor-web/assets/{cynefin-EF2NZ3EQ-CtcknEQ_.js → cynefin-EF2NZ3EQ-C0CkiipV.js} +1 -1
- package/editor-web/assets/{cynefinDiagram-WF24UDRP-Ca7VIsjN.js → cynefinDiagram-WF24UDRP-hdsnJ4cI.js} +1 -1
- package/editor-web/assets/{dagre-NK4GIZVX-BzcSLtsr.js → dagre-NK4GIZVX-CC7WSgaK.js} +1 -1
- package/editor-web/assets/deck-DQpNIS2p.js +1 -0
- package/editor-web/assets/{diagram-CBK3MWTC-DpRmTGlG.js → diagram-CBK3MWTC-DmaVm13J.js} +1 -1
- package/editor-web/assets/{diagram-I5XIIV2D-BTrs_AX8.js → diagram-I5XIIV2D-De8jqp7b.js} +1 -1
- package/editor-web/assets/{diagram-ODIL2UCW-CkIVjPqH.js → diagram-ODIL2UCW-B5pBTulX.js} +1 -1
- package/editor-web/assets/{diagram-PFBEJUXE-BlFMbAG1.js → diagram-PFBEJUXE-BYsXg5_w.js} +1 -1
- package/editor-web/assets/{diagram-RJA3I4VV-D3f8VJ-D.js → diagram-RJA3I4VV-DZ8f6bYe.js} +1 -1
- package/editor-web/assets/{diagram-TYUNFSNR-Bbpngj6F.js → diagram-TYUNFSNR-qXHUsauD.js} +1 -1
- package/editor-web/assets/dist--z0ZHp4T.js +16 -0
- package/editor-web/assets/dist-9kuRjUTN.js +41 -0
- package/editor-web/assets/dist-B3rd02Cg.js +6 -0
- package/editor-web/assets/dist-B5GOGGEe.js +1 -0
- package/editor-web/assets/dist-Bx6q9kCu.js +1 -0
- package/editor-web/assets/dist-C4hHtrJr.js +1 -0
- package/editor-web/assets/dist-CCXJewsi.js +19 -0
- package/editor-web/assets/dist-CfK2BLl8.js +4 -0
- package/editor-web/assets/dist-Cmux3oJ_.js +1 -0
- package/editor-web/assets/dist-Cspf85KV.js +6 -0
- package/editor-web/assets/dist-DA72-4WB.js +82 -0
- package/editor-web/assets/{dist-DruvDNQe.js → dist-DAhe-kFC.js} +5 -5
- package/editor-web/assets/dist-DIJnhQFK.js +9 -0
- package/editor-web/assets/dist-DOrGo1GD.js +19 -0
- package/editor-web/assets/{dist-Bd8IxQPP.js → dist-DQ6RpEJD.js} +2 -2
- package/editor-web/assets/dist-DjiCHlSu.js +35 -0
- package/editor-web/assets/dist-Do4a40Wn.js +19 -0
- package/editor-web/assets/dist-FKEWS3Co.js +547 -0
- package/editor-web/assets/dist-QKd2i6kG.js +5 -0
- package/editor-web/assets/dist-SGnOfLhx.js +24 -0
- package/editor-web/assets/dist-VmVB7tl4.js +3 -0
- package/editor-web/assets/{docx-draw-CoK1oqQD.js → docx-draw-L54blreB.js} +1 -1
- package/editor-web/assets/{ebnfDiagram-V4P3TTPT-BaKj-yL6.js → ebnfDiagram-V4P3TTPT-B7-IfVI-.js} +1 -1
- package/editor-web/assets/{elk-QONTBCTQ-Cn2qv1_U.js → elk-QONTBCTQ-Gj_WaeBn.js} +1 -1
- package/editor-web/assets/{erDiagram-KYQIGQAA-Bd7AEIDo.js → erDiagram-KYQIGQAA-BDF6Qoqx.js} +1 -1
- package/editor-web/assets/esm-PQD5Pn8a.js +21 -0
- package/editor-web/assets/{eventmodeling-K75KTNOO-Sfp7_461.js → eventmodeling-K75KTNOO-elxVXXEe.js} +1 -1
- package/editor-web/assets/{file-question-mark-DlIjUK37.js → file-question-mark-PeZgyqkK.js} +1 -1
- package/editor-web/assets/flowDiagram-IUGLLWBU-B-25n8zE.js +1 -0
- package/editor-web/assets/{ganttDiagram-R7GPNTJY-CBqcGdHI.js → ganttDiagram-R7GPNTJY-CEogW3jW.js} +1 -1
- package/editor-web/assets/{gitGraph-VSP46ZUC-WTokXKTW.js → gitGraph-VSP46ZUC-Bh9cRWFa.js} +1 -1
- package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-BIWZHD9q.js → gitGraphDiagram-PDYL7XHY-BQAvdM_V.js} +1 -1
- package/editor-web/assets/{group-BdrTp7gi.js → group-DwM2yqU8.js} +1 -1
- package/editor-web/assets/hint-CbwoSBMw.js +1 -0
- package/editor-web/assets/index-CXisi0Cj.css +2 -0
- package/editor-web/assets/index-wMlfx8aT.js +28 -0
- package/editor-web/assets/{info-OHQRW6UA-COC6G-_J.js → info-OHQRW6UA-CdPrqere.js} +1 -1
- package/editor-web/assets/{infoDiagram-MVDRKAX5-DpaqdKBD.js → infoDiagram-MVDRKAX5-uwIMeP44.js} +1 -1
- package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-Dyn2MAy1.js → ishikawaDiagram-HPEHV2GE-rtfvqK7E.js} +1 -1
- package/editor-web/assets/iso-UwGLGD3F.js +1 -0
- package/editor-web/assets/{italic-zw4_eUNF.js → italic-BV7iHxoP.js} +1 -1
- package/editor-web/assets/{journeyDiagram-BOSHW7O7-DeSVfmm7.js → journeyDiagram-BOSHW7O7-mmhfIyVG.js} +1 -1
- package/editor-web/assets/{kanban-definition-FNSA4HC5-Bfg0lj7B.js → kanban-definition-FNSA4HC5-Fe7jBsi-.js} +1 -1
- package/editor-web/assets/{link-DopSU3aa.js → link-CFOv3nz-.js} +1 -1
- package/editor-web/assets/{mermaid-parser.core-CyhovuYE.js → mermaid-parser.core-BxOSjBH9.js} +3 -3
- package/editor-web/assets/{mermaid.core-Dx1fBVUG.js → mermaid.core-BOln9YdH.js} +4 -4
- package/editor-web/assets/{mindmap-definition-6OY57UG3-QEU2HF_m.js → mindmap-definition-6OY57UG3-M3Q1LOtO.js} +1 -1
- package/editor-web/assets/minus-ngE8owxs.js +1 -0
- package/editor-web/assets/{packet-JDAUHWVQ-ReJTa_hw.js → packet-JDAUHWVQ-Dbb0TUG6.js} +1 -1
- package/editor-web/assets/{pegDiagram-ECIUJNBX-Bo1jFrvb.js → pegDiagram-ECIUJNBX-BZMRpSFC.js} +1 -1
- package/editor-web/assets/{pie-XZMESJXO-BrtYafNA.js → pie-XZMESJXO-Ctm9XdKp.js} +1 -1
- package/editor-web/assets/{pieDiagram-GNMPY74T-Cj0zQqs_.js → pieDiagram-GNMPY74T-cGbs5ZTl.js} +1 -1
- package/editor-web/assets/progress-DZQTiRLv.js +6 -0
- package/editor-web/assets/{quadrantDiagram-D57K4MC3-D5npDAVn.js → quadrantDiagram-D57K4MC3-BUe_zsxT.js} +1 -1
- package/editor-web/assets/{radar-ABXABTNO-C8RDrRqi.js → radar-ABXABTNO-CCmKtqLs.js} +1 -1
- package/editor-web/assets/{railroad-I3PHUGI6-ebDrmYTK.js → railroad-I3PHUGI6-k-yhjhjA.js} +1 -1
- package/editor-web/assets/{railroad-abnf-LNEFI6M7-BxKuqg6V.js → railroad-abnf-LNEFI6M7-B-PvntB3.js} +1 -1
- package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-DOclnfpr.js → railroad-ebnf-DWYD2UWJ-Ds2rua1h.js} +1 -1
- package/editor-web/assets/{railroad-peg-JR7BVNR7-DN0A1fpq.js → railroad-peg-JR7BVNR7-jNZ2wEp2.js} +1 -1
- package/editor-web/assets/{railroadDiagram-Y72NRBL7-B3PjoVWw.js → railroadDiagram-Y72NRBL7-CTqSQ15w.js} +1 -1
- package/editor-web/assets/react-Byupo4pA.js +1 -0
- package/editor-web/assets/replace-CLLMtF4e.js +1 -0
- package/editor-web/assets/{requirementDiagram-EQYSW5RA-DLdzkQk5.js → requirementDiagram-EQYSW5RA-CUblhR5M.js} +1 -1
- package/editor-web/assets/ribbon-DajdQ_Ya.js +1 -0
- package/editor-web/assets/row-Bei9HNEe.js +1 -0
- package/editor-web/assets/{sankeyDiagram-SY24JHO5-Dip4Piv_.js → sankeyDiagram-SY24JHO5-nSz6zDX3.js} +1 -1
- package/editor-web/assets/schemas-C21MyseF.js +1 -0
- package/editor-web/assets/{iso-DoC-ZoBr.js → schemas-DlRAoVtq.js} +1 -1
- package/editor-web/assets/{scissors-B_xOiUhd.js → scissors-m6QcoEf2.js} +1 -1
- package/editor-web/assets/search-D75Bi2GU.js +1 -0
- package/editor-web/assets/{sequenceDiagram-BLEHNHQU-QnPcoybL.js → sequenceDiagram-BLEHNHQU-DxTpOYuo.js} +1 -1
- package/editor-web/assets/{session-DMlLCFWg.js → session-BhClkDyr.js} +1 -1
- package/editor-web/assets/{sigma-DSUsJhMn.js → sigma-B4AWtnVA.js} +1 -1
- package/editor-web/assets/snapshots-DwGHDN3t.js +1 -0
- package/editor-web/assets/sound-DkR3qxSt.js +1 -0
- package/editor-web/assets/split-DBAbwPZ5.js +3 -0
- package/editor-web/assets/{square-arrow-out-up-right-DF5dvsSp.js → square-arrow-out-up-right-1NqFsNDe.js} +1 -1
- package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-D103CiMX.js → stateDiagram-v2-A6IESKWZ-C3e14iHY.js} +1 -1
- package/editor-web/assets/{sticky-note-BdkIu5_D.js → sticky-note-s4QfzaBB.js} +1 -1
- package/editor-web/assets/surface-CIF0Ae0z.js +1 -0
- package/editor-web/assets/swatch-BUzr_XmH.js +1 -0
- package/editor-web/assets/{swimlanes-B3ENRKFQ-y4gCqEoa.js → swimlanes-B3ENRKFQ-DPPdzNzu.js} +1 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-B8n3zOw_.js +8 -0
- package/editor-web/assets/switch-DrZxoPQS.js +1 -0
- package/editor-web/assets/{syntax-CU_WPKxt.js → syntax-emXV4DnN.js} +1 -1
- package/editor-web/assets/table-BW43XXVd.js +1 -0
- package/editor-web/assets/tabs-BwU2E7bU.js +1 -0
- package/editor-web/assets/text-wrap-Baus6l-V.js +1 -0
- package/editor-web/assets/textarea-BX_ax3X8.js +1 -0
- package/editor-web/assets/{timeline-definition-JXYKGLGB-BMp76v4V.js → timeline-definition-JXYKGLGB-DRTJ1_Er.js} +1 -1
- package/editor-web/assets/tolerant-DM9s0Mt1.js +1 -0
- package/editor-web/assets/{treeView-D4JQ5SDB-Q_GYyk0b.js → treeView-D4JQ5SDB-BYJ_m-i5.js} +1 -1
- package/editor-web/assets/{treemap-SAJKECNS-B5lRWdQB.js → treemap-SAJKECNS-BcU6I6Rg.js} +1 -1
- package/editor-web/assets/type-CvZ0HZsV.js +41 -0
- package/editor-web/assets/{undo-2-C47jrRp5.js → undo-2-DCbMWoug.js} +1 -1
- package/editor-web/assets/{usecaseDiagram-WPOLBNNX--QRllA-U.js → usecaseDiagram-WPOLBNNX-YV92pS4o.js} +1 -1
- package/editor-web/assets/{vennDiagram-Q3Y3IDCW-CzkATPA3.js → vennDiagram-Q3Y3IDCW-oAvfHZtf.js} +1 -1
- package/editor-web/assets/video-SJvDRCJK.js +1 -0
- package/editor-web/assets/{wardley-7MLQ67FV-BXzwcdJa.js → wardley-7MLQ67FV-BLNiqxtt.js} +1 -1
- package/editor-web/assets/{wardleyDiagram-IVAIDKWA-BQvC8Agx.js → wardleyDiagram-IVAIDKWA-SppgC6xW.js} +1 -1
- package/editor-web/assets/{whole-word-D3ZAtnkw.js → whole-word-C9TkGBCY.js} +1 -1
- package/editor-web/assets/{words-CaUHhQHf.js → words-BUlNNuH2.js} +3 -3
- package/editor-web/assets/words-zMedmPWc.js +3 -0
- package/editor-web/assets/workbook-BZKYx4WB.js +41 -0
- package/editor-web/assets/{xychartDiagram-4URNHDU4-aY-lsD5o.js → xychartDiagram-4URNHDU4-BHMn_jwJ.js} +1 -1
- package/editor-web/assets/{zoom-in-PgsC94hP.js → zoom-in-yAGKspfC.js} +1 -1
- package/editor-web/index.html +9 -8
- package/package.json +3 -3
- package/CHANGELOG.md +0 -251
- package/dist/commands/render.js +0 -3
- package/dist/node_modules/@allyhub/video-extension/dist/inspect/motion.js +0 -4
- package/dist/node_modules/@allyhub/video-measure/dist/still.js +0 -2
- package/editor-web/assets/arrow-down-B8VUPCGi.js +0 -1
- package/editor-web/assets/arrow-up-Ds4juY8X.js +0 -1
- package/editor-web/assets/article-8evPh712.js +0 -3
- package/editor-web/assets/article-BhRtWYMd.js +0 -7
- package/editor-web/assets/bar-button-J9vbfzTx.js +0 -1
- package/editor-web/assets/calc-worker-oEIqrrTM.js +0 -45
- package/editor-web/assets/channel-wIj_OqDm.js +0 -1
- package/editor-web/assets/chart-amT4lgX3.js +0 -2
- package/editor-web/assets/chart-file-dGiRgFcH.js +0 -1
- package/editor-web/assets/code-CD-CbJG9.js +0 -1
- package/editor-web/assets/collaborator-BU4qU7O3.js +0 -1
- package/editor-web/assets/deck-C7fN0Qtn.js +0 -1
- package/editor-web/assets/dist-3iovns9K.js +0 -16
- package/editor-web/assets/dist-BkHnbOEj.js +0 -4
- package/editor-web/assets/dist-BvOrNcK-.js +0 -19
- package/editor-web/assets/dist-CEIszq39.js +0 -1
- package/editor-web/assets/dist-CU5RbLNH.js +0 -1
- package/editor-web/assets/dist-CWZj8IAm.js +0 -1
- package/editor-web/assets/dist-C_Mtrnif.js +0 -17
- package/editor-web/assets/dist-CdqpwdCV.js +0 -24
- package/editor-web/assets/dist-CjT76RAw.js +0 -43
- package/editor-web/assets/dist-CpzEn9T8.js +0 -6
- package/editor-web/assets/dist-CrFYWl5-.js +0 -3
- package/editor-web/assets/dist-D3C6FyrO.js +0 -82
- package/editor-web/assets/dist-D4eBFGVL.js +0 -1
- package/editor-web/assets/dist-DTcjb3cP.js +0 -18
- package/editor-web/assets/dist-D_WSM29I.js +0 -17
- package/editor-web/assets/dist-Dp_9ISjP.js +0 -531
- package/editor-web/assets/dist-J-tPYKGS.js +0 -5
- package/editor-web/assets/dist-YW8hS4IM.js +0 -9
- package/editor-web/assets/esm-Cjv8ogpP.js +0 -21
- package/editor-web/assets/file-exclamation-point-_L3ElCJ5.js +0 -1
- package/editor-web/assets/flowDiagram-IUGLLWBU-BlVUglzw.js +0 -1
- package/editor-web/assets/hint-rlht0uxG.js +0 -1
- package/editor-web/assets/index-BQWZnyAQ.js +0 -28
- package/editor-web/assets/index-Dvh1t1om.css +0 -2
- package/editor-web/assets/minus-CbPnUIOy.js +0 -1
- package/editor-web/assets/progress-CwKcXARv.js +0 -6
- package/editor-web/assets/props-form-BpSXbrSF.js +0 -1
- package/editor-web/assets/react-Edyoga_4.js +0 -1
- package/editor-web/assets/row-C_svyL8o.js +0 -1
- package/editor-web/assets/schemas-CQ_UU8-Z.js +0 -1
- package/editor-web/assets/search-Ba2BbT6T.js +0 -1
- package/editor-web/assets/slides-7xWhREpt.js +0 -1
- package/editor-web/assets/snapshots-BLX4NTQC.js +0 -1
- package/editor-web/assets/sound-bTlco_K3.js +0 -1
- package/editor-web/assets/split-tFGKk-x8.js +0 -3
- package/editor-web/assets/strikethrough-BwXWi4zg.js +0 -1
- package/editor-web/assets/surface-DtCjIlrq.js +0 -1
- package/editor-web/assets/svg-CWIBMIQ9.js +0 -1
- package/editor-web/assets/swatch-DhztHwPU.js +0 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-DKzB_wSf.js +0 -8
- package/editor-web/assets/switch-8MU4Nfxe.js +0 -1
- package/editor-web/assets/table-DRbddzx0.js +0 -1
- package/editor-web/assets/tabs-CuEawka3.js +0 -1
- package/editor-web/assets/tag-CIfWT8B_.js +0 -1
- package/editor-web/assets/text-align-start-Cic2-TLh.js +0 -1
- package/editor-web/assets/textarea-D7TnPwv1.js +0 -1
- package/editor-web/assets/video-D0uTbHWx.js +0 -1
- package/editor-web/assets/words-XlXG79Ur.js +0 -3
- package/editor-web/assets/workbook-CiCXkjmN.js +0 -45
- package/editor-web/assets/x-DlhyIKuu.js +0 -41
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
(function(){var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));let u=1048576,d=16384;function f(e){let t=``;for(let n=e+1;n>0;n=Math.floor((n-1)/26))t=String.fromCharCode(65+(n-1)%26)+t;return t}function p(e){if(!/^[A-Za-z]{1,3}$/u.test(e))return;let t=0;for(let n of e.toUpperCase())t=t*26+n.charCodeAt(0)-64;return t<=16384?t-1:void 0}let m=e=>`${f(e.col)}${String(e.row+1)}`;function h(e){let t=m({row:e.top,col:e.left});return e.top===e.bottom&&e.left===e.right?t:`${t}:${m({row:e.bottom,col:e.right})}`}function g(e){let t=/^\$?([A-Za-z]{1,3})\$?([1-9]\d*)$/u.exec(e.trim());if(!t)return;let n=p(t[1]??``),r=Number(t[2])-1;return n===void 0||r>=1048576?void 0:{row:r,col:n}}function _(e){let[t=``,n,r]=e.split(`:`);if(r!==void 0)return;let i=g(t),a=n===void 0?i:g(n);if(i&&a)return{top:Math.min(i.row,a.row),left:Math.min(i.col,a.col),bottom:Math.max(i.row,a.row),right:Math.max(i.col,a.col)}}function v(e){let t=[];for(let n of e.trim().split(/\s+/u)){let e=_(n);if(!e)return;t.push(e)}return t}let y=(e,t,n)=>t>=e.top&&t<=e.bottom&&n>=e.left&&n<=e.right,b=(e,t)=>e.top<=t.bottom&&t.top<=e.bottom&&e.left<=t.right&&t.left<=e.right;function x(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ee(e,t=`|`){return e.map(e=>Te(e)).join(t)}function te(e,t){return typeof t==`bigint`?t.toString():t}var S=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function ne(e){return new S(e)}function re(e){return e==null}function C(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ie(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}let ae=/* @__PURE__*/ Symbol(`evaluating`);function oe(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ae)return r===void 0&&(r=ae,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function se(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ce(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function le(e){return ce(e._zod.def)??e._zod.def.shape}function ue(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return se(this,t,e),e},enumerable:!0,configurable:!0})}function de(e,t,n){t in e?se(e,t,n):e[t]=n}function fe(e,t,n,r){let i=le(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?ue(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):de(e,a,r?r(n.value,a):n.value))}}function pe(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?ue(e,n,()=>t[n]):de(e,n,r.value))}}function me(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function he(e){return JSON.stringify(e)}function ge(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}let _e=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ve(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let ye=/* @__PURE__*/ ne(()=>{if(mt.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function be(e){if(ve(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ve(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function xe(e){return be(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let Se=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function Ce(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function we(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function w(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Te(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Ee(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}let De={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Oe={int64:[/* @__PURE__*/ BigInt(`-9223372036854775808`),/* @__PURE__*/ BigInt(`9223372036854775807`)],uint64:[/* @__PURE__*/ BigInt(0),/* @__PURE__*/ BigInt(`18446744073709551615`)]};function ke(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return fe(i,e,Ae(e,t)),we(e,me(n,{shape:i,checks:[]}))}function Ae(e,t){let n=le(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function je(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Ae(e,t)),a={};return fe(a,e,Reflect.ownKeys(le(e)).filter(e=>!i.has(e))),we(e,me(n,{shape:a,checks:[]}))}function Me(e,t){if(!be(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=le(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return we(e,me(e._zod.def,{shape:Ne(e,t)}))}function Ne(e,t){let n={};return fe(n,e,Reflect.ownKeys(le(e))),pe(n,t),n}function Pe(e,t){if(!be(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return we(e,me(e._zod.def,{shape:Ne(e,t)}))}function Fe(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return fe(n,e,Reflect.ownKeys(le(e))),fe(n,t,Reflect.ownKeys(le(t))),we(e,me(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Ie(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Ae(t,n)):void 0,o={};return fe(o,t,Reflect.ownKeys(le(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),we(t,me(t._zod.def,{shape:o,checks:[]}))}function Le(e,t,n){let r=n?new Set(Ae(t,n)):void 0,i={};return fe(i,t,Reflect.ownKeys(le(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),we(t,me(t._zod.def,{shape:i}))}function Re(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ze(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Be(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ve(e){return typeof e==`string`?e:e?.message}function He(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Ue(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function We(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Ve(e.inst?._zod.def?.error?.(e))??Ve(a?.(e))??Ve(t?.error?.(e))??Ve(n.customError?.(e))??Ve(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}let Ge=/[\uD800-\uDBFF]/;function Ke(e){let t=e.length;if(!Ge.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function qe(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Je(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Ye(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Xe(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):et(e,n,r.value)}}function Ze(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Qe(e,t,n){return Ze(e,t,n,!1)}/* @__NO_SIDE_EFFECTS__ */
|
|
2
|
+
function $e(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Ze(this,n,r(this))},set(e){Ze(this,n,e)}})}return t}function et(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Ze(this,t,n.bind(this))},set(e){Ze(this,t,e)}})}function tt(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let nt,rt=!1,it={configurable:!0,get(){rt=!0}};function at(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&nt!==e._zod?nt=void 0:(nt=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,it);let e=rt;rt=!1;try{let r=n(this);return rt?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),rt||=e,r}catch(n){throw delete this[t],rt||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function ot(e,t,n,r){let i=tt(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function st(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var ct;let lt={value:void 0,enumerable:!1},ut=`captureStackTrace`in Error?Error:null;function dt(e){let t=ut;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return ut=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}/* @__NO_SIDE_EFFECTS__ */
|
|
3
|
+
function T(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){lt.value=new a(r);try{Object.defineProperty(n,"_zod",lt)}finally{lt.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Xe(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?dt(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var ft=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},pt=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ct=globalThis).__zod_globalConfig??(ct.__zod_globalConfig={});let mt=globalThis.__zod_globalConfig;function ht(e){return e&&Object.assign(mt,e),mt}function gt(){let e=this._zod;return e.message??=JSON.stringify(e.def,te,2),e.message}function _t(e){this._zod.message=e}let vt={get:gt,set:_t,enumerable:!0,configurable:!0},yt={value:void 0,enumerable:!1},bt=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),xt=/* @__PURE__ */ T(`$ZodError`,(e,t)=>{e.name=`$ZodError`,yt.value=t,Object.defineProperty(e,"issues",yt),yt.value=void 0,Object.defineProperty(e,"message",vt);let n=Object.getPrototypeOf(e);bt.has(n)||(bt.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function St(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Ct(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?St(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function wt(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Tt(e,t){return{callee:t?.callee??e,Err:t?.Err}}let Et=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new ft;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>We(e,o,ht())));throw _e(n,a?.callee??t),n}return s.value};return t},Dt=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>We(e,o,ht())));throw _e(n,a?.callee??t),n}return s.value};return t},Ot=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new ft;return a.issues.length?kt(e,a.issues,i):{success:!0,data:a.value}};function kt(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>We(e,n,ht()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}let At=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?kt(e,a.issues,i):{success:!0,data:a.value}},jt=/* @__PURE__ */ Symbol.for(`zod.compile.invalid`),Mt=/* @__PURE__ */ Symbol.for(`zod.compile.fallback`),Nt=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==jt)return!0;if(r.definite===!0&&n===void 0)return!1}return Pt(e,t,n)});function Pt(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Mt]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new ft;return a.issues.length===0}let Ft=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},It=e=>{let t=Et(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Tt(n,a))};return n},Lt=e=>{let t=Et(e),n=(e,r,i,a)=>t(e,r,i,Tt(n,a));return n},Rt=e=>{let t=Dt(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Tt(n,a))};return n},zt=e=>{let t=Dt(e),n=async(e,r,i,a)=>await t(e,r,i,Tt(n,a));return n},Bt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ot(e)(t,n,i)},Vt=e=>(t,n,r)=>Ot(e)(t,n,r),Ht=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return At(e)(t,n,i)},Ut=e=>async(t,n,r)=>At(e)(t,n,r),Wt=/^[cC][0-9a-z]{6,}$/,Gt=/^[0-9a-z]+$/,Kt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,qt=/^[0-9a-vA-V]{20}$/,Jt=/^[A-Za-z0-9]{27}$/,Yt=/^[a-zA-Z0-9_-]{21}$/;function Xt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}let Zt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Qt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$t=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,en=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function tn(){return/* @__PURE__ */ RegExp(`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}let nn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,an=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,on=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,cn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,ln=/^https?$/,un=/^\+[1-9]\d{6,14}$/,dn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function fn(e){return RegExp(`^${e}$`)}let pn=/*@__PURE__*/ fn(dn);function mn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function hn(e){return RegExp(`^${mn(e)}$`)}function gn(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${mn({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${mn({precision:e.precision})}`:n;return RegExp(`^${dn}T(?:${r})$`)}let _n=/^[\s\S]{0,}$/,vn=/^-?\d+$/,yn=/^-?\d+(?:\.\d+)?$/,bn=/^(?:true|false)$/i,xn=/^null$/i,Sn=/^[^A-Z]*$/,Cn=/^[^a-z]*$/,wn=/*@__PURE__*/ T(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Tn=e=>{let t=e.value;return!re(t)&&t.length!==void 0},En={number:`number`,bigint:`bigint`,object:`date`},Dn=/*@__PURE__*/ T(`$ZodCheckLessThan`,(e,t)=>{wn.init(e,t);let n=En[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:En[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),On=/*@__PURE__*/ T(`$ZodCheckGreaterThan`,(e,t)=>{wn.init(e,t);let n=En[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:En[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),kn=/*@__PURE__*/ T(`$ZodCheckMultipleOf`,(e,t)=>{wn.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):ie(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),An=/*@__PURE__*/ T(`$ZodCheckNumberFormat`,(e,t)=>{wn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=De[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),jn=/*@__PURE__*/ T(`$ZodCheckMaxLength`,(e,t)=>{var n;wn.init(e,t),(n=e._zod.def).when??(n.when=Tn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ke(r):i)<=t.maximum)return;let a=qe(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Mn=/*@__PURE__*/ T(`$ZodCheckMinLength`,(e,t)=>{var n;wn.init(e,t),(n=e._zod.def).when??(n.when=Tn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ke(r):i)>=t.minimum)return;let a=qe(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Nn=/*@__PURE__*/ T(`$ZodCheckLengthEquals`,(e,t)=>{var n;wn.init(e,t),(n=e._zod.def).when??(n.when=Tn),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ke(r):i;if(a===t.length)return;let o=qe(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Pn=/*@__PURE__*/ T(`$ZodCheckStringFormat`,(e,t)=>{var n,r;wn.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Fn=/*@__PURE__*/ T(`$ZodCheckRegex`,(e,t)=>{Pn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),In=/*@__PURE__*/ T(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Sn,Pn.init(e,t)}),Ln=/*@__PURE__*/ T(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Cn,Pn.init(e,t)}),Rn=/*@__PURE__*/ T(`$ZodCheckIncludes`,(e,t)=>{wn.init(e,t);let n=Ce(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),zn=/*@__PURE__*/ T(`$ZodCheckStartsWith`,(e,t)=>{wn.init(e,t);let n=RegExp(`^${Ce(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Bn=/*@__PURE__*/ T(`$ZodCheckEndsWith`,(e,t)=>{wn.init(e,t);let n=RegExp(`.*${Ce(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Vn=/*@__PURE__*/ T(`$ZodCheckOverwrite`,(e,t)=>{wn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Hn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
4
|
+
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
5
|
+
`)}\n};`)(...Object.values(this.closed))}};let Un={major:4,minor:6,patch:7},Wn=/*@__PURE__*/ T(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Un;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Re(t),a;for(let o of n){if(o._zod.def.when){if(ze(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new ft;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Ue(t.issues,n,e),i||=Re(t,n))});else{if(t.issues.length===n)continue;Ue(t.issues,n,e),i||=Re(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Re(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new ft;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new ft;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Qe(this,`~standard`,qn(this))},set"~standard"(e){Ze(this,`~standard`,e)}}),Gn=(e,t)=>e.issues.length?{issues:e.issues.map(e=>We(e,t,ht()))}:{value:e.value};async function Kn(e,t){let n={async:!0};return Gn(await e._zod.run({value:t,issues:[]},n),n)}function qn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Gn(r,n)}catch{}return Kn(e,t)},vendor:`zod`,version:1}}let Jn=/*@__PURE__*/ T(`$ZodString`,(e,t)=>{Wn.init(e,t),e._zod.pattern=t.pattern??_n,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Yn=/*@__PURE__*/ T(`$ZodStringFormat`,(e,t)=>{Pn.init(e,t),Jn.init(e,t)}),Xn=/*@__PURE__*/ T(`$ZodGUID`,(e,t)=>{t.pattern??=Qt,Yn.init(e,t)}),Zn=/*@__PURE__*/ T(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=$t(e)}else t.pattern??=$t();Yn.init(e,t)}),Qn=/*@__PURE__*/ T(`$ZodEmail`,(e,t)=>{t.pattern??=en,Yn.init(e,t)});function $n(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function er(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?$n(e)||2:tr(e,t)}function tr(e,t){if(!t.normalize&&t.protocol?.source===ln.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}let nr=/[\t\n\r]/g;function rr(e){return e.replace(nr,``)}function ir(e,t){return t.lastIndex=0,t.test(e.hostname)}function ar(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}let or=/*@__PURE__*/ T(`$ZodURL`,(e,t)=>{Yn.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=er(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=rr(r);return}t.hostname&&!ir(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!ar(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:rr(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),sr=/*@__PURE__*/ T(`$ZodEmoji`,(e,t)=>{t.pattern??=tn(),Yn.init(e,t)}),cr=/*@__PURE__*/ T(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Yt:Xt(t.length),Yn.init(e,t)}),lr=/*@__PURE__*/ T(`$ZodCUID`,(e,t)=>{t.pattern??=Wt,Yn.init(e,t)}),ur=/*@__PURE__*/ T(`$ZodCUID2`,(e,t)=>{t.pattern??=Gt,Yn.init(e,t)}),dr=/*@__PURE__*/ T(`$ZodULID`,(e,t)=>{t.pattern??=Kt,Yn.init(e,t)}),fr=/*@__PURE__*/ T(`$ZodXID`,(e,t)=>{t.pattern??=qt,Yn.init(e,t)}),pr=/*@__PURE__*/ T(`$ZodKSUID`,(e,t)=>{t.pattern??=Jt,Yn.init(e,t)}),mr=/*@__PURE__*/ T(`$ZodISODateTime`,(e,t)=>{t.pattern??=gn(t),Yn.init(e,t)}),hr=/*@__PURE__*/ T(`$ZodISODate`,(e,t)=>{t.pattern??=pn,Yn.init(e,t)}),gr=/*@__PURE__*/ T(`$ZodISOTime`,(e,t)=>{t.pattern??=hn(t),Yn.init(e,t)}),_r=/*@__PURE__*/ T(`$ZodISODuration`,(e,t)=>{t.pattern??=Zt,Yn.init(e,t)}),vr=/*@__PURE__*/ T(`$ZodIPv4`,(e,t)=>{t.pattern??=nn,Yn.init(e,t)}),yr=/^[0-9a-fA-F:.]+$/;function br(e){return yr.test(e)?$n(`http://[${e}]`):!1}let xr=/*@__PURE__*/ T(`$ZodIPv6`,(e,t)=>{t.pattern??=rn,Yn.init(e,t),e._zod.check=n=>{br(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Sr=/*@__PURE__*/ T(`$ZodCIDRv4`,(e,t)=>{t.pattern??=an,Yn.init(e,t)});function Cr(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:br(n)}let wr=/*@__PURE__*/ T(`$ZodCIDRv6`,(e,t)=>{t.pattern??=on,Yn.init(e,t),e._zod.check=n=>{Cr(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Tr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let Er=/^[0-9a-zA-Z+/]*={0,2}$/,Dr=/*@__PURE__*/ T(`$ZodBase64`,(e,t)=>{t.pattern??=Er,Yn.init(e,t),e._zod.check=n=>{Tr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Or=/^[A-Za-z0-9_-]*$/;function kr(e){if(!Or.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Tr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}let Ar=/*@__PURE__*/ T(`$ZodBase64URL`,(e,t)=>{t.pattern??=Or,Yn.init(e,t),e._zod.check=n=>{kr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),jr=/*@__PURE__*/ T(`$ZodE164`,(e,t)=>{t.pattern??=un,Yn.init(e,t)});function Mr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}let Nr=/*@__PURE__*/ T(`$ZodJWT`,(e,t)=>{Yn.init(e,t),e._zod.check=n=>{Mr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Pr=/*@__PURE__*/ T(`$ZodNumber`,(e,t)=>{Wn.init(e,t),e._zod.pattern=yn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Fr=/*@__PURE__*/ T(`$ZodNumberFormat`,(e,t)=>{An.init(e,t),Pr.init(e,t)}),Ir=/*@__PURE__*/ T(`$ZodBoolean`,(e,t)=>{Wn.init(e,t),e._zod.pattern=bn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Lr=/*@__PURE__*/ T(`$ZodNull`,(e,t)=>{Wn.init(e,t),e._zod.pattern=xn,e._zod.values=/* @__PURE__ */ new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Rr=/*@__PURE__*/ T(`$ZodUnknown`,(e,t)=>{Wn.init(e,t),e._zod.parse=e=>e}),zr=/*@__PURE__*/ T(`$ZodNever`,(e,t)=>{Wn.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Br(e,t){let n=He(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of He(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,Ue(n.issues,t,e),n}}return i(n,a)}}let Vr=e=>Array.isArray(e)?e.length:-1;function Hr(e,t,n){e.issues.length&&t.issues.push(...Be(n,e.issues)),t.value[n]=e.value}let Ur=/*@__PURE__*/ T(`$ZodArray`,(e,t)=>{Wn.init(e,t);let n=mt.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Hr(t,r,e)));else if(Hr(c,r,e),s&&c.issues.length!==0&&Re(c))break}return o.length?Promise.all(o).then(()=>r):r},Br(e,Vr)});function Wr(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Be(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}let Gr=[];function Kr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Gr,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Ee(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function qr(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(Re(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Wr(e,n,i,t,d,f))):Wr(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}let Jr=/*@__PURE__*/ T(`$ZodObject`,(e,t)=>{Wn.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=ne(()=>Kr(t));at(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||se(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=ve,o=t.catchall,s,c=mt.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(Re(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Wr(n,t,e,r,a,o))):Wr(s,t,e,r,a,o)}return o?qr(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Yr=/*@__PURE__*/ T(`$ZodObjectJIT`,(e,t)=>{Jr.init(e,t);let n=e._zod.parse,r=ne(()=>Kr(t)),i=mt.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Hn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
6
|
+
let ${e}_ab = false;
|
|
7
|
+
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
8
|
+
const iss = ${e}.issues[i];
|
|
9
|
+
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
|
|
10
|
+
payload.issues.push(iss);
|
|
11
|
+
if (iss.continue !== true) ${e}_ab = true;
|
|
12
|
+
}
|
|
13
|
+
if (${e}_ab && ctx && ctx.abortEarly) {
|
|
14
|
+
payload.value = newResult;
|
|
15
|
+
return payload;
|
|
16
|
+
}`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:he(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
|
|
17
|
+
const ${n}_present = ${i};
|
|
18
|
+
if (!${n}.issues.length || ${n}_present) {
|
|
19
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (${e}) {
|
|
23
|
+
newResult[${r}] = ${n}.value;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
`)}else f?(o.write(`
|
|
28
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
29
|
+
}
|
|
30
|
+
`),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
|
|
31
|
+
if (${n}.value !== undefined || ${i}) {
|
|
32
|
+
newResult[${r}] = ${n}.value;
|
|
33
|
+
}
|
|
34
|
+
`)):o.write(`
|
|
35
|
+
const ${n}_present = ${i};
|
|
36
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
37
|
+
}
|
|
38
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
39
|
+
payload.issues.push({
|
|
40
|
+
code: "invalid_type",
|
|
41
|
+
expected: "nonoptional",
|
|
42
|
+
input: undefined,
|
|
43
|
+
path: [${r}]
|
|
44
|
+
});
|
|
45
|
+
if (ctx && ctx.abortEarly) {
|
|
46
|
+
payload.value = newResult;
|
|
47
|
+
return payload;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (${n}_present) {
|
|
52
|
+
newResult[${r}] = ${n}.value;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=ve,c=!mt.jitless,l=c&&ye.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?qr([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Xr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Re(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>We(e,r,ht())))}),t)}let Zr=/*@__PURE__*/ T(`$ZodUnion`,(e,t)=>{Wn.init(e,t),at(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),at(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),at(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),at(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>C(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Xr(t,r,e,i)):Xr(o,r,e,i)}}),Qr=/*@__PURE__*/ T(`$ZodIntersection`,(e,t)=>{Wn.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>ei(e,t,n)):ei(e,i,a)}});function $r(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(be(e)&&be(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=$r(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=$r(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ei(e,t,n){let r=/* @__PURE__ */ new Map,i,a=/* @__PURE__ */ new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=$r(t.value,n.value);if(!c.valid){if(Re(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}let ti=/*@__PURE__*/ T(`$ZodTuple`,(e,t)=>{Wn.init(e,t);let n=t.items,r=mt.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=ni(n,`optin`),l=ni(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length),d=t.rest?a?.abortEarly:void 0,f=!1;for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):(u[e]=t,d&&!f&&t.issues.length&&(f=Re(t)))}if(t.rest&&!f){let e=n.length-1,r=o.slice(n.length),c=i.issues.length;for(let n of r){if(d&&i.issues.length!==c){if(Re(i,c))break;c=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>ri(t,i,e))):ri(r,i,e)}}return s.length?Promise.all(s).then(()=>ii(u,i,n,o,l)):ii(u,i,n,o,l)}});function ni(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function ri(e,t,n){e.issues.length&&t.issues.push(...Be(n,e.issues)),t.value[n]=e.value}function ii(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...Be(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}let ai=/*@__PURE__*/ T(`$ZodRecord`,(e,t)=>{Wn.init(e,t);let n=mt.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!be(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=/* @__PURE__ */ new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>We(e,i,ht())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Be(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Be(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&yn.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>We(e,i,ht())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Be(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Be(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),oi=/*@__PURE__*/ T(`$ZodEnum`,(e,t)=>{Wn.init(e,t);let n=x(t.entries),r=new Set(n);e._zod.values=r,at(e,`pattern`,e=>{let t=x(e.def.entries).filter(e=>Se.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Ce(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),si=/*@__PURE__*/ T(`$ZodLiteral`,(e,t)=>{Wn.init(e,t);let n=new Set(t.values);e._zod.values=n,at(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Ce(e):e?Ce(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),ci=/*@__PURE__*/ T(`$ZodTransform`,(e,t)=>{Wn.init(e,t),e._zod.optin=`optional`,mt.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new pt(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new ft;return n.value=i,n}});function li(e,t){return e.value=t.issues.length?void 0:t.value,e}let ui=/*@__PURE__*/ T(`$ZodOptional`,(e,t)=>{Wn.init(e,t),at(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,at(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),at(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${C(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>li(e,t)):li(e,r)}return t.innerType._zod.run(e,n)}}),di=/*@__PURE__*/ T(`$ZodExactOptional`,(e,t)=>{ui.init(e,t),at(e,`values`,e=>e.def.innerType._zod.values),at(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),fi=/*@__PURE__*/ T(`$ZodNullable`,(e,t)=>{Wn.init(e,t),at(e,`optin`,e=>e.def.innerType._zod.optin),at(e,`optout`,e=>e.def.innerType._zod.optout),at(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${C(t.source)}|null)$`):void 0}),at(e,`values`,e=>e.def.innerType._zod.values?/* @__PURE__ */ new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),pi=/*@__PURE__*/ T(`$ZodDefault`,(e,t)=>{Wn.init(e,t),e._zod.optin=`defaulted`,at(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>mi(e,t)):mi(r,t)}});function mi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let hi=/*@__PURE__*/ T(`$ZodPrefault`,(e,t)=>{Wn.init(e,t),e._zod.optin=`defaulted`,at(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),gi=/*@__PURE__*/ T(`$ZodNonOptional`,(e,t)=>{Wn.init(e,t),at(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>_i(t,e)):_i(i,e)}});function _i(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function vi(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>We(e,r,ht()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}let yi=/*@__PURE__*/ T(`$ZodCatch`,(e,t)=>{Wn.init(e,t),at(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),at(e,`optout`,e=>e.def.innerType._zod.optout),at(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>vi(e,r,t,n)):vi(e,r,t,n)}}),bi=/*@__PURE__*/ T(`$ZodPipe`,(e,t)=>{Wn.init(e,t),at(e,`values`,e=>e.def.in._zod.values),at(e,`optin`,e=>e.def.in._zod.optin),at(e,`optout`,e=>e.def.out._zod.optout),at(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>xi(e,t.in,n)):xi(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>xi(e,t.out,n)):xi(r,t.out,n)}});function xi(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}let Si=/*@__PURE__*/ T(`$ZodReadonly`,(e,t)=>{Wn.init(e,t),at(e,`propValues`,e=>e.def.innerType._zod.propValues),at(e,`values`,e=>e.def.innerType._zod.values),at(e,`optin`,e=>e.def.innerType?._zod?.optin),at(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Ci):Ci(r)}});function Ci(e){return e.memo||(e.value=Object.freeze(e.value)),e}let wi=/*@__PURE__*/ T(`$ZodLazy`,(e,t)=>{Wn.init(e,t),oe(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),at(e,`pattern`,e=>e.innerType?._zod?.pattern),at(e,`propValues`,e=>e.innerType?._zod?.propValues),at(e,`optin`,e=>e.innerType?._zod?.optin??void 0),at(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Ti=/*@__PURE__*/ T(`$ZodCustom`,(e,t)=>{wn.init(e,t),Wn.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Ei(t,n,r,e));Ei(i,n,r,e)}});function Ei(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ye(e))}}var Di=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};let Oi=`~memo`,ki=[];function Ai(e){return typeof e==`object`&&!!e}function ji(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}let Mi=/*@__PURE__*/ new WeakMap;function Ni(e,t,n){let r=Mi.get(e);if(r!==void 0)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0,a=e=>{if(i!==2&&e?._zod){let r=Ni(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=0;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?1:o.value?._zod?Ni(o.value,t,n):0;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=ce(c);s(e?o(e,!0):1),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Ni(r,t,!1):1);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Pi(e,i)}function Pi(e,t){return t!==1&&Mi.set(e,t===2),t}function Fi(e,t){let n=e.buckets.get(t);return n||(n=/* @__PURE__ */ new WeakMap,e.buckets.set(t,n)),n}let Ii,Li=[],Ri={alloc(e,t,n){let r=Ii;if(!r)return n;Ii=void 0;let i={value:n,issues:null};return r.set(t.value,i),Li.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Bi(n,e.value))throw new Di;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Ni(e,/* @__PURE__ */ new Set,!1);if(i===0)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===2||r?n=!0:r=!0}let l=s.value;if(!Ai(l))return t(s,c);let u=c[Oi];u||(u={buckets:/* @__PURE__ */ new WeakMap,backEdges:void 0},c[Oi]=u);let d;i===c?d=a:(d=Fi(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...ji(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=/* @__PURE__ */ new WeakSet),u.backEdges.add(f.value)),s;Ii=d;let p=Li.length,m=t(s,c);Ii=void 0;let h=Li.length>p?Li.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?ji(e.issues):ki),e)):(h&&(h.issues=m.issues.length?ji(m.issues):ki),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function zi(){return Ri}function Bi(e,t){let n=e[Oi]?.backEdges;return n!==void 0&&Ai(t)&&n.has(t)}let Vi=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Je(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Te(e.values[0])}`:`Invalid option: expected one of ${ee(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${ee(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Hi(){return{localeError:Vi()}}var Ui,Wi=class{constructor(){this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Gi(){return new Wi}(Ui=globalThis).__zod_globalRegistry??(Ui.__zod_globalRegistry=Gi());let Ki=globalThis.__zod_globalRegistry;function qi(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
|
|
56
|
+
function Ji(e,t){return new e(qi({type:`string`,...w(t)}))}// @__NO_SIDE_EFFECTS__
|
|
57
|
+
function Yi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
58
|
+
function Xi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
59
|
+
function Zi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
60
|
+
function Qi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
61
|
+
function $i(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
62
|
+
function ea(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
63
|
+
function ta(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
64
|
+
function na(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
65
|
+
function ra(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
66
|
+
function ia(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
67
|
+
function aa(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
68
|
+
function oa(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
69
|
+
function sa(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
70
|
+
function ca(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
71
|
+
function la(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
72
|
+
function ua(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
73
|
+
function da(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
74
|
+
function fa(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
75
|
+
function pa(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
76
|
+
function ma(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
77
|
+
function ha(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
78
|
+
function ga(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
79
|
+
function _a(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
80
|
+
function va(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
81
|
+
function ya(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
82
|
+
function ba(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
83
|
+
function xa(e,t){return new e(qi({type:`number`,checks:[],...w(t)}))}// @__NO_SIDE_EFFECTS__
|
|
84
|
+
function Sa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
85
|
+
function Ca(e,t){return new e({type:`boolean`,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
86
|
+
function wa(e,t){return new e({type:`null`,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
87
|
+
function Ta(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
|
|
88
|
+
function Ea(e,t){return new e({type:`never`,...w(t)})}// @__NO_SIDE_EFFECTS__
|
|
89
|
+
function Da(e,t){return new Dn({check:`less_than`,...w(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
|
|
90
|
+
function Oa(e,t){return new Dn({check:`less_than`,...w(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
|
|
91
|
+
function ka(e,t){return new On({check:`greater_than`,...w(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
|
|
92
|
+
function Aa(e,t){return new On({check:`greater_than`,...w(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
|
|
93
|
+
function ja(e,t){return new kn({check:`multiple_of`,...w(t),value:e})}// @__NO_SIDE_EFFECTS__
|
|
94
|
+
function Ma(e,t){return new jn({check:`max_length`,...w(t),maximum:e})}// @__NO_SIDE_EFFECTS__
|
|
95
|
+
function Na(e,t){return new Mn({check:`min_length`,...w(t),minimum:e})}// @__NO_SIDE_EFFECTS__
|
|
96
|
+
function Pa(e,t){return new Nn({check:`length_equals`,...w(t),length:e})}// @__NO_SIDE_EFFECTS__
|
|
97
|
+
function Fa(e,t){return new Fn({check:`string_format`,format:`regex`,...w(t),pattern:e})}// @__NO_SIDE_EFFECTS__
|
|
98
|
+
function Ia(e){return new In({check:`string_format`,format:`lowercase`,...w(e)})}// @__NO_SIDE_EFFECTS__
|
|
99
|
+
function La(e){return new Ln({check:`string_format`,format:`uppercase`,...w(e)})}// @__NO_SIDE_EFFECTS__
|
|
100
|
+
function Ra(e,t){return new Rn({check:`string_format`,format:`includes`,...w(t),includes:e})}// @__NO_SIDE_EFFECTS__
|
|
101
|
+
function za(e,t){return new zn({check:`string_format`,format:`starts_with`,...w(t),prefix:e})}// @__NO_SIDE_EFFECTS__
|
|
102
|
+
function Ba(e,t){return new Bn({check:`string_format`,format:`ends_with`,...w(t),suffix:e})}// @__NO_SIDE_EFFECTS__
|
|
103
|
+
function Va(e){return new Vn({check:`overwrite`,tx:e})}// @__NO_SIDE_EFFECTS__
|
|
104
|
+
function Ha(e){return/* @__PURE__ */ Va(t=>t.normalize(e))}// @__NO_SIDE_EFFECTS__
|
|
105
|
+
function Ua(){return/* @__PURE__ */ Va(e=>e.trim())}// @__NO_SIDE_EFFECTS__
|
|
106
|
+
function Wa(){return/* @__PURE__ */ Va(e=>e.toLowerCase())}// @__NO_SIDE_EFFECTS__
|
|
107
|
+
function Ga(){return/* @__PURE__ */ Va(e=>e.toUpperCase())}// @__NO_SIDE_EFFECTS__
|
|
108
|
+
function Ka(){return/* @__PURE__ */ Va(e=>ge(e))}// @__NO_SIDE_EFFECTS__
|
|
109
|
+
function qa(e,t,n){return new e({type:`array`,element:t,...w(n)})}// @__NO_SIDE_EFFECTS__
|
|
110
|
+
function Ja(e,t,n){let r=w(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}// @__NO_SIDE_EFFECTS__
|
|
111
|
+
function Ya(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...w(n)})}// @__NO_SIDE_EFFECTS__
|
|
112
|
+
function Xa(e,t){let n=/* @__PURE__ */ Za(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ye(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Ye(r))}},e(t.value,t)),t);return n}// @__NO_SIDE_EFFECTS__
|
|
113
|
+
function Za(e,t){let n=new wn({check:`custom`,...w(t)});return n._zod.check=e,n}function Qa(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&se(e,t,n[t]);return e}function $a(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Ki,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:/* @__PURE__ */ new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function eo(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function to(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,to(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Qa(o.schema,c),t.io===`input`&&fo(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function no(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function ro(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=/* @__PURE__ */ new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${no(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+no(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
114
|
+
|
|
115
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function io(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;io(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}let ao=/* @__PURE__ */ new Set([`type`,`properties`,`required`,`additionalProperties`]),oo=[`oneOf`,`anyOf`];function so(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function co(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!ao.has(e))return null;t.push(n)}let n={},r=/* @__PURE__ */ new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??so(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}se(n,r,e.length===1?e[0]:co(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=so(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function lo(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of ao)if(t in e)return;let n=t.filter(e=>oo.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=co(t);else{let e=n[0],i=oo.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>co([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Qa(e,r))}function uo(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Qa(i,s),Qa(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())io(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])lo(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Qa(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,se(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:mo(t,`input`,e.processors),output:mo(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function fo(e,t){let n=t??{seen:/* @__PURE__ */ new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return fo(r.element,n);if(r.type===`set`)return fo(r.valueType,n);if(r.type===`lazy`)return fo(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return fo(r.innerType,n);if(r.type===`intersection`)return fo(r.left,n)||fo(r.right,n);if(r.type===`record`||r.type===`map`)return fo(r.keyType,n)||fo(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:fo(r.in,n)||fo(r.out,n);if(r.type===`object`){for(let e in r.shape)if(fo(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(fo(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(fo(e,n))return!0;return!!(r.rest&&fo(r.rest,n))}return!1}let po=(e,t={})=>n=>{let r=$a({...n,processors:t});return to(e,r),ro(r,e),uo(r,e)},mo=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=$a({...i??{},target:a,io:t,processors:n});return to(e,o),ro(o,e),uo(o,e)},ho=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},go=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},_o=(e,t)=>{ho(e,`minimum`,t),go(e,`maximum`,t)},vo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},yo=(e,t)=>{e.patterns??=/* @__PURE__ */ new Set,e.patterns.add(t)},bo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},xo=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},So=(e,t)=>ho(e,`minimum`,t.minimum),Co=(e,t)=>go(e,`maximum`,t.maximum),wo=e=>(t,n)=>{xo(t,n.format);let[r,i]=e[n.format];ho(t,`minimum`,r),go(t,`maximum`,i)},To={greater_than:(e,t)=>ho(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>go(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>vo(e,t.value),number_format:wo(De),bigint_format:wo(Oe),min_length:So,max_length:Co,length_equals:(e,t)=>_o(e,t.length),min_size:So,max_size:Co,size_equals:(e,t)=>_o(e,t.size),string_format:(e,t)=>{xo(e,t.format),t.pattern&&yo(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>bo(e,t.mime)};function Eo(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)To[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&ho(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&ho(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&go(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&go(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&vo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&bo(t,i.mime);for(let e of i.patterns??[])yo(t,e);return t}let Do={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Oo=/* @__PURE__ */ new Map([[Er,sn],[Or,cn]]),ko=e=>Oo.get(e)??e,Ao=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Eo(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Do[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(ko);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},jo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Eo(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=/* @__PURE__ */ new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):eo(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Mo=(e,t,n,r)=>{n.type=`boolean`},No=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Po=(e,t,n,r)=>{n.not={}},Fo=(e,t,n,r)=>{let i=e._zod.def,a=x(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},Io=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(eo(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(eo(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Lo=(e,t,n,r)=>{eo(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ro=(e,t,n,r)=>{eo(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},zo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Eo(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=to(a.element,t,{...r,path:[...r.path,`items`]})};function Bo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Bo(t.out):t.type===`catch`?Bo(t.innerType):e._zod.optin}let Vo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&eo(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)se(i.properties,e,to(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Bo(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=to(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ho=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>to(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Uo=(e,t,n,r)=>{let i=e._zod.def,a=to(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=to(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Wo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>to(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?to(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Bo(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=Eo(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Go(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Go(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Go(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?yn:vn).source)),p}let Ko=/* @__PURE__ */ new WeakMap;function qo(e){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=/* @__PURE__ */ new Map;for(let r of Ko.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Go(t,a,/* @__PURE__ */ new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}let Jo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=Eo(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=to(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)se(i.patternProperties,ko(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=to(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Ko.get(t);n||(n=[],Ko.set(t,n),t.deferred.push(()=>qo(t))),n.push(e)}i.additionalProperties=to(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Bo(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Yo=(e,t,n,r)=>{let i=e._zod.def,a=to(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Xo=(e,t,n,r)=>{let i=e._zod.def;to(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Zo=Symbol();function Qo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(eo(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Zo):JSON.parse(o)}let $o=(e,t,n,r)=>{let i=e._zod.def;to(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Qo(i.defaultValue,e,t,n,r);o!==Zo&&(n.default=o)},es=(e,t,n,r)=>{let i=e._zod.def;to(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Qo(i.defaultValue,e,t,n,r);o!==Zo&&(n._prefault=o)},ts=(e,t,n,r)=>{let i=e._zod.def;to(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{eo(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},ns=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;to(o,t,r);let s=t.seen.get(e);s.ref=o},rs=(e,t,n,r)=>{let i=e._zod.def;to(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},is=(e,t,n,r)=>{let i=e._zod.def;to(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},as=(e,t,n,r)=>{let i=e._zod.innerType;to(i,t,r);let a=t.seen.get(e);a.ref=i},os=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]);function ss(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}let cs=/*@__PURE__*/ T(`ZodError`,(e,t)=>{xt.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);os.has(n)||(os.add(n),ss(n,`format`,e=>t=>wt(e,t)),ss(n,`flatten`,e=>t=>Ct(e,t)),ss(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,te,2)}),ss(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,te,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),ls=/* @__PURE__ */ Et(cs),us=/* @__PURE__ */ Dt(cs),ds=/* @__PURE__ */ Ot(cs),fs=/* @__PURE__ */ At(cs),ps=/* @__PURE__ */ It(cs),ms=/* @__PURE__ */ Lt(cs),hs=/* @__PURE__ */ Rt(cs),gs=/* @__PURE__ */ zt(cs),_s=/* @__PURE__ */ Bt(cs),vs=/* @__PURE__ */ Vt(cs),ys=/* @__PURE__ */ Ht(cs),bs=/* @__PURE__ */ Ut(cs);function xs(){mt.localeError||ht(Hi())}function Ss(){mt.memoizer||ht({memoizer:zi()})}let Cs=/*@__PURE__*/ T(`ZodType`,(e,t)=>(xs(),Wn.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(me(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return we(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(qc(e,t))},superRefine(e,t){return this.check(Jc(e,t))},overwrite(e){return this.check(/* @__PURE__ */ Va(e))},optional(){return Ec(this)},exactOptional(){return Oc(this)},nullable(){return Ac(this)},nullish(){return Ec(Ac(this))},nonoptional(e){return Ic(this,e)},array(){return cc(this)},or(e){return fc([this,e])},and(e){return mc(this,e)},transform(e){return Bc(this,wc(e))},default(e){return Mc(this,e)},prefault(e){return Pc(this,e)},catch(e){return Rc(this,e)},pipe(e){return Bc(this,e)},readonly(){return Hc(this)},describe(e){let t=this.clone();return Ki.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ki.get(this);let t=this.clone();return Ki.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Qe(this,`~standard`,{...qn(this),jsonSchema:{input:mo(this,`input`),output:mo(this,`output`)}})},set"~standard"(e){Ze(this,`~standard`,e)},parse:function e(t,n){return ls(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await us(this,t,n,{callee:e})},safeParse(e,t){return ds(this,e,t)},async safeParseAsync(e,t){return fs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ze(this,`spa`,e)},validate(e,t){return Nt(this,e,t)},validateAsync(e,t){return Ft(this,e,t)},encode:function e(t,n){return ps(this,t,n,{callee:e})},decode:function e(t,n){return ms(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await hs(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await gs(this,t,n,{callee:e})},safeEncode(e,t){return _s(this,e,t)},safeDecode(e,t){return vs(this,e,t)},async safeEncodeAsync(e,t){return ys(this,e,t)},async safeDecodeAsync(e,t){return bs(this,e,t)},toJSONSchema(e){return po(this,{})(e)},get description(){return Ki.get(this)?.description},get _def(){return this._zod.def}}),ws=/*@__PURE__*/ T(`_ZodString`,(e,t)=>{Jn.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r)},/*@__PURE__*/ $e({format:e=>Eo(e).format??null,minLength:e=>Eo(e).minimum??null,maxLength:e=>Eo(e).maximum??null},{regex(...e){return this.check(/* @__PURE__ */ Fa(...e))},includes(...e){return this.check(/* @__PURE__ */ Ra(...e))},startsWith(...e){return this.check(/* @__PURE__ */ za(...e))},endsWith(...e){return this.check(/* @__PURE__ */ Ba(...e))},min(...e){return this.check(/* @__PURE__ */ Na(...e))},max(...e){return this.check(/* @__PURE__ */ Ma(...e))},length(...e){return this.check(/* @__PURE__ */ Pa(...e))},nonempty(...e){return this.check(/* @__PURE__ */ Na(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ Ia(e))},uppercase(e){return this.check(/* @__PURE__ */ La(e))},trim(){return this.check(/* @__PURE__ */ Ua())},normalize(...e){return this.check(/* @__PURE__ */ Ha(...e))},toLowerCase(){return this.check(/* @__PURE__ */ Wa())},toUpperCase(){return this.check(/* @__PURE__ */ Ga())},slugify(){return this.check(/* @__PURE__ */ Ka())}})),Ts=/*@__PURE__*/ T(`ZodString`,(e,t)=>{Jn.init(e,t),ws.init(e,t)},{email(e){return this.check(/* @__PURE__ */ Yi(js,e))},url(e){return this.check(/* @__PURE__ */ ta(Ps,e))},jwt(e){return this.check(/* @__PURE__ */ ga(Ys,e))},emoji(e){return this.check(/* @__PURE__ */ na(Fs,e))},guid(e){return this.check(/* @__PURE__ */ Xi(Ms,e))},uuid(e){return this.check(/* @__PURE__ */ Zi(Ns,e))},uuidv4(e){return this.check(/* @__PURE__ */ Qi(Ns,e))},uuidv6(e){return this.check(/* @__PURE__ */ $i(Ns,e))},uuidv7(e){return this.check(/* @__PURE__ */ ea(Ns,e))},nanoid(e){return this.check(/* @__PURE__ */ ra(Is,e))},cuid(e){return this.check(/* @__PURE__ */ ia(Ls,e))},cuid2(e){return this.check(/* @__PURE__ */ aa(Rs,e))},ulid(e){return this.check(/* @__PURE__ */ oa(zs,e))},base64(e){return this.check(/* @__PURE__ */ pa(Ks,e))},base64url(e){return this.check(/* @__PURE__ */ ma(qs,e))},xid(e){return this.check(/* @__PURE__ */ sa(Bs,e))},ksuid(e){return this.check(/* @__PURE__ */ ca(Vs,e))},ipv4(e){return this.check(/* @__PURE__ */ la(Hs,e))},ipv6(e){return this.check(/* @__PURE__ */ ua(Us,e))},cidrv4(e){return this.check(/* @__PURE__ */ da(Ws,e))},cidrv6(e){return this.check(/* @__PURE__ */ fa(Gs,e))},e164(e){return this.check(/* @__PURE__ */ ha(Js,e))},datetime(e){return this.check(/* @__PURE__ */ _a(Ds,e))},date(e){return this.check(/* @__PURE__ */ va(Os,e))},time(e){return this.check(/* @__PURE__ */ ya(ks,e))},duration(e){return this.check(/* @__PURE__ */ ba(As,e))}});function E(e){return/* @__PURE__ */ Ji(Ts,e)}let Es=/*@__PURE__*/ T(`ZodStringFormat`,(e,t)=>{Yn.init(e,t),ws.init(e,t)}),Ds=/*@__PURE__*/ T(`ZodISODateTime`,(e,t)=>{mr.init(e,t),Es.init(e,t)}),Os=/*@__PURE__*/ T(`ZodISODate`,(e,t)=>{hr.init(e,t),Es.init(e,t)}),ks=/*@__PURE__*/ T(`ZodISOTime`,(e,t)=>{gr.init(e,t),Es.init(e,t)}),As=/*@__PURE__*/ T(`ZodISODuration`,(e,t)=>{_r.init(e,t),Es.init(e,t)}),js=/*@__PURE__*/ T(`ZodEmail`,(e,t)=>{Qn.init(e,t),Es.init(e,t)}),Ms=/*@__PURE__*/ T(`ZodGUID`,(e,t)=>{Xn.init(e,t),Es.init(e,t)}),Ns=/*@__PURE__*/ T(`ZodUUID`,(e,t)=>{Zn.init(e,t),Es.init(e,t)}),Ps=/*@__PURE__*/ T(`ZodURL`,(e,t)=>{or.init(e,t),Es.init(e,t)}),Fs=/*@__PURE__*/ T(`ZodEmoji`,(e,t)=>{sr.init(e,t),Es.init(e,t)}),Is=/*@__PURE__*/ T(`ZodNanoID`,(e,t)=>{cr.init(e,t),Es.init(e,t)}),Ls=/*@__PURE__*/ T(`ZodCUID`,(e,t)=>{lr.init(e,t),Es.init(e,t)}),Rs=/*@__PURE__*/ T(`ZodCUID2`,(e,t)=>{ur.init(e,t),Es.init(e,t)}),zs=/*@__PURE__*/ T(`ZodULID`,(e,t)=>{dr.init(e,t),Es.init(e,t)}),Bs=/*@__PURE__*/ T(`ZodXID`,(e,t)=>{fr.init(e,t),Es.init(e,t)}),Vs=/*@__PURE__*/ T(`ZodKSUID`,(e,t)=>{pr.init(e,t),Es.init(e,t)}),Hs=/*@__PURE__*/ T(`ZodIPv4`,(e,t)=>{vr.init(e,t),Es.init(e,t)}),Us=/*@__PURE__*/ T(`ZodIPv6`,(e,t)=>{xr.init(e,t),Es.init(e,t)}),Ws=/*@__PURE__*/ T(`ZodCIDRv4`,(e,t)=>{Sr.init(e,t),Es.init(e,t)}),Gs=/*@__PURE__*/ T(`ZodCIDRv6`,(e,t)=>{wr.init(e,t),Es.init(e,t)}),Ks=/*@__PURE__*/ T(`ZodBase64`,(e,t)=>{Dr.init(e,t),Es.init(e,t)}),qs=/*@__PURE__*/ T(`ZodBase64URL`,(e,t)=>{Ar.init(e,t),Es.init(e,t)}),Js=/*@__PURE__*/ T(`ZodE164`,(e,t)=>{jr.init(e,t),Es.init(e,t)}),Ys=/*@__PURE__*/ T(`ZodJWT`,(e,t)=>{Nr.init(e,t),Es.init(e,t)}),Xs=/*@__PURE__*/ T(`ZodNumber`,(e,t)=>{Pr.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.isFinite=!0},/*@__PURE__*/ $e({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Eo(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Eo(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Eo(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Eo(e).format??null},{gt(e,t){return this.check(/* @__PURE__ */ ka(e,t))},gte(e,t){return this.check(/* @__PURE__ */ Aa(e,t))},min(e,t){return this.check(/* @__PURE__ */ Aa(e,t))},lt(e,t){return this.check(/* @__PURE__ */ Da(e,t))},lte(e,t){return this.check(/* @__PURE__ */ Oa(e,t))},max(e,t){return this.check(/* @__PURE__ */ Oa(e,t))},int(e){return this.check(Qs(e))},safe(e){return this.check(Qs(e))},positive(e){return this.check(/* @__PURE__ */ ka(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ Aa(0,e))},negative(e){return this.check(/* @__PURE__ */ Da(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ Oa(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ ja(e,t))},step(e,t){return this.check(/* @__PURE__ */ ja(e,t))},finite(){return this}}));function D(e){return/* @__PURE__ */ xa(Xs,e)}let Zs=/*@__PURE__*/ T(`ZodNumberFormat`,(e,t)=>{Fr.init(e,t),Xs.init(e,t)});function Qs(e){return/* @__PURE__ */ Sa(Zs,e)}let $s=/*@__PURE__*/ T(`ZodBoolean`,(e,t)=>{Ir.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r)});function ec(e){return/* @__PURE__ */ Ca($s,e)}let tc=/*@__PURE__*/ T(`ZodNull`,(e,t)=>{Lr.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r)});function nc(e){return/* @__PURE__ */ wa(tc,e)}let rc=/*@__PURE__*/ T(`ZodUnknown`,(e,t)=>{Rr.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ic(){return/* @__PURE__ */ Ta(rc)}let ac=/*@__PURE__*/ T(`ZodNever`,(e,t)=>{zr.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r)});function oc(e){return/* @__PURE__ */ Ea(ac,e)}let sc=/*@__PURE__*/ T(`ZodArray`,(e,t)=>{Ss(),Ur.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(/* @__PURE__ */ Na(e,t))},nonempty(e){return this.check(/* @__PURE__ */ Na(1,e))},max(e,t){return this.check(/* @__PURE__ */ Ma(e,t))},length(e,t){return this.check(/* @__PURE__ */ Pa(e,t))},unwrap(){return this.element}});function cc(e,t){return/* @__PURE__ */ qa(sc,e,t)}let lc=/*@__PURE__*/ T(`ZodObject`,(e,t)=>{Ss(),Yr.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),ot(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return k(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(me(this._zod.def,{catchall:e}))},passthrough(){return this.clone(me(this._zod.def,{catchall:ic()}))},loose(){return this.clone(me(this._zod.def,{catchall:ic()}))},strict(){return this.clone(me(this._zod.def,{catchall:oc()}))},strip(){return this.clone(me(this._zod.def,{catchall:void 0}))},extend(e){return Me(this,e)},safeExtend(e){return Pe(this,e)},merge(e){return Fe(this,e)},pick(e){return ke(this,e)},omit(e){return je(this,e)},partial(...e){return Ie(Tc,this,e[0])},exactPartial(...e){return Ie(Dc,this,e[0],`exactPartial`)},required(...e){return Le(Fc,this,e[0])}});function uc(e,t){let n={type:`object`,shape:e??{},...w(t)};return new lc(n)}function O(e,t){return new lc({type:`object`,shape:e,catchall:oc(),...w(t)})}let dc=/*@__PURE__*/ T(`ZodUnion`,(e,t)=>{Zr.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.options=t.options});function fc(e,t){return new dc({type:`union`,options:e,...w(t)})}let pc=/*@__PURE__*/ T(`ZodIntersection`,(e,t)=>{Qr.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r)});function mc(e,t){return new pc({type:`intersection`,left:e,right:t})}let hc=/*@__PURE__*/ T(`ZodTuple`,(e,t)=>{Ss(),ti.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new Tc({type:`optional`,innerType:e}))})}});function gc(e,t,n){let r=t instanceof Wn;return new hc({type:`tuple`,items:e,rest:r?t:null,...w(r?n:t)})}let _c=/*@__PURE__*/ T(`ZodRecord`,(e,t)=>{Ss(),ai.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function vc(e,t,n){return!t||!t._zod?new _c({type:`record`,keyType:E(),valueType:e,...w(t)}):new _c({type:`record`,keyType:e,valueType:t,...w(n)})}function yc(e,t,n){return new _c({type:`record`,keyType:e,valueType:t,...w(n),partial:!0})}let bc=/*@__PURE__*/ T(`ZodEnum`,(e,t)=>{oi.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new bc({...t,checks:[],...w(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new bc({...t,checks:[],...w(r),entries:i})}});function k(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new bc({type:`enum`,entries:n,...w(t)})}let xc=/*@__PURE__*/ T(`ZodLiteral`,(e,t)=>{si.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Sc(e,t){return new xc({type:`literal`,values:Array.isArray(e)?e:[e],...w(t)})}let Cc=/*@__PURE__*/ T(`ZodTransform`,(e,t)=>{Ss(),ci.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new pt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ye(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Ye(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function wc(e){return new Cc({type:`transform`,transform:e})}let Tc=/*@__PURE__*/ T(`ZodOptional`,(e,t)=>{ui.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>is(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ec(e){return new Tc({type:`optional`,innerType:e})}let Dc=/*@__PURE__*/ T(`ZodExactOptional`,(e,t)=>{di.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>is(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oc(e){return new Dc({type:`optional`,innerType:e})}let kc=/*@__PURE__*/ T(`ZodNullable`,(e,t)=>{fi.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ac(e){return new kc({type:`nullable`,innerType:e})}let jc=/*@__PURE__*/ T(`ZodDefault`,(e,t)=>{pi.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$o(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Mc(e,t){return new jc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():xe(t)}})}let Nc=/*@__PURE__*/ T(`ZodPrefault`,(e,t)=>{hi.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>es(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Pc(e,t){return new Nc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():xe(t)}})}let Fc=/*@__PURE__*/ T(`ZodNonOptional`,(e,t)=>{gi.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ic(e,t){return new Fc({type:`nonoptional`,innerType:e,...w(t)})}let Lc=/*@__PURE__*/ T(`ZodCatch`,(e,t)=>{yi.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ts(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Rc(e,t){return new Lc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:st(t)})}let zc=/*@__PURE__*/ T(`ZodPipe`,(e,t)=>{bi.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ns(e,t,n,r),e.in=t.in,e.out=t.out});function Bc(e,t){return new zc({type:`pipe`,in:e,out:t})}let Vc=/*@__PURE__*/ T(`ZodReadonly`,(e,t)=>{Si.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hc(e){return new Vc({type:`readonly`,innerType:e})}let Uc=/*@__PURE__*/ T(`ZodLazy`,(e,t)=>{wi.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>as(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Wc(e){return new Uc({type:`lazy`,getter:e})}let Gc=/*@__PURE__*/ T(`ZodCustom`,(e,t)=>{Ti.init(e,t),Cs.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r)});function Kc(e,t){return/* @__PURE__ */ Ja(Gc,e??(()=>!0),t)}function qc(e,t={}){return/* @__PURE__ */ Ya(Gc,e,t)}function Jc(e,t){return/* @__PURE__ */ Xa(e,t)}let Yc=[`org_chart`,`issue_tree`,`decision_tree`,`fishbone`,`matrix`,`marimekko`,`heatmap`,`small_multiples`],Xc={orgchart:`org_chart`,organization_chart:`org_chart`,organisation_chart:`org_chart`,organigram:`org_chart`,hierarchy:`org_chart`,reporting_lines:`org_chart`,issuetree:`issue_tree`,logic_tree:`issue_tree`,mece_tree:`issue_tree`,mece:`issue_tree`,driver_tree:`issue_tree`,tree:`issue_tree`,tree_diagram:`issue_tree`,mind_map:`issue_tree`,mindmap:`issue_tree`,decisiontree:`decision_tree`,decision:`decision_tree`,ishikawa:`fishbone`,fish_bone:`fishbone`,cause_and_effect:`fishbone`,cause_effect:`fishbone`,root_cause:`fishbone`,"2x2":`matrix`,"2_x_2":`matrix`,two_by_two:`matrix`,quadrant:`matrix`,quadrants:`matrix`,quadrant_chart:`matrix`,magic_quadrant:`matrix`,priority_matrix:`matrix`,bcg:`matrix`,mekko:`marimekko`,marimekko_chart:`marimekko`,mosaic:`marimekko`,mosaic_plot:`marimekko`,variable_width:`marimekko`,heat_map:`heatmap`,heatmap_table:`heatmap`,heat_table:`heatmap`,small_multiple:`small_multiples`,smallmultiples:`small_multiples`,trellis:`small_multiples`,facet:`small_multiples`,facets:`small_multiples`,faceted:`small_multiples`,panel_chart:`small_multiples`,lattice:`small_multiples`,grid_of_charts:`small_multiples`},Zc=[`text`,`body`,`muted`,`ground`,`surface`,`well`,`rule`,`rule-strong`,`accent1`,`accent2`,`accent3`,`accent4`,`accent5`,`accent6`,`deep`],Qc=[`good`,`warning`,`bad`,`info`,`neutral`],$c={good:{mark:`#2E7D4F`,tint:`#E3F2E6`,ink:`#1E4D31`,dark:`#6FCF97`},warning:{mark:`#A35400`,tint:`#FFF0DC`,ink:`#6B3700`,dark:`#F2B45C`},bad:{mark:`#B3362C`,tint:`#FDECEA`,ink:`#7A231C`,dark:`#F28B82`},info:{mark:`#3E54CE`,tint:`#DEE5F7`,ink:`#26338A`,dark:`#9AA8F0`},neutral:{mark:`#6B635E`,tint:`#EFECE8`,ink:`#3D3834`,dark:`#B5AEA8`}},el=[`gray`,`brown`,`red`,`orange`,`yellow`,`green`,`blue`,`purple`,`pink`],tl={yellow:{mark:`#8A6A00`,tint:`#FBF3DB`},brown:{mark:`#64473A`,tint:`#E9E5E3`},purple:{mark:`#6940A5`,tint:`#EAE4F2`},pink:{mark:`#AD1A72`,tint:`#F4DFEB`}},nl=e=>e.trim().replace(/([a-z0-9])([A-Z])/gu,`$1-$2`).toLowerCase().replace(/[\s_]+/gu,`-`),rl={good:`good`,success:`good`,positive:`good`,ok:`good`,pass:`good`,passed:`good`,met:`good`,"on-track":`good`,green:`good`,tip:`good`,done:`good`,warning:`warning`,warn:`warning`,caution:`warning`,"at-risk":`warning`,risk:`warning`,amber:`warning`,yellow:`warning`,orange:`warning`,bad:`bad`,danger:`bad`,error:`bad`,negative:`bad`,critical:`bad`,fail:`bad`,failed:`bad`,missed:`bad`,"off-track":`bad`,blocked:`bad`,late:`bad`,red:`bad`,info:`info`,note:`info`,notice:`info`,blue:`info`,neutral:`neutral`,none:`neutral`,flat:`neutral`,default:`neutral`,gray:`neutral`,grey:`neutral`,muted:`neutral`};function il(e,t=`other`){let n=nl(e);if(t===`callout`){if(n===`caution`)return`bad`;if(n===`important`)return`accent1`}return rl[n]}Object.keys(rl);function al(e){let t=nl(e).replace(/^--/u,``),n=/^chart-([1-6])$/u.exec(t);return n?`accent${n[1]??`1`}`:Zc.includes(t)?t:{"text-primary":`text`,primary:`text`,"text-body":`body`,"text-secondary":`muted`,secondary:`muted`,"page-bg":`ground`,background:`ground`,border:`rule`,divider:`rule-strong`,accent:`accent1`}[t]}function ol(e){if(typeof e!=`string`)return e;let t=e.trim();if(!/^[[{]/u.test(t))return e;try{return JSON.parse(t)}catch(t){if(t instanceof SyntaxError)return e;throw t}}let sl=e=>typeof e==`object`&&!!e&&!Array.isArray(e),cl={"":!0,true:!0,yes:!0,1:!0,false:!1,no:!1,0:!1};function ll(e,t,n,r){let i=ol(t),a=t=>{r.push({path:n,message:`${e.name} is ${t}, not ${JSON.stringify(i)}.`})},o=e.type;if(typeof o==`object`){if(typeof i!=`string`&&typeof i!=`number`){a(Object.keys(o.oneOf).join(`, `));return}let e=o.oneOf[Wl(String(i))];return e===void 0&&a(`one of ${[...new Set(Object.values(o.oneOf))].join(`, `)}`),e}switch(o){case`words`:case`string`:if(typeof i==`string`)return i;if(typeof i==`number`)return String(i);a(`words`);return;case`figure`:if(typeof i==`number`&&Number.isFinite(i)||typeof i==`string`&&i.trim()!==``)return i;a(`a figure (a number, words such as 30%, or a reference)`);return;case`number`:{if(ql(i))return i;let e=typeof i==`string`?Number(i.trim()):i;if(typeof e==`number`&&Number.isFinite(e))return e;a(`a number`);return}case`share`:if(ql(i))return i;if(typeof i==`number`&&Number.isFinite(i))return i>1&&i<=100?i/100:i;if(typeof i==`string`){let e=/^\s*(\d+(?:\.\d+)?|\.\d+)\s*(%)?\s*$/u.exec(i);if(e){let t=Number(e[1]);return e[2]===`%`||t>1?t/100:t}}a(`a share (0.3 or 30%)`);return;case`bool`:{if(typeof i==`boolean`)return i;let e=typeof i==`string`?cl[i.trim().toLowerCase()]:void 0;return e===void 0&&a(`true or false`),e}case`color`:if(typeof i==`string`&&iu(i))return i.trim();a(`a role (accent1…accent6, muted), a tone, a colour name or #RRGGBB`);return;case`tone`:{if(ql(i))return i;let e=typeof i==`string`?il(i):void 0;return e===void 0&&a(`a tone (${Qc.join(`, `)})`),e}case`numbers`:{if(ql(i))return i;let e=typeof i==`string`?i.split(`,`).map(e=>e.trim()===``?NaN:Number(e)):i;if(Array.isArray(e)&&e.length>0&&e.every(e=>e===null||typeof e==`number`&&Number.isFinite(e)))return e;a(`numbers ([12, 15, 14]), or a reference`);return}case`words-list`:{if(ql(i))return i;let e=typeof i==`string`?i.split(`,`).map(e=>e.trim()):i;if(Array.isArray(e)&&e.every(e=>typeof e==`string`||typeof e==`number`))return e.map(String);a(`a list of words`);return}case`matrix`:if(Array.isArray(i)&&i.every(e=>Array.isArray(e)&&e.every(e=>e===null||typeof e==`number`&&Number.isFinite(e))))return i;a(`rows of numbers ([[1, 2], [3, 4]])`);return;case`chart`:if(sl(i))return i;a(`a chart's fields ({ type: line, … })`);return}}function ul(e,t,n,r,i){let a=ol(t);if(!sl(a)){r.push({path:n,message:`this is ${i.what}'s fields, not ${JSON.stringify(a)}.`});return}let o=/* @__PURE__ */ new Map;for(let t of e){o.set(t.name,t);for(let e of t.aliases??[])o.has(e)||o.set(e,t)}let s={},c=/* @__PURE__ */ new Map;for(let[t,l]of Object.entries(a)){if(l==null)continue;let a=o.get(Wl(t));if(a===void 0){if(i.rest?.(t,l)===!0)continue;r.push({path:[...n,t],message:`there is no ${t}: ${i.what} has ${e.map(e=>e.name).join(`, `)}.`});continue}let u=c.get(a.name);if(u!==void 0){r.push({path:[...n,t],message:`${t} and ${u} are both ${a.name}: give one.`});continue}let d=ll(a,l,[...n,t],r);d!==void 0&&(s[a.name]=d,c.set(a.name,t))}for(let t of e)t.required===!0&&s[t.name]===void 0&&(i.wordsElsewhere!==!0||t.type!==`words`)&&r.push({path:n,message:`${i.what} has a ${t.name}.`});return s}let dl={name:`id`,type:`string`,aliases:[`key`,`code`]},fl={name:`parent`,type:`string`,aliases:[`parent_id`,`manager`,`reports_to`,`boss`,`supervisor`,`parent_name`,`under`]},pl=[`children`,`items`,`reports`,`direct_reports`,`branches`,`sub`,`subitems`,`nodes`,`kids`,`options`,`outcomes`],ml={org_chart:[{name:`name`,type:`words`,aliases:[`full_name`,`person`,`employee`,`label`],required:!0},{name:`role`,type:`words`,aliases:[`title`,`job`,`job_title`,`position`]},{name:`photo`,type:`string`,aliases:[`image`,`avatar`,`picture`,`src`,`headshot`]},{name:`note`,type:`words`,aliases:[`team`,`department`,`text`]},{name:`status`,type:`tone`,aliases:[`tone`]},dl,fl],issue_tree:[{name:`text`,type:`words`,aliases:[`title`,`label`,`name`,`question`,`issue`,`hypothesis`,`driver`],required:!0},{name:`note`,type:`words`,aliases:[`detail`,`description`,`body`]},{name:`status`,type:`tone`,aliases:[`tone`]},dl,fl],decision_tree:[{name:`text`,type:`words`,aliases:[`title`,`name`,`node`,`question`,`event`]},{name:`label`,type:`words`,aliases:[`branch`,`option`,`choice`,`edge`,`if`]},{name:`type`,type:{oneOf:{decision:`decision`,choice:`decision`,square:`decision`,chance:`chance`,uncertainty:`chance`,event:`chance`,circle:`chance`,random:`chance`,end:`end`,terminal:`end`,leaf:`end`,outcome:`end`,triangle:`end`,payoff:`end`}},aliases:[`node_type`,`shape`]},{name:`probability`,type:`share`,aliases:[`p`,`prob`,`chance_of`,`likelihood`,`odds`]},{name:`value`,type:`figure`,aliases:[`payoff`,`result`,`ev`,`expected_value`,`npv`,`worth`]},dl,fl]},hl=[`items`,`nodes`,`root`,`tree`,`people`,`members`,`children`,`branches`,`hierarchy`];function gl(e,t,n,r,i,a){let o=ol(t),s=Array.isArray(o)?o:[o],c=`a node of ${e.replace(`_`,` `)}`;return a>32?(r.push({path:n,message:`a tree is at most 32 levels deep.`}),[]):s.flatMap((t,s)=>{let l=Array.isArray(o)?[...n,s]:n;if(typeof t==`string`||typeof t==`number`)return[{[e===`org_chart`?`name`:`text`]:String(t)}];let u,d=``,f=ul(ml[e],t,l,r,{...i,what:c,rest:(e,t)=>pl.includes(Wl(e))?(u===void 0?(u=t,d=e):r.push({path:[...l,e],message:`${e} and ${d} are both its children: give one.`}),!0):!1});return f===void 0?[]:(u!==void 0&&(f.children=gl(e,u,[...l,d],r,i,a+1)),[f])})}let _l={org_chart:[{name:`alt`,type:`words`}],issue_tree:[{name:`orientation`,type:{oneOf:{horizontal:`horizontal`,left_to_right:`horizontal`,right:`horizontal`,across:`horizontal`,row:`horizontal`,vertical:`vertical`,top_down:`vertical`,down:`vertical`,column:`vertical`}},aliases:[`direction`]},{name:`alt`,type:`words`}],decision_tree:[{name:`format`,type:`string`,aliases:[`number_format`]},{name:`alt`,type:`words`}]};function vl(e,t,n,r,i){let a=ol(t);if(Array.isArray(a))return{items:gl(e,a,n,r,i,0)};if(!sl(a)){r.push({path:n,message:`this is a list of nodes, or { items: [...] }, or { data: <a table>, parent: <its column> }, not ${JSON.stringify(a)}.`});return}let o,s=``,c,l={},u=new Set(ml[e].flatMap(e=>[e.name,...e.aliases??[]])),d=Object.keys(a).map(Wl);if(!d.includes(`data`)&&!d.includes(`source`)&&!d.some(e=>hl.includes(e)&&e!==`children`)&&d.some(e=>u.has(e)&&e!==`id`&&e!==`parent`)){let t={},o={},s=new Set(_l[e].flatMap(e=>[e.name,...e.aliases??[]]));for(let[e,n]of Object.entries(a))s.has(Wl(e))&&!u.has(Wl(e))?t[e]=n:o[e]=n;let c=ul(_l[e],t,n,r,{...i,what:`a tree`})??{};return c.items=gl(e,o,n,r,i,0),c}let f={},p=new Set(_l[e].flatMap(e=>[e.name,...e.aliases??[]]));for(let[e,t]of Object.entries(a)){let i=Wl(e);hl.includes(i)?(o!==void 0&&r.push({path:[...n,e],message:`${e} and ${s} are both its nodes: give one.`}),o=t,s=e):i===`data`||i===`source`?c=t:p.has(i)?f[e]=t:l[e]=t}let m=ul(_l[e],f,n,r,{...i,what:`a tree`})??{};if(o!==void 0&&c!==void 0&&r.push({path:n,message:`give items or data, not both.`}),o!==void 0)m.items=gl(e,o,[...n,s],r,i,0);else if(c!==void 0)typeof c!=`string`||c.trim()===``?r.push({path:[...n,`data`],message:`data names a table: ../team/team#people, or a CSV, its rows a node each.`}):m.data=c.trim(),m.columns=yl(ml[e],l,n,r);else{for(let t of Object.keys(l))r.push({path:[...n,t],message:`there is no ${t}: a tree has items (its nodes, each with children), or data with a parent column, and ${_l[e].map(e=>e.name).join(`, `)}.`});Object.keys(l).length===0&&r.push({path:n,message:`a tree has items, or data.`})}return m}function yl(e,t,n,r){let i=/* @__PURE__ */ new Map;for(let t of e){i.set(t.name,t.name);for(let e of t.aliases??[])i.has(e)||i.set(e,t.name)}let a={};for(let[o,s]of Object.entries(t)){let t=i.get(Wl(o));t===void 0||typeof s!=`string`?r.push({path:[...n,o],message:t===void 0?`there is no ${o}: with data, a field names its column (${e.map(e=>e.name).join(`, `)}).`:`${o} names a column of the data, not ${JSON.stringify(s)}.`}):a[t]=s}return a}let bl=[{name:`name`,type:`words`,aliases:[`title`,`label`,`category`,`bone`,`group`,`text`],required:!0}],xl=[`causes`,`items`,`children`,`reasons`,`factors`,`subcauses`,`sub_causes`];function Sl(e,t,n,r,i){let a=ol(e);return(Array.isArray(a)?a:[a]).flatMap((e,o)=>{let s=Array.isArray(a)?[...t,o]:t;if(typeof e==`string`||typeof e==`number`)return[{text:String(e)}];let c,l=ul([{name:`text`,type:`words`,aliases:[`name`,`title`,`label`,`cause`],required:!0}],e,s,n,{...r,what:`a cause`,rest:(e,t)=>!xl.includes(Wl(e))||i>0?!1:(c=t,!0)});return l===void 0?[]:(c!==void 0&&(l.causes=Sl(c,[...s,`causes`],n,r,i+1)),[l])})}function Cl(e,t,n,r){let i=ol(e);if(!sl(i)){n.push({path:t,message:`a fishbone is { effect, categories: [{ name, causes: [...] }] } or { effect, data, category, cause }, not ${JSON.stringify(i)}.`});return}let a={},o,s=``,c={},l=ul([{name:`effect`,type:`words`,aliases:[`problem`,`head`,`outcome`,`title`,`issue`,`result`],required:!0},{name:`data`,type:`string`,aliases:[`source`]},{name:`alt`,type:`words`}],i,t,n,{...r,what:`a fishbone`,rest:(e,r)=>{let i=Wl(e);return[`categories`,`bones`,`branches`,`causes`,`groups`,`items`].includes(i)?o===void 0?(o=r,s=e,!0):(n.push({path:[...t,e],message:`${e} and ${s} are both its categories: give one.`}),!0):(c[e]=r,!0)}});if(l!==void 0){if(Object.assign(a,l),o!==void 0){let e=ol(o),i=[...t,s],c=sl(e)?Object.entries(e).map(([e,t])=>({name:e,causes:t})):e;Array.isArray(c)?a.categories=c.flatMap((e,t)=>{if(typeof e==`string`)return[{name:e,causes:[]}];let a,o=ul(bl,e,[...i,t],n,{...r,what:`a category`,rest:(e,t)=>xl.includes(Wl(e))?(a=t,!0):!1});return o===void 0?[]:(o.causes=a===void 0?[]:Sl(a,[...i,t,`causes`],n,r,0),[o])}):n.push({path:i,message:`categories is a list of { name, causes }, or { People: [causes…], … }.`})}if(a.data!==void 0)a.columns=yl([{name:`category`,type:`string`,aliases:[`name`,`bone`,`group`,`area`]},{name:`cause`,type:`string`,aliases:[`text`,`reason`,`factor`]}],c,t,n);else for(let e of Object.keys(c))n.push({path:[...t,e],message:`there is no ${e}: a fishbone has effect, categories (or data), alt.`});return a.categories===void 0&&a.data===void 0&&n.push({path:t,message:`a fishbone has categories, or data.`}),a}}let wl=[{name:`title`,type:`words`,aliases:[`label`,`name`,`text`]},{name:`low`,type:`words`,aliases:[`low_label`,`left`,`bottom`]},{name:`high`,type:`words`,aliases:[`high_label`,`right`,`top`]},{name:`min`,type:`number`,aliases:[`from`,`start`]},{name:`max`,type:`number`,aliases:[`to`,`end`]},{name:`split`,type:`number`,aliases:[`mid`,`middle`,`midpoint`,`threshold`,`cut`,`cross`]}],Tl={top_left:0,tl:0,upper_left:0,top_right:1,tr:1,upper_right:1,bottom_left:2,bl:2,lower_left:2,bottom_right:3,br:3,lower_right:3},El=[{name:`name`,type:`words`,aliases:[`label`,`title`,`text`,`item`,`idea`,`option`],required:!0},{name:`x`,type:`number`,aliases:[`score_x`,`horizontal`,`across`,`x_score`]},{name:`y`,type:`number`,aliases:[`score_y`,`vertical`,`up`,`y_score`]},{name:`quadrant`,type:`string`,aliases:[`cell`,`box`,`group`]},{name:`status`,type:`tone`,aliases:[`tone`]},{name:`color`,type:`color`,aliases:[`colour`]}];function Dl(e,t,n,r){let i,a=``,o={},s=ol(e),c=ul([{name:`x_axis`,type:`chart`,aliases:[`x_label`,`horizontal_axis`]},{name:`y_axis`,type:`chart`,aliases:[`y_label`,`vertical_axis`]},{name:`quadrants`,type:`chart`,aliases:[`quadrant_names`,`quadrant_labels`,`cells`,`boxes`]},{name:`data`,type:`string`,aliases:[`source`]},{name:`alt`,type:`words`}],sl(s)?Object.fromEntries(Object.entries(s).map(([e,t])=>{let n=ol(t),r=Wl(e);return[`x_axis`,`y_axis`,`x_label`,`y_label`].includes(r)&&typeof n==`string`?[e,{title:n}]:[`quadrants`,`quadrant_names`,`quadrant_labels`,`cells`,`boxes`].includes(r)&&Array.isArray(n)?[e,{list:n}]:[e,n]})):s,t,n,{...r,what:`a matrix`,rest:(e,t)=>{let n=Wl(e);return[`items`,`points`,`ideas`,`options`,`initiatives`,`dots`].includes(n)?(i=t,a=e,!0):(o[e]=t,!0)}});if(c!==void 0){for(let e of[`x_axis`,`y_axis`])c[e]!==void 0&&(c[e]=ul(wl,c[e],[...t,e],n,{...r,what:`an axis`}));if(c.quadrants!==void 0){let e=c.quadrants,r=[void 0,void 0,void 0,void 0];if(Array.isArray(e.list))e.list.slice(0,4).forEach((e,t)=>{typeof e==`string`?r[t]=e:sl(e)&&typeof e.name==`string`&&(r[t]=e.name)});else for(let[i,a]of Object.entries(e)){let e=Tl[Wl(i)];e===void 0||typeof a!=`string`?n.push({path:[...t,`quadrants`,i],message:`quadrants are four names in reading order (top left, top right, bottom left, bottom right), or { top_left, top_right, bottom_left, bottom_right }.`}):r[e]=a}c.quadrants=r}if(i!==void 0){let e=ol(i);Array.isArray(e)?c.items=e.flatMap((e,i)=>{let o=ul(El,e,[...t,a,i],n,{...r,what:`an item of a matrix`});return o===void 0?[]:(o.x===void 0!=(o.y===void 0)&&n.push({path:[...t,a,i],message:`an item has both x and y, or a quadrant.`}),o.x===void 0&&o.quadrant===void 0&&n.push({path:[...t,a,i],message:`an item is placed by its x and y scores, or by its quadrant (top-left, top-right, bottom-left, bottom-right, or a quadrant's name).`}),[o])}):n.push({path:[...t,a],message:`items is a list.`})}if(c.data!==void 0)c.columns=yl(El,o,t,n);else for(let e of Object.keys(o))n.push({path:[...t,e],message:`there is no ${e}: a matrix has items (or data), x_axis, y_axis, quadrants, alt.`});return c.items===void 0&&c.data===void 0&&n.push({path:t,message:`a matrix has items, or data.`}),c}}let Ol=[{name:`name`,type:`words`,aliases:[`label`,`title`],required:!0},{name:`values`,type:`numbers`,aliases:[`data`,`value`]},{name:`color`,type:`color`,aliases:[`colour`,`background_color`]}];function kl(e,t,n,r){let i=ol(e);if(!Array.isArray(i))n.push({path:t,message:`series is a list: { name, values } each, or with data the names of its columns.`});else return i.flatMap((e,i)=>{if(typeof e==`string`)return[e];let a=ul(Ol,e,[...t,i],n,{...r,what:`a series`});return a===void 0?[]:[a]})}function Al(e,t,n,r){let i,a=ul([{name:`categories`,type:`words-list`,aliases:[`columns`,`segments`,`labels`,`markets`,`x`]},{name:`data`,type:`string`,aliases:[`source`]},{name:`widths`,type:`numbers`,aliases:[`width`,`sizes`,`totals`,`market_size`]},{name:`format`,type:`string`,aliases:[`number_format`]},{name:`labels`,type:{oneOf:{share:`share`,percent:`share`,percentage:`share`,value:`value`,values:`value`,none:`none`,false:`none`,true:`share`}},aliases:[`data_labels`]},{name:`alt`,type:`words`}],e,t,n,{...r,what:`a Marimekko`,rest:(e,t)=>{let n=Wl(e);return[`series`,`datasets`,`rows`,`stacks`,`segments_by`].includes(n)?(i=t,!0):!1}});if(a!==void 0){if(i!==void 0){let e=kl(i,[...t,`series`],n,r);e!==void 0&&(a.series=e)}return a.series===void 0&&n.push({path:t,message:`a Marimekko has series.`}),a.data===void 0&&!Array.isArray(a.categories)&&n.push({path:t,message:`a Marimekko has categories (its columns), or data.`}),a}}function jl(e,t,n,r){let i=ul([{name:`rows`,type:`words-list`,aliases:[`row_labels`,`y`,`y_labels`,`row_names`]},{name:`columns`,type:`words-list`,aliases:[`column_labels`,`x`,`x_labels`,`categories`,`column_names`,`labels`]},{name:`values`,type:`matrix`,aliases:[`cells`,`matrix`,`z`,`grid`]},{name:`data`,type:`string`,aliases:[`source`,`range`]},{name:`format`,type:`string`,aliases:[`number_format`]},{name:`color`,type:`color`,aliases:[`colour`,`hue`]},{name:`low_color`,type:`color`,aliases:[`min_color`,`low_colour`,`from`]},{name:`mid`,type:`number`,aliases:[`midpoint`,`center`,`centre`]},{name:`min`,type:`number`},{name:`max`,type:`number`},{name:`show_values`,type:`bool`,aliases:[`show_labels`,`data_labels`,`numbers`]},{name:`title`,type:`words`,aliases:[`corner`,`heading`]},{name:`alt`,type:`words`}],e,t,n,{...r,what:`a heatmap`});if(i===void 0)return;i.values===void 0&&i.data===void 0&&n.push({path:t,message:`a heatmap has values, or data.`});let a=i.values;if(a!==void 0){let e=i.rows,r=i.columns;Array.isArray(e)&&e.length!==a.length&&n.push({path:[...t,`rows`],message:`rows names ${String(e.length)} rows; values has ${String(a.length)}.`});let o=Math.max(0,...a.map(e=>e.length));Array.isArray(r)&&r.length!==o&&n.push({path:[...t,`columns`],message:`columns names ${String(r.length)} columns; values' rows have ${String(o)}.`})}return i}let Ml=[`type`,`legend`,`labels`,`gap_width`,`overlap`,`value_axis`,`category_axis`,`smooth`,`line_width`,`size`,`color`,`colors`];function Nl(e,t,n,r){let i,a=``,o,s={},c=ul([{name:`categories`,type:`words-list`,aliases:[`labels`,`x`]},{name:`data`,type:`string`,aliases:[`source`]},{name:`by`,type:`string`,aliases:[`facet`,`split`,`per`,`split_by`,`group_by`,`row`,`column_by`,`panel`]},{name:`columns`,type:`number`,aliases:[`across`,`cols`,`wrap`,`per_row`]},{name:`shared`,type:`bool`,aliases:[`shared_axes`,`same_scale`,`share_axes`]},{name:`format`,type:`string`,aliases:[`number_format`]},{name:`chart`,type:`chart`,aliases:[`spec`,`each`,`template`]},{name:`alt`,type:`words`}],e,t,n,{...r,what:`small multiples`,rest:(e,t)=>{let n=Wl(e);return[`panels`,`items`,`charts`,`multiples`,`groups`,`facets`].includes(n)?(i=t,a=e,!0):n===`series`||n===`datasets`?(o=t,!0):Ml.includes(n)?(s[n===`colors`?`color`:n]=t,!0):!1}});if(c===void 0)return;let l={...sl(c.chart)?c.chart:{},...s};if(typeof l.type!=`string`&&(l.type=`column-clustered`),c.chart=l,o!==void 0){let e=kl(o,[...t,`series`],n,r);e!==void 0&&(c.series=e)}if(i!==void 0){let e=ol(i);Array.isArray(e)?c.panels=e.flatMap((e,i)=>{let o,s=ul([{name:`title`,type:`words`,aliases:[`name`,`label`,`category`,`group`],required:!0},{name:`values`,type:`numbers`,aliases:[`data`,`value`]}],e,[...t,a,i],n,{...r,what:`a panel`,rest:(e,t)=>[`series`,`datasets`].includes(Wl(e))?(o=t,!0):!1});if(s===void 0)return[];if(o!==void 0){let e=kl(o,[...t,a,i,`series`],n,r);e!==void 0&&(s.series=e)}return s.values===void 0&&s.series===void 0&&n.push({path:[...t,a,i],message:`a panel has values, or series.`}),[s]}):n.push({path:[...t,a],message:`panels is a list of { title, values } or { title, series }.`})}return c.panels===void 0&&c.data===void 0&&n.push({path:t,message:`small multiples have panels, or data and by.`}),c.data!==void 0&&c.by===void 0&&n.push({path:t,message:`with data, by names the column each panel is one value of.`}),c}function Pl(e,t,n,r,i){switch(e){case`org_chart`:case`issue_tree`:case`decision_tree`:return vl(e,t,n,r,i);case`fishbone`:return Cl(t,n,r,i);case`matrix`:return Dl(t,n,r,i);case`marimekko`:return Al(t,n,r,i);case`heatmap`:return jl(t,n,r,i);case`small_multiples`:return Nl(t,n,r,i)}}let Fl={alluvial:`sankey`,alluvial_diagram:`sankey`,sankey_diagram:`sankey`,sankey_chart:`sankey`,flows:`sankey`,flow_diagram:`sankey`,roadmap:`gantt`,gantt_chart:`gantt`,timeline_gantt:`gantt`,gantt_timeline:`gantt`,project_plan:`gantt`},Il=[`links`,`flows`,`edges`,`nodes`,`source`,`target`,`from`,`to`],Ll={fields:[{name:`source`,type:`string`,aliases:[`from`,`origin`,`src`,`parent`],required:!0},{name:`target`,type:`string`,aliases:[`to`,`destination`,`dest`,`dst`,`child`],required:!0},{name:`value`,type:`number`,aliases:[`amount`,`weight`,`flow`,`count`,`size`,`volume`,`qty`,`quantity`,`total`],required:!0},{name:`color`,type:`color`,aliases:[`colour`]}]},Rl={fields:[{name:`nodes`,type:`nodes`,aliases:[`node`]},{name:`format`,type:`string`,aliases:[`number_format`]},{name:`values`,type:`bool`,aliases:[`show_values`,`data_labels`,`labels`]},{name:`align`,type:{oneOf:{justify:`justify`,justified:`justify`,left:`left`,start:`left`,right:`right`,end:`right`,center:`center`,centre:`center`}},aliases:[`node_align`,`alignment`]},{name:`alt`,type:`words`}],item:`link`,list:!0},zl={fields:[{name:`name`,type:`words`,aliases:[`title`,`task`,`label`,`activity`,`item`,`text`],required:!0},{name:`id`,type:`string`,aliases:[`key`,`code`,`wbs`]},{name:`start`,type:`string`,aliases:[`begin`,`from`,`start_date`,`starts`,`date`]},{name:`end`,type:`string`,aliases:[`finish`,`to`,`due`,`end_date`,`ends`,`until`,`deadline`]},{name:`duration`,type:`string`,aliases:[`days`,`length`]},{name:`group`,type:`words`,aliases:[`lane`,`phase`,`stream`,`workstream`,`section`,`category`,`team`,`swimlane`,`track`,`epic`]},{name:`progress`,type:`string`,aliases:[`complete`,`percent`,`percent_complete`,`completion`,`done`]},{name:`milestone`,type:`bool`,aliases:[`is_milestone`]},{name:`depends`,type:`names`,aliases:[`dependencies`,`depends_on`,`after`,`predecessors`,`needs`]},{name:`status`,type:`tone`,aliases:[`tone`,`rag`,`health`]},{name:`color`,type:`color`,aliases:[`colour`]}]},Bl={fields:[{name:`today`,type:`string`,aliases:[`now`,`as_of`,`status_date`]},{name:`scale`,type:{oneOf:{day:`day`,days:`day`,daily:`day`,week:`week`,weeks:`week`,weekly:`week`,month:`month`,months:`month`,monthly:`month`,quarter:`quarter`,quarters:`quarter`,quarterly:`quarter`,year:`year`,years:`year`,yearly:`year`}},aliases:[`unit`,`zoom`,`interval`,`period`]},{name:`alt`,type:`words`}],item:`task`,list:!0},Vl=[`links`,`flows`,`edges`,`tasks`,`activities`],Hl=[`chart`,`table`,`stats`,`stat`,`card`,`tag`,`callout`,`icon`,`progress`,`timeline`,`steps`,`person`,`people`,`risk_matrix`,`sankey`,`gantt`,...Yc],Ul=e=>Yc.includes(e);function Wl(e){return e.trim().replace(/([a-z0-9])([A-Z])/gu,`$1_$2`).toLowerCase().replace(/[-\s]+/gu,`_`)}let Gl={kpi:`stat`,kpi_card:`stat`,kpi_tile:`stat`,metric:`stat`,kpis:`stats`,metrics:`stats`,scorecard:`stats`,tile:`card`,panel:`card`,badge:`tag`,pill:`tag`,chip:`tag`,alert:`callout`,admonition:`callout`,notice:`callout`,banner:`callout`,glyph:`icon`,gauge:`progress`,meter:`progress`,progress_bar:`progress`,progressbar:`progress`,milestones:`timeline`,process:`steps`,stepper:`steps`,flow:`steps`,avatar:`person`,profile:`person`,member:`person`,team:`people`,members:`people`,graph:`chart`,risk_grid:`risk_matrix`,risk_map:`risk_matrix`,impact_matrix:`risk_matrix`,probability_impact:`risk_matrix`,...Fl,...Xc};function Kl(e){let t=Wl(e);return Hl.includes(t)?t:Gl[t]}function ql(e){if(typeof e!=`string`)return!1;let t=e.trim();return Jl(t)?!0:/^=\S/u.test(t)||/^[A-Za-z_\\][\w.]*\[[^\]]+\]$/u.test(t)||/^(?:'[^']+'|[A-Za-z_][\w.]*)![A-Z]{1,3}\d+(?::[A-Z]{1,3}\d+)?$/u.test(t)}function Jl(e){if(typeof e!=`string`)return!1;let t=e.trim();return/^(?:\.{1,2}\/|\/)\S+$/u.test(t)?t.includes(`#`)||/\.(?:csv|ya?ml|json)$/iu.test(t):/^[\w.-]+(?:\/[\w.-]+)*\.(?:csv|ya?ml|json)(?:#\S+)?$/iu.test(t)||/^[\w.-]+(?:\/[\w.-]+)+#\S+$/u.test(t)}let Yl={name:`alt`,type:`words`},Xl={name:`orientation`,type:{oneOf:{horizontal:`horizontal`,row:`horizontal`,across:`horizontal`,vertical:`vertical`,column:`vertical`,down:`vertical`}},aliases:[`direction`]},Zl={fields:[{name:`value`,type:`figure`,aliases:[`figure`,`number`,`kpi`,`metric`],required:!0},{name:`label`,type:`words`,aliases:[`title`,`name`,`caption`],required:!0},{name:`delta`,type:`figure`,aliases:[`change`,`diff`,`vs`]},{name:`good`,type:{oneOf:{up:`up`,higher:`up`,increase:`up`,down:`down`,lower:`down`,decrease:`down`}},aliases:[`direction`]},{name:`status`,type:`tone-ref`,aliases:[`tone`,`rag`]},{name:`target`,type:`figure`,aliases:[`goal`,`benchmark`]},{name:`min`,type:`figure`,aliases:[`low`,`from`,`floor`,`scale_min`,`range_min`]},{name:`max`,type:`figure`,aliases:[`high`,`to`,`ceiling`,`scale_max`,`range_max`]},{name:`note`,type:`words`,aliases:[`subtitle`,`footnote`,`context`]},{name:`trend`,type:`series`,aliases:[`sparkline`,`history`]},{name:`format`,type:`string`,aliases:[`number_format`]},{name:`icon`,type:`string`},Yl]},Ql={fields:[{name:`name`,type:`words`,required:!0},{name:`role`,type:`words`,aliases:[`title`,`job`,`position`,`job_title`]},{name:`photo`,type:`string`,aliases:[`image`,`avatar`,`picture`,`src`]},{name:`note`,type:`words`,aliases:[`text`,`team`]},Yl]},$l={stat:Zl,person:Ql,milestone:{fields:[{name:`date`,type:`string`,aliases:[`when`,`at`,`time`]},{name:`title`,type:`words`,aliases:[`name`,`label`,`event`],required:!0},{name:`text`,type:`words`,aliases:[`description`,`body`]},{name:`lane`,type:`words`,aliases:[`track`,`row`,`group`,`stream`]},{name:`status`,type:{oneOf:{done:`done`,complete:`done`,completed:`done`,shipped:`done`,current:`current`,now:`current`,active:`current`,in_progress:`current`,planned:`planned`,next:`planned`,todo:`planned`,upcoming:`planned`,future:`planned`,...Object.fromEntries(Qc.map(e=>[e,e])),at_risk:`warning`,risk:`warning`,late:`bad`,blocked:`bad`}},aliases:[`state`,`tone`]}]},step:{fields:[{name:`title`,type:`words`,aliases:[`name`,`label`],required:!0},{name:`text`,type:`words`,aliases:[`description`,`body`]},{name:`icon`,type:`string`}]},entry:{fields:[{name:`label`,type:`words`,aliases:[`number`,`name`,`id`,`title`],required:!0},{name:`row`,type:`string`,aliases:[`y`,`impact`,`severity`],required:!0},{name:`column`,type:`string`,aliases:[`x`,`likelihood`,`probability`,`col`],required:!0}]},link:Ll,task:zl},eu={stat:Zl,stats:{fields:[Yl,{name:`columns`,type:`number`,aliases:[`across`,`per_row`]}],item:`stat`,list:!0},card:{fields:[{name:`eyebrow`,type:`words`,aliases:[`kicker`,`overline`,`label`]},{name:`value`,type:`figure`,aliases:[`metric`,`figure`,`number`,`kpi`]},{name:`caption`,type:`words`,aliases:[`value_label`,`metric_label`,`unit`]},{name:`title`,type:`words`,aliases:[`heading`,`name`]},{name:`subtitle`,type:`words`,aliases:[`subheading`]},{name:`body`,type:`words`,aliases:[`text`,`description`,`content`]},{name:`lines`,type:`lines`,aliases:[`items`,`points`,`bullets`,`details`,`facts`,`list`]},{name:`icon`,type:`string`},{name:`tag`,type:`tag`,aliases:[`badge`,`pill`,`chip`]},{name:`featured`,type:`bool`,aliases:[`highlight`,`highlighted`,`primary`,`emphasis`]},Yl]},tag:{fields:[{name:`text`,type:`words`,aliases:[`label`,`value`],required:!0},{name:`status`,type:`tone`,aliases:[`tone`,`variant`]},{name:`color`,type:`color`,aliases:[`colour`]},Yl]},callout:{fields:[{name:`title`,type:`words`,aliases:[`heading`]},{name:`text`,type:`words`,aliases:[`body`,`content`,`message`]},{name:`tone`,type:`callout-tone`,aliases:[`status`,`type`,`kind`,`variant`]},{name:`icon`,type:`string`,aliases:[`emoji`]},Yl]},icon:{fields:[{name:`name`,type:`string`,aliases:[`icon`,`glyph`],required:!0},{name:`size`,type:`number`},{name:`color`,type:`color`,aliases:[`colour`]},{name:`stroke`,type:`number`,aliases:[`stroke_width`]},Yl]},progress:{fields:[{name:`value`,type:`figure`,aliases:[`percent`,`current`],required:!0},{name:`of`,type:`figure`,aliases:[`max`,`total`]},{name:`target`,type:`figure`,aliases:[`goal`]},{name:`label`,type:`words`,aliases:[`title`]},{name:`note`,type:`words`},{name:`shape`,type:{oneOf:{bar:`bar`,linear:`bar`,line:`bar`,ring:`ring`,circle:`ring`,donut:`ring`,doughnut:`ring`,gauge:`ring`,radial:`ring`}},aliases:[`type`,`variant`]},{name:`status`,type:`tone-ref`,aliases:[`tone`]},{name:`format`,type:`string`,aliases:[`number_format`]},Yl]},timeline:{fields:[{name:`today`,type:`string`,aliases:[`now`]},{name:`bands`,type:{oneOf:{months:`months`,month:`months`,true:`months`,quarters:`quarters`,quarter:`quarters`,none:`none`,false:`none`}},aliases:[`periods`,`scale`,`band`]},Xl,Yl],item:`milestone`,list:!0},steps:{fields:[{name:`current`,type:`string`,aliases:[`active`]},{name:`numbered`,type:`bool`},Xl,Yl],item:`step`,list:!0},person:Ql,people:{fields:[Yl],item:`person`,list:!0},sankey:Rl,gantt:Bl,risk_matrix:{fields:[{name:`rows`,type:`labels`,aliases:[`y_labels`,`row_labels`,`levels`],required:!0},{name:`columns`,type:`labels`,aliases:[`x_labels`,`column_labels`,`cols`],required:!0},{name:`y`,type:`words`,aliases:[`y_label`,`y_axis`,`row_title`]},{name:`x`,type:`words`,aliases:[`x_label`,`x_axis`,`column_title`]},{name:`tones`,type:{oneOf:{risk:`risk`,heat:`risk`,rag:`risk`,none:`none`,plain:`none`,false:`none`}},aliases:[`colors`,`colours`,`shading`]},Yl],item:`entry`,list:!0}},tu={"":!0,true:!0,yes:!0,1:!0,false:!1,no:!1,0:!1};function nu(e){if(typeof e!=`string`)return e;let t=e.trim();if(!/^[[{]/u.test(t))return e;try{return JSON.parse(t)}catch(t){if(t instanceof SyntaxError)return e;throw t}}let ru=`a role (text, muted, accent1…accent6, deep), a tone (${Qc.join(`, `)}), a colour name (${el.join(`, `)}) or #RRGGBB`;function iu(e){return al(e)!==void 0||il(e)!==void 0||el.includes(e.trim().toLowerCase())||/^#[0-9A-Fa-f]{6}$/u.test(e.trim())||id(e.trim())!==void 0}function au(e,t,n,r){let i=i=>(r.push({path:n,message:`${e.name} is ${i}, not ${JSON.stringify(t)}.`}),null),a=e.type;if(typeof a==`object`)return typeof t==`string`?a.oneOf[Wl(t)]??i(`one of ${[...new Set(Object.values(a.oneOf))].join(`, `)}`):i(Object.keys(a.oneOf).join(`, `));switch(a){case`words`:case`string`:return typeof t==`string`?t:typeof t==`number`?String(t):i(`words`);case`figure`:return typeof t==`number`&&Number.isFinite(t)||typeof t==`string`&&t.trim()!==``?t:i(`a figure (words such as 68.4%, a number, or a reference)`);case`series`:{if(ql(t))return t;let e=nu(t),n=typeof e==`string`?e.split(`,`).map(e=>e.trim()===``?NaN:Number(e)):e;return Array.isArray(n)&&n.length>0&&n.every(e=>typeof e==`number`&&Number.isFinite(e))?n:i(`numbers oldest first ([12, 15, 14, 19] or 12,15,14,19), or a reference`)}case`tone`:case`tone-ref`:case`callout-tone`:return a===`tone-ref`&&ql(t)?t:typeof t==`string`?il(t,a===`callout-tone`?`callout`:`other`)??i(`a tone (${Qc.join(`, `)}, or RAG's red, amber, green)`):i(`a tone (${Qc.join(`, `)})`);case`bool`:return typeof t==`boolean`?t:(typeof t==`string`?tu[t.trim().toLowerCase()]:void 0)??i(`true or false`);case`number`:{let e=typeof t==`string`&&t.trim()!==``?Number(t):t;return typeof e==`number`&&Number.isFinite(e)?e:i(`a number`)}case`color`:return typeof t==`string`&&iu(t)?t.trim():i(ru);case`tag`:return typeof t==`string`?{text:t}:ou(eu.tag,nu(t),n,r,{});case`names`:{let e=nu(t),n=Array.isArray(e)?e:typeof e==`string`||typeof e==`number`?String(e).split(/[,;]/u):void 0;if(n===void 0||!n.every(e=>typeof e==`string`||typeof e==`number`))return i(`a task's name or id, or a list of them`);let r=n.map(e=>String(e).trim()).filter(e=>e!==``);return r.length===0?null:r}case`nodes`:{let e=nu(t);if(!Array.isArray(e))return i(`a list of nodes: a name each, or { name, label, color }`);let a=[];return e.forEach((e,t)=>{if(typeof e==`string`||typeof e==`number`){a.push({name:String(e)});return}if(typeof e!=`object`||!e){r.push({path:[...n,t],message:`a node is its name, or { name, label, color }.`});return}let i={};for(let[a,o]of Object.entries(e)){let e=Wl(a),s=typeof o==`string`||typeof o==`number`?String(o):void 0;s!==void 0&&(e===`name`||e===`id`||e===`key`?i.name??=s:e===`label`||e===`title`||e===`text`?i.label=s:e===`color`||e===`colour`?iu(s)?i.color=s.trim():r.push({path:[...n,t,a],message:`color is ${ru}, not ${JSON.stringify(o)}.`}):r.push({path:[...n,t,a],message:`a node has name, label, color; not ${a}.`}))}i.name??=i.label??``,i.name===``?r.push({path:[...n,t],message:`a node has a name.`}):a.push(i)}),a}case`labels`:{let e=nu(t),n=typeof e==`string`?e.split(`,`).map(e=>e.trim()):e;return Array.isArray(n)&&n.length>0&&n.every(e=>typeof e==`string`||typeof e==`number`)?n.map(String):i(`labels in order ([High, Med, Low] or High,Med,Low)`)}case`lines`:{let e=nu(t);if(typeof e==`string`)return[{text:e}];if(typeof e==`object`&&e&&!Array.isArray(e))return Object.entries(e).map(([e,t])=>({label:e,text:String(t)}));if(!Array.isArray(e))return i(`lines: a list of words, or of { label, text }`);let a=[];return e.forEach((e,t)=>{if(typeof e==`string`||typeof e==`number`)a.push({text:String(e)});else if(typeof e==`object`&&e){let i=e,o=i.label??i.name??i.key??i.term,s=i.text??i.value??i.body??i.description;typeof s!=`string`&&typeof s!=`number`?r.push({path:[...n,t],message:`a line has its text: { label, text }, or words.`}):a.push({text:String(s),...typeof o==`string`?{label:o}:{}})}}),a}}}function ou(e,t,n,r,i){let a=nu(t);if(typeof a!=`object`||!a||Array.isArray(a)){r.push({path:n,message:`this is a block's fields, not ${JSON.stringify(a)}.`});return}let o=/* @__PURE__ */ new Map;for(let t of e.fields){o.set(t.name,t);for(let e of t.aliases??[])o.has(e)||o.set(e,t)}let s={},c=/* @__PURE__ */ new Map;for(let[t,i]of Object.entries(a)){if(i==null)continue;let a=Wl(t);if((a===`down_is_good`||a===`lower_is_better`)&&o.has(`good`)){let e=au({name:t,type:`bool`},i,[...n,t],r);if(e==null)continue;if(c.has(`good`)){r.push({path:[...n,t],message:`${t} and ${c.get(`good`)??`good`} both say which way is good: give one.`});continue}s.good=e===!0?`down`:`up`,c.set(`good`,t);continue}if(a===`higher_is_better`&&o.has(`good`)){let e=au({name:t,type:`bool`},i,[...n,t],r);if(e==null)continue;s.good=e===!0?`up`:`down`,c.set(`good`,t);continue}let l=o.get(a);if(l===void 0){r.push({path:[...n,t],message:`there is no ${t}: a block of this kind has ${e.fields.map(e=>e.name).join(`, `)}.`});continue}let u=c.get(l.name);if(u!==void 0){r.push({path:[...n,t],message:`${t} and ${u} are both ${l.name}: give one.`});continue}let d=au(l,i,[...n,t],r);d!=null&&(s[l.name]=d,c.set(l.name,t))}for(let t of e.fields)t.required===!0&&s[t.name]===void 0&&(i.wordsElsewhere!==!0||t.type!==`words`)&&r.push({path:n,message:`a block of this kind has a ${t.name}.`});return s}function su(e,t,n,r,i){let a=e.item;if(a===void 0)return ou(e,t,n,r,i);let o=$l[a],s=(e,t)=>e.flatMap((e,n)=>{let a=ou(o,e,[...t,n],r,i);return a===void 0?[]:[a]}),c=nu(t);if(Array.isArray(c))return{items:s(c,n)};if(typeof c!=`object`||!c){r.push({path:n,message:`this is a list of items, or { items: [...] }, or { data: <a table>, … }, not ${JSON.stringify(c)}.`});return}let l={},u={},d,f,p=new Set(e.fields.flatMap(e=>[e.name,...e.aliases??[]])),m=[`items`,`milestones`,`events`,`stages`,`phases`,`people`,`members`,`stats`,`kpis`,...Vl,`entries`,`risks`,`points`];for(let[e,t]of Object.entries(c)){let n=Wl(e);m.includes(n)?d=t:n===`data`||n===`source`&&a!==`link`?f=t:p.has(n)?l[e]=t:u[e]=t}let h=ou(e,l,n,r,i)??{};if(d!==void 0&&f!==void 0&&r.push({path:n,message:`give items or data, not both.`}),d!==void 0){let e=nu(d);Array.isArray(e)?h.items=s(e,[...n,`items`]):r.push({path:[...n,`items`],message:`items is a list.`})}else if(f!==void 0){typeof f!=`string`||f.trim()===``?r.push({path:[...n,`data`],message:`data names a table: ../budget/budget#kpis.`}):h.data=f.trim();let e=/* @__PURE__ */ new Map;for(let t of o.fields){e.set(t.name,t.name);for(let n of t.aliases??[])e.has(n)||e.set(n,t.name)}let t={};for(let[i,a]of Object.entries(u)){let s=e.get(Wl(i));s===void 0||typeof a!=`string`?r.push({path:[...n,i],message:s===void 0?`there is no ${i}: with data, a field names its column (${o.fields.map(e=>e.name).join(`, `)}).`:`${i} names a column of the data, not ${JSON.stringify(a)}.`}):t[s]=a}Object.keys(t).length>0&&(h.columns=t)}else{for(let t of Object.keys(u))r.push({path:[...n,t],message:`there is no ${t}: this block has items (or data), ${e.fields.map(e=>e.name).join(`, `)}.`});Object.keys(u).length===0&&r.push({path:n,message:`this block has items, or data.`})}return h}let cu=[`columns`,`rows`,`data`,`head`,`total`,`alt`],lu={left:`left`,l:`left`,start:`left`,center:`center`,centre:`center`,ctr:`center`,middle:`center`,right:`right`,r:`right`,end:`right`};function uu(e,t,n){let r=nu(e);if(typeof r!=`object`||!r||Array.isArray(r)){n.push({path:t,message:`a table is { columns, rows } or { data }.`});return}let i={fields:`columns`,headers:`columns`,source:`data`,header:`head`,totals:`total`},a={};for(let[e,o]of Object.entries(r)){let r=Wl(e),s=i[r]??r;if(!cu.includes(s)){n.push({path:[...t,e],message:`there is no ${e}: a table has ${cu.join(`, `)}.`});continue}if(a[s]!==void 0){n.push({path:[...t,e],message:`${e} is ${s} again: give one.`});continue}let c=[...t,e],l=nu(o);if(s===`columns`){if(!Array.isArray(l)){n.push({path:c,message:`columns is a list: a name each, or { name, title, align, format, width, tag }.`});continue}let e=[];l.forEach((t,r)=>{if(typeof t==`string`||typeof t==`number`){e.push({name:String(t)});return}if(typeof t!=`object`||!t){n.push({path:[...c,r],message:`a column is its name, or { name, … }.`});return}let i={name:``};for(let[e,a]of Object.entries(t)){let t=Wl(e);(t===`name`||t===`key`||t===`field`)&&typeof a==`string`?i.name=a:(t===`title`||t===`label`||t===`header`)&&typeof a==`string`?i.title=a:t===`align`&&typeof a==`string`&&lu[Wl(a)]!==void 0?i.align=lu[Wl(a)]??`left`:(t===`format`||t===`number_format`)&&typeof a==`string`?i.format=a:t===`width`&&(typeof a==`number`||typeof a==`string`)?i.width=a:(t===`tag`||t===`pill`||t===`badge`||t===`status`)&&typeof a==`boolean`?i.tag=a:(t===`avatar`||t===`person`||t===`people`||t===`initials`||t===`owner`)&&typeof a==`boolean`?i.avatar=a:n.push({path:[...c,r,e],message:`a column has name, title, align (left, center, right), format, width, tag, avatar; not ${e}: ${JSON.stringify(a)}.`})}i.name===``&&i.title!==void 0&&i.title!==``&&(i.name=i.title),i.name===``&&(i.name=String(r+1)),e.push(i)}),a.columns=e}else if(s===`rows`)Array.isArray(l)?a.rows=l:n.push({path:c,message:`rows is a list of rows, each a list of cells or a record by column.`});else if(s===`data`)typeof l==`string`&&l.trim()!==``?a.data=l.trim():n.push({path:c,message:`data names a table: ../budget/budget#orders, or a CSV.`});else if(s===`head`||s===`total`){let e=au({name:s,type:`bool`},l,c,n);e!=null&&(a[s]=e)}else typeof l==`string`&&(a[s]=l)}return a.rows===void 0&&a.data===void 0&&n.push({path:t,message:`a table has rows, or data.`}),a}let du={column:`column-clustered`,columns:`column-clustered`,vertical_bar:`column-clustered`,bar:`bar-clustered`,horizontal_bar:`bar-clustered`,donut:`doughnut`,xy:`scatter`,point:`scatter`,points:`scatter`,lines:`line`,areas:`area`};function fu(e){let t=Wl(e),n=du[t];if(n!==void 0)return n;let r=t.replace(/([a-z])(\d)/gu,`$1_$2`).split(`_`),i=r.find(e=>[`column`,`bar`,`line`,`area`,`scatter`].includes(e));if(i===void 0)return e;let a=[i];return r.includes(`stacked`)&&a.push(`stacked`),(r.includes(`100`)||r.includes(`percent`))&&a.push(`100`),r.includes(`clustered`)&&a.push(`clustered`),r.includes(`markers`)&&a.push(`markers`),r.includes(`smooth`)&&a.push(`smooth`),(i===`column`||i===`bar`)&&a.length===1&&a.push(`clustered`),a.join(`-`)}function pu(e){let t={};for(let[n,r]of Object.entries(e)){let e=Wl(n);e===`type`&&typeof r==`string`?t.type=fu(r):e===`labels`&&Array.isArray(r)?t.categories=r:e===`datasets`&&Array.isArray(r)?t.series=r.map(e=>{if(typeof e!=`object`||!e)return e;let t={};for(let[n,r]of Object.entries(e)){let e=Wl(n);e===`label`?t.name=r:e===`data`?t.values=r:e===`background_color`||e===`border_color`?t.color??=r:t[e]=r}return t}):e===`data_labels`&&r!==void 0?t.labels=r:e===`legend`&&(r===!1||r===`none`||r===`false`)?t.legend=`none`:t[e]=r}let n=t.format??t.number_format;if(typeof n==`string`){delete t.format,delete t.number_format;let e=t.value_axis;e===void 0?t.value_axis={format:n}:typeof e==`object`&&e&&!Array.isArray(e)&&(t.value_axis={format:n,...e});let r=t.labels;r===!0?t.labels={value:!0,format:n}:typeof r==`object`&&r&&!Array.isArray(r)&&(t.labels={format:n,...r})}return t}let mu,hu=()=>{if(mu!==void 0)return mu;let e=Nd.extend({title:E().optional()});return mu=Pd.extend({title:E().optional(),value_axis:e.optional(),category_axis:e.optional(),secondary_axis:e.optional(),points:vc(E(),fc([E(),vc(E(),E())])).optional(),alt:E().optional(),legend:k([...Dd,`none`]).optional()}),mu};function gu(e,t,n={}){let r=[],i=_u(e,t)??Kl(e);if(i===void 0)return r.push({path:[],message:`there is no block ${e}: the blocks are ${Hl.join(`, `)}.`}),{problems:r};if(i===`chart`){let e=nu(t);if(typeof e!=`object`||!e||Array.isArray(e))return r.push({path:[],message:`a chart is { type, categories, series } or { type, data, … }.`}),{problems:r};let n=hu().safeParse(pu(e));if(!n.success){for(let e of n.error.issues)r.push({path:e.path.map(e=>typeof e==`number`?e:String(e)),message:e.message});return{problems:r}}return{block:{kind:i,fields:n.data},problems:r}}let a=i===`table`?uu(t,[],r):Ul(i)?Pl(i,t,[],r,n):su(eu[i],t,[],r,n);return a===void 0?{problems:r}:{block:{kind:i,fields:a},problems:r}}function _u(e,t){if(Wl(e)!==`flow`)return;let n=nu(t),r=Array.isArray(n)?n[0]:n;if(typeof r==`object`&&r)return Object.keys(r).map(Wl).some(e=>Il.includes(e))?`sankey`:void 0}let vu=[`stat`,`stats`,`card`,`tag`,`callout`,`icon`,`progress`,`timeline`,`steps`,`person`,`people`,`risk_matrix`,`sankey`,`gantt`,...Yc];function yu(e){return ic().superRefine((t,n)=>{for(let r of gu(e,t,{wordsElsewhere:!0}).problems)n.addIssue({code:`custom`,path:r.path,message:r.message})})}let bu=/^[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*$/u,xu=O({display:E(),speak:E()}),Su=O({declarations:cc(E()).default([]),selectors:cc(E()).default([]),match:vc(E(),E()).refine(e=>Object.keys(e).length>0,`A match needs at least one case.`)}),Cu=fc([E(),xu,gc([Su])]);vc(E(),ic()).superRefine((e,t)=>{for(let[n,r]of Object.entries(e)){if(n===`$schema`){typeof r!=`string`&&t.addIssue({code:`custom`,path:[n],message:`$schema is a string.`});continue}bu.test(n)||t.addIssue({code:`custom`,path:[n],message:`"${n}" is not a message key: letters, digits, _ and -, in segments joined by dots.`});let e=Cu.safeParse(r);e.success||t.addIssue({code:`custom`,path:[n],message:Array.isArray(r)?`A message with variants is [{ "declarations": […], "selectors": […], "match": {…} }]: ${e.error.issues.map(e=>e.message).join(`; `)}`:`A message is a string, { display, speak }, or [{ declarations, selectors, match }].`})}}).transform(e=>{let t={...e};return delete t.$schema,t});let wu=/^[A-Za-z0-9_-]+$/u,Tu=E().regex(wu,`A name is letters, digits, _ and -.`),Eu=Wc(()=>fc([E(),xu,Su,cc(Eu),vc(Tu,Eu)])),Du=O({id:Tu,say:fc([E(),Su]).optional(),screen:vc(Tu,Eu).optional()}),Ou=O({id:Tu,text:vc(Tu,Eu).optional(),alt:vc(Tu,E()).optional(),notes:fc([E(),Su]).optional()}),ku=O({id:Tu,text:vc(Tu,Eu).optional()});O({title:E().optional(),text:vc(Tu,Eu).optional(),parts:cc(Du).default([]),slides:cc(Ou).default([]),boards:cc(ku).default([])}).superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;e.parts.forEach((e,r)=>{n.has(e.id)&&t.addIssue({code:`custom`,path:[`parts`,r,`id`],message:`Two parts are "${e.id}".`}),n.add(e.id)});let r=/* @__PURE__ */ new Set;e.slides.forEach((e,n)=>{r.has(e.id)&&t.addIssue({code:`custom`,path:[`slides`,n,`id`],message:`Two slides are "${e.id}".`}),r.add(e.id)});let i=/* @__PURE__ */ new Set;e.boards.forEach((e,n)=>{i.has(e.id)&&t.addIssue({code:`custom`,path:[`boards`,n,`id`],message:`Two boards are "${e.id}".`}),i.add(e.id)})});let Au=E().regex(wu,`A name is letters, digits, _ and -.`),ju=[`dk1`,`lt1`,`dk2`,`lt2`,`accent1`,`accent2`,`accent3`,`accent4`,`accent5`,`accent6`,`hlink`,`folHlink`],Mu=[`l`,`ctr`,`r`,`just`],Nu=/* @__PURE__ */ `line.lineInv.triangle.rtTriangle.rect.diamond.parallelogram.trapezoid.nonIsoscelesTrapezoid.pentagon.hexagon.heptagon.octagon.decagon.dodecagon.star4.star5.star6.star7.star8.star10.star12.star16.star24.star32.roundRect.round1Rect.round2SameRect.round2DiagRect.snipRoundRect.snip1Rect.snip2SameRect.snip2DiagRect.plaque.ellipse.teardrop.homePlate.chevron.pieWedge.pie.blockArc.donut.noSmoking.rightArrow.leftArrow.upArrow.downArrow.stripedRightArrow.notchedRightArrow.bentUpArrow.leftRightArrow.upDownArrow.leftUpArrow.leftRightUpArrow.quadArrow.leftArrowCallout.rightArrowCallout.upArrowCallout.downArrowCallout.leftRightArrowCallout.upDownArrowCallout.quadArrowCallout.bentArrow.uturnArrow.circularArrow.leftCircularArrow.leftRightCircularArrow.curvedRightArrow.curvedLeftArrow.curvedUpArrow.curvedDownArrow.swooshArrow.cube.can.lightningBolt.heart.sun.moon.smileyFace.irregularSeal1.irregularSeal2.foldedCorner.bevel.frame.halfFrame.corner.diagStripe.chord.arc.leftBracket.rightBracket.leftBrace.rightBrace.bracketPair.bracePair.straightConnector1.bentConnector2.bentConnector3.bentConnector4.bentConnector5.curvedConnector2.curvedConnector3.curvedConnector4.curvedConnector5.callout1.callout2.callout3.accentCallout1.accentCallout2.accentCallout3.borderCallout1.borderCallout2.borderCallout3.accentBorderCallout1.accentBorderCallout2.accentBorderCallout3.wedgeRectCallout.wedgeRoundRectCallout.wedgeEllipseCallout.cloudCallout.cloud.ribbon.ribbon2.ellipseRibbon.ellipseRibbon2.leftRightRibbon.verticalScroll.horizontalScroll.wave.doubleWave.plus.flowChartProcess.flowChartDecision.flowChartInputOutput.flowChartPredefinedProcess.flowChartInternalStorage.flowChartDocument.flowChartMultidocument.flowChartTerminator.flowChartPreparation.flowChartManualInput.flowChartManualOperation.flowChartConnector.flowChartPunchedCard.flowChartPunchedTape.flowChartSummingJunction.flowChartOr.flowChartCollate.flowChartSort.flowChartExtract.flowChartMerge.flowChartOfflineStorage.flowChartOnlineStorage.flowChartMagneticTape.flowChartMagneticDisk.flowChartMagneticDrum.flowChartDisplay.flowChartDelay.flowChartAlternateProcess.flowChartOffpageConnector.actionButtonBlank.actionButtonHome.actionButtonHelp.actionButtonInformation.actionButtonForwardNext.actionButtonBackPrevious.actionButtonEnd.actionButtonBeginning.actionButtonReturn.actionButtonDocument.actionButtonSound.actionButtonMovie.gear6.gear9.funnel.mathPlus.mathMinus.mathMultiply.mathDivide.mathEqual.mathNotEqual.cornerTabs.squareTabs.plaqueTabs.chartX.chartStar.chartPlus`.split(`.`),Pu=[`appear`,`fade`,`fly-in`,`float-in`,`split`,`wipe`,`zoom`,`disappear`,`fade-out`,`fly-out`,`float-out`,`split-out`,`wipe-out`,`zoom-out`,`pulse`,`grow-shrink`,`spin`,`transparency`,`path`],Fu=[`word`,`letter`],Iu=[`until-next-click`,`until-end-of-slide`],Lu=[`on-click`,`with-previous`,`after-previous`],Ru=[`from-bottom`,`from-top`,`from-left`,`from-right`,`from-top-right`,`from-bottom-right`,`from-top-left`,`from-bottom-left`,`vertical-out`,`vertical-in`,`horizontal-out`,`horizontal-in`,`in`,`out`,`rotate`,`up`,`down`,`clockwise`,`counterclockwise`,`both`,`horizontal`,`vertical`],zu=[`solid`,`sysDot`,`sysDash`,`dash`,`dashDot`,`lgDash`,`lgDashDot`,`lgDashDotDot`,`dot`,`sysDashDot`,`sysDashDotDot`],Bu=[`flat`,`rnd`,`sq`],Vu=[`round`,`bevel`,`miter`],Hu=[`sng`,`dbl`,`thickThin`,`thinThick`,`tri`],Uu=[`none`,`triangle`,`arrow`,`stealth`,`diamond`,`oval`],Wu=[`sm`,`med`,`lg`],Gu=O({w:k(Wu).optional(),len:k(Wu).optional()}),Ku=O({x:D(),y:D(),w:D().nonnegative(),h:D().nonnegative()}),qu=[`tx1`,`bg1`,`tx2`,`bg2`],Ju=[...ju,...qu],Yu=[`tint`,`shade`,`lumMod`,`lumOff`,`lum`,`satMod`,`satOff`,`sat`,`hueMod`,`hueOff`,`hue`,`alpha`,`alphaMod`,`alphaOff`],Xu=`(?:${Ju.join(`|`)})`,Zu=`(?:${Yu.join(`|`)}) -?\\d+(?:\\.\\d+)?(?:%|°)`,Qu=RegExp(`^(${Xu}) (lighter|darker) (100(?:\\.0{1,3})?|[1-9]?\\d(?:\\.\\d{1,3})?)%$`,`u`),$u=RegExp(`^(${Xu}|#[0-9A-Fa-f]{6})((?: ${Zu})+)$`,`u`),ed=/^#[0-9A-Fa-f]{6}$/u,td=e=>Ju.includes(e),nd=e=>Yu.includes(e),rd=/* @__PURE__ */ new Set([`hue`,`hueOff`]);function id(e){if(td(e))return e;if(ed.test(e))return{rgb:e.toUpperCase()};let t=$u.exec(e);if(t){let[,e=``,n=``]=t,r=[];for(let e of n.matchAll(/ (\w+) (-?[\d.]+)(%|°)/gu)){let[,t=``,n=``,i]=e;if(!nd(t)||i===`°`!==rd.has(t))return;let a=Number(n);r.push({name:t,value:i===`%`?Math.round(a*1e3)/1e5:a})}return td(e)?{theme_color:e,transforms:r}:{rgb:e.toUpperCase(),transforms:r}}let n=Qu.exec(e),[,r=``,i,a=``]=n??[],o=Math.round(Number(a)*1e3);if(!(!n||!td(r)||o<=0||o>1e5))return{theme_color:r,brightness:(i===`lighter`?o:-o)/1e5}}let ad=`A colour is one of the theme's (${ju.join(`, `)}) or the colour map's (${qu.join(`, `)}), one of them lighter or darker by a share over 0 up to 100% ("accent1 lighter 40%", "dk1 darker 25%"), #RRGGBB, or one of them with DrawingML's transforms in order ("accent1 lumMod 75% lumOff 25%", "#4472C4 alpha 50%", "accent2 hueOff 30°": ${Yu.join(`, `)}).`,od=fc([k(Ju),E().regex(Qu,ad),E().regex(ed,ad),E().regex($u,ad)]).refine(e=>id(e)!==void 0,ad),sd=/* @__PURE__ */ `alphaLcParenBoth.alphaUcParenBoth.alphaLcParenR.alphaUcParenR.alphaLcPeriod.alphaUcPeriod.arabicParenBoth.arabicParenR.arabicPeriod.arabicPlain.romanLcParenBoth.romanUcParenBoth.romanLcParenR.romanUcParenR.romanLcPeriod.romanUcPeriod.circleNumDbPlain.circleNumWdBlackPlain.circleNumWdWhitePlain.arabicDbPeriod.arabicDbPlain.ea1ChsPeriod.ea1ChsPlain.ea1ChtPeriod.ea1ChtPlain.ea1JpnChsDbPeriod.ea1JpnKorPlain.ea1JpnKorPeriod.arabic1Minus.arabic2Minus.hebrew2Minus.thaiAlphaPeriod.thaiAlphaParenR.thaiAlphaParenBoth.thaiNumPeriod.thaiNumParenR.thaiNumParenBoth.hindiAlphaPeriod.hindiNumPeriod.hindiNumParenR.hindiAlpha1Period`.split(`.`),cd=[`sng`,`dbl`,`heavy`,`dotted`,`dottedHeavy`,`dash`,`dashHeavy`,`dashLong`,`dashLongHeavy`,`dotDash`,`dotDashHeavy`,`dotDotDash`,`dotDotDashHeavy`,`wavy`,`wavyHeavy`,`wavyDbl`,`words`],ld=[`sngStrike`,`dblStrike`],ud=[`all`,`small`,`none`],dd=[`horz`,`vert`,`vert270`,`eaVert`,`wordArtVert`,`wordArtVertRtl`,`mongolianVert`],fd=[`t`,`ctr`,`b`],pd=fc([D().min(0).max(1584),uc({lines:D().min(0).max(100)})]),md=D().min(0).max(4032),hd=fc([D().positive().max(10),O({lines:D().positive().max(10)}),O({points:D().positive().max(1584)})]),gd=O({left:md.optional(),top:md.optional(),right:md.optional(),bottom:md.optional()}),_d=[`none`,`shrink`,`grow`],vd=O({margin_left:md.optional(),indent:D().min(-4032).max(4032).optional(),size:D().positive().max(4e3).optional(),bold:ec().optional(),italic:ec().optional(),color:od.optional(),bullet:fc([Sc(!1),E().min(1).max(2)]).optional(),numbered:k(sd).optional()}),yd=O({paragraph:Qs().min(0),paragraphs:Qs().min(1).optional(),align:k(Mu).optional(),line_spacing:hd.optional(),space_before:pd.optional(),space_after:pd.optional(),bullet:fc([Sc(!1),E().min(1).max(2)]).optional(),numbered:k(sd).optional(),bullet_color:od.optional(),bullet_size:D().min(.25).max(4).optional(),start_at:Qs().min(1).max(32767).optional(),margin_left:md.optional(),indent:D().min(-4032).max(4032).optional()}),bd=O({size:D().positive().max(4e3).optional(),bold:ec().optional(),italic:ec().optional(),underline:fc([ec(),k(cd)]).optional(),strike:fc([ec(),k(ld)]).optional(),caps:k(ud).optional(),spacing:D().min(-100).max(100).optional(),color:od.optional(),font:E().min(1).optional(),align:k(Mu).optional(),line_spacing:hd.optional(),space_before:pd.optional(),space_after:pd.optional(),anchor:k(fd).optional(),orientation:k(dd).optional(),bullet:fc([Sc(!1),E().min(1).max(2)]).optional(),numbered:k(sd).optional(),bullet_color:od.optional(),bullet_size:D().min(.25).max(4).optional(),start_at:Qs().min(1).max(32767).optional(),margin:fc([md,gd]).optional(),margin_left:md.optional(),margin_top:md.optional(),margin_right:md.optional(),margin_bottom:md.optional(),autofit:k(_d).optional(),wrap:ec().optional(),columns:Qs().min(1).max(16).optional(),column_spacing:md.optional(),levels:cc(vd).max(9).optional(),paragraphs:cc(yd).optional()}),xd=O({left:D().lt(1).optional(),top:D().lt(1).optional(),right:D().lt(1).optional(),bottom:D().lt(1).optional()}).refine(e=>(e.left??0)+(e.right??0)<1,{message:`left and right together cut the whole picture away`}).refine(e=>(e.top??0)+(e.bottom??0)<1,{message:`top and bottom together cut the whole picture away`}),Sd=Wc(()=>fc([E(),D(),ec(),nc(),cc(Sd),vc(E(),Sd)])),Cd=[`waterfall`,`box-whisker`,`histogram`,`pareto`,`treemap`,`sunburst`,`funnel`],wd=[`dumbbell`,`slope`,`bullet`],Td=[`column-clustered`,`column-stacked`,`column-stacked-100`,`bar-clustered`,`bar-stacked`,`bar-stacked-100`,`line`,`line-markers`,`area`,`area-stacked`,`area-stacked-100`,`pie`,`doughnut`,`radar`,`radar-markers`,`radar-filled`,`bubble`,`stock-hlc`,`stock-ohlc`,...Cd,...wd,`scatter`,`scatter-lines`,`scatter-smooth`],Ed=[`exclusive`,`inclusive`],Dd=[`bottom`,`top`,`left`,`right`],Od=[`column-clustered`,`column-stacked`,`column-stacked-100`,`line`,`line-markers`,`area`,`area-stacked`,`area-stacked-100`],kd=[`circle`,`square`,`diamond`,`triangle`,`x`,`star`,`plus`,`dash`,`dot`,`none`],Ad=fc([ec(),O({value:ec().optional(),percentage:ec().optional(),category:ec().optional(),series:ec().optional(),format:E().min(1).optional(),position:k([`outEnd`,`inEnd`,`ctr`,`inBase`,`t`,`b`,`l`,`r`,`bestFit`]).optional(),size:D().positive().optional(),color:od.optional(),bold:ec().optional(),first:ec().optional(),last:ec().optional()})]),jd=[`nextTo`,`low`,`high`,`none`],Md=[`none`,`in`,`out`,`cross`],Nd=O({min:D().optional(),max:D().optional(),major:D().positive().optional(),gridlines:ec().optional(),visible:ec().optional(),format:E().min(1).optional(),reverse:ec().optional(),gridline_color:od.optional(),line_color:od.optional(),labels:k(jd).optional(),tick_marks:k(Md).optional(),minor_tick_marks:k(Md).optional(),crosses:k([`autoZero`,`min`,`max`]).optional(),crosses_at:D().optional(),log_base:D().min(2).max(1e3).optional(),units:k([`hundreds`,`thousands`,`tenThousands`,`hundredThousands`,`millions`,`tenMillions`,`hundredMillions`,`billions`,`trillions`]).optional(),units_label:ec().optional(),minor:D().positive().optional(),minor_gridlines:ec().optional(),label_angle:D().min(-90).max(90).optional(),label_every:Qs().min(1).max(31999).optional()}),Pd=O({type:k(Td),data:E().min(1).optional(),categories:fc([E().min(1),cc(fc([E(),cc(E()).min(1)]))]).optional(),series:cc(fc([E().min(1),O({name:E().min(1),values:cc(D().nullable()).optional(),x:cc(D().nullable()).optional(),sizes:cc(D().nullable()).optional(),size:E().min(1).optional(),color:od.optional(),format:E().min(1).optional(),smooth:ec().optional(),line_width:D().min(0).optional(),marker_size:D().int().min(2).max(72).optional(),type:k(Od).optional(),secondary:ec().optional(),labels:Ad.optional(),line_dash:k(zu).optional(),marker:k(kd).optional(),transparency:D().min(0).max(1).optional(),fill:Sc(`none`).optional(),points:vc(E(),O({color:od})).optional()})])).min(1),legend:k([...Dd,`none`]).optional(),labels:Ad.optional(),gap_width:D().min(0).max(500).optional(),overlap:D().min(-100).max(100).optional(),vary_by_categories:ec().optional(),category_colors:cc(od).min(1).optional(),hole_size:D().min(10).max(90).optional(),totals:cc(E().min(1)).min(1).optional(),connector_lines:ec().optional(),quartiles:k(Ed).optional(),mean_markers:ec().optional(),mean_line:ec().optional(),outliers:ec().optional(),inner_points:ec().optional(),bin_count:Qs().min(1).max(1e3).optional(),bin_width:D().positive().optional(),overflow:D().optional(),underflow:D().optional(),interval_closed:k([`right`,`left`]).optional(),high_low_lines:ec().optional(),secondary_gap_width:D().min(0).max(500).optional(),orientation:k([`horizontal`,`vertical`]).optional(),parent_labels:k([`banner`,`overlapping`,`none`]).optional(),value_axis:Nd.optional(),category_axis:Nd.optional(),secondary_axis:Nd.optional(),size:D().positive().optional(),title_size:D().positive().optional(),color:od.optional()}),Fd=D().min(0).max(1),Id=O({angle:D().min(0).max(360).optional(),path:k([`circle`,`rect`,`shape`]).optional(),focus:O({left:D().optional(),top:D().optional(),right:D().optional(),bottom:D().optional()}).optional(),stops:cc(O({at:Fd,color:od,transparency:Fd.optional()})).min(2).max(10)}),Ld=O({preset:k(/* @__PURE__ */ `pct5.pct10.pct20.pct25.pct30.pct40.pct50.pct60.pct70.pct75.pct80.pct90.horz.vert.ltHorz.ltVert.dkHorz.dkVert.narHorz.narVert.dashHorz.dashVert.cross.dnDiag.upDiag.ltDnDiag.ltUpDiag.dkDnDiag.dkUpDiag.wdDnDiag.wdUpDiag.dashDnDiag.dashUpDiag.diagCross.smCheck.lgCheck.smGrid.lgGrid.dotGrid.smConfetti.lgConfetti.horzBrick.diagBrick.solidDmnd.openDmnd.dotDmnd.plaid.sphere.weave.divot.shingle.wave.trellis.zigZag`.split(`.`)),fg:od.optional(),bg:od.optional()}),Rd=O({path:E().min(1),tile:O({scale_x:D().positive().max(100).optional(),scale_y:D().positive().max(100).optional(),x:D().optional(),y:D().optional(),align:k([`tl`,`t`,`tr`,`l`,`ctr`,`r`,`bl`,`b`,`br`]).optional()}).optional(),transparency:Fd.optional()}),zd=fc([k([`grayscale`,`sepia`,`washout`,`black_white`]),O({duotone:gc([od,od])}),O({black_white:Fd})]),Bd=O({fill:od.optional(),gradient:Id.optional(),pattern:Ld.optional(),picture:E().min(1).optional(),picture_fill:Rd.optional()}).refine(e=>[e.fill,e.gradient,e.pattern,e.picture,e.picture_fill].filter(e=>e!==void 0).length===1,{message:`A background is a fill, a gradient, a pattern or a picture (picture or picture_fill): one of them.`}),Vd=O({color:od.optional(),blur:D().min(0).max(100).optional(),distance:D().min(0).max(200).optional(),angle:D().min(0).max(360).optional(),transparency:Fd.optional()}),Hd=O({color:od.optional(),blur:D().min(0).max(100).optional(),distance:D().min(0).max(200).optional(),angle:D().min(0).max(360).optional(),transparency:Fd.optional()}),Ud=O({color:od.optional(),size:D().min(0).max(150).optional(),transparency:Fd.optional()}),Wd=O({transparency:Fd.optional(),size:Fd.optional(),distance:D().min(0).max(100).optional(),blur:D().min(0).max(100).optional()}),Gd=fc([O({shape:E().min(1),site:Qs().min(0)}),Sc(`none`)]),Kd=uc({row:Qs().min(0),column:Qs().min(0),rows:Qs().min(1).optional(),columns:Qs().min(1).optional()});function qd(e,t,n,r){let i=e.rows??1,a=e.columns??1;if(i*a<2)return`A merge takes two cells or more.`;if(e.row+i>t||e.column+a>n)return`A merge from row ${String(e.row)}, column ${String(e.column)} goes past the table's ${String(t)} rows and ${String(n)} columns.`;for(let t=e.row;t<e.row+i;t++)for(let n=e.column;n<e.column+a;n++){let e=`${String(t)},${String(n)}`;if(r.has(e))return`Two merges take the cell at row ${String(t)}, column ${String(n)}.`;r.add(e)}}let Jd=fc([od,Sc(`none`),O({color:fc([od,Sc(`none`)]),width:D().min(0).max(1584).optional()})]),Yd=O({fill:fc([od,Sc(`none`)]).optional(),text:bd.optional(),line:fc([od,Sc(`none`)]).optional(),line_width:D().min(0).max(1584).optional(),borders:O({left:Jd.optional(),right:Jd.optional(),top:Jd.optional(),bottom:Jd.optional()}).optional()});function Xd(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e,n=t.columns??t.fields??t.headers;if(Array.isArray(n)&&n.some(e=>typeof e==`string`||typeof e==`object`&&!!e&&(`name`in e||`title`in e||`tag`in e)))return!0;let r=t.rows;return Array.isArray(r)&&r.some(e=>Array.isArray(e)||typeof e==`object`&&!!e&&!(`height`in e))}let Zd=(e,t,n)=>{Xd(e)!==n&&t.addIssue({code:`invalid_type`,expected:`object`,input:e,message:`not this form of a table`})},Qd=(e,t)=>{if(Zd(e,t,!0),Xd(e))for(let n of gu(`table`,e,{wordsElsewhere:!0}).problems)t.addIssue({code:`custom`,path:n.path,message:n.message})},$d=fc([D().positive(),Yd.extend({width:D().positive()})]),ef=Yd.extend({row:Qs().min(0),column:Qs().min(0),rows:Qs().min(1).optional(),columns:Qs().min(1).optional()}),tf=O({start:k([`auto`,`on-click`]).optional(),trim:O({start:D().min(0).optional(),end:D().positive().optional()}).refine(e=>e.start===void 0||e.end===void 0||e.end>e.start,{message:`A trim ends after it starts.`}).optional(),loop:ec().optional(),volume:D().min(0).max(1).optional(),fullscreen:ec().optional(),hide:ec().optional()}),nf=O({columns:cc($d).min(1),rows:cc(O({height:D().positive(),fill:fc([od,Sc(`none`)]).optional(),text:bd.optional(),line:od.optional(),line_width:D().min(0).max(1584).optional(),borders:Yd.shape.borders})).min(1),merged:cc(Kd).optional(),cells:cc(ef).optional(),data:E().min(1).optional(),fields:cc(E().min(1)).min(1).optional(),head:ec().optional(),style:E().min(1).optional(),first_row:ec().optional(),last_row:ec().optional(),first_col:ec().optional(),last_col:ec().optional(),horz_banding:ec().optional(),vert_banding:ec().optional()}).superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;e.data===void 0&&(e.fields!==void 0||e.head!==void 0)&&t.addIssue({code:`custom`,path:[e.fields===void 0?`head`:`fields`],message:`fields and head say how a table shows its data: give it data.`}),(e.cells??[]).forEach((n,r)=>{(n.row+(n.rows??1)>e.rows.length||n.column+(n.columns??1)>e.columns.length)&&t.addIssue({code:`custom`,path:[`cells`,r],message:`Cells from row ${String(n.row)}, column ${String(n.column)} go past the table's ${String(e.rows.length)} rows and ${String(e.columns.length)} columns.`})}),(e.merged??[]).forEach((r,i)=>{let a=qd(r,e.rows.length,e.columns.length,n);a!==void 0&&t.addIssue({code:`custom`,path:[`merged`,i],message:a})})}),rf=O({frame:Ku.optional(),rotation:D().min(0).lt(360).optional(),flip_h:Sc(!0).optional(),flip_v:Sc(!0).optional(),connect:O({begin:Gd.optional(),end:Gd.optional()}).optional(),z:Qs().optional(),fill:fc([od,Sc(`none`)]).optional(),fill_transparency:Fd.optional(),gradient:Id.optional(),pattern:Ld.optional(),picture_fill:Rd.optional(),shadow:Vd.optional(),inner_shadow:Hd.optional(),glow:Ud.optional(),soft_edges:D().positive().max(100).optional(),reflection:Wd.optional(),line:fc([od,Sc(`none`)]).optional(),line_width:D().positive().max(1584).optional(),line_dash:k(zu).optional(),line_cap:k(Bu).optional(),line_join:k(Vu).optional(),line_compound:k(Hu).optional(),line_begin:k(Uu).optional(),line_end:k(Uu).optional(),line_begin_size:Gu.optional(),line_end_size:Gu.optional(),text:bd.optional(),textbox:Sc(!0).optional(),picture:E().min(1).optional(),crop:xd.optional(),fit:k([`fill`,`fit`]).optional(),brightness:D().min(-1).max(1).optional(),contrast:D().min(-1).max(1).optional(),recolor:zd.optional(),transparency:Fd.optional(),movie:E().min(1).optional(),audio:E().min(1).optional(),item:E().min(1).optional(),poster:D().min(0).optional(),playback:tf.optional(),geometry:k(Nu).optional(),adjustments:cc(D()).max(8).optional(),path:O({w:D().positive(),h:D().positive(),d:E().min(1)}).optional(),table:fc([nf,ic().superRefine(Qd).pipe(Kc())]).optional(),chart:Pd.optional(),stat:yu(`stat`).optional(),stats:yu(`stats`).optional(),card:yu(`card`).optional(),tag:yu(`tag`).optional(),callout:yu(`callout`).optional(),icon:yu(`icon`).optional(),progress:yu(`progress`).optional(),timeline:yu(`timeline`).optional(),steps:yu(`steps`).optional(),person:yu(`person`).optional(),people:yu(`people`).optional(),risk_matrix:yu(`risk_matrix`).optional(),sankey:yu(`sankey`).optional(),gantt:yu(`gantt`).optional(),org_chart:yu(`org_chart`).optional(),issue_tree:yu(`issue_tree`).optional(),decision_tree:yu(`decision_tree`).optional(),fishbone:yu(`fishbone`).optional(),matrix:yu(`matrix`).optional(),marimekko:yu(`marimekko`).optional(),heatmap:yu(`heatmap`).optional(),small_multiples:yu(`small_multiples`).optional(),link:E().trim().min(1).optional(),group:E().regex(/^[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)*$/u,`A group is a name of letters, digits, _ and -; a group in a group is outer/inner.`).optional(),locked:Sc(!0).optional(),decorative:Sc(!0).optional(),component:fc([Au,E().regex(/^[^#\s]+\.[cm]?[jt]sx?(?:#[A-Za-z_$][\w$]*)?$/u,`A component is a name the deck's module registers, or a module's path and export: ../ui.ts#Dialog.`)]).optional(),props:vc(E(),Sd).optional(),dur:D().positive().optional()}),af=[`textbox`,`picture`,`movie`,`audio`,`geometry`,`path`,`table`,`chart`,`component`,`item`,...vu],of=O({type:k([`fade`,`push`,`wipe`,`split`,`reveal`,`cut`,`cover`,`uncover`,`zoom`,`morph`]),direction:k(Ru).optional(),through_black:Sc(!0).optional(),duration:D().min(0).optional()}),sf=O({shape:E().min(1),paragraph:Qs().min(0).optional(),effect:k(Pu),direction:k(Ru).optional(),amount:D().positive().max(36e3).optional(),start:k(Lu).optional(),duration:D().min(0).optional(),delay:D().min(0).optional(),path:E().min(1).optional(),animate_text:k(Fu).optional(),text_delay:D().min(0).max(100).optional(),repeat:fc([D().min(1).max(1e4),k(Iu)]).optional(),rewind:Sc(!0).optional()});O({slides:cc(O({id:Au,layout:E().min(1).optional(),generate:Au.optional(),hidden:fc([Sc(!0),cc(E())]).optional(),shapes:vc(E().min(1),rf).optional(),animations:cc(sf).optional(),transition:of.optional(),advance_after:D().min(0).max(86400).optional(),background:Bd.optional(),section:E().trim().min(1).max(255).optional()})).default([])}).superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;e.slides.forEach((e,r)=>{n.has(e.id)&&t.addIssue({code:`custom`,path:[`slides`,r,`id`],message:`Two slides are "${e.id}".`}),n.add(e.id),(e.layout===void 0?0:1)+(e.generate===void 0?0:1)!=1&&t.addIssue({code:`custom`,path:[`slides`,r],message:`Slide ${e.id} has a layout or a generator: one of them.`}),e.hidden!==void 0&&e.generate===void 0&&e.hidden!==!0&&t.addIssue({code:`custom`,path:[`slides`,r,`hidden`],message:`Slide ${e.id} is hidden (true); a list of ids is a generated block's.`});for(let[n,i]of Object.entries(e.shapes??{})){let a=af.filter(e=>i[e]!==void 0&&(e!==`geometry`||i.picture===void 0));a.length>1&&t.addIssue({code:`custom`,path:[`slides`,r,`shapes`,n],message:`Shape ${n} is one kind of shape, not ${a.join(` and `)}.`});let o=n.includes(`/`)?n.split(`/`):[n];(!(o.length<=2&&o.every(e=>wu.test(e)))||o.length===2&&e.generate===void 0)&&t.addIssue({code:`custom`,path:[`slides`,r,`shapes`,n],message:`A shape's name is letters, digits, _ and -; <slide>/<shape> only in a generated block.`})}})});let cf=[`blue`,`sage`,`sand`,`rose`,`slate`,`moss`,`plum`,`ember`,`mist`,`clay`,`office`],lf={dk1:`#000000`,lt1:`#FFFFFF`,dk2:`#44546A`,lt2:`#E7E6E6`,accent1:`#4472C4`,accent2:`#ED7D31`,accent3:`#A5A5A5`,accent4:`#FFC000`,accent5:`#5B9BD5`,accent6:`#70AD47`,hlink:`#0563C1`,folHlink:`#954F72`};function uf(e,t,n,r){let[i,a,o,s,c,l]=r;return{name:e,colors:{dk1:`#151515`,lt1:`#FFFFFF`,dk2:n,lt2:t,accent1:i,accent2:a,accent3:o,accent4:s,accent5:c,accent6:l,hlink:lf.hlink,folHlink:lf.folHlink}}}let df=`#A39E96`,ff={blue:uf(`blue`,`#DEE5F7`,`#212B5C`,[`#4257B8`,`#D29A32`,`#C2603F`,`#2F8487`,`#7A5BA6`,df]),sage:uf(`sage`,`#D7EDE2`,`#1F4532`,[`#3E8A63`,`#D29A32`,`#3E5BA9`,`#C2603F`,`#2F8487`,df]),sand:uf(`sand`,`#EDE8DE`,`#463B28`,[`#8C7550`,`#3E5BA9`,`#C2603F`,`#2F8487`,`#7A5BA6`,df]),rose:uf(`rose`,`#F0E4E1`,`#4D302B`,[`#9A5F55`,`#D29A32`,`#3E5BA9`,`#2F8487`,`#7A5BA6`,df]),slate:uf(`slate`,`#DDE3E8`,`#283D40`,[`#4F7A80`,`#D29A32`,`#3E5BA9`,`#C2603F`,`#7A5BA6`,df]),moss:uf(`moss`,`#DDE8D8`,`#253D1F`,[`#4A7A3E`,`#D29A32`,`#3E5BA9`,`#C2603F`,`#2F8487`,df]),plum:uf(`plum`,`#E8DDEF`,`#3A284D`,[`#74509A`,`#D29A32`,`#3E5BA9`,`#C2603F`,`#2F8487`,df]),ember:uf(`ember`,`#F0E4D8`,`#543118`,[`#A8622F`,`#3E5BA9`,`#2F8487`,`#7A5BA6`,`#3F8A63`,df]),mist:uf(`mist`,`#E2E8E8`,`#274141`,[`#4E8282`,`#D29A32`,`#3E5BA9`,`#C2603F`,`#7A5BA6`,df]),clay:uf(`clay`,`#EDE4DC`,`#473020`,[`#8E6040`,`#D29A32`,`#3E5BA9`,`#2F8487`,`#7A5BA6`,df])};function pf(e){let t=e.toLowerCase();return t===`office`?lf:ff[t]?.colors}fc([k(cf),O({name:k(cf).optional(),colors:yc(k(ju),E().regex(/^#[0-9A-Fa-f]{6}$/u,`A colour is #RRGGBB.`)).optional()})]);function mf(e,t=lf){if(e===void 0)return t;let n=typeof e==`string`?e:e.name,r=n===void 0?t:pf(n)??t,i=typeof e==`string`?void 0:e.colors;if(!i)return r;let a={...r};for(let[e,t]of Object.entries(i))a[e]=t.toUpperCase();return a}function hf(e,t,n){if(e.startsWith(`#`))return e;let r=/^(\w+)(?: (lighter|darker) ([\d.]+)%)?$/u.exec(e),i=r?t[r[1]]:void 0;if(!r||i===void 0)return e;if(r[2]===void 0)return i;let a=Number(r[3])/100;return n(i,r[2]===`lighter`?a:-a)}let gf=new Map([[`ctr`,`center`,`centre`,`middle`,`mid`,`centered`,`centred`],[`t`,`top`],[`b`,`bottom`],[`l`,`left`],[`r`,`right`],[`just`,`justify`,`justified`],[`out`,`outside`,`outer`],[`in`,`inside`,`inner`]].flatMap(e=>e.map(t=>[t,e[0]])));function _f(e){return e.replace(/([a-z0-9])([A-Z])/gu,`$1 $2`).toLowerCase().split(/[\s_\-.]+/u).filter(e=>e!==``).map(e=>gf.get(e)??e).join(``)}function vf(e,t){for(let n of[_f(e),_f(`${e} clustered`)]){let e=t.filter(e=>typeof e==`string`&&_f(e)===n);if(e.length===1)return e[0]}}function yf(e,t){let n=Array.from({length:e.length+1},(e,n)=>Array.from({length:t.length+1},(e,t)=>n===0?t:t===0?n:0)),r=(e,t)=>n[e]?.[t]??0;for(let i=1;i<=e.length;i++)for(let a=1;a<=t.length;a++){let o=e[i-1]===t[a-1]?0:1,s=Math.min(r(i-1,a)+1,r(i,a-1)+1,r(i-1,a-1)+o);i>1&&a>1&&e[i-1]===t[a-2]&&e[i-2]===t[a-1]&&(s=Math.min(s,r(i-2,a-2)+1));let c=n[i];c&&(c[a]=s)}return r(e.length,t.length)}function bf(e,t){let n=e.toLowerCase(),r;for(let i of t){if(typeof i!=`string`)continue;let t=Math.min(yf(n,i.toLowerCase()),yf(_f(e),_f(i)));(r===void 0||t<r.d)&&(r={value:i,d:t})}return r&&r.d<=Math.max(1,Math.floor(n.length/3))?r.value:void 0}let xf=[`Normal`,`Title`,`Heading 1`,`Heading 2`,`Heading 3`,`Heading 4`,`Good`,`Bad`,`Neutral`,`Input`,`Output`,`Calculation`,`Check Cell`,`Linked Cell`,`Note`,`Warning Text`,`Explanatory Text`,`Total`,`Hyperlink`,`Followed Hyperlink`,...[1,2,3,4,5,6].flatMap(e=>[`Accent${String(e)}`,`20% - Accent${String(e)}`,`40% - Accent${String(e)}`,`60% - Accent${String(e)}`]),`Comma`,`Comma [0]`,`Currency`,`Currency [0]`,`Percent`],Sf={"Headline 1":`Heading 1`,"Headline 2":`Heading 2`,"Headline 3":`Heading 3`,"Headline 4":`Heading 4`},Cf=[...xf,...Object.keys(Sf)];({...Object.fromEntries([1,2,3,4,5,6].flatMap(e=>{let t=29+(e-1)*4;return[[`Accent${String(e)}`,t],[`20% - Accent${String(e)}`,t+1],[`40% - Accent${String(e)}`,t+2],[`60% - Accent${String(e)}`,t+3]]}))});function wf(e,t=`,`){let n=e.startsWith(``),r=[],i=[],a=0,o=0,s=+!!n,c=1,l=e.length;for(;s<l;){let n=s,u=c,d=[],f=``,p=!1,m=!1,h=!1;for(;s<l;){let i=e.charAt(s);if(p){if(i===`"`){if(e.charAt(s+1)===`"`){f+=`"`,s+=2;continue}p=!1,s+=1;continue}i===`
|
|
116
|
+
`&&(c+=1),f+=i,s+=1}else if(i===`"`&&f===``&&!m)p=!0,m=!0,s+=1;else if(i===t)d.push(f),f=``,m=!1,s+=1;else{if(i===`\r`||i===`
|
|
117
|
+
`){let t=s;i===`\r`&&e.charAt(s+1)===`
|
|
118
|
+
`?(a+=1,s+=2):(i===`
|
|
119
|
+
`&&(o+=1),s+=1),c+=1,d.push(f),r.push({fields:d,start:n,end:t,line:u}),h=!0;break}f+=i,s+=1}}h||(p&&i.push({line:u,message:`a quoted field is never closed: a " is missing`}),d.push(f),r.push({fields:d,start:n,end:l,line:u}))}let u=e.charAt(l-1);return{source:e,records:r,dialect:{delimiter:t,newline:a>o?`\r
|
|
120
|
+
`:`
|
|
121
|
+
`,bom:n,finalNewline:l>+!!n&&(u===`
|
|
122
|
+
`||u===`\r`)},problems:i}}let Tf=Object.freeze({1078:`af`,1052:`sq`,1118:`am`,5121:`ar-DZ`,15361:`ar-BH`,3073:`ar-EG`,2049:`ar-IQ`,11265:`ar-JO`,13313:`ar-KW`,12289:`ar-LB`,4097:`ar-LY`,6145:`ar-MA`,8193:`ar-OM`,16385:`ar-QA`,1025:`ar-SA`,10241:`ar-SY`,7169:`ar-TN`,14337:`ar-AE`,9217:`ar-YE`,1067:`hy`,1101:`as`,2092:`az-AZ`,1068:`az-AZ`,1069:`eu`,1059:`be`,2117:`bn`,1093:`bn-IN`,5146:`bs`,1026:`bg`,1109:`my`,1027:`ca`,2052:`zh-CN`,3076:`zh-HK`,5124:`zh-MO`,4100:`zh-SG`,1028:`zh-TW`,1050:`hr`,1029:`cs`,1030:`da`,1125:`dv`,2067:`nl-BE`,1043:`nl-NL`,1126:`bin`,3081:`en-AU`,10249:`en-BZ`,4105:`en-CA`,9225:`en-CB`,2057:`en-GB`,16393:`en-IN`,6153:`en-IE`,8201:`en-JM`,5129:`en-NZ`,13321:`en-PH`,7177:`en-ZA`,11273:`en-TT`,1033:`en-US`,12297:`en-ZW`,1061:`et`,1071:`mk`,1080:`fo`,1065:`fa`,1124:`fil`,1035:`fi`,2060:`fr-BE`,11276:`fr-CM`,3084:`fr-CA`,9228:`fr-CG`,12300:`fr-CI`,1036:`fr-FR`,5132:`fr-LU`,13324:`fr-ML`,6156:`fr-MC`,14348:`fr-MA`,10252:`fr-SN`,4108:`fr-CH`,7180:`fr`,1122:`fy-NL`,2108:`gd-IE`,1084:`gd`,1110:`gl`,1079:`ka`,3079:`de-AT`,1031:`de-DE`,5127:`de-LI`,4103:`de-LU`,2055:`de-CH`,1032:`el`,1140:`gn`,1095:`gu`,1279:`en`,1037:`he`,1081:`hi`,1038:`hu`,1039:`is`,1136:`ig-NG`,1057:`id`,1040:`it-IT`,2064:`it-CH`,1041:`ja`,1099:`kn`,1120:`ks`,1087:`kk`,1107:`km`,1111:`kok`,1042:`ko`,1088:`ky`,1108:`lo`,1142:`la`,1062:`lv`,1063:`lt`,2110:`ms-BN`,1086:`ms-MY`,1100:`ml`,1082:`mt`,1112:`mni`,1153:`mi`,1102:`mr`,1104:`mn`,2128:`mn`,1121:`ne`,1044:`no-NO`,2068:`no-NO`,1096:`or`,1045:`pl`,1046:`pt-BR`,2070:`pt-PT`,1094:`pa`,1047:`rm`,2072:`ro-MO`,1048:`ro-RO`,1049:`ru`,2073:`ru-MO`,1083:`se`,1103:`sa`,3098:`sr-SP`,2074:`sr-SP`,1072:`st`,1074:`tn`,1113:`sd`,1115:`si`,1051:`sk`,1060:`sl`,1143:`so`,1070:`sb`,11274:`es-AR`,16394:`es-BO`,13322:`es-CL`,9226:`es-CO`,5130:`es-CR`,7178:`es-DO`,12298:`es-EC`,17418:`es-SV`,4106:`es-GT`,18442:`es-HN`,2058:`es-MX`,19466:`es-NI`,6154:`es-PA`,15370:`es-PY`,10250:`es-PE`,20490:`es-PR`,1034:`es-ES`,14346:`es-UY`,8202:`es-VE`,1089:`sw`,2077:`sv-FI`,1053:`sv-SE`,1114:`syc`,1064:`tg`,1097:`ta`,1092:`tt`,1098:`te`,1054:`th`,1105:`bo`,1073:`ts`,1055:`tr`,1090:`tk`,1058:`uk`,1056:`ur`,2115:`uz-UZ`,1091:`uz-UZ`,1075:`ve`,1066:`vi`,1106:`cy`,1076:`xh`,1085:`yi`,1077:`zu`}),Ef=`GENERAL`,Df=`GROUP`,Of=`SCALE`,kf=`TEXT`,Af=`MINUS`,jf=`POINT`,Mf=`ERROR`,Nf=`COLOR`,Pf=`STRING`,Ff=`CHAR`,If=`CURRENCY`,Lf=/* @__PURE__ */ `¤.$.£.¥.֏.؋.৳.฿.៛.₡.₦.₩.₪.₫.€.₭.₮.₱.₲.₴.₸.₹.₺.₼.₽.₾.₿`.split(`.`),A=(e,t=``)=>e.replaceAll(`~`,t).split(`;`),j=(e,t=``)=>A(e,t),M=(e,t=``)=>A(e,t),Rf=(e,t=0,n=0)=>(e.mmm||=t<1?e.mmmm.concat():e.mmmm.map(e=>{let n=e.slice(0,t%10);return n+(t<10||e===n?``:`.`)}),e.ddd||=n<1?e.dddd.concat():e.dddd.map(e=>{let t=e.slice(0,n%10);return t+(n<10||e===t?``:`.`)}),!e.mmm6&&e.mmmm6&&(e.mmm6=e.mmmm6),e),N=e=>({minus:!e.p,sign:!!e.s,dateOrder:e.o??1,currencyPos:e.f??3,padMm:e.m==null||!!e.m,padDd:e.d==null||!!e.d,padHh:e.h==null||!!e.h,padHhAlt:!!e.i,dateSep:e.k??`/`,shortDateSep:e.l??`-`,timeSep:e.b??`:`,shortYear:!!e.y,spacePercent:!!e.c}),zf=`Black`,Bf=`White`,Vf=`Green`,Hf=`Blue`,Uf=`Yellow`,Wf=`Magenta`,Gf=`Cyan`,Kf={k:`.`,l:`.`},qf={d:0,h:0,m:0,k:`.`,l:`.`},Jf={d:1,y:1,f:0,o:1,k:`-`,b:`:`,s:1},Yf={...Jf,y:0},Xf={h:0,d:0,f:0,m:0,s:1};function Zf(){let e=M(`一月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月`),t={黑色:zf,白色:Bf,紅色:`Red`,綠色:Vf,藍色:Hf,黃色:Uf,洋紅:Wf,青色:Gf};P({group:`,`,ampm:A(`上午;下午`),mmmm:e,mmm:M(`1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月`),dddd:j(`~日;~一;~二;~三;~四;~五;~六`,`星期`),ddd:j(`周日;周一;周二;周三;周四;周五;周六`),color:`颜色`,colors:{黑色:zf,白色:Bf,红色:`Red`,绿色:Vf,蓝色:Hf,黄色:Uf,洋红:Wf,蓝绿色:Gf},general:`G/通用格式`,currency:`¥`,format:N({h:0,d:0,f:0,m:0,o:2,s:1}),sysdate:`yyyy年m月d日`,systime:`h:mm:ss`},`zh-CN`),P({group:`,`,ampm:A(`上午;下午`),mmmm:e,mmm:e,dddd:j(`~日;~一;~二;~三;~四;~五;~六`,`星期`),ddd:j(`週日;週一;週二;週三;週四;週五;週六`),nan:`非數值`,color:`色彩`,colors:t,general:`G/通用格式`,currency:`NT$`,format:N({d:0,f:0,o:2,m:0,i:1}),sysdate:`yyyy年m月d日`,systime:`AM/PM hh:mm:ss`},`zh-TW`),P({group:`,`,ampm:A(`上午;下午`),mmmm:e,mmm:e,dddd:j(`~日;~一;~二;~三;~四;~五;~六`,`星期`),ddd:j(`週日;週一;週二;週三;週四;週五;週六`),color:`色彩`,colors:t,currency:`HK$`,format:N({h:0,d:0,f:0,m:0,p:1}),sysdate:`yyyy年m月d日`,systime:`h:mm:ss`},`zh-HK`),P({group:`,`,mmmm:M(`1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月`),mmm:M(`1;2;3;4;5;6;7;8;9;10;11;12`),dddd:j(`日曜日;月曜日;火曜日;水曜日;木曜日;金曜日;土曜日`),ddd:j(`日;月;火;水;木;金;土`),ampm:A(`午前;午後`),general:`G/標準`,currency:`¥`,color:`色`,colors:{黒:zf,白:Bf,赤:`Red`,緑:Vf,青:Hf,黄:Uf,紫:Wf,水:Gf},format:N({h:0,f:0,o:2,d:1}),sysdate:`yyyy年m月d日`,systime:`h:mm:ss`},`ja`),P({group:`,`,ampm:A(`오전;오후`),mmmm:M(`1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월`),mmm:M(`1;2;3;4;5;6;7;8;9;10;11;12`),dddd:j(`일요일;월요일;화요일;수요일;목요일;금요일;토요일`),ddd:j(`일;월;화;수;목;금;토`),color:`색`,colors:{검정:zf,흰색:Bf,빨강:`Red`,녹색:Vf,파랑:Hf,노랑:Uf,자홍:Wf,녹청:Gf},general:`G/표준`,currency:`₩`,format:N({h:0,f:0,o:2,k:`-`}),sysdate:`yyyy년 mmmm d일 dddd`,systime:`AM/PM h:mm:ss`},`ko`),P({group:`,`,mmmm:M(`มกร~;กุมภาพันธ์;มีน~;เมษายน;พฤษภ~;มิถุนายน;กรกฎ~;สิงห~;กันยายน;ตุล~;พฤศจิกายน;ธันว~`,`าคม`),mmm:M(`ม.ค.;ก.พ.;มี.ค.;เม.ย.;พ.ค.;มิ.ย.;ก.ค.;ส.ค.;ก.ย.;ต.ค.;พ.ย.;ธ.ค.`),dddd:j(`อาทิตย์;จันทร์;อังคาร;พุธ;พฤหัสบดี;ศุกร์;เสาร์`),ddd:j(`อา.;จ.;อ.;พ.;พฤ.;ศ.;ส.`),color:`สี`,colors:{ดำ:zf,ขาว:Bf,แดง:`Red`,เขียว:Vf,น้ำเงิน:Hf,เหลือง:Uf,ม่วงมาเจนต้า:Wf,ฟ้า:Gf},currency:`฿`,format:N({h:0,d:0,f:0,m:0,o:1}),sysdate:`d mmmm yyyy`,systime:`h:mm:ss`},`th`),P(Rf({decimal:`,`,ampm:A(`dop.;odp.`),mmmm:M(`leden;únor;březen;duben;květen;červen;červenec;srpen;září;říjen;listopad;prosinec`),mmm:M(`I;II;III;IV;V;VI;VII;VIII;IX;X;XI;XII`),dddd:j(`neděle;pondělí;úterý;středa;čtvrtek;pátek;sobota`),bool:A(`PRAVDA;NEPRAVDA`),color:`Barva`,colors:{černá:zf,bílá:Bf,červená:`Red`,zelená:Vf,modrá:Hf,žlutá:Uf,purpurová:Wf,azurová:Gf},general:`Všeobecný`,opcodes:{dy:`r`},currency:`Kč`,format:N({h:0,k:`.`,l:`.`}),sysdate:`dddd d. mmmm yyyy`,systime:`h:mm:ss`},-1,2),`cs`),P(Rf({group:`.`,decimal:`,`,mmmm:M(`januar;februar;marts;april;maj;juni;juli;august;september;oktober;november;december`),dddd:j(`søn~;man~;tirs~;ons~;tors~;fre~;lør~`,`dag`),bool:A(`SAND;FALSK`),color:`Farve`,colors:{sort:zf,hvid:Bf,rød:`Red`,lysegrøn:Vf,blå:Hf,gul:Uf,lyslilla:Wf,akvamarin:Gf},general:`Standard`,opcodes:{dy:`å`,th:`t`},currency:`kr.`,format:N({k:`-`}),sysdate:`d. mmmm yyyy`,systime:`hh:mm:ss`},3,2),`da`),P(Rf({group:`.`,decimal:`,`,mmmm:M(`januari;februari;maart;april;mei;juni;juli;augustus;september;oktober;november;december`),mmm:M(`jan;feb;mrt;apr;mei;jun;jul;aug;sep;okt;nov;dec`),dddd:j(`zondag;maandag;dinsdag;woensdag;donderdag;vrijdag;zaterdag`),bool:A(`WAAR;ONWAAR`),color:`Kleur`,colors:{zwart:zf,wit:Bf,rood:`Red`,root:`Red`,groen:Vf,blauw:Hf,geel:Uf,magenta:Wf,cyaan:Gf},general:`Standaard`,opcodes:{dy:`j`,th:`u`},currency:`€`,format:N({d:0,f:2,m:0,k:`-`,s:1}),sysdate:`dddd d mmmm yyyy`,systime:`hh:mm:ss`},-1,2),`nl`),P({group:`,`,format:N({h:0,d:0,f:0,m:0,o:0,p:1}),sysdate:`dddd, mmmm d, yyyy`,systime:`h:mm:ss AM/PM`},`en`),P({group:`,`,format:N({h:0,d:0,f:0,m:0,o:0,p:1}),sysdate:`dddd, mmmm d, yyyy`,systime:`h:mm:ss AM/PM`},`en-US`),P({group:`,`,format:N({h:0,f:0,o:2,p:0,k:`-`}),sysdate:`mmmm d, yyyy`,systime:`h:mm:ss AM/PM`},`en-CA`),P({group:`,`,color:`Colour`,ampm:[`AM`,`PM`],format:N({h:0,d:0,f:0,p:0}),sysdate:`dddd, d mmmm yyyy`,systime:`h:mm:ss AM/PM`},`en-AU`),P({group:`,`,color:`Colour`,ampm:[`AM`,`PM`],currency:`£`,format:N({f:0,p:0}),sysdate:`dd mmmm yyyy`,systime:`hh:mm:ss`},`en-GB`),P({group:`,`,mmm:M(`Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sept;Oct;Nov;Dec`),color:`Colour`,ampm:[`am`,`pm`],currency:`€`,format:N({f:0,p:0}),sysdate:`dddd d mmmm yyyy`,systime:`hh:mm:ss`},`en-IE`),P(Rf({decimal:`,`,nan:`epäluku`,ampm:A(`ap.;ip.`),mmmm:M(`tammi~;helmi~;maalis~;huhti~;touko~;kesä~;heinä~;elo~;syys~;loka~;marras~;joulu~`,`kuu`),mmm:M(`tammi;helmi;maalis;huhti;touko;kesä;heinä;elo;syys;loka;marras;joulu`),dddd:j(`sunnun~;maanan~;tiis~;keskiviikko;tors~;perjan~;lauan~`,`tai`),bool:A(`TOSI;EPÄTOSI`),color:`Väri`,colors:{musta:zf,valkoinen:Bf,punainen:`Red`,vihreä:Vf,sininen:Hf,keltainen:Uf,magenta:Wf,syaani:Gf},general:`Yleinen`,currency:`€`,opcodes:{dy:`v`,dm:`k`,dd:`p`,th:`t`},format:N({h:0,d:0,p:0,k:`.`,l:`.`,m:0,c:1}),sysdate:`dddd d. mmmm yyyy`,systime:`h.mm.ss`},-1,2),`fi`);let n=Rf({group:` `,decimal:`,`,mmmm:M(`janvier;février;mars;avril;mai;juin;juillet;août;septembre;octobre;novembre;décembre`),mmm:M(`janv;févr;mars;avr;mai;juin;juil;août;sept;oct;nov;déc`),dddd:j(`~manche;lun~;mar~;mercre~;jeu~;vendre~;same~`,`di`),ddd:[`dim`,`lun`,`mar`,`mer`,`jeu`,`ven`,`sam`],bool:A(`VRAI;FAUX`),color:`Couleur`,colors:{noir:zf,blanc:Bf,rouge:`Red`,vert:Vf,bleu:Hf,jaune:Uf,magenta:Wf,cyan:Gf},opcodes:{dy:`a`,dd:`j`,wd:`o`},general:`Standard`,systime:`hh:mm:ss`},-1,-13);P({...n,currency:`€`,format:N({}),sysdate:`dddd d mmmm yyyy`},`fr`),P({...n,ampm:A(`AM;PM`),format:N({p:1,o:2,d:1,k:`-`,l:`-`,s:1}),sysdate:`d mmmm yyyy`},`fr-CA`),P({group:`'`,decimal:`.`,...n,currency:`CHF`,format:N({o:1,d:1,k:`.`,l:`.`}),sysdate:`dddd, d mmmm yyyy`},`fr-CH`);let r=Rf({mmmm:M(`Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember`),mmm:M(`Jan;Feb;Mrz;Apr;Mai;Jun;Jul;Aug;Sep;Okt;Nov;Dez`),dddd:j(`Sonn~;Mon~;Diens~;Mittwoch;Donners~;Frei~;Sams~`,`tag`),bool:A(`WAHR;FALSCH`),color:`Farbe`,colors:{schwarz:zf,weiß:Bf,rot:`Red`,grün:Vf,blau:Hf,gelb:Uf,magenta:Wf,zyan:Gf},opcodes:{dy:`j`,dd:`t`},general:`Standard`,sysdate:`dddd, d. mmmm yyyy`,systime:`hh:mm:ss`},-1,2);P({group:`.`,decimal:`,`,...r,currency:`€`,format:N({k:`.`,l:`. `})},`de`),P({group:`’`,decimal:`.`,...r,currency:`CHF`,mmm:M(`Jan;Feb;Mär;Apr;Mai;Jun;Jul;Aug;Sep;Okt;Nov;Dez`),format:N({o:1,d:1,k:`.`,f:2,s:1,l:`. `})},`de-CH`),P(Rf({group:`.`,decimal:`,`,ampm:A(`πμ;μμ`),mmmm:M(`Ιανουαρ~;Φεβρουαρ~;Μαρτ~;Απριλ~;Μαΐου;Ιουν~;Ιουλ~;Αυγούστου;Σεπτεμβρ~;Οκτωβρ~;Νοεμβρ~;Δεκεμβρ~`,`ίου`),mmm:M(`Ιαν;Φεβ;Μαρ;Απρ;Μαϊ;Ιουν;Ιουλ;Αυγ;Σεπ;Οκτ;Νοε;Δεκ`),dddd:j(`Κυριακή;Δευτέρα;Τρίτη;Τετάρτη;Πέμπτη;Παρασκευή;Σάββατο`),ddd:[`Κυρ`,`Δευ`,`Τρι`,`Τετ`,`Πεμ`,`Παρ`,`Σαβ`],colors:{μαύρο:zf,λευκό:Bf,κόκκινο:`Red`,πράσινο:Vf,μπλε:Hf,κίτρινο:Uf,ματζέντα:Wf,γαλάζιο:Gf},general:`Γενικός τύπος`,color:`Χρώμα`,opcodes:{dy:`ε`,dm:`μ`,dd:`η`,th:`ω`,tm:`λ`,ts:`δ`},currency:`€`,format:N({h:0,d:0,m:0}),sysdate:`dddd, d mmmm yyyy`,systime:`h:mm:ss AM/PM`},-1,3),`el`),P({decimal:`,`,ampm:A(`de.;du.`),mmmm:M(`január;február;március;április;május;június;július;augusztus;szeptember;október;november;december`),mmm:M(`jan;febr;márc;ápr;máj;jún;júl;aug;szept;okt;nov;dec`),dddd:j(`vasárnap;hétfő;kedd;szerda;csütörtök;péntek;szombat`),ddd:j(`V;H;K;Sze;Cs;P;Szo`),bool:A(`IGAZ;HAMIS`),currency:`Ft`,general:`Normál`,opcodes:{dy:`é`,dm:`h`,dd:`n`,th:`ó`,tm:`p`,ts:`m`},colors:{fekete:zf,fehér:Bf,piros:`Red`,zöld:Vf,kék:Hf,sárga:Uf,bíbor:Wf,ciánkék:Gf},color:`Szín`,format:N({h:0,o:2,k:`.`,l:`.`,d:1}),sysdate:`yyyy. mmmm d".", dddd`,systime:`h:mm:ss`},`hu`),P(Rf({group:`.`,decimal:`,`,ampm:A(`f.h.;e.h.`),mmmm:M(`janúar;febrúar;mars;apríl;maí;júní;júlí;ágúst;september;október;nóvember;desember`),dddd:j(`sunnu~;mánu~;þriðju~;miðviku~;fimmtu~;föstu~;laugar~`,`dagur`),currency:`kr.`,format:N({d:0,m:0,k:`.`,l:`.`}),sysdate:`dddd, d. mmmm yyyy`,systime:`hh:mm:ss`},3,3),`is`),P(Rf({group:`.`,decimal:`,`,ampm:A(`AM;PM`),mmmm:M(`Januari;Februari;Maret;April;Mei;Juni;Juli;Agustus;September;Oktober;November;Desember`),dddd:j(`Minggu;Senin;Selasa;Rabu;Kamis;Jumat;Sabtu`),ddd:j(`Mgg;Sen;Sel;Rab;Kam;Jum;Sab`),color:`Warna`,colors:{hitam:zf,putih:Bf,merah:`Red`,hijau:Vf,biru:Hf,kuning:Uf,magenta:Wf,sian:Gf},currency:`Rp`,format:N({f:0,b:`.`}),sysdate:`dddd, dd mmmm yyyy`,systime:`hh.mm.ss`},3,3),`id`);let i=Rf({mmmm:M(`gennaio;febbraio;marzo;aprile;maggio;giugno;luglio;agosto;settembre;ottobre;novembre;dicembre`),dddd:j(`domenica;lunedì;martedì;mercoledì;giovedì;venerdì;sabato`),bool:A(`VERO;FALSO`),general:`Standard`,color:`Colore`,colors:{nero:zf,bianco:Bf,rosso:`Red`,verde:Vf,blu:Hf,giallo:Uf,fucsia:Wf,celeste:Gf,ciano:Gf},opcodes:{dy:`a`,dd:`g`,wd:`o`,en:`x`},systime:`hh:mm:ss`},3,3);P({group:`.`,decimal:`,`,...i,currency:`€`,format:N({}),sysdate:`dddd d mmmm yyyy`},`it`),P({group:`’`,decimal:`.`,...i,currency:`CHF`,format:N({o:1,d:1,k:`.`,l:`.`,f:2,s:1}),sysdate:`dddd, d mmmm yyyy`},`it-CH`);let a={decimal:`,`,ampm:A(`a.m.;p.m.`),mmmm:M(`januar;februar;mars;april;mai;juni;juli;august;september;oktober;november;desember`),mmm:M(`jan;feb;mar;apr;mai;jun;jul;aug;sep;okt;nov;des`),dddd:j(`søn~;man~;tirs~;ons~;tors~;fre~;lør~`,`dag`),bool:A(`SANN;USANN`),color:`Farge`,colors:{svart:zf,hvit:Bf,rød:`Red`,grønn:Vf,blå:Hf,gul:Uf,magenta:Wf,cyan:Gf},general:`Standard`,opcodes:{dy:`å`,th:`t`},currency:`kr`,sysdate:`dddd d. mmmm yyyy`,systime:`hh:mm:ss`};P(Rf({...a,format:N({f:2,c:1,k:`.`,l:`.`,s:1})},-1,3),`nb`),P(Rf({...a,format:N({f:2,c:1,k:`.`,l:`.`,s:1})},-1,3),`no`),P(Rf({decimal:`,`,mmmm:M(`styczeń;luty;marzec;kwiecień;maj;czerwiec;lipiec;sierpień;wrzesień;październik;listopad;grudzień`),dddd:j(`niedziela;poniedziałek;wtorek;środa;czwartek;piątek;sobota`),ddd:j(`niedz;pon;wt;śr;czw;pt;sob`),bool:A(`PRAWDA;FAŁSZ`),color:`Kolor`,colors:{czarny:zf,biały:Bf,czerwony:`Red`,zielony:Vf,niebieski:Hf,żółty:Uf,amarantowy:Wf,błękitny:Gf},general:`Standardowy`,opcodes:{dy:`r`,th:`g`},currency:`zł`,format:N({d:0,k:`.`,l:`.`}),sysdate:`dddd, d mmmm yyyy`,systime:`hh:mm:ss`},3,-1),`pl`);let o={decimal:`,`,mmmm:M(`janeiro;fevereiro;março;abril;maio;junho;julho;agosto;setembro;outubro;novembro;dezembro`),dddd:j(`domingo;segunda-feira;terça-feira;quarta-feira;quinta-feira;sexta-feira;sábado`),bool:A(`VERDADEIRO;FALSO`),opcodes:{dy:`a`,wd:`o`},color:`Cor`};P({...Rf(o,3,3),group:` `,general:`Estandar`,colors:{preto:zf,branco:Bf,vermelho:`Red`,verde:Vf,azul:Hf,amarelo:Uf,magenta:Wf,turquesa:Gf,ciano:Gf},currency:`€`,format:N({l:`/`}),sysdate:`d "de" mmmm "de" yyyy`,systime:`hh:mm:ss`},`pt`),P({...Rf(o,3,3),group:`.`,general:`Geral`,colors:{preto:zf,branco:Bf,vermelho:`Red`,verde:Vf,azul:Hf,amarelo:Uf,magenta:Wf,ciano:Gf},currency:`R$`,format:N({f:2,l:`/`}),sysdate:`dddd, d "de" mmmm "de" yyyy`,systime:`hh:mm:ss`},`pt-BR`),P({decimal:`,`,nan:`не\xA0число`,mmmm:M(`Январь;Февраль;Март;Апрель;Май;Июнь;Июль;Август;Сентябрь;Октябрь;Ноябрь;Декабрь`),mmm:M(`янв;фев;мар;апр;май;июн;июл;авг;сен;окт;ноя;дек`),dddd:j(`воскресенье;понедельник;вторник;среда;четверг;пятница;суббота`),ddd:j(`Вс;Пн;Вт;Ср;Чт;Пт;Сб`),mmmm6:M(`рамадан;шавваль;зуль-каада;зуль-хиджжа;мухаррам;раби-уль-авваль;раби-уль-ахир;джумад-уль-авваль;джумад-уль-ахир;раджаб;шаабан;рамадан`),mmm6:M(`рам.;шав.;зуль-к.;зуль-х.;мух.;раб. I;раб. II;джум. I;джум. II;радж.;шааб.;рам.`),bool:A(`ИСТИНА;ЛОЖЬ`),general:`Основной`,opcodes:{dy:`г`,dm:`м`,dd:`д`,th:`ч`,tm:`м`,ts:`с`},color:`Цвет`,colors:{черный:zf,белый:Bf,красный:`Red`,зеленый:Vf,синий:Hf,желтый:Uf,фиолетовый:Wf,пурпурный:Wf,голубой:Gf},currency:`₽`,format:N({h:0,k:`.`,l:`.`}),sysdate:`d mmmm yyyy "г."`,systime:`h:mm:ss`},`ru`),P(Rf({decimal:`,`,mmmm:M(`január;február;marec;apríl;máj;jún;júl;august;september;október;november;december`),mmm:M(`1;2;3;4;5;6;7;8;9;10;11;12`),dddd:j(`nedeľa;pondelok;utorok;streda;štvrtok;piatok;sobota`),color:`Farba`,colors:{čierna:zf,biela:Bf,červená:`Red`,zelená:Vf,modrá:Hf,žltá:Uf,purpurová:Wf,azúrová:Gf},currency:`€`,format:N(qf),sysdate:`dddd d. mmmm yyyy`,systime:`h:mm:ss`},3,2),`sk`);let s={group:`.`,decimal:`,`,ampm:A(`a.\xA0m.;p.\xA0m.`),mmmm:M(`enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiem~;octu~;noviem~;diciem~`,`bre`),mmm:M(`ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic`),dddd:j(`domingo;lunes;martes;miércoles;jueves;viernes;sábado`),ddd:j(`dom;lun;mar;mié;jue;vie;sáb`),bool:A(`VERDADERO;FALSO`),colors:{negro:zf,blanco:Bf,rojo:`Red`,verde:Vf,azul:Hf,amarillo:Uf,magenta:Wf,cian:Gf,ciano:Gf},systime:`h:mm:ss`,sysdate:`dddd, d "de" mmmm "de" yyyy`},c=M(`ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic`),l=M(`ene;feb;mar;abr;may;jun;jul;ago;sept;oct;nov;dic`);P({...s,ampm:A(`AM;PM`),ddd:j(`do;lu;ma;mi;ju;vi;sá`),general:`Estándar`,opcodes:{dy:`a`,wd:`o`},currency:`€`,format:N({h:0,d:1})},`es`),P({...s,mmm:l,format:N({d:0,f:2,m:0}),systime:`hh:mm:ss`},`es-AR`),P({...s,mmm:l,currency:`Bs`,format:N({d:0,f:0,m:0}),systime:`hh:mm:ss`},`es-BO`),P({...s,mmm:l,format:N({h:0,f:0,s:1,k:`-`})},`es-CL`),P({...s,mmm:c,format:N({h:0,d:0,f:2}),systime:`h:mm:ss AM/PM`},`es-CO`),P({...s,mmm:l,format:N(Xf)},`es-EC`),P({...s,mmm:l,currency:`₲`,format:N({d:0,f:2,s:1,m:0}),systime:`hh:mm:ss`},`es-PY`),P({...s,group:`,`,decimal:`.`,mmm:c,ampm:A(`a. m.;p. m.`),opcodes:{dy:`a`,wd:`o`},general:`Estándar`,format:N({f:0,i:1}),systime:`hh:mm:ss AM/PM`},`es-MX`),P({...s,mmmm:M(`Enero;Febrero;Marzo;Abril;Mayo;Junio;Julio;Agosto;Setiembre;Octubre;Noviembre;Diciembre`),mmm:M(`Ene;Feb;Mar;Abr;May;Jun;Jul;Ago;set;Oct;Nov;Dic`),format:N({d:0,f:2,h:0,m:0})},`es-UY`),P({...s,mmm:l,currency:`Bs.S`,format:N(Xf),systime:`h:mm:ss AM/PM`},`es-VE`),P(Rf({decimal:`,`,ampm:A(`fm;em`),mmmm:M(`januari;februari;mars;april;maj;juni;juli;augusti;september;oktober;november;december`),dddd:j(`sön~;mån~;tis~;ons~;tors~;fre~;lör~`,`dag`),opcodes:{dy:`å`,th:`t`},bool:[`SANT`,`FALSKT`],general:`Standard`,color:`Färg`,colors:{svart:zf,vit:Bf,röd:`Red`,grön:Vf,blå:Hf,gul:Uf,magenta:Wf,cyanblå:Gf},currency:`kr`,format:N({o:2,k:`-`}),sysdate:`"den" d mmmm yyyy`,systime:`hh:mm:ss`},3,3),`sv`),P(Rf({group:`.`,decimal:`,`,ampm:A(`ÖÖ;ÖS`),mmmm:M(`Ocak;Şubat;Mart;Nisan;Mayıs;Haziran;Temmuz;Ağustos;Eylül;Ekim;Kasım;Aralık`),mmm:M(`Oca;Şub;Mar;Nis;May;Haz;Tem;Ağu;Eyl;Eki;Kas;Ara`),dddd:j(`Pazar;Pazartesi;Salı;Çarşamba;Perşembe;Cuma;Cumartesi`),ddd:j(`Paz;Pzt;Sal;Çar;Per;Cum;Cmt`),bool:A(`DOĞRU;YANLIŞ`),color:`Renk`,colors:{siyah:zf,beyaz:Bf,kırmızı:`Red`,yeşil:Vf,mavi:Hf,sarı:Uf,pembe:Wf,camgöbeği:Gf},opcodes:{dm:`a`,dd:`g`,th:`s`,tm:`d`,ts:`n`},general:`Genel`,currency:`₺`,format:N({d:0,f:0,k:`.`,l:`.`}),sysdate:`d mmmm yyyy dddd`,systime:`hh:mm:ss`},3,-1),`tr`),P({group:`,`,ampm:A(`AM;PM`),mmmm:M(`Ionawr;Chwefror;Mawrth;Ebrill;Mai;Mehefin;Gorffennaf;Awst;Medi;Hydref;Tachwedd;Rhagfyr`),mmm:M(`Ion;Chwef;Maw;Ebr;Mai;Meh;Gorff;Awst;Medi;Hyd;Tach;Rhag`),dddd:j(`Dydd Sul;Dydd Llun;Dydd Mawrth;Dydd Mercher;Dydd Iau;Dydd Gwener;Dydd Sadwrn`),ddd:j(`Sul;Llun;Maw;Mer;Iau;Gwe;Sad`),currency:`£`,format:N({f:0,p:0}),sysdate:`dddd, d mmmm yyyy`,systime:`hh:mm:ss`},`cy`),P({group:`.`,decimal:`,`,mmmm:M(`yanvar;fevral;mart;aprel;may;iyun;iyul;avqust;sentyabr;oktyabr;noyabr;dekabr`),mmm:M(`yan;fev;mar;apr;may;iyn;iyl;avq;sen;okt;noy;dek`),dddd:j(`bazar;bazar ertəsi;çərşənbə axşamı;çərşənbə;cümə axşamı;cümə;şənbə`),ddd:j(`B;B.E;Ç.A;Ç;C.A;C;Ş`),currency:`₼`,format:N(Kf),sysdate:`d mmmm yyyy, dddd`,systime:`hh:mm:ss`},`az`),P(Rf({decimal:`,`,mmmm:M(`студзень;люты;сакавік;красавік;май;чэрвень;ліпень;жнівень;верасень;кастрычнік;лістапад;снежань`),mmm:M(`студз;лют;сак;крас;май;чэрв;ліп;жн;вер;кастр;ліст;снеж`),dddd:j(`нядзеля;панядзелак;аўторак;серада;чацвер;пятніца;субота`),ddd:j(`нд;пн;аўт;ср;чц;пт;сб`),currency:`Br`,format:N({y:1,k:`.`,l:`.`}),sysdate:`d mmmm yyyy`,systime:`hh:mm:ss`},3,-1),`be`),P({decimal:`,`,mmmm:M(`януари;февруари;март;април;май;юни;юли;август;септември;октомври;ноември;декември`),mmm:M(`яну;фев;мар;апр;май;юни;юли;авг;сеп;окт;ное;дек`),dddd:j(`неделя;понеделник;вторник;сряда;четвъртък;петък;събота`),ddd:j(`нед;пон;вт;ср;четв;пет;съб`),currency:`лв.`,format:N(qf),sysdate:`dd mmmm yyyy "г."`,systime:`h:mm:ss`},`bg`),P({group:`.`,decimal:`,`,mmmm:M(`gener;febrer;març;abril;maig;juny;juliol;agost;setembre;octubre;novembre;desembre`),mmm:M(`gen;febr;març;abr;maig;juny;jul;ag;set;oct;nov;des`),dddd:j(`diumenge;dilluns;dimarts;dimecres;dijous;divendres;dissabte`),ddd:j(`dg;dl;dt;dc;dj;dv;ds`),general:`Estándar`,opcodes:{dy:`a`,wd:`o`},ampm:A(`a.\xA0m.;p.\xA0m.`),currency:`€`,format:N({d:0,o:1,h:0,m:0}),sysdate:`dddd, d mmmm "de" yyyy`,systime:`h:mm:ss`},`ca`),P(Rf({group:`,`,decimal:`.`,mmmm:M(`Enero;Pebrero;Marso;Abril;Mayo;Hunyo;Hulyo;Agosto;Setyembre;Oktubre;Nobyembre;Disyembre`),dddd:j(`Linggo;Lunes;Martes;Miyerkules;Huwebes;Biyernes;Sabado`),currency:`₱`,format:N({h:0,d:0,f:0,m:0,o:0}),sysdate:`dddd, mmmm d, yyyy`,systime:`h:mm:ss AM/PM`},3,3),`fil`),P({group:`,`,decimal:`.`,ampm:[`પૂર્વ\xA0મધ્યાહ્ન`,`ઉત્તર\xA0મધ્યાહ્ન`],mmmm:M(`જાન્યુઆરી;ફેબ્રુઆરી;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટેમ્બર;ઑક્ટોબર;નવેમ્બર;ડિસેમ્બર`),mmm:M(`જાન્યુ;ફેબ્રુ;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગ;સપ્ટે;ઑક્ટો;નવે;ડિસે`),dddd:j(`રવિ~;સોમ~;મંગળ~;બુધ~;ગુરુ~;શુક્ર~;શનિ~`,`વાર`),ddd:j(`રવિ;સોમ;મંગળ;બુધ;ગુરુ;શુક્ર;શનિ`),currency:`₹`,format:N(Jf),sysdate:`dd mmmm yyyy`,systime:`hh:mm:ss`},`gu`),P({group:`,`,decimal:`.`,ampm:A(`לפ׳;אח׳`),dddd:[`יום\xA0ראשון`,`יום\xA0שני`,`יום\xA0שלישי`,`יום\xA0רביעי`,`יום\xA0חמישי`,`יום\xA0שישי`,`שבת`],ddd:[`יום\xA0א`,`יום\xA0ב`,`יום\xA0ג`,`יום\xA0ד`,`יום\xA0ה`,`יום\xA0ו`,`שבת`],mmmm:M(`ינואר;פברואר;מרץ;אפריל;מאי;יוני;יולי;אוגוסט;ספטמבר;אוקטובר;נובמבר;דצמבר`),mmm:M(`ינו;פבר;מרץ;אפר;מאי;יונ;יול;אוג;ספט;אוק;נוב;דצמ`),mmmm6:M(`רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע אל־אוול;רביע א־ת׳אני;ג׳ומאדא אל־אולא;ג׳ומאדא א־ת׳אניה;רג׳ב;שעבאן;רמדאן`),mmm6:M(`רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע א׳;רביע ב׳;ג׳ומאדא א׳;ג׳ומאדא ב׳;רג׳ב;שעבאן;רמדאן`),color:`צבע`,colors:{שחור:zf,לבן:Bf,אדום:`Red`,ירוק:Vf,כחול:Hf,צהוב:Uf,"אדום ארגמן":Wf,תכלת:Gf},currency:`₪`,format:N({f:2,s:1}),sysdate:`dddd dd mmmm yyyy`,systime:`hh:mm:ss`},`he`),P(Rf({group:`.`,decimal:`,`,mmmm:M(`siječanj;veljača;ožujak;travanj;svibanj;lipanj;srpanj;kolovoz;rujan;listopad;studeni;prosinac`),mmm:M(`sij;vlj;ožu;tra;svi;lip;srp;kol;ruj;lis;stu;pro`),dddd:j(`nedjelja;ponedjeljak;utorak;srijeda;četvrtak;petak;subota`),currency:`€`,format:N(qf),sysdate:`d. mmmm yyyy.`,systime:`h:mm:ss`},-1,3),`hr`),P({decimal:`,`,mmmm:M(`Հունվար;Փետրվար;Մարտ;Ապրիլ;Մայիս;Հունիս;Հուլիս;Օգոստոս;Սեպտեմբեր;Հոկտեմբեր;Նոյեմբեր;Դեկտեմբեր`),mmm:M(`Հնվ;Փտվ;Մրտ;Ապր;Մյս;Հնս;Հլս;Օգս;Սպտ;Հկտ;Նյմ;Դկտ`),dddd:j(`Կիրակի;Երկուշաբթի;Երեքշաբթի;Չորեքշաբթի;Հինգշաբթի;Ուրբաթ;Շաբաթ`),ddd:j(`Կիր;Երկ;Երք;Չրք;Հնգ;Ուր;Շբթ`),currency:`֏`,format:N(Kf),sysdate:`d mmmm, yyyy`,systime:`hh:mm:ss`},`hy`),P(Rf({decimal:`,`,mmmm:M(`იანვარი;თებერვალი;მარტი;აპრილი;მაისი;ივნისი;ივლისი;აგვისტო;სექტემბერი;ოქტომბერი;ნოემბერი;დეკემბერი`),dddd:j(`კვირა;ორშაბათი;სამშაბათი;ოთხშაბათი;ხუთშაბათი;პარასკევი;შაბათი`),ddd:j(`კვ;ორშ;სამშ;ოთხშ;ხუთშ;პარ;შაბ`),currency:`₾`,format:N(Kf),sysdate:`dddd, dd mmmm, yyyy`,systime:`hh:mm:ss`},3,-1),`ka`),P(Rf({decimal:`,`,mmmm:M(`Қаңтар;Ақпан;Наурыз;Сәуір;Мамыр;Маусым;Шілде;Тамыз;Қыркүйек;Қазан;Қараша;Желтоқсан`),mmm:M(`қаң;ақп;нау;сәу;мам;мау;шіл;там;қыр;қаз;қар;жел`),dddd:j(`жексенбі;дүйсенбі;сейсенбі;сәрсенбі;бейсенбі;жұма;сенбі`),ddd:j(`жек;дүй;сей;сәр;бей;жұм;сен`),opcodes:{dy:`г`,dm:`м`,dd:`д`,th:`ч`,tm:`м`,ts:`с`},currency:`₸`,general:`Основной`,format:N(Kf),sysdate:`yyyy ж. d mmmm, dddd`,systime:`hh:mm:ss`},-1,-1),`kk`),P({group:`,`,mmmm:M(`ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಏಪ್ರಿಲ್;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟಂಬರ್;ಅಕ್ಟೋಬರ್;ನವೆಂಬರ್;ಡಿಸೆಂಬರ್`),mmm:M(`ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಎಪ್ರಿಲ್;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟಂಬರ್;ಅಕ್ಟೋಬರ್;ನವೆಂಬರ್;ಡಿಸೆಂಬರ್`),dddd:j(`ಭಾನು~;ಸೋಮ~;ಮಂಗಳ~;ಬುಧ~;ಗುರು~;ಶುಕ್ರ~;ಶನಿ~`,`ವಾರ`),ddd:j(`ಭಾನು;ಸೋಮ;ಮಂಗಳ;ಬುಧ;ಗುರು;ಶುಕ್ರ;ಶನಿ`),ampm:A(`ಪೂರ್ವಾಹ್ನ;ಅಪರಾಹ್ನ`),currency:`₹`,format:N(Jf),sysdate:`dd mmmm yyyy`,systime:`hh:mm:ss`},`kn`),P({decimal:`,`,mmmm:M(`sausis;vasaris;kovas;balandis;gegužė;birželis;liepa;rugpjūtis;rugsėjis;spalis;lapkritis;gruodis`),mmm:M(`saus;vas;kov;bal;geg;birž;liep;rugp;rugs;spal;lapkr;gruod`),dddd:j(`sekmadienis;pirmadienis;antradienis;trečiadienis;ketvirtadienis;penktadienis;šeštadienis`),ddd:j(`sk;pr;an;tr;kt;pn;št`),ampm:A(`priešpiet;popiet`),currency:`€`,format:N({o:2,k:`-`}),sysdate:`yyyy "m." mmmm d "d.," dddd`,systime:`hh:mm:ss`},`lt`),P({decimal:`,`,mmmm:M(`janvāris;februāris;marts;aprīlis;maijs;jūnijs;jūlijs;augusts;septembris;oktobris;novembris;decembris`),mmm:M(`janv;febr;marts;apr;maijs;jūn;jūl;aug;sept;okt;nov;dec`),dddd:j(`svētdiena;pirmdiena;otrdiena;trešdiena;ceturtdiena;piektdiena;sestdiena`),ddd:j(`Svētd;Pirmd;Otrd;Trešd;Ceturtd;Piektd;Sestd`),ampm:A(`priekšp.;pēcp.`),currency:`€`,format:N(Kf),sysdate:`dddd, yyyy. "gada" d. mmmm`,systime:`hh:mm:ss`},`lv`),P({group:`,`,decimal:`.`,mmmm:M(`ജനുവരി;ഫെബ്രുവരി;മാര്ച്ച്;ഏപ്രില്;മേയ്;ജൂൺ;ജൂലൈ;ആഗസ്റ്റ്;സെപ്റ്റംബര്;ഒക്ടോബര്;നവംബര്;ഡിസംബര്`),mmm:M(`ജനു;ഫെബ്രു;മാർ;ഏപ്രി;മേയ്;ജൂൺ;ജൂലൈ;ഓഗ;സെപ്റ്റം;ഒക്ടോ;നവം;ഡിസം`),dddd:j(`ഞായറാഴ്ച;തിങ്കളാഴ്ച;ചൊവ്വാഴ്ച;ബുധനാഴ്ച;വ്യാഴാഴ്ച;വെള്ളിയാഴ്ച;ശനിയാഴ്ച`),ddd:j(`ഞായർ;തിങ്കൾ;ചൊവ്വ;ബുധൻ;വ്യാഴം;വെള്ളി;ശനി`),currency:`₹`,format:N({d:0,m:0,h:0,y:0,f:0,o:1,k:`/`,b:`:`,s:0}),sysdate:`yyyy, mmmm d, dddd`,systime:`h:mm:ss AM/PM`},`ml`),P({group:`,`,decimal:`.`,mmmm:M(`Нэгдүгээ~;Хоёрдугаа~;Гуравдугаа~;Дөрөвдүгээ~;Тавдугаа~;Зургаадугаа~;Долоодугаа~;Наймдугаа~;Есдүгээ~;Аравдугаа~;Арван нэгдүгээ~;Арван хоёрдугаар са`,`р сар`),mmm:M(`1~;2~;3~;4~;5~;6~;7~;8~;9~;10~;11~;12~`,`-р сар`),dddd:j(`ням;даваа;мягмар;лхагва;пүрэв;баасан;бямба`),ddd:j(`Ня;Да;Мя;Лха;Пү;Ба;Бя`),ampm:A(`ү.ө.;ү.х.`),currency:`₮`,format:N({o:2,f:2,k:`.`,l:`.`}),sysdate:`yyyy оны mmmmын d, dddd гараг`,systime:`hh:mm:ss`},`mn`),P({group:`,`,decimal:`.`,ampm:[`म.पू.`,`म.नं.`],mmmm:M(`जानेवारी;फेब्रुवारी;मार्च;एप्रिल;मे;जून;जुलै;ऑगस्ट;सप्टेंबर;ऑक्टोबर;नोव्हेंबर;डिसेंबर`),mmm:M(`जाने;फेब्रु;मार्च;एप्रि;मे;जून;जुलै;ऑग;सप्टें;ऑक्टो;नोव्हें;डिसें`),dddd:j(`रविवार;सोमवार;मंगळवार;बुधवार;गुरुवार;शुक्रवार;शनिवार`),ddd:j(`रवि;सोम;मंगळ;बुध;गुरु;शुक्र;शनि`),currency:`₹`,format:N(Yf),sysdate:`dd mmmm yyyy`,systime:`hh:mm:ss`},`mr`),P(Rf({group:`,`,decimal:`.`,mmmm:M(`ဇန်နဝါရီ;ဖေဖော်ဝါရီ;မတ်;ဧပြီ;မေ;ဇွန်;ဇူလိုင်;ဩဂုတ်;စက်တင်ဘာ;အောက်တိုဘာ;နိုဝင်ဘာ;ဒီဇင်ဘာ`),mmm:M(`ဇန်;ဖေ;မတ်;ဧ;မေ;ဇွန်;ဇူ;ဩ;စက်;အောက်;နို;ဒီ`),dddd:j(`တနင်္ဂနွေ;တနင်္လာ;အင်္ဂါ;ဗုဒ္ဓဟူး;ကြာသပတေး;သောကြာ;စနေ`),ampm:A(`နံနက်;ညနေ`),currency:`K`,format:N({h:0,d:0,m:0}),sysdate:`yyyy၊ mmmm d၊ dddd`,systime:`h:mm:ss`},-1,0),`my`),P(Rf({group:`,`,decimal:`.`,mmmm:M(`ਜਨਵਰੀ;ਫ਼ਰਵਰੀ;ਮਾਰਚ;ਅਪ੍ਰੈਲ;ਮਈ;ਜੂਨ;ਜੁਲਾਈ;ਅਗਸਤ;ਸਤੰਬਰ;ਅਕਤੂਬਰ;ਨਵੰਬਰ;ਦਸੰਬਰ`),dddd:j(`ਐਤਵਾਰ;ਸੋਮਵਾਰ;ਮੰਗਲਵਾਰ;ਬੁੱਧਵਾਰ;ਵੀਰਵਾਰ;ਸ਼ੁੱਕਰਵਾਰ;ਸ਼ਨਿੱਚਰਵਾਰ`),ddd:j(`ਐਤ;ਸੋਮ;ਮੰਗਲ;ਬੁੱਧ;ਵੀਰ;ਸ਼ੁਕਰ;ਸ਼ਨਿੱਚਰ`),ampm:[`ਸਵੇਰ`,`ਸ਼ਾਮ`],currency:`₹`,format:N({d:1,i:1,y:1,f:2,o:1,k:`-`,b:`:`,s:1}),sysdate:`dd mmmm yyyy dddd`,systime:`AM/PM hh:mm:ss`}),`pa`),P({group:`.`,decimal:`,`,mmmm:M(`ianuarie;februarie;martie;aprilie;mai;iunie;iulie;august;septem~;octom~;noiem~;decem~`,`brie`),mmm:M(`ian;feb;mar;apr;mai;iun;iul;aug;sept;oct;nov;dec`),dddd:j(`duminică;luni;marți;miercuri;joi;vineri;sâmbătă`),ddd:j(`dum;lun;mar;mie;joi;vin;sâm`),ampm:A(`a.m.;p.m.`),currency:`lei`,format:N(Kf),sysdate:`dddd, d mmmm yyyy`,systime:`hh:mm:ss`},`ro`),P(Rf({group:`.`,decimal:`,`,mmmm:M(`januar;februar;marec;april;maj;junij;julij;avgust;september;oktober;november;december`),dddd:j(`nedelja;ponedeljek;torek;sreda;četrtek;petek;sobota`),ampm:A(`dop.;pop.`),currency:`€`,format:N({d:0,k:`.`,l:`.`}),sysdate:`dddd, d. mmmm yyyy`,systime:`hh:mm:ss`},3,3),`sl`),P(Rf({group:`.`,decimal:`,`,mmmm:M(`januar;februar;mart;april;maj;jun;jul;avgust;septembar;oktobar;novembar;decembar`),dddd:j(`nedelja;ponedeljak;utorak;sreda;četvrtak;petak;subota`),currency:`RSD`,format:N({d:0,m:0,k:`.`,l:`.`}),sysdate:`dddd, d. mmmm yyyy.`,systime:`hh:mm:ss`},3,3),`sr`),P(Rf({group:`,`,decimal:`.`,ampm:[`காலை`,`மாலை`],mmmm:M(`ஜனவரி;பிப்ரவரி;மார்ச்;ஏப்ரல்;மே;ஜூன்;ஜூலை;ஆகஸ்ட்;செப்டம்பர்;அக்டோபர்;நவம்பர்;டிசம்பர்`),dddd:j(`ஞாயிறு;திங்கள்;செவ்வாய்;புதன்;வியாழன்;வெள்ளி;சனி`),currency:`₹`,format:N({d:1,y:0,f:2,o:1,k:`-`,b:`:`,s:1}),sysdate:`dd mmmm yyyy`,systime:`hh:mm:ss`}),`ta`),P({group:`,`,decimal:`.`,mmmm:M(`జనవరి;ఫిబ్రవరి;మార్చి;ఏప్రిల్;మే;జూన్;జులై;ఆగస్టు;సెప్టెంబర్;అక్టోబర్;నవంబర్;డిసెంబర్`),mmm:M(`జన;ఫిబ్ర;మార్చి;ఏప్రి;మే;జూన్;జులై;ఆగ;సెప్టెం;అక్టో;నవం;డిసెం`),dddd:j(`ఆదివారం;సోమవారం;మంగళవారం;బుధవారం;గురువారం;శుక్రవారం;శనివారం`),ddd:j(`ఆది;సోమ;మంగళ;బుధ;గురు;శుక్ర;శని`),currency:`₹`,format:N({d:1,h:0,y:0,f:0,o:1,k:`-`,b:`:`,s:0}),sysdate:`d, mmmm yyyy, dddd`,systime:`h:mm:ss AM/PM`},`te`),P({decimal:`,`,mmmm:M(`січень;лютий;березень;квітень;травень;червень;липень;серпень;вересень;жовтень;листопад;грудень`),mmm:M(`Січ;Лют;Бер;Кві;Тра;Чер;Лип;Сер;Вер;Жов;Лис;Гру`),dddd:j(`неділя;понеділок;вівторок;середа;четвер;п'ятниця;субота`),ddd:j(`Нд;Пн;Вт;Ср;Чт;Пт;Сб`),ampm:A(`дп;пп`),currency:`₴`,format:N({h:0,k:`.`,l:`.`}),sysdate:`d mmmm yyyy "р."`,systime:`h:mm:ss`},`uk`),P({group:`.`,decimal:`,`,mmmm:M(`~Giêng;~Hai;~Ba;~Tư;~Năm;~Sáu;~Bảy;~Tám;~Chín;~Mười;~Mười Một;~Mười Hai`,`Tháng `),mmm:M(`~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12`,`Thg`),dddd:j(`Chủ Nhật;~Hai;~Ba;~Tư;~Năm;~Sáu;~Bảy`,`Thứ `),ddd:j(`CN;T2;T3;T4;T5;T6;T7`),ampm:A(`SA;CH`),currency:`₫`,format:N({h:0,d:1}),sysdate:`dd mmmm yyyy`,systime:`h:mm:ss AM/PM`},`vi`),P(Rf({group:`٬`,decimal:`٫`,ampm:A(`ص;م`),percent:`٪`,mmmm:M(`يناير;فبراير;مارس;أبريل;مايو;يونيو;يوليو;أغسطس;سبتمبر;أكتوبر;نوفمبر;ديسمبر`),dddd:j(`الأحد;الإثنين;الثلاثاء;الأربعاء;الخميس;الجمعة;السبت`),mmmm6:M(`رمضان;شوال;ذو القعدة;ذو الحجة;محرم;ربيع الأول;ربيع الآخرة;جمادى الأولى;جمادى الآخرة;رجب;شعبان;رمضان`),color:`اللون`,colors:{أسود:zf,أبيض:Bf,أحمر:`Red`,أخضر:Vf,أزرق:Hf,أصفر:Uf,ماجنتا:Wf,سماوي:Gf},currency:``,format:N({f:2,i:1,y:1,s:1}),sysdate:`dd/mmmm/yyyy`,systime:`hh:mm:ss AM/PM`},0,0),`ar`),P({group:`,`,decimal:`.`,ampm:[`AM`,`PM`],mmmm:M(`জানুয়ারী;ফেব্রুয়ারী;মার্চ;এপ্রিল;মে;জুন;জুলাই;আগস্ট;সেপ্টেম্বর;অক্টোবর;নভেম্বর;ডিসেম্বর`),mmm:M(`জানু;ফেব্রু;মার্চ;এপ্রিল;মে;জুন;জুলাই;আগ;সেপ্টে;অক্টো;নভে;ডিসে`),dddd:j(`রবিবার;সোমবার;মঙ্গলবার;বুধবার;বৃহস্পতিবার;শুক্রবার;শনিবার`),ddd:j(`রবি.;সোম.;মঙ্গল.;বুধ.;বৃহস্পতি.;শুক্র.;শনি.`),currency:`₹`,format:N({f:2,y:1,k:`-`,b:`.`,s:1}),sysdate:`dd mmmm yyyy`,systime:`hh.mm.ss`},`bn`),P({group:`,`,decimal:`.`,mmmm:M(`जनवरी;फरवरी;मार्च;अप्रैल;मई;जून;जुलाई;अगस्त;सितम्बर;अक्तूबर;नवम्बर;दिसम्बर`),mmm:M(`जनवरी;फरवरी;मार्च;अप्रैल;मई;जून;जुलाई;अगस्त;सितम्बर;अक्तूबर;नवम्बर;दिसम्बर`),dddd:j(`रविवार;सोमवार;मंगलवार;बुधवार;गुरुवार;शुक्रवार;शनिवार`),ddd:j(`रवि.;सोम.;मंगल.;बुध.;गुरु.;शुक्र.;शनि.`),ampm:[`पूर्वाह्न`,`अपराह्न`],currency:`₹`,format:N(Yf),sysdate:`dd mmmm yyyy`,systime:`hh:mm:ss`},`hi`)}let Qf=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),$f=RegExp(`^[`+Qf(Lf.join(``))+`]`);function ep(e){let t=[];t.push([Ef,/^General/i,0]),e.general&&e.general!==`General`&&t.push([Ef,RegExp(`^${Qf(e.general)}`,`i`),0]),e.colors&&t.push([Nf,RegExp(`^\\[(${Object.keys(e.colors).map(Qf).join(`|`)})\\]`,`i`),1]),e.color&&t.push([Nf,RegExp(`^\\[(${Qf(e.color)}\\s*\\d+)\\]`,`i`),1]);let n,r;if(e.opcodes){let t=Qf(e.opcodes.dy??`y`),i=Qf(e.opcodes.dm??`m`),a=Qf(e.opcodes.dd??`d`),o=Qf(e.opcodes.th??`h`),s=Qf(e.opcodes.tm??`m`),c=Qf(e.opcodes.ts??`s`),l=Qf(e.opcodes.wd??`a`),u=Qf(e.opcodes.en??`g`),d=`[${t+t.toUpperCase()}]+|[${i+i.toUpperCase()}]+|[${a+a.toUpperCase()}]+|[${o+o.toUpperCase()}]+|[${s+s.toUpperCase()}]+|[${c+c.toUpperCase()}]+|[${l+l.toUpperCase()}]{3,}|[${u+u.toUpperCase()}]+|[bB]+|e+`;n=RegExp(`^(?:${d})`),r=RegExp(`^(?:\\[(${Qf(o)}+|${Qf(s)}+|${Qf(c)}+)\\]+)`,`i`)}else n=/^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/,r=/^(?:\[(h+|m+|s+)\])/i;return(e.currency.length>1||!Lf.includes(e.currency))&&t.push([If,RegExp(`^(?:${Qf(e.currency)})`),0]),t.push([`HASH`,/^#/,0],[`ZERO`,/^0/,0],[`QMARK`,/^\?/,0],[`SLASH`,/^\//,0],[`BREAK`,/^;/,0],[kf,/^@/,0],[`PLUS`,/^\+/,0],[Af,/^-/,0],[jf,/^\./,0],[`SPACE`,/^ /,0],[`PERCENT`,/^%/,0],[`AMPM`,/^(?:AM\/PM|am\/pm|A\/P)/,0],[If,$f,0],[`DIGIT`,/^[1-9]/,0],[`CALENDAR`,/^(?:B[12])/i,0],[Mf,/^B$/,0],[`DATETIME`,n,0],[`DURATION`,r,1],[`CONDITION`,/^\[((?:<[=>]?|>=?|=)\s*(?:-?[.\d]+))\]/,1],[`DBNUM`,/^\[(DBNum[0-4]?\d)\]/i,1],[`NATNUM`,/^\[(NatNum[0-4]?\d)\]/i,1],[`LOCALE`,/^\[\$([^\]]*)\]/,1],[Nf,/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i,1],[`MODIFIER`,/^\[([^\]])\]/,1],[`ESCAPED`,/^\\(.)/,1],[Pf,/^"([^"]*?)"/,1],[`SKIP`,/^_(\\.|.)/,1],[`EXP`,/^[Ee]([+-])/,1],[`FILL`,/^\*(\\.|.)/,1],[`PAREN`,/^[()]/,0],[Mf,/^[EÈÉÊËèéêëĒēĔĕĖėĘęĚěȄȅȆȇȨȩNnÑñŃńŅņŇňǸǹ["*/\\_]/,0],[Ff,/^./,0]),t}let tp=e=>{let t=(e||`\0`).charCodeAt(0);return t===63||t===35||t>=48&&t<=57};function np(e,t){let n=0,r=[],i=[];for(;n<e.length;){let a=e.slice(n),o=0,s=/^(,+)(.)?/.exec(a);if(s){let t=s[1];o=t.length;let a=e[n-1]||``,c=!1,l=!1;tp(a)?(c=!0,l=!0):a===`.`&&(l=!0);let u=s[2]||``;if(c&&(!u||u===`;`)&&(c=!1),l&&tp(u)&&(l=!1),c&&!l)r.push({type:Df,value:`,`,raw:t});else if(!c&&l)r.push({type:Of,value:`,`,raw:t});else if(c&&l){let e={type:Of,value:`,`,raw:t};r.push(e),i.push(e)}else r.push({type:`COMMA`,value:`,`,raw:t})}else{let e;for(let[n,i,s]of t){let t=i.exec(a);if(t){e={type:n,value:t[s||0],raw:t[0]},r.push(e),o=t[0].length;break}}i.length&&e?.raw===`;`&&(i.length=0),e&&i.length&&tp(e.raw)&&(i.forEach(e=>e.type=Df),i.length=0)}if(!o){let e=a[0];o=1,r.push({type:Ff,value:e,raw:e})}n+=o}return r}function rp(e){return np(e,ep(fp))}let ip=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,ap={},op={group:`\xA0`,decimal:`.`,positive:`+`,negative:`-`,percent:`%`,exponent:`E`,nan:`NaN`,infinity:`∞`,ampm:[`AM`,`PM`],mmmm6:[`Muharram`,`Safar`,`Rabiʻ I`,`Rabiʻ II`,`Jumada I`,`Jumada II`,`Rajab`,`Shaʻban`,`Ramadan`,`Shawwal`,`Dhuʻl-Qiʻdah`,`Dhuʻl-Hijjah`],mmm6:[`Muh.`,`Saf.`,`Rab. I`,`Rab. II`,`Jum. I`,`Jum. II`,`Raj.`,`Sha.`,`Ram.`,`Shaw.`,`Dhuʻl-Q.`,`Dhuʻl-H.`],mmmm:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],mmm:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],dddd:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],ddd:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],bool:[`TRUE`,`FALSE`],general:`General`,currency:`$`,sysdate:`dddd, mmmm d, yyyy`,systime:`h:mm:ss AM/PM`,color:`Color`,colors:{black:`Black`,white:`White`,red:`Red`,green:`Green`,blue:`Blue`,yellow:`Yellow`,magenta:`Magenta`,cyan:`Cyan`},format:{minus:!0,dateOrder:1,currencyPos:2,monthFirst:!0,padMm:!0,padDd:!0,padHh:!0}};function sp(e){let t=ip.exec(e);if(!t)throw SyntaxError(`Invalid locale: ${e}`);return{lang:t[1]+(t[2]?`-`+t[2]:``),language:t[1],territory:t[2]||``}}function cp(e){if(typeof e==`number`)return Tf[e&65535]||void 0;let t=parseInt(e,16);if(isFinite(t)&&Tf[t&65535])return Tf[t&65535]||void 0;if(ip.test(e))return e}function lp(e){let t;if(e){let n=cp(e);if(n){let e=sp(n);t=ap[e.lang]||ap[e.language]||void 0}}return t}function up(e){let t=np(e||``,ep(op)),n=t.findIndex(e=>e.type===`DATETIME`&&/^m/i.test(e.value)),r=t.findIndex(e=>e.type===`DATETIME`&&/^dd?$/i.test(e.value));return n>=0&&r>=0&&n<r}function dp(e){let t=e.sysdate??op.sysdate;return{...op,...e,opcodes:{...op.opcodes,...e.opcodes},format:{...op.format,...e.format,monthFirst:e.format?.monthFirst??up(t)}}}function P(e,t){let n=typeof t==`object`?t:sp(t);return ap[n.lang]=dp(e),n.language!==n.lang&&!ap[n.language]&&(ap[n.language]=dp(e)),ap[n.lang]}Zf();let fp=lp(`en`);if(!fp)throw Error(`numfmt default locale is missing!`);let pp={overflow:`######`,dateErrorThrows:!1,dateErrorNumber:!0,bigintErrorNumber:!1,dateSpanLarge:!0,leap1900:!0,nbsp:!1,throws:!0,invalid:`######`,locale:``,ignoreTimezone:!1,grouping:[3,3],indexColors:!0,skipChar:``,fillChar:``},mp=[];for(let e=0;e<=22;e++)mp[e]=10**e;let hp=134217729;function gp(e){return e>=0&&e<=22?mp[e]:10**e}function _p(e,t){let n=14-t;if(n>=0&&n<=22){let t=mp[n],r=e*t,i=hp*e,a=i-(i-e),o=e-a;i=hp*t;let s=i-(i-t),c=t-s,l=a*s-r+a*c+o*s+o*c,u=Math.floor(r);return r-u-.5>-l?u+1:u}if(n<0&&n>=-22){let t=mp[-n],r=e%t,i=Math.round((e-r)/t);return r>t/2?i+1:i}return NaN}function vp(e){let t=e.indexOf(`e`),n=+e.slice(t+1),r=e.charAt(0)+e.slice(2,t);if(r.length<=15)return[+r*mp[15-r.length],n];let i=+r.slice(0,15),a=r.charCodeAt(15);return(a>53||a===53&&/[1-9]/.test(r.slice(16)))&&i++,i>=0x38d7ea4c68000?[i/10,n+1]:[i,n]}function yp(e){if(e<22250738585072014e-324)return vp(e.toExponential());let t=Math.floor(Math.log10(e));e<gp(t)?t--:e>=gp(t+1)&&t++;let n=_p(e,t);return n>=0x38d7ea4c68000?(t++,n=_p(e,t)):n<0x5af3107a4000&&(t--,n=_p(e,t)),n===n?n>=0x38d7ea4c68000?[n/10,t+1]:[n,t]:vp(e.toExponential(14))}function bp(e,t){return t>=0&&t<=22?e*mp[t]:t<0&&t>=-22?e/mp[-t]:+(e+`e`+t)}function xp(e,t){if(t>=15)return e;let n=gp(15-t),r=Math.floor(e/n);return(e-r*n)*2>=n?r+1:r}function Sp(e,t){if(!e)return[0,0];if(t>=0&&e<0x38d7ea4c68000&&Number.isInteger(e))return[e,0];let[n,r]=yp(e),i=r+1+t;return i>=15?[n,r-14]:[xp(n,i),-t]}function Cp(e,t,n,r){if(!e)return[0,0,0];let[i,a]=yp(e);for(;;){let e=n>1?Math.floor(a/n)*n:a;r||e++;let o=a-e+1+t;if(o>=15)return[i,a-14-e,e];let s=xp(i,o);if(o<0||s<gp(o))return[s,-t,e];i=0x5af3107a4000,a++}}function wp(e,t){if(!e)return[``,``];let n=String(e);if(t>=0)return[t?n+`0`.repeat(t):n,``];let r=n.length+t,i=n.length;for(;i>0&&n.charCodeAt(i-1)===48;)i--;return[r>0?n.slice(0,r):``,i>r?(r>=0?``:`0`.repeat(-r))+n.slice(Math.max(r,0),i):``]}function Tp(e,t=0){if(e<0)return-Tp(-e,t);if(t){let n=10**t||1;return Math.round(e*n)/n}return Math.round(e)}function Ep(e,t=0){return typeof e==`number`?e<0?-Ep(-e,t):!e||!isFinite(e)?e:bp(...Sp(e,t)):NaN}function Dp(e,t=2,n=2){let r=e<0?-1:1,i=10**(t||2),a=10**(n||2),o=Math.abs(e),s=0,c=0,l=0,u=1,d,f;if(e=o,e%1==0)f=[e*r,1];else if(e<1e-19)f=[r,0x8ac7230489e80000];else if(e>0x8ac7230489e80000)f=[0x8ac7230489e80000*r,1];else{do if(o=1/(o-Math.floor(o)),d=u,u=u*Math.floor(o)+s,s=d,c=l,l=Math.floor(e*u+.5),l>=i||u>=a)return[r*c,s];while(Math.abs(e-l/u)>=1e-13&&o!==Math.floor(o));f=[r*l,u]}return f}let Op=Math.floor;function kp(e,t=!0){if(t&&e>=0){if(e===0)return[1900,1,0];if(e===60)return[1900,2,29];if(e<60)return[1900,e<32?1:2,(e-1)%31+1]}let n=e+68569+2415019,r=Op(4*n/146097);n-=Op((146097*r+3)/4);let i=Op(4e3*(n+1)/1461001);n=n-Op(1461*i/4)+31;let a=Op(80*n/2447),o=n-Op(2447*a/80);n=Op(a/11);let s=a+2-12*n;return[100*(r-49)+i+n|0,s|0,o|0]}function Ap(e){return kp(e+1462)}function jp(e){if(e===60)throw Error(`#VALUE!`);if(e<=1)return[1317,8,29];if(e<60)return[1317,e<32?9:10,1+(e-2)%30];let t=10631/30,n=8.01/60,r=e+466935,i=Op(r/10631);r-=10631*i;let a=Op((r-n)/t);r-=Op(a*t+n);let o=Op((r+28.5001)/29.5);return o===13?[30*i+a,12,30]:[30*i+a,o,r-Op(29.5001*o-29)]}function Mp(e,t=0,n=!0){let r=Op(e);return t===6?jp(r):t===-1?Ap(r):kp(r,n)}let Np=Math.floor;function Pp(e,t){let n;if(Array.isArray(e)){let[t,r,i,a,o,s]=e;n=Date.UTC(t,r==null?0:r-1,i??1,a||0,o||0,s||0)}else if(e instanceof Date&&(n=e.valueOf(),!t?.ignoreTimezone)){let t=/* @__PURE__ */ new Date;t.setUTCFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t.setUTCHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n=t.valueOf()}if(n!=null&&isFinite(n)){let e=Np(n/864e5),t=n-e*864e5;return e-(e<=-25509?-25568:-25569)+t/864e5}}let Fp={".":[`,`,`\xA0`,` `,`'`,`٬`],",":[`.`,`\xA0`,` `,`'`,`٬`],"٫":[`.`,`\xA0`,` `,`'`,`٬`]},Ip=e=>e?.length===1&&e>=`0`&&e<=`9`;function Lp(e,t){let n=t.decimal,r=[...Fp[n]||[`'`,`٬`]];!r.includes(t.group)&&t.group!==` `&&t.group!==n&&r.push(t.group);let i=``,a=``,o=1,s=0,c=!1,l=!1,u=!1,d=!1,f=!1,p=0,m=[` `,`\xA0`,` `,`+`,`%`,`(`,`-`].concat(Lf);for(;m.includes(e[p]);){let t=e[p];if(t===`-`){if(c||l)return;c=!0,o=-1}else if($f.test(t)){if(f)return;f=!0}else if(t===`(`){if(l||c)return;l=!0,o=-1}else if(t===`%`){if(d)return;d=!0}p++}let h=!1,g;if(e[p]===n||Ip(e[p]))for(;p<e.length;){let t=e[p];if(!g&&r.includes(t))g=t;else if(!(g&&g===t)){if(t===n){if(h)break;i+=`.`,h=!0}else if(Ip(t))i+=t;else break}p++}if(e[p]===`e`||e[p]===`E`){a+=e[p],p++,(e[p]===`+`||e[p]===`-`)&&(a+=e[p],p++);let t=p;for(;Ip(e[p]);)a+=e[p],p++;if(t===p)return}let _=[` `,`\xA0`,` `,`%`,`$`,`)`].concat(Lf);for(;_.includes(e[p]);){let t=e[p];if($f.test(t)){if(f)return;f=!0}else if(t===`)`){if(u||!l)return;u=!0}else if(t===`%`){if(d)return;d=!0}p++}if(p!==e.length)return;let v=parseFloat(i+a);if(!isFinite(v))return;if(a){if(d||f)return;s=11}else if(d){if(f)return;s=i.includes(`.`)?10:9,v*=.01}else f?s=i.includes(`.`)?7:5:g&&(s=i.includes(`.`)?4:3);let y={value:v*o};return s&&(y.formatId=s),y}function Rp(e){let t=``,n=0,r=``,i=!1;for(let a=0;a<e.length;a++){let o=e.charCodeAt(a);o>=48&&o<=57?(t+=n>=15?`0`:e[a],n++):o===46?t+=`.`:o===45?i?t+=`-`:r=`-`:(o===101||o===69)&&(t+=`e`,i=!0,n=0)}return t?Number(r+t):NaN}let zp=e=>e?.length===1&&e>=`0`&&e<=`9`,Bp=e=>e===`\xA0`||e===` `;function Vp(e,t){let n=t.decimal,r=t.group!==` `&&t.group!==n?t.group:``,i=t.format?.currencyPos??0,a=``,o=``,s=1,c=!1,l=!1,u=!1,d=!1,f=!1,p=!1,m=null,h=0;if(Bp(e[h]))return;let g=t.currency??`$`,_=``;do{if(_=e[h],_===`-`){if(c||u||l)return;c=!0,s=-1}else if(_===`+`){if(c||l)return;l=!0}else if((i===0||i===2)&&e.slice(h).startsWith(g)){if(p)return;h+=Math.max(0,g.length-1),p=!0,m=_}else if(_===`€`){if(p)return;p=!0,m=_}else if(_===`(`){if(u||c)return;u=!0,s=-1}else if(_===`%`){if(f)return;f=!0}else if(_!==` `&&_!==` `)break;h++}while(h<e.length);let v=!1,y=0,b=0;if(e[h]===n||zp(e[h]))for(;h<e.length;){let t=e[h];if(t===r){if(v||!b&&(!a||!+a)||b&&y<3)return;y=0,b++}else if(t===n){if(v||b&&y<3)return;y=0,a+=`.`,v=!0}else if(zp(t))y++,a+=t;else break;h++}if(!v&&b&&y<3)return;let x=!1,ee=0,te=``,S=!v&&/^ +(\d+)\/(\d+)/.exec(e.slice(h));if(S&&(ee=+S[1]/S[2],x=!0,te=S[2],h+=S[0].length),e[h]===`e`||e[h]===`E`){o+=e[h],h++,(e[h]===`+`||e[h]===`-`)&&(o+=e[h],h++);let t=h;for(;zp(e[h]);)o+=e[h],h++;if(t===h)return}let ne=``;for(;h<e.length;){if(_=e[h],ne=_,(i===1||i===3)&&e.slice(h).startsWith(g)){if(p)return;h+=Math.max(0,g.length-1),p=!0,m=_}else if(_===`€`){if(p)return;p=!0,m=_}else if(_===`)`){if(d||!u)return;d=!0}else if(_===`%`){if(f)return;f=!0}else if(_!==` `&&_!==` `)break;h++}if(Bp(ne)||h!==e.length||p&&f||d!==u||d&&l)return;let re=Rp(a+o);if(x&&(re+=ee),f&&(re=+(re*.01).toPrecision(15)),!isFinite(re))return;let C;o?C=11:x?C=te.length>1?13:12:f?C=v?10:9:p&&m!==`€`?C=v?8:6:b&&m!==`€`&&(C=v?4:3);let ie={value:re?re*s:0};return C&&(ie.formatId=C),ie}let Hp=(e,t)=>t===2?e%4==0&&e%100!=0||e%400==0||e===1900?29:28:t===4||t===6||t===9||t===11?30:31;function Up(e,t,n){return n<1||t<1||t>12?!1:n<=Hp(e,t)}let Wp=e=>e.replace(/\s+/g,``).trim().replace(/\./g,``).toLowerCase();function Gp(e,t){let n=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?=\s*[^\s\d]|$)/.exec(e),r=``;if(n){let i=Wp(e.slice(n[0].length));if(i===Wp(t.ampm[0])||i===`a`||i===`am`)r=`a`;else if(i===Wp(t.ampm[1])||i===`p`||i===`pm`)r=`p`;else if(i===`:`)n[3]||=`0`,n[2]||=`0`;else if(i)return}if(n){let[,e,t,i,a]=n;if(a&&!i||!r&&!t&&!i)return;let o=(e||0)*1;if(r){if(o>=13)return;r===`a`?o===12&&(o=0):r===`p`&&o!==12&&(o+=12)}let s=(t||0)*1,c=(i||0)*1,l=(a||0)*1,u=r?18:20;return i&&u++,{value:(o*60*60+s*60+c+l)/86400,formatId:u}}}var Kp=class{maxSize;entries=/* @__PURE__ */ new Map;constructor(e){this.maxSize=e}get(e){let t=this.entries.get(e);return t!==void 0&&(this.entries.delete(e),this.entries.set(e,t)),t}set(e,t){this.entries.delete(e),this.entries.set(e,t),this.entries.size>this.maxSize&&this.entries.delete(this.entries.keys().next().value)}getOrSet(e,t){let n=this.entries.has(e)?this.entries.get(e):t(e);return this.set(e,n),n}};let qp=/* @__PURE__ */ `!d-m-y.!d-m-Y.!j-m-y.!j-m-Y.!d-n-y.!d-n-Y.!j-n-y.!j-n-Y.?m-d-y.?m-d-Y.?m-j-y.?m-j-Y.?n-d-y.?n-d-Y.?n-j-y.?n-j-Y.d-M-y.d-M-Y.j-M-y.j-M-Y.M-d-y.M-d-Y.M-j-y.M-j-Y.d-F-y.d-F-Y.F-d-y.F-d-Y.F-j-y.F-j-Y.j-F-y.j-F-Y.y-F-d.y-F-j.y-M-d.y-M-j.Y-F-d.Y-F-j.Y-M-d.Y-m-d.Y-M-j.Y-m-j.Y-n-d.Y-n-j.j-F.j-M.d-F.d-M.n-d.n-j.n-Y.m-d.m-j.m-Y.M-Y.M-y.F-y.F-Y.Y-M.Y-n.Y-m.Y-F.Y-M`.split(`.`),Jp={},Yp={};function Xp(e,t,n=1){if(e){let r=e[0],i=e.slice(1);r===`!`?Xp(i,t,4):r===`?`?Xp(i,t,2):(t[r]=t[r]||{},Xp(i,t[r],n))}else t.$=n}function Zp(e,t){Xp(e,t),Xp(e+` x`,t),Xp(e+` l`,t),Xp(e+` l x`,t),Xp(`l `+e,t),Xp(`l `+e+` x`,t),Xp(e+` D`,t),Xp(e+` D x`,t),Xp(`D `+e,t),Xp(`D `+e+` x`,t)}qp.forEach(e=>{e.startsWith(`?`)||Zp(e,Jp),e.startsWith(`!`)||Zp(e,Yp)});let Qp=(/* @__PURE__ */ new Date()).getUTCFullYear(),$p=(e,t,n=!1)=>{for(let r of t)if(e.startsWith(r[0])){let t=r[0].length;return n&&(r[2]===`D`||r[2]===`M`)&&e[t]===`.`&&t++,[e.slice(0,t),r]}return[``,null]},em=(e,t,n,r)=>{let i=n.path||``,a=Object.keys(t);for(let o of a){let a;if(t[o]){if(o===`$`||o===`€`)e||(a=n);else if(o===`-`){let s=/^(\s*([./-]|,\s)\s*|\s+)/.exec(e);if(s){let c=s[1]===`-`||s[1]===`/`||s[1]===`.`?s[1]:` `;if(!n.sep||n.sep===c){let l=s[0].replace(/\s+/g,` `);a=em(e.slice(s[0].length),t[o],{...n,sep:c,path:i+l},r)}}}else if(o===` `){let s=/^[,.]?\s+/.exec(e);if(s){let c=s[0].replace(/\s+/g,` `);a=em(e.slice(s[0].length),t[o],{...n,path:i+c},r)}}else if(o===`j`||o===`d`){let s=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(e);s&&(a=em(e.slice(s[0].length),t[o],{...n,day:s[0],path:i+o},r))}else if(o===`n`||o===`m`){let s=/^(0?[1-9]|1[012])\b/.exec(e);s&&(a=em(e.slice(s[0].length),t[o],{...n,month:+s[0],_mon:s[0],path:i+o},r))}else if(o===`F`||o===`M`){let[s,c]=$p(e,r.mon,r.mp);c?.[2]===o&&(a=em(e.slice(s.length),t[o],{...n,month:c[1],_mon:s,path:i+o},r))}else if(o===`l`||o===`D`){let[s,c]=$p(e,r.day,r.dp);c?.[2]===o&&(a=em(e.slice(s.length),t[o],{...n,path:i+o},r))}else if(o===`y`){let s=/^\d\d\b/.exec(e);if(s){let c=+s[0]>=30?+s[0]+1900:+s[0]+2e3;a=em(e.slice(s[0].length),t[o],{...n,year:c,path:i+o},r)}}else if(o===`Y`){let s=/^\d\d\d\d\b/.exec(e);s&&(a=em(e.slice(s[0].length),t[o],{...n,year:+s[0],path:i+o},r))}else if(o===`x`){let s=Gp(e,r.l10n);s&&(a=em(``,t[o],{...n,time:s.value,tf:s.formatId,path:i+o},r))}else throw Error(`Unknown date token "${o}"`);if(a&&Up(n.year||1916,n.month||1,n.day?+n.day:1))return a}}},tm=e=>e.replace(/\s+/g,` `).trim().replace(/’/,`'`).replace(/\.$/,``).toLowerCase(),nm=(e,t)=>{let n=e.map((e,n)=>[tm(e),n+1,t]);return n.sort((e,t)=>t[0].length-e[0].length),n},rm=e=>({mon:[...nm(e.mmmm,`F`),...nm(e.mmm,`M`)],mp:e.mmm[0].at(-1)===`.`,day:[...nm(e.dddd,`l`),...nm(e.ddd,`D`)],dp:e.ddd[0].at(-1)===`.`,l10n:e}),im=new Kp(10);function am(e,t){let n=im.getOrSet(t,rm),r=em(tm(e),t.format?.dateOrder?Jp:Yp,{path:``},n);if(r){if(r.sep===`.`&&r.path?.length===3)return;let e=+(r.year??Qp);r.day||=`1`;let t=-1/0;if(e<1900)return;e<=1900&&(r.month??0)<=2?t=25568:e<1e4&&(t=25569);let n=Date.UTC(e,(r.month??1)-1,+r.day)/864e5+t+(r.time||0);if(n>=0&&n<=2958465){let e=0,t=0;if(r.path){for(let e of r.path)e===`j`||e===`d`?t|=1:e===`n`||e===`m`||e===`M`||e===`F`?t|=2:(e===`y`||e===`Y`)&&(t|=4);t===3&&(e=16),t===6&&(e=17),t===7&&(e=14)}return r.tf&&(e=22),{value:n,formatId:e}}}}function om(e,t){return e>=48&&e<=57?`0`:e===58?`:`:e===46&&t<65?`.`:e===32?`_`:e===160||e===8239?`~`:`?`}function sm(e,t){return e>=48&&e<=57?`0`:e===58?`:`:e===44&&t<65?`.`:e===46&&t<65?`!`:e===32?`_`:e===160||e===8239?`~`:`?`}function cm(e,t){let n=[],r={type:``,value:``},i=-1;for(let a=0;a<e.length;a++){let o=e.charCodeAt(a),s=t(o,i);r.type!==s&&(r.value&&n.push(r),r={type:s,value:``}),r.value+=e[a],i=o}return r.value&&n.push(r),n}function lm(e,t,n,r,i){let a=+(t||0),o=+(n||0),s=r?Number(`.`+(r.slice(0,3)||`0`)):0,c=(e||0)*1;if(i){if(c>=13||o>=60||a>=60)return NaN;i===`a`?c===12&&(c=0):i===`p`&&c!==12&&(c+=12)}let l=0;return a>=60&&l++,o>=60&&l++,c>=24&&l++,l>1?NaN:(c*60*60+a*60+o+s)/86400}let um=e=>e.replace(/\s+/g,``).toLowerCase(),dm={a:`a`,"a.":`a`,"a:":`a`,am:`a`,p:`p`,"p.":`p`,"p:":`p`,pm:`p`};function fm(e){return/^\d\d?$/.test(e)}function pm(e){return/^\d{0,10}$/.test(e)}let mm=(e,t)=>{let n=um(t);return e===n||e===n.charAt(0)};function hm(e){return e[1]?.value===`:`?{h:e[0].value,m:e[2]?.value??`0`,s:e[4]?.value??`0`,f:`0`,ap:``,z:+e[0].value>23?46:e[4]?21:20}:null}function gm(e){return{h:e[0].value,m:`0`,s:`0`,f:`0`,ap:um(e[2].value),z:18}}function _m(e){return{h:e[0].value,m:e[2].value,s:`0`,f:`0`,ap:um(e[4].value),z:18}}let vm={"0:":hm,"0:0":hm,"0:0.":hm,"0:0!":hm,"0:0:":hm,"0:0:0":hm,"0:0.0":e=>({h:`0`,m:e[0].value,s:e[2].value,f:e[4].value,ap:``,z:47}),"0:0:0.0":e=>({h:e[0].value,m:e[2].value,s:e[4].value,f:e[6].value,ap:``,z:47}),"0:0:0!0":(e,t)=>t?{h:e[0].value,m:e[2].value,s:e[4].value,f:`0`,ap:``,z:21}:null,"0_?":gm,"0_?:":gm,"0:0_?":_m,"0:0_?:":_m,"0:0:0_?":e=>({h:e[0].value,m:e[2].value,s:e[4].value,f:`0`,ap:um(e[6].value),z:+e[0].value>23?46:19})};function ym(e,t,n=!1){let r=cm(e,t.decimal===`,`?sm:om),i=r.reduce((e,t)=>e+t.type,``),a=vm[i]?.(r,n);if(!a)return;let{h:o,m:s,s:c,f:l,ap:u,z:d}=a;if(fm(o)&&fm(s)&&fm(c)&&pm(l)){let e=dm[u];e||u!==`a,`&&u!==`p,`||t.decimal!==`,`||(e=dm[u[0]]);let n=``;if(mm(u,t.ampm[0])||e===`a`)n=`a`;else if(mm(u,t.ampm[1])||e===`p`)n=`p`;else if(u)return;let r=lm(o,s,c,l,n);if(isFinite(r)){let e={value:r,formatId:d};return(+s>59||+c>59)&&delete e.formatId,e}}}let bm=(/* @__PURE__ */ new Date()).getUTCFullYear(),xm=e=>e.trim().replace(/\s+/g,` `).replace(/’/,`'`).replace(/\.$/,``).toLowerCase(),Sm=e=>/^\d+$/.test(e),Cm=e=>{let t={};e.dddd.forEach(e=>{if(!Sm(e)){let n=xm(e);for(let e=3;e<=n.length;e++)t[n.slice(0,e)]=[`dddd`,0]}});for(let n of e.ddd)if(!Sm(n)){let e=xm(n);t[e]=[`ddd`,0]}return e.mmmm.forEach((e,n)=>{if(!Sm(e)){let r=xm(e);for(let e=3;e<=r.length;e++)t[r.slice(0,e)]=[`mmmm`,n+1]}}),e.mmm.forEach((e,n)=>{if(!Sm(e)){let r=xm(e);t[r]=[`mmm`,n+1]}}),t},wm=new Kp(10);function Tm(e,t,n){if(Up(e,t,n)){let r=-1/0;if(e<1900)return null;e<=1900&&t<=2?r=25568:e<1e4&&(r=25569);let i=Date.UTC(e,t-1,n)/864e5+r;if(i>=0&&i<=2958465)return i}return null}function Em(e){return e>=48&&e<=57?1:e===32||e>=44&&e<=47?2:3}function Dm(e){let t=[],n=-1,r=``;for(let i=0;i<e.length;i++){let a=e.charCodeAt(i);Em(n)!==Em(a)&&(r&&t.push(r),r=``),r+=e[i],n=a}return r&&t.push(r),t}let Om=e=>{let t=Number(e);return e.length<=2&&isFinite(t)&&t>0&&t<=12},km=(e,t,n)=>{let r=Number(e);return e.length<=2&&isFinite(r)&&r>0&&r<=Hp(n??bm,t??1)},Am=e=>e.length>3&&isFinite(Number(e)),jm=e=>e.length<=2&&isFinite(Number(e)),Mm=e=>{let t=+e;return t+=t>=30?1900:2e3,t};function Nm(e,t){let n=wm.getOrSet(t,Cm),r=e=>!!n[e]&&n[e][0]===`mmm`,i=e=>!!n[e]&&n[e][0]===`mmmm`,a=e=>n[e]?n[e][1]:0,o=Dm(e.toLowerCase()),s=null,c,l=bm,u=``;o.length>5&&/^ +$/.test(o[5])&&(u=o.slice(6).join(``),o.length=5);let d=t.format?.dateOrder??0,f=d===0,p=d===2,m=!f&&!p,h=!!t.format?.monthFirst,g=t.format?.dateSep===`.`,_=e=>{let t=e.trim();return t===`/`||t===`-`||g&&t===`.`},v=e=>e===` `||_(e),y=e=>h&&/^, +$/.test(e),b=e=>h&&/^,? +$/.test(e),x=e=>v(e)||!h&&/^, +$/.test(e);if(o.length===5){let[e,t,n,l,u]=o,[d,m]=f?[e,n]:[n,e];(i(e)||r(e))&&b(t)&&km(n)&&y(l)&&Am(u)?(s=Tm(+u,a(e),+n),c=15):(i(e)||r(e))&&y(t)&&km(n)&&y(l)&&jm(u)?(s=Tm(Mm(u),a(e),+n),c=15):km(e,a(n),Mm(u))&&x(t)&&(i(n)||r(n))&&x(l)&&jm(u)?(s=Tm(Mm(u),a(n),+e),c=15):km(e,a(n),+u)&&x(t)&&(i(n)||r(n))&&x(l)&&Am(u)?(s=Tm(+u,a(n),+e),c=15):Am(e)&&_(t)&&Om(n)&&_(l)&&km(u,+n,+e)?(s=Tm(+e,+n,+u),c=14):p?jm(e)&&_(t)&&Om(n)&&_(l)&&km(u,+n,Mm(e))&&(s=Tm(Mm(e),+n,+u),c=14):Om(d)&&_(t)&&km(m,+d,+u)&&_(l)&&Am(u)?(s=Tm(+u,+d,+m),c=14):Om(d)&&_(t)&&km(m,+d,Mm(u))&&_(l)&&jm(u)&&(s=Tm(Mm(u),+d,+m),c=14)}else if(o.length===3){let[e,t,n]=o;if(r(n)&&km(e,a(n))&&v(t))s=Tm(l,a(n),+e),c=16;else if(i(n)&&km(e,a(n))&&v(t))s=Tm(l,a(n),+e),c=16;else if(_(t)&&Sm(e)&&Sm(n)){if(p)Om(e)&&km(n,+e)?(s=Tm(l,+e,+n),c=16):Om(n)&&km(e,+n)?(s=Tm(l,+n,+e),c=16):(jm(e)&&+e>0||Am(e))&&Om(n)&&(s=Tm(jm(e)?Mm(e):+e,+n,1),c=17);else{let[t,r]=f?[e,n]:[n,e];Om(t)&&km(r,+t)?(s=Tm(l,+t,+r),c=16):Om(e)&&jm(n)&&(f||+n>0)?(s=Tm(Mm(n),+e,1),c=17):Om(e)&&Am(n)&&(s=Tm(+n,+e,1),c=17)}}else!m&&(r(e)||i(e))&&v(t)&&km(n,a(e))?(s=Tm(l,a(e),+n),c=16):(r(e)||i(e))&&v(t)&&Am(n)?(s=Tm(+n,a(e),1),c=17):(r(e)||i(e))&&v(t)&&jm(n)?(s=Tm(Mm(n),a(e),1),c=17):km(e,a(t),Mm(n))&&(i(t)||r(t))&&jm(n)?(s=Tm(Mm(n),a(t),+e),c=15):km(e,a(t),+n)&&(i(t)||r(t))&&Am(n)&&(s=Tm(+n,a(t),+e),c=15)}else if(o.length===2){let[e,t]=o;!m&&(r(e)||i(e))&&km(t,a(e))?(s=Tm(l,a(e),+t),c=16):km(e,a(t))&&(r(t)||i(t))?(s=Tm(l,a(t),+e),c=16):(r(e)||i(e))&&Am(t)?(s=Tm(+t,a(e),1),c=17):(r(e)||i(e))&&jm(t)&&(s=Tm(Mm(t),a(e),1),c=17)}if(s!=null&&u){let e=ym(u,t,!0);e?(s+=e.value,e.formatId&&(c=e.formatId===46?void 0:c===14&&e.formatId>=18&&e.formatId<=21?22:e.formatId)):s=null}if(s!=null)return{value:s,formatId:c}}function Pm(e,t){let n=lp(t?.locale)||fp;return t?.mode===1?am(e,n):Nm(e,n)}function Fm(e,t){let n=lp(t?.locale)||fp;return t?.mode===1?Gp(e,n):ym(e,n)}function Im(e,t){let n=e.trim().toLowerCase(),r=t.bool[0].toLowerCase();if(n===`true`||n===r)return{value:!0};let i=t.bool[1].toLowerCase();if(n===`false`||n===i)return{value:!1}}function Lm(e,t){let n=e.toLowerCase(),r=t.bool[0].toLowerCase();if(n===`true`||n===r)return{value:!0};let i=t.bool[1].toLowerCase();if(n===`false`||n===i)return{value:!1}}function Rm(e,t){let n=lp(t?.locale)||fp;return t?.mode===1?Lp(e,n)??am(e,n)??Gp(e,n)??Im(e,n):Vp(e,n)??Nm(e,n)??ym(e,n)??Lm(e,n)}function zm(e){return{scale:1,percent:!1,text:!1,parens:!1,fractions:!1,grouping:!1,exponential:!1,integer:!1,locale:``,pattern:``,int_max:0,frac_max:0,frac_min:0,man_p:``,num_p:``,num_min:0,den_min:0,den_max:0,date:0,tokensUsed:0,date_eval:!1,date_system:1,sec_decimals:0,general:!1,clock:24,int_min:0,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:e??[],den_p:``,int_p:``,denominator:0,sysdate:!1,systime:!1}}function Bm(e){let t,n=0,r,i=``,a=/^([^-]*)-([0-9a-fA-F]{3,8})$/.exec(e);if(a){a[1]&&(i=a[1]);let e=parseInt(a[2],16),o=e>>24&255;o&&(n=o);let s=e>>16&255;s&&(t=s);let c=e&65535;if(c===63488)return{sysdate:!0};if(c===62464)return{systime:!0};c&&Tf[c]&&(r=Tf[c])}else{let a=/^([^-]*)-([a-z\d][a-z\d_.@-]*)?(?:,([a-f\d]{1,4}))?$/i.exec(e);if(a){let e=a[2];if(/^x-sysdate$/.test(e))return{sysdate:!0};if(/^x-systime$/.test(e))return{systime:!0};if(a[1]&&(i=a[1]),e&&(/-x-gannen$/i.test(e)&&(e=e.slice(0,-9)),r=cp(e)),a[3]){let e=parseInt(a[3],16),r=e>>8&255;r&&(n=r);let i=e&255;i&&(t=i)}}else if(e.includes(`-`))return{currency:e};else return{currency:e}}let o={};return t&&(o.calendar=t),n&&(o.numberStyle=n),r&&(o.locale=r),i&&(o.currency=i),o}function Vm(e,t){typeof e==`string`?t.push({type:Pf,value:e}):t.push(e)}let Hm=e=>{let t=0;for(let n=0;n<e.length;n++)e.charCodeAt(n)!==35&&t++;return t};function Um(e,t){let n=e?.type;return n===`HASH`||n===`ZERO`||n===`QMARK`||n===`DIGIT`&&t===`DEN`}function Wm(e){let t=[],n=zm(t),r=`INT`,i,a=[],o,s=!1,c=-1,l=!1,u=``,d=!1,f=e=>e===`DEN`?n.den_pattern:e===`INT`?n.int_pattern:e===`FRAC`?n.frac_pattern:e===`MAN`?n.man_pattern:[];for(;++c<e.length&&!l;){let p=e[c],m=p.type||`ERROR`;if(u+=p.raw,m===`GENERAL`)n.general=!0,Vm({type:m},t);else if(Um(p,r)){let e=f(r);o&&(Um(o,r)||o.type===`GROUP`)?(e.push((e.pop()||``)+p.value),i&&`num`in i&&(i.num+=p.value)):(e.push(p.value),i={type:r,num:p.value},Vm(i,t))}else if(m===`PAREN`)p.value===`(`&&(n.parens=!0),Vm(p.value,t);else if(m===`DIGIT`)Vm(p.value,t);else if(m===`SLASH`){d=!0;let e=f(r);if(e.length){if(!i)throw SyntaxError(`Format pattern is missing a numerator`);n.fractions=!0;let a=e.pop();n.num_pattern.push(a),i.type=`NUM`,r=`DEN`,Vm({type:`DIV`},t)}else Vm(p.value,t)}else if(m===`COMMA`)Vm(`,`,t);else if(m===`SCALE`)n.scale=.001**p.raw.length;else if(m===`GROUP`){if(r===`INT`&&(n.grouping=!0),r===`DEN`)throw SyntaxError(`Cannot group denominator digits`)}else if(m===`SPACE`)Vm({type:m},t);else if(m===`BREAK`){l=!0;break}else if(m===`TEXT`)n.text=!0,Vm({type:m,value:p.value},t);else if(m===`PLUS`||m===`MINUS`)Vm({type:m},t);else if(m===`DURATION`){let e=p.value.toLowerCase(),r=e[0],i;i=r===`h`?{type:`HOUR-ELAP`,size:16,pad:e.length}:r===`m`?{type:`MIN-ELAP`,size:32,pad:e.length}:{type:`SEC-ELAP`,size:64,pad:e.length},n.date|=i.size,a.push(i),Vm(i,t)}else if(n.date&&m===`POINT`&&e[c+1]?.type===`ZERO`){let r=1;c++;let i=`0`;e[c+1]?.type===`ZERO`&&(i+=`0`,r=2,c++),e[c+1]?.type===`ZERO`&&(i+=`0`,r=3,c++),u+=i;let a=[64,128,256,512][r];n.date|=a,n.date_eval=!0,n.sec_decimals=Math.max(n.sec_decimals,r),Vm({type:`SUBSEC`,size:a,decimals:r},t)}else if(m===`CALENDAR`)s||(n.date_system=p.value===`B2`||p.value===`b2`?6:1);else if(m===`DATETIME`){let e,r=p.value.toLowerCase(),i=r[0];if(r===`y`||r===`yy`)e={type:`YEAR-SHORT`,size:2};else if(i===`y`||i===`e`)e={type:`YEAR`,size:2};else if(r===`b`||r===`bb`)e={type:`B-YEAR-SHORT`,size:2};else if(i===`b`)e={type:`B-YEAR`,size:2};else if(r===`d`||r===`dd`)e={type:`DAY`,size:8,pad:r===`dd`};else if(r===`ddd`||r===`aaa`)e={type:`WEEKDAY-SHORT`,size:8};else if(i===`d`||i===`a`)e={type:`WEEKDAY`,size:8};else if(i===`h`)e={type:`HOUR`,size:16,pad:r.length>1};else if(i===`m`){r.length===3?e={type:`MONTHNAME-SHORT`,size:4}:r.length===5?e={type:`MONTHNAME-SINGLE`,size:4}:r.length>=4&&(e={type:`MONTHNAME`,size:4});let t=a[a.length-1];!e&&t&&!t.used&&t.size&80&&(t.used=!0,e={type:`MIN`,size:32,pad:r.length>1}),e||={type:`MONTH`,size:4,pad:r.length>1,indeterminate:!0}}else if(i===`s`){e={type:`SEC`,size:64,pad:r.length>1};let t=a[a.length-1];t&&t.size&32?e.used=!0:t&&`indeterminate`in t&&(delete t.indeterminate,t.size=32,t.type=`MIN`,e.used=!0)}e&&(n.date|=e.size,n.date_eval=!0,a.push(e),Vm(e,t))}else if(m===`AMPM`)n.clock=12,n.date|=16,n.date_eval=!0,Vm({type:m,short:p.value===`A/P`},t);else if(m===`ESCAPED`)Vm({type:Pf,value:p.value,escaped:!0},t);else if(m===`STRING`||m===`CHAR`)Vm(p.value,t);else if(m===`CONDITION`){let e=/^(<[=>]?|>=?|=)\s*(-?[.\d]+)$/.exec(p.value);if(e)n.condition=[e[1],parseFloat(e[2])];else throw Error(`Invalid condition: `+p.value)}else if(m===`LOCALE`){let e=Bm(p.value);e.currency&&Vm({type:Pf,value:e.currency,escaped:!0},t),e.sysdate&&(n.sysdate=!0),e.systime&&(n.systime=!0),e.locale&&(n.locale=e.locale),(e.calendar===1||e.calendar===6)&&(n.date_system=e.calendar),s=!0}else if(m===`COLOR`){let e,t=p.value.toLowerCase();n.color=(e=/^color\s*(\d+)$/i.exec(t))?parseInt(e[1],10):t}else if(m===`PERCENT`)n.scale=100,n.percent=!0,Vm(`%`,t);else if(m===`POINT`)Vm({type:m,value:p.value},t),n.date||(n.dec_fractions=!0,r=`FRAC`);else if(m===`EXP`){n.exponential=!0;let e=p.value.includes(`+`);n.exp_plus=e,r=`MAN`,Vm({type:`EXP`,plus:e},t)}else if(m===`SKIP`)Vm({type:m,value:p.value},t);else if(m===`FILL`)Vm({type:m,value:p.value},t);else if(m===`CURRENCY`)Vm({type:m,value:p.value},t);else if(m===`DBNUM`){let e=parseInt(p.value.slice(5));if(e<1||e>4)throw SyntaxError(`Unknown modifier: `+p.value)}else if(m===`NATNUM`)throw SyntaxError(`Unknown modifier: `+p.value);else if(m===`MODIFIER`)throw SyntaxError(`Unknown modifier: `+p.value);else if(m===`ERROR`)throw SyntaxError(`Illegal character: ${u}`);else throw SyntaxError(`Unknown token ${m} in ${u}`);o=p}if(n.tokensUsed=c,n.pattern=u,n.fractions&&n.dec_fractions||n.grouping&&!n.int_pattern.length||n.fractions&&n.exponential||n.fractions&&n.den_pattern.length*n.num_pattern.length===0||d&&!n.fractions&&!n.date||n.exponential&&(n.int_pattern.length||n.frac_pattern.length)*n.man_pattern.length===0)throw SyntaxError(`Invalid pattern: ${u}`);let p=n.int_pattern.join(``),m=n.man_pattern.join(``),h=n.frac_pattern.join(``);n.int_max=p.length,n.int_min=Hm(p);let g=0;for(let e=0;e<p.length;e++){let t=p[p.length-1-e];/^[0-9?]/.test(t)&&(g=e+1)}n.int_min=g,n.frac_max=h.length,n.frac_min=Hm(h);let _=n.num_pattern.join(``),v=n.den_pattern[0]||``;if(v.includes(`?`)||_.includes(`?`)?(v=v.replace(/\d/g,`?`),v=v.replace(/#$/g,`?`),n.num_min=Hm(_),n.den_max=v.length,n.den_min=Hm(v),_=_.replace(/#$/g,`?`)):(n.num_min=Hm(_),n.den_max=v.length,n.den_min=Hm(v)),n.int_p=p,n.man_p=m,n.num_p=_,n.den_p=v,n.den_pattern.length&&(n.denominator=parseInt(n.den_pattern.join(``).replace(/\D/g,``),10)),n.integer=!!p.length,!n.integer&&!n.exponential&&h.length){let e=n.tokens.findIndex(e=>e.type===jf);n.tokens.splice(e,0,{type:`INT`,num:`#`}),n.integer=!0,n.int_pattern=[`#`],n.int_p=`#`}if(!n.tokens.length&&/^\[(?!\$)/.test(n.pattern)&&(n.general=!0,Vm({type:Ef},t)),n.fractions)for(let e=0;e<t.length-1;e++){let n=t[e];if(n.type!==`STRING`&&n.type!==`SPACE`)continue;let r=t[e+1].type;r===`NUM`?n.rule=`num+int`:r===`DIV`?n.rule=`num`:r===`DEN`&&(n.rule=`den`)}return n.grouping&&n.int_pattern.length>1&&(n.grouping=!1),n}let Gm=e=>{let[t,n]=e.condition??[``,0];n<0&&(t===`<`||t===`<=`||t===`=`)||n===0&&t===`<`||e.tokens.unshift({type:Af,volatile:!0})},Km=(e,t)=>{let n={};for(let t in e){let r=e[t];n[t]=Array.isArray(r)?[...r]:r}return t&&n.tokens&&n.tokens.unshift(t),n.generated=!0,n};function qm(e){let t=[],n=!1,r,i=null,a=0,o,s=0,c=0,l=rp(e);do{if(o=Wm(l),(o.date||o.general)&&(o.int_pattern.length||o.frac_pattern.length||o.scale!==1||o.text))throw Error(`Illegal format`);if(o.condition&&(c++,n=!0),o.text){if(i)throw Error(`Unexpected partition`);i=o}o.locale&&(r=cp(o.locale)),t.push(o),a=+(l[o.tokensUsed]?.type===`BREAK`),l=l.slice(o.tokensUsed+a),s++}while(a&&s<4&&c<3);if(a)throw Error(`Unexpected partition`);if(c>2)throw Error(`Unexpected condition`);let u=t[3];if(u&&(u.int_pattern.length||u.frac_pattern.length||u.date))throw Error(`Unexpected partition`);if(n){t[0].condition||(t[0].condition=[`>`,0]);let e=t.length;if(e===1&&(t[1]=Wm(rp(`General`)),t[1].generated=!0),e<3){let e=t[0],n=t[1];if(Gm(e),n.condition)Gm(n);else{let t=e.condition;t&&(t[0]===`=`||t[1]>=0&&(t[0]===`>`||t[0]===`>=`))&&n.tokens.unshift({type:Af,volatile:!0})}}else t.forEach(Gm)}else{if(t.length<4&&i)for(let e=0,n=t.length;e<n;e++)t[e]===i&&t.splice(e,1);if(t.length<1&&i&&(t[0]=Wm(rp(`General`)),t[0].generated=!0),t.length<2){let e={type:Af,volatile:!0};t.push(Km(t[0],e))}if(t.length<3&&t.push(Km(t[0])),t.length<4){if(i)t.push(i);else{let e=Wm(rp(`@`));e.generated=!0,t.push(e)}}t[0].condition=[`>`,0],t[1].condition=[`<`,0],t[2].condition=void 0}return{pattern:e,partitions:t,locale:r}}let Jm=new Kp(1e3);function Ym(e,t=!1){e||=`General`;let n=Jm.get(e);if(!n)try{n=qm(e),Jm.set(e,n)}catch(r){if(t)throw r;let i=r&&typeof r==`object`&&`message`in r?String(r.message):`Unknown error`,a=zm([{type:Mf}]);a.error=!0,n={pattern:e,partitions:[a,a,a,a],error:i,locale:void 0}}return n}function Xm(e){if(e===0)return e;let t=Math.ceil(Math.log10(e<0?-e:e)),n=10**(16-Math.floor(t));return isFinite(n)?Math.round(e*n)/n:0}function Zm(e,t=0){let n=Math.floor(Math.log10(e));return t>1?Math.floor(n/t)*t:n}function Qm(e,t=1){return t<-300?parseFloat(e.toExponential().split(`e`)[0]):e*10**-t}let $m={total:1,sign:0,digits:1,period:0,int:1,frac:0};function eh(e,t=!0){let n=Math.abs(e);if(!n)return $m;let r=t&&e<0?1:0,i=Math.floor(n),a=Math.floor(Math.log10(n)+1),o=0,s=0;if(i!==n){o=1;let e=String(Ep(n*10**-a,15)),t=e.length,r=!0,i=0;for(;i<=e.length;){if(e[i]===`.`){t--;break}e[i]===`0`&&r?t--:r=!1,i++}s=t-a,s<0&&(s=0,o=0)}return{total:r+Math.max(a,1)+o+s,digits:Math.max(a,0)+s,sign:r,period:o,int:Math.max(a,1),frac:s}}let th=(e,t)=>e.replace(/\./,t.decimal),nh=(e,t,n)=>{let r=Math.abs(t),i;return i=e===1?e:Ep(e,5),[th(i+``,n),n.exponent,t<0?n.negative:n.positive,r<10?`0`:``,r]};function rh(e,t,n){if(typeof t==`string`)e.push(t);else{let r=t|0;if(t===r)e.push(Math.abs(r));else{let r=Math.abs(t),i=Zm(r),a=Qm(r,i);a===10&&(a=1,i++);let o=eh(r);if(i>=-4&&i<=-1){let t=r.toPrecision(10+i).replace(/\.?0+$/,``);e.push(th(t,n))}else if(i===10){let t=Math.round(r);t<1e11?e.push(t):e.push(...nh(1,11,n))}else if(Math.abs(i)<=9){if(o.total<=11){let t=Ep(r,9).toFixed(o.frac);e.push(th(t,n))}else i===9?e.push(Math.round(r)):i>=0&&i<9?e.push(th(String(Ep(r,9-i)),n)):e.push(...nh(a,i,n))}else o.total>=12?e.push(...nh(a,i,n)):e.push(th(Ep(r,9).toFixed(o.frac),n))}}return e}function ih(e,t=!1){return e===`0`?`0`:e===`?`?t?`\xA0`:` `:``}let ah=86400,oh=(e,t,n)=>n?e<-694324||t>=35830291:e<0||t>=2958466;function sh(e,t,n,r){let i=``,a=``,o=``,s=``,c=``,l=``,u=0,d=0;if(typeof e==`bigint`){if(e<=2**53-1&&e>=-(2**53-1))e=Number(e);else return n.bigintErrorNumber?String(e):n.overflow;d=e}else typeof e==`number`&&(d=Math.trunc(e));let f=0,p=0,m=1,h=0,g=0,_=0,v=0,y=0,b=0,x=r||fp;if(!t.text&&isFinite(t.scale)&&t.scale!==1&&typeof e==`number`&&(e=Xm(e*t.scale)),typeof e==`number`&&t.fractions){if(t.integer){let t=Math.abs(Tp(e,1));l+=t<1?``:Math.floor(t)}}else if(typeof e==`number`&&isFinite(e)&&(t.exponential||t.integer||t.dec_fractions)){let n,r;t.exponential?([n,r,u]=Cp(Math.abs(e),t.frac_max,t.int_max,!!t.integer),i+=Math.abs(u),e=(e<0?-n:n)*gp(r)):[n,r]=Sp(Math.abs(e),t.frac_max);let[a,o]=wp(n,r);t.integer&&(l=a),t.dec_fractions&&(c=o)}let ee=n.grouping[0]??3,te=n.grouping[1]??ee,S=!t.error&&(t.num_p.includes(`0`)||t.den_p.includes(`0`)),ne=S;if(t.fractions&&typeof e==`number`){ne=S||!!(e%1);let n=Math.abs(t.integer?e%1:e);if(n){if(ne=!0,t.denominator&&isFinite(t.denominator))s+=t.denominator,o+=Tp(n*t.denominator),o===`0`&&(o=``,s=``,ne=S);else{let e=Dp(n,1/0,t.den_max);o+=e[0],s+=e[1],t.integer&&o===`0`&&(o=``,s=``,ne=S)}}else!e&&!t.integer&&(ne=!0,o=`0`,s=`1`);t.integer&&!ne&&!Math.trunc(e)&&(l=`0`)}if(t.date&&typeof e==`number`){d=Math.trunc(e);let r=ah*(e-d);if(f=Math.floor(r),b=r-f,Math.abs(b)<1e-6?b=0:b>.9999&&(b=0,f+=1),b){let e=t.date&512||t.date&256||t.date&128;(e===512&&b>.9995||e===256&&b>.995||e===128&&b>.95||!e&&b>=.5)&&(f++,b=0)}if(f===ah&&t.date&1008&&(f=0,d+=1),d||t.date_system){let r=Mp(e+d-Math.trunc(e),t.date_system,n.leap1900);p=r[0],m=r[1],h=r[2]}if(f){let e=f<0?ah+f:f;y=Math.floor(e)%60,v=Math.floor(e/60)%60,_=Math.floor(e/60/60)%60}if(g=(6+d)%7,t.date_eval&&oh(e,d+f/ah,n.dateSpanLarge)){if(n.dateErrorThrows)throw Error(`Date out of bounds`);return n.dateErrorNumber?rh(e<0?[x.negative]:[],e,x).join(``):n.overflow}}let re=ih(`?`,n.nbsp);u<0?a=`-`:t.exp_plus&&(a=`+`);let C=[],ie=(e,t,r,i)=>{let a=!i&&e.length>t.length?r.length+e.length-t.length:r.length;e.length<t.length&&(i+=e.length-t.length);for(let t=0;t<a;t++)C.push(e[t+i]||ih(r[t],n.nbsp));return a},ae=!1,oe={int:0,frac:0,man:0,num:0,den:0};for(let r=0,u=t.tokens.length;r<u;r++){let u=t.tokens[r],S=u.type,se=`num`in u?u.num.length:0;if(S===`STRING`){let e=u.rule;e?e===`num`&&ne||e===`num+int`&&ne&&l||e===`den`&&ne?C.push(u.value.replaceAll(` `,re)):(e===`num`&&t.num_min>0||t.den_min>0||e===`num+int`&&t.den_min>0&&(l||t.num_min)||e===`den`&&t.den_min>0||t.den_min>0)&&C.push(re.repeat(u.value.length)):C.push(u.value.replaceAll(` `,re))}else if(S===`SPACE`)u.rule===`num+int`?(ne||t.num_min||t.den_min)&&(l||t.num_min)&&C.push(re):C.push(re);else if(S===`ERROR`)C.push(n.invalid);else if(S===`POINT`)C.push(t.date?u.value:x.decimal);else if(S===`GENERAL`)rh(C,e,x);else if(S===`EXP`)C.push(x.exponent);else if(S===`MINUS`)u.volatile&&t.date||u.volatile&&(typeof e!=`number`||e>=0)||(u.volatile&&!t.fractions&&(t.integer||t.dec_fractions)?(typeof e==`number`&&e<0&&l&&l!==`0`||c)&&C.push(x.negative):C.push(x.negative));else if(S===`PLUS`)C.push(x.positive);else if(S===`TEXT`)C.push(e);else if(S===`FILL`)n.fillChar&&C.push(n.fillChar,u.value);else if(S===`SKIP`)n.skipChar?C.push(n.skipChar,u.value):C.push(n.nbsp?`\xA0`:` `);else if(S===`DIV`)ne?C.push(`/`):t.num_min>0||t.den_min>0?C.push(re):C.push(ih(`#`,n.nbsp));else if(S===`INT`){if(t.int_pattern.length===1){let r=t.int_p,i=t.exponential&&!e,a=i?Math.max(t.int_min,t.int_max,l.length):Math.max(t.int_min,l.length),o=``;for(let e=a;e>0;e--){let a=l.charAt(l.length-e);i&&!a&&(a=`0`);let s=a?``:r.charAt(r.length-e)||r[0],c=``;if(t.grouping){let t=e-1-ee;t>=0&&!(t%te)&&(c=a||s===`0`?x.group:ih(`?`,n.nbsp))}o+=(a||ih(s,n.nbsp))+c}C.push(o)}else oe.int+=ie(l,t.int_p,u.num,oe.int)}else if(S===`FRAC`){let e=oe.frac;for(let t=0;t<se;t++)C.push(c[t+e]||ih(u.num[t],n.nbsp));oe.frac+=se}else if(S===`MAN`)oe.man||C.push(a),oe.man+=ie(i,t.man_p,u.num,oe.man);else if(S===`NUM`)oe.num+=ie(o,t.num_p,u.num,oe.num);else if(S===`DEN`){let e=oe.den;for(let t=0;t<se;t++){let r=s[t+e];if(!r){let e=u.num.charCodeAt(t);e>48&&e<=57||ae&&e===48?(ae=!0,r=n.nbsp?`\xA0`:` `):r=!ae&&t===se-1&&e===48&&!s?`1`:ih(u.num[t],n.nbsp)}C.push(r)}oe.den+=se}else if(S===`YEAR`)p<0&&C.push(x.negative),C.push(String(Math.abs(p)).padStart(4,`0`));else if(S===`YEAR-SHORT`){let e=p%100;C.push(e<10?`0`:``,e)}else if(S===`MONTH`)C.push(u.pad&&m<10?`0`:``,m);else if(S===`MONTHNAME-SINGLE`)t.date_system===6?C.push(x.mmmm6[m-1].charAt(0)):C.push(x.mmmm[m-1].charAt(0));else if(S===`MONTHNAME-SHORT`)t.date_system===6?C.push(x.mmm6[m-1]):C.push(x.mmm[m-1]);else if(S===`MONTHNAME`)t.date_system===6?C.push(x.mmmm6[m-1]):C.push(x.mmmm[m-1]);else if(u.type===`WEEKDAY-SHORT`)C.push(x.ddd[g]);else if(u.type===`CURRENCY`)C.push(u.value);else if(S===`WEEKDAY`)C.push(x.dddd[g]);else if(S===`DAY`)C.push(u.pad&&h<10?`0`:``,h);else if(S===`HOUR`){let e=_%t.clock||(t.clock<24?t.clock:0);C.push(u.pad&&e<10?`0`:``,e)}else if(S===`MIN`)C.push(u.pad&&v<10?`0`:``,v);else if(S===`SEC`)C.push(u.pad&&y<10?`0`:``,y);else if(S===`SUBSEC`){C.push(x.decimal);let e=b.toFixed(t.sec_decimals);C.push(e.slice(2,2+u.decimals))}else if(S===`AMPM`){let e=_<12?0:1;u.short?C.push(`AP`[e]):C.push(x.ampm[e])}else if(S===`HOUR-ELAP`&&typeof e==`number`){e<0&&C.push(x.negative);let t=d*24+Math.floor(Math.abs(f)/3600);C.push(String(Math.abs(t)).padStart(u.pad,`0`))}else if(S===`MIN-ELAP`&&typeof e==`number`){e<0&&C.push(x.negative);let t=d*1440+Math.floor(Math.abs(f)/60);C.push(String(Math.abs(t)).padStart(u.pad,`0`))}else if(S===`SEC-ELAP`&&typeof e==`number`){e<0&&C.push(x.negative);let t=d*ah+Math.abs(f);C.push(String(Math.abs(t)).padStart(u.pad,`0`))}else if(S===`B-YEAR`)C.push(p+543);else if(S===`B-YEAR-SHORT`){let e=(p+543)%100;C.push(e<10?`0`:``,e)}}return C.join(``)}let ch=Wm([{type:kf,value:`@`,raw:`@`}]);function lh(e,t){for(let n=0;n<3;n++){let r=t[n];if(r){let t=!1;if(r.condition){let n=r.condition[0],i=r.condition[1];n===`=`?t=e===i:n===`<>`?t=e!==i:typeof e==`string`?t=!1:n===`>`?t=e>i:n===`<`?t=e<i:n===`>=`?t=e>=i:n===`<=`&&(t=e<=i)}else t=!0;if(t)return r}}}function uh(e,t,n){let r=t.partitions,i=lp(t.locale||n.locale)??fp,a=r[3]?r[3]:ch;if(typeof e==`boolean`&&(e=i.bool[+!e]),e==null)return``;let o=typeof e==`bigint`;if(typeof e!=`number`&&!o)return sh(String(e),a,n,i);if(!o&&!Number.isFinite(e))return Number.isNaN(e)?i.nan:(e<0?i.negative:``)+i.infinity;let s=e,c=lh(s,r);return c?.sysdate&&(c=Ym(i.sysdate??`dd mmmm yyyy`,!1).partitions[0]),c?.systime&&(c=Ym(i.systime??`hh:mm:ss`,!1).partitions[0]),c?sh(s,c,n,i):n.overflow}function dh(e,t,n={}){let r=Object.assign({},pp,n),i=Ym(e,r.throws);return uh(Pp(t,r)??t,i,r)}function fh(e){try{return Ym(e,!0),!0}catch{return!1}}var F=class e{static all=/* @__PURE__ */ new Map;code;constructor(e){this.code=e}static of(t){let n=e.all.get(t);return n||(n=new e(t),e.all.set(t,n)),n}toString(){return this.code}toJSON(){return this.code}};let I={NULL:F.of(`#NULL!`),DIV0:F.of(`#DIV/0!`),VALUE:F.of(`#VALUE!`),REF:F.of(`#REF!`),NAME:F.of(`#NAME?`),NUM:F.of(`#NUM!`),NA:F.of(`#N/A`),SPILL:F.of(`#SPILL!`),CALC:F.of(`#CALC!`),CYCLE:F.of(`#CYCLE!`)},ph=[`#NULL!`,`#DIV/0!`,`#VALUE!`,`#REF!`,`#NAME?`,`#NUM!`,`#N/A`,`#GETTING_DATA`,`#SPILL!`,`#CALC!`,`#CYCLE!`];function mh(e){let t=e.toUpperCase(),n=ph.find(e=>e===t);return n===void 0?void 0:F.of(n)}var L=class{rows;cols;data;constructor(e,t,n){this.rows=e,this.cols=t,this.data=n}at(e,t){return this.data[e*this.cols+t]??null}};let hh=864e5,gh=25569;function _h(e){let t=e+gh;return t<61?t-1:t}function vh(e){let t=Math.floor(e);if(t!==60)return(t<60?t+1:t)-gh}function yh(e,t,n){let r=new Date(Date.UTC(2e3,t-1,1));return r.setUTCFullYear(r.getUTCFullYear()-2e3+e),_h(Math.floor(r.getTime()/hh))+n-1}function bh(e){let t=vh(e);return t===void 0?{year:1900,month:2,day:29}:Math.floor(e)===0?{year:1900,month:1,day:0}:xh(t)}function xh(e){let t=e+719468,n=Math.floor(t/146097),r=t-n*146097,i=Math.floor((r-Math.floor(r/1460)+Math.floor(r/36524)-Math.floor(r/146096))/365),a=r-(365*i+Math.floor(i/4)-Math.floor(i/100)),o=Math.floor((5*a+2)/153),s=a-Math.floor((153*o+2)/5)+1,c=o<10?o+3:o-9;return{year:i+n*400+ +(c<=2),month:c,day:s}}function Sh(e){let t=e.getTime(),n=Math.floor(t/hh);return _h(n)+(t-n*hh)/hh}let Ch=(e,t=2)=>String(e).padStart(t,`0`);function wh(e){if(e===0)return`0`;let t=Number(e.toPrecision(15)),n=Math.floor(Math.log10(Math.abs(t)));if(n>=15||n<-10){let[e=``,n=`0`]=t.toExponential().split(`e`),r=Number(n);return`${e}E${r<0?`-`:`+`}${Ch(Math.abs(r))}`}let r=String(t);return r.includes(`e`)?t.toFixed(Math.min(20,Math.abs(n)+15)).replace(/0+$/u,``):r}let Th=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/u,Eh=/^[+-]?\d{1,3}(?:,\d{3})+(?:\.\d+)?$/u,Dh=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/u,Oh=e=>/^[+-]?\d+$/u.test(e)&&e.replace(/^[+-]?0*/u,``).length>15;function kh(e){let t=Dh.exec(e);if(!t)return;let[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])],a=yh(n,r,i),o=bh(a);if(o.month!==r||o.day!==i)return;if(t[4]===void 0)return{value:a,format:`yyyy-mm-dd`};let[s,c,l]=[Number(t[4]),Number(t[5]),Number(t[6]??0)];if(s>23||c>59||l>59)return;let u=t[7],d=0;if(u!==void 0&&u!==`Z`){let e=u.replace(`:`,``);d=(e.startsWith(`-`)?1:-1)*(Number(e.slice(1,3))*60+Number(e.slice(3,5)))/1440}return{value:a+(s*3600+c*60+l)/86400+d,format:t[6]===void 0?`yyyy-mm-dd hh:mm`:`yyyy-mm-dd hh:mm:ss`}}function Ah(e){let t=/^(\d{1,4}):([0-5]?\d)(?::([0-5]?\d))?(?:\s*([AaPp])[Mm]?)?$/u.exec(e)??/^(\d{1,2})()()\s*([AaPp])[Mm]?$/u.exec(e);if(!t)return;let n=Number(t[1]),r=t[2]===void 0||t[2]===``?0:Number(t[2]),i=t[3]===void 0||t[3]===``?0:Number(t[3]),a=t[4]?.toUpperCase();if(a!==void 0)return n<1||n>12?void 0:{value:((n%12+(a===`P`?12:0))*3600+r*60+i)/86400,format:t[3]?`h:mm:ss AM/PM`:`h:mm AM/PM`};let o=(n*3600+r*60+i)/86400;return n>=24?{value:o,format:`[h]:mm:ss`}:{value:o,format:t[3]?`h:mm:ss`:`h:mm`}}function jh(e){if(e===``)return{value:null};if(e.startsWith(`'`))return{value:e.slice(1)};if(e.length>1&&e.startsWith(`=`))return{value:null,formula:e};let t=e.trim();if(t===``)return{value:e};let n=t.toUpperCase();if(n===`TRUE`)return{value:!0};if(n===`FALSE`)return{value:!1};if(Th.test(t))return Oh(t)?{value:e}:{value:Number(t)};if(t.endsWith(`%`)){let e=t.slice(0,-1).trim();if(Th.test(e))return{value:Number(e)/100,format:e.includes(`.`)?`0.00%`:`0%`}}if(Eh.test(t))return{value:Number(t.replaceAll(`,`,``)),format:t.includes(`.`)?`#,##0.00`:`#,##0`};let r=/^([+-]?)\$(\d[\d,]*(?:\.\d+)?)$/u.exec(t),i=r?.[2]?.replaceAll(`,`,``);if(r&&i!==void 0)return{value:Number(`${r[1]??``}${i}`),format:t.includes(`.`)?`$#,##0.00`:`$#,##0`};let a=kh(t);if(a)return a;let o=Ah(t);if(o)return o;let s=mh(t);return s?{value:s}:{value:e}}function Mh(e){let t=dh(`General`,e),n=[t];for(let r=10;r>=1;r--){let i=dh(`General`,Number(e.toPrecision(r)));i.length<(n[n.length-1]??t).length&&n.push(i)}for(let r=5;r>=0;r--){let i=e.toExponential(r).replace(/e([+-])(\d)$/u,`E$10$2`).replace(/e/u,`E`);i.length<(n[n.length-1]??t).length&&n.push(i)}return n}function Nh(e,t){let n=Mh(e);return t?n.find(t):n[0]}function Ph(e,t){if(e===null)return``;if(e instanceof F)return e.code;if(typeof e==`boolean`)return e?`TRUE`:`FALSE`;let n=t??`General`;if(typeof e==`string`)return t!==void 0&&fh(t)?dh(t,e):e;if(n===`General`||!fh(n))return Nh(e)??wh(e);try{return dh(n,e)}catch{return Nh(e)??wh(e)}}let Fh=e=>{let t=/^#?([0-9a-fA-F]{6})$/u.exec(e)?.[1]??`000000`;return[0,2,4].map(e=>parseInt(t.slice(e,e+2),16)/255)},Ih=e=>Math.ceil(Math.min(1,Math.max(0,e))*255-.5-1e-9).toString(16).padStart(2,`0`).toUpperCase(),Lh=([e,t,n])=>`#${Ih(e??0)}${Ih(t??0)}${Ih(n??0)}`;function Rh([e,t,n]){let r=e??0,i=t??0,a=n??0,o=Math.max(r,i,a),s=Math.min(r,i,a),c=(o+s)/2;if(o===s)return[0,0,c];let l=o-s,u=c>.5?l/(2-o-s):l/(o+s);return[o===r?((i-a)/l+(i<a?6:0))*60:o===i?((a-r)/l+2)*60:((r-i)/l+4)*60,u,c]}function zh([e,t,n]){let r=((e??0)%360+360)%360,i=t??0,a=n??0;if(i===0)return[a,a,a];let o=a<.5?a*(1+i):a+i-a*i,s=2*a-o,c=e=>{let t=(e%1+1)%1;return t<1/6?s+(o-s)*6*t:t<1/2?o:t<2/3?s+(o-s)*(2/3-t)*6:s};return[c(r/360+1/3),c(r/360),c(r/360-1/3)]}let Bh=1e5;function Vh(e){let t=Math.round(e*Bh);return t>0?{lumMod:Bh-t,lumOff:t}:{lumMod:Bh+t}}function Hh(e,t){let{lumMod:n,lumOff:r=0}=Vh(t);return Math.min(1,Math.max(0,(e*n+r)/Bh))}function Uh(e,t){if(t===0)return Lh(Fh(e));let[n,r,i]=Rh(Fh(e));return Lh(zh([n,r,Hh(i,t)]))}let Wh=2.3,Gh=e=>e**Wh,Kh=e=>Math.max(0,e)**(1/Wh),qh=e=>Math.min(1,Math.max(0,e));function Jh(e,t,n=0){let r=n/1e5,i=e.rgb,a=e.alpha;if(t.startsWith(`alpha`))return a=t===`alpha`?r:t===`alphaMod`?a*r:a+r,{rgb:i,alpha:qh(a)};switch(t){case`tint`:i=i.map(e=>Kh(1-(1-Gh(e))*r));break;case`shade`:i=i.map(e=>Kh(Gh(e)*r));break;case`inv`:i=i.map(e=>Kh(1-Gh(e)));break;case`gamma`:i=i.map(e=>Kh(Gh(e)**(1/Wh)));break;case`invGamma`:i=i.map(e=>Kh(Gh(e)**Wh));break;case`comp`:{let[e,t,n]=Rh(i);i=zh([e+180,t,n]);break}case`gray`:{let e=.299*i[0]+.587*i[1]+.114*i[2];i=[e,e,e];break}case`red`:case`green`:case`blue`:case`redMod`:case`greenMod`:case`blueMod`:case`redOff`:case`greenOff`:case`blueOff`:{let e=t.startsWith(`red`)?0:t.startsWith(`green`)?1:2,n=i.map(Gh);n[e]=qh(t.endsWith(`Mod`)?n[e]*r:t.endsWith(`Off`)?n[e]+r:r),i=n.map(Kh);break}case`hue`:case`hueMod`:case`hueOff`:case`sat`:case`satMod`:case`satOff`:case`lum`:case`lumMod`:case`lumOff`:{let e=Rh(i),a=t.startsWith(`hue`)?0:t.startsWith(`sat`)?1:2,o=a===0&&t!==`hueMod`?n/6e4:r,s=e[a],c=t.endsWith(`Mod`)?s*r:t.endsWith(`Off`)?s+o:o;e[a]=a===0?(c%360+360)%360:qh(c),i=zh(e);break}}return{rgb:i,alpha:a}}let Yh={tx1:`dk1`,bg1:`lt1`,tx2:`dk2`,bg2:`lt2`},Xh=(e,t)=>t[e]??(e in Yh?t[Yh[e]]:`#000000`),Zh=/* @__PURE__ */ new Set([`hue`,`hueOff`]),Qh=e=>Math.round(e.value*(Zh.has(e.name)?6e4:1e5));function $h(e,t){let n=typeof e==`string`?Xh(e,t):`rgb`in e?e.rgb:`brightness`in e?Uh(Xh(e.theme_color,t),e.brightness):Xh(e.theme_color,t),r=typeof e==`string`||`brightness`in e?[]:e.transforms,i={rgb:Fh(n),alpha:1};for(let e of r??[])i=Jh(i,e.name,Qh(e));return i}function eg(e,t){if(typeof e==`string`)return Xh(e,t);if(`rgb`in e&&!e.transforms?.length)return e.rgb;if(`brightness`in e)return Uh(Xh(e.theme_color,t),e.brightness);let{rgb:n,alpha:r}=$h(e,t),i=Lh(n);return r>=1?i:`${i}${Math.round(r*255).toString(16).padStart(2,`0`).toUpperCase()}`}let tg=e=>{let t=/^#([0-9A-Fa-f]{6})$/u.exec(e.trim());return t?.[1]===void 0?void 0:Number.parseInt(t[1],16)};function ng(e,t,n){let r=tg(e),i=tg(t);if(r===void 0||i===void 0)return e;let a=(e,t)=>e>>t&255;return`#${[16,8,0].map(e=>Math.round(a(r,e)*n+a(i,e)*(1-n))).map(e=>e.toString(16).padStart(2,`0`)).join(``).toUpperCase()}`}function rg(e){let t=tg(e);if(t===void 0)return 1;let n=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*n(t>>16&255)+.7152*n(t>>8&255)+.0722*n(t&255)}function ig(e,t){let[n,r]=[rg(e),rg(t)].sort((e,t)=>t-e);return((n??0)+.05)/((r??0)+.05)}function ag(e,t){if(!e.startsWith(`#`)||!t.startsWith(`#`))return e;for(let n=1;n>.2;n-=.04){let r=ng(e,`#FFFFFF`,n);if(ig(r,t)>=3)return r}return ng(e,`#FFFFFF`,.2)}function og(e){if(!e.startsWith(`#`))return e;for(let t=1;t>.4;t-=.03){let n=ng(e,`#000000`,t);if(ig(`#FFFFFF`,n)>=4.5)return n}return ng(e,`#000000`,.4)}function sg(e){if(!e.startsWith(`#`))return`#FFFFFF`;let t=ig(`#FFFFFF`,e);return t>=4.5?`#FFFFFF`:ig(`#151515`,e)>t?`#151515`:`#FFFFFF`}function cg(e,t,n,r,i=.7){for(let a=1;a>=1-i;a-=.02){let i=ng(e,t,a);if(ig(i,n)>=r)return i}return ng(e,t,1-i)}function lg(e){let t=e=>{let t=ng(e,`#FFFFFF`,.14);return{mark:cg(e,`#000000`,`#FFFFFF`,4.5),tint:t,ink:cg(e,`#000000`,t,8,.85),dark:cg(e,`#FFFFFF`,`#151515`,5.5,.85)}};return{...$c,info:t(e.accent1),neutral:t(ng(e.dk1,e.lt1,.62))}}function ug(e=lf,t={}){let n=t.dark??(t.ground!==void 0&&rg(t.ground)<.4),r=n?e.lt1:e.dk1,i=t.ground??(n?e.dk1:e.lt1);return{roles:{text:r,body:r,muted:ng(r,i,.62),ground:i,surface:i,well:n?ng(r,i,.08):ng(e.lt2,i,.5),rule:ng(r,i,.15),"rule-strong":ng(r,i,.4),accent1:e.accent1,accent2:e.accent2,accent3:e.accent3,accent4:e.accent4,accent5:e.accent5,accent6:e.accent6,deep:e.dk2},dark:n,theme:e,font:t.font??`Inter, "Noto Sans SC", Carlito, Calibri, Arial, sans-serif`,tones:lg(e)}}function dg(e,t){if(e.startsWith(`on:`)){let n=dg(e.slice(3),t);return n.startsWith(`#`)?sg(n):`#FFFFFF`}let n=/^(.+)~(\d{1,3})$/u.exec(e);if(n){let e=dg(n[1]??``,t),r=t.roles.ground.startsWith(`#`)?t.roles.ground:t.dark?t.theme.dk1:t.theme.lt1;return e.startsWith(`#`)?ng(e,r,Math.min(100,Number(n[2]))/100):t.roles.well}if(e===`stripe`){let{text:e,ground:n,well:r}=t.roles;return t.dark&&e.startsWith(`#`)&&n.startsWith(`#`)?ng(e,n,.04):r}if(e.endsWith(`~tint`)){let n=dg(e.slice(0,-5),t),r=t.roles.ground.startsWith(`#`)?t.roles.ground:t.dark?t.theme.dk1:t.theme.lt1;return n.startsWith(`#`)?ng(n,r,.14):t.roles.well}let r=al(e);if(r!==void 0&&!e.includes(` `)){let e=t.roles[r];return t.dark&&/^accent[1-6]$/u.test(r)?ag(e,t.roles.ground):e}if(e===`accent-ground`)return og(dg(`accent1`,t));if(e===`on-accent`)return sg(og(dg(`accent1`,t)));if(e===`on-deep`)return sg(dg(`deep`,t));if(e.startsWith(`#`))return e.toUpperCase();let i=/^([a-z]+)(?:-(tint|ink))?$/u.exec(e);if(i){let e=i[1]??``,n=i[2],r=Object.keys($c).find(t=>t===e);if(r!==void 0){let e=t.tones[r];if(t.dark){let r=t.roles.ground.startsWith(`#`)?t.roles.ground:t.theme.dk1;return n===`tint`?ng(e.dark,r,.18):e.dark}return n===`tint`?e.tint:n===`ink`?e.ink:e.mark}if(el.includes(e)){let t=tl[e];if(t!==void 0)return n===`tint`?t.tint:t.mark}}let a=id(e);return a===void 0?e:eg(a,t.theme)}function fg(e,t,n){let r=gu(`heatmap`,t??{}),i=r.problems.filter(e=>!e.message.includes(`has values, or data`)).map(e=>`${e.path.length>0?`${e.path.join(`.`)}: `:``}${e.message}`),a=r.block?.fields??{},o=typeof a.data==`string`?a.data.trim():void 0,s=o===void 0?e:o.replace(/^=/u,``),c=ug(n??lf),l=typeof a.color==`string`?a.color:`accent1`,u=e=>{let t=dg(e,c);return/^#[0-9A-Fa-f]{6}$/u.test(t)?t.toUpperCase():`#4472C4`},d=typeof a.mid==`number`?a.mid:void 0,f=typeof a.low_color==`string`?a.low_color:d===void 0?void 0:`accent2`,p=e=>typeof a[e]==`number`?{at:`num`,value:a[e]}:{at:e};return{rule:{range:s,type:`colorScale`,stops:f===void 0?[{...p(`min`),color:u(`${l}~6`)},{...p(`max`),color:u(l)}]:[{...p(`min`),color:u(f)},{at:`num`,value:d??0,color:u(`ground`)},{...p(`max`),color:u(l)}]},problems:i}}var R=class{sheet;top;left;bottom;right;constructor(e,t,n,r,i){this.sheet=e,this.top=t,this.left=n,this.bottom=r,this.right=i}get rows(){return this.bottom-this.top+1}get cols(){return this.right-this.left+1}get single(){return this.top===this.bottom&&this.left===this.right}get key(){return`${String(this.sheet.index)}!${String(this.top)},${String(this.left)}:${String(this.bottom)},${String(this.right)}`}},pg=class{parts;constructor(e){this.parts=e}},mg=class{params;body;frame;named;constructor(e,t,n,r){this.params=e,this.body=t,this.frame=n,this.named=r}},hg=class{missing=!0};let gg=new hg;function _g(e,t){for(let n of t)e.push(n)}let vg=e=>`${e.abs?`$`:``}${f(e.index)}`,yg=e=>`${e.abs?`$`:``}${String(e.index+1)}`;function bg(e,t){let n=t===void 0?e:`${e}:${t}`;return/^[\p{L}_][\p{L}\p{N}_.]*$/u.test(e)&&!/^[A-Za-z]{1,3}\d+$/u.test(e)&&!/^(?:TRUE|FALSE)$/iu.test(e)&&(t===void 0||/^[\p{L}_][\p{L}\p{N}_.]*$/u.test(t))?`${n}!`:`'${n.replaceAll(`'`,`''`)}'!`}function xg(e){let t=e.sheet===void 0?``:bg(e.sheet,e.lastSheet);if(e.row===void 0&&e.col&&e.col2)return`${t}${vg(e.col)}:${vg(e.col2)}`;if(e.col===void 0&&e.row&&e.row2)return`${t}${yg(e.row)}:${yg(e.row2)}`;if(!e.col||!e.row)return`${t}#REF!`;let n=`${vg(e.col)}${yg(e.row)}`;return e.col2&&e.row2?`${t}${n}:${vg(e.col2)}${yg(e.row2)}`:`${t}${n}`}let Sg=e=>e.replace(/([[\]#'@])/gu,`'$1`),Cg=e=>/^[\p{L}\p{N}_]+$/u.test(e);function wg(e){let t=e.table??``,[n,r]=e.columns,i=e.columns.map(e=>`[${Sg(e)}]`).join(`:`);if(e.sections.length===0)return e.thisRow?n===void 0?`${t}[@]`:r===void 0?`${t}[@${Cg(n)?Sg(n):i}]`:`${t}[@${i}]`:n===void 0?t===``?`[]`:t:r===void 0?`${t}[${Sg(n)}]`:`${t}[${i}]`;if(n===void 0&&e.sections.length===1)return`${t}[${e.sections[0]??``}]`;let a=e.sections.map(e=>`[${e}]`);return i!==``&&a.push(i),`${t}[${a.join(`,`)}]`}function Tg(e){let{before:t=``,after:n=``}=e.space??{};return`${t}${Eg(e)}${n}`}function Eg(e){let t=e.space?.inner??``;switch(e.kind){case`number`:return e.raw;case`string`:return`"${e.value.replaceAll(`"`,`""`)}"`;case`boolean`:return e.value?`TRUE`:`FALSE`;case`error`:return`${e.sheet===void 0?``:bg(e.sheet)}${e.code}`;case`missing`:return``;case`ref`:return xg(e);case`structured`:return wg(e);case`name`:return`${e.sheet===void 0?``:bg(e.sheet)}${e.name}`;case`unary`:return`${e.op}${Tg(e.arg)}`;case`postfix`:return`${Tg(e.arg)}${e.op}`;case`binary`:return`${Tg(e.left)}${t}${e.op}${Tg(e.right)}`;case`call`:return`${e.written}(${e.args.map(Tg).join(`,`)}${t})`;case`invoke`:return`${Tg(e.callee)}(${e.args.map(Tg).join(`,`)}${t})`;case`array`:return`{${e.rows.map(e=>e.map(Tg).join(`,`)).join(`;`)}}`;case`paren`:return`(${Tg(e.arg)}${t})`}}let Dg=e=>`=${Tg(e)}`;function Og(e){let t=e.lastIndexOf(`!`),n=t<0?void 0:e.slice(0,t),r=n===void 0?void 0:/^'.*'$/u.test(n)?n.slice(1,-1).replaceAll(`''`,`'`):n,i=_((t<0?e:e.slice(t+1)).replace(/\$/gu,``));return i===void 0?void 0:{...r===void 0?{}:{sheet:r},area:i}}function kg(e,t){let n=_(t.at.replace(/\$/gu,``)),r=Og(t.data.replace(/^=/u,``));if(n===void 0)return{problem:`${t.at} is not a cell or a range of cells`};if(r===void 0)return{problem:`${t.data} is not a range`};let i=bg(r.sheet??e),a=r.area,o=a.bottom-a.top+1,s=a.right-a.left+1,c=[],l=[];for(let e=n.top;e<=n.bottom;e++)for(let t=n.left;t<=n.right;t++)l.push({row:e,col:t});if(l.length===1){let e=l[0];return e===void 0?{problem:`${t.at} is no cell`}:o>1&&s>1?{problem:`one cell draws a row or a column of values, not ${t.data}; for a block of rows, at is a column of cells, one a row`}:{cells:[{...e,data:i+h(a)}]}}let u=n.left===n.right,d=n.top===n.bottom;if(u&&l.length===o)l.forEach((e,t)=>{c.push({...e,data:i+h({...a,top:a.top+t,bottom:a.top+t})})});else if(d&&l.length===s)l.forEach((e,t)=>{c.push({...e,data:i+h({...a,left:a.left+t,right:a.left+t})})});else return{problem:`${t.at} has ${String(l.length)} cells, and ${t.data} ${String(o)} rows and ${String(s)} columns: a column of cells draws a row of the data each, a row of cells a column each`};return{cells:c}}
|
|
123
|
+
/*! js-yaml 5.4.1 https://github.com/nodeca/js-yaml @license MIT */
|
|
124
|
+
var Ag=Symbol(`NOT_RESOLVED`);function jg(e,t){return{tagName:e,nodeKind:`scalar`,implicit:t.implicit??!1,matchByTagPrefix:t.matchByTagPrefix??!1,implicitFirstChars:t.implicitFirstChars??null,resolve:t.resolve,identify:t.identify,represent:t.represent??(e=>String(e)),representTagName:t.representTagName??(()=>e)}}function Mg(e,t){let n=t.finalize===void 0;return{tagName:e,nodeKind:`sequence`,implicit:!1,matchByTagPrefix:t.matchByTagPrefix??!1,create:t.create,addItem:t.addItem,finalize:t.finalize??(e=>e),carrierIsResult:n,identify:t.identify,represent:t.represent??(e=>e),representTagName:t.representTagName??(()=>e)}}function Ng(e,t){let n=t.finalize===void 0;return{tagName:e,nodeKind:`mapping`,implicit:!1,matchByTagPrefix:t.matchByTagPrefix??!1,create:t.create,addPair:t.addPair,has:t.has,keys:t.keys,get:t.get,finalize:t.finalize??(e=>e),carrierIsResult:n,identify:t.identify,represent:t.represent??(e=>e),representTagName:t.representTagName??(()=>e)}}var Pg=jg(`tag:yaml.org,2002:str`,{resolve:e=>e,identify:e=>typeof e==`string`}),Fg=[``,`~`,`null`,`Null`,`NULL`],Ig=jg(`tag:yaml.org,2002:null`,{implicit:!0,implicitFirstChars:[``,`~`,`n`,`N`],resolve:e=>Fg.indexOf(e)===-1?Ag:null,identify:e=>e===null,represent:()=>`null`}),Lg=jg(`tag:yaml.org,2002:null`,{implicit:!0,implicitFirstChars:[`n`],resolve:(e,t)=>e===`null`||t&&e===``?null:Ag,identify:e=>e===null,represent:()=>`null`}),Rg=[``,`~`,`null`,`Null`,`NULL`],zg=jg(`tag:yaml.org,2002:null`,{implicit:!0,implicitFirstChars:[``,`~`,`n`,`N`],resolve:e=>Rg.indexOf(e)===-1?Ag:null,identify:e=>e===null,represent:()=>`null`}),Bg=[`true`,`True`,`TRUE`],Vg=[`false`,`False`,`FALSE`],Hg=jg(`tag:yaml.org,2002:bool`,{implicit:!0,implicitFirstChars:[`t`,`T`,`f`,`F`],resolve:e=>Bg.indexOf(e)!==-1||Vg.indexOf(e)===-1&&Ag,identify:e=>Object.prototype.toString.call(e)===`[object Boolean]`,represent:e=>e?`true`:`false`}),Ug=[`true`],Wg=[`false`],Gg=jg(`tag:yaml.org,2002:bool`,{implicit:!0,implicitFirstChars:[`t`,`f`],resolve:e=>Ug.indexOf(e)!==-1||Wg.indexOf(e)===-1&&Ag,identify:e=>Object.prototype.toString.call(e)===`[object Boolean]`,represent:e=>e?`true`:`false`}),Kg=[`true`,`True`,`TRUE`,`y`,`Y`,`yes`,`Yes`,`YES`,`on`,`On`,`ON`],qg=[`false`,`False`,`FALSE`,`n`,`N`,`no`,`No`,`NO`,`off`,`Off`,`OFF`],Jg=jg(`tag:yaml.org,2002:bool`,{implicit:!0,implicitFirstChars:[`y`,`Y`,`n`,`N`,`t`,`T`,`f`,`F`,`o`,`O`],resolve:e=>Kg.indexOf(e)!==-1||qg.indexOf(e)===-1&&Ag,identify:e=>Object.prototype.toString.call(e)===`[object Boolean]`,represent:e=>e?`true`:`false`}),Yg=/* @__PURE__ */ RegExp(`^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$`),Xg=/* @__PURE__ */ RegExp(`^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$`);function Zg(e){let t=e,n=1;return(t[0]===`-`||t[0]===`+`)&&(t[0]===`-`&&(n=-1),t=t.slice(1)),t.startsWith(`0b`)?n*parseInt(t.slice(2),2):t.startsWith(`0o`)?n*parseInt(t.slice(2),8):t.startsWith(`0x`)?n*parseInt(t.slice(2),16):n*parseInt(t,10)}function Qg(e,t){if(t){if(!Xg.test(e))return Ag}else if(!Yg.test(e))return Ag;let n=Zg(e);return Number.isFinite(n)?n:Ag}var $g=jg(`tag:yaml.org,2002:int`,{implicit:!0,implicitFirstChars:[`-`,`+`,...`0123456789`],resolve:Qg,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf(`e`)<0,represent:e=>e.toString(10)}),e_=/* @__PURE__ */ RegExp(`^-?(?:0|[1-9][0-9]*)$`),t_=/* @__PURE__ */ RegExp(`^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$`);function n_(e){let t=e,n=1;return(t[0]===`-`||t[0]===`+`)&&(t[0]===`-`&&(n=-1),t=t.slice(1)),t.startsWith(`0b`)?n*parseInt(t.slice(2),2):t.startsWith(`0o`)?n*parseInt(t.slice(2),8):t.startsWith(`0x`)?n*parseInt(t.slice(2),16):n*parseInt(t,10)}function r_(e,t){if(t){if(!t_.test(e))return Ag}else if(!e_.test(e))return Ag;let n=n_(e);return Number.isFinite(n)?n:Ag}var i_=jg(`tag:yaml.org,2002:int`,{implicit:!0,implicitFirstChars:[`-`,...`0123456789`],resolve:r_,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf(`e`)<0,represent:e=>e.toString(10)}),a_=/* @__PURE__ */ RegExp(`^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$`);function o_(e){let t=e.replace(/_/g,``),n=1;if((t[0]===`-`||t[0]===`+`)&&(t[0]===`-`&&(n=-1),t=t.slice(1)),t.startsWith(`0b`))return n*parseInt(t.slice(2),2);if(t.startsWith(`0x`))return n*parseInt(t.slice(2),16);if(t.includes(`:`)){let e=0;for(let n of t.split(`:`))e=e*60+Number(n);return n*e}return t!==`0`&&t[0]===`0`?n*parseInt(t,8):n*parseInt(t,10)}function s_(e){if(!a_.test(e))return Ag;let t=o_(e);return Number.isFinite(t)?t:Ag}var c_=jg(`tag:yaml.org,2002:int`,{implicit:!0,implicitFirstChars:[`-`,`+`,...`0123456789`],resolve:s_,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf(`e`)<0,represent:e=>e.toString(10)}),l_=/* @__PURE__ */ RegExp(`^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`),u_=/* @__PURE__ */ RegExp(`^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`);function d_(e){if(!l_.test(e))return Ag;let t=e.toLowerCase(),n=t[0]===`-`?-1:1;if(`+-`.includes(t[0])&&(t=t.slice(1)),t===`.inf`)return n===1?1/0:-1/0;if(t===`.nan`)return NaN;let r=n*parseFloat(t);return Number.isFinite(r)||u_.test(e)?r:Ag}function f_(e){if(isNaN(e))return`.nan`;if(e===1/0)return`.inf`;if(e===-1/0)return`-.inf`;if(Object.is(e,-0))return`-0.0`;let t=e.toString(10);return/^[-+]?[0-9]+e/.test(t)?t.replace(`e`,`.e`):t}var p_=jg(`tag:yaml.org,2002:float`,{implicit:!0,implicitFirstChars:[`-`,`+`,`.`,...`0123456789`],resolve:d_,identify:e=>typeof e==`number`&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf(`e`)>=0),represent:f_}),m_=/* @__PURE__ */ RegExp(`^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$`),h_=/* @__PURE__ */ RegExp(`^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`);function g_(e,t){if(t){if(!h_.test(e))return Ag;let t=e.toLowerCase(),n=t[0]===`-`?-1:1;if(`+-`.includes(t[0])&&(t=t.slice(1)),t===`.inf`)return n===1?1/0:-1/0;if(t===`.nan`)return NaN;let r=n*parseFloat(t);return Number.isFinite(r)?r:Ag}if(!m_.test(e))return Ag;let n=Number(e);return Number.isFinite(n)?n:Ag}function __(e){if(isNaN(e))return`.nan`;if(e===1/0)return`.inf`;if(e===-1/0)return`-.inf`;if(Object.is(e,-0))return`-0.0`;let t=e.toString(10);return/^[-+]?[0-9]+e/.test(t)?t.replace(`e`,`.e`):t}var v_=jg(`tag:yaml.org,2002:float`,{implicit:!0,implicitFirstChars:[`-`,...`0123456789`],resolve:g_,identify:e=>typeof e==`number`&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf(`e`)>=0),represent:__}),y_=/* @__PURE__ */ RegExp(`^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`),b_=/* @__PURE__ */ RegExp(`^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`);function x_(e){if(!y_.test(e))return Ag;let t=e.toLowerCase().replace(/_/g,``),n=t[0]===`-`?-1:1;if(`+-`.includes(t[0])&&(t=t.slice(1)),t===`.inf`)return n===1?1/0:-1/0;if(t===`.nan`)return NaN;let r=0;if(t.includes(`:`)){for(let e of t.split(`:`))r=r*60+Number(e);r*=n}else r=n*parseFloat(t);return Number.isFinite(r)||b_.test(e)?r:Ag}function S_(e){if(isNaN(e))return`.nan`;if(e===1/0)return`.inf`;if(e===-1/0)return`-.inf`;if(Object.is(e,-0))return`-0.0`;let t=e.toString(10);return/^[-+]?[0-9]+e/.test(t)?t.replace(`e`,`.e`):t}var C_=jg(`tag:yaml.org,2002:float`,{implicit:!0,implicitFirstChars:[`-`,`+`,`.`,...`0123456789`],resolve:x_,identify:e=>typeof e==`number`&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf(`e`)>=0),represent:S_}),w_=jg(`tag:yaml.org,2002:merge`,{implicit:!0,implicitFirstChars:[`<`],resolve:(e,t)=>e===`<<`||t&&e===``?`<<`:Ag,identify:()=>!1}),T_=/^[A-Za-z0-9+/]*={0,2}$/;function E_(e){let t=e.replace(/\s/g,``);if(t.length%4!=0||!T_.test(t))return Ag;let n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r}function D_(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}var O_=jg(`tag:yaml.org,2002:binary`,{resolve:E_,identify:e=>Object.prototype.toString.call(e)===`[object Uint8Array]`,represent:D_}),k_=/* @__PURE__ */ RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$`),A_=/* @__PURE__ */ RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$`);function j_(e,t,n,r=0,i=0,a=0,o=0){let s=new Date(Date.UTC(e,t,n,r,i,a,o));return s.setUTCFullYear(e,t,n),s}function M_(e){let t=k_.exec(e);if(t===null&&(t=A_.exec(e)),t===null)return Ag;let n=+t[1],r=t[2]-1,i=+t[3];if(!t[4]){let e=j_(n,r,i);return e.getUTCFullYear()!==n||e.getUTCMonth()!==r||e.getUTCDate()!==i?Ag:e}let a=+t[4],o=+t[5],s=+t[6],c=0;if(a>23||o>59||s>59)return Ag;if(t[7]){let e=t[7].slice(0,3);for(;e.length<3;)e+=`0`;c=+e}let l=j_(n,r,i,a,o,s,c);if(l.getUTCFullYear()!==n||l.getUTCMonth()!==r||l.getUTCDate()!==i)return Ag;if(t[9]){let e=+t[10],n=+(t[11]||0);if(e>23||n>59)return Ag;let r=(e*60+n)*6e4;l.setTime(l.getTime()-(t[9]===`-`?-r:r))}return l}var N_=jg(`tag:yaml.org,2002:timestamp`,{implicit:!0,implicitFirstChars:[...`0123456789`],resolve:M_,identify:e=>e instanceof Date,represent:e=>e.toISOString()}),P_=Mg(`tag:yaml.org,2002:seq`,{create:()=>[],addItem:(e,t)=>{e.push(t)},identify:Array.isArray});function F_(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}var I_=Mg(`tag:yaml.org,2002:omap`,{create:()=>({list:[],seen:/* @__PURE__ */ new Set}),addItem:(e,t)=>{let n;if(t instanceof Map){if(t.size!==1)return`cannot resolve an ordered map item`;n=t.keys().next().value}else if(F_(t)){let e=Object.keys(t);if(e.length!==1)return`cannot resolve an ordered map item`;n=e[0]}else return`cannot resolve an ordered map item`;return e.seen.has(n)?`duplicate key in ordered map`:(e.seen.add(n),e.list.push(t),``)},finalize:e=>e.list,identify:()=>!1}),L_=Mg(`tag:yaml.org,2002:pairs`,{create:()=>[],addItem:(e,t)=>{if(t instanceof Map)return t.size===1?(e.push(t.entries().next().value),``):`cannot resolve a pairs item`;if(Object.prototype.toString.call(t)!==`[object Object]`)return`cannot resolve a pairs item`;let n=t,r=Object.keys(n);return r.length===1?(e.push([r[0],n[r[0]]]),``):`cannot resolve a pairs item`},identify:()=>!1}),R_=Ng(`tag:yaml.org,2002:map`,{create:()=>({}),identify:F_,represent:e=>{let t=/* @__PURE__ */ new Map;for(let n of Object.keys(e))t.set(n,e[n]);return t},addPair:(e,t,n)=>{if(typeof t==`object`&&t)return`object-based map does not support complex keys`;let r=String(t);return r===`__proto__`?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,``},has:(e,t)=>typeof t==`object`&&t?!1:Object.prototype.hasOwnProperty.call(e,String(t)),keys:e=>Object.keys(e),get:(e,t)=>{let n=String(t);return Object.prototype.hasOwnProperty.call(e,n)?e[n]:null}}),z_=Ng(`tag:yaml.org,2002:set`,{create:()=>/* @__PURE__ */ new Set,identify:e=>e instanceof Set,represent:e=>{let t=/* @__PURE__ */ new Map;for(let n of e)t.set(n,null);return t},addPair:(e,t,n)=>n===null?(e.add(t),``):`cannot resolve a set item`,has:(e,t)=>e.has(t),keys:e=>e.keys(),get:()=>null});function B_(){return{scalar:Object.create(null),sequence:Object.create(null),mapping:Object.create(null)}}function V_(){return{scalar:[],sequence:[],mapping:[]}}function H_(e){let t=[];for(let n of e){let e=t.length;for(let r=0;r<t.length;r++){let i=t[r];if(i.nodeKind===n.nodeKind&&i.tagName===n.tagName&&i.matchByTagPrefix===n.matchByTagPrefix){e=r;break}}t[e]=n}return t}var U_=class e{tags;implicitScalarTags;implicitScalarByFirstChar;implicitScalarAnyFirstChar;defaultScalarTag;defaultSequenceTag;defaultMappingTag;exact;prefix;constructor(e){let t=H_(e),n=[],r=B_(),i=V_();for(let e of t){if(e.nodeKind===`scalar`&&e.implicit){if(e.matchByTagPrefix)throw Error(`Implicit scalar tags cannot match by tag prefix`);n.push(e)}switch(e.nodeKind){case`scalar`:e.matchByTagPrefix?i.scalar.push(e):r.scalar[e.tagName]=e;break;case`sequence`:e.matchByTagPrefix?i.sequence.push(e):r.sequence[e.tagName]=e;break;case`mapping`:e.matchByTagPrefix?i.mapping.push(e):r.mapping[e.tagName]=e}}let a=n.filter(e=>e.implicitFirstChars===null),o=/* @__PURE__ */ new Set;for(let e of n)if(e.implicitFirstChars!==null)for(let t of e.implicitFirstChars)o.add(t);let s=/* @__PURE__ */ new Map;for(let e of o)s.set(e,n.filter(t=>t.implicitFirstChars===null||t.implicitFirstChars.indexOf(e)!==-1));let c=r.scalar[`tag:yaml.org,2002:str`];if(!c)throw Error(`schema does not define the default scalar tag (tag:yaml.org,2002:str)`);this.tags=t,this.implicitScalarTags=n,this.implicitScalarByFirstChar=s,this.implicitScalarAnyFirstChar=a,this.defaultScalarTag=c,this.defaultSequenceTag=r.sequence[`tag:yaml.org,2002:seq`],this.defaultMappingTag=r.mapping[`tag:yaml.org,2002:map`],this.exact=r,this.prefix=i}lookupScalarTag(e){let t=this.exact.scalar[e];if(t)return t;for(let t of this.prefix.scalar)if(e.startsWith(t.tagName))return t}lookupSequenceTag(e){let t=this.exact.sequence[e];if(t)return t;for(let t of this.prefix.sequence)if(e.startsWith(t.tagName))return t}lookupMappingTag(e){let t=this.exact.mapping[e];if(t)return t;for(let t of this.prefix.mapping)if(e.startsWith(t.tagName))return t}resolveImplicitScalarTag(e){let t=this.implicitScalarByFirstChar.get(e.charAt(0))??this.implicitScalarAnyFirstChar;for(let n of t){let t=n.resolve(e,!1,n.tagName);if(t!==Ag)return{value:t,tag:n}}let n=this.defaultScalarTag;return{value:n.resolve(e,!1,n.tagName),tag:n}}withTags(...t){let n=[];for(let e of t)n=n.concat(e);return new e([...this.tags,...n])}},W_=new U_([Pg,P_,R_]);new U_([...W_.tags,Lg,Gg,i_,v_]);var G_=new U_([...W_.tags,Ig,Hg,$g,p_]);new U_([...W_.tags,zg,Jg,c_,C_,N_,w_,O_,I_,L_,z_]).withTags({...c_,resolve:(e,t,n)=>{let r=c_.resolve(e,t,n);return r===Ag?$g.resolve(e,t,n):r}},{...C_,resolve:(e,t,n)=>{let r=C_.resolve(e,t,n);return r===Ag?p_.resolve(e,t,n):r}}),Ng(`tag:yaml.org,2002:map`,{create:()=>/* @__PURE__ */ new Map,addPair:(e,t,n)=>(e.set(t,n),``),has:(e,t)=>e.has(t),keys:e=>e.keys(),get:(e,t)=>e.get(t),identify:e=>e instanceof Map||F_(e),represent:e=>{if(e instanceof Map)return e;let t=/* @__PURE__ */ new Map,n=e;for(let e of Object.keys(n))t.set(e,n[e]);return t}});function K_(e){if(Array.isArray(e)){let t=Array.prototype.slice.call(e);for(let e=0;e<t.length;e++){if(Array.isArray(t[e]))return null;typeof t[e]==`object`&&Object.prototype.toString.call(t[e])===`[object Object]`&&(t[e]=`[object Object]`)}return String(t)}return typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`?`[object Object]`:String(e)}Ng(`tag:yaml.org,2002:map`,{create:()=>({}),identify:F_,represent:e=>{let t=/* @__PURE__ */ new Map;for(let n of Object.keys(e))t.set(n,e[n]);return t},addPair:(e,t,n)=>{let r=K_(t);return r===null?`nested arrays are not supported inside keys`:(r===`__proto__`?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,``)},has:(e,t)=>{let n=K_(t);return n!==null&&Object.prototype.hasOwnProperty.call(e,n)},keys:e=>Object.keys(e),get:(e,t)=>{let n=String(t);return Object.prototype.hasOwnProperty.call(e,n)?e[n]:null}});var q_={DOCUMENT:1,SEQUENCE:2,MAPPING:3,SCALAR:4,ALIAS:5,POP:6},J_={PLAIN:1,SINGLE_QUOTED:2,DOUBLE_QUOTED:3,LITERAL_BLOCK:4,FOLDED_BLOCK:5},Y_={BLOCK:1,FLOW:2},X_={CLIP:1,STRIP:2,KEEP:3};function Z_(e){switch(e){case 48:return`\0`;case 97:return`\x07`;case 98:return`\b`;case 116:return` `;case 9:return` `;case 110:return`
|
|
125
|
+
`;case 118:return`\v`;case 102:return`\f`;case 114:return`\r`;case 101:return`\x1B`;case 32:return` `;case 34:return`"`;case 47:return`/`;case 92:return`\\`;case 78:return`
`;case 95:return`\xA0`;case 76:return`\u2028`;case 80:return`\u2029`;default:return``}}var Q_=Array(256),$_=Array(256);for(let e=0;e<256;e++)Q_[e]=+!!Z_(e),$_[e]=Z_(e);Object.assign(Object.create(null),{"!":`!`,"!!":`tag:yaml.org,2002:`});var ev={filename:``,schema:G_,json:!1,maxTotalMergeKeys:1e4,maxAliases:-1},tv=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`,nv=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`;RegExp(`^(?:${tv})*$`),RegExp(`^(?:${nv})+$`),RegExp(`^(?:!(?:${tv})*|${nv}(?:${tv})*)$`),{...ev};function rv(e,t){return!!(e&1<<t)}var iv={applyQuoteFlowKeysOption:ov,doubleQuoteForInvisibles:sv,doubleQuoteWhitespaceOnly:cv,applyForceQuotesOption:lv,tryLongOrMultilineAsBlock:uv,quoteInvalidPlain:dv,fallbackToDoubleQuoted:fv};function av(e){return e.presenterOptions.quoteStyle===`single`&&rv(e.allowedStylesMask,J_.SINGLE_QUOTED)?J_.SINGLE_QUOTED:J_.DOUBLE_QUOTED}function ov(e){e.presenterOptions.quoteFlowKeys&&e.isKey&&e.flowOnly&&e.style===J_.PLAIN&&(e.style=J_.DOUBLE_QUOTED)}function sv(e){e.style===J_.PLAIN&&/[\t\x7F-\xA0\u2028\u2029\uFEFF\uFFFE\uFFFF]/.test(e.node.value)&&(e.style=J_.DOUBLE_QUOTED)}function cv(e){e.style===J_.PLAIN&&/^\s+$/.test(e.node.value)&&(e.style=J_.DOUBLE_QUOTED)}function lv(e){e.presenterOptions.forceQuotes&&(e.isKey||e.style!==J_.PLAIN||(e.style=e.node.value.includes(`
|
|
126
|
+
`)?J_.DOUBLE_QUOTED:av(e)))}function uv(e){if(e.style!==J_.PLAIN||e.isKey)return;let t=e.node.value,n=t.indexOf(`
|
|
127
|
+
`)!==-1;if(!rv(e.allowedStylesMask,J_.LITERAL_BLOCK)){n&&(e.style=J_.DOUBLE_QUOTED);return}let r=e.presenterOptions.lineWidth;if(r===-1){n&&(e.style=J_.LITERAL_BLOCK);return}let i=Math.max(Math.min(r,40),r-e.shiftOfContent),a=0,o=!1;for(;a<=t.length;){let e=t.length,n=t.indexOf(`
|
|
128
|
+
`,a);n!==-1&&(e=n);let r=t.slice(a,e);if(r.length>i&&r[0]!==` `&&/ [^ \t]/.test(r)&&(o=!0),n===-1)break;a=n+1}o?e.style=J_.FOLDED_BLOCK:n&&(e.style=J_.LITERAL_BLOCK)}function dv(e){e.style===J_.PLAIN&&!rv(e.allowedStylesMask,J_.PLAIN)&&(e.style=av(e))}function fv(e){rv(e.allowedStylesMask,e.style)||(e.style=J_.DOUBLE_QUOTED)}var pv=`[\\x09\\x0A\\x0D\\x20-\\x7E\\x85\\xA0-\\uD7FF\\uE000-\\uFFFD\\u{10000}-\\u{10FFFF}]`,mv=`[\\n\\r]`,hv=`\\uFEFF`,gv=`[ \\t]`,_v=`(?:(?!(?:${mv}|${hv}))${pv})`,vv=`(?:(?!${gv})${_v})`,yv=`[\\x09\\x20-\\uD7FF\\uE000-\\uFFFF\\u{10000}-\\u{10FFFF}]`,bv=`[-?:,\\[\\]{}#&*!|>'"%@\`]`,xv=`[,\\[\\]{}]`,Sv=vv,Cv=`(?:(?!${xv})${vv})`,wv=`(?:(?:(?!${bv})${vv})|[?:-](?=${Sv}))`,Tv=`(?:(?:(?!${bv})${vv})|[?:-](?=${Cv}))`,Ev=`(?:(?:(?![:#])${Sv})|:(?=${Sv}))#*`,Dv=`(?:(?:(?![:#])${Cv})|:(?=${Cv}))#*`,Ov=`(?:${gv}*${Ev})*`,kv=`(?:${gv}*${Dv})*`,Av=`${wv}#*${Ov}`,jv=`${Tv}#*${kv}`,Mv=Av,Nv=jv,Pv=`\\n+${Ev}${Ov}`,Fv=`\\n+${Dv}${kv}`,Iv=`${Av}(?:${Pv})*`,Lv=`${jv}(?:${Fv})*`;RegExp(`^(?:${Iv})$`,`u`),RegExp(`^(?:${Lv})$`,`u`),RegExp(`^(?:${Mv})$`,`u`),RegExp(`^(?:${Nv})$`,`u`),RegExp(`^(?:${yv})*$`,`u`),RegExp(`^(?:${yv}|\\n)*$`,`u`),RegExp(`^(?:${_v}|\\n)*$`,`u`),Object.keys(iv).map(e=>Reflect.get(iv,e)),q_.DOCUMENT,q_.SEQUENCE,q_.MAPPING,q_.SCALAR,q_.ALIAS,q_.POP,J_.PLAIN,J_.SINGLE_QUOTED,J_.DOUBLE_QUOTED,J_.LITERAL_BLOCK,J_.FOLDED_BLOCK,Y_.BLOCK,Y_.FLOW,X_.CLIP,X_.STRIP,X_.KEEP;let Rv=Symbol.for(`yaml.alias`),zv=Symbol.for(`yaml.document`),Bv=Symbol.for(`yaml.map`),Vv=Symbol.for(`yaml.pair`),Hv=Symbol.for(`yaml.scalar`),Uv=Symbol.for(`yaml.seq`),Wv=Symbol.for(`yaml.node.type`),Gv=e=>!!e&&typeof e==`object`&&e[Wv]===Rv,Kv=e=>!!e&&typeof e==`object`&&e[Wv]===zv,qv=e=>!!e&&typeof e==`object`&&e[Wv]===Bv,Jv=e=>!!e&&typeof e==`object`&&e[Wv]===Vv,Yv=e=>!!e&&typeof e==`object`&&e[Wv]===Hv,Xv=e=>!!e&&typeof e==`object`&&e[Wv]===Uv;function Zv(e){if(e&&typeof e==`object`)switch(e[Wv]){case Bv:case Uv:return!0}return!1}function Qv(e){if(e&&typeof e==`object`)switch(e[Wv]){case Rv:case Bv:case Hv:case Uv:return!0}return!1}let $v=e=>(Yv(e)||Zv(e))&&!!e.anchor,ey=Symbol(`break visit`),ty=Symbol(`skip children`),ny=Symbol(`remove node`);function ry(e,t){let n=ay(t);Kv(e)?iy(null,e.contents,n,Object.freeze([e]))===ny&&(e.contents=null):iy(null,e,n,Object.freeze([]))}ry.BREAK=ey,ry.SKIP=ty,ry.REMOVE=ny;function iy(e,t,n,r){let i=oy(e,t,n,r);if(Qv(i)||Jv(i))return sy(e,r,i),iy(e,i,n,r);if(typeof i!=`symbol`){if(Zv(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=iy(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===ey)return ey;else i===ny&&(t.items.splice(e,1),--e)}}else if(Jv(t)){r=Object.freeze(r.concat(t));let e=iy(`key`,t.key,n,r);if(e===ey)return ey;e===ny&&(t.key=null);let i=iy(`value`,t.value,n,r);if(i===ey)return ey;i===ny&&(t.value=null)}}return i}function ay(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function oy(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(qv(t))return n.Map?.(e,t,r);if(Xv(t))return n.Seq?.(e,t,r);if(Jv(t))return n.Pair?.(e,t,r);if(Yv(t))return n.Scalar?.(e,t,r);if(Gv(t))return n.Alias?.(e,t,r)}function sy(e,t,n){let r=t[t.length-1];if(Zv(r))r.items[e]=n;else if(Jv(r))e===`key`?r.key=n:r.value=n;else if(Kv(r))r.contents=n;else{let e=Gv(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function cy(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function ly(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=ly(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=ly(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=ly(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=ly(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function uy(e,t,n){if(Array.isArray(e))return e.map((e,t)=>uy(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!$v(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var dy=class{constructor(e){Object.defineProperty(this,Wv,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Kv(e))throw TypeError(`A document argument is required`);let a={anchors:/* @__PURE__ */ new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=uy(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?ly(i,{"":o},``,o):o}},fy=class extends dy{constructor(e){super(Rv),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ry(e,{Node:(e,t)=>{(Gv(t)||$v(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);
|
|
129
|
+
/* istanbul ignore if */
|
|
130
|
+
if(a||=(uy(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=py(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(cy(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function py(e,t,n){if(Gv(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Zv(t)){let r=0;for(let i of t.items){let t=py(e,i,n);t>r&&(r=t)}return r}if(Jv(t)){let r=py(e,t.key,n),i=py(e,t.value,n);return Math.max(r,i)}return 1}let my=e=>!e||typeof e!=`function`&&typeof e!=`object`;var hy=class extends dy{constructor(e){super(Hv),this.value=e}toJSON(e,t){return t?.keep?this.value:uy(this.value,e,t)}toString(){return String(this.value)}};hy.BLOCK_FOLDED=`BLOCK_FOLDED`,hy.BLOCK_LITERAL=`BLOCK_LITERAL`,hy.PLAIN=`PLAIN`,hy.QUOTE_DOUBLE=`QUOTE_DOUBLE`,hy.QUOTE_SINGLE=`QUOTE_SINGLE`;function gy(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function _y(e,t,n){if(Kv(e)&&(e=e.contents),Qv(e))return e;if(Jv(e)){let t=n.schema[Bv].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new fy(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=`tag:yaml.org,2002:`+t.slice(2));let l=gy(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new hy(e);return c&&(c.node=t),t}l=e instanceof Map?o[Bv]:Symbol.iterator in Object(e)?o[Uv]:o[Bv]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new hy(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function vy(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=/* @__PURE__ */ new Map([[n,r]])}return _y(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:/* @__PURE__ */ new Map})}let yy=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;var by=class extends dy{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>Qv(t)||Jv(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(yy(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(Zv(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,vy(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(Zv(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&Yv(i)?i.value:i:Zv(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Jv(t))return!1;let n=t.value;return n==null||e&&Yv(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return Zv(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(Zv(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,vy(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};let xy=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function Sy(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}let Cy=(e,t,n)=>e.endsWith(`
|
|
131
|
+
`)?Sy(n,t):n.includes(`
|
|
132
|
+
`)?`
|
|
133
|
+
`+Sy(n,t):(e.endsWith(` `)?``:` `)+n,wy=`flow`;function Ty(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=Ey(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
|
|
134
|
+
`)n===`block`&&(h=Ey(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
|
|
135
|
+
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
|
|
136
|
+
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function Ey(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
|
|
137
|
+
`);r=t,i=t+1,a=e[i]}return r}let Dy=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Oy=e=>/^(%|---|\.\.\.)/m.test(e);function ky(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
|
|
138
|
+
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function Ay(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Oy(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
|
|
139
|
+
|
|
140
|
+
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
|
|
141
|
+
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:Ty(o,a,`quoted`,Dy(t,!1))}function jy(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
142
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return Ay(e,t);let n=t.indent||(Oy(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:Ty(r,n,wy,Dy(t,!1))}function My(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=Ay;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?jy:i&&!t?Ay:n?jy:Ay}return r(e,t)}let Ny;try{Ny=/* @__PURE__ */ RegExp(`(^|(?<!
|
|
143
|
+
))
|
|
144
|
+
+(?!
|
|
145
|
+
|$)`,`g`)}catch{Ny=/\n+(?!\n|$)/g}function Py({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return My(n,r);let l=r.indent||(r.forceBlockIndent||Oy(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===hy.BLOCK_FOLDED?!1:t===hy.BLOCK_LITERAL||!ky(n,c,l.length);if(!n)return u?`|
|
|
146
|
+
`:`>
|
|
147
|
+
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
|
|
148
|
+
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
|
|
149
|
+
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
150
|
+
`&&(p=p.slice(0,-1)),p.replace(Ny,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
|
|
151
|
+
`)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
|
|
152
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=Dy(r,!0);o!==`folded`&&t!==hy.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=Ty(`${v}${e}${p}`,l,`block`,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function Fy(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
|
|
153
|
+
`)||u&&/[[\]{},]/.test(a))return My(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
|
154
|
+
`)?My(a,t):Py(e,t,n,r);if(!s&&!u&&i!==hy.PLAIN&&a.includes(`
|
|
155
|
+
`))return Py(e,t,n,r);if(Oy(a)){if(c===``)return t.forceBlockIndent=!0,Py(e,t,n,r);if(s&&c===l)return My(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return My(a,t)}return s?d:Ty(d,c,wy,Dy(t,!1))}function Iy(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==hy.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=hy.QUOTE_DOUBLE);let c=e=>{switch(e){case hy.BLOCK_FOLDED:case hy.BLOCK_LITERAL:return i||a?My(o.value,t):Py(o,t,n,r);case hy.QUOTE_DOUBLE:return Ay(o.value,t);case hy.QUOTE_SINGLE:return jy(o.value,t);case hy.PLAIN:return Fy(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function Ly(e,t){let n=Object.assign({blockQuote:!0,commentString:xy,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:/* @__PURE__ */ new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Ry(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(Yv(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function zy(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(Yv(e)||Zv(e))&&e.anchor;a&&cy(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function By(e,t,n,r){if(Jv(e))return e.toString(t,n,r);if(Gv(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=/* @__PURE__ */ new Set([e]),e=e.resolve(t.doc)}let i,a=Qv(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Ry(t.doc.schema.tags,a);let o=zy(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):Yv(a)?Iy(a,t,n,r):a.toString(t,n,r);return o?Yv(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Vy({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=Qv(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(Zv(e)||!Qv(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||Zv(e)||(Yv(e)?e.type===hy.BLOCK_FOLDED||e.type===hy.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=By(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=Cy(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Cy(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=Cy(g,n.indent,l(f))));let _,v,y;Qv(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&Yv(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Xv(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=By(t,n,()=>b=!0,()=>h=!0),ee=` `;if(f||_||v){if(ee=_?`
|
|
156
|
+
`:``,v){let e=l(v);ee+=`\n${Sy(e,n.indent)}`}x===``&&!n.inFlow?ee===`
|
|
157
|
+
`&&y&&(ee=`
|
|
158
|
+
|
|
159
|
+
`):ee+=`\n${n.indent}`}else if(!p&&Zv(t)){let e=x[0],r=x.indexOf(`
|
|
160
|
+
`),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(ee=`\n${n.indent}`)}}else(x===``||x[0]===`
|
|
161
|
+
`)&&(ee=``);return g+=ee+x,n.inFlow?b&&r&&r():y&&!b?g+=Cy(g,n.indent,l(y)):h&&i&&i(),g}function Hy(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}let Uy={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new hy(Symbol(`<<`)),{addToJSMap:Gy}),stringify:()=>`<<`},Wy=(e,t)=>(Uy.identify(t)||Yv(t)&&(!t.type||t.type===hy.PLAIN)&&Uy.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Uy.tag&&e.default);function Gy(e,t,n){let r=qy(e,n);if(Xv(r))for(let n of r.items)Ky(e,t,n);else if(Array.isArray(r))for(let n of r)Ky(e,t,n);else Ky(e,t,r)}function Ky(e,t,n){let r=qy(e,n);if(!qv(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function qy(e,t){return e&&Gv(t)?t.resolve(e.doc,e):t}function Jy(e,t,{key:n,value:r}){if(Qv(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Wy(e,n))Gy(e,t,r);else{let i=uy(n,``,e);if(t instanceof Map)t.set(i,uy(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Yy(n,i,e),o=uy(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Yy(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(Qv(e)&&n?.doc){let t=Ly(n.doc,{});t.anchors=/* @__PURE__ */ new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Hy(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Xy(e,t,n){return new Zy(_y(e,void 0,n),_y(t,void 0,n))}var Zy=class e{constructor(e,t=null){Object.defineProperty(this,Wv,{value:Vv}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return Qv(n)&&(n=n.clone(t)),Qv(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Jy(t,t?.mapAsMap?/* @__PURE__ */ new Map:{},this)}toString(e,t,n){return e?.doc?Vy(this,e,t,n):JSON.stringify(this)}};function Qy(e,t,n){return(t.inFlow??e.flow?eb:$y)(e,t,n)}function $y({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(Qv(i))!d&&i.spaceBefore&&f.push(``),tb(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(Jv(i)){let e=Qv(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),tb(n,f,e.commentBefore,d))}d=!1;let s=By(i,u,()=>o=null,()=>d=!0);o&&(s+=Cy(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
|
|
162
|
+
`}}return e?(p+=`
|
|
163
|
+
`+Sy(l(e),c),s&&s()):d&&o&&o(),p}function eb({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(Qv(i))i.spaceBefore&&d.push(``),tb(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(Jv(i)){let e=Qv(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),tb(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=Qv(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=By(i,c,()=>a=null);l||=d.length>u||o.includes(`
|
|
164
|
+
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=Cy(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
|
|
165
|
+
`;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function tb({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=Sy(t(r),e);n.push(i.trimStart())}}function nb(e,t){let n=Yv(t)?t.value:t;for(let r of e)if(Jv(r)&&(r.key===t||r.key===n||Yv(r.key)&&r.key.value===n))return r}var rb=class extends by{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Bv,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Xy(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=Jv(e)?e:!e||typeof e!=`object`||!(`key`in e)?new Zy(e,e?.value):new Zy(e.key,e.value);let r=nb(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);Yv(r.value)&&my(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=nb(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=nb(this.items,e)?.value;return(!t&&Yv(n)?n.value:n)??void 0}has(e){return!!nb(this.items,e)}set(e,t){this.add(new Zy(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?/* @__PURE__ */ new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Jy(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!Jv(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Qy(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}};let ib={collection:`map`,default:!0,nodeClass:rb,tag:`tag:yaml.org,2002:map`,resolve(e,t){return qv(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>rb.from(e,t,n)};var ab=class extends by{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Uv,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=ob(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=ob(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&Yv(r)?r.value:r}has(e){let t=ob(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=ob(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Yv(r)&&my(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(uy(e,String(r++),t));return n}toString(e,t,n){return e?Qy(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(_y(a,void 0,n))}}return i}};function ob(e){let t=Yv(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}let sb={collection:`seq`,default:!0,nodeClass:ab,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Xv(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>ab.from(e,t,n)};function cb(e){return typeof e==`bigint`||Number.isInteger(e)}let lb=({value:e})=>JSON.stringify(e),ub=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:lb},{identify:e=>e==null,createNode:()=>new hy(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:lb},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:lb},{identify:cb,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>cb(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:lb}];[ib,sb].concat(ub,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function db(e,t,n){let{replacer:r}=n,i=new ab(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Xy(o,s,n))}return i}var fb=class e extends ab{constructor(){super(),this.add=rb.prototype.add.bind(this),this.delete=rb.prototype.delete.bind(this),this.get=rb.prototype.get.bind(this),this.has=rb.prototype.has.bind(this),this.set=rb.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=/* @__PURE__ */ new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(Jv(e)?(r=uy(e.key,``,t),i=uy(e.value,r,t)):r=uy(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=db(e,t,n),i=new this;return i.items=r.items,i}};fb.tag=`tag:yaml.org,2002:omap`;var pb=class e extends rb{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=Jv(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new Zy(e.key,null):new Zy(e,null),nb(this.items,t.key)||this.items.push(t)}get(e,t){let n=nb(this.items,e);return!t&&Jv(n)?Yv(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=nb(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Zy(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Xy(e,null,n));return i}};pb.tag=`tag:yaml.org,2002:set`;let mb=Symbol(`break visit`),hb=Symbol(`skip children`),gb=Symbol(`remove item`);function _b(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),vb(Object.freeze([]),e,t)}_b.BREAK=mb,_b.SKIP=hb,_b.REMOVE=gb,_b.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},_b.parentCollection=(e,t)=>{let n=_b.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function vb(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=vb(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===mb)return mb;else r===gb&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}let yb=`sheet.yaml`,bb=`sheet.ts`,xb=/* @__PURE__ */ RegExp(`^[:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`);function Sb(e,t){let n=[],r=t.exec(e);for(;r;){let i=[];i.startIndex=t.lastIndex-r[0].length;let a=r.length;for(let e=0;e<a;e++)i.push(r[e]);n.push(i),r=t.exec(e)}return n}let Cb=function(e){return xb.exec(e)!=null};function wb(e){return e!==void 0}let Tb=[`hasOwnProperty`,`toString`,`valueOf`,`__defineGetter__`,`__defineSetter__`,`__lookupGetter__`,`__lookupSetter__`],Eb=[`__proto__`,`constructor`,`prototype`],Db={allowBooleanAttributes:!1,unpairedTags:[]};function Ob(e,t){t=Object.assign({},Db,t);let n=[],r=!1,i=!1;e[0]===``&&(e=e.substr(1));for(let a=0;a<e.length;a++)if(e[a]===`<`&&e[a+1]===`?`){if(a+=2,a=Ab(e,a),a.err)return a}else if(e[a]===`<`){let o=a;if(a++,e[a]===`!`){a=jb(e,a);continue}{let s=!1;e[a]===`/`&&(s=!0,a++);let c=``;for(;a<e.length&&e[a]!==`>`&&e[a]!==` `&&e[a]!==` `&&e[a]!==`
|
|
166
|
+
`&&e[a]!==`\r`;a++)c+=e[a];if(c=c.trim(),c[c.length-1]===`/`&&(c=c.substring(0,c.length-1),a--),!zb(c)){let t;return t=c.trim().length===0?`Invalid space after '<'.`:`Tag '`+c+`' is an invalid name.`,Lb(`InvalidTag`,t,Bb(e,a))}let l=Mb(e,a);if(l===!1)return Lb(`InvalidAttr`,`Attributes for '`+c+`' have open quote.`,Bb(e,a));let u=l.value;if(a=l.index,u[u.length-1]===`/`){let n=a-u.length;u=u.substring(0,u.length-1);let i=Pb(u,t);if(i===!0)r=!0;else return Lb(i.err.code,i.err.msg,Bb(e,n+i.err.line))}else if(s){if(!l.tagClosed)return Lb(`InvalidTag`,`Closing tag '`+c+`' doesn't have proper closing.`,Bb(e,a));if(u.trim().length>0)return Lb(`InvalidTag`,`Closing tag '`+c+`' can't have attributes or invalid starting.`,Bb(e,o));if(n.length===0)return Lb(`InvalidTag`,`Closing tag '`+c+`' has not been opened.`,Bb(e,o));{let t=n.pop();if(c!==t.tagName){let n=Bb(e,t.tagStartPos);return Lb(`InvalidTag`,`Expected closing tag '`+t.tagName+`' (opened in line `+n.line+`, col `+n.col+`) instead of closing tag '`+c+`'.`,Bb(e,o))}n.length==0&&(i=!0)}}else{let s=Pb(u,t);if(s!==!0)return Lb(s.err.code,s.err.msg,Bb(e,a-u.length+s.err.line));if(i===!0)return Lb(`InvalidXml`,`Multiple possible root nodes found.`,Bb(e,a));t.unpairedTags.indexOf(c)!==-1||n.push({tagName:c,tagStartPos:o}),r=!0}for(a++;a<e.length;a++)if(e[a]===`<`){if(e[a+1]===`!`){a++,a=jb(e,a);continue}if(e[a+1]===`?`){if(a=Ab(e,++a),a.err)return a}else break}else if(e[a]===`&`){let t=Ib(e,a);if(t==-1)return Lb(`InvalidChar`,`char '&' is not expected.`,Bb(e,a));a=t}else if(i===!0&&!kb(e[a]))return Lb(`InvalidXml`,`Extra text at the end`,Bb(e,a));e[a]===`<`&&a--}}else{if(kb(e[a]))continue;return Lb(`InvalidChar`,`char '`+e[a]+`' is not expected.`,Bb(e,a))}return r?n.length==1?Lb(`InvalidTag`,`Unclosed tag '`+n[0].tagName+`'.`,Bb(e,n[0].tagStartPos)):n.length>0?Lb(`InvalidXml`,`Invalid '`+JSON.stringify(n.map(e=>e.tagName),null,4).replace(/\r?\n/g,``)+`' found.`,{line:1,col:1}):!0:Lb(`InvalidXml`,`Start tag expected.`,1)}function kb(e){return e===` `||e===` `||e===`
|
|
167
|
+
`||e===`\r`}function Ab(e,t){let n=t;for(;t<e.length;t++)if(e[t]==`?`||e[t]==` `){let r=e.substr(n,t-n);if(t>5&&r===`xml`)return Lb(`InvalidXml`,`XML declaration allowed only at the start of the document.`,Bb(e,t));if(e[t]==`?`&&e[t+1]==`>`){t++;break}continue}return t}function jb(e,t){if(e.length>t+5&&e[t+1]===`-`&&e[t+2]===`-`){for(t+=3;t<e.length;t++)if(e[t]===`-`&&e[t+1]===`-`&&e[t+2]===`>`){t+=2;break}}else if(e.length>t+8&&e[t+1]===`D`&&e[t+2]===`O`&&e[t+3]===`C`&&e[t+4]===`T`&&e[t+5]===`Y`&&e[t+6]===`P`&&e[t+7]===`E`){let n=1;for(t+=8;t<e.length;t++)if(e[t]===`<`)n++;else if(e[t]===`>`&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]===`[`&&e[t+2]===`C`&&e[t+3]===`D`&&e[t+4]===`A`&&e[t+5]===`T`&&e[t+6]===`A`&&e[t+7]===`[`){for(t+=8;t<e.length;t++)if(e[t]===`]`&&e[t+1]===`]`&&e[t+2]===`>`){t+=2;break}}return t}function Mb(e,t){let n=``,r=``,i=!1;for(;t<e.length;t++){if(e[t]===`"`||e[t]===`'`)r===``?r=e[t]:r!==e[t]||(r=``);else if(e[t]===`>`&&r===``){i=!0;break}n+=e[t]}return r===``&&{value:n,index:t,tagClosed:i}}function Nb(e){let t=[],n=e.length,r=0;for(;r<n;){let i=r;for(;r<n&&kb(e[r]);)r++;if(r>=n)break;if(e[r]===`=`){r=i+1;continue}let a=e.slice(i,r),o=r;for(;r<n&&!kb(e[r])&&e[r]!==`=`;)r++;let s=e.slice(o,r),c,l=r;for(;l<n&&kb(e[l]);)l++;l<n&&e[l]===`=`&&(c=e.slice(r,l+1),r=l+1);let u,d,f=r;for(;f<n&&kb(e[f]);)f++;if(f<n&&(e[f]===`"`||e[f]===`'`)){let t=f+1,n=e.indexOf(e[f],t);n!==-1&&(u=e[f],d=e.slice(t,n),r=n+1)}let p={startIndex:i};p[1]=a,p[2]=s,p[3]=c,p[4]=u!==void 0||void 0,p[5]=u,p[6]=d,t.push(p)}return t}function Pb(e,t){let n=Nb(e),r={};for(let e=0;e<n.length;e++){if(n[e][1].length===0)return Lb(`InvalidAttr`,`Attribute '`+n[e][2]+`' has no space in starting.`,Vb(n[e]));if(n[e][3]!==void 0&&n[e][4]===void 0)return Lb(`InvalidAttr`,`Attribute '`+n[e][2]+`' is without value.`,Vb(n[e]));if(n[e][3]===void 0&&!t.allowBooleanAttributes)return Lb(`InvalidAttr`,`boolean attribute '`+n[e][2]+`' is not allowed.`,Vb(n[e]));let i=n[e][2];if(!Rb(i))return Lb(`InvalidAttr`,`Attribute '`+i+`' is an invalid name.`,Vb(n[e]));if(!Object.prototype.hasOwnProperty.call(r,i))r[i]=1;else return Lb(`InvalidAttr`,`Attribute '`+i+`' is repeated.`,Vb(n[e]))}return!0}function Fb(e,t){let n=/\d/;for(e[t]===`x`&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===`;`)return t;if(!e[t].match(n))break}return-1}function Ib(e,t){if(t++,e[t]===`;`)return-1;if(e[t]===`#`)return t++,Fb(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===`;`)break;return-1}return t}function Lb(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function Rb(e){return Cb(e)}function zb(e){return Cb(e)}function Bb(e,t){let n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Vb(e){return e.startIndex+e[1].length}let Hb={cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,euro:`€`,dollar:`$`,fnof:`ƒ`,inr:`₹`,af:`؋`,birr:`ብር`,peso:`₱`,rub:`₽`,won:`₩`,yuan:`¥`,cedil:`¸`},Ub={amp:`&`,apos:`'`,gt:`>`,lt:`<`,quot:`"`},Wb={nbsp:`\xA0`,copy:`©`,reg:`®`,trade:`™`,mdash:`—`,ndash:`–`,hellip:`…`,laquo:`«`,raquo:`»`,lsquo:`‘`,rsquo:`’`,ldquo:`“`,rdquo:`”`,bull:`•`,para:`¶`,sect:`§`,deg:`°`,frac12:`½`,frac14:`¼`,frac34:`¾`},Gb=Object.freeze({ALLOW:`allow`,BLOCK:`block`,THROW:`throw`}),Kb=/* @__PURE__ */ new Set(`!?\\\\/[]$%{}^&*()<>|+`);function qb(e){if(e[0]===`#`)throw Error(`[EntityReplacer] Invalid character '#' in entity name: "${e}"`);for(let t of e)if(Kb.has(t))throw Error(`[EntityReplacer] Invalid character '${t}' in entity name: "${e}"`);return e}function Jb(...e){let t=Object.create(null);for(let n of e)if(n)for(let e of Object.keys(n)){let r=n[e];if(typeof r==`string`)t[e]=r;else if(r&&typeof r==`object`&&r.val!==void 0){let n=r.val;typeof n==`string`&&(t[e]=n)}}return t}let Yb=`external`,Xb=`base`;function Zb(e){return!e||e===Yb?/* @__PURE__ */ new Set([Yb]):e===`all`?/* @__PURE__ */ new Set([`all`]):e===Xb?/* @__PURE__ */ new Set([Xb]):Array.isArray(e)?new Set(e):/* @__PURE__ */ new Set([Yb])}let Qb=Object.freeze({allow:0,leave:1,remove:2,throw:3}),$b=/* @__PURE__ */ new Set([9,10,13]);function ex(e){if(!e)return{xmlVersion:1,onLevel:Qb.allow,nullLevel:Qb.remove};let t=e.xmlVersion===1.1?1.1:1,n=Qb[e.onNCR]??Qb.allow,r=Qb[e.nullNCR]??Qb.remove;return{xmlVersion:t,onLevel:n,nullLevel:Math.max(r,Qb.remove)}}var tx=class{constructor(e={}){this._limit=e.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof e.postCheck==`function`?e.postCheck:e=>e,this._limitTiers=Zb(this._limit.applyLimitsTo??Yb),this._numericAllowed=e.numericAllowed??!0,this._baseMap=Jb(Ub,e.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(e.remove&&Array.isArray(e.remove)?e.remove:[]),this._leaveSet=new Set(e.leave&&Array.isArray(e.leave)?e.leave:[]);let t=ex(e.ncr);this._ncrXmlVersion=t.xmlVersion,this._ncrOnLevel=t.onLevel,this._ncrNullLevel=t.nullLevel,this._onExternalEntity=typeof e.onExternalEntity==`function`?e.onExternalEntity:null,this._onInputEntity=typeof e.onInputEntity==`function`?e.onInputEntity:null}_applyRegistrationHook(e,t,n,r){if(!e)return!0;let i=e(t,n);if(i===Gb.BLOCK)return!1;if(i===Gb.THROW)throw Error(`[EntityDecoder] Registration of ${r} entity "&${t};" was rejected by hook`);return!0}setExternalEntities(e){if(e)for(let t of Object.keys(e))qb(t);if(!this._onExternalEntity){this._externalMap=Jb(e);return}let t=Jb(e),n=Object.create(null);for(let[e,r]of Object.entries(t))this._applyRegistrationHook(this._onExternalEntity,e,r,`external`)&&(n[e]=r);this._externalMap=n}addExternalEntity(e,t){qb(e),typeof t==`string`&&t.indexOf(`&`)===-1&&this._applyRegistrationHook(this._onExternalEntity,e,t,`external`)&&(this._externalMap[e]=t)}addInputEntities(e){if(this._totalExpansions=0,this._expandedLength=0,!this._onInputEntity){this._inputMap=Jb(e);return}let t=Jb(e),n=Object.create(null);for(let[e,r]of Object.entries(t))this._applyRegistrationHook(this._onInputEntity,e,r,`input`)&&(n[e]=r);this._inputMap=n}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(e){this._ncrXmlVersion=e===1.1?1.1:1}decode(e){if(typeof e!=`string`||e.length===0||e.indexOf(`&`)===-1)return e;let t=e,n=[],r=e.length,i=0,a=0,o=this._maxTotalExpansions>0,s=this._maxExpandedLength>0,c=o||s;for(;a<r;){if(e.charCodeAt(a)!==38){a++;continue}let t=a+1;for(;t<r&&e.charCodeAt(t)!==59&&t-a<=32;)t++;if(t>=r||e.charCodeAt(t)!==59){a++;continue}let l=e.slice(a+1,t);if(l.length===0){a++;continue}let u,d;if(this._removeSet.has(l))u=``,d===void 0&&(d=Yb);else if(this._leaveSet.has(l)){a++;continue}else if(l.charCodeAt(0)===35){let e=this._resolveNCR(l);if(e===void 0){a++;continue}u=e,d=Xb}else{let e=this._resolveName(l);u=e?.value,d=e?.tier}if(u===void 0)a++;else if(a>i&&n.push(e.slice(i,a)),n.push(u),i=t+1,a=i,c&&this._tierCounts(d)){if(o&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(s){let e=u.length-(l.length+2);if(e>0&&(this._expandedLength+=e,this._expandedLength>this._maxExpandedLength))throw Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}i<r&&n.push(e.slice(i));let l=n.length===0?e:n.join(``);return this._postCheck(l,t)}_tierCounts(e){return this._limitTiers.has(`all`)?!0:this._limitTiers.has(e)}_resolveName(e){if(e in this._inputMap)return{value:this._inputMap[e],tier:Yb};if(e in this._externalMap)return{value:this._externalMap[e],tier:Yb};if(e in this._baseMap)return{value:this._baseMap[e],tier:Xb}}_classifyNCR(e){return e===0?this._ncrNullLevel:e>=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!$b.has(e)?Qb.remove:-1}_applyNCRAction(e,t,n){switch(e){case Qb.allow:return String.fromCodePoint(n);case Qb.remove:return``;case Qb.leave:return;case Qb.throw:throw Error(`[EntityDecoder] Prohibited numeric character reference &${t}; (U+${n.toString(16).toUpperCase().padStart(4,`0`)})`);default:return String.fromCodePoint(n)}}_resolveNCR(e){let t=e.charCodeAt(1),n;if(n=t===120||t===88?parseInt(e.slice(2),16):parseInt(e.slice(1),10),Number.isNaN(n)||n<0||n>1114111)return;let r=this._classifyNCR(n);if(!this._numericAllowed&&r<Qb.remove)return;let i=r===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,r);return this._applyNCRAction(i,e,n)}};let nx=e=>Tb.includes(e)?`__`+e:e,rx={preserveOrder:!1,attributeNamePrefix:`@_`,attributesGroupName:!1,textNodeName:`#text`,ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0,unicode:!1},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:nx};function ix(e,t){if(typeof e!=`string`)return;let n=e.toLowerCase();if(Tb.some(e=>n===e.toLowerCase())||Eb.some(e=>n===e.toLowerCase()))throw Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`)}function ax(e,t){return typeof e==`boolean`?{enabled:e,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:`all`}:typeof e==`object`&&e?{enabled:e.enabled!==!1,maxEntitySize:Math.max(1,e.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,e.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,e.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,e.maxExpandedLength??1e5),maxEntityCount:Math.max(1,e.maxEntityCount??1e3),allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null,appliesTo:e.appliesTo??`all`}:ax(!0)}let ox=function(e){let t=Object.assign({},rx,e),n=[{value:t.attributeNamePrefix,name:`attributeNamePrefix`},{value:t.attributesGroupName,name:`attributesGroupName`},{value:t.textNodeName,name:`textNodeName`},{value:t.cdataPropName,name:`cdataPropName`},{value:t.commentPropName,name:`commentPropName`}];for(let{value:e,name:t}of n)e&&ix(e,t);return t.onDangerousProperty===null&&(t.onDangerousProperty=nx),t.processEntities=ax(t.processEntities,t.htmlEntities),t.unpairedTagsSet=new Set(t.unpairedTags),t.stopNodes&&Array.isArray(t.stopNodes)&&(t.stopNodes=t.stopNodes.map(e=>typeof e==`string`&&e.startsWith(`*.`)?`..`+e.substring(2):e)),t},sx;sx=typeof Symbol==`function`?Symbol(`XML Node Metadata`):`@@xmlMetadata`;var cx=class{constructor(e){this.tagname=e,this.child=[],this[`:@`]=Object.create(null)}add(e,t){e===`__proto__`&&(e=`#__proto__`),this.child.push({[e]:t})}addChild(e,t){e.tagname===`__proto__`&&(e.tagname=`#__proto__`),e[`:@`]&&Object.keys(e[`:@`]).length>0?this.child.push({[e.tagname]:e.child,":@":e[`:@`]}):this.child.push({[e.tagname]:e.child}),this.addStartIndex(t)}addStartIndex(e){e!==void 0&&(this.child[this.child.length-1][sx]={startIndex:e})}addEndIndex(e){let t=this.child[this.child.length-1];t!==void 0&&t[sx]!==void 0&&t[sx].endIndex===void 0&&(t[sx].endIndex=e)}static getMetaDataSymbol(){return sx}};let lx=(e,t,n=``)=>{let r=`[${e.replace(`:`,``)}][${t.replace(`:`,``)}]*`;return{name:RegExp(`^[${e}][${t}]*$`,n),ncName:RegExp(`^${r}$`,n),qName:RegExp(`^${r}(?::${r})?$`,n),nmToken:RegExp(`^[${t}]+$`,n),nmTokens:RegExp(`^[${t}]+(?:\\s+[${t}]+)*$`,n)}},ux=lx(`:A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�`,`:A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�\\-\\.\\d·̀-ͯ‿-⁀`),dx=lx(`:A-Za-z_À-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,`:A-Za-z_À-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-\\-\\.\\d·̀-ͯ҇‿-⁀`,`u`),fx=lx(`:A-Za-z_`,`:A-Za-z_\\-\\.\\d`),px=(e=`1.0`,t=!1)=>t?fx:e===`1.1`?dx:ux,mx=(e,{xmlVersion:t=`1.0`,asciiOnly:n=!1}={})=>px(t,n).qName.test(e);var hx=class{constructor(e,t){this.suppressValidationErr=!e,this.options=e,this.xmlVersion=t||1}setXmlVersion(e=1){this.xmlVersion=e}readDocType(e,t){let n=Object.create(null),r=0;if(e[t+3]===`O`&&e[t+4]===`C`&&e[t+5]===`T`&&e[t+6]===`Y`&&e[t+7]===`P`&&e[t+8]===`E`){t+=9;let i=1,a=!1,o=!1,s=null,c=``;for(;t<e.length;t++)if(s!==null)e[t]===s&&(s=null),c+=e[t];else if(!a&&!o&&(e[t]===`"`||e[t]===`'`))s=e[t],c+=e[t];else if(e[t]===`<`&&!o){if(a&&_x(e,`!ENTITY`,t)){t+=7;let i,a;if([i,a,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),a.indexOf(`&`)===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&r>=this.options.maxEntityCount)throw Error(`Entity count (${r+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);n[i]=a,r++}}else if(a&&_x(e,`!ELEMENT`,t)){t+=8;let{index:n}=this.readElementExp(e,t+1);t=n}else if(a&&_x(e,`!ATTLIST`,t))t+=8;else if(a&&_x(e,`!NOTATION`,t)){t+=9;let{index:n}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=n}else if(_x(e,`!--`,t))o=!0;else throw Error(`Invalid DOCTYPE`);i++,c=``}else if(e[t]===`>`){if(o?e[t-1]===`-`&&e[t-2]===`-`&&(o=!1,i--):i--,i===0)break}else e[t]===`[`?a=!0:c+=e[t];if(s!==null||i!==0)throw Error(`Unclosed DOCTYPE`)}else throw Error(`Invalid Tag instead of DOCTYPE`);return{entities:n,i:t}}readEntityExp(e,t){t=gx(e,t);let n=t;for(;t<e.length&&!/\s/.test(e[t])&&e[t]!==`"`&&e[t]!==`'`;)t++;let r=e.substring(n,t);if(vx(r,{xmlVersion:this.xmlVersion}),t=gx(e,t),!this.suppressValidationErr){if(e.substring(t,t+6).toUpperCase()===`SYSTEM`)throw Error(`External entities are not supported`);if(e[t]===`%`)throw Error(`Parameter entities are not supported`)}let i=``;if([t,i]=this.readIdentifierVal(e,t,`entity`),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&i.length>this.options.maxEntitySize)throw Error(`Entity "${r}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return t--,[r,i,t]}readNotationExp(e,t){t=gx(e,t);let n=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;let r=e.substring(n,t);!this.suppressValidationErr&&vx(r,{xmlVersion:this.xmlVersion}),t=gx(e,t);let i=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&i!==`SYSTEM`&&i!==`PUBLIC`)throw Error(`Expected SYSTEM or PUBLIC, found "${i}"`);t+=i.length,t=gx(e,t);let a=null,o=null;if(i===`PUBLIC`)[t,a]=this.readIdentifierVal(e,t,`publicIdentifier`),t=gx(e,t),(e[t]===`"`||e[t]===`'`)&&([t,o]=this.readIdentifierVal(e,t,`systemIdentifier`));else if(i===`SYSTEM`&&([t,o]=this.readIdentifierVal(e,t,`systemIdentifier`),!this.suppressValidationErr&&!o))throw Error(`Missing mandatory system identifier for SYSTEM notation`);return{notationName:r,publicIdentifier:a,systemIdentifier:o,index:--t}}readIdentifierVal(e,t,n){let r=``,i=e[t];if(i!==`"`&&i!==`'`)throw Error(`Expected quoted string, found "${i}"`);t++;let a=t;for(;t<e.length&&e[t]!==i;)t++;if(r=e.substring(a,t),e[t]!==i)throw Error(`Unterminated ${n} value`);return t++,[t,r]}readElementExp(e,t){t=gx(e,t);let n=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;let r=e.substring(n,t);if(!this.suppressValidationErr&&!mx(r,{xmlVersion:this.xmlVersion}))throw Error(`Invalid element name: "${r}"`);t=gx(e,t);let i=``;if(e[t]===`E`&&_x(e,`MPTY`,t))t+=4;else if(e[t]===`A`&&_x(e,`NY`,t))t+=2;else if(e[t]===`(`){t++;let n=t;for(;t<e.length&&e[t]!==`)`;)t++;if(i=e.substring(n,t),e[t]!==`)`)throw Error(`Unterminated content model`)}else if(!this.suppressValidationErr)throw Error(`Invalid Element Expression, found "${e[t]}"`);return{elementName:r,contentModel:i.trim(),index:t}}readAttlistExp(e,t){t=gx(e,t);let n=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;let r=e.substring(n,t);for(vx(r,{xmlVersion:this.xmlVersion}),t=gx(e,t),n=t;t<e.length&&!/\s/.test(e[t]);)t++;let i=e.substring(n,t);if(!vx(i,{xmlVersion:this.xmlVersion}))throw Error(`Invalid attribute name: "${i}"`);t=gx(e,t);let a=``;if(e.substring(t,t+8).toUpperCase()===`NOTATION`){if(a=`NOTATION`,t+=8,t=gx(e,t),e[t]!==`(`)throw Error(`Expected '(', found "${e[t]}"`);t++;let n=[];for(;t<e.length&&e[t]!==`)`;){let r=t;for(;t<e.length&&e[t]!==`|`&&e[t]!==`)`;)t++;let i=e.substring(r,t);if(i=i.trim(),!vx(i,{xmlVersion:this.xmlVersion}))throw Error(`Invalid notation name: "${i}"`);n.push(i),e[t]===`|`&&(t++,t=gx(e,t))}if(e[t]!==`)`)throw Error(`Unterminated list of notations`);t++,a+=` (`+n.join(`|`)+`)`}else{let n=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;if(a+=e.substring(n,t),!this.suppressValidationErr&&![`CDATA`,`ID`,`IDREF`,`IDREFS`,`ENTITY`,`ENTITIES`,`NMTOKEN`,`NMTOKENS`].includes(a.toUpperCase()))throw Error(`Invalid attribute type: "${a}"`)}t=gx(e,t);let o=``;return e.substring(t,t+8).toUpperCase()===`#REQUIRED`?(o=`#REQUIRED`,t+=8):e.substring(t,t+7).toUpperCase()===`#IMPLIED`?(o=`#IMPLIED`,t+=7):[t,o]=this.readIdentifierVal(e,t,`ATTLIST`),{elementName:r,attributeName:i,attributeType:a,defaultValue:o,index:t}}};let gx=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function _x(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function vx(e,t){if(mx(e,{xmlVersion:t}))return e;throw Error(`Invalid entity name ${e}`)}let yx=[48,1632,1776,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,65296,120782,120792,120802,120812,120822,66720,68912,69734,69872,69942,70096,70384,70736,70864,71248,71360,71472,71904,72016,72688,72784,73040,73120,73552,92768,92864,93008,123200,123632,124144,125264,130032],bx=/* @__PURE__ */ new Map,xx=1632,Sx=(/* @__PURE__ */ new Uint8Array(63904)).fill(255);for(let e of yx)for(let t=0;t<10;t++){let n=e+t;n<=65535?Sx[n-xx]=t:bx.set(n,t)}let Cx=/* @__PURE__ */ new Set([8722,65293,65123]);function wx(e){if(typeof e!=`string`)return e;let t=e.length;if(t===0)return e;let n=-1;for(let r=0;r<t;r++){let i=e.charCodeAt(r);if(!(i>=48&&i<=57||i===45)){if(i<1632){if(Cx.has(i)){n=r;break}}else if(i>=55296&&i<=56319){if(r+1<t){let t=e.charCodeAt(r+1);if(t>=56320&&t<=57343){let e=65536+(i-55296<<10)+(t-56320);if(bx.has(e)){n=r;break}}}}else if(Sx[i-1632]!==255||Cx.has(i)){n=r;break}}}if(n===-1)return e;let r=[];n>0&&r.push(e.slice(0,n));for(let i=n;i<t;i++){let n=e.charCodeAt(i);if(n>=48&&n<=57||n===45){r.push(e[i]);continue}if(n<1632){r.push(Cx.has(n)?`-`:e[i]);continue}if(n>=55296&&n<=56319){if(i+1<t){let t=e.charCodeAt(i+1);if(t>=56320&&t<=57343){let e=65536+(n-55296<<10)+(t-56320),a=bx.get(e);if(a!==void 0){r.push(String.fromCharCode(a+48)),i++;continue}}}r.push(e[i]);continue}if(Cx.has(n)){r.push(`-`);continue}let a=Sx[n-xx];r.push(a===255?e[i]:String.fromCharCode(a+48))}return r.join(``)}let Tx=/^[-+]?0x[a-fA-F0-9]+$/,Ex=/^0b[01]+$/,Dx=/^0o[0-7]+$/,Ox=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,kx={hex:!0,binary:!1,octal:!1,leadingZeros:!0,decimalPoint:`.`,eNotation:!0,infinity:`original`,unicode:!1};function Ax(e,t={}){if(t=Object.assign({},kx,t),!e||typeof e!=`string`)return e;let n=e.trim();if(n.length===0||t.skipLike!==void 0&&t.skipLike.test(n))return e;if(n===`0`||t.unicode&&(n=wx(n),n===`0`))return 0;if(t.hex&&Tx.test(n))return Px(n,16);if(t.binary&&Ex.test(n))return Px(n,2);if(t.octal&&Dx.test(n))return Px(n,8);if(!isFinite(n)){let r=Number(n);return Number.isNaN(r)?e:Fx(e,r,t)}if(n.includes(`e`)||n.includes(`E`))return Mx(e,n,t);{let r=Ox.exec(n);if(r){let i=r[1]||``,a=r[2],o=Nx(r[3]),s=i?n[a.length+1]===`.`:n[a.length]===`.`;if(!t.leadingZeros&&(a.length>1||a.length===1&&!s))return e;{let r=Number(n),s=String(r);if(r===0)return r;if(s.search(/[eE]/)!==-1)return t.eNotation?r:e;if(n.indexOf(`.`)!==-1)return s===`0`||s===o||s===`${i}${o}`?r:e;let c=a?o:n;return a?c===s||i+c===s?r:e:c===s||c===i+s?r:e}}return e}}let jx=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function Mx(e,t,n){if(!n.eNotation)return e;let r=t.match(jx);if(r){let i=r[1]||``,a=r[3].indexOf(`e`)===-1?`E`:`e`,o=r[2],s=i?t[o.length+1]===a:t[o.length]===a;return o.length>1&&s?e:o.length===1&&(r[3].startsWith(`.${a}`)||r[3][0]===a)?Number(t):o.length>0?n.leadingZeros&&!s?Number(t):e:Number(t)}return e}function Nx(e){if(e&&e.indexOf(`.`)!==-1){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e=e.slice(0,t),e===`.`?e=`0`:e[0]===`.`?e=`0`+e:e[e.length-1]===`.`&&(e=e.substring(0,e.length-1)),e}return e}function Px(e,t){let n=e.trim();if((t===2||t===8)&&(e=n.substring(2)),parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw Error(`parseInt, Number.parseInt, window.parseInt are not supported`)}function Fx(e,t,n){let r=t===1/0;switch(n.infinity.toLowerCase()){case`null`:return null;case`infinity`:return t;case`string`:return r?`Infinity`:`-Infinity`;default:return e}}function Ix(e){return typeof e==`function`?e:Array.isArray(e)?t=>{for(let n of e)if(typeof n==`string`&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}var Lx=class{constructor(e,t={},n){this.pattern=e,this.separator=t.separator||`.`,this.segments=this._parse(e),this.data=n,this._hasDeepWildcard=this.segments.some(e=>e.type===`deep-wildcard`),this._hasAttributeCondition=this.segments.some(e=>e.attrName!==void 0),this._hasPositionSelector=this.segments.some(e=>e.position!==void 0)}_parse(e){let t=[],n=0,r=``;for(;n<e.length;)e[n]===this.separator?n+1<e.length&&e[n+1]===this.separator?(r.trim()&&(t.push(this._parseSegment(r.trim())),r=``),t.push({type:`deep-wildcard`}),n+=2):(r.trim()&&t.push(this._parseSegment(r.trim())),r=``,n++):(r+=e[n],n++);return r.trim()&&t.push(this._parseSegment(r.trim())),t}_parseSegment(e){let t={type:`tag`},n=null,r=e,i=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(i&&(r=i[1]+i[3],i[2])){let e=i[2].slice(1,-1);e&&(n=e)}let a,o=r;if(r.includes(`::`)){let t=r.indexOf(`::`);if(a=r.substring(0,t).trim(),o=r.substring(t+2).trim(),!a)throw Error(`Invalid namespace in pattern: ${e}`)}let s,c=null;if(o.includes(`:`)){let e=o.lastIndexOf(`:`),t=o.substring(0,e).trim(),n=o.substring(e+1).trim();[`first`,`last`,`odd`,`even`].includes(n)||/^nth\(\d+\)$/.test(n)?(s=t,c=n):s=o}else s=o;if(!s)throw Error(`Invalid segment pattern: ${e}`);if(t.tag=s,a&&(t.namespace=a),n){if(n.includes(`=`)){let e=n.indexOf(`=`);t.attrName=n.substring(0,e).trim(),t.attrValue=n.substring(e+1).trim()}else t.attrName=n.trim()}if(c){let e=c.match(/^nth\((\d+)\)$/);e?(t.position=`nth`,t.positionValue=parseInt(e[1],10)):t.position=c}return t}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}},Rx=class{constructor(){this._byDepthAndTag=/* @__PURE__ */ new Map,this._wildcardByDepth=/* @__PURE__ */ new Map,this._deepWildcards=[],this._deepByTerminalTag=/* @__PURE__ */ new Map,this._patterns=/* @__PURE__ */ new Set,this._sealed=!1}add(e){if(this._sealed)throw TypeError(`ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.`);if(this._patterns.has(e.pattern))return this;if(this._patterns.add(e.pattern),e.hasDeepWildcard()){let t=e.segments[e.segments.length-1];if(t&&t.type!==`deep-wildcard`&&t.tag!==`*`){let n=t.tag;this._deepByTerminalTag.has(n)||this._deepByTerminalTag.set(n,[]),this._deepByTerminalTag.get(n).push(e)}else this._deepWildcards.push(e);return this}let t=e.length,n=e.segments[e.segments.length-1]?.tag;if(!n||n===`*`)this._wildcardByDepth.has(t)||this._wildcardByDepth.set(t,[]),this._wildcardByDepth.get(t).push(e);else{let r=`${t}:${n}`;this._byDepthAndTag.has(r)||this._byDepthAndTag.set(r,[]),this._byDepthAndTag.get(r).push(e)}return this}addAll(e){for(let t of e)this.add(t);return this}has(e){return this._patterns.has(e.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(e){return this.findMatch(e)!==null}findMatch(e){let t=e.getDepth(),n=e.getCurrentTag(),r=`${t}:${n}`,i=this._byDepthAndTag.get(r);if(i){for(let t=0;t<i.length;t++)if(e.matches(i[t]))return i[t]}let a=this._wildcardByDepth.get(t);if(a){for(let t=0;t<a.length;t++)if(e.matches(a[t]))return a[t]}let o=this._deepByTerminalTag.get(n);if(o){for(let t=0;t<o.length;t++)if(e.matches(o[t]))return o[t]}for(let t=0;t<this._deepWildcards.length;t++)if(e.matches(this._deepWildcards[t]))return this._deepWildcards[t];return null}},zx=class{constructor(e){this._matcher=e}get separator(){return this._matcher.separator}getCurrentTag(){let e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){let e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){let t=this._matcher.path;if(t.length!==0)return t[t.length-1].values?.[e]}hasAttr(e){let t=this._matcher.path;if(t.length===0)return!1;let n=t[t.length-1];return n.values!==void 0&&e in n.values}getAnyParentAttr(e){return this._matcher.getAnyParentAttr(e)}hasAnyParentAttr(e){return this._matcher.hasAnyParentAttr(e)}getPosition(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,t=!0){return this._matcher.toString(e,t)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}},Bx=class{constructor(e={}){this.separator=e.separator||`.`,this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new zx(this),this._keptAttrs=[]}push(e,t=null,n=null,r=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let i=this.path.length,a=this.siblingStacks[i];a||(a={counts:/* @__PURE__ */ new Map,total:0},this.siblingStacks[i]=a);let o=n?`${n}:${e}`:e,s=a.counts.get(o)||0,c=a.total;a.counts.set(o,s+1),a.total++;let l={tag:e,position:c,counter:s};n!=null&&(l.namespace=n),t!=null&&(l.values=t),this.path.push(l);let u=this.path.length,d=r===null?null:r.keep;if(d!=null&&d.length>0&&t)for(let e=0;e<d.length;e++){let n=d[e];t[n]!==void 0&&this._keptAttrs.push({depth:u,name:n,value:t[n]})}}pop(){if(this.path.length===0)return;this._pathStringCache=null;let e=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);let t=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=t;)this._keptAttrs.pop();return e}updateCurrent(e){if(this.path.length>0){let t=this.path[this.path.length-1];e!=null&&(t.values=e)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return!1;let t=this.path[this.path.length-1];return t.values!==void 0&&e in t.values}getAnyParentAttr(e){let t=this._keptAttrs;for(let n=t.length-1;n>=0;n--)if(t[n].name===e)return t[n].value}hasAnyParentAttr(e){let t=this._keptAttrs;for(let n=t.length-1;n>=0;n--)if(t[n].name===e)return!0;return!1}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,t=!0){let n=e||this.separator;if(n===this.separator&&t===!0){if(this._pathStringCache!==null)return this._pathStringCache;let e=this.path.map(e=>e.namespace?`${e.namespace}:${e.tag}`:e.tag).join(n);return this._pathStringCache=e,e}return this.path.map(e=>t&&e.namespace?`${e.namespace}:${e.tag}`:e.tag).join(n)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(e){let t=e.segments;return t.length===0?!1:e.hasDeepWildcard()?this._matchWithDeepWildcard(t):this._matchSimple(t)}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let t=0;t<e.length;t++)if(!this._matchSegment(e[t],this.path[t],t===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(e){let t=this.path.length-1,n=e.length-1;for(;n>=0&&t>=0;){let r=e[n];if(r.type===`deep-wildcard`){if(n--,n<0)return!0;let r=e[n],i=!1;for(let e=t;e>=0;e--)if(this._matchSegment(r,this.path[e],e===this.path.length-1)){t=e-1,n--,i=!0;break}if(!i)return!1}else{if(!this._matchSegment(r,this.path[t],t===this.path.length-1))return!1;t--,n--}}return n<0}_matchSegment(e,t,n){if(e.tag!==`*`&&e.tag!==t.tag||e.namespace!==void 0&&e.namespace!==`*`&&e.namespace!==t.namespace||e.attrName!==void 0&&(!n||!t.values||!(e.attrName in t.values)||e.attrValue!==void 0&&String(t.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!n)return!1;let r=t.counter??0;if(e.position===`first`&&r!==0||e.position===`odd`&&r%2!=1||e.position===`even`&&r%2!=0||e.position===`nth`&&r!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>e&&{counts:new Map(e.counts),total:e.total}),keptAttrs:this._keptAttrs.map(e=>({...e}))}}restore(e){this._pathStringCache=null,this.path=e.path.map(e=>({...e})),this.siblingStacks=e.siblingStacks.map(e=>e&&{counts:new Map(e.counts),total:e.total}),this._keptAttrs=(e.keptAttrs||[]).map(e=>({...e}))}readOnly(){return this._view}};let Vx=[{id:`html-script-open`,description:`<script opening tag`,pattern:/<script[\s>/]/i},{id:`html-script-close`,description:`<\/script closing tag`,pattern:/<\/script[\s>]/i},{id:`html-javascript-protocol`,description:`javascript: URI scheme (with optional whitespace/encoding)`,pattern:/j[\t\n\r ]*a[\t\n\r ]*v[\t\n\r ]*a[\t\n\r ]*s[\t\n\r ]*c[\t\n\r ]*r[\t\n\r ]*i[\t\n\r ]*p[\t\n\r ]*t[\t\n\r ]*:/i},{id:`html-vbscript-protocol`,description:`vbscript: URI scheme`,pattern:/vbscript[\t\n\r ]*:/i},{id:`html-data-html`,description:`data:text/html URI — can execute scripts in browsers`,pattern:/data[\t\n\r ]*:[\t\n\r ]*text\/html/i},{id:`html-data-xhtml`,description:`data:application/xhtml+xml URI`,pattern:/data[\t\n\r ]*:[\t\n\r ]*application\/xhtml/i},{id:`html-data-svg`,description:`data:image/svg+xml URI — can execute scripts`,pattern:/data[\t\n\r ]*:[\t\n\r ]*image\/svg\+xml/i},{id:`html-inline-event-handler`,description:`Inline event handler attributes: onclick=, onerror=, onload=, etc.`,pattern:/\bon\w{1,30}\s*=/i},{id:`html-entity-obfuscated-script`,description:`HTML-entity-encoded <script (e.g. <script or <script)`,pattern:/(?:�*3[Cc];?|�*60;?|<)\s*script/i},{id:`html-entity-obfuscated-javascript`,description:`HTML-entity-encoded javascript: (partial — catches common j or j for "j")`,pattern:/(?:�*6[Aa];?|�*106;?)\s*(?:�*61;?|a)[\s\S]{0,80}script\s*:/i},{id:`html-style-expression`,description:`CSS expression() — IE-era code execution in style attributes`,pattern:/style[\s\S]{0,20}expression\s*\(/i},{id:`html-object-embed`,description:`<object or <embed tags that can load active content`,pattern:/<(?:object|embed)[\s>/]/i},{id:`html-base-tag`,description:`<base href= — can hijack all relative URLs on a page`,pattern:/<base[\s>]/i},{id:`html-meta-refresh`,description:`<meta http-equiv="refresh" — can redirect users`,pattern:/<meta[\s\S]{0,40}http-equiv[\s\S]{0,20}refresh/i},{id:`html-srcdoc`,description:`srcdoc= attribute on iframes — embeds HTML that can run scripts`,pattern:/srcdoc\s*=/i},{id:`html-iframe`,description:`<iframe tag`,pattern:/<iframe[\s>/]/i},{id:`html-form`,description:`<form tag — can be used for phishing / credential harvesting injection`,pattern:/<form[\s>/]/i}],Hx=[{id:`xml-cdata-injection`,description:`CDATA section injection: <![CDATA[ breaks out of text node context`,pattern:/<!\[CDATA\[/i},{id:`xml-cdata-close`,description:`CDATA close sequence: ]]> can terminate an enclosing CDATA section`,pattern:/\]\]>/},{id:`xml-processing-instruction`,description:`XML processing instruction: <?xml-stylesheet or <?php etc.`,pattern:/<\?(?:xml[\- ]|php|asp)/i},{id:`xml-doctype-injection`,description:`DOCTYPE declaration embedded in content — can define entities`,pattern:/<!DOCTYPE(?:[\s[]|$)/i},{id:`xml-entity-system`,description:`SYSTEM keyword — used in external entity declarations (XXE)`,pattern:/\bSYSTEM\s+["']/i},{id:`xml-entity-public`,description:`PUBLIC keyword — used in external entity declarations (XXE)`,pattern:/\bPUBLIC\s+["']/i},{id:`xml-entity-declaration`,description:`<!ENTITY declaration — defines entities, potential XXE or entity expansion`,pattern:/<!ENTITY[\s%]/i},{id:`xml-billion-laughs`,description:`Entity reference chaining / billion laughs: repeated &eX; style references`,pattern:/(?:&\w{1,20};){3,}/},{id:`xml-namespace-confusion`,description:`xmlns: attribute injection — can redefine namespaces to confuse parsers`,pattern:/\bxmlns(?::\w{1,40})?\s*=/i},{id:`xml-comment-injection`,description:`<!-- comment injection — can hide content from some parsers`,pattern:/<!--/},{id:`xml-comment-close`,description:`--> closes an enclosing XML comment`,pattern:/-->/},{id:`xml-pi-close`,description:`?> closes an enclosing processing instruction`,pattern:/\?>/}],Ux=[{id:`svg-script-element`,description:`<script element inside SVG executes JavaScript`,pattern:/<script[\s>/]/i},{id:`svg-xlink-href-javascript`,description:`xlink:href with javascript: — classic SVG XSS via <a> or <use>`,pattern:/xlink\s*:\s*href\s*=\s*["']?\s*javascript\s*:/i},{id:`svg-href-javascript`,description:`href= with javascript: in SVG context (<a>, <animate>, etc.)`,pattern:/href\s*=\s*["']?\s*javascript\s*:/i},{id:`svg-foreignobject`,description:`<foreignObject embeds HTML inside SVG — can execute scripts`,pattern:/<foreignObject[\s>/]/i},{id:`svg-use-external`,description:`<use xlink:href or href pointing to external resource (non-fragment URL)`,pattern:/<use[\s\S]{0,60}(?:xlink\s*:\s*)?href\s*=\s*(?:["'][^#]|[^"'#\s>])/i},{id:`svg-animate-href`,description:`<animate attributeName="href" — can dynamically change href to javascript:`,pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*href["']/i},{id:`svg-animate-xlinkhref`,description:`<animate attributeName="xlink:href"`,pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*xlink\s*:\s*href["']/i},{id:`svg-set-javascript`,description:`<set to="javascript:..." — sets an attribute to a javascript: URI`,pattern:/<set[\s\S]{0,80}to\s*=\s*["']?\s*javascript\s*:/i},{id:`svg-event-handler`,description:`SVG-specific event handler attributes: onload=, onerror=, onactivate=, etc.`,pattern:/\bon(?:load|error|activate|begin|end|repeat|focus|blur|click|mouse\w{1,20}|key\w{1,20})\s*=/i},{id:`svg-handler-generic`,description:`Generic on* handler catch-all for SVG attributes`,pattern:/\bon\w{1,30}\s*=/i},{id:`svg-filter-feimage`,description:`<feImage href= — filter primitive that can load external resources`,pattern:/<feImage[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=/i},{id:`svg-image-external`,description:`<image xlink:href with http/https or javascript protocol`,pattern:/<image[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=\s*["']?\s*(?:https?|javascript)\s*:/i},{id:`svg-style-javascript`,description:`style= attribute containing javascript: (e.g. background:url(javascript:...))`,pattern:/style\s*=[\s\S]{0,60}javascript\s*:/i}],Wx=[{id:`sql-block-comment-open`,description:`SQL block comment open: /* ... */ — unusual in legitimate user text`,pattern:/\/\*/},{id:`sql-union-select`,description:`UNION SELECT — most common SQL injection aggregation attack`,pattern:/\bUNION\s{1,20}(?:ALL\s{1,20})?SELECT\b/i},{id:`sql-drop-table`,description:`DROP TABLE — destructive DDL injection`,pattern:/\bDROP\s{1,20}TABLE\b/i},{id:`sql-drop-database`,description:`DROP DATABASE — destructive DDL injection`,pattern:/\bDROP\s{1,20}DATABASE\b/i},{id:`sql-insert-into`,description:`INSERT INTO — data injection`,pattern:/\bINSERT\s{1,20}INTO\b/i},{id:`sql-delete-from`,description:`DELETE FROM — data deletion injection`,pattern:/\bDELETE\s{1,20}FROM\b/i},{id:`sql-update-set`,description:`UPDATE ... SET — data modification injection`,pattern:/\bUPDATE\b[\s\S]{1,60}\bSET\b/i},{id:`sql-exec-xp`,description:`EXEC xp_ — MSSQL extended stored procedure execution`,pattern:/\bEXEC(?:UTE)?\s{1,20}xp_/i},{id:`sql-tautology-string`,description:`Classic string tautology: ' OR '1'='1 or " OR "1"="1"`,pattern:/'\s{0,10}OR\s{0,10}'[^']{0,20}'\s*=\s*'[^']{0,20}/i},{id:`sql-tautology-numeric`,description:`Numeric tautology: OR 1=1`,pattern:/\bOR\s{1,10}1\s*=\s*1\b/i},{id:`sql-always-true-zero`,description:`Numeric tautology: OR 0=0`,pattern:/\bOR\s{1,10}0\s*=\s*0\b/i},{id:`sql-sleep-benchmark`,description:`Time-based blind injection: SLEEP() or BENCHMARK()`,pattern:/\b(?:SLEEP|BENCHMARK)\s*\(/i},{id:`sql-waitfor-delay`,description:`MSSQL time-based blind injection: WAITFOR DELAY`,pattern:/\bWAITFOR\s{1,20}DELAY\b/i},{id:`sql-char-function`,description:`CHAR() function — used to obfuscate injected strings`,pattern:/\bCHAR\s*\(\s*\d{1,3}/i},{id:`sql-information-schema`,description:`INFORMATION_SCHEMA — reconnaissance query for table/column enumeration`,pattern:/\bINFORMATION_SCHEMA\b/i}],Gx=[{id:`shell-path-traversal-unix`,description:`Unix path traversal: ../ — climbing the directory tree`,pattern:/\.\.\//},{id:`shell-path-traversal-windows`,description:`Windows path traversal: ..\\ — climbing the directory tree`,pattern:/\.\.\\/},{id:`shell-path-traversal-encoded`,description:`URL-encoded path traversal: %2e%2e or %2f variants`,pattern:/%2e%2e|%2f\.\.|\.\.%2f/i},{id:`shell-null-byte`,description:`Null byte injection: \\x00 or %00 — truncates strings in C-backed functions`,pattern:/\x00|%00/},{id:`shell-semicolon`,description:`Semicolon command separator: cmd1; cmd2`,pattern:/;/},{id:`shell-pipe`,description:`Pipe operator: cmd1 | cmd2`,pattern:/\|/},{id:`shell-and-operator`,description:`AND operator: cmd1 && cmd2`,pattern:/&&/},{id:`shell-or-operator`,description:`OR operator: cmd1 || cmd2`,pattern:/\|\|/},{id:`shell-backtick`,description:"Backtick command substitution: `cmd`",pattern:/`/},{id:`shell-dollar-paren`,description:`Dollar-paren command substitution: $(cmd)`,pattern:/\$\(/},{id:`shell-dollar-brace`,description:"Dollar-brace variable expansion: ${var} — can be abused for injection",pattern:/\$\{/},{id:`shell-redirect-out`,description:`Output redirection: cmd > file or cmd >> file`,pattern:/>{1,2}/},{id:`shell-redirect-in`,description:`Input redirection: cmd < file`,pattern:/</},{id:`shell-newline-injection`,description:`Newline injection: \\n or \\r — can inject new shell commands`,pattern:/[\n\r]/},{id:`shell-glob-star`,description:`Glob expansion: * or ? — can expand to unintended files`,pattern:/[/\\][*?]/},{id:`shell-absolute-root`,description:`Absolute root path injection: string starting with / or \\ (Windows UNC)`,pattern:/^(?:\/|\\\\)/},{id:`shell-windows-drive`,description:`Windows drive letter path injection: C:\\ or D:/`,pattern:/^[a-zA-Z]:[/\\]/},{id:`shell-curl-wget`,description:`curl/wget with URL or flags — can exfiltrate data or download payloads`,pattern:/\b(?:curl|wget)\s+(?:https?:\/\/|ftp:\/\/|-)/i}],Kx=[{id:`redos-nested-quantifier-plus`,description:`Nested + quantifier inside a group with outer quantifier: (a+)+, (.+b)*, etc.`,pattern:/\([^)]*\+[^)]*\)[+*]/},{id:`redos-nested-quantifier-star`,description:`Nested * quantifier: (a*)* or (a*)+ — catastrophic backtracking`,pattern:/\([^)]*\*[^)]*\)[*+]/},{id:`redos-nested-groups`,description:`Doubly nested quantified groups: ((a+)+) — guaranteed catastrophic`,pattern:/\(\([^)]{0,40}\)[+*]\)[+*]/},{id:`redos-alternation-overlap`,description:`Overlapping alternation under quantifier: (a|a)+ — ambiguous NFA paths`,pattern:/\(([^|()]{1,20})\|(?:\1)(?:\|[^|()]{1,20}){0,5}\)[+*?]{1,2}/},{id:`redos-star-plus-concat`,description:`(x*x)+ pattern — triggers super-linear backtracking`,pattern:/\([^)]{0,10}\*[^)]{0,10}\)[+*]/},{id:`redos-dot-star-greedy`,description:`(.*){n,} or (.+){n,} — repeated greedy dot quantifiers`,pattern:/\(\.[*+]\)\{?\d/},{id:`redos-large-repetition`,description:`Very large fixed or range repetition count {1000,} or {1000,n} — denial of service via backtracking`,pattern:/\{\d{4,}(?:,\d*)?\}/},{id:`redos-catastrophic-alternation`,description:`Long alternation with many similar branches — polynomial backtracking risk`,pattern:/\([^)]{0,200}(?:\|[^|)]{0,50}){9,}\)/}],qx=`["'\\s]*:`,Jx=[{id:`nosql-where-operator`,description:`$where — executes arbitrary JavaScript server-side in MongoDB`,pattern:RegExp(`\\$where${qx}`,`i`)},{id:`nosql-ne-operator`,description:`$ne — "not equal" operator used to bypass equality checks`,pattern:RegExp(`\\$ne${qx}`,`i`)},{id:`nosql-gt-operator`,description:`$gt — "greater than" used to bypass password/value checks`,pattern:RegExp(`\\$gte?${qx}`,`i`)},{id:`nosql-lt-operator`,description:`$lt / $lte — "less than" bypass variants`,pattern:RegExp(`\\$lte?${qx}`,`i`)},{id:`nosql-regex-operator`,description:`$regex — can be used to extract data character by character (blind injection)`,pattern:RegExp(`\\$regex${qx}`,`i`)},{id:`nosql-or-operator`,description:`$or — logical OR; used to create always-true conditions`,pattern:RegExp(`\\$or${qx}\\s*\\[`,`i`)},{id:`nosql-and-operator`,description:`$and — logical AND operator injection`,pattern:RegExp(`\\$and${qx}\\s*\\[`,`i`)},{id:`nosql-nor-operator`,description:`$nor — logical NOR operator injection`,pattern:RegExp(`\\$nor${qx}\\s*\\[`,`i`)},{id:`nosql-exists-operator`,description:`$exists — can enumerate fields to determine schema`,pattern:RegExp(`\\$exists${qx}`,`i`)},{id:`nosql-in-operator`,description:`$in — matches any value in a list; can enumerate values`,pattern:RegExp(`\\$in${qx}\\s*\\[`,`i`)},{id:`nosql-expr-operator`,description:`$expr — allows aggregation expressions in queries (MongoDB 3.6+)`,pattern:RegExp(`\\$expr${qx}`,`i`)},{id:`nosql-function-operator`,description:`$function — executes arbitrary JavaScript in MongoDB 4.4+`,pattern:RegExp(`\\$function${qx}`,`i`)},{id:`nosql-accumulator-operator`,description:`$accumulator — custom aggregation with arbitrary JS execution`,pattern:RegExp(`\\$accumulator${qx}`,`i`)},{id:`nosql-proto-pollution`,description:`__proto__ — prototype pollution via object key injection`,pattern:/__proto__/},{id:`nosql-constructor-prototype`,description:`constructor.prototype — alternative prototype pollution vector (dot notation or JSON key)`,pattern:/constructor[\s"':.,{\[]*prototype/i},{id:`nosql-proto-bracket`,description:`["__proto__"] — bracket-notation prototype pollution`,pattern:/\[["']__proto__["']\]/}],Yx=[{id:`log-crlf-injection`,description:`CRLF injection: literal \\r or \\n embeds fake log lines`,pattern:/[\r\n]/},{id:`log-url-encoded-crlf`,description:`URL-encoded CRLF: %0d, %0a, %0D, %0A — decoded by some log parsers`,pattern:/%0[dDaA]/},{id:`log-unicode-newline`,description:`Unicode newline variants: U+2028 (line separator), U+2029 (paragraph separator)`,pattern:/[\u2028\u2029]/},{id:`log-log4shell-jndi`,description:"Log4Shell: ${jndi:...} triggers remote code execution in Apache Log4j",pattern:/\$\{jndi\s*:/i},{id:`log-log4shell-obfuscated`,description:"Obfuscated Log4Shell: ${::-j}... lookup-bypass prefix used to evade WAF detection",pattern:/\$\{::-/},{id:`log-log4j-lookup`,description:"Log4j lookup syntax: ${env:...}, ${sys:...}, ${ctx:...} — data exfiltration",pattern:/\$\{(?:env|sys|ctx|main|map|sd|web|docker|k8s|spring)\s*:/i},{id:`log-ssti-double-brace`,description:`SSTI double-brace: {{expression}} — Jinja2, Twig, Handlebars, etc.`,pattern:/\{\{[\s\S]{0,80}\}\}/},{id:`log-ssti-hash-brace`,description:`SSTI hash-brace: #{expression} — Thymeleaf, Velocity, Ruby ERB`,pattern:/#\{[\s\S]{0,80}\}/},{id:`log-ssti-dollar-brace`,description:"SSTI/EL injection: ${expression with operators or method calls} — JSP EL, Freemarker, SpEL",pattern:/\$\{[^}]*(?:\.|\(|\*|\+|\bclass\b|\bruntime\b|\bprocess\b|\bexec\b)[^}]{0,80}\}/i},{id:`log-ssti-percent-tag`,description:`SSTI ERB/ASP tag: <%= expression %> — Ruby ERB, ASP`,pattern:/<%=[\s\S]{0,80}%>/},{id:`log-null-byte`,description:`Null byte: \\x00 or %00 — can truncate log entries in C-backed loggers`,pattern:/\x00|%00/},{id:`log-ansi-escape`,description:`ANSI escape sequence: ESC[ — can manipulate terminal output when logs are tailed`,pattern:/\x1b\[/}],Xx=[{id:`sql-line-comment`,description:`SQL line comment: -- followed by whitespace or end of string`,pattern:/--(?:\s|$)/},{id:`sql-stacked-query`,description:`Stacked queries: semicolon immediately followed by a SQL keyword`,pattern:/;\s{0,10}(?:SELECT|INSERT|UPDATE|DELETE|DROP|CREATE|ALTER|EXEC)\b/i},{id:`sql-hex-encoding`,description:`Hex-encoded string injection: 0x41414141 style (MySQL)`,pattern:/\b0x[0-9a-f]{4,}/i}],Zx=[...Wx,...Xx];Vx.label=`HTML`,Hx.label=`XML`,Ux.label=`SVG`,Wx.label=`SQL`,Zx.label=`SQL-STRICT`,Gx.label=`SHELL`,Kx.label=`REDOS`,Jx.label=`NOSQL`,Yx.label=`LOG`,Object.freeze({HTML:Vx,XML:Hx,SVG:Ux,SQL:Wx,"SQL-STRICT":Zx,SHELL:Gx,REDOS:Kx,NOSQL:Jx,LOG:Yx});function Qx(e){if(typeof e!=`string`)throw TypeError(`is-unsafe: first argument must be a string, got ${typeof e}`)}function $x(e){if(!(e instanceof RegExp)){if(Array.isArray(e)){if(e.length===0)throw TypeError(`is-unsafe: context must not be an empty array`);if(Array.isArray(e[0])){for(let t of e)if(!Array.isArray(t)||t.length===0)throw TypeError(`is-unsafe: each context in the array must be a non-empty pattern array (PatternList)`)}}else throw TypeError(`is-unsafe: second argument must be a PatternList (e.g. HTML), an array of PatternLists (e.g. [HTML, XML]), or a RegExp. Got: ${typeof e}`)}}function eS(e){return e instanceof RegExp?{lists:null,regex:e}:Array.isArray(e[0])?{lists:e,regex:null}:{lists:[e],regex:null}}function tS(e,t){let n=t.label??`CUSTOM`;for(let r of t)if(r.pattern.test(e))return{context:n,id:r.id,description:r.description,pattern:r.pattern};return null}function nS(e,t){Qx(e),$x(t);let{lists:n,regex:r}=eS(t);if(r)return r.test(e);for(let t of n)if(tS(e,t)!==null)return!0;return!1}function rS(e,t){if(!e)return{};let n=t.attributesGroupName?e[t.attributesGroupName]:e;if(!n)return{};let r={};for(let e in n)if(e.startsWith(t.attributeNamePrefix)){let i=e.substring(t.attributeNamePrefix.length);r[i]=n[e]}else r[e]=n[e];return r}function iS(e){if(!e||typeof e!=`string`)return;let t=e.indexOf(`:`);if(t!==-1&&t>0){let n=e.substring(0,t);if(n!==`xmlns`)return n}}var aS=class{constructor(e,t){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=uS,this.parseTextData=oS,this.resolveNameSpace=sS,this.buildAttributesMap=lS,this.isItStopNode=mS,this.replaceEntitiesValue=fS,this.readStopNodeData=yS,this.saveTextToParentTag=pS,this.addChild=dS,this.ignoreAttributesFn=Ix(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.doctypefound=!1;let n={...Ub};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities==`object`?n=this.options.htmlEntities:this.options.htmlEntities===!0&&(n={...Wb,...Hb}),this.entityDecoder=new tx({namedEntities:{...n,...t},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo},onInputEntity:(e,t)=>nS(t,[Vx,Hx])?Gb.BLOCK:Gb.ALLOW})),this.matcher=new Bx,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new Rx;let r=this.options.stopNodes;if(r&&r.length>0){for(let e=0;e<r.length;e++){let t=r[e];typeof t==`string`?this.stopNodeExpressionsSet.add(new Lx(t)):t instanceof Lx&&this.stopNodeExpressionsSet.add(t)}this.stopNodeExpressionsSet.seal()}}};function oS(e,t,n,r,i,a,o){let s=this.options;if(e!==void 0&&(s.trimValues&&!r&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e,t,n));let r=s.jPath?n.toString():n,c=s.tagValueProcessor(t,e,r,i,a);return c==null?e:typeof c!=typeof e||c!==e?c:s.trimValues||e.trim()===e?bS(e,s.parseTagValue,s.numberParseOptions):e}}function sS(e){if(this.options.removeNSPrefix){let t=e.split(`:`),n=e.charAt(0)===`/`?`/`:``;if(t[0]===`xmlns`)return``;t.length===2&&(e=n+t[1])}return e}let cS=/* @__PURE__ */ RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,`gm`);function lS(e,t,n,r=!1){let i=this.options;if(r===!0||i.ignoreAttributes!==!0&&typeof e==`string`){let r=Sb(e,cS),a=r.length,o={},s=Array(a),c=!1,l={};for(let e=0;e<a;e++){let t=this.resolveNameSpace(r[e][1]),a=r[e][4];if(t.length&&a!==void 0){let r=a;i.trimValues&&(r=r.trim()),r=this.replaceEntitiesValue(r,n,this.readonlyMatcher),s[e]=r,l[t]=r,c=!0}}c&&typeof t==`object`&&t.updateCurrent&&t.updateCurrent(l);let u=i.jPath?t.toString():this.readonlyMatcher,d=!1;for(let e=0;e<a;e++){let t=this.resolveNameSpace(r[e][1]);if(this.ignoreAttributesFn(t,u))continue;let n=i.attributeNamePrefix+t;if(t.length){if(i.transformAttributeName&&(n=i.transformAttributeName(n)),n=SS(n,i),r[e][4]!==void 0){let r=s[e],a=i.attributeValueProcessor(t,r,u);a==null?o[n]=r:typeof a!=typeof r||a!==r?o[n]=a:o[n]=bS(r,i.parseAttributeValue,i.numberParseOptions),d=!0}else i.allowBooleanAttributes&&(o[n]=!0,d=!0)}}if(!d)return;if(i.attributesGroupName&&!i.preserveOrder){let e={};return e[i.attributesGroupName]=o,e}return o}}let uS=function(e){e=e.replace(/\r\n?/g,`
|
|
168
|
+
`);let t=new cx(`!xml`),n=t,r=``;this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0,this.doctypefound=!1;let i=this.options,a=new hx(i.processEntities),o=e.length;for(let s=0;s<o;s++)if(e[s]===`<`){let c=e.charCodeAt(s+1);if(c===47){let a=gS(e,`>`,s,`Closing Tag is not closed.`),o=e.substring(s+2,a).trim();if(i.removeNSPrefix){let e=o.indexOf(`:`);e!==-1&&(o=o.substr(e+1))}o=xS(i.transformTagName,o,``,i).tagName,n&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher));let c=this.matcher.getCurrentTag();if(o&&i.unpairedTagsSet.has(o))throw Error(`Unpaired tag can not be used as closing tag: </${o}>`);c&&i.unpairedTagsSet.has(c)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,n=this.tagsNodeStack.pop()||t,i.captureMetaData&&n&&n.addEndIndex(a+1),r=``,s=a}else if(c===63){let t=vS(e,s,!1,`?>`);if(!t)throw Error(`Pi Tag is not closed.`);r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let o=this.buildAttributesMap(t.tagExp,this.matcher,t.tagName,!0);if(o){let e=o[this.options.attributeNamePrefix+`version`];this.entityDecoder.setXmlVersion(Number(e)||1),a.setXmlVersion(Number(e)||1)}if(!(i.ignoreDeclaration&&t.tagName===`?xml`||i.ignorePiTags)){let e=new cx(t.tagName);e.add(i.textNodeName,``),t.tagName!==t.tagExp&&t.attrExpPresent&&i.ignoreAttributes!==!0&&(e[`:@`]=o),this.addChild(n,e,this.readonlyMatcher,s),i.captureMetaData&&n.addEndIndex(t.closeIndex+2)}s=t.closeIndex+1}else if(c===33&&e.charCodeAt(s+2)===45&&e.charCodeAt(s+3)===45){let t=gS(e,`-->`,s+4,`Comment is not closed.`);if(i.commentPropName){let a=e.substring(s+4,t-2);r=this.saveTextToParentTag(r,n,this.readonlyMatcher),n.add(i.commentPropName,[{[i.textNodeName]:a}])}s=t}else if(c===33&&e.charCodeAt(s+2)===68){if(this.doctypefound)throw Error(`Multiple DOCTYPE declarations found.`);this.doctypefound=!0;let t=a.readDocType(e,s);this.entityDecoder.addInputEntities(t.entities),s=t.i}else if(c===33&&e.charCodeAt(s+2)===91){let t=gS(e,`]]>`,s,`CDATA is not closed.`)-2,a=e.substring(s+9,t);r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let o=this.parseTextData(a,n.tagname,this.readonlyMatcher,!0,!1,!0,!0);o??=``,i.cdataPropName?n.add(i.cdataPropName,[{[i.textNodeName]:a}]):n.add(i.textNodeName,o),s=t+2}else{let a=vS(e,s,i.removeNSPrefix);if(!a){let t=e.substring(Math.max(0,s-50),Math.min(o,s+50));throw Error(`readTagExp returned undefined at position ${s}. Context: "${t}"`)}let c=a.tagName,l=a.rawTagName,u=a.tagExp,d=a.attrExpPresent,f=a.closeIndex;if({tagName:c,tagExp:u}=xS(i.transformTagName,c,u,i),i.strictReservedNames&&(c===i.commentPropName||c===i.cdataPropName||c===i.textNodeName||c===i.attributesGroupName))throw Error(`Invalid tag name: ${c}`);n&&r&&n.tagname!==`!xml`&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher,!1));let p=n;p&&i.unpairedTagsSet.has(p.tagname)&&(n=this.tagsNodeStack.pop(),this.matcher.pop());let m=!1;u.length>0&&u.lastIndexOf(`/`)===u.length-1&&(m=!0,c[c.length-1]===`/`?(c=c.substr(0,c.length-1),u=c):u=u.substr(0,u.length-1),d=c!==u);let h=null,g;g=iS(l),c!==t.tagname&&this.matcher.push(c,{},g),c!==u&&d&&(h=this.buildAttributesMap(u,this.matcher,c),h&&rS(h,i)),c!==t.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let _=s;if(this.isCurrentNodeStopNode){let t=``;if(m)s=a.closeIndex;else if(i.unpairedTagsSet.has(c))s=a.closeIndex;else{let n=this.readStopNodeData(e,l,f+1);if(!n)throw Error(`Unexpected end of ${l}`);s=n.i,t=n.tagContent}let r=new cx(c);h&&(r[`:@`]=h),r.add(i.textNodeName,t),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(n,r,this.readonlyMatcher,_),i.captureMetaData&&n.addEndIndex(s+1)}else{if(m){({tagName:c,tagExp:u}=xS(i.transformTagName,c,u,i));let e=new cx(c);h&&(e[`:@`]=h),this.addChild(n,e,this.readonlyMatcher,_),i.captureMetaData&&n.addEndIndex(f+1),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(i.unpairedTagsSet.has(c)){let e=new cx(c);h&&(e[`:@`]=h),this.addChild(n,e,this.readonlyMatcher,_),i.captureMetaData&&n.addEndIndex(a.closeIndex+1),this.matcher.pop(),this.isCurrentNodeStopNode=!1,s=a.closeIndex;continue}else{let e=new cx(c);if(this.tagsNodeStack.length>i.maxNestedTags)throw Error(`Maximum nested tags exceeded`);this.tagsNodeStack.push(n),h&&(e[`:@`]=h),this.addChild(n,e,this.readonlyMatcher,_),n=e}r=``,s=f}}}else r+=e[s];return t.child};function dS(e,t,n,r){this.options.captureMetaData||(r=void 0);let i=this.options.jPath?n.toString():n,a=this.options.updateTag(t.tagname,i,t[`:@`]);a===!1||(typeof a==`string`&&(t.tagname=a),e.addChild(t,r))}function fS(e,t,n){let r=this.options.processEntities;if(!r||!r.enabled)return e;if(r.allowedTags){let i=this.options.jPath?n.toString():n;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(t):r.allowedTags(t,i)))return e}if(r.tagFilter){let i=this.options.jPath?n.toString():n;if(!r.tagFilter(t,i))return e}return this.entityDecoder.decode(e)}function pS(e,t,n,r){return e&&=(r===void 0&&(r=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[`:@`]?Object.keys(t[`:@`]).length!==0:!1,r),e!==void 0&&e!==``&&t.add(this.options.textNodeName,e),``),e}function mS(){return this.stopNodeExpressionsSet.size!==0&&this.matcher.matchesAny(this.stopNodeExpressionsSet)}function hS(e,t,n=`>`){let r=0,i=e.length,a=n.charCodeAt(0),o=n.length>1?n.charCodeAt(1):-1,s=``,c=t;for(let n=t;n<i;n++){let t=e.charCodeAt(n);if(r)t===r&&(r=0);else if(t===34||t===39)r=t;else if(t===a){if(o!==-1){if(e.charCodeAt(n+1)===o)return s+=e.substring(c,n),{data:s,index:n}}else return s+=e.substring(c,n),{data:s,index:n}}else t===9&&!r&&(s+=e.substring(c,n)+` `,c=n+1)}}function gS(e,t,n,r){let i=e.indexOf(t,n);if(i===-1)throw Error(r);return i+t.length-1}function _S(e,t,n,r){let i=e.indexOf(t,n);if(i===-1)throw Error(r);return i}function vS(e,t,n,r=`>`){let i=hS(e,t+1,r);if(!i)return;let a=i.data,o=i.index,s=a.search(/\s/),c=a,l=!0;s!==-1&&(c=a.substring(0,s),a=a.substring(s+1).trimStart());let u=c;if(n){let e=c.indexOf(`:`);e!==-1&&(c=c.substr(e+1),l=c!==i.data.substr(e+1))}return{tagName:c,tagExp:a,closeIndex:o,attrExpPresent:l,rawTagName:u}}function yS(e,t,n){let r=n,i=1,a=e.length;for(;n<a;n++)if(e[n]===`<`){let a=e.charCodeAt(n+1);if(a===47){let a=_S(e,`>`,n,`${t} is not closed`);if(e.substring(n+2,a).trim()===t&&(i--,i===0))return{tagContent:e.substring(r,n),i:a};n=a}else if(a===63)n=gS(e,`?>`,n+1,`StopNode is not closed.`);else if(a===33&&e.charCodeAt(n+2)===45&&e.charCodeAt(n+3)===45)n=gS(e,`-->`,n+3,`StopNode is not closed.`);else if(a===33&&e.charCodeAt(n+2)===91)n=gS(e,`]]>`,n,`StopNode is not closed.`)-2;else{let r=vS(e,n,!1);r&&((r&&r.tagName)===t&&r.tagExp[r.tagExp.length-1]!==`/`&&i++,n=r.closeIndex)}}}function bS(e,t,n){if(t&&typeof e==`string`){let t=e.trim();return t===`true`||t!==`false`&&Ax(e,n)}return wb(e)?e:``}function xS(e,t,n,r){if(e){let r=e(t);n===t&&(n=r),t=r}return t=SS(t,r),{tagName:t,tagExp:n}}function SS(e,t){if(Eb.includes(e))throw Error(`[SECURITY] Invalid name: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);return Tb.includes(e)?t.onDangerousProperty(e):e}let CS=cx.getMetaDataSymbol();function wS(e,t){if(!e||typeof e!=`object`)return{};if(!t)return e;let n={};for(let r in e)if(r.startsWith(t)){let i=r.substring(t.length);n[i]=e[r]}else n[r]=e[r];return n}function TS(e,t,n,r){return ES(e,t,n,r)}function ES(e,t,n,r){let i,a={};for(let o=0;o<e.length;o++){let s=e[o],c=DS(s);if(c!==void 0&&c!==t.textNodeName){let e=wS(s[`:@`]||{},t.attributeNamePrefix);n.push(c,e)}if(c===t.textNodeName)i===void 0?i=s[c]:i+=``+s[c];else if(c===void 0)continue;else if(s[c]){let e=ES(s[c],t,n,r),i=kS(e,t);if(Object.keys(e).length===0&&t.alwaysCreateTextNode&&(e[t.textNodeName]=``),s[`:@`]?OS(e,s[`:@`],r,t):Object.keys(e).length===1&&e[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?e=e[t.textNodeName]:Object.keys(e).length===0&&(t.alwaysCreateTextNode?e[t.textNodeName]=``:e=``),s[CS]!==void 0&&typeof e==`object`&&e&&(e[CS]=s[CS]),a[c]!==void 0&&Object.prototype.hasOwnProperty.call(a,c))Array.isArray(a[c])||(a[c]=[a[c]]),a[c].push(e);else{let n=t.jPath?r.toString():r;a[c]=t.isArray(c,n,i)?[e]:e}c!==void 0&&c!==t.textNodeName&&n.pop()}}return typeof i==`string`?i.length>0&&(a[t.textNodeName]=i):i!==void 0&&(a[t.textNodeName]=i),a}function DS(e){let t=Object.keys(e);for(let e=0;e<t.length;e++){let n=t[e];if(n!==`:@`)return n}}function OS(e,t,n,r){if(t){let i=Object.keys(t),a=i.length;for(let o=0;o<a;o++){let a=i[o],s=a.startsWith(r.attributeNamePrefix)?a.substring(r.attributeNamePrefix.length):a,c=r.jPath?n.toString()+`.`+s:n;e[a]=r.isArray(a,c,!0,!0)?[t[a]]:t[a]}}}function kS(e,t){let{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]==`boolean`||e[n]===0))}var AS=class{constructor(e){this.externalEntities={},this.options=ox(e)}parse(e,t){if(typeof e!=`string`&&e.toString)e=e instanceof Uint8Array&&!(typeof Buffer<`u`&&Buffer.isBuffer(e))?new TextDecoder(`utf-8`,{ignoreBOM:!0}).decode(e):e.toString();else if(typeof e!=`string`)throw Error(`XML data is accepted in String or Bytes[] form.`);if(t){t===!0&&(t={});let n=Ob(e,t);if(n!==!0)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}let n=new aS(this.options,this.externalEntities),r=n.parseXml(e);return this.options.preserveOrder||r===void 0?r:TS(r,this.options,n.matcher,n.readonlyMatcher)}addEntity(e,t){if(t.indexOf(`&`)!==-1)throw Error(`Entity value can't have '&'`);if(e.indexOf(`&`)!==-1||e.indexOf(`;`)!==-1)throw Error(`An entity must be set without '&' and ';'. Eg. use '#xD' for '
'`);if(t===`&`)throw Error(`An entity with value '&' is not permitted`);this.externalEntities[e]=t}static getMetaDataSymbol(){return cx.getMetaDataSymbol()}};let jS=/* @__PURE__ */ new Set(/* @__PURE__ */ `c.row.col.cols.si.r.rPh.sheet.definedName.font.fill.border.numFmt.xf.Relationship.Override.Default.mergeCell.tablePart.tableColumn.sheetView.pane.selection.conditionalFormatting.dataValidation.hyperlink.rgbColor.brk.filterColumn.externalReference.gsd`.split(`.`));new AS({ignoreAttributes:!1,attributeNamePrefix:``,removeNSPrefix:!0,trimValues:!1,parseTagValue:!1,parseAttributeValue:!1,processEntities:!0,htmlEntities:!0,textNodeName:`#text`,isArray:(e,t,n,r)=>!r&&jS.has(e)}),`000000 FFFFFF FF0000 00FF00 0000FF FFFF00 FF00FF 00FFFF 000000 FFFFFF FF0000 00FF00 0000FF FFFF00 FF00FF 00FFFF 800000 008000 000080 808000 800080 008080 C0C0C0 808080 9999FF 993366 FFFFCC CCFFFF 660066 FF8080 0066CC CCCCFF 000080 FF00FF FFFF00 00FFFF 800080 800000 008080 0000FF 00CCFF CCFFFF CCFFCC FFFF99 99CCFF FF99CC CC99FF FFCC99 3366FF 33CCCC 99CC00 FFCC00 FF9900 FF6600 666699 969696 003366 339966 003300 333300 993300 993366 333399 333333`.split(` `);function MS(e){let t=Number.parseInt(e.slice(0,2),16)/255,n=Number.parseInt(e.slice(2,4),16)/255,r=Number.parseInt(e.slice(4,6),16)/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2;if(i===a)return[0,0,o];let s=i-a,c=o>.5?s/(2-i-a):s/(i+a);return[(i===t?(n-r)/s+(n<r?6:0):i===n?(r-t)/s+2:(t-n)/s+4)/6,c,o]}function NS(e,t,n){let r=n<.5?n*(1+t):n+t-n*t,i=2*n-r,a=e=>{let a=e<0?e+1:e>1?e-1:e,o=t===0?n:a<1/6?i+(r-i)*6*a:a<1/2?r:a<2/3?i+(r-i)*(2/3-a)*6:i;return Math.round(o*255).toString(16).toUpperCase().padStart(2,`0`)};return`${a(e+1/3)}${a(e)}${a(e-1/3)}`}function PS(e,t){if(t===0)return e;let[n,r,i]=MS(e),a=t<0?i*(1+t):i*(1-t)+t;return NS(n,r,Math.min(1,Math.max(0,a)))}function FS(e){return[e.lt1,e.dk1,e.lt2,e.dk2,e.accent1,e.accent2,e.accent3,e.accent4,e.accent5,e.accent6,e.hlink,e.folHlink].map(e=>e.slice(1).toUpperCase())}let IS=(e,t,n=0)=>`#${PS(e[t].slice(1).toUpperCase(),n)}`,LS=(e,t)=>hf(e,t,(e,t)=>`#${PS(e.slice(1).toUpperCase(),t)}`);function RS(e,t){let n=e=>e===void 0||e.startsWith(`#`)?e:LS(e,t),r={...e};if(e.color!==void 0&&(r.color=n(e.color)),typeof e.fill==`string`?r.fill=n(e.fill):e.fill&&(r.fill={...e.fill,...e.fill.color===void 0?{}:{color:n(e.fill.color)},...e.fill.background===void 0?{}:{background:n(e.fill.background)}}),e.border){let t={};for(let[r,i]of Object.entries(e.border)){if(!i)continue;let e=n(i.color);t[r]=e===void 0?i:{...i,color:e}}r.border=t}return r}let zS=.3999755851924192,BS=(e,t)=>({left:{style:e,color:t},right:{style:e,color:t},top:{style:e,color:t},bottom:{style:e,color:t}});function VS(e){let t=(t,n=0)=>IS(e,t,n),n={Normal:{},Title:{size:18,color:t(`dk2`)},"Heading 1":{size:15,bold:!0,color:t(`dk2`),border:{bottom:{style:`thick`,color:t(`accent1`)}}},"Heading 2":{size:13,bold:!0,color:t(`dk2`),border:{bottom:{style:`thick`,color:t(`accent1`,.499984740745262)}}},"Heading 3":{bold:!0,color:t(`dk2`),border:{bottom:{style:`medium`,color:t(`accent1`,zS)}}},"Heading 4":{bold:!0,color:t(`dk2`)},Good:{fill:`#C6EFCE`,color:`#006100`},Bad:{fill:`#FFC7CE`,color:`#9C0006`},Neutral:{fill:`#FFEB9C`,color:`#9C5700`},Input:{fill:`#FFCC99`,color:`#3F3F76`,border:BS(`thin`,`#7F7F7F`)},Output:{fill:`#F2F2F2`,bold:!0,color:`#3F3F3F`,border:BS(`thin`,`#3F3F3F`)},Calculation:{fill:`#F2F2F2`,bold:!0,color:`#FA7D00`,border:BS(`thin`,`#7F7F7F`)},"Check Cell":{fill:`#A5A5A5`,bold:!0,color:`#FFFFFF`,border:BS(`double`,`#3F3F3F`)},"Linked Cell":{color:`#FA7D00`,border:{bottom:{style:`double`,color:`#FF8001`}}},Note:{fill:`#FFFFCC`,border:BS(`thin`,`#B2B2B2`)},"Warning Text":{color:`#FF0000`},"Explanatory Text":{italic:!0,color:`#7F7F7F`},Total:{bold:!0,border:{top:{style:`thin`,color:t(`accent1`)},bottom:{style:`double`,color:t(`accent1`)}}},Hyperlink:{color:t(`hlink`),underline:!0},"Followed Hyperlink":{color:t(`folHlink`),underline:!0},Comma:{format:`_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)`},"Comma [0]":{format:`_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)`},Currency:{format:`_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)`},"Currency [0]":{format:`_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)`},Percent:{format:`0%`}};for(let e of[1,2,3,4,5,6]){let r=`accent${String(e)}`;n[`Accent${String(e)}`]={fill:t(r),color:t(`lt1`)},n[`20% - Accent${String(e)}`]={fill:t(r,.7999816888943144)},n[`40% - Accent${String(e)}`]={fill:t(r,.5999938962981048)},n[`60% - Accent${String(e)}`]={fill:t(r,zS),color:t(`lt1`)}}return n}let HS=/* @__PURE__ */ new WeakMap;function US(e,t=lf){let n=HS.get(t);return n||(n=VS(t),HS.set(t,n)),n[Sf[e]??e]}let WS=e=>e.toLowerCase();function GS(e,t){let n=e.sheets.length;if(!t)return{file:e,own:n,names:/* @__PURE__ */ new Set,ordinary:[]};let r=new Set(e.sheets.map(e=>WS(e.name))),i=t.sheets.filter(e=>!r.has(WS(e.name))),a=t.sheets.filter(e=>r.has(WS(e.name))).map(e=>e.name),o=new Set(Object.keys(e.names??{}).map(WS)),s=Object.entries(t.names??{}).filter(([e])=>!o.has(WS(e)));return{file:{...e,sheets:[...e.sheets,...i],...s.length===0?{}:{names:{...e.names,...Object.fromEntries(s)}}},own:n,names:new Set(s.map(([e])=>e)),ordinary:a}}function KS(e,t){return t(qS(e,t))}function qS(e,t){switch(e.kind){case`unary`:case`postfix`:case`paren`:{let n=KS(e.arg,t);return n===e.arg?e:{...e,arg:n}}case`binary`:{let n=KS(e.left,t),r=KS(e.right,t);return n===e.left&&r===e.right?e:{...e,left:n,right:r}}case`call`:{let n=e.args.map(e=>KS(e,t));return n.every((t,n)=>t===e.args[n])?e:{...e,args:n}}case`invoke`:{let n=KS(e.callee,t),r=e.args.map(e=>KS(e,t));return n===e.callee&&r.every((t,n)=>t===e.args[n])?e:{...e,callee:n,args:r}}case`array`:{let n=e.rows.map(e=>e.map(e=>KS(e,t)));return n.every((t,n)=>t.every((t,r)=>t===e.rows[n]?.[r]))?e:{...e,rows:n}}default:return e}}function JS(e,t,n){if(e.abs||t===0)return e;let r=e.index+t;return r<0||r>=n?void 0:{...e,index:r}}function YS(e,t,n){let r=e.col&&JS(e.col,n,16384),i=e.col2&&JS(e.col2,n,16384),a=e.row&&JS(e.row,t,1048576),o=e.row2&&JS(e.row2,t,1048576),s=(e,t)=>e!==void 0&&t===void 0;return s(e.col,r)||s(e.col2,i)||s(e.row,a)||s(e.row2,o)?{kind:`error`,code:`#REF!`,...e.sheet===void 0?{}:{sheet:e.sheet}}:r===e.col&&i===e.col2&&a===e.row&&o===e.row2?e:{...e,...r?{col:r}:{},...i?{col2:i}:{},...a?{row:a}:{},...o?{row2:o}:{}}}function XS(e,t,n){return t===0&&n===0?e:KS(e,e=>e.kind===`ref`?YS(e,t,n):e)}function ZS(e,t,n){let r=[],i=e=>e===void 0?`~`:JSON.stringify(e),a=(e,t)=>e===void 0?`~`:e.abs?`$${String(e.index)}`:`^${String(e.index-t)}`,o=e=>{r.push(`(`);for(let t of e)s(t);r.push(`)`)},s=e=>{switch(e.kind){case`number`:r.push(`n`,String(e.value),i(e.raw));return;case`string`:r.push(`s`,i(e.value));return;case`boolean`:r.push(e.value?`T`:`F`);return;case`error`:r.push(`e`,e.code,i(e.sheet));return;case`missing`:r.push(`m`);return;case`ref`:r.push(e.range?`R`:`r`,i(e.sheet),i(e.lastSheet),a(e.col,n),a(e.row,t),a(e.col2,n),a(e.row2,t));return;case`structured`:r.push(`t`,i(e.table),JSON.stringify(e.sections),JSON.stringify(e.columns),e.thisRow?`@`:`-`);return;case`name`:r.push(`a`,i(e.name),i(e.sheet));return;case`unary`:case`postfix`:r.push(e.kind===`unary`?`u`:`p`,e.op),s(e.arg);return;case`paren`:r.push(`{`),s(e.arg),r.push(`}`);return;case`binary`:r.push(`b`,JSON.stringify(e.op)),s(e.left),s(e.right);return;case`call`:r.push(`c`,i(e.name),i(e.written)),o(e.args);return;case`invoke`:r.push(`i`),s(e.callee),o(e.args);return;case`array`:r.push(`[`);for(let t of e.rows)o(t);r.push(`]`);return}};return s(e),r.join(` `)}let QS=[`#All`,`#Data`,`#Headers`,`#Totals`,`#This Row`];var $S=class extends Error{at;constructor(e,t){super(e),this.at=t}};let eC=/* @__PURE__ */ new Set([`=`,`<>`,`<`,`<=`,`>`,`>=`]),tC={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"&":2,"+":3,"-":3,"*":4,"/":4,"^":5},nC=e=>e>=`0`&&e<=`9`,rC=e=>/[\p{L}_\\]/u.test(e)||e>=`\ud800`&&e<=`\udfff`,iC=e=>/[\p{L}\p{N}\p{M}_.?\\]/u.test(e)||e>=`\ud800`&&e<=`\udfff`,aC=(e,t)=>({index:e,abs:t});function oC(e,t){let n={};return t.before&&(n.before=t.before),t.inner&&(n.inner=t.inner),t.after&&(n.after=t.after),Object.keys(n).length===0?e:{...e,space:{...e.space,...n}}}var sC=class{at=0;s;locals=[];constructor(e){this.s=e}blanks(){return this.space()!==``}space(){let e=this.at;for(;/\s/u.test(this.s.charAt(this.at));)this.at+=1;return this.s.slice(e,this.at)}peek(e){return this.s.startsWith(e,this.at)}eat(e){return this.peek(e)?(this.at+=e.length,!0):!1}stop(e,t=this.at){throw new $S(e,t)}parse(){this.eat(`=`),this.s.slice(this.at).trim()===``&&this.stop(`a formula with nothing in it`,this.s.length);let e=this.expression(0);return this.blanks(),this.at<this.s.length&&this.stop(`"${this.s.charAt(this.at)}" where an operator should be`),e}operator(){let e=this.at,t=this.space(),n=this.s.slice(this.at,this.at+2),r=this.s.charAt(this.at);return this.at=e,eC.has(n)?{op:n,inner:t}:tC[r]===void 0?void 0:{op:r,inner:t}}expression(e){let t=this.prefix();for(;;){let n=this.operator();if(n===void 0)return t;let{op:r,inner:i}=n,a=tC[r]??0;if(a<=e)return t;this.at+=i.length+r.length;let o=this.expression(a);t=oC({kind:`binary`,op:r,left:t,right:o},{inner:i})}}prefix(){let e=this.at,t=this.space();for(let e of[`-`,`+`,`@`])if(this.eat(e))return oC({kind:`unary`,op:e,arg:this.prefix()},{before:t});return this.at=e,this.postfix()}postfix(){let e=this.references();for(;;){let t=this.at;if(this.blanks(),this.eat(`%`))e={kind:`postfix`,op:`%`,arg:e};else if(this.at=t,this.peek(`#`)&&!uC(this.s,this.at))this.at+=1,e={kind:`postfix`,op:`#`,arg:e};else if(this.peek(`(`)&&(e.kind===`call`||e.kind===`paren`)){let{args:t}=this.call(``);e={kind:`invoke`,callee:e,args:t}}else return e}}spilled(){let e=this.primary();return!this.peek(`#`)||uC(this.s,this.at)?e:(this.at+=1,{kind:`postfix`,op:`#`,arg:e})}references(){let e=this.spilled();for(;;){if(this.peek(`:`)){this.at+=1,this.blanks();let t=this.spilled();e={kind:`binary`,op:`:`,left:e,right:t};continue}let t=this.at;if(lC(e)&&this.blanks()&&this.startsReference()){let t=this.primary();e={kind:`binary`,op:` `,left:e,right:t}}else return this.at=t,e}}startsReference(){let e=this.s.charAt(this.at);return e===`$`||e===`'`||e===`(`||e===`[`||rC(e)}primary(){let e=this.space();return oC(this.bare(),{before:e})}bare(){let e=this.s.charAt(this.at);if(e===``&&this.stop(`the formula ends where a value should be`),e===`(`)return this.parenthesis();if(e===`{`)return this.arrayConstant();if(e===`"`)return{kind:`string`,value:this.text()};if(nC(e)||e===`.`){let e=mC(this.s,this.at);return e?(this.at=e.end,{kind:`ref`,...e.ref}):this.number()}return e===`#`?this.errorLiteral(void 0):e===`[`?this.bracket(void 0):e===`$`||e===`'`||rC(e)?this.word():this.stop(`"${e}" where a value should be`)}parenthesis(){let e=this.at;this.at+=1;let t=this.expression(0),n=this.space();for(;this.eat(`,`);){let e=this.expression(0);t=oC({kind:`binary`,op:`,`,left:t,right:e},{inner:n}),n=this.space()}return this.eat(`)`)||this.stop(`a ( that is never closed`,e),oC({kind:`paren`,arg:t},{inner:n})}number(){let e=/^(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/u.exec(this.s.slice(this.at));return e?(this.at+=e[0].length,{kind:`number`,value:Number(e[0]),raw:e[0]}):this.stop(`a number that is not one`)}text(){let e=this.at;this.at+=1;let t=``;for(;;){this.at>=this.s.length&&this.stop(`a " that is never closed`,e);let n=this.s.charAt(this.at);if(n===`"`){if(this.s.charAt(this.at+1)!==`"`)return this.at+=1,t;this.at+=1}t+=n,this.at+=1}}errorLiteral(e){let t=uC(this.s,this.at);return t===void 0?this.stop(`a # that names no error`):(this.at+=t.length,{kind:`error`,code:t,...e===void 0?{}:{sheet:e}})}arrayConstant(){let e=this.at;this.at+=1;let t=[[]];for(;;)if(this.blanks(),t[t.length-1]?.push(this.arrayItem()),this.blanks(),!this.eat(`,`)){if(this.eat(`;`))t.push([]);else{if(this.eat(`}`))break;this.stop(`a { that is never closed`,e)}}let n=t[0]?.length;return t.some(e=>e.length!==n)&&this.stop(`an array whose rows are not all as long`,e),{kind:`array`,rows:t}}arrayItem(){let e=this.s.charAt(this.at);if(e===`"`)return{kind:`string`,value:this.text()};if(e===`#`)return this.errorLiteral(void 0);if(e===`-`||e===`+`)return this.at+=1,{kind:`unary`,op:e,arg:this.number()};if(nC(e)||e===`.`)return this.number();let t=this.name(),n=t.toUpperCase();return n===`TRUE`||n===`FALSE`?{kind:`boolean`,value:n===`TRUE`}:this.stop(`${t} in an array: an array holds only constants`)}name(){let e=this.at;for(;this.at<this.s.length&&iC(this.s.charAt(this.at));)this.at+=1;return this.s.slice(e,this.at)}quoted(){let e=this.at;this.at+=1;let t=``;for(;;){this.at>=this.s.length&&this.stop(`a ' that is never closed`,e);let n=this.s.charAt(this.at);if(n===`'`){if(this.s.charAt(this.at+1)!==`'`)return this.at+=1,t;this.at+=1}t+=n,this.at+=1}}bound(e){let t=e.toLowerCase();return this.locals.some(e=>e.has(t))}word(){let e=this.sheetPrefix();if(e)return this.afterSheet(e.first,e.last);let t=mC(this.s,this.at);if(t)return this.at=t.end,{kind:`ref`,...t.ref};let n=/^([A-Za-z]{1,3}):([A-Za-z]{1,3})/u.exec(this.s.slice(this.at)),r=n!==null&&(this.bound(n[1]??``)||this.bound(n[2]??``))?void 0:fC(this.s,this.at);if(r)return this.at=r.end,{kind:`ref`,...r.ref};if(this.peek(`$`))return this.stop(`a "$" that is not part of a reference`);let i=this.at,a=this.name();if(a===``)return this.stop(`"${this.s.charAt(i)}" in a name`);if(this.peek(`(`))return this.call(a);if(this.peek(`[`))return this.bracket(a);let o=a.toUpperCase();return o===`TRUE`||o===`FALSE`?{kind:`boolean`,value:o===`TRUE`}:{kind:`name`,name:a}}sheetPrefix(){let e=this.at;if(this.peek(`'`)){let t=this.quoted();if(!this.eat(`!`)){this.at=e;return}let n=t.indexOf(`:`);return n>0?{first:t.slice(0,n),last:t.slice(n+1)}:{first:t}}let t=this.name();if(t!==``&&this.eat(`!`))return{first:t};if(t!==``&&this.eat(`:`)){let e=this.name();if(e!==``&&this.eat(`!`))return{first:t,last:e}}this.at=e}afterSheet(e,t){let n={sheet:e,...t===void 0?{}:{lastSheet:t}};if(this.peek(`#`))return this.errorLiteral(e);let r=mC(this.s,this.at);if(r)return this.at=r.end,{kind:`ref`,...n,...r.ref};let i=fC(this.s,this.at);if(i)return this.at=i.end,{kind:`ref`,...n,...i.ref};let a=this.name();return a===``?this.stop(`nothing after ${e}!`):{kind:`name`,name:a,sheet:e}}call(e){let t=this.at;this.at+=1;let n=[],r=t=>oC({kind:`call`,name:e.toUpperCase(),written:e,args:n},{inner:t}),i=this.at,a=this.space();if(this.eat(`)`))return r(a);this.at=i;let o=cC.test(e)?/* @__PURE__ */ new Set:void 0;o&&this.locals.push(o);let s=e=>(o&&this.locals.pop(),r(e));for(;;){let r=this.at,i=this.space(),a;this.peek(`,`)||this.peek(`)`)?a=oC({kind:`missing`},{before:i}):(this.at=r,a=this.expression(0));let c=this.space();if(o&&a.kind===`name`&&a.sheet===void 0&&o.add(a.name.replace(/^_xlpm\./iu,``).toLowerCase()),this.eat(`,`))n.push(oC(a,{after:c}));else{if(n.push(a),this.eat(`)`))return s(c);this.stop(`a ( of ${e.toUpperCase()} that is never closed`,t)}}}columnName(){let e=``;for(;;){this.at>=this.s.length&&this.stop(`a [ that is never closed`);let t=this.s.charAt(this.at);if(t===`]`)return e;t===`[`&&this.stop(`a [ inside a column's name`),t===`'`?(this.at+=1,e+=this.s.charAt(this.at),this.at+=1):(e+=t,this.at+=1)}}bracket(e){let t=this.at;this.at+=1;let n={kind:`structured`,...e===void 0?{}:{table:e},sections:[],columns:[],thisRow:!1};if(this.eat(`]`))return n;if(!(this.peek(`[`)||this.peek(`#`)||this.peek(`@`))){let r=this.columnName();return this.at+=1,e===void 0&&/[!']/u.test(this.s.charAt(this.at))&&this.stop(`a formula that reaches into another workbook`,t),e===void 0&&rC(this.s.charAt(this.at))&&this.stop(`a formula that reaches into another workbook`,t),n.columns=[r.trim()],n}return this.eat(`@`)?(n.thisRow=!0,this.eat(`]`)||(this.peek(`[`)?this.items(n):n.columns=[this.columnName().trim()],this.eat(`]`)||this.stop(`a [ that is never closed`,t)),n):(this.items(n),this.eat(`]`)||this.stop(`a [ that is never closed`,t),n)}items(e){for(;;){if(this.blanks(),this.peek(`#`))this.section(e);else if(this.eat(`[`)){if(this.peek(`#`))this.section(e),this.eat(`]`)||this.stop(`a [ that is never closed`);else{let t=this.columnName().trim();this.at+=1,e.columns.push(t),this.eat(`:`)&&(this.eat(`[`)||this.stop(`a column's name after :`),e.columns.push(this.columnName().trim()),this.at+=1)}}else this.stop(`a column or a section of a table`);if(this.blanks(),!this.eat(`,`))return}}section(e){let t=this.s.slice(this.at).toLowerCase(),n=QS.find(e=>t.startsWith(e.toLowerCase()));n===void 0&&this.stop(`a section of a table that is not one`),this.at+=n.length,n===`#This Row`?e.thisRow=!0:e.sections.push(n)}};let cC=/^(?:_xlfn\.)?(?:LET|LAMBDA)$/iu,lC=e=>e.kind===`ref`||e.kind===`name`||e.kind===`structured`||e.kind===`call`||e.kind===`paren`||e.kind===`binary`&&(e.op===`:`||e.op===` `);function uC(e,t){let n=/^#[A-Za-z0-9_/]+[!?]?/u.exec(e.slice(t));return n?mh(n[0])?.code:void 0}let dC=(e,t)=>{let n=e.charAt(t);return n!==``&&(iC(n)||n===`(`||n===`!`||n===`[`)};function fC(e,t){let n=e.slice(t),r=/^(\$?)([A-Za-z]{1,3}):(\$?)([A-Za-z]{1,3})/u.exec(n);if(r){let n=t+r[0].length,i=p(r[2]??``),a=p(r[4]??``);if(i!==void 0&&a!==void 0&&!dC(e,n))return{ref:{col:aC(i,r[1]===`$`),col2:aC(a,r[3]===`$`),range:!0},end:n}}let i=/^(\$?)([A-Za-z]{1,3})(\$?)([1-9]\d*)/u.exec(n);if(!i)return;let a=pC(i),o=t+i[0].length;if(a&&!dC(e,o)){if(e.charAt(o)===`:`){let t=/^(\$?)([A-Za-z]{1,3})(\$?)([1-9]\d*)/u.exec(e.slice(o+1));if(t){let n=pC(t),r=o+1+t[0].length;if(n&&!dC(e,r))return{ref:{...a,col2:n.col,row2:n.row,range:!0},end:r}}}return{ref:{...a,range:!1},end:o}}}function pC(e){let t=p(e[2]??``),n=Number(e[4])-1;if(!(t===void 0||t>=16384||n>=1048576))return{col:aC(t,e[1]===`$`),row:aC(n,e[3]===`$`)}}function mC(e,t){let n=/^(\$?)([1-9]\d*):(\$?)([1-9]\d*)/u.exec(e.slice(t));if(!n)return;let r=t+n[0].length,i=Number(n[2])-1,a=Number(n[4])-1;if(!(i>=1048576||a>=1048576||dC(e,r)))return{ref:{row:aC(i,n[1]===`$`),row2:aC(a,n[3]===`$`),range:!0},end:r}}function hC(e){try{return{ok:!0,node:new sC(e).parse()}}catch(e){if(e instanceof $S)return{ok:!1,error:{message:e.message,at:e.at}};throw e}}var gC=class{node;error;analysis;text;row;col;atRow;atCol;source;constructor(e,t,n,r,i){this.text=e,this.atRow=t,this.atCol=n,this.source=r;let a=hC(e);if(!a.ok){this.error=a.error,this.row=t,this.col=n;return}let o=i===void 0||!_C(a.node)?void 0:ZS(a.node,t,n),s=o===void 0?void 0:i?.get(o);s?(this.node=s.node,this.row=s.row,this.col=s.col):(this.node=a.node,this.row=t,this.col=n,o!==void 0&&i?.set(o,{node:a.node,row:t,col:n}))}};function _C(e){let t=!0,n=e=>{if(!t||typeof e!=`object`||!e)return;let r=e;if(r.kind===`call`&&typeof r.name==`string`&&r.name.toUpperCase()===`TABLE`)t=!1;else for(let t of Object.values(e))if(Array.isArray(t))for(let e of t)n(e);else typeof t==`object`&&t&&n(t)};return n(e),t}var vC=class{value=null;array;spill;blocked;state=1;mark=0;shared;sheet;row;col;constructor(e,t,n,r){this.shared=e,this.sheet=t,this.row=n,this.col=r}get moved(){let{node:e,row:t,col:n}=this.shared;if(!e)throw Error(`${this.shared.text} does not parse.`);return XS(e,this.row-t,this.col-n)}get text(){let{node:e,text:t,atRow:n,atCol:r}=this.shared;return!e||n===this.row&&r===this.col?t:Dg(this.moved)}},yC=class{columns=[];firsts=[];lasts=[];formulas=[];get(e,t){return this.columns[t]?.[e]}set(e,t,n){let r=this.columns[t];r||(r=[],this.columns[t]=r,this.firsts[t]=e,this.lasts[t]=e),r[e]instanceof vC&&(this.formulas[t]=(this.formulas[t]??1)-1),n instanceof vC&&(this.formulas[t]=(this.formulas[t]??0)+1),r[e]=n,e<(this.firsts[t]??e)&&(this.firsts[t]=e),e>(this.lasts[t]??e)&&(this.lasts[t]=e)}get width(){return this.columns.length}holds(e,t,n){let r=Math.min(e.right,this.columns.length-1);for(let i=e.left;i<=r;i++){let r=this.columns[i];if(!r)continue;let a=Math.min(e.bottom,this.last(i));for(let o=Math.max(e.top,this.first(i));o<=a;o++)if(r[o]!==void 0&&(o!==t||i!==n))return!0}return!1}first(e){return this.firsts[e]??1/0}last(e){return this.lasts[e]??-1}hasFormulas(e){return(this.formulas[e]??0)>0}},bC=class{columns=[];rows=0;lines=[];places=[];records=[];name;sheet;at;file;spec;constructor(e,t,n,r,i){this.name=e,this.sheet=t,this.at=n,this.file=r,this.spec=i}get area(){return{top:this.at.row,left:this.at.col,bottom:this.at.row+this.rows,right:this.at.col+Math.max(this.columns.length,1)-1}}get data(){let e=this.area;return{...e,top:e.top+1}}column(e){let t=e.toLowerCase();return this.columns.find(e=>e.name.toLowerCase()===t)}};let xC=(e,t)=>e*16384+t;function SC(e,t){e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right);for(let n=t.left;n<=t.right;n++){let r=e.columns.get(n);e.columns.set(n,[Math.min(r?.[0]??t.top,t.top),Math.max(r?.[1]??t.bottom,t.bottom)])}}var CC=class{tables=[];blocks=[];merges=[];formulas=/* @__PURE__ */ new Set;implied=/* @__PURE__ */ new Map;keys=/* @__PURE__ */ new Map;fills=[];blanks=/* @__PURE__ */ new Set;conditions=[];validations=[];filters=[];charts=[];tiles=[];sparklines=[];names=/* @__PURE__ */ new Map;freeze;generated=!1;grid=new yC;expanded=!1;lowest=-1;ghosts=/* @__PURE__ */ new Map;spills=/* @__PURE__ */ new Set;stopped=/* @__PURE__ */ new Set;reach;lookAreas;name;index;spec;book;constructor(e,t,n){this.name=e,this.index=t,this.spec=n}respec(e){let t=e.charts!==this.spec.charts;this.spec=e,this.lookAreas=void 0,t&&(this.charts.length=0,e.charts?.forEach((e,t)=>{let n=FC(PC(this,e),t,[],()=>void 0);n&&this.charts.push(n)}))}put(e,t,n){n instanceof vC&&this.formulas.add(n),this.grid.set(e,t,n),e>this.lowest&&(this.lowest=e)}replace(e,t,n){this.expand();let r=this.grid.get(e,t);r instanceof vC&&this.formulas.delete(r),n instanceof vC&&this.formulas.add(n),this.grid.set(e,t,n),e>this.lowest&&(this.lowest=e)}expand(){if(!this.expanded){this.expanded=!0;for(let e=this.fills.length-1;e>=0;e--){let t=this.fills[e];if(!t)continue;let{area:n,shared:r,value:i,format:a,start:o}=t;for(let e=n.top;e<=n.bottom;e++)for(let t=n.left;t<=n.right;t++)if(this.grid.get(e,t)===void 0&&!this.blanks.has(xC(e,t))){if(r){let n=new vC(r,this,e,t);o!==void 0&&(n.value=o),this.put(e,t,n)}else i!=null&&(this.put(e,t,i),a!==void 0&&this.implied.set(xC(e,t),a))}}}}at(e,t){return this.expand(),this.grid.get(e,t)}spillAt(e,t){return this.ghosts.size===0?void 0:this.ghosts.get(xC(e,t))}holds(e,t){return this.expand(),this.grid.holds(e,t.row,t.col)}spillsIn(e){if(this.spills.size===0)return[];if((e.bottom-e.top+1)*(e.right-e.left+1)>=this.spills.size)return[...this.spills].filter(t=>t.spill!==void 0&&b(t.spill,e));let t=/* @__PURE__ */ new Set;for(let n=e.top;n<=e.bottom;n++)for(let r=e.left;r<=e.right;r++){let e=this.ghosts.get(xC(n,r));e&&t.add(e)}return[...t]}blockedBy(e){if(this.stopped.size===0)return[];let t=[];for(let n of this.stopped)n.blocked&&b(n.blocked,e)&&t.push(n);return t}placeSpill(e,t){e.spill=t,this.spills.add(e);for(let n=t.top;n<=t.bottom;n++)for(let r=t.left;r<=t.right;r++)(n!==e.row||r!==e.col)&&this.ghosts.set(xC(n,r),e);this.reach&&SC(this.reach,t)}blockSpill(e,t){e.blocked=t,this.stopped.add(e)}clearSpill(e){let t=e.spill;if(t)for(let n=t.top;n<=t.bottom;n++)for(let r=t.left;r<=t.right;r++)this.ghosts.get(xC(n,r))===e&&this.ghosts.delete(xC(n,r));e.spill=void 0,e.blocked=void 0,this.spills.delete(e),this.stopped.delete(e)}clearSpills(){for(let e of[...this.spills,...this.stopped])e.spill=void 0,e.blocked=void 0;this.spills.clear(),this.stopped.clear(),this.ghosts.clear(),this.reach=void 0}tighten(){this.reach=void 0}spillReach(){if(this.reach)return this.reach;let e={columns:/* @__PURE__ */ new Map,bottom:-1,right:-1};for(let{spill:t}of this.spills)t&&SC(e,t);return this.reach=e,e}hasFormulas(e){return this.expand(),this.grid.hasFormulas(e)}span(e,t,n){this.expand();let r=this.grid.first(e),i=this.grid.last(e);if(this.spills.size===0)return[Math.max(t,r),Math.min(n,i)];let[a,o]=this.spillReach().columns.get(e)??[1/0,-1];return[Math.max(t,Math.min(r,a)),Math.min(n,Math.max(i,o))]}get columnsUsed(){return this.expand(),this.spills.size===0?this.grid.width:Math.max(this.grid.width,this.spillReach().right+1)}get lastRow(){return this.expand(),this.spills.size===0?this.lowest:Math.max(this.lowest,this.spillReach().bottom)}get used(){let e=this.lastRow,t=this.columnsUsed-1;return e<0||t<0?void 0:{top:0,left:0,bottom:e,right:t}}tableAt(e,t){return this.tables.find(n=>y(n.area,e,t))}blockAt(e,t){return this.blocks.find(n=>y(n.area,e,t))}looks(){if(this.lookAreas)return this.lookAreas;let e=[];for(let t of this.spec.format??[]){let n=_(t.range);n&&e.push({area:n,entry:t})}let t=[];for(let[e,n]of Object.entries(this.spec.cells??{})){if(!e.includes(`:`)||typeof n!=`object`||!n)continue;let r=_(e);r&&t.push({area:r,entry:n})}return this.lookAreas={formats:e,ranges:t},this.lookAreas}styledAreas(){let{formats:e,ranges:t}=this.looks();return[...e,...t.filter(e=>Object.keys(e.entry).some(e=>EC.has(e)))]}lookAt(e,t){let n={},r=e=>{if(!e)return;let t=e.style;typeof t==`string`&&r(this.styleLook(t));for(let[t,r]of Object.entries(e))EC.has(t)&&r!==void 0&&(n[t]=t===`border`?{...n.border,...r}:r)},i=this.implied.get(xC(e,t));i!==void 0&&(n.format=i);let a=this.ghosts.size===0?void 0:this.spillAt(e,t),o=a&&this.lookAt(a.row,a.col).format;o!==void 0&&(n.format=o),this.spec.columns&&r(this.spec.columns[f(t)]),this.spec.rows&&r(this.spec.rows[String(e+1)]);let s=this.tableAt(e,t);s&&e>s.at.row&&r(s.columns[t-s.at.col]?.spec);let{formats:c,ranges:l}=this.looks();for(let n of c)y(n.area,e,t)&&r(n.entry);for(let n of l)y(n.area,e,t)&&r(n.entry);let u=this.keys.get(xC(e,t)),d=u===void 0?void 0:this.spec.cells?.[u];if(typeof d==`object`&&d&&r(d),n.border){let e=Object.entries(n.border).filter(([,e])=>e?.style!==`none`);e.length===0?delete n.border:n.border=Object.fromEntries(e)}return wC(n,this.book?.colors)}styleLook(e){if(this.book)return this.book.styleLook(e);let t=TC(e,void 0);return t&&`builtin`in t?US(t.builtin):void 0}runsAt(e,t){let n=this.keys.get(xC(e,t)),r=n===void 0?void 0:this.spec.cells?.[n];return typeof r==`object`&&r?r.runs:void 0}mergeAt(e,t){return this.merges.find(n=>y(n,e,t))}validationAt(e,t){return this.validations.find(n=>n.areas.some(n=>y(n,e,t)))}filterHeadAt(e,t){return this.filters.find(n=>e===n.area.top&&t>=n.area.left&&t<=n.area.right)}filterAt(e,t){return this.filters.find(n=>y(n.area,e,t))}filesAt(e,t){let n=this.tableAt(e,t);if(n&&e>n.at.row){let e=n.columns[t-n.at.col]?.spec?.files;if(e!==void 0)return e}return n?.at.row===e?void 0:this.spec.columns?.[f(t)]?.files}};function wC(e,t){let n=e=>typeof e==`string`&&!e.startsWith(`#`),r=e.fill;return n(e.color)||n(r)||typeof r==`object`&&(n(r.color)||n(r.background))||Object.values(e.border??{}).some(e=>n(e?.color))?RS(e,t??lf):e}function TC(e,t){if(t&&e in t)return{own:e};let n=t?vf(e,Object.keys(t)):void 0;if(n!==void 0)return{own:n};let r=vf(e,Cf);return r===void 0?void 0:{builtin:Sf[r]??r}}let EC=/* @__PURE__ */ new Set([`style`,`bold`,`italic`,`underline`,`strike`,`font`,`size`,`color`,`fill`,`align`,`valign`,`wrap`,`shrink`,`indent`,`rotation`,`border`,`locked`,`hide_formula`,`format`]);var DC=class{title;sheets=[];names=/* @__PURE__ */ new Map;checks=[];bySheet=/* @__PURE__ */ new Map;byTable=/* @__PURE__ */ new Map;file;generated;ordinary=[];colors;themeOrder;projectTheme;constructor(e,t,n){this.file=e,this.title=e.title,this.generated=t,this.projectTheme=n,this.colors=mf(this.theme),this.themeOrder=FS(this.colors)}get theme(){return this.file.theme??this.projectTheme}respec(e){this.file=GS(e,this.generated).file,this.title=e.title,this.colors=mf(this.theme),this.themeOrder=FS(this.colors),this.sheets.forEach(t=>{let n=e.sheets.find(e=>e.name===t.name);n&&t.respec(n)})}sheet(e){return this.bySheet.get(e.toLowerCase())}styleLook(e,t=0){let n=this.file.styles,r=TC(e,n);if(!r)return;if(`builtin`in r)return US(r.builtin,this.colors);let i=n?.[r.own];if(i){let n={...i.style!==void 0&&i.style!==e&&t<8?this.styleLook(i.style,t+1):void 0};for(let[e,t]of Object.entries(i))e!==`style`&&t!==void 0&&(n[e]=e===`border`?{...n.border,...t}:t);return wC(n,this.colors)}}styleNamed(e){return TC(e,this.file.styles)}table(e){return this.byTable.get(e.toLowerCase())}name(e,t){let n=e.toLowerCase();return(t?.names.size?t.names.get(n):void 0)??this.names.get(n)}definitions(e){let t=e.toLowerCase(),n=[],r=this.names.get(t);r&&n.push(r);for(let e of this.sheets){let r=e.names.get(t);r&&n.push(r)}return n}get tables(){return[...this.byTable.values()]}addSheet(e){e.book=this,this.sheets.push(e),this.bySheet.set(e.name.toLowerCase(),e)}addTable(e){e.sheet.tables.push(e),this.byTable.set(e.name.toLowerCase(),e)}sourceOf(e,t,n){if(e.generated)return{file:bb};let r=this.sheets.indexOf(e),i=e.tableAt(t,n);if(i){let e=i.columns[n-i.at.col],r=t-i.at.row-1,a=e?.csv!==void 0&&(i.records[r]?.[e.csv]??``)!==``;return r>=0&&e?.formula&&!a?e.formula.source:{file:i.file,line:r<0?1:i.lines[r]??1}}let a=e.blockAt(t,n);if(a)return{file:a.file,line:a.lines[t-a.area.top]??1};let o=e.keys.get(xC(t,n));if(o!==void 0)return{file:yb,path:[`sheets`,r,`cells`,o]};for(let i of Object.keys(e.spec.cells??{})){if(!i.includes(`:`))continue;let e=_(i);if(e&&y(e,t,n))return{file:yb,path:[`sheets`,r,`cells`,i]}}}};let OC=/^[\p{L}_\\][\p{L}\p{N}_.\\?]*$/u;function kC(e){return OC.test(e)&&g(e)===void 0&&!/^(?:TRUE|FALSE)$/iu.test(e)&&!/^[Rr](?:\d+)?(?:[Cc]\d*)?$/u.test(e)&&!/^[Cc]\d*$/u.test(e)}let AC=`made`,jC=e=>e[0]===AC?bb:yb;function MC(e){let t=e.length;for(;t>1&&(e[t-1]??``).trim()===``;)t--;return e.slice(0,t)}var NC=class{problems=[];wb;read_;lineOf;own;madeNames;trees=/* @__PURE__ */ new Map;unread=/* @__PURE__ */ new Set;constructor(e,t,n,r,i){this.wb=e,this.read_=t,this.lineOf=n,this.own=r,this.madeNames=i}yaml(e,t){let n=this.lineOf(e);this.problems.push({file:jC(e),...n===void 0?{}:{line:n},message:t})}sheetPath(e){return e<this.own?[`sheets`,e]:[AC,`sheets`,e-this.own]}read(){let{file:e}=this.wb;e.sheets.forEach((e,t)=>{let n=this.sheetPath(t);if(this.wb.sheet(e.name)){this.yaml([...n,`name`],`two sheets are named ${e.name}`);return}(/[\\/?*[\]:]/u.test(e.name)||e.name.length>31)&&this.yaml([...n,`name`],`${e.name} cannot be a sheet's name: at most 31 characters, none of \\ / ? * [ ] :`);let r=new CC(e.name,this.wb.sheets.length,e);r.generated=t>=this.own,this.wb.addSheet(r)}),this.names();for(let[t,n]of e.sheets.entries()){let e=this.wb.sheets[t];e?.spec===n&&this.sheet(e,this.sheetPath(t))}this.styles(),e.checks?.forEach((e,t)=>{let n={file:yb,path:[`checks`,t,`formula`]};this.wb.checks.push({name:e.name,formula:new gC(e.formula,0,0,n),source:n})})}styles(){let{file:e}=this.wb,t=Object.keys(e.styles??{}),n=(e,n)=>{if(typeof n!=`object`||!n)return;let r=n.style;if(typeof r!=`string`||this.wb.styleNamed(r))return;let i=bf(r,[...t,...Cf]);this.yaml([...e,`style`],`${r} is no cell style${i===void 0?``:`: did you mean "${i}"?`} A style is one of Excel's (Heading 1, Input, Total, 20% - Accent1…) or one \`styles\` defines`)};for(let[t,r]of Object.entries(e.styles??{}))n([`styles`,t],r);e.sheets.forEach((e,t)=>{if(t>=this.own)return;let r=[`sheets`,t];for(let[t,i]of Object.entries(e.cells??{}))n([...r,`cells`,t],i);e.format?.forEach((e,t)=>{n([...r,`format`,t],e)});for(let[t,i]of Object.entries(e.columns??{}))n([...r,`columns`,t],i);for(let[t,i]of Object.entries(e.rows??{}))n([...r,`rows`,t],i);e.tables?.forEach((e,t)=>{for(let[i,a]of Object.entries(e.columns??{}))n([...r,`tables`,t,`columns`,i],a)})})}names(){let{file:e}=this.wb;this.namesOf(e.names,e.hidden_names,e=>this.madeNames.has(e)?[AC,`names`,e]:[`names`,e],this.wb.names,void 0),e.sheets.forEach((e,t)=>{let n=this.wb.sheets[t];n?.spec===e&&this.namesOf(e.names,e.hidden_names,e=>[...this.sheetPath(t),`names`,e],n.names,n)})}namesOf(e,t,n,r,i){let a=new Set(t?.map(e=>e.toLowerCase()));for(let[t,o]of Object.entries(e??{})){let e=n(t);if(!kC(t)){this.yaml(e,`${t} cannot be a name`);continue}let s={file:jC(e),path:e},c=typeof o==`string`&&o.startsWith(`=`)?{name:t,formula:new gC(o,0,0,s),source:s}:{name:t,value:typeof o==`string`?jh(o).value:o,source:s};i&&(c.sheet=i),a.has(t.toLowerCase())&&(c.hidden=!0),r.set(t.toLowerCase(),c)}}sheet(e,t){let{spec:n}=e;if(n.freeze!==void 0){let r=g(n.freeze);r?e.freeze=r:this.yaml([...t,`freeze`],`${n.freeze} is not a cell`)}n.tables?.forEach((n,r)=>{this.table(e,n,[...t,`tables`,r])});for(let[t,n]of e.tables.entries())for(let r of e.tables.slice(t+1))b(n.area,r.area)&&this.problems.push({file:yb,message:`tables ${n.name} and ${r.name} overlap on ${e.name}`});n.blocks?.forEach((n,r)=>{this.block(e,n.at,n.rows,[...t,`blocks`,r])}),this.cells(e,n.cells??{},[...t,`cells`]),n.merges?.forEach((n,r)=>{let i=_(n);i?e.merges.push(i):this.yaml([...t,`merges`,r],`${n} is not a range`)}),n.format?.forEach((e,n)=>{_(e.range)||this.yaml([...t,`format`,n,`range`],`${e.range} is not a range`)}),n.conditional?.forEach((n,r)=>{this.condition(e,n,[...t,`conditional`,r])}),n.validations?.forEach((n,r)=>{this.validation(e,n,[...t,`validations`,r])}),this.filters(e,t),n.charts?.forEach((n,r)=>{this.chart(e,n,r,[...t,`charts`,r])}),n.tiles?.forEach((n,r)=>{let i=PC(e,n),a=Object.keys(n).find(e=>Kl(e)!==void 0);if(a!==void 0&&Kl(a)===`heatmap`){let i=fg(n.at,n[a],this.wb.colors);for(let e of i.problems)this.yaml([...t,`tiles`,r,a],e);i.rule&&this.condition(e,i.rule,[...t,`tiles`,r,`at`]);return}let o=g(i.at);o?a!==void 0&&e.tiles.push({spec:i,at:o,index:r,kind:a}):this.yaml([...t,`tiles`,r,`at`],`${n.at} is not a cell`)}),n.sparklines?.forEach((n,r)=>{let i=kg(e.name,n);i.cells?e.sparklines.push({spec:n,index:r,cells:i.cells}):this.yaml([...t,`sparklines`,r],i.problem??`not a sparkline`)});for(let e of Object.keys(n.columns??{}))p(e)===void 0&&this.yaml([...t,`columns`,e],`${e} is not a column`);for(let e of Object.keys(n.rows??{}))(!/^[1-9]\d*$/u.test(e)||Number(e)>1048576)&&this.yaml([...t,`rows`,e],`${e} is not a row`)}chart(e,t,n,r){let i=FC(PC(e,t),n,r,(e,t)=>{this.yaml(e,t)});i&&e.charts.push(i)}bound(e,t,n){if(!(typeof e!=`string`||!e.startsWith(`=`)||e.length<2))return new gC(e,t?.top??0,t?.left??0,{file:jC(n),path:n})}condition(e,t,n){let r=v(t.range);if(!r){this.yaml([...n,`range`],`${t.range} is not a range`);return}let[i]=r,a=[],o=(e,t)=>{let n=this.bound(e,i,t);n&&a.push(n)};if(t.type===`expression`&&o(t.formula.startsWith(`=`)?t.formula:`=${t.formula}`,[...n,`formula`]),t.type===`cellIs`&&t.formula.forEach((e,t)=>{o(e,[...n,`formula`,t])}),t.type===`dataBar`)for(let e of[`min`,`max`])o(t[e]?.value,[...n,e,`value`]);(t.type===`colorScale`||t.type===`iconSet`)&&t.stops?.forEach((e,t)=>{o(e.value,[...n,`stops`,t,`value`])}),e.conditions.push({spec:t,areas:r,formulas:a})}validation(e,t,n){let r=v(t.range);if(!r){this.yaml([...n,`range`],`${t.range} is not a range`);return}let i=(t.formula??[]).map((e,t)=>this.bound(e,r[0],[...n,`formula`,t])),a=t.formula?.length??0,o=t.type!==`list`&&t.type!==`custom`&&(t.operator===void 0||t.operator===`between`||t.operator===`notBetween`);(t.type!==`list`||t.values===void 0)&&a<(o?2:1)&&this.yaml(n,`a ${t.type} validation needs its bounds`),e.validations.push({spec:t,areas:r,formulas:i})}filters(e,t){let{spec:n}=e;if(n.filter){let r=[...t,`filter`],i=_(n.filter.range);if(!i)this.yaml([...r,`range`],`${n.filter.range} is not a range`);else{let t=/* @__PURE__ */ new Map;for(let[e,a]of Object.entries(n.filter.columns??{})){let o=p(e);o===void 0||o<i.left||o>i.right?this.yaml([...r,`columns`,e],`${e} is not a column of ${n.filter.range}`):t.set(o,a)}let a=e.tables.find(e=>b(e.area,i));a&&this.yaml(r,`a filter over table ${a.name}: a table has its own`),e.filters.push({area:i,columns:t})}}e.tables.forEach((n,r)=>{let{filter:i}=n.spec;if(i===!1)return;let a=/* @__PURE__ */ new Map;for(let[e,o]of Object.entries(i?.columns??{})){let i=n.column(e);i?a.set(n.at.col+i.index,o):this.unread.has(n)||this.yaml([...t,`tables`,r,`filter`,`columns`,e],`table ${n.name} has no column ${e}`)}e.filters.push({area:n.area,table:n,columns:a})})}csv(e,t,n){let r=this.read_(e);return r||this.yaml(t,`${n}: ${e} is not there, from this file's folder or from the project's root`),r}overlapping(e,t){let n=e.tables.find(e=>b(e.area,t));if(n)return`table ${n.name}`;let r=e.blocks.find(e=>b(e.area,t));return r?`the block of ${r.file}`:void 0}typed(e,t,n,r,i){if(r.formula!==void 0){let a=new vC(new gC(r.formula,t,n,i,this.trees),e,t,n);r.start!==void 0&&(a.value=r.start),e.put(t,n,a)}else r.value!==null&&(e.put(t,n,r.value),r.format!==void 0&&e.implied.set(xC(t,n),r.format))}table(e,t,n){let r=g(t.at);if(!r){this.yaml([...n,`at`],`${t.at} is not a cell`);return}if(!kC(t.name)){this.yaml([...n,`name`],`${t.name} cannot be a table's name`);return}if(this.wb.table(t.name)){this.yaml([...n,`name`],`two tables are named ${t.name}`);return}this.wb.name(t.name)&&this.yaml([...n,`name`],`${t.name} is a defined name and a table's`);let i=new bC(t.name,e,r,t.rows,t),a=this.csv(t.rows,[...n,`rows`],`table ${t.name}`),o=a?.rows??[],s=a?.lines??[],c=o[0],l=s[0]??1,u=/* @__PURE__ */ new Set,d=MC(c??[]),f=c?.length===0?[``]:o.slice(1).every(e=>e.slice(d.length).every(e=>e.trim()===``))?d:c??[];f.forEach((e,n)=>{let r=e.trim();r===``&&this.problems.push({file:t.rows,line:l,message:`column ${String(n+1)} has no name`}),u.has(r.toLowerCase())&&this.problems.push({file:t.rows,line:l,message:`two columns are named ${r}`}),u.add(r.toLowerCase()),i.columns.push({name:r,index:i.columns.length,csv:n})});for(let[e,r]of Object.entries(t.columns??{})){let o=i.column(e),s=o??{name:e,index:i.columns.length};o||(r.formula===void 0&&a&&this.yaml([...n,`columns`,e],`table ${t.name} has no column ${e}`),i.columns.push(s)),s.spec=r}let p=f.length;for(let e=1;e<o.length;e++){let n=o[e];if(!n||n.length===0)continue;let r=s[e]??e+1;i.places.push(e),i.records.push(n),i.lines.push(r),n.slice(p).some(e=>e.trim()!==``)&&this.problems.push({file:t.rows,line:r,message:`this row has ${String(n.length)} fields and the header ${String(p)}`})}i.rows=i.records.length;let m=this.overlapping(e,i.area);m&&this.yaml(n,`table ${t.name} overlaps ${m} on ${e.name}`),this.wb.addTable(i),a?this.tableKey(i,n):this.unread.add(i);let h=r.row+1;i.columns.forEach(a=>{let o=r.col+a.index;e.put(r.row,o,a.name);let s=a.spec?.formula;s!==void 0&&(a.formula=new gC(s,h,o,{file:jC(n),path:[...n,`columns`,a.name,`formula`]}),i.rows>0&&e.fills.push({area:{top:h,left:o,bottom:h+i.rows-1,right:o},shared:a.formula})),a.csv!==void 0&&i.records.forEach((n,r)=>{this.typed(e,h+r,o,jh(n[a.csv??0]??``),{file:t.rows,line:i.lines[r]??1})})})}tableKey(e,t){let{key:n}=e.spec;if(n===void 0)return;let r=e.column(n);if(r?.csv===void 0){this.yaml([...t,`key`],`table ${e.name} has no column ${n} in ${e.file}`);return}let i=/* @__PURE__ */ new Set;e.records.forEach((t,a)=>{let o=t[r.csv??0]??``,s=e.lines[a]??1;o===``?this.problems.push({file:e.file,line:s,message:`this row has no ${n}, table ${e.name}'s key`}):i.has(o)&&this.problems.push({file:e.file,line:s,message:`two rows have the key ${o}`}),i.add(o)})}block(e,t,n,r){let i=g(t);if(!i){this.yaml([...r,`at`],`${t} is not a cell`);return}let a=this.csv(n,[...r,`rows`],`a block`);if(!a)return;let o=a.rows,s=o.map((e,t)=>a.lines[t]??t+1),c=o.reduce((e,t)=>Math.max(e,t.length),1),l={top:i.row,left:i.col,bottom:i.row+Math.max(o.length,1)-1,right:i.col+c-1},u=this.overlapping(e,l);u&&this.yaml(r,`the block of ${n} overlaps ${u} on ${e.name}`),e.blocks.push({area:l,file:n,lines:s}),o.forEach((t,r)=>{t.forEach((t,a)=>{this.typed(e,i.row+r,i.col+a,jh(t),{file:n,line:s[r]??r+1})})})}cells(e,t,n){let r=[];for(let[i,a]of Object.entries(t)){let t=[...n,i],o=_(i);if(!o){this.yaml(t,`${i} is not a cell or a range`);continue}let s=this.overlapping(e,o);if(s&&this.yaml(t,`${i} overlaps ${s}`),i.includes(`:`)){let n=(o.bottom-o.top+1)*(o.right-o.left+1);n>5e6?this.yaml(t,`${i} is ${String(n)} cells`):(typeof a==`object`&&a&&a.runs&&this.yaml([...t,`runs`],`${i} is a range: runs are one cell's`),this.fill(e,o,a,t))}else r.push([i,a,{row:o.top,col:o.left}])}for(let[t,i,a]of r){let r=[...n,t],o=zC(i),s=xC(a.row,a.col);e.keys.set(s,t),o.value===null&&o.formula===void 0&&e.blanks.add(s),this.typed(e,a.row,a.col,o,{file:jC(r),path:r});let c=typeof i==`object`&&i?i.name:void 0;c!==void 0&&this.cellName(e,a,c,r)}}cellName(e,t,n,r){if(!kC(n)){this.yaml(r,`${n} cannot be a name`);return}if(this.wb.name(n)){this.yaml(r,`two places are named ${n}`);return}let i={file:jC(r),path:r},a=m(t).replace(/^([A-Z]+)(\d+)$/u,`$$$1$$$2`),o=`='${e.name.replaceAll(`'`,`''`)}'!${a}`;this.wb.names.set(n.toLowerCase(),{name:n,formula:new gC(o,0,0,i),source:i})}fill(e,t,n,r){let i=zC(n),a={file:jC(r),path:r};e.fills.push(i.formula===void 0?{area:t,value:i.value,...i.format===void 0?{}:{format:i.format}}:{area:t,shared:new gC(i.formula,t.top,t.left,a),...i.start===void 0?{}:{start:i.start}})}};function PC(e,t){let n=t.at.includes(`:`)?_(t.at):void 0;if(!n)return t;let r=0;for(let t=n.left;t<=n.right;t++)r+=VC(e,t);let i=0;for(let t=n.top;t<=n.bottom;t++)i+=HC(e,t);return{...t,at:m({row:n.top,col:n.left}),width:t.width??r,height:t.height??i}}function FC(e,t,n,r){let i=g(e.at);if(!i){r([...n,`at`],`${e.at} is not a cell`);return}let a=(e,t)=>{let n=new gC(IC(e),0,0,{file:jC(t),path:t});return n.node&&!LC(n.node)&&r(t,`${e} is not a range or a table's column`),n},o=(e,t)=>e?.startsWith(`=`)===!0?a(e,t):void 0,s=o(e.title,[...n,`title`]);return{spec:e,at:i,index:t,...e.categories===void 0?{}:{categories:a(e.categories,[...n,`categories`])},...s?{title:s}:{},series:e.series.map((e,t)=>{let r=[...n,`series`,t],i=o(e.name,[...r,`name`]);return{values:a(e.values,[...r,`values`]),...e.x===void 0?{}:{x:a(e.x,[...r,`x`])},...e.sizes===void 0?{}:{sizes:a(e.sizes,[...r,`sizes`])},...i?{name:i}:{}}})}}let IC=e=>e.startsWith(`=`)?e:`=${e}`;function LC(e){switch(e.kind){case`error`:case`ref`:case`structured`:case`name`:return!0;case`paren`:case`postfix`:return LC(e.arg);case`binary`:return e.op===`:`||e.op===`,`;default:return!1}}let RC=e=>e.map(e=>e.text).join(``);function zC(e){if(e===null)return{value:null};if(typeof e==`string`)return jh(e);if(typeof e!=`object`)return{value:e};if(e.formula!==void 0)return{value:null,formula:e.formula.startsWith(`=`)?e.formula:`=${e.formula}`,...e.start===void 0?{}:{start:typeof e.start==`string`?jh(e.start).value:e.start}};if(e.runs!==void 0)return{value:RC(e.runs)};let{value:t}=e;return typeof t==`string`?jh(t):{value:t??null}}function BC(e){let t=GS(e.file,e.generated),n=new DC(t.file,e.generated,e.theme);return n.ordinary=t.ordinary,new NC(n,t=>{let n=e.generated?.csv[t];if(n!==void 0)return{rows:wf(n).records.map(e=>e.end===e.start?[]:e.fields),lines:[]};let r=e.rows(t);return r&&{rows:r,lines:[]}},()=>void 0,t.own,t.names).read(),n}function VC(e,t){let n=e.spec.columns?.[f(t)]?.width;if(n!==void 0)return n;for(let n of e.tables){let e=n.columns[t-n.at.col]?.spec?.width;if(e!==void 0)return e}return 64}let HC=(e,t)=>e.spec.rows?.[String(t+1)]?.height??20,UC=e=>e instanceof F?{error:e.code}:e;function WC(e){return typeof e!=`object`||!e?e:mh(e.error)??I.VALUE}let GC=e=>({rows:e.rows,cols:e.cols,data:e.data.map(UC)}),KC=e=>new L(e.rows,e.cols,e.data.map(WC));function qC(e,t){let n=t.formula?.text;if(n===void 0)return;let r=hC(n);if(!r.ok||r.node.kind!==`ref`)return;let i=r.node;if(i.range||!i.col||!i.row||i.lastSheet!==void 0)return;let a=i.sheet===void 0?e.sheets[0]:e.sheet(i.sheet);return a&&{sheet:a,row:i.row.index,col:i.col.index}}let JC=e=>typeof e==`string`?jh(e):{value:e??null};function YC(e,t){let n=e.file.scenarios?.[t];if(!n)return!1;for(let[t,r]of Object.entries(n)){let n=e.name(t);if(!n)continue;let i=JC(r),a=qC(e,n);i.formula===void 0?a?a.sheet.replace(a.row,a.col,i.value??void 0):(n.value=i.value,delete n.formula):(n.formula=new gC(i.formula,0,0,n.source),delete n.value)}return!0}let XC=/* @__PURE__ */ new Map;function ZC(e){if(!/\d/u.test(e))return;if(XC.has(e))return XC.get(e);XC.size>=5e4&&XC.clear();let t=QC(e);return XC.set(e,t),t}function QC(e){let t=jh(e.trim());if(typeof t.value==`number`)return t.value;if(e.trim()===``)return;let n=Rm(e);if(typeof n?.value==`number`)return n.value;let r=/^(\s*\d{1,2})([A-Za-z]{3,}\s+\d{2,4}\s*)$/u.exec(e);if(!r)return;let i=Rm(`${r[1]??``} ${r[2]??``}`);return typeof i?.value==`number`?i.value:void 0}function z(e){return typeof e==`number`?e:e==null?0:typeof e==`boolean`?+!!e:e instanceof F?e:ZC(e)??I.VALUE}function B(e){return typeof e==`string`?e:e==null?``:typeof e==`number`?wh(e):typeof e==`boolean`?e?`TRUE`:`FALSE`:e}function $C(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;let t=e.trim().toUpperCase();return t===`TRUE`||t!==`FALSE`&&I.VALUE}let ew=e=>typeof e==`number`?0:typeof e==`string`?1:2,tw=(e,t)=>e===t?!0:Math.abs(e-t)>1e-13*Math.max(Math.abs(e),Math.abs(t))?!1:Number(e.toPrecision(15))===Number(t.toPrecision(15));function nw(e,t){let n=e??(typeof t==`string`?``:typeof t!=`boolean`&&0),r=t??(typeof e==`string`?``:typeof e!=`boolean`&&0),i=ew(n),a=ew(r);if(i!==a)return i<a?-1:1;if(typeof n==`number`&&typeof r==`number`)return tw(n,r)?0:n<r?-1:1;if(typeof n==`string`&&typeof r==`string`){let e=n.toUpperCase(),t=r.toUpperCase();return e===t?0:e<t?-1:1}return n===r?0:n===!1?-1:1}let rw=e=>Number.isFinite(e)?e:I.NUM;function iw(e,t,n){return Math.abs(e)<=Math.max(Math.abs(t),Math.abs(n))*89e-17?0:e}function aw(e,t,n){let r=z(t);if(r instanceof F)return r;let i=z(n);if(i instanceof F)return i;switch(e){case`+`:return rw(iw(r+i,r,i));case`-`:return rw(iw(r-i,r,i));case`*`:return rw(r*i);case`/`:return i===0?I.DIV0:rw(r/i);default:return r===0&&i===0?I.NUM:r===0&&i<0?I.DIV0:rw(r**i)}}function ow(e,t,n){if(t instanceof F)return t;if(n instanceof F)return n;switch(e){case`&`:{let e=B(t);if(e instanceof F)return e;let r=B(n);return r instanceof F?r:`${e}${r}`}case`=`:return nw(t,n)===0;case`<>`:return nw(t,n)!==0;case`<`:return nw(t,n)<0;case`<=`:return nw(t,n)<=0;case`>`:return nw(t,n)>0;case`>=`:return nw(t,n)>=0;default:return aw(e,t,n)}}function sw(e,t,n){let r=Math.max(e.rows,t.rows),i=Math.max(e.cols,t.cols),a=Array(r*i),o=(e,t,n)=>{let r=e.rows===1?0:t,i=e.cols===1?0:n;return r<e.rows&&i<e.cols?e.at(r,i):void 0};for(let s=0;s<r;s++)for(let r=0;r<i;r++){let c=o(e,s,r),l=o(t,s,r);a[s*i+r]=c===void 0||l===void 0?I.NA:n(c,l)}return new L(r,i,a)}let cw=e=>({top:e.top,left:e.left,bottom:e.bottom,right:e.right});var lw=class{kept=/* @__PURE__ */ new Map;of(e,t,n){let r=this.kept.get(e);if(r)return r.value;let i=n();return this.kept.set(e,{over:t.map(e=>({sheet:e.sheet,area:cw(e)})),value:i}),i}asked=/* @__PURE__ */ new Set;ofRepeated(e,t,n){let r=this.kept.get(e);if(r)return r.value;if(!this.asked.has(e))this.asked.add(e);else return this.asked.delete(e),this.of(e,t,n)}get(e){return this.kept.get(e)?.value}set(e,t,n){this.kept.set(e,{over:t.map(e=>({sheet:e.sheet,area:cw(e)})),value:n})}changed(e,t){if(this.kept.size!==0)for(let[n,r]of this.kept)r.over.some(n=>n.sheet===e&&b(n.area,t))&&this.kept.delete(n)}clear(){this.kept.clear(),this.asked.clear()}};let uw=(e,t)=>`${e}:${t.key}`,dw=/* @__PURE__ */ new Map;function fw(e){let t=/^([vr?]*)(?:\(([vr]+)\))?$/u.exec(e),n=t?.[1];if(n===void 0||(n.match(/\?/gu)??[]).length>1)throw Error(`"${e}" is not a signature.`);let r=e=>Array.from({length:e.length},(t,n)=>e.charAt(n)===`v`?`value`:`whole`),i=r(n.replace(`?`,``)),a=r(t?.[2]??``),o=n.indexOf(`?`);return{fixed:i,group:a,min:o>=0?o:i.length+a.length,max:a.length>0?255:i.length}}function pw(e,t){return t<e.fixed.length?e.fixed[t]??`whole`:e.group.length===0?`whole`:e.group[(t-e.fixed.length)%e.group.length]??`whole`}function mw(e,t){return e.group.length===0||t<=e.fixed.length||(t-e.fixed.length)%e.group.length===0}function V(e,t,n,r,i={}){dw.set(e,{name:e,min:t,max:n,kind:`scalar`,call:r,from:i.from??`allyhub`,...i.errors===!0?{errors:!0}:{},...i.volatile===!0?{volatile:!0}:{}})}function H(e,t,n,r={}){let{min:i,max:a,fixed:o,group:s}=fw(t);dw.set(e,{name:e,min:i,max:a,kind:`raw`,params:{fixed:o,group:s},call:n,from:r.from??`allyhub`,...r.volatile===!0?{volatile:!0}:{}})}function hw(e,t,n,r){dw.set(e,{name:e,min:t,max:n,kind:`lazy`,call:r,from:`allyhub`})}function gw(e,t){let n=dw.get(t);n&&dw.set(e,{...n,name:e})}function U(e,t){if(e instanceof F)return e;if(e instanceof pg)return I.VALUE;if(e instanceof R){let n=Math.min(e.bottom,e.sheet.lastRow);return{rows:Math.max(0,n-e.top+1),cols:e.cols,at:(n,r)=>t.calc.read(e.sheet,e.top+n,e.left+r),reference:e}}if(e instanceof L)return{rows:e.rows,cols:e.cols,at:(t,n)=>e.at(t,n),array:e};if(e instanceof mg)return I.VALUE;let n=e instanceof hg?null:e;return{rows:1,cols:1,at:()=>n}}function _w(e,t,n){for(let r of e)if(r instanceof R)t.calc.each(r,e=>{n(e,!1)});else if(r instanceof pg)for(let e of r.parts)t.calc.each(e,e=>{n(e,!1)});else if(r instanceof L)for(let e of r.data)e!==null&&n(e,!1);else r instanceof hg?n(null,!0):r instanceof mg?n(I.VALUE,!0):n(r,!0)}function vw(e,t,n){let r=e=>{for(let r of t.calc.matrix(e).data)n(r,!1)};for(let t of e)if(t instanceof R)r(t);else if(t instanceof pg)t.parts.forEach(r);else if(t instanceof L)for(let e of t.data)n(e,!1);else t instanceof hg?n(null,!0):t instanceof mg?n(I.VALUE,!0):n(t,!0)}function yw(e,t){let n=[],r;return _w(e,t,(e,t)=>{if(!r){if(e instanceof F)r=e;else if(typeof e==`number`)n.push(e);else if(t){let t=z(e);t instanceof F?r=t:n.push(t)}}}),r??n}function bw(e,t){let n=[],r;return _w(e,t,(e,t)=>{if(!r){if(e instanceof F)r=e;else if(typeof e==`number`)n.push(e);else if(typeof e==`boolean`)n.push(+!!e);else if(t){let t=z(e);t instanceof F?r=t:n.push(t)}else typeof e==`string`&&n.push(0)}}),r??n}let xw=e=>(...t)=>{let n=[];for(let e of t){let t=z(e);if(t instanceof F)return t;n.push(t)}return e(...n)};function Sw(e,t){return e===void 0?t:z(e)}function Cw(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`}let ww=/* @__PURE__ */ new Map;function Tw(e){let t=ww.get(e);if(t)return t;ww.size>=1e4&&ww.clear();let n=Ew(e);return ww.set(e,n),n}function Ew(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charAt(n);r===`~`&&/[*?~]/u.test(e.charAt(n+1))?(n+=1,t+=e.charAt(n).replace(/[*?]/u,`\\$&`)):t+=r===`*`?`[\\s\\S]*`:r===`?`?`[\\s\\S]`:r.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`)}let n=RegExp(`^${t}$`,`iu`);return e=>n.test(e)}let Dw=e=>/[*?~]/u.test(e);function Ow(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charAt(n);if(r===`~`&&/[*?~]/u.test(e.charAt(n+1)))n+=1,t+=e.charAt(n);else if(r===`*`||r===`?`)return;else t+=r}return t}function kw(e){return t=>{if(typeof t==`number`)return tw(t,e);if(typeof t!=`string`)return!1;let n=ZC(t);return n!==void 0&&tw(n,e)}}function Aw(e,t){let n=t=>e===`>`?t>0:e===`>=`?t>=0:e===`<`?t<0:t<=0;return e=>typeof e==typeof t&&n(nw(e,t))}function jw(e){if(e===null)return{test:kw(0),key:`n0`};if(typeof e==`number`)return{test:kw(e),key:`n${String(Number(e.toPrecision(15)))}`};if(typeof e==`boolean`)return{test:t=>t===e,key:e?`bT`:`bF`};if(e instanceof F)return{test:t=>t===e};let t=/^(<>|>=|<=|=|>|<)/u.exec(e),n=t?.[1]??`=`,r=t?e.slice(n.length):e,i=e=>e===null;if(r===``)return n===`=`?{test:t?i:e=>e===null||e===``}:n===`<>`?{test:e=>e!==null}:{test:()=>!1};let a=ZC(r),o=/^(?:TRUE|FALSE)$/iu.test(r)?r.toUpperCase()===`TRUE`:void 0,s=a??o;if(n===`=`||n===`<>`){let e,t;if(a!==void 0)e=kw(a),t=Cw(a);else if(o!==void 0)e=e=>e===o,t=Cw(o);else if(mh(r)!==void 0)e=e=>e instanceof F&&e.code===r.toUpperCase();else if(Dw(r)){let t=Tw(r);e=e=>typeof e==`string`&&t(e)}else{let n=r.toUpperCase();e=e=>typeof e==`string`&&e.toUpperCase()===n,t=Cw(r)}return n===`=`?t===void 0?{test:e}:{test:e,key:t}:{test:t=>!e(t)}}return{test:Aw(n,s??r)}}function Mw(e,t){let n=e.reference;if(!(n?.cols!==1||e.rows<64))return t.calc.indexes.ofRepeated(uw(`crit`,n),[n],()=>{let t=/* @__PURE__ */ new Map,n=(e,n)=>{if(e===void 0)return;let r=t.get(e);r?r.push(n):t.set(e,[n])};for(let t=0;t<e.rows;t++){let r=e.at(t,0);if(n(Cw(r),t),typeof r==`string`){let e=ZC(r);e!==void 0&&n(Cw(e),t)}}return t})}function Nw(e,t){return jw(t.calc.scalar(e,t.frame))}function Pw(e,t){let n=[];for(let r=0;r+1<e.length;r+=2){let i=U(e[r],t);if(i instanceof F)return i;let a=Nw(e[r+1],t);if(a instanceof F)return a;n.push({cells:i,crit:a})}let r=n[0]?.cells;return r&&n.some(e=>!Fw(e.cells,r))?I.VALUE:n}let Fw=(e,t)=>e.cols===t.cols&&(e.reference?.rows??e.rows)===(t.reference?.rows??t.rows);function Iw(e,t,n){let r=e[0];if(!r)return;let i,a;for(let n of e){if(n.crit.key===void 0)continue;let e=Mw(n.cells,t);if(!e)continue;let r=e.get(n.crit.key)??[];(i===void 0||r.length<i.length)&&(i=r,a=n)}if(i!==void 0){let t=e.filter(e=>e!==a);for(let e of i)t.every(t=>t.crit.test(t.cells.at(e,0)))&&n(e,0);return}let o=Math.max(...e.map(e=>e.cells.rows));for(let t=0;t<o;t++)for(let i=0;i<r.cells.cols;i++)e.every(e=>e.crit.test(e.cells.at(t,i)))&&n(t,i)}function Lw(e,t){return e instanceof R?(e.rows-t.rows)*e.cols:0}function Rw(e,t,n,r){let i;return Iw(t,n,(t,n)=>{if(i)return;let a=e.at(t,n);a instanceof F?i=a:typeof a==`number`&&r(a)}),i}function zw(e,t){let n=U(e[0],t);if(n instanceof F)return n;let r=e[2];return r===void 0?n:U(r,t)}let Bw=e=>(t,n)=>{let r=U(t[0],n);if(r instanceof F)return r;let i=Nw(t[1],n);if(i instanceof F)return i;let a=zw(t,n);if(a instanceof F)return a;let o=[];return Rw(a,[{cells:r,crit:i}],n,e=>{o.push(e)})??e(o)},Vw=e=>(t,n)=>{let r=U(t[0],n);if(r instanceof F)return r;let i=Pw(t.slice(1),n);if(i instanceof F)return i;let a=i[0]?.cells;if(a&&!Fw(r,a))return I.VALUE;let o=[];return Rw(r,i,n,e=>{o.push(e)})??e(o)},Hw=(e,t)=>(n,r)=>{let i=[],a=[e];for(let e of n)if(e instanceof R)i.push(e),a.push(`r${e.key}`);else if(e instanceof hg)a.push(`-`);else if(e instanceof F)a.push(`e${e.code}`);else if(typeof e!=`object`||!e)a.push(`${typeof e}:${String(e)}`);else return t(n,r);if(i.length===0)return t(n,r);let o=a.join(`\0`),s=r.calc.results.get(o);if(s!==void 0)return s;let c=t(n,r);return(typeof c!=`object`||!c||c instanceof F)&&r.calc.results.set(o,i,c),c},Uw=e=>e.reduce((e,t)=>e+t,0),Ww=e=>e.length===0?I.DIV0:Uw(e)/e.length;H(`SUMIF`,`rv?r`,Hw(`SUMIF`,Bw(Uw))),H(`AVERAGEIF`,`rv?r`,Hw(`AVERAGEIF`,Bw(Ww))),H(`SUMIFS`,`r(rv)`,Hw(`SUMIFS`,Vw(Uw))),H(`AVERAGEIFS`,`r(rv)`,Hw(`AVERAGEIFS`,Vw(Ww))),H(`MINIFS`,`r(rv)`,Hw(`MINIFS`,Vw(e=>e.length===0?0:e.reduce((e,t)=>t<e?t:e)))),H(`MAXIFS`,`r(rv)`,Hw(`MAXIFS`,Vw(e=>e.length===0?0:e.reduce((e,t)=>t>e?t:e)))),H(`COUNTIF`,`rv`,Hw(`COUNTIF`,(e,t)=>{let n=U(e[0],t);if(n instanceof F)return n;let r=Nw(e[1],t);if(r instanceof F)return r;let i=0;return Iw([{cells:n,crit:r}],t,()=>{i+=1}),i+(r.test(null)?Lw(e[0],n):0)})),H(`COUNTIFS`,`(rv)`,Hw(`COUNTIFS`,(e,t)=>{let n=Pw(e,t);if(n instanceof F)return n;let r=0;return Iw(n,t,()=>{r+=1}),r}));let Gw=e=>typeof e==`number`?0:typeof e==`string`?1:typeof e==`boolean`?2:3;function Kw(e,t){let n=Gw(e),r=Gw(t);if(n!==r)return n-r;if(typeof e==`number`&&typeof t==`number`)return e-t;if(typeof e==`string`&&typeof t==`string`){let n=e.toLowerCase(),r=t.toLowerCase();return n<r?-1:+(n>r)}return typeof e==`boolean`&&typeof t==`boolean`?e===t?0:e?1:-1:e instanceof F&&t instanceof F?e.code<t.code?-1:+(e.code>t.code):0}let qw=e=>e.separator??`, `;function Jw(e,t){let n=qw(t);return e.split(n.trim()===``?n:n.trim()).map(e=>e.trim()).filter(e=>e!==``)}let Yw=(e,t,n,r)=>Ph(t.value(e,n,r),e.lookAt(n,r).format),Xw=(e,t)=>{if(t===``)return e.blanks===!0;let n=t.toLowerCase();return e.values?.some(e=>e.toLowerCase()===n)===!0};function Zw(e,t,n,r){let i=e.validations.length===0?void 0:e.validationAt(t,n);return i?.spec.multiple===!0?Jw(r,i.spec):[r]}function Qw(e,t,n){let{operator:r}=e,i=e.value;if(typeof i==`number`&&typeof t==`number`)switch(r){case`equal`:return t===i;case`notEqual`:return t!==i;case`greaterThan`:return t>i;case`greaterThanOrEqual`:return t>=i;case`lessThan`:return t<i;case`lessThanOrEqual`:return t<=i}let a=String(i);if(r===`equal`||r===`notEqual`){let e=Dw(a)?Tw(a)(n):n.toLowerCase()===a.toLowerCase();return r===`equal`?e:!e}if(n===``)return!1;let o=n.toLowerCase().localeCompare(a.toLowerCase());switch(r){case`greaterThan`:return o>0;case`greaterThanOrEqual`:return o>=0;case`lessThan`:return o<0;case`lessThanOrEqual`:return o<=0}}function $w(e,t,n,r,i){let{top:a}=n.area,o=Math.min(n.area.bottom,e.lastRow),s=()=>{let n=[];for(let i=a+1;i<=o;i++){let a=t.value(e,i,r);typeof a==`number`&&n.push(a)}return n};if(i.values!==void 0||i.blanks!==void 0)return n=>{let a=Yw(e,t,n,r);return a===``?i.blanks===!0:Zw(e,n,r,a).some(e=>Xw(i,e))};let c=i.conditions;if(c)return n=>{let a=t.value(e,n,r),o=Yw(e,t,n,r),s=c.map(e=>Qw(e,a,o));return i.or===!0?s.some(Boolean):s.every(Boolean)};let l=i.top;if(l){let n=s().sort((e,t)=>l.bottom===!0?e-t:t-e),i=l.percent===!0?Math.max(1,Math.floor(n.length*l.count/100)):Math.round(l.count),a=n[Math.min(i,n.length)-1];return n=>{let i=t.value(e,n,r);return typeof i!=`number`||a===void 0?!1:l.bottom===!0?i<=a:i>=a}}if(i.average){let n=s(),a=n.reduce((e,t)=>e+t,0)/Math.max(1,n.length),o=i.average===`above`;return n=>{let i=t.value(e,n,r);return typeof i==`number`&&(o?i>a:i<a)}}let u=i.color;return u?t=>{let n=e.lookAt(t,r);return u.fill===void 0?u.font===void 0||(n.color??`#000000`).toUpperCase()===u.font.toUpperCase():typeof n.fill==`string`&&n.fill.toUpperCase()===u.fill.toUpperCase()}:()=>!0}function eT(e,t,n,r){return[...n.columns].filter(([e])=>e!==r).map(([r,i])=>$w(e,t,n,r,i))}let tT=(e,t)=>e.every(e=>e(t));function nT(e,t){let n=/* @__PURE__ */ new Set;for(let r of e.filters){if(r.columns.size===0)continue;let{top:i,bottom:a}=r.area,o=Math.min(a,e.lastRow),s=eT(e,t,r);for(let e=i+1;e<=o;e++)tT(s,e)||n.add(e)}return n}let rT=(e,t)=>e?t.calc.eval(e,t.frame):!1;function iT(e,t,n){if(!(e instanceof L))return e;let r=e.rows===1?0:t,i=e.cols===1?0:n;return r<e.rows&&i<e.cols?e.at(r,i):I.NA}function aT(e,t,n){let r=[e,...t].filter(e=>e instanceof L),i=Math.max(...r.map(e=>e.rows)),a=Math.max(...r.map(e=>e.cols)),o=Array(i*a);for(let r=0;r<i;r++)for(let i=0;i<a;i++){let s=n(iT(e,r,i));o[r*a+i]=s instanceof F?s:iT(t[s]??I.VALUE,r,i)}return new L(i,a,o)}hw(`IF`,1,3,(e,t)=>{let n=t.calc.flat(rT(e[0],t)),r=n=>{let r=e[n];if(r===void 0)return n===1;let i=t.calc.eval(r,t.frame);return i instanceof hg?null:i};if(n instanceof L){let i=n=>n<e.length?t.calc.flat(r(n))??0:!1;return aT(n,[i(1),i(2)],e=>{let t=$C(e);return t instanceof F?t:+!t})}let i=$C(n);return i instanceof F?i:r(i?1:2)}),hw(`IFS`,2,255,(e,t)=>{for(let n=0;n+1<e.length;n+=2){let r=$C(t.calc.scalar(rT(e[n],t),t.frame));if(r instanceof F)return r;if(r)return rT(e[n+1],t)}return I.NA});let oT=e=>(t,n)=>{let r=n.calc.flat(rT(t[0],n)),i=t=>t instanceof F&&(e===void 0||t===e),a=()=>t[1]?n.calc.flat(n.calc.eval(t[1],n.frame)):``;return r instanceof L?aT(r,[r,a()],e=>+!!i(e)):i(r)?a():r};hw(`IFERROR`,2,2,oT()),hw(`IFNA`,2,2,oT(I.NA)),hw(`CHOOSE`,2,255,(e,t)=>{let n=t.calc.flat(rT(e[0],t));if(n instanceof L){let r=e.slice(1).map(e=>t.calc.flat(t.calc.eval(e,t.frame)));return aT(n,r,e=>{let t=z(e);if(t instanceof F)return t;let n=Math.trunc(t)-1;return n<0||n>=r.length?I.VALUE:n})}let r=z(n);if(r instanceof F)return r;let i=Math.trunc(r),a=e[i];return i<1||a===void 0?I.VALUE:t.calc.eval(a,t.frame)}),hw(`SWITCH`,3,255,(e,t)=>{let n=t.calc.scalar(rT(e[0],t),t.frame);if(n instanceof F)return n;let r=1;for(;r+1<e.length;r+=2){let i=t.calc.scalar(rT(e[r],t),t.frame);if(i instanceof F)return i;if(nw(n,i)===0)return rT(e[r+1],t)}return r<e.length?rT(e[r],t):I.NA});function sT(e,t){let n=[],r;return _w(e,t,(e,t)=>{if(r)return;if(e instanceof F){r=e;return}if(typeof e==`string`&&!t||e===null)return;let i=$C(e);i instanceof F?r=i:n.push(i)}),r||(n.length===0?I.VALUE:n)}H(`AND`,`(r)`,(e,t)=>{let n=sT(e,t);return n instanceof F?n:n.every(Boolean)}),H(`OR`,`(r)`,(e,t)=>{let n=sT(e,t);return n instanceof F?n:n.some(Boolean)}),H(`XOR`,`(r)`,(e,t)=>{let n=sT(e,t);return n instanceof F?n:n.filter(Boolean).length%2==1}),V(`NOT`,1,1,e=>{let t=$C(e);return t instanceof F?t:!t}),H(`TRUE`,``,()=>!0),H(`FALSE`,``,()=>!1);let cT=(e,t)=>t?{names:e,parent:t}:{names:e};hw(`LET`,3,255,(e,t)=>{if(e.length%2==0)return I.VALUE;let n=/* @__PURE__ */ new Map,r={...t.frame,scope:cT(n,t.frame.scope)};for(let i=0;i+1<e.length;i+=2){let a=e[i];if(a?.kind!==`name`)return I.VALUE;n.set(a.name.toLowerCase(),rT(e[i+1],{...t,frame:r}))}return rT(e[e.length-1],{...t,frame:r})}),hw(`LAMBDA`,1,254,(e,t)=>{let n=[];for(let t of e.slice(0,-1)){if(t.kind!==`name`)return I.VALUE;n.push(t.name.toLowerCase())}let r=e[e.length-1];return r?new mg(n,r,t.frame):I.VALUE});function lT(e){let t=0;for(let n of e)t=iw(t+n,t,n);return t}H(`SUM`,`(r)`,(e,t)=>{let n=0,r;return _w(e,t,(e,i)=>{if(!r){if(typeof e==`number`)n=iw(n+e,n,e);else if(e instanceof F)r=e;else if(i){let i=yw([e],t);i instanceof F?r=i:n+=i[0]??0}}}),r??rw(n)}),H(`AVERAGE`,`(r)`,(e,t)=>{let n=yw(e,t);return n instanceof F?n:n.length===0?I.DIV0:lT(n)/n.length}),H(`AVERAGEA`,`(r)`,(e,t)=>{let n=bw(e,t);return n instanceof F?n:n.length===0?I.DIV0:lT(n)/n.length}),H(`COUNT`,`(r)`,(e,t)=>{let n=0;return _w(e,t,(e,r)=>{typeof e==`number`?n+=1:r&&!(e instanceof F)&&e!==null&&(yw([e],t)instanceof F||(n+=1))}),n}),H(`COUNTA`,`(r)`,(e,t)=>{let n=0;return _w(e,t,()=>{n+=1}),n}),H(`COUNTBLANK`,`r`,(e,t)=>{let n=e[0];if(n instanceof F)return n;if(n instanceof R){let e=0;return t.calc.each(n,t=>{t!==``&&(e+=1)}),n.rows*n.cols-e}let r=t.calc.flat(n);return r instanceof L?r.data.filter(e=>e===null||e===``).length:+(r===null||r===``)});let uT=e=>t=>{if(t instanceof F)return t;if(t.length===0)return 0;let n=t[0]??0;for(let r of t)n=e(n,r);return n},dT=uT((e,t)=>t<e?t:e),fT=uT((e,t)=>t>e?t:e);H(`MIN`,`(r)`,(e,t)=>dT(yw(e,t))),H(`MAX`,`(r)`,(e,t)=>fT(yw(e,t))),H(`MINA`,`(r)`,(e,t)=>dT(bw(e,t))),H(`MAXA`,`(r)`,(e,t)=>fT(bw(e,t))),H(`PRODUCT`,`(r)`,(e,t)=>{let n=yw(e,t);return n instanceof F?n:n.length===0?0:rw(n.reduce((e,t)=>e*t,1))}),H(`SUMSQ`,`(r)`,(e,t)=>{let n=yw(e,t);return n instanceof F?n:rw(lT(n.map(e=>e*e)))}),H(`SUMPRODUCT`,`(r)`,(e,t)=>{let n=e.map(e=>U(e,t)),r=n[0];if(r===void 0||r instanceof F)return r??I.VALUE;let{rows:i}=r,{cols:a}=r,o=e=>e.reference&&e.reference.bottom<1048575?e.reference.rows:e.rows;for(let e of n){if(e instanceof F)return e;if(e.cols!==a||o(e)!==o(r))return I.VALUE;i=Math.min(i,e.rows)}let s=0;for(let e=0;e<i;e++)for(let t=0;t<a;t++){let r=1;for(let i of n){let n=i.at(e,t);if(n instanceof F)return n;r*=typeof n==`number`?n:0}s+=r}return rw(s)});let pT={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 mT(e){if(!(e instanceof vC))return!1;let{node:t}=e.shared;return t?.kind===`call`&&t.name===`SUBTOTAL`}H(`SUBTOTAL`,`v(r)`,(e,t)=>{let n=t.calc.scalar(e[0],t.frame);if(n instanceof F)return n;if(typeof n!=`number`)return I.VALUE;let r=n<100,i=pT[r?n:n-100],a=i===void 0?void 0:dw.get(i);if(a?.kind!==`raw`)return I.VALUE;let o=[],s=e=>{let n=t=>e.sheet.spec.rows?.[String(t+1)]?.hidden===!0,i=Math.min(e.bottom,e.sheet.lastRow),a=[],s=t.calc.filtered(e.sheet);for(let o=e.top;o<=i;o++)if(!s.has(o)&&(r||!n(o)))for(let n=e.left;n<=e.right;n++)a.push(mT(e.sheet.at(o,n))?null:t.calc.read(e.sheet,o,n));o.push(new L(a.length,1,a))};for(let t of e.slice(1)){if(t instanceof F)return t;if(t instanceof R)s(t);else if(t instanceof pg)t.parts.forEach(s);else return I.VALUE}return a.call(o,t)});let hT=(e,t)=>typeof e==typeof t&&!(e instanceof F)&&e!==null;function gT(e){if(e.rows===1)return{length:e.cols,at:t=>e.at(0,t)};if(e.cols===1)return{length:e.rows,at:t=>e.at(t,0)}}let _T=/* @__PURE__ */ new WeakMap;function vT(e,t){let n=_T.get(e);if(n)return n;if(n===void 0){_T.set(e,null);return}let r=t();return _T.set(e,r),r}function yT(e,t,n,r,i,a=0,o=1){let s=typeof e==`string`?e:void 0,c=i&&s!==void 0&&Dw(s)?Ow(s):s;if(s!==void 0&&c===void 0){let e=Tw(s);for(let n=a;n>=0&&n<t.length;n+=o){let r=t.at(n);if(typeof r==`string`&&e(r))return n}return-1}let l=Cw(c??e);if(l===void 0)return-1;if(t.length>=64&&a===0&&o===1){let e=()=>{let e=/* @__PURE__ */ new Map;for(let n=t.length-1;n>=0;n--){let r=Cw(t.at(n));r!==void 0&&e.set(r,[n])}return e},i=n.reference,a=i?r.calc.indexes.ofRepeated(uw(`find`,i),[i],e):n.array&&vT(n.array,e);if(a)return a.get(l)?.[0]??-1}for(let e=a;e>=0&&e<t.length;e+=o)if(Cw(t.at(e))===l)return e;return-1}function bT(e,t,n=!1){let r=0,i=t.length-1,a=-1;for(;r<=i;){let o=r+i>>1,s=o;for(;s>=r&&!hT(t.at(s),e);)--s;if(s<r){r=o+1;continue}let c=nw(t.at(s),e);(n?c>=0:c<=0)?(a=s,r=o+1):i=s-1}return a}let xT=(e,t)=>t.calc.scalar(e??null,t.frame),ST=(e,t,n)=>e===void 0?n:e instanceof hg?!1:$C(t.calc.scalar(e,t.frame));function CT(e){return(t,n)=>{let r=xT(t[0],n);if(r instanceof F)return r;let i=U(t[1],n);if(i instanceof F)return i;let a=z(n.calc.scalar(t[2],n.frame));if(a instanceof F)return a;let o=Math.trunc(a);if(o<1)return I.VALUE;let s=i.reference,c=s?s.bottom-s.top+1:i.rows;if(o>(e?i.cols:c))return I.REF;let l=ST(t[3],n,!0);if(l instanceof F)return l;let u={length:e?i.rows:i.cols,at:t=>e?i.at(t,0):i.at(0,t)},d={rows:e?i.rows:1,cols:e?1:i.cols,at:(e,t)=>i.at(e,t),...i.reference?{reference:new R(i.reference.sheet,i.reference.top,i.reference.left,e?i.reference.bottom:i.reference.top,e?i.reference.left:i.reference.right)}:{}},f=l?bT(r,u):yT(r,u,d,n,!0);return f<0?I.NA:e?i.at(f,o-1):i.at(o-1,f)}}H(`VLOOKUP`,`vrv?v`,CT(!0)),H(`HLOOKUP`,`vrv?v`,CT(!1)),H(`MATCH`,`vr?v`,(e,t)=>{let n=xT(e[0],t);if(n instanceof F)return n;let r=U(e[1],t);if(r instanceof F)return r;let i=gT(r);if(!i)return I.NA;let a=e[2]===void 0?1:e[2]instanceof hg?0:z(t.calc.scalar(e[2],t.frame));if(a instanceof F)return a;let o=a===0?yT(n,i,r,t,!0):bT(n,i,a<0);return o<0?I.NA:o+1}),H(`LOOKUP`,`vr?r`,(e,t)=>{let n=xT(e[0],t);if(n instanceof F)return n;let r=U(e[1],t);if(r instanceof F)return r;let i=r.rows>=r.cols,a=bT(n,{length:i?r.rows:r.cols,at:e=>i?r.at(e,0):r.at(0,e)});if(a<0)return I.NA;if(e[2]===void 0)return i?r.at(a,r.cols-1):r.at(r.rows-1,a);let o=U(e[2],t);if(o instanceof F)return o;let s=gT(o);return s?s.at(a):I.NA});function wT(e,t,n,r,i){let a=gT(t);if(!a)return-1;let o=i===-1;if(Math.abs(i)===2){let t=bT(e,a,i<0);if(t>=0&&nw(a.at(t),e)===0)return t;if(r===0)return-1}let s=yT(e,a,t,n,r===2,o?a.length-1:0,o?-1:1);if(s>=0||r===0||r===2)return s;let c=-1;for(let t=0;t<a.length;t++){let n=a.at(t);if(!hT(n,e))continue;let i=nw(n,e),o=c<0||(r<0?nw(n,a.at(c))>0:nw(n,a.at(c))<0);(r<0?i<0:i>0)&&o&&(c=t)}return c}let TT=(e,t,n)=>{let r=(e,t)=>e===void 0||e instanceof hg?t:z(n.calc.scalar(e,n.frame)),i=r(e,0);if(i instanceof F)return i;let a=r(t,1);return a instanceof F?a:[i,a]};H(`XLOOKUP`,`vrr?rvv`,(e,t)=>{let n=xT(e[0],t);if(n instanceof F)return n;let r=U(e[1],t);if(r instanceof F)return r;let i=U(e[2],t);if(i instanceof F)return i;let a=TT(e[4],e[5],t);if(a instanceof F)return a;let o=wT(n,r,t,a[0],a[1]);if(o<0){let n=e[3];return n===void 0||n instanceof hg?I.NA:t.calc.flat(n)}if(r.cols===1){if(i.cols===1)return i.at(o,0);let e=[];for(let t=0;t<i.cols;t++)e.push(i.at(o,t));return new L(1,i.cols,e)}if(i.rows===1)return i.at(0,o);let s=[];for(let e=0;e<i.rows;e++)s.push(i.at(e,o));return new L(i.rows,1,s)}),H(`XMATCH`,`vr?vv`,(e,t)=>{let n=xT(e[0],t);if(n instanceof F)return n;let r=U(e[1],t);if(r instanceof F)return r;let i=TT(e[2],e[3],t);if(i instanceof F)return i;let a=wT(n,r,t,i[0],i[1]);return a<0?I.NA:a+1}),H(`INDEX`,`rv?vv`,(e,t)=>{let n=e[0],r=e=>{if(e===void 0||e instanceof hg)return 0;let n=z(t.calc.scalar(e,t.frame));return n instanceof F?n:Math.trunc(n)};if(n instanceof pg){let t=r(e[3]??1);if(t instanceof F)return t;let i=n.parts[t-1];if(!i)return I.REF;n=i}if(n instanceof F)return n;let i=r(e[1]);if(i instanceof F)return i;let a=r(e[2]);if(a instanceof F)return a;if(i<0||a<0)return I.VALUE;if(n instanceof R){let t=e[2]===void 0&&n.rows===1,r=t?1:i,o=t?i:a;return r>n.rows||o>n.cols?I.REF:new R(n.sheet,r===0?n.top:n.top+r-1,o===0?n.left:n.left+o-1,r===0?n.bottom:n.top+r-1,o===0?n.right:n.left+o-1)}let o=U(n,t);if(o instanceof F)return o;let s=e[2]===void 0&&o.rows===1,c=s?1:i,l=s?i:a===0&&o.cols===1?1:a;if(c>o.rows||l>o.cols)return I.REF;if(c>0&&l>0)return o.at(c-1,l-1);let u=c===0?o.rows:1,d=l===0?o.cols:1,f=[];for(let e=0;e<u;e++)for(let t=0;t<d;t++)f.push(o.at(c===0?e:c-1,l===0?t:l-1));return new L(u,d,f)}),H(`OFFSET`,`rvv?vv`,(e,t)=>{let n=e[0];if(n instanceof F)return n;if(!(n instanceof R))return I.VALUE;let r=(e,n)=>{if(e===void 0||e instanceof hg)return n;let r=z(t.calc.scalar(e,t.frame));return r instanceof F?r:Math.trunc(r)},i=r(e[1],0),a=r(e[2],0),o=r(e[3],n.rows),s=r(e[4],n.cols);for(let e of[i,a,o,s])if(e instanceof F)return e;let[c,l,u,d]=[i,a,o,s];if(u===0||d===0)return I.REF;let f=n.top+(c??0),p=n.left+(l??0),m=f+(u??1)-1,h=p+(d??1)-1;return Math.min(f,m)<0||Math.min(p,h)<0||Math.max(f,m)>=1048576||Math.max(p,h)>=16384?I.REF:new R(n.sheet,Math.min(f,m),Math.min(p,h),Math.max(f,m),Math.max(p,h))},{volatile:!0});let ET=/^(?:(.*)!)?R(\[-?\d+\]|\d+)?C(\[-?\d+\]|\d+)?(?::R(\[-?\d+\]|\d+)?C(\[-?\d+\]|\d+)?)?$/iu,DT=(e,t)=>e===void 0?t:e.startsWith(`[`)?t+Number(e.slice(1,-1)):Number(e)-1;function OT(e,t,n){let r=ET.exec(e.trim());if(!r)return;let[,i,a,o,s,c]=r,l={row:DT(a,t),col:DT(o,n)};if(l.row<0||l.col<0)return;let u=m(l),d=i===void 0?``:`${i}!`;if(s===void 0&&c===void 0)return`${d}${u}`;let f={row:DT(s,t),col:DT(c,n)};return f.row<0||f.col<0?void 0:`${d}${u}:${m(f)}`}H(`INDIRECT`,`v?v`,(e,t)=>{let n=B(t.calc.scalar(e[0],t.frame));if(n instanceof F)return n;let r=e[1]===void 0||$C(t.calc.scalar(e[1],t.frame));if(r instanceof F)return r;let i=r?n:OT(n,t.frame.row,t.frame.col);if(i===void 0)return I.REF;let a=hC(i);if(!a.ok)return I.REF;let{node:o}=a;if(o.kind!==`ref`&&o.kind!==`structured`&&o.kind!==`name`&&(o.kind!==`binary`||o.op!==`:`))return I.REF;let s=t.calc.eval(o,{...t.frame,dr:0,dc:0});return s instanceof R||s instanceof pg?s:I.REF},{volatile:!0});let kT=(e,t,n)=>{if(e===void 0||e instanceof hg)return t+1;if(e instanceof F)return e;if(e instanceof L)return new L(e.rows,e.cols,e.data.map(e=>e instanceof F?e:I.VALUE));if(!(e instanceof R))return I.VALUE;let[r,i]=n(e);if(i<=1)return r+1;let a=Array.from({length:i},(e,t)=>r+t+1);return n===AT?new L(i,1,a):new L(1,i,a)},AT=e=>[e.top,e.bottom===1048575?Math.min(e.rows,e.sheet.lastRow-e.top+1):e.rows],jT=e=>[e.left,e.cols];H(`ROW`,`?r`,(e,t)=>kT(e[0],t.frame.row,AT)),H(`COLUMN`,`?r`,(e,t)=>kT(e[0],t.frame.col,jT)),H(`ROWS`,`r`,(e,t)=>{let n=e[0];if(n instanceof R)return n.rows;let r=U(n,t);return r instanceof F?r:r.rows}),H(`COLUMNS`,`r`,(e,t)=>{let n=e[0];if(n instanceof R)return n.cols;let r=U(n,t);return r instanceof F?r:r.cols}),H(`AREAS`,`r`,e=>{let t=e[0];return t instanceof R?1:t instanceof pg?t.parts.length:I.VALUE}),V(`ADDRESS`,2,5,(e,t,n,r,i)=>{let a=z(e),o=z(t),s=n==null?1:z(n);for(let e of[a,o,s])if(e instanceof F)return e;let[c,l,u]=[a,o,s];if((c??0)<1||(l??0)<1||(c??0)>1048576||(l??0)>16384)return I.VALUE;let d=r==null||$C(r);if(d instanceof F)return d;let p=u===1||u===2,m=u===1||u===3,h=d?`${m?`$`:``}${f((l??1)-1)}${p?`$`:``}${String(c)}`:`R${p?String(c):`[${String(c)}]`}C${m?String(l):`[${String(l)}]`}`;if(i==null)return h;let g=B(i);return g instanceof F?g:`${bg(g)}${h}`}),H(`TRANSPOSE`,`r`,(e,t)=>{let n=U(e[0],t);if(n instanceof F)return n;let r=[];for(let e=0;e<n.cols;e++)for(let t=0;t<n.rows;t++)r.push(n.at(t,e));return new L(n.cols,n.rows,r)}),hw(`SHEET`,0,1,(e,t)=>{let n=e[0];if(n===void 0)return t.frame.sheet.index+1;let r=t.calc.eval(n,t.frame);if(r instanceof R)return r.sheet.index+1;let i=t.calc.scalar(r,t.frame);if(typeof i!=`string`)return I.NA;let a=t.calc.wb.sheet(i);return a?a.index+1:I.NA}),H(`SHEETS`,`?r`,(e,t)=>t.calc.wb.sheets.length);let MT=(e,t)=>Array.from(e,e=>{let n=t(e);return n.length===e.length?n:e}).join(``),NT=e=>MT(e,e=>e.toLowerCase());function PT(e,t){if(e===void 0||e instanceof hg)return[];let n=U(e,t);if(n instanceof F)return n;let r=[];for(let e=0;e<n.rows;e++)for(let t=0;t<n.cols;t++){let i=n.at(e,t);if(i===null)continue;let a=B(i);if(a instanceof F)return a;r.push(a)}return r}function FT(e,t,n){let r=n?NT(e):e,i=(n?t.map(NT):[...t]).filter(e=>e!==``).sort((e,t)=>t.length-e.length),a=[];if(i.length===0)return a;let o=0;for(;o<e.length;){let e=i.find(e=>r.startsWith(e,o));e===void 0?o+=1:(a.push({at:o,length:e.length}),o+=e.length)}return a}function IT(e,t,n){let r=[],i=0;for(let a of FT(e,t,n))r.push(e.slice(i,a.at)),i=a.at+a.length;return r.push(e.slice(i)),r}let LT=e=>t=>{let n=B(t);return n instanceof F?n:e(n)},RT=(e,t)=>{if(e===void 0)return t;let n=z(e);return n instanceof F?n:n<0?I.VALUE:Math.trunc(n)},zT=e=>MT(e,e=>e.toUpperCase()),BT=NT;V(`LEFT`,1,2,(e,t)=>{let n=B(e),r=RT(t,1);return n instanceof F?n:r instanceof F?r:n.slice(0,r)}),V(`RIGHT`,1,2,(e,t)=>{let n=B(e),r=RT(t,1);return n instanceof F?n:r instanceof F?r:r===0?``:n.slice(-r)}),V(`MID`,3,3,(e,t,n)=>{let r=B(e),i=z(t),a=RT(n,0);if(r instanceof F)return r;if(i instanceof F)return i;if(a instanceof F)return a;if(i<1)return I.VALUE;let o=Math.trunc(i)-1;return r.slice(o,o+a)}),V(`LEN`,1,1,LT(e=>e.length)),V(`LOWER`,1,1,LT(BT)),V(`UPPER`,1,1,LT(zT)),V(`PROPER`,1,1,LT(e=>BT(e).replace(/(^|[^\p{L}])(\p{L})/gu,(e,t,n)=>`${t}${zT(n)}`))),V(`TRIM`,1,1,LT(e=>e.replace(/ +/gu,` `).replace(/^ | $/gu,``))),V(`CLEAN`,1,1,LT(e=>e.replace(/[\u0000-\u001f]/gu,``))),V(`T`,1,1,e=>typeof e==`string`?e:``),V(`EXACT`,2,2,(e,t)=>{let n=B(e),r=B(t);return n instanceof F?n:r instanceof F?r:n===r}),V(`REPT`,2,2,(e,t)=>{let n=B(e),r=RT(t,0);return n instanceof F?n:r instanceof F?r:n.length*r>32767?I.VALUE:n.repeat(r)}),V(`CHAR`,1,1,xw(e=>{let t=Math.trunc(e);return t<1||t>255?I.VALUE:VT(t)})),V(`UNICHAR`,1,1,xw(e=>{let t=Math.trunc(e);return t<1||t>1114111?I.VALUE:String.fromCodePoint(t)})),V(`CODE`,1,1,LT(e=>e===``?I.VALUE:e.charCodeAt(0))),V(`UNICODE`,1,1,LT(e=>e.codePointAt(0)??I.VALUE));function VT(e){return e>=128&&e<160?`€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ`.charAt(e-128):String.fromCharCode(e)}H(`CONCAT`,`(r)`,(e,t)=>{let n=``,r;return vw(e,t,e=>{if(r)return;let t=B(e);t instanceof F?r=t:n+=t}),r??n}),V(`CONCATENATE`,1,255,(...e)=>{let t=``;for(let n of e){let e=B(n);if(e instanceof F)return e;t+=e}return t}),H(`TEXTJOIN`,`rv(r)`,(e,t)=>{let[n,r,...i]=e,a=U(n??``,t);if(a instanceof F)return a;let o=[];for(let e=0;e<a.rows;e++)for(let t=0;t<a.cols;t++){let n=B(a.at(e,t));if(n instanceof F)return n;o.push(n)}let s=$C(t.calc.scalar(r===void 0||r instanceof hg||r,t.frame));if(s instanceof F)return s;let c=[],l;if(vw(i,t,e=>{if(l)return;let t=B(e);t instanceof F?l=t:s&&t===``||c.push(t)}),l)return l;let u=c[0]??``;for(let e=1;e<c.length;e++)u+=`${o.length>0?o[(e-1)%o.length]??``:``}${c[e]??``}`;return u}),V(`SUBSTITUTE`,3,4,(e,t,n,r)=>{let i=B(e),a=B(t),o=B(n);if(i instanceof F)return i;if(a instanceof F)return a;if(o instanceof F)return o;if(a===``)return i;if(r===void 0)return i.split(a).join(o);let s=z(r);if(s instanceof F)return s;if(s<1)return I.VALUE;let c=-1;for(let e=0;e<Math.trunc(s);e++)if(c=i.indexOf(a,c+1),c<0)return i;return`${i.slice(0,c)}${o}${i.slice(c+a.length)}`}),V(`REPLACE`,4,4,(e,t,n,r)=>{let i=B(e),a=z(t),o=RT(n,0),s=B(r);if(i instanceof F)return i;if(a instanceof F)return a;if(o instanceof F)return o;if(s instanceof F)return s;if(a<1)return I.VALUE;let c=Math.trunc(a)-1;return`${i.slice(0,c)}${s}${i.slice(c+o)}`}),V(`FIND`,2,3,(e,t,n)=>{let r=B(e),i=B(t),a=n===void 0?1:z(n);if(r instanceof F)return r;if(i instanceof F)return i;if(a instanceof F)return a;if(a<1||a>i.length+1)return I.VALUE;let o=i.indexOf(r,Math.trunc(a)-1);return o<0?I.VALUE:o+1}),V(`SEARCH`,2,3,(e,t,n)=>{let r=B(e),i=B(t),a=n===void 0?1:z(n);if(r instanceof F)return r;if(i instanceof F)return i;if(a instanceof F)return a;if(a<1||a>i.length+1)return I.VALUE;let o=Math.trunc(a)-1,s=Ow(r);if(s!==void 0){let e=i.toLowerCase(),t=s.toLowerCase();if(e.length===i.length&&t.length===s.length){let n=e.indexOf(t,o);return n<0?I.VALUE:n+1}}let c=Tw(`${r}*`);for(let e=o;e<=i.length;e++)if(c(i.slice(e)))return e+1;return I.VALUE}),V(`VALUE`,1,1,e=>typeof e==`number`?e:e==null?0:typeof e==`string`?ZC(e)??I.VALUE:I.VALUE),V(`NUMBERVALUE`,1,3,(e,t,n)=>{let r=B(e),i=B(t??`.`),a=B(n??`,`);if(r instanceof F)return r;if(i instanceof F)return i;if(a instanceof F)return a;let o=r.replace(/\s/gu,``).split(a).join(``).replace(i,`.`);if(o===``)return 0;let s=/%*$/u.exec(o)?.[0].length??0,c=Number(o.slice(0,o.length-s));return Number.isNaN(c)?I.VALUE:c/100**s}),V(`TEXT`,2,2,(e,t)=>{let n=B(t);if(n instanceof F)return n;if(!fh(n))return I.VALUE;if(typeof e==`boolean`)return e?`TRUE`:`FALSE`;let r=typeof e==`string`?ZC(e)??e:e??0;if(r instanceof F)return r;try{return dh(n,r)}catch{return I.VALUE}});function HT(e,t,n){return dh(`${n?`#,##0`:`0`}${t>0?`.${`0`.repeat(t)}`:``}`,e)}let UT=(e,t)=>{let n=10**t;return Math.sign(e)*Math.round(Math.abs(e)*n+1e-9)/n};V(`FIXED`,1,3,(e,t,n)=>{let r=z(e),i=t==null?2:z(t),a=n!==void 0&&$C(n);if(r instanceof F)return r;if(i instanceof F)return i;if(a instanceof F)return a;let o=Math.trunc(i);return HT(UT(r,o),Math.max(0,o),!a)}),V(`DOLLAR`,1,2,(e,t)=>{let n=z(e),r=t==null?2:z(t);if(n instanceof F)return n;if(r instanceof F)return r;let i=Math.trunc(r),a=HT(Math.abs(UT(n,i)),Math.max(0,i),!0);return n<0?`($${a})`:`$${a}`});function WT(e,t,n,r,i){let a=FT(e,t,r);return n>0?(i&&a.push({at:e.length,length:0}),a[n-1]):(i&&a.unshift({at:0,length:0}),a[a.length+n])}function GT(e){return(t,n)=>{let[r,i,a,o,s,c]=t.map(e=>e instanceof hg?void 0:e),l=B(r??null),u=PT(i,n),d=Sw(a,1),f=Sw(o,0),p=Sw(s,0);if(l instanceof F)return l;if(u instanceof F)return u;if(d instanceof F)return d;if(f instanceof F)return f;if(p instanceof F)return p;let m=Math.trunc(d);if(m===0||Math.abs(m)>Math.max(l.length,1))return I.VALUE;if(u.length>0&&u.every(e=>e===``))return m>0==(e===`before`)?``:l;let h=WT(l,u,m,f===1,p===1);return h?e===`before`?l.slice(0,h.at):l.slice(h.at+h.length):c===void 0?I.NA:c}}H(`TEXTBEFORE`,`vr?vvvv`,GT(`before`)),H(`TEXTAFTER`,`vr?vvvv`,GT(`after`)),V(`HYPERLINK`,1,2,(e,t)=>t===void 0?e??``:t),V(`ENCODEURL`,1,1,LT(e=>encodeURIComponent(e)));for(let e of[`LEN`,`LEFT`,`RIGHT`,`MID`,`FIND`,`SEARCH`,`REPLACE`])gw(`${e}B`,e);let KT=e=>{let t=z(e);return t instanceof F?t:t<0||t>=2958466?I.NUM:Math.floor(t)},qT=e=>e%4==0&&e%100!=0||e%400==0,JT=(e,t)=>t===2?qT(e)?29:28:[4,6,9,11].includes(t)?30:31,YT=e=>e.month===2&&e.day===JT(e.year,2);V(`DATE`,3,3,xw((e=0,t=1,n=1)=>{let r=Math.trunc(e);if(r<0||r>9999)return I.NUM;let i=yh(r<1900?r+1900:r,Math.trunc(t),Math.trunc(n));return Number.isFinite(i)&&i>=0&&i<=2958465?i:I.NUM})),V(`TIME`,3,3,xw((e=0,t=0,n=0)=>{let r=Math.trunc(e)*3600+Math.trunc(t)*60+Math.trunc(n);return r<0?I.NUM:r%86400/86400})),V(`YEAR`,1,1,e=>{let t=KT(e);return t instanceof F?t:bh(t).year}),V(`MONTH`,1,1,e=>{let t=KT(e);return t instanceof F?t:bh(t).month}),V(`DAY`,1,1,e=>{let t=KT(e);return t instanceof F?t:bh(t).day});let XT=e=>{let t=z(e);return t instanceof F?t:t<0?I.NUM:Math.round((t-Math.floor(t))*86400)%86400};V(`HOUR`,1,1,e=>{let t=XT(e);return t instanceof F?t:Math.floor(t/3600)}),V(`MINUTE`,1,1,e=>{let t=XT(e);return t instanceof F?t:Math.floor(t/60)%60}),V(`SECOND`,1,1,e=>{let t=XT(e);return t instanceof F?t:t%60}),V(`DATEVALUE`,1,1,e=>{let t=B(e);if(t instanceof F)return t;let n=Pm(t)??Rm(t);return typeof n?.value==`number`?Math.floor(n.value):I.VALUE}),V(`TIMEVALUE`,1,1,e=>{let t=B(e);if(t instanceof F)return t;let n=Fm(t)??Rm(t);return typeof n?.value==`number`?n.value-Math.floor(n.value):I.VALUE});let ZT=e=>(e%7+6)%7;V(`WEEKDAY`,1,2,(e,t)=>{let n=KT(e);if(n instanceof F)return n;let r=t==null?1:z(t);if(r instanceof F)return r;let i=ZT(n);return r===1?i+1:r===2?(i+6)%7+1:r===3?(i+6)%7:r>=11&&r<=17?(i+7-(r-10)%7)%7+1:I.NUM});let QT=e=>{let t=e-(ZT(e)+6)%7+3,{year:n}=bh(t);return Math.floor((t-yh(n,1,1))/7)+1};V(`ISOWEEKNUM`,1,1,e=>{let t=KT(e);return t instanceof F?t:QT(t)}),V(`WEEKNUM`,1,2,(e,t)=>{let n=KT(e);if(n instanceof F)return n;let r=t==null?1:z(t);if(r instanceof F)return r;if(r===21)return QT(n);let i=r===1?0:r===2?1:r>=11&&r<=17?(r-10)%7:-1;if(i<0)return I.NUM;let a=yh(bh(n).year,1,1),o=(ZT(a)+7-i)%7;return Math.floor((n-a+o)/7)+1});let $T=(e,t)=>{let{year:n,month:r,day:i}=bh(e),a=n*12+r-1+t,o=Math.floor(a/12),s=a-o*12+1;return yh(o,s,Math.min(i,JT(o,s)))};V(`EDATE`,2,2,(e,t)=>{let n=KT(e),r=z(t);if(n instanceof F)return n;if(r instanceof F)return r;let i=$T(n,Math.trunc(r));return i<0?I.NUM:i}),V(`EOMONTH`,2,2,(e,t)=>{let n=KT(e),r=z(t);if(n instanceof F)return n;if(r instanceof F)return r;let i=bh($T(n,Math.trunc(r))),a=yh(i.year,i.month,JT(i.year,i.month));return a<0?I.NUM:a}),V(`DAYS`,2,2,(e,t)=>{let n=KT(e),r=KT(t);return n instanceof F?n:r instanceof F?r:n-r}),V(`DATEDIF`,3,3,(e,t,n)=>{let r=KT(e),i=KT(t),a=B(n);if(r instanceof F)return r;if(i instanceof F)return i;if(a instanceof F)return a;if(r>i)return I.NUM;let o=bh(r),s=bh(i),c=(s.year-o.year)*12+s.month-o.month-+(s.day<o.day);switch(a.toUpperCase()){case`D`:return i-r;case`M`:return c;case`Y`:return Math.floor(c/12);case`YM`:return c%12;case`MD`:{if(s.day>=o.day)return s.day-o.day;let e=s.month===1?12:s.month-1,t=s.month===1?s.year-1:s.year;return JT(t,e)-o.day+s.day}case`YD`:{let e=s.year-o.year-+(c%12<0),t=Math.floor(c/12),n=$T(r,t*12);return e>=0?i-n:I.NUM}default:return I.NUM}});function eE(e,t,n){let r=bh(e),i=bh(t),a=r.day,o=i.day,s=i.month,c=i.year;return n?(a=Math.min(a,30),o=Math.min(o,30)):(a===JT(r.year,r.month)&&(a=30),o===31&&(a<30?(o=1,s+=1,s>12&&(s=1,c+=1)):o=30)),(c-r.year)*360+(s-r.month)*30+o-a}V(`DAYS360`,2,3,(e,t,n)=>{let r=KT(e),i=KT(t),a=n!==void 0&&$C(n);return r instanceof F?r:i instanceof F?i:a instanceof F?a:eE(r,i,a)});function tE(e,t,n){let[r,i]=e<=t?[e,t]:[t,e],a=bh(r),o=bh(i),s=i-r;switch(n){case 0:{let e=a.day,t=o.day;return YT(a)&&(YT(o)&&(t=30),e=30),t===31&&e>=30&&(t=30),e===31&&(e=30),((o.year-a.year)*360+(o.month-a.month)*30+t-e)/360}case 2:return s/360;case 3:return s/365;case 4:return eE(r,i,!0)/360;default:{if(a.year===o.year||o.year===a.year+1&&(a.month>o.month||a.month===o.month&&a.day>=o.day)){let e;if(a.year===o.year)e=qT(a.year);else{let t=e=>qT(e)?yh(e,2,29):1/0;e=t(a.year)>=r&&t(a.year)<=i||t(o.year)>=r&&t(o.year)<=i}return s/(e?366:365)}let e=o.year-a.year+1;return s/((yh(o.year+1,1,1)-yh(a.year,1,1))/e)}}}V(`YEARFRAC`,2,3,(e,t,n)=>{let r=KT(e),i=KT(t),a=n==null?0:z(n);if(r instanceof F)return r;if(i instanceof F)return i;if(a instanceof F)return a;let o=Math.trunc(a);return o<0||o>4?I.NUM:tE(r,i,o)});function nE(e){let t=(...e)=>[0,1,2,3,4,5,6].map(t=>e.includes(t));if(e==null)return t(0,6);if(typeof e==`string`){if(!/^[01]{7}$/u.test(e)||e===`1111111`)return I.VALUE;let t=e.split(``).map(e=>e===`1`);return[t[6]??!1,...t.slice(0,6)]}let n=z(e);return n instanceof F?n:n>=1&&n<=7?t((n+5)%7,(n+6)%7):n>=11&&n<=17?t(n-11):I.NUM}function rE(e,t){if(e===void 0||e instanceof hg)return/* @__PURE__ */ new Set;let n=yw([e],t);return n instanceof F?n:new Set(n.map(e=>Math.floor(e)))}function iE(e,t,n,r){let i=e<=t?1:-1,a=0;for(let o=e;i>0?o<=t:o>=t;o+=i)n[ZT(o)]!==!0&&!r.has(o)&&(a+=i);return a}function aE(e,t,n,r){if(n.every(Boolean))return I.VALUE;let i=t<0?-1:1,a=e;for(let e=Math.abs(t);e>0;)a+=i,n[ZT(a)]!==!0&&!r.has(a)&&--e;return a<0?I.NUM:a}let oE=e=>(t,n)=>{let r=KT(n.calc.scalar(t[0],n.frame)),i=KT(n.calc.scalar(t[1],n.frame));if(r instanceof F)return r;if(i instanceof F)return i;let a=e?t[2]:void 0,o=nE(a===void 0||a instanceof hg?void 0:n.calc.scalar(a,n.frame));if(o instanceof F)return o;let s=rE(t[e?3:2],n);return s instanceof F?s:iE(r,i,o,s)},sE=e=>(t,n)=>{let r=KT(n.calc.scalar(t[0],n.frame)),i=z(n.calc.scalar(t[1],n.frame));if(r instanceof F)return r;if(i instanceof F)return i;let a=e?t[2]:void 0,o=nE(a===void 0||a instanceof hg?void 0:n.calc.scalar(a,n.frame));if(o instanceof F)return o;let s=rE(t[e?3:2],n);return s instanceof F?s:aE(r,Math.trunc(i),o,s)};H(`NETWORKDAYS`,`vv?r`,oE(!1)),H(`NETWORKDAYS.INTL`,`vv?vr`,oE(!0)),H(`WORKDAY`,`vv?r`,sE(!1)),H(`WORKDAY.INTL`,`vv?vr`,sE(!0)),H(`NOW`,``,(e,t)=>t.calc.nowSerial(),{volatile:!0}),H(`TODAY`,``,(e,t)=>Math.floor(t.calc.nowSerial()),{volatile:!0});function cE(e,t,n){let r=n[0]??0,i=0;return t.forEach((t,a)=>{i+=t/(1+e)**(((n[a]??r)-r)/365)}),i}let lE=(e,t)=>{let n=[];return vw([e],t,e=>n.push(e)),n},uE=(e,t)=>{let n=lE(e[0],t),r=lE(e[1],t);if(n.length!==r.length)return I.NUM;let i=[],a=[];for(let[e,t]of n.entries()){let n=r[e]??null;if(t instanceof F)return t;if(n instanceof F)return n;if(typeof t==`number`){if(typeof n!=`number`)return I.VALUE;i.push(t),a.push(Math.floor(n))}}return i.length===0?I.NUM:{values:i,dates:a}};H(`XNPV`,`vrr`,(e,t)=>{let n=z(t.calc.scalar(e[0],t.frame));if(n instanceof F)return n;let r=uE(e.slice(1),t);return r instanceof F?r:n<=0?I.NUM:cE(n,r.values,r.dates)}),H(`XIRR`,`rr?v`,(e,t)=>{let n=uE(e,t);if(n instanceof F)return n;let{values:r,dates:i}=n;if(!r.some(e=>e>0)||!r.some(e=>e<0))return I.NUM;let a=e[2]===void 0||e[2]instanceof hg?.1:z(t.calc.scalar(e[2],t.frame));if(a instanceof F)return a;let o=i[0]??0,s=a;for(let e=0;e<100;e++){let e=0,t=0;r.forEach((n,r)=>{let a=((i[r]??o)-o)/365;e+=n/(1+s)**a,t-=a*n/(1+s)**(a+1)});let n=s-e/t;if(!Number.isFinite(n))return I.NUM;if(Math.abs(n-s)<1e-10)return n;s=n<=-1?(s-1)/2:n}return I.NUM});let dE=(e,t)=>{V(e,1,1,e=>t(e),{errors:!0})};dE(`ISBLANK`,e=>e==null),dE(`ISNUMBER`,e=>typeof e==`number`),dE(`ISTEXT`,e=>typeof e==`string`),dE(`ISNONTEXT`,e=>typeof e!=`string`),dE(`ISLOGICAL`,e=>typeof e==`boolean`),dE(`ISERROR`,e=>e instanceof F),dE(`ISERR`,e=>e instanceof F&&e!==I.NA),dE(`ISNA`,e=>e===I.NA);let fE=(e,t)=>{let n=z(e);return n instanceof F?n:Math.abs(Math.trunc(n))%2===t};V(`ISEVEN`,1,1,e=>fE(e,0)),V(`ISODD`,1,1,e=>fE(e,1)),V(`N`,1,1,e=>typeof e==`number`?e:typeof e==`boolean`?+!!e:e instanceof F?e:0,{errors:!0}),H(`NA`,``,()=>I.NA),H(`TYPE`,`r`,(e,t)=>{let n=t.calc.flat(e[0]);return n instanceof L?64:typeof n==`number`||n===null?1:typeof n==`string`?2:typeof n==`boolean`?4:16});let pE=[I.NULL,I.DIV0,I.VALUE,I.REF,I.NAME,I.NUM,I.NA];V(`ERROR.TYPE`,1,1,e=>{let t=e instanceof F?pE.indexOf(e):-1;return t<0?I.NA:t+1},{errors:!0}),hw(`ISREF`,1,1,(e,t)=>{let n=e[0];if(!n)return!1;let r=t.calc.eval(n,t.frame);return r instanceof R||r instanceof pg});let mE=e=>e instanceof R?e.sheet.at(e.top,e.left):void 0;hw(`ISFORMULA`,1,1,(e,t)=>{let n=e[0];if(!n)return I.VALUE;let r=t.calc.eval(n,t.frame);return r instanceof mg?I.VALUE:mE(r)instanceof vC}),hw(`FORMULATEXT`,1,1,(e,t)=>{let n=e[0];if(!n)return I.VALUE;let r=mE(t.calc.eval(n,t.frame));return r instanceof vC?r.text:I.NA}),H(`CELL`,`v?r`,(e,t)=>{let n=B(t.calc.scalar(e[0],t.frame));if(n instanceof F)return n;let r=e[1],i=r instanceof R?r:new R(t.frame.sheet,t.frame.row,t.frame.col,t.frame.row,t.frame.col),a=()=>t.calc.read(i.sheet,i.top,i.left);switch(n.toLowerCase()){case`filename`:return`[${t.calc.wb.title??`sheet`}.xlsx]${i.sheet.name}`;case`row`:return i.top+1;case`col`:return i.left+1;case`address`:return m({row:i.top,col:i.left}).replace(/^([A-Z]+)(\d+)$/u,`$$$1$$$2`);case`contents`:return a();case`type`:{let e=a();return e===null?`b`:typeof e==`string`?`l`:`v`}default:return I.VALUE}}),H(`TABLE`,`?rrrrr`,()=>I.NA);var hE=/* @__PURE__ */ o(((e,t,n)=>{(function(n,r){typeof e==`object`?t.exports=r():typeof define==`function`&&define.amd?define(r):n.jStat=r()})(n,function(){var e=function(e,t){var n=Array.prototype.concat,r=Array.prototype.slice,i=Object.prototype.toString;function a(t,n){var r=t>n?t:n;return e.pow(10,17-~~(e.log(r>0?r:-r)*e.LOG10E))}var o=Array.isArray||function(e){return i.call(e)===`[object Array]`};function s(e){return i.call(e)===`[object Function]`}function c(e){return typeof e==`number`&&e-e===0}function l(e){return n.apply([],e)}function u(){return new u._init(arguments)}u.fn=u.prototype,u._init=function(e){if(o(e[0])){if(o(e[0][0])){s(e[1])&&(e[0]=u.map(e[0],e[1]));for(var t=0;t<e[0].length;t++)this[t]=e[0][t];this.length=e[0].length}else this[0]=s(e[1])?u.map(e[0],e[1]):e[0],this.length=1}else if(c(e[0]))this[0]=u.seq.apply(null,e),this.length=1;else if(e[0]instanceof u)return u(e[0].toArray());else this[0]=[],this.length=1;return this},u._init.prototype=u.prototype,u._init.constructor=u,u.utils={calcRdx:a,isArray:o,isFunction:s,isNumber:c,toVector:l},u._random_fn=e.random,u.setRandom=function(e){if(typeof e!=`function`)throw TypeError(`fn is not a function`);u._random_fn=e},u.extend=function(e){var t,n;if(arguments.length===1){for(n in e)u[n]=e[n];return this}for(t=1;t<arguments.length;t++)for(n in arguments[t])e[n]=arguments[t][n];return e},u.rows=function(e){return e.length||1},u.cols=function(e){return e[0].length||1},u.dimensions=function(e){return{rows:u.rows(e),cols:u.cols(e)}},u.row=function(e,t){return o(t)?t.map(function(t){return u.row(e,t)}):e[t]},u.rowa=function(e,t){return u.row(e,t)},u.col=function(e,t){if(o(t)){var n=u.arange(e.length).map(function(){return Array(t.length)});return t.forEach(function(t,r){u.arange(e.length).forEach(function(i){n[i][r]=e[i][t]})}),n}for(var r=Array(e.length),i=0;i<e.length;i++)r[i]=[e[i][t]];return r},u.cola=function(e,t){return u.col(e,t).map(function(e){return e[0]})},u.diag=function(e){for(var t=u.rows(e),n=Array(t),r=0;r<t;r++)n[r]=[e[r][r]];return n},u.antidiag=function(e){for(var t=u.rows(e)-1,n=Array(t),r=0;t>=0;t--,r++)n[r]=[e[r][t]];return n},u.transpose=function(e){var t=[],n,r,i,a,s;for(o(e[0])||(e=[e]),r=e.length,i=e[0].length,s=0;s<i;s++){for(n=Array(r),a=0;a<r;a++)n[a]=e[a][s];t.push(n)}return t.length===1?t[0]:t},u.map=function(e,t,n){var r,i,a,s,c;for(o(e[0])||(e=[e]),i=e.length,a=e[0].length,s=n?e:Array(i),r=0;r<i;r++)for(s[r]||(s[r]=Array(a)),c=0;c<a;c++)s[r][c]=t(e[r][c],r,c);return s.length===1?s[0]:s},u.cumreduce=function(e,t,n){var r,i,a,s,c;for(o(e[0])||(e=[e]),i=e.length,a=e[0].length,s=n?e:Array(i),r=0;r<i;r++)for(s[r]||(s[r]=Array(a)),a>0&&(s[r][0]=e[r][0]),c=1;c<a;c++)s[r][c]=t(s[r][c-1],e[r][c]);return s.length===1?s[0]:s},u.alter=function(e,t){return u.map(e,t,!0)},u.create=function(e,t,n){var r=Array(e),i,a;for(s(t)&&(n=t,t=e),i=0;i<e;i++)for(r[i]=Array(t),a=0;a<t;a++)r[i][a]=n(i,a);return r};function d(){return 0}u.zeros=function(e,t){return c(t)||(t=e),u.create(e,t,d)};function f(){return 1}u.ones=function(e,t){return c(t)||(t=e),u.create(e,t,f)},u.rand=function(e,t){return c(t)||(t=e),u.create(e,t,u._random_fn)};function p(e,t){return+(e===t)}u.identity=function(e,t){return c(t)||(t=e),u.create(e,t,p)},u.symmetric=function(e){var t=e.length,n,r;if(e.length!==e[0].length)return!1;for(n=0;n<t;n++)for(r=0;r<t;r++)if(e[r][n]!==e[n][r])return!1;return!0},u.clear=function(e){return u.alter(e,d)},u.seq=function(e,t,n,r){s(r)||(r=!1);for(var i=[],o=a(e,t),c=(t*o-e*o)/((n-1)*o),l=e,u=0;l<=t&&u<n;u++,l=(e*o+c*o*u)/o)i.push(r?r(l,u):l);return i},u.arange=function(e,n,r){var i=[],a;if(r||=1,n===t&&(n=e,e=0),e===n||r===0||e<n&&r<0||e>n&&r>0)return[];if(r>0)for(a=e;a<n;a+=r)i.push(a);else for(a=e;a>n;a+=r)i.push(a);return i},u.slice=function(){function e(e,n,r,i){var a,o=[],s=e.length;if(n===t&&r===t&&i===t)return u.copy(e);if(n||=0,r||=e.length,n=n>=0?n:s+n,r=r>=0?r:s+r,i||=1,n===r||i===0||n<r&&i<0||n>r&&i>0)return[];if(i>0)for(a=n;a<r;a+=i)o.push(e[a]);else for(a=n;a>r;a+=i)o.push(e[a]);return o}function n(t,n){var r,i;if(n||={},c(n.row)){if(c(n.col))return t[n.row][n.col];var a=u.rowa(t,n.row);return r=n.col||{},e(a,r.start,r.end,r.step)}if(c(n.col)){var o=u.cola(t,n.col);return i=n.row||{},e(o,i.start,i.end,i.step)}return i=n.row||{},r=n.col||{},e(t,i.start,i.end,i.step).map(function(t){return e(t,r.start,r.end,r.step)})}return n}(),u.sliceAssign=function(n,r,i){var a,o;if(c(r.row)){if(c(r.col))return n[r.row][r.col]=i;r.col=r.col||{},r.col.start=r.col.start||0,r.col.end=r.col.end||n[0].length,r.col.step=r.col.step||1,a=u.arange(r.col.start,e.min(n.length,r.col.end),r.col.step);var s=r.row;return a.forEach(function(e,t){n[s][e]=i[t]}),n}if(c(r.col)){r.row=r.row||{},r.row.start=r.row.start||0,r.row.end=r.row.end||n.length,r.row.step=r.row.step||1,o=u.arange(r.row.start,e.min(n[0].length,r.row.end),r.row.step);var l=r.col;return o.forEach(function(e,t){n[e][l]=i[t]}),n}return i[0].length===t&&(i=[i]),r.row.start=r.row.start||0,r.row.end=r.row.end||n.length,r.row.step=r.row.step||1,r.col.start=r.col.start||0,r.col.end=r.col.end||n[0].length,r.col.step=r.col.step||1,o=u.arange(r.row.start,e.min(n.length,r.row.end),r.row.step),a=u.arange(r.col.start,e.min(n[0].length,r.col.end),r.col.step),o.forEach(function(e,t){a.forEach(function(r,a){n[e][r]=i[t][a]})}),n},u.diagonal=function(e){var t=u.zeros(e.length,e.length);return e.forEach(function(e,n){t[n][n]=e}),t},u.copy=function(e){return e.map(function(e){return c(e)?e:e.map(function(e){return e})})};var m=u.prototype;return m.length=0,m.push=Array.prototype.push,m.sort=Array.prototype.sort,m.splice=Array.prototype.splice,m.slice=Array.prototype.slice,m.toArray=function(){return this.length>1?r.call(this):r.call(this)[0]},m.map=function(e,t){return u(u.map(this,e,t))},m.cumreduce=function(e,t){return u(u.cumreduce(this,e,t))},m.alter=function(e){return u.alter(this,e),this},(function(e){for(var t=0;t<e.length;t++)(function(e){m[e]=function(t){var n=this,r;return t?(setTimeout(function(){t.call(n,m[e].call(n))}),this):(r=u[e](this),o(r)?u(r):r)}})(e[t])})(`transpose clear symmetric rows cols dimensions diag antidiag`.split(` `)),(function(e){for(var t=0;t<e.length;t++)(function(e){m[e]=function(t,n){var r=this;return n?(setTimeout(function(){n.call(r,m[e].call(r,t))}),this):u(u[e](this,t))}})(e[t])})(`row col`.split(` `)),(function(e){for(var t=0;t<e.length;t++)(function(e){m[e]=function(){return u(u[e].apply(null,arguments))}})(e[t])})(`create zeros ones rand identity`.split(` `)),u}(Math);return(function(e,t){var n=e.utils.isFunction;function r(e,t){return e-t}function i(e,n,r){return t.max(n,t.min(e,r))}e.sum=function(e){for(var t=0,n=e.length;--n>=0;)t+=e[n];return t},e.sumsqrd=function(e){for(var t=0,n=e.length;--n>=0;)t+=e[n]*e[n];return t},e.sumsqerr=function(t){for(var n=e.mean(t),r=0,i=t.length,a;--i>=0;)a=t[i]-n,r+=a*a;return r},e.sumrow=function(e){for(var t=0,n=e.length;--n>=0;)t+=e[n];return t},e.product=function(e){for(var t=1,n=e.length;--n>=0;)t*=e[n];return t},e.min=function(e){for(var t=e[0],n=0;++n<e.length;)e[n]<t&&(t=e[n]);return t},e.max=function(e){for(var t=e[0],n=0;++n<e.length;)e[n]>t&&(t=e[n]);return t},e.unique=function(e){for(var t={},n=[],r=0;r<e.length;r++)t[e[r]]||(t[e[r]]=!0,n.push(e[r]));return n},e.mean=function(t){return e.sum(t)/t.length},e.meansqerr=function(t){return e.sumsqerr(t)/t.length},e.geomean=function(n){var r=n.map(t.log),i=e.mean(r);return t.exp(i)},e.median=function(e){var t=e.length,n=e.slice().sort(r);return t&1?n[t/2|0]:(n[t/2-1]+n[t/2])/2},e.cumsum=function(t){return e.cumreduce(t,function(e,t){return e+t})},e.cumprod=function(t){return e.cumreduce(t,function(e,t){return e*t})},e.diff=function(e){for(var t=[],n=e.length,r=1;r<n;r++)t.push(e[r]-e[r-1]);return t},e.rank=function(e){var t,n=[],i={};for(t=0;t<e.length;t++){var a=e[t];i[a]?i[a]++:(i[a]=1,n.push(a))}var o=n.sort(r),s={},c=1;for(t=0;t<o.length;t++){var a=o[t],l=i[a];s[a]=(c+(c+l-1))/2,c+=l}return e.map(function(e){return s[e]})},e.mode=function(e){for(var t=e.length,n=e.slice().sort(r),i=1,a=0,o=0,s=[],c=0;c<t;c++)n[c]===n[c+1]?i++:(i>a?(s=[n[c]],a=i,o=0):i===a&&(s.push(n[c]),o++),i=1);return o===0?s[0]:s},e.range=function(t){return e.max(t)-e.min(t)},e.variance=function(t,n){return e.sumsqerr(t)/(t.length-+!!n)},e.pooledvariance=function(t){return t.reduce(function(t,n){return t+e.sumsqerr(n)},0)/(t.reduce(function(e,t){return e+t.length},0)-t.length)},e.deviation=function(t){for(var n=e.mean(t),r=t.length,i=Array(r),a=0;a<r;a++)i[a]=t[a]-n;return i},e.stdev=function(n,r){return t.sqrt(e.variance(n,r))},e.pooledstdev=function(n){return t.sqrt(e.pooledvariance(n))},e.meandev=function(n){for(var r=e.mean(n),i=[],a=n.length-1;a>=0;a--)i.push(t.abs(n[a]-r));return e.mean(i)},e.meddev=function(n){for(var r=e.median(n),i=[],a=n.length-1;a>=0;a--)i.push(t.abs(n[a]-r));return e.median(i)},e.coeffvar=function(t){return e.stdev(t)/e.mean(t)},e.quartiles=function(e){var n=e.length,i=e.slice().sort(r);return[i[t.round(n/4)-1],i[t.round(n/2)-1],i[t.round(n*3/4)-1]]},e.quantiles=function(e,n,a,o){var s=e.slice().sort(r),c=[n.length],l=e.length,u,d,f,p,m,h;for(a===void 0&&(a=3/8),o===void 0&&(o=3/8),u=0;u<n.length;u++)d=n[u],f=a+d*(1-a-o),p=l*d+f,m=t.floor(i(p,1,l-1)),h=i(p-m,0,1),c[u]=(1-h)*s[m-1]+h*s[m];return c},e.percentile=function(e,t,n){var i=e.slice().sort(r),a=t*(i.length+(n?1:-1))+ +!n,o=parseInt(a),s=a-o;return o+1<i.length?i[o-1]+s*(i[o]-i[o-1]):i[o-1]},e.percentileOfScore=function(e,t,n){var r=0,i=e.length,a=!1,o,s;for(n===`strict`&&(a=!0),s=0;s<i;s++)o=e[s],(a&&o<t||!a&&o<=t)&&r++;return r/i},e.histogram=function(n,r){r||=4;for(var i=e.min(n),a=(e.max(n)-i)/r,o=n.length,s=[],c=0;c<r;c++)s[c]=0;for(c=0;c<o;c++)s[t.min(t.floor((n[c]-i)/a),r-1)]+=1;return s},e.covariance=function(t,n){for(var r=e.mean(t),i=e.mean(n),a=t.length,o=Array(a),s=0;s<a;s++)o[s]=(t[s]-r)*(n[s]-i);return e.sum(o)/(a-1)},e.corrcoeff=function(t,n){return e.covariance(t,n)/e.stdev(t,1)/e.stdev(n,1)},e.spearmancoeff=function(t,n){return t=e.rank(t),n=e.rank(n),e.corrcoeff(t,n)},e.stanMoment=function(n,r){for(var i=e.mean(n),a=e.stdev(n),o=n.length,s=0,c=0;c<o;c++)s+=t.pow((n[c]-i)/a,r);return s/n.length},e.skewness=function(t){return e.stanMoment(t,3)},e.kurtosis=function(t){return e.stanMoment(t,4)-3};var a=e.prototype;(function(t){for(var r=0;r<t.length;r++)(function(t){a[t]=function(r,i){var o=[],s=0,c=this;if(n(r)&&(i=r,r=!1),i)return setTimeout(function(){i.call(c,a[t].call(c,r))}),this;if(this.length>1){for(c=r===!0?this:this.transpose();s<c.length;s++)o[s]=e[t](c[s]);return o}return e[t](this[0],r)}})(t[r])})(`cumsum cumprod`.split(` `)),(function(t){for(var r=0;r<t.length;r++)(function(t){a[t]=function(r,i){var o=[],s=0,c=this;if(n(r)&&(i=r,r=!1),i)return setTimeout(function(){i.call(c,a[t].call(c,r))}),this;if(this.length>1){for(t!==`sumrow`&&(c=r===!0?this:this.transpose());s<c.length;s++)o[s]=e[t](c[s]);return r===!0?e[t](e.utils.toVector(o)):o}return e[t](this[0],r)}})(t[r])})(`sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis`.split(` `)),(function(t){for(var r=0;r<t.length;r++)(function(t){a[t]=function(){var r=[],i=0,o=this,s=Array.prototype.slice.call(arguments),c;if(n(s[s.length-1])){c=s[s.length-1];var l=s.slice(0,s.length-1);return setTimeout(function(){c.call(o,a[t].apply(o,l))}),this}c=void 0;var u=function(n){return e[t].apply(o,[n].concat(s))};if(this.length>1){for(o=o.transpose();i<o.length;i++)r[i]=u(o[i]);return r}return u(this[0])}})(t[r])})(`quantiles percentileOfScore`.split(` `))})(e,Math),(function(e,t){e.gammaln=function(e){var n=0,r=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],i=1.000000000190015,a,o,s=(o=a=e)+5.5;for(s-=(a+.5)*t.log(s);n<6;n++)i+=r[n]/++o;return t.log(2.5066282746310007*i/a)-s},e.loggam=function(e){var n,r,i,a,o,s,c,l=[.08333333333333333,-.002777777777777778,.0007936507936507937,-.0005952380952380952,.0008417508417508418,-.001917526917526918,.00641025641025641,-.02955065359477124,.1796443723688307,-1.3924322169059];if(n=e,c=0,e==1||e==2)return 0;for(e<=7&&(c=t.floor(7-e),n=e+c),r=1/(n*n),i=2*t.PI,o=l[9],s=8;s>=0;s--)o*=r,o+=l[s];if(a=o/n+.5*t.log(i)+(n-.5)*t.log(n)-n,e<=7)for(s=1;s<=c;s++)a-=t.log(n-1),--n;return a},e.gammafn=function(e){var n=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],r=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],i=!1,a=0,o=0,s=0,c=e,l,u,d,f;if(e>171.6243769536076)return 1/0;if(c<=0){if(f=c%1+36e-17,f)i=(c&1?-1:1)*t.PI/t.sin(t.PI*f),c=1-c;else return 1/0}for(d=c,u=c<1?c++:(c-=a=(c|0)-1)-1,l=0;l<8;++l)s=(s+n[l])*u,o=o*u+r[l];if(f=s/o+1,d<c)f/=d;else if(d>c)for(l=0;l<a;++l)f*=c,c++;return i&&(f=i/f),f},e.gammap=function(t,n){return e.lowRegGamma(t,n)*e.gammafn(t)},e.lowRegGamma=function(n,r){var i=e.gammaln(n),a=n,o=1/n,s=o,c=r+1-n,l=1/1e-30,u=1/c,d=u,f=1,p=-~(t.log(n>=1?n:1/n)*8.5+n*.4+17),m;if(r<0||n<=0)return NaN;if(r<n+1){for(;f<=p;f++)o+=s*=r/++a;return o*t.exp(-r+n*t.log(r)-i)}for(;f<=p;f++)m=-f*(f-n),c+=2,u=m*u+c,l=c+m/l,u=1/u,d*=u*l;return 1-d*t.exp(-r+n*t.log(r)-i)},e.factorialln=function(t){return t<0?NaN:e.gammaln(t+1)},e.factorial=function(t){return t<0?NaN:e.gammafn(t+1)},e.combination=function(n,r){return n>170||r>170?t.exp(e.combinationln(n,r)):e.factorial(n)/e.factorial(r)/e.factorial(n-r)},e.combinationln=function(t,n){return e.factorialln(t)-e.factorialln(n)-e.factorialln(t-n)},e.permutation=function(t,n){return e.factorial(t)/e.factorial(t-n)},e.betafn=function(n,r){if(!(n<=0||r<=0))return n+r>170?t.exp(e.betaln(n,r)):e.gammafn(n)*e.gammafn(r)/e.gammafn(n+r)},e.betaln=function(t,n){return e.gammaln(t)+e.gammaln(n)-e.gammaln(t+n)},e.betacf=function(e,n,r){var i=1e-30,a=1,o=n+r,s=n+1,c=n-1,l=1,u=1-o*e/s,d,f,p,m;for(t.abs(u)<i&&(u=i),u=1/u,m=u;a<=100&&(d=2*a,f=a*(r-a)*e/((c+d)*(n+d)),u=1+f*u,t.abs(u)<i&&(u=i),l=1+f/l,t.abs(l)<i&&(l=i),u=1/u,m*=u*l,f=-(n+a)*(o+a)*e/((n+d)*(s+d)),u=1+f*u,t.abs(u)<i&&(u=i),l=1+f/l,t.abs(l)<i&&(l=i),u=1/u,p=u*l,m*=p,!(t.abs(p-1)<3e-7));a++);return m},e.gammapinv=function(n,r){var i=0,a=r-1,o=1e-8,s=e.gammaln(r),c,l,u,d,f,p,m;if(n>=1)return t.max(100,r+100*t.sqrt(r));if(n<=0)return 0;for(r>1?(p=t.log(a),m=t.exp(a*(p-1)-s),f=n<.5?n:1-n,u=t.sqrt(-2*t.log(f)),c=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,n<.5&&(c=-c),c=t.max(.001,r*t.pow(1-1/(9*r)-c/(3*t.sqrt(r)),3))):(u=1-r*(.253+r*.12),c=n<u?t.pow(n/u,1/r):1-t.log(1-(n-u)/(1-u)));i<12;i++){if(c<=0)return 0;if(l=e.lowRegGamma(r,c)-n,u=r>1?m*t.exp(-(c-a)+a*(t.log(c)-p)):t.exp(-c+a*t.log(c)-s),d=l/u,c-=u=d/(1-.5*t.min(1,d*((r-1)/c-1))),c<=0&&(c=.5*(c+u)),t.abs(u)<o*c)break}return c},e.erf=function(e){var n=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-991364156e-18,-227365122e-18,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],r=n.length-1,i=!1,a=0,o=0,s,c,l,u;for(e<0&&(e=-e,i=!0),s=2/(2+e),c=4*s-2;r>0;r--)l=a,a=c*a-o+n[r],o=l;return u=s*t.exp(-e*e+.5*(n[0]+c*a)-o),i?u-1:1-u},e.erfc=function(t){return 1-e.erf(t)},e.erfcinv=function(n){var r=0,i,a,o,s;if(n>=2)return-100;if(n<=0)return 100;for(s=n<1?n:2-n,o=t.sqrt(-2*t.log(s/2)),i=-.70711*((2.30753+o*.27061)/(1+o*(.99229+o*.04481))-o);r<2;r++)a=e.erfc(i)-s,i+=a/(1.1283791670955126*t.exp(-i*i)-i*a);return n<1?i:-i},e.ibetainv=function(n,r,i){var a=1e-8,o=r-1,s=i-1,c=0,l,u,d,f,p,m,h,g,_,v,y;if(n<=0)return 0;if(n>=1)return 1;for(r>=1&&i>=1?(d=n<.5?n:1-n,f=t.sqrt(-2*t.log(d)),h=(2.30753+f*.27061)/(1+f*(.99229+f*.04481))-f,n<.5&&(h=-h),g=(h*h-3)/6,_=2/(1/(2*r-1)+1/(2*i-1)),v=h*t.sqrt(g+_)/_-(1/(2*i-1)-1/(2*r-1))*(g+5/6-2/(3*_)),h=r/(r+i*t.exp(2*v))):(l=t.log(r/(r+i)),u=t.log(i/(r+i)),f=t.exp(r*l)/r,p=t.exp(i*u)/i,v=f+p,h=n<f/v?t.pow(r*v*n,1/r):1-t.pow(i*v*(1-n),1/i)),y=-e.gammaln(r)-e.gammaln(i)+e.gammaln(r+i);c<10;c++){if(h===0||h===1)return h;if(m=e.ibeta(h,r,i)-n,f=t.exp(o*t.log(h)+s*t.log(1-h)+y),p=m/f,h-=f=p/(1-.5*t.min(1,p*(o/h-s/(1-h)))),h<=0&&(h=.5*(h+f)),h>=1&&(h=.5*(h+f+1)),t.abs(f)<a*h&&c>0)break}return h},e.ibeta=function(n,r,i){var a=n===0||n===1?0:t.exp(e.gammaln(r+i)-e.gammaln(r)-e.gammaln(i)+r*t.log(n)+i*t.log(1-n));return n<0||n>1?!1:n<(r+1)/(r+i+2)?a*e.betacf(n,r,i)/r:1-a*e.betacf(1-n,i,r)/i},e.randn=function(n,r){var i,a,o,s,c;if(r||=n,n)return e.create(n,r,function(){return e.randn()});do i=e._random_fn(),a=1.7156*(e._random_fn()-.5),o=i-.449871,s=t.abs(a)+.386595,c=o*o+s*(.196*s-.25472*o);while(c>.27597&&(c>.27846||a*a>-4*t.log(i)*i*i));return a/i},e.randg=function(n,r,i){var a=n,o,s,c,l,u,d;if(i||=r,n||=1,r)return d=e.zeros(r,i),d.alter(function(){return e.randg(n)}),d;n<1&&(n+=1),o=n-1/3,s=1/t.sqrt(9*o);do{do u=e.randn(),l=1+s*u;while(l<=0);l=l*l*l,c=e._random_fn()}while(c>1-.331*t.pow(u,4)&&t.log(c)>.5*u*u+o*(1-l+t.log(l)));if(n==a)return o*l;do c=e._random_fn();while(c===0);return t.pow(c,1/a)*o*l},(function(t){for(var n=0;n<t.length;n++)(function(t){e.fn[t]=function(){return e(e.map(this,function(n){return e[t](n)}))}})(t[n])})(`gammaln gammafn factorial factorialln`.split(` `)),(function(t){for(var n=0;n<t.length;n++)(function(t){e.fn[t]=function(){return e(e[t].apply(null,arguments))}})(t[n])})(`randn`.split(` `))})(e,Math),(function(e,t){(function(t){for(var n=0;n<t.length;n++)(function(t){e[t]=function e(t,n,r){return this instanceof e?(this._a=t,this._b=n,this._c=r,this):new e(t,n,r)},e.fn[t]=function(n,r,i){var a=e[t](n,r,i);return a.data=this,a},e[t].prototype.sample=function(n){var r=this._a,i=this._b,a=this._c;return n?e.alter(n,function(){return e[t].sample(r,i,a)}):e[t].sample(r,i,a)},(function(n){for(var r=0;r<n.length;r++)(function(n){e[t].prototype[n]=function(r){var i=this._a,a=this._b,o=this._c;return!r&&r!==0&&(r=this.data),typeof r==`number`?e[t][n](r,i,a,o):e.fn.map.call(r,function(r){return e[t][n](r,i,a,o)})}})(n[r])})(`pdf cdf inv`.split(` `)),(function(n){for(var r=0;r<n.length;r++)(function(n){e[t].prototype[n]=function(){return e[t][n](this._a,this._b,this._c)}})(n[r])})(`mean median mode variance`.split(` `))})(t[n])})(`beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine`.split(` `)),e.extend(e.beta,{pdf:function(n,r,i){return n>1||n<0?0:r==1&&i==1?1:r<512&&i<512?t.pow(n,r-1)*t.pow(1-n,i-1)/e.betafn(r,i):t.exp((r-1)*t.log(n)+(i-1)*t.log(1-n)-e.betaln(r,i))},cdf:function(t,n,r){return t>1||t<0?(t>1)*1:e.ibeta(t,n,r)},inv:function(t,n,r){return e.ibetainv(t,n,r)},mean:function(e,t){return e/(e+t)},median:function(t,n){return e.ibetainv(.5,t,n)},mode:function(e,t){return(e-1)/(e+t-2)},sample:function(t,n){var r=e.randg(t);return r/(r+e.randg(n))},variance:function(e,n){return e*n/(t.pow(e+n,2)*(e+n+1))}}),e.extend(e.centralF,{pdf:function(n,r,i){var a,o,s;return n<0?0:r<=2?n===0&&r<2?1/0:n===0&&r===2?1:1/e.betafn(r/2,i/2)*t.pow(r/i,r/2)*t.pow(n,r/2-1)*t.pow(1+r/i*n,-(r+i)/2):(a=r*n/(i+n*r),o=i/(i+n*r),s=r*o/2,s*e.binomial.pdf((r-2)/2,(r+i-2)/2,a))},cdf:function(t,n,r){return t<0?0:e.ibeta(n*t/(n*t+r),n/2,r/2)},inv:function(t,n,r){return r/(n*(1/e.ibetainv(t,n/2,r/2)-1))},mean:function(e,t){return t>2?t/(t-2):void 0},mode:function(e,t){return e>2?t*(e-2)/(e*(t+2)):void 0},sample:function(t,n){var r=e.randg(t/2)*2,i=e.randg(n/2)*2;return r/t/(i/n)},variance:function(e,t){if(!(t<=4))return 2*t*t*(e+t-2)/(e*(t-2)*(t-2)*(t-4))}}),e.extend(e.cauchy,{pdf:function(e,n,r){return r<0?0:r/(t.pow(e-n,2)+t.pow(r,2))/t.PI},cdf:function(e,n,r){return t.atan((e-n)/r)/t.PI+.5},inv:function(e,n,r){return n+r*t.tan(t.PI*(e-.5))},median:function(e){return e},mode:function(e){return e},sample:function(n,r){return e.randn()*t.sqrt(1/(2*e.randg(.5)))*r+n}}),e.extend(e.chisquare,{pdf:function(n,r){return n<0?0:n===0&&r===2?.5:t.exp((r/2-1)*t.log(n)-n/2-r/2*t.log(2)-e.gammaln(r/2))},cdf:function(t,n){return t<0?0:e.lowRegGamma(n/2,t/2)},inv:function(t,n){return 2*e.gammapinv(t,.5*n)},mean:function(e){return e},median:function(e){return e*t.pow(1-2/(9*e),3)},mode:function(e){return e-2>0?e-2:0},sample:function(t){return e.randg(t/2)*2},variance:function(e){return 2*e}}),e.extend(e.exponential,{pdf:function(e,n){return e<0?0:n*t.exp(-n*e)},cdf:function(e,n){return e<0?0:1-t.exp(-n*e)},inv:function(e,n){return-t.log(1-e)/n},mean:function(e){return 1/e},median:function(e){return 1/e*t.log(2)},mode:function(){return 0},sample:function(n){return-1/n*t.log(e._random_fn())},variance:function(e){return t.pow(e,-2)}}),e.extend(e.gamma,{pdf:function(n,r,i){return n<0?0:n===0&&r===1?1/i:t.exp((r-1)*t.log(n)-n/i-e.gammaln(r)-r*t.log(i))},cdf:function(t,n,r){return t<0?0:e.lowRegGamma(n,t/r)},inv:function(t,n,r){return e.gammapinv(t,n)*r},mean:function(e,t){return e*t},mode:function(e,t){if(e>1)return(e-1)*t},sample:function(t,n){return e.randg(t)*n},variance:function(e,t){return e*t*t}}),e.extend(e.invgamma,{pdf:function(n,r,i){return n<=0?0:t.exp(-(r+1)*t.log(n)-i/n-e.gammaln(r)+r*t.log(i))},cdf:function(t,n,r){return t<=0?0:1-e.lowRegGamma(n,r/t)},inv:function(t,n,r){return r/e.gammapinv(1-t,n)},mean:function(e,t){return e>1?t/(e-1):void 0},mode:function(e,t){return t/(e+1)},sample:function(t,n){return n/e.randg(t)},variance:function(e,t){if(!(e<=2))return t*t/((e-1)*(e-1)*(e-2))}}),e.extend(e.kumaraswamy,{pdf:function(e,n,r){return e===0&&n===1?r:e===1&&r===1?n:t.exp(t.log(n)+t.log(r)+(n-1)*t.log(e)+(r-1)*t.log(1-t.pow(e,n)))},cdf:function(e,n,r){return e<0?0:e>1?1:1-t.pow(1-t.pow(e,n),r)},inv:function(e,n,r){return t.pow(1-t.pow(1-e,1/r),1/n)},mean:function(t,n){return n*e.gammafn(1+1/t)*e.gammafn(n)/e.gammafn(1+1/t+n)},median:function(e,n){return t.pow(1-t.pow(2,-1/n),1/e)},mode:function(e,n){if(e>=1&&n>=1&&e!==1&&n!==1)return t.pow((e-1)/(e*n-1),1/e)},variance:function(){throw Error(`variance not yet implemented`)}}),e.extend(e.lognormal,{pdf:function(e,n,r){return e<=0?0:t.exp(-t.log(e)-.5*t.log(2*t.PI)-t.log(r)-t.pow(t.log(e)-n,2)/(2*r*r))},cdf:function(n,r,i){return n<0?0:.5+.5*e.erf((t.log(n)-r)/t.sqrt(2*i*i))},inv:function(n,r,i){return t.exp(-1.4142135623730951*i*e.erfcinv(2*n)+r)},mean:function(e,n){return t.exp(e+n*n/2)},median:function(e){return t.exp(e)},mode:function(e,n){return t.exp(e-n*n)},sample:function(n,r){return t.exp(e.randn()*r+n)},variance:function(e,n){return(t.exp(n*n)-1)*t.exp(2*e+n*n)}}),e.extend(e.noncentralt,{pdf:function(n,r,i){var a=1e-14;return t.abs(i)<a?e.studentt.pdf(n,r):t.abs(n)<a?t.exp(e.gammaln((r+1)/2)-i*i/2-.5*t.log(t.PI*r)-e.gammaln(r/2)):r/n*(e.noncentralt.cdf(n*t.sqrt(1+2/r),r+2,i)-e.noncentralt.cdf(n,r,i))},cdf:function(n,r,i){var a=1e-14,o=200;if(t.abs(i)<a)return e.studentt.cdf(n,r);var s=!1;n<0&&(s=!0,i=-i);for(var c=e.normal.cdf(-i,0,1),l=a+1,u=l,d=n*n/(n*n+r),f=0,p=t.exp(-i*i/2),m=t.exp(-i*i/2-.5*t.log(2)-e.gammaln(3/2))*i;f<o||u>a||l>a;)u=l,f>0&&(p*=i*i/(2*f),m*=i*i/(2*(f+1/2))),l=p*e.beta.cdf(d,f+.5,r/2)+m*e.beta.cdf(d,f+1,r/2),c+=.5*l,f++;return s?1-c:c}}),e.extend(e.normal,{pdf:function(e,n,r){return t.exp(-.5*t.log(2*t.PI)-t.log(r)-t.pow(e-n,2)/(2*r*r))},cdf:function(n,r,i){return .5*(1+e.erf((n-r)/t.sqrt(2*i*i)))},inv:function(t,n,r){return-1.4142135623730951*r*e.erfcinv(2*t)+n},mean:function(e){return e},median:function(e){return e},mode:function(e){return e},sample:function(t,n){return e.randn()*n+t},variance:function(e,t){return t*t}}),e.extend(e.pareto,{pdf:function(e,n,r){return e<n?0:r*t.pow(n,r)/t.pow(e,r+1)},cdf:function(e,n,r){return e<n?0:1-t.pow(n/e,r)},inv:function(e,n,r){return n/t.pow(1-e,1/r)},mean:function(e,n){if(!(n<=1))return n*t.pow(e,n)/(n-1)},median:function(e,n){return e*(n*t.SQRT2)},mode:function(e){return e},variance:function(e,n){if(!(n<=2))return e*e*n/(t.pow(n-1,2)*(n-2))}}),e.extend(e.studentt,{pdf:function(n,r){return r=r>1e100?1e100:r,1/(t.sqrt(r)*e.betafn(.5,r/2))*t.pow(1+n*n/r,-((r+1)/2))},cdf:function(n,r){var i=r/2;return e.ibeta((n+t.sqrt(n*n+r))/(2*t.sqrt(n*n+r)),i,i)},inv:function(n,r){var i=e.ibetainv(2*t.min(n,1-n),.5*r,.5);return i=t.sqrt(r*(1-i)/i),n>.5?i:-i},mean:function(e){return e>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(n){return e.randn()*t.sqrt(n/(2*e.randg(n/2)))},variance:function(e){return e>2?e/(e-2):e>1?1/0:void 0}}),e.extend(e.weibull,{pdf:function(e,n,r){return e<0||n<0||r<0?0:r/n*t.pow(e/n,r-1)*t.exp(-t.pow(e/n,r))},cdf:function(e,n,r){return e<0?0:1-t.exp(-t.pow(e/n,r))},inv:function(e,n,r){return n*t.pow(-t.log(1-e),1/r)},mean:function(t,n){return t*e.gammafn(1+1/n)},median:function(e,n){return e*t.pow(t.log(2),1/n)},mode:function(e,n){return n<=1?0:e*t.pow((n-1)/n,1/n)},sample:function(n,r){return n*t.pow(-t.log(e._random_fn()),1/r)},variance:function(n,r){return n*n*e.gammafn(1+2/r)-t.pow(e.weibull.mean(n,r),2)}}),e.extend(e.uniform,{pdf:function(e,t,n){return e<t||e>n?0:1/(n-t)},cdf:function(e,t,n){return e<t?0:e<n?(e-t)/(n-t):1},inv:function(e,t,n){return t+e*(n-t)},mean:function(e,t){return .5*(e+t)},median:function(t,n){return e.mean(t,n)},mode:function(){throw Error(`mode is not yet implemented`)},sample:function(t,n){return t/2+n/2+(n/2-t/2)*(2*e._random_fn()-1)},variance:function(e,n){return t.pow(n-e,2)/12}});function n(e,n,r,i){for(var a=0,o=1,s=1,c=1,l=0,u=0,d;t.abs((s-u)/s)>i;)u=s,d=-(n+l)*(n+r+l)*e/(n+2*l)/(n+2*l+1),a=s+d*a,o=c+d*o,l+=1,d=l*(r-l)*e/(n+2*l-1)/(n+2*l),s=a+d*s,c=o+d*c,a/=c,o/=c,s/=c,c=1;return s/n}e.extend(e.binomial,{pdf:function(n,r,i){return i===0||i===1?+(r*i===n):e.combination(r,n)*t.pow(i,n)*t.pow(1-i,r-n)},cdf:function(r,i,a){var o,s=1e-10;if(r<0)return 0;if(r>=i)return 1;if(a<0||a>1||i<=0)return NaN;r=t.floor(r);var c=a,l=r+1,u=i-r,d=l+u,f=t.exp(e.gammaln(d)-e.gammaln(u)-e.gammaln(l)+l*t.log(c)+u*t.log(1-c));return o=c<(l+1)/(d+2)?f*n(c,l,u,s):1-f*n(1-c,u,l,s),t.round((1-o)*(1/s))/(1/s)}}),e.extend(e.negbin,{pdf:function(n,r,i){return n===n>>>0?n<0?0:e.combination(n+r-1,r-1)*t.pow(1-i,n)*t.pow(i,r):!1},cdf:function(t,n,r){var i=0,a=0;if(t<0)return 0;for(;a<=t;a++)i+=e.negbin.pdf(a,n,r);return i}}),e.extend(e.hypgeom,{pdf:function(n,r,i,a){if(n!==n|0)return!1;if(n<0||n<i-(r-a)||n>a||n>i)return 0;if(i*2>r)return a*2>r?e.hypgeom.pdf(r-i-a+n,r,r-i,r-a):e.hypgeom.pdf(a-n,r,r-i,a);if(a*2>r)return e.hypgeom.pdf(i-n,r,i,r-a);if(i<a)return e.hypgeom.pdf(n,r,a,i);for(var o=1,s=0,c=0;c<n;c++){for(;o>1&&s<a;)o*=1-i/(r-s),s++;o*=(a-c)*(i-c)/((c+1)*(r-i-a+c+1))}for(;s<a;s++)o*=1-i/(r-s);return t.min(1,t.max(0,o))},cdf:function(n,r,i,a){if(n<0||n<i-(r-a))return 0;if(n>=a||n>=i)return 1;if(i*2>r)return a*2>r?e.hypgeom.cdf(r-i-a+n,r,r-i,r-a):1-e.hypgeom.cdf(a-n-1,r,r-i,a);if(a*2>r)return 1-e.hypgeom.cdf(i-n-1,r,i,r-a);if(i<a)return e.hypgeom.cdf(n,r,a,i);for(var o=1,s=1,c=0,l=0;l<n;l++){for(;o>1&&c<a;){var u=1-i/(r-c);s*=u,o*=u,c++}s*=(a-l)*(i-l)/((l+1)*(r-i-a+l+1)),o+=s}for(;c<a;c++)o*=1-i/(r-c);return t.min(1,t.max(0,o))}}),e.extend(e.poisson,{pdf:function(n,r){return r<0||n%1!=0||n<0?0:t.pow(r,n)*t.exp(-r)/e.factorial(n)},cdf:function(t,n){var r=[],i=0;if(t<0)return 0;for(;i<=t;i++)r.push(e.poisson.pdf(i,n));return e.sum(r)},mean:function(e){return e},variance:function(e){return e},sampleSmall:function(n){var r=1,i=0,a=t.exp(-n);do i++,r*=e._random_fn();while(r>a);return i-1},sampleLarge:function(n){var r=n,i,a,o,s=t.sqrt(r),c=t.log(r),l,u=.931+2.53*s,d,f,p;for(l=-.059+.02483*u,d=1.1239+1.1328/(u-3.4),f=.9277-3.6224/(u-2);;)if(a=t.random()-.5,o=t.random(),p=.5-t.abs(a),i=t.floor((2*l/p+u)*a+r+.43),p>=.07&&o<=f||!(i<0||p<.013&&o>p)&&t.log(o)+t.log(d)-t.log(l/(p*p)+u)<=-r+i*c-e.loggam(i+1))return i},sample:function(e){return e<10?this.sampleSmall(e):this.sampleLarge(e)}}),e.extend(e.triangular,{pdf:function(e,t,n,r){return n<=t||r<t||r>n?NaN:e<t||e>n?0:e<r?2*(e-t)/((n-t)*(r-t)):e===r?2/(n-t):2*(n-e)/((n-t)*(n-r))},cdf:function(e,n,r,i){return r<=n||i<n||i>r?NaN:e<=n?0:e>=r?1:e<=i?t.pow(e-n,2)/((r-n)*(i-n)):1-t.pow(r-e,2)/((r-n)*(r-i))},inv:function(e,n,r,i){return r<=n||i<n||i>r?NaN:e<=(i-n)/(r-n)?n+(r-n)*t.sqrt(e*((i-n)/(r-n))):n+(r-n)*(1-t.sqrt((1-e)*(1-(i-n)/(r-n))))},mean:function(e,t,n){return(e+t+n)/3},median:function(e,n,r){if(r<=(e+n)/2)return n-t.sqrt((n-e)*(n-r))/t.sqrt(2);if(r>(e+n)/2)return e+t.sqrt((n-e)*(r-e))/t.sqrt(2)},mode:function(e,t,n){return n},sample:function(n,r,i){var a=e._random_fn();return a<(i-n)/(r-n)?n+t.sqrt(a*(r-n)*(i-n)):r-t.sqrt((1-a)*(r-n)*(r-i))},variance:function(e,t,n){return(e*e+t*t+n*n-e*t-e*n-t*n)/18}}),e.extend(e.arcsine,{pdf:function(e,n,r){return r<=n?NaN:e<=n||e>=r?0:2/t.PI*t.pow(t.pow(r-n,2)-t.pow(2*e-n-r,2),-.5)},cdf:function(e,n,r){return e<n?0:e<r?2/t.PI*t.asin(t.sqrt((e-n)/(r-n))):1},inv:function(e,n,r){return n+(.5-.5*t.cos(t.PI*e))*(r-n)},mean:function(e,t){return t<=e?NaN:(e+t)/2},median:function(e,t){return t<=e?NaN:(e+t)/2},mode:function(){throw Error(`mode is not yet implemented`)},sample:function(n,r){return(n+r)/2+(r-n)/2*t.sin(2*t.PI*e.uniform.sample(0,1))},variance:function(e,n){return n<=e?NaN:t.pow(n-e,2)/8}});function r(e){return e/t.abs(e)}e.extend(e.laplace,{pdf:function(e,n,r){return r<=0?0:t.exp(-t.abs(e-n)/r)/(2*r)},cdf:function(e,n,r){return r<=0?0:e<n?.5*t.exp((e-n)/r):1-.5*t.exp(-(e-n)/r)},mean:function(e){return e},median:function(e){return e},mode:function(e){return e},variance:function(e,t){return 2*t*t},sample:function(n,i){var a=e._random_fn()-.5;return n-i*r(a)*t.log(1-2*t.abs(a))}});function i(n,r,i){var a=12,o=6,s=-30,c=-50,l=60,u=8,d=3,f=2,p=3,m=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],h=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],g=n*.5;if(g>=u)return 1;var _=2*e.normal.cdf(g,0,1,1,0)-1;_=_>=t.exp(c/i)?t.pow(_,i):0;for(var v=n>d?f:p,y=g,b=(u-g)/v,x=y+b,ee=0,te=i-1,S=1;S<=v;S++){for(var ne=0,re=.5*(x+y),C=.5*(x-y),ie=1;ie<=a;ie++){var ae,oe;o<ie?(ae=a-ie+1,oe=m[ae-1]):(ae=ie,oe=-m[ae-1]);var se=re+C*oe,ce=se*se;if(ce>l)break;var le=2*e.normal.cdf(se,0,1,1,0),ue=2*e.normal.cdf(se,n,1,1,0),de=le*.5-ue*.5;de>=t.exp(s/te)&&(de=h[ae-1]*t.exp(-(.5*ce))*t.pow(de,te),ne+=de)}ne*=2*C*i/t.sqrt(2*t.PI),ee+=ne,y=x,x+=b}return _+=ee,_<=t.exp(s/r)?0:(_=t.pow(_,r),_>=1?1:_)}function a(e,n,r){var i=.322232421088,a=.099348462606,o=-1,s=.588581570495,c=-.342242088547,l=.531103462366,u=-.204231210125,d=.10353775285,f=-453642210148e-16,p=.0038560700634,m=.8832,h=.2368,g=1.214,_=1.208,v=1.4142,y=120,b=.5-.5*e,x=t.sqrt(t.log(1/(b*b))),ee=x+((((x*f+u)*x+c)*x+o)*x+i)/((((x*p+d)*x+l)*x+s)*x+a);r<y&&(ee+=(ee*ee*ee+ee)/r/4);var te=m-h*ee;return r<y&&(te+=-g/r+_*ee/r),ee*(te*t.log(n-1)+v)}e.extend(e.tukey,{cdf:function(n,r,a){var o=1,s=r,c=16,l=8,u=-30,d=1e-14,f=100,p=800,m=5e3,h=25e3,g=1,_=.5,v=.25,y=.125,b=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],x=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(n<=0)return 0;if(a<2||o<1||s<2)return NaN;if(!Number.isFinite(n))return 1;if(a>h)return i(n,o,s);var ee=a*.5,te=ee*t.log(a)-a*t.log(2)-e.gammaln(ee),S=ee-1,ne=a*.25,re=a<=f?g:a<=p?_:a<=m?v:y;te+=t.log(re);for(var C=0,ie=1;ie<=50;ie++){for(var ae=0,oe=(2*ie-1)*re,se=1;se<=c;se++){var ce,le;l<se?(ce=se-l-1,le=te+S*t.log(oe+b[ce]*re)-(b[ce]*re+oe)*ne):(ce=se-1,le=te+S*t.log(oe-b[ce]*re)+(b[ce]*re-oe)*ne);var ue;if(le>=u){ue=l<se?n*t.sqrt((b[ce]*re+oe)*.5):n*t.sqrt((-(b[ce]*re)+oe)*.5);var de=i(ue,o,s)*x[ce]*t.exp(le);ae+=de}}if(ie*re>=1&&ae<=d)break;C+=ae}if(ae>d)throw Error(`tukey.cdf failed to converge`);return C>1&&(C=1),C},inv:function(n,r,i){var o=1,s=r,c=1e-4,l=50;if(i<2||o<1||s<2||n<0||n>1)return NaN;if(n===0)return 0;if(n===1)return 1/0;for(var u=a(n,s,i),d=e.tukey.cdf(u,r,i)-n,f=d>0?t.max(0,u-1):u+1,p=e.tukey.cdf(f,r,i)-n,m,h=1;h<l;h++)if(m=f-p*(f-u)/(p-d),d=p,u=f,m<0&&(m=0,p=-n),p=e.tukey.cdf(m,r,i)-n,f=m,t.abs(f-u)<c)return m;throw Error(`tukey.inv failed to converge`)}})})(e,Math),(function(e,t){var n=Array.prototype.push,r=e.utils.isArray;function i(t){return r(t)||t instanceof e}e.extend({add:function(t,n){return i(n)?(i(n[0])||(n=[n]),e.map(t,function(e,t,r){return e+n[t][r]})):e.map(t,function(e){return e+n})},subtract:function(t,n){return i(n)?(i(n[0])||(n=[n]),e.map(t,function(e,t,r){return e-n[t][r]||0})):e.map(t,function(e){return e-n})},divide:function(t,n){return i(n)?(i(n[0])||(n=[n]),e.multiply(t,e.inv(n))):e.map(t,function(e){return e/n})},multiply:function(t,n){var r,a,o,s,c,l,u,d;if(t.length===void 0&&n.length===void 0)return t*n;if(c=t.length,l=t[0].length,u=e.zeros(c,o=i(n)?n[0].length:l),d=0,i(n)){for(;d<o;d++)for(r=0;r<c;r++){for(s=0,a=0;a<l;a++)s+=t[r][a]*n[a][d];u[r][d]=s}return c===1&&d===1?u[0][0]:u}return e.map(t,function(e){return e*n})},outer:function(t,n){return e.multiply(t.map(function(e){return[e]}),[n])},dot:function(t,n){i(t[0])||(t=[t]),i(n[0])||(n=[n]);for(var r=t[0].length===1&&t.length!==1?e.transpose(t):t,a=n[0].length===1&&n.length!==1?e.transpose(n):n,o=[],s=0,c=r.length,l=r[0].length,u,d;s<c;s++){for(o[s]=[],u=0,d=0;d<l;d++)u+=r[s][d]*a[s][d];o[s]=u}return o.length===1?o[0]:o},pow:function(n,r){return e.map(n,function(e){return t.pow(e,r)})},exp:function(n){return e.map(n,function(e){return t.exp(e)})},log:function(n){return e.map(n,function(e){return t.log(e)})},abs:function(n){return e.map(n,function(e){return t.abs(e)})},norm:function(e,n){var r=0,a=0;for(isNaN(n)&&(n=2),i(e[0])&&(e=e[0]);a<e.length;a++)r+=t.pow(t.abs(e[a]),n);return t.pow(r,1/n)},angle:function(n,r){return t.acos(e.dot(n,r)/(e.norm(n)*e.norm(r)))},aug:function(e,t){for(var r=[],i=0;i<e.length;i++)r.push(e[i].slice());for(i=0;i<r.length;i++)n.apply(r[i],t[i]);return r},inv:function(t){for(var n=t.length,r=t[0].length,i=e.identity(n,r),a=e.gauss_jordan(t,i),o=[],s=0,c;s<n;s++)for(o[s]=[],c=r;c<a[0].length;c++)o[s][c-r]=a[s][c];return o},det:function e(t){if(t.length===2)return t[0][0]*t[1][1]-t[0][1]*t[1][0];for(var n=0,r=0;r<t.length;r++){for(var i=[],a=1;a<t.length;a++){i[a-1]=[];for(var o=0;o<t.length;o++)o<r?i[a-1][o]=t[a][o]:o>r&&(i[a-1][o-1]=t[a][o])}var s=r%2?-1:1;n+=e(i)*t[0][r]*s}return n},gauss_elimination:function(n,r){var i=0,a=0,o=n.length,s=n[0].length,c=1,l=0,u=[],d,f,p,m;for(n=e.aug(n,r),d=n[0].length,i=0;i<o;i++){for(f=n[i][i],a=i,m=i+1;m<s;m++)f<t.abs(n[m][i])&&(f=n[m][i],a=m);if(a!=i)for(m=0;m<d;m++)p=n[i][m],n[i][m]=n[a][m],n[a][m]=p;for(a=i+1;a<o;a++)for(c=n[a][i]/n[i][i],m=i;m<d;m++)n[a][m]=n[a][m]-c*n[i][m]}for(i=o-1;i>=0;i--){for(l=0,a=i+1;a<=o-1;a++)l+=u[a]*n[i][a];u[i]=(n[i][d-1]-l)/n[i][i]}return u},gauss_jordan:function(n,r){for(var i=e.aug(n,r),a=i.length,o=i[0].length,s=0,c,l=0,u;l<a;l++){var d=l;for(u=l+1;u<a;u++)t.abs(i[u][l])>t.abs(i[d][l])&&(d=u);var f=i[l];for(i[l]=i[d],i[d]=f,u=l+1;u<a;u++)for(s=i[u][l]/i[l][l],c=l;c<o;c++)i[u][c]-=i[l][c]*s}for(l=a-1;l>=0;l--){for(s=i[l][l],u=0;u<l;u++)for(c=o-1;c>l-1;c--)i[u][c]-=i[l][c]*i[u][l]/s;for(i[l][l]/=s,c=a;c<o;c++)i[l][c]/=s}return i},triaUpSolve:function(t,n){var r=t[0].length,i=e.zeros(1,r)[0],a,o=!1;return n[0].length!=null&&(n=n.map(function(e){return e[0]}),o=!0),e.arange(r-1,-1,-1).forEach(function(o){a=e.arange(o+1,r).map(function(e){return i[e]*t[o][e]}),i[o]=(n[o]-e.sum(a))/t[o][o]}),o?i.map(function(e){return[e]}):i},triaLowSolve:function(t,n){var r=t[0].length,i=e.zeros(1,r)[0],a,o=!1;return n[0].length!=null&&(n=n.map(function(e){return e[0]}),o=!0),e.arange(r).forEach(function(r){a=e.arange(r).map(function(e){return t[r][e]*i[e]}),i[r]=(n[r]-e.sum(a))/t[r][r]}),o?i.map(function(e){return[e]}):i},lu:function(t){var n=t.length,r=e.identity(n),i=e.zeros(t.length,t[0].length),a;return e.arange(n).forEach(function(e){i[0][e]=t[0][e]}),e.arange(1,n).forEach(function(o){e.arange(o).forEach(function(n){a=e.arange(n).map(function(e){return r[o][e]*i[e][n]}),r[o][n]=(t[o][n]-e.sum(a))/i[n][n]}),e.arange(o,n).forEach(function(n){a=e.arange(o).map(function(e){return r[o][e]*i[e][n]}),i[o][n]=t[a.length][n]-e.sum(a)})}),[r,i]},cholesky:function(n){var r=n.length,i=e.zeros(n.length,n[0].length),a;return e.arange(r).forEach(function(o){a=e.arange(o).map(function(e){return t.pow(i[o][e],2)}),i[o][o]=t.sqrt(n[o][o]-e.sum(a)),e.arange(o+1,r).forEach(function(t){a=e.arange(o).map(function(e){return i[o][e]*i[t][e]}),i[t][o]=(n[o][t]-e.sum(a))/i[o][o]})}),i},gauss_jacobi:function(n,r,i,a){for(var o=0,s=0,c=n.length,l=[],u=[],d=[],f,p,m,h;o<c;o++)for(l[o]=[],u[o]=[],d[o]=[],s=0;s<c;s++)o>s?(l[o][s]=n[o][s],u[o][s]=d[o][s]=0):o<s?(u[o][s]=n[o][s],l[o][s]=d[o][s]=0):(d[o][s]=n[o][s],l[o][s]=u[o][s]=0);for(m=e.multiply(e.multiply(e.inv(d),e.add(l,u)),-1),p=e.multiply(e.inv(d),r),f=i,h=e.add(e.multiply(m,i),p),o=2;t.abs(e.norm(e.subtract(h,f)))>a;)f=h,h=e.add(e.multiply(m,f),p),o++;return h},gauss_seidel:function(n,r,i,a){for(var o=0,s=n.length,c=[],l=[],u=[],d,f,p,m,h;o<s;o++)for(c[o]=[],l[o]=[],u[o]=[],d=0;d<s;d++)o>d?(c[o][d]=n[o][d],l[o][d]=u[o][d]=0):o<d?(l[o][d]=n[o][d],c[o][d]=u[o][d]=0):(u[o][d]=n[o][d],c[o][d]=l[o][d]=0);for(m=e.multiply(e.multiply(e.inv(e.add(u,c)),l),-1),p=e.multiply(e.inv(e.add(u,c)),r),f=i,h=e.add(e.multiply(m,i),p),o=2;t.abs(e.norm(e.subtract(h,f)))>a;)f=h,h=e.add(e.multiply(m,f),p),o+=1;return h},SOR:function(n,r,i,a,o){for(var s=0,c=n.length,l=[],u=[],d=[],f,p,m,h,g;s<c;s++)for(l[s]=[],u[s]=[],d[s]=[],f=0;f<c;f++)s>f?(l[s][f]=n[s][f],u[s][f]=d[s][f]=0):s<f?(u[s][f]=n[s][f],l[s][f]=d[s][f]=0):(d[s][f]=n[s][f],l[s][f]=u[s][f]=0);for(h=e.multiply(e.inv(e.add(d,e.multiply(l,o))),e.subtract(e.multiply(d,1-o),e.multiply(u,o))),m=e.multiply(e.multiply(e.inv(e.add(d,e.multiply(l,o))),r),o),p=i,g=e.add(e.multiply(h,i),m),s=2;t.abs(e.norm(e.subtract(g,p)))>a;)p=g,g=e.add(e.multiply(h,p),m),s++;return g},householder:function(n){for(var r=n.length,i=n[0].length,a=0,o=[],s=[],c,l,u,d,f;a<r-1;a++){for(c=0,d=a+1;d<i;d++)c+=n[d][a]*n[d][a];for(f=n[a+1][a]>0?-1:1,c=f*t.sqrt(c),l=t.sqrt((c*c-n[a+1][a]*c)/2),o=e.zeros(r,1),o[a+1][0]=(n[a+1][a]-c)/(2*l),u=a+2;u<r;u++)o[u][0]=n[u][a]/(2*l);s=e.subtract(e.identity(r,i),e.multiply(e.multiply(o,e.transpose(o)),2)),n=e.multiply(s,e.multiply(n,s))}return n},QR:function(){var n=e.sum,r=e.arange;function i(i){var a=i.length,o=i[0].length,s=e.zeros(o,o);i=e.copy(i);for(var c,l=0,u;l<o;l++){for(s[l][l]=t.sqrt(n(r(a).map(function(e){return i[e][l]*i[e][l]}))),c=0;c<a;c++)i[c][l]=i[c][l]/s[l][l];for(u=l+1;u<o;u++)for(s[l][u]=n(r(a).map(function(e){return i[e][l]*i[e][u]})),c=0;c<a;c++)i[c][u]=i[c][u]-i[c][l]*s[l][u]}return[i,s]}return i}(),lstsq:function(){function t(t){t=e.copy(t);var n=t.length,r=e.identity(n);return e.arange(n-1,-1,-1).forEach(function(n){e.sliceAssign(r,{row:n},e.divide(e.slice(r,{row:n}),t[n][n])),e.sliceAssign(t,{row:n},e.divide(e.slice(t,{row:n}),t[n][n])),e.arange(n).forEach(function(i){var a=e.multiply(t[i][n],-1),o=e.slice(t,{row:i}),s=e.multiply(e.slice(t,{row:n}),a);e.sliceAssign(t,{row:i},e.add(o,s));var c=e.slice(r,{row:i}),l=e.multiply(e.slice(r,{row:n}),a);e.sliceAssign(r,{row:i},e.add(c,l))})}),r}function n(n,r){var i=!1;r[0].length===void 0&&(r=r.map(function(e){return[e]}),i=!0);var a=e.QR(n),o=a[0],s=a[1],c=n[0].length,l=e.slice(o,{col:{end:c}}),u=t(e.slice(s,{row:{end:c}})),d=e.transpose(l);d[0].length===void 0&&(d=[d]);var f=e.multiply(e.multiply(u,d),r);return f.length===void 0&&(f=[[f]]),i?f.map(function(e){return e[0]}):f}return n}(),jacobi:function(n){for(var r=1,i=n.length,a=e.identity(i,i),o=[],s,c,l,u,d,f,p,m;r===1;){for(f=n[0][1],u=0,d=1,c=0;c<i;c++)for(l=0;l<i;l++)c!=l&&f<t.abs(n[c][l])&&(f=t.abs(n[c][l]),u=c,d=l);for(p=n[u][u]===n[d][d]?n[u][d]>0?t.PI/4:-t.PI/4:t.atan(2*n[u][d]/(n[u][u]-n[d][d]))/2,m=e.identity(i,i),m[u][u]=t.cos(p),m[u][d]=-t.sin(p),m[d][u]=t.sin(p),m[d][d]=t.cos(p),a=e.multiply(a,m),s=e.multiply(e.multiply(e.inv(m),n),m),n=s,r=0,c=1;c<i;c++)for(l=1;l<i;l++)c!=l&&t.abs(n[c][l])>.001&&(r=1)}for(c=0;c<i;c++)o.push(n[c][c]);return[a,o]},rungekutta:function(e,t,n,r,i,a){var o,s,c,l,u;if(a===2)for(;r<=n;)o=t*e(r,i),s=t*e(r+t,i+o),c=i+(o+s)/2,i=c,r+=t;if(a===4)for(;r<=n;)o=t*e(r,i),s=t*e(r+t/2,i+o/2),l=t*e(r+t/2,i+s/2),u=t*e(r+t,i+l),c=i+(o+2*s+2*l+u)/6,i=c,r+=t;return i},romberg:function(e,n,r,i){for(var a=0,o=(r-n)/2,s=[],c=[],l=[],u,d,f,p,m;a<i/2;){for(m=e(n),f=n,p=0;f<=r;f+=o,p++)s[p]=f;for(u=s.length,f=1;f<u-1;f++)m+=(f%2==0?2:4)*e(s[f]);m=o/3*(m+e(r)),l[a]=m,o/=2,a++}for(d=l.length,u=1;d!==1;){for(f=0;f<d-1;f++)c[f]=(t.pow(4,u)*l[f+1]-l[f])/(t.pow(4,u)-1);d=c.length,l=c,c=[],u++}return l},richardson:function(e,n,r,i){function a(e,t){for(var n=0,r=e.length,i;n<r;n++)e[n]===t&&(i=n);return i}for(var o=t.abs(r-e[a(e,r)+1]),s=0,c=[],l=[],u,d,f,p,m;i>=o;)u=a(e,r+i),d=a(e,r),c[s]=(n[u]-2*n[d]+n[2*d-u])/(i*i),i/=2,s++;for(p=c.length,f=1;p!=1;){for(m=0;m<p-1;m++)l[m]=(t.pow(4,f)*c[m+1]-c[m])/(t.pow(4,f)-1);p=l.length,c=l,l=[],f++}return c},simpson:function(e,t,n,r){for(var i=(n-t)/r,a=e(t),o=[],s=t,c=0,l=1,u;s<=n;s+=i,c++)o[c]=s;for(u=o.length;l<u-1;l++)a+=(l%2==0?2:4)*e(o[l]);return i/3*(a+e(n))},hermite:function(e,t,n,r){for(var i=e.length,a=0,o=0,s=[],c=[],l=[],u=[],d;o<i;o++){for(s[o]=1,d=0;d<i;d++)o!=d&&(s[o]*=(r-e[d])/(e[o]-e[d]));for(c[o]=0,d=0;d<i;d++)o!=d&&(c[o]+=1/(e[o]-e[d]));l[o]=(1-2*(r-e[o])*c[o])*(s[o]*s[o]),u[o]=(r-e[o])*(s[o]*s[o]),a+=l[o]*t[o]+u[o]*n[o]}return a},lagrange:function(e,t,n){for(var r=0,i=0,a,o,s=e.length;i<s;i++){for(o=t[i],a=0;a<s;a++)i!=a&&(o*=(n-e[a])/(e[i]-e[a]));r+=o}return r},cubic_spline:function(t,n,r){for(var i=t.length,a=0,o,s=[],c=[],l=[],u=[],d=[],f=[],p=[];a<i-1;a++)d[a]=t[a+1]-t[a];for(l[0]=0,a=1;a<i-1;a++)l[a]=3/d[a]*(n[a+1]-n[a])-3/d[a-1]*(n[a]-n[a-1]);for(a=1;a<i-1;a++)s[a]=[],c[a]=[],s[a][a-1]=d[a-1],s[a][a]=2*(d[a-1]+d[a]),s[a][a+1]=d[a],c[a][0]=l[a];for(u=e.multiply(e.inv(s),c),o=0;o<i-1;o++)f[o]=(n[o+1]-n[o])/d[o]-d[o]*(u[o+1][0]+2*u[o][0])/3,p[o]=(u[o+1][0]-u[o][0])/(3*d[o]);for(o=0;o<i&&!(t[o]>r);o++);return--o,n[o]+(r-t[o])*f[o]+e.sq(r-t[o])*u[o]+(r-t[o])*e.sq(r-t[o])*p[o]},gauss_quadrature:function(){throw Error(`gauss_quadrature not yet implemented`)},PCA:function(t){var n=t.length,r=t[0].length,i=0,a,o,s=[],c=[],l=[],u=[],d=[],f=[],p=[],m=[],h=[],g=[];for(i=0;i<n;i++)s[i]=e.sum(t[i])/r;for(i=0;i<r;i++)for(p[i]=[],a=0;a<n;a++)p[i][a]=t[a][i]-s[a];for(p=e.transpose(p),i=0;i<n;i++)for(m[i]=[],a=0;a<n;a++)m[i][a]=e.dot([p[i]],[p[a]])/(r-1);for(l=e.jacobi(m),h=l[0],c=l[1],g=e.transpose(h),i=0;i<c.length;i++)for(a=i;a<c.length;a++)c[i]<c[a]&&(o=c[i],c[i]=c[a],c[a]=o,u=g[i],g[i]=g[a],g[a]=u);for(f=e.transpose(p),i=0;i<n;i++)for(d[i]=[],a=0;a<f.length;a++)d[i][a]=e.dot([g[i]],[f[a]]);return[t,c,g,d]}}),(function(t){for(var n=0;n<t.length;n++)(function(t){e.fn[t]=function(n,r){var i=this;return r?(setTimeout(function(){r.call(i,e.fn[t].call(i,n))},15),this):typeof e[t](this,n)==`number`?e[t](this,n):e(e[t](this,n))}})(t[n])})(`add divide multiply subtract dot pow exp log abs norm angle`.split(` `))})(e,Math),(function(e,t){var n=[].slice,r=e.utils.isNumber,i=e.utils.isArray;e.extend({zscore:function(){var t=n.call(arguments);return r(t[1])?(t[0]-t[1])/t[2]:(t[0]-e.mean(t[1]))/e.stdev(t[1],t[2])},ztest:function(){var r=n.call(arguments),a;return i(r[1])?(a=e.zscore(r[0],r[1],r[3]),r[2]===1?e.normal.cdf(-t.abs(a),0,1):e.normal.cdf(-t.abs(a),0,1)*2):r.length>2?(a=e.zscore(r[0],r[1],r[2]),r[3]===1?e.normal.cdf(-t.abs(a),0,1):e.normal.cdf(-t.abs(a),0,1)*2):(a=r[0],r[1]===1?e.normal.cdf(-t.abs(a),0,1):e.normal.cdf(-t.abs(a),0,1)*2)}}),e.extend(e.fn,{zscore:function(e,t){return(e-this.mean())/this.stdev(t)},ztest:function(n,r,i){var a=t.abs(this.zscore(n,i));return r===1?e.normal.cdf(-a,0,1):e.normal.cdf(-a,0,1)*2}}),e.extend({tscore:function(){var r=n.call(arguments);return r.length===4?(r[0]-r[1])/(r[2]/t.sqrt(r[3])):(r[0]-e.mean(r[1]))/(e.stdev(r[1],!0)/t.sqrt(r[1].length))},ttest:function(){var i=n.call(arguments),a;return i.length===5?(a=t.abs(e.tscore(i[0],i[1],i[2],i[3])),i[4]===1?e.studentt.cdf(-a,i[3]-1):e.studentt.cdf(-a,i[3]-1)*2):r(i[1])?(a=t.abs(i[0]),i[2]==1?e.studentt.cdf(-a,i[1]-1):e.studentt.cdf(-a,i[1]-1)*2):(a=t.abs(e.tscore(i[0],i[1])),i[2]==1?e.studentt.cdf(-a,i[1].length-1):e.studentt.cdf(-a,i[1].length-1)*2)}}),e.extend(e.fn,{tscore:function(e){return(e-this.mean())/(this.stdev(!0)/t.sqrt(this.cols()))},ttest:function(n,r){return r===1?1-e.studentt.cdf(t.abs(this.tscore(n)),this.cols()-1):e.studentt.cdf(-t.abs(this.tscore(n)),this.cols()-1)*2}}),e.extend({anovafscore:function(){var r=n.call(arguments),i,a,o,s,c,l,u,d;if(r.length===1){for(c=Array(r[0].length),u=0;u<r[0].length;u++)c[u]=r[0][u];r=c}for(a=[],u=0;u<r.length;u++)a=a.concat(r[u]);for(o=e.mean(a),i=0,u=0;u<r.length;u++)i+=r[u].length*t.pow(e.mean(r[u])-o,2);for(i/=r.length-1,l=0,u=0;u<r.length;u++)for(s=e.mean(r[u]),d=0;d<r[u].length;d++)l+=t.pow(r[u][d]-s,2);return l/=a.length-r.length,i/l},anovaftest:function(){var t=n.call(arguments),i,a,o,s;if(r(t[0]))return 1-e.centralF.cdf(t[0],t[1],t[2]);var c=e.anovafscore(t);for(i=t.length-1,o=0,s=0;s<t.length;s++)o+=t[s].length;return a=o-i-1,1-e.centralF.cdf(c,i,a)},ftest:function(t,n,r){return 1-e.centralF.cdf(t,n,r)}}),e.extend(e.fn,{anovafscore:function(){return e.anovafscore(this.toArray())},anovaftes:function(){for(var t=0,n=0;n<this.length;n++)t+=this[n].length;return e.ftest(this.anovafscore(),this.length-1,t-this.length)}}),e.extend({qscore:function(){var i=n.call(arguments),a,o,s,c,l;return r(i[0])?(a=i[0],o=i[1],s=i[2],c=i[3],l=i[4]):(a=e.mean(i[0]),o=e.mean(i[1]),s=i[0].length,c=i[1].length,l=i[2]),t.abs(a-o)/(l*t.sqrt((1/s+1/c)/2))},qtest:function(){var t=n.call(arguments),r;t.length===3?(r=t[0],t=t.slice(1)):t.length===7?(r=e.qscore(t[0],t[1],t[2],t[3],t[4]),t=t.slice(5)):(r=e.qscore(t[0],t[1],t[2]),t=t.slice(3));var i=t[0],a=t[1];return 1-e.tukey.cdf(r,a,i-a)},tukeyhsd:function(t){for(var n=e.pooledstdev(t),r=t.map(function(t){return e.mean(t)}),i=t.reduce(function(e,t){return e+t.length},0),a=[],o=0;o<t.length;++o)for(var s=o+1;s<t.length;++s){var c=e.qtest(r[o],r[s],t[o].length,t[s].length,n,i,t.length);a.push([[o,s],c])}return a}}),e.extend({normalci:function(){var r=n.call(arguments),i=[,,],a=r.length===4?t.abs(e.normal.inv(r[1]/2,0,1)*r[2]/t.sqrt(r[3])):t.abs(e.normal.inv(r[1]/2,0,1)*e.stdev(r[2])/t.sqrt(r[2].length));return i[0]=r[0]-a,i[1]=r[0]+a,i},tci:function(){var r=n.call(arguments),i=[,,],a=r.length===4?t.abs(e.studentt.inv(r[1]/2,r[3]-1)*r[2]/t.sqrt(r[3])):t.abs(e.studentt.inv(r[1]/2,r[2].length-1)*e.stdev(r[2],!0)/t.sqrt(r[2].length));return i[0]=r[0]-a,i[1]=r[0]+a,i},significant:function(e,t){return e<t}}),e.extend(e.fn,{normalci:function(t,n){return e.normalci(t,n,this.toArray())},tci:function(t,n){return e.tci(t,n,this.toArray())}});function a(e,n,r,i){if(e>1||r>1||e<=0||r<=0)throw Error(`Proportions should be greater than 0 and less than 1`);var a=(e*n+r*i)/(n+i),o=t.sqrt(a*(1-a)*(1/n+1/i));return(e-r)/o}e.extend(e.fn,{oneSidedDifferenceOfProportions:function(t,n,r,i){var o=a(t,n,r,i);return e.ztest(o,1)},twoSidedDifferenceOfProportions:function(t,n,r,i){var o=a(t,n,r,i);return e.ztest(o,2)}})})(e,Math),e.models=(function(){function t(t){var r=t[0].length;return e.arange(r).map(function(i){var a=e.arange(r).filter(function(e){return e!==i});return n(e.col(t,i).map(function(e){return e[0]}),e.col(t,a))})}function n(t,n){var r=t.length,i=n[0].length-1,a=r-i-1,o=e.lstsq(n,t),s=e.multiply(n,o.map(function(e){return[e]})).map(function(e){return e[0]}),c=e.subtract(t,s),l=e.mean(t),u=e.sum(s.map(function(e){return(e-l)**2})),d=e.sum(t.map(function(e,t){return(e-s[t])**2})),f=u+d;return{exog:n,endog:t,nobs:r,df_model:i,df_resid:a,coef:o,predict:s,resid:c,ybar:l,SST:f,SSE:u,SSR:d,R2:u/f}}function r(n){var r=t(n.exog),i=Math.sqrt(n.SSR/n.df_resid),a=r.map(function(e){var t=e.SST,n=e.R2;return i/Math.sqrt(t*(1-n))}),o=n.coef.map(function(e,t){return(e-0)/a[t]}),s=o.map(function(t){var r=e.studentt.cdf(t,n.df_resid);return(r>.5?1-r:r)*2}),c=e.studentt.inv(.975,n.df_resid);return{se:a,t:o,p:s,sigmaHat:i,interval95:n.coef.map(function(e,t){var n=c*a[t];return[e-n,e+n]})}}function i(t){var n=t.R2/t.df_model/((1-t.R2)/t.df_resid);return{F_statistic:n,pvalue:1-function(t,n,r){return e.beta.cdf(t/(r/n+t),n/2,r/2)}(n,t.df_model,t.df_resid)}}function a(e,t){var a=n(e,t),o=r(a),s=i(a),c=1-(1-a.R2)*((a.nobs-1)/a.df_resid);return a.t=o,a.f=s,a.adjust_R2=c,a}return{ols:a}})(),e.extend({buildxmatrix:function(){for(var t=Array(arguments.length),n=0;n<arguments.length;n++)t[n]=[1].concat(arguments[n]);return e(t)},builddxmatrix:function(){for(var t=Array(arguments[0].length),n=0;n<arguments[0].length;n++)t[n]=[1].concat(arguments[0][n]);return e(t)},buildjxmatrix:function(t){for(var n=Array(t.length),r=0;r<t.length;r++)n[r]=t[r];return e.builddxmatrix(n)},buildymatrix:function(t){return e(t).transpose()},buildjymatrix:function(e){return e.transpose()},matrixmult:function(t,n){var r,i,a,o,s;if(t.cols()==n.rows()){if(n.rows()>1){for(o=[],r=0;r<t.rows();r++)for(o[r]=[],i=0;i<n.cols();i++){for(s=0,a=0;a<t.cols();a++)s+=t.toArray()[r][a]*n.toArray()[a][i];o[r][i]=s}return e(o)}for(o=[],r=0;r<t.rows();r++)for(o[r]=[],i=0;i<n.cols();i++){for(s=0,a=0;a<t.cols();a++)s+=t.toArray()[r][a]*n.toArray()[i];o[r][i]=s}return e(o)}},regress:function(t,n){var r=e.xtranspxinv(t),i=t.transpose(),a=e.matrixmult(e(r),i);return e.matrixmult(a,n)},regresst:function(t,n,r){var i=e.regress(t,n),a={};a.anova={};var o=e.jMatYBar(t,i);a.yBar=o;var s=n.mean();a.anova.residuals=e.residuals(n,o),a.anova.ssr=e.ssr(o,s),a.anova.msr=a.anova.ssr/(t[0].length-1),a.anova.sse=e.sse(n,o),a.anova.mse=a.anova.sse/(n.length-(t[0].length-1)-1),a.anova.sst=e.sst(n,s),a.anova.mst=a.anova.sst/(n.length-1),a.anova.r2=1-a.anova.sse/a.anova.sst,a.anova.r2<0&&(a.anova.r2=0),a.anova.fratio=a.anova.msr/a.anova.mse,a.anova.pvalue=e.anovaftest(a.anova.fratio,t[0].length-1,n.length-(t[0].length-1)-1),a.anova.rmse=Math.sqrt(a.anova.mse),a.anova.r2adj=1-a.anova.mse/a.anova.mst,a.anova.r2adj<0&&(a.anova.r2adj=0),a.stats=Array(t[0].length);for(var c=e.xtranspxinv(t),l,u,d,f=0;f<i.length;f++)l=Math.sqrt(a.anova.mse*Math.abs(c[f][f])),u=Math.abs(i[f]/l),d=e.ttest(u,n.length-t[0].length-1,r),a.stats[f]=[i[f],l,u,d];return a.regress=i,a},xtranspx:function(t){return e.matrixmult(t.transpose(),t)},xtranspxinv:function(t){var n=e.matrixmult(t.transpose(),t);return e.inv(n)},jMatYBar:function(t,n){return new e(e.matrixmult(t,n))},residuals:function(t,n){return e.matrixsubtract(t,n)},ssr:function(e,t){for(var n=0,r=0;r<e.length;r++)n+=(e[r]-t)**2;return n},sse:function(e,t){for(var n=0,r=0;r<e.length;r++)n+=(e[r]-t[r])**2;return n},sst:function(e,t){for(var n=0,r=0;r<e.length;r++)n+=(e[r]-t)**2;return n},matrixsubtract:function(t,n){for(var r=Array(t.length),i=0;i<t.length;i++){r[i]=Array(t[i].length);for(var a=0;a<t[i].length;a++)r[i][a]=t[i][a]-n[i][a]}return e(r)}}),e.jStat=e,e})})),gE=/* @__PURE__ */ o((e=>{(function(t){typeof DO_NOT_EXPORT_BESSEL>`u`?typeof e==`object`?t(e):typeof define==`function`&&define.amd?define(function(){var e={};return t(e),e}):t({}):t({})})(function(e){e.version=`1.0.2`;var t=Math;function n(e,t){for(var n=0,r=0;n<e.length;++n)r=t*r+e[n];return r}function r(e,t,n,r,i){if(t===0)return n;if(t===1)return r;for(var a=2/e,o=r,s=1;s<t;++s)o=r*s*a+i*n,n=r,r=o;return o}function i(e,t,n,i,a){return function(n,o){if(i){if(n===0)return i==1?-1/0:1/0;if(n<0)return NaN}if(o===0)return e(n);if(o===1)return t(n);if(o<0)return NaN;o|=0;var s=e(n),c=t(n);return r(n,o,s,c,a)}}var a=(function(){var e=.636619772,i=[57568490574,-13362590354,651619640.7,-11214424.18,77392.33017,-184.9052456].reverse(),a=[57568490411,1029532985,9494680.718,59272.64853,267.8532712,1].reverse(),o=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),s=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34935152e-8].reverse();function c(r){var c=0,l=0,u=0,d=r*r;if(r<8)l=n(i,d),u=n(a,d),c=l/u;else{var f=r-.785398164;d=64/d,l=n(o,d),u=n(s,d),c=t.sqrt(e/r)*(t.cos(f)*l-t.sin(f)*u*8/r)}return c}var l=[72362614232,-7895059235,242396853.1,-2972611.439,15704.4826,-30.16036606].reverse(),u=[144725228442,2300535178,18583304.74,99447.43394,376.9991397,1].reverse(),d=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),f=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();function p(r){var i=0,a=0,o=0,s=r*r,c=t.abs(r)-2.356194491;return Math.abs(r)<8?(a=r*n(l,s),o=n(u,s),i=a/o):(s=64/s,a=n(d,s),o=n(f,s),i=t.sqrt(e/t.abs(r))*(t.cos(c)*a-t.sin(c)*o*8/t.abs(r)),r<0&&(i=-i)),i}return function e(n,i){if(i=Math.round(i),!isFinite(n))return isNaN(n)?n:0;if(i<0)return(i%2?-1:1)*e(n,-i);if(n<0)return(i%2?-1:1)*e(-n,i);if(i===0)return c(n);if(i===1)return p(n);if(n===0)return 0;var a=0;if(n>i)a=r(n,i,c(n),p(n),-1);else{for(var o=2*t.floor((i+t.floor(t.sqrt(40*i)))/2),s=!1,l=0,u=0,d=1,f=0,m=2/n,h=o;h>0;h--)f=h*m*d-l,l=d,d=f,t.abs(d)>1e10&&(d*=1e-10,l*=1e-10,a*=1e-10,u*=1e-10),s&&(u+=d),s=!s,h==i&&(a=l);u=2*u-d,a/=u}return a}})(),o=(function(){var e=.636619772,r=[-2957821389,7062834065,-512359803.6,10879881.29,-86327.92757,228.4622733].reverse(),o=[40076544269,745249964.8,7189466.438,47447.2647,226.1030244,1].reverse(),s=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),c=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34945152e-8].reverse();function l(i){var l=0,u=0,d=0,f=i*i,p=i-.785398164;return i<8?(u=n(r,f),d=n(o,f),l=u/d+e*a(i,0)*t.log(i)):(f=64/f,u=n(s,f),d=n(c,f),l=t.sqrt(e/i)*(t.sin(p)*u+t.cos(p)*d*8/i)),l}var u=[-4900604943e3,127527439e4,-51534381390,734926455.1,-4237922.726,8511.937935].reverse(),d=[249958057e5,424441966400,3733650367,22459040.02,102042.605,354.9632885,1].reverse(),f=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),p=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();function m(r){var i=0,o=0,s=0,c=r*r,l=r-2.356194491;return r<8?(o=r*n(u,c),s=n(d,c),i=o/s+e*(a(r,1)*t.log(r)-1/r)):(c=64/c,o=n(f,c),s=n(p,c),i=t.sqrt(e/r)*(t.sin(l)*o+t.cos(l)*s*8/r)),i}return i(l,m,`BESSELY`,1,-1)})(),s=(function(){var e=[1,3.5156229,3.0899424,1.2067492,.2659732,.0360768,.0045813].reverse(),r=[.39894228,.01328592,.00225319,-.00157565,.00916281,-.02057706,.02635537,-.01647633,.00392377].reverse();function i(i){return i<=3.75?n(e,i*i/14.0625):t.exp(t.abs(i))/t.sqrt(t.abs(i))*n(r,3.75/t.abs(i))}var a=[.5,.87890594,.51498869,.15084934,.02658733,.00301532,32411e-8].reverse(),o=[.39894228,-.03988024,-.00362018,.00163801,-.01031555,.02282967,-.02895312,.01787654,-.00420059].reverse();function s(e){return e<3.75?e*n(a,e*e/14.0625):(e<0?-1:1)*t.exp(t.abs(e))/t.sqrt(t.abs(e))*n(o,3.75/t.abs(e))}return function e(n,r){if(r=Math.round(r),r===0)return i(n);if(r===1)return s(n);if(r<0)return NaN;if(t.abs(n)===0)return 0;if(n==1/0)return 1/0;var a=0,o,c=2/t.abs(n),l=0,u=1,d=0;for(o=2*t.round((r+t.round(t.sqrt(40*r)))/2);o>0;o--)d=o*c*u+l,l=u,u=d,t.abs(u)>1e10&&(u*=1e-10,l*=1e-10,a*=1e-10),o==r&&(a=l);return a*=e(n,0)/u,n<0&&r%2?-a:a}})(),c=(function(){var e=[-.57721566,.4227842,.23069756,.0348859,.00262698,1075e-7,74e-7].reverse(),r=[1.25331414,-.07832358,.02189568,-.01062446,.00587872,-.0025154,53208e-8].reverse();function a(i){return i<=2?-t.log(i/2)*s(i,0)+n(e,i*i/4):t.exp(-i)/t.sqrt(i)*n(r,2/i)}var o=[1,.15443144,-.67278579,-.18156897,-.01919402,-.00110404,-4686e-8].reverse(),c=[1.25331414,.23498619,-.0365562,.01504268,-.00780353,.00325614,-68245e-8].reverse();function l(e){return e<=2?t.log(e/2)*s(e,1)+1/e*n(o,e*e/4):t.exp(-e)/t.sqrt(e)*n(c,2/e)}return i(a,l,`BESSELK`,2,1)})();e.besselj=a,e.bessely=o,e.besseli=s,e.besselk=c})})),_E=/* @__PURE__ */ s({ABS:()=>Vk,ACCRINT:()=>yP,ACOS:()=>Hk,ACOSH:()=>Uk,ACOT:()=>Wk,ACOTH:()=>Gk,AGGREGATE:()=>Kk,AND:()=>QP,ARABIC:()=>qk,ASIN:()=>Jk,ASINH:()=>Yk,ATAN:()=>Xk,ATAN2:()=>Zk,ATANH:()=>Qk,AVEDEV:()=>SO,AVERAGE:()=>CO,AVERAGEA:()=>wO,AVERAGEIF:()=>TO,AVERAGEIFS:()=>EO,BASE:()=>$k,BESSELI:()=>Xj,BESSELJ:()=>Zj,BESSELK:()=>Qj,BESSELY:()=>$j,BETA:()=>DO,BETADIST:()=>JM,BETAINV:()=>YM,BIN2DEC:()=>eM,BIN2HEX:()=>tM,BIN2OCT:()=>nM,BINOM:()=>OO,BINOMDIST:()=>XM,BITAND:()=>rM,BITLSHIFT:()=>iM,BITOR:()=>aM,BITRSHIFT:()=>oM,BITXOR:()=>sM,CEILING:()=>eA,CEILINGMATH:()=>ZM,CEILINGPRECISE:()=>QM,CHAR:()=>JD,CHIDIST:()=>$M,CHIDISTRT:()=>eN,CHIINV:()=>tN,CHIINVRT:()=>nN,CHISQ:()=>kO,CHITEST:()=>rN,CHOOSE:()=>kD,CHOOSECOLS:()=>AD,CHOOSEROWS:()=>jD,CLEAN:()=>YD,CODE:()=>XD,COLUMN:()=>MD,COLUMNS:()=>ND,COMBIN:()=>tA,COMBINA:()=>nA,COMPLEX:()=>cM,CONCAT:()=>QD,CONCATENATE:()=>ZD,CONFIDENCE:()=>AO,CONVERT:()=>lM,CORREL:()=>jO,COS:()=>rA,COSH:()=>iA,COT:()=>aA,COTH:()=>oA,COUNT:()=>MO,COUNTA:()=>NO,COUNTBLANK:()=>PO,COUNTIF:()=>FO,COUNTIFS:()=>IO,COUPDAYS:()=>bP,COVAR:()=>iN,COVARIANCE:()=>LO,COVARIANCEP:()=>aN,COVARIANCES:()=>oN,CRITBINOM:()=>sN,CSC:()=>sA,CSCH:()=>cA,CUMIPMT:()=>xP,CUMPRINC:()=>SP,DATE:()=>Cj,DATEDIF:()=>wj,DATEVALUE:()=>Tj,DAVERAGE:()=>nP,DAY:()=>Ej,DAYS:()=>Oj,DAYS360:()=>kj,DB:()=>CP,DCOUNT:()=>rP,DCOUNTA:()=>iP,DDB:()=>wP,DEC2BIN:()=>uM,DEC2HEX:()=>dM,DEC2OCT:()=>fM,DECIMAL:()=>lA,DEGREES:()=>uA,DELTA:()=>pM,DEVSQ:()=>RO,DGET:()=>aP,DISC:()=>TP,DMAX:()=>oP,DMIN:()=>sP,DOLLAR:()=>$D,DOLLARDE:()=>EP,DOLLARFR:()=>DP,DPRODUCT:()=>cP,DROP:()=>PD,DSTDEV:()=>lP,DSTDEVP:()=>uP,DSUM:()=>dP,DVAR:()=>fP,DVARP:()=>pP,EDATE:()=>Aj,EFFECT:()=>OP,EOMONTH:()=>jj,ERF:()=>mM,ERFC:()=>hM,ERFCPRECISE:()=>cN,ERFPRECISE:()=>lN,ERROR:()=>hD,EVEN:()=>dA,EXACT:()=>eO,EXP:()=>fA,EXPAND:()=>FD,EXPON:()=>zO,EXPONDIST:()=>uN,F:()=>BO,FACT:()=>mA,FACTDOUBLE:()=>hA,FALSE:()=>$P,FDIST:()=>dN,FDISTRT:()=>fN,FIND:()=>tO,FINV:()=>pN,FINVRT:()=>mN,FISHER:()=>VO,FISHERINV:()=>HO,FIXED:()=>nO,FLOOR:()=>gA,FLOORMATH:()=>hN,FLOORPRECISE:()=>gN,FORECAST:()=>UO,FREQUENCY:()=>WO,FTEST:()=>_N,FV:()=>kP,FVSCHEDULE:()=>AP,GAMMA:()=>GO,GAMMADIST:()=>vN,GAMMAINV:()=>yN,GAMMALN:()=>KO,GAMMALNPRECISE:()=>bN,GAUSS:()=>qO,GCD:()=>_A,GEOMEAN:()=>JO,GESTEP:()=>gM,GROWTH:()=>YO,HARMEAN:()=>XO,HEX2BIN:()=>_M,HEX2DEC:()=>vM,HEX2OCT:()=>yM,HLOOKUP:()=>ID,HOUR:()=>Mj,HSTACK:()=>KD,HYPGEOM:()=>ZO,HYPGEOMDIST:()=>xN,IF:()=>eF,IFERROR:()=>nF,IFNA:()=>rF,IFS:()=>tF,IMABS:()=>bM,IMAGINARY:()=>xM,IMARGUMENT:()=>SM,IMCONJUGATE:()=>CM,IMCOS:()=>wM,IMCOSH:()=>TM,IMCOT:()=>EM,IMCSC:()=>BM,IMCSCH:()=>VM,IMDIV:()=>DM,IMEXP:()=>OM,IMLN:()=>kM,IMLOG10:()=>AM,IMLOG2:()=>jM,IMPOWER:()=>MM,IMPRODUCT:()=>NM,IMREAL:()=>PM,IMSEC:()=>FM,IMSECH:()=>IM,IMSIN:()=>LM,IMSINH:()=>RM,IMSQRT:()=>zM,IMSUB:()=>HM,IMSUM:()=>UM,IMTAN:()=>WM,INDEX:()=>LD,INT:()=>vA,INTERCEPT:()=>QO,IPMT:()=>jP,IRR:()=>MP,ISBLANK:()=>gD,ISERR:()=>_D,ISERROR:()=>vD,ISEVEN:()=>yD,ISLOGICAL:()=>bD,ISNA:()=>xD,ISNONTEXT:()=>SD,ISNUMBER:()=>CD,ISO:()=>yA,ISODD:()=>wD,ISOWEEKNUM:()=>Nj,ISPMT:()=>NP,ISTEXT:()=>TD,KURT:()=>$O,LARGE:()=>ek,LCM:()=>bA,LEFT:()=>rO,LEN:()=>iO,LINEST:()=>tk,LN:()=>xA,LOG:()=>SA,LOG10:()=>CA,LOGEST:()=>nk,LOGINV:()=>SN,LOGNORM:()=>rk,LOGNORMDIST:()=>CN,LOGNORMINV:()=>wN,LOOKUP:()=>RD,LOWER:()=>aO,MATCH:()=>zD,MAX:()=>ik,MAXA:()=>ak,MAXIFS:()=>ok,MEDIAN:()=>sk,MID:()=>oO,MIN:()=>ck,MINA:()=>lk,MINIFS:()=>uk,MINUTE:()=>Pj,MIRR:()=>PP,MMULT:()=>wA,MOD:()=>TA,MODE:()=>dk,MODEMULT:()=>TN,MODESNGL:()=>EN,MONTH:()=>Fj,MROUND:()=>EA,MULTINOMIAL:()=>DA,MUNIT:()=>OA,N:()=>ED,NA:()=>DD,NEGBINOM:()=>fk,NEGBINOMDIST:()=>DN,NETWORKDAYS:()=>Ij,NETWORKDAYSINTL:()=>ON,NOMINAL:()=>FP,NORM:()=>pk,NORMDIST:()=>kN,NORMINV:()=>AN,NORMSDIST:()=>jN,NORMSINV:()=>MN,NOT:()=>iF,NOW:()=>Lj,NPER:()=>IP,NPV:()=>LP,NUMBERVALUE:()=>sO,OCT2BIN:()=>GM,OCT2DEC:()=>KM,OCT2HEX:()=>qM,ODD:()=>kA,OR:()=>aF,PDURATION:()=>RP,PEARSON:()=>mk,PERCENTILE:()=>hk,PERCENTILEEXC:()=>NN,PERCENTILEINC:()=>PN,PERCENTRANK:()=>gk,PERCENTRANKEXC:()=>FN,PERCENTRANKINC:()=>IN,PERMUT:()=>_k,PERMUTATIONA:()=>vk,PHI:()=>yk,PI:()=>AA,PMT:()=>zP,POISSON:()=>bk,POISSONDIST:()=>LN,POWER:()=>jA,PPMT:()=>BP,PRICEDISC:()=>VP,PROB:()=>xk,PRODUCT:()=>MA,PROPER:()=>cO,PV:()=>HP,QUARTILE:()=>Sk,QUARTILEEXC:()=>RN,QUARTILEINC:()=>zN,QUOTIENT:()=>NA,RADIANS:()=>PA,RAND:()=>FA,RANDBETWEEN:()=>IA,RANK:()=>Ck,RANKAVG:()=>BN,RANKEQ:()=>VN,RATE:()=>UP,REPLACE:()=>lO,REPT:()=>uO,RIGHT:()=>dO,ROMAN:()=>LA,ROUND:()=>zA,ROUNDDOWN:()=>BA,ROUNDUP:()=>VA,ROW:()=>wk,ROWS:()=>BD,RRI:()=>WP,RSQ:()=>Tk,SEARCH:()=>fO,SEC:()=>HA,SECH:()=>UA,SECOND:()=>Rj,SERIESSUM:()=>WA,SIGN:()=>GA,SIN:()=>KA,SINH:()=>qA,SKEW:()=>Ek,SKEWP:()=>HN,SLN:()=>GP,SLOPE:()=>Dk,SMALL:()=>Ok,SORT:()=>VD,SQRT:()=>JA,SQRTPI:()=>YA,STANDARDIZE:()=>kk,STDEV:()=>Ak,STDEVA:()=>jk,STDEVP:()=>UN,STDEVPA:()=>Mk,STDEVS:()=>WN,STEYX:()=>Nk,SUBSTITUTE:()=>pO,SUBTOTAL:()=>XA,SUM:()=>ZA,SUMIF:()=>QA,SUMIFS:()=>$A,SUMPRODUCT:()=>ej,SUMSQ:()=>tj,SUMX2MY2:()=>nj,SUMX2PY2:()=>rj,SUMXMY2:()=>ij,SWITCH:()=>cF,SYD:()=>KP,T:()=>mO,TAKE:()=>HD,TAN:()=>aj,TANH:()=>oj,TBILLEQ:()=>qP,TBILLPRICE:()=>JP,TBILLYIELD:()=>YP,TDIST:()=>GN,TDISTRT:()=>KN,TEXT:()=>hO,TEXTJOIN:()=>gO,TIME:()=>zj,TIMEVALUE:()=>Bj,TINV:()=>qN,TODAY:()=>Vj,TRANSPOSE:()=>UD,TREND:()=>Pk,TRIM:()=>_O,TRIMMEAN:()=>Fk,TRUE:()=>oF,TRUNC:()=>sj,TTEST:()=>JN,TYPE:()=>OD,UNICHAR:()=>vO,UNICODE:()=>yO,UNIQUE:()=>WD,UPPER:()=>bO,VALUE:()=>xO,VAR:()=>Ik,VARA:()=>Lk,VARP:()=>YN,VARPA:()=>Rk,VARS:()=>XN,VLOOKUP:()=>GD,VSTACK:()=>qD,WEEKDAY:()=>Hj,WEEKNUM:()=>Uj,WEIBULL:()=>zk,WEIBULLDIST:()=>ZN,WORKDAY:()=>Wj,WORKDAYINTL:()=>QN,XIRR:()=>XP,XNPV:()=>ZP,XOR:()=>sF,YEAR:()=>Gj,YEARFRAC:()=>Jj,Z:()=>Bk,ZTEST:()=>$N,utils:()=>lF}),W=/* @__PURE__ */ l(hE(),1),vE=/* @__PURE__ */ l(gE(),1);let yE=/* @__PURE__ */ Error(`#NULL!`),bE=/* @__PURE__ */ Error(`#DIV/0!`),G=/* @__PURE__ */ Error(`#VALUE!`),xE=/* @__PURE__ */ Error(`#REF!`),SE=/* @__PURE__ */ Error(`#NAME?`),K=/* @__PURE__ */ Error(`#NUM!`),q=/* @__PURE__ */ Error(`#N/A`),CE=/* @__PURE__ */ Error(`#ERROR!`),wE=/* @__PURE__ */ Error(`#GETTING_DATA`),TE=/* @__PURE__ */ Error(`#CALC!`);var EE=/*#__PURE__*/ Object.freeze({__proto__:null,calc:TE,data:wE,div0:bE,error:CE,na:q,name:SE,nil:yE,num:K,ref:xE,value:G});let DE=!1;function OE(){DE=!0}function kE(){DE=!1}function AE(e){e<60&&(e+=1);let t=Math.floor(e-25569)*86400,n=/* @__PURE__ */ new Date(t*1e3),r=e-Math.floor(e)+1e-7,i=Math.floor(86400*r),a=i%60;i-=a;let o=Math.floor(i/3600),s=Math.floor(i/60)%60,c=n.getUTCDate(),l=n.getUTCMonth();return e>=60&&e<61&&(c=29,l=1),new Date(n.getUTCFullYear(),l,c,o,s,a)}function jE(e){let t=new Date(1900,0,1),n=e>-22038912e5?2:1;return Math.ceil((e-t)/864e5)+n}var ME=/*#__PURE__*/ Object.freeze({__proto__:null,dateToSerial:jE,get returnSerial(){return DE},serialToDate:AE,useDate:kE,useSerial:OE});let NE=[`>`,`>=`,`<`,`<=`,`=`,`<>`],PE=`operator`,FE=`literal`,IE=[PE,FE],LE=PE,RE=FE;function zE(e,t){if(IE.indexOf(t)===-1)throw Error(`Unsupported token type: `+t);return{value:e,type:t}}function BE(e){return typeof e==`string`&&/^\d+(\.\d+)?$/.test(e)&&(e=e.indexOf(`.`)===-1?parseInt(e,10):parseFloat(e)),e}function VE(e){let t=e.length,n=[],r=0,i=``,a=``;for(;r<t;){let t=e.charAt(r);switch(t){case`>`:case`<`:case`=`:a+=t,i.length>0&&(n.push(i),i=``);break;default:a.length>0&&(n.push(a),a=``),i+=t}r++}return i.length>0&&n.push(i),a.length>0&&n.push(a),n}function HE(e){let t=``,n=[];for(let r=0;r<e.length;r++){let i=e[r];r===0&&NE.indexOf(i)>=0?n.push(zE(i,LE)):t+=i}return t.length>0&&n.push(zE(BE(t),RE)),n.length>0&&n[0].type!==LE&&n.unshift(zE(`=`,LE)),n}function UE(e){let t=[],n;for(let r=0;r<e.length;r++){let i=e[r];switch(i.type){case LE:n=i.value;break;case RE:t.push(i.value)}}return WE(t,n)}function WE(e,t){let n=!1;switch(t){case`>`:n=e[0]>e[1];break;case`>=`:n=e[0]>=e[1];break;case`<`:n=e[0]<e[1];break;case`<=`:n=e[0]<=e[1];break;case`=`:n=e[0]==e[1];break;case`<>`:n=e[0]!=e[1]}return n}function GE(e){return HE(VE(e))}let KE=UE;function qE(e){let t=[];return JE(e,e=>{t.push(e)}),t}function JE(e,t){let n=-1,r=e.length;for(;++n<r&&t(e[n],n,e)!==!1;);return e}function YE(e){let t=e.length,n;for(;t--;)if(n=e[t],typeof n!=`number`){if(n===!0)e[t]=1;else if(n===!1)e[t]=0;else if(typeof n==`string`){let r=Z(n);e[t]=r instanceof Error?0:r}}return e}function XE(e){return[e.length,e.reduce((e,t)=>Math.max(e,t.length),0)]}function ZE(e,t){let n=[e,t];return n.some(e=>!mD(e))?q:n.some(e=>e<=0)?G:Array.from({length:e},()=>Array.from({length:t},()=>void 0))}function QE(e,t){if(!e)return G;e.every(e=>Array.isArray(e))&&e.length!==0||(e=[[...e]]),e.map((t,n)=>{t.map((t,r)=>{t||(e[n][r]=0)})});let n=e.reduce((t,n,r)=>n.length>e[t].length?r:t,0),r=e[n].length;return e.map(e=>[...e,...Array(r-e.length).fill(0)])}function J(){let e;if(arguments.length===1){let t=arguments[0];e=tD(t)?qE.apply(null,arguments):[t]}else e=Array.from(arguments);for(;!nD(e);)e=$E(e);return e}function $E(e){return!e||!e.reduce?[e]:e.reduce((e,t)=>{let n=Array.isArray(e),r=Array.isArray(t);return n&&r?e.concat(t):n?(e.push(t),e):r?[e].concat(t):[e,t]})}function eD(e,t){return t||=1,!e||typeof e.slice!=`function`?e:e.slice(0,e.length-t)}function tD(e){return e!=null&&typeof e.length==`number`&&typeof e!=`string`}function nD(e){if(!e)return!1;for(let t=0;t<e.length;++t)if(Array.isArray(e[t]))return!1;return!0}function rD(e,t){return t||=1,!e||typeof e.slice!=`function`?e:e.slice(t)}function iD(e){return e?e[0].map((t,n)=>e.map(e=>e[n])):G}function aD(e,t){let n=null;return JE(e,(e,r)=>{if(e[0]===t)return n=r,!1}),n??G}function Y(){for(let e=0;e<arguments.length;e++)if(arguments[e]instanceof Error)return arguments[e]}function X(){let e=arguments.length;for(;e--;)if(arguments[e]instanceof Error)return!0;return!1}function oD(e){let t=0x5af3107a4000;return Math.round(e*t)/t}function sD(){return J.apply(null,arguments).filter(e=>typeof e==`number`)}function cD(e){if(typeof e==`boolean`||e instanceof Error)return e;if(typeof e==`number`)return e!==0;if(typeof e==`string`){let t=e.toUpperCase();if(t===`TRUE`)return!0;if(t===`FALSE`)return!1}return e instanceof Date&&!isNaN(e)||G}function lD(e){if(!isNaN(e)){if(e instanceof Date)return new Date(e);let t=parseFloat(e);return t<0||t>=2958466?K:AE(t)}return typeof e==`string`&&(e=/(\d{4})-(\d\d?)-(\d\d?)$/.test(e)?/* @__PURE__ */ new Date(e+`T00:00:00.000`):new Date(e),!isNaN(e))?e:G}function uD(e){let t=e.length,n;for(;t--;){if(n=lD(e[t]),n===G)return n;e[t]=n}return e}function Z(e){return e instanceof Error?e:e==null?0:(typeof e==`boolean`&&(e=+e),!isNaN(e)&&e!==``?parseFloat(e):G)}function Q(e){let t;if(!e||(t=e.length)===0)return G;let n;for(;t--;){if(e[t]instanceof Error)return e[t];if(n=Z(e[t]),n instanceof Error)return n;e[t]=n}return e}function dD(e){return e instanceof Error?e:e==null?``:e.toString()}function fD(){let e=arguments.length;for(;e--;)if(typeof arguments[e]==`string`)return!0;return!1}function pD(){let e=qE(arguments),t=Q(J(e.shift()));if(t instanceof Error)return t;let n=e,r=n.length/2;for(let e=0;e<r;e++)n[e*2]=J(n[e*2]);let i=[];for(let e=0;e<t.length;e++){let a=!1;for(let t=0;t<r;t++){let r=n[t*2][e],i=n[t*2+1],o=i===void 0||i===`*`,s=!1;if(o)s=!0;else{let e=GE(i+``),t=[zE(r,RE)].concat(e);s=KE(t)}if(!s){a=!1;break}a=!0}a&&i.push(t[e])}return i}function mD(e){return e!=null}let hD={};hD.TYPE=e=>{switch(e){case yE:return 1;case bE:return 2;case G:return 3;case xE:return 4;case SE:return 5;case K:return 6;case q:return 7;case wE:return 8}return q};function gD(e){return e===null}function _D(e){return[G,xE,bE,K,SE,yE].indexOf(e)>=0||typeof e==`number`&&(isNaN(e)||!isFinite(e))}function vD(e){return _D(e)||e===q}function yD(e){return!(Math.floor(Math.abs(e))&1)}function bD(e){return e===!0||e===!1}function xD(e){return e===q}function SD(e){return typeof e!=`string`}function CD(e){return typeof e==`number`&&!isNaN(e)&&isFinite(e)}function wD(e){return!!(Math.floor(Math.abs(e))&1)}function TD(e){return typeof e==`string`}function ED(e){return CD(e)?e:e instanceof Date?e.getTime():e===!0?1:e===!1?0:vD(e)?e:0}function DD(){return q}function OD(e){if(CD(e))return 1;if(TD(e))return 2;if(bD(e))return 4;if(vD(e))return 16;if(Array.isArray(e))return 64}function kD(){if(arguments.length<2)return q;let e=arguments[0];return e<1||e>254||arguments.length<e+1?G:arguments[e]}function AD(e,t,...n){if(!Array.isArray(e))return G;let r=J([t,...n]),[i,a]=XE(e);if(r.some(e=>{if(!mD(e))return!0;let t=Math.abs(e);return!(0<t&&t<=a)}))return G;let o=r.map(e=>e<0?e+a+1:e),s=Array(i);for(let t=0;t<i;t++){s[t]=Array(o.length);for(let n=0;n<o.length;n++)s[t][n]=e[t][o[n]-1]??0}return s}function jD(e,t,...n){if(!Array.isArray(e))return G;let r=J([t,...n]);return r.some(t=>{if(!mD(t))return!0;let n=Math.abs(t);return!(0<n&&n<=e.length)})?G:r.map(t=>t<0?t+e.length+1:t).reduce((t,n)=>{let r=[...e[--n]].map(e=>mD(e)?e:0);return t.push(r),t},[])}function MD(e,t){if(arguments.length!==2)return q;if(t<0)return K;if(!(e instanceof Array)||typeof t!=`number`)return G;if(e.length!==0)return W.default.col(e,t)}function ND(e){return arguments.length===1?e instanceof Array?e.length===0?0:W.default.cols(e):G:q}function PD(e,t,n){if(X(e,t,n))return Y(e,t,n);if(!(e instanceof Array))return G;let r=[],[i,a]=XE(e),o=0,s=i;if(typeof t==`number`){if(Math.abs(t)>i)return TE;t>0?o=t:t<0&&(s+=t)}let c=0,l=a;if(typeof n==`number`){if(Math.abs(n)>a)return TE;n>0?c=n:n<0&&(l+=n)}for(let t=o;t<s;t++){let n=[...e[t].slice(c,l).map(e=>e??0)];r.push(n)}return r}function FD(e,t,n,r){let[i,a]=XE(e);if(mD(t)||(t=i),mD(n)||(n=a),t<i||n<a)return G;let o=ZE(t,n);for(let s=0;s<t;s++)for(let t=0;t<n;t++){let n=e[s]?.[t];mD(n)||(n=s<i&&t<a?0:r??q),o[s][t]=n}return o}function ID(e,t,n,r){return GD(e,iD(t),n,r)}function LD(e,t,n){let r=Y(e,t,n);if(r)return r;if(!Array.isArray(e))return G;let i=e.length>0&&!Array.isArray(e[0]);return i&&!n?(n=t,t=1):(n||=1,t||=1),n<0||t<0?G:i&&t===1&&n<=e.length?e[n-1]:t<=e.length&&n<=e[t-1].length?e[t-1][n-1]:xE}function RD(e,t,n){t=J(t),n=n?J(n):t;let r=typeof e==`number`,i=q;for(let a=0;a<t.length;a++)if(t[a]===e)return n[a];else if(r&&t[a]<=e||typeof t[a]==`string`&&t[a].localeCompare(e)<0)i=n[a];else if(r&&t[a]>e)return i;return i}function zD(e,t,n){if(!e&&e!==0||!t||(arguments.length===2&&(n=1),t=J(t),!(t instanceof Array))||n!==-1&&n!==0&&n!==1)return q;let r,i;for(let a=0;a<t.length;a++)if(n===1){if(t[a]===e)return a+1;t[a]<e&&(i?t[a]>i&&(r=a+1,i=t[a]):(r=a+1,i=t[a]))}else if(n===0){if(typeof e==`string`&&typeof t[a]==`string`){let n=e.toLowerCase().replace(/\?/g,`.`).replace(/\*/g,`.*`).replace(/~/g,`\\`).replace(/\+/g,`\\+`).replace(/\(/g,`\\(`).replace(/\)/g,`\\)`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`);if(RegExp(`^`+n+`$`).test(t[a].toLowerCase()))return a+1}else if(t[a]===e)return a+1}else if(n===-1){if(t[a]===e)return a+1;t[a]>e&&(i?t[a]<i&&(r=a+1,i=t[a]):(r=a+1,i=t[a]))}return r||q}function BD(e){return arguments.length===1?e instanceof Array?e.length===0?0:W.default.rows(e):G:q}function VD(e,t=1,n=1,r=!1){if(!e||!Array.isArray(e))return q;if(e.length===0)return 0;if(t=Z(t),!t||t<1||(n=Z(n),n!==1&&n!==-1))return G;if(r=cD(r),typeof r!=`boolean`)return SE;let i=e=>e.sort((e,r)=>(e=dD(e[t-1]),r=dD(r[t-1]),n===1?e<r?n*-1:n:e>r?n:n*-1)),a=QE(e),o=r?iD(a):a;return t>=1&&t<=o[0].length?r?iD(i(o)):i(o):G}function HD(e,t,n){if(X(e,t,n))return Y(e,t,n);if(!(e instanceof Array))return G;let[r,i]=XE(e),a=0,o=r-1;if(typeof t==`number`){if(t===0)return TE;Math.abs(t)<=r&&(t<0?a=r+t:o=t-1)}let s=0,c=i-1;if(typeof n==`number`){if(n===0)return TE;Math.abs(n)<=i&&(n<0?s=i+n:c=n-1)}let l=ZE(o-a+1,c-s+1),u=-1,d;for(let t=a;t<=o;t++){u++,d=-1;for(let n=s;n<=c;n++)l[u][++d]=e[t]?.[n]??0}return l}function UD(e){return e?iD(QE(e)):q}function WD(){let e=[];for(let t=0;t<arguments.length;++t){let n=!1,r=arguments[t];for(let t=0;t<e.length&&(n=e[t]===r,!n);++t);n||e.push(r)}return e}function GD(e,t,n,r){if(!t||!n)return q;r=r!==0&&r!==!1;let i=q,a=!1,o=typeof e==`number`,s=typeof e==`string`?e.toLowerCase():e;for(let c=0;c<t.length;c++){let l=t[c],u=typeof l[0]==`string`?l[0].toLowerCase():l[0];if(u===s){i=n<l.length+1?l[n-1]:xE;break}!a&&(o&&r&&u<=e||r&&typeof u==`string`&&u.localeCompare(e)<0)&&(i=n<l.length+1?l[n-1]:xE),o&&u>e&&(a=!0)}return i}function KD(e,...t){let n=[e,...t],r=0,i=0,a=[];for(let e of n){let[t,n]=XE(e);r=Math.max(r,t),i+=n,a.push(n)}let o=Array.from({length:r},()=>Array(i)),s=0;for(let e=0;e<n.length;e++){let t=n[e],i=a[e];for(let e=0;e<i;e++){for(let n=0;n<r;n++)o[n][s]=t[n]?.[e]??(n<t.length?0:q);s++}}return o}function qD(e,...t){let n=[e,...t],r=0,i=0;for(let e of n){let[t,n]=XE(e);r=Math.max(r,n),i+=t}let a=Array(i),o,s=-1;for(;(o=n.shift())!==void 0;)for(let e=0;e<o.length;e++){a[++s]=Array(r);for(let t=0;t<r;t++)a[s][t]=o[e][t]??(t<o[e].length?0:q)}return a}function JD(e){return e=Z(e),e===0?G:e instanceof Error?e:String.fromCharCode(e)}function YD(e){return X(e)?e:(e||=``,e.replace(/[\0-\x1F]/g,``))}function XD(e){if(X(e))return e;e||=``;let t=e.charCodeAt(0);return isNaN(t)&&(t=G),t}function ZD(){let e=J(arguments),t=Y.apply(void 0,e);if(t)return t;let n=0;for(;(n=e.indexOf(!0))>-1;)e[n]=`TRUE`;let r=0;for(;(r=e.indexOf(!1))>-1;)e[r]=`FALSE`;return e.join(``)}let QD=ZD;function $D(e,t=2){if(e=Z(e),isNaN(e))return G;e=zA(e,t);let n={style:`currency`,currency:`USD`,minimumFractionDigits:t>=0?t:0,maximumFractionDigits:t>=0?t:0},r=e.toLocaleString(`en-US`,n);return e<0?`$(`+r.slice(2)+`)`:r}function eO(e,t){return arguments.length===2?Y(e,t)||(e=dD(e),t=dD(t),e===t):q}function tO(e,t,n){if(arguments.length<2)return q;e=dD(e),t=dD(t),n=n===void 0?0:n;let r=t.indexOf(e,n-1);return r===-1?G:r+1}function nO(e,t=2,n=!1){if(e=Z(e),isNaN(e)||(t=Z(t),isNaN(t)))return G;if(t<0){let n=10**-t;e=Math.round(e/n)*n}else e=e.toFixed(t);if(n)e=e.toString().replace(/,/g,``);else{let t=e.toString().split(`.`);t[0]=t[0].replace(/\B(?=(\d{3})+$)/g,`,`),e=t.join(`.`)}return e}function rO(e,t){return Y(e,t)||(e=dD(e),t=t===void 0?1:t,t=Z(t),t instanceof Error||typeof e!=`string`?G:e.substring(0,t))}function iO(e){return arguments.length===0?CE:e instanceof Error?e:Array.isArray(e)?G:dD(e).length}function aO(e){return arguments.length===1?(e=dD(e),X(e)?e:e.toLowerCase()):G}function oO(e,t,n){if(X(e,t,n))return Y(e,t,n);let r=[t,n].map(e=>Z(e));if(!r.every(e=>!(e instanceof Error)&&e>0))return G;mD(e)?typeof e!=`string`&&(e=String(e)):e=``,[t,n]=r;let i=t-1,a=i+n;return e.substring(i,a)}function sO(e,t,n){return e=mD(e)?e:``,typeof e==`number`?e:typeof e==`string`?(t=t===void 0?`.`:t,n=n===void 0?`,`:n,Number(e.replace(t,`.`).replace(n,``))):q}function cO(e){return X(e)?e:isNaN(e)&&typeof e==`number`?G:(e=dD(e),e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()))}function lO(e,t,n,r){return t=Z(t),n=Z(n),X(t,n)||typeof e!=`string`||typeof r!=`string`?G:e.substr(0,t-1)+r+e.substr(t-1+n)}function uO(e,t){return Y(e,t)||(e=dD(e),t=Z(t),t instanceof Error?t:Array(t+1).join(e))}function dO(e,t){return Y(e,t)||(e=dD(e),t=t===void 0?1:t,t=Z(t),t instanceof Error?t:e.substring(e.length-t))}function fO(e,t,n){let r;return typeof e!=`string`||typeof t!=`string`?G:(n=n===void 0?0:n,r=t.toLowerCase().indexOf(e.toLowerCase(),n-1)+1,r===0?G:r)}function pO(e,t,n,r){if(arguments.length<3)return q;if(!e||!t)return e;if(r===void 0)return e.split(t).join(n);{if(r=Math.floor(Number(r)),Number.isNaN(r)||r<=0)return G;let i=0,a=0;for(;i>-1&&e.indexOf(t,i)>-1;)if(i=e.indexOf(t,i+1),a++,i>-1&&a===r)return e.substring(0,i)+n+e.substring(i+t.length);return e}}function mO(e){return e instanceof Error||typeof e==`string`?e:``}function hO(e,t){if(e===void 0||e instanceof Error||t instanceof Error)return q;if(e instanceof Date)return e.toISOString().slice(0,10);if(t==null)return``;if(typeof t==`number`)return String(t);if(typeof t!=`string`)return G;let n=t.startsWith(`$`)?`$`:``,r=t.endsWith(`%`);t=t.replace(/%/g,``).replace(/\$/g,``);let i=t.includes(`.`)?t.split(`.`)[1].match(/0/g).length:0,a=!t.includes(`,`);return r&&(e*=100),e=nO(e,i,a),e.startsWith(`-`)?(e=e.replace(`-`,``),e=`-`+n+e):e=n+e,r&&(e+=`%`),e}function gO(e,t,...n){if(typeof t!=`boolean`&&(t=cD(t)),arguments.length<3)return q;e??=``;let r=J(n),i=t?r.filter(e=>e):r;if(Array.isArray(e)){e=J(e);let t=i.map(e=>[e]),n=0;for(let r=0;r<t.length-1;r++)t[r].push(e[n]),n++,n===e.length&&(n=0);return i=J(t),i.join(``)}return i.join(e)}function _O(e){return e=dD(e),e instanceof Error?e:e.replace(/\s+/g,` `).trim()}let vO=JD,yO=XD;function bO(e){return e=dD(e),e instanceof Error?e:e.toUpperCase()}function xO(e){let t=Y(e);if(t)return t;if(typeof e==`number`)return e;if(mD(e)||(e=``),typeof e!=`string`)return G;let n=/(%)$/.test(e)||/^(%)/.test(e);if(e=e.replace(/^[^0-9-]{0,3}/,``),e=e.replace(/[^0-9]{0,3}$/,``),e=e.replace(/[ ,]/g,``),e===``)return 0;let r=Number(e);return isNaN(r)?G:(r||=0,n&&(r*=.01),r)}function SO(){let e=J(arguments).filter(mD);if(e.length===0)return K;let t=Q(e);return t instanceof Error?t:W.default.sum((0,W.default)(t).subtract(W.default.mean(t)).abs()[0])/t.length}function CO(){let e=J(arguments).filter(mD);if(e.length===0)return bE;let t=Y.apply(void 0,e);if(t)return t;let n=sD(e),r=n.length,i=0,a=0,o;for(let e=0;e<r;e++)i+=n[e],a+=1;return o=i/a,isNaN(o)&&(o=K),o}function wO(){let e=J(arguments).filter(mD);if(e.length===0)return bE;let t=Y.apply(void 0,e);if(t)return t;let n=e,r=n.length,i=0,a=0,o;for(let e=0;e<r;e++){let t=n[e];typeof t==`number`&&(i+=t),t===!0&&i++,t!==null&&a++}return o=i/a,isNaN(o)&&(o=K),o}function TO(e,t,n){if(arguments.length<=1)return q;if(n||=e,n=Q(J(n).filter(mD)),e=J(e),n instanceof Error)return n;let r=0,i=0,a=t===void 0||t===`*`,o=a?null:GE(t+``);for(let t=0;t<e.length;t++){let s=e[t];if(a)i+=n[t],r++;else{let e=[zE(s,RE)].concat(o);KE(e)&&(i+=n[t],r++)}}return i/r}function EO(){let e=pD(...arguments),t=e.reduce((e,t)=>e+t,0)/e.length;return isNaN(t)?0:t}let DO={};DO.DIST=function(e,t,n,r,i,a){return arguments.length<4||(i=i===void 0?0:i,a=a===void 0?1:a,e=Z(e),t=Z(t),n=Z(n),i=Z(i),a=Z(a),X(e,t,n,i,a))?G:(e=(e-i)/(a-i),r?W.default.beta.cdf(e,t,n):W.default.beta.pdf(e,t,n))},DO.INV=(e,t,n,r,i)=>(r=r===void 0?0:r,i=i===void 0?1:i,e=Z(e),t=Z(t),n=Z(n),r=Z(r),i=Z(i),X(e,t,n,r,i)?G:W.default.beta.inv(e,t,n)*(i-r)+r);let OO={};OO.DIST=(e,t,n,r)=>(e=Z(e),t=Z(t),n=Z(n),r=Z(r),X(e,t,n,r)?G:r?W.default.binomial.cdf(e,t,n):W.default.binomial.pdf(e,t,n)),OO.DIST.RANGE=(e,t,n,r)=>{if(r=r===void 0?n:r,e=Z(e),t=Z(t),n=Z(n),r=Z(r),X(e,t,n,r))return G;let i=0;for(let a=n;a<=r;a++)i+=tA(e,a)*t**+a*(1-t)**(e-a);return i},OO.INV=(e,t,n)=>{if(e=Z(e),t=Z(t),n=Z(n),X(e,t,n))return G;let r=0;for(;r<=e;){if(W.default.binomial.cdf(r,e,t)>=n)return r;r++}};let kO={};kO.DIST=(e,t,n)=>(e=Z(e),t=Z(t),X(e,t)?G:n?W.default.chisquare.cdf(e,t):W.default.chisquare.pdf(e,t)),kO.DIST.RT=(e,t)=>!e|!t?q:e<1||t>10**10?K:typeof e!=`number`||typeof t!=`number`?G:1-W.default.chisquare.cdf(e,t),kO.INV=(e,t)=>(e=Z(e),t=Z(t),X(e,t)?G:W.default.chisquare.inv(e,t)),kO.INV.RT=(e,t)=>!e|!t?q:e<0||e>1||t<1||t>10**10?K:typeof e!=`number`||typeof t!=`number`?G:W.default.chisquare.inv(1-e,t),kO.TEST=function(e,t){if(arguments.length!==2)return q;if(!(e instanceof Array)||!(t instanceof Array)||e.length!==t.length||e[0]&&t[0]&&e[0].length!==t[0].length)return G;let n=e.length,r,i,a;for(i=0;i<n;i++)e[i]instanceof Array||(r=e[i],e[i]=[],e[i].push(r)),t[i]instanceof Array||(r=t[i],t[i]=[],t[i].push(r));let o=e[0].length,s=o===1?n-1:(n-1)*(o-1),c=0,l=Math.PI;for(i=0;i<n;i++)for(a=0;a<o;a++)c+=(e[i][a]-t[i][a])**2/t[i][a];function u(e,t){let n=Math.exp(-.5*e);t%2==1&&(n*=Math.sqrt(2*e/l));let r=t;for(;r>=2;)n=n*e/r,r-=2;let i=n,a=t;for(;i>1e-10*n;)a+=2,i=i*e/a,n+=i;return 1-n}return Math.round(u(c,s)*1e6)/1e6};let AO={};AO.NORM=(e,t,n)=>(e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?G:W.default.normalci(1,e,t,n)[1]-1),AO.T=(e,t,n)=>(e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?G:W.default.tci(1,e,t,n)[1]-1);function jO(e,t){return e=Q(J(e)),t=Q(J(t)),X(e,t)?G:W.default.corrcoeff(e,t)}function MO(){return sD(J(arguments)).length}function NO(){let e=J(arguments);return e.length-PO(e)}function PO(){let e=J(arguments),t=0,n;for(let r=0;r<e.length;r++)n=e[r],(n==null||n===``)&&t++;return t}function FO(e,t){if(e=J(e),t===void 0||t===`*`)return e.length;let n=0,r=GE(t+``);for(let t=0;t<e.length;t++){let i=e[t],a=[zE(i,RE)].concat(r);KE(a)&&n++}return n}function IO(){let e=qE(arguments),t=Array(J(e[0]).length);for(let e=0;e<t.length;e++)t[e]=!0;for(let n=0;n<e.length;n+=2){let r=J(e[n]),i=e[n+1];if(i!==void 0&&i!==`*`){let e=GE(i+``);for(let n=0;n<r.length;n++){let i=r[n],a=[zE(i,RE)].concat(e);t[n]=t[n]&&KE(a)}}}let n=0;for(let e=0;e<t.length;e++)t[e]&&n++;return n}let LO={};LO.P=(e,t)=>{if(e=Q(J(e)),t=Q(J(t)),X(e,t))return G;let n=W.default.mean(e),r=W.default.mean(t),i=0,a=e.length;for(let o=0;o<a;o++)i+=(e[o]-n)*(t[o]-r);return i/a},LO.S=(e,t)=>(e=Q(J(e)),t=Q(J(t)),X(e,t)?G:W.default.covariance(e,t));function RO(){let e=Q(J(arguments));if(e instanceof Error)return e;let t=W.default.mean(e),n=0;for(let r=0;r<e.length;r++)n+=(e[r]-t)**2;return n}let zO={};zO.DIST=(e,t,n)=>(e=Z(e),t=Z(t),X(e,t)?G:n?W.default.exponential.cdf(e,t):W.default.exponential.pdf(e,t));let BO={};BO.DIST=(e,t,n,r)=>(e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?G:r?W.default.centralF.cdf(e,t,n):W.default.centralF.pdf(e,t,n)),BO.DIST.RT=function(e,t,n){return arguments.length===3?e<0||t<1||n<1?K:typeof e!=`number`||typeof t!=`number`||typeof n!=`number`?G:1-W.default.centralF.cdf(e,t,n):q},BO.INV=(e,t,n)=>(e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?G:e<=0||e>1?K:W.default.centralF.inv(e,t,n)),BO.INV.RT=function(e,t,n){return arguments.length===3?e<0||e>1||t<1||t>10**10||n<1||n>10**10?K:typeof e!=`number`||typeof t!=`number`||typeof n!=`number`?G:W.default.centralF.inv(1-e,t,n):q},BO.TEST=(e,t)=>{if(!e||!t||!(e instanceof Array)||!(t instanceof Array))return q;if(e.length<2||t.length<2)return bE;let n=(e,t)=>{let n=0;for(let r=0;r<e.length;r++)n+=(e[r]-t)**2;return n},r=ZA(e)/e.length,i=ZA(t)/t.length;return n(e,r)/(e.length-1)/(n(t,i)/(t.length-1))};function VO(e){return e=Z(e),e instanceof Error?e:Math.log((1+e)/(1-e))/2}function HO(e){if(e=Z(e),e instanceof Error)return e;let t=Math.exp(2*e);return(t-1)/(t+1)}function UO(e,t,n){if(e=Z(e),t=Q(J(t)),n=Q(J(n)),X(e,t,n))return G;let r=W.default.mean(n),i=W.default.mean(t),a=n.length,o=0,s=0;for(let e=0;e<a;e++)o+=(n[e]-r)*(t[e]-i),s+=(n[e]-r)**2;let c=o/s;return i-c*r+c*e}function WO(e,t){if(e=Q(J(e)),t=Q(J(t)),X(e,t))return G;let n=e.length,r=t.length,i=[];for(let a=0;a<=r;a++){i[a]=0;for(let o=0;o<n;o++)a===0?e[o]<=t[0]&&(i[0]+=1):a<r?e[o]>t[a-1]&&e[o]<=t[a]&&(i[a]+=1):a===r&&e[o]>t[r-1]&&(i[r]+=1)}return i}function GO(e){return e=Z(e),e instanceof Error?e:e===0||parseInt(e,10)===e&&e<0?K:W.default.gammafn(e)}GO.DIST=function(e,t,n,r){return arguments.length===4?e<0||t<=0||n<=0||typeof e!=`number`||typeof t!=`number`||typeof n!=`number`?G:r?W.default.gamma.cdf(e,t,n,!0):W.default.gamma.pdf(e,t,n,!1):q},GO.INV=function(e,t,n){return arguments.length===3?e<0||e>1||t<=0||n<=0?K:typeof e!=`number`||typeof t!=`number`||typeof n!=`number`?G:W.default.gamma.inv(e,t,n):q};function KO(e){return e=Z(e),e instanceof Error?e:W.default.gammaln(e)}KO.PRECISE=function(e){return arguments.length===1?e<=0?K:typeof e==`number`?W.default.gammaln(e):G:q};function qO(e){return e=Z(e),e instanceof Error?e:W.default.normal.cdf(e,0,1)-.5}function JO(){let e=Q(J(arguments));return e instanceof Error?e:W.default.geomean(e)}function YO(e,t,n,r){if(e=Q(J(e)),e instanceof Error)return e;let i;if(t===void 0)for(t=[],i=1;i<=e.length;i++)t.push(i);if(n===void 0&&(n=t),t=Q(J(t)),n=Q(J(n)),X(t,n))return G;r===void 0&&(r=!0);let a=e.length,o=0,s=0,c=0,l=0;for(i=0;i<a;i++){let n=t[i],r=Math.log(e[i]);o+=n,s+=r,c+=n*r,l+=n*n}o/=a,s/=a,c/=a,l/=a;let u,d;r?(u=(c-o*s)/(l-o*o),d=s-u*o):(u=c/l,d=0);let f=[];for(i=0;i<n.length;i++)f.push(Math.exp(d+u*n[i]));return f}function XO(){let e=Q(J(arguments));if(e instanceof Error)return e;let t=e.length,n=0;for(let r=0;r<t;r++)n+=1/e[r];return t/n}let ZO={};ZO.DIST=(e,t,n,r,i)=>{if(e=Z(e),t=Z(t),n=Z(n),r=Z(r),X(e,t,n,r))return G;function a(e,t,n,r){return tA(n,e)*tA(r-n,t-e)/tA(r,t)}function o(e,t,n,r){let i=0;for(let o=0;o<=e;o++)i+=a(o,t,n,r);return i}return i?o(e,t,n,r):a(e,t,n,r)};function QO(e,t){return e=Q(e),t=Q(t),X(e,t)?G:e.length===t.length?UO(0,e,t):q}function $O(){let e=Q(J(arguments));if(e instanceof Error)return e;let t=W.default.mean(e),n=e.length,r=0;for(let i=0;i<n;i++)r+=(e[i]-t)**4;return r/=W.default.stdev(e,!0)**4,n*(n+1)/((n-1)*(n-2)*(n-3))*r-3*(n-1)*(n-1)/((n-2)*(n-3))}function ek(e,t){return Y.apply(void 0,e)||(X(t)?t:(e=sD(J(e)),t=Z(t),t<0||e.length<t?G:e.sort((e,t)=>t-e)[t-1]))}function tk(e,t){if(e=Q(J(e)),t=Q(J(t)),X(e,t))return G;let n=W.default.mean(e),r=W.default.mean(t),i=t.length,a=0,o=0;for(let s=0;s<i;s++)a+=(t[s]-r)*(e[s]-n),o+=(t[s]-r)**2;let s=a/o;return[s,n-s*r]}function nk(e,t){if(e=Q(J(e)),t=Q(J(t)),X(e,t)||e.length!==t.length)return G;for(let t=0;t<e.length;t++)e[t]=Math.log(e[t]);let n=tk(e,t);return n[0]=Math.round(Math.exp(n[0])*1e6)/1e6,n[1]=Math.round(Math.exp(n[1])*1e6)/1e6,n}let rk={};rk.DIST=(e,t,n,r)=>(e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?G:r?W.default.lognormal.cdf(e,t,n):W.default.lognormal.pdf(e,t,n)),rk.INV=(e,t,n)=>(e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?G:W.default.lognormal.inv(e,t,n));function ik(){let e=J(arguments),t=Y.apply(void 0,e);if(t)return t;let n=sD(e);return n.length===0?0:Math.max.apply(Math,n)}function ak(){let e=J(arguments),t=Y.apply(void 0,e);if(t)return t;let n=YE(e);return n=n.map(e=>e??0),n.length===0?0:Math.max.apply(Math,n)}function ok(){let e=pD(...arguments);return e.length===0?0:Math.max.apply(Math,e)}function sk(){let e=J(arguments),t=Y.apply(void 0,e);if(t)return t;let n=YE(e),r=W.default.median(n);return isNaN(r)&&(r=K),r}function ck(){let e=J(arguments),t=Y.apply(void 0,e);if(t)return t;let n=sD(e);return n.length===0?0:Math.min.apply(Math,n)}function lk(){let e=J(arguments),t=Y.apply(void 0,e);if(t)return t;let n=YE(e);return n=n.map(e=>e??0),n.length===0?0:Math.min.apply(Math,n)}function uk(){let e=pD(...arguments);return e.length===0?0:Math.min.apply(Math,e)}let dk={};dk.MULT=function(){let e=Q(J(arguments));if(e instanceof Error)return e;let t=e.length,n={},r=[],i=0,a;for(let o=0;o<t;o++)a=e[o],n[a]=n[a]?n[a]+1:1,n[a]>i&&(i=n[a],r=[]),n[a]===i&&(r[r.length]=a);return r},dk.SNGL=function(){let e=Q(J(arguments));return e instanceof Error?e:dk.MULT(e).sort((e,t)=>e-t)[0]};let fk={};fk.DIST=(e,t,n,r)=>(e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?G:r?W.default.negbin.cdf(e,t,n):W.default.negbin.pdf(e,t,n));let pk={};pk.DIST=(e,t,n,r)=>(e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?G:n<=0?K:r?W.default.normal.cdf(e,t,n):W.default.normal.pdf(e,t,n)),pk.INV=(e,t,n)=>(e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?G:W.default.normal.inv(e,t,n)),pk.S={},pk.S.DIST=(e,t)=>(e=Z(e),e instanceof Error?G:t?W.default.normal.cdf(e,0,1):W.default.normal.pdf(e,0,1)),pk.S.INV=e=>(e=Z(e),e instanceof Error?G:W.default.normal.inv(e,0,1));function mk(e,t){if(t=Q(J(t)),e=Q(J(e)),X(t,e))return G;let n=W.default.mean(e),r=W.default.mean(t),i=e.length,a=0,o=0,s=0;for(let c=0;c<i;c++)a+=(e[c]-n)*(t[c]-r),o+=(e[c]-n)**2,s+=(t[c]-r)**2;return a/Math.sqrt(o*s)}let hk={};hk.EXC=(e,t)=>{if(e=Q(J(e)),t=Z(t),X(e,t))return G;e=e.sort((e,t)=>e-t);let n=e.length;if(t<1/(n+1)||t>1-1/(n+1))return K;let r=t*(n+1)-1,i=Math.floor(r);return oD(r===i?e[r]:e[i]+(r-i)*(e[i+1]-e[i]))},hk.INC=(e,t)=>{if(e=Q(J(e)),t=Z(t),X(e,t))return G;e=e.sort((e,t)=>e-t);let n=e.length,r=t*(n-1),i=Math.floor(r);return oD(r===i?e[r]:e[i]+(r-i)*(e[i+1]-e[i]))};let gk={};gk.EXC=(e,t,n)=>{if(n=n===void 0?3:n,e=Q(J(e)),t=Z(t),n=Z(n),X(e,t,n))return G;e=e.sort((e,t)=>e-t);let r=WD.apply(null,e),i=e.length,a=r.length,o=10**n,s=0,c=!1,l=0;for(;!c&&l<a;)t===r[l]?(s=(e.indexOf(r[l])+1)/(i+1),c=!0):t>=r[l]&&(t<r[l+1]||l===a-1)&&(s=(e.indexOf(r[l])+1+(t-r[l])/(r[l+1]-r[l]))/(i+1),c=!0),l++;return Math.floor(s*o)/o},gk.INC=(e,t,n)=>{if(n=n===void 0?3:n,e=Q(J(e)),t=Z(t),n=Z(n),X(e,t,n))return G;e=e.sort((e,t)=>e-t);let r=WD.apply(null,e),i=e.length,a=r.length,o=10**n,s=0,c=!1,l=0;for(;!c&&l<a;)t===r[l]?(s=e.indexOf(r[l])/(i-1),c=!0):t>=r[l]&&(t<r[l+1]||l===a-1)&&(s=(e.indexOf(r[l])+(t-r[l])/(r[l+1]-r[l]))/(i-1),c=!0),l++;return Math.floor(s*o)/o};function _k(e,t){return e=Z(e),t=Z(t),X(e,t)?G:mA(e)/mA(e-t)}function vk(e,t){return e=Z(e),t=Z(t),X(e,t)?G:e**+t}function yk(e){return e=Z(e),e instanceof Error?G:Math.exp(-.5*e*e)/2.5066282746310002}let bk={};bk.DIST=(e,t,n)=>(e=Z(e),t=Z(t),X(e,t)?G:n?W.default.poisson.cdf(e,t):W.default.poisson.pdf(e,t));function xk(e,t,n,r){if(n===void 0)return 0;if(r=r===void 0?n:r,e=Q(J(e)),t=Q(J(t)),n=Z(n),r=Z(r),X(e,t,n,r))return G;if(n===r)return e.indexOf(n)>=0?t[e.indexOf(n)]:0;let i=e.sort((e,t)=>e-t),a=i.length,o=0;for(let s=0;s<a;s++)i[s]>=n&&i[s]<=r&&(o+=t[e.indexOf(i[s])]);return o}let Sk={};Sk.EXC=(e,t)=>{if(e=Q(sD(J(e))),t=Z(t),X(e,t))return G;switch(t){case 1:return hk.EXC(e,.25);case 2:return hk.EXC(e,.5);case 3:return hk.EXC(e,.75);default:return K}},Sk.INC=(e,t)=>{if(e=Q(sD(J(e))),t=Z(t),X(e,t))return G;switch(t){case 1:return hk.INC(e,.25);case 2:return hk.INC(e,.5);case 3:return hk.INC(e,.75);default:return K}};let Ck={};Ck.AVG=(e,t,n)=>{if(e=Z(e),t=Q(J(t)),X(e,t))return G;t=J(t),n||=!1;let r=n?(e,t)=>e-t:(e,t)=>t-e;t=t.sort(r);let i=t.length,a=0;for(let n=0;n<i;n++)t[n]===e&&a++;return a>1?(2*t.indexOf(e)+a+1)/2:t.indexOf(e)+1},Ck.EQ=(e,t,n)=>{if(e=Z(e),t=Q(J(t)),X(e,t))return G;n||=!1;let r=n?(e,t)=>e-t:(e,t)=>t-e;return t=t.sort(r),t.indexOf(e)+1};function wk(e,t){if(arguments.length!==2)return q;if(t<0)return K;if(!(e instanceof Array)||typeof t!=`number`)return G;if(e.length!==0)return W.default.row(e,t)}function Tk(e,t){return e=Q(J(e)),t=Q(J(t)),X(e,t)?G:mk(e,t)**2}function Ek(){let e=Q(J(arguments));if(e instanceof Error)return e;let t=W.default.mean(e),n=e.length,r=0;for(let i=0;i<n;i++)r+=(e[i]-t)**3;return n*r/((n-1)*(n-2)*W.default.stdev(e,!0)**3)}Ek.P=function(){let e=Q(J(arguments));if(e instanceof Error)return e;let t=W.default.mean(e),n=e.length,r=0,i=0;for(let a=0;a<n;a++)i+=(e[a]-t)**3,r+=(e[a]-t)**2;return i/=n,r/=n,i/r**(3/2)};function Dk(e,t){if(e=Q(J(e)),t=Q(J(t)),X(e,t))return G;let n=W.default.mean(t),r=W.default.mean(e),i=t.length,a=0,o=0;for(let s=0;s<i;s++)a+=(t[s]-n)*(e[s]-r),o+=(t[s]-n)**2;return a/o}function Ok(e,t){return e=Q(J(e)),t=Z(t),X(e,t)?e:e.sort((e,t)=>e-t)[t-1]}function kk(e,t,n){return e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?G:(e-t)/n}let Ak={};Ak.P=function(){let e=Ik.P.apply(this,arguments),t=Math.sqrt(e);return isNaN(t)&&(t=K),t},Ak.S=function(){let e=Ik.S.apply(this,arguments);return Math.sqrt(e)};function jk(){let e=Lk.apply(this,arguments);return Math.sqrt(e)}function Mk(){let e=Rk.apply(this,arguments),t=Math.sqrt(e);return isNaN(t)&&(t=K),t}function Nk(e,t){if(e=Q(J(e)),t=Q(J(t)),X(e,t))return G;let n=W.default.mean(t),r=W.default.mean(e),i=t.length,a=0,o=0,s=0;for(let c=0;c<i;c++)a+=(e[c]-r)**2,o+=(t[c]-n)*(e[c]-r),s+=(t[c]-n)**2;return Math.sqrt((a-o*o/s)/(i-2))}mO.DIST=(e,t,n)=>n!==1&&n!==2?K:n===1?mO.DIST.RT(e,t):mO.DIST[`2T`](e,t),mO.DIST[`2T`]=function(e,t){return arguments.length===2?e<0||t<1?K:typeof e!=`number`||typeof t!=`number`?G:(1-W.default.studentt.cdf(e,t))*2:q},mO.DIST.RT=function(e,t){return arguments.length===2?e<0||t<1?K:typeof e!=`number`||typeof t!=`number`?G:1-W.default.studentt.cdf(e,t):q},mO.INV=(e,t)=>(e=Z(e),t=Z(t),X(e,t)?G:W.default.studentt.inv(e,t)),mO.INV[`2T`]=(e,t)=>(e=Z(e),t=Z(t),e<=0||e>1||t<1?K:X(e,t)?G:Math.abs(W.default.studentt.inv(e/2,t))),mO.TEST=(e,t)=>{if(e=Q(J(e)),t=Q(J(t)),X(e,t))return G;let n=W.default.mean(e),r=W.default.mean(t),i=0,a=0,o=0;for(;o<e.length;o++)i+=(e[o]-n)**2;for(o=0;o<t.length;o++)a+=(t[o]-r)**2;i/=e.length-1,a/=t.length-1;let s=Math.abs(n-r)/Math.sqrt(i/e.length+a/t.length);return mO.DIST[`2T`](s,e.length+t.length-2)};function Pk(e,t,n){if(e=Q(J(e)),t=Q(J(t)),n=Q(J(n)),X(e,t,n))return G;let r=tk(e,t),i=r[0],a=r[1],o=[];return n.forEach(e=>{o.push(i*e+a)}),o}function Fk(e,t){if(e=Q(J(e)),t=Z(t),X(e,t))return G;let n=gA(e.length*t,2)/2;return W.default.mean(eD(rD(e.sort((e,t)=>e-t),n),n))}let Ik={};Ik.P=function(){let e=sD(J(arguments)),t=e.length,n=0,r=CO(e),i;for(let i=0;i<t;i++)n+=(e[i]-r)**2;return i=n/t,isNaN(i)&&(i=K),i},Ik.S=function(){let e=sD(J(arguments)),t=e.length,n=0,r=CO(e);for(let i=0;i<t;i++)n+=(e[i]-r)**2;return n/(t-1)};function Lk(){let e=J(arguments),t=e.length,n=0,r=0,i=wO(e);for(let a=0;a<t;a++){let t=e[a];n+=typeof t==`number`?(t-i)**2:t===!0?(1-i)**2:(0-i)**2,t!==null&&r++}return n/(r-1)}function Rk(){let e=J(arguments),t=e.length,n=0,r=0,i=wO(e),a;for(let a=0;a<t;a++){let t=e[a];n+=typeof t==`number`?(t-i)**2:t===!0?(1-i)**2:(0-i)**2,t!==null&&r++}return a=n/r,isNaN(a)&&(a=K),a}let zk={};zk.DIST=(e,t,n,r)=>(e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?G:r?1-Math.exp(-((e/n)**+t)):e**(t-1)*Math.exp(-((e/n)**+t))*t/n**+t);let Bk={};Bk.TEST=(e,t,n)=>{if(e=Q(J(e)),t=Z(t),X(e,t))return G;n||=Ak.S(e);let r=e.length;return 1-pk.S.DIST((CO(e)-t)/(n/Math.sqrt(r)),!0)};function Vk(e){return e=Z(e),e instanceof Error?e:Math.abs(e)}function Hk(e){if(e=Z(e),e instanceof Error)return e;let t=Math.acos(e);return isNaN(t)&&(t=K),t}function Uk(e){if(e=Z(e),e instanceof Error)return e;let t=Math.log(e+Math.sqrt(e*e-1));return isNaN(t)&&(t=K),t}function Wk(e){return e=Z(e),e instanceof Error?e:Math.atan(1/e)}function Gk(e){if(e=Z(e),e instanceof Error)return e;let t=.5*Math.log((e+1)/(e-1));return isNaN(t)&&(t=K),t}function Kk(e,t,n,r){if(e=Z(e),t=Z(e),X(e,t))return G;switch(e){case 1:return CO(n);case 2:return MO(n);case 3:return NO(n);case 4:return ik(n);case 5:return ck(n);case 6:return MA(n);case 7:return Ak.S(n);case 8:return Ak.P(n);case 9:return ZA(n);case 10:return Ik.S(n);case 11:return Ik.P(n);case 12:return sk(n);case 13:return dk.SNGL(n);case 14:return ek(n,r);case 15:return Ok(n,r);case 16:return hk.INC(n,r);case 17:return Sk.INC(n,r);case 18:return hk.EXC(n,r);case 19:return Sk.EXC(n,r)}}function qk(e){if(e==null)return 0;if(e instanceof Error)return e;if(!/^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/.test(e))return G;let t=0;return e.replace(/[MDLV]|C[MD]?|X[CL]?|I[XV]?/g,e=>{t+={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1}[e]}),t}function Jk(e){if(e=Z(e),e instanceof Error)return e;let t=Math.asin(e);return isNaN(t)&&(t=K),t}function Yk(e){return e=Z(e),e instanceof Error?e:Math.log(e+Math.sqrt(e*e+1))}function Xk(e){return e=Z(e),e instanceof Error?e:Math.atan(e)}function Zk(e,t){return e=Z(e),t=Z(t),Y(e,t)||Math.atan2(e,t)}function Qk(e){if(e=Z(e),e instanceof Error)return e;let t=Math.log((1+e)/(1-e))/2;return isNaN(t)&&(t=K),t}function $k(e,t,n){e=Z(e),t=Z(t),n=Z(n);let r=Y(e,t,n);if(r)return r;if(t===0)return K;let i=e.toString(t);return Array(Math.max(n+1-i.length,0)).join(`0`)+i}function eA(e,t){return e=Z(e),t=Z(t),Y(e,t)||(t===0?0:e>0&&t<0?K:Math.ceil(e/t)*t)}eA.MATH=(e,t,n=0)=>(t===void 0&&(t=e>0?1:-1),e=Z(e),t=Z(t),n=Z(n),Y(e,t,n)||(t===0?0:(t=Math.abs(t),n===0||e>0?Math.ceil(e/t)*t:Math.floor(e/t)*t))),eA.PRECISE=(e,t)=>eA.MATH(e,t);function tA(e,t){return e=Z(e),t=Z(t),Y(e,t)||(e<t?K:mA(e)/(mA(t)*mA(e-t)))}function nA(e,t){return e=Z(e),t=Z(t),Y(e,t)||(e<t?K:e===0&&t===0?1:tA(e+t-1,e-1))}function rA(e){return e=Z(e),e instanceof Error?e:Math.cos(e)}function iA(e){return e=Z(e),e instanceof Error?e:(Math.exp(e)+Math.exp(-e))/2}function aA(e){return e=Z(e),e instanceof Error?e:e===0?bE:1/Math.tan(e)}function oA(e){if(e=Z(e),e instanceof Error)return e;if(e===0)return bE;let t=Math.exp(2*e);return(t+1)/(t-1)}function sA(e){return e=Z(e),e instanceof Error?e:e===0?bE:1/Math.sin(e)}function cA(e){return e=Z(e),e instanceof Error?e:e===0?bE:2/(Math.exp(e)-Math.exp(-e))}function lA(e,t){if(arguments.length<2)return q;e||=`0`,t=Z(t);let n=Y(e,t);if(n)return n;if(t===0)return K;let r=parseInt(e,t);return isNaN(r)?K:r}function uA(e){return e=Z(e),e instanceof Error?e:e*180/Math.PI}function dA(e){return e=Z(e),e instanceof Error?e:eA.MATH(e,-2,-1)}function fA(e){return arguments.length<1?q:arguments.length>1?CE:(e=Z(e),e instanceof Error||(e=Math.exp(e)),e)}let pA=[];function mA(e){if(e=Z(e),e instanceof Error)return e;let t=Math.floor(e);return t===0||t===1?1:(pA[t]>0||(pA[t]=mA(t-1)*t),pA[t])}function hA(e){if(e=Z(e),e instanceof Error)return e;let t=Math.floor(e);return t<=0?1:t*hA(t-2)}function gA(e,t){return e=Z(e),t=Z(t),Y(e,t)||(t?e>0&&t<0?K:Math.floor(e/t)*t:bE)}gA.MATH=(e,t=1,n=0)=>(e=Z(e),t=Z(t),n=Z(n),Y(e,t,n)||(t===0?0:(t=Math.abs(t),n===0||e>0?Math.floor(e/t)*t:Math.ceil(e/t)*t))),gA.PRECISE=(e,t)=>gA.MATH(e,t);function _A(){let e=Q(J(arguments));if(e instanceof Error)return e;let t=e.length,n=e[0],r=n<0?-n:n;for(let n=1;n<t;n++){let t=e[n],i=t<0?-t:t;for(;r&&i;)r>i?r%=i:i%=r;r+=i}return r}function vA(e){return e=Z(e),e instanceof Error?e:Math.floor(e)}let yA={CEILING:eA};function bA(){let e=Q(J(arguments));if(e instanceof Error)return e;for(var t,n,r,i,a=1;(r=e.pop())!==void 0;){if(r===0)return 0;for(;r>1;){if(r%2){for(t=3,n=Math.floor(Math.sqrt(r));t<=n&&r%t;t+=2);i=t<=n?t:r}else i=2;for(r/=i,a*=i,t=e.length;t;e[--t]%i===0&&(e[t]/=i)===1&&e.splice(t,1));}}return a}function xA(e){return e=Z(e),e instanceof Error?e:e===0?K:Math.log(e)}function SA(e,t){return e=Z(e),t=t?Z(t):10,Y(e,t)||(e===0||t===0?K:Math.log(e)/Math.log(t))}function CA(e){return e=Z(e),e instanceof Error?e:e===0?K:Math.log(e)/Math.log(10)}function wA(e,t){return!Array.isArray(e)||!Array.isArray(t)||e.some(e=>!e.length)||t.some(e=>!e.length)||$E(e).some(e=>typeof e!=`number`)||$E(t).some(e=>typeof e!=`number`)||e[0].length!==t.length?G:Array(e.length).fill(0).map(()=>Array(t[0].length).fill(0)).map((n,r)=>n.map((n,i)=>e[r].reduce((e,n,r)=>e+n*t[r][i],0)))}function TA(e,t){e=Z(e),t=Z(t);let n=Y(e,t);if(n)return n;if(t===0)return bE;let r=Math.abs(e%t);return r=e<0?t-r:r,t>0?r:-r}function EA(e,t){return e=Z(e),t=Z(t),Y(e,t)||(e*t===0?0:e*t<0?K:Math.round(e/t)*t)}function DA(){let e=Q(J(arguments));if(e instanceof Error)return e;let t=0,n=1;for(let r=0;r<e.length;r++)t+=e[r],n*=mA(e[r]);return mA(t)/n}function OA(e){return arguments.length>1?q:(e=parseInt(e),!e||e<=0?G:Array(e).fill(0).map(()=>Array(e).fill(0)).map((e,t)=>(e[t]=1,e)))}function kA(e){if(e=Z(e),e instanceof Error)return e;let t=Math.ceil(Math.abs(e));return t=t&1?t:t+1,e>=0?t:-t}function AA(){return Math.PI}function jA(e,t){e=Z(e),t=Z(t);let n=Y(e,t);if(n)return n;if(e===0&&t===0)return K;let r=e**+t;return isNaN(r)?K:r}function MA(){let e=J(arguments).filter(e=>e!=null);if(e.length===0)return 0;let t=Q(e);if(t instanceof Error)return t;let n=1;for(let e=0;e<t.length;e++)n*=t[e];return n}function NA(e,t){return e=Z(e),t=Z(t),Y(e,t)||parseInt(e/t,10)}function PA(e){return e=Z(e),e instanceof Error?e:e*Math.PI/180}function FA(){return Math.random()}function IA(e,t){return e=Z(e),t=Z(t),Y(e,t)||e+Math.ceil((t-e+1)*Math.random())-1}function LA(e){if(e=Z(e),e instanceof Error)return e;let t=String(e).split(``),n=/* @__PURE__ */ `.C.CC.CCC.CD.D.DC.DCC.DCCC.CM..X.XX.XXX.XL.L.LX.LXX.LXXX.XC..I.II.III.IV.V.VI.VII.VIII.IX`.split(`.`),r=``,i=3;for(;i--;)r=(n[+t.pop()+i*10]||``)+r;return Array(+t.join(``)+1).join(`M`)+r}function RA(e,t,n){e=Z(e),t=Z(t);let r=Y(e,t);if(r)return r;let i=e>=0?1:-1,a=(Math.abs(e)+`e`+t).split(`e`);return a=(n(a[0]+`e`+a[1])+`e`+-t).split(`e`),Number(a[0]+`e`+a[1])*i}function zA(e,t){return RA(e,t,Math.round)}function BA(e,t){return RA(e,t,Math.floor)}function VA(e,t){return RA(e,t,Math.ceil)}function HA(e){return e=Z(e),e instanceof Error?e:1/Math.cos(e)}function UA(e){return e=Z(e),e instanceof Error?e:2/(Math.exp(e)+Math.exp(-e))}function WA(e,t,n,r){if(e=Z(e),t=Z(t),n=Z(n),r=Q(r),X(e,t,n,r))return G;let i=r[0]*e**+t;for(let a=1;a<r.length;a++)i+=r[a]*e**+(t+a*n);return i}function GA(e){return e=Z(e),e instanceof Error?e:e<0?-1:e===0?0:1}function KA(e){return e=Z(e),e instanceof Error?e:Math.sin(e)}function qA(e){return e=Z(e),e instanceof Error?e:(Math.exp(e)-Math.exp(-e))/2}function JA(e){return e=Z(e),e instanceof Error?e:e<0?K:Math.sqrt(e)}function YA(e){return e=Z(e),e instanceof Error?e:Math.sqrt(e*Math.PI)}function XA(e,t){if(e=Z(e),e instanceof Error)return e;switch(e){case 1:return CO(t);case 2:return MO(t);case 3:return NO(t);case 4:return ik(t);case 5:return ck(t);case 6:return MA(t);case 7:return Ak.S(t);case 8:return Ak.P(t);case 9:return ZA(t);case 10:return Ik.S(t);case 11:return Ik.P(t);case 101:return CO(t);case 102:return MO(t);case 103:return NO(t);case 104:return ik(t);case 105:return ck(t);case 106:return MA(t);case 107:return Ak.S(t);case 108:return Ak.P(t);case 109:return ZA(t);case 110:return Ik.S(t);case 111:return Ik.P(t)}}function ZA(){let e=0;return JE(qE(arguments),t=>{if(e instanceof Error)return!1;if(t instanceof Error)e=t;else if(typeof t==`number`)e+=t;else if(typeof t==`string`){let n=parseFloat(t);!isNaN(n)&&(e+=n)}else if(Array.isArray(t)){let n=ZA.apply(null,t);n instanceof Error?e=n:e+=n}}),e}function QA(e,t,n){if(e=J(e),n=n?J(n):e,e instanceof Error)return e;if(t==null||t instanceof Error)return 0;let r=0,i=t===`*`,a=i?null:GE(t+``);for(let t=0;t<e.length;t++){let o=e[t],s=n[t];if(i)r+=o;else{let e=[zE(o,RE)].concat(a);r+=KE(e)?s:0}}return r}function $A(){let e=qE(arguments);return e[0]=YE(J(e[0])),ZA(pD(...e))}function ej(){if(!arguments||arguments.length===0)return G;let e=arguments.length+1,t=0,n,r,i,a;for(let o=0;o<arguments[0].length;o++)if(arguments[0][o]instanceof Array)for(let i=0;i<arguments[0][o].length;i++){for(n=1,r=1;r<e;r++){let e=arguments[r-1][o][i];if(e instanceof Error)return e;if(a=Z(e),a instanceof Error)return a;n*=a}t+=n}else{for(n=1,r=1;r<e;r++){let e=arguments[r-1][o];if(e instanceof Error)return e;if(i=Z(e),i instanceof Error)return i;n*=i}t+=n}return t}function tj(){let e=Q(J(arguments));if(e instanceof Error)return e;let t=0,n=e.length;for(let r=0;r<n;r++)t+=CD(e[r])?e[r]*e[r]:0;return t}function nj(e,t){if(e=Q(J(e)),t=Q(J(t)),X(e,t))return G;let n=0;for(let r=0;r<e.length;r++)n+=e[r]*e[r]-t[r]*t[r];return n}function rj(e,t){if(e=Q(J(e)),t=Q(J(t)),X(e,t))return G;let n=0;e=Q(J(e)),t=Q(J(t));for(let r=0;r<e.length;r++)n+=e[r]*e[r]+t[r]*t[r];return n}function ij(e,t){if(e=Q(J(e)),t=Q(J(t)),X(e,t))return G;let n=0;e=J(e),t=J(t);for(let r=0;r<e.length;r++)n+=(e[r]-t[r])**2;return n}function aj(e){return e=Z(e),e instanceof Error?e:Math.tan(e)}function oj(e){if(e=Z(e),e instanceof Error)return e;let t=Math.exp(2*e);return(t-1)/(t+1)}function sj(e,t){return e=Z(e),t=Z(t),Y(e,t)||(e>0?1:-1)*Math.floor(Math.abs(e)*10**t)/10**t}function cj(e,t){return arguments.length===2?(e=Z(e),t=Z(t),Y(e,t)||e+t):q}function lj(e,t){return arguments.length===2?(e=Z(e),t=Z(t),Y(e,t)||(t===0?bE:e/t)):q}function uj(e,t){return arguments.length===2?e instanceof Error?e:t instanceof Error?t:(e===null&&(e=void 0),t===null&&(t=void 0),e===t):q}function dj(e,t){return arguments.length===2?e instanceof Error?e:t instanceof Error?t:(fD(e,t)?(e=dD(e),t=dD(t)):(e=Z(e),t=Z(t)),Y(e,t)||e>t):q}function fj(e,t){return arguments.length===2?(fD(e,t)?(e=dD(e),t=dD(t)):(e=Z(e),t=Z(t)),Y(e,t)||e>=t):q}function pj(e,t){return arguments.length===2?(fD(e,t)?(e=dD(e),t=dD(t)):(e=Z(e),t=Z(t)),Y(e,t)||e<t):q}function mj(e,t){return arguments.length===2?(fD(e,t)?(e=dD(e),t=dD(t)):(e=Z(e),t=Z(t)),Y(e,t)||e<=t):q}function hj(e,t){return arguments.length===2?(e=Z(e),t=Z(t),Y(e,t)||e-t):q}function gj(e,t){return arguments.length===2?(e=Z(e),t=Z(t),Y(e,t)||e*t):q}function _j(e,t){return arguments.length===2?e instanceof Error?e:t instanceof Error?t:(e===null&&(e=void 0),t===null&&(t=void 0),e!==t):q}function vj(e,t){return arguments.length===2?jA(e,t):q}var yj=/*#__PURE__*/ Object.freeze({__proto__:null,ADD:cj,DIVIDE:lj,EQ:uj,GT:dj,GTE:fj,LT:pj,LTE:mj,MINUS:hj,MULTIPLY:gj,NE:_j,POW:vj});let bj=[void 0,0,1,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,1,2,3,4,5,6,0],xj=[[],[1,2,3,4,5,6,7],[7,1,2,3,4,5,6],[6,0,1,2,3,4,5],[],[],[],[],[],[],[],[7,1,2,3,4,5,6],[6,7,1,2,3,4,5],[5,6,7,1,2,3,4],[4,5,6,7,1,2,3],[3,4,5,6,7,1,2],[2,3,4,5,6,7,1],[1,2,3,4,5,6,7]],Sj=[[],[6,0],[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],void 0,void 0,void 0,[0,0],[1,1],[2,2],[3,3],[4,4],[5,5],[6,6]];function Cj(e,t,n){let r;return e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?r=G:(r=new Date(e,t-1,n),r.getFullYear()<0&&(r=K)),DE?jE(r):r}function wj(e,t,n){n=n.toUpperCase(),e=lD(e),t=lD(t);let r=e.getFullYear(),i=e.getMonth(),a=e.getDate(),o=t.getFullYear(),s=t.getMonth(),c=t.getDate(),l;switch(n){case`Y`:l=Math.floor(Jj(e,t));break;case`D`:l=Oj(t,e);break;case`M`:l=s-i+12*(o-r),c<a&&l--;break;case`MD`:a<=c?l=c-a:(s===0?(e.setFullYear(o-1),e.setMonth(12)):(e.setFullYear(o),e.setMonth(s-1)),l=Oj(t,e));break;case`YM`:l=s-i+12*(o-r),c<a&&l--,l%=12;break;case`YD`:s>i||s===i&&c<a?e.setFullYear(o):e.setFullYear(o-1),l=Oj(t,e)}return l}function Tj(e){if(typeof e!=`string`||isNaN(Date.parse(e)))return G;let t=new Date(e);return DE?jE(t):t}function Ej(e){let t=lD(e);return t instanceof Error?t:t.getDate()}function Dj(e){let t=new Date(e);return t.setHours(0,0,0,0),t}function Oj(e,t){return e=lD(e),t=lD(t),e instanceof Error?e:t instanceof Error?t:jE(Dj(e))-jE(Dj(t))}function kj(e,t,n){if(n=cD(n||`false`),e=lD(e),t=lD(t),e instanceof Error)return e;if(t instanceof Error)return t;if(n instanceof Error)return n;let r=e.getMonth(),i=t.getMonth(),a,o;if(n)a=e.getDate()===31?30:e.getDate(),o=t.getDate()===31?30:t.getDate();else{let n=new Date(e.getFullYear(),r+1,0).getDate(),s=new Date(t.getFullYear(),i+1,0).getDate();a=e.getDate()===n?30:e.getDate(),t.getDate()===s?a<30?(i++,o=1):o=30:o=t.getDate()}return 360*(t.getFullYear()-e.getFullYear())+30*(i-r)+(o-a)}function Aj(e,t){if(e=lD(e),e instanceof Error)return e;if(isNaN(t))return G;let n=e.getDate();e.setDate(1),t=parseInt(t,10),e.setMonth(e.getMonth()+t);let r=e.getMonth();if(n>28){let t=[31,28,31,30,31,30,31,31,30,31,30,31][r],i=e.getFullYear();r===1&&(i%4==0&&i%100!=0||i%400==0)&&(t=29),n=Math.min(n,t)}return e.setDate(n),DE?jE(e):e}function jj(e,t){if(e=lD(e),e instanceof Error)return e;if(isNaN(t))return G;t=parseInt(t,10);let n=new Date(e.getFullYear(),e.getMonth()+t+1,0);return DE?jE(n):n}function Mj(e){return e=lD(e),e instanceof Error?e:e.getHours()}function Nj(e){if(e=lD(e),e instanceof Error)return e;e=Dj(e),e.setDate(e.getDate()+4-(e.getDay()||7));let t=new Date(e.getFullYear(),0,1);return Math.ceil(((e-t)/864e5+1)/7)}function Pj(e){return e=lD(e),e instanceof Error?e:e.getMinutes()}function Fj(e){return e=lD(e),e instanceof Error?e:e.getMonth()+1}function Ij(e,t,n){return Ij.INTL(e,t,1,n)}Ij.INTL=(e,t,n,r)=>{if(e=lD(e),e instanceof Error)return e;if(t=lD(t),t instanceof Error)return t;let i=!1,a=[],o=[1,2,3,4,5,6,0],s=/* @__PURE__ */ RegExp(`^[0|1]{7}$`);if(n===void 0)n=Sj[1];else if(typeof n==`string`&&s.test(n)){i=!0,n=n.split(``);for(let e=0;e<n.length;e++)n[e]===`1`&&a.push(o[e])}else n=Sj[n];if(!(n instanceof Array))return G;r===void 0?r=[]:r instanceof Array||(r=[r]);for(let e=0;e<r.length;e++){let t=lD(r[e]);if(t instanceof Error)return t;r[e]=t}let c=Math.round((t-e)/864e5)+1,l=c,u=e;for(let e=0;e<c;e++){let e=(/* @__PURE__ */ new Date()).getTimezoneOffset()>0?u.getUTCDay():u.getDay(),t=i?a.includes(e):e===n[0]||e===n[1];for(let e=0;e<r.length;e++){let n=r[e];if(n.getDate()===u.getDate()&&n.getMonth()===u.getMonth()&&n.getFullYear()===u.getFullYear()){t=!0;break}}t&&l--,u.setDate(u.getDate()+1)}return l};function Lj(){return DE?jE(/* @__PURE__ */ new Date):/* @__PURE__ */ new Date}function Rj(e){return e=lD(e),e instanceof Error?e:e.getSeconds()}function zj(e,t,n){return e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?G:e<0||t<0||n<0?K:(3600*e+60*t+n)/86400}function Bj(e){return e=lD(e),e instanceof Error?e:(3600*e.getHours()+60*e.getMinutes()+e.getSeconds())/86400}function Vj(){let e=Dj(/* @__PURE__ */ new Date);return DE?jE(e):e}function Hj(e,t){if(e=lD(e),e instanceof Error)return e;t===void 0&&(t=1);let n=e.getDay();return xj[t][n]}function Uj(e,t){if(e=lD(e),e instanceof Error)return e;if(t===void 0&&(t=1),t===21)return Nj(e);let n=bj[t],r=new Date(e.getFullYear(),0,1),i=+(r.getDay()<n);return r-=Math.abs(r.getDay()-n)*24*60*60*1e3,Math.floor((e-r)/864e5/7+1)+i}function Wj(e,t,n){return Wj.INTL(e,t,1,n)}Wj.INTL=(e,t,n,r)=>{if(e=lD(e),e instanceof Error)return e;if(t=Z(t),t instanceof Error)return t;if(n=n===void 0?Sj[1]:Sj[n],!(n instanceof Array))return G;r===void 0?r=[]:r instanceof Array||(r=[r]);for(let e=0;e<r.length;e++){let t=lD(r[e]);if(t instanceof Error)return t;r[e]=t}let i=0,a=Math.sign(t);for(;i<t*a;){e.setDate(e.getDate()+a);let t=e.getDay();if(t!==n[0]&&t!==n[1]){for(let t=0;t<r.length;t++){let n=r[t];if(n.getDate()===e.getDate()&&n.getMonth()===e.getMonth()&&n.getFullYear()===e.getFullYear()){i--;break}}i++}}return e.getFullYear()<1900?G:e};function Gj(e){return e=lD(e),e instanceof Error?e:e.getFullYear()}function Kj(e){return new Date(e,1,29).getMonth()===1}function qj(e,t){return Math.ceil((t-e)/1e3/60/60/24)}function Jj(e,t,n){if(e=lD(e),e instanceof Error)return e;if(t=lD(t),t instanceof Error)return t;n||=0;let r=e.getDate(),i=e.getMonth()+1,a=e.getFullYear(),o=t.getDate(),s=t.getMonth()+1,c=t.getFullYear();switch(n){case 0:return r===31&&o===31?(r=30,o=30):r===31?r=30:r===30&&o===31&&(o=30),(o+s*30+c*360-(r+i*30+a*360))/360;case 1:{let n=(e,t)=>{let n=e.getFullYear(),r=new Date(n,2,1);if(Kj(n)&&e<r&&t>=r)return!0;let i=t.getFullYear(),a=new Date(i,2,1);return Kj(i)&&t>=a&&e<a},l=365;if(a===c||a+1===c&&(i>s||i===s&&r>=o))return(a===c&&Kj(a)||n(e,t)||s===1&&o===29)&&(l=366),qj(e,t)/l;let u=c-a+1,d=(new Date(c+1,0,1)-new Date(a,0,1))/1e3/60/60/24/u;return qj(e,t)/d}case 2:return qj(e,t)/360;case 3:return qj(e,t)/365;case 4:return(o+s*30+c*360-(r+i*30+a*360))/360}}function Yj(e){return/^[01]{1,10}$/.test(e)}function Xj(e,t){return e=Z(e),t=Z(t),X(e,t)?G:vE.default.besseli(e,t)}function Zj(e,t){return e=Z(e),t=Z(t),X(e,t)?G:vE.default.besselj(e,t)}function Qj(e,t){return e=Z(e),t=Z(t),X(e,t)?G:vE.default.besselk(e,t)}function $j(e,t){return e=Z(e),t=Z(t),X(e,t)?G:vE.default.bessely(e,t)}function eM(e){if(!Yj(e))return K;let t=parseInt(e,2),n=e.toString();return n.length===10&&n.substring(0,1)===`1`?parseInt(n.substring(1),2)-512:t}function tM(e,t){if(!Yj(e))return K;let n=e.toString();if(n.length===10&&n.substring(0,1)===`1`)return(0xfffffffe00+parseInt(n.substring(1),2)).toString(16);let r=parseInt(e,2).toString(16);return t===void 0?r:isNaN(t)?G:t<0?K:(t=Math.floor(t),t>=r.length?uO(`0`,t-r.length)+r:K)}function nM(e,t){if(!Yj(e))return K;let n=e.toString();if(n.length===10&&n.substring(0,1)===`1`)return(1073741312+parseInt(n.substring(1),2)).toString(8);let r=parseInt(e,2).toString(8);return t===void 0?r:isNaN(t)?G:t<0?K:(t=Math.floor(t),t>=r.length?uO(`0`,t-r.length)+r:K)}function rM(e,t){return e=Z(e),t=Z(t),X(e,t)?G:e<0||t<0||Math.floor(e)!==e||Math.floor(t)!==t||e>0xffffffffffff||t>0xffffffffffff?K:e&t}function iM(e,t){return e=Z(e),t=Z(t),X(e,t)?G:e<0||Math.floor(e)!==e||e>0xffffffffffff||Math.abs(t)>53?K:t>=0?e<<t:e>>-t}function aM(e,t){return e=Z(e),t=Z(t),X(e,t)?G:e<0||t<0||Math.floor(e)!==e||Math.floor(t)!==t||e>0xffffffffffff||t>0xffffffffffff?K:e|t}function oM(e,t){return e=Z(e),t=Z(t),X(e,t)?G:e<0||Math.floor(e)!==e||e>0xffffffffffff||Math.abs(t)>53?K:t>=0?e>>t:e<<-t}function sM(e,t){return e=Z(e),t=Z(t),X(e,t)?G:e<0||t<0||Math.floor(e)!==e||Math.floor(t)!==t||e>0xffffffffffff||t>0xffffffffffff?K:e^t}function cM(e,t,n){if(e=Z(e),t=Z(t),X(e,t))return e;if(n=n===void 0?`i`:n,n!==`i`&&n!==`j`)return G;if(e===0&&t===0)return 0;if(e===0)return t===1?n:t.toString()+n;if(t===0)return e.toString();{let r=t>0?`+`:``;return e.toString()+r+(t===1?n:t.toString()+n)}}function lM(e,t,n){if(e=Z(e),e instanceof Error)return e;let r=[[`a.u. of action`,`?`,null,`action`,!1,!1,105457168181818e-48],[`a.u. of charge`,`e`,null,`electric_charge`,!1,!1,160217653141414e-33],[`a.u. of energy`,`Eh`,null,`energy`,!1,!1,435974417757576e-32],[`a.u. of length`,`a?`,null,`length`,!1,!1,529177210818182e-25],[`a.u. of mass`,`m?`,null,`mass`,!1,!1,910938261616162e-45],[`a.u. of time`,`?/Eh`,null,`time`,!1,!1,241888432650516e-31],[`admiralty knot`,`admkn`,null,`speed`,!1,!0,.514773333],[`ampere`,`A`,null,`electric_current`,!0,!1,1],[`ampere per meter`,`A/m`,null,`magnetic_field_intensity`,!0,!1,1],[`ångström`,`Å`,[`ang`],`length`,!1,!0,1e-10],[`are`,`ar`,null,`area`,!1,!0,100],[`astronomical unit`,`ua`,null,`length`,!1,!1,149597870691667e-25],[`bar`,`bar`,null,`pressure`,!1,!1,1e5],[`barn`,`b`,null,`area`,!1,!1,1e-28],[`becquerel`,`Bq`,null,`radioactivity`,!0,!1,1],[`bit`,`bit`,[`b`],`information`,!1,!0,1],[`btu`,`BTU`,[`btu`],`energy`,!1,!0,1055.05585262],[`byte`,`byte`,null,`information`,!1,!0,8],[`candela`,`cd`,null,`luminous_intensity`,!0,!1,1],[`candela per square metre`,`cd/m?`,null,`luminance`,!0,!1,1],[`coulomb`,`C`,null,`electric_charge`,!0,!1,1],[`cubic ångström`,`ang3`,[`ang^3`],`volume`,!1,!0,1e-30],[`cubic foot`,`ft3`,[`ft^3`],`volume`,!1,!0,.028316846592],[`cubic inch`,`in3`,[`in^3`],`volume`,!1,!0,16387064e-12],[`cubic light-year`,`ly3`,[`ly^3`],`volume`,!1,!0,846786664623715e-61],[`cubic metre`,`m3`,[`m^3`],`volume`,!0,!0,1],[`cubic mile`,`mi3`,[`mi^3`],`volume`,!1,!0,4168181825.44058],[`cubic nautical mile`,`Nmi3`,[`Nmi^3`],`volume`,!1,!0,6352182208],[`cubic Pica`,`Pica3`,[`Picapt3`,`Pica^3`,`Picapt^3`],`volume`,!1,!0,7.58660370370369e-8],[`cubic yard`,`yd3`,[`yd^3`],`volume`,!1,!0,.764554857984],[`cup`,`cup`,null,`volume`,!1,!0,.0002365882365],[`dalton`,`Da`,[`u`],`mass`,!1,!1,166053886282828e-41],[`day`,`d`,[`day`],`time`,!1,!0,86400],[`degree`,`°`,null,`angle`,!1,!1,.0174532925199433],[`degrees Rankine`,`Rank`,null,`temperature`,!1,!0,.555555555555556],[`dyne`,`dyn`,[`dy`],`force`,!1,!0,1e-5],[`electronvolt`,`eV`,[`ev`],`energy`,!1,!0,1.60217656514141],[`ell`,`ell`,null,`length`,!1,!0,1.143],[`erg`,`erg`,[`e`],`energy`,!1,!0,1e-7],[`farad`,`F`,null,`electric_capacitance`,!0,!1,1],[`fluid ounce`,`oz`,null,`volume`,!1,!0,295735295625e-16],[`foot`,`ft`,null,`length`,!1,!0,.3048],[`foot-pound`,`flb`,null,`energy`,!1,!0,1.3558179483314],[`gal`,`Gal`,null,`acceleration`,!1,!1,.01],[`gallon`,`gal`,null,`volume`,!1,!0,.003785411784],[`gauss`,`G`,[`ga`],`magnetic_flux_density`,!1,!0,1],[`grain`,`grain`,null,`mass`,!1,!0,647989e-10],[`gram`,`g`,null,`mass`,!1,!0,.001],[`gray`,`Gy`,null,`absorbed_dose`,!0,!1,1],[`gross registered ton`,`GRT`,[`regton`],`volume`,!1,!0,2.8316846592],[`hectare`,`ha`,null,`area`,!1,!0,1e4],[`henry`,`H`,null,`inductance`,!0,!1,1],[`hertz`,`Hz`,null,`frequency`,!0,!1,1],[`horsepower`,`HP`,[`h`],`power`,!1,!0,745.69987158227],[`horsepower-hour`,`HPh`,[`hh`,`hph`],`energy`,!1,!0,2684519.538],[`hour`,`h`,[`hr`],`time`,!1,!0,3600],[`imperial gallon (U.K.)`,`uk_gal`,null,`volume`,!1,!0,.00454609],[`imperial hundredweight`,`lcwt`,[`uk_cwt`,`hweight`],`mass`,!1,!0,50.802345],[`imperial quart (U.K)`,`uk_qt`,null,`volume`,!1,!0,.0011365225],[`imperial ton`,`brton`,[`uk_ton`,`LTON`],`mass`,!1,!0,1016.046909],[`inch`,`in`,null,`length`,!1,!0,.0254],[`international acre`,`uk_acre`,null,`area`,!1,!0,4046.8564224],[`IT calorie`,`cal`,null,`energy`,!1,!0,4.1868],[`joule`,`J`,null,`energy`,!0,!0,1],[`katal`,`kat`,null,`catalytic_activity`,!0,!1,1],[`kelvin`,`K`,[`kel`],`temperature`,!0,!0,1],[`kilogram`,`kg`,null,`mass`,!0,!0,1],[`knot`,`kn`,null,`speed`,!1,!0,.514444444444444],[`light-year`,`ly`,null,`length`,!1,!0,9460730472580800],[`litre`,`L`,[`l`,`lt`],`volume`,!1,!0,.001],[`lumen`,`lm`,null,`luminous_flux`,!0,!1,1],[`lux`,`lx`,null,`illuminance`,!0,!1,1],[`maxwell`,`Mx`,null,`magnetic_flux`,!1,!1,1e-18],[`measurement ton`,`MTON`,null,`volume`,!1,!0,1.13267386368],[`meter per hour`,`m/h`,[`m/hr`],`speed`,!1,!0,.00027777777777778],[`meter per second`,`m/s`,[`m/sec`],`speed`,!0,!0,1],[`meter per second squared`,`m?s??`,null,`acceleration`,!0,!1,1],[`parsec`,`pc`,[`parsec`],`length`,!1,!0,0x6da012f958ee1c],[`meter squared per second`,`m?/s`,null,`kinematic_viscosity`,!0,!1,1],[`metre`,`m`,null,`length`,!0,!0,1],[`miles per hour`,`mph`,null,`speed`,!1,!0,.44704],[`millimetre of mercury`,`mmHg`,null,`pressure`,!1,!1,133.322],[`minute`,`?`,null,`angle`,!1,!1,.000290888208665722],[`minute`,`min`,[`mn`],`time`,!1,!0,60],[`modern teaspoon`,`tspm`,null,`volume`,!1,!0,5e-6],[`mole`,`mol`,null,`amount_of_substance`,!0,!1,1],[`morgen`,`Morgen`,null,`area`,!1,!0,2500],[`n.u. of action`,`?`,null,`action`,!1,!1,105457168181818e-48],[`n.u. of mass`,`m?`,null,`mass`,!1,!1,910938261616162e-45],[`n.u. of speed`,`c?`,null,`speed`,!1,!1,299792458],[`n.u. of time`,`?/(me?c??)`,null,`time`,!1,!1,128808866778687e-35],[`nautical mile`,`M`,[`Nmi`],`length`,!1,!0,1852],[`newton`,`N`,null,`force`,!0,!0,1],[`œrsted`,`Oe `,null,`magnetic_field_intensity`,!1,!1,79.5774715459477],[`ohm`,`Ω`,null,`electric_resistance`,!0,!1,1],[`ounce mass`,`ozm`,null,`mass`,!1,!0,.028349523125],[`pascal`,`Pa`,null,`pressure`,!0,!1,1],[`pascal second`,`Pa?s`,null,`dynamic_viscosity`,!0,!1,1],[`pferdestärke`,`PS`,null,`power`,!1,!0,735.49875],[`phot`,`ph`,null,`illuminance`,!1,!1,1e-4],[`pica (1/6 inch)`,`pica`,null,`length`,!1,!0,.00035277777777778],[`pica (1/72 inch)`,`Pica`,[`Picapt`],`length`,!1,!0,.00423333333333333],[`poise`,`P`,null,`dynamic_viscosity`,!1,!1,.1],[`pond`,`pond`,null,`force`,!1,!0,.00980665],[`pound force`,`lbf`,null,`force`,!1,!0,4.4482216152605],[`pound mass`,`lbm`,null,`mass`,!1,!0,.45359237],[`quart`,`qt`,null,`volume`,!1,!0,.000946352946],[`radian`,`rad`,null,`angle`,!0,!1,1],[`second`,`?`,null,`angle`,!1,!1,484813681109536e-20],[`second`,`s`,[`sec`],`time`,!0,!0,1],[`short hundredweight`,`cwt`,[`shweight`],`mass`,!1,!0,45.359237],[`siemens`,`S`,null,`electrical_conductance`,!0,!1,1],[`sievert`,`Sv`,null,`equivalent_dose`,!0,!1,1],[`slug`,`sg`,null,`mass`,!1,!0,14.59390294],[`square ångström`,`ang2`,[`ang^2`],`area`,!1,!0,1e-20],[`square foot`,`ft2`,[`ft^2`],`area`,!1,!0,.09290304],[`square inch`,`in2`,[`in^2`],`area`,!1,!0,64516e-8],[`square light-year`,`ly2`,[`ly^2`],`area`,!1,!0,895054210748189e17],[`square meter`,`m?`,null,`area`,!0,!0,1],[`square mile`,`mi2`,[`mi^2`],`area`,!1,!0,2589988.110336],[`square nautical mile`,`Nmi2`,[`Nmi^2`],`area`,!1,!0,3429904],[`square Pica`,`Pica2`,[`Picapt2`,`Pica^2`,`Picapt^2`],`area`,!1,!0,1792111111111e-17],[`square yard`,`yd2`,[`yd^2`],`area`,!1,!0,.83612736],[`statute mile`,`mi`,null,`length`,!1,!0,1609.344],[`steradian`,`sr`,null,`solid_angle`,!0,!1,1],[`stilb`,`sb`,null,`luminance`,!1,!1,1e-4],[`stokes`,`St`,null,`kinematic_viscosity`,!1,!1,1e-4],[`stone`,`stone`,null,`mass`,!1,!0,6.35029318],[`tablespoon`,`tbs`,null,`volume`,!1,!0,147868e-10],[`teaspoon`,`tsp`,null,`volume`,!1,!0,492892e-11],[`tesla`,`T`,null,`magnetic_flux_density`,!0,!0,1],[`thermodynamic calorie`,`c`,null,`energy`,!1,!0,4.184],[`ton`,`ton`,null,`mass`,!1,!0,907.18474],[`tonne`,`t`,null,`mass`,!1,!1,1e3],[`U.K. pint`,`uk_pt`,null,`volume`,!1,!0,.00056826125],[`U.S. bushel`,`bushel`,null,`volume`,!1,!0,.03523907],[`U.S. oil barrel`,`barrel`,null,`volume`,!1,!0,.158987295],[`U.S. pint`,`pt`,[`us_pt`],`volume`,!1,!0,.000473176473],[`U.S. survey mile`,`survey_mi`,null,`length`,!1,!0,1609.347219],[`U.S. survey/statute acre`,`us_acre`,null,`area`,!1,!0,4046.87261],[`volt`,`V`,null,`voltage`,!0,!1,1],[`watt`,`W`,null,`power`,!0,!0,1],[`watt-hour`,`Wh`,[`wh`],`energy`,!1,!0,3600],[`weber`,`Wb`,null,`magnetic_flux`,!0,!1,1],[`yard`,`yd`,null,`length`,!1,!0,.9144],[`year`,`yr`,null,`time`,!1,!0,31557600]],i={Yi:[`yobi`,80,12089258196146292e8,`Yi`,`yotta`],Zi:[`zebi`,70,0x400000000000000000,`Zi`,`zetta`],Ei:[`exbi`,60,0x1000000000000000,`Ei`,`exa`],Pi:[`pebi`,50,0x4000000000000,`Pi`,`peta`],Ti:[`tebi`,40,1099511627776,`Ti`,`tera`],Gi:[`gibi`,30,1073741824,`Gi`,`giga`],Mi:[`mebi`,20,1048576,`Mi`,`mega`],ki:[`kibi`,10,1024,`ki`,`kilo`]},a={Y:[`yotta`,1e24,`Y`],Z:[`zetta`,1e21,`Z`],E:[`exa`,0xde0b6b3a7640000,`E`],P:[`peta`,0x38d7ea4c68000,`P`],T:[`tera`,0xe8d4a51000,`T`],G:[`giga`,1e9,`G`],M:[`mega`,1e6,`M`],k:[`kilo`,1e3,`k`],h:[`hecto`,100,`h`],e:[`dekao`,10,`e`],d:[`deci`,.1,`d`],c:[`centi`,.01,`c`],m:[`milli`,.001,`m`],u:[`micro`,1e-6,`u`],n:[`nano`,1e-9,`n`],p:[`pico`,1e-12,`p`],f:[`femto`,1e-15,`f`],a:[`atto`,1e-18,`a`],z:[`zepto`,1e-21,`z`],y:[`yocto`,1e-24,`y`]},o=null,s=null,c=t,l=n,u=1,d=1,f;for(let e=0;e<r.length;e++)f=r[e][2]===null?[]:r[e][2],(r[e][1]===c||f.indexOf(c)>=0)&&(o=r[e]),(r[e][1]===l||f.indexOf(l)>=0)&&(s=r[e]);if(o===null){let e=i[t.substring(0,2)],n=a[t.substring(0,1)];t.substring(0,2)===`da`&&(n=[`dekao`,10,`da`]),e?(u=e[2],c=t.substring(2)):n&&(u=n[1],c=t.substring(n[2].length));for(let e=0;e<r.length;e++)f=r[e][2]===null?[]:r[e][2],(r[e][1]===c||f.indexOf(c)>=0)&&(o=r[e])}if(s===null){let e=i[n.substring(0,2)],t=a[n.substring(0,1)];n.substring(0,2)===`da`&&(t=[`dekao`,10,`da`]),e?(d=e[2],l=n.substring(2)):t&&(d=t[1],l=n.substring(t[2].length));for(let e=0;e<r.length;e++)f=r[e][2]===null?[]:r[e][2],(r[e][1]===l||f.indexOf(l)>=0)&&(s=r[e])}return o===null||s===null||o[3]!==s[3]?q:e*o[6]*u/(s[6]*d)}function uM(e,t){if(e=Z(e),e instanceof Error)return e;if(!/^-?[0-9]{1,3}$/.test(e)||e<-512||e>511)return K;if(e<0)return`1`+uO(`0`,9-(512+e).toString(2).length)+(512+e).toString(2);let n=parseInt(e,10).toString(2);return t===void 0?n:isNaN(t)?G:t<0?K:(t=Math.floor(t),t>=n.length?uO(`0`,t-n.length)+n:K)}function dM(e,t){if(e=Z(e),e instanceof Error)return e;if(!/^-?[0-9]{1,12}$/.test(e)||e<-549755813888||e>549755813887)return K;if(e<0)return(1099511627776+e).toString(16);let n=parseInt(e,10).toString(16);return t===void 0?n:isNaN(t)?G:t<0?K:(t=Math.floor(t),t>=n.length?uO(`0`,t-n.length)+n:K)}function fM(e,t){if(e=Z(e),e instanceof Error)return e;if(!/^-?[0-9]{1,9}$/.test(e)||e<-536870912||e>536870911)return K;if(e<0)return(1073741824+e).toString(8);let n=parseInt(e,10).toString(8);return t===void 0?n:isNaN(t)?G:t<0?K:(t=Math.floor(t),t>=n.length?uO(`0`,t-n.length)+n:K)}function pM(e,t){return t=t===void 0?0:t,e=Z(e),t=Z(t),X(e,t)?G:+(e===t)}function mM(e,t){return t=t===void 0?0:t,e=Z(e),t=Z(t),X(e,t)?G:W.default.erf(e)}function hM(e){return isNaN(e)?G:W.default.erfc(e)}function gM(e,t){return t||=0,e=Z(e),X(t,e)?e:+(e>=t)}function _M(e,t){if(!/^[0-9A-Fa-f]{1,10}$/.test(e))return K;let n=e.length===10&&e.substring(0,1).toLowerCase()===`f`,r=n?parseInt(e,16)-1099511627776:parseInt(e,16);if(r<-512||r>511)return K;if(n)return`1`+uO(`0`,9-(512+r).toString(2).length)+(512+r).toString(2);let i=r.toString(2);return t===void 0?i:isNaN(t)?G:t<0?K:(t=Math.floor(t),t>=i.length?uO(`0`,t-i.length)+i:K)}function vM(e){if(!/^[0-9A-Fa-f]{1,10}$/.test(e))return K;let t=parseInt(e,16);return t>=549755813888?t-1099511627776:t}function yM(e,t){if(!/^[0-9A-Fa-f]{1,10}$/.test(e))return K;let n=parseInt(e,16);if(n>536870911&&n<0xffe0000000)return K;if(n>=0xffe0000000)return(n-0xffc0000000).toString(8);let r=n.toString(8);return t===void 0?r:isNaN(t)?G:t<0?K:(t=Math.floor(t),t>=r.length?uO(`0`,t-r.length)+r:K)}function bM(e){let t=PM(e),n=xM(e);return X(t,n)?G:Math.sqrt(t**2+n**2)}function xM(e){if(e===void 0||e===!0||e===!1)return G;if(e===0||e===`0`)return 0;if([`i`,`j`].indexOf(e)>=0)return 1;e+=``,e=e.replace(`+i`,`+1i`).replace(`-i`,`-1i`).replace(`+j`,`+1j`).replace(`-j`,`-1j`);let t=e.indexOf(`+`),n=e.indexOf(`-`);t===0&&(t=e.indexOf(`+`,1)),n===0&&(n=e.indexOf(`-`,1));let r=e.substring(e.length-1,e.length),i=r===`i`||r===`j`;return t>=0||n>=0?i?t>=0?isNaN(e.substring(0,t))||isNaN(e.substring(t+1,e.length-1))?K:Number(e.substring(t+1,e.length-1)):isNaN(e.substring(0,n))||isNaN(e.substring(n+1,e.length-1))?K:-Number(e.substring(n+1,e.length-1)):K:i?isNaN(e.substring(0,e.length-1))?K:e.substring(0,e.length-1):isNaN(e)?K:0}function SM(e){let t=PM(e),n=xM(e);return X(t,n)?G:t===0&&n===0?bE:t===0&&n>0?Math.PI/2:t===0&&n<0?-Math.PI/2:n===0&&t>0?0:n===0&&t<0?-Math.PI:t>0?Math.atan(n/t):t<0&&n>=0?Math.atan(n/t)+Math.PI:Math.atan(n/t)-Math.PI}function CM(e){let t=PM(e),n=xM(e);if(X(t,n))return G;let r=e.substring(e.length-1);return r=r===`i`||r===`j`?r:`i`,n===0?e:cM(t,-n,r)}function wM(e){let t=PM(e),n=xM(e);if(X(t,n))return G;let r=e.substring(e.length-1);return r=r===`i`||r===`j`?r:`i`,cM(Math.cos(t)*(Math.exp(n)+Math.exp(-n))/2,-Math.sin(t)*(Math.exp(n)-Math.exp(-n))/2,r)}function TM(e){let t=PM(e),n=xM(e);if(X(t,n))return G;let r=e.substring(e.length-1);return r=r===`i`||r===`j`?r:`i`,cM(Math.cos(n)*(Math.exp(t)+Math.exp(-t))/2,Math.sin(n)*(Math.exp(t)-Math.exp(-t))/2,r)}function EM(e){return X(PM(e),xM(e))?G:DM(wM(e),LM(e))}function DM(e,t){let n=PM(e),r=xM(e),i=PM(t),a=xM(t);if(X(n,r,i,a))return G;let o=e.substring(e.length-1),s=t.substring(t.length-1),c=`i`;if((o===`j`||s===`j`)&&(c=`j`),i===0&&a===0)return K;let l=i*i+a*a;return cM((n*i+r*a)/l,(r*i-n*a)/l,c)}function OM(e){let t=PM(e),n=xM(e);if(X(t,n))return G;let r=e.substring(e.length-1);r=r===`i`||r===`j`?r:`i`;let i=Math.exp(t);return cM(i*Math.cos(n),i*Math.sin(n),r)}function kM(e){let t=PM(e),n=xM(e);if(X(t,n))return G;let r=e.substring(e.length-1);return r=r===`i`||r===`j`?r:`i`,cM(Math.log(Math.sqrt(t*t+n*n)),Math.atan(n/t),r)}function AM(e){let t=PM(e),n=xM(e);if(X(t,n))return G;let r=e.substring(e.length-1);return r=r===`i`||r===`j`?r:`i`,cM(Math.log(Math.sqrt(t*t+n*n))/Math.log(10),Math.atan(n/t)/Math.log(10),r)}function jM(e){let t=PM(e),n=xM(e);if(X(t,n))return G;let r=e.substring(e.length-1);return r=r===`i`||r===`j`?r:`i`,cM(Math.log(Math.sqrt(t*t+n*n))/Math.log(2),Math.atan(n/t)/Math.log(2),r)}function MM(e,t){t=Z(t);let n=PM(e),r=xM(e);if(X(t,n,r))return G;let i=e.substring(e.length-1);i=i===`i`||i===`j`?i:`i`;let a=bM(e)**+t,o=SM(e);return cM(a*Math.cos(t*o),a*Math.sin(t*o),i)}function NM(){let e=arguments[0];if(!arguments.length)return G;for(let t=1;t<arguments.length;t++){let n=PM(e),r=xM(e),i=PM(arguments[t]),a=xM(arguments[t]);if(X(n,r,i,a))return G;e=cM(n*i-r*a,n*a+r*i)}return e}function PM(e){if(e===void 0||e===!0||e===!1)return G;if(e===0||e===`0`||[`i`,`+i`,`1i`,`+1i`,`-i`,`-1i`,`j`,`+j`,`1j`,`+1j`,`-j`,`-1j`].indexOf(e)>=0)return 0;e+=``;let t=e.indexOf(`+`),n=e.indexOf(`-`);t===0&&(t=e.indexOf(`+`,1)),n===0&&(n=e.indexOf(`-`,1));let r=e.substring(e.length-1,e.length),i=r===`i`||r===`j`;return t>=0||n>=0?i?t>=0?isNaN(e.substring(0,t))||isNaN(e.substring(t+1,e.length-1))?K:Number(e.substring(0,t)):isNaN(e.substring(0,n))||isNaN(e.substring(n+1,e.length-1))?K:Number(e.substring(0,n)):K:i?isNaN(e.substring(0,e.length-1))?K:0:isNaN(e)?K:e}function FM(e){return e===!0||e===!1||X(PM(e),xM(e))?G:DM(`1`,wM(e))}function IM(e){return X(PM(e),xM(e))?G:DM(`1`,TM(e))}function LM(e){let t=PM(e),n=xM(e);if(X(t,n))return G;let r=e.substring(e.length-1);return r=r===`i`||r===`j`?r:`i`,cM(Math.sin(t)*(Math.exp(n)+Math.exp(-n))/2,Math.cos(t)*(Math.exp(n)-Math.exp(-n))/2,r)}function RM(e){let t=PM(e),n=xM(e);if(X(t,n))return G;let r=e.substring(e.length-1);return r=r===`i`||r===`j`?r:`i`,cM(Math.cos(n)*(Math.exp(t)-Math.exp(-t))/2,Math.sin(n)*(Math.exp(t)+Math.exp(-t))/2,r)}function zM(e){if(X(PM(e),xM(e)))return G;let t=e.substring(e.length-1);t=t===`i`||t===`j`?t:`i`;let n=Math.sqrt(bM(e)),r=SM(e);return cM(n*Math.cos(r/2),n*Math.sin(r/2),t)}function BM(e){return e===!0||e===!1?G:X(PM(e),xM(e))?K:DM(`1`,LM(e))}function VM(e){return e===!0||e===!1?G:X(PM(e),xM(e))?K:DM(`1`,RM(e))}function HM(e,t){let n=PM(e),r=xM(e),i=PM(t),a=xM(t);if(X(n,r,i,a))return G;let o=e.substring(e.length-1),s=t.substring(t.length-1),c=`i`;return(o===`j`||s===`j`)&&(c=`j`),cM(n-i,r-a,c)}function UM(){if(!arguments.length)return G;let e=J(arguments),t=0,n=0;for(let r of e){let e=+PM(r),i=+xM(r);if(X(e,i))return G;t+=e,n+=i}return cM(t,n,`i`)}function WM(e){return e===!0||e===!1||X(PM(e),xM(e))?G:DM(LM(e),wM(e))}function GM(e,t){if(!/^[0-7]{1,10}$/.test(e))return K;let n=e.length===10&&e.substring(0,1)===`7`,r=n?parseInt(e,8)-1073741824:parseInt(e,8);if(r<-512||r>511)return K;if(n)return`1`+uO(`0`,9-(512+r).toString(2).length)+(512+r).toString(2);let i=r.toString(2);return t===void 0?i:isNaN(t)?G:t<0?K:(t=Math.floor(t),t>=i.length?uO(`0`,t-i.length)+i:K)}function KM(e){if(!/^[0-7]{1,10}$/.test(e))return K;let t=parseInt(e,8);return t>=536870912?t-1073741824:t}function qM(e,t){if(!/^[0-7]{1,10}$/.test(e))return K;let n=parseInt(e,8);if(n>=536870912)return`ff`+(n+3221225472).toString(16);let r=n.toString(16);return t===void 0?r:isNaN(t)?G:t<0?K:(t=Math.floor(t),t>=r.length?uO(`0`,t-r.length)+r:K)}let JM=DO.DIST,YM=DO.INV,XM=OO.DIST,ZM=eA.MATH,QM=eA.PRECISE,$M=kO.DIST,eN=kO.DIST.RT,tN=kO.INV,nN=kO.INV.RT,rN=kO.TEST,iN=LO.P,aN=LO.P,oN=LO.S,sN=OO.INV,cN=hM.PRECISE,lN=mM.PRECISE,uN=zO.DIST,dN=BO.DIST,fN=BO.DIST.RT,pN=BO.INV,mN=BO.INV.RT,hN=gA.MATH,gN=gA.PRECISE,_N=BO.TEST,vN=GO.DIST,yN=GO.INV,bN=KO.PRECISE,xN=ZO.DIST,SN=rk.INV,CN=rk.DIST,wN=rk.INV,TN=dk.MULT,EN=dk.SNGL,DN=fk.DIST,ON=Ij.INTL,kN=pk.DIST,AN=pk.INV,jN=pk.S.DIST,MN=pk.S.INV,NN=hk.EXC,PN=hk.INC,FN=gk.EXC,IN=gk.INC,LN=bk.DIST,RN=Sk.EXC,zN=Sk.INC,BN=Ck.AVG,VN=Ck.EQ,HN=Ek.P,UN=Ak.P,WN=Ak.S,GN=mO.DIST,KN=mO.DIST.RT,qN=mO.INV,JN=mO.TEST,YN=Ik.P,XN=Ik.S,ZN=zk.DIST,QN=Wj.INTL,$N=Bk.TEST;function eP(e){let t=[];return JE(e,e=>{e&&t.push(e)}),t}function tP(e,t){let n={};for(let t=1;t<e[0].length;++t)n[t]=!0;let r=t[0].length;for(let e=1;e<t.length;++e)t[e].length>r&&(r=t[e].length);for(let i=1;i<e.length;++i)for(let a=1;a<e[i].length;++a){let o=!1,s=!1;for(let n=0;n<t.length;++n){let c=t[n];if(c.length<r)continue;let l=c[0];if(e[i][0]===l){s=!0;for(let t=1;t<c.length;++t)if(!o){if(c[t]===void 0||c[t]===`*`)o=!0;else{let n=GE(c[t]+``),r=[zE(e[i][a],RE)].concat(n);o=KE(r)}}}}s&&(n[a]=n[a]&&o)}let i=[];for(let t=0;t<e[0].length;++t)n[t]&&i.push(t-1);return i}function nP(e,t,n){if(isNaN(t)&&typeof t!=`string`)return G;let r=tP(e,n),i=[];i=rD(typeof t==`string`?e[aD(e,t)]:e[t]);let a=0;return JE(r,e=>{a+=i[e]}),r.length===0?bE:a/r.length}function rP(e,t,n){if(isNaN(t)&&typeof t!=`string`)return G;let r=tP(e,n),i=[];i=rD(typeof t==`string`?e[aD(e,t)]:e[t]);let a=[];return JE(r,e=>{a.push(i[e])}),MO(a)}function iP(e,t,n){if(isNaN(t)&&typeof t!=`string`)return G;let r=tP(e,n),i=[];i=rD(typeof t==`string`?e[aD(e,t)]:e[t]);let a=[];return JE(r,e=>{a.push(i[e])}),NO(a)}function aP(e,t,n){if(isNaN(t)&&typeof t!=`string`)return G;let r=tP(e,n),i=[];return i=rD(typeof t==`string`?e[aD(e,t)]:e[t]),r.length===0?G:r.length>1?K:i[r[0]]}function oP(e,t,n){if(isNaN(t)&&typeof t!=`string`)return G;let r=tP(e,n),i=[];i=rD(typeof t==`string`?e[aD(e,t)]:e[t]);let a=i[r[0]];return JE(r,e=>{a<i[e]&&(a=i[e])}),a}function sP(e,t,n){if(isNaN(t)&&typeof t!=`string`)return G;let r=tP(e,n),i=[];i=rD(typeof t==`string`?e[aD(e,t)]:e[t]);let a=i[r[0]];return JE(r,e=>{a>i[e]&&(a=i[e])}),a}function cP(e,t,n){if(isNaN(t)&&typeof t!=`string`)return G;let r=tP(e,n),i=[];i=rD(typeof t==`string`?e[aD(e,t)]:e[t]);let a=[];JE(r,e=>{a.push(i[e])}),a=eP(a);let o=1;return JE(a,e=>{o*=e}),o}function lP(e,t,n){if(isNaN(t)&&typeof t!=`string`)return G;let r=tP(e,n),i=[];i=rD(typeof t==`string`?e[aD(e,t)]:e[t]);let a=[];return JE(r,e=>{a.push(i[e])}),a=eP(a),Ak.S(a)}function uP(e,t,n){if(isNaN(t)&&typeof t!=`string`)return G;let r=tP(e,n),i=[];i=rD(typeof t==`string`?e[aD(e,t)]:e[t]);let a=[];return JE(r,e=>{a.push(i[e])}),a=eP(a),Ak.P(a)}function dP(e,t,n){if(isNaN(t)&&typeof t!=`string`)return G;let r=tP(e,n),i=[];i=rD(typeof t==`string`?e[aD(e,t)]:e[t]);let a=[];return JE(r,e=>{a.push(i[e])}),ZA(a)}function fP(e,t,n){if(isNaN(t)&&typeof t!=`string`)return G;let r=tP(e,n),i=[];i=rD(typeof t==`string`?e[aD(e,t)]:e[t]);let a=[];return JE(r,e=>{a.push(i[e])}),Ik.S(a)}function pP(e,t,n){if(isNaN(t)&&typeof t!=`string`)return G;let r=tP(e,n),i=[];i=rD(typeof t==`string`?e[aD(e,t)]:e[t]);let a=[];return JE(r,e=>{a.push(i[e])}),Ik.P(a)}function mP(e){return e&&e.getTime&&!isNaN(e.getTime())}function hP(e){return e instanceof Date?e:new Date(e)}function gP(e,t,n){let r=lD(t);for(r.setFullYear(e.getFullYear()),r<e&&r.setFullYear(r.getFullYear()+1);r>e;)r.setMonth(r.getMonth()+-12/n);return r}function _P(e){return e=Z(e),[1,2,4].indexOf(e)===-1?K:e}function vP(e){return e=Z(e),[0,1,2,3,4].indexOf(e)===-1?K:e}function yP(e,t,n,r,i,a,o){return e=hP(e),t=hP(t),n=hP(n),a=_P(a),o=vP(o),Y(a,o)?K:!mP(e)||!mP(t)||!mP(n)?G:r<=0||i<=0||n<=e?K:(i||=0,o||=0,i*r*Jj(e,n,o))}function bP(e,t,n,r){if(r=vP(r),n=_P(n),e=lD(e),t=lD(t),Y(e,t))return G;if(Y(n,r)||e>=t)return K;if(r===1){let r=gP(e,t,n),i=lD(r);return i.setMonth(i.getMonth()+12/n),wj(r,i,`D`)}let i;switch(r){case 0:case 2:case 4:i=360;break;case 3:i=365;break;default:return K}return i/n}function xP(e,t,n,r,i,a){if(e=Z(e),t=Z(t),n=Z(n),X(e,t,n))return G;if(e<=0||t<=0||n<=0||r<1||i<1||r>i||a!==0&&a!==1)return K;let o=zP(e,t,n,0,a),s=0;r===1&&(a===0&&(s=-n),r++);for(let t=r;t<=i;t++)s+=a===1?kP(e,t-2,o,n,1)-o:kP(e,t-1,o,n,0);return s*=e,s}function SP(e,t,n,r,i,a){if(e=Z(e),t=Z(t),n=Z(n),X(e,t,n))return G;if(e<=0||t<=0||n<=0||r<1||i<1||r>i||a!==0&&a!==1)return K;let o=zP(e,t,n,0,a),s=0;r===1&&(s=a===0?o+n*e:o,r++);for(let t=r;t<=i;t++)s+=a>0?o-(kP(e,t-2,o,n,1)-o)*e:o-kP(e,t-1,o,n,0)*e;return s}function CP(e,t,n,r,i){if(i=i===void 0?12:i,e=Z(e),t=Z(t),n=Z(n),r=Z(r),i=Z(i),X(e,t,n,r,i))return G;if(e<0||t<0||n<0||r<0||[1,2,3,4,5,6,7,8,9,10,11,12].indexOf(i)===-1||r>n)return K;if(t>=e)return 0;let a=(1-(t/e)**(1/n)).toFixed(3),o=e*a*i/12,s=o,c=0,l=r===n?n-1:r;for(let t=2;t<=l;t++)c=(e-s)*a,s+=c;return r===1?o:r===n?(e-s)*a:c}function wP(e,t,n,r,i){if(i=i===void 0?2:i,e=Z(e),t=Z(t),n=Z(n),r=Z(r),i=Z(i),X(e,t,n,r,i))return G;if(e<0||t<0||n<0||r<0||i<=0||r>n)return K;if(t>=e)return 0;let a=0,o=0;for(let s=1;s<=r;s++)o=Math.min((e-a)*(i/n),e-t-a),a+=o;return o}function TP(e,t,n,r,i){if(e=lD(e),t=lD(t),n=Z(n),r=Z(r),i=Z(i),i||=0,X(e,t,n,r,i))return G;if(n<=0||r<=0)return K;if(e>=t)return G;let a,o;switch(i){case 0:a=360,o=kj(e,t,!1);break;case 1:a=365,o=wj(e,t,`D`);break;case 2:a=360,o=wj(e,t,`D`);break;case 3:a=365,o=wj(e,t,`D`);break;case 4:a=360,o=kj(e,t,!0);break;default:return K}return(r-n)/r*a/o}function EP(e,t){if(e=Z(e),t=Z(t),X(e,t))return G;if(t<0)return K;if(t>=0&&t<1)return bE;t=parseInt(t,10);let n=parseInt(e,10);n+=e%1*10**Math.ceil(Math.log(t)/Math.LN10)/t;let r=10**(Math.ceil(Math.log(t)/Math.LN2)+1);return n=Math.round(n*r)/r,n}function DP(e,t){if(e=Z(e),t=Z(t),X(e,t))return G;if(t<0)return K;if(t>=0&&t<1)return bE;t=parseInt(t,10);let n=parseInt(e,10);return n+=e%1*10**-Math.ceil(Math.log(t)/Math.LN10)*t,n}function OP(e,t){return e=Z(e),t=Z(t),X(e,t)?G:e<=0||t<1?K:(t=parseInt(t,10),(1+e/t)**+t-1)}function kP(e,t,n,r,i){if(r||=0,i||=0,e=Z(e),t=Z(t),n=Z(n),r=Z(r),i=Z(i),X(e,t,n,r,i))return G;let a;if(e===0)a=r+n*t;else{let o=(1+e)**+t;a=i===1?r*o+n*(1+e)*(o-1)/e:r*o+n*(o-1)/e}return-a}function AP(e,t){if(e=Z(e),t=Q(J(t)),X(e,t))return G;let n=t.length,r=e;for(let e=0;e<n;e++)r*=1+t[e];return r}function jP(e,t,n,r,i,a){if(i||=0,a||=0,e=Z(e),t=Z(t),n=Z(n),r=Z(r),i=Z(i),a=Z(a),X(e,t,n,r,i,a))return G;let o=zP(e,n,r,i,a);return(t===1?a===1?0:-r:a===1?kP(e,t-2,o,r,1)-o:kP(e,t-1,o,r,0))*e}function MP(e,t){if(t=typeof t==`number`?t:t===void 0?.1:Z(t),e=J(e).filter(mD),e=Q(e),X(e,t))return G;let n=new Float64Array(e.length),r=!1,i=!1;for(let t=0;t<e.length;t++)n[t]=e[t],n[t]>0&&(r=!0),n[t]<0&&(i=!0);if(!r||!i)return K;let a=e=>{e<=-1&&(e=-.999999999);let t=n[0],r=1+e,i=1;for(let e=1;e<n.length;e++)i*=r,t+=n[e]/i;return t},o=/* @__PURE__ */ new Map,s=function(e){let t=Math.round(e*1e10)/1e10;if(o.has(t))return o.get(t);let n=a(t);return o.set(t,n),n};return function(){let e=1e-10,n=1e3,r=t,i=r,a=0;for(;a<n;){let t=s(r);if(Math.abs(t)<e)return r;if(a>0&&Math.abs(r-i)<e*10)break;let n=Math.max(1e-4,Math.abs(r*1e-4)),o=(s(r+n)-t)/n;if(Math.abs(o)<e)break;i=r;let c=t/o,l=Math.max(.1,Math.abs(r)*.5);r-=Math.abs(c)>l?Math.sign(c)*l:c,r<=-1&&(r=-.99999999),r>1e3&&(r=1e3),a++}let o=s(r);if(Math.abs(o)<e)return r;let c,l;if(o>0){for(c=r,l=r+.1;s(l)>0&&l<1e3;)l=l*2+.1;if(l>=1e3)return r}else{for(l=r,c=Math.max(-.99999999,r-.1);s(c)<0&&c>-.99999999;)c=Math.max(-.99999999,c-.1);if(c<=-.99999999)return r}let u;for(let t=0;t<n;t++){u=(c+l)/2;let t=s(u);if(Math.abs(t)<e||Math.abs(l-c)<e)return u;t*s(c)<0?l=u:c=u}return u}()}function NP(e,t,n,r){return e=Z(e),t=Z(t),n=Z(n),r=Z(r),X(e,t,n,r)?G:r*e*(t/n-1)}function PP(e,t,n){if(e=Q(J(e)),t=Z(t),n=Z(n),X(e,t,n))return G;let r=e.length,i=[],a=[];for(let t=0;t<r;t++)e[t]<0?i.push(e[t]):a.push(e[t]);return(-LP(n,a)*(1+n)**(r-1)/(LP(t,i)*(1+t)))**(1/(r-1))-1}function FP(e,t){return e=Z(e),t=Z(t),X(e,t)?G:e<=0||t<1?K:(t=parseInt(t,10),((e+1)**(1/t)-1)*t)}function IP(e,t,n,r,i){if(i=i===void 0?0:i,r=r===void 0?0:r,e=Z(e),t=Z(t),n=Z(n),r=Z(r),i=Z(i),X(e,t,n,r,i))return G;if(e===0)return-(n+r)/t;{let a=t*(1+e*i)-r*e,o=n*e+t*(1+e*i);return Math.log(a/o)/Math.log(1+e)}}function LP(){let e=Q(J(arguments));if(e instanceof Error)return e;let t=e[0],n=0;for(let r=1;r<e.length;r++)n+=e[r]/(1+t)**+r;return n}function RP(e,t,n){return e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?G:e<=0?K:(Math.log(n)-Math.log(t))/Math.log(1+e)}function zP(e,t,n,r,i){if(r||=0,i||=0,e=Z(e),t=Z(t),n=Z(n),r=Z(r),i=Z(i),X(e,t,n,r,i))return G;let a;if(e===0)a=(n+r)/t;else{let o=(1+e)**+t;a=i===1?(r*e/(o-1)+n*e/(1-1/o))/(1+e):r*e/(o-1)+n*e/(1-1/o)}return-a}function BP(e,t,n,r,i,a){return i||=0,a||=0,e=Z(e),n=Z(n),r=Z(r),i=Z(i),a=Z(a),X(e,n,r,i,a)?G:zP(e,n,r,i,a)-jP(e,t,n,r,i,a)}function VP(e,t,n,r,i){if(e=lD(e),t=lD(t),n=Z(n),r=Z(r),i=Z(i),i||=0,X(e,t,n,r,i))return G;if(n<=0||r<=0)return K;if(e>=t)return G;let a,o;switch(i){case 0:a=360,o=kj(e,t,!1);break;case 1:a=365,o=wj(e,t,`D`);break;case 2:a=360,o=wj(e,t,`D`);break;case 3:a=365,o=wj(e,t,`D`);break;case 4:a=360,o=kj(e,t,!0);break;default:return K}return r-n*r*o/a}function HP(e,t,n,r,i){return r||=0,i||=0,e=Z(e),t=Z(t),n=Z(n),r=Z(r),i=Z(i),X(e,t,n,r,i)?G:e===0?-n*t-r:((1-(1+e)**+t)/e*n*(1+e*i)-r)/(1+e)**+t}function UP(e,t,n,r,i,a){if(a=a===void 0?.1:a,r=r===void 0?0:r,i=i===void 0?0:i,e=Z(e),t=Z(t),n=Z(n),r=Z(r),i=Z(i),a=Z(a),X(e,t,n,r,i,a))return G;let o=1e-10,s=a;i=+!!i;for(let a=0;a<100;a++){if(s<=-1)return K;let a,c;if(Math.abs(s)<o?a=n*(1+e*s)+t*(1+s*i)*e+r:(c=(1+s)**+e,a=n*c+t*(1/s+i)*(c-1)+r),Math.abs(a)<o)return s;let l;if(Math.abs(s)<o)l=n*e+t*i*e;else{c=(1+s)**+e;let r=e*(1+s)**(e-1);l=n*r+t*(1/s+i)*r+t*(-1/(s*s))*(c-1)}s-=a/l}return s}function WP(e,t,n){return e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?G:e===0||t===0?K:(n/t)**(1/e)-1}function GP(e,t,n){return e=Z(e),t=Z(t),n=Z(n),X(e,t,n)?G:n===0?K:(e-t)/n}function KP(e,t,n,r){return e=Z(e),t=Z(t),n=Z(n),r=Z(r),X(e,t,n,r)?G:n===0||r<1||r>n?K:(r=parseInt(r,10),(e-t)*(n-r+1)*2/(n*(n+1)))}function qP(e,t,n){return e=lD(e),t=lD(t),n=Z(n),X(e,t,n)?G:n<=0||e>t||t-e>31536e6?K:365*n/(360-n*kj(e,t,!1))}function JP(e,t,n){return e=lD(e),t=lD(t),n=Z(n),X(e,t,n)?G:n<=0||e>t||t-e>31536e6?K:100*(1-n*kj(e,t,!1)/360)}function YP(e,t,n){return e=lD(e),t=lD(t),n=Z(n),X(e,t,n)?G:n<=0||e>t||t-e>31536e6?K:(100-n)*360/(n*kj(e,t,!1))}function XP(e,t,n){if(e=Q(J(e)),t=uD(J(t)),n=Z(n),X(e,t,n))return G;let r=(e,t,n)=>{let r=n+1,i=e[0];for(let n=1;n<e.length;n++)i+=e[n]/r**(Oj(t[n],t[0])/365);return i},i=(e,t,n)=>{let r=n+1,i=0;for(let n=1;n<e.length;n++){let a=Oj(t[n],t[0])/365;i-=a*e[n]/r**+(a+1)}return i},a=!1,o=!1;for(let t=0;t<e.length;t++)e[t]>0&&(a=!0),e[t]<0&&(o=!0);if(!a||!o)return K;n||=.1;let s=n,c=1e-10,l,u,d,f=!0;do d=r(e,t,s),l=s-d/i(e,t,s),u=Math.abs(l-s),s=l,f=u>c&&Math.abs(d)>c;while(f);return s}function ZP(e,t,n){if(e=Z(e),t=Q(J(t)),n=uD(J(n)),X(e,t,n))return G;let r=0;for(let i=0;i<t.length;i++)r+=t[i]/(1+e)**(Oj(n[i],n[0])/365);return r}function QP(){let e=J(arguments),t=G;for(let n=0;n<e.length;n++){if(e[n]instanceof Error)return e[n];e[n]!==void 0&&e[n]!==null&&typeof e[n]!=`string`&&(t===G&&(t=!0),e[n]||(t=!1))}return t}function $P(){return!1}function eF(e,t,n){return e instanceof Error?e:(t=arguments.length>=2?t:!0,t??=0,n=arguments.length===3&&n,n??=0,e?t:n)}function tF(){for(let e=0;e<arguments.length/2;e++)if(arguments[e*2])return arguments[e*2+1];return q}function nF(e,t){return vD(e)?t:e}function rF(e,t){return e===q?t:e}function iF(e){return typeof e==`string`?G:e instanceof Error?e:!e}function aF(){let e=J(arguments),t=G;for(let n=0;n<e.length;n++){if(e[n]instanceof Error)return e[n];e[n]!==void 0&&e[n]!==null&&typeof e[n]!=`string`&&(t===G&&(t=!1),e[n]&&(t=!0))}return t}function oF(){return!0}function sF(){let e=J(arguments),t=G;for(let n=0;n<e.length;n++){if(e[n]instanceof Error)return e[n];e[n]!==void 0&&e[n]!==null&&typeof e[n]!=`string`&&(t===G&&(t=0),e[n]&&t++)}return t===G?t:!!(Math.floor(Math.abs(t))&1)}function cF(){let e;if(arguments.length>0){let t=arguments[0],n=arguments.length-1,r=Math.floor(n/2),i=!1,a=n%2!=0,o=n%2==0?null:arguments[arguments.length-1];if(r){for(let n=0;n<r;n++)if(t===arguments[n*2+1]){e=arguments[n*2+2],i=!0;break}}i||(e=a?o:q)}else e=G;return e}let lF={errors:EE,symbols:yj,date:ME},uF=_E;function dF(e){let t=e.split(`.`).reduce((e,t)=>e?.[t],uF);if(typeof t!=`function`)throw Error(`@formulajs/formulajs has no ${e}.`);return t}function fF(e){return typeof e==`number`?Number.isFinite(e)?e:I.NUM:e instanceof Error?mh(e.message)??I.VALUE:typeof e==`boolean`||typeof e==`string`?e:I.VALUE}let pF=(e,t)=>{try{return fF(e(...t))}catch{return I.VALUE}};function mF(e,t){return yw([e],t)}function hF(e,t){let n=U(e,t);if(n instanceof F)return n;let r=[];for(let e=0;e<n.rows;e++){let t=[];for(let r=0;r<n.cols;r++){let i=n.at(e,r);if(i instanceof F)return i;t.push(typeof i==`number`?i:0)}r.push(t)}return r}function gF(e,t,n){let r=t.split(`?`)[0]?.length??0,i=t.replace(`?`,``),a=dF(n);V(e,r,i.length,(...e)=>{let t=[];for(let[n,r]of e.entries()){if(r===void 0){t.push(void 0);continue}let e=i.charAt(n),a=e===`n`?z(r):e===`b`?$C(r):B(r);if(a instanceof F)return a;t.push(a)}return pF(a,t)},{from:`formulajs`})}function _F(e,t,n){let r=t.replace(`?`,``),i=r.endsWith(`r`),a=dF(n);H(e,Array.from({length:t.length},(e,n)=>{let r=t.charAt(n);return r===`?`?`?`:i&&n===t.length-1?`(r)`:`lm`.includes(r)?`r`:`v`}).join(``),(e,t)=>{let n=[];for(let[a,o]of e.entries()){let s=i&&a>=r.length-1?`r`:r.charAt(a);if(s===`r`){let r=yw(e.slice(a),t);if(r instanceof F)return r;n.push(r);break}if(o instanceof hg){n.push(void 0);continue}let c;if(s===`l`)c=mF(o,t);else if(s===`m`)c=hF(o,t);else{let e=t.calc.scalar(o,t.frame);c=s===`n`?z(e):s===`b`?$C(e):B(e)}if(c instanceof F)return c;n.push(c)}return pF(a,n)},{from:`formulajs`})}function vF(e,t,n=``,r=1){let i=dF(t),a=n.length;H(e,`${`v`.repeat(a)}rr`,(e,t)=>{let n=[];for(let r of e.slice(0,a)){let e=z(t.calc.scalar(r,t.frame));if(e instanceof F)return e;n.push(e)}let o=U(e[a],t),s=U(e[a+1],t);if(o instanceof F)return o;if(s instanceof F)return s;if(o.rows*o.cols!==s.rows*s.cols)return I.NA;let c=[],l=[];for(let e=0;e<o.rows;e++)for(let t=0;t<o.cols;t++){let n=o.at(e,t),r=s.rows===o.rows?s.at(e,t):s.at(t,e);if(n instanceof F)return n;if(r instanceof F)return r;typeof n==`number`&&typeof r==`number`&&(c.push(n),l.push(r))}if(c.length<r)return I.DIV0;let u=pF(i,[...n,c,l]);return u===I.NUM?I.DIV0:u},{from:`formulajs`})}function yF(e,t,n=!1,r=1,i=I.DIV0){let a=dF(t);H(e,`(r)`,(e,t)=>{let o=n?bw(e,t):yw(e,t);if(o instanceof F)return o;if(o.length<r)return i;let s=pF(a,[o]);return s===I.NUM&&i===I.DIV0?I.DIV0:s},{from:`formulajs`})}function bF(e){let t=/^([+-]?[\d.]+(?:e[+-]?\d+)?)?(?:([+-]?)([\d.]+(?:e[+-]?\d+)?)?([ij]))?$/iu.exec(e);if(!t)return e;let[,n,r,i,a]=t,o=n===void 0?``:wh(Number(n));if(a===void 0)return o;let s=i===void 0?``:wh(Number(i));return`${o}${r??``}${s===`1`?``:s}${a}`}function xF(e,t){let n=dF(e);V(e,t.length,t.length,(...e)=>{let r=[];for(let[n,i]of e.entries()){let e=t.charAt(n)===`n`?z(i):B(i);if(e instanceof F)return e;r.push(e)}let i=pF(n,r);return typeof i==`string`?bF(i):i},{from:`formulajs`})}for(let e of/* @__PURE__ */ `ABS.ACOS.ACOSH.ACOT.ACOTH.ASIN.ASINH.ATAN.ATANH.COS.COSH.COT.COTH.CSC.CSCH.DEGREES.EVEN.EXP.INT.LN.LOG10.ODD.RADIANS.SEC.SECH.SIGN.SIN.SINH.SQRT.SQRTPI.TAN.TANH`.split(`.`))gF(e,`n`,e);for(let e of[`COMBIN`,`COMBINA`,`MROUND`,`PERMUT`,`PERMUTATIONA`,`POWER`])gF(e,`nn`,e);gF(`TRUNC`,`n?n`,`TRUNC`),gF(`CEILING`,`nn`,`CEILING`),V(`FLOOR`,2,2,(e,t)=>{let n=z(e??0);if(n instanceof F)return n;let r=z(t??0);return r instanceof F?r:n===0&&r===0?0:pF(dF(`FLOOR`),[n,r])}),gF(`CEILING.MATH`,`n?nn`,`CEILINGMATH`),gF(`FLOOR.MATH`,`n?nn`,`FLOORMATH`),gF(`CEILING.PRECISE`,`n?n`,`CEILINGPRECISE`),gF(`FLOOR.PRECISE`,`n?n`,`FLOORPRECISE`),gw(`ISO.CEILING`,`CEILING.PRECISE`),V(`PI`,0,0,()=>Math.PI),H(`RAND`,``,(e,t)=>t.calc.random(),{volatile:!0}),H(`RANDBETWEEN`,`vv`,(e,t)=>{let n=z(t.calc.scalar(e[0],t.frame)),r=z(t.calc.scalar(e[1],t.frame));if(n instanceof F)return n;if(r instanceof F)return r;let i=Math.ceil(n),a=Math.floor(r);return i>a?I.NUM:i+Math.floor(t.calc.random()*(a-i+1))},{volatile:!0}),yF(`MULTINOMIAL`,`MULTINOMIAL`),yF(`AVEDEV`,`AVEDEV`,!1,1,I.NUM),yF(`DEVSQ`,`DEVSQ`,!1,1,I.NUM),yF(`MEDIAN`,`MEDIAN`,!1,1,I.NUM),yF(`SKEW`,`SKEW`,!1,3),yF(`SKEW.P`,`SKEW.P`,!1,3),yF(`STDEV.S`,`STDEV.S`,!1,2),yF(`STDEV.P`,`STDEV.P`,!1,1),yF(`VAR.S`,`VAR.S`,!1,2),yF(`VAR.P`,`VAR.P`,!1,1),yF(`STDEVA`,`STDEVA`,!0,2),yF(`STDEVPA`,`STDEVPA`,!0,1),yF(`VARA`,`VARA`,!0,2),yF(`VARPA`,`VARPA`,!0,1);for(let[e,t]of[[`STDEV`,`STDEV.S`],[`STDEVP`,`STDEV.P`],[`VAR`,`VAR.S`],[`VARP`,`VAR.P`]])gw(e,t);_F(`PERCENTILE.INC`,`ln`,`PERCENTILE.INC`),_F(`PERCENTILE.EXC`,`ln`,`PERCENTILE.EXC`),_F(`PERCENTRANK.INC`,`ln?n`,`PERCENTRANK.INC`),_F(`PERCENTRANK.EXC`,`ln?n`,`PERCENTRANK.EXC`),_F(`QUARTILE.EXC`,`ln`,`QUARTILE.EXC`),H(`TRIMMEAN`,`rv`,(e,t)=>{let n=yw([e[0]],t);if(n instanceof F)return n;let r=z(t.calc.scalar(e[1],t.frame));if(r instanceof F)return r;if(r<0||r>=1||n.length===0)return I.NUM;let i=Math.floor(n.length*r/2),a=[...n].sort((e,t)=>e-t).slice(i,n.length-i);return a.reduce((e,t)=>e+t,0)/a.length}),gw(`PERCENTILE`,`PERCENTILE.INC`),gw(`PERCENTRANK`,`PERCENTRANK.INC`),vF(`CORREL`,`CORREL`),vF(`PEARSON`,`PEARSON`),vF(`RSQ`,`RSQ`),vF(`SLOPE`,`SLOPE`),vF(`INTERCEPT`,`INTERCEPT`),vF(`STEYX`,`STEYX`,``,3),vF(`COVARIANCE.P`,`COVARIANCE.P`),vF(`COVARIANCE.S`,`COVARIANCE.S`,``,2),vF(`FORECAST`,`FORECAST`,`n`),gw(`FORECAST.LINEAR`,`FORECAST`),gw(`COVAR`,`COVARIANCE.P`),gF(`PV`,`nnn?nn`,`PV`),gF(`NPER`,`nnn?nn`,`NPER`),gF(`RATE`,`nnn?nnn`,`RATE`),gF(`SYD`,`nnnn`,`SYD`),gF(`DDB`,`nnnn?n`,`DDB`),gF(`ISPMT`,`nnnn`,`ISPMT`),gF(`EFFECT`,`nn`,`EFFECT`),gF(`NOMINAL`,`nn`,`NOMINAL`),gF(`CUMIPMT`,`nnnnnn`,`CUMIPMT`),gF(`CUMPRINC`,`nnnnnn`,`CUMPRINC`),gF(`DOLLARDE`,`nn`,`DOLLARDE`),gF(`DOLLARFR`,`nn`,`DOLLARFR`),gF(`PDURATION`,`nnn`,`PDURATION`),gF(`RRI`,`nnn`,`RRI`),_F(`IRR`,`l?n`,`IRR`),_F(`MIRR`,`lnn`,`MIRR`),_F(`NPV`,`nr`,`NPV`),_F(`FVSCHEDULE`,`nl`,`FVSCHEDULE`);for(let e of[`BIN2DEC`,`HEX2DEC`,`OCT2DEC`,`IMABS`,`IMAGINARY`,`IMARGUMENT`,`IMREAL`])gF(e,`t`,e);for(let e of[`IMCONJUGATE`,`IMCOS`,`IMCOSH`,`IMCOT`,`IMCSC`,`IMCSCH`,`IMEXP`,`IMLN`,`IMLOG10`,`IMLOG2`,`IMSEC`,`IMSECH`,`IMSIN`,`IMSINH`,`IMSQRT`,`IMTAN`])xF(e,`t`);for(let e of[`BIN2OCT`,`HEX2BIN`,`HEX2OCT`,`OCT2BIN`])gF(e,`t?n`,e);for(let e of[`DEC2BIN`,`DEC2OCT`])gF(e,`n?n`,e);for(let[e,t]of[[`BIN2HEX`,`t`],[`OCT2HEX`,`t`],[`DEC2HEX`,`n`]]){let n=dF(e);V(e,1,2,(e,r)=>{let i=t===`n`?z(e):B(e);if(i instanceof F)return i;let a=r===void 0?void 0:z(r);if(a instanceof F)return a;let o=pF(n,[i,a]);return typeof o==`string`?o.toUpperCase():o},{from:`formulajs`})}xF(`IMDIV`,`tt`),xF(`IMSUB`,`tt`),xF(`IMPOWER`,`tn`),gF(`COMPLEX`,`nn?t`,`COMPLEX`),gF(`DECIMAL`,`tn`,`DECIMAL`),gF(`ARABIC`,`t`,`ARABIC`);for(let e of[`IMSUM`,`IMPRODUCT`]){let t=dF(e);H(e,`(r)`,(e,n)=>{let r=[],i;if(_w(e,n,e=>{if(i||e===null)return;let t=B(e);t instanceof F?i=t:r.push(t)}),i)return i;let a=pF(t,r);return typeof a==`string`?bF(a):a},{from:`formulajs`})}gF(`DELTA`,`n?n`,`DELTA`),gF(`GESTEP`,`n?n`,`GESTEP`);let SF=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.00016431823292116355,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],CF=.5*Math.log(2*Math.PI);function wF(e){if(Number.isInteger(e)&&e<=171)return Math.log(TF(e));let t=SF[0]??0;for(let n=1;n<SF.length;n++)t+=(SF[n]??0)/(e+n);let n=e+4.7421875+.5;return CF+Math.log(t/e)+(e+.5)*Math.log(n)-n}function TF(e){if(e<=0&&Number.isInteger(e))return NaN;if(Number.isInteger(e)&&e<=171){let t=1;for(let n=2;n<e;n++)t*=n;return t}return e<.5?Math.PI/(Math.sin(Math.PI*e)*TF(1-e)):Math.exp(wF(e))}let EF=1e-16,DF=1e-300,OF=1e5;function kF(e,t){if(t<=0)return 0;if(t<e+1){let n=1/e,r=n,i=e;for(let e=0;e<OF&&(i+=1,n*=t/i,r+=n,!(Math.abs(n)<Math.abs(r)*EF));e++);return r*Math.exp(-t+e*Math.log(t)-wF(e))}return 1-AF(e,t)}function AF(e,t){if(t<=0)return 1;if(t<e+1)return 1-kF(e,t);let n=t+1-e,r=1/DF,i=1/n,a=i;for(let t=1;t<OF;t++){let o=-t*(t-e);n+=2,i=o*i+n,Math.abs(i)<DF&&(i=DF),r=n+o/r,Math.abs(r)<DF&&(r=DF),i=1/i;let s=i*r;if(a*=s,Math.abs(s-1)<EF)break}return Math.exp(-t+e*Math.log(t)-wF(e))*a}function jF(e,t,n){let r=e+t,i=e+1,a=e-1,o=1,s=1-r*n/i;Math.abs(s)<DF&&(s=DF),s=1/s;let c=s;for(let l=1;l<OF;l++){let u=2*l,d=l*(t-l)*n/((a+u)*(e+u));s=1+d*s,Math.abs(s)<DF&&(s=DF),o=1+d/o,Math.abs(o)<DF&&(o=DF),s=1/s,c*=s*o,d=-(e+l)*(r+l)*n/((e+u)*(i+u)),s=1+d*s,Math.abs(s)<DF&&(s=DF),o=1+d/o,Math.abs(o)<DF&&(o=DF),s=1/s;let f=s*o;if(c*=f,Math.abs(f-1)<EF)break}return c}function MF(e,t,n){if(n<=0)return 0;if(n>=1)return 1;let r=Math.exp(wF(e+t)-wF(e)-wF(t)+e*Math.log(n)+t*Math.log1p(-n));return n<(e+1)/(e+t+2)?r*jF(e,t,n)/e:1-r*jF(t,e,1-n)/t}let NF=e=>e===0?0:(e<0?-1:1)*kF(.5,e*e),PF=e=>e<0?2-PF(-e):AF(.5,e*e),FF=e=>Math.exp(-e*e/2)/Math.sqrt(2*Math.PI),IF=e=>PF(-e/Math.SQRT2)/2,LF=(e,t)=>e.reduce((e,n)=>e*t+n,0),RF={a:[2509.0859296330846,33430.57558358813,67265.7709270087,45921.95393154987,13731.69376550946,1971.5909503065513,133.14166789178438,3.3871328727963665],b:[5226.495278852854,28729.085735721943,39307.89580009271,21213.794301586597,5394.196021424751,687.1870074920579,42.31333070160091,1],c:[.0007745450142783414,.022723844989269184,.2417807251774506,1.2704582524523684,3.6478483247632045,5.769497221460691,4.630337846156546,1.4234371107496837],d:[1.0507500716444169e-9,.0005475938084995344,.015198666563616457,.14810397642748008,.6897673349851,1.6763848301838038,2.053191626637759,1],e:[2.0103343992922881e-7,27115555687434876e-21,.0012426609473880784,.026532189526576124,.29656057182850487,1.7848265399172913,5.463784911164114,6.657904643501104],f:[20442631033899397e-31,1.421511758316446e-7,18463183175100548e-21,.0007868691311456133,.014875361290850615,.1369298809227358,.599832206555888,1]};function zF(e){let t=e-.5;if(t===0)return 0;if(Math.abs(t)<=.425){let e=.180625-t*t;return t*LF(RF.a,e)/LF(RF.b,e)}let n=t<0?e:1-e,r=Math.sqrt(-Math.log(n)),i=r<=5?LF(RF.c,r-1.6)/LF(RF.d,r-1.6):LF(RF.e,r-5)/LF(RF.f,r-5);return t<0?-i:i}function BF(e,t,n,r,i=1/0){let a=n,o=Math.min(r,i);for(;e(o)<t&&o<i;)a=o,o=Math.min(o*2+1,i);for(let n=0;n<400;n++){let n=(a+o)/2;if(n===a||n===o)return n;e(n)<t?a=n:o=n}return(a+o)/2}function VF(e,t,n,r){let i=(n-t)/r,a=e(t)+e(n);for(let n=1;n<r;n++)a+=e(t+n*i)*(n%2==1?4:2);return a*i/3}let HF=4e4;function UF(e,t){let n=Math.max(256,4*Math.ceil(Math.abs(t)+e)+256),r=Math.PI/n,i=.5*(Math.cos(0)+Math.cos(e*Math.PI));for(let a=1;a<n;a++){let n=a*r;i+=Math.cos(e*n-t*Math.sin(n))}return i*r/Math.PI}function WF(e,t){let n=VF(n=>Math.sin(t*Math.sin(n)-e*n),0,Math.PI,HF),r=Math.asinh((760+2*e*e)/t)+2,i=e%2==0?1:-1;return(n-VF(n=>(Math.exp(e*n)+i*Math.exp(-e*n))*Math.exp(-t*Math.sinh(n)),0,r,HF))/Math.PI}function GF(e,t){let n=Math.max(256,4*Math.ceil(Math.abs(t)+e)+256),r=Math.PI/n,i=.5*(Math.exp(t)+Math.exp(-t)*Math.cos(e*Math.PI));for(let a=1;a<n;a++){let n=a*r;i+=Math.exp(t*Math.cos(n))*Math.cos(e*n)}return i*r/Math.PI}function KF(e,t){let n=Math.acosh(760/t+1)+2+e,r=4096,i=n/r,a=.5*Math.exp(-t);for(let n=1;n<=r;n++){let r=n*i;a+=Math.exp(-t*Math.cosh(r))*Math.cosh(e*r)}return a*i}function qF(e,t,n,r){V(e,t,n,(...e)=>{let t=[];for(let n of e){let e=n===void 0?NaN:z(n);if(e instanceof F)return e;t.push(e)}return r(...t)})}function JF(e,t,n,r=0){V(e,t+1,t+1+r,(...e)=>{let r=$C(e[t]);if(r instanceof F)return r;let i=[];for(let[n,r]of e.entries()){if(n===t)continue;let e=r===void 0?NaN:z(r);if(e instanceof F)return e;i.push(e)}return n(r,...i)})}let YF=e=>Number.isFinite(e)?e:I.NUM;JF(`NORM.DIST`,3,(e,t=0,n=0,r=0)=>{if(r<=0)return I.NUM;let i=(t-n)/r;return e?IF(i):FF(i)/r}),qF(`NORM.INV`,3,3,(e=0,t=0,n=0)=>e<=0||e>=1||n<=0?I.NUM:t+n*zF(e)),V(`NORM.S.DIST`,1,2,(e,t)=>{let n=z(e);if(n instanceof F)return n;let r=t===void 0||$C(t);return r instanceof F?r:r?IF(n):FF(n)}),qF(`NORMSDIST`,1,1,(e=0)=>IF(e)),qF(`NORM.S.INV`,1,1,(e=0)=>e<=0||e>=1?I.NUM:zF(e)),JF(`LOGNORM.DIST`,3,(e,t=0,n=0,r=0)=>{if(t<=0||r<=0)return I.NUM;let i=(Math.log(t)-n)/r;return e?IF(i):FF(i)/(t*r)}),qF(`LOGNORMDIST`,3,3,(e=0,t=0,n=0)=>e<=0||n<=0?I.NUM:IF((Math.log(e)-t)/n)),qF(`LOGNORM.INV`,3,3,(e=0,t=0,n=0)=>e<=0||e>=1||n<=0?I.NUM:Math.exp(t+n*zF(e))),qF(`STANDARDIZE`,3,3,(e=0,t=0,n=0)=>n<=0?I.NUM:(e-t)/n),qF(`GAUSS`,1,1,(e=0)=>IF(e)-.5),qF(`PHI`,1,1,(e=0)=>FF(e)),qF(`FISHER`,1,1,(e=0)=>e<=-1||e>=1?I.NUM:.5*Math.log((1+e)/(1-e))),qF(`FISHERINV`,1,1,(e=0)=>{let t=Math.exp(2*e);return(t-1)/(t+1)}),qF(`CONFIDENCE.NORM`,3,3,(e=0,t=0,n=0)=>{let r=Math.trunc(n);return e<=0||e>=1||t<=0||r<1?I.NUM:zF(1-e/2)*t/Math.sqrt(r)});let XF=(e,t)=>MF(t/2,.5,t/(t+e*e)),ZF=(e,t)=>e<0?XF(e,t)/2:1-XF(e,t)/2;JF(`T.DIST`,2,(e,t=0,n=0)=>{let r=Math.trunc(n);return r<1?I.NUM:e?ZF(t,r):Math.exp(wF((r+1)/2)-wF(r/2))/Math.sqrt(r*Math.PI)*(1+t*t/r)**(-(r+1)/2)}),qF(`T.DIST.2T`,2,2,(e=0,t=0)=>{let n=Math.trunc(t);return e<0||n<1?I.NUM:XF(e,n)}),qF(`T.DIST.RT`,2,2,(e=0,t=0)=>{let n=Math.trunc(t);return n<1?I.NUM:e<0?1-XF(e,n)/2:XF(e,n)/2}),qF(`TDIST`,3,3,(e=0,t=0,n=0)=>{let r=Math.trunc(t),i=Math.trunc(n);return e<0||r<1||i!==1&&i!==2?I.NUM:XF(e,r)*i/2}),qF(`T.INV`,2,2,(e=0,t=0)=>{let n=Math.trunc(t);return e<=0||e>=1||n<1?I.NUM:e===.5?0:e<.5?-QF(2*e,n):QF(2*(1-e),n)});let QF=(e,t)=>BF(e=>-XF(e,t),-e,0,1);qF(`T.INV.2T`,2,2,(e=0,t=0)=>{let n=Math.trunc(t);return e<=0||e>1||n<1?I.NUM:QF(e,n)}),qF(`CONFIDENCE.T`,3,3,(e=0,t=0,n=0)=>{let r=Math.trunc(n);return e<=0||e>=1||t<=0||r<1?I.NUM:r===1?I.DIV0:QF(e,r-1)*t/Math.sqrt(r)}),JF(`CHISQ.DIST`,2,(e,t=0,n=0)=>{let r=Math.trunc(n);return t<0||r<1?I.NUM:e?kF(r/2,t/2):t===0?r===2?.5:r<2?I.NUM:0:Math.exp((r/2-1)*Math.log(t)-t/2-r/2*Math.LN2-wF(r/2))}),qF(`CHISQ.DIST.RT`,2,2,(e=0,t=0)=>{let n=Math.trunc(t);return e<0||n<1?I.NUM:AF(n/2,e/2)}),qF(`CHISQ.INV`,2,2,(e=0,t=0)=>{let n=Math.trunc(t);return e<0||e>=1||n<1?I.NUM:e===0?0:BF(e=>kF(n/2,e/2),e,0,n)}),qF(`CHISQ.INV.RT`,2,2,(e=0,t=0)=>{let n=Math.trunc(t);return e<=0||e>1||n<1?I.NUM:e===1?0:BF(e=>-AF(n/2,e/2),-e,0,n)});let $F=(e,t,n)=>MF(t/2,n/2,t*e/(t*e+n)),eI=(e,t,n)=>MF(n/2,t/2,n/(t*e+n));JF(`F.DIST`,3,(e,t=0,n=0,r=0)=>{let i=Math.trunc(n),a=Math.trunc(r);if(t<0||i<1||a<1)return I.NUM;if(e)return $F(t,i,a);if(t===0)return i===2?1:i<2?I.NUM:0;let o=wF((i+a)/2)-wF(i/2)-wF(a/2)+i/2*Math.log(i/a)+(i/2-1)*Math.log(t)-(i+a)/2*Math.log(1+i*t/a);return Math.exp(o)}),qF(`F.DIST.RT`,3,3,(e=0,t=0,n=0)=>{let r=Math.trunc(t),i=Math.trunc(n);return e<0||r<1||i<1?I.NUM:eI(e,r,i)}),qF(`F.INV`,3,3,(e=0,t=0,n=0)=>{let r=Math.trunc(t),i=Math.trunc(n);return e<0||e>1||r<1||i<1?I.NUM:e===0?0:e===1?I.NUM:BF(e=>$F(e,r,i),e,0,1)}),qF(`F.INV.RT`,3,3,(e=0,t=0,n=0)=>{let r=Math.trunc(t),i=Math.trunc(n);return e<=0||e>1||r<1||i<1?I.NUM:e===1?0:BF(e=>-eI(e,r,i),-e,0,1)}),JF(`GAMMA.DIST`,3,(e,t=0,n=0,r=0)=>t<0||n<=0||r<=0?I.NUM:e?kF(n,t/r):t===0?n===1?1/r:n<1?I.NUM:0:Math.exp((n-1)*Math.log(t)-t/r-n*Math.log(r)-wF(n))),qF(`GAMMA.INV`,3,3,(e=0,t=0,n=0)=>e<0||e>=1||t<=0||n<=0?I.NUM:e===0?0:n*BF(e=>kF(t,e),e,0,t));let tI=(e,t,n)=>Math.exp(wF(t+n)-wF(t)-wF(n)+(t-1)*Math.log(e)+(n-1)*Math.log1p(-e));JF(`BETA.DIST`,3,(e,t=0,n=0,r=0,i=0,a=1)=>{let o=Number.isNaN(i)?0:i,s=Number.isNaN(a)?1:a;if(n<=0||r<=0||t<o||t>s||o===s)return I.NUM;let c=(t-o)/(s-o);return e?MF(n,r,c):tI(c,n,r)/(s-o)},2),qF(`BETADIST`,3,5,(e=0,t=0,n=0,r=0,i=1)=>{let a=Number.isNaN(r)?0:r,o=Number.isNaN(i)?1:i;return t<=0||n<=0||e<a||e>o||a===o?I.NUM:MF(t,n,(e-a)/(o-a))}),qF(`BETA.INV`,3,5,(e=0,t=0,n=0,r=0,i=1)=>{let a=Number.isNaN(r)?0:r,o=Number.isNaN(i)?1:i;return e<=0||e>1||t<=0||n<=0||a>=o?I.NUM:a+(o-a)*BF(e=>MF(t,n,e),e,0,.5,1)}),gw(`BETAINV`,`BETA.INV`);let nI=(e,t)=>wF(e+1)-wF(t+1)-wF(e-t+1),rI=(e,t,n)=>n===0?+(e===0):n===1?+(e===t):Math.exp(nI(t,e)+e*Math.log(n)+(t-e)*Math.log1p(-n)),iI=(e,t,n)=>e>=t||n===0?1:n===1?0:1-MF(e+1,t-e,n);JF(`BINOM.DIST`,3,(e,t=0,n=0,r=0)=>{let i=Math.trunc(t),a=Math.trunc(n);return i<0||i>a||r<0||r>1?I.NUM:e?iI(i,a,r):rI(i,a,r)}),qF(`BINOM.INV`,3,3,(e=0,t=0,n=0)=>{let r=Math.trunc(e);if(r<0||t<=0||t>=1||n<=0||n>=1)return I.NUM;for(let e=0;e<r;e++)if(iI(e,r,t)>=n)return e;return r}),qF(`BINOM.DIST.RANGE`,3,4,(e=0,t=0,n=0,r=NaN)=>{let i=Math.trunc(e),a=Math.trunc(n),o=Number.isNaN(r)?a:Math.trunc(r);if(i<0||t<0||t>1||a<0||a>i||o<a||o>i)return I.NUM;let s=0;for(let e=a;e<=o;e++)s+=rI(e,i,t);return s}),JF(`NEGBINOM.DIST`,3,(e,t=0,n=0,r=0)=>{let i=Math.trunc(t),a=Math.trunc(n);return i<0||a<1||r<0||r>1?I.NUM:e?MF(a,i+1,r):r===0||r===1?+(r===1&&i===0):Math.exp(nI(i+a-1,a-1)+a*Math.log(r)+i*Math.log1p(-r))}),qF(`NEGBINOMDIST`,3,3,(e=0,t=0,n=0)=>{let r=Math.trunc(e),i=Math.trunc(t);return r<0||i<1||n<0||n>1?I.NUM:n===0||n===1?+(n===1&&r===0):Math.exp(nI(r+i-1,i-1)+i*Math.log(n)+r*Math.log1p(-n))}),JF(`POISSON.DIST`,2,(e,t=0,n=0)=>{let r=Math.trunc(t);return r<0||n<0?I.NUM:n===0?e||r===0?1:0:e?AF(r+1,n):Math.exp(r*Math.log(n)-n-wF(r+1))}),JF(`EXPON.DIST`,2,(e,t=0,n=0)=>t<0||n<=0?I.NUM:e?-Math.expm1(-n*t):n*Math.exp(-n*t)),JF(`WEIBULL.DIST`,3,(e,t=0,n=0,r=0)=>{if(t<0||n<=0||r<=0)return I.NUM;let i=(t/r)**n;return e?-Math.expm1(-i):n/r**n*t**(n-1)*Math.exp(-i)});let aI=(e,t,n,r)=>Math.exp(nI(n,e)+nI(r-n,t-e)-nI(r,t));JF(`HYPGEOM.DIST`,4,(e,t=0,n=0,r=0,i=0)=>{let a=Math.trunc(t),o=Math.trunc(n),s=Math.trunc(r),c=Math.trunc(i);if(a<0||a>o||a>s||o>c||s>c||o<=0||s<=0||c<=0||a<o-c+s)return I.NUM;if(!e)return aI(a,o,s,c);let l=0;for(let e=Math.max(0,o-c+s);e<=a;e++)l+=aI(e,o,s,c);return Math.min(1,l)}),qF(`HYPGEOMDIST`,4,4,(e=0,t=0,n=0,r=0)=>{let i=Math.trunc(e),a=Math.trunc(t),o=Math.trunc(n),s=Math.trunc(r);return i<0||i>a||i>o||a>s||o>s||i<a-s+o?I.NUM:aI(i,a,o,s)}),qF(`GAMMA`,1,1,(e=0)=>YF(TF(e))),qF(`GAMMALN`,1,1,(e=0)=>e<=0?I.NUM:wF(e)),gw(`GAMMALN.PRECISE`,`GAMMALN`),qF(`ERF`,1,2,(e=0,t=NaN)=>Number.isNaN(t)?NF(e):NF(t)-NF(e)),qF(`ERFC`,1,1,(e=0)=>PF(e)),gw(`ERF.PRECISE`,`ERF`),gw(`ERFC.PRECISE`,`ERFC`);for(let[e,t]of[[`NORMDIST`,`NORM.DIST`],[`NORMINV`,`NORM.INV`],[`NORMSINV`,`NORM.S.INV`],[`LOGINV`,`LOGNORM.INV`],[`CHIINV`,`CHISQ.INV.RT`],[`CHIDIST`,`CHISQ.DIST.RT`],[`FDIST`,`F.DIST.RT`],[`FINV`,`F.INV.RT`],[`BINOMDIST`,`BINOM.DIST`],[`CRITBINOM`,`BINOM.INV`],[`POISSON`,`POISSON.DIST`],[`EXPONDIST`,`EXPON.DIST`],[`GAMMADIST`,`GAMMA.DIST`],[`GAMMAINV`,`GAMMA.INV`],[`TINV`,`T.INV.2T`],[`WEIBULL`,`WEIBULL.DIST`],[`CONFIDENCE`,`CONFIDENCE.NORM`]])gw(e,t);let oI=2**48;function sI(e,t){let[n=`0`,r=`0`]=e.toExponential().split(`e`);return Number(`${n}e${String(Number(r)+t)}`)}let cI=e=>Number(e.toPrecision(15));function lI(e,t,n){let r=Math.trunc(t),i=sI(Math.abs(cI(e)),r);if(i>=2**53)return e;let a=sI(n(i),-r);return e<0?-a:a}V(`ROUND`,2,2,xw((e=0,t=0)=>lI(e,t,e=>Math.floor(e+.5)))),V(`ROUNDUP`,2,2,xw((e=0,t=0)=>lI(e,t,Math.ceil))),V(`ROUNDDOWN`,2,2,xw((e=0,t=0)=>lI(e,t,Math.floor))),V(`MOD`,2,2,xw((e=0,t=0)=>{if(t===0)return I.DIV0;let n=e%t;return n!==0&&n<0!=t<0?n+t:n})),V(`QUOTIENT`,2,2,xw((e=0,t=0)=>t===0?I.DIV0:Math.trunc(e/t))),V(`POWER`,2,2,xw((e=0,t=0)=>{if(e===0&&t===0)return I.NUM;if(e===0&&t<0)return I.DIV0;let n=e**t;return Number.isFinite(n)?n:I.NUM})),V(`LOG`,1,2,(e,t)=>{let n=z(e),r=t==null?10:z(t);return n instanceof F?n:r instanceof F?r:n<=0||r<=0?I.NUM:r===1?I.DIV0:r===10?Math.log10(n):r===2?Math.log2(n):Math.log(n)/Math.log(r)});function uI(e,t){let[n,r]=[e,t];for(;r!==0;)[n,r]=[r,n%r];return n}function dI(e,t){let n=yw(e,t);if(n instanceof F)return n;let r=n.map(Math.trunc);return r.some(e=>e<0||e>=2**53)?I.NUM:r}H(`GCD`,`(r)`,(e,t)=>{let n=dI(e,t);return n instanceof F?n:n.reduce(uI,0)}),H(`LCM`,`(r)`,(e,t)=>{let n=dI(e,t);if(n instanceof F)return n;if(n.includes(0))return 0;let r=n.reduce((e,t)=>e*t/uI(e,t),1);return Number.isFinite(r)?r:I.NUM}),V(`BASE`,2,3,xw((e=0,t=0,n=NaN)=>{let r=Math.trunc(e),i=Math.trunc(t),a=Number.isNaN(n)?0:Math.trunc(n);return r<0||r>=2**53||i<2||i>36||a<0||a>255?I.NUM:r.toString(i).toUpperCase().padStart(a,`0`)}));let fI=[1e3,500,100,50,10,5,1];function pI(e,t){let n=e=>fI[e]??1,r=e=>`MDCLXVI`.charAt(e),i=fI.length-1,a=e,o=``;for(let e=0;e<=i/2;e++){let s=2*e,c=Math.floor(a/n(s));if(c%5==4){let e=c===4?s-1:s-2,l=s,u=0;for(;u<t&&l<i;)u+=1,n(e)-n(l+1)<=a?l+=1:u=t;o+=r(l)+r(e),a+=n(l)-n(e)}else c>4&&(o+=r(s-1)),o+=r(s).repeat(c%5),a%=n(s)}return o}V(`ROMAN`,1,2,(e,t)=>{let n=z(e);if(n instanceof F)return n;let r=0;if(typeof t==`boolean`)r=t?0:4;else if(t!=null){let e=z(t);if(e instanceof F)return e;r=Math.trunc(e)}let i=Math.trunc(n);return i<0||i>3999||r<0||r>4?I.VALUE:pI(i,r)});function mI(e){return!Number.isInteger(e)||e<0||e>=oI?I.NUM:BigInt(e)}for(let[e,t]of[[`BITAND`,(e,t)=>e&t],[`BITOR`,(e,t)=>e|t],[`BITXOR`,(e,t)=>e^t]])V(e,2,2,xw((e=0,n=0)=>{let r=mI(e),i=mI(n);return r instanceof F?r:i instanceof F?i:Number(t(r,i))}));for(let[e,t]of[[`BITLSHIFT`,1],[`BITRSHIFT`,-1]])V(e,2,2,xw((e=0,n=0)=>{let r=mI(e);if(r instanceof F)return r;let i=Math.trunc(n)*t;if(Math.abs(i)>53)return I.NUM;let a=i>=0?r<<BigInt(i):r>>BigInt(-i);return a>=BigInt(oI)?I.NUM:Number(a)}));for(let[e,t,n]of[[`BESSELJ`,UF,!1],[`BESSELI`,GF,!1],[`BESSELY`,WF,!0],[`BESSELK`,KF,!0]])V(e,2,2,xw((e=0,r=0)=>{let i=Math.trunc(r);if(i<0||n&&e<=0)return I.NUM;let a=t(i,e);return Number.isFinite(a)?a:I.NUM}));V(`SLN`,3,3,xw((e=0,t=0,n=0)=>n===0?I.DIV0:(e-t)/n)),H(`GEOMEAN`,`(r)`,(e,t)=>{let n=yw(e,t);return n instanceof F?n:n.length===0||n.some(e=>e<=0)?I.NUM:Math.exp(n.reduce((e,t)=>e+Math.log(t),0)/n.length)}),H(`HARMEAN`,`(r)`,(e,t)=>{let n=yw(e,t);return n instanceof F?n:n.length===0||n.some(e=>e<=0)?I.NUM:n.length/n.reduce((e,t)=>e+1/t,0)}),H(`KURT`,`(r)`,(e,t)=>{let n=yw(e,t);if(n instanceof F)return n;let r=n.length;if(r<4)return I.DIV0;let i=n.reduce((e,t)=>e+t,0)/r,a=n.reduce((e,t)=>e+(t-i)**2,0)/(r-1);if(a===0)return I.DIV0;let o=n.reduce((e,t)=>e+(t-i)**4,0)/a**2;return r*(r+1)/((r-1)*(r-2)*(r-3))*o-3*(r-1)**2/((r-2)*(r-3))});function hI(e,t){let n=[],r;return vw(e,t,(e,t)=>{if(!r){if(e instanceof F)r=e;else if(typeof e==`number`)n.push(e);else if(t&&e!==null){let t=z(e);t instanceof F?r=t:n.push(t)}}}),r??n}H(`MODE.SNGL`,`(r)`,(e,t)=>{let n=hI(e,t);if(n instanceof F)return n;let r=/* @__PURE__ */ new Map;for(let e of n)r.set(e,(r.get(e)??0)+1);let i,a=1;for(let[e,t]of r)t>a&&(i=e,a=t);return i??I.NA}),gw(`MODE`,`MODE.SNGL`),H(`MODE.MULT`,`(r)`,(e,t)=>{let n=hI(e,t);if(n instanceof F)return n;let r=/* @__PURE__ */ new Map;for(let e of n)r.set(e,(r.get(e)??0)+1);let i=0;for(let e of r.values())i=Math.max(i,e);if(i<2)return I.NA;let a=[...r].filter(([,e])=>e===i).map(([e])=>e);return new L(a.length,1,a)});function gI(e,t){let n=t*(e.length-1),r=Math.floor(n),i=e[r]??0,a=e[r+1]??i;return i+(n-r)*(a-i)}H(`QUARTILE.INC`,`rv`,(e,t)=>{let n=yw([e[0]],t);if(n instanceof F)return n;let r=z(t.calc.scalar(e[1],t.frame));if(r instanceof F)return r;let i=Math.trunc(r);return n.length===0||i<0||i>4?I.NUM:gI([...n].sort((e,t)=>e-t),i/4)}),gw(`QUARTILE`,`QUARTILE.INC`);function _I(e,t){let n=z(t.calc.scalar(e[0],t.frame));if(n instanceof F)return n;let r=yw([e[1]],t);if(r instanceof F)return r;let i=e[2]===void 0?0:z(t.calc.scalar(e[2],t.frame));if(i instanceof F)return i;let a=r.filter(e=>e===n).length;return a===0?I.NA:{before:r.filter(e=>i===0?e>n:e<n).length,ties:a}}H(`RANK.EQ`,`vr?v`,(e,t)=>{let n=_I(e,t);return n instanceof F?n:n.before+1}),H(`RANK.AVG`,`vr?v`,(e,t)=>{let n=_I(e,t);return n instanceof F?n:n.before+(n.ties+1)/2}),gw(`RANK`,`RANK.EQ`);function vI(e,t){let n=U(e,t);if(n instanceof F)return n;let r=[];for(let e=0;e<n.rows;e++){let t=[];for(let r=0;r<n.cols;r++){let i=n.at(e,r);if(i instanceof F)return i;if(typeof i!=`number`)return I.VALUE;t.push(i)}r.push(t)}return r}let yI=e=>new L(e.length,e[0]?.length??0,e.flat());function bI(e,t){let n=t[0]?.length??0;return e.map(e=>Array.from({length:n},(n,r)=>e.reduce((e,n,i)=>e+n*(t[i]?.[r]??0),0)))}H(`MMULT`,`rr`,(e,t)=>{let n=vI(e[0],t),r=vI(e[1],t);return n instanceof F?n:r instanceof F?r:(n[0]?.length??0)===r.length?yI(bI(n,r)):I.VALUE});function xI(e){let t=e.length,n=e.map((e,n)=>[...e,...Array.from({length:t},(e,t)=>+(n===t))]),r=(e,t)=>n[e]?.[t]??0,i=1;for(let e=0;e<t;e++){let a=e;for(let n=e+1;n<t;n++)Math.abs(r(n,e))>Math.abs(r(a,e))&&(a=n);if(r(a,e)===0)return{determinant:0};if(a!==e){let[t=[],r=[]]=[n[e],n[a]];n[e]=r,n[a]=t,i=-i}let o=r(e,e);i*=o,n[e]=(n[e]??[]).map(e=>e/o);for(let i=0;i<t;i++){if(i===e)continue;let t=r(i,e),a=n[e]??[];n[i]=(n[i]??[]).map((e,n)=>e-t*(a[n]??0))}}return{determinant:i,inverse:n.map(e=>e.slice(t))}}let SI=e=>e.length>0&&e.every(t=>t.length===e.length);H(`MDETERM`,`r`,(e,t)=>{let n=vI(e[0],t);return n instanceof F?n:SI(n)?xI(n).determinant:I.VALUE}),H(`MINVERSE`,`r`,(e,t)=>{let n=vI(e[0],t);if(n instanceof F)return n;if(!SI(n))return I.VALUE;let{inverse:r}=xI(n);return r?yI(r):I.NUM}),V(`MUNIT`,1,1,xw((e=0)=>{let t=Math.trunc(e);return t<1||t>73?I.VALUE:yI(Array.from({length:t},(e,n)=>Array.from({length:t},(e,t)=>+(n===t))))}));function CI(e,t,n){let r=U(e,n),i=U(t,n);if(r instanceof F)return r;if(i instanceof F)return i;if(r.rows*r.cols!==i.rows*i.cols)return I.NA;let a=[],o=[];for(let e=0;e<r.rows;e++)for(let t=0;t<r.cols;t++){let n=r.at(e,t),s=i.rows===r.rows?i.at(e,t):i.at(t,e);if(n instanceof F)return n;if(s instanceof F)return s;typeof n==`number`&&typeof s==`number`&&(a.push(n),o.push(s))}return{xs:a,ys:o}}for(let[e,t]of[[`SUMX2MY2`,(e,t)=>e*e-t*t],[`SUMX2PY2`,(e,t)=>e*e+t*t],[`SUMXMY2`,(e,t)=>(e-t)**2]])H(e,`rr`,(e,n)=>{let r=CI(e[0],e[1],n);return r instanceof F?r:r.xs.length===0?I.DIV0:r.xs.reduce((e,n,i)=>e+t(n,r.ys[i]??0),0)});H(`SERIESSUM`,`vvvr`,(e,t)=>{let[n,r,i]=e.slice(0,3).map(e=>z(t.calc.scalar(e,t.frame)));if(n instanceof F)return n;if(r instanceof F)return r;if(i instanceof F)return i;let a=yw([e[3]],t);return a instanceof F?a:a.reduce((e,t,a)=>e+t*(n??0)**((r??0)+a*(i??0)),0)}),H(`FREQUENCY`,`rr`,(e,t)=>{let n=yw([e[0]],t);if(n instanceof F)return n;let r=[];_w([e[1]],t,e=>{typeof e==`number`&&r.push(e)});let i=r.map((e,t)=>({b:e,i:t})).sort((e,t)=>e.b-t.b),a=Array(r.length+1).fill(0);for(let e of n){let t=0,n=i.length;for(;t<n;){let r=t+n>>1;e<=(i[r]?.b??1/0)?n=r:t=r+1}let o=i[t]?.i??r.length;a[o]=(a[o]??0)+1}return new L(a.length,1,a)}),H(`PROB`,`rrv?v`,(e,t)=>{let n=CI(e[0],e[1],t);if(n instanceof F)return n;let r=z(t.calc.scalar(e[2],t.frame));if(r instanceof F)return r;let i=e[3]===void 0?r:z(t.calc.scalar(e[3],t.frame));if(i instanceof F)return i;let a=n.ys.reduce((e,t)=>e+t,0);return n.ys.some(e=>e<=0||e>1)||Math.abs(a-1)>1e-12?I.NUM:n.xs.reduce((e,t,a)=>t>=r&&t<=i?e+(n.ys[a]??0):e,0)});let wI=e=>e.reduce((e,t)=>e+t,0);function TI(e,t,n){let r=t.map(e=>n?[...e,1]:[...e]),i=r[0]?.length??0,{inverse:a}=xI(Array.from({length:i},(e,t)=>Array.from({length:i},(e,n)=>r.reduce((e,r)=>e+(r[t]??0)*(r[n]??0),0))));if(!a)return;let o=Array.from({length:i},(t,n)=>r.reduce((t,r,i)=>t+(r[n]??0)*(e[i]??0),0)),s=a.map(e=>e.reduce((e,t,n)=>e+t*(o[n]??0),0));return n?s:[...s,0]}function EI(e,t,n){let r=vI(e[0],t);if(r instanceof F)return r;let i=r.length===1,a=r.flat();if(n&&a.some(e=>e<=0))return I.NUM;let o=n?a.map(Math.log):a,s=e[1];if(s===void 0||!DI(s))return{ys:o,xs:a.map((e,t)=>[t+1]),byRow:i};let c=vI(s,t);if(c instanceof F)return c;let l=c[0]?.length??0;return i?l===o.length?{ys:o,xs:Array.from({length:l},(e,t)=>c.map(e=>e[t]??0)),byRow:i}:I.REF:c.length===o.length?{ys:o,xs:c,byRow:i}:I.REF}let DI=e=>e instanceof R||e instanceof L||typeof e==`number`,OI=(e,t)=>e===void 0||!DI(e)&&typeof e!=`boolean`||$C(t.calc.scalar(e,t.frame));function kI(e){return(t,n)=>{let r=EI(t,n,e);if(r instanceof F)return r;let i=OI(t[3],n);if(i instanceof F)return i;let a=TI(r.ys,r.xs,i);if(!a)return I.NUM;let o=t[2],s=r.xs;if(o!==void 0&&DI(o)){let e=vI(o,n);if(e instanceof F)return e;let t=r.xs[0]?.length??1,i=e[0]?.length??0;s=r.byRow||t===1&&e.length===1?Array.from({length:i},(t,n)=>e.map(e=>e[n]??0)):e}let c=s.map(t=>{let n=t.reduce((e,t,n)=>e+t*(a[n]??0),0)+(a[t.length]??0);return e?Math.exp(n):n});return r.byRow?new L(1,c.length,c):new L(c.length,1,c)}}H(`TREND`,`r?rrv`,kI(!1)),H(`GROWTH`,`r?rrv`,kI(!0));function AI(e,t,n,r){let i=t.map(e=>r?[...e,1]:[...e]),a=i[0]?.length??0,{inverse:o}=xI(Array.from({length:a},(e,t)=>Array.from({length:a},(e,n)=>i.reduce((e,r)=>e+(r[t]??0)*(r[n]??0),0))));if(!o)return;let s=t.map(e=>e.reduce((e,t,r)=>e+t*(n[r]??0),0)+(n[e.length]??0)),c=e.reduce((e,t,n)=>e+(t-(s[n]??0))**2,0),l=r?wI(e)/e.length:0,u=e.reduce((e,t)=>e+(t-l)**2,0),d=u-c,f=e.length-a,p=f>0?c/f:0,m=o.map((e,t)=>Math.sqrt(Math.max(0,(e[t]??0)*p))),h=t[0]?.length??0;return{errors:m,r2:u===0?1:d/u,sey:Math.sqrt(p),f:f>0&&c>0?d/h/(c/f):0,df:f,ssreg:d,ssresid:c}}function jI(e){return(t,n)=>{let r=EI(t,n,e);if(r instanceof F)return r;let i=OI(t[2],n);if(i instanceof F)return i;let a=TI(r.ys,r.xs,i);if(!a)return I.NUM;let o=[...a.slice(0,-1).reverse(),a[a.length-1]??0],s=e?o.map(Math.exp):o,c=t[3],l=c===void 0||!MI(c)?!1:$C(n.calc.scalar(c,n.frame));if(l instanceof F)return l;if(!l)return new L(1,s.length,s);let u=AI(r.ys,r.xs,a,i);if(!u)return I.NUM;let d=s.length,f=e=>[...e,...Array(d-e.length).fill(I.NA)],p=i?[...u.errors.slice(0,-1).reverse(),u.errors[u.errors.length-1]??0]:[...[...u.errors].reverse(),I.NA];return new L(5,d,[...s,...p,...f([u.r2,u.sey]),...f([u.f,u.df]),...f([u.ssreg,u.ssresid])])}}let MI=e=>DI(e)||typeof e==`boolean`;H(`LINEST`,`r?rvv`,jI(!1)),H(`LOGEST`,`r?rvv`,jI(!0));let NI=e=>wI(e)/e.length,PI=e=>{let t=NI(e);return e.reduce((e,n)=>e+(n-t)**2,0)/(e.length-1)};H(`CHISQ.TEST`,`rr`,(e,t)=>{let n=vI(e[0],t),r=vI(e[1],t);if(n instanceof F)return n;if(r instanceof F)return r;let i=n.length,a=n[0]?.length??0;if(r.length!==i||(r[0]?.length??0)!==a||i*a<2)return I.NA;let o=0;for(let e=0;e<i;e++)for(let t=0;t<a;t++){let i=r[e]?.[t]??0;if(i<0)return I.NUM;if(i===0)return I.DIV0;o+=((n[e]?.[t]??0)-i)**2/i}return AF((i>1&&a>1?(i-1)*(a-1):i>1?i-1:a-1)/2,o/2)}),gw(`CHITEST`,`CHISQ.TEST`),H(`T.TEST`,`rrvv`,(e,t)=>{let n=z(t.calc.scalar(e[2],t.frame)),r=z(t.calc.scalar(e[3],t.frame));if(n instanceof F)return n;if(r instanceof F)return r;let i=Math.trunc(n),a=Math.trunc(r);if(i!==1&&i!==2||a<1||a>3)return I.NUM;let o,s;if(a===1){let n=CI(e[0],e[1],t);if(n instanceof F)return n;let r=n.xs.map((e,t)=>e-(n.ys[t]??0));if(r.length<2)return I.DIV0;o=NI(r)/Math.sqrt(PI(r)/r.length),s=r.length-1}else{let n=yw([e[0]],t),r=yw([e[1]],t);if(n instanceof F)return n;if(r instanceof F)return r;if(n.length<2||r.length<2)return I.DIV0;let[i,c,l,u]=[PI(n),PI(r),n.length,r.length],d=Math.abs(NI(n)-NI(r));if(a===2){s=l+u-2;let e=((l-1)*i+(u-1)*c)/s;o=d/Math.sqrt(e*(1/l+1/u))}else{let e=i/l,t=c/u;o=d/Math.sqrt(e+t),s=(e+t)**2/(e**2/(l-1)+t**2/(u-1))}}return Number.isFinite(o)?MF(s/2,.5,s/(s+o*o))*i/2:I.DIV0}),gw(`TTEST`,`T.TEST`),H(`F.TEST`,`rr`,(e,t)=>{let n=yw([e[0]],t),r=yw([e[1]],t);if(n instanceof F)return n;if(r instanceof F)return r;if(n.length<2||r.length<2)return I.DIV0;let[i,a]=[PI(n),PI(r)];if(i===0||a===0)return I.DIV0;let o=i/a,[s,c]=[n.length-1,r.length-1],l=MF(c/2,s/2,c/(s*o+c));return 2*Math.min(l,1-l)}),gw(`FTEST`,`F.TEST`),H(`Z.TEST`,`rv?v`,(e,t)=>{let n=yw([e[0]],t);if(n instanceof F)return n;let r=z(t.calc.scalar(e[1],t.frame));if(r instanceof F)return r;if(n.length===0)return I.NA;let i=e[2]===void 0?n.length<2?I.DIV0:Math.sqrt(PI(n)):z(t.calc.scalar(e[2],t.frame));return i instanceof F?i:i===0?I.DIV0:1-IF((NI(n)-r)/(i/Math.sqrt(n.length)))}),gw(`ZTEST`,`Z.TEST`);let FI={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`,12:`MEDIAN`,13:`MODE.SNGL`,14:`LARGE`,15:`SMALL`,16:`PERCENTILE.INC`,17:`QUARTILE.INC`,18:`PERCENTILE.EXC`,19:`QUARTILE.EXC`};H(`AGGREGATE`,`vv(r)`,(e,t)=>{let n=z(t.calc.scalar(e[0],t.frame)),r=z(t.calc.scalar(e[1],t.frame));if(n instanceof F)return n;if(r instanceof F)return r;let i=FI[Math.trunc(n)],a=i===void 0?void 0:dw.get(i);if(a===void 0)return I.VALUE;let o=![2,3,6,7].includes(Math.trunc(r)),s=[1,3,5,7].includes(Math.trunc(r)),c=e=>{let n=e instanceof pg?e.parts:[e],r=[];for(let e of n)if(e instanceof R){let n=e;for(let e=n.top;e<=Math.min(n.bottom,n.sheet.lastRow);e++)if(!s||n.sheet.spec.rows?.[String(e+1)]?.hidden!==!0&&!t.calc.filtered(n.sheet).has(e))for(let i=n.left;i<=n.right;i++)r.push(t.calc.read(n.sheet,e,i))}else{let n=t.calc.flat(e);n instanceof L?_g(r,n.data):r.push(n)}let i=o?r:r.filter(e=>!(e instanceof F));return new L(i.length,1,i)},l=Math.trunc(n)>=14,u=e.slice(2),d=l?[c(u[0]),...u.slice(1)]:u.map(c);return t.calc.applyFunction(a,d,t.frame)}),V(`FACT`,1,1,xw(e=>{if(e<0)return I.NUM;let t=1;for(let n=2;n<=Math.trunc(e);n++)t*=n;return Number.isFinite(t)?t:I.NUM})),V(`FACTDOUBLE`,1,1,xw(e=>{if(e<0)return I.NUM;let t=1;for(let n=Math.trunc(e);n>1;n-=2)t*=n;return Number.isFinite(t)?t:I.NUM})),V(`ATAN2`,2,2,xw((e,t)=>e===0&&t===0?I.DIV0:Math.atan2(t,e)));let II={largest:/* @__PURE__ */ new WeakMap,smallest:/* @__PURE__ */ new WeakMap};function LI(e,t,n){let r=()=>{let r=yw([e],n);return r instanceof F?r:r.sort((e,n)=>t?n-e:e-n)};if(e instanceof R)return n.calc.indexes.ofRepeated(uw(t?`large`:`small`,e),[e],()=>{let e=r();return new Map(e instanceof F?[]:[[``,e]])})?.get(``)??r();if(!(e instanceof L))return r();let i=t?II.largest:II.smallest,a=i.get(e);if(a)return a;let o=r();return o instanceof F||i.set(e,a===null?o:null),o}for(let[e,t]of[[`LARGE`,!0],[`SMALL`,!1]])H(e,`rv`,(e,n)=>{let r=LI(e[0],t,n);if(r instanceof F)return r;let i=z(e[1]);if(i instanceof F)return i;let a=Math.ceil(i);return a<1||a>r.length?I.NUM:r[a-1]??I.NUM});let RI=.0254,zI=12*RI,BI=3*zI,VI=5280*zI,HI=1852,UI=9460730472580800,WI=RI/72,GI=453.59237,KI=9.80665,qI=GI/1e3*KI,JI=zI*qI,YI=231*RI**3/128,XI=.00454609,ZI=101325,QI=550*JI,$I=/* @__PURE__ */ new Map;function $(e,t){for(let n of e)$I.set(n,t)}let eL=(e,t)=>({quantity:e,factor:t,prefix:1});$([`g`],eL(`mass`,1)),$([`sg`],{quantity:`mass`,factor:qI*1e3/zI}),$([`lbm`],{quantity:`mass`,factor:GI}),$([`u`],eL(`mass`,1660538782e-33)),$([`ozm`],{quantity:`mass`,factor:GI/16}),$([`grain`],{quantity:`mass`,factor:GI/7e3}),$([`cwt`,`shweight`],{quantity:`mass`,factor:100*GI}),$([`uk_cwt`,`lcwt`,`hweight`],{quantity:`mass`,factor:112*GI}),$([`stone`],{quantity:`mass`,factor:14*GI}),$([`ton`],{quantity:`mass`,factor:2e3*GI}),$([`uk_ton`,`LTON`,`brton`],{quantity:`mass`,factor:2240*GI}),$([`m`],eL(`distance`,1)),$([`mi`],{quantity:`distance`,factor:VI}),$([`Nmi`],{quantity:`distance`,factor:HI}),$([`in`],{quantity:`distance`,factor:RI}),$([`ft`],{quantity:`distance`,factor:zI}),$([`yd`],{quantity:`distance`,factor:BI}),$([`ang`],eL(`distance`,1e-10)),$([`ell`],{quantity:`distance`,factor:45*RI}),$([`ly`],eL(`distance`,UI)),$([`parsec`,`pc`],eL(`distance`,648e3/Math.PI*149597870700)),$([`Picapt`,`Pica`],{quantity:`distance`,factor:WI}),$([`pica`],{quantity:`distance`,factor:RI/6}),$([`survey_mi`],{quantity:`distance`,factor:6336e3/3937}),$([`yr`],{quantity:`time`,factor:31557600}),$([`day`,`d`],{quantity:`time`,factor:86400}),$([`hr`],{quantity:`time`,factor:3600}),$([`mn`,`min`],{quantity:`time`,factor:60}),$([`sec`,`s`],eL(`time`,1)),$([`Pa`,`p`],eL(`pressure`,1)),$([`atm`,`at`],eL(`pressure`,ZI)),$([`mmHg`],eL(`pressure`,ZI/760)),$([`psi`],{quantity:`pressure`,factor:qI/RI**2}),$([`Torr`],{quantity:`pressure`,factor:ZI/760}),$([`N`],eL(`force`,1)),$([`dyn`,`dy`],eL(`force`,1e-5)),$([`lbf`],{quantity:`force`,factor:qI}),$([`pond`],eL(`force`,KI/1e3)),$([`J`],eL(`energy`,1)),$([`e`],eL(`energy`,1e-7)),$([`c`],eL(`energy`,4.184)),$([`cal`],eL(`energy`,4.1868)),$([`eV`,`ev`],eL(`energy`,1602176487e-28)),$([`HPh`,`hh`],{quantity:`energy`,factor:QI*3600}),$([`Wh`,`wh`],eL(`energy`,3600)),$([`flb`],{quantity:`energy`,factor:JI}),$([`BTU`,`btu`],{quantity:`energy`,factor:1055.05585262}),$([`HP`,`h`],{quantity:`power`,factor:QI}),$([`PS`],{quantity:`power`,factor:75*KI}),$([`W`,`w`],eL(`power`,1)),$([`T`],eL(`magnetism`,1)),$([`ga`],eL(`magnetism`,1e-4));let tL=(e,t,n=!1)=>{$(e,{quantity:`volume`,factor:t**3,...n?{prefix:3}:{}})};$([`tsp`],{quantity:`volume`,factor:YI/6}),$([`tspm`],{quantity:`volume`,factor:5e-6}),$([`tbs`],{quantity:`volume`,factor:YI/2}),$([`oz`],{quantity:`volume`,factor:YI}),$([`cup`],{quantity:`volume`,factor:8*YI}),$([`pt`,`us_pt`],{quantity:`volume`,factor:16*YI}),$([`uk_pt`],{quantity:`volume`,factor:XI/8}),$([`qt`],{quantity:`volume`,factor:32*YI}),$([`uk_qt`],{quantity:`volume`,factor:XI/4}),$([`gal`],{quantity:`volume`,factor:128*YI}),$([`uk_gal`],{quantity:`volume`,factor:XI}),$([`l`,`L`,`lt`],eL(`volume`,.001)),$([`barrel`],{quantity:`volume`,factor:5376*YI}),$([`bushel`],{quantity:`volume`,factor:2150.42*RI**3}),$([`GRT`,`regton`],{quantity:`volume`,factor:100*zI**3}),$([`MTON`],{quantity:`volume`,factor:40*zI**3}),tL([`m3`,`m^3`],1,!0),tL([`ang3`,`ang^3`],1e-10,!0),tL([`ft3`,`ft^3`],zI),tL([`in3`,`in^3`],RI),tL([`ly3`,`ly^3`],UI),tL([`mi3`,`mi^3`],VI),tL([`yd3`,`yd^3`],BI),tL([`Nmi3`,`Nmi^3`],HI),tL([`Pica3`,`Picapt3`,`Pica^3`,`Picapt^3`],WI);let nL=(e,t,n=!1)=>{$(e,{quantity:`area`,factor:t**2,...n?{prefix:2}:{}})};$([`uk_acre`],{quantity:`area`,factor:4840*BI**2}),$([`us_acre`],{quantity:`area`,factor:43560*(1200/3937)**2}),$([`ar`],eL(`area`,100)),$([`ha`],{quantity:`area`,factor:1e4}),$([`Morgen`],{quantity:`area`,factor:2500}),nL([`m2`,`m^2`],1,!0),nL([`ang2`,`ang^2`],1e-10,!0),nL([`ft2`,`ft^2`],zI),nL([`in2`,`in^2`],RI),nL([`ly2`,`ly^2`],UI),nL([`mi2`,`mi^2`],VI),nL([`yd2`,`yd^2`],BI),nL([`Nmi2`,`Nmi^2`],HI),nL([`Pica2`,`Picapt2`,`Pica^2`,`Picapt^2`],WI),$([`bit`],{quantity:`information`,factor:1,prefix:1,binary:!0}),$([`byte`],{quantity:`information`,factor:8,prefix:1,binary:!0}),$([`admkn`],{quantity:`speed`,factor:6080*zI/3600}),$([`kn`],{quantity:`speed`,factor:HI/3600}),$([`m/h`,`m/hr`],eL(`speed`,1/3600)),$([`m/s`,`m/sec`],eL(`speed`,1)),$([`mph`],{quantity:`speed`,factor:VI/3600});let rL={Y:1e24,Z:1e21,E:0xde0b6b3a7640000,P:0x38d7ea4c68000,T:0xe8d4a51000,G:1e9,M:1e6,k:1e3,h:100,da:10,e:10,d:.1,c:.01,m:.001,u:1e-6,n:1e-9,p:1e-12,f:1e-15,a:1e-18,z:1e-21,y:1e-24},iL={Yi:2**80,Zi:2**70,Ei:2**60,Pi:2**50,Ti:2**40,Gi:2**30,Mi:2**20,ki:1024},aL={C:{toK:e=>e+273.15,fromK:e=>e-273.15},F:{toK:e=>(e-32)*5/9+273.15,fromK:e=>(e-273.15)*9/5+32},K:{toK:e=>e,fromK:e=>e},Rank:{toK:e=>e*5/9,fromK:e=>e*9/5},Reau:{toK:e=>e*5/4+273.15,fromK:e=>(e-273.15)*4/5}},oL={C:`C`,cel:`C`,F:`F`,fah:`F`,K:`K`,kel:`K`,Rank:`Rank`,Reau:`Reau`};function sL(e){let t=oL[e];if(t!==void 0)return{kind:`temperature`,scale:t,times:1};let n=$I.get(e);if(n)return{kind:`unit`,quantity:n.quantity,factor:n.factor};for(let[t,n]of Object.entries(rL)){if(!e.startsWith(t))continue;let r=e.slice(t.length);if(oL[r]===`K`)return{kind:`temperature`,scale:`K`,times:n};let i=$I.get(r);if(i?.prefix!==void 0)return{kind:`unit`,quantity:i.quantity,factor:i.factor*n**i.prefix}}for(let[t,n]of Object.entries(iL)){if(!e.startsWith(t))continue;let r=$I.get(e.slice(t.length));if(r?.binary===!0)return{kind:`unit`,quantity:r.quantity,factor:r.factor*n}}}function cL(e,t,n){let r=sL(t),i=sL(n);if(!r||!i)return I.NA;if(r.kind===`temperature`||i.kind===`temperature`){if(r.kind!==`temperature`||i.kind!==`temperature`)return I.NA;let t=aL[r.scale],n=aL[i.scale];return!t||!n?I.NA:n.fromK(t.toK(e*r.times))/i.times}return r.quantity===i.quantity?e*r.factor/i.factor:I.NA}V(`CONVERT`,3,3,(e,t,n)=>{let r=z(e),i=B(t),a=B(n);return r instanceof F?r:i instanceof F?i:a instanceof F?a:cL(r,i,a)});let lL=5e6,uL=e=>Array.from({length:e.rows},(t,n)=>Array.from({length:e.cols},(t,r)=>e.at(n,r))),dL=e=>{let t=e[0]?.length??0;return new L(e.length,t,e.flat())},fL=e=>{let t=e[0]?.length??0;return Array.from({length:t},(t,n)=>e.map(e=>e[n]??null))};function pL(e,t){if(!(e===void 0||e instanceof hg))return t.calc.scalar(e,t.frame)}function mL(e,t,n){let r=pL(e,t);return r==null?n:z(r)}function hL(e,t,n){let r=pL(e,t);return r==null?n:$C(r)}function gL(e,t,n){if(e===void 0||e instanceof hg)return[n];let r=U(e,t);if(r instanceof F)return r;let i=[];for(let e=0;e<r.rows;e++)for(let t=0;t<r.cols;t++){let n=z(r.at(e,t));if(n instanceof F)return n;i.push(Math.trunc(n))}return i}let _L=e=>e===null||e===``;function vL(e,t,n){if(_L(e)||_L(t))return _L(e)&&_L(t)?0:_L(e)?1:-1;let r=Kw(e,t);return n?-r:r}function yL(e){return e instanceof F?e:e===null?!1:typeof e==`boolean`?e:typeof e==`number`?e!==0:I.VALUE}H(`FILTER`,`rr?r`,(e,t)=>{let n=U(e[0],t),r=U(e[1],t);if(n instanceof F)return n;if(r instanceof F)return r;if(r.rows>1&&r.cols>1)return I.VALUE;let i=r.cols===1&&r.rows===n.rows?!0:r.rows===1&&r.cols===n.cols?!1:void 0;if(i===void 0)return I.VALUE;let a=uL(n),o=i?a:fL(a),s=[];for(let e=0;e<o.length;e++){let t=yL(i?r.at(e,0):r.at(0,e));if(t instanceof F)return t;t&&s.push(o[e]??[])}return s.length===0?e[2]===void 0||e[2]instanceof hg?I.CALC:e[2]:dL(i?s:fL(s))}),H(`SORT`,`r?rrr`,(e,t)=>{let n=U(e[0],t);if(n instanceof F)return n;let r=gL(e[1],t,1);if(r instanceof F)return r;let i=gL(e[2],t,1);if(i instanceof F)return i;let a=hL(e[3],t,!1);if(a instanceof F)return a;let o=uL(n),s=a?fL(o):o,c=s[0]?.length??0;if(i.length!==1&&i.length!==r.length||r.some(e=>e<1||e>c)||i.some(e=>e!==1&&e!==-1))return I.VALUE;let l=s.map((e,t)=>({line:e,index:t})).sort((e,t)=>{for(let[n,a]of r.entries()){let r=i[i.length===1?0:n]??1,o=vL(e.line[a-1]??null,t.line[a-1]??null,r<0);if(o!==0)return o}return e.index-t.index}).map(e=>e.line);return dL(a?fL(l):l)}),H(`SORTBY`,`r(r)`,(e,t)=>{let n=U(e[0],t);if(n instanceof F)return n;let r=[],i;for(let a=1;a<e.length;a+=2){let o=U(e[a],t);if(o instanceof F)return o;if(o.rows>1&&o.cols>1)return I.VALUE;let s=o.cols===1&&o.rows===n.rows,c=o.rows===1&&o.cols===n.cols;if(!s&&!c)return I.VALUE;let l=i??s;if(l?!s:!c)return I.VALUE;i=l;let u=mL(e[a+1],t,1);if(u instanceof F)return u;if(u!==1&&u!==-1)return I.VALUE;r.push({values:uL(o).flat(),descending:u<0})}let a=uL(n),o=(i===!1?fL(a):a).map((e,t)=>({line:e,index:t})).sort((e,t)=>{for(let{values:n,descending:i}of r){let r=vL(n[e.index]??null,n[t.index]??null,i);if(r!==0)return r}return e.index-t.index}).map(e=>e.line);return dL(i===!1?fL(o):o)});let bL=e=>e instanceof F?`e${e.code}`:typeof e==`string`?`s${e.toLowerCase()}`:`${typeof e}${String(e)}`;H(`UNIQUE`,`r?rr`,(e,t)=>{let n=U(e[0],t);if(n instanceof F)return n;let r=hL(e[1],t,!1);if(r instanceof F)return r;let i=hL(e[2],t,!1);if(i instanceof F)return i;let a=uL(n),o=(n.reference?.rows??n.rows)-n.rows,s=e=>Array(e).fill(null);if(o>0&&r&&(a.length+o)*n.cols<=lL)for(let e=0;e<o;e++)a.push(s(n.cols));let c=r?fL(a):a,l=/* @__PURE__ */ new Map,u=(e,t)=>{let n=e.map(bL).join(`\0`),r=l.get(n);r?r.count+=t:l.set(n,{line:e,count:t})};for(let e of c)u(e,1);o>0&&!r&&u(s(n.cols),o);let d=[...l.values()].filter(e=>!i||e.count===1).map(e=>e.line);return d.length===0?I.CALC:dL(r?fL(d):d)});function xL(e,t){if(e instanceof F)return e;if(t instanceof F)return t;let n=Math.trunc(e),r=Math.trunc(t);return n<0||r<0?I.VALUE:n===0||r===0?I.CALC:n>1048576||r>16384||n*r>lL?I.VALUE:{rows:n,cols:r}}H(`SEQUENCE`,`r?rrr`,(e,t)=>{let n=xL(mL(e[0],t,1),mL(e[1],t,1));if(n instanceof F)return n;let r=mL(e[2],t,1);if(r instanceof F)return r;let i=mL(e[3],t,1);if(i instanceof F)return i;let a=Array(n.rows*n.cols);for(let e=0;e<a.length;e++)a[e]=r+e*i;return new L(n.rows,n.cols,a)}),H(`RANDARRAY`,`?rrrrr`,(e,t)=>{let n=xL(mL(e[0],t,1),mL(e[1],t,1));if(n instanceof F)return n;let r=mL(e[2],t,0);if(r instanceof F)return r;let i=mL(e[3],t,1);if(i instanceof F)return i;let a=hL(e[4],t,!1);if(a instanceof F)return a;if(r>i||a&&(!Number.isInteger(r)||!Number.isInteger(i)))return I.VALUE;let o=Array(n.rows*n.cols);for(let e=0;e<o.length;e++){let n=t.calc.random();o[e]=a?r+Math.floor(n*(i-r+1)):r+n*(i-r)}return new L(n.rows,n.cols,o)},{volatile:!0}),H(`TEXTSPLIT`,`vr?rvvv`,(e,t)=>{let n=pL(e[0],t);if(n instanceof F)return n;let r=B(n??``);if(r instanceof F)return r;let i=PT(e[1],t);if(i instanceof F)return i;let a=PT(e[2],t);if(a instanceof F)return a;if(i.length===0&&a.length===0||i.includes(``)||a.includes(``))return I.VALUE;let o=hL(e[3],t,!1);if(o instanceof F)return o;let s=mL(e[4],t,0);if(s instanceof F)return s;let c=pL(e[5],t)??I.NA,l=s===1,u=(a.length===0?[r]:IT(r,a,l)).filter(e=>!(o&&e===``)).map(e=>{let t=i.length===0?[e]:IT(e,i,l);return o?t.filter(e=>e!==``):t}),d=Math.max(0,...u.map(e=>e.length));return u.length===0||d===0?I.CALC:dL(u.map(e=>Array.from({length:d},(t,n)=>e[n]??c)))});let SL=(e,t)=>{let n=t.calc.flat(e);return n instanceof L?n.at(0,0):n};H(`MAP`,`r(r)`,(e,t)=>{let n=e[e.length-1];if(!(n instanceof mg))return I.VALUE;let r=[];for(let n of e.slice(0,-1)){let e=U(n,t);if(e instanceof F)return e;r.push(e)}let i=r[0];if(!i)return I.VALUE;let{rows:a,cols:o}=i;if(r.some(e=>e.rows!==a||e.cols!==o))return I.VALUE;let s=Array(a*o);for(let e=0;e<a;e++)for(let i=0;i<o;i++)s[e*o+i]=SL(t.calc.apply(n,r.map(t=>t.at(e,i))),t);return new L(a,o,s)});function CL(e,t){let n=e.length===3,r=e[e.length-1];if(!(r instanceof mg))return I.VALUE;let i=U(e[+!!n],t);return i instanceof F?i:{start:n?pL(e[0],t)??null:i.at(0,0),cells:i,fn:r}}H(`REDUCE`,`rr?r`,(e,t)=>{let n=CL(e,t);if(n instanceof F)return n;let{cells:r,fn:i}=n,a=e.length===3?0:1,o=n.start;for(let e=a;e<r.rows*r.cols;e++)o=SL(t.calc.apply(i,[o,r.at(Math.floor(e/r.cols),e%r.cols)]),t);return o}),H(`SCAN`,`rr?r`,(e,t)=>{let n=CL(e,t);if(n instanceof F)return n;let{cells:r,fn:i}=n,a=r.rows*r.cols,o=e.length===3?0:1,s=Array(a),c=n.start;o===1&&(s[0]=c);for(let e=o;e<a;e++)c=SL(t.calc.apply(i,[c,r.at(Math.floor(e/r.cols),e%r.cols)]),t),s[e]=c;return new L(r.rows,r.cols,s)});let wL=e=>(t,n)=>{let r=U(t[0],n);if(r instanceof F)return r;let i=t[1];if(!(i instanceof mg))return I.VALUE;let a=uL(r),o=(e?a:fL(a)).map(t=>SL(n.calc.apply(i,[e?new L(1,t.length,t):new L(t.length,1,t)]),n));return e?new L(o.length,1,o):new L(1,o.length,o)};H(`BYROW`,`rr`,wL(!0)),H(`BYCOL`,`rr`,wL(!1)),H(`MAKEARRAY`,`rrr`,(e,t)=>{let n=xL(mL(e[0],t,1),mL(e[1],t,1));if(n instanceof F)return n;let r=e[2];if(!(r instanceof mg))return I.VALUE;let i=Array(n.rows*n.cols);for(let e=0;e<n.rows;e++)for(let a=0;a<n.cols;a++)i[e*n.cols+a]=SL(t.calc.apply(r,[e+1,a+1]),t);return new L(n.rows,n.cols,i)});function TL(e){return(t,n)=>{let r=[];for(let i of t){let t=U(i,n);if(t instanceof F)return t;let a=uL(t);r.push(e?a:fL(a))}let i=Math.max(0,...r.map(e=>e[0]?.length??0)),a=r.flatMap(e=>e.map(e=>Array.from({length:i},(t,n)=>n<e.length?e[n]??null:I.NA)));return a.length===0?I.CALC:dL(e?a:fL(a))}}H(`VSTACK`,`(r)`,TL(!0)),H(`HSTACK`,`(r)`,TL(!1));function EL(e,t,n){let r=Math.min(e,Math.abs(t));return n?t>=0?[0,r]:[e-r,e]:t>=0?[r,e]:[0,e-r]}function DL(e){return(t,n)=>{let r=U(t[0],n);if(r instanceof F)return r;let i=e=>e===void 0||e instanceof hg,a=mL(t[1],n,e?r.rows:0);if(a instanceof F)return a;let o=mL(t[2],n,e?r.cols:0);if(o instanceof F)return o;if(e&&!i(t[1])&&Math.trunc(a)===0||e&&!i(t[2])&&Math.trunc(o)===0)return I.CALC;let[s,c]=EL(r.rows,Math.trunc(a),e),[l,u]=EL(r.cols,Math.trunc(o),e);return c<=s||u<=l?I.CALC:dL(uL(r).slice(s,c).map(e=>e.slice(l,u)))}}H(`TAKE`,`rr?r`,DL(!0)),H(`DROP`,`rr?r`,DL(!1));function OL(e){return(t,n)=>{let r=U(t[0],n);if(r instanceof F)return r;let i=mL(t[1],n,0);if(i instanceof F)return i;let a=hL(t[2],n,!1);if(a instanceof F)return a;if(![0,1,2,3].includes(i))return I.VALUE;let o=uL(r),s=(a?fL(o):o).flat().filter(e=>!((i===1||i===3)&&e===null||(i===2||i===3)&&e instanceof F));return s.length===0?I.CALC:e?new L(s.length,1,s):new L(1,s.length,s)}}H(`TOCOL`,`r?rr`,OL(!0)),H(`TOROW`,`r?rr`,OL(!1));function kL(e){return(t,n)=>{let r=U(t[0],n);if(r instanceof F)return r;let i=uL(r),a=e?i:fL(i),o=[];for(let e of t.slice(1)){let t=gL(e,n,1);if(t instanceof F)return t;for(let e of t){let t=a[e>0?e-1:a.length+e];if(e===0||!t)return I.VALUE;o.push(t)}}return dL(e?o:fL(o))}}H(`CHOOSEROWS`,`r(r)`,kL(!0)),H(`CHOOSECOLS`,`r(r)`,kL(!1)),H(`EXPAND`,`rr?rr`,(e,t)=>{let n=U(e[0],t);if(n instanceof F)return n;let r=xL(mL(e[1],t,n.rows),mL(e[2],t,n.cols));if(r instanceof F)return r;if(r.rows<n.rows||r.cols<n.cols)return I.VALUE;let i=pL(e[3],t)??I.NA,a=Array(r.rows*r.cols);for(let e=0;e<r.rows;e++)for(let t=0;t<r.cols;t++)a[e*r.cols+t]=e<n.rows&&t<n.cols?n.at(e,t):i;return new L(r.rows,r.cols,a)});function AL(e){return(t,n)=>{let r=U(t[0],n);if(r instanceof F)return r;if(r.rows>1&&r.cols>1)return I.VALUE;let i=mL(t[1],n,1);if(i instanceof F)return i;let a=Math.trunc(i);if(a<1)return I.NUM;let o=pL(t[2],n)??I.NA,s=uL(r).flat(),c=[];for(let e=0;e<s.length;e+=a)c.push(Array.from({length:a},(t,n)=>e+n<s.length?s[e+n]??null:o));return dL(e?c:fL(c))}}H(`WRAPROWS`,`rr?r`,AL(!0)),H(`WRAPCOLS`,`rr?r`,AL(!1));function jL(e,t,n){let r=B(e);if(r instanceof F)return r;let i=t==null?0:z(t);if(i instanceof F)return i;if(i!==0&&i!==1)return I.VALUE;try{return new RegExp(r,`${i===1?`i`:``}${n?`g`:``}`)}catch{return I.VALUE}}V(`REGEXTEST`,2,3,(e,t,n)=>{let r=B(e);if(r instanceof F)return r;let i=jL(t,n,!1);return i instanceof F?i:i.test(r)}),H(`REGEXEXTRACT`,`vv?vv`,(e,t)=>{let n=B(e[0]instanceof hg?null:e[0]);if(n instanceof F)return n;let r=mL(e[2],t,0);if(r instanceof F)return r;let i=e[3]instanceof hg?void 0:e[3],a=jL(e[1],i,r===1);if(a instanceof F)return a;if(r===0)return a.exec(n)?.[0]??I.NA;if(r===1){let e=[...n.matchAll(a)].map(e=>e[0]);return e.length===0?I.NA:new L(e.length,1,e)}if(r===2){let e=a.exec(n);if(!e)return I.NA;let t=e.slice(1).map(e=>e??``);return t.length===0?I.NA:new L(1,t.length,t)}return I.VALUE}),V(`REGEXREPLACE`,3,5,(e,t,n,r,i)=>{let a=B(e),o=B(n);if(a instanceof F)return a;if(o instanceof F)return o;let s=r==null?0:z(r);if(s instanceof F)return s;let c=jL(t,i,!0);if(c instanceof F)return c;let l=Math.trunc(s);if(l===0)return a.replace(c,o);let u=[...a.matchAll(c)],d=l>0?u[l-1]:u[u.length+l];if(!d)return a;let f=new RegExp(c.source,c.flags.replace(`g`,``)),p=d.index;return a.slice(0,p)+d[0].replace(f,o)+a.slice(p+d[0].length)}),H(`PERCENTOF`,`rr`,(e,t)=>{let n=dw.get(`SUM`);if(!n)return I.NAME;let r=z(SL(t.calc.applyFunction(n,[e[0]],t.frame),t)),i=z(SL(t.calc.applyFunction(n,[e[1]],t.frame),t));return r instanceof F?r:i instanceof F?i:i===0?I.DIV0:r/i}),H(`TRIMRANGE`,`r?vv`,(e,t)=>{let n=e[0];if(!(n instanceof R))return n instanceof F?n:I.VALUE;let r=mL(e[1],t,3),i=mL(e[2],t,3);if(r instanceof F)return r;if(i instanceof F)return i;let a=t.calc.matrix(n),o=e=>Array.from({length:a.cols},(t,n)=>a.at(e,n)).every(e=>e===null),s=e=>Array.from({length:a.rows},(t,n)=>a.at(n,e)).every(e=>e===null),c=0,l=a.rows-1,u=0,d=a.cols-1;if(r===1||r===3)for(;c<=l&&o(c);)c++;if(r===2||r===3)for(;l>=c&&o(l);)l--;if(i===1||i===3)for(;u<=d&&s(u);)u++;if(i===2||i===3)for(;d>=u&&s(d);)d--;return c>l||u>d?I.REF:new R(n.sheet,n.top+c,n.left+u,n.top+l,n.left+d)});function ML(e,t,n){let r=/* @__PURE__ */ new Map;for(let i of n){let n=e[i]?.[t]??null,a=bL(n),o=r.get(a);o?o.records.push(i):r.set(a,{key:n,records:[i],children:[]})}return[...r.values()]}function NL(e,t,n,r,i,a){let o=(e,t)=>e.sort((e,n)=>{for(let r of i){let i=`field`in r?r.field===t?vL(e.key,n.key,r.down):0:vL(r.value(e.records),r.value(n.records),r.down);if(i!==0)return i}return 0}),s=[],c=r<0,l=Math.abs(r);if(a){let r=/* @__PURE__ */ new Map;for(let i of n){let n=(e[i]??[]).slice(0,t).map(bL).join(`\0`),a=r.get(n);a?a.records.push(i):r.set(n,{key:null,records:[i],children:[]})}let a=[...r.values()].sort((t,n)=>{for(let r of i){let i=`field`in r?vL(e[t.records[0]??0]?.[r.field]??null,e[n.records[0]??0]?.[r.field]??null,r.down):vL(r.value(t.records),r.value(n.records),r.down);if(i!==0)return i}return 0});for(let n of a)s.push({kind:`leaf`,keys:(e[n.records[0]??0]??[]).slice(0,t),records:n.records})}else{let r=(n,i,a)=>{for(let u of o(n,i)){let n=[...a,u.key];if(i===t-1){s.push({kind:`leaf`,keys:n,records:u.records});continue}let o={kind:`subtotal`,keys:[...n,...Array(t-n.length).fill(null)],records:u.records},d=i<l-1;d&&c&&s.push(o),r(ML(e,i+1,u.records),i+1,n),d&&!c&&s.push(o)}};r(ML(e,0,n),0,[])}if(l>=1){let e={kind:`total`,keys:[`Total`,...Array(t-1).fill(null)],records:[...n]};c?s.unshift(e):s.push(e)}return s}function PL(e,t,n,r){let i=e=>new L(e.length,1,[...e]),a=e.named===void 0?void 0:dw.get(e.named),o=(a?a.min>=2:e.params.length>=2)?[i(t),i(n)]:[i(t)];return SL(r.calc.apply(e,o),r)}function FL(e,t,n){if(e===void 0||e instanceof hg){let e=t[0]??[],n=t[1]??[];return{has:e.length>0&&e.every(e=>typeof e==`string`)&&n.some(e=>typeof e==`number`),show:!1,named:!1}}let r=mL(e,n,0);return r instanceof F?r:[0,1,2,3].includes(r)?{has:r===1||r===3,show:r===2||r===3,named:r===2}:I.VALUE}function IL(e,t,n,r){let i=Array.from({length:t},(e,t)=>t);if(e===void 0||e instanceof hg)return i;let a=U(e,r);if(a instanceof F)return a;if(a.rows*a.cols!==t+n)return I.VALUE;let o=[];for(let e of i){let t=e+n,r=yL(a.cols===1?a.at(t,0):a.at(0,t));if(r instanceof F)return r;r&&o.push(e)}return o}function LL(e,t,n,r){let i=e===void 0||e instanceof hg?[]:gL(e,r,1);if(i instanceof F)return i;let a=[];for(let e of i){let r=Math.abs(e)-1,i=e<0;if(r<0)return I.VALUE;if(r<t)a.push({field:r,down:i});else{let e=n(r-t);if(!e)return I.VALUE;a.push({value:e,down:i})}}for(let e=0;e<t;e++)a.some(t=>`field`in t&&t.field===e)||a.push({field:e,down:!1});return a}let RL=(e,t,n)=>mL(e,t,n);H(`GROUPBY`,`rrr?vvrrv`,(e,t)=>{let n=U(e[0],t),r=U(e[1],t),i=e[2];if(n instanceof F)return n;if(r instanceof F)return r;if(!(i instanceof mg)||n.rows!==r.rows)return I.VALUE;let a=n.cols===0?[]:uL(n),o=uL(r),s=FL(e[3],o,t);if(s instanceof F)return s;let c=+!!s.has,l=a.slice(c),u=o.slice(c),d=RL(e[4],t,1);if(d instanceof F)return d;let f=mL(e[7],t,0);if(f instanceof F)return f;let p=IL(e[6],l.length,c,t);if(p instanceof F)return p;if(p.length===0)return I.CALC;let m=n.cols,h=r.cols,g=e=>u.map(t=>t[e]??null),_=Array.from({length:h},(e,t)=>g(t)),v=e=>p.map(t=>_[e]?.[t]??null),y=(e,n)=>PL(i,n.map(t=>_[e]?.[t]??null),v(e),t),b=LL(e[5],m,e=>e<h?t=>y(e,t):void 0,t);if(b instanceof F)return b;let x=NL(l,m,p,d,b,f===1),ee=[];s.show&&ee.push([...Array.from({length:m},(e,t)=>s.named?`Row Field ${String(t+1)}`:a[0]?.[t]??null),...Array.from({length:h},(e,t)=>s.named?`Value ${String(t+1)}`:o[0]?.[t]??null)]);for(let e of x)ee.push([...e.keys,...Array.from({length:h},(t,n)=>y(n,e.records))]);return dL(ee)}),H(`PIVOTBY`,`rrrr?vvrvrrv`,(e,t)=>{let n=U(e[0],t),r=U(e[1],t),i=U(e[2],t),a=e[3];if(n instanceof F)return n;if(r instanceof F)return r;if(i instanceof F)return i;if(!(a instanceof mg)||n.rows!==i.rows||r.rows!==i.rows)return I.VALUE;let o=uL(n),s=uL(r),c=uL(i),l=FL(e[4],c,t);if(l instanceof F)return l;let u=+!!l.has,d=o.slice(u),f=s.slice(u),p=c.slice(u),m=RL(e[5],t,1),h=RL(e[7],t,1),g=mL(e[10],t,0);if(m instanceof F)return m;if(h instanceof F)return h;if(g instanceof F)return g;let _=IL(e[9],p.length,u,t);if(_ instanceof F)return _;if(_.length===0)return I.CALC;let v=i.cols,y=LL(e[6],n.cols,()=>void 0,t),b=LL(e[8],r.cols,()=>void 0,t);if(y instanceof F)return y;if(b instanceof F)return b;let x=NL(d,n.cols,_,m,y,!1),ee=NL(f,r.cols,_,h,b,!1),te=(e,t)=>{let n=new Set(t);return e.filter(e=>n.has(e))},S=(e,t)=>p[t]?.[e]??null,ne=(e,n,r)=>{let i=te(n.records,r.records);if(i.length===0)return null;let o=g===1?n.records:g===2?_:r.records;return PL(a,i.map(t=>S(e,t)),o.map(t=>S(e,t)),t)},re=n.cols,C=[];for(let e=0;e<r.cols;e++)C.push([...Array(re).fill(null),...ee.flatMap(t=>Array.from({length:v},(n,r)=>r===0?t.keys[e]??null:null))]);(v>1||l.show)&&C.push([...Array.from({length:re},(e,t)=>l.show?o[0]?.[t]??null:null),...ee.flatMap(()=>Array.from({length:v},(e,t)=>l.has?c[0]?.[t]??null:`Value ${String(t+1)}`))]);for(let e of x)C.push([...e.keys,...ee.flatMap(t=>Array.from({length:v},(n,r)=>ne(r,e,t)))]);return dL(C)});let zL=(e,t)=>bh(yh(e,t+1,0)).day,BL=(e,t,n)=>n===0||n===4?Math.round(tE(e,t,n)*360):t-e;function VL(e,t,n){let r=bh(e),i=r.year*12+r.month-1+t,a=Math.floor(i/12),o=i-a*12+1,s=zL(a,o);return yh(a,o,n?s:Math.min(r.day,s))}let HL=e=>{let t=bh(e);return t.day===zL(t.year,t.month)};function UL(e,t,n,r){let i=12/n,a=HL(t),o=0,s=t;for(;s>e;)o+=1,s=VL(t,-i*o,a);let c=VL(t,-i*(o-1),a),l=r===1?c-s:r===3?365/n:360/n,u=BL(s,e,r);return{previous:s,next:c,count:o,period:l,since:u,until:r===0||r===4?l-u:c-e}}function WL(e,t){let n=[];for(let[r,i]of t.entries()){let t=e[r],a=t==null?i??0:z(t);if(a instanceof F)return a;n.push(a)}return n}let GL=e=>Number.isInteger(e)&&e>=0&&e<=4,KL=e=>e===1||e===2||e===4;function qL(e,t,n,r){V(e,t,n.length,(...e)=>{let t=WL(e,n);if(t instanceof F)return t;let[i=0,a=0,...o]=t,s=Math.trunc(i),c=Math.trunc(a),l=Math.trunc(o[o.length-1]??0);return s>=c||!GL(l)?I.NUM:r(s,c,...o.slice(0,-1),l)})}for(let[e,t]of[[`COUPDAYBS`,e=>e.since],[`COUPDAYS`,e=>e.period],[`COUPDAYSNC`,e=>e.until],[`COUPNCD`,e=>e.next],[`COUPNUM`,e=>e.count],[`COUPPCD`,e=>e.previous]])qL(e,3,[void 0,void 0,void 0,0],(e,n,r=0,i=0)=>KL(r)?t(UL(e,n,r,i)):I.NUM);function JL(e,t,n,r,i,a,o){let s=UL(e,t,a,o),c=100*n/a,l=s.until/s.period;if(s.count===1)return(i+c)/(1+l*r/a)-c*s.since/s.period;let u=i/(1+r/a)**(s.count-1+l);for(let e=1;e<=s.count;e++)u+=c/(1+r/a)**(e-1+l);return u-c*s.since/s.period}qL(`PRICE`,6,[void 0,void 0,void 0,void 0,void 0,void 0,0],(e,t,n=0,r=0,i=0,a=0,o=0)=>n<0||r<0||i<=0||!KL(a)?I.NUM:JL(e,t,n,r,i,a,o)),qL(`YIELD`,6,[void 0,void 0,void 0,void 0,void 0,void 0,0],(e,t,n=0,r=0,i=0,a=0,o=0)=>{if(n<0||r<=0||i<=0||!KL(a))return I.NUM;let s=-.99,c=1;for(;JL(e,t,n,c,i,a,o)>r&&c<1e6;)c*=2;for(let l=0;l<200;l++){let l=(s+c)/2;JL(e,t,n,l,i,a,o)>r?s=l:c=l}return(s+c)/2});function YL(e,t,n,r,i,a){let o=UL(e,t,i,a),s=o.until/o.period,c=0,l=0;for(let e=1;e<=o.count;e++){let t=e-1+s,a=(100*n/i+(e===o.count?100:0))/(1+r/i)**t;c+=t*a,l+=a}return c/l/i}qL(`DURATION`,5,[void 0,void 0,void 0,void 0,void 0,0],(e,t,n=0,r=0,i=0,a=0)=>n<0||r<0||!KL(i)?I.NUM:YL(e,t,n,r,i,a)),qL(`MDURATION`,5,[void 0,void 0,void 0,void 0,void 0,0],(e,t,n=0,r=0,i=0,a=0)=>n<0||r<0||!KL(i)?I.NUM:YL(e,t,n,r,i,a)/(1+r/i)),qL(`DISC`,4,[void 0,void 0,void 0,void 0,0],(e,t,n=0,r=0,i=0)=>n<=0||r<=0?I.NUM:(r-n)/r/tE(e,t,i)),qL(`INTRATE`,4,[void 0,void 0,void 0,void 0,0],(e,t,n=0,r=0,i=0)=>n<=0||r<=0?I.NUM:(r-n)/n/tE(e,t,i)),qL(`RECEIVED`,4,[void 0,void 0,void 0,void 0,0],(e,t,n=0,r=0,i=0)=>{let a=1-r*tE(e,t,i);return n<=0||r<=0||a<=0?I.NUM:n/a}),qL(`PRICEDISC`,4,[void 0,void 0,void 0,void 0,0],(e,t,n=0,r=0,i=0)=>n<=0||r<=0?I.NUM:r*(1-n*tE(e,t,i))),qL(`YIELDDISC`,4,[void 0,void 0,void 0,void 0,0],(e,t,n=0,r=0,i=0)=>n<=0||r<=0?I.NUM:(r-n)/n/tE(e,t,i));function XL(e,t){V(e,3,3,xw((e=0,n=0,r=0)=>{let i=Math.trunc(e),a=Math.trunc(n);return i>=a||r<=0||a>VL(i,12,!1)?I.NUM:t(a-i,r)}))}XL(`TBILLPRICE`,(e,t)=>{let n=100*(1-t*e/360);return n<=0?I.NUM:n}),XL(`TBILLYIELD`,(e,t)=>(100-t)/t*360/e),XL(`TBILLEQ`,(e,t)=>{if(e<=182)return 365*t/(360-t*e);let n=100*(1-t*e/360),r=e/365,i=r*r-(2*r-1)*(1-100/n);return(-r+Math.sqrt(i))/(r-.5)}),V(`ACCRINTM`,3,5,(...e)=>{let t=WL(e,[void 0,void 0,void 0,1e3,0]);if(t instanceof F)return t;let[n=0,r=0,i=0,a=0,o=0]=t,s=Math.trunc(n),c=Math.trunc(r);return s>=c||i<=0||a<=0||!GL(o)?I.NUM:a*i*tE(s,c,o)}),V(`ACCRINT`,6,8,(...e)=>{let t=WL(e.slice(0,7),[void 0,void 0,void 0,void 0,1e3,void 0,0]);if(t instanceof F)return t;let[n=0,r=0,i=0,a=0,o=0,s=0,c=0]=t,l=e[7]===void 0||$C(e[7]);if(l instanceof F)return l;let u=Math.trunc(n),d=Math.trunc(i),f=Math.trunc(r);if(u>=d||a<=0||o<=0||!KL(s)||!GL(c))return I.NUM;let p=12/s,m=f,h=f;for(let e=1;m>u;e++)m=VL(f,-p*e,!1);let g=0;for(;m<d;){h=VL(m,p,!1);let e=l?Math.max(u,m):Math.max(m,f<=d?f:u),t=Math.min(d,h),n=c===1?h-m:c===3?365/s:360/s;t>e&&(g+=BL(e,t,c)/n),m=h}return o*a*g/s});let ZL=(e,t)=>(1+e)**t,QL=e=>e===0?0:1,$L=e=>Number.isFinite(e)?e:I.NUM;function eR(e,t,n,r,i){if(e===0)return-(n+r)/t;let a=ZL(e,t);return-(n*a+r)*e/((1+e*i)*(a-1))}function tR(e,t,n,r,i){if(e===0)return-(r+n*t);let a=ZL(e,t);return-(r*a+n*(1+e*i)*(a-1)/e)}function nR(e,t,n,r,i,a){if(t<1||t>n)return I.NUM;if(a===1&&t===1)return 0;let o=eR(e,n,r,i,a),s=a===1?tR(e,t-2,o,r,1)-o:tR(e,t-1,o,r,0);return $L(s*e)}V(`PMT`,3,5,xw((e,t,n,r=0,i=0)=>t===0?I.NUM:$L(eR(e,t,n,r,QL(i))))),V(`FV`,3,5,xw((e,t,n,r=0,i=0)=>$L(tR(e,t,n,r,QL(i))))),V(`IPMT`,4,6,xw((e,t,n,r,i=0,a=0)=>nR(e,t,n,r,i,QL(a)))),V(`PPMT`,4,6,xw((e,t,n,r,i=0,a=0)=>{let o=QL(a),s=nR(e,t,n,r,i,o);return s instanceof F?s:$L(eR(e,n,r,i,o)-s)})),V(`DB`,4,5,xw((e,t,n,r,i=12)=>{let a=Math.trunc(r);if(e<0||t<0||n<=0||a<=0||i<=0||i>12||a>n+1)return I.NUM;let o=e===0?0:Math.round((1-(t/e)**(1/n))*1e3)/1e3,s=0,c=0;for(let t=1;t<=a;t++)c=t===1?e*o*i/12:t===n+1?(e-s)*o*(12-i)/12:(e-s)*o,s+=c;return $L(c)})),V(`VDB`,5,7,(...e)=>{let t=WL(e.slice(0,6),[void 0,void 0,void 0,void 0,void 0,2]);if(t instanceof F)return t;let[n=0,r=0,i=0,a=0,o=0,s=0]=t,c=e[6]!==void 0&&$C(e[6]);if(c instanceof F)return c;if(n<0||r<0||i<=0||a<0||o>i||a>o||s<=0)return I.NUM;let l=n,u=0,d=Math.ceil(o);for(let e=1;e<=d;e++){let t=Math.min(l*s/i,Math.max(0,l-r)),n=i-e+1,d=(l-r)/n,f=c?t:Math.max(t,d),p=Math.min(o,e)-Math.max(a,e-1);p>0&&(u+=f*p),l-=f}return u});let rR=(e,t,n,r,i)=>({whole:tE(n,t,i),accrued:tE(n,e,i),left:tE(e,t,i),rate:r});qL(`PRICEMAT`,5,[void 0,void 0,void 0,void 0,void 0,0],(e,t,n=0,r=0,i=0,a=0)=>{let o=Math.trunc(n);if(o>=e||r<0||i<0)return I.NUM;let{whole:s,accrued:c,left:l}=rR(e,t,o,r,a);return(100+s*r*100)/(1+l*i)-c*r*100}),qL(`YIELDMAT`,5,[void 0,void 0,void 0,void 0,void 0,0],(e,t,n=0,r=0,i=0,a=0)=>{let o=Math.trunc(n);if(o>=e||r<0||i<=0)return I.NUM;let{whole:s,accrued:c,left:l}=rR(e,t,o,r,a);return((1+s*r)/(i/100+c*r)-1)/l});function iR(e,t,n,r,i){let a=12/r,o=HL(t),s={held:0,accrued:0,left:0,count:0},c=0,l=t;for(;l>e;){c+=1;let u=VL(t,-a*c,o),d=i===1?l-u:i===3?365/r:360/r,f=Math.max(u,e),p=l,m=(e,t)=>t>e?BL(e,t,i)/d:0;s.held+=m(f,p),s.accrued+=m(f,Math.min(n,p)),s.left+=m(Math.max(n,f),p),s.count+=1,l=u}return s}function aR(e,t,n,r,i,a,o,s,c){let l=100*i/s,u=UL(r,t,s,c).count+1,d=iR(n,r,e,s,c),f=1+a/s,p=d.left,m=o/f**(u-1+p);m+=l*d.held/f**p;for(let e=2;e<=u;e++)m+=l/f**(e-1+p);return m-l*d.accrued}function oR(e,t,n){let r=n;for(let n=0;n<100;n++){let n=e(r),i=n-t;if(Math.abs(i)<1e-10)return r;let a=(e(r+1e-6)-n)/1e-6;if(a===0||!Number.isFinite(a))return;r-=i/a,r<=-1&&(r=-.99)}}function sR(e,t){V(e,8,9,(...e)=>{let n=WL(e,[void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,0]);if(n instanceof F)return n;let[r=0,i=0,a=0,o=0,s=0,c=0,l=0,u=0]=n,d=Math.trunc(n[8]??0),f=Math.trunc(r),p=Math.trunc(i),m=Math.trunc(a),h=Math.trunc(o);return!GL(d)||!KL(u)||!(p>h&&h>f&&f>m)||s<0||c<0||l<=0?I.NUM:t(e=>aR(f,p,m,h,s,e,l,u,d),c)})}sR(`ODDFPRICE`,(e,t)=>e(t)),sR(`ODDFYIELD`,(e,t)=>oR(e,t,.1)??I.NUM);function cR(e,t){V(e,7,8,(...e)=>{let n=WL(e,[void 0,void 0,void 0,void 0,void 0,void 0,void 0,0]);if(n instanceof F)return n;let[r=0,i=0,a=0,o=0,s=0,c=0,l=0]=n,u=Math.trunc(n[7]??0),d=Math.trunc(r),f=Math.trunc(i),p=Math.trunc(a);return!GL(u)||!KL(l)||!(f>d&&d>p)||o<0||s<0||c<=0?I.NUM:t({odd:iR(p,f,d,l,u),coupon:100*o/l,last:s,red:c,f:l})})}cR(`ODDLPRICE`,({odd:e,coupon:t,last:n,red:r,f:i})=>(r+e.held*t)/(1+e.left*n/i)-e.accrued*t),cR(`ODDLYIELD`,({odd:e,coupon:t,last:n,red:r,f:i})=>{let a=n+e.accrued*t;return(r+e.held*t-a)/a*i/e.left}),V(`AMORLINC`,6,7,(...e)=>{let t=WL(e,[void 0,void 0,void 0,void 0,void 0,void 0,0]);if(t instanceof F)return t;let[n=0,r=0,i=0,a=0,o=0,s=0]=t,c=Math.trunc(t[6]??0),l=Math.trunc(o);if(!GL(c)||c===2||n<0||a<0||a>n||l<0||s<=0||r>i)return I.NUM;let u=n*s,d=tE(Math.trunc(r),Math.trunc(i),c)*u,f=Math.trunc((n-a-d)/u);return l===0?d:l<=f?u:l===f+1?n-a-u*f-d:0}),V(`AMORDEGRC`,6,7,(...e)=>{let t=WL(e,[void 0,void 0,void 0,void 0,void 0,void 0,0]);if(t instanceof F)return t;let[n=0,r=0,i=0,a=0,o=0,s=0]=t,c=Math.trunc(t[6]??0),l=Math.trunc(o);if(!GL(c)||c===2||n<0||a<0||a>n||l<0||s<=0||r>i)return I.NUM;let u=1/s,d=s*(u<3?1:u<5?1.5:u<=6?2:2.5),f=Math.round(tE(Math.trunc(r),Math.trunc(i),c)*d*n);if(l===0)return f;let p=n-f,m=p-a;for(let e=0;e<l;e++){if(f=Math.round(d*p),m-=f,m<0)return l-e<=1?Math.round(p*.5):0;p-=f}return f});function lR(e,t){let n=[];for(let t=0;t<e.cols;t++){let r=B(e.at(0,t));if(r instanceof F)return r;n.push(r.toLowerCase())}let r=[];for(let i=1;i<e.rows;i++){let a=t.rows<2;for(let r=1;r<t.rows&&!a;r++){let o=!0;for(let a=0;a<t.cols&&o;a++){let s=t.at(r,a);if(s===null||s===``)continue;let c=B(t.at(0,a));if(c instanceof F)return c;let l=n.indexOf(c.toLowerCase());if(l<0){o=!1;continue}let u=jw(s);if(u instanceof F)return u;u.test(e.at(i,l))||(o=!1)}o&&(a=!0)}a&&r.push(i)}return r}function uR(e,t){if(typeof t==`number`){let n=Math.trunc(t)-1;return n<0||n>=e.cols?I.VALUE:n}let n=B(t);if(n instanceof F)return n;for(let t=0;t<e.cols;t++){let r=e.at(0,t);if(typeof r==`string`&&nw(r,n)===0)return t}return I.VALUE}function dR(e,t){let n=U(e[0],t);if(n instanceof F)return n;let r=U(e[2],t);if(r instanceof F)return r;let i=lR(n,r);if(i instanceof F)return i;let a=e[1];if(a===void 0)return{list:i.map(()=>null),db:n};let o=uR(n,t.calc.scalar(a,t.frame));return o instanceof F?o:{list:i.map(e=>n.at(e,o)),db:n}}function fR(e,t){H(e,`rvr`,(e,n)=>{let r=dR(e,n);if(r instanceof F)return r;let i=dw.get(t);if(i?.kind!==`raw`)return I.VALUE;let a=r.list.filter(e=>typeof e==`number`);return i.call([...a.length>0?a:[0]],n)})}for(let[e,t]of[[`DSUM`,`SUM`],[`DMAX`,`MAX`],[`DMIN`,`MIN`],[`DPRODUCT`,`PRODUCT`]])fR(e,t);for(let[e,t]of[[`DAVERAGE`,`AVERAGE`],[`DSTDEV`,`STDEV.S`],[`DSTDEVP`,`STDEV.P`],[`DVAR`,`VAR.S`],[`DVARP`,`VAR.P`]])H(e,`rvr`,(e,n)=>{let r=dR(e,n);if(r instanceof F)return r;let i=dw.get(t);if(i?.kind!==`raw`)return I.VALUE;let a=r.list.filter(e=>typeof e==`number`);return a.length===0?I.DIV0:i.call(a,n)});H(`DCOUNT`,`rv?r`,(e,t)=>{let n=dR(e.length===2?[e[0],void 0,e[1]]:e,t);return n instanceof F?n:n.list.filter(e=>typeof e==`number`).length}),H(`DCOUNTA`,`rv?r`,(e,t)=>{let n=dR(e.length===2?[e[0],void 0,e[1]]:e,t);return n instanceof F?n:n.list.filter(e=>e!==null).length}),H(`DGET`,`rvr`,(e,t)=>{let n=dR(e,t);return n instanceof F?n:n.list.length===0?I.VALUE:n.list.length>1?I.NUM:n.list[0]??null});function pR(e,t,n){let r={reads:[],names:/* @__PURE__ */ new Set,volatile:!1,unknownNames:[],unknownFunctions:[],arguments:[]},i=/* @__PURE__ */ new Set,a=(t,a,s)=>{let c=t.toLowerCase();if(s===void 0&&a.has(c))return!0;let l=s===void 0?n:e.sheet(s),u=l?[e.name(c,l)]:e.definitions(c);if(u.some(e=>e!==void 0)){r.names.add(c);let e=`${s??``}!${c}`;if(!i.has(e)){i.add(e);for(let e of u)e?.formula?.node&&o(e.formula.node,/* @__PURE__ */ new Set)}return!0}if(dw.has(t.toUpperCase()))return!0;let d=e.table(c);return d?(r.reads.push({kind:`structured`,table:d.name,sections:[],columns:[],thisRow:!1}),!0):!1},o=(e,t)=>{switch(e.kind){case`ref`:case`structured`:r.reads.push(e);return;case`name`:a(e.name,t,e.sheet)||r.unknownNames.push(e.name);return;case`unary`:case`postfix`:case`paren`:o(e.arg,t);return;case`binary`:o(e.left,t),o(e.right,t);return;case`array`:return;case`invoke`:o(e.callee,t);for(let n of e.args)o(n,t);return;case`call`:{let n=dw.get(e.name);if(e.name===`LET`||e.name===`LAMBDA`){let n=new Set(t),r=e.args[e.args.length-1];e.args.forEach((t,i)=>{t!==r&&(e.name===`LET`&&i%2==1?o(t,n):t.kind===`name`&&n.add(t.name.toLowerCase()))}),r&&o(r,n);return}if(!n)a(e.written,t)||r.unknownFunctions.push(e.name);else{n.volatile===!0&&(r.volatile=!0);let t=n.kind===`raw`&&!mw(n.params,e.args.length);(e.args.length<n.min||e.args.length>n.max||t)&&r.arguments.push({name:e.name,given:e.args.length,min:n.min,max:n.max,...t?{group:n.params.group.length}:{}})}for(let n of e.args)o(n,t);return}default:return}};return t.node&&o(t.node,/* @__PURE__ */ new Set),r}var mR=class{cells=/* @__PURE__ */ new Set;reference;constructor(e){this.reference=e}footprint(){return{sheet:this.reference.sheet,area:this.reference}}visit(e,t,n){if(this.reference.sheet===e&&b(this.reference,t))for(let e of this.cells)n(e)}},hR=class{s;constructor(e){this.s=e}footprint(){let{s:e}=this;return{sheet:e.reads,area:{top:e.t+e.kt*e.group.top,bottom:e.b+e.kb*e.group.bottom,left:e.l+e.kl*e.group.left,right:e.r+e.kr*e.group.right}}}visit(e,t,n){let{s:r}=this;if(e!==r.reads)return;let i=gR(r.group.top,r.group.bottom,r.t,r.kt,r.b,r.kb,t.top,t.bottom);if(!i)return;let a=gR(r.group.left,r.group.right,r.l,r.kl,r.r,r.kr,t.left,t.right);if(a)for(let e=i[0];e<=i[1];e++)for(let t=a[0];t<=a[1];t++){let i=r.on.at(e,t);i instanceof vC&&i.shared===r.shared&&n(i)}}};function gR(e,t,n,r,i,a,o,s){let c=e,l=t;if(r===1)l=Math.min(l,s-n);else if(n>s)return;if(a===1)c=Math.max(c,o-i);else if(i<o)return;return c<=l?[c,l]:void 0}var _R=class{single=/* @__PURE__ */ new Map;ranges=/* @__PURE__ */ new Map;byColumn=/* @__PURE__ */ new Map;wide=[];source;constructor(e){this.source=e}build(e){let t=/* @__PURE__ */ new Map;for(let n of e){let e=t.get(n.shared);e?e.push(n):t.set(n.shared,[n])}for(let[e,n]of t)if(n.length<2||!this.addGroup(e,n))for(let e of n)this.add(e)}add(e){for(let t of this.source.readsOf(e))if(t.single){let n=this.single.get(t.sheet);n||(n=/* @__PURE__ */ new Map,this.single.set(t.sheet,n));let r=xC(t.top,t.left),i=n.get(r);i||(i=/* @__PURE__ */ new Set,n.set(r,i)),i.add(e)}else{let n=this.ranges.get(t.key);n||(n=new mR(t),this.ranges.set(t.key,n),this.list(n)),n.cells.add(e)}}remove(e){for(let t of this.source.readsOf(e))t.single?this.single.get(t.sheet)?.get(xC(t.top,t.left))?.delete(e):this.ranges.get(t.key)?.cells.delete(e)}readersIn(e,t){let n=/* @__PURE__ */ new Set,r=e=>{n.add(e)},i=this.single.get(e);if(i)for(let e=t.top;e<=t.bottom;e++)for(let r=t.left;r<=t.right;r++)for(let t of i.get(xC(e,r))??[])n.add(t);let a=/* @__PURE__ */ new Set,o=n=>{a.has(n)||(a.add(n),n.visit(e,t,r))};for(let e of this.wide)o(e);let s=this.byColumn.get(e);if(s)for(let e=t.left;e<=t.right;e++)s.get(e)?.forEach(o);return[...n]}readers(e,t,n){return this.readersIn(e,{top:t,left:n,bottom:t,right:n})}list(e){let{sheet:t,area:n}=e.footprint();if(n.right-n.left+1>32){this.wide.push(e);return}let r=this.byColumn.get(t);r||(r=/* @__PURE__ */ new Map,this.byColumn.set(t,r));for(let t=n.left;t<=n.right;t++){let n=r.get(t);n?n.push(e):r.set(t,[e])}}addGroup(e,t){let n=t[0]?.sheet;if(!n||t.some(e=>e.sheet!==n))return!1;let r={top:1/0,bottom:-1/0,left:1/0,right:-1/0};for(let e of t)r.top=Math.min(r.top,e.row),r.bottom=Math.max(r.bottom,e.row),r.left=Math.min(r.left,e.col),r.right=Math.max(r.right,e.col);let i=(t,r)=>this.source.readsAt(e,n,t,r),a=i(r.top,r.left),o=r.bottom>r.top?i(r.top+1,r.left):a,s=r.right>r.left?i(r.top,r.left+1):a,c=i(r.bottom,r.right);if(o.length!==a.length||s.length!==a.length||c.length!==a.length)return!1;let l=[];for(let t=0;t<a.length;t++){let i=a[t],u=o[t],d=s[t],f=c[t];if(!i||!u||!d||!f||u.sheet!==i.sheet||d.sheet!==i.sheet||f.sheet!==i.sheet)return!1;let p=(e,t)=>{let n=e-t;return n===0||n===1?n:void 0},m=r.bottom>r.top,h=r.right>r.left,g=m?p(u.top,i.top):0,_=m?p(u.bottom,i.bottom):0,v=h?p(d.left,i.left):0,y=h?p(d.right,i.right):0;if(g===void 0||_===void 0||v===void 0||y===void 0)return!1;let b=i.top-g*r.top,x=i.bottom-_*r.top,ee=i.left-v*r.left,te=i.right-y*r.left;if(f.top!==b+g*r.bottom||f.bottom!==x+_*r.bottom||f.left!==ee+v*r.right||f.right!==te+y*r.right)return!1;l.push(new hR({shared:e,on:n,group:r,reads:i.sheet,t:b,kt:g,b:x,kb:_,l:ee,kl:v,r:te,kr:y}))}for(let e of l)this.list(e);return!0}};function vR(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),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}}let yR=/* @__PURE__ */ new Set,bR=/\b(?:SUBTOTAL|AGGREGATE)\(/iu,xR=2e3;var SR=class extends Error{cell;constructor(e){super(`computed first`),this.cell=e}};let CR={max_iterations:100,max_change:.001};function wR(e,t){return typeof e==`number`&&typeof t==`number`?Math.abs(t-e):e===t||e instanceof F&&t instanceof F&&e.code===t.code?0:1/0}let TR=(e,t)=>!e||!t?e===t:e.rows!==t.rows||e.cols!==t.cols?!1:e.data.every((e,n)=>e===t.data[n]),ER=(e,t)=>e.row<t.row||e.row===t.row&&e.col<t.col;var DR=class{cycles=[];computed=0;iterated;nowSerial;random;pass=0;lambdaSlots=0;stack=[];inCycle=/* @__PURE__ */ new Set;waiting=/* @__PURE__ */ new Set;work=[];unwound=/* @__PURE__ */ new Map;counted=/* @__PURE__ */ new Set;looping=/* @__PURE__ */ new Set;tablesOf;inTables=!1;loop=/* @__PURE__ */ new Set;around=/* @__PURE__ */ new Set;namesAt=/* @__PURE__ */ new Set;graph=new _R({readsOf:e=>this.readsOf(e),readsAt:(e,t,n,r)=>this.readsAt(e,t,n,r)});graphMade=!1;reports;replica;settled=/* @__PURE__ */ new Set;moved=[];unsettled=/* @__PURE__ */ new Set;hiddenBy=/* @__PURE__ */ new Map;volatiles=/* @__PURE__ */ new Set;indexes=new lw;results=new lw;wb;constructor(e,t={}){this.wb=e;let{now:n,random:r}=t;this.reports=t.report===!0,this.replica=t.replica===!0,this.nowSerial=()=>Sh(n??/* @__PURE__ */ new Date),this.random=r??Math.random;for(let t of e.sheets)t.expand()}allCells(){return this.wb.sheets.flatMap(e=>[...e.formulas])}filtered(e){return this.hiddenBy.get(e)??yR}calculate(){if(this.replica){for(let e of this.wb.sheets)e.clearSpills();for(let e of this.allCells())e.state=0;return this}this.hiddenBy.clear(),this.indexes.clear(),this.results.clear();for(let e of this.wb.sheets)e.clearSpills();this.moved=[],this.unsettled.clear();let e=this.allCells();for(let t of e)t.state=1;return this.cycles=[],this.inCycle.clear(),this.looping.clear(),this.loop=/* @__PURE__ */ new Set,this.around.clear(),this.tablesOf=void 0,this.iterated=void 0,this.run(e),this.applyFilters(e),this}iteration(){let e=this.wb.file.iteration;if(e!==void 0)return{max_iterations:(e===!0?void 0:e.max_iterations)??CR.max_iterations,max_change:(e===!0?void 0:e.max_change)??CR.max_change}}applyFilters(e){for(let e of this.wb.sheets){if(e.filters.every(e=>e.columns.size===0))continue;let t=nT(e,this);t.size>0&&this.hiddenBy.set(e,t)}if(this.hiddenBy.size!==0&&e.some(e=>bR.test(e.shared.text))){for(let t of e)t.state=1;this.cycles=[],this.inCycle.clear(),this.run([...e])}}value(e,t,n){return this.read(e,t,n)}read(e,t,n){let r=e.at(t,n);return r===void 0?this.ghost(e,t,n):typeof r!=`object`||r instanceof F?r:(r.state===1&&!this.waiting.has(r)?this.computeNow(r):r.state!==0&&this.circular(r),r.value)}ghost(e,t,n){let r=e.spillAt(t,n);if(!r)return null;if(r.state===1&&!this.waiting.has(r))this.computeNow(r);else if(r.state!==0)return this.circular(r),null;let{array:i}=r;return i&&e.spillAt(t,n)===r?i.at(t-r.row,n-r.col):null}circular(e){let t=this.stack.indexOf(e),n=t>=0?this.stack.slice(t):[e],r=!1;if(t<0&&this.waiting.has(e)){n=[];for(let t=this.work.lastIndexOf(e);t<this.work.length-1;t++){let e=this.work[t];e!==void 0&&(this.counted.has(e)?r=!0:(this.counted.add(e),n.push(...this.unwound.get(e)??[e])))}n.push(...this.stack)}if(this.iteration())for(let e of n)this.looping.add(e);else{!r&&!n.some(e=>this.inCycle.has(e))&&this.cycles.push(n);for(let e of n)this.inCycle.add(e)}}forget(e,t){this.indexes.changed(e,t),this.results.changed(e,t)}run(e){for(let t of e){let{sheet:e,row:n,col:r}=t;this.forget(e,{top:n,left:r,bottom:n,right:r}),t.spill&&this.forget(e,t.spill)}e.some(e=>this.loop.has(e))&&(this.iterated=void 0),this.computed=0;for(let t of this.order(e))t.state===1&&this.computeNow(t);this.spread(),this.iterate(),this.tables()}tableCells(){if(this.tablesOf)return this.tablesOf;let e=/* @__PURE__ */ new Map;for(let t of this.allCells())if(AR(t.shared.node)){let n=e.get(t.shared);n?n.push(t):e.set(t.shared,[t])}return this.tablesOf=e,e}tables(){if(this.replica||this.inTables)return;let e=this.tableCells();if(e.size!==0){this.inTables=!0;try{let t=[];for(let[n,r]of e)this.table(n,r),t.push(...r);let n=new Set(t),r=/* @__PURE__ */ new Set;for(let e of t)for(let t of this.readers(e.sheet,e.row,e.col))n.has(t)||r.add(t);r.size>0&&this.mark([...r])}finally{this.inTables=!1}}}operations(e){let t=/* @__PURE__ */ new Map,n=(e,t)=>{let n=e===void 0?void 0:this.eval(e,t);return n instanceof R&&n.single?n:void 0},r=e.map(e=>{let r=e.shared.node;if(r?.kind!==`call`)return I.REF;let i=jR(e),a=n(r.args[0],i);if(!a)return I.REF;let o=[];for(let e=1;e+1<r.args.length;e+=2){let a=n(r.args[e],i),s=n(r.args[e+1],i);if(!a||!s)return I.REF;let c=`${String(a.sheet.index)}:${String(a.top)}:${String(a.left)}`;t.has(c)||t.set(c,{sheet:a.sheet,row:a.top,col:a.left,slot:a.sheet.at(a.top,a.left)});let l=this.read(s.sheet,s.top,s.left);o.push({sheet:a.sheet,row:a.top,col:a.left,slot:l??void 0})}return this.change(o),this.read(a.sheet,a.top,a.left)});t.size>0&&this.change([...t.values()]),e.forEach((e,t)=>{e.value=r[t]??null,this.reports&&this.settled.add(e)})}table(e,t){let[n]=t,r=e.node;if(!n||r?.kind!==`call`)return;if(r.args.length>2){this.operations(t);return}let{sheet:i}=n,a=e.row,o=e.col,s={sheet:i,row:a,col:o,dr:0,dc:0},c=e=>{if(e===void 0||e.kind===`missing`)return null;let t=this.eval(e,s);return t instanceof R&&t.single?t:void 0},l=c(r.args[0]),u=c(r.args[1]),d=e=>{for(let n of t)n.value=e,this.reports&&this.settled.add(n)};if(l===void 0||u===void 0||l===null&&u===null||a===0||o===0){d(I.REF);return}let f=[l,u].filter(e=>e!==null).map(e=>({sheet:e.sheet,row:e.top,col:e.left,slot:e.sheet.at(e.top,e.left)})),p=e=>{let t=[];l&&t.push({sheet:l.sheet,row:l.top,col:l.left,slot:this.read(i,a-1,e.col)??void 0}),u&&t.push({sheet:u.sheet,row:u.top,col:u.left,slot:this.read(i,e.row,o-1)??void 0}),this.change(t)},m=e=>{let[t,n]=l&&u?[a-1,o-1]:u?[a-1,e.col]:[e.row,o-1];return this.read(i,t,n)},h=e=>l&&u?void 0:u?e.row:e.col,g=t.map((e,t)=>({cell:e,i:t})).sort((e,t)=>u&&!l?e.cell.row-t.cell.row||e.cell.col-t.cell.col:e.cell.col-t.cell.col||e.cell.row-t.cell.row),_=[],v;for(let{cell:e,i:t}of g){let n=h(e);(n===void 0||n!==v)&&(p(e),v=n),_[t]=m(e)}this.change(f),t.forEach((e,t)=>{e.value=_[t]??null,this.reports&&this.settled.add(e)})}iterate(){let e=this.iteration();if(!e||this.looping.size===0){this.looping.clear();return}for(let e of this.looping)this.around.add(e);let t=this.downstream([...this.looping]),n=[...t],r=1,i=1/0;for(;r<e.max_iterations;){let t=n.map(e=>e.value);this.looping.clear(),this.indexes.clear(),this.results.clear();for(let e of n)e.state=1;for(let e of this.order(n))e.state===1&&this.computeNow(e);if(r+=1,i=0,n.forEach((e,n)=>{i=Math.max(i,wR(t[n]??null,e.value))}),i<e.max_change)break}this.looping.clear(),this.spread(),this.looping.clear(),this.loop=t,this.iterated={cells:n.length,iterations:r,change:i}}iterates(e){return this.loop.has(e)}circularCells(){return[...this.around]}downstream(e){let t=new Set(e),n=[...e];for(;;){let e=n.pop();if(!e)break;for(let r of this.readers(e.sheet,e.row,e.col))t.has(r)||(t.add(r),n.push(r))}return t}spread(){for(let e=0;this.moved.length>0;e++){let t=this.moved;if(this.moved=[],e>=24)break;if(e>=12)for(let{sheet:e,area:n}of t)for(let t of e.spillsIn(n))this.unsettled.add(t);this.build();let n=/* @__PURE__ */ new Set,r=[...this.unsettled];for(let{sheet:e,area:n}of t)_g(r,this.readersIn(e,n)),_g(r,e.blockedBy(n));for(;;){let e=r.pop();if(!e)break;n.has(e)||(n.add(e),_g(r,this.readers(e.sheet,e.row,e.col)))}if(n.size!==0){for(let e of n)e.state=1,this.inCycle.delete(e);this.cycles=this.cycles.filter(e=>!e.some(e=>n.has(e))),this.indexes.clear(),this.results.clear();for(let e of this.order([...n]))e.state===1&&this.computeNow(e)}}for(let e of this.wb.sheets)e.tighten()}spillOut(e,t){let{sheet:n,row:r,col:i}=e,a={top:r,left:i,bottom:r+t.rows-1,right:i+t.cols-1},o=n.spillsIn(a).filter(t=>t!==e);if(a.bottom>=1048576||a.right>=16384||n.holds(a,e)||n.tables.some(e=>b(e.area,a))||n.merges.some(e=>b(e,a))||o.some(t=>ER(t,e)))return n.blockSpill(e,a),!1;for(let e of o)this.evict(e,a);return n.placeSpill(e,a),!0}evict(e,t){let{sheet:n,spill:r}=e;r&&(n.clearSpill(e),n.blockSpill(e,t),e.array=void 0,e.value=I.SPILL,this.moved.push({sheet:n,area:r}),this.reports&&this.settled.add(e))}analysisOf(e){if(e.analysis!==void 0)return e.analysis;let t=e.node,n=t===void 0?void 0:this.analyses.get(t),r=n??pR(this.wb,e);return t!==void 0&&n===void 0&&this.analyses.set(t,r),e.analysis=r,r}analyses=/* @__PURE__ */ new WeakMap;readsOf(e){let t=[],n=jR(e);for(let r of this.analysisOf(e.shared).reads){let e=r.kind===`ref`?this.resolveRef(r,n):this.structured(r,n);e instanceof R?t.push(e):e instanceof pg&&t.push(...e.parts)}return t}readsAt(e,t,n,r){let i={sheet:t,row:n,col:r,dr:n-e.row,dc:r-e.col},a=[];for(let t of this.analysisOf(e).reads){let e=t.kind===`ref`?this.resolveRef(t,i):this.structured(t,i);e instanceof R?a.push(e):e instanceof pg?a.push(...e.parts):a.push(void 0)}return a}readsOfFormula(e,t){let n=[],r={sheet:t,row:e.row,col:e.col,dr:0,dc:0};for(let t of this.analysisOf(e).reads){let e=t.kind===`ref`?this.resolveRef(t,r):this.structured(t,r);e instanceof R?n.push(e):e instanceof pg&&n.push(...e.parts)}return n}order(e){this.pass+=1;let{pass:t}=this,n=[],r=/* @__PURE__ */ new Set,i=[],a=e=>{e.mark=t,i.push({cell:e,reads:this.pending(e,r),next:0})};for(let r of e)if(r.mark!==t)for(a(r);;){let e=i[i.length-1];if(!e)break;let r=e.reads[e.next];e.next+=1,r===void 0?(n.push(e.cell),i.pop()):r.mark!==t&&r.state===1&&a(r)}return n}pending(e,t){let n=[];for(let r of this.readsOf(e)){let{sheet:e}=r;if(r.single){let t=e.at(r.top,r.left);t instanceof vC&&n.push(t);continue}if(t.has(r.key))continue;t.add(r.key);let i=Math.min(r.right,e.columnsUsed-1);for(let t=r.left;t<=i;t++){if(!e.hasFormulas(t))continue;let[i,a]=e.span(t,r.top,r.bottom);for(let r=i;r<=a;r++){let i=e.at(r,t);i instanceof vC&&n.push(i)}}}return n}computeNow(e){if(this.stack.length>0){if(this.stack.length>=50&&this.stack.length<xR)throw new SR(e);this.compute(e);return}let t=[e],n=/* @__PURE__ */ new Set([e]);this.work=t;try{for(;t.length>0;){let e=t[t.length-1];if(e===void 0)break;if(this.waiting.delete(e),e.state!==1)t.pop();else try{this.compute(e),t.pop()}catch(r){if(!(r instanceof SR))throw r;this.unwound.set(e,[...this.stack]),this.counted.delete(e);for(let e of this.stack)e.state=1;if(this.stack.length=0,this.waiting.add(e),n.has(r.cell)){r.cell.value=I.CALC,r.cell.state=0;continue}n.add(r.cell),t.push(r.cell)}}}finally{this.waiting.clear(),this.unwound.clear(),this.counted.clear(),this.work=[]}}compute(e){if(this.stack.length>=xR){e.value=I.CALC,e.state=0;return}e.state=2,this.stack.push(e),this.computed+=1;let{node:t}=e.shared,n=AR(t)?e.value:t?this.top(this.eval(t,jR(e))):I.NAME;this.stack.pop(),this.unsettled.has(e)&&!this.inCycle.has(e)&&(this.inCycle.add(e),this.cycles.push([e])),this.settleResult(e,n),e.state=0,this.reports&&this.settled.add(e)}settleResult(e,t){let{sheet:n}=e,r=e.spill,i=e.array;if(n.clearSpill(e),e.array=void 0,t instanceof L){let n=kR(t);n.rows*n.cols<=1||this.spillOut(e,n)?(e.array=n,e.value=n.at(0,0)??0):e.value=I.SPILL}else e.value=t;this.inCycle.has(e)&&(n.clearSpill(e),e.value=I.CYCLE,e.array=void 0);let a=e.spill;TR(i,e.array)&&OR(r,a)||(r&&this.moved.push({sheet:n,area:r}),a&&this.moved.push({sheet:n,area:a}))}top(e){let t=this.flat(e);return t===null?0:t}flat(e){return e instanceof R?e.single?this.read(e.sheet,e.top,e.left):this.matrix(e):e instanceof pg?I.VALUE:e instanceof mg?I.CALC:e instanceof hg?null:e}matrix(e){let t=e.bottom===1048575?Math.min(e.bottom,e.sheet.lastRow):e.bottom,n=e.right===16383?Math.min(e.right,e.sheet.columnsUsed-1):e.right,r=Math.max(0,t-e.top+1),i=Math.max(0,n-e.left+1),a=Array(r*i);for(let t=0;t<r;t++)for(let n=0;n<i;n++)a[t*i+n]=this.read(e.sheet,e.top+t,e.left+n);return new L(r,i,a)}each(e,t){let{sheet:n}=e,r=Math.min(e.right,n.columnsUsed-1);for(let i=e.left;i<=r;i++){let[r,a]=n.span(i,e.top,e.bottom);for(let e=r;e<=a;e++){let r=n.at(e,i);r===void 0?n.spillAt(e,i)&&t(this.read(n,e,i),e,i):t(typeof r==`object`&&!(r instanceof F)?this.read(n,e,i):r,e,i)}}}evaluate(e,t){let{node:n}=e;return n?this.top(this.eval(n,{sheet:t,row:e.row,col:e.col,dr:0,dc:0})):I.NAME}evaluateAt(e,t,n,r){let{node:i}=e;return i?this.top(this.eval(i,{sheet:t,row:n,col:r,dr:n-e.row,dc:r-e.col})):I.NAME}hyperlinkTarget(e){let t=e.shared.node;for(;t?.kind===`paren`;)t=t.arg;if(t?.kind!==`call`||t.name!==`HYPERLINK`)return;let[n]=t.args;if(n===void 0)return;let r=jR(e);return this.scalar(this.eval(n,r),r)}bound(e,t,n){let r=e.abs?e.index:e.index+t;return r<0||r>=n?void 0:r}resolveRef(e,t){let n=e.sheet===void 0?t.sheet:this.wb.sheet(e.sheet);if(!n)return I.REF;let r=0,i=16383,a=0,o=1048575;if(e.col){let n=this.bound(e.col,t.dc,d),a=this.bound(e.col2??e.col,t.dc,d);if(n===void 0||a===void 0)return I.REF;r=Math.min(n,a),i=Math.max(n,a)}if(e.row){let n=this.bound(e.row,t.dr,u),r=this.bound(e.row2??e.row,t.dr,u);if(n===void 0||r===void 0)return I.REF;a=Math.min(n,r),o=Math.max(n,r)}if(e.lastSheet!==void 0){let t=this.wb.sheet(e.lastSheet);if(!t)return I.REF;let[s,c]=[Math.min(n.index,t.index),Math.max(n.index,t.index)];return new pg(this.wb.sheets.slice(s,c+1).map(e=>new R(e,a,r,o,i)))}return new R(n,a,r,o,i)}structured(e,t){let n=e.table===void 0?t.sheet.tableAt(t.row,t.col):this.wb.table(e.table);return n?MR(n,e,t):e.table===void 0?I.REF:I.NAME}nameValue(e,t,n){let r=e.toLowerCase();if(n===void 0)for(let e=t.scope;e;e=e.parent){let t=e.names.get(r);if(t!==void 0)return t}let i=n===void 0?t.sheet:this.wb.sheet(n);if(!i)return I.REF;let a=this.wb.name(e,i);if(a){if(!a.formula)return a.value??null;let{node:e}=a.formula;if(!e)return I.NAME;if(this.namesAt.has(r))return I.CYCLE;this.namesAt.add(r);try{return this.eval(e,{sheet:t.sheet,row:0,col:0,dr:0,dc:0})}finally{this.namesAt.delete(r)}}let o=this.wb.table(e);if(o){let{top:e,left:t,bottom:n,right:r}=o.data;return new R(o.sheet,e,t,n,r)}let s=dw.get(e.toUpperCase());return s&&s.kind!==`lazy`?NR(s,e,t):I.NAME}intersect(e,t){return!(e instanceof R)||e.single?e:e.cols===1&&t.row>=e.top&&t.row<=e.bottom?new R(e.sheet,t.row,e.left,t.row,e.left):e.rows===1&&t.col>=e.left&&t.col<=e.right?new R(e.sheet,e.top,t.col,e.top,t.col):I.VALUE}unary(e,t){let n=this.flat(e);return n instanceof L?new L(n.rows,n.cols,n.data.map(t)):t(n)}operate(e,t,n){let r=this.flat(t),i=this.flat(n);return r instanceof L||i instanceof L?sw(r instanceof L?r:new L(1,1,[r]),i instanceof L?i:new L(1,1,[i]),(t,n)=>ow(e,t,n)):ow(e,r,i)}rangeOf(e,t){return e instanceof F?e:t instanceof F?t:!(e instanceof R)||!(t instanceof R)||e.sheet!==t.sheet?I.REF:new R(e.sheet,Math.min(e.top,t.top),Math.min(e.left,t.left),Math.max(e.bottom,t.bottom),Math.max(e.right,t.right))}intersection(e,t){if(e instanceof F)return e;if(t instanceof F)return t;if(!(e instanceof R)||!(t instanceof R))return I.REF;let n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),i=Math.min(e.bottom,t.bottom),a=Math.min(e.right,t.right);return e.sheet!==t.sheet||n>i||r>a?I.NULL:new R(e.sheet,n,r,i,a)}union(e,t){if(e instanceof F)return e;if(t instanceof F)return t;let n=e=>e instanceof R?[e]:e instanceof pg?e.parts:[],r=[...n(e),...n(t)];return r.length===0?I.VALUE:new pg(r)}eval(e,t){switch(e.kind){case`number`:case`string`:case`boolean`:return e.value;case`error`:return F.of(e.code);case`missing`:return gg;case`ref`:return this.resolveRef(e,t);case`structured`:return this.structured(e,t);case`name`:return this.nameValue(e.name,t,e.sheet);case`paren`:return this.eval(e.arg,t);case`unary`:{let n=this.eval(e.arg,t);return e.op===`@`?this.intersect(n,t):e.op===`+`?n:this.unary(n,e=>ow(`*`,e,-1))}case`postfix`:{let n=this.eval(e.arg,t);if(e.op===`%`)return this.unary(n,e=>ow(`/`,e,100));if(n instanceof R&&n.single){let e=n.sheet.at(n.top,n.left);if(e instanceof vC){this.read(n.sheet,n.top,n.left);let{spill:t}=e;if(t)return new R(n.sheet,t.top,t.left,t.bottom,t.right);if(e.array)return n}}return I.REF}case`binary`:{let n=this.eval(e.left,t),r=this.eval(e.right,t);return e.op===`:`?this.rangeOf(n,r):e.op===` `?this.intersection(n,r):e.op===`,`?this.union(n,r):this.operate(e.op,n,r)}case`array`:return new L(e.rows.length,e.rows[0]?.length??0,e.rows.flatMap(e=>e.map(e=>{let n=this.eval(e,t);return n instanceof L||n instanceof R||n instanceof pg||n instanceof mg||n instanceof hg?I.VALUE:n})));case`invoke`:{let n=this.eval(e.callee,t);return n instanceof mg?this.invoke(n,e.args,t):n instanceof F?n:I.VALUE}case`call`:return this.call(e.name,e.args,t)}}invoke(e,t,n){return this.apply(e,t.map(e=>this.eval(e,n)))}apply(e,t){if(e.named!==void 0){let n=dw.get(e.named);return!n||n.kind===`lazy`?I.NAME:t.length<n.min||t.length>n.max?I.VALUE:this.applyFunction(n,t,e.frame)}if(t.length>e.params.length)return I.VALUE;let n=e.params.length+1;if(this.lambdaSlots+n>1024)return I.NUM;let r=/* @__PURE__ */ new Map;e.params.forEach((e,n)=>{r.set(e,t[n]??gg)}),this.lambdaSlots+=n;let i=this.stack.length;try{return this.eval(e.body,{...e.frame,scope:{names:r,...e.frame.scope?{parent:e.frame.scope}:{}}})}catch(e){if(!(e instanceof RangeError)||!e.message.includes(`call stack`))throw e;for(let e of this.stack.splice(i))e.state=1;return I.NUM}finally{this.lambdaSlots-=n}}call(e,t,n){let r=dw.get(e);if(!r){let r=this.nameValue(e,n);return r instanceof mg?this.invoke(r,t,n):I.NAME}return t.length<r.min||t.length>r.max?I.VALUE:r.kind===`lazy`?r.call(t,{calc:this,frame:n}):this.applyFunction(r,t.map(e=>this.eval(e,n)),n)}applyFunction(e,t,n){let r={calc:this,frame:n};if(e.kind===`lazy`)return I.VALUE;if(e.kind===`raw`)return mw(e.params,t.length)?this.over(t,t=>pw(e.params,t)===`value`,t=>e.call(t,r)):I.VALUE;let i=e.errors===!0;return this.over(t,()=>!0,t=>{let n=t.map(e=>e instanceof hg?void 0:e);if(!i){for(let e of n)if(e instanceof F)return e}return e.call(...n)})}over(e,t,n){let r=[],i=/* @__PURE__ */ new Map;for(let[n,a]of e.entries()){if(!t(n)||a instanceof hg){r.push(a);continue}let e=this.flat(a);e instanceof L&&i.set(n,e),r.push(e)}if(i.size===0)return n(r);let a=[...i.values()],o=Math.max(...a.map(e=>e.rows)),s=Math.max(...a.map(e=>e.cols));if(o===0||s===0)return I.CALC;let c=Array(o*s);for(let e=0;e<o;e++)for(let t=0;t<s;t++){let a=r.map((n,r)=>{let a=i.get(r);if(!a)return n;let o=a.rows===1?0:e,s=a.cols===1?0:t;return o<a.rows&&s<a.cols?a.at(o,s):I.NA});c[e*s+t]=this.element(n(a))}return new L(o,s,c)}element(e){let t=this.flat(e);return t instanceof L?t.rows>0&&t.cols>0?t.at(0,0):I.CALC:t}scalar(e,t){if(e instanceof hg)return null;if(e instanceof R){let n=this.intersect(e,t);return n instanceof R?this.read(n.sheet,n.top,n.left):I.VALUE}return e instanceof L?e.at(0,0):e instanceof pg||e instanceof mg?I.VALUE:e}recalculate(){if(this.replica)return this;let e=this.allCells().filter(e=>this.analysisOf(e.shared).volatile);return this.mark(e),this}build(){if(this.graphMade)return;this.graphMade=!0;let e=this.allCells();for(let t of e)this.analysisOf(t.shared).volatile&&this.volatiles.add(t);this.graph.build(e)}addEdges(e){this.analysisOf(e.shared).volatile&&this.volatiles.add(e),this.graph.add(e)}removeEdges(e){this.volatiles.delete(e),this.graph.remove(e)}readersIn(e,t){return this.graph.readersIn(e,t)}readers(e,t,n){return this.build(),this.graph.readers(e,t,n)}precedents(e){return this.readsOf(e)}mark(e){this.build();let t=new Set(e),n=[...e];for(;;){let e=n.pop();if(!e)break;for(let r of this.readers(e.sheet,e.row,e.col))t.has(r)||(t.add(r),n.push(r))}this.settle(t)}settle(e){for(let t of e)t.state=1,this.inCycle.delete(t);this.cycles=this.cycles.filter(t=>!t.some(t=>e.has(t))),this.run([...e])}set(e,t,n,r){let i=typeof r==`string`&&r.length>1&&r.startsWith(`=`)?new vC(new gC(r,t,n,{file:``}),e,t,n):void 0;this.change([{sheet:e,row:t,col:n,slot:i??r??void 0}])}prepare(){this.build()}change(e){if(this.replica){for(let{sheet:t,row:n,col:r,slot:i}of e){let e=t.at(n,r);e instanceof vC&&t.clearSpill(e),t.replace(n,r,i),i instanceof vC&&(i.state=0)}return}this.build();let t=/* @__PURE__ */ new Set,n=[...this.unsettled];this.unsettled.clear();let r=/* @__PURE__ */ new Set;for(let{sheet:i,row:a,col:o,slot:s}of e){let e=i.at(a,o);(e instanceof vC&&AR(e.shared.node)||s instanceof vC&&AR(s.shared.node))&&(this.tablesOf=void 0),e instanceof vC&&(r.add(e),this.inCycle.delete(e),this.removeEdges(e),t.delete(e),e.spill&&this.moved.push({sheet:i,area:e.spill}),i.clearSpill(e));let c=i.spillAt(a,o);c&&n.push(c),n.push(...i.blockedBy({top:a,left:o,bottom:a,right:o})),i.replace(a,o,s),this.forget(i,{top:a,left:o,bottom:a,right:o}),s instanceof vC&&(this.addEdges(s),t.add(s))}r.size>0&&(this.cycles=this.cycles.filter(e=>!e.some(e=>r.has(e))));for(let{sheet:t,row:r,col:i}of e)_g(n,this.readers(t,r,i));for(_g(n,this.volatiles);;){let e=n.pop();if(!e)break;t.has(e)||this.inTables&&AR(e.shared.node)||(t.add(e),_g(n,this.readers(e.sheet,e.row,e.col)))}this.settle(t)}setName(e,t){let n=this.wb.name(e);if(!n)throw Error(`There is no name ${e}.`);n.value=t,delete n.formula;let r=e.toLowerCase();this.mark(this.allCells().filter(e=>this.analysisOf(e.shared).names.has(r)))}takeComputed(){let e=[];for(let t of this.settled)e.push({sheet:t.sheet.index,row:t.row,col:t.col,value:UC(t.value),...t.array?{array:GC(t.array)}:{},...t.spill?{spill:t.spill}:{},...t.blocked?{blocked:t.blocked}:{}});return this.settled.clear(),{cells:e,cycles:this.cycles.map(e=>e.map(e=>({sheet:e.sheet.index,row:e.row,col:e.col}))),hidden:[...this.hiddenBy].map(([e,t])=>({sheet:e.index,rows:[...t]}))}}receive(e){for(let t of e.cells){let e=this.wb.sheets[t.sheet],n=e?.at(t.row,t.col);e&&n instanceof vC&&(e.clearSpill(n),n.value=WC(t.value),n.array=t.array?KC(t.array):void 0,t.spill&&e.placeSpill(n,t.spill),t.blocked&&e.blockSpill(n,t.blocked),n.state=0)}this.cycles=e.cycles.flatMap(e=>{let t=e.flatMap(e=>{let t=this.wb.sheets[e.sheet]?.at(e.row,e.col);return t instanceof vC?[t]:[]});return t.length>0?[t]:[]});let t=new Map(this.hiddenBy);this.hiddenBy.clear();for(let{sheet:n,rows:r}of e.hidden){let e=this.wb.sheets[n];if(!e)continue;let i=t.get(e),a=i?.size===r.length&&r.every(e=>i.has(e));this.hiddenBy.set(e,a?i:new Set(r))}for(let e of this.wb.sheets)e.tighten()}numberOf(e){return z(e)}};let OR=(e,t)=>e?.top===t?.top&&e?.left===t?.left&&e?.bottom===t?.bottom&&e?.right===t?.right;function kR(e){return e.data.some(e=>e===null)?new L(e.rows,e.cols,e.data.map(e=>e??0)):e}function AR(e){return e?.kind===`call`&&e.name===`TABLE`}function jR(e){return{sheet:e.sheet,row:e.row,col:e.col,dr:e.row-e.shared.row,dc:e.col-e.shared.col}}function MR(e,t,n){let{sheet:r}=e,i=e.area,a=i.left,o=i.right,[s,c]=t.columns;if(s!==void 0){let t=e.column(s),n=c===void 0?t:e.column(c);if(!t||!n)return I.REF;a=i.left+Math.min(t.index,n.index),o=i.left+Math.max(t.index,n.index)}if(t.thisRow)return n.sheet!==r||n.row<=i.top||n.row>i.bottom?I.VALUE:new R(r,n.row,a,n.row,o);let l=t.sections;if(l.includes(`#Totals`))return I.REF;let u=l.includes(`#All`)||l.includes(`#Headers`),d=l.length===0||l.includes(`#All`)||l.includes(`#Data`),f=u?i.top:i.top+1,p=d?i.bottom:i.top;return new R(r,f,a,p,o)}function NR(e,t,n){return new mg([],{kind:`call`,name:e.name,written:t,args:[]},n,e.name)}function PR(e,t,n,r){r&&e.respec(r);let i=[];for(let t of n){let n=e.sheets[t.sheet];if(!n)continue;let{row:r,col:a}=t,o=xC(r,a);if(t.key===null?n.keys.delete(o):t.key!==void 0&&n.keys.set(o,t.key),t.record){let n=e.table(t.record.table);n&&(n.records[t.record.index]=t.record.fields)}n.implied.delete(o);let s=t.column?e.table(t.column.table)?.columns.find(e=>e.name===t.column?.name)?.formula:void 0;if(s){i.push({sheet:n,row:r,col:a,slot:new vC(s,n,r,a)});continue}let c=jh(t.input??``);c.format!==void 0&&n.implied.set(o,c.format),i.push({sheet:n,row:r,col:a,slot:c.formula===void 0?c.value??void 0:new vC(new gC(c.formula,r,a,{file:``}),n,r,a)})}t.change(i)}function FR(e,t={}){let n=new Map(e.rows),r=BC({file:e.file,rows:e=>n.get(e),generated:e.generated,theme:e.theme});return e.scenario!==void 0&&YC(r,e.scenario),{workbook:r,calc:new DR(r,{random:vR(e.seed),...t}).calculate()}}var IR=class{model;generation=-1;handle(e){if(e.kind===`open`)this.model=FR(e,{report:!0}),this.generation=e.generation;else{if(e.generation!==this.generation||!this.model)return;e.kind===`cells`?PR(this.model.workbook,this.model.calc,e.cells,e.file):this.model.calc.recalculate()}return{generation:this.generation,computed:this.model.calc.takeComputed()}}};FS(lf);let LR=[[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],[`周一`,`周二`,`周三`,`周四`,`周五`,`周六`,`周日`],[`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`,`星期日`]],RR=[[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`]];[...LR,...RR],Object.fromEntries([`bold`,`italic`,`underline`,`strike`,`font`,`size`,`color`,`fill`,`align`,`valign`,`wrap`,`shrink`,`indent`,`rotation`,`border`,`locked`,`hide_formula`,`format`].map(e=>[e,void 0]));let zR=new IR;addEventListener(`message`,e=>{let t=zR.handle(e.data);t&&postMessage(t)})})();
|