@bino-bi/bn-template-engine 1.0.0-next.27 → 1.0.0-next.28
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/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/p-5075771a.entry.js +1 -0
- package/dist/bn-template-engine/p-5d516435.entry.js +1 -0
- package/dist/bn-template-engine/p-5e90e728.entry.js +1 -0
- package/dist/bn-template-engine/p-9ef7e132.entry.js +1 -0
- package/dist/bn-template-engine/p-9f7a1980.entry.js +1 -0
- package/dist/bn-template-engine/p-BeXgxHkW.js +1 -0
- package/dist/bn-template-engine/p-CH0bpt_k.js +1 -0
- package/dist/bn-template-engine/p-ClruFZD_.js +1 -0
- package/dist/bn-template-engine/{p-CTrNbSXN.js → p-DFmSrSnf.js} +1 -1
- package/dist/bn-template-engine/p-DI3efDSV.js +1 -0
- package/dist/bn-template-engine/p-DXLTTILG.js +1 -0
- package/dist/bn-template-engine/p-DtP4jqG5.js +1 -0
- package/dist/bn-template-engine/p-a8281b71.entry.js +1 -0
- package/dist/bn-template-engine/p-b31277e7.entry.js +1 -0
- package/dist/bn-template-engine/p-b396ac84.entry.js +1 -0
- package/dist/cjs/{bn-asset_21.cjs.entry.js → bn-asset_28.cjs.entry.js} +21401 -6608
- package/dist/cjs/bn-grid.cjs.entry.js +4 -6
- package/dist/cjs/bn-image.cjs.entry.js +3 -5
- package/dist/cjs/bn-internationalization.cjs.entry.js +17 -6
- package/dist/cjs/bn-ruleset.cjs.entry.js +5 -5
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-template.cjs.entry.js +2 -2
- package/dist/cjs/bn-text.cjs.entry.js +115 -43
- package/dist/cjs/{context-protocol-G4pi217i.js → context-protocol-C0rKepqu.js} +98 -12
- package/dist/cjs/{diagnostics-CRfecdNZ.js → diagnostics-Cq-qDtXq.js} +1 -1
- package/dist/cjs/editor-companion.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/queryError-BZjnIW_w.js +16 -0
- package/dist/cjs/{scaling-BGTK5H0H.js → sanitizeHtml-Yx1xn6i_.js} +467 -287
- package/dist/cjs/{withBodyObserver-DJO98AJ-.js → withBodyObserver-CaPUjuC5.js} +1 -1
- package/dist/cjs/withHasError-qGW_yqIv.js +426 -0
- package/dist/cjs/{withStyled-CZCnmfPw.js → withStyled-vSfogp9J.js} +543 -42
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +51 -28
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.js +13 -5
- package/dist/collection/components/bn-chart-bubble/utils/BubbleChart.js +67 -30
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +47 -29
- package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.js +14 -5
- package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +34 -18
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletChartStyle.js +2 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletConfig.js +1 -1
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +50 -27
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.js +13 -5
- package/dist/collection/components/bn-chart-scatter/utils/ScatterChart.js +52 -18
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +59 -43
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +56 -15
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +218 -262
- package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +1 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/Needle.js +11 -4
- package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +16 -25
- package/dist/collection/components/bn-chart-structure/utils/model/StructureChartComponentConfig.js +3 -2
- package/dist/collection/components/bn-chart-structure/utils/model/styles/StructureChartStyle.js +2 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +99 -51
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +56 -15
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +245 -250
- package/dist/collection/components/bn-chart-time/utils/elements/AreaFill.js +1 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Label.js +1 -1
- package/dist/collection/components/bn-chart-time/utils/elements/LineSeries.js +1 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Needle.js +11 -4
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +22 -34
- package/dist/collection/components/bn-chart-time/utils/helper/LabelCollisionManager.js +3 -3
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +4 -3
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartDataRow.js +2 -2
- package/dist/collection/components/bn-chart-time/utils/model/styles/TimeChartStyle.js +2 -0
- package/dist/collection/components/bn-component-style/bn-component-style.js +14 -2
- package/dist/collection/components/bn-context/bn-context.js +92 -22
- package/dist/collection/components/bn-dataset/bn-dataset.js +246 -90
- package/dist/collection/components/bn-datasource/bn-datasource.js +169 -77
- package/dist/collection/components/bn-footer/bn-footer.js +6 -6
- package/dist/collection/components/bn-internationalization/bn-internationalization.js +14 -3
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +25 -74
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +59 -71
- package/dist/collection/components/bn-message/bn-message.js +2 -2
- package/dist/collection/components/bn-page/bn-page.css +0 -240
- package/dist/collection/components/bn-page/bn-page.js +14 -4
- package/dist/collection/components/bn-page/pageFormats.js +69 -0
- package/dist/collection/components/bn-ruleset/bn-ruleset.js +2 -2
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +7 -7
- package/dist/collection/components/bn-table/bn-table.js +93 -58
- package/dist/collection/components/bn-table/ibcs-table.css +2 -1
- package/dist/collection/components/bn-table/ibcs-table.js +85 -28
- package/dist/collection/components/bn-table/utils/Table.js +12 -13
- package/dist/collection/components/bn-table/utils/elements/Cell.js +9 -3
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +38 -34
- package/dist/collection/components/bn-table/utils/elements/TableRow.js +2 -1
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +4 -4
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +17 -4
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +128 -98
- package/dist/collection/components/bn-table/utils/helper/IntervalColumns.js +6 -20
- package/dist/collection/components/bn-table/utils/helper/QueryGroup.js +9 -2
- package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +2 -2
- package/dist/collection/components/bn-table/utils/model/TableAttribute.js +2 -2
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +3 -2
- package/dist/collection/components/bn-template/bn-template.js +1 -1
- package/dist/collection/components/bn-text/bn-text.js +36 -39
- package/dist/collection/components/bn-text/utils/template.js +79 -0
- package/dist/collection/components/bn-title/bn-title.js +10 -4
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +3 -1
- package/dist/collection/components/bn-tree/bn-tree.js +119 -23
- package/dist/collection/components/bn-tree/utils/EdgeRenderer.js +59 -51
- package/dist/collection/components/bn-tree/utils/TreeLayout.js +30 -5
- package/dist/collection/components/bn-tree/utils/TreeParser.js +35 -0
- package/dist/collection/components/editor-companion/editor-companion.js +1 -1
- package/dist/collection/context/context-protocol.js +1 -1
- package/dist/collection/context/scopedDb.js +47 -4
- package/dist/collection/stores/componentStyles.js +39 -0
- package/dist/collection/stores/internationalization.js +5 -3
- package/dist/collection/utils/DateStringFactory.js +17 -15
- package/dist/collection/utils/autoFit.js +2 -2
- package/dist/collection/utils/componentRegister.js +60 -16
- package/dist/collection/utils/constants.js +2 -2
- package/dist/collection/utils/dataAnalyzer.js +9 -12
- package/dist/collection/utils/formatter.js +29 -20
- package/dist/collection/utils/layoutObserver.js +1 -1
- package/dist/collection/utils/layoutState/generic.js +1 -1
- package/dist/collection/utils/layoutState/svgChartElements.js +2 -2
- package/dist/collection/utils/layoutTemplate.js +81 -0
- package/dist/collection/utils/measurementHost.js +2 -2
- package/dist/collection/utils/model/Order.js +1 -1
- package/dist/collection/utils/model/styles/SVGStyle.js +12 -4
- package/dist/collection/utils/parentDimensions.js +35 -3
- package/dist/collection/utils/queryError.js +11 -0
- package/dist/collection/utils/relativeVariance.js +14 -0
- package/dist/collection/utils/sanitizeHtml.js +30 -16
- package/dist/collection/utils/scaling.js +2 -2
- package/dist/collection/utils/stackColors.js +27 -5
- package/dist/collection/utils/stackLayout.js +71 -0
- package/dist/collection/utils/styled/attributes.js +16 -3
- package/dist/collection/utils/styled/style-sheet.js +1 -1
- package/dist/collection/utils/styled/withStyled.js +1 -1
- package/dist/collection/utils/testing/fakeGroup.js +21 -0
- package/dist/collection/utils/testing/mutationObserver.js +44 -0
- package/dist/collection/utils/testing/structureChart.js +26 -0
- package/dist/collection/utils/testing/timeChart.js +28 -0
- package/dist/collection/utils/validate.js +1 -1
- package/dist/collection/utils/withComponentStatus.js +137 -12
- package/dist/collection/utils/withInheritedProps.js +113 -64
- package/dist/collection/utils/withRuleSet.js +10 -7
- package/dist/collection/utils/withTranslation.js +3 -3
- package/dist/collection/utils/xy/FacetGrid.js +1 -1
- package/dist/collection/utils/xy/IsoCurves.js +1 -1
- package/dist/collection/utils/xy/NumericScale.js +46 -15
- package/dist/collection/utils/xy/PointLabeler.js +2 -2
- package/dist/collection/utils/xy/RadiusScale.js +2 -2
- package/dist/collection/utils/xy/SeriesPalette.js +3 -3
- package/dist/collection/utils/xy/VarianceMeasure.js +22 -4
- package/dist/collection/utils/xy/XYFrame.js +4 -4
- package/dist/collection/utils/xy/XYLegend.js +5 -7
- package/dist/collection/utils/xy/checkXYOverflow.js +32 -0
- package/dist/collection/utils/xy/formatXYValue.js +13 -0
- package/dist/collection/utils/xy/model/XYChartDataRow.js +0 -0
- package/dist/collection/utils/xy/model/XYChartStyle.js +2 -0
- package/dist/components/DataFormatDigits.js +1 -1
- package/dist/components/DateStringFactory.js +1 -1
- package/dist/components/LabelCollisionManager.js +1 -1
- package/dist/components/NumericScale.js +1 -1
- package/dist/components/Order.js +1 -1
- package/dist/components/SVGStyle.js +1 -0
- package/dist/components/TableAttribute.js +1 -0
- package/dist/components/VarianceMeasure.js +1 -1
- package/dist/components/XYChartDataRow.js +1 -1
- package/dist/components/bn-asset.js +1 -1
- package/dist/components/bn-body2.js +1 -1
- package/dist/components/bn-card2.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-component-style.js +1 -1
- package/dist/components/bn-context.js +1 -1
- package/dist/components/bn-dataset.js +1 -1
- package/dist/components/bn-datasource.js +1 -1
- package/dist/components/bn-footer2.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-internationalization.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-message2.js +1 -1
- package/dist/components/bn-page2.js +1 -1
- package/dist/components/bn-ruleset.js +1 -1
- package/dist/components/bn-scaling-group.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-template.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title2.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/checkXYOverflow.js +1 -0
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/editor-companion.js +1 -1
- package/dist/components/emptyState.js +1 -1
- package/dist/components/formatter.js +1 -1
- package/dist/components/ibcs-chart-bubble2.js +1 -1
- package/dist/components/ibcs-chart-bullet2.js +1 -1
- package/dist/components/ibcs-chart-scatter2.js +1 -1
- package/dist/components/ibcs-chart-structure2.js +1 -1
- package/dist/components/ibcs-chart-time2.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/ibcs-title2.js +1 -1
- package/dist/components/layoutObserver.js +1 -0
- package/dist/components/layoutTemplate.js +1 -0
- package/dist/components/pageFormats.js +1 -0
- package/dist/components/parentDimensions.js +1 -0
- package/dist/components/queryError.js +1 -0
- package/dist/components/relativeVariance.js +1 -0
- package/dist/components/sanitizeHtml.js +1 -1
- package/dist/components/stackColors.js +1 -1
- package/dist/components/stackLayout.js +1 -0
- package/dist/components/svg.esm.js +1 -1
- package/dist/components/validate.js +1 -1
- package/dist/components/withBodyObserver.js +1 -1
- package/dist/components/withComponentStatus.js +1 -0
- package/dist/components/withComponentStyle.js +1 -1
- package/dist/components/withDataset.js +1 -1
- package/dist/components/withHasError.js +1 -1
- package/dist/components/withRuleSet.js +1 -1
- package/dist/components/withScalingGroup.js +1 -1
- package/dist/components/withStyled.js +1 -1
- package/dist/components/withTranslation.js +1 -1
- package/dist/esm/{bn-asset_21.entry.js → bn-asset_28.entry.js} +20962 -6176
- package/dist/esm/bn-grid.entry.js +4 -6
- package/dist/esm/bn-image.entry.js +3 -5
- package/dist/esm/bn-internationalization.entry.js +17 -6
- package/dist/esm/bn-ruleset.entry.js +5 -5
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-template.entry.js +2 -2
- package/dist/esm/bn-text.entry.js +111 -39
- package/dist/esm/{context-protocol-D_ysqCp8.js → context-protocol-CdTp19uA.js} +96 -12
- package/dist/esm/{diagnostics-BjZRZraG.js → diagnostics-vw6TKMiT.js} +1 -1
- package/dist/esm/editor-companion.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/queryError-ClruFZD_.js +13 -0
- package/dist/esm/{scaling-YbP727FC.js → sanitizeHtml-C5bFtARM.js} +464 -287
- package/dist/esm/{withBodyObserver-Cb9ZC5_J.js → withBodyObserver-DD_-r04o.js} +1 -1
- package/dist/esm/withHasError-73WV2SP5.js +422 -0
- package/dist/esm/{withStyled-3yRswBcf.js → withStyled-BDEyKd_H.js} +513 -27
- package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +8 -4
- package/dist/types/components/bn-chart-bubble/ibcs-chart-bubble.d.ts +2 -1
- package/dist/types/components/bn-chart-bubble/utils/BubbleChart.d.ts +14 -2
- package/dist/types/components/bn-chart-bullet/bn-chart-bullet.d.ts +12 -11
- package/dist/types/components/bn-chart-bullet/ibcs-chart-bullet.d.ts +2 -1
- package/dist/types/components/bn-chart-bullet/utils/BulletChart.d.ts +8 -5
- package/dist/types/components/bn-chart-bullet/utils/model/BulletChartStyle.d.ts +2 -0
- package/dist/types/components/bn-chart-bullet/utils/model/BulletConfig.d.ts +1 -1
- package/dist/types/components/bn-chart-scatter/bn-chart-scatter.d.ts +8 -4
- package/dist/types/components/bn-chart-scatter/ibcs-chart-scatter.d.ts +2 -1
- package/dist/types/components/bn-chart-scatter/utils/ScatterChart.d.ts +11 -1
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +13 -12
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +8 -1
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +29 -6
- package/dist/types/components/bn-chart-structure/utils/elements/StackedBar.d.ts +4 -3
- package/dist/types/components/bn-chart-structure/utils/model/DataPoint.d.ts +3 -2
- package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts +2 -1
- package/dist/types/components/bn-chart-structure/utils/model/styles/StructureChartStyle.d.ts +2 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +19 -15
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +8 -1
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +63 -5
- package/dist/types/components/bn-chart-time/utils/elements/AreaFill.d.ts +1 -1
- package/dist/types/components/bn-chart-time/utils/elements/StackedColumn.d.ts +9 -8
- package/dist/types/components/bn-chart-time/utils/model/DataPoint.d.ts +3 -2
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +3 -2
- package/dist/types/components/bn-chart-time/utils/model/styles/TimeChartStyle.d.ts +2 -0
- package/dist/types/components/bn-context/bn-context.d.ts +15 -3
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +41 -20
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +34 -18
- package/dist/types/components/bn-footer/bn-footer.d.ts +2 -2
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +3 -10
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +13 -6
- package/dist/types/components/bn-message/bn-message.d.ts +2 -1
- package/dist/types/components/bn-page/bn-page.d.ts +2 -1
- package/dist/types/components/bn-page/pageFormats.d.ts +40 -0
- package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +2 -2
- package/dist/types/components/bn-table/bn-table.d.ts +11 -10
- package/dist/types/components/bn-table/ibcs-table.d.ts +8 -5
- package/dist/types/components/bn-table/utils/Table.d.ts +3 -1
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -2
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +6 -4
- package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +1 -1
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +2 -0
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +14 -5
- package/dist/types/components/bn-table/utils/helper/IntervalColumns.d.ts +2 -2
- package/dist/types/components/bn-table/utils/helper/QueryGroup.d.ts +6 -1
- package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +2 -2
- package/dist/types/components/bn-table/utils/model/TableAttribute.d.ts +2 -0
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +2 -1
- package/dist/types/components/bn-text/bn-text.d.ts +20 -13
- package/dist/types/components/bn-text/utils/template.d.ts +10 -0
- package/dist/types/components/bn-title/ibcs-title/ibcs-title.d.ts +1 -0
- package/dist/types/components/bn-tree/bn-tree.d.ts +8 -1
- package/dist/types/components/bn-tree/utils/EdgeRenderer.d.ts +18 -5
- package/dist/types/components/bn-tree/utils/TreeLayout.d.ts +5 -0
- package/dist/types/components.d.ts +226 -184
- package/dist/types/context/scopedDb.d.ts +20 -0
- package/dist/types/stores/componentStyles.d.ts +6 -0
- package/dist/types/utils/DateStringFactory.d.ts +3 -2
- package/dist/types/utils/autoFit.d.ts +2 -2
- package/dist/types/utils/componentRegister.d.ts +21 -5
- package/dist/types/utils/constants.d.ts +2 -2
- package/dist/types/utils/dataAnalyzer.d.ts +1 -1
- package/dist/types/utils/formatter.d.ts +7 -9
- package/dist/types/utils/layoutState/generic.d.ts +1 -1
- package/dist/types/utils/layoutState/svgChartElements.d.ts +2 -2
- package/dist/types/utils/layoutTemplate.d.ts +16 -0
- package/dist/types/utils/model/ChartStyles.d.ts +1 -1
- package/dist/types/utils/model/DataQueryResultRow.d.ts +2 -2
- package/dist/types/utils/model/Order.d.ts +1 -1
- package/dist/types/utils/model/styles/SVGStyle.d.ts +5 -1
- package/dist/types/utils/parentDimensions.d.ts +9 -0
- package/dist/types/utils/queryError.d.ts +5 -0
- package/dist/types/utils/relativeVariance.d.ts +9 -0
- package/dist/types/utils/sanitizeHtml.d.ts +2 -2
- package/dist/types/utils/scaling.d.ts +1 -1
- package/dist/types/utils/stackColors.d.ts +3 -2
- package/dist/types/utils/stackLayout.d.ts +49 -0
- package/dist/types/utils/testing/fakeGroup.d.ts +8 -0
- package/dist/types/utils/testing/mutationObserver.d.ts +5 -0
- package/dist/types/utils/testing/structureChart.d.ts +5 -0
- package/dist/types/utils/testing/timeChart.d.ts +5 -0
- package/dist/types/utils/validate.d.ts +1 -1
- package/dist/types/utils/withComponentStatus.d.ts +11 -3
- package/dist/types/utils/withInheritedProps.d.ts +42 -15
- package/dist/types/utils/withRuleSet.d.ts +2 -1
- package/dist/types/utils/withTranslation.d.ts +2 -2
- package/dist/types/utils/xy/FacetGrid.d.ts +1 -1
- package/dist/types/utils/xy/IsoCurves.d.ts +1 -1
- package/dist/types/utils/xy/NumericScale.d.ts +9 -4
- package/dist/types/utils/xy/PointLabeler.d.ts +2 -2
- package/dist/types/utils/xy/RadiusScale.d.ts +2 -2
- package/dist/types/utils/xy/SeriesPalette.d.ts +3 -3
- package/dist/types/utils/xy/VarianceMeasure.d.ts +10 -2
- package/dist/types/utils/xy/XYFrame.d.ts +4 -1
- package/dist/types/utils/xy/XYLegend.d.ts +3 -1
- package/dist/types/utils/xy/checkXYOverflow.d.ts +8 -0
- package/dist/types/utils/xy/formatXYValue.d.ts +7 -0
- package/dist/types/utils/xy/model/AxisConfig.d.ts +1 -1
- package/dist/types/utils/xy/model/XYChartStyle.d.ts +2 -0
- package/package.json +3 -1
- package/readme.md +11 -11
- package/dist/bn-template-engine/p-0a19e8af.entry.js +0 -1
- package/dist/bn-template-engine/p-0f6ece5a.entry.js +0 -1
- package/dist/bn-template-engine/p-13db2986.entry.js +0 -1
- package/dist/bn-template-engine/p-1b35c4ac.entry.js +0 -1
- package/dist/bn-template-engine/p-4602d613.entry.js +0 -1
- package/dist/bn-template-engine/p-489438ed.entry.js +0 -1
- package/dist/bn-template-engine/p-686d8e44.entry.js +0 -1
- package/dist/bn-template-engine/p-6f86159c.entry.js +0 -1
- package/dist/bn-template-engine/p-7401e3f3.entry.js +0 -1
- package/dist/bn-template-engine/p-83d50a14.entry.js +0 -1
- package/dist/bn-template-engine/p-BA48JiHe.js +0 -1
- package/dist/bn-template-engine/p-BCr2-Ka-.js +0 -1
- package/dist/bn-template-engine/p-BEkgk7Ij.js +0 -1
- package/dist/bn-template-engine/p-BVYKc5cH.js +0 -1
- package/dist/bn-template-engine/p-BeLWoM0Q.js +0 -1
- package/dist/bn-template-engine/p-CHZZqoB7.js +0 -1
- package/dist/bn-template-engine/p-CURM2Nrr.js +0 -1
- package/dist/bn-template-engine/p-Ckhir6Ux.js +0 -1
- package/dist/bn-template-engine/p-Ct0wEGrw.js +0 -1
- package/dist/bn-template-engine/p-CtEA0ZQc.js +0 -1
- package/dist/bn-template-engine/p-DJ5KJ6GF.js +0 -1
- package/dist/bn-template-engine/p-DoIuKI09.js +0 -1
- package/dist/bn-template-engine/p-DsTzlzxQ.js +0 -1
- package/dist/bn-template-engine/p-DtLI_CzV.js +0 -1
- package/dist/bn-template-engine/p-DwGg2_vO.js +0 -1
- package/dist/bn-template-engine/p-Z-mcXias.js +0 -1
- package/dist/bn-template-engine/p-aeba74a4.entry.js +0 -1
- package/dist/bn-template-engine/p-b4dabaf9.entry.js +0 -1
- package/dist/bn-template-engine/p-d083f0e6.entry.js +0 -1
- package/dist/bn-template-engine/p-ee09f216.entry.js +0 -1
- package/dist/bn-template-engine/p-f00b189f.entry.js +0 -1
- package/dist/cjs/AxisConfig-CbNnsmGC.js +0 -233
- package/dist/cjs/LabelCollisionManager-tOT40-pH.js +0 -415
- package/dist/cjs/NumericScale-BAyYXpKL.js +0 -107
- package/dist/cjs/Order-C5XgrPzr.js +0 -87
- package/dist/cjs/SVGStyle-C1LhLgbT.js +0 -6513
- package/dist/cjs/SVGVariancesStyleGroup-C2Ys_Iz6.js +0 -50
- package/dist/cjs/VarianceMeasure-uph4FBRa.js +0 -372
- package/dist/cjs/XYChartDataRow-BNqTnXnX.js +0 -829
- package/dist/cjs/bn-chart-bubble.cjs.entry.js +0 -793
- package/dist/cjs/bn-chart-bullet.cjs.entry.js +0 -806
- package/dist/cjs/bn-chart-scatter.cjs.entry.js +0 -679
- package/dist/cjs/bn-tree.cjs.entry.js +0 -1042
- package/dist/cjs/emptyState-B3kPjSFO.js +0 -423
- package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +0 -625
- package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +0 -674
- package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +0 -668
- package/dist/cjs/sanitizeHtml-LuZr1IMd.js +0 -85
- package/dist/cjs/withHasError-BdDmiOXM.js +0 -258
- package/dist/cjs/withScalingGroup-DrFV_zsQ.js +0 -73
- package/dist/components/autoFit.js +0 -1
- package/dist/components/utils.js +0 -1
- package/dist/esm/AxisConfig-CEFoGHUN.js +0 -224
- package/dist/esm/LabelCollisionManager-Dou5LvUs.js +0 -407
- package/dist/esm/NumericScale-DsTzlzxQ.js +0 -105
- package/dist/esm/Order-Tn0j255j.js +0 -83
- package/dist/esm/SVGStyle-BSuFK9YW.js +0 -6503
- package/dist/esm/SVGVariancesStyleGroup-D52LMGw8.js +0 -48
- package/dist/esm/VarianceMeasure-BXWH7oAW.js +0 -364
- package/dist/esm/XYChartDataRow-D272UFel.js +0 -820
- package/dist/esm/bn-chart-bubble.entry.js +0 -791
- package/dist/esm/bn-chart-bullet.entry.js +0 -804
- package/dist/esm/bn-chart-scatter.entry.js +0 -677
- package/dist/esm/bn-tree.entry.js +0 -1040
- package/dist/esm/emptyState-DqkM4Yc5.js +0 -417
- package/dist/esm/ibcs-chart-bubble.entry.js +0 -623
- package/dist/esm/ibcs-chart-bullet.entry.js +0 -672
- package/dist/esm/ibcs-chart-scatter.entry.js +0 -666
- package/dist/esm/sanitizeHtml-BA48JiHe.js +0 -83
- package/dist/esm/withHasError-Bh1Viz52.js +0 -254
- package/dist/esm/withScalingGroup-Byn-W6z8.js +0 -71
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as i,H as s,g as e,f as n,d as r,e as o,F as h}from"./p-C5UYpZUU.js";import{w as a,a as l,r as c}from"./p-CH0bpt_k.js";import{g as u,S as d,c as f,h as p,b as v,d as g,u as m,e as b,D as y,i as w,X as x,r as S,m as $,s as M,j as _}from"./p-BeXgxHkW.js";import{w as R}from"./p-DFmSrSnf.js";import{a as O,m as k,C as E,b as L,c as T,w as A,d as C,r as P,s as N,v as D,e as U,A as z,O as F,f as W,g as G,h as j,j as I,k as Y,i as B,l as H,n as V,S as X,o as J,p as q,q as K,t as Q,u as Z,D as tt,x as it,y as st,z as et,B as nt,E as rt,F as ot,G as ht,H as at,I as lt,J as ct,K as ut,L as dt,M as ft,N as pt,P as vt,Q as gt,T as mt,R as bt,U as yt,V as wt,W as xt,X as St,Y as $t,Z as Mt,_ as _t,$ as Rt,a0 as Ot,a1 as kt,a2 as Et,a3 as Lt,a4 as Tt,a5 as At,a6 as Ct,a7 as Pt,a8 as Nt}from"./p-DXLTTILG.js";import{r as Dt,m as Ut,a as zt,o as Ft,b as Wt,c as Gt,t as jt}from"./p-DI3efDSV.js";import{LAYOUT_STATE_VERSION as It}from"./index.esm.js";import{g as Yt,b as Bt,i as Ht,f as Vt,r as Xt,a as Jt,w as qt,p as Kt,c as Qt,d as Zt,e as ti,s as ii,h as si}from"./p-DtP4jqG5.js";import{e as ei,r as ni}from"./p-ClruFZD_.js";const ri=class{constructor(i){t(this,i),a(this),this.errors=l(this),R(this,(t=>{this.stores||(this.stores=u(this.element));try{const i=t.replace(/\s/g,"");this.stores.assets.set(this.name,i)}catch(i){console.error("Error parsing asset",i,t),this.stores.assets.set(this.name,void 0)}}))}render(){return i(s,{key:"dfec9f90136278bddab194479301aa3fa5bc1e72"})}get element(){return e(this)}};ri.style=":host{display:none}";const oi=class{constructor(i){t(this,i),a(this),this.errors=l(this),this.componentStyle=O(this)}getFontStyles(){return this.componentStyle((t=>{var i,s,e,n;return{"--bn-font-family":(null===(i=t.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(s=t.global)||void 0===s?void 0:s.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(e=t.global)||void 0===e?void 0:e.fontColor)||"#000000","--bn-font-background":(null===(n=t.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}render(){return i(s,{key:"f43978af1c6658c6fa165093c3ada6b5f3b5986d",style:this.getFontStyles()},i("slot",{key:"b9c97432089676fc373b1d5ee59573ef5681a5c5"}))}get element(){return e(this)}};oi.style=':host{flex:1;min-height:0;position:relative;overflow:hidden;display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}';const hi=class{constructor(i){t(this,i),a(this),this.errors=l(this),this.componentStyle=O(this)}render(){return i(s,{key:"92bcbc010336d3a542c86e182831bbfddda2aa9b",style:this.prepareStyle()},i("slot",{key:"d836aa5443283df158dcb50345aee0df97f74a6e"}))}prepareStyle(){return{"font-family":this.componentStyle((t=>t.global.fontFamily)),"font-size":`${this.componentStyle((t=>t.global.fontSizePx))}px`,"--bn-font-family":this.componentStyle((t=>t.global.fontFamily))||"'Noto Sans', sans-serif","--bn-font-size":`${this.componentStyle((t=>t.global.fontSizePx))||13.3333}px`,"--bn-font-color":this.componentStyle((t=>t.global.fontColor))||"#000000","--bn-font-background":this.componentStyle((t=>t.global.fontBackgroundColor))||"#ffffff"}}get element(){return e(this)}};function ai(t){if("function"==typeof getComputedStyle){const i=parseFloat(getComputedStyle(t).fontSize);if(Number.isFinite(i)&&i>0)return i}return d.global.fontSizePx}function li(t,i){var s;return{version:It,tag:t.localName,id:zt(t),slot:null!==(s=t.getAttribute("slot"))&&void 0!==s?s:void 0,rect:Ut(t,i),em:{fontSizePx:ai(t),appliedScaleFactor:1},regions:[],metadata:{},diagnostics:Dt(t)}}hi.style=':host{display:flex;flex-direction:column;justify-content:space-between;flex:1;min-height:0;padding:0.25em;margin:0.5em;background-origin:content-box;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}:host(.border){box-sizing:border-box;-webkit-box-sizing:border-box;border:0.1em solid #ddd}div{color:var(--bn-font-color, black)}';const ci=/^Scenario([1-4])$/;function ui(t,i){var s;let e=t.parentElement;for(;e&&e!==i;){const t=ci.exec(null!==(s=e.id)&&void 0!==s?s:"");if(t)return`scenario${t[1]}`;e=e.parentElement}}function di(t){const i=Number(t.split("_")[0]);return Number.isFinite(i)?i:void 0}function fi(t,i){var s;return(null!==(s=t.getAttribute("class"))&&void 0!==s?s:"").split(/\s+/).includes(i)}function pi(t,i,s,e,n){var r,o;const h={regions:[],barCount:0},a=[];return Array.from(null!==(o=null===(r=t.shadowRoot)||void 0===r?void 0:r.querySelectorAll(i))&&void 0!==o?o:[]).forEach(((t,i)=>{var r,o,l,c;const u=null!==(r=s[i])&&void 0!==r?r:`segment${i}`,d=null===(o=t.shadowRoot)||void 0===o?void 0:o.querySelector("svg#drawCanvas");if(d&&(h.regions.push({id:`canvas:${u}`,rect:Ut(d,e)}),0===i&&(h.barCount=function(t){const i=t.querySelector('g[id="Scenario1"]');return i?Array.from(i.children).filter((t=>{var i;return/^\d+$/.test(null!==(i=t.id)&&void 0!==i?i:"")})).length:0}(d)),"full"===n&&a.push(...function(t,i,s){const e=[];return t.querySelectorAll('g[id$="_RECT"]').forEach(((n,r)=>{var o;const h={kind:"bar",id:n.id,segment:i,scenario:ui(n,t),index:null!==(o=di(n.id))&&void 0!==o?o:r,rect:Ut(n,s)};e.push(h)})),["DATA","SCENARIO"].forEach((n=>{t.querySelectorAll(`g[id$="_${n}_Label"]`).forEach(((t,r)=>{var o,h,a;if(fi(t,"hide"))return;const l=null!==(h=null===(o=t.textContent)||void 0===o?void 0:o.trim())&&void 0!==h?h:"";if(!l)return;const c={kind:"label",id:t.id,role:"DATA"===n?"data":"scenario",text:l,segment:i,index:null!==(a=di(t.id))&&void 0!==a?a:r,rect:Ut(t,s)};e.push(c)}))})),t.querySelectorAll('g[id="axis"] line').forEach((t=>{var n;const r=(null!==(n=t.getAttribute("class"))&&void 0!==n?n:"").split(/\s+/).find((t=>t.startsWith("axis-"))),o=Ut(t,s),h={kind:"axis",style:null==r?void 0:r.slice(5),orientation:o.context.width>=o.context.height?"horizontal":"vertical",segment:i,rect:o};e.push(h)})),t.querySelectorAll('g[id="AxisAndDateLables"] text, g[id="AxisAndDateLabelsLine"] text').forEach((n=>{var r,o;if(fi(n,"hide")||function(t,i){var s;let e=t.parentElement;for(;e&&e!==i;){if((null!==(s=e.id)&&void 0!==s?s:"").endsWith("_Label"))return!0;e=e.parentElement}return!1}(n,t))return;const h=null!==(o=null===(r=n.textContent)||void 0===r?void 0:r.trim())&&void 0!==o?o:"";if(!h)return;const a={kind:"label",role:fi(n,"categories")?"title":"category",text:h,segment:i,rect:Ut(n,s)};e.push(a)})),e}(d,u,e))),"full"===n){const i=null===(l=t.shadowRoot)||void 0===l?void 0:l.querySelector(".footer"),s=null===(c=null==i?void 0:i.textContent)||void 0===c?void 0:c.trim();s&&a.push({kind:"label",role:"footer",text:s,segment:u,rect:Ut(i,e)})}})),"full"===n&&(h.elements=a),h}function vi(t,i,s,e,n,r){var o,h,a,l;const c={version:It,tag:t.localName,id:zt(t),slot:null!==(o=t.getAttribute("slot"))&&void 0!==o?o:void 0,rect:Ut(t,n),em:e,regions:[],metadata:{title:s},diagnostics:Dt(t)},u=null===(l=null===(a=null===(h=t.shadowRoot)||void 0===h?void 0:h.querySelector(i))||void 0===a?void 0:a.shadowRoot)||void 0===l?void 0:l.querySelector("svg#drawCanvas");return u&&(c.regions.push({id:"canvas",rect:Ut(u,n)}),c.metadata.pointCount=u.querySelectorAll("circle, ellipse").length,"full"===r&&(c.elements=function(t,i){const s=[];return t.querySelectorAll("circle, ellipse").forEach(((t,e)=>{const n={kind:"point",index:e,rect:Ut(t,i)};s.push(n)})),t.querySelectorAll("text").forEach((t=>{var e,n;const r=null!==(n=null===(e=t.textContent)||void 0===e?void 0:e.trim())&&void 0!==n?n:"";if(!r)return;const o={kind:"label",role:"data",text:r,rect:Ut(t,i)};s.push(o)})),s}(u,n))),c}function gi(t,i,s){var e,n,r,o,h;const a="WARN_overflow",l=Yt(t),c=parseFloat(null!==(h=null===(o=null===(r=null===(n=null===(e=t.shadowRoot)||void 0===e?void 0:e.querySelector(i))||void 0===n?void 0:n.shadowRoot)||void 0===r?void 0:r.querySelector("svg#drawCanvas"))||void 0===o?void 0:o.getAttribute("height"))&&void 0!==h?h:""),u=Math.max(Number.isNaN(c)?0:Math.floor(c),t.scrollHeight||0),d=t.scrollWidth||0,f=[];l.width>0&&d>l.width+1&&f.push(`width (${Math.round(d)}px > ${Math.round(l.width)}px)`);const p=Bt(t,u);p>1&&f.push(`height (${Math.round(u)}px > ${Math.round(u-p)}px)`),0!==f.length?s.addOrReplace({id:a,type:"warning",message:`Chart exceeds available ${f.join(" and ")} and will be cut off. Check the scale and aspect values or enlarge the container.`}):s.remove(a)}function mi(t,i,s=80){let e=null,n=!1,r=-1,o=-1;const h=function(t){var i;const s=t.parentElement;return(null===(i=null==s?void 0:s.assignedSlot)||void 0===i?void 0:i.parentElement)?s.assignedSlot.parentElement:s}(t);if(!h)return{disconnect(){}};const a=new ResizeObserver((t=>{var a;if(n)return;let l,c;const u=t[0];if(null===(a=null==u?void 0:u.contentBoxSize)||void 0===a?void 0:a.length){const t=u.contentBoxSize[0];l=t.inlineSize,c=t.blockSize}else l=h.clientWidth,c=h.clientHeight;Math.abs(l-r)<=2&&Math.abs(c-o)<=2||(r=l,o=c,null!=e&&clearTimeout(e),e=setTimeout((()=>{n||i()}),s))}));return a.observe(h),{disconnect(){n=!0,null!=e&&clearTimeout(e),a.disconnect()}}}const bi=t=>{let i,s,r,o,h=null;const a=()=>{const t=s.ruleSets.state;o=k([t._system||{},t._default||{},t[r]||{}])},l=()=>{const i=e(t),s=i.getAttribute("ruleset");if(h&&(h.disconnect(),h=null),s&&Ht(s)){const e=Vt(i,s);if(r=Xt(e,"ruleset"),e.length>0){h=new MutationObserver((()=>{r=Xt(e,"ruleset"),a(),n(t)}));for(const t of e)h.observe(t,{attributes:!0,attributeFilter:["ruleset"]})}}else r=s},d=new MutationObserver((i=>{i.forEach((i=>{"ruleset"===i.attributeName&&(l(),a(),n(t))}))})),p=t.connectedCallback;t.connectedCallback=()=>{const h=e(t);s=u(h),o=s.ruleSets.state._system,d.observe(h,{attributes:!0,attributeFilter:["ruleset"]}),l(),a(),i=s.ruleSets.on("set",(i=>{i!==r&&"_default"!==i||(l(),a(),n(e(t)))})),c(p,t)};const v=t.disconnectedCallback;return t.disconnectedCallback=()=>{d.disconnect(),h&&(h.disconnect(),h=null),c(i),f(e(t)),c(v,t)},()=>o},yi=t=>{let i,s;const r=()=>{"function"==typeof t.validateUnitScaling&&t.validateUnitScaling(t.unitScaling),"function"==typeof t.validatePercentageScaling&&t.validatePercentageScaling(t.percentageScaling),"function"==typeof t.validateSizeScaling&&t.validateSizeScaling()},o=t.connectedCallback;t.connectedCallback=()=>{const h=e(t);s=u(h),(()=>{const i=s.scalingGroups.state;for(const s of Object.keys(i))void 0!==i[s]?t.pixelPerUnitGroupMap.set(s,i[s]):t.pixelPerUnitGroupMap.delete(s)})(),r(),i=s.scalingGroups.on("set",((i,s)=>{void 0!==s?t.pixelPerUnitGroupMap.set(i,s):t.pixelPerUnitGroupMap.delete(i),r(),n(e(t))})),c(o,t)};const h=t.disconnectedCallback;t.disconnectedCallback=()=>{c(i),f(e(t)),c(h,t)}};function wi(t,i){var s;const e=null!==(s=null==t?void 0:t.trim())&&void 0!==s?s:"";if(""===e||"null"===e)return{data:null,parseError:!1};if(e.startsWith("{")||e.startsWith("["))try{const t=JSON.parse(e);return"object"!=typeof t||null===t||Array.isArray(t)?{data:null,parseError:!0}:{data:t,parseError:!1}}catch(t){return{data:null,parseError:!0}}return null!==i?{data:{[i]:e},parseError:!1}:{data:null,parseError:!0}}function xi(t,i){return Object.keys(t).filter((t=>!i.includes(t)))}function Si(t,i,s){if(E.isExisting(t[i]))return E.isString(t[i])?t[i]:void s.push(i)}function $i(t,i,s){if(E.isExisting(t[i]))return E.isNumber(t[i])?t[i]:void s.push(i)}const Mi=["measure","label","unit","min","max","refLine","highlight"];function _i(t){const i=[],s=Si(t,"measure",i);if(void 0===s||""===s.trim())return i.push("measure"),{config:null,unknownKeys:xi(t,Mi),invalidFields:i};const e={measure:s.trim()};return e.label=Si(t,"label",i),e.unit=Si(t,"unit",i),e.min=$i(t,"min",i),e.max=$i(t,"max",i),e.refLine=$i(t,"refLine",i),e.highlight=function(t,i){if(!E.isExisting(t.highlight))return;if(!E.isObject(t.highlight)||Array.isArray(t.highlight))return void i.push("highlight");const s=t.highlight,e={},n=$i(s,"from",i),r=$i(s,"to",i);return void 0!==n&&(e.from=n),void 0!==r&&(e.to=r),e}(t,i),{config:e,unknownKeys:xi(t,Mi),invalidFields:i}}const Ri=["measure","label","unit","group"];function Oi(t){const i=[],s=Si(t,"measure",i);if(void 0===s||""===s.trim())return i.push("measure"),{config:null,unknownKeys:xi(t,Ri),invalidFields:i};const e={measure:s.trim()};return e.label=Si(t,"label",i),e.unit=Si(t,"unit",i),e.group=Si(t,"group",i),{config:e,unknownKeys:xi(t,Ri),invalidFields:i}}const ki=["measure"];function Ei(t){const i=[],s=Si(t,"measure",i);return void 0===s||""===s.trim()?(i.push("measure"),{config:null,unknownKeys:xi(t,ki),invalidFields:i}):{config:{measure:s.trim()},unknownKeys:xi(t,ki),invalidFields:i}}const Li=["values","label","unit","highlight"];function Ti(t){const i=[];let s=null;if("auto"===t.values?s="auto":E.isArray(t.values)&&t.values.every((t=>E.isNumber(t)))?s=t.values:i.push("values"),null===s)return{config:null,unknownKeys:xi(t,Li),invalidFields:i};const e={values:s};if(e.label=Si(t,"label",i),e.unit=Si(t,"unit",i),E.isExisting(t.highlight))if(E.isObject(t.highlight)&&!Array.isArray(t.highlight)){const s=$i(t.highlight,"from",i);void 0!==s&&(e.highlight={from:s})}else i.push("highlight");return{config:e,unknownKeys:xi(t,Li),invalidFields:i}}const Ai=["points","values","max"];function Ci(t,i){const s=[],e={points:i.points,values:i.values,max:i.max};return E.isExisting(t.points)&&("auto"===t.points||"none"===t.points||"all"===t.points||E.isArray(t.points)&&t.points.every((t=>E.isString(t)))?e.points=t.points:s.push("points")),E.isExisting(t.values)&&(E.isBoolean(t.values)?e.values=t.values:s.push("values")),E.isExisting(t.max)&&(E.isNumber(t.max)&&t.max>0?e.max=Math.floor(t.max):s.push("max")),{config:e,unknownKeys:xi(t,Ai),invalidFields:s}}const Pi=["level","columns"];function Ni(t){const i=[],s=E.isString(t.level)?t.level.toLowerCase():null;if("rowgroup"!==s&&"category"!==s)return i.push("level"),{config:null,unknownKeys:xi(t,Pi),invalidFields:i};const e={level:s};return E.isExisting(t.columns)&&(E.isNumber(t.columns)&&t.columns>=1?e.columns=Math.floor(t.columns):i.push("columns")),{config:e,unknownKeys:xi(t,Pi),invalidFields:i}}const Di=["show","position"];function Ui(t){const i=[],s={show:!0,position:"right"};return E.isExisting(t.show)&&(E.isBoolean(t.show)?s.show=t.show:i.push("show")),E.isExisting(t.position)&&("right"===t.position||"bottom"===t.position?s.position=t.position:i.push("position")),{config:s,unknownKeys:xi(t,Di),invalidFields:i}}function zi(t,i){var s,e;const n=Array.from(null!==(e=null===(s=t.shadowRoot)||void 0===s?void 0:s.querySelectorAll(i))&&void 0!==e?e:[]);n.length>0&&n.every((t=>t.classList.contains("no-data")))?t.classList.add("no-data"):t.classList.remove("no-data")}const Fi={rowGroup:0,category:1,subCategory:2},Wi=["ac","pp","fc","pl"],Gi=class{validateFilter(t){const i="ERR_filter";p(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateX(t){this.validateMeasureSpec("x",t,!0,(t=>_i(t)))}validateY(t){this.validateMeasureSpec("y",t,!0,(t=>_i(t)))}validateSize(t){this.validateMeasureSpec("size",t,!0,(t=>Oi(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>Ei(t)))}validateCompareWith(t){const i="ERR_compareWith";L(t)||Wi.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`compare-with: invalid value '${t}' - expected ${Wi.join("/")}; ignored.`})}validateLevel(t){const i="ERR_level",s=["auto","category","subcategory"];L(t)||s.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`level: invalid value '${t}' - expected ${s.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const i="ERR_seriesLevel",s=["auto","rowgroup","category","none"];L(t)||s.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`series-level: invalid value '${t}' - expected ${s.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>Ni(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>Ci(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>Ui(t)))}validateAspect(t){const i="ERR_aspect";L(t)||null!==this.parseAspect(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const i="ERR_limit";T(t)&&Number(t)>=0?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const i="ERR_scale";if(L(t))return void this.errors.remove(i);const{mode:s,factor:e}=Kt(t);"factor"===s&&(void 0===e||e<=0)?this.errors.addOrReplace({id:i,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(i)}constructor(i){t(this,i),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.pixelPerUnitGroupMap=new Map,this.chartTitle="",this.filter="",this.share="",this.compareWith="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,i)=>this.t(t,i),A(this),a(this),Jt(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.errors=l(this),yi(this),this.componentStyle=O(this),this.ruleSetConfig=bi(this),this.t=qt(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateSize(this.size),this.validateShare(this.share),this.validateCompareWith(this.compareWith),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){zi(this.element,"ibcs-chart-bubble");const{mode:t}=Kt(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const i=this.element,{width:s}=Yt(i);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const e=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),n=i.scrollWidth,o=this.appliedScaleFactor;if(!Number.isFinite(n)||n<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const h=Math.max(.3,o*(s-1)/n);Math.abs(h-o)<.01||(i.style.setProperty("--bn-font-size",e*h+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${h.toFixed(3)}`}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,r((()=>{this.appliedScaleFactor=h}))),this.checkOverflow()}checkOverflow(){gi(this.element,"ibcs-chart-bubble",this.errors)}componentDidLoad(){this.layoutObserver=mi(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=Yt(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,n(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=Yt(this.element);this._lastObservedWidth=t,n(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"all",values:!0,max:12}}setBlockingError(t,i){null===i?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:i}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const i=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===i||this.pixelPerUnitGroupMap.has(i)?null:this.t(".bubble-scale-group-unknown",{group:i}))}validateMeasureSpec(t,i,s,e){var n;const r=`ERR_xy_json_${t}`,o=`ERR_xy_measure_${t}`,h=`WARN_xy_fields_${t}`,{data:a,parseError:l}=wi(i,"measure");if(l)return this.setBlockingError(r,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(o,null),void this.errors.remove(h);if(this.setBlockingError(r,null),null===a)return this.setBlockingError(o,s?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(h);const c=null!==(n=a.measure)&&void 0!==n?n:"";C(c)?this.setBlockingError(o,null):this.setBlockingError(o,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(h,t,e(a))}validateObjectSpec(t,i,s){const e=`ERR_xy_json_${t}`,n=`WARN_xy_fields_${t}`,{data:r,parseError:o}=wi(i,null);if(o)return this.setBlockingError(e,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(n);this.setBlockingError(e,null),null!==r?this.reportSpecIssues(n,t,s(r)):this.errors.remove(n)}reportSpecIssues(t,i,s){const e=[];null!==s&&s.invalidFields.length>0&&e.push(`invalid: ${s.invalidFields.join(", ")}`),null!==s&&s.unknownKeys.length>0&&e.push(`unknown: ${s.unknownKeys.join(", ")}`),e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${i}: ignored sub-fields (${e.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,i){const{data:s,parseError:e}=wi(i,"measure");if(e||null===s)return null;const{config:n}=_i(s);return null!==n&&C(n.measure)?(void 0!==n.min&&void 0!==n.max&&n.min>=n.max?(this.errors.addOrReplace({id:`WARN_xy_domain_${t}`,type:"warning",message:`${t}: min must be smaller than max; the override is ignored.`}),n.min=void 0,n.max=void 0):this.errors.remove(`WARN_xy_domain_${t}`),n):null}prepareSize(){const{data:t,parseError:i}=wi(this.size,"measure");if(i||null===t)return null;const{config:s}=Oi(t);return null!==s&&C(s.measure)?s:null}prepareShare(){const{data:t,parseError:i}=wi(this.share,"measure");if(i||null===t)return null;const{config:s}=Ei(t);return null!==s&&C(s.measure)?s:null}prepareCompareFamily(){var t;const i=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return Wi.includes(i)?i:null}prepareLabels(){const t=this.labelDefaults(),{data:i,parseError:s}=wi(this.labels,null);return s||null===i?{points:t.points,values:t.values,max:t.max}:Ci(i,t).config}prepareLegend(){const{data:t,parseError:i}=wi(this.legend,null);return i||null===t?{show:!0,position:"right"}:Ui(t).config}prepareFacet(){const{data:t,parseError:i}=wi(this.facet,null);return i||null===t?null:Ni(t).config}preparePointLevel(){var t,i;const s=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===s)return"category";if("subcategory"===s)return"subCategory";const e=null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel;return"rowGroup"===e||"category"===e||"subCategory"===e?e:"category"}prepareSeriesLevel(t){var i;const s=null===(i=this.seriesLevel)||void 0===i?void 0:i.trim().toLowerCase();return"none"===s?null:"rowgroup"===s?"rowGroup":"category"===s||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,i){const s=new Set;let e=!1;for(const i of t){if(void 0===i)continue;const t=P(i);null!==t&&("scenario"===t.kind?s.add(N(t.slot)):e=!0)}this.setBlockingError("ERR_xy_family",s.size>1?this.t(".xy-family-mixed",{families:[...s].join(", ")}):null);const n=this.prepareCompareFamily();this.setBlockingError("ERR_xy_compare_variance",null!==n&&e?this.t(".xy-compare-variance"):null),this.setBlockingError("ERR_xy_compare_family",null!==n&&1===s.size&&s.has(n)?`compare-with: '${n}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),o=this.prepareSeriesLevel(r),h=null!==i?"rowgroup"===i.level?"rowGroup":"category":null;let a=null;if(null!==o&&Fi[o]>=Fi[r]&&(a=`series '${o}' vs point '${r}'`),null!==h){const t=null!=o?o:r;Fi[h]>=Fi[t]&&(a=`facet '${h}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==a?this.t(".xy-level-order",{detail:a}):null)}parseAspect(t){const i=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===i)return null;const s=Number(i[1]),e=Number(i[2]);return s<=0||e<=0?null:s/e}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}prepareSizeAreaPerUnit(){var t;const i=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===i||!this.pixelPerUnitGroupMap.has(i))return 0;const s=this.pixelPerUnitGroupMap.get(i);if(!(s>0))return 0;const e=this.getEffectiveFontPx();return e*e/s}i18nLocalKeys(){return["no-data","axis.in","legend.title","legend.size","legend.compare"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),i=new Map(v.map((t=>[t,this.t("global.".concat(t))])));return new Map([...i.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const s=i.global.fontSizePx*t;return{scaleFactors:i["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${s}px ${i.global.fontFamily}`,size:s,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-bubble"].axisStyles,seriesColors:i["bn-chart-bubble"].seriesColors,padding:i["bn-chart-bubble"].padding}}))}async getLayoutState(t){var i;const s=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",e=Ft(this.element),n=this.getEffectiveScaleFactor(),r=Number.isFinite(n)&&n>0?n:1,o=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*r;return vi(this.element,"ibcs-chart-bubble",this.chartTitle||void 0,{fontSizePx:o,appliedScaleFactor:r},e,s)}getEffectiveScaleFactor(){const{mode:t,factor:i}=Kt(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){const t=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}));return t*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var s,e,n,r;const o=(null===(s=i.global)||void 0===s?void 0:s.fontSizePx)||13.3333;return{"--bn-font-family":(null===(e=i.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":o*t+"px","--bn-font-color":(null===(n=i.global)||void 0===n?void 0:n.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const i of["ac","pp","fc","pl"])for(const s of[1,2,3,4])t[`${i}${s}`]={type:"number",isOptional:!0,description:""};const i={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[s,e]of Object.entries(i)){if(null===e)continue;const i=P(e.measure);null!==i&&("scenario"===i.kind?t[i.slot].description=`${s}: ${void 0!==e.label?e.label:e.measure}`:(t[i.measure.base].description=`${s}: ${e.measure} (base)`,t[i.measure.delta].description=`${s}: ${e.measure} (delta)`))}const s=this.prepareCompareFamily();if(null!==s)for(const[e,n]of Object.entries(i)){if(null===n||"share"===e)continue;const i=P(n.measure);if(null!==i&&"scenario"===i.kind){const n=s+i.slot.replace(/^[a-z]+/,"");""===t[n].description&&(t[n].description=`${e}: compareWith`)}}return{IBubbleChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareAxis("x",this.x),s=this.prepareAxis("y",this.y),e=this.prepareSize(),n=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==s?void 0:s.measure,null==e?void 0:e.measure,null==n?void 0:n.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===s||null===e)return null;const o=this.preparePointLevel(),h=this.prepareI18n(),a=this.prepareStyle(),l=Yt(this.element).width;return i("ibcs-chart-bubble",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:s,size:e,share:n,compareFamily:this.prepareCompareFamily(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:r,pointLevel:o,seriesLevel:this.prepareSeriesLevel(o),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,sizeAreaPerUnit:this.prepareSizeAreaPerUnit(),styles:a,i18n:h,containerWidth:l,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return i(s,{key:"0bfa49a51e13bdc7a52a57539f3c9228bed2dfd1",style:this.getFontStyles()},i("div",{key:"12c6edc017728be62060ae4f9196e26e73c07e25",class:"container"},this.chartTemplate()))}get element(){return e(this)}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}};Gi.style=':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}';const ji=["measure","label","unit"];function Ii(t){const i=[],s=Xi(t,"measure",i);if(void 0===s||""===s.trim())return i.push("measure"),{config:null,unknownKeys:Vi(t,ji),invalidFields:i};const e={measure:s.trim()};return e.label=Xi(t,"label",i),e.unit=Xi(t,"unit",i),{config:e,unknownKeys:Vi(t,ji),invalidFields:i}}const Yi=["show","decimals"];function Bi(t,i){const s=[],e={show:i.show,decimals:i.decimals};return E.isExisting(t.show)&&("auto"===t.show||"none"===t.show?e.show=t.show:s.push("show")),E.isExisting(t.decimals)&&(E.isNumber(t.decimals)&&t.decimals>=0&&t.decimals<=4?e.decimals=Math.floor(t.decimals):s.push("decimals")),{config:e,unknownKeys:Vi(t,Yi),invalidFields:s}}function Hi(t){var i;const s=null!==(i=null==t?void 0:t.trim())&&void 0!==i?i:"";if(""===s||"null"===s)return{ranges:[],parseError:!1,issues:[]};let e;try{e=JSON.parse(s)}catch(t){return{ranges:[],parseError:!0,issues:[]}}if(!Array.isArray(e)||0===e.length)return{ranges:[],parseError:!0,issues:[]};if(!e.every((t=>E.isNumber(t)&&isFinite(t)&&t>0)))return{ranges:[],parseError:!0,issues:[]};const n=[];let r=e;const o=[...r].sort(((t,i)=>t-i));return o.some(((t,i)=>t!==r[i]))&&n.push("not ascending, sorted"),r=o,r.length>2&&(n.push(`${r.length} entries, first 2 kept`),r=r.slice(0,2)),{ranges:r,parseError:!1,issues:n}}function Vi(t,i){return Object.keys(t).filter((t=>!i.includes(t)))}function Xi(t,i,s){if(E.isExisting(t[i]))return E.isString(t[i])?t[i]:void s.push(i)}const Ji=["pl1","pp1","fc1"],qi=class{validateFilter(t){const i="ERR_filter";p(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateActual(t){this.validateMeasureSpec("actual",t)}validateTarget(t){this.validateMeasureSpec("target",t)}validateRanges(t){const i="ERR_bullet_json_ranges",s="WARN_bullet_ranges",e=Hi(t);if(e.parseError)return this.setBlockingError(i,this.t(".bullet-prop-json",{prop:"ranges"})),void this.errors.remove(s);this.setBlockingError(i,null),e.issues.length>0?this.errors.addOrReplace({id:s,type:"warning",message:this.t(".bullet-ranges-invalid",{detail:e.issues.join("; ")})}):this.errors.remove(s)}validateNormalize(t){this.validateEnum("normalize","ERR_normalize",t,["target","none"],"target")}validateVariances(t){this.validateEnum("variances","ERR_variances",t,["auto","none"],"auto")}validateLevel(t){this.validateEnum("level","ERR_level",t,["auto","rowgroup","category","subcategory"],"auto")}validateOrder(t){const i="ERR_order",s=D(t).filter((t=>""!==t));0===s.length?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`order: invalid value(s) '${s.join(", ")}'; using the dataset order.`})}validateOrderDirection(t){const i="ERR_orderDirection";L(t)||U(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`order-direction: invalid value '${t}' - expected asc/desc; using asc.`})}validateLimit(t){const i="ERR_limit";T(t)&&Number(t)>=0?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateLabels(t){const i="ERR_bullet_json_labels",s="WARN_bullet_fields_labels",{data:e,parseError:n}=wi(t,null);if(n)return this.setBlockingError(i,this.t(".bullet-prop-json",{prop:"labels"})),void this.errors.remove(s);this.setBlockingError(i,null),null!==e?this.reportSpecIssues(s,"labels",Bi(e,this.labelDefaults())):this.errors.remove(s)}validateScale(t){const i="ERR_scale";if(L(t))return void this.errors.remove(i);const{mode:s,factor:e}=Kt(t);"factor"===s&&(void 0===e||e<=0)?this.errors.addOrReplace({id:i,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(i)}constructor(i){t(this,i),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.actual="",this.target="",this.ranges="",this.normalize="target",this.variances="auto",this.level="auto",this.order="",this.orderDirection="",this.limit=0,this.labels="",this._autoScaleGuard=!1,this._lastScaledParentHeight=0,this.translateForInner=(t,i)=>this.t(t,i),A(this),a(this),Jt(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.errors=l(this),this.componentStyle=O(this),this.ruleSetConfig=bi(this),this.t=qt(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateActual(this.actual),this.validateTarget(this.target),this.validateRanges(this.ranges),this.validateNormalize(this.normalize),this.validateVariances(this.variances),this.validateLevel(this.level),this.validateOrder(this.order),this.validateOrderDirection(this.orderDirection),this.validateLimit(this.limit),this.validateLabels(this.labels),this.validateScale(this.scale)}componentDidRender(){zi(this.element,"ibcs-chart-bullet");const{mode:t}=Kt(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const i=this.element,{height:s}=Yt(i);if(s<=0)return;this._lastScaledParentHeight=s;const e=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),n=i.scrollHeight,o=this.appliedScaleFactor;if(n<=s+1)return void this.errors.remove("AUTO_scale");const h=Math.max(.3,o*(s-1)/n);Math.abs(h-o)<.01||(i.style.setProperty("--bn-font-size",e*h+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${h.toFixed(3)}`}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,r((()=>{this.appliedScaleFactor=h})))}componentDidLoad(){this.layoutObserver=mi(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=Yt(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,n(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=Yt(this.element);this._lastScaledParentHeight=t,n(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{show:"auto",decimals:1}}setBlockingError(t,i){null===i?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:i}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateMeasureSpec(t,i){var s;const e=`ERR_bullet_json_${t}`,n=`ERR_bullet_measure_${t}`,r=`WARN_bullet_fields_${t}`,{data:o,parseError:h}=wi(i,"measure");if(h)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(r);if(this.setBlockingError(e,null),null===o)return this.setBlockingError(n,null),void this.errors.remove(r);const a=(null!==(s=o.measure)&&void 0!==s?s:"").trim(),l=P(a);"auto"===a.toLowerCase()||null!==l&&"scenario"===l.kind?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".bullet-measure-invalid",{prop:t,measure:a})),this.reportSpecIssues(r,t,Ii(o))}validateEnum(t,i,s,e,n){L(s)||e.includes(s.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`${t}: invalid value '${s}' - expected ${e.join("/")}; using '${n}'.`})}reportSpecIssues(t,i,s){const e=[];null!==s&&s.invalidFields.length>0&&e.push(`invalid: ${s.invalidFields.join(", ")}`),null!==s&&s.unknownKeys.length>0&&e.push(`unknown: ${s.unknownKeys.join(", ")}`),e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${i}: ignored sub-fields (${e.join("; ")}).`}):this.errors.remove(t)}prepareActual(){var t,i,s,e,n;const{data:r,parseError:o}=wi(this.actual,"measure");if(o)return null;const h=null!==r?Ii(r).config:null;if(null===h||"auto"===h.measure.toLowerCase()){const n=null!==h,r=null!==(i=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==i?i:[],o=null!==(e=r.includes("ac1")?"ac1":null!==(s=r.find((t=>t.startsWith("ac"))))&&void 0!==s?s:r[0])&&void 0!==e?e:"ac1";return n||null===this.datasetMeta?this.errors.remove("AUTO_actual"):this.errors.addOrReplace({id:"AUTO_actual",type:"warning",message:`actual: not set, auto-detected: ${o}`}),null===h?{measure:o}:Object.assign(Object.assign({},h),{measure:o})}return this.errors.remove("AUTO_actual"),"scenario"===(null===(n=P(h.measure))||void 0===n?void 0:n.kind)?h:null}prepareTarget(){var t,i,s;const{data:e,parseError:n}=wi(this.target,"measure");if(n)return null;const r=null!==e?Ii(e).config:null;if(null===r||"auto"===r.measure.toLowerCase()){const s=null!==r,e=null!==(i=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==i?i:[],n=Ji.find((t=>e.includes(t)));return void 0===n?(this.errors.remove("AUTO_target"),null!==this.datasetMeta?this.errors.addOrReplace({id:"WARN_bullet_target_unavailable",type:"warning",message:this.t(".bullet-target-none")}):this.errors.remove("WARN_bullet_target_unavailable"),null):(this.errors.remove("WARN_bullet_target_unavailable"),s||null===this.datasetMeta?this.errors.remove("AUTO_target"):this.errors.addOrReplace({id:"AUTO_target",type:"warning",message:`target: not set, auto-detected: ${n}`}),null===r?{measure:n}:Object.assign(Object.assign({},r),{measure:n}))}return this.errors.remove("AUTO_target"),this.errors.remove("WARN_bullet_target_unavailable"),"scenario"===(null===(s=P(r.measure))||void 0===s?void 0:s.kind)?r:null}prepareNormalize(){var t;return"none"===(null===(t=this.normalize)||void 0===t?void 0:t.trim().toLowerCase())?"none":"target"}prepareShowVariances(){var t;return"none"!==(null===(t=this.variances)||void 0===t?void 0:t.trim().toLowerCase())}prepareLevel(){var t,i;const s=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("rowgroup"===s)return z.ROWGROUP;if("category"===s)return z.CATEGORY;if("subcategory"===s)return z.SUBCATEGORY;const e=null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel;if(void 0!==e&&""!==e){const t=z[e.toUpperCase()];if(void 0!==t)return t}return z.CATEGORY}prepareOrder(){var t,i,s,e;const n="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let r;L(this.order)||n?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedOrder)?(n?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:`order: not set, auto-detected: ${this.datasetMeta.suggestedOrder}`}),r=this.datasetMeta.suggestedOrder):(this.errors.remove("AUTO_order"),r=""):(this.errors.remove("AUTO_order"),r=this.order);const o=null!==(e=F[null===(s=this.orderDirection)||void 0===s?void 0:s.toUpperCase()])&&void 0!==e?e:F.ASC;if(L(r))return new W([G.CATEGORYINDEX],o);const h=r.split(",").map((t=>G[t.trim().toUpperCase()])).filter((t=>void 0!==t));return new W(h.length>0?h:[G.CATEGORYINDEX],o)}prepareLabels(){const t=this.labelDefaults(),{data:i,parseError:s}=wi(this.labels,null);return s||null===i?{show:t.show,decimals:t.decimals}:Bi(i,t).config}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","target","axis.in"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),i=new Map(v.map((t=>[t,this.t("global.".concat(t))])));return new Map([...i.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const s=i.global.fontSizePx*t;return{scaleFactors:i["bn-chart-bullet"].scaleFactors,fontStyles:{font:`${s}px ${i.global.fontFamily}`,size:s,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-bullet"].axisStyles,barStyles:i["bn-chart-bullet"].barStyles,varianceStyles:i["bn-chart-bullet"].varianceStyles,rangeColors:i["bn-chart-bullet"].rangeColors,padding:i["bn-chart-bullet"].padding}}))}async getLayoutState(t){var i;const s=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",e=Ft(this.element),n=this.getEffectiveScaleFactor(),r=Number.isFinite(n)&&n>0?n:1,o=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*r;return vi(this.element,"ibcs-chart-bullet",this.chartTitle||void 0,{fontSizePx:o,appliedScaleFactor:r},e,s)}getEffectiveScaleFactor(){const{mode:t,factor:i}=Kt(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var s,e,n,r;const o=(null===(s=i.global)||void 0===s?void 0:s.fontSizePx)||13.3333;return{"--bn-font-family":(null===(e=i.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":o*t+"px","--bn-font-color":(null===(n=i.global)||void 0===n?void 0:n.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const i of["ac","pp","fc","pl"])for(const s of[1,2,3,4])t[`${i}${s}`]={type:"number",isOptional:!0,description:""};const i={actual:this.prepareActual(),target:this.prepareTarget()};for(const[s,e]of Object.entries(i))null!==e&&void 0!==t[e.measure]&&(t[e.measure].description=`${s}: ${void 0!==e.label?e.label:e.measure}`);return{IBulletChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareActual(),s=this.prepareTarget(),e=Hi(this.ranges).ranges,n=this.prepareNormalize();return this.setBlockingError("ERR_bullet_measure_same",null!==t&&null!==s&&t.measure===s.measure?this.t(".bullet-measure-same",{measure:t.measure}):null),e.length>0&&"target"===n?this.errors.addOrReplace({id:"WARN_bullet_ranges_ignored",type:"warning",message:this.t(".bullet-ranges-ignored")}):this.errors.remove("WARN_bullet_ranges_ignored"),this.hasBlockingErrors()||null===t?null:i("ibcs-chart-bullet",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,actual:t,target:s,ranges:e,normalize:n,showVariances:this.prepareShowVariances(),level:this.prepareLevel(),order:this.prepareOrder(),limit:this.prepareLimit(),labels:this.prepareLabels(),filter:this.filter,styles:this.prepareStyle(),i18n:this.prepareI18n(),containerWidth:Yt(this.element).width,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return i(s,{key:"895f33380b663aff0f9aa116add2d485e02588e6",style:this.getFontStyles()},i("div",{key:"58425ce02fa1cf074333464dfe17e702fd41acb0",class:"container"},this.chartTemplate()))}get element(){return e(this)}static get watchers(){return{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalize:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}}};qi.style=':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}';const Ki={rowGroup:0,category:1,subCategory:2},Qi=class{validateFilter(t){const i="ERR_filter";p(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateX(t){this.validateAxisSpec("x",t)}validateY(t){this.validateAxisSpec("y",t)}validateIso(t){this.validateObjectSpec("iso",t,null,(t=>Ti(t)))}validateLevel(t){const i="ERR_level",s=["auto","category","subcategory"];L(t)||s.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`level: invalid value '${t}' - expected ${s.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const i="ERR_seriesLevel",s=["auto","rowgroup","category","none"];L(t)||s.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`series-level: invalid value '${t}' - expected ${s.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,null,(t=>Ni(t)))}validateLabels(t){this.validateObjectSpec("labels",t,null,(t=>Ci(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,null,(t=>Ui(t)))}validateAspect(t){const i="ERR_aspect";L(t)||null!==this.parseAspect(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const i="ERR_limit";T(t)&&Number(t)>=0?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const i="ERR_scale";if(L(t))return void this.errors.remove(i);const{mode:s,factor:e}=Kt(t);"factor"===s&&(void 0===e||e<=0)?this.errors.addOrReplace({id:i,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(i)}constructor(i){t(this,i),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.iso="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,i)=>this.t(t,i),A(this),a(this),Jt(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.errors=l(this),this.componentStyle=O(this),this.ruleSetConfig=bi(this),this.t=qt(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateIso(this.iso),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){zi(this.element,"ibcs-chart-scatter");const{mode:t}=Kt(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const i=this.element,{width:s}=Yt(i);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const e=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),n=i.scrollWidth,o=this.appliedScaleFactor;if(!Number.isFinite(n)||n<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const h=Math.max(.3,o*(s-1)/n);Math.abs(h-o)<.01||(i.style.setProperty("--bn-font-size",e*h+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${h.toFixed(3)}`}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,r((()=>{this.appliedScaleFactor=h}))),this.checkOverflow()}checkOverflow(){gi(this.element,"ibcs-chart-scatter",this.errors)}componentDidLoad(){this.layoutObserver=mi(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=Yt(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,n(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=Yt(this.element);this._lastObservedWidth=t,n(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"auto",values:!1,max:12}}setBlockingError(t,i){null===i?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:i}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateAxisSpec(t,i){var s;const e=`ERR_xy_json_${t}`,n=`ERR_xy_measure_${t}`,r=`WARN_xy_fields_${t}`,o="x"===t||"y"===t||"size"===t,{data:h,parseError:a}=wi(i,"measure");if(a)return this.setBlockingError(e,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(r);if(this.setBlockingError(e,null),null===h)return this.setBlockingError(n,o?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(r);const l="share"===t?null:_i(h),c=null!==(s=h.measure)&&void 0!==s?s:"";C(c)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(r,t,l)}validateObjectSpec(t,i,s,e){const n=`ERR_xy_json_${t}`,r=`WARN_xy_fields_${t}`,{data:o,parseError:h}=wi(i,s);if(h)return this.setBlockingError(n,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(r);this.setBlockingError(n,null),null!==o?this.reportSpecIssues(r,t,e(o)):this.errors.remove(r)}reportSpecIssues(t,i,s){const e=[];null!==s&&s.invalidFields.length>0&&e.push(`invalid: ${s.invalidFields.join(", ")}`),null!==s&&s.unknownKeys.length>0&&e.push(`unknown: ${s.unknownKeys.join(", ")}`),e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${i}: ignored sub-fields (${e.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,i){const{data:s,parseError:e}=wi(i,"measure");if(e||null===s)return null;const{config:n}=_i(s);return null!==n&&C(n.measure)?(void 0!==n.min&&void 0!==n.max&&n.min>=n.max?(this.errors.addOrReplace({id:`WARN_xy_domain_${t}`,type:"warning",message:`${t}: min must be smaller than max; the override is ignored.`}),n.min=void 0,n.max=void 0):this.errors.remove(`WARN_xy_domain_${t}`),n):null}prepareIso(){const{data:t,parseError:i}=wi(this.iso,null);return i||null===t?null:Ti(t).config}prepareLabels(){const t=this.labelDefaults(),{data:i,parseError:s}=wi(this.labels,null);return s||null===i?{points:t.points,values:t.values,max:t.max}:Ci(i,t).config}prepareLegend(){const{data:t,parseError:i}=wi(this.legend,null);return i||null===t?{show:!0,position:"right"}:Ui(t).config}prepareFacet(){const{data:t,parseError:i}=wi(this.facet,null);return i||null===t?null:Ni(t).config}preparePointLevel(){var t,i;const s=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===s)return"category";if("subcategory"===s)return"subCategory";const e=null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel;return"rowGroup"===e||"category"===e||"subCategory"===e?e:"category"}prepareSeriesLevel(t){var i;const s=null===(i=this.seriesLevel)||void 0===i?void 0:i.trim().toLowerCase();return"none"===s?null:"rowgroup"===s?"rowGroup":"category"===s||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,i){const s=new Set;for(const i of t){if(void 0===i)continue;const t=P(i);null!==t&&"scenario"===t.kind&&s.add(N(t.slot))}this.setBlockingError("ERR_xy_family",s.size>1?this.t(".xy-family-mixed",{families:[...s].join(", ")}):null);const e=this.preparePointLevel(),n=this.prepareSeriesLevel(e),r=null!==i?"rowgroup"===i.level?"rowGroup":"category":null;let o=null;if(null!==n&&Ki[n]>=Ki[e]&&(o=`series '${n}' vs point '${e}'`),null!==r){const t=null!=n?n:e;Ki[r]>=Ki[t]&&(o=`facet '${r}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==o?this.t(".xy-level-order",{detail:o}):null)}parseAspect(t){const i=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===i)return null;const s=Number(i[1]),e=Number(i[2]);return s<=0||e<=0?null:s/e}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","axis.in","legend.title"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),i=new Map(v.map((t=>[t,this.t("global.".concat(t))])));return new Map([...i.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor(),i=this.element.localName;return this.componentStyle((s=>{const e=s.global.fontSizePx*t;return{scaleFactors:s[i].scaleFactors,fontStyles:{font:`${e}px ${s.global.fontFamily}`,size:e,color:s.global.fontColor,background:s.global.fontBackgroundColor,leading:1.8},axisStyles:s[i].axisStyles,seriesColors:s[i].seriesColors,padding:s[i].padding}}))}async getLayoutState(t){var i;const s=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",e=Ft(this.element),n=this.getEffectiveScaleFactor(),r=Number.isFinite(n)&&n>0?n:1,o=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*r;return vi(this.element,"ibcs-chart-scatter",this.chartTitle||void 0,{fontSizePx:o,appliedScaleFactor:r},e,s)}getEffectiveScaleFactor(){const{mode:t,factor:i}=Kt(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var s,e,n,r;const o=(null===(s=i.global)||void 0===s?void 0:s.fontSizePx)||13.3333;return{"--bn-font-family":(null===(e=i.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":o*t+"px","--bn-font-color":(null===(n=i.global)||void 0===n?void 0:n.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const i of["ac","pp","fc","pl"])for(const s of[1,2,3,4])t[`${i}${s}`]={type:"number",isOptional:!0,description:""};for(const[i,s]of Object.entries(this.mappedAxes())){if(null===s)continue;const e=P(s.measure);null!==e&&("scenario"===e.kind?t[e.slot].description=`${i}: ${"label"in s&&void 0!==s.label?s.label:s.measure}`:(t[e.measure.base].description=`${i}: ${s.measure} (base)`,t[e.measure.delta].description=`${i}: ${s.measure} (delta)`))}return{[this.dataStructureName()]:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}mappedAxes(){return{x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y)}}dataStructureName(){return"IScatterChartDataRow"}chartTemplate(){const t=this.prepareAxis("x",this.x),s=this.prepareAxis("y",this.y),e=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==s?void 0:s.measure],e),this.hasBlockingErrors()||null===t||null===s)return null;const n=this.preparePointLevel(),r=this.prepareI18n(),o=this.prepareStyle(),h=Yt(this.element).width;return i("ibcs-chart-scatter",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:s,iso:this.prepareIso(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:e,pointLevel:n,seriesLevel:this.prepareSeriesLevel(n),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,styles:o,i18n:r,containerWidth:h,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return i(s,{key:"61ebef430224576a8dc7dc0538e362848c31004f",style:this.getFontStyles()},i("div",{key:"89a3c7653191348e8dd4231395e599f32365c8c1",class:"container"},this.chartTemplate()))}get element(){return e(this)}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}};Qi.style=':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}';const Zi=class{validateFilter(t){const i="ERR_filter";p(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateScenario(t){const i="ERR_scenarios";if(Ht(t))return void this.errors.remove(i);const s=j(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(Ht(t))return void this.errors.remove(i);const s=I(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validateUnitScaling(t){const i="ERR_unitScaling";L(t)?this.errors.remove(i):"invalid"===Qt(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="ERR_percentageScaling";L(t)?this.errors.remove(i):"invalid"===Qt(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validateLevel(t){const i="ERR_level";L(t)||Y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="ERR_order";if(Ht(t))return void this.errors.remove(i);const s=D(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";Ht(t)||L(t)||U(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateLimit(t){const i="ERR_limit";T(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateShowCategories(t){const i="ERR_showCategories";B(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showCategories: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateMeasureScale(t){const i="ERR_measureScale";H(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateShowMeasureScale(t){const i="ERR_showMeasureScale";B(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateStack(t){const i="ERR_stack",s=V(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:s.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(i){t(this,i),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this._lastScaledParentHeight=0,this.chartTitle="",this.filter="",this.limit=0,this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.measureUnit="",this.stack="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=t=>{var i,s,e,n,r,o;this.lastAutoScalingReport={unit:null!==(i=t.unit)&&void 0!==i?i:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(e=t.percentage)&&void 0!==e?e:null===(n=this.lastAutoScalingReport)||void 0===n?void 0:n.percentage};const h=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),a=this.getEffectiveFontPx();if(void 0!==t.unit&&t.unit>0&&this.autoUnitWarningActive){const i=a/t.unit;h(i,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=i,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${Zi.describeScalingInput(String(null!==(r=this.unitScaling)&&void 0!==r?r:"").trim())}, auto-fitted to 1 em ≈ ${Zt(i)} units.`}))}if(void 0!==t.percentage&&t.percentage>0&&this.autoPctWarningActive){const i=100*a/t.percentage;h(i,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=i,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${Zi.describeScalingInput(String(null!==(o=this.percentageScaling)&&void 0!==o?o:"").trim())}, auto-fitted to 1 em ≈ ${Zt(i)} percentage points.`}))}},A(this),a(this),Jt(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=l(this),yi(this),this.componentStyle=O(this),this.ruleSetConfig=bi(this),this.t=qt(this).t,this.resolveInherited=ti(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}],this.errors)}componentWillLoad(){this.validateFilter(this.filter),this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){zi(this.element,"ibcs-chart-structure");const{mode:t}=Kt(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const i=this.element,{height:s}=Yt(i);if(s<=0)return void this.checkOverflow();this._lastScaledParentHeight=s;const e=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),n=i.scrollHeight,o=this.appliedScaleFactor;if(n<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const h=Math.max(.3,o*(s-1)/n);Math.abs(h-o)<.01||(i.style.setProperty("--bn-font-size",e*h+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${h.toFixed(3)}`}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,r((()=>{this.appliedScaleFactor=h}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=mi(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=Yt(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,n(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=Yt(this.element);this._lastScaledParentHeight=t,n(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}measureContentWidth(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("ibcs-chart-structure");let s=0,e=!1;return null==i||i.forEach((t=>{var i,n,r;const o=parseFloat(null!==(r=null===(n=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===n?void 0:n.getAttribute("width"))&&void 0!==r?r:"");Number.isNaN(o)||(s+=o,e=!0)})),e?Math.max(Math.floor(s),this.element.scrollWidth):this.element.scrollWidth}checkOverflow(){const t="WARN_overflow",i=Yt(this.element),s=this.measureContentWidth(),e=this.element.scrollHeight,n=i.width>0&&s>i.width+1,r=i.height>0&&e>i.height+1;if(!n&&!r)return void this.errors.remove(t);const o=this.prepareVariances().some((t=>t.startsWith("dr"))),h="value"===Qt(this.unitScaling,this.pixelPerUnitGroupMap).kind,a=o&&"value"===Qt(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:l}=Kt(this.scale),c="auto"!==l&&"empty"!==l,u=[];n&&h&&u.push("unit-scaling"),n&&a&&u.push("percentage-scaling"),r&&c&&u.push("scale");const d=[];n&&d.push(`width (${Math.round(s)}px > ${Math.round(i.width)}px)`),r&&d.push(`height (${Math.round(e)}px > ${Math.round(i.height)}px)`),this.errors.addOrReplace({id:t,type:u.length>0?"error":"warning",message:`Chart exceeds available ${d.join(" and ")}. `+(u.length>0?`Adjust ${u.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container.")})}prepareDimension(){const t=Yt(this.element),i=this.prepareVariances();return this.canvasWidthSegmented=t.width/(1+i.length),{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,s,e;const n=this.resolveInherited("scenarios",this.scenarios);if(n.inherited)return this.errors.remove("AUTO_scenarios"),n.value.split(",").map((t=>t.trim()));const r="auto"===(null===(t=n.value)||void 0===t?void 0:t.trim().toLowerCase());return L(n.value)||r?(null===(s=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===s?void 0:s.length)>0?(r||n.unresolved?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:`scenarios: not set, auto-detected: ${this.datasetMeta.availableScenarios.join(",")}`}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(e=n.value)||void 0===e?void 0:e.split(",").map((t=>t.trim())))}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return L(t)?[]:null==t?void 0:t.split(",").map((t=>t.trim()))}prepareHideCategories(t){return t>=1||"true"!==this.showCategories}prepareI18n(){const t=v,i=new Map(["no-data","REST"].map((t=>[t,this.t(".".concat(t))]))),s=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...s.entries(),...i.entries()])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const t=Qt(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===t.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/t.value):"auto"===t.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,0):(this.autoUnitWarningActive=!0,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${Zi.describeScalingInput(t.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const t=Qt(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===t.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/t.value):"auto"===t.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,0):(this.autoPctWarningActive=!0,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${Zi.describeScalingInput(t.raw)}, auto-calculated to fit available space.`}),0)}prepareLevel(){var t,i,s;const e="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return L(this.level)||e?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(e?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:`level: not set, auto-detected: ${this.datasetMeta.suggestedLevel}`}),z[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),z[null===(s=this.level)||void 0===s?void 0:s.toUpperCase()])}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),s=i.value,e=this.resolveInherited("orderDirection",this.orderDirection).value,n="auto"===(null==s?void 0:s.trim().toLowerCase());let r;return L(s)||n?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(n||i.unresolved?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:`order: not set, auto-detected: ${this.datasetMeta.suggestedOrder}`}),r=this.datasetMeta.suggestedOrder):r=s:(this.errors.remove("AUTO_order"),r=s),{hierarchy:null==r?void 0:r.split(",").map((t=>G[null==t?void 0:t.toUpperCase()])),direction:F[null==e?void 0:e.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const s=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:i["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:i["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:i["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:i["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:i["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:i["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${s}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:s,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-structure"].axisStyles,barStyles:i["bn-chart-structure"].barStyles,varianceStyles:i["bn-chart-structure"].varianceStyles,stackColors:i["bn-chart-structure"].stackColors,padding:i["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareStackConfig(){if(L(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,s="WARN_stack_dimensions_scenarios";if(i===X.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:s,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(s)}else this.errors.remove(s);return{by:i,mode:t.mode||q.ABSOLUTE,order:t.order||J.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return L(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,s){const e=this.preparePixelPerUnit(),n=this.preparePixelPerPercentage(),r=this.prepareStackConfig(),o=this.prepareScenarios(),h=(null==r?void 0:r.by)===X.DIMENSIONS?o.slice(0,1):o;return i("ibcs-chart-structure",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(s),scenarios:h,variances:[t],hideCategories:this.prepareHideCategories(s),pixelPerUnit:e,pixelPerPercentage:n,reportAutoScaling:this.handleAutoScalingReport,errors:this.errors,limit:this.prepareLimit(),styles:this.prepareStyle(),i18n:this.prepareI18n(),order:this.prepareOrder(),level:this.prepareLevel(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(s),stackConfig:r,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getLayoutState(t){var i,s,e,n;const r=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",o=Ft(this.element),h=this.getEffectiveScaleFactor(),a=Number.isFinite(h)&&h>0?h:1,l=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*a,c=this.prepareVariances(),u=pi(this.element,"ibcs-chart-structure",["base",...c],o,r),d=null===(s=this.element.shadowRoot)||void 0===s?void 0:s.querySelector("ibcs-chart-structure"),f={version:It,tag:this.element.localName,id:zt(this.element),slot:null!==(e=this.element.getAttribute("slot"))&&void 0!==e?e:void 0,rect:Ut(this.element,o),em:{fontSizePx:l,appliedScaleFactor:a},regions:u.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(n=null==d?void 0:d.scenarios)&&void 0!==n?n:[],variances:c,barCount:u.barCount,hasNoData:0===u.barCount},diagnostics:Dt(this.element),scaling:this.resolveScalingInfo(l)};return u.elements&&(f.elements=u.elements),f}resolveScalingInfo(t){var i,s;const e={},n=Qt(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===n.kind)e.unitMode="fixed",e.unitsPerEm=n.value,e.unitPxPerUnit=t/n.value;else{e.unitMode="auto";const s=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==s&&s>0&&(e.unitPxPerUnit=s,e.unitsPerEm=t/s)}const r=Qt(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===r.kind)e.percentageMode="fixed",e.percentagePointsPerEm=r.value,e.percentagePxPerPoint=t/r.value;else{e.percentageMode="auto";const i=null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.percentage;void 0!==i&&i>0&&(e.percentagePxPerPoint=i/100,e.percentagePointsPerEm=100*t/i)}return e}getEffectiveScaleFactor(){const{mode:t,factor:i}=Kt(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){const t=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}));return t*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var s,e,n,r;const o=(null===(s=i.global)||void 0===s?void 0:s.fontSizePx)||13.3333;return{"--bn-font-family":(null===(e=i.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":o*t+"px","--bn-font-color":(null===(n=i.global)||void 0===n?void 0:n.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const e=this.prepareVariances();e.length>0&&(t=[...t,...e]);const n=this.getFontStyles();return i(s,{key:"c87917d6897bc4dfb21bc5ba1760df91038cf554",style:n},i("div",{key:"38c2b4a8b0d0c9fd6f13010782c2ae5faa1b218b",class:"container"},t.map(this.chartTemplate)))}get element(){return e(this)}static get watchers(){return{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}};Zi.style=':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}svg#drawCanvas{display:block}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}';class ts{constructor(t){this.type="",this.base="",this.delta="",this.direction="",this.isValid=!1;const i=/(d|dr)(pl\d|ac\d|fc\d|pp\d)_(pl\d|ac\d|fc\d|pp\d)_(pos|neg|neu)/;if(i.test(t)){const s=i.exec(t);null!=s&&(this.type=String(s[1]),this.base=String(s[2]),this.delta=String(s[3]),this.direction=String(s[4]),this.isValid=!0)}}}var is;!function(t){t.OPERATION="operation",t.ROWGROUP="rowGroup",t.ROWGROUPINDEX="rowGroupIndex",t.CURRENTROW="currentRow",t.CATEGORY="category",t.CATEGORYINDEX="categoryIndex",t.SUBCATEGORY="subCategory",t.SUBCATEGORYINDEX="subCategoryIndex",t.COLUMNGROUP="columnGroup",t.COLUMNGROUPINDEX="columnIndex",t.COLUMNSUBGROUP="columnSubGroup",t.COLUMNSUBGROUPINDEX="columnSubGroupIndex",t.AC1="ac1",t.AC2="ac2",t.AC3="ac3",t.AC4="ac4",t.PP1="pp1",t.PP2="pp2",t.PP3="pp3",t.PP4="pp4",t.FC1="fc1",t.FC2="fc2",t.FC3="fc3",t.FC4="fc4",t.PL1="pl1",t.PL2="pl2",t.PL3="pl3",t.PL4="pl4",t.TOTALROWCOUNT="totalRowCnt",t.ROWNR="rowNr",t.TYPE="type"}(is||(is={}));var ss,es,ns={},rs=function(){if(ss)return ns;ss=1;var t={};return Object.defineProperty(ns,"__esModule",{value:!0}),ns.default=function(i,s){void 0===s&&(s={});var e=JSON.stringify({text:i,options:s});if(t[e])return t[e];s.font=s.font||"Times",s.fontSize=s.fontSize||"16px",s.fontWeight=s.fontWeight||"normal",s.width=s.width||"auto";var n=function(t,i){var s=document.createElement("div"),e=document.createTextNode(t);return s.appendChild(e),s.style.fontFamily=i.font,s.style.fontSize=i.fontSize,s.style.fontWeight=i.fontWeight,s.style.position="absolute",s.style.visibility="hidden",s.style.left="-999px",s.style.top="-999px",s.style.width=i.width,s.style.height="auto",document.body.appendChild(s),s}(i,s),r={width:n.offsetWidth,height:n.offsetHeight};return function(t){t.parentNode.removeChild(t)}(n),t[e]=r,r},ns}(),os=g(rs);class hs{static number(t,i="decimal",s=1,e=0,n=1,r="de"){const o=`${r}|${i}|${s}|${e}`;let h=this.formats.get(o);if(!h){const t={style:i,useGrouping:!0,maximumFractionDigits:s,minimumFractionDigits:e};try{h=new Intl.NumberFormat([r,"de-DE"],t)}catch(i){h=new Intl.NumberFormat("de-DE",t)}this.formats.set(o,h)}const a=h.format(t/n);return(a===h.format(-0)?h.format(0):a).replace(/\s+(%)/g,"$1")}static translateScenarioLabel(t,i){if(null==t)return"";const s=new ts(t);if(!s.isValid)return`${i.get(t)||t}`;let e,n;return is.AC1===s.base?(e=i.get("dr"===s.type?"ibcssymbol_delta_ac_relative":"ibcssymbol_delta_ac"),n=i.get(s.delta)||s.delta):(e=i.get("dr"===s.type?"ibcssymbol_delta_generic_relative":"ibcssymbol_delta_generic"),n=`${i.get(s.base)||s.base} - ${i.get(s.delta)||s.delta}`),void 0===e&&(e="{%}"),`${e.replace("{%}",n)}`}static getMaxWidthOfArrayItems(t,i,s){return os(t.map((t=>hs.translateScenarioLabel(t,i))).reduce(((t,i)=>t.length<i.length?i:t),""),{font:s.fontStyles.font,fontSize:s.fontStyles.size+"px"}).width}}hs.formats=new Map,function(t){t.ROWGROUP="rowGroup",t.ROWGROUPINDEX="rowGroupIndex",t.CATEGORY="category",t.CATEGORYINDEX="categoryIndex",t.SUBCATEGORY="subCategory",t.SUBCATEGORYINDEX="subCategoryIndex"}(es||(es={}));const as=class{validateFilter(t){const i="ERR_filter";p(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateScenario(t){const i="ERR_scenarios";if(Ht(t))return void this.errors.remove(i);const s=j(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(Ht(t))return void this.errors.remove(i);const s=I(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validateLeftSync(t){const i="ERR_syncSpaceLeft";K(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"syncSpaceLeft: invalid value(s) '"+t+"' are not supported."})}validateLimit(t){const i="ERR_limit";T(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateUnitScaling(t){const i="ERR_unitScaling";L(t)?this.errors.remove(i):"invalid"===Qt(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="ERR_percentageScaling";L(t)?this.errors.remove(i):"invalid"===Qt(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validateLevel(t){const i="ERR_level";L(t)||Y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="ERR_order";if(Ht(t))return void this.errors.remove(i);const s=D(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";Ht(t)||L(t)||U(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateDateInterval(t){const i="ERR_dateInterval";L(t)||Q(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateInterval: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateChartMode(t){const i="ERR_chartMode";["bar","line","auto"].includes(null==t?void 0:t.toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"chartMode: invalid value '"+(null==t?void 0:t.toString())+"' is not supported. Valid values are: bar, line, auto."})}validateMaxBars(t){const i="ERR_maxBars";!T(t)||t<1?this.errors.addOrReplace({id:i,type:"warning",message:"maxBars: invalid value '"+(null==t?void 0:t.toString())+"' is not supported. Must be a positive integer."}):this.errors.remove(i)}validateStack(t){const i="ERR_stack",s=V(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:s.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}validateAxisLabelsMode(t){const i="ERR_axisLabelsMode";L(t)||Z(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"axisLabelsMode: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateLineFullWidth(t){const i="ERR_lineFullWidth";B(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"lineFullWidth: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateShowCategories(t){const i="ERR_showCategories";B(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showCategories: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateMeasureScale(t){const i="ERR_measureScale";H(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateShowMeasureScale(t){const i="ERR_showMeasureScale";B(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateShowOverlayAvg(t){const i="ERR_showOverlayAvg";B(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showOverlayAvg: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateShowOverlayMedian(t){const i="ERR_showOverlayMedian";B(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showOverlayMedian: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}constructor(i){t(this,i),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.chartTitle="",this.filter="",this.syncSpaceLeft=-1,this.limit=0,this.chartMode="bar",this.maxBars=28,this.stack="",this.intervalSpanLimit=28,this.lineFullWidth="true",this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.showOverlayAvg="true",this.showOverlayMedian="false",this.measureUnit="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this._lastObservedWidth=0,this._settleTimer=null,this._lastAppliedHeight=0,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=t=>{var i,s,e,n,r,o;this.lastAutoScalingReport={unit:null!==(i=t.unit)&&void 0!==i?i:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(e=t.percentage)&&void 0!==e?e:null===(n=this.lastAutoScalingReport)||void 0===n?void 0:n.percentage};const h=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),a=this.getEffectiveFontPx();if(void 0!==t.unit&&t.unit>0&&this.autoUnitWarningActive){const i=a/t.unit;h(i,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=i,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${as.describeScalingInput(String(null!==(r=this.unitScaling)&&void 0!==r?r:"").trim())}, auto-fitted to 1 em ≈ ${Zt(i)} units.`}))}if(void 0!==t.percentage&&t.percentage>0&&this.autoPctWarningActive){const i=100*a/t.percentage;h(i,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=i,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${as.describeScalingInput(String(null!==(o=this.percentageScaling)&&void 0!==o?o:"").trim())}, auto-fitted to 1 em ≈ ${Zt(i)} percentage points.`}))}},A(this),a(this),Jt(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=l(this),yi(this),this.componentStyle=O(this),this.ruleSetConfig=bi(this),this.t=qt(this).t,this.resolveInherited=ti(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}],this.errors)}componentWillLoad(){this.validateFilter(this.filter),this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLimit(this.limit),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateLeftSync(this.syncSpaceLeft),this.validateDateInterval(this.dateInterval),this.validateAxisLabelsMode(this.axisLabelsMode),this.validateLineFullWidth(this.lineFullWidth),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateShowOverlayAvg(this.showOverlayAvg),this.validateShowOverlayMedian(this.showOverlayMedian),this.validateChartMode(this.chartMode),this.validateMaxBars(this.maxBars),this.validateStack(this.stack),this.validateScaling(this.scale)}measureContentWidth(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("ibcs-chart-time");let s=0,e=!1;return null==i||i.forEach((t=>{var i,n,r;const o=parseFloat(null!==(r=null===(n=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===n?void 0:n.getAttribute("width"))&&void 0!==r?r:"");Number.isNaN(o)||(s=Math.max(s,o),e=!0)})),e?Math.max(Math.floor(s),this.element.scrollWidth):this.element.scrollWidth}measureContentHeight(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("ibcs-chart-time");let s=0,e=!1;return null==i||i.forEach((t=>{var i,n,r;const o=parseFloat(null!==(r=null===(n=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===n?void 0:n.getAttribute("height"))&&void 0!==r?r:"");Number.isNaN(o)||(s+=o,e=!0)})),e?Math.max(Math.floor(s),this.element.scrollHeight):this.element.scrollHeight}checkOverflow(){const t="WARN_overflow",i=Yt(this.element),s=this.measureContentWidth(),e=this.measureContentHeight(),n=i.width>0&&s>i.width+1,r=i.height>0&&e>i.height+1;if(!n&&!r)return void this.errors.remove(t);const o=this.prepareVariances().some((t=>t.startsWith("dr"))),h="value"===Qt(this.unitScaling,this.pixelPerUnitGroupMap).kind,a=o&&"value"===Qt(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:l}=Kt(this.scale),c="auto"!==l&&"empty"!==l,u=[];r&&h&&u.push("unit-scaling"),r&&a&&u.push("percentage-scaling"),n&&c&&u.push("scale");const d=[];n&&d.push(`width (${Math.round(s)}px > ${Math.round(i.width)}px)`),r&&d.push(`height (${Math.round(e)}px > ${Math.round(i.height)}px)`),this.errors.addOrReplace({id:t,type:u.length>0?"error":"warning",message:`Chart exceeds available ${d.join(" and ")}. `+(u.length>0?`Adjust ${u.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container.")})}componentDidRender(){zi(this.element,"ibcs-chart-time");const{mode:t}=Kt(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const i=this.element,{width:s}=Yt(i);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const e=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),n=i.scrollWidth,o=this.appliedScaleFactor;if(n<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const h=Math.max(.3,o*(s-1)/n);Math.abs(h-o)<.01||(i.style.setProperty("--bn-font-size",e*h+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${h.toFixed(3)}`}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,r((()=>{this.appliedScaleFactor=h}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=mi(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=Yt(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,n(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=Yt(this.element);this._lastObservedWidth=t,n(this)}))})),this.settleParentHeight()}settleParentHeight(){const t=[150,400,1e3,2500],i=()=>{if(this._settleTimer=null,!this.element.isConnected)return;const{height:s}=Yt(this.element);s>0&&Math.abs(s-this._lastAppliedHeight)>8&&!this._autoScaleGuard&&n(this);const e=t.shift();void 0!==e&&(this._settleTimer=setTimeout(i,e))};this._settleTimer=setTimeout(i,t.shift())}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null,null!=this._settleTimer&&(clearTimeout(this._settleTimer),this._settleTimer=null)}prepareDimension(){const t=Yt(this.element),i=this.prepareScenarios(),s=this.prepareVariances();this.canvasWidthSegmented=t.width/(i.length+s.length||1),this._lastAppliedHeight=t.height;const e=1+s.length,n="true"===this.showMeasureScale?this.getEffectiveFontPx():0;return{width:this.canvasWidthSegmented,height:Math.max(0,t.height-n)/e}}prepareScenarios(){var t,i,s,e;const n=this.resolveInherited("scenarios",this.scenarios);if(n.inherited)return this.errors.remove("AUTO_scenarios"),n.value.split(",").map((t=>t.trim()));const r="auto"===(null===(t=n.value)||void 0===t?void 0:t.trim().toLowerCase());return L(n.value)||r?(null===(s=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===s?void 0:s.length)>0?(r||n.unresolved?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:`scenarios: not set, auto-detected: ${this.datasetMeta.availableScenarios.join(",")}`}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(e=n.value)||void 0===e?void 0:e.split(",").map((t=>t.trim())))}prepareAvg(){return"true"===this.showOverlayAvg}prepareMedian(){return"true"===this.showOverlayMedian}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return L(t)?[]:null==t?void 0:t.split(",").map((t=>t.trim()))}checkVarianceScenarios(t){const i="WARN_variances_scenario",s=this.prepareScenarios(),e=[];for(const i of t){const t=new ts(i);if(t.isValid)for(const n of[t.base,t.delta])s.includes(n)||e.push(`'${i}' needs '${n}'`)}s.length>0&&e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:`variances: ${e.join(", ")}, which is not in scenarios (${s.join(", ")}). The variance has no values.`}):this.errors.remove(i)}prepareHideAxisLabels(t){return t>=1||"true"!==this.showCategories}prepareI18n(){const t=v,i=new Map(["no-data"].map((t=>[t,this.t(".".concat(t))]))),s=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...s.entries(),...i.entries()])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const t=Qt(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===t.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/t.value):"auto"===t.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,0):(this.autoUnitWarningActive=!0,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${as.describeScalingInput(t.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const t=Qt(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===t.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/t.value):"auto"===t.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,0):(this.autoPctWarningActive=!0,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${as.describeScalingInput(t.raw)}, auto-calculated to fit available space.`}),0)}prepareLevel(){var t,i,s;const e="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return L(this.level)||e?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(e?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:`level: not set, auto-detected: ${this.datasetMeta.suggestedLevel}`}),es[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),es[null===(s=this.level)||void 0===s?void 0:s.toUpperCase()])}prepareOrder(){var t,i,s;const e=this.resolveInherited("order",this.order),n=e.value,r=this.resolveInherited("orderDirection",this.orderDirection).value;let o=(L(this.level)||"auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase()))&&(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?this.datasetMeta.suggestedLevel:this.level;const h="auto"===(null==n?void 0:n.trim().toLowerCase());return L(n)||h?(null===(s=this.datasetMeta)||void 0===s?void 0:s.suggestedLevel)&&(h||e.unresolved?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:`order: not set, auto-detected: ${o}`})):(this.errors.remove("AUTO_order"),"levelindex"===(null==n?void 0:n.toLocaleLowerCase())&&(o+="Index")),{hierarchy:[G[null==o?void 0:o.toUpperCase()]],direction:F[null==r?void 0:r.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const s=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-time"].scaleFactors.scenarioOffset,scenarioLabelToColumn:i["bn-chart-time"].scaleFactors.scenarioLabelToColumn,labelToColumn:i["bn-chart-time"].scaleFactors.labelToColumn,labelToAxis:i["bn-chart-time"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-time"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-time"].scaleFactors.needleHeadWidth,columnWidth:i["bn-chart-time"].scaleFactors.columnWidth,varianceAxisLineWidth:i["bn-chart-time"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-time"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-time"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-time"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-time"].scaleFactors.markerWidth,markerOffset:i["bn-chart-time"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-time"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-time"].scaleFactors.axisTickLength},fontStyles:{font:`${s}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:s,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-time"].axisStyles,barStyles:i["bn-chart-time"].barStyles,varianceStyles:i["bn-chart-time"].varianceStyles,stackColors:i["bn-chart-time"].stackColors,padding:i["bn-chart-time"].padding,pattern:null,locale:"de"}}))}prepareLeftSideOffset(t,i){return this.syncSpaceLeft>-1?this.syncSpaceLeft:hs.getMaxWidthOfArrayItems([...this.prepareVariances(),...this.prepareScenarios(),this.chartTitle],t,i)}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareDateInterval(){var t,i,s;const e="auto"===(null===(t=this.dateInterval)||void 0===t?void 0:t.trim().toLowerCase());return L(this.dateInterval)||e?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedDateInterval)?(e?this.errors.remove("AUTO_dateInterval"):this.errors.addOrReplace({id:"AUTO_dateInterval",type:"warning",message:`dateInterval: not set, auto-detected: ${this.datasetMeta.suggestedDateInterval}`}),tt[this.datasetMeta.suggestedDateInterval.toUpperCase()]):e?tt.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),tt[null===(s=this.dateInterval)||void 0===s?void 0:s.toUpperCase()])}prepareIntervalSpanLimit(){const t=Number(this.intervalSpanLimit);return t>0?t:28}prepareAxisLabelsMode(){var t;return it[null===(t=this.axisLabelsMode)||void 0===t?void 0:t.toUpperCase()]}prepareFilter(){return 0===this.filter.length?"":this.filter}getDataStructure(){return{ITimeChartDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return L(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareStackConfig(){if(L(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,s="WARN_stack_dimensions_scenarios";if(i===X.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:s,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(s)}else this.errors.remove(s);return{by:i,mode:t.mode||q.ABSOLUTE,order:t.order||J.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareLineFullWidth(){return"true"===this.lineFullWidth}prepareChartMode(){var t;const i=null===(t=this.chartMode)||void 0===t?void 0:t.toLowerCase();return"line"===i?st.LINE:"auto"===i?st.AUTO:st.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(t,s){const e=this.prepareI18n(),n=this.prepareStyle(),r=Yt(this.element).width,o=this.preparePixelPerUnit(),h=this.preparePixelPerPercentage(),a=this.prepareStackConfig(),l=this.prepareScenarios(),c=(null==a?void 0:a.by)===X.DIMENSIONS?l.slice(0,1):l;return i("ibcs-chart-time",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(s),scenarios:c,variances:[t],hideAxisLabels:this.prepareHideAxisLabels(s),pixelPerUnit:o,pixelPerPercentage:h,reportAutoScaling:this.handleAutoScalingReport,errors:this.errors,limit:this.prepareLimit(),leftSideOffsetForHorizontalSync:this.prepareLeftSideOffset(e,n),styles:n,i18n:e,order:this.prepareOrder(),level:this.prepareLevel(),dateInterval:this.prepareDateInterval(),intervalSpanLimit:this.prepareIntervalSpanLimit(),axisLabelsMode:this.prepareAxisLabelsMode(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showOverlayAvg:this.prepareAvg(),showOverlayMedian:this.prepareMedian(),showMeasureScale:this.prepareShowMeasureScale(s),chartMode:this.prepareChartMode(),maxBars:this.prepareMaxBars(),stackConfig:a,lineFullWidth:this.prepareLineFullWidth(),containerWidth:r,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getLayoutState(t){var i,s,e,n;const r=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",o=Ft(this.element),h=this.getEffectiveScaleFactor(),a=Number.isFinite(h)&&h>0?h:1,l=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*a,c=this.prepareVariances(),u=pi(this.element,"ibcs-chart-time",["base",...c],o,r),d=null===(s=this.element.shadowRoot)||void 0===s?void 0:s.querySelector("ibcs-chart-time"),f={version:It,tag:this.element.localName,id:zt(this.element),slot:null!==(e=this.element.getAttribute("slot"))&&void 0!==e?e:void 0,rect:Ut(this.element,o),em:{fontSizePx:l,appliedScaleFactor:a},regions:u.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(n=null==d?void 0:d.scenarios)&&void 0!==n?n:[],variances:c,barCount:u.barCount,chartMode:this.chartMode||void 0,hasNoData:0===u.barCount},diagnostics:Dt(this.element),scaling:this.resolveScalingInfo(l)};return u.elements&&(f.elements=u.elements),f}resolveScalingInfo(t){var i,s;const e={},n=Qt(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===n.kind)e.unitMode="fixed",e.unitsPerEm=n.value,e.unitPxPerUnit=t/n.value;else{e.unitMode="auto";const s=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==s&&s>0&&(e.unitPxPerUnit=s,e.unitsPerEm=t/s)}const r=Qt(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===r.kind)e.percentageMode="fixed",e.percentagePointsPerEm=r.value,e.percentagePxPerPoint=t/r.value;else{e.percentageMode="auto";const i=null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.percentage;void 0!==i&&i>0&&(e.percentagePxPerPoint=i/100,e.percentagePointsPerEm=100*t/i)}return e}getEffectiveScaleFactor(){const{mode:t,factor:i}=Kt(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){const t=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}));return t*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var s,e,n,r;const o=(null===(s=i.global)||void 0===s?void 0:s.fontSizePx)||13.3333;return{"--bn-font-family":(null===(e=i.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":o*t+"px","--bn-font-color":(null===(n=i.global)||void 0===n?void 0:n.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const e=this.prepareVariances();this.checkVarianceScenarios(e),e.length>0&&(t=[...t,...e]);const n=this.getFontStyles();return i(s,{key:"a357016dd99c03b2bd2a2a64036b7b8d7dbeac6b",style:n},i("div",{key:"253fbdb945eca47c1bbec2484172186fb4ae8e8a",class:"container"},t.map(this.chartTemplate)))}get element(){return e(this)}static get watchers(){return{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian:0}]}}};as.style=':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column-reverse}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}';const ls=class{constructor(i){t(this,i),this.name="_default",a(this),this.errors=l(this),R(this,(t=>{this.stores||(this.stores=u(this.element));try{const i=JSON.parse(t);this.stores.componentStyles.set(this.name,i),this.errors.remove("JSON_PARSE");const s=m(i);s.length>0?this.errors.addOrReplace({id:"ERR_keys",type:"error",message:`Unknown style keys, they are ignored: ${s.join(", ")}`}):this.errors.remove("ERR_keys")}catch(t){this.errors.addOrReplace({id:"JSON_PARSE",type:"error",message:`bn-component-style: Failed to parse JSON body - ${t.message}`}),console.error(t)}}))}render(){return i(s,{key:"d2737ee7ff674501929f28adbc733ed27aec95e5"})}get element(){return e(this)}};ls.style="bn-component-style{display:none}";const cs={xga:[1024,768,"px"],hd:[1280,720,"px"],"full-hd":[1920,1080,"px"],"4k":[3840,2160,"px"],"4k2k":[4096,2160,"px"],a6:[4.13,5.83,"in"],a5:[5.83,8.27,"in"],a4:[8.27,11.69,"in"],a3:[11.69,16.54,"in"],a2:[16.54,23.39,"in"],a1:[23.39,33.11,"in"],a0:[33.11,46.81,"in"],letter:[8.5,11,"in"],legal:[8.5,14,"in"],tabloid:[11,17,"in"],ledger:[17,11,"in"]},us=Object.keys(cs),ds=["landscape","portrait"];function fs(t,i){const s=null!=t&&us.includes(t),[e,n,r]=cs[s?t:"xga"],o=e>=n?"landscape":"portrait",h=s&&ds.includes(null!=i?i:"")?i:o,[a,l]=h===o?[e,n]:[n,e];return{width:`${a}${r}`,height:`${l}${r}`,orientation:h}}function ps(t,i,s){const e=fs(t,i),n=ds.includes(null!=s?s:"")&&s!==e.orientation;return n?{width:e.height,height:e.width,turned:n}:{width:e.width,height:e.height,turned:n}}function vs(t,i,s){const{width:e,height:n}=ps(t,i,s);return`@page { size: ${e} ${n}; }`}const gs=["format","orientation","page-format","page-orientation","render-orientation","page-number"],ms=(t,i,s)=>{const e=t[i];return"string"==typeof e?e:i in t?null:t.getAttribute(s)},bs=class{constructor(i){t(this,i),this.assignedPageNumbers=new WeakMap,a(this),this.errors=l(this)}setLocale(t){this.stores.context.state.locale=t}connectedCallback(){this.stores=b(this.element),this.locale&&(this.stores.context.state.locale=this.locale),this.syncPages(),this.pageObserver=new MutationObserver((()=>this.syncPages())),this.pageObserver.observe(this.element,{childList:!0,subtree:!0,attributes:!0,attributeFilter:gs})}disconnectedCallback(){var t,i;null===(t=this.pageObserver)||void 0===t||t.disconnect(),null===(i=this.pageSizeStyle)||void 0===i||i.remove(),this.pageSizeStyle=void 0}syncPages(){const t=Array.from(this.element.querySelectorAll("bn-page, bn-layout-page"));t.forEach(((t,i)=>{const s="bn-layout-page"===t.localName?t:t.querySelector("bn-footer");if(!s)return;const e=ms(s,"pageNumber","page-number");if(null!==e&&e!==this.assignedPageNumbers.get(s))return;const n=(i+1).toString();this.assignedPageNumbers.set(s,n),e!==n&&s.setAttribute("page-number",n)}));const i=this.element.getAttribute("render-orientation");void 0!==this.renderOrientation&&this.renderOrientation!==i&&t.filter((t=>"bn-layout-page"===t.localName)).forEach((t=>n(t))),this.renderOrientation=i,this.writePageSize(t[0],i)}writePageSize(t,i){var s;if(!t||document.querySelector("bn-context")!==this.element)return null===(s=this.pageSizeStyle)||void 0===s||s.remove(),void(this.pageSizeStyle=void 0);const e="bn-layout-page"===t.localName?vs(ms(t,"pageFormat","page-format"),ms(t,"pageOrientation","page-orientation"),i):vs(ms(t,"format","format"),ms(t,"orientation","orientation"));this.pageSizeStyle||(this.pageSizeStyle=document.createElement("style"),this.pageSizeStyle.setAttribute("data-bn-page-size",""),document.head.append(this.pageSizeStyle)),this.pageSizeStyle.textContent!==e&&(this.pageSizeStyle.textContent=e)}async getLayoutState(t){var i,s;const e=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",n=Array.from(this.element.querySelectorAll("bn-body, bn-card, bn-chart-bubble, bn-chart-bullet, bn-chart-scatter, bn-chart-structure, bn-chart-time, bn-footer, bn-grid, bn-image, bn-layout-card, bn-layout-page, bn-message, bn-page, bn-table, bn-template, bn-text, bn-title, bn-tree"));await Promise.all(n.map((t=>{var i,s,e;return null!==(e=null===(s=(i=t).componentOnReady)||void 0===s?void 0:s.call(i))&&void 0!==e?e:Promise.resolve()})));const r=this.element.getBoundingClientRect(),o={x:r.left,y:r.top},h=await Promise.all(n.map((async t=>{const i=t.getBoundingClientRect(),s={context:o,component:{x:i.left,y:i.top}};try{const i=t;return"function"==typeof i.getLayoutState?await i.getLayoutState({detail:e}):li(t,s)}catch(i){let e;try{e=li(t,s)}catch(i){const s={x:0,y:0,width:0,height:0};e={version:It,tag:t.localName,id:t.localName,rect:{context:Object.assign({},s),component:Object.assign({},s)},em:{fontSizePx:0,appliedScaleFactor:1},regions:[],metadata:{},diagnostics:[]}}return e.error=String(i instanceof Error?i.message:i),e}}))),a=Wt(n.map((t=>({tag:t.localName,explicitId:Gt(t)}))));return h.forEach(((t,i)=>{t.id=a[i]})),{version:It,generatedAt:(new Date).toISOString(),detail:e,context:{viewport:jt(r),locale:null===(s=this.stores)||void 0===s?void 0:s.context.state.locale},components:h}}componentWillLoad(){}componentDidLoad(){}componentShouldUpdate(){}componentWillRender(){}componentDidRender(){}componentWillUpdate(){}componentDidUpdate(){}render(){return i(s,{key:"b67db95d4e6f7f07e1f3cf277eacc26104af4620"},i("slot",{key:"33e5e400aaf3c9e929a40afa0e3dd108295762a9"}))}get element(){return e(this)}static get watchers(){return{locale:[{setLocale:0}]}}};bs.style=":host{display:block}";const ys=["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"],ws=["rowGroup","category","subCategory","columnGroup","columnSubGroup"];function xs(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}function Ss(t){const i=Array.from(t);return{distinctValues:i,count:i.length,hasData:i.length>0}}var $s=Uint8Array,Ms=Uint16Array,_s=Int32Array,Rs=new $s([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Os=new $s([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ks=new $s([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Es=function(t,i){for(var s=new Ms(31),e=0;e<31;++e)s[e]=i+=1<<t[e-1];var n=new _s(s[30]);for(e=1;e<30;++e)for(var r=s[e];r<s[e+1];++r)n[r]=r-s[e]<<5|e;return{b:s,r:n}},Ls=Es(Rs,2),Ts=Ls.b,As=Ls.r;Ts[28]=258,As[258]=28;for(var Cs=Es(Os,0).b,Ps=new Ms(32768),Ns=0;Ns<32768;++Ns){var Ds=(43690&Ns)>>1|(21845&Ns)<<1;Ps[Ns]=((65280&(Ds=(61680&(Ds=(52428&Ds)>>2|(13107&Ds)<<2))>>4|(3855&Ds)<<4))>>8|(255&Ds)<<8)>>1}var Us=function(t,i,s){for(var e=t.length,n=0,r=new Ms(i);n<e;++n)t[n]&&++r[t[n]-1];var o,h=new Ms(i);for(n=1;n<i;++n)h[n]=h[n-1]+r[n-1]<<1;if(s){o=new Ms(1<<i);var a=15-i;for(n=0;n<e;++n)if(t[n])for(var l=n<<4|t[n],c=i-t[n],u=h[t[n]-1]++<<c,d=u|(1<<c)-1;u<=d;++u)o[Ps[u]>>a]=l}else for(o=new Ms(e),n=0;n<e;++n)t[n]&&(o[n]=Ps[h[t[n]-1]++]>>15-t[n]);return o},zs=new $s(288);for(Ns=0;Ns<144;++Ns)zs[Ns]=8;for(Ns=144;Ns<256;++Ns)zs[Ns]=9;for(Ns=256;Ns<280;++Ns)zs[Ns]=7;for(Ns=280;Ns<288;++Ns)zs[Ns]=8;var Fs=new $s(32);for(Ns=0;Ns<32;++Ns)Fs[Ns]=5;var Ws=Us(zs,9,1),Gs=Us(Fs,5,1),js=function(t){for(var i=t[0],s=1;s<t.length;++s)t[s]>i&&(i=t[s]);return i},Is=function(t,i,s){var e=i/8|0;return(t[e]|t[e+1]<<8)>>(7&i)&s},Ys=function(t,i){var s=i/8|0;return(t[s]|t[s+1]<<8|t[s+2]<<16)>>(7&i)},Bs=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Hs=function(t,i,s){var e=new Error(i||Bs[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,Hs),!s)throw e;return e},Vs=new $s(0);function Xs(t,i){var s,e,n=function(t){31==t[0]&&139==t[1]&&8==t[2]||Hs(6,"invalid gzip data");var i=t[3],s=10;4&i&&(s+=2+(t[10]|t[11]<<8));for(var e=(i>>3&1)+(i>>4&1);e>0;e-=!t[s++]);return s+(2&i)}(t);return n+8>t.length&&Hs(6,"invalid gzip data"),function(t,i,s,e){var n=t.length;if(!n||i.f&&!i.l)return s||new $s(0);var r=!s,o=r||2!=i.i;r&&(s=new $s(3*n));var h,a,l=function(t){var i=s.length;if(t>i){var e=new $s(Math.max(2*i,t));e.set(s),s=e}},c=i.f||0,u=i.p||0,d=i.b||0,f=i.l,p=i.d,v=i.m,g=i.n,m=8*n;do{if(!f){c=Is(t,u,1);var b=Is(t,u+1,3);if(u+=3,!b){var y=t[(L=4+((u+7)/8|0))-4]|t[L-3]<<8,w=L+y;if(w>n){Hs(0);break}o&&l(d+y),s.set(t.subarray(L,w),d),i.b=d+=y,i.p=u=8*w,i.f=c;continue}if(1==b)f=Ws,p=Gs,v=9,g=5;else if(2==b){var x=Is(t,u,31)+257,S=Is(t,u+10,15)+4,$=x+Is(t,u+5,31)+1;u+=14;for(var M=new $s($),_=new $s(19),R=0;R<S;++R)_[ks[R]]=Is(t,u+3*R,7);u+=3*S;var O=js(_),k=(1<<O)-1,E=Us(_,O,1);for(R=0;R<$;){var L,T=E[Is(t,u,k)];if(u+=15&T,(L=T>>4)<16)M[R++]=L;else{var A=0,C=0;for(16==L?(C=3+Is(t,u,3),u+=2,A=M[R-1]):17==L?(C=3+Is(t,u,7),u+=3):18==L&&(C=11+Is(t,u,127),u+=7);C--;)M[R++]=A}}var P=M.subarray(0,x),N=M.subarray(x);v=js(P),g=js(N),f=Us(P,v,1),p=Us(N,g,1)}else Hs(1);if(u>m){Hs(0);break}}o&&l(d+131072);for(var D=(1<<v)-1,U=(1<<g)-1,z=u;;z=u){var F=(A=f[Ys(t,u)&D])>>4;if((u+=15&A)>m){Hs(0);break}if(A||Hs(2),F<256)s[d++]=F;else{if(256==F){z=u,f=null;break}var W=F-254;F>264&&(W=Is(t,u,(1<<(I=Rs[R=F-257]))-1)+Ts[R],u+=I);var G=p[Ys(t,u)&U],j=G>>4;if(G||Hs(3),u+=15&G,N=Cs[j],j>3){var I=Os[j];N+=Ys(t,u)&(1<<I)-1,u+=I}if(u>m){Hs(0);break}o&&l(d+131072);var Y=d+W;if(d<N){var B=0-N,H=Math.min(N,Y);for(B+d<0&&Hs(3);d<H;++d)s[d]=e[B+d]}for(;d<Y;++d)s[d]=s[d-N]}}i.l=f,i.p=z,i.b=d,i.f=c,f&&(c=1,i.m=v,i.d=p,i.n=g)}while(!c);return d!=s.length&&r?(h=s,(null==(a=d)||a>h.length)&&(a=h.length),new $s(h.subarray(0,a))):s.subarray(0,d)}(t.subarray(n,-8),{i:2},new $s(((s=t)[(e=s.length)-4]|s[e-3]<<8|s[e-2]<<16|s[e-1]<<24)>>>0),i)}var Js="undefined"!=typeof TextDecoder&&new TextDecoder;try{Js.decode(Vs,{stream:!0})}catch(t){}function qs(t){return et(t)}function Ks(t){const i=t.indexOf(":");if(-1===i)throw new Error("Invalid compressed format: missing ':' separator");const s=t.slice(0,i),e=t.slice(i+1),n=atob(e),r=new Uint8Array(n.length);for(let t=0;t<n.length;t++)r[t]=n.charCodeAt(t);const o=Xs(r);return{hash:s,json:(new TextDecoder).decode(o)}}const Qs=class{constructor(i){t(this,i),this.datasources="",this.static=!1,this.raw=!0,this.interval=0,this.lastBodyHash=null,this.lastViewQuery=null,this.nameShared=!1,this.currentUrl=null,this.pollTimerId=null,this.abortController=null,this.firstLoadPending=!1,this.onNameShared=t=>{const i=this.nameShared;this.nameShared=t,t?this.errors.addOrReplace({id:"ERR_name",type:"error",message:`name: "${this.name}" is used by more than one dataset or datasource.`}):(this.errors.remove("ERR_name"),i&&this.reload())},this.holdStatus=a(this),this.errors=l(this),((t,i)=>{let s,n=[],r=[];const o=t=>{let e;try{e=s.db.db.exec(`SELECT * FROM \`${t}\``)}catch(t){e=[]}i()},h=()=>{n.forEach((t=>t())),n=[],r.forEach((t=>{t&&(n.push(s.db.subscribe(t,(()=>o(t)))),o(t))}))},a=new MutationObserver((i=>{i.forEach((i=>{"datasources"===i.attributeName&&(r=(e(t).getAttribute("datasources")||"").split(","),h())}))})),l=t.connectedCallback;t.connectedCallback=()=>{const i=e(t);s=u(i),r=(i.getAttribute("datasources")||"").split(","),h(),a.observe(i,{attributes:!0,attributeFilter:["datasources"]}),c(l,t)};const d=t.disconnectedCallback;t.disconnectedCallback=()=>{a.disconnect(),n.forEach((t=>t())),n=[],f(e(t)),c(d,t)}})(this,(()=>{this.executeQuery()})),R(this,(t=>this.sync(t)))}sync(t){if(this.stores=u(this.element),!this.releaseName&&this.name&&(this.releaseName=this.stores.db.claim(this.name,this.onNameShared)),this.src){if(this.src===this.currentUrl)return;return this.currentUrl=this.src,this.lastBodyHash=null,this.query="",this.errors.remove("ERR_sql"),this.errors.remove("ERR_body"),this.firstLoadPending=!0,this.holdStatus(this.fetchAndStore(this.src)),void this.startPolling()}let i,s;if(null!==this.currentUrl&&(this.cancelInFlight(),this.currentUrl=null),this.errors.remove("ERR_src"),!this.raw&&this.static&&""!==t.trim())try{const e=Ks(t);i=e.hash,s=e.json}catch(t){return this.errors.addOrReplace({id:"ERR_body",type:"error",message:`Body: ${ei(t)}`}),void(this.lastBodyHash=null)}else i=qs(t),s=t;i!==this.lastBodyHash&&(this.lastBodyHash=i,this.errors.remove("ERR_body"),this.query=s,this.executeQuery())}executeQuery(){var t,i;if(this.stores||(this.stores=u(this.element)),this.query||this.errors.remove("ERR_sql"),!this.name)return;if(!(this.query||this.static&&null===this.currentUrl))return;const s=this.stores.db.db;let e;if(this.static){try{e=""===this.query.trim()?[]:null!==(t=JSON.parse(this.query))&&void 0!==t?t:[],Array.isArray(e)?this.errors.remove("ERR_body"):this.errors.addOrReplace({id:"ERR_body",type:"error",message:"Body: not a JSON array."})}catch(t){this.errors.addOrReplace({id:"ERR_body",type:"error",message:`Body: ${ei(t)}`}),e=[]}s.tables[this.name]={data:Array.isArray(e)?e:[]},this.registered=s.tables[this.name],this.dropViewStatements(),this.errors.remove("ERR_sql")}else{if(this.lastViewQuery!==this.query){try{s.exec(`DROP VIEW \`${this.name}\``)}catch(t){}null!=s.tables[this.name]&&delete s.tables[this.name],s.views&&null!=s.views[this.name]&&delete s.views[this.name];try{if(p(this.query))throw new Error("double backticks are not allowed.");s.exec(`CREATE VIEW \`${this.name}\` AS ${this.query}`),this.registered=s.tables[this.name],s.resetSqlCache(),this.lastViewQuery=this.query}catch(t){return console.error("bn-dataset: failed to register SQL view",t,this.query),this.errors.addOrReplace({id:"ERR_sql",type:"error",message:`SQL: ${t instanceof Error?t.message:t}`}),s.resetSqlCache(),this.lastViewQuery=null,e=[],void this.publish(e)}}else null===(i=s.tables[this.name])||void 0===i||delete i.select;try{e=s.exec(`SELECT * FROM \`${this.name}\``),this.errors.remove("ERR_sql")}catch(t){if(void 0===this.latestResult)return;return this.errors.addOrReplace({id:"ERR_sql",type:"error",message:`SQL: ${t instanceof Error?t.message:t}`}),void this.publish([])}}this.publish(e)}publish(t){this.latestResult!==t?(this.latestResult=t,this.stores.db.notify(this.name),this.publishedMeta=function(t){const i={};for(const t of ws)i[t]=new Set;const s={};for(const t of ys)s[t]={hasData:!1,min:null,max:null};const e=new Set;let n=null,r=null;const o=Array.isArray(t)?t:[];for(let t=0;t<o.length;t++){const h=o[t];if(null==h)continue;for(const t of ws){const s=h[t];null!=s&&""!==s&&i[t].add(String(s))}for(const t of ys){const i=h[t];if(xs(i)){const e=s[t];e.hasData=!0,(null===e.min||i<e.min)&&(e.min=i),(null===e.max||i>e.max)&&(e.max=i)}}const a=h.date;if(null!=a&&""!==a){const t=String(a);e.add(t),(null===n||t<n)&&(n=t),(null===r||t>r)&&(r=t)}}const h=ys.map((t=>({key:t,hasData:s[t].hasData,min:s[t].min,max:s[t].max}))),a=h.filter((t=>t.hasData)).map((t=>t.key)),l=Ss(i.rowGroup),c=Ss(i.category),u=Ss(i.subCategory),d=Ss(i.columnGroup),f=Ss(i.columnSubGroup),p={min:n,max:r,hasData:e.size>0,distinctCount:e.size};let v="category";return u.hasData?v="subCategory":c.hasData?v="category":l.hasData&&(v="rowGroup"),{rowCount:o.length,scenarios:h,availableScenarios:a,rowGroup:l,category:c,subCategory:u,columnGroup:d,columnSubGroup:f,dateRange:p,suggestedLevel:v,suggestedOrder:v,suggestedDateInterval:p.hasData?"auto":null,calculatedAt:Date.now()}}(t),this.stores.datasetsMeta.set(this.name,this.publishedMeta)):this.stores.db.notify(this.name)}nameUpdated(t,i){var s;this.unregister(i),this.name&&this.element.isConnected&&this.sync(null!==(s=this.element.textContent)&&void 0!==s?s:"")}onIntervalChange(){this.currentUrl&&this.startPolling()}onSrcChange(){var t;this.element.isConnected&&this.sync(null!==(t=this.element.textContent)&&void 0!==t?t:"")}disconnectedCallback(){this.cancelInFlight(),this.unregister(this.name)}unregister(t){var i,s,e;const n=null===(s=null===(i=this.stores)||void 0===i?void 0:i.db)||void 0===s?void 0:s.db;n&&null!==this.lastViewQuery&&n.resetSqlCache(),null===(e=this.releaseName)||void 0===e||e.call(this),this.releaseName=void 0;const r=null!=(null==n?void 0:n.tables[t])&&n.tables[t]!==this.registered;if(r&&void 0!==this.publishedMeta&&this.stores.datasetsMeta.get(t)===this.publishedMeta&&this.stores.datasetsMeta.set(t,null),this.publishedMeta=void 0,this.registered=void 0,this.lastBodyHash=null,this.lastViewQuery=null,this.currentUrl=null,this.latestResult=void 0,n&&t&&!r){try{n.exec(`DROP VIEW \`${t}\``)}catch(t){}null!=n.tables[t]&&delete n.tables[t],n.views&&null!=n.views[t]&&delete n.views[t],this.stores.datasetsMeta.set(t,null),this.stores.db.notify(t)}}async fetchAndStore(t){var i,s;null===(i=this.abortController)||void 0===i||i.abort(),this.abortController=new AbortController,this.stores||(this.stores=u(this.element));try{const i=await fetch(t,{signal:this.abortController.signal});if(!i.ok)throw new Error(`HTTP ${i.status}`);const e=null!==(s=await i.json())&&void 0!==s?s:[];if(!Array.isArray(e))throw new Error("not a JSON array.");const n=this.stores.db.db;n.tables[this.name]={data:e},this.registered=n.tables[this.name],this.dropViewStatements(),this.errors.remove("ERR_src"),this.publish(e)}catch(t){if(t instanceof DOMException&&"AbortError"===t.name)return;this.errors.addOrReplace({id:"ERR_src",type:"error",message:`src: ${ei(t)}`});const i=this.stores.db.db;i.tables[this.name]={data:[]},this.registered=i.tables[this.name],this.dropViewStatements(),this.publish([])}this.firstLoadPending=!1}reload(){var t;null!==this.lastViewQuery&&this.stores.db.db.resetSqlCache(),this.lastBodyHash=null,this.lastViewQuery=null,this.currentUrl=null,this.latestResult=void 0,this.sync(null!==(t=this.element.textContent)&&void 0!==t?t:"")}dropViewStatements(){null!==this.lastViewQuery&&this.stores.db.db.resetSqlCache(),this.lastViewQuery=null}clearPollTimer(){null!==this.pollTimerId&&(clearInterval(this.pollTimerId),this.pollTimerId=null)}cancelInFlight(){var t;this.clearPollTimer(),null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=null}startPolling(){this.clearPollTimer(),this.currentUrl&&this.interval>0&&(this.pollTimerId=setInterval((()=>{this.currentUrl&&!this.firstLoadPending&&this.fetchAndStore(this.currentUrl)}),1e3*this.interval))}render(){return i(s,{key:"b1b6c4f25ecbd1f37be510b3b926c22a8193f637"})}get element(){return e(this)}static get watchers(){return{name:[{nameUpdated:0}],interval:[{onIntervalChange:0}],src:[{onSrcChange:0}]}}};Qs.style="bn-dataset{display:none}";const Zs=class{constructor(i){t(this,i),this.raw=!0,this.interval=0,this.lastHash=null,this.nameShared=!1,this.currentUrl=null,this.pollTimerId=null,this.abortController=null,this.firstLoadPending=!1,this.onNameShared=t=>{const i=this.nameShared;this.nameShared=t,t?this.errors.addOrReplace({id:"ERR_name",type:"error",message:`name: "${this.name}" is used by more than one dataset or datasource.`}):(this.errors.remove("ERR_name"),i&&this.reload())},this.holdStatus=a(this),this.errors=l(this),R(this,(t=>this.sync(t)))}sync(t){var i;if(this.stores=u(this.element),!this.releaseName&&this.name&&(this.releaseName=this.stores.db.claim(this.name,this.onNameShared)),this.src){if(this.src===this.currentUrl)return;return this.currentUrl=this.src,this.lastHash=null,this.errors.remove("ERR_body"),this.firstLoadPending=!0,this.holdStatus(this.fetchAndStore(this.src)),void this.startPolling()}null!==this.currentUrl&&(this.cancelInFlight(),this.currentUrl=null),this.errors.remove("ERR_src");try{let s,e;if(this.raw||""===t.trim())s=qs(t),e=t;else{const i=Ks(t);s=i.hash,e=i.json}if(s===this.lastHash)return;this.lastHash=s;const n=""===e.trim()?[]:null!==(i=JSON.parse(e))&&void 0!==i?i:[];Array.isArray(n)?this.errors.remove("ERR_body"):this.errors.addOrReplace({id:"ERR_body",type:"error",message:"Body: not a JSON array."}),this.publish(n)}catch(t){this.lastHash=null,this.errors.addOrReplace({id:"ERR_body",type:"error",message:`Body: ${ei(t)}`}),this.publish([])}}reload(){var t;this.lastHash=null,this.currentUrl=null,this.sync(null!==(t=this.element.textContent)&&void 0!==t?t:"")}publish(t){const i=this.stores.db.db;i.tables[this.name]={data:Array.isArray(t)?t:[]},this.registered=i.tables[this.name],this.stores.db.notify(this.name)}onIntervalChange(){this.currentUrl&&this.startPolling()}onSrcChange(){var t;this.element.isConnected&&this.sync(null!==(t=this.element.textContent)&&void 0!==t?t:"")}nameUpdated(t,i){var s;this.unregister(i),this.name&&this.element.isConnected&&this.sync(null!==(s=this.element.textContent)&&void 0!==s?s:"")}disconnectedCallback(){this.cancelInFlight(),this.unregister(this.name),f(this.element)}unregister(t){var i,s,e;null===(i=this.releaseName)||void 0===i||i.call(this),this.releaseName=void 0,this.lastHash=null,this.currentUrl=null;const n=null===(e=null===(s=this.stores)||void 0===s?void 0:s.db)||void 0===e?void 0:e.db,r=null!=(null==n?void 0:n.tables[t])&&n.tables[t]!==this.registered;this.registered=void 0,n&&t&&!r&&(null!=n.tables[t]&&delete n.tables[t],n.views&&null!=n.views[t]&&delete n.views[t],this.stores.db.notify(t))}async fetchAndStore(t){var i,s;null===(i=this.abortController)||void 0===i||i.abort(),this.abortController=new AbortController,this.stores||(this.stores=u(this.element));try{const i=await fetch(t,{signal:this.abortController.signal});if(!i.ok)throw new Error(`HTTP ${i.status}`);const e=null!==(s=await i.json())&&void 0!==s?s:[];if(!Array.isArray(e))throw new Error("not a JSON array.");this.errors.remove("ERR_src"),this.publish(e)}catch(t){if(t instanceof DOMException&&"AbortError"===t.name)return;this.errors.addOrReplace({id:"ERR_src",type:"error",message:`src: ${ei(t)}`}),this.publish([])}this.firstLoadPending=!1}clearPollTimer(){null!==this.pollTimerId&&(clearInterval(this.pollTimerId),this.pollTimerId=null)}cancelInFlight(){var t;this.clearPollTimer(),null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=null}startPolling(){this.clearPollTimer(),this.currentUrl&&this.interval>0&&(this.pollTimerId=setInterval((()=>{this.currentUrl&&!this.firstLoadPending&&this.fetchAndStore(this.currentUrl)}),1e3*this.interval))}render(){return i(s,{key:"4e164358c873601f39332f5d35d14a1ad5f66f73"})}get element(){return e(this)}static get watchers(){return{interval:[{onIntervalChange:0}],src:[{onSrcChange:0}],name:[{nameUpdated:0}]}}};Zs.style="bn-datasource{display:none}";const te=class{constructor(i){t(this,i),this.pageNumber=null,this.displayPageNumber=!0,a(this),this.errors=l(this),this.componentStyle=O(this)}getFontStyles(){return this.componentStyle((t=>{var i,s,e,n;return{"--bn-font-family":(null===(i=t.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(s=t.global)||void 0===s?void 0:s.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(e=t.global)||void 0===e?void 0:e.fontColor)||"#000000","--bn-font-background":(null===(n=t.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}isValidHttpUrl(t){let i;try{i=new URL(t)}catch(t){return!1}return"http:"===i.protocol||"https:"===i.protocol}prepareAssetUrl(t){return this.isValidHttpUrl(t)?t:`./assets/${t}.png`}render(){return i(s,{key:"8751cf4e338d54605350f06743956689eb4286ce",id:this.displayPageNumber||this.text||this.code?"container-page-footer":"container",style:this.getFontStyles()},i("div",{key:"7a9fb20453df0db4755d90c00043fff4c262eda2",id:"footer-text"},null!=this.text?i("span",{class:"note"},this.text):""),i("div",{key:"7ef166a4d0d48b1fb5cceb7e79ca678c4c4e0d63",id:"code"},null!=this.code?i("img",{class:"image",src:o(`${this.prepareAssetUrl(this.code)}`)}):""),i("div",{key:"bf74b278f43540612327e03539278f7fa35996f1",id:"page-number"},this.displayPageNumber?i("span",{class:"page"},this.pageNumber):""))}static get assetsDirs(){return["assets"]}get element(){return e(this)}};te.style=':host{padding:0.2em 0.5em;display:flex;flex-direction:row;justify-content:space-between;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}:host(#container-page-footer){box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em solid #ddd}div#footer-text{font-size:0.6em;display:inline}div#code{flex:1;display:inline;text-align:right;padding-right:1em}div#page-number{font-size:0.6em;display:inline}.image{z-index:2;background-color:transparent;border:transparent;height:1.2em;width:auto}';const ie=new Map([["split-vertical",'"a b"'],["split-horizontal",'"a" "b"'],["2x2",'"a b" "c d"'],["3x3",'"a b c" "d e f" "g h i"'],["4x4",'"a b c d" "e f g h" "i j k l" "m n o p"'],["1-over-2",'"a a" "b c"'],["2-over-1",'"a b" "c c"'],["1-over-3",'"a a a " "b c d"'],["3-over-1",'"a b c" "d d d"'],["gold3",'"a c" "b c"'],["gold4",'"a b c c" "d d c c"']]),se="custom-template",ee=/"[\w\d\s.]+"|'[\w\d\s.]+'/g,ne=/"[^"]*"|'[^']*'/g;function re(t){var i;return(null!==(i=null==t?void 0:t.match(ee))&&void 0!==i?i:[]).map((t=>t.slice(1,-1).split(/\s+/).filter((t=>""!==t)))).filter((t=>t.length>0))}function oe(t,i){var s;return t===se?re(i).length>0?i:'"a"':null!==(s=ie.get(t))&&void 0!==s?s:'"a"'}function he(t){var i;const s=(null===(i=re(t)[0])||void 0===i?void 0:i.length)||1;return Array(s).fill("minmax(0, 1fr)").join(" ")}function ae(t){var i;return Array.from(new Set(null!==(i=null==t?void 0:t.match(/\b\w+\b/g))&&void 0!==i?i:[]))}function le(t){var i;const s=re(t);if(0===s.length)return'no row found, the layout is drawn as a single cell. Write one quoted row per grid row, e.g. \'"a a" "b c"\'.';const e=null!==(i=null==t?void 0:t.match(ne))&&void 0!==i?i:[];return e.some((t=>""===t.slice(1,-1).trim()))?"a pair of quotes holds no cell, so the browser ignores the template.":e.length!==s.length?"a row cannot be read. Use only letters, digits, '_' and '.' in a cell name, and open and close every row with the same kind of quote.":s.some((t=>t.length!==s[0].length))?"the rows have different numbers of cells, so the browser ignores the template.":void 0}const ce=class{constructor(i){t(this,i),this.titleImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.footerText="",this.cardLayout="full",this.cardCustomTemplate='"a b" "c d"',this.cardGridGap="0",this.cardFitToContent=!1,this.cardShowBorder=!0,a(this),this.errors=l(this),this.resolveInherited=ti(this,[{propName:"titleScenarios",ancestorAttr:"title-scenarios"},{propName:"titleVariances",ancestorAttr:"title-variances"},{propName:"titleOrder",ancestorAttr:"title-order"},{propName:"titleOrderDirection",ancestorAttr:"title-order-direction"},{propName:"ruleset",ancestorAttr:"ruleset"}])}connectedCallback(){this.stores=u(this.element)}getCommonStyles(){let t="100%";return!0===this.cardFitToContent&&(t="fit-content"),{display:"grid",height:t,width:"100%",gap:this.cardGridGap+"px"}}getGridTemplateColumns(t){return he(this.getTemplatePattern(t))}getRowCount(t){return re(this.getTemplatePattern(t)).length||1}getGridTemplateRows(t){const i=this.getRowCount(t);return this.cardFitToContent?Array(i).fill("auto").join(" "):Array(i).fill("minmax(0, 1fr)").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplatePattern(this.cardLayout),"grid-template-columns":this.getGridTemplateColumns(this.cardLayout),"grid-template-rows":this.getGridTemplateRows(this.cardLayout)})}createDivAreaStyles(t){return t.map((t=>({display:"flex",overflow:"hidden","grid-area":t})))}getSlots(t){const s=this.createDivAreaStyles(t);return i(h,null,s.map(((t,s)=>i("div",{style:t},i("slot",{name:"card-slot-"+s})))))}extractSlotNames(t){return ae(t)}getTemplatePattern(t){return oe(t,this.cardCustomTemplate)}async getNumberOfSlot(t){const i=this.getTemplatePattern(t);return this.extractSlotNames(i).length}componentWillRender(){const t=this.cardLayout===se?le(this.cardCustomTemplate):void 0;t?this.errors.addOrReplace({id:"ERR_cardCustomTemplate",type:"warning",message:`cardCustomTemplate: ${t}`}):this.errors.remove("ERR_cardCustomTemplate")}setCardClass(){return!0===this.cardShowBorder?"card_box border":"card_box"}titleProp(t){return this.resolveInherited(t,this[t],"").value}prepareTitleImage(t){if(null==t||""===t)return"";const i=this.stores.assets.state;return t.startsWith("asset:")?i[t.substring(6)]:i[t]||t}render(){var t;const s=this.getLayoutStyle(),e=this.extractSlotNames(s["grid-template-areas"]);return i("bn-card",{key:"5356123d5ccb6a4d201b19f27b739d2e3738654c",styles:this.styles,"selected-style":this.selectedStyle,class:this.setCardClass()},i("div",{key:"2847a91836d59929ce6c14d934ec20f408159b0e",class:"cardtitle"},i("bn-title",{key:"54a7d3136ef39c616319001bf10575be3de787e6","i18n-namespace":null!==(t=this.i18nNamespace)&&void 0!==t?t:this.titleNamespace,ruleset:this.titleProp("ruleset"),"business-unit":this.titleBusinessUnit,scenarios:this.titleProp("titleScenarios"),variances:this.titleProp("titleVariances"),order:this.titleProp("titleOrder"),"order-direction":this.titleProp("titleOrderDirection"),measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),null!=this.titleImage&&""!==this.titleImage?i("img",{class:"image",src:this.prepareTitleImage(this.titleImage)}):""),i("bn-body",{key:"6109186cc1d27c73b38a5fd08db72373e0e147c4"},i("div",{key:"673e56a5d2a313a968c4d4e52e697f1f8590f265",style:s,"data-bn-fit-content":this.cardFitToContent?String(this.getRowCount(this.cardLayout)):null},this.getSlots(e))),i("bn-footer",{key:"d7788950df85f3babff77294ccadb6ea72490192",text:this.footerText,"page-number":"0","display-page-number":"false"}))}get element(){return e(this)}};ce.style=':host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden}.cardtitle{display:inline-flex}::slotted(*){flex:1 1 auto;min-width:0}.image{margin-right:0.5em;margin-top:0.5em;z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:inline}';const ue=class{constructor(i){t(this,i),this.messageText="",this.messageImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.footerDisplayPageNumber=!0,this.pageLayout="full",this.pageCustomTemplate='"a b" "c d"',this.pageGridGap="0",this.pageFitToContent=!1,a(this),this.errors=l(this)}getCommonStyles(){let t="100%";return!0===this.pageFitToContent&&(t="fit-content"),{display:"grid",height:t,width:"100%",gap:this.pageGridGap+"px"}}getRowCount(t){return re(this.getTemplateAreas(t)).length||1}getGridTemplateRows(t){const i=this.getRowCount(t);return this.pageFitToContent?Array(i).fill("auto").join(" "):Array(i).fill("minmax(0, 1fr)").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplateAreas(this.pageLayout),"grid-template-columns":this.getGridTemplateColumns(this.pageLayout),"grid-template-rows":this.getGridTemplateRows(this.pageLayout)})}createDivAreaStyles(t){return t.map((t=>({display:"flex",overflow:"hidden","grid-area":t})))}getSlots(t){const s=this.createDivAreaStyles(t);return i(h,null,s.map(((t,s)=>i("div",{style:t},i("slot",{name:"slot-"+s})))))}extractSlotNames(t){return ae(t)}getTemplateAreas(t){return oe(t,this.pageCustomTemplate)}getGridTemplateColumns(t){return(i=t)===se||ie.has(i)?he(this.getTemplateAreas(t)):"1fr";var i}async getNumberOfSlot(t){const i=this.getTemplateAreas(t);return this.extractSlotNames(i).length}mirror(t,i){null==i?this.element.hasAttribute(t)&&this.element.removeAttribute(t):this.element.getAttribute(t)!==i&&this.element.setAttribute(t,i)}componentWillRender(){this.mirror("page-format",this.pageFormat),this.mirror("page-orientation",this.pageOrientation);const t=this.pageLayout===se?le(this.pageCustomTemplate):void 0;t?this.errors.addOrReplace({id:"ERR_pageCustomTemplate",type:"warning",message:`pageCustomTemplate: ${t}`}):this.errors.remove("ERR_pageCustomTemplate")}rotation(){var t;const i=null===(t=this.element.closest("bn-context"))||void 0===t?void 0:t.getAttribute("render-orientation"),s=ps(this.pageFormat,this.pageOrientation,i);if(s.turned)return{host:{width:s.width,height:s.height},page:{transform:"rotate(-90deg) translate(-100%)",transformOrigin:"top left"}}}render(){var t;const e=this.getLayoutStyle(),n=this.extractSlotNames(e["grid-template-areas"]),r=this.rotation();return i(s,{key:"ab0aa5ecfd46b0cd8dfbf14d51adfc269c539e75",style:null==r?void 0:r.host},i("bn-page",{key:"fe6c5e57a982b1ac45215a9673e78e3b692e4877",styles:this.styles,"selected-style":this.selectedStyle,format:this.pageFormat,orientation:this.pageOrientation,style:null==r?void 0:r.page},i("bn-message",{key:"d8b71030848157c6ae53fa2923d89fd528946e6c",text:this.messageText,image:this.messageImage}),i("bn-title",{key:"77cca44524b0414868b953c83df711445bdf2d55","i18n-namespace":null!==(t=this.i18nNamespace)&&void 0!==t?t:this.titleNamespace,ruleset:this.ruleset,"business-unit":this.titleBusinessUnit,scenarios:this.titleScenarios,variances:this.titleVariances,order:this.titleOrder,"order-direction":this.titleOrderDirection,measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),i("bn-body",{key:"f701dd8428a20babaffff8410c76d8a3cc05f1e3"},i("div",{key:"379a923754c6517e9834a4ab9aed6b956c3593a8",style:e,"data-bn-fit-content":this.pageFitToContent?String(this.getRowCount(this.pageLayout)):null},this.getSlots(n))),i("bn-footer",{key:"a1373cbbd4a81c34d86d48a56d7bf1a9f5baa543",text:this.footerText,"page-number":this.pageNumber,"display-page-number":this.footerDisplayPageNumber})))}get element(){return e(this)}};ue.style=':host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:block;overflow:hidden}::slotted(*){flex:1 1 auto;min-width:0}';const de=class{constructor(i){t(this,i),a(this),this.errors=l(this),this.componentStyle=O(this)}connectedCallback(){this.stores=u(this.element)}getFontStyles(){return this.componentStyle((t=>{var i,s,e,n;return{"--bn-font-family":(null===(i=t.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(s=t.global)||void 0===s?void 0:s.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(e=t.global)||void 0===e?void 0:e.fontColor)||"#000000","--bn-font-background":(null===(n=t.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}prepareAssetUrl(t){if(null==t||""===t)return"";const i=this.stores.assets.state;return t.startsWith("asset:")?i[t.substring(6)]:i[t]||t}render(){return i(s,{key:"b9edc58322ef8a1932030f6e601a094c12905ef6",id:this.text||this.image?"container-page-message":"container",style:this.getFontStyles()},i("div",{key:"d7b93d754a4063534d8fe022511161715a4c595b",id:"message-text"},null!=this.text&&""!==this.text?i("span",{class:"note",innerHTML:ii(this.text)}):""),i("div",{key:"f140147c0ab1c9882eba74ec56e0ce011894eb6f",id:"page-image"},null!=this.image&&""!==this.image?i("img",{class:"image",src:this.prepareAssetUrl(this.image)}):""))}static get assetsDirs(){return["assets"]}get element(){return e(this)}};de.style=':host{padding:0.2em 0.5em;display:flex;flex-direction:row;justify-content:space-between;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}:host(#container-page-message){min-height:4.55em;box-sizing:border-box;-webkit-box-sizing:border-box;border-bottom:0.1em solid #ddd}div#message-text{font-size:1.4em;overflow:clip;display:inline}span.note p{margin:0}.image{z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:block}';const fe=class{constructor(i){t(this,i),a(this),this.errors=l(this),this.componentStyle=O(this)}validateFormat(t){const i="ERR_format";L(t)||us.includes(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`format: invalid value '${t}' is not supported. Valid values: ${us.join(", ")}`})}validateOrientation(t){const i="ERR_orientation";L(t)||ds.includes(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`orientation: invalid value '${t}' is not supported. Valid values: ${ds.join(", ")}`})}componentWillLoad(){this.validateFormat(this.format),this.validateOrientation(this.orientation)}render(){return i(s,{key:"81cbdaed9d6fc9325cab39fff23e7f588aa0aab0",format:this.format,orientation:this.orientation,style:this.prepareStyle()},i("slot",{key:"ba63b8dbed121cba3eb7e1a5bf5d3d496a030707"}))}prepareStyle(){const t={"font-family":this.componentStyle((t=>t.global.fontFamily)),"font-size":`${this.componentStyle((t=>t.global.fontSizePx))}px`,"--bn-font-family":this.componentStyle((t=>t.global.fontFamily))||"'Noto Sans', sans-serif","--bn-font-size":`${this.componentStyle((t=>t.global.fontSizePx))||13.3333}px`,"--bn-font-color":this.componentStyle((t=>t.global.fontColor))||"#000000","--bn-font-background":this.componentStyle((t=>t.global.fontBackgroundColor))||"#ffffff"};if(us.includes(this.format)){const{width:i,height:s}=fs(this.format,this.orientation);t.width=i,t.height=s}return t}get element(){return e(this)}static get watchers(){return{format:[{validateFormat:0}],orientation:[{validateOrientation:0}]}}};fe.style=':host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);height:768px;width:1024px;display:flex;flex-direction:column;page-break-after:always;overflow:hidden}';const pe=class{constructor(i){t(this,i),a(this),this.errors=l(this)}connectedCallback(){this.stores=u(this.element),this.pushToStore()}disconnectedCallback(){this.removeEntryIfOurs(this.storedName)}onNameChange(t,i){const s=null==i?void 0:i.toString().trim();s&&s!==(null==t?void 0:t.toString().trim())&&this.removeEntryIfOurs(s),this.pushToStore()}onValueChange(){this.pushToStore()}removeEntryIfOurs(t){t&&this.stores&&(this.storedName===t&&this.stores.scalingGroups.state[t]===this.storedValue&&this.stores.scalingGroups.set(t,void 0),this.storedName===t&&(this.storedName=void 0,this.storedValue=void 0))}pushToStore(){var t;if(!this.stores)return;const i=null===(t=this.name)||void 0===t?void 0:t.toString().trim(),s=si(i);if("auto"===s.kind)return void this.errors.addOrReplace({id:"ERR_reserved_name",type:"warning",message:'bn-scaling-group: name "auto" is reserved and cannot be used.'});if(this.errors.remove("ERR_reserved_name"),!i)return void this.errors.addOrReplace({id:"ERR_empty_name",type:"warning",message:"bn-scaling-group: name is required."});if(this.errors.remove("ERR_empty_name"),"number"===s.kind)return void this.errors.addOrReplace({id:"ERR_numeric_name",type:"warning",message:`bn-scaling-group: name "${i}" is not allowed - it would be ambiguous with a numeric scaling value.`});this.errors.remove("ERR_numeric_name");const e=si(this.value);if("number"!==e.kind)return void this.errors.addOrReplace({id:"ERR_invalid_value",type:"warning",message:`bn-scaling-group: invalid value "${this.value}" - must be a positive number, optionally with k/M/G/T suffix.`});this.errors.remove("ERR_invalid_value");const n=this.stores.scalingGroups.state[i];void 0===n||n===e.value||this.storedName===i&&this.storedValue===n?this.errors.remove("WARN_duplicate_group"):this.errors.addOrReplace({id:"WARN_duplicate_group",type:"warning",message:`bn-scaling-group: "${i}" is already registered with a different value (${Zt(n)}); overwriting.`}),this.storedName&&this.storedName!==i&&this.removeEntryIfOurs(this.storedName),this.stores.scalingGroups.set(i,e.value),this.storedName=i,this.storedValue=e.value}render(){return i(s,{key:"ffdeed9b4a44d43a51950fd400325a5298468f34"})}get element(){return e(this)}static get watchers(){return{name:[{onNameChange:0}],value:[{onValueChange:0}]}}};var ve,ge,me,be,ye;pe.style="bn-scaling-group{display:none}",function(t){t[t.ALL=-1]="ALL"}(ve||(ve={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(ge||(ge={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(me||(me={})),function(t){t.ASC="asc",t.DESC="desc"}(be||(be={})),function(t){t.HEADER="HEADER",t.GROUPHEAD="GROUPHEAD",t.SEPERATORLINE="SEPERATORLINE",t.SUM="SUM",t.GROUPSUM="GROUP_SUM",t.DRILLELEMENT="DRILLELEMENT",t.STANDARD="STANDARD",t.PARTELEMENT="PARTELEMENT",t.ENTRY="ENTRY"}(ye||(ye={}));const we="none",xe="setname";function Se(t){return t===xe?"COALESCE([setname],[setName])":`normalizeDate([date], '${t}')`}function $e(t){if(null==t)return"";if("string"==typeof t)return t.trim();const i=Me(t);return i?i.toISO():String(t)}function Me(t){if(null!=t){if("string"==typeof t){const i=y.fromISO(t,{zone:"utc"});return i.isValid?i:void 0}if("number"==typeof t){const i=y.fromMillis(t,{zone:"utc"});return i.isValid?i:void 0}if("boolean"==typeof t.isValid)return t.isValid?t:void 0}}const _e=class{validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(i){t(this,i),this.layoutObserver=null,this._lastScaledParentWidth=0,this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.hasBlankSetnames=!1,this.sumTitle="",this.filter="",this.measureUnit="",this.barColumnWidth="w10",this.unitScaling="100",this.percentageScaling="2",this.pixelPerUnitGroupMap=new Map,this.dataFormat="decimal",this.grouped="false",this.showMeasureScale="false",this.showGroupTitle="true",this.type="list",this.limit=0,this.thereof="[]",this.partof="[]",this.order="category",this.orderDirection="asc",this.measureType="volume",this.measureScale="greatest",this.dataFormatDigitsDecimal=1,this.dataFormatDigitsPercent=2,this.categoryWidth="w15",this.columnthereof=null,this.interval="none",this.tableAttributes="",this._autoScaleGuard=!1,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=t=>{var i,s,e,n;this.lastAutoScalingReport={unit:null!==(i=t.unit)&&void 0!==i?i:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(e=t.percentage)&&void 0!==e?e:null===(n=this.lastAutoScalingReport)||void 0===n?void 0:n.percentage};const r=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t);if(void 0!==t.unit&&t.unit>0&&this.autoUnitWarningActive){const i=1/t.unit;r(i,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=i,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: invalid value "${this.unitScaling}" - auto-fitted to 1 em ≈ ${Zt(i)} units.`}))}if(void 0!==t.percentage&&t.percentage>0&&this.autoPctWarningActive){const i=1/t.percentage;r(i,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=i,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: invalid value "${this.percentageScaling}" - auto-fitted to 1 em ≈ ${Zt(i)} percentage points.`}))}},A(this),a(this),this.errors=l(this),yi(this),this.componentStyle=O(this),this.ruleSetConfig=bi(this),Jt(this,((t,i)=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1,this.hasBlankSetnames=Array.isArray(i)&&i.some((t=>{var i;return L(null!==(i=null==t?void 0:t.setname)&&void 0!==i?i:null==t?void 0:t.setName)}))}),((t,i)=>{this.datasetMeta=i})),this.t=qt(this).t,this.resolveInherited=ti(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}],this.errors)}validateFilter(t){const i="ERR_filter";p(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateScenario(t){const i="ERR_scenarios";if(Ht(t))return void this.errors.remove(i);const s=j(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+(null==s?void 0:s.toString())+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(Ht(t))return void this.errors.remove(i);const s=I(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validateBarColumns(t){const i="ERR_barColumns";if(L(t))return void this.errors.remove(i);const s=rt(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"barColumns: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validateBarColumnWidth(t){const i="ERR_barColumnWidth";ot(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"barColumnWidth: invalid value '"+t+"' is not supported."})}validateUnitScaling(t){const i="ERR_unitScaling";"invalid"===Qt(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value '"+t+"' is not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="ERR_percentageScaling";"invalid"===Qt(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value '"+t+"' is not supported."}):this.errors.remove(i)}validateDataFormat(t){const i="ERR_dataFormat";ht(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormat: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateGrouped(t){const i="ERR_grouped";B(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"grouped: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateShowMeasureScale(t){const i="ERR_showMeasureScale";B(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateShowGroupTitle(t){const i="ERR_showGroupTitle";B(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showGroupTitle: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateType(t){const i="ERR_type";at(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"type: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateLimit(t){const i="ERR_limit";T(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateThereOf(t){const i="ERR_thereof",s=lt(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"ThereOf: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validatePartOf(t){const i="ERR_partof",s=ct(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"partof: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validateOrderList(t){const i="ERR_order";if(Ht(t))return void this.errors.remove(i);const s=D(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";Ht(t)||U(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateMeasureType(t){const i="ERR_measureType";ut(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureType: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateMeasureScale(t){const i="ERR_measureScale";H(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateDataFormatDigitsDecimal(t){const i="ERR_dataFormatDigitsDecimal";T(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormatDigitsDecimal: invalid value(s) '"+t+"' are not supported."})}validateDateFormatDigitsPercent(t){const i="ERR_dataFormatDigitsPercent";T(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormatDigitsPercent: invalid value(s) '"+t+"' are not supported."})}validateCategoryWidth(t){const i="ERR_categoryWidth";dt(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"categoryWidth: invalid value(s) '"+t+"' are not supported."})}validateColumnThereOf(t){const i=ft(t),s="ERR_categorythereof";i.length>0?this.errors.addOrReplace({id:s,type:"warning",message:"columnthereof: invalid value(s) '"+JSON.stringify(i)+"' are not supported."}):this.errors.remove(s)}validateInterval(t){const i="ERR_interval",s=null==t?void 0:t.trim().toLowerCase();L(t)||s===we||s===xe||Q(s)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"interval: invalid value '"+t+"' is not supported."})}validateTableAttributes(t){const i="ERR_attributes",s=pt(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"attributes: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}componentWillLoad(){this.validateFilter(this.filter),this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateDataFormat(this.dataFormat),this.validateGrouped(this.grouped),this.validateShowGroupTitle(this.showGroupTitle),this.validateType(this.type),this.validateLimit(this.limit),this.validateThereOf(this.thereof),this.validatePartOf(this.partof),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal),this.validateDateFormatDigitsPercent(this.dataFormatDigitsPercent),this.validateCategoryWidth(this.categoryWidth),this.validateMeasureType(this.measureType),this.validateMeasureScale(this.measureScale),this.validateColumnThereOf(this.columnthereof),this.validateInterval(this.interval),this.validateTableAttributes(this.tableAttributes),this.validateShowMeasureScale(this.showMeasureScale),this.validateBarColumns(this.barColumns),this.validateBarColumnWidth(this.barColumnWidth),this.validateUnitScaling(this.unitScaling),this.validatePercentageScaling(this.percentageScaling),this.validateScaling(this.scale)}componentDidLoad(){this.layoutObserver=mi(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=Yt(this.element);t>0&&Math.abs(t-this._lastScaledParentWidth)>2&&(this._lastScaledParentWidth=t,n(this))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}componentDidRender(){zi(this.element,"ibcs-table");const{mode:t}=Kt(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const i=this.element,{width:s}=Yt(i);if(s<=0)return void this.checkOverflow();this._lastScaledParentWidth=s;const e=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),n=i.scrollWidth,o=this.appliedScaleFactor;if(n<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const h=Math.max(.3,o*(s-1)/n);Math.abs(h-o)<.001||(i.style.setProperty("--bn-font-size",e*h+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled table by factor ${h.toFixed(3)}`}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,r((()=>{this.appliedScaleFactor=h}))),this.checkOverflow()}checkOverflow(){const t="WARN_overflow",i=Yt(this.element),s=this.element.scrollWidth,e=this.element.scrollHeight,n=i.width>0&&s>i.width+1,r=i.height>0&&e>i.height+1;if(!n&&!r)return void this.errors.remove(t);const{mode:o}=Kt(this.scale),h="auto"!==o&&"empty"!==o,a=[];n&&a.push(`width (${Math.round(s)}px > ${Math.round(i.width)}px)`),r&&a.push(`height (${Math.round(e)}px > ${Math.round(i.height)}px)`),this.errors.addOrReplace({id:t,type:h?"error":"warning",message:`Table exceeds available ${a.join(" and ")}. Give the component more space, reduce rows (e.g. limit), or set a smaller scale.`})}prepareDataFormat(){var t;return vt[null===(t=this.dataFormat)||void 0===t?void 0:t.toUpperCase()]}prepareGrouped(){return"true"===this.grouped}prepareShowGroupTitle(){return"true"===this.showGroupTitle}prepareTableType(){var t;return me[null===(t=this.type)||void 0===t?void 0:t.toUpperCase()]}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareThereOf(){if(null==this.thereof||""===this.thereof.trim())return[];try{return JSON.parse(this.thereof)}catch(t){return[]}}preparePartOf(){if(null==this.partof||""===this.partof.trim())return[];try{return JSON.parse(this.partof)}catch(t){return[]}}prepareOrder(){var t;const i=this.resolveInherited("order",this.order,"category").value,s=this.resolveInherited("orderDirection",this.orderDirection,"asc").value,e="auto"===(null==i?void 0:i.trim().toLowerCase());let n=i;return e&&(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)&&(n=this.datasetMeta.suggestedOrder),{hierarchy:n.split(",").map((t=>G[null==t?void 0:t.toUpperCase()])),direction:F[null==s?void 0:s.toUpperCase()]}}prepareI18nMode(){return gt.META}prepareI18n(){const t=v,i=new Map(["in","category","operation","there_of","part_of","SUM_TOTAL","no-data","REST"].map((t=>[t,this.t(".".concat(t))]))),s=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...s.entries(),...i.entries()])}prepareDataFormatDigits(){return{percent:this.dataFormatDigitsPercent,decimal:this.dataFormatDigitsDecimal}}prepareScenarios(){var t,i,s,e,n,r,o,h,a,l,c;const u=this.resolveInherited("scenarios",this.scenarios),d=this.resolveInherited("variances",this.variances);if(u.inherited||d.inherited){this.errors.remove("AUTO_scenarios");let e=[];return L(u.value)?u.unresolved&&(e=e.concat(null!==(i=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==i?i:[])):e=e.concat(u.value.split(",")),(null===(s=d.value)||void 0===s?void 0:s.trim().length)>0&&(e=e.concat(d.value.split(","))),e.map((t=>t.trim()))}const f="auto"===(null===(e=u.value)||void 0===e?void 0:e.trim().toLowerCase()),p=f||u.unresolved;if((L(u.value)||f)&&L(d.value))return(null===(r=null===(n=this.datasetMeta)||void 0===n?void 0:n.availableScenarios)||void 0===r?void 0:r.length)>0?(p?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:`scenarios: not set, auto-detected: ${this.datasetMeta.availableScenarios.join(",")}`}),this.datasetMeta.availableScenarios):[];let v=[];return f||L(u.value)?(null===(h=null===(o=this.datasetMeta)||void 0===o?void 0:o.availableScenarios)||void 0===h?void 0:h.length)>0&&(p?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:`scenarios: not set, auto-detected: ${this.datasetMeta.availableScenarios.join(",")}`}),v=v.concat(this.datasetMeta.availableScenarios)):(this.errors.remove("AUTO_scenarios"),v=v.concat(null===(a=u.value)||void 0===a?void 0:a.split(","))),(null===(l=d.value)||void 0===l?void 0:l.trim().length)>0&&(v=v.concat(null===(c=d.value)||void 0===c?void 0:c.split(","))),v.map((t=>t.trim()))}prepareCategoryWidth(){var t;return L(this.categoryWidth)?mt.INF:mt[null===(t=this.categoryWidth)||void 0===t?void 0:t.toUpperCase()]}prepareMeasureScale(){return L(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareMeasureType(){var t;return L(this.measureType)?bt.VOLUME:bt[null===(t=this.measureType)||void 0===t?void 0:t.toUpperCase()]}prepareColumnThereOf(){if(null==this.columnthereof||""===this.columnthereof.trim())return new Map;const t=new Map;try{const i=JSON.parse(this.columnthereof);for(const[s,e]of Object.entries(i))!1===t.has(e.scenario)&&t.set(e.scenario,[]),t.get(e.scenario).push(e)}catch(t){return new Map}return t}prepareInterval(){var t;const i="ERR_intervalConflict",s="ERR_intervalNoDate",e="ERR_intervalSetname",n=L(this.interval)?we:this.interval.trim().toLowerCase();return n!==we&&n!==xe&&!Q(n)||n===we?(this.errors.remove(i),this.errors.remove(s),this.errors.remove(e),we):null!=this.columnthereof&&""!==this.columnthereof.trim()?(this.errors.addOrReplace({id:i,type:"warning",message:"interval: cannot be combined with columnthereof, interval is ignored."}),this.errors.remove(s),this.errors.remove(e),we):(this.errors.remove(i),n===xe?(this.hasBlankSetnames?this.errors.addOrReplace({id:e,type:"warning",message:"interval: rows with blank setname found, they are grouped under '-'."}):this.errors.remove(e),this.errors.remove(s),xe):(this.errors.remove(e),this.datasetMeta&&!(null===(t=this.datasetMeta.dateRange)||void 0===t?void 0:t.hasData)?(this.errors.addOrReplace({id:s,type:"warning",message:"interval: dataset has no date values, interval is ignored."}),we):(this.errors.remove(s),n)))}prepareAttributes(){if(null==this.tableAttributes||""===this.tableAttributes.trim())return[];try{const t=JSON.parse(this.tableAttributes);return null===t||"object"!=typeof t||t instanceof Array?[]:Object.entries(t).map((([t,i],s)=>"string"==typeof i?yt(t,`attr_${s}`,i):null)).filter((t=>null!==t))}catch(t){return[]}}prepareSumTitle(){return""===this.sumTitle||null==this.sumTitle?"SUM_TOTAL":this.sumTitle}prepareShowMeasureScale(){return"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareBarColumnWidth(){var t;const i=null===(t=this.barColumnWidth)||void 0===t?void 0:t.toUpperCase(),s=xt[i];return s?wt[s]:wt[xt.W10]}prepareBarColumns(){return L(this.barColumns)?[]:this.barColumns.split(",").map((t=>t.trim()))}prepareUnitScaling(){const t=Qt(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===t.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,1/t.value):"auto"===t.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,0):(this.autoUnitWarningActive=!0,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: invalid value "${t.raw}" - auto-fitting to the bar column width.`}),0)}preparePercentageScaling(){const t=Qt(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===t.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,1/t.value):"auto"===t.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,0):(this.autoPctWarningActive=!0,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: invalid value "${t.raw}" - auto-fitting to the pin area.`}),0)}getDataStructure(){return{ITableDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}async getLayoutState(t){var i,s,e,n;const r=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",o=Ft(this.element),h=this.getEffectiveScaleFactor(),a=Number.isFinite(h)&&h>0?h:1,l=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*a,c={version:It,tag:this.element.localName,id:zt(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:Ut(this.element,o),em:{fontSizePx:l,appliedScaleFactor:a},regions:[],metadata:{},diagnostics:Dt(this.element),scaling:this.resolveScalingInfo(l)},u=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("ibcs-table");if(u){const t=null!==(n=u.scenarios)&&void 0!==n?n:[];if(c.metadata.scenarios=t.filter((t=>!t.startsWith("d"))),c.metadata.variances=t.filter((t=>t.startsWith("d"))),"function"==typeof u.getLayoutDetail){const t=await u.getLayoutDetail(o,r);c.regions=t.regions,c.metadata=Object.assign(Object.assign({},c.metadata),t.metadata),c.diagnostics=[...c.diagnostics,...t.diagnostics],t.elements&&(c.elements=t.elements),t.table&&(c.table=t.table)}}return c}resolveScalingInfo(t){var i,s;const e={},n=Qt(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===n.kind)e.unitMode="fixed",e.unitsPerEm=n.value,e.unitPxPerUnit=t/n.value;else{e.unitMode="auto";const s=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==s&&s>0&&(e.unitsPerEm=1/s,e.unitPxPerUnit=s*t)}const r=Qt(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===r.kind)e.percentageMode="fixed",e.percentagePointsPerEm=r.value,e.percentagePxPerPoint=t/r.value;else{e.percentageMode="auto";const i=null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.percentage;void 0!==i&&i>0&&(e.percentagePointsPerEm=1/i,e.percentagePxPerPoint=i*t)}return e}getEffectiveScaleFactor(){const{mode:t,factor:i}=Kt(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var s,e,n,r;const o=(null===(s=i.global)||void 0===s?void 0:s.fontSizePx)||13.3333;return{"--bn-font-family":(null===(e=i.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":o*t+"px","--bn-font-color":(null===(n=i.global)||void 0===n?void 0:n.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles(),e=this.getEffectiveScaleFactor();return i(s,{key:"ba76b60711ca2b8fb83226d3473aefdc394036f8",style:t},i("div",{key:"425f6a33db9d0baffd4edcffe4a986b4e114886c"},i("ibcs-table",{key:"4b7c445d24314f515a1432e88f54ec4b52bd76d2",tableName:this.datasetName,dataVersion:this.dataVersion,sumTitle:this.prepareSumTitle(),scenarios:this.prepareScenarios(),scenariosDataFormat:this.prepareDataFormat(),grouped:this.prepareGrouped(),limit:this.prepareLimit(),showGroupTitle:this.prepareShowGroupTitle(),thereof:this.prepareThereOf(),partof:this.preparePartOf(),order:this.prepareOrder(),categorythereof:this.prepareColumnThereOf(),attributeColumns:this.prepareAttributes(),type:this.prepareTableType(),categoryWidth:this.prepareCategoryWidth(),dataFormatDigits:this.prepareDataFormatDigits(),i18n:this.prepareI18n(),i18nMode:this.prepareI18nMode(),measureScale:this.prepareMeasureScale(),measureType:this.prepareMeasureType(),measureUnit:this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(),filter:this.prepareFilter(),barColumns:this.prepareBarColumns(),interval:this.prepareInterval(),barColumnMaxWidth:this.prepareBarColumnWidth(),unitScaling:this.prepareUnitScaling(),percentageScaling:this.preparePercentageScaling(),reportAutoScaling:this.handleAutoScalingReport,errors:this.errors,scaleFactor:e,ruleSetConfig:this.ruleSetConfig(),selectedStyle:this.selectedStyle})))}get element(){return e(this)}static get watchers(){return{scale:[{validateScaling:0}],filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],barColumns:[{validateBarColumns:0}],barColumnWidth:[{validateBarColumnWidth:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dataFormat:[{validateDataFormat:0}],grouped:[{validateGrouped:0}],showMeasureScale:[{validateShowMeasureScale:0}],showGroupTitle:[{validateShowGroupTitle:0}],type:[{validateType:0}],limit:[{validateLimit:0}],thereof:[{validateThereOf:0}],partof:[{validatePartOf:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],measureType:[{validateMeasureType:0}],measureScale:[{validateMeasureScale:0}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDateFormatDigitsPercent:0}],categoryWidth:[{validateCategoryWidth:0}],columnthereof:[{validateColumnThereOf:0}],interval:[{validateInterval:0}],tableAttributes:[{validateTableAttributes:0}]}}};_e.style=':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}';const Re=class{constructor(i){t(this,i),this.businessUnit="",this.order="category",this.orderDirection="asc",this.dateFormat="none",this.dateLink="none",A(this),a(this),this.t=qt(this).t,this.errors=l(this),this.componentStyle=O(this),this.ruleSetConfig=bi(this)}validateScenario(t){const i="ERR_scenarios",s=j(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+(null==s?void 0:s.toString())+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances",s=I(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+(null==s?void 0:s.toString())+"' are not supported."}):this.errors.remove(i)}validateOrder(t){const i=D(t),s="ERR_order";i.length>0?this.errors.addOrReplace({id:s,type:"warning",message:"order: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."}):this.errors.remove(s)}validateOrderDirection(t){const i="ERR_orderDirection";U(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateMeasures(t){const i="ERR_measures",s=St(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"measures: invalid value(s) '"+(null==s?void 0:s.toString())+'\' are not supported. Valid format example: [{"name": "Bruttoumsatz", "unit": "mEUR"}]'}):this.errors.remove(i)}validateDateStart(t){const i="ERR_dateStart";$t(t)||L(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateStart: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateDateEnd(t){const i="ERR_dateEnd";$t(t)||L(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateStart: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateDateFormat(t){const i="ERR_dateFormat";Q(t)||L(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateFormat: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateDateLink(t){const i="ERR_dateLink";Mt(t)||L(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateLink: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateMeasures(this.measures),this.validateDateStart(this.dateStart),this.validateDateEnd(this.dateEnd),this.validateDateFormat(this.dateFormat),this.validateDateLink(this.dateLink),this.validateOrderDirection(this.orderDirection),this.validateOrder(this.order)}prepareI18n(){const t=v,i=new Map(["SEPERATOR_WS","in","CONNECTOR_WS"].map((t=>[t,this.t(".".concat(t))]))),s=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...s.entries(),...i.entries()])}prepareI18nMode(){return gt.META}prepareLocale(){return u(this.element).context.state.locale||"de"}prepareTitleOrder(){var t;return L(this.order)||L(this.orderDirection)?null:{hierarchy:this.order.split(",").map((t=>t.trim())),direction:F[null===(t=this.orderDirection)||void 0===t?void 0:t.toUpperCase()]}}prepareTitleTimePeriod(){var t,i;return L(this.dateStart)&&L(this.dateEnd)||L(this.dateLink)?null:{start:y.fromISO(this.dateStart,{zone:"utc"}),end:y.fromISO(this.dateEnd,{zone:"utc"}),format:tt[null===(t=this.dateFormat)||void 0===t?void 0:t.toUpperCase()],link:_t[null===(i=this.dateLink)||void 0===i?void 0:i.toUpperCase()]}}prepareMeasures(){if(L(this.measures))return[];try{return JSON.parse(this.measures)}catch(t){return[]}}prepareScenarios(){var t,i,s,e;if(L(this.scenarios)&&L(this.variances))return[];let n=[];return(null===(t=this.scenarios)||void 0===t?void 0:t.trim().length)>0&&(n=n.concat(null===(i=this.scenarios)||void 0===i?void 0:i.split(","))),(null===(s=this.variances)||void 0===s?void 0:s.trim().length)>0&&(n=n.concat(null===(e=this.variances)||void 0===e?void 0:e.split(","))),n.map((t=>t.trim()))}prepareBusinessUnit(){return L(this.businessUnit)||"null"===this.businessUnit?null:this.businessUnit}getFontStyles(){return this.componentStyle((t=>{var i,s,e,n;return{"--bn-font-family":(null===(i=t.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(s=t.global)||void 0===s?void 0:s.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(e=t.global)||void 0===e?void 0:e.fontColor)||"#000000","--bn-font-background":(null===(n=t.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles();return i(s,{key:"542f7c564c8675dd7a493fc697a65a308601321f",style:t},i("ibcs-title",{key:"aea2b5c0395d68a2d2cb947aa0284e0d0d7c4787",businessUnit:this.prepareBusinessUnit(),scenarios:this.prepareScenarios(),measures:this.prepareMeasures(),timeperiod:this.prepareTitleTimePeriod(),order:this.prepareTitleOrder(),i18n:this.prepareI18n(),"i18n-mode":this.prepareI18nMode(),locale:this.prepareLocale(),ruleSetConfig:this.ruleSetConfig()}))}get element(){return e(this)}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],measures:[{validateMeasures:0}],dateStart:[{validateDateStart:0}],dateEnd:[{validateDateEnd:0}],dateFormat:[{validateDateFormat:0}],dateLink:[{validateDateLink:0}]}}};Re.style=':host{padding:0.5em;margin-bottom:0.5em;box-sizing:border-box;-webkit-box-sizing:border-box;width:100%;display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}';const Oe=["*","/","+","-","x","÷","none"];function ke(t){switch(t){case"*":case"x":return"×";case"/":case"÷":return"÷";case"+":return"+";case"-":return"−";default:return""}}function Ee(t,i,s){return t.find((t=>t.from===i&&t.to===s))}function Le(t){return 2*(t-1)+1}function Te(t){return 2*(t-1)+1}function Ae(t){return t<=1?1:2*(t-1)+1}function Ce(t,i){const s=t.getBoundingClientRect(),e=s.left-i.left,n=s.top-i.top;return{left:e,top:n,width:s.width,height:s.height,centerX:e+s.width/2,centerY:n+s.height/2}}function Pe(t,i,s){switch(s){case"ltr":return i?{x:t.left+t.width,y:t.centerY}:{x:t.left,y:t.centerY};case"rtl":return i?{x:t.left,y:t.centerY}:{x:t.left+t.width,y:t.centerY};case"ttb":return i?{x:t.centerX,y:t.top+t.height}:{x:t.centerX,y:t.top};case"btt":return i?{x:t.centerX,y:t.top}:{x:t.centerX,y:t.top+t.height}}}function Ne(t,i,s,e,n=8){const r=-(e-1)*n/2+s*n;switch(i){case"ltr":return{x:t.left,y:t.centerY+r};case"rtl":return{x:t.left+t.width,y:t.centerY+r};case"ttb":return{x:t.centerX+r,y:t.top};case"btt":return{x:t.centerX+r,y:t.top+t.height}}}function De(t,i,s,e,n){switch(s){case"straight":return function(t,i){return{path:`M ${t.x} ${t.y} L ${i.x} ${i.y}`,midpoint:{x:(t.x+i.x)/2,y:(t.y+i.y)/2}}}(t,i);case"curved":return function(t,i,s){let e,n;if("ltr"===s||"rtl"===s){const s=(t.x+i.x)/2;e={x:s,y:t.y},n={x:s,y:i.y}}else{const s=(t.y+i.y)/2;e={x:t.x,y:s},n={x:i.x,y:s}}return{path:`M ${t.x} ${t.y} C ${e.x} ${e.y}, ${n.x} ${n.y}, ${i.x} ${i.y}`,midpoint:{x:.125*t.x+.375*e.x+.375*n.x+.125*i.x,y:.125*t.y+.375*e.y+.375*n.y+.125*i.y}}}(t,i,e);default:return function(t,i,s,e){let n,r;if("ltr"===s||"rtl"===s){const s=null!=e?e:t.x+.7*(i.x-t.x);n=`M ${t.x} ${t.y} L ${s} ${t.y} L ${s} ${i.y} L ${i.x} ${i.y}`,r={x:s,y:(t.y+i.y)/2}}else{const s=null!=e?e:t.y+.7*(i.y-t.y);n=`M ${t.x} ${t.y} L ${t.x} ${s} L ${i.x} ${s} L ${i.x} ${i.y}`,r={x:(t.x+i.x)/2,y:s}}return{path:n,midpoint:r}}(t,i,e,n)}}function Ue(t,i,s){let e,n,r;switch(s){case"ltr":e=t.left+t.width,n=i.map((t=>t.left)),r=1;break;case"rtl":e=t.left,n=i.map((t=>t.left+t.width)),r=-1;break;case"ttb":e=t.top+t.height,n=i.map((t=>t.top)),r=1;break;case"btt":e=t.top,n=i.map((t=>t.top+t.height)),r=-1}const o=n.map((t=>(t-e)*r)).filter((t=>t>=0));if(0!==o.length)return e+Math.min(...o)*r*.7}function ze(t,i,s,e){return"ltr"===e||"rtl"===e?{x:t,y:(i.centerY+s.centerY)/2}:{x:(i.centerX+s.centerX)/2,y:t}}function Fe(t,i,s){var e,n;return Object.assign({stroke:null!==(e=null==s?void 0:s.color)&&void 0!==e?e:t,strokeWidth:null!==(n=null==s?void 0:s.width)&&void 0!==n?n:i},(null==s?void 0:s.dasharray)?{strokeDasharray:s.dasharray}:{})}const We=class{validateEdgesProp(t){const i="ERR_edges",s=function(t){const i=[];if(!t||""===t.trim())return i.push("edges: value is required"),i;let s;try{s=JSON.parse(t)}catch(t){return i.push("edges: invalid JSON structure"),i}if(!Array.isArray(s))return i.push("edges: must be an array"),i;if(0===s.length)return i.push("edges: array must not be empty"),i;const e=new Set,n=new Set,r=new Map;s.forEach(((t,s)=>{if("object"!=typeof t||null===t)return void i.push(`edges[${s}]: must be an object`);const o=t;if("string"!=typeof o.from||""===o.from.trim()?i.push(`edges[${s}]: 'from' is required and must be a non-empty string`):e.add(o.from),"string"!=typeof o.to||""===o.to.trim()?i.push(`edges[${s}]: 'to' is required and must be a non-empty string`):(e.add(o.to),n.add(o.to),"string"==typeof o.from&&r.set(o.from,[...r.get(o.from)||[],o.to])),void 0!==o.operator&&("string"==typeof o.operator&&Oe.includes(o.operator)||i.push(`edges[${s}]: 'operator' must be one of: ${Oe.join(", ")}`)),void 0!==o.label&&"string"!=typeof o.label&&i.push(`edges[${s}]: 'label' must be a string`),void 0!==o.style)if("object"!=typeof o.style||null===o.style)i.push(`edges[${s}]: 'style' must be an object`);else{const t=o.style;void 0!==t.color&&"string"!=typeof t.color&&i.push(`edges[${s}]: 'style.color' must be a string`),void 0!==t.width&&"number"!=typeof t.width&&i.push(`edges[${s}]: 'style.width' must be a number`),void 0!==t.dasharray&&"string"!=typeof t.dasharray&&i.push(`edges[${s}]: 'style.dasharray' must be a string`)}}));const o=Array.from(e).filter((t=>!n.has(t)));return 0===o.length?i.push("edges: tree has no root node (circular reference detected)"):o.length>1?i.push(`edges: tree has multiple root nodes: ${o.join(", ")}`):i.push(...function(t,i,s){const e=[],n=new Set,r=new Set,o=t=>{r.add(t),n.add(t);for(const s of i.get(t)||[])n.has(s)?e.push(`edges: circular reference, the edge from '${t}' to '${s}' leads back`):r.has(s)||o(s);n.delete(t)};o(t);const h=Array.from(s).filter((t=>!r.has(t)));return h.length>0&&e.push(`edges: nodes not connected to the root '${t}': ${h.join(", ")}`),e}(o[0],r,e)),i}(t);s.length>0?(this.errors.addOrReplace({id:i,type:"error",message:`edges: ${s.join("; ")}`}),this.treeConfig=null):(this.errors.remove(i),this.treeConfig=function(t){if(!t||""===t.trim())return null;try{const i=JSON.parse(t);if(!Array.isArray(i))return null;const s=i,e=function(t){const i=new Map;for(const s of t){const t=i.get(s.from)||[];t.push(s.to),i.set(s.from,t)}return i}(s),n=function(t){const i=new Set;for(const s of t)i.add(s.from),i.add(s.to);return i}(s),r=function(t,i){const s=new Set;for(const i of t)s.add(i.to);const e=Array.from(i).filter((t=>!s.has(t)));return 1===e.length?e[0]:null}(s,n);return{edges:s,adjacencyList:e,rootNode:r,allNodes:n}}catch(t){return console.error("parseTreeConfig: failed to parse tree configuration",t),null}}(t)),this.recalculateLayout()}validateDirection(t){const i="ERR_direction",s=["ltr","rtl","ttb","btt"];s.includes(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`direction: invalid value '${t}', must be one of: ${s.join(", ")}`}),this.recalculateLayout()}validateLevelSpacing(t){const i="ERR_levelSpacing";!K(t)||t<0?this.errors.addOrReplace({id:i,type:"warning",message:`level-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(i),this.recalculateLayout()}validateNodeSpacing(t){const i="ERR_nodeSpacing";!K(t)||t<0?this.errors.addOrReplace({id:i,type:"warning",message:`node-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(i),this.recalculateLayout()}validateEdgeStyle(t){const i="ERR_edgeStyle",s=["straight","orthogonal","curved"];s.includes(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`edge-style: invalid value '${t}', must be one of: ${s.join(", ")}`})}validateShowOperators(t){const i="ERR_showOperators";B(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`show-operators: invalid value '${t}', must be 'true' or 'false'`})}constructor(i){t(this,i),this.treeConfig=null,this.layout=null,this.nodeRects=new Map,this.svgWidth=0,this.svgHeight=0,this.resizeObserver=null,this.gridContainer=null,this.observed=new Set,this.parentObserver=null,this.direction="ltr",this.levelSpacing=60,this.nodeSpacing=20,this.edgeStyle="orthogonal",this.showOperators="true",A(this),a(this),this.errors=l(this),this.componentStyle=O(this)}async getLayoutState(t){var i,s,e,n,r,o,h,a,l,c,u;const d=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",f=Ft(this.element),p=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),v={version:It,tag:this.element.localName,id:zt(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:Ut(this.element,f),em:{fontSizePx:p,appliedScaleFactor:1},regions:[],metadata:{nodeCount:null!==(n=null===(e=this.treeConfig)||void 0===e?void 0:e.allNodes.size)&&void 0!==n?n:0,edgeCount:null!==(o=null===(r=this.treeConfig)||void 0===r?void 0:r.edges.length)&&void 0!==o?o:0},diagnostics:Dt(this.element)},g=null===(h=this.element.shadowRoot)||void 0===h?void 0:h.querySelector(".tree-grid");if(g&&v.regions.push({id:"grid",rect:Ut(g,f)}),"full"!==d||!this.treeConfig)return v;const m=[];for(const t of this.treeConfig.allNodes){const i=this.element.querySelector(`[slot="${t}"]`);if(!i)continue;const s={kind:"node",nodeId:t,rect:Ut(i,f)};m.push(s)}const b=Array.from(null!==(l=null===(a=this.element.shadowRoot)||void 0===a?void 0:a.querySelectorAll("svg.edge-layer path"))&&void 0!==l?l:[]);let y=0;for(const t of this.treeConfig.edges){if(!this.nodeRects.get(t.from)||!this.nodeRects.get(t.to))continue;const i=b[y++];if(!i)break;const s={kind:"edge",from:t.from,to:t.to,operator:t.operator,path:null!==(c=i.getAttribute("d"))&&void 0!==c?c:void 0,rect:Ut(i,f)};m.push(s)}return null===(u=this.element.shadowRoot)||void 0===u||u.querySelectorAll("svg.edge-layer g.operator-group").forEach((t=>{var i,s;const e=null!==(s=null===(i=t.textContent)||void 0===i?void 0:i.trim())&&void 0!==s?s:"";if(!e)return;const n={kind:"label",role:"operator",text:e,rect:Ut(t,f)};m.push(n)})),v.elements=m,v}getTreeStyle(){return this.componentStyle((t=>({edgeColor:t["bn-tree"].edgeColor,edgeWidth:t["bn-tree"].edgeWidth,operatorCircleRadius:t["bn-tree"].operatorCircleRadius,operatorFontSize:t.global.fontSizePx*t["bn-tree"].operatorFontSizeScale,operatorColor:t["bn-tree"].operatorColor})))}componentWillLoad(){this.validateEdgesProp(this.edges),this.validateDirection(this.direction),this.validateLevelSpacing(this.levelSpacing),this.validateNodeSpacing(this.nodeSpacing),this.validateEdgeStyle(this.edgeStyle),this.validateShowOperators(this.showOperators)}connectedCallback(){this.observeLayout(),this.updateNodeRects()}componentDidLoad(){var t;null===(t=this.element.shadowRoot)||void 0===t||t.addEventListener("slotchange",(()=>{this.observeLayout(),this.updateNodeRects()})),requestAnimationFrame((()=>{this.updateNodeRects()}))}componentDidRender(){this.observeLayout(),this.updateNodeRects()}disconnectedCallback(){var t;this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.observed.clear(),null===(t=this.parentObserver)||void 0===t||t.disconnect(),this.parentObserver=null}observeLayout(){var t,i,s;const e=null!==(i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelector(".tree-grid"))&&void 0!==i?i:null;if(e!==this.gridContainer&&(null===(s=this.resizeObserver)||void 0===s||s.disconnect(),this.observed.clear(),this.gridContainer=e),e){this.resizeObserver||(this.resizeObserver=new ResizeObserver((()=>{this.updateNodeRects()}))),this.parentObserver||(this.parentObserver=mi(this.element,(()=>this.checkOverflow())));for(const t of[e,...Array.from(this.element.querySelectorAll("[slot]"))])this.observed.has(t)||(this.resizeObserver.observe(t),this.observed.add(t))}}recalculateLayout(){this.layout=this.treeConfig?function(t,i,s,e){if(!t.rootNode)return{positions:new Map,gridTemplateColumns:"",gridTemplateRows:"",maxLevel:0,maxIndex:0};const n=function(t){const i=new Map;if(!t.rootNode)return i;const s=[{node:t.rootNode,level:0}],e=new Set;for(;s.length>0;){const{node:n,level:r}=s.shift();if(e.has(n))continue;e.add(n),i.set(n,r);const o=t.adjacencyList.get(n)||[];for(const t of o)e.has(t)||s.push({node:t,level:r+1})}return i}(t),r=function(t){const i=new Map;if(!t.rootNode)return i;let s=0;return function e(n){const r=i.get(n);if(r)return r;const o=t.adjacencyList.get(n)||[];if(i.set(n,{startIndex:s,endIndex:s}),0===o.length){const t={startIndex:s,endIndex:s};return i.set(n,t),s++,t}let h=1/0,a=-1/0;for(const t of o){const i=e(t);h=Math.min(h,i.startIndex),a=Math.max(a,i.endIndex)}const l={startIndex:h,endIndex:a};return i.set(n,l),l}(t.rootNode),i}(t),o=function(t,i,s,e){var n,r;const o=new Map,h=Math.max(...Array.from(i.values()));for(const a of t.allNodes){const l=null!==(n=i.get(a))&&void 0!==n?n:0,c=null!==(r=s.get(a))&&void 0!==r?r:{startIndex:0,endIndex:0};let u,d,f=1,p=1;const v=c.endIndex-c.startIndex+1,g=Array.from(t.allNodes).some((t=>{var e;const n=s.get(t);return t!==a&&void 0!==n&&(null!==(e=i.get(t))&&void 0!==e?e:0)===l&&n.startIndex<=c.endIndex&&c.startIndex<=n.endIndex})),m=g?1:v;switch(e){case"ltr":u=l+1,d=c.startIndex+1,f=v;break;case"rtl":u=h-l+1,d=c.startIndex+1,f=v;break;case"ttb":d=l+1,u=c.startIndex+1,p=m;break;case"btt":d=h-l+1,u=c.startIndex+1,p=m}o.set(a,{nodeId:a,level:l,index:c.startIndex,gridColumn:u,gridRow:d,gridRowSpan:f,gridColumnSpan:p})}return o}(t,n,r,i),h=Math.max(...Array.from(n.values())),a=Math.max(...Array.from(r.values()).map((t=>t.endIndex))),{gridTemplateColumns:l,gridTemplateRows:c}=function(t,i,s,e,n){const r=t+1,o=i+1;if("ltr"===s||"rtl"===s){const t=[];for(let i=0;i<r;i++)t.push("auto"),i<r-1&&t.push(`${e}px`);const i=[];for(let t=0;t<o;t++)i.push("auto"),t<o-1&&i.push(`${n}px`);return{gridTemplateColumns:t.join(" "),gridTemplateRows:i.join(" ")}}{const t=[];for(let i=0;i<r;i++)t.push("auto"),i<r-1&&t.push(`${e}px`);const i=[];for(let t=0;t<o;t++)i.push("auto"),t<o-1&&i.push(`${n}px`);return{gridTemplateColumns:i.join(" "),gridTemplateRows:t.join(" ")}}}(h,a,i,s,e);return{positions:o,gridTemplateColumns:l,gridTemplateRows:c,maxLevel:h,maxIndex:a}}(this.treeConfig,this.direction,this.levelSpacing,this.nodeSpacing):null}updateNodeRects(){var t;if(!this.treeConfig||!this.gridContainer)return void(null===(t=this.errors)||void 0===t||t.remove("WARN_overflow"));const i=this.gridContainer.getBoundingClientRect(),s=new Map;for(const t of this.treeConfig.allNodes){const e=this.element.querySelector(`[slot="${t}"]`);e&&s.set(t,Ce(e,i))}(function(t,i){if(t.size!==i.size)return!1;for(const[s,e]of t){const t=i.get(s);if(!t||t.left!==e.left||t.top!==e.top||t.width!==e.width||t.height!==e.height)return!1}return!0})(this.nodeRects,s)||(this.nodeRects=s),this.svgWidth=i.width,this.svgHeight=i.height,this.checkOverflow()}checkOverflow(){var t,i;const s="WARN_overflow",e=Yt(this.element),n=(null===(t=this.gridContainer)||void 0===t?void 0:t.scrollWidth)||0,r=(null===(i=this.gridContainer)||void 0===i?void 0:i.scrollHeight)||0,o=[];e.width>0&&n>e.width+1&&o.push(`width (${Math.round(n)}px > ${Math.round(e.width)}px)`);const h=Bt(this.element,r);h>1&&o.push(`height (${Math.round(r)}px > ${Math.round(r-h)}px)`),0!==o.length?this.errors.addOrReplace({id:s,type:"warning",message:`Tree exceeds available ${o.join(" and ")} and will be cut off. Reduce level-spacing, node-spacing or the node content, or enlarge the container.`}):this.errors.remove(s)}getSlotStyle(t){if(!this.layout)return{};const i=this.layout.positions.get(t);return i?"ltr"===this.direction||"rtl"===this.direction?{"grid-column":String(Le(i.gridColumn)),"grid-row":`${Te(i.gridRow)} / span ${Ae(i.gridRowSpan)}`,"align-self":"center"}:{"grid-row":String(Te(i.gridRow)),"grid-column":`${Le(i.gridColumn)} / span ${s=i.gridColumnSpan,Ae(s)}`,"justify-self":"center"}:{};var s}renderEdges(){var t;if(!this.treeConfig||0===this.nodeRects.size)return null;const s=this.getTreeStyle(),e=[],n=[],r=new Map;for(const t of this.treeConfig.edges){const i=r.get(t.to)||[];i.push(t.from),r.set(t.to,i)}const o=new Map;for(const[t,i]of this.treeConfig.adjacencyList.entries()){const s=this.nodeRects.get(t),e=i.map((t=>this.nodeRects.get(t))).filter((t=>void 0!==t)),n=s?Ue(s,e,this.direction):void 0;void 0!==n&&o.set(t,n)}for(const t of this.treeConfig.edges){const n=this.nodeRects.get(t.from),h=this.nodeRects.get(t.to);if(!n||!h)continue;const a=Pe(n,!0,this.direction),l=r.get(t.to)||[];let c;if(l.length>1){const i=l.indexOf(t.from);c=Ne(h,this.direction,i,l.length)}else c=Pe(h,!1,this.direction);const{path:u}=De(a,c,this.edgeStyle,this.direction,o.get(t.from)),d=Fe(s.edgeColor,s.edgeWidth,t.style);e.push(i("path",{key:`edge-${t.from}-${t.to}`,d:u,fill:"none",stroke:d.stroke,"stroke-width":d.strokeWidth,"stroke-dasharray":d.strokeDasharray}))}if("true"===this.showOperators)for(const[e,r]of this.treeConfig.adjacencyList.entries()){const h=o.get(e);if(void 0!==h)for(let o=0;o<r.length-1;o++){const a=r[o],l=r[o+1],c=Ee(this.treeConfig.edges,e,a);if(!(null==c?void 0:c.operator)||"none"===c.operator)continue;const u=this.nodeRects.get(a),d=this.nodeRects.get(l);if(!u||!d)continue;const f=null!==(t=c.label)&&void 0!==t?t:ke(c.operator),p=ze(h,u,d,this.direction);n.push(i("g",{key:`operator-${e}-${a}`,class:"operator-group"},i("circle",{cx:p.x,cy:p.y,r:s.operatorCircleRadius,fill:"white",stroke:s.edgeColor,"stroke-width":s.edgeWidth}),i("text",{x:p.x,y:p.y,"text-anchor":"middle","dominant-baseline":"central",style:{fontSize:`${s.operatorFontSize}px`,fill:s.operatorColor,fontWeight:"bold"}},f)))}}return i("svg",{class:"edge-layer",width:this.svgWidth,height:this.svgHeight,style:{position:"absolute",top:"0",left:"0",pointerEvents:"none"}},e,n)}renderSlots(){return this.treeConfig&&this.layout?Array.from(this.treeConfig.allNodes).map((t=>i("div",{key:t,class:"tree-node",style:this.getSlotStyle(t)},i("slot",{name:t})))):null}getFontStyles(){return this.componentStyle((t=>{var i,s,e,n;return{"--bn-font-family":(null===(i=t.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(s=t.global)||void 0===s?void 0:s.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(e=t.global)||void 0===e?void 0:e.fontColor)||"#000000","--bn-font-background":(null===(n=t.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles();return i(s,{style:t},this.treeConfig&&this.layout?i("div",{class:"tree-container"},i("div",{class:"tree-grid",style:{display:"grid","grid-template-columns":this.layout.gridTemplateColumns,"grid-template-rows":this.layout.gridTemplateRows,position:"relative"}},this.renderEdges(),this.renderSlots())):i("div",{class:"tree-container tree-error"},i("slot",null)))}get element(){return e(this)}static get watchers(){return{edges:[{validateEdgesProp:0}],direction:[{validateDirection:0}],levelSpacing:[{validateLevelSpacing:0}],nodeSpacing:[{validateNodeSpacing:0}],edgeStyle:[{validateEdgeStyle:0}],showOperators:[{validateShowOperators:0}]}}};We.style=':host{display:inline-block;position:relative;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.tree-container{position:relative;display:inline-block}.tree-grid{position:relative;display:grid;align-items:center}.tree-node{position:relative;z-index:1;border:1px solid #404040;background:var(--bn-font-background, white)}.edge-layer{position:absolute;top:0;left:0;z-index:0;pointer-events:none;overflow:visible}.tree-error{display:flex;flex-wrap:wrap;gap:20px}';class Ge{constructor(t){this._dateFormat={year:"YYYY",quarter:"Q[Q] YYYY",month:"MMM YYYY",locale:"[KW]WW YYYY",day:"DD.MM.YYYY"},this._dateLinkFormat={avg:"Ø[DATE]",interval:"[DATE]..[DATE]",start:".[DATE]",end:"[DATE].",ytd:"_[DATE]",ytg:"[DATE]_",cum:"[DATE]_[DATE]",mat:"~[DATE]",none:"[DATE]"},this._scenarioMap=new Map;const i=k([w,null!=t?t:{}]);Object.entries(i.scenarios).forEach((([t,i])=>{var s,e,n;this.createScenarioMapEntry(t,null!==(s=i.name)&&void 0!==s?s:t,null!==(e=i.colorIndex)&&void 0!==e?e:10,null!==(n=i.sortIndex)&&void 0!==n?n:0)})),this._fallBackScenario=i.fallback}createScenarioMapEntry(t,i,s,e){const n=i,r=s;[1,2,3,4].forEach((s=>{this._scenarioMap.set(t+s,{name:i+s,group:n,colorIndex:r,sortIndex:e+10*s})}))}getScenario(t){return this._scenarioMap.has(t)?this._scenarioMap.get(t):this._fallBackScenario}getScenarioGroup(t){return this._scenarioMap.has(t)?this._scenarioMap.get(t).name:this._fallBackScenario.name}getScenarioColorIndex(t){return this._scenarioMap.has(t)?this._scenarioMap.get(t).colorIndex:this._fallBackScenario.colorIndex}getScenarioSorIndex(t){const i=this.normalizeVarianceScenario(t);return this._scenarioMap.has(i)?this._scenarioMap.get(i).sortIndex:this._fallBackScenario.sortIndex}normalizeVarianceScenario(t){if(null==t)return"";const i=new ts(t);return i.isValid?i.type+i.delta:t}}class je{constructor(){this.font="16px Arial",this.family="Arial",this.size=16,this.color="#000000",this.background="#ffffff",this.leading=1.8}}class Ie{adapt(t){const i=new je;return E.isString(t.font)&&(i.font=t.font),E.isString(t.family)&&(i.family=t.family),E.isNumber(t.size)&&(i.size=t.size),E.isString(t.color)&&(i.color=t.color),E.isString(t.background)&&(i.background=t.background),E.isNumber(t.leading)&&(i.leading=t.leading),i}default(){return new je}}let Ye=class{constructor(){this.top=10,this.left=10,this.right=10,this.bottom=10}};class Be{adapt(t){const i=new Ye;return E.isNumber(t.top)&&(i.top=t.top),E.isNumber(t.left)&&(i.left=t.left),E.isNumber(t.right)&&(i.right=t.right),E.isNumber(t.bottom)&&(i.bottom=t.bottom),i}default(){return new Ye}}function He(t){return"fc"===t||"hatched"===t?"hatched":"solid"===t||"outlined"===t?t:void 0}class Ve{constructor(t="#000000",i="#000000",s=.1){this.stroke=t,this.fill=i,this.width=s}}class Xe{adapt(t){const i=new Ve(t.stroke,t.fill,t.width);return i.fillpattern=He(t.fillpattern),"outlined"===i.fillpattern&&(i.fill="transparent"),E.isString(t.dasharray)&&(i.dasharray=t.dasharray),i}default(){return new Ve("#000000","#000000",.3)}defaultAC(){return new Ve("#000000","#000000",.3)}defaultFC(){const t=new Ve("#000000","#000000",.3);return t.dasharray="10 5 5 5",t.fillpattern="hatched",t}defaultPP(){return new Ve("#999999","#999999",.3)}defaultPL(){return new Ve("#000000","#ffffff",.3)}defaultPos(){return new Ve("#00ff00","#00ff00",.3)}defaultNeg(){return new Ve("#ff0000","#ff0000",.3)}defaultNeu(){return new Ve("#999999","#999999",.3)}}class Je{constructor(t,i,s,e){this.ac=t,this.fc=i,this.pp=s,this.pl=e}getSVGStyle(t){return"ac"===t?this.ac:"fc"===t?this.fc:"pp"===t?this.pp:"pl"===t?this.pl:this.ac}}class qe{constructor(t){this.svgStyleAdapter=t}adapt(t){const i=new Je(this.svgStyleAdapter.defaultAC(),this.svgStyleAdapter.defaultFC(),this.svgStyleAdapter.defaultPP(),this.svgStyleAdapter.defaultPL());return E.isExisting(t.ac)&&(i.ac=this.svgStyleAdapter.adapt(t.ac)),E.isExisting(t.fc)&&(i.fc=this.svgStyleAdapter.adapt(t.fc)),E.isExisting(t.pp)&&(i.pp=this.svgStyleAdapter.adapt(t.pp)),E.isExisting(t.pl)&&(i.pl=this.svgStyleAdapter.adapt(t.pl)),i}default(){return new Je(this.svgStyleAdapter.defaultAC(),this.svgStyleAdapter.defaultFC(),this.svgStyleAdapter.defaultPP(),this.svgStyleAdapter.defaultPL())}}class Ke{constructor(t,i,s,e){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=s,this.padding=e,this.seriesColors=[...x],this.locale="de"}}class Qe{constructor(t,i,s,e){this.scaleFactorsXYChartAdapter=t,this.fontStyleAdapter=i,this.svgStyleGroupAdapter=s,this.paddingAdapter=e}adapt(t){const i=this.default();return E.isExisting(t)&&(E.isExisting(t.scaleFactors)&&(i.scaleFactors=this.scaleFactorsXYChartAdapter.adapt(t.scaleFactors)),E.isExisting(t.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(t.fontStyles)),E.isExisting(t.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(t.axisStyles)),E.isExisting(t.padding)&&(i.padding=this.paddingAdapter.adapt(t.padding)),Array.isArray(t.seriesColors)&&t.seriesColors.length>0&&(i.seriesColors=t.seriesColors)),i}default(){return new Ke(this.scaleFactorsXYChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.paddingAdapter.default())}}class Ze{constructor(){this.pointRadius=.4,this.bubbleMaxRadius=3.2,this.bubbleMinRadius=.35,this.axisTickLength=.35,this.labelToMark=.3,this.legendSwatch=.9,this.panelGap=1.6,this.refLineWidth=1,this.gridLineWidth=1}}class tn{adapt(t){const i=new Ze;return E.isNumber(t.pointRadius)&&(i.pointRadius=t.pointRadius),E.isNumber(t.bubbleMaxRadius)&&(i.bubbleMaxRadius=t.bubbleMaxRadius),E.isNumber(t.bubbleMinRadius)&&(i.bubbleMinRadius=t.bubbleMinRadius),E.isNumber(t.axisTickLength)&&(i.axisTickLength=t.axisTickLength),E.isNumber(t.labelToMark)&&(i.labelToMark=t.labelToMark),E.isNumber(t.legendSwatch)&&(i.legendSwatch=t.legendSwatch),E.isNumber(t.panelGap)&&(i.panelGap=t.panelGap),E.isNumber(t.refLineWidth)&&(i.refLineWidth=t.refLineWidth),E.isNumber(t.gridLineWidth)&&(i.gridLineWidth=t.gridLineWidth),i}default(){return new Ze}}var sn=Object.create,en=Object.defineProperty,nn=Object.getOwnPropertyDescriptor,rn=Object.getOwnPropertyNames,on=Object.getPrototypeOf,hn=Object.prototype.hasOwnProperty,an=(t,i)=>()=>(i||(t((i={exports:{}}).exports,i),t=null),i.exports),ln=t=>{let i={};for(var s in t)en(i,s,{get:t[s],enumerable:!0});return en(i,Symbol.toStringTag,{value:"Module"}),i},cn=(t,i,s)=>(s=null!=t?sn(on(t)):{},((t,i,s,e)=>{if(i&&"object"==typeof i||"function"==typeof i)for(var n,r=rn(i),o=0,h=r.length;o<h;o++)hn.call(t,n=r[o])||undefined===n||en(t,n,{get:(t=>i[t]).bind(null,n),enumerable:!(e=nn(i,n))||e.enumerable});return t})(en(s,"default",{value:t,enumerable:!0}),t));const un={},dn=[];function fn(t,i){if(Array.isArray(t))for(const s of t)fn(s,i);else if("object"!=typeof t)vn(Object.getOwnPropertyNames(i)),un[t]=Object.assign(un[t]||{},i);else for(const i in t)fn(i,t[i])}function pn(t){return un[t]||{}}function vn(t){dn.push(...t)}var gn=an(((t,i)=>{i.exports=function(t){try{return!!t()}catch(t){return!0}}})),mn=an(((t,i)=>{var s=gn();i.exports=!s((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))})),bn=an(((t,i)=>{var s=mn(),e=Function.prototype,n=e.call,r=s&&e.bind.bind(n,n);i.exports=s?r:function(t){return function(){return n.apply(t,arguments)}}})),yn=an(((t,i)=>{var s=bn();i.exports=s({}.isPrototypeOf)})),wn=an(((t,i)=>{var s=function(t){return t&&t.Math===Math&&t};i.exports=s("object"==typeof globalThis&&globalThis)||s("object"==typeof window&&window)||s("object"==typeof self&&self)||s("object"==typeof global&&global)||s("object"==typeof t&&t)||function(){return this}()||Function("return this")()})),xn=an(((t,i)=>{var s=mn(),e=Function.prototype,n=e.apply,r=e.call;i.exports="object"==typeof Reflect&&Reflect.apply||(s?r.bind(n):function(){return r.apply(n,arguments)})})),Sn=an(((t,i)=>{var s=bn(),e=s({}.toString),n=s("".slice);i.exports=function(t){return n(e(t),8,-1)}})),$n=an(((t,i)=>{var s=Sn(),e=bn();i.exports=function(t){if("Function"===s(t))return e(t)}})),Mn=an(((t,i)=>{var s="object"==typeof document&&document.all;i.exports=void 0===s&&void 0!==s?function(t){return"function"==typeof t||t===s}:function(t){return"function"==typeof t}})),_n=an(((t,i)=>{var s=gn();i.exports=!s((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))})),Rn=an(((t,i)=>{var s=mn(),e=Function.prototype.call;i.exports=s?e.bind(e):function(){return e.apply(e,arguments)}})),On=an((t=>{var i={}.propertyIsEnumerable,s=Object.getOwnPropertyDescriptor,e=s&&!i.call({1:2},1);t.f=e?function(t){var i=s(this,t);return!!i&&i.enumerable}:i})),kn=an(((t,i)=>{i.exports=function(t,i){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:i}}})),En=an(((t,i)=>{var s=bn(),e=gn(),n=Sn(),r=Object,o=s("".split);i.exports=e((function(){return!r("z").propertyIsEnumerable(0)}))?function(t){return"String"===n(t)?o(t,""):r(t)}:r})),Ln=an(((t,i)=>{i.exports=function(t){return null==t}})),Tn=an(((t,i)=>{var s=Ln(),e=TypeError;i.exports=function(t){if(s(t))throw new e("Can't call method on "+t);return t}})),An=an(((t,i)=>{var s=En(),e=Tn();i.exports=function(t){return s(e(t))}})),Cn=an(((t,i)=>{var s=Mn();i.exports=function(t){return"object"==typeof t?null!==t:s(t)}})),Pn=an(((t,i)=>{i.exports={}})),Nn=an(((t,i)=>{var s=Pn(),e=wn(),n=Mn(),r=function(t){return n(t)?t:void 0};i.exports=function(t,i){return arguments.length<2?r(s[t])||r(e[t]):s[t]&&s[t][i]||e[t]&&e[t][i]}})),Dn=an(((t,i)=>{var s=wn().navigator,e=s&&s.userAgent;i.exports=e?String(e):""})),Un=an(((t,i)=>{var s,e,n=wn(),r=Dn(),o=n.process,h=n.Deno,a=o&&o.versions||h&&h.version,l=a&&a.v8;l&&(e=(s=l.split("."))[0]>0&&s[0]<4?1:+(s[0]+s[1])),!e&&r&&(!(s=r.match(/Edge\/(\d+)/))||s[1]>=74)&&(s=r.match(/Chrome\/(\d+)/))&&(e=+s[1]),i.exports=e})),zn=an(((t,i)=>{var s=Un(),e=gn(),n=wn().String;i.exports=!!Object.getOwnPropertySymbols&&!e((function(){var t=Symbol("symbol detection");return!n(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&s&&s<41}))})),Fn=an(((t,i)=>{var s=zn();i.exports=s&&!Symbol.sham&&"symbol"==typeof Symbol.iterator})),Wn=an(((t,i)=>{var s=Nn(),e=Mn(),n=yn(),r=Fn(),o=Object;i.exports=r?function(t){return"symbol"==typeof t}:function(t){var i=s("Symbol");return e(i)&&n(i.prototype,o(t))}})),Gn=an(((t,i)=>{var s=String;i.exports=function(t){try{return s(t)}catch(t){return"Object"}}})),jn=an(((t,i)=>{var s=Mn(),e=Gn(),n=TypeError;i.exports=function(t){if(s(t))return t;throw new n(e(t)+" is not a function")}})),In=an(((t,i)=>{var s=jn(),e=Ln();i.exports=function(t,i){var n=t[i];return e(n)?void 0:s(n)}})),Yn=an(((t,i)=>{var s=Rn(),e=Mn(),n=Cn(),r=TypeError;i.exports=function(t,i){var o,h;if("string"===i&&e(o=t.toString)&&!n(h=s(o,t)))return h;if(e(o=t.valueOf)&&!n(h=s(o,t)))return h;if("string"!==i&&e(o=t.toString)&&!n(h=s(o,t)))return h;throw new r("Can't convert object to primitive value")}})),Bn=an(((t,i)=>{i.exports=!0})),Hn=an(((t,i)=>{var s=wn(),e=Object.defineProperty;i.exports=function(t,i){try{e(s,t,{value:i,configurable:!0,writable:!0})}catch(e){s[t]=i}return i}})),Vn=an(((t,i)=>{var s=Bn(),e=wn(),n=Hn(),r="__core-js_shared__",o=i.exports=e[r]||n(r,{});(o.versions||(o.versions=[])).push({version:"3.49.0",mode:s?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE",source:"https://github.com/zloirock/core-js"})})),Xn=an(((t,i)=>{var s=Vn();i.exports=function(t,i){return s[t]||(s[t]=i||{})}})),Jn=an(((t,i)=>{var s=Tn(),e=Object;i.exports=function(t){return e(s(t))}})),qn=an(((t,i)=>{var s=bn(),e=Jn(),n=s({}.hasOwnProperty);i.exports=Object.hasOwn||function(t,i){return n(e(t),i)}})),Kn=an(((t,i)=>{var s=bn(),e=0,n=Math.random(),r=s(1.1.toString);i.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+r(++e+n,36)}})),Qn=an(((t,i)=>{var s=wn(),e=Xn(),n=qn(),r=Kn(),o=zn(),h=Fn(),a=s.Symbol,l=e("wks"),c=h?a.for||a:a&&a.withoutSetter||r;i.exports=function(t){return n(l,t)||(l[t]=o&&n(a,t)?a[t]:c("Symbol."+t)),l[t]}})),Zn=an(((t,i)=>{var s=Rn(),e=Cn(),n=Wn(),r=In(),o=Yn(),h=Qn(),a=TypeError,l=h("toPrimitive");i.exports=function(t,i){if(!e(t)||n(t))return t;var h,c=r(t,l);if(c){if(void 0===i&&(i="default"),h=s(c,t,i),!e(h)||n(h))return h;throw new a("Can't convert object to primitive value")}return void 0===i&&(i="number"),o(t,i)}})),tr=an(((t,i)=>{var s=Zn(),e=Wn();i.exports=function(t){var i=s(t,"string");return e(i)?i:i+""}})),ir=an(((t,i)=>{var s=wn(),e=Cn(),n=s.document,r=e(n)&&e(n.createElement);i.exports=function(t){return r?n.createElement(t):{}}})),sr=an(((t,i)=>{var s=_n(),e=gn(),n=ir();i.exports=!s&&!e((function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a}))})),er=an((t=>{var i=_n(),s=Rn(),e=On(),n=kn(),r=An(),o=tr(),h=qn(),a=sr(),l=Object.getOwnPropertyDescriptor;t.f=i?l:function(t,i){if(t=r(t),i=o(i),a)try{return l(t,i)}catch(t){}if(h(t,i))return n(!s(e.f,t,i),t[i])}})),nr=an(((t,i)=>{var s=gn(),e=Mn(),n=/#|\.prototype\./,r=function(t,i){var n=h[o(t)];return n===l||n!==a&&(e(i)?s(i):!!i)},o=r.normalize=function(t){return String(t).replace(n,".").toLowerCase()},h=r.data={},a=r.NATIVE="N",l=r.POLYFILL="P";i.exports=r})),rr=an(((t,i)=>{var s=$n(),e=jn(),n=mn(),r=s(s.bind);i.exports=function(t,i){return e(t),void 0===i?t:n?r(t,i):function(){return t.apply(i,arguments)}}})),or=an(((t,i)=>{var s=_n(),e=gn();i.exports=s&&e((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))})),hr=an(((t,i)=>{var s=Cn(),e=String,n=TypeError;i.exports=function(t){if(s(t))return t;throw new n(e(t)+" is not an object")}})),ar=an((t=>{var i=_n(),s=sr(),e=or(),n=hr(),r=tr(),o=TypeError,h=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l="enumerable",c="configurable",u="writable";t.f=i?e?function(t,i,s){if(n(t),i=r(i),n(s),"function"==typeof t&&"prototype"===i&&"value"in s&&u in s&&!s[u]){var e=a(t,i);e&&e[u]&&(t[i]=s.value,s={configurable:c in s?s[c]:e[c],enumerable:l in s?s[l]:e[l],writable:!1})}return h(t,i,s)}:h:function(t,i,e){if(n(t),i=r(i),n(e),s)try{return h(t,i,e)}catch(t){}if("get"in e||"set"in e)throw new o("Accessors not supported");return"value"in e&&(t[i]=e.value),t}})),lr=an(((t,i)=>{var s=_n(),e=ar(),n=kn();i.exports=s?function(t,i,s){return e.f(t,i,n(1,s))}:function(t,i,s){return t[i]=s,t}})),cr=an(((t,i)=>{var s=wn(),e=xn(),n=$n(),r=Mn(),o=er().f,h=nr(),a=Pn(),l=rr(),c=lr(),u=qn();Vn();var d=function(t){var i=function(s,n,r){if(this instanceof i){switch(arguments.length){case 0:return new t;case 1:return new t(s);case 2:return new t(s,n)}return new t(s,n,r)}return e(t,this,arguments)};return i.prototype=t.prototype,i};i.exports=function(t,i){var e,f,p,v,g,m,b,y,w,x=t.target,S=t.global,$=t.stat,M=t.proto,_=S?s:$?s[x]:s[x]&&s[x].prototype,R=S?a:a[x]||c(a,x,{})[x],O=R.prototype;for(v in i)f=!(e=h(S?v:x+($?".":"#")+v,t.forced))&&_&&u(_,v),m=R[v],f&&(b=t.dontCallGetSet?(w=o(_,v))&&w.value:_[v]),g=f&&b?b:i[v],(e||M||typeof m!=typeof g)&&(y=t.bind&&f?l(g,s):t.wrap&&f?d(g):M&&r(g)?n(g):g,(t.sham||g&&g.sham||m&&m.sham)&&c(y,"sham",!0),c(R,v,y),M&&(u(a,p=x+"Prototype")||c(a,p,{}),c(a[p],v,g),t.real&&O&&(e||!O[v])&&c(O,v,g)))}})),ur=an(((t,i)=>{var s=Math.ceil,e=Math.floor;i.exports=Math.trunc||function(t){var i=+t;return(i>0?e:s)(i)}})),dr=an(((t,i)=>{var s=ur();i.exports=function(t){var i=+t;return i!=i||0===i?0:s(i)}})),fr=an(((t,i)=>{var s=dr(),e=Math.max,n=Math.min;i.exports=function(t,i){var r=s(t);return r<0?e(r+i,0):n(r,i)}})),pr=an(((t,i)=>{var s=dr(),e=Math.min;i.exports=function(t){var i=s(t);return i>0?e(i,9007199254740991):0}})),vr=an(((t,i)=>{var s=pr();i.exports=function(t){return s(t.length)}})),gr=an(((t,i)=>{var s=An(),e=fr(),n=vr(),r=function(t){return function(i,r,o){var h=s(i),a=n(h);if(0===a)return!t&&-1;var l,c=e(o,a);if(t&&r!=r){for(;a>c;)if((l=h[c++])!=l)return!0}else for(;a>c;c++)if((t||c in h)&&h[c]===r)return t||c||0;return!t&&-1}};i.exports={includes:r(!0),indexOf:r(!1)}})),mr=an(((t,i)=>{i.exports=function(){}})),br=an((()=>{var t=cr(),i=gr().includes,s=gn(),e=mr(),n=s((function(){return!Array(1).includes()})),r=s((function(){return[,1].includes(void 0,1)}));t({target:"Array",proto:!0,forced:n||r},{includes:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),e("includes")})),yr=an(((t,i)=>{var s=wn(),e=Pn();i.exports=function(t,i){var n=e[t+"Prototype"],r=n&&n[i];if(r)return r;var o=s[t],h=o&&o.prototype;return h&&h[i]}})),wr=an(((t,i)=>{br();var s=yr();i.exports=s("Array","includes")})),xr=an(((t,i)=>{var s=Cn(),e=Sn(),n=Qn()("match");i.exports=function(t){var i;return s(t)&&(void 0!==(i=t[n])?!!i:"RegExp"===e(t))}})),Sr=an(((t,i)=>{var s=xr(),e=TypeError;i.exports=function(t){if(s(t))throw new e("The method doesn't accept regular expressions");return t}})),$r=an(((t,i)=>{var s={};s[Qn()("toStringTag")]="z",i.exports="[object z]"===String(s)})),Mr=an(((t,i)=>{var s=$r(),e=Mn(),n=Sn(),r=Qn()("toStringTag"),o=Object,h="Arguments"===n(function(){return arguments}());i.exports=s?n:function(t){var i,s,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(s=function(t,i){try{return t[i]}catch(t){}}(i=o(t),r))?s:h?n(i):"Object"===(a=n(i))&&e(i.callee)?"Arguments":a}})),_r=an(((t,i)=>{var s=Mr(),e=String;i.exports=function(t){if("Symbol"===s(t))throw new TypeError("Cannot convert a Symbol value to a string");return e(t)}})),Rr=an(((t,i)=>{var s=Qn()("match");i.exports=function(t){var i=/./;try{"/./"[t](i)}catch(e){try{return i[s]=!1,"/./"[t](i)}catch(t){}}return!1}})),Or=an((()=>{var t=cr(),i=bn(),s=Sr(),e=Tn(),n=_r(),r=Rr(),o=i("".indexOf);t({target:"String",proto:!0,forced:!r("includes")},{includes:function(t){return!!~o(n(e(this)),n(s(t)),arguments.length>1?arguments[1]:void 0)}})})),kr=an(((t,i)=>{Or();var s=yr();i.exports=s("String","includes")})),Er=an(((t,i)=>{var s=yn(),e=wr(),n=kr(),r=Array.prototype,o=String.prototype;i.exports=function(t){var i=t.includes;return t===r||s(r,t)&&i===r.includes?e:"string"==typeof t||t===o||s(o,t)&&i===o.includes?n:i}})),Lr=cn(an(((t,i)=>{var s=Er();i.exports=s}))());function Tr(t,i){let s;const e=t.length,n=[];for(s=0;s<e;s++)n.push(i(t[s]));return n}function Ar(t){return t%360*Math.PI/180}function Cr(t){return t.replace(/([A-Z])/g,(function(t,i){return"-"+i.toLowerCase()}))}function Pr(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Nr(t,i,s,e){return null!=i&&null!=s||(e=e||t.bbox(),null==i?i=e.width/e.height*s:null==s&&(s=e.height/e.width*i)),{width:i,height:s}}function Dr(t,i){const s=t.origin;let e=null!=t.ox?t.ox:null!=t.originX?t.originX:"center",n=null!=t.oy?t.oy:null!=t.originY?t.originY:"center";null!=s&&([e,n]=Array.isArray(s)?s:"object"==typeof s?[s.x,s.y]:[s,s]);const r="string"==typeof e,o="string"==typeof n;if(r||o){const{height:t,width:s,x:h,y:a}=i.bbox();r&&(e=(0,Lr.default)(e).call(e,"left")?h:(0,Lr.default)(e).call(e,"right")?h+s:h+s/2),o&&(n=(0,Lr.default)(n).call(n,"top")?a:(0,Lr.default)(n).call(n,"bottom")?a+t:a+t/2)}return[e,n]}const Ur=new Set(["desc","metadata","title"]),zr=t=>Ur.has(t.nodeName),Fr="http://www.w3.org/2000/svg",Wr="http://www.w3.org/2000/xmlns/",Gr="http://www.w3.org/1999/xlink",jr={window:"undefined"==typeof window?null:window,document:"undefined"==typeof document?null:document};var Ir=class{};const Yr={},Br="___SYMBOL___ROOT___";function Hr(t,i=Fr){return jr.document.createElementNS(i,t)}function Vr(t,i=!1){if(t instanceof Ir)return t;if("object"==typeof t)return qr(t);if(null==t)return new Yr[Br];if("string"==typeof t&&"<"!==t.trim().charAt(0))return qr(jr.document.querySelector(t));const s=i?jr.document.createElement("div"):Hr("svg");return s.innerHTML=t.trim(),t=qr(s.firstElementChild),s.removeChild(s.firstElementChild),t}function Xr(t,i){return i&&(i instanceof jr.window.Node||i.ownerDocument&&i instanceof i.ownerDocument.defaultView.Node)?i:Hr(t)}function Jr(t){if(!t)return null;if(t.instance instanceof Ir)return t.instance;if("#document-fragment"===t.nodeName)return new Yr.Fragment(t);let i=Pr(t.nodeName||"Dom");return"LinearGradient"===i||"RadialGradient"===i?i="Gradient":Yr[i]||(i="Dom"),new Yr[i](t)}let qr=Jr;function Kr(t,i=t.name,s=!1){return Yr[i]=t,s&&(Yr[Br]=t),vn(Object.getOwnPropertyNames(t.prototype)),t}let Qr=1e3;function Zr(t){return"Svgjs"+Pr(t)+Qr++}function to(t){for(let i=t.children.length-1;i>=0;i--)to(t.children[i]);return t.id?(t.id=Zr(t.nodeName),t):t}function io(t,i){let s,e;for(e=(t=Array.isArray(t)?t:[t]).length-1;e>=0;e--)for(s in i)t[e].prototype[s]=i[s]}function so(t){return function(...i){const s=i[i.length-1];return!s||s.constructor!==Object||s instanceof Array?t.apply(this,i):t.apply(this,i.slice(0,-1)).attr(s)}}fn("Dom",{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},prev:function(){return this.siblings()[this.position()-1]},forward:function(){const t=this.position();return this.parent().add(this.remove(),t+1),this},backward:function(){const t=this.position();return this.parent().add(this.remove(),t?t-1:0),this},front:function(){return this.parent().add(this.remove()),this},back:function(){return this.parent().add(this.remove(),0),this},before:function(t){(t=Vr(t)).remove();const i=this.position();return this.parent().add(t,i),this},after:function(t){(t=Vr(t)).remove();const i=this.position();return this.parent().add(t,i+1),this},insertBefore:function(t){return(t=Vr(t)).before(this),this},insertAfter:function(t){return(t=Vr(t)).after(this),this}});const eo=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,no=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,ro=/rgb\((\d+),(\d+),(\d+)\)/,oo=/^(#[^\s]+)$/,ho=/\)\s*,?\s*/,ao=/\s/g,lo=/^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i,co=/^rgb\(/,uo=/^(\s+)?$/,fo=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,po=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,vo=/[\s,]+/,go=/[MLHVCSQTAZ]/i;fn("Dom",{classes:function(){const t=this.attr("class");return null==t?[]:t.trim().split(vo)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){const i=this.classes();i.push(t),this.attr("class",i.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter((function(i){return i!==t})).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}});const mo=t=>t.startsWith("--")?t:Cr(t);function bo(t){const i=Math.max(0,Math.min(255,Math.round(t))).toString(16);return 1===i.length?"0"+i:i}function yo(t,i){for(let s=i.length;s--;)if(null==t[i[s]])return!1;return!0}function wo(t,i,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(i-t)*s:s<.5?i:s<2/3?t+(i-t)*(2/3-s)*6:t}fn("Dom",{css:function(t,i){const s={};if(0===arguments.length){const t=this.node.style;for(let i=0;i<t.length;i++){const e=t.item(i),n=t.getPropertyValue(e),r=t.getPropertyPriority(e);s[e]=r?`${n} !${r}`:n}return s}if(arguments.length<2){if(Array.isArray(t)){for(const i of t){const t=mo(i);s[i]=this.node.style.getPropertyValue(t)}return s}if("string"==typeof t)return this.node.style.getPropertyValue(mo(t));if("object"==typeof t)for(const i in t)this.node.style.setProperty(mo(i),null==t[i]||uo.test(t[i])?"":t[i])}return 2===arguments.length&&this.node.style.setProperty(mo(t),null==i||uo.test(i)?"":i),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),fn("Dom",{data:function(t,i,s){if(null==t)return this.data(Tr(function(t){let i;const s=t.length,e=[];for(i=0;i<s;i++)0===t[i].nodeName.indexOf("data-")&&e.push(t[i]);return e}(this.node.attributes),(t=>t.nodeName.slice(5))));if(t instanceof Array){const i={};for(const s of t)i[s]=this.data(s);return i}if("object"==typeof t)for(i in t)this.data(i,t[i]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(i){return this.attr("data-"+t)}else this.attr("data-"+t,null===i?null:!0===s||"string"==typeof i||"number"==typeof i?i:JSON.stringify(i));return this}}),fn("Dom",{remember:function(t,i){if("object"==typeof arguments[0])for(const i in t)this.remember(i,t[i]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=i}return this},forget:function(){if(0===arguments.length)this._memory={};else for(let t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});var xo=class t{constructor(...t){this.init(...t)}static isColor(i){return i&&(i instanceof t||this.isRgb(i)||this.test(i))}static isRgb(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}static random(i="vibrant",s){const{random:e,round:n,sin:r,PI:o}=Math;if("vibrant"===i){const i=24*e()+57,s=38*e()+45,n=360*e();return new t(i,s,n,"lch")}if("sine"===i){const i=n(80*r(2*o*(s=null==s?e():s)/.5+.01)+150),h=n(50*r(2*o*s/.5+4.6)+200),a=n(100*r(2*o*s/.5+2.3)+150);return new t(i,h,a)}if("pastel"===i){const i=8*e()+86,s=17*e()+9,n=360*e();return new t(i,s,n,"lch")}if("dark"===i){const i=10+10*e(),s=50*e()+86,n=360*e();return new t(i,s,n,"lch")}if("rgb"===i){const i=255*e(),s=255*e(),n=255*e();return new t(i,s,n)}if("lab"===i){const i=100*e(),s=256*e()-128,n=256*e()-128;return new t(i,s,n,"lab")}if("grey"===i){const i=255*e();return new t(i,i,i)}throw new Error("Unsupported random color mode")}static test(t){return"string"==typeof t&&(lo.test(t)||co.test(t))}cmyk(){const{_a:i,_b:s,_c:e}=this.rgb(),[n,r,o]=[i,s,e].map((t=>t/255)),h=Math.min(1-n,1-r,1-o);return 1===h?new t(0,0,0,1,"cmyk"):new t((1-n-h)/(1-h),(1-r-h)/(1-h),(1-o-h)/(1-h),h,"cmyk")}hsl(){const{_a:i,_b:s,_c:e}=this.rgb(),[n,r,o]=[i,s,e].map((t=>t/255)),h=Math.max(n,r,o),a=Math.min(n,r,o),l=(h+a)/2,c=h===a,u=h-a;return new t(360*(c?0:h===n?((r-o)/u+(r<o?6:0))/6:h===r?((o-n)/u+2)/6:h===o?((n-r)/u+4)/6:0),100*(c?0:l>.5?u/(2-h-a):u/(h+a)),100*l,"hsl")}init(t=0,i=0,s=0,e=0,n="rgb"){if(t=t||0,this.space)for(const t in this.space)delete this[this.space[t]];if("number"==typeof t)n="string"==typeof e?e:n,e="string"==typeof e?0:e,Object.assign(this,{_a:t,_b:i,_c:s,_d:e,space:n});else if(t instanceof Array)this.space=i||("string"==typeof t[3]?t[3]:t[4])||"rgb",Object.assign(this,{_a:t[0],_b:t[1],_c:t[2],_d:t[3]||0});else if(t instanceof Object){const s=function(t,i){const s=yo(t,"rgb")?{_a:t.r,_b:t.g,_c:t.b,_d:0,space:"rgb"}:yo(t,"xyz")?{_a:t.x,_b:t.y,_c:t.z,_d:0,space:"xyz"}:yo(t,"hsl")?{_a:t.h,_b:t.s,_c:t.l,_d:0,space:"hsl"}:yo(t,"lab")?{_a:t.l,_b:t.a,_c:t.b,_d:0,space:"lab"}:yo(t,"lch")?{_a:t.l,_b:t.c,_c:t.h,_d:0,space:"lch"}:yo(t,"cmyk")?{_a:t.c,_b:t.m,_c:t.y,_d:t.k,space:"cmyk"}:{_a:0,_b:0,_c:0,space:"rgb"};return s.space=i||s.space,s}(t,i);Object.assign(this,s)}else if("string"==typeof t)if(co.test(t)){const i=t.replace(ao,""),[s,e,n]=ro.exec(i).slice(1,4).map((t=>parseInt(t)));Object.assign(this,{_a:s,_b:e,_c:n,_d:0,space:"rgb"})}else{if(!lo.test(t))throw Error("Unsupported string format, can't construct Color");{const i=t=>parseInt(t,16),[,s,e,n]=no.exec(function(t){return 4===t.length?["#",t.substring(1,2),t.substring(1,2),t.substring(2,3),t.substring(2,3),t.substring(3,4),t.substring(3,4)].join(""):t}(t)).map(i);Object.assign(this,{_a:s,_b:e,_c:n,_d:0,space:"rgb"})}}const{_a:r,_b:o,_c:h,_d:a}=this;Object.assign(this,"rgb"===this.space?{r,g:o,b:h}:"xyz"===this.space?{x:r,y:o,z:h}:"hsl"===this.space?{h:r,s:o,l:h}:"lab"===this.space?{l:r,a:o,b:h}:"lch"===this.space?{l:r,c:o,h}:"cmyk"===this.space?{c:r,m:o,y:h,k:a}:{})}lab(){const{x:i,y:s,z:e}=this.xyz();return new t(116*s-16,500*(i-s),200*(s-e),"lab")}lch(){const{l:i,a:s,b:e}=this.lab(),n=Math.sqrt(s**2+e**2);let r=180*Math.atan2(e,s)/Math.PI;return r<0&&(r*=-1,r=360-r),new t(i,n,r,"lch")}rgb(){if("rgb"===this.space)return this;if("lab"===(i=this.space)||"xyz"===i||"lch"===i){let{x:i,y:s,z:e}=this;if("lab"===this.space||"lch"===this.space){let{l:t,a:n,b:r}=this;if("lch"===this.space){const{c:t,h:i}=this,s=Math.PI/180;n=t*Math.cos(s*i),r=t*Math.sin(s*i)}const o=(t+16)/116,h=n/500+o,a=o-r/200,l=16/116,c=.008856,u=7.787;i=.95047*(h**3>c?h**3:(h-l)/u),s=1*(o**3>c?o**3:(o-l)/u),e=1.08883*(a**3>c?a**3:(a-l)/u)}const n=3.2406*i+-1.5372*s+-.4986*e,r=-.9689*i+1.8758*s+.0415*e,o=.0557*i+-.204*s+1.057*e,h=Math.pow,a=.0031308,l=n>a?1.055*h(n,1/2.4)-.055:12.92*n,c=r>a?1.055*h(r,1/2.4)-.055:12.92*r,u=o>a?1.055*h(o,1/2.4)-.055:12.92*o;return new t(255*l,255*c,255*u)}if("hsl"===this.space){let{h:i,s,l:e}=this;if(i/=360,s/=100,e/=100,0===s)return e*=255,new t(e,e,e);const n=e<.5?e*(1+s):e+s-e*s,r=2*e-n,o=255*wo(r,n,i+1/3),h=255*wo(r,n,i),a=255*wo(r,n,i-1/3);return new t(o,h,a)}if("cmyk"===this.space){const{c:i,m:s,y:e,k:n}=this,r=255*(1-Math.min(1,i*(1-n)+n)),o=255*(1-Math.min(1,s*(1-n)+n)),h=255*(1-Math.min(1,e*(1-n)+n));return new t(r,o,h)}return this;var i}toArray(){const{_a:t,_b:i,_c:s,_d:e,space:n}=this;return[t,i,s,e,n]}toHex(){const[t,i,s]=this._clamped().map(bo);return`#${t}${i}${s}`}toRgb(){const[t,i,s]=this._clamped();return`rgb(${t},${i},${s})`}toString(){return this.toHex()}xyz(){const{_a:i,_b:s,_c:e}=this.rgb(),[n,r,o]=[i,s,e].map((t=>t/255)),h=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92,a=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,l=o>.04045?Math.pow((o+.055)/1.055,2.4):o/12.92,c=(.4124*h+.3576*a+.1805*l)/.95047,u=(.2126*h+.7152*a+.0722*l)/1,d=(.0193*h+.1192*a+.9505*l)/1.08883,f=c>.008856?Math.pow(c,1/3):7.787*c+16/116,p=u>.008856?Math.pow(u,1/3):7.787*u+16/116,v=d>.008856?Math.pow(d,1/3):7.787*d+16/116;return new t(f,p,v,"xyz")}_clamped(){const{_a:t,_b:i,_c:s}=this.rgb(),{max:e,min:n,round:r}=Math;return[t,i,s].map((t=>e(0,n(r(t),255))))}},So=class t{constructor(...t){this.init(...t)}clone(){return new t(this)}init(t,i){const s=Array.isArray(t)?{x:t[0],y:t[1]}:"object"==typeof t?{x:t.x,y:t.y}:{x:t,y:i};return this.x=null==s.x?0:s.x,this.y=null==s.y?0:s.y,this}toArray(){return[this.x,this.y]}transform(t){return this.clone().transformO(t)}transformO(t){Mo.isMatrixLike(t)||(t=new Mo(t));const{x:i,y:s}=this;return this.x=t.a*i+t.c*s+t.e,this.y=t.b*i+t.d*s+t.f,this}};function $o(t,i){return Math.abs(i-t)<1e-6}var Mo=class t{constructor(...t){this.init(...t)}static formatTransforms(t){const i="both"===t.flip||!0===t.flip,s=t.flip&&(i||"x"===t.flip)?-1:1,e=t.flip&&(i||"y"===t.flip)?-1:1,n=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,r=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,o=t.scale&&t.scale.length?t.scale[0]*s:isFinite(t.scale)?t.scale*s:isFinite(t.scaleX)?t.scaleX*s:s,h=t.scale&&t.scale.length?t.scale[1]*e:isFinite(t.scale)?t.scale*e:isFinite(t.scaleY)?t.scaleY*e:e,a=t.shear||0,l=t.rotate||t.theta||0,c=new So(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),u=c.x,d=c.y,f=new So(t.position??t.px??t.positionX??NaN,t.py??t.positionY??NaN),p=f.x,v=f.y,g=new So(t.translate||t.tx||t.translateX,t.ty||t.translateY),m=g.x,b=g.y,y=new So(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:o,scaleY:h,skewX:n,skewY:r,shear:a,theta:l,rx:y.x,ry:y.y,tx:m,ty:b,ox:u,oy:d,px:p,py:v}}static fromArray(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}static isMatrixLike(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}static matrixMultiply(t,i,s){const e=t.b*i.a+t.d*i.b,n=t.a*i.c+t.c*i.d,r=t.b*i.c+t.d*i.d,o=t.e+t.a*i.e+t.c*i.f,h=t.f+t.b*i.e+t.d*i.f;return s.a=t.a*i.a+t.c*i.b,s.b=e,s.c=n,s.d=r,s.e=o,s.f=h,s}around(t,i,s){return this.clone().aroundO(t,i,s)}aroundO(t,i,s){const e=t||0,n=i||0;return this.translateO(-e,-n).lmultiplyO(s).translateO(e,n)}clone(){return new t(this)}decompose(t=0,i=0){const s=this.a,e=this.b,n=this.c,r=this.d,o=this.e,h=this.f,a=s*r-e*n,l=a>0?1:-1,c=l*Math.sqrt(s*s+e*e),u=Math.atan2(l*e,l*s),d=(s*n+e*r)/a;return{scaleX:c,scaleY:n*c/(d*s-e)||r*c/(d*e+s),shear:d,rotate:180/Math.PI*u,translateX:o-t+t*s+i*n,translateY:h-i+t*e+i*r,originX:t,originY:i,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}equals(i){if(i===this)return!0;const s=new t(i);return $o(this.a,s.a)&&$o(this.b,s.b)&&$o(this.c,s.c)&&$o(this.d,s.d)&&$o(this.e,s.e)&&$o(this.f,s.f)}flip(t,i){return this.clone().flipO(t,i)}flipO(t,i){return"x"===t?this.scaleO(-1,1,i,0):"y"===t?this.scaleO(1,-1,0,i):this.scaleO(-1,-1,t,i||t)}init(i){const s=t.fromArray([1,0,0,1,0,0]);return i=i instanceof qo?i.matrixify():"string"==typeof i?t.fromArray(i.split(vo).map(parseFloat)):Array.isArray(i)?t.fromArray(i):"object"==typeof i&&t.isMatrixLike(i)?i:"object"==typeof i?(new t).transform(i):6===arguments.length?t.fromArray([].slice.call(arguments)):s,this.a=null!=i.a?i.a:s.a,this.b=null!=i.b?i.b:s.b,this.c=null!=i.c?i.c:s.c,this.d=null!=i.d?i.d:s.d,this.e=null!=i.e?i.e:s.e,this.f=null!=i.f?i.f:s.f,this}inverse(){return this.clone().inverseO()}inverseO(){const t=this.a,i=this.b,s=this.c,e=this.d,n=this.e,r=this.f,o=t*e-i*s;if(!o)throw new Error("Cannot invert "+this);const h=e/o,a=-i/o,l=-s/o,c=t/o,u=-(h*n+l*r),d=-(a*n+c*r);return this.a=h,this.b=a,this.c=l,this.d=c,this.e=u,this.f=d,this}lmultiply(t){return this.clone().lmultiplyO(t)}lmultiplyO(i){const s=i instanceof t?i:new t(i);return t.matrixMultiply(s,this,this)}multiply(t){return this.clone().multiplyO(t)}multiplyO(i){const s=i instanceof t?i:new t(i);return t.matrixMultiply(this,s,this)}rotate(t,i,s){return this.clone().rotateO(t,i,s)}rotateO(t,i=0,s=0){t=Ar(t);const e=Math.cos(t),n=Math.sin(t),{a:r,b:o,c:h,d:a,e:l,f:c}=this;return this.a=r*e-o*n,this.b=o*e+r*n,this.c=h*e-a*n,this.d=a*e+h*n,this.e=l*e-c*n+s*n-i*e+i,this.f=c*e+l*n-i*n-s*e+s,this}scale(){return this.clone().scaleO(...arguments)}scaleO(t,i=t,s=0,e=0){3===arguments.length&&(e=s,s=i,i=t);const{a:n,b:r,c:o,d:h,e:a,f:l}=this;return this.a=n*t,this.b=r*i,this.c=o*t,this.d=h*i,this.e=a*t-s*t+s,this.f=l*i-e*i+e,this}shear(t,i,s){return this.clone().shearO(t,i,s)}shearO(t,i=0,s=0){const{a:e,b:n,c:r,d:o,e:h,f:a}=this;return this.a=e+n*t,this.c=r+o*t,this.e=h+a*t-s*t,this}skew(){return this.clone().skewO(...arguments)}skewO(t,i=t,s=0,e=0){3===arguments.length&&(e=s,s=i,i=t),t=Ar(t),i=Ar(i);const n=Math.tan(t),r=Math.tan(i),{a:o,b:h,c:a,d:l,e:c,f:u}=this;return this.a=o+h*n,this.b=h+o*r,this.c=a+l*n,this.d=l+a*r,this.e=c+u*n-e*n,this.f=u+c*r-s*r,this}skewX(t,i,s){return this.skew(t,0,i,s)}skewY(t,i,s){return this.skew(0,t,i,s)}toArray(){return[this.a,this.b,this.c,this.d,this.e,this.f]}toString(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}transform(i){if(t.isMatrixLike(i))return new t(i).multiplyO(this);const s=t.formatTransforms(i),{x:e,y:n}=new So(s.ox,s.oy).transform(this),r=(new t).translateO(s.rx,s.ry).lmultiplyO(this).translateO(-e,-n).scaleO(s.scaleX,s.scaleY).skewO(s.skewX,s.skewY).shearO(s.shear).rotateO(s.theta).translateO(e,n);if(isFinite(s.px)||isFinite(s.py)){const t=new So(e,n).transform(r),i=isFinite(s.px)?s.px-t.x:0,o=isFinite(s.py)?s.py-t.y:0;r.translateO(i,o)}return r.translateO(s.tx,s.ty),r}translate(t,i){return this.clone().translateO(t,i)}translateO(t,i){return this.e+=t||0,this.f+=i||0,this}valueOf(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}};function _o(){if(!_o.nodes||_o.nodes.svg.node.ownerDocument!==jr.document){const t=Vr().size(2,0);t.node.style.cssText=["opacity: 0","position: absolute","left: -100%","top: -100%","overflow: hidden"].join(";"),t.attr("focusable","false"),t.attr("aria-hidden","true"),_o.nodes={svg:t,path:t.path().node}}return _o.nodes.svg.node.parentNode||_o.nodes.svg.addTo(jr.document.body||jr.document.documentElement),_o.nodes}function Ro(t){return!(t.width||t.height||t.x||t.y)}Kr(Mo,"Matrix");var Oo=class t{constructor(...t){this.init(...t)}addOffset(){return this.x+=jr.window.pageXOffset,this.y+=jr.window.pageYOffset,new t(this)}init(t){return t="string"==typeof t?t.split(vo).map(parseFloat):Array.isArray(t)?t:"object"==typeof t?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0]||0,this.y=t[1]||0,this.width=this.w=t[2]||0,this.height=this.h=t[3]||0,this.x2=this.x+this.w,this.y2=this.y+this.h,this.cx=this.x+this.w/2,this.cy=this.y+this.h/2,this}isNulled(){return Ro(this)}merge(i){const s=Math.min(this.x,i.x),e=Math.min(this.y,i.y),n=Math.max(this.x+this.width,i.x+i.width)-s,r=Math.max(this.y+this.height,i.y+i.height)-e;return new t(s,e,n,r)}toArray(){return[this.x,this.y,this.width,this.height]}toString(){return this.x+" "+this.y+" "+this.width+" "+this.height}transform(i){i instanceof Mo||(i=new Mo(i));let s=1/0,e=-1/0,n=1/0,r=-1/0;return[new So(this.x,this.y),new So(this.x2,this.y),new So(this.x,this.y2),new So(this.x2,this.y2)].forEach((function(t){t=t.transform(i),s=Math.min(s,t.x),e=Math.max(e,t.x),n=Math.min(n,t.y),r=Math.max(r,t.y)})),new t(s,n,e-s,r-n)}};function ko(t,i,s){let e;try{if(e=i(t.node),Ro(e)&&(n=t.node)!==jr.document&&!(jr.document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===jr.document}).call(jr.document.documentElement,n))throw new Error("Element not in the dom")}catch(i){e=s(t)}var n;return e}fn({viewbox:{viewbox(t,i,s,e){return null==t?new Oo(this.attr("viewBox")):this.attr("viewBox",new Oo(t,i,s,e))},zoom(t,i){let{width:s,height:e}=this.attr(["width","height"]);if((s||e)&&"string"!=typeof s&&"string"!=typeof e||(s=this.node.clientWidth,e=this.node.clientHeight),!s||!e)throw new Error("Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element");const n=this.viewbox(),r=s/n.width,o=e/n.height,h=Math.min(r,o);if(null==t)return h;let a=h/t;a===1/0&&(a=Number.MAX_SAFE_INTEGER/100),i=i||new So(s/2/r+n.x,e/2/o+n.y);const l=new Oo(n).transform(new Mo({scale:a,origin:i}));return this.viewbox(l)}}}),Kr(Oo,"Box");var Eo=class extends Array{constructor(t=[],...i){if(super(t,...i),"number"==typeof t)return this;this.length=0,this.push(...t)}};io([Eo],{each(t,...i){return this.map("function"==typeof t?(i,s,e)=>t.call(i,i,s,e):s=>s[t](...i))},toArray(){return Array.prototype.concat.apply([],this)}});const Lo=["toArray","constructor","each"];function To(t){let i=(t+"").trim();const s=i.match(/^url\((.*)\)$/i);if(s){i=s[1].trim();const t=i[0];if('"'===t||"'"===t){if(i[i.length-1]!==t)return null;i=i.slice(1,-1)}}const e=i.match(oo);return e?e[1].slice(1):null}function Ao(t,i){const s=`#${jr.window.CSS.escape(i)}`;return 1===t.nodeType&&t.matches(s)?t:t.querySelector(s)}function Co(t,i,s=`[${i}]`){const e=t.getAttribute("id"),n=t.getRootNode();if(!e||Ao(n,e)!==t)return new Eo;const r=[];1===n.nodeType&&n.matches(s)&&To(n.getAttribute(i))===e&&r.push(Jr(n));for(const t of n.querySelectorAll(s))To(t.getAttribute(i))===e&&r.push(Jr(t));return new Eo(r)}Eo.extend=function(t){t=t.reduce(((t,i)=>((0,Lr.default)(Lo).call(Lo,i)||"_"===i[0]||(i in Array.prototype&&(t["$"+i]=Array.prototype[i]),t[i]=function(...t){return this.each(i,...t)}),t)),{}),io([Eo],t)};let Po=0;const No=new WeakMap,Do=new WeakMap,Uo=()=>Object.create(null);function zo(t){const i=t.getEventHolder();let s=No.get(i);return s||(s=Uo(),No.set(i,s)),s}function Fo(t){return t.getEventTarget()}function Wo(t,i,s,e,n){const r=s.bind(e||t),o=n||!1,h=Vr(t),a=zo(h),l=Fo(h);i=Array.isArray(i)?i:i.split(vo);let c=Do.get(s);c||(c=++Po,Do.set(s,c)),i.forEach((function(t){const i=t.split(".")[0],s=t.split(".")[1]||"*";a[i]=a[i]||Uo(),a[i][s]=a[i][s]||Uo(),a[i][s][c]=a[i][s][c]||[],a[i][s][c].push({listener:r,options:o}),l.addEventListener(i,r,o)}))}function Go(t,i,s,e){const n=Vr(t),r=zo(n),o=Fo(n);("function"!=typeof s||(s=Do.get(s)))&&(i=Array.isArray(i)?i:(i||"").split(vo)).forEach((function(t){const i=t&&t.split(".")[0],h=t&&t.split(".")[1];let a,l;if(s){if(r[i]&&r[i][h||"*"]){const t=r[i][h||"*"][s];if(!t)return;t.forEach((function(t){o.removeEventListener(i,t.listener,t.options??e??!1)})),delete r[i][h||"*"][s]}}else if(i&&h){if(r[i]&&r[i][h]){for(l in r[i][h])Go(o,[i,h].join("."),l);delete r[i][h]}}else if(h)for(t in r)for(a in r[t])h===a&&Go(o,[t,h].join("."));else if(i){if(r[i]){for(a in r[i])Go(o,[i,a].join("."));delete r[i]}}else{for(t in r)Go(o,t);!function(t){No.delete(t.getEventHolder())}(n)}}))}var jo=class extends Ir{addEventListener(){}dispatch(t,i,s){return function(t,i,s,e){const n=Fo(t);return i instanceof jr.window.Event||(i=new jr.window.CustomEvent(i,{detail:s,cancelable:!0,...e})),n.dispatchEvent(i),i}(this,t,i,s)}dispatchEvent(t){const i=zo(this)[t.type];if(!i)return!0;for(const s in i)for(const e in i[s])i[s][e].forEach((function(i){i.listener(t)}));return!t.defaultPrevented}fire(t,i,s){return this.dispatch(t,i,s),this}getEventHolder(){return this}getEventTarget(){return this}off(t,i,s){return Go(this,t,i,s),this}on(t,i,s,e){return Wo(this,t,i,s,e),this}removeEventListener(){}};function Io(){}Kr(jo,"EventTarget");const Yo={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","text-anchor":"start"};var Bo=class extends Array{constructor(...t){super(...t),this.init(...t)}clone(){return new this.constructor(this)}init(t){return"number"==typeof t||(this.length=0,this.push(...this.parse(t))),this}parse(t=[]){return t instanceof Array?t:t.trim().split(vo).map(parseFloat)}toArray(){return Array.prototype.concat.apply([],this)}toSet(){return new Set(this)}toString(){return this.join(" ")}valueOf(){const t=[];return t.push(...this),t}},Ho=class t{constructor(...t){this.init(...t)}convert(i){return new t(this.value,i)}divide(i){return i=new t(i),new t(this/i,this.unit||i.unit)}init(i,s){return s=Array.isArray(i)?i[1]:s,i=Array.isArray(i)?i[0]:i,this.value=0,this.unit=s||"","number"==typeof i?this.value=isNaN(i)?0:isFinite(i)?i:i<0?-34e37:34e37:"string"==typeof i?(s=i.match(eo))&&(this.value=parseFloat(s[1]),"%"===s[5]?this.value/=100:"s"===s[5]&&(this.value*=1e3),this.unit=s[5]):i instanceof t&&(this.value=i.valueOf(),this.unit=i.unit),this}minus(i){return i=new t(i),new t(this-i,this.unit||i.unit)}plus(i){return i=new t(i),new t(this+i,this.unit||i.unit)}times(i){return i=new t(i),new t(this*i,this.unit||i.unit)}toArray(){return[this.value,this.unit]}toJSON(){return this.toString()}toString(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}valueOf(){return this.value}};const Vo=new Set(["fill","stroke","color","bgcolor","stop-color","flood-color","lighting-color"]),Xo=[];var Jo=class t extends jo{constructor(t,i){super(),this.node=t,this.type=t.nodeName,i&&t!==i&&this.attr(i)}add(t,i){return(t=Vr(t)).removeNamespace&&this.node instanceof jr.window.SVGElement&&t.removeNamespace(),null==i?this.node.appendChild(t.node):t.node!==this.node.childNodes[i]&&this.node.insertBefore(t.node,this.node.childNodes[i]),this}addTo(t,i){return Vr(t).put(this,i)}children(){return new Eo(Tr(this.node.children,(function(t){return Jr(t)})))}clear(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}clone(t=!0,i=!0){this.writeDataToDom();let s=this.node.cloneNode(t);return i&&(s=to(s)),new this.constructor(s)}each(t,i){const s=this.children();let e,n;for(e=0,n=s.length;e<n;e++)t.apply(s[e],[e,s]),i&&s[e].each(t,i);return this}element(i,s){return this.put(new t(Hr(i),s))}first(){return Jr(this.node.firstChild)}get(t){return Jr(this.node.childNodes[t])}getEventHolder(){return this.node}getEventTarget(){return this.node}has(t){return this.index(t)>=0}html(t,i){return this.xml(t,i,"http://www.w3.org/1999/xhtml")}id(t){return void 0!==t||this.node.id||(this.node.id=Zr(this.type)),this.attr("id",t)}index(t){return[].slice.call(this.node.childNodes).indexOf(t.node)}last(){return Jr(this.node.lastChild)}matches(t){const i=this.node,s=i.matches||i.matchesSelector||i.msMatchesSelector||i.mozMatchesSelector||i.webkitMatchesSelector||i.oMatchesSelector||null;return s&&s.call(i,t)}parent(t){let i=this;if(!i.node.parentNode)return null;if(i=Jr(i.node.parentNode),!t)return i;do{if("string"==typeof t?i.matches(t):i instanceof t)return i}while(i=Jr(i.node.parentNode));return i}put(t,i){return t=Vr(t),this.add(t,i),t}putIn(t,i){return Vr(t).add(this,i)}remove(){return this.parent()&&this.parent().removeElement(this),this}removeElement(t){return this.node.removeChild(t.node),this}replace(t){return t=Vr(t),this.node.parentNode&&this.node.parentNode.replaceChild(t.node,this.node),t}round(t=2,i=null){const s=10**t,e=this.attr(i);for(const t in e)"number"==typeof e[t]&&(e[t]=Math.round(e[t]*s)/s);return this.attr(e),this}svg(t,i){return this.xml(t,i,Fr)}toString(){return this.id()}words(t){return this.node.textContent=t,this}wrap(t){const i=this.parent();if(!i)return this.addTo(t);const s=i.index(this);return i.put(t,s).put(this)}writeDataToDom(){return this.each((function(){this.writeDataToDom()})),this}xml(t,i,s){if("boolean"==typeof t&&(s=i,i=t,t=null),null==t||"function"==typeof t){i=null==i||i,this.writeDataToDom();let s=this;if(null!=t){if(s=Jr(s.node.cloneNode(!0)),i){const i=t(s);if(s=i||s,!1===i)return""}s.each((function(){const i=t(this),s=i||this;!1===i?this.remove():i&&this!==s&&this.replace(s)}),!0)}return i?s.node.outerHTML:s.node.innerHTML}i=null!=i&&i;const e=Hr("wrapper",s),n=jr.document.createDocumentFragment();e.innerHTML=t;for(let t=e.children.length;t--;)n.appendChild(e.firstElementChild);const r=this.parent();return i?this.replace(n)&&r:this.add(n)}};io(Jo,{attr:function(t,i,s){if(null==t){t={},i=this.node.attributes;for(const s of i)t[s.nodeName]=fo.test(s.nodeValue)?parseFloat(s.nodeValue):s.nodeValue;return t}if(t instanceof Array)return t.reduce(((t,i)=>(t[i]=this.attr(i),t)),{});if("object"==typeof t&&t.constructor===Object)for(i in t)this.attr(i,t[i]);else if(null===i)this.node.removeAttribute(t);else{if(null==i)return null==(i=this.node.getAttribute(t))?Yo[t]:fo.test(i)?parseFloat(i):i;"number"==typeof(i=Xo.reduce(((i,s)=>s(t,i,this)),i))?i=new Ho(i):Vo.has(t)&&xo.isColor(i)?i=new xo(i):i.constructor===Array&&(i=new Bo(i)),"leading"===t?this.leading&&this.leading(i):"string"==typeof s?this.node.setAttributeNS(s,t,i.toString()):this.node.setAttribute(t,i.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this},find:function(t){return function(t,i){return new Eo(Tr((i||jr.document).querySelectorAll(t),(function(t){return Jr(t)})))}(t,this.node)},findOne:function(t){return Jr(this.node.querySelector(t))}}),Kr(Jo,"Dom");var qo=class extends Jo{constructor(t,i){super(t,i),this.dom={},this.node.instance=this,(t.hasAttribute("data-svgjs")||t.hasAttribute("svgjs:data"))&&this.setData(JSON.parse(t.getAttribute("data-svgjs"))??JSON.parse(t.getAttribute("svgjs:data"))??{})}center(t,i){return this.cx(t).cy(i)}cx(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)}cy(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)}defs(){const t=this.root();return t&&t.defs()}dmove(t,i){return this.dx(t).dy(i)}dx(t=0){return this.x(new Ho(t).plus(this.x()))}dy(t=0){return this.y(new Ho(t).plus(this.y()))}getEventHolder(){return this}height(t){return this.attr("height",t)}move(t,i){return this.x(t).y(i)}parents(t=this.root()){const i="string"==typeof t,s=this.root(),e=s&&s.node;i||(t=t&&Vr(t).node);const n=new Eo;let r=this;for(;(r=r.parent())&&r.node!==jr.document&&"#document-fragment"!==r.node.nodeName&&(n.push(r),i||r.node!==t)&&(!i||!r.matches(t));)if(e&&r.node===e)return null;return n}reference(t){if(!(t=this.attr(t)))return null;const i=function(t,i){const s=To(i);return s?Ao(t.getRootNode(),s):null}(this.node,t);return i?Vr(i):null}root(){const t=this.parent(Yr[Br]);return t&&t.root()}setData(t){return this.dom=t,this}size(t,i){const s=Nr(this,t,i);return this.width(new Ho(s.width)).height(new Ho(s.height))}width(t){return this.attr("width",t)}writeDataToDom(t){return((t,i,s={})=>{const e={...this.dom};for(const t in e)e[t].valueOf()===s[t]&&delete e[t];Object.keys(e).length?t.node.setAttribute("data-svgjs",JSON.stringify(e)):(t.node.removeAttribute("data-svgjs"),t.node.removeAttribute("svgjs:data"))})(this,0,t),super.writeDataToDom()}x(t){return this.attr("x",t)}y(t){return this.attr("y",t)}};io(qo,{bbox:function(){const t=ko(this,(t=>t.getBBox()),(t=>{try{const i=t.clone().addTo(_o().svg).show(),s=i.node.getBBox();return i.remove(),s}catch(i){throw new Error(`Getting bbox of element "${t.node.nodeName}" is not possible: ${i.toString()}`)}}));return new Oo(t)},rbox:function(t){const i=ko(this,(t=>t.getBoundingClientRect()),(t=>{throw new Error(`Getting rbox of element "${t.node.nodeName}" is not possible`)})),s=new Oo(i);return t?s.transform(t.screenCTM().inverseO()):s.addOffset()},inside:function(t,i){const s=this.bbox();return t>s.x&&i>s.y&&t<s.x+s.width&&i<s.y+s.height},point:function(t,i){return new So(t,i).transformO(this.screenCTM().inverseO())},ctm:function(){return new Mo(this.node.getCTM())},screenCTM:function(){try{if("function"==typeof this.isRoot&&!this.isRoot()){const t=this.rect(1,1),i=t.node.getScreenCTM();return t.remove(),new Mo(i)}return new Mo(this.node.getScreenCTM())}catch(t){return console.warn(`Cannot get CTM from SVG node ${this.node.nodeName}. Is the element rendered?`),new Mo}}}),Kr(qo,"Element");const Ko={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(t,i){return"color"===i?t:t+"-"+i}};["fill","stroke"].forEach((function(t){const i={};let s;i[t]=function(i){if(void 0===i)return this.attr(t);if("string"==typeof i||i instanceof xo||xo.isRgb(i)||i instanceof qo)this.attr(t,i);else for(s=Ko[t].length-1;s>=0;s--)null!=i[Ko[t][s]]&&this.attr(Ko.prefix(t,Ko[t][s]),i[Ko[t][s]]);return this},fn(["Element","Runner"],i)})),fn(["Element","Runner"],{matrix:function(t,i,s,e,n,r){return null==t?new Mo(this):this.attr("transform",new Mo(t,i,s,e,n,r))},rotate:function(t,i,s){return this.transform({rotate:t,ox:i,oy:s},!0)},skew:function(t,i,s,e){return this.transform(1===arguments.length||3===arguments.length?{skew:t,ox:i,oy:s}:{skew:[t,i],ox:s,oy:e},!0)},shear:function(t,i,s){return this.transform({shear:t,ox:i,oy:s},!0)},scale:function(t,i,s,e){return this.transform(1===arguments.length||3===arguments.length?{scale:t,ox:i,oy:s}:{scale:[t,i],ox:s,oy:e},!0)},translate:function(t,i){return this.transform({translate:[t,i]},!0)},relative:function(t,i){return this.transform({relative:[t,i]},!0)},flip:function(t="both",i="center"){return-1==="xybothtrue".indexOf(t)&&(i=t,t="both"),this.transform({flip:t,origin:i},!0)},opacity:function(t){return this.attr("opacity",t)}}),fn("radius",{radius:function(t,i=t){return"radialGradient"===(this._element||this).type?this.attr("r",new Ho(t)):this.rx(t).ry(i)}}),fn("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new So(this.node.getPointAtLength(t))}}),fn(["Element","Runner"],{font:function(t,i){if("object"==typeof t){for(i in t)this.font(i,t[i]);return this}return"leading"===t?this.leading(i):this.attr("anchor"===t?"text-anchor":"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?"font-"+t:t,i)}}),fn("Element",["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel","contextmenu","wheel","pointerdown","pointermove","pointerup","pointerleave","pointercancel"].reduce((function(t,i){return t[i]=function(t){return null===t?this.off(i):this.on(i,t),this},t}),{})),fn("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(ho).slice(0,-1).map((function(t){const i=t.trim().split("(");return[i[0].trim(),i[1].split(vo).map((function(t){return parseFloat(t)}))]})).reverse().reduce((function(t,i){return"matrix"===i[0]?t.lmultiply(Mo.fromArray(i[1])):t[i[0]].apply(t,i[1])}),new Mo)},toParent:function(t,i){if(this===t)return this;if(zr(this.node))return this.addTo(t,i);const s=this.screenCTM(),e=t.screenCTM().inverse();return this.addTo(t,i).untransform().transform(e.multiply(s)),this},toRoot:function(t){return this.toParent(this.root(),t)},transform:function(t,i){if(null==t||"string"==typeof t){const i=new Mo(this).decompose();return null==t?i:i[t]}Mo.isMatrixLike(t)||(t={...t,origin:Dr(t,this)});const s=new Mo(!0===i?this:i||!1).transform(t);return this.attr("transform",s)}});var Qo=class t extends qo{flatten(){return this.each((function(){if(this instanceof t)return this.flatten().ungroup()})),this}ungroup(t=this.parent(),i=t.index(this)){return i=-1===i?t.children().length:i,this.each((function(s,e){return e[e.length-s-1].toParent(t,i)})),this.remove()}};Kr(Qo,"Container");var Zo=class extends Qo{constructor(t,i=t){super(Xr("defs",t),i)}flatten(){return this}ungroup(){return this}};Kr(Zo,"Defs");var th=class extends qo{};Kr(th,"Shape");var ih=ln({cx:()=>oh,cy:()=>hh,height:()=>lh,rx:()=>sh,ry:()=>eh,width:()=>ah,x:()=>nh,y:()=>rh});function sh(t){return this.attr("rx",t)}function eh(t){return this.attr("ry",t)}function nh(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function rh(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function oh(t){return this.attr("cx",t)}function hh(t){return this.attr("cy",t)}function ah(t){return null==t?2*this.rx():this.rx(new Ho(t).divide(2))}function lh(t){return null==t?2*this.ry():this.ry(new Ho(t).divide(2))}var ch=class extends th{constructor(t,i=t){super(Xr("ellipse",t),i)}size(t,i){const s=Nr(this,t,i);return this.rx(new Ho(s.width).divide(2)).ry(new Ho(s.height).divide(2))}};io(ch,ih),fn("Container",{ellipse:so((function(t=0,i=t){return this.put(new ch).size(t,i).move(0,0)}))}),Kr(ch,"Ellipse");var uh=class extends Jo{constructor(t=jr.document.createDocumentFragment()){super(t)}xml(t,i,s){if("boolean"==typeof t&&(s=i,i=t,t=null),null==t||"function"==typeof t){const t=new Jo(Hr("wrapper",s));return t.add(this.node.cloneNode(!0)),t.xml(!1,s)}return super.xml(t,!1,s)}};Kr(uh,"Fragment");var dh=ln({from:()=>fh,to:()=>ph});function fh(t,i){return this.attr("radialGradient"===(this._element||this).type?{fx:new Ho(t),fy:new Ho(i)}:{x1:new Ho(t),y1:new Ho(i)})}function ph(t,i){return this.attr("radialGradient"===(this._element||this).type?{cx:new Ho(t),cy:new Ho(i)}:{x2:new Ho(t),y2:new Ho(i)})}var vh=class extends Qo{constructor(t,i){super(Xr(t+"Gradient","string"==typeof t?null:t),i)}attr(t,i,s){return"transform"===t&&(t="gradientTransform"),super.attr(t,i,s)}bbox(){return new Oo}targets(){return Co(this.node,"fill")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}};io(vh,dh),fn({Container:{gradient(...t){return this.defs().gradient(...t)}},Defs:{gradient:so((function(t,i){return this.put(new vh(t)).update(i)}))}}),Kr(vh,"Gradient");var gh=class extends Qo{constructor(t,i=t){super(Xr("pattern",t),i)}attr(t,i,s){return"transform"===t&&(t="patternTransform"),super.attr(t,i,s)}bbox(){return new Oo}targets(){return Co(this.node,"fill")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}};fn({Container:{pattern(...t){return this.defs().pattern(...t)}},Defs:{pattern:so((function(t,i,s){return this.put(new gh).update(s).attr({x:0,y:0,width:t,height:i,patternUnits:"userSpaceOnUse"})}))}}),Kr(gh,"Pattern");var mh=class extends th{constructor(t,i=t){super(Xr("image",t),i)}load(t,i){if(!t)return this;const s=new jr.window.Image;return Wo(s,"load",(function(t){const e=this.parent(gh);0===this.width()&&0===this.height()&&this.size(s.width,s.height),e instanceof gh&&0===e.width()&&0===e.height()&&e.size(this.width(),this.height()),"function"==typeof i&&i.call(this,t)}),this),Wo(s,"load error",(function(){Go(s)})),this.attr("href",s.src=t,Gr)}};Xo.push((function(t,i,s){return"fill"!==t&&"stroke"!==t||po.test(i)&&(i=s.root().defs().image(i)),i instanceof mh&&(i=s.root().defs().pattern(0,0,(t=>{t.add(i)}))),i})),fn({Container:{image:so((function(t,i){return this.put(new mh).size(0,0).load(t,i)}))}}),Kr(mh,"Image");var bh=class extends Bo{bbox(){let t=-1/0,i=-1/0,s=1/0,e=1/0;return this.forEach((function(n){t=Math.max(n[0],t),i=Math.max(n[1],i),s=Math.min(n[0],s),e=Math.min(n[1],e)})),new Oo(s,e,t-s,i-e)}move(t,i){const s=this.bbox();if(t-=s.x,i-=s.y,!isNaN(t)&&!isNaN(i))for(let s=this.length-1;s>=0;s--)this[s]=[this[s][0]+t,this[s][1]+i];return this}parse(t=[0,0]){const i=[];(t=t instanceof Array?Array.prototype.concat.apply([],t):t.trim().split(vo).map(parseFloat)).length%2!=0&&t.pop();for(let s=0,e=t.length;s<e;s+=2)i.push([t[s],t[s+1]]);return i}size(t,i){let s;const e=this.bbox();for(s=this.length-1;s>=0;s--)e.width&&(this[s][0]=(this[s][0]-e.x)*t/e.width+e.x),e.height&&(this[s][1]=(this[s][1]-e.y)*i/e.height+e.y);return this}toLine(){return{x1:this[0][0],y1:this[0][1],x2:this[1][0],y2:this[1][1]}}toString(){const t=[];for(let i=0,s=this.length;i<s;i++)t.push(this[i].join(","));return t.join(" ")}transform(t){return this.clone().transformO(t)}transformO(t){Mo.isMatrixLike(t)||(t=new Mo(t));for(let i=this.length;i--;){const[s,e]=this[i];this[i][0]=t.a*s+t.c*e+t.e,this[i][1]=t.b*s+t.d*e+t.f}return this}},yh=ln({MorphArray:()=>wh,height:()=>Mh,width:()=>$h,x:()=>xh,y:()=>Sh});const wh=bh;function xh(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}function Sh(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}function $h(t){const i=this.bbox();return null==t?i.width:this.size(t,i.height)}function Mh(t){const i=this.bbox();return null==t?i.height:this.size(i.width,t)}var _h=class extends th{constructor(t,i=t){super(Xr("line",t),i)}array(){return new bh([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])}move(t,i){return this.attr(this.array().move(t,i).toLine())}plot(t,i,s,e){return null==t?this.array():(t=void 0!==i?{x1:t,y1:i,x2:s,y2:e}:new bh(t).toLine(),this.attr(t))}size(t,i){const s=Nr(this,t,i);return this.attr(this.array().size(s.width,s.height).toLine())}};io(_h,yh),fn({Container:{line:so((function(...t){return _h.prototype.plot.apply(this.put(new _h),null!=t[0]?t:[0,0,0,0])}))}}),Kr(_h,"Line");var Rh=class extends Qo{constructor(t,i=t){super(Xr("marker",t),i)}height(t){return this.attr("markerHeight",t)}orient(t){return this.attr("orient",t)}ref(t,i){return this.attr("refX",t).attr("refY",i)}toString(){return"url(#"+this.id()+")"}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}width(t){return this.attr("markerWidth",t)}};function Oh(t,i){return function(s){return null==s?this[t]:(this[t]=s,i&&i.call(this),this)}}fn({Container:{marker(...t){return this.defs().marker(...t)}},Defs:{marker:so((function(t,i,s){return this.put(new Rh).size(t,i).ref(t/2,i/2).viewbox(0,0,t,i).attr("orient","auto").update(s)}))},marker:{marker(t,i,s,e){let n=["marker"];return"all"!==t&&n.push(t),n=n.join("-"),t=arguments[1]instanceof Rh?arguments[1]:this.defs().marker(i,s,e),this.attr(n,t)}}}),Kr(Rh,"Marker");const kh={"-":function(t){return t},"<>":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(t,i,s,e){return function(n){return n<0?t>0?i/t*n:s>0?e/s*n:0:n>1?s<1?(1-e)/(1-s)*n+(e-s)/(1-s):t<1?(1-i)/(1-t)*n+(i-t)/(1-t):1:3*n*(1-n)**2*i+3*n**2*(1-n)*e+n**3}},steps:function(t,i="end"){i=i.split("-").reverse()[0];let s=t;return"none"===i?--s:"both"===i&&++s,(e,n=!1)=>{let r=Math.floor(e*t);const o=e*r%1==0;return"start"!==i&&"both"!==i||++r,n&&o&&--r,e>=0&&r<0&&(r=0),e<=1&&r>s&&(r=s),r/s}}};var Eh=class{done(){return!1}},Lh=class extends Eh{constructor(t=">"){super(),this.ease=kh[t]||t}step(t,i,s){return"number"!=typeof t?s<1?t:i:t+(i-t)*this.ease(s)}},Th=class extends Eh{constructor(t){super(),this.stepper=t}done(t){return t.done}step(t,i,s,e){return this.stepper(t,i,s,e)}};function Ah(){const t=(this._duration||500)/1e3,i=Math.PI,s=Math.log((this._overshoot||0)/100+1e-10),e=-s/Math.sqrt(i*i+s*s),n=3.9/(e*t);this.d=2*e*n,this.k=n*n}io(class extends Th{constructor(t=500,i=0){super(),this.duration(t).overshoot(i)}step(t,i,s,e){if("string"==typeof t)return t;if(e.done=s===1/0,s===1/0)return i;if(0===s)return t;s>100&&(s=16);const n=e.velocity||0,r=-this.d*n-this.k*(t-i),o=t+n*(s/=1e3)+r*s*s/2;return e.velocity=n+r*s,e.done=Math.abs(i-o)+Math.abs(n)<.002,e.done?i:o}},{duration:Oh("_duration",Ah),overshoot:Oh("_overshoot",Ah)}),io(class extends Th{constructor(t=.1,i=.01,s=0,e=1e3){super(),this.p(t).i(i).d(s).windup(e)}step(t,i,s,e){if("string"==typeof t)return t;if(e.done=s===1/0,s===1/0)return i;if(0===s)return t;const n=i-t;let r=(e.integral||0)+n*s;const o=(n-(e.error||0))/s,h=this._windup;return!1!==h&&(r=Math.max(-h,Math.min(r,h))),e.error=n,e.integral=r,e.done=Math.abs(n)<.001,e.done?i:t+(this.P*n+this.I*r+this.D*o)}},{windup:Oh("_windup"),p:Oh("P"),i:Oh("I"),d:Oh("D")});const Ch={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},Ph={M:function(t,i,s){return i.x=s.x=t[0],i.y=s.y=t[1],["M",i.x,i.y]},L:function(t,i){return i.x=t[0],i.y=t[1],["L",t[0],t[1]]},H:function(t,i){return i.x=t[0],["H",t[0]]},V:function(t,i){return i.y=t[0],["V",t[0]]},C:function(t,i){return i.x=t[4],i.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,i){return i.x=t[2],i.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,i){return i.x=t[2],i.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,i){return i.x=t[0],i.y=t[1],["T",t[0],t[1]]},Z:function(t,i,s){return i.x=s.x,i.y=s.y,["Z"]},A:function(t,i){return i.x=t[5],i.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},Nh="mlhvqtcsaz".split("");for(let t=0,i=Nh.length;t<i;++t)Ph[Nh[t]]=function(t){return function(i,s,e){if("H"===t)i[0]=i[0]+s.x;else if("V"===t)i[0]=i[0]+s.y;else if("A"===t)i[5]=i[5]+s.x,i[6]=i[6]+s.y;else for(let t=0,e=i.length;t<e;++t)i[t]=i[t]+(t%2?s.y:s.x);return Ph[t](i,s,e)}}(Nh[t].toUpperCase());function Dh(t){return t.segment.length&&t.segment.length-1===Ch[t.segment[0].toUpperCase()]}function Uh(t,i){t.inNumber&&zh(t,!1);const s=go.test(i);if(s)t.segment=[i];else{const i=t.lastCommand,s=i.toLowerCase();t.segment=["m"===s?i===s?"l":"L":i]}return t.inSegment=!0,t.lastCommand=t.segment[0],s}function zh(t,i){if(!t.inNumber)throw new Error("Parser Error");t.number&&t.segment.push(parseFloat(t.number)),t.inNumber=i,t.number="",t.pointSeen=!1,t.hasExponent=!1,Dh(t)&&Fh(t)}function Fh(t){t.inSegment=!1,t.absolute&&(t.segment=function(t){return Ph[t.segment[0]](t.segment.slice(1),t.p,t.p0)}(t)),t.segments.push(t.segment)}function Wh(t){if(!t.segment.length)return!1;const i="A"===t.segment[0].toUpperCase(),s=t.segment.length;return i&&(4===s||5===s)}function Gh(t){return"E"===t.lastToken.toUpperCase()}const jh=new Set([" ",",","\t","\n","\r","\f"]);var Ih=class extends Bo{bbox(){return _o().path.setAttribute("d",this.toString()),new Oo(_o.nodes.path.getBBox())}move(t,i){const s=this.bbox();if(t-=s.x,i-=s.y,!isNaN(t)&&!isNaN(i))for(let s,e=this.length-1;e>=0;e--)s=this[e][0],"M"===s||"L"===s||"T"===s?(this[e][1]+=t,this[e][2]+=i):"H"===s?this[e][1]+=t:"V"===s?this[e][1]+=i:"C"===s||"S"===s||"Q"===s?(this[e][1]+=t,this[e][2]+=i,this[e][3]+=t,this[e][4]+=i,"C"===s&&(this[e][5]+=t,this[e][6]+=i)):"A"===s&&(this[e][6]+=t,this[e][7]+=i);return this}parse(t="M0 0"){return Array.isArray(t)&&(t=Array.prototype.concat.apply([],t).toString()),function(t,i=!0){let s=0,e="";const n={segment:[],inNumber:!1,number:"",lastToken:"",inSegment:!1,segments:[],pointSeen:!1,hasExponent:!1,absolute:i,p0:new So,p:new So};for(;n.lastToken=e,e=t.charAt(s++);)if(n.inSegment||!Uh(n,e))if("."!==e)if(isNaN(parseInt(e)))if(jh.has(e))n.inNumber&&zh(n,!1);else if("-"!==e&&"+"!==e)if("E"!==e.toUpperCase()){if(go.test(e)){if(n.inNumber)zh(n,!1);else{if(!Dh(n))throw new Error("parser Error");Fh(n)}--s}}else n.number+=e,n.hasExponent=!0;else{if(n.inNumber&&!Gh(n)){zh(n,!1),--s;continue}n.number+=e,n.inNumber=!0}else{if("0"===n.number||Wh(n)){n.inNumber=!0,n.number=e,zh(n,!0);continue}n.inNumber=!0,n.number+=e}else{if(n.pointSeen||n.hasExponent){zh(n,!1),--s;continue}n.inNumber=!0,n.pointSeen=!0,n.number+=e}return n.inNumber&&zh(n,!1),n.inSegment&&Dh(n)&&Fh(n),n.segments}(t)}size(t,i){const s=this.bbox();let e,n;for(s.width=0===s.width?1:s.width,s.height=0===s.height?1:s.height,e=this.length-1;e>=0;e--)n=this[e][0],"M"===n||"L"===n||"T"===n?(this[e][1]=(this[e][1]-s.x)*t/s.width+s.x,this[e][2]=(this[e][2]-s.y)*i/s.height+s.y):"H"===n?this[e][1]=(this[e][1]-s.x)*t/s.width+s.x:"V"===n?this[e][1]=(this[e][1]-s.y)*i/s.height+s.y:"C"===n||"S"===n||"Q"===n?(this[e][1]=(this[e][1]-s.x)*t/s.width+s.x,this[e][2]=(this[e][2]-s.y)*i/s.height+s.y,this[e][3]=(this[e][3]-s.x)*t/s.width+s.x,this[e][4]=(this[e][4]-s.y)*i/s.height+s.y,"C"===n&&(this[e][5]=(this[e][5]-s.x)*t/s.width+s.x,this[e][6]=(this[e][6]-s.y)*i/s.height+s.y)):"A"===n&&(this[e][1]=this[e][1]*t/s.width,this[e][2]=this[e][2]*i/s.height,this[e][6]=(this[e][6]-s.x)*t/s.width+s.x,this[e][7]=(this[e][7]-s.y)*i/s.height+s.y);return this}toString(){return function(t){let i="";for(let s=0,e=t.length;s<e;s++)i+=t[s][0],null!=t[s][1]&&(i+=t[s][1],null!=t[s][2]&&(i+=" ",i+=t[s][2],null!=t[s][3]&&(i+=" ",i+=t[s][3],i+=" ",i+=t[s][4],null!=t[s][5]&&(i+=" ",i+=t[s][5],i+=" ",i+=t[s][6],null!=t[s][7]&&(i+=" ",i+=t[s][7])))));return i+" "}(this)}};const Yh=t=>{const i=typeof t;return"number"===i?Ho:"string"===i?xo.isColor(t)?xo:vo.test(t)?go.test(t)?Ih:Bo:eo.test(t)?Ho:Hh:qh.indexOf(t.constructor)>-1?t.constructor:Array.isArray(t)?Bo:"object"===i?Jh:Hh};var Bh=class{constructor(t){this._stepper=t||new Lh("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}at(t){return this._morphObj.morph(this._from,this._to,t,this._stepper,this._context)}done(){return this._context.map(this._stepper.done).reduce((function(t,i){return t&&i}),!0)}from(t){return null==t?this._from:(this._from=this._set(t),this)}stepper(t){return null==t?this._stepper:(this._stepper=t,this)}to(t){return null==t?this._to:(this._to=this._set(t),this)}type(t){return null==t?this._type:(this._type=t,this)}_set(t){this._type||this.type(Yh(t));let i=new this._type(t);return this._type===xo&&(i=this._to?i[this._to[4]]():this._from?i[this._from[4]]():i),this._type===Jh&&(i=this._to?i.align(this._to):this._from?i.align(this._from):i),i=i.toConsumable(),this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(i.length)).map(Object).map((function(t){return t.done=!0,t})),i}},Hh=class{constructor(...t){this.init(...t)}init(t){return t=Array.isArray(t)?t[0]:t,this.value=t,this}toArray(){return[this.value]}valueOf(){return this.value}},Vh=class t{constructor(...t){this.init(...t)}init(i){return Array.isArray(i)&&(i={scaleX:i[0],scaleY:i[1],shear:i[2],rotate:i[3],translateX:i[4],translateY:i[5],originX:i[6],originY:i[7]}),Object.assign(this,t.defaults,i),this}toArray(){const t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}};Vh.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0};const Xh=(t,i)=>t[0]<i[0]?-1:t[0]>i[0]?1:0;var Jh=class{constructor(...t){this.init(...t)}align(t){const i=this.values;for(let s=0,e=i.length;s<e;++s){if(i[s+1]===t[s+1]){if(i[s+1]===xo&&t[s+7]!==i[s+7]){const i=t[s+7],e=new xo(this.values.splice(s+3,5))[i]().toArray();this.values.splice(s+3,0,...e)}s+=i[s+2]+2;continue}if(!t[s+1])return this;const e=(new t[s+1]).toArray();i.splice(s,i[s+2]+3,t[s],t[s+1],t[s+2],...e),s+=i[s+2]+2}return this}init(t){if(this.values=[],Array.isArray(t))return void(this.values=t.slice());t=t||{};const i=[];for(const s in t){const e=Yh(t[s]),n=new e(t[s]).toArray();i.push([s,e,n.length,...n])}return i.sort(Xh),this.values=i.reduce(((t,i)=>t.concat(i)),[]),this}toArray(){return this.values}valueOf(){const t={},i=this.values;for(;i.length;){const s=i.shift(),e=i.shift(),n=i.shift();t[s]=new e(i.splice(0,n))}return t}};const qh=[Hh,Vh,Jh];var Kh=class extends th{constructor(t,i=t){super(Xr("path",t),i)}array(){return this._array||(this._array=new Ih(this.attr("d")))}clear(){return delete this._array,this}height(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}move(t,i){return this.attr("d",this.array().move(t,i))}plot(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new Ih(t))}size(t,i){const s=Nr(this,t,i);return this.attr("d",this.array().size(s.width,s.height))}width(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}x(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}y(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}};Kh.prototype.MorphArray=Ih,fn({Container:{path:so((function(t){return this.put(new Kh).plot(t||new Ih)}))}}),Kr(Kh,"Path");var Qh=ln({array:()=>Zh,clear:()=>ta,move:()=>ia,plot:()=>sa,size:()=>ea});function Zh(){return this._array||(this._array=new bh(this.attr("points")))}function ta(){return delete this._array,this}function ia(t,i){return this.attr("points",this.array().move(t,i))}function sa(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new bh(t))}function ea(t,i){const s=Nr(this,t,i);return this.attr("points",this.array().size(s.width,s.height))}var na=class extends th{constructor(t,i=t){super(Xr("polygon",t),i)}};fn({Container:{polygon:so((function(t){return this.put(new na).plot(t||new bh)}))}}),io(na,yh),io(na,Qh),Kr(na,"Polygon");var ra=class extends th{constructor(t,i=t){super(Xr("polyline",t),i)}};fn({Container:{polyline:so((function(t){return this.put(new ra).plot(t||new bh)}))}}),io(ra,yh),io(ra,Qh),Kr(ra,"Polyline");var oa=class extends th{constructor(t,i=t){super(Xr("rect",t),i)}};io(oa,{rx:sh,ry:eh}),fn({Container:{rect:so((function(t,i){return this.put(new oa).size(t,i)}))}}),Kr(oa,"Rect");var ha=class{constructor(){this._first=null,this._last=null}first(){return this._first&&this._first.value}last(){return this._last&&this._last.value}push(t){const i=void 0!==t.next?t:{value:t,next:null,prev:null};return this._last?(i.prev=this._last,this._last.next=i,this._last=i):(this._last=i,this._first=i),i}remove(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}shift(){const t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null}};const aa={nextDraw:null,frames:new ha,timeouts:new ha,immediates:new ha,timer:()=>jr.window.performance||jr.window.Date,transforms:[],frame(t){const i=aa.frames.push({run:t});return null===aa.nextDraw&&(aa.nextDraw=jr.window.requestAnimationFrame(aa._draw)),i},timeout(t,i){i=i||0;const s=aa.timer().now()+i,e=aa.timeouts.push({run:t,time:s});return null===aa.nextDraw&&(aa.nextDraw=jr.window.requestAnimationFrame(aa._draw)),e},immediate(t){const i=aa.immediates.push(t);return null===aa.nextDraw&&(aa.nextDraw=jr.window.requestAnimationFrame(aa._draw)),i},cancelFrame(t){null!=t&&aa.frames.remove(t)},clearTimeout(t){null!=t&&aa.timeouts.remove(t)},cancelImmediate(t){null!=t&&aa.immediates.remove(t)},_draw(t){try{let i=null;const s=aa.timeouts.last();for(;(i=aa.timeouts.shift())&&(t>=i.time?i.run():aa.timeouts.push(i),i!==s););let e=null;const n=aa.frames.last();for(;e!==n&&(e=aa.frames.shift());)e.run(t);let r=null;for(;r=aa.immediates.shift();)r()}finally{const t=aa.timeouts.first()||aa.frames.first()||aa.immediates.first();aa.nextDraw=t?jr.window.requestAnimationFrame(aa._draw):null}}},la=function(t){const i=t.start,s=t.runner.duration();return{start:i,duration:s,end:i+s,runner:t.runner}},ca=function(){const t=jr.window;return(t.performance||t.Date).now()};var ua=class extends jo{constructor(t=ca){super(),this._timeSource=t,this.terminate()}active(){return!!this._nextFrame}finish(){return this.time(this.getEndTimeOfTimeline()+1),this.pause()}getEndTime(){const t=this.getLastRunnerInfo(),i=t?t.runner.duration():0;return(t?t.start:this._time)+i}getEndTimeOfTimeline(){const t=this._runners.map((t=>t.start+t.runner.duration()));return Math.max(0,...t)}getLastRunnerInfo(){return this.getRunnerInfoById(this._lastRunnerId)}getRunnerInfoById(t){return this._runners[this._runnerIds.indexOf(t)]||null}pause(){return this._paused=!0,this._continue()}persist(t){return null==t?this._persist:(this._persist=t,this)}play(){return this._paused=!1,this.updateTime()._continue()}reverse(t){const i=this.speed();if(null==t)return this.speed(-i);const s=Math.abs(i);return this.speed(t?-s:s)}schedule(t,i,s){if(null==t)return this._runners.map(la);let e=0;const n=this.getEndTime();if(i=i||0,null==s||"last"===s||"after"===s)e=n;else if("absolute"===s||"start"===s)e=i,i=0;else if("now"===s)e=this._time;else if("relative"===s){const s=this.getRunnerInfoById(t.id);s&&(e=s.start+i,i=0)}else{if("with-last"!==s)throw new Error('Invalid value for the "when" parameter');{const t=this.getLastRunnerInfo();e=t?t.start:this._time}}t.unschedule(),t.timeline(this);const r=t.persist(),o={persist:null===r?this._persist:r,start:e+i,runner:t};return this._lastRunnerId=t.id,this._runners.push(o),this._runners.sort(((t,i)=>t.start-i.start)),this._runnerIds=this._runners.map((t=>t.runner.id)),this.updateTime()._continue(),this}seek(t){return this.time(this._time+t)}source(t){return null==t?this._timeSource:(this._timeSource=t,this)}speed(t){return null==t?this._speed:(this._speed=t,this)}stop(){return this.time(0),this.pause()}time(t){return null==t?this._time:(this._time=t,this._continue(!0))}unschedule(t){const i=this._runnerIds.indexOf(t.id);return i<0||(this._runners.splice(i,1),this._runnerIds.splice(i,1),t.timeline(null)),this}updateTime(){return this.active()||(this._lastSourceTime=this._timeSource()),this}_continue(t=!1){return aa.cancelFrame(this._nextFrame),this._nextFrame=null,t?this._stepImmediate():(this._paused||(this._nextFrame=aa.frame(this._step)),this)}_stepFn(t=!1){const i=this._timeSource();let s=i-this._lastSourceTime;t&&(s=0);const e=this._speed*s+(this._time-this._lastStepTime);this._lastSourceTime=i,t||(this._time+=e,this._time=this._time<0?0:this._time),this._lastStepTime=this._time,this.fire("time",this._time);for(let t=this._runners.length;t--;){const i=this._runners[t];this._time-i.start<=0&&i.runner.reset()}let n=!1;for(let t=0,i=this._runners.length;t<i;t++){const s=this._runners[t],r=s.runner;let o=e;const h=this._time-s.start;h<=0?n=!0:(h<o&&(o=h),r.active()&&(r.step(o).done?!0!==s.persist&&r.duration()-r.time()+this._time+s.persist<this._time&&(r.unschedule(),--t,--i):n=!0))}return n&&!(this._speed<0&&0===this._time)||this._runnerIds.length&&this._speed<0&&this._time>0?this._continue():(this.pause(),this.fire("finished")),this}terminate(){this._startTime=0,this._speed=1,this._persist=0,this._nextFrame=null,this._paused=!0,this._runners=[],this._runnerIds=[],this._lastRunnerId=-1,this._time=0,this._lastSourceTime=0,this._lastStepTime=0,this._step=this._stepFn.bind(this,!1),this._stepImmediate=this._stepFn.bind(this,!0)}};fn({Element:{timeline:function(t){return null==t?(this._timeline=this._timeline||new ua,this._timeline):(this._timeline=t,this)}}});var da=class t extends jo{constructor(i){super(),this.id=t.id++,i="function"==typeof(i=null==i?400:i)?new Th(i):i,this._element=null,this._timeline=null,this.done=!1,this._queue=[],this._duration="number"==typeof i&&i,this._isDeclarative=i instanceof Th,this._stepper=this._isDeclarative?i:new Lh,this._history={},this.enabled=!0,this._time=0,this._lastTime=0,this._reseted=!0,this.transforms=new Mo,this.transformId=1,this._haveReversed=!1,this._reverse=!1,this._loopsDone=0,this._swing=!1,this._wait=0,this._times=1,this._frameId=null,this._persist=!!this._isDeclarative||null}static sanitise(t,i,s){let e=1,n=!1,r=0;return i=i??0,s=s||"last","object"!=typeof(t=t??400)||t instanceof Eh||(i=t.delay??i,s=t.when??s,n=t.swing||n,e=t.times??e,r=t.wait??r,t=t.duration??400),{duration:t,delay:i,swing:n,times:e,wait:r,when:s}}active(t){return null==t?this.enabled:(this.enabled=t,this)}addTransform(t){return this.transforms.lmultiplyO(t),this}after(t){return this.on("finished",t)}animate(i,s,e){const n=t.sanitise(i,s,e),r=new t(n.duration);return this._timeline&&r.timeline(this._timeline),this._element&&r.element(this._element),r.loop(n).schedule(n.delay,n.when)}clearTransform(){return this.transforms=new Mo,this}clearTransformsFromQueue(){var t;this.done&&this._timeline&&(0,Lr.default)(t=this._timeline._runnerIds).call(t,this.id)||(this._queue=this._queue.filter((t=>!t.isTransform)))}delay(t){return this.animate(0,t)}duration(){return this._times*(this._wait+this._duration)-this._wait}during(t){return this.queue(null,t)}ease(t){return this._stepper=new Lh(t),this}element(t){return null==t?this._element:(this._element=t,t._prepareRunner(),this)}finish(){return this.step(1/0)}loop(t,i,s){return"object"==typeof t&&(i=t.swing,s=t.wait,t=t.times),this._times=t||1/0,this._swing=i||!1,this._wait=s||0,!0===this._times&&(this._times=1/0),this}loops(t){const i=this._duration+this._wait;if(null==t){const t=Math.floor(this._time/i);return Math.min(t+(this._time-t*i)/this._duration,this._times)}const s=Math.floor(t);return this.time(i*s+this._duration*(t%1))}persist(t){return null==t?this._persist:(this._persist=t,this)}position(t){const i=this._time,s=this._duration,e=this._wait,n=this._swing,r=this._reverse;let o;if(null==t){const t=function(t){const i=n*Math.floor(t%(2*(e+s))/(e+s)),o=i&&!r||!i&&r,h=Math.pow(-1,o)*(t%(e+s))/s+o;return Math.max(Math.min(h,1),0)},h=this._times*(e+s)-e;return o=i<=0?Math.round(t(1e-5)):i<h?t(i):Math.round(t(h-1e-5)),o}const h=Math.floor(this.loops()),a=n&&h%2==0;return o=h+(a&&!r||r&&a?t:1-t),this.loops(o)}progress(t){return null==t?Math.min(1,this._time/this.duration()):this.time(t*this.duration())}queue(t,i,s,e){return this._queue.push({initialiser:t||Io,runner:i||Io,retarget:s,isTransform:e,initialised:!1,finished:!1}),this.timeline()&&this.timeline()._continue(),this}reset(){return this._reseted||(this.time(0),this._reseted=!0),this}reverse(t){return this._reverse=null==t?!this._reverse:t,this}schedule(t,i,s){if(t instanceof ua||(s=i,i=t,t=this.timeline()),!t)throw Error("Runner cannot be scheduled without timeline");return t.schedule(this,i,s),this}step(t){if(!this.enabled)return this;this._time+=t=null==t?16:t;const i=this.position(),s=this._lastPosition!==i&&this._time>=0;this._lastPosition=i;const e=this.duration(),n=this._lastTime<=0&&this._time>0,r=this._lastTime<e&&this._time>=e;this._lastTime=this._time,n&&this.fire("start",this);const o=this._isDeclarative;this.done=!o&&!r&&this._time>=e,this._reseted=!1;let h=!1;return(s||o)&&(this._initialise(s),this.transforms=new Mo,h=this._run(o?t:i),this.fire("step",this)),this.done=this.done||h&&o,r&&this.fire("finished",this),this}time(t){return null==t?this._time:(this.step(t-this._time),this)}timeline(t){return void 0===t?this._timeline:(this._timeline=t,this)}unschedule(){const t=this.timeline();return t&&t.unschedule(this),this}_initialise(t){if(t||this._isDeclarative)for(let i=0,s=this._queue.length;i<s;++i){const s=this._queue[i],e=this._isDeclarative||!s.initialised&&t;t=!s.finished,e&&t&&(s.initialiser.call(this),s.initialised=!0)}}_rememberMorpher(t,i){if(this._history[t]={morpher:i,caller:this._queue[this._queue.length-1]},this._isDeclarative){const t=this.timeline();t&&t.play()}}_run(t){let i=!0;for(let s=0,e=this._queue.length;s<e;++s){const e=this._queue[s],n=e.runner.call(this,t);e.finished=e.finished||!0===n,i=i&&e.finished}return i}_tryRetarget(t,i,s){if(this._history[t]){if(!this._history[t].caller.initialised){const i=this._queue.indexOf(this._history[t].caller);return this._queue.splice(i,1),!1}this._history[t].caller.retarget?this._history[t].caller.retarget.call(this,i,s):this._history[t].morpher.to(i),this._history[t].caller.finished=!1;const e=this.timeline();return e&&e.play(),!0}return!1}};da.id=0;var fa=class{constructor(t=new Mo,i=-1,s=!0){this.transforms=t,this.id=i,this.done=s}clearTransformsFromQueue(){}};io([da,fa],{mergeWith(t){return new fa(t.transforms.lmultiply(this.transforms),t.id)}});const pa=(t,i)=>t.lmultiplyO(i),va=t=>t.transforms;function ga(){const t=this._transformationRunners.runners.map(va).reduce(pa,new Mo);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}var ma=class{constructor(){this.runners=[],this.ids=[]}add(t){var i;if((0,Lr.default)(i=this.runners).call(i,t))return;const s=t.id+1;return this.runners.push(t),this.ids.push(s),this}clearBefore(t){const i=this.ids.indexOf(t+1)||1;return this.ids.splice(0,i,0),this.runners.splice(0,i,new fa).forEach((t=>t.clearTransformsFromQueue())),this}edit(t,i){const s=this.ids.indexOf(t+1);return this.ids.splice(s,1,t+1),this.runners.splice(s,1,i),this}getByID(t){return this.runners[this.ids.indexOf(t+1)]}length(){return this.ids.length}merge(){let t=null;for(let e=0;e<this.runners.length;++e){var i,s;const n=this.runners[e];if(!(t&&n.done&&t.done)||n._timeline&&(0,Lr.default)(i=n._timeline._runnerIds).call(i,n.id)||t._timeline&&(0,Lr.default)(s=t._timeline._runnerIds).call(s,t.id))t=n;else{this.remove(n.id);const i=n.mergeWith(t);this.edit(t.id,i),t=i,--e}}return this}remove(t){const i=this.ids.indexOf(t+1);return this.ids.splice(i,1),this.runners.splice(i,1),this}};fn({Element:{animate(t,i,s){const e=da.sanitise(t,i,s),n=this.timeline();return new da(e.duration).loop(e).element(this).timeline(n.play()).schedule(e.delay,e.when)},delay(t,i){return this.animate(0,t,i)},_clearTransformRunnersBefore(t){this._transformationRunners.clearBefore(t.id)},_currentTransform(t){return this._transformationRunners.runners.filter((i=>i.id<=t.id)).map(va).reduce(pa,new Mo)},_addRunner(t){this._transformationRunners.add(t),aa.cancelImmediate(this._frameId),this._frameId=aa.immediate(ga.bind(this))},_prepareRunner(){null==this._frameId&&(this._transformationRunners=(new ma).add(new fa(new Mo(this))))}}}),io(da,{attr(t,i){return this.styleAttr("attr",t,i)},css(t,i){return this.styleAttr("css",t,i)},styleAttr(t,i,s){if("string"==typeof i)return this.styleAttr(t,{[i]:s});const e=i,n=this._history[t];if(n&&!n.caller.initialised&&n.caller.retarget)return n.caller.retarget.call(this,e),this;if(this._tryRetarget(t,e))return this;let r=new Bh(this._stepper).to(e),o=Object.keys(e);return this.queue((function(){r=r.from(this.element()[t](o))}),(function(i){return this.element()[t](r.at(i).valueOf()),r.done()}),(function(i){const s=(e=Object.keys(i),n=o,e.filter((t=>!(0,Lr.default)(n).call(n,t))));var e,n;if(s.length&&null!=r.from()){const i=this.element()[t](s),e=new Jh(r.from()).valueOf();Object.assign(e,i),r.from(e)}const h=new Jh(r.to()).valueOf();Object.assign(h,i),r.to(h),o=Object.keys(h)})),this._rememberMorpher(t,r),this},zoom(t,i){if(this._tryRetarget("zoom",t,i))return this;let s=new Bh(this._stepper).to(new Ho(t));return this.queue((function(){s=s.from(this.element().zoom())}),(function(t){return this.element().zoom(s.at(t),i),s.done()}),(function(t,e){i=e,s.to(t)})),this._rememberMorpher("zoom",s),this},transform(t,i,s){if(i=t.relative||i,this._isDeclarative&&!i&&this._tryRetarget("transform",t))return this;const e=Mo.isMatrixLike(t);s=null!=t.affine?t.affine:null!=s?s:!e;const n=new Bh(this._stepper).type(s?Vh:Mo);let r,o,h,a,l;return this.queue((function(){o=o||this.element(),r=r||Dr(t,o),l=new Mo(i?void 0:o),o._addRunner(this),i||o._clearTransformRunnersBefore(this)}),(function(c){i||this.clearTransform();const{x:u,y:d}=new So(r).transform(o._currentTransform(this)),f={...t,origin:[u,d]};!0===f.relative&&delete f.relative;let p=new Mo(f),v=this._isDeclarative&&h?h:l;if(s){p=p.decompose(u,d),v=v.decompose(u,d);const t=p.rotate,i=v.rotate,s=[t-360,t,t+360],e=s.map((t=>Math.abs(t-i))),n=Math.min(...e),r=e.indexOf(n);p.rotate=s[r]}i&&(e||(p.rotate=t.rotate||0),this._isDeclarative&&a&&(v.rotate=a)),n.from(v),n.to(p);const g=n.at(c);return a=g.rotate,h=new Mo(g),this.addTransform(h),o._addRunner(this),n.done()}),(function(i){(i.origin||"center").toString()!==(t.origin||"center").toString()&&(r=Dr(i,o)),t={...i,origin:r}}),!0),this._isDeclarative&&this._rememberMorpher("transform",n),this},x(t){return this._queueNumber("x",t)},y(t){return this._queueNumber("y",t)},ax(t){return this._queueNumber("ax",t)},ay(t){return this._queueNumber("ay",t)},dx(t=0){return this._queueNumberDelta("x",t)},dy(t=0){return this._queueNumberDelta("y",t)},dmove(t,i){return this.dx(t).dy(i)},_queueNumberDelta(t,i){if(i=new Ho(i),this._tryRetarget(t,i))return this;const s=new Bh(this._stepper).to(i);let e=null;return this.queue((function(){e=this.element()[t](),s.from(e),s.to(e+i)}),(function(i){return this.element()[t](s.at(i)),s.done()}),(function(t){s.to(e+new Ho(t))})),this._rememberMorpher(t,s),this},_queueObject(t,i){if(this._tryRetarget(t,i))return this;const s=new Bh(this._stepper).to(i);return this.queue((function(){s.from(this.element()[t]())}),(function(i){return this.element()[t](s.at(i)),s.done()})),this._rememberMorpher(t,s),this},_queueNumber(t,i){return this._queueObject(t,new Ho(i))},cx(t){return this._queueNumber("cx",t)},cy(t){return this._queueNumber("cy",t)},move(t,i){return this.x(t).y(i)},amove(t,i){return this.ax(t).ay(i)},center(t,i){return this.cx(t).cy(i)},size(t,i){const s=Nr(this._element,t,i);return this.width(s.width).height(s.height)},width(t){return this._queueNumber("width",t)},height(t){return this._queueNumber("height",t)},plot(t,i,s,e){if(4===arguments.length)return this.plot([t,i,s,e]);if(this._tryRetarget("plot",t))return this;const n=new Bh(this._stepper).type(this._element.MorphArray).to(t);return this.queue((function(){n.from(this._element.array())}),(function(t){return this._element.plot(n.at(t)),n.done()})),this._rememberMorpher("plot",n),this},leading(t){return this._queueNumber("leading",t)},viewbox(t,i,s,e){return this._queueObject("viewbox",new Oo(t,i,s,e))},update(t){return"object"!=typeof t?this.update({offset:arguments[0],color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}}),io(da,{rx:sh,ry:eh,from:fh,to:ph}),Kr(da,"Runner");var ba=class extends Qo{constructor(t,i=t){super(Xr("svg",t),i),this.namespace()}defs(){return this.isRoot()?Jr(this.node.querySelector("defs"))||this.put(new Zo):this.root().defs()}isRoot(){return!this.node.parentNode||!(this.node.parentNode instanceof jr.window.SVGElement)&&"#document-fragment"!==this.node.parentNode.nodeName}namespace(){return this.isRoot()?this.attr({xmlns:Fr,version:"1.1"}).attr("xmlns:xlink",Gr,Wr):this.root().namespace()}removeNamespace(){return this.attr({xmlns:null,version:null}).attr("xmlns:xlink",null,Wr).attr("xmlns:svgjs",null,Wr)}root(){return this.isRoot()?this:super.root()}};fn({Container:{nested:so((function(){return this.put(new ba)}))}}),Kr(ba,"Svg",!0);var ya=class extends Qo{constructor(t,i=t){super(Xr("symbol",t),i)}};fn({Container:{symbol:so((function(){return this.put(new ya)}))}}),Kr(ya,"Symbol");var wa=ln({amove:()=>Ta,ax:()=>Ea,ay:()=>La,build:()=>Aa,center:()=>ka,cx:()=>Ra,cy:()=>Oa,length:()=>Sa,move:()=>_a,plain:()=>xa,x:()=>$a,y:()=>Ma});function xa(t){return!1===this._build&&this.clear(),this.node.appendChild(jr.document.createTextNode(t)),this}function Sa(){return this.node.getComputedTextLength()}function $a(t,i=this.bbox()){return null==t?i.x:this.attr("x",this.attr("x")+t-i.x)}function Ma(t,i=this.bbox()){return null==t?i.y:this.attr("y",this.attr("y")+t-i.y)}function _a(t,i,s=this.bbox()){return this.x(t,s).y(i,s)}function Ra(t,i=this.bbox()){return null==t?i.cx:this.attr("x",this.attr("x")+t-i.cx)}function Oa(t,i=this.bbox()){return null==t?i.cy:this.attr("y",this.attr("y")+t-i.cy)}function ka(t,i,s=this.bbox()){return this.cx(t,s).cy(i,s)}function Ea(t){return this.attr("x",t)}function La(t){return this.attr("y",t)}function Ta(t,i){return this.ax(t).ay(i)}function Aa(t){return this._build=!!t,this}var Ca=class extends th{constructor(t,i=t){super(Xr("text",t),i),this.dom.leading=this.dom.leading??new Ho(1.3),this._rebuild=!0,this._build=!1}leading(t){return null==t?this.dom.leading:(this.dom.leading=new Ho(t),this.rebuild())}rebuild(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){const t=this;let i=0;const s=this.dom.leading;this.each((function(e){if(zr(this.node))return;const n=jr.window.getComputedStyle(this.node).getPropertyValue("font-size"),r=s*new Ho(n);this.dom.newLined&&(this.attr("x",t.attr("x")),"\n"===this.text()?i+=r:(this.attr("dy",e?r+i:0),i=0))})),this.fire("rebuild")}return this}setData(t){return this.dom=t,this.dom.leading=new Ho(t.leading||1.3),this}writeDataToDom(){return super.writeDataToDom({leading:1.3})}text(t){if(void 0===t){const i=this.node.childNodes;let s=0;t="";for(let e=0,n=i.length;e<n;++e)"textPath"===i[e].nodeName||zr(i[e])?0===e&&(s=e+1):(e!==s&&3!==i[e].nodeType&&!0===Jr(i[e]).dom.newLined&&(t+="\n"),t+=i[e].textContent);return t}if(this.clear().build(!0),"function"==typeof t)t.call(this,this);else for(let i=0,s=(t=(t+"").split("\n")).length;i<s;i++)this.newLine(t[i]);return this.build(!1).rebuild()}};io(Ca,wa),fn({Container:{text:so((function(t=""){return this.put(new Ca).text(t)})),plain:so((function(t=""){return this.put(new Ca).plain(t)}))}}),Kr(Ca,"Text");var Pa=class extends th{constructor(t,i=t){super(Xr("tspan",t),i),this._build=!1}dx(t){return this.attr("dx",t)}dy(t){return this.attr("dy",t)}newLine(){this.dom.newLined=!0;const t=this.parent();if(!(t instanceof Ca))return this;const i=t.index(this),s=jr.window.getComputedStyle(this.node).getPropertyValue("font-size"),e=t.dom.leading*new Ho(s);return this.dy(i?e:0).attr("x",t.x())}text(t){return null==t?this.node.textContent+(this.dom.newLined?"\n":""):("function"==typeof t?(this.clear().build(!0),t.call(this,this),this.build(!1)):this.plain(t),this)}};io(Pa,wa),fn({Tspan:{tspan:so((function(t=""){const i=new Pa;return this._build||this.clear(),this.put(i).text(t)}))},Text:{newLine:function(t=""){return this.tspan(t).newLine()}}}),Kr(Pa,"Tspan");var Na=class extends th{constructor(t,i=t){super(Xr("circle",t),i)}radius(t){return this.attr("r",t)}rx(t){return this.attr("r",t)}ry(t){return this.rx(t)}size(t){return this.radius(new Ho(t).divide(2))}};io(Na,{x:nh,y:rh,cx:oh,cy:hh,width:ah,height:lh}),fn({Container:{circle:so((function(t=0){return this.put(new Na).size(t).move(0,0)}))}}),Kr(Na,"Circle");var Da=class extends Qo{constructor(t,i=t){super(Xr("clipPath",t),i)}remove(){return this.targets().forEach((function(t){t.unclip()})),super.remove()}targets(){return Co(this.node,"clip-path")}};fn({Container:{clip:so((function(){return this.defs().put(new Da)}))},Element:{clipper(){return this.reference("clip-path")},clipWith(t){const i=t instanceof Da?t:this.parent().clip().add(t);return this.attr("clip-path","url(#"+i.id()+")")},unclip(){return this.attr("clip-path",null)}}}),Kr(Da,"ClipPath");var Ua=class extends qo{constructor(t,i=t){super(Xr("foreignObject",t),i)}};fn({Container:{foreignObject:so((function(t,i){return this.put(new Ua).size(t,i)}))}}),Kr(Ua,"ForeignObject");var za=ln({dmove:()=>Fa,dx:()=>Wa,dy:()=>Ga,height:()=>ja,move:()=>Ia,size:()=>Ya,width:()=>Ba,x:()=>Ha,y:()=>Va});function Fa(t,i){return this.children().forEach((s=>{let e;try{e=s.node instanceof jr.window.SVGSVGElement?new Oo(s.attr(["x","y","width","height"])):s.bbox()}catch(t){return}const n=new Mo(s),r=n.translate(t,i).transform(n.inverse()),o=new So(e.x,e.y).transform(r);s.dmove(o.x-e.x,o.y-e.y)})),this}function Wa(t){return this.dmove(t,0)}function Ga(t){return this.dmove(0,t)}function ja(t,i=this.bbox()){return null==t?i.height:this.size(i.width,t,i)}function Ia(t=0,i=0,s=this.bbox()){return this.dmove(t-s.x,i-s.y)}function Ya(t,i,s=this.bbox()){const e=Nr(this,t,i,s),n=e.width/s.width,r=e.height/s.height;return this.children().forEach((t=>{const i=new So(s).transform(new Mo(t).inverse());t.scale(n,r,i.x,i.y)})),this}function Ba(t,i=this.bbox()){return null==t?i.width:this.size(t,i.height,i)}function Ha(t,i=this.bbox()){return null==t?i.x:this.move(t,i.y,i)}function Va(t,i=this.bbox()){return null==t?i.y:this.move(i.x,t,i)}var Xa=class extends Qo{constructor(t,i=t){super(Xr("g",t),i)}};io(Xa,za),fn({Container:{group:so((function(){return this.put(new Xa)}))}}),Kr(Xa,"G");var Ja=class extends Qo{constructor(t,i=t){super(Xr("a",t),i)}target(t){return this.attr("target",t)}to(t){return this.attr("href",t,Gr)}};io(Ja,za),fn({Container:{link:so((function(t){return this.put(new Ja).to(t)}))},Element:{unlink(){const t=this.linker();if(!t)return this;const i=t.parent();if(!i)return this.remove();const s=i.index(t);return i.add(this,s),t.remove(),this},linkTo(t){let i=this.linker();return i||(i=new Ja,this.wrap(i)),"function"==typeof t?t.call(i,i):i.to(t),this},linker(){const t=this.parent();return t&&"a"===t.node.nodeName.toLowerCase()?t:null}}}),Kr(Ja,"A");var qa=class extends Qo{constructor(t,i=t){super(Xr("mask",t),i)}remove(){return this.targets().forEach((function(t){t.unmask()})),super.remove()}targets(){return Co(this.node,"mask")}};fn({Container:{mask:so((function(){return this.defs().put(new qa)}))},Element:{masker(){return this.reference("mask")},maskWith(t){const i=t instanceof qa?t:this.parent().mask().add(t);return this.attr("mask","url(#"+i.id()+")")},unmask(){return this.attr("mask",null)}}}),Kr(qa,"Mask");var Ka=class extends qo{constructor(t,i=t){super(Xr("stop",t),i)}update(t){return("number"==typeof t||t instanceof Ho)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new Ho(t.offset)),this}};fn({Gradient:{stop:function(t,i,s){return this.put(new Ka).update(t,i,s)}}}),Kr(Ka,"Stop");var Qa=class extends qo{constructor(t,i=t){super(Xr("style",t),i)}addText(t=""){return this.node.textContent+=t,this}font(t,i,s={}){return this.rule("@font-face",{fontFamily:t,src:i,...s})}rule(t,i){return this.addText(function(t,i){if(!t)return"";if(!i)return t;let s=t+"{";for(const t in i)s+=Cr(t)+":"+i[t]+";";return s+="}",s}(t,i))}};fn("Dom",{style(t,i){return this.put(new Qa).rule(t,i)},fontface(t,i,s){return this.put(new Qa).font(t,i,s)}}),Kr(Qa,"Style");var Za=class extends Ca{constructor(t,i=t){super(Xr("textPath",t),i)}array(){const t=this.track();return t?t.array():null}plot(t){const i=this.track();let s=null;return i&&(s=i.plot(t)),null==t?s:this}track(){return this.reference("href")}};fn({Container:{textPath:so((function(t,i){return t instanceof Ca||(t=this.text(t)),t.path(i)}))},Text:{path:so((function(t,i=!0){const s=new Za;let e;if(t instanceof Kh||(t=this.defs().path(t)),s.attr("href","#"+t,Gr),i)for(;e=this.node.firstChild;)s.node.appendChild(e);return this.put(s)})),textPath(){return this.findOne("textPath")}},Path:{text:so((function(t){return t instanceof Ca||(t=(new Ca).addTo(this.parent()).text(t)),t.path(this)})),targets(){return Co(this.node,"href","textPath")}}}),Za.prototype.MorphArray=Ih,Kr(Za,"TextPath");var tl=class extends th{constructor(t,i=t){super(Xr("use",t),i)}use(t,i){return this.attr("href",(i||"")+"#"+t,Gr)}};fn({Container:{use:so((function(t,i){return this.put(new tl).use(t,i)}))}}),Kr(tl,"Use"),io([ba,ya,mh,gh,Rh],pn("viewbox")),io([_h,ra,na,Kh],pn("marker")),io(Ca,pn("Text")),io(Kh,pn("Path")),io(Zo,pn("Defs")),io([Ca,Pa],pn("Tspan")),io([oa,ch,vh,da],pn("radius")),io(jo,pn("EventTarget")),io(Jo,pn("Dom")),io(qo,pn("Element")),io(th,pn("Shape")),io([Qo,uh],pn("Container")),io(vh,pn("Gradient")),io(da,pn("Runner")),Eo.extend([...new Set(dn)]),function(t=[]){qh.push(...[].concat(t))}([Ho,xo,Oo,Mo,Bo,bh,Ih,So]),io(qh,{to(t){return(new Bh).type(this.constructor).from(this.toArray()).to(t)},fromArray(t){return this.init(t),this},toConsumable(){return this.toArray()},morph(t,i,s,e,n){return this.fromArray(t.map((function(t,r){return e.step(t,i[r],s,n[r],n)})))}});const il=["pl","fc","pp","ac"];function sl(t){return t.replace(/\d+$/,"")}function el(t){const i=function(t){const i=/^#([0-9a-f]+)$/i.exec(t.trim());if(i){const t=i[1];return 3===t.length||4===t.length?[0,1,2].map((i=>parseInt(t[i]+t[i],16))):6===t.length||8===t.length?[0,2,4].map((i=>parseInt(t.slice(i,i+2),16))):null}const s=/^rgba?\(\s*([\d.]+%?)[\s,]+([\d.]+%?)[\s,]+([\d.]+%?)/i.exec(t.trim());return s?s.slice(1,4).map((t=>t.endsWith("%")?2.55*parseFloat(t):parseFloat(t))):null}(t);if(null===i)return"#000000";const[s,e,n]=i;return.299*s+.587*e+.114*n>128?"#000000":"#ffffff"}class nl{constructor(t,i,s,e){this.count=t,this.drawingRect=s,this.panelGapPx=e,this.columns=Math.max(1,Math.min(null!=i?i:t,t)),this.rows=Math.max(1,Math.ceil(t/this.columns))}panelRect(t){const i=t%this.columns,s=Math.floor(t/this.columns),e=(this.drawingRect.width-(this.columns-1)*this.panelGapPx)/this.columns,n=(this.drawingRect.height-(this.rows-1)*this.panelGapPx)/this.rows;return{x:this.drawingRect.x+i*(e+this.panelGapPx),y:this.drawingRect.y+s*(n+this.panelGapPx),width:e,height:n}}isOuterLeft(t){return t%this.columns==0}isOuterBottom(t){return t+this.columns>=this.count}}class rl{constructor(t,i,s,e){this.domainMin=t,this.domainMax=i,this.rangeMin=s,this.rangeMax=e}scale(t){const i=this.domainMax-this.domainMin;return 0===i?(this.rangeMin+this.rangeMax)/2:this.rangeMin+(t-this.domainMin)/i*(this.rangeMax-this.rangeMin)}static domain(t,i,s,e=.04){let n=i-t;if(0===n){const s=0===t?1:.1*Math.abs(t);n=(i+=s)-(t-=s)}return[void 0!==(null==s?void 0:s.min)?s.min:t-n*e,void 0!==(null==s?void 0:s.max)?s.max:i+n*e]}static niceStep(t,i){if(t<=0||i<=0)return 1;const s=t/i,e=Math.pow(10,Math.floor(Math.log10(s))),n=s/e;let r;return r=n<=1?1:n<=2?2:n<=2.5?2.5:n<=5?5:10,r*e}ticks(t){const i=this.domainMax-this.domainMin;if(i<=0)return[this.domainMin];const s=rl.niceStep(i,t),e=Math.ceil(this.domainMin/s)*s;if(e+s===e||s<Math.pow(10,-15))return[this.domainMin];const n=rl.stepDecimals(s),r=Math.floor((this.domainMax+1e-9*s-e)/s)+1,o=[];for(let t=0;t<r;t++){const i=Number((e+t*s).toFixed(n)),r=0===i?0:i;0!==o.length&&r===o[o.length-1]||o.push(r)}return o}static stepDecimals(t){if(!Number.isFinite(t)||t<=0)return 0;for(let i=0;i<15;i++){const s=t*Math.pow(10,i),e=Math.round(s);if(e>=1&&Math.abs(s-e)<1e-9*e)return i}return 15}static tickDecimals(t){return 0===t.length?0:rl.stepDecimals(1===t.length?Math.abs(t[0]):(t[t.length-1]-t[0])/(t.length-1))}}function ol(t,i,s,e=!1){return hs.number(t,e?"percent":"decimal",i,i,1,s)}function hl(t,i){return rl.tickDecimals(i?t.map((t=>100*t)):t)}class al{constructor(t="",i=1){this.prefix=t,this.value=i}}var ll;!function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right",t[t.Top=3]="Top",t[t.Bottom=4]="Bottom"}(ll||(ll={}));let cl=class{constructor(t,i,s,e,n,r,o,h){this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.isRelativeLabel=!1,this.segmentFillColor=null,this.x=i,this.y=s,this.value=n,this.group=t.group().id(this.createElementID(t.toString(),e)),this.styles=r,this.isVarianceLabel=!1,this.verticalHookLocation=o||ll.Top,this.horizontalHookLocation=h||ll.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}updateGroup(t){return this.group=t,this}draw(t=!0,i={percent:2,decimal:1},s=new al){if(this.isEmpty())return this;const e=this.group;let n,r="";if(!1===Number.isNaN(Number(this.value))){let t="percent",e=i.percent,o=i.percent,h=1;!1===this.isRelativeLabel&&(e=i.decimal,o=i.decimal,h=s.value,t="decimal"),n=hs.number(Number(this.value),t,e,o,h,this.styles.locale),this.isVarianceLabel&&Number(this.value)>=0&&(r="+")}else n=""+this.value;const o=this.drawLabel(e,r+n);return!1===t&&(o.addClass("hide"),e.addClass("hide")),this}isEmpty(){return null==this.value||""===this.value}setPos(t,i){return this.x=t,this.y=i,this}forceStringTypeDraw(){return this.drawLabel(this.group,""+this.value),this}drawLabel(t,i){const s=this.styles.fontStyles.background||"#ffffff";let e="start";const n=t.text(i);n.move(this.x,this.y);const r=n.bbox(),o=r.w,h=r.h;let a=0,l=0;const c=n.x();let u=n.y();return this.horizontalHookLocation===ll.Left?(e="left",a=n.x()):this.horizontalHookLocation===ll.Center?(e="middle",a=n.x()-(o+2)/2):this.horizontalHookLocation===ll.Right&&(e="end",a=n.x()-o),this.verticalHookLocation===ll.Center?(u=n.y()-1.2*h/2,l=u+.2*h):this.verticalHookLocation===ll.Top?(u-=h/4,l=u+.2*h):this.verticalHookLocation===ll.Bottom&&(u-=h,l=u+.2*h),n.move(c,u),n.font({anchor:e}),null!=this.segmentFillColor?n.fill(el(this.segmentFillColor)):t.rect(o+2,.8*h).stroke(s).fill(s).opacity(.9).move(a-1,l).insertBefore(n),n}createElementID(t,i){return t+"_"+i+"_"+this.ID_SCENARIOLABEL}};const ul={ac:1,pp:2,fc:3,pl:4};var dl;!function(t){t[t.Above=0]="Above",t[t.Below=1]="Below",t[t.Left=2]="Left",t[t.Right=3]="Right"}(dl||(dl={}));class fl{constructor(){this.labels=[],this.scenarioLabels=[]}clear(){this.labels=[],this.scenarioLabels=[]}register(t){this.labels.push(t)}hasCollision(t){return this.labels.some((i=>this.intersects(t,i)))}getOptimalPlacement(t,i,s,e,n,r,o,h){const a=ul[o]||99,l=r/2;for(const r of h){const o=this.calculatePlacementForDirection(t,i,s,e,n,l,8,r);if(!this.hasCollision(o.bounds))return o}for(const r of h){const o=this.calculatePlacementForDirection(t,i,s,e,n,l,8,r);if(!this.collidesWithHigherPriority(o.bounds,a))return o}return null}calculatePlacementForDirection(t,i,s,e,n,r,o,h){let a,l,c,u,d,f;switch(h){case dl.Above:a=t,l=i-r-o,c=ll.Bottom,u=ll.Center,d=t-s/2,f=i-r-o-e;break;case dl.Below:a=t,l=i+r+o,c=ll.Top,u=ll.Center,d=t-s/2,f=i+r+o-e/4;break;case dl.Left:a=t-r-o,l=i,c=ll.Center,u=ll.Right,d=t-r-o-s,f=i-.6*e;break;case dl.Right:a=t+r+o,l=i,c=ll.Center,u=ll.Left,d=t+r+o,f=i-.6*e}return{labelX:a,labelY:l,verticalHook:c,horizontalHook:u,bounds:{x:d,y:f,width:s,height:e,pointIndex:n,preferredHook:c}}}collidesWithHigherPriority(t,i){return this.labels.some((s=>!!s.scenarioType&&((ul[s.scenarioType]||99)<i&&this.intersects(t,s))))}shouldHideScenarioLabel(t,i,s,e=20){const n=ul[s]||99;return!(n<=1)&&this.scenarioLabels.some((s=>{if((ul[s.scenarioType]||99)>=n)return!1;const r=Math.abs(i-s.y),o=Math.abs(t-s.x);return r<e&&o<e}))}registerScenarioLabel(t,i,s){this.scenarioLabels.push({x:t,y:i,scenarioType:s})}intersects(t,i){return!(t.x+t.width<i.x||i.x+i.width<t.x||t.y+t.height<i.y||i.y+i.height<t.y)}getLabelCount(){return this.labels.length}}const pl=["n","ne","e","se","s","sw","w","nw"],vl=Math.SQRT1_2;class gl{constructor(t,i,s=new fl){this.frame=t,this.gapPx=i,this.manager=s}registerMark(t,i,s){this.manager.register(this.bounds(t-s,i-s,2*s,2*s))}selectCandidates(t,i,s,e){if("none"===i)return{selected:[],unknownNames:[]};if("all"===i)return{selected:[...t],unknownNames:[]};if("auto"===i)return{selected:t.slice(0,s),unknownNames:[]};const n=new Set(i),r=t.filter((t=>n.has(e(t)))),o=new Set(r.map((t=>e(t))));return{selected:r,unknownNames:i.filter((t=>!o.has(t)))}}place(t){const i=[];for(const s of t)for(const t of pl){const e=this.anchorBox(s,t);if(!this.insideFrame(e.x,e.y,s.width,s.height))continue;const n=this.bounds(e.x,e.y,s.width,s.height);if(!this.manager.hasCollision(n)){this.manager.register(n),i.push({candidate:s,x:e.x,y:e.y,anchor:t});break}}return i}anchorBox(t,i){const s=t.r+this.gapPx,e=t.r*vl+.5*this.gapPx;switch(i){case"n":return{x:t.cx-t.width/2,y:t.cy-s-t.height};case"ne":return{x:t.cx+e,y:t.cy-e-t.height};case"e":return{x:t.cx+s,y:t.cy-t.height/2};case"se":return{x:t.cx+e,y:t.cy+e};case"s":return{x:t.cx-t.width/2,y:t.cy+s};case"sw":return{x:t.cx-e-t.width,y:t.cy+e};case"w":return{x:t.cx-s-t.width,y:t.cy-t.height/2};case"nw":return{x:t.cx-e-t.width,y:t.cy-e-t.height}}}insideFrame(t,i,s,e){return t>=this.frame.x&&i>=this.frame.y&&t+s<=this.frame.x+this.frame.width&&i+e<=this.frame.y+this.frame.height}bounds(t,i,s,e){return{x:t,y:i,width:s,height:e,pointIndex:0,preferredHook:ll.Center}}}class ml{constructor(t,i,s,e,n){this.mode=t,this.vMax=i,this.rMaxPx=s,this.rMinPx=e,this.areaPerUnitPx2=n}static local(t,i,s){return new ml("local",t,i,s,0)}static grouped(t){return new ml("grouped",0,0,0,t)}radius(t){return"grouped"===this.mode?t<=0?0:Math.sqrt(this.areaPerUnitPx2*t/Math.PI):this.vMax<=0||t<=0?this.rMinPx:Math.max(this.rMinPx,this.rMaxPx*Math.sqrt(t/this.vMax))}}class bl{constructor(t,i,s,e){this.xScale=t,this.yScale=i,this.rect=s,this.styles=e}get em(){return this.styles.fontStyles.size}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}drawBands(t,i,s){var e,n,r,o;const h=this.styles.axisStyles.pl.fill;if(void 0!==i&&(void 0!==i.from||void 0!==i.to)){const s=this.xScale.scale(null!==(e=i.from)&&void 0!==e?e:this.xScale.domainMin),r=this.xScale.scale(null!==(n=i.to)&&void 0!==n?n:this.xScale.domainMax);t.rect(Math.abs(r-s),this.rect.height).move(Math.min(s,r),this.rect.y).fill(h)}if(void 0!==s&&(void 0!==s.from||void 0!==s.to)){const i=this.yScale.scale(null!==(r=s.from)&&void 0!==r?r:this.yScale.domainMin),e=this.yScale.scale(null!==(o=s.to)&&void 0!==o?o:this.yScale.domainMax);t.rect(this.rect.width,Math.abs(i-e)).move(this.rect.x,Math.min(i,e)).fill(h)}}drawGrid(t,i,s){const e={color:this.styles.axisStyles.pp.stroke,width:this.styles.scaleFactors.gridLineWidth};for(const s of i){const i=this.yScale.scale(s);t.line(this.rect.x,i,this.rect.x+this.rect.width,i).stroke(e)}if(void 0!==s)for(const i of s){const s=this.xScale.scale(i);t.line(s,this.rect.y,s,this.rect.y+this.rect.height).stroke(e)}}drawRefLines(t,i,s){const e={color:this.styles.axisStyles.fc.stroke,width:this.styles.scaleFactors.refLineWidth};if(void 0!==i){const s=this.xScale.scale(i);t.line(s,this.rect.y,s,this.rect.y+this.rect.height).stroke(e)}if(void 0!==s){const i=this.yScale.scale(s);t.line(this.rect.x,i,this.rect.x+this.rect.width,i).stroke(e)}}drawFrame(t){t.rect(this.rect.width,this.rect.height).move(this.rect.x,this.rect.y).fill("none").stroke({color:this.styles.axisStyles.ac.stroke,width:this.styles.scaleFactors.gridLineWidth})}drawTickLabels(t,i){const s=this.styles.scaleFactors.axisTickLength*this.em,e={size:this.styles.fontStyles.size,anchor:"start"},n=this.fontFamily(),r=this.styles.fontStyles.color;if(i.showXLabels)for(const o of i.ticksX){const h=this.xScale.scale(o);t.text(ol(o,i.xDecimals,this.styles.locale,i.xPercent)).font(Object.assign(Object.assign({},e),{anchor:"middle"})).fill(r).attr({x:h,y:this.rect.y+this.rect.height+s+.8*this.em,"font-family":n})}if(i.showYLabels)for(const o of i.ticksY){const h=this.yScale.scale(o);t.text(ol(o,i.yDecimals,this.styles.locale,i.yPercent)).font(Object.assign(Object.assign({},e),{anchor:"end"})).fill(r).attr({x:this.rect.x-s,y:h+.35*this.em,"font-family":n})}}drawPanelTitle(t,i){""!==i&&t.text(i).font({size:this.styles.fontStyles.size,weight:"bold",anchor:"start"}).fill(this.styles.fontStyles.color).attr({x:this.rect.x+.5*this.em,y:this.rect.y+1.2*this.em,"font-family":this.fontFamily()})}}class yl{constructor(t){this.styles=t}get em(){return this.styles.fontStyles.size}get rowHeight(){return 1.5*this.em}get swatchSize(){return this.styles.scaleFactors.legendSwatch*this.em}textWidth(t,i=!1){const s=os(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:i?"bold":"normal"}).width;return Number.isFinite(s)&&s>0?s:.6*t.length*this.em}rows(t){const i=[];t.sizeCaption.forEach(((t,s)=>{i.push({text:t,bold:0===s,treatment:null})})),null!==t.title&&""!==t.title&&i.push({text:t.title,bold:!0,treatment:null});for(const s of[...t.compareEntries,...t.entries])i.push({text:s.label,bold:!1,treatment:s.treatment,fill:s.fill});return i}measure(t,i){const s=this.rows(t);if(0===s.length)return{width:0,height:0};const e=this.swatchSize+.4*this.em;if("bottom"===i){let t=0;for(const i of s)t+=(null!==i.treatment?e:0)+this.textWidth(i.text,i.bold)+1.5*this.em;return{width:t,height:this.rowHeight}}let n=0;for(const t of s)n=Math.max(n,(null!==t.treatment?e:0)+this.textWidth(t.text,t.bold));return{width:n,height:s.length*this.rowHeight}}draw(t,i,s,e,n){var r;const o=this.rows(i),h=this.swatchSize+.4*this.em;let a=s,l=e;for(const i of o){let s=a;if(null!==i.treatment){const e=t.circle(this.swatchSize).move(a,l+(this.rowHeight-this.swatchSize)/2).fill(null!==(r=i.fill)&&void 0!==r?r:i.treatment.hatch?"#ffffff":i.treatment.fill).stroke({color:"#ffffff"===i.treatment.stroke?i.treatment.fill:i.treatment.stroke,width:i.treatment.strokeWidth});void 0!==i.treatment.dasharray&&e.attr("stroke-dasharray",i.treatment.dasharray),s+=h}t.text(i.text).font({size:this.styles.fontStyles.size,weight:i.bold?"bold":"normal",anchor:"start"}).fill(this.styles.fontStyles.color).attr({x:s,y:l+this.rowHeight/2+.35*this.em,"font-family":this.fontFamily()}),"bottom"===n?a=s+this.textWidth(i.text,i.bold)+1.5*this.em:l+=this.rowHeight}}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}}class wl{constructor(){this.operation="+",this.custom={},this.counts={}}slotValue(t){const i=this[t];return E.isNumber(i)?i:null}slotHasNoData(t){return 0===this.counts[t]}}const xl=["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"];class Sl{adapt(t){const i=new wl;if(E.isOperator(t.operation)&&(i.operation=t.operation),E.isString(t.date)){const s=y.fromISO(t.date);i.date=s.isValid?s:void 0}E.isString(t.rowGroup)&&E.isNumber(t.rowGroupIndex)&&(i.rowGroup=t.rowGroup,i.rowGroupIndex=t.rowGroupIndex),E.isString(t.category)&&E.isNumber(t.categoryIndex)&&(i.category=t.category,i.categoryIndex=t.categoryIndex),E.isString(t.subCategory)&&E.isNumber(t.subCategoryIndex)&&(i.subCategory=t.subCategory,i.subCategoryIndex=t.subCategoryIndex),E.isString(t.columnGroup)&&E.isNumber(t.columnGroupIndex)&&(i.columnGroup=t.columnGroup,i.columnGroupIndex=t.columnGroupIndex),E.isString(t.columnSubGroup)&&E.isNumber(t.columnSubGroupIndex)&&(i.columnSubGroup=t.columnSubGroup,i.columnSubGroupIndex=t.columnSubGroupIndex);for(const s of xl){E.isNumber(t[s])&&(i[s]=t[s]);const e=t[`${s}_cnt`];E.isNumber(e)&&(i.counts[s]=e)}for(const s of Object.keys(t))s.startsWith("_")&&(i.custom[s]=t[s]);return i}default(){return new wl}}const $l={rowGroup:"rowGroupIndex",category:"categoryIndex",subCategory:"subCategoryIndex"};function Ml(t,i){if("scenario"===i.kind)return{value:t.slotValue(i.slot),varianceNoData:!1};if(t.slotHasNoData(i.measure.base)||t.slotHasNoData(i.measure.delta))return{value:null,varianceNoData:!0};const s=i.measure.compute(t.slotValue(i.measure.base),t.slotValue(i.measure.delta));return{value:s,varianceNoData:null===s}}function _l(t,i){return void 0!==i&&(void 0!==i.min&&t<i.min||void 0!==i.max&&t>i.max)}function Rl(t,i){return"scenario"!==t.kind?null:i+Rt(t.slot)}function Ol(t,i){var s,e,n,r,o,h,a,l,c;const u=[],d=new Set,f=[];let p=0,v=0,g=0,m=0,b=0;const y=new Map,w=new Map,x=new Map,S=null!==(s=i.compareFamily)&&void 0!==s?s:null,$=null!==S?Rl(i.measures.x,S):null,M=null!==S?Rl(i.measures.y,S):null,_=null!==S&&void 0!==i.measures.size?Rl(i.measures.size,S):null;for(const s of t){const t=s[i.pointLevel];if(null==t||""===t)continue;const u=null!==(e=null!==i.facetLevel?s[i.facetLevel]:"")&&void 0!==e?e:"",S=null!==(n=null!==i.seriesLevel?s[i.seriesLevel]:"")&&void 0!==n?n:"",R=`${u}\0${S}\0${t}`;if(d.has(R)){p++,f.length<5&&!f.includes(t)&&f.push(t);continue}const O=Ml(s,i.measures.x),k=Ml(s,i.measures.y);if(null===O.value||null===k.value){(O.varianceNoData||k.varianceNoData)&&v++;continue}if(_l(O.value,null===(r=i.domains)||void 0===r?void 0:r.x)||_l(k.value,null===(o=i.domains)||void 0===o?void 0:o.y)){g++;continue}const E={name:t,seriesKey:S,facetKey:u,x:O.value,y:k.value,row:s};if(void 0!==i.measures.size){const t=Ml(s,i.measures.size).value;if(null===t)continue;if(t<0){m++;continue}E.size=t}if(void 0!==i.measures.share){const t=Ml(s,i.measures.share).value;null!==t&&(t<0||t>1?(b++,E.share=Math.min(1,Math.max(0,t))):E.share=t)}if(null!==$&&null!==M){const t=s.slotValue($),e=s.slotValue(M),n=null!==_?s.slotValue(_):null;null===t||null===e||null!==_&&null===n?E.compare=null:_l(t,null===(h=i.domains)||void 0===h?void 0:h.x)||_l(e,null===(a=i.domains)||void 0===a?void 0:a.y)?(g++,E.compare=null):(E.compare={x:t,y:e},null!==n&&(E.compare.size=n))}if(d.add(R),x.has(u)||x.set(u,[]),x.get(u).push(E),null!==i.facetLevel){const t=s[$l[i.facetLevel]];null!=t&&t<(null!==(l=y.get(u))&&void 0!==l?l:Number.POSITIVE_INFINITY)&&y.set(u,t)}if(null!==i.seriesLevel){const t=s[$l[i.seriesLevel]];null!=t&&t<(null!==(c=w.get(S))&&void 0!==c?c:Number.POSITIVE_INFINITY)&&w.set(S,t)}}const R=[...x.keys()].sort(((t,i)=>{var s,e;return(null!==(s=y.get(t))&&void 0!==s?s:Number.MAX_SAFE_INTEGER)-(null!==(e=y.get(i))&&void 0!==e?e:Number.MAX_SAFE_INTEGER)})),O=R.map((t=>{let s=x.get(t);return i.limit>0&&s.length>i.limit&&(s="size"===i.limitBy?[...s].sort(((t,i)=>{var s,e;return(null!==(s=i.size)&&void 0!==s?s:0)-(null!==(e=t.size)&&void 0!==e?e:0)})).slice(0,i.limit):s.slice(0,i.limit)),{key:t,points:s}})),k=new Set;for(const t of O)for(const i of t.points)k.add(i.seriesKey);const E=[...k].sort(((t,i)=>{var s,e;return(null!==(s=w.get(t))&&void 0!==s?s:Number.MAX_SAFE_INTEGER)-(null!==(e=w.get(i))&&void 0!==e?e:Number.MAX_SAFE_INTEGER)})).map(((t,i)=>({key:t,index:i})));let L=null,T=0;for(const t of O)for(const i of t.points){T++;const t=[i.x],s=[i.y],e=void 0!==i.size?[i.size]:[];null!=i.compare&&(t.push(i.compare.x),s.push(i.compare.y),void 0!==i.compare.size&&e.push(i.compare.size)),null===L&&(L={xMin:t[0],xMax:t[0],yMin:s[0],yMax:s[0],sizeMax:0});for(const i of t)L.xMin=Math.min(L.xMin,i),L.xMax=Math.max(L.xMax,i);for(const t of s)L.yMin=Math.min(L.yMin,t),L.yMax=Math.max(L.yMax,t);for(const t of e)L.sizeMax=Math.max(L.sizeMax,t)}return p>0&&u.push({code:"xy-duplicate-point",data:{count:String(p),names:f.join(", ")}}),v>0&&u.push({code:"xy-variance-nodata",data:{count:String(v)}}),g>0&&u.push({code:"xy-point-clipped",data:{count:String(g)}}),m>0&&u.push({code:"bubble-size-negative",data:{count:String(m)}}),b>0&&u.push({code:"bubble-share-range",data:{count:String(b)}}),T>5e3&&u.push({code:"xy-point-budget",data:{count:String(T)}}),{facets:O,series:E,extents:L,warnings:u,totalPoints:T}}class kl{constructor(t,i,s,e,n,r){var o,h,a,l;this.ruleSet=t,this.config=e,this.styles=n,this.availableWidth=r,this.warnings=[],this.canvasHeight=0,this.i18nMap=new Map,this.hatchPatterns=new Set,this.scaleOverflowCount=0,this.svgRoot=null,this.config=Object.assign(Object.assign({},e),{x:Ot(e.x),y:Ot(e.y)});const c=new Sl;let u=[];try{""!==s&&(u=i.exec(`SELECT * FROM ${s}`))}catch(t){this.queryError=ei(t)}const d=(null!=u?u:[]).map((t=>c.adapt(t)));this.data=Ol(d,{pointLevel:e.pointLevel,seriesLevel:e.seriesLevel,facetLevel:null!==e.facet?"rowgroup"===e.facet.level?"rowGroup":"category":null,measures:{x:null!==(o=P(e.x.measure))&&void 0!==o?o:{kind:"scenario",slot:"ac1"},y:null!==(h=P(e.y.measure))&&void 0!==h?h:{kind:"scenario",slot:"ac2"},size:null!==(a=P(e.size.measure))&&void 0!==a?a:{kind:"scenario",slot:"ac3"},share:null!==e.share&&null!==(l=P(e.share.measure))&&void 0!==l?l:void 0},compareFamily:e.compareFamily,domains:{x:{min:this.config.x.min,max:this.config.x.max},y:{min:this.config.y.min,max:this.config.y.max}},limit:e.limit,limitBy:"size"}),this.warnings.push(...this.data.warnings)}get em(){return this.styles.fontStyles.size}get xPercent(){return kt(this.config.x.measure)}get yPercent(){return kt(this.config.y.measure)}get sizePercent(){return kt(this.config.size.measure)}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}textWidth(t,i=!1){const s=os(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:i?"bold":"normal"}).width;return Number.isFinite(s)&&s>0?s:.6*t.length*this.em}drawText(t,i,s,e,n={}){var r,o;t.text(i).font({size:this.styles.fontStyles.size,weight:n.bold?"bold":"normal",anchor:null!==(r=n.anchor)&&void 0!==r?r:"start"}).fill(null!==(o=n.color)&&void 0!==o?o:this.styles.fontStyles.color).attr({x:s,y:e,"font-family":this.fontFamily()})}hasNoData(){return 0===this.data.totalPoints}getWarnings(){return this.warnings}getQueryError(){return this.queryError}getAllocatedCanvasWidth(){return this.availableWidth}getAllocatedCanvasHeight(){return this.canvasHeight}setI18n(t){this.i18nMap=t}addWarningOnce(t,i){this.warnings.some((i=>i.code===t))||this.warnings.push({code:t,data:i})}primaryColorIndex(){const t=P(this.config.size.measure);return null===t||"variance"===t.kind?10:this.ruleSet.getScenarioColorIndex(t.slot)}compareColorIndex(){return this.ruleSet.getScenarioColorIndex(`${this.config.compareFamily}1`)}seriesHue(t){const{color:i,overflowed:s}=S(t,this.styles.seriesColors);return s&&this.addWarningOnce("xy-series-overflow",{}),i}familyDisplayName(t){return this.ruleSet.getScenario(`${t}1`).group}legendModel(){var t,i;const s=[],e=null!==(i=null!==(t=this.config.size.label)&&void 0!==t?t:this.i18nMap.get("legend.size"))&&void 0!==i?i:"";""!==e&&(s.push(e),void 0!==this.config.size.unit&&""!==this.config.size.unit&&s.push(`${this.i18nMap.get("axis.in")||"in"} ${this.config.size.unit}`));const n=[];if(null!==this.config.compareFamily){const t=P(this.config.size.measure),i=null!==t&&"scenario"===t.kind?t.slot.replace(/\d+$/,""):"ac";n.push(this.legendEntry(this.familyDisplayName(this.config.compareFamily),this.compareColorIndex(),0)),n.push(this.legendEntry(this.familyDisplayName(i),this.primaryColorIndex(),0))}const r=this.data.series.map((t=>{var i;return this.legendEntry(""===t.key?null!==(i=this.ruleSet.getScenario("").name)&&void 0!==i?i:"Series":t.key,this.primaryColorIndex(),t.index)}));return{sizeCaption:s,title:this.i18nMap.get("legend.title")||null,compareEntries:n,entries:r}}legendEntry(t,i,s){const e=this.seriesHue(s),n=$(i,e,"bubble");return{label:t,treatment:n,fill:this.treatmentFill(n,s,e)}}toString(){const t=new ba;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}axisTitle(t,i){var s;const e=null!==(s=t.label)&&void 0!==s?s:"";return""===e?"":void 0===t.unit||""===t.unit?e:`${e} ${i} ${t.unit}`}draw(t){var i,s,e,n,r,o,h,a,l,c,u;this.warnings=this.data.warnings.slice(),this.hatchPatterns.clear(),this.scaleOverflowCount=0,this.svgRoot=t;const d=this.em,f=this.styles.padding,p=this.i18nMap.get("axis.in")||"in",v=t.group(),g=new yl(this.styles),m=this.legendModel(),b=this.config.legend.show&&(m.entries.length>0||m.sizeCaption.length>0),y=b?g.measure(m,this.config.legend.position):{width:0,height:0},w="right"===this.config.legend.position&&b?y.width+d:0,x=""!==this.config.chartTitle?1.6*d:0,S=this.axisTitle(this.config.y,p),$=this.axisTitle(this.config.x,p),M=""!==S?1.4*d:.4*d,_=1.4*d+(""!==$?1.3*d:0);let R,O=3*d,k={x:0,y:0,width:0,height:0},E=[];const L=Math.max(1,this.data.facets.length),T=null===(i=this.config.facet)||void 0===i?void 0:i.columns,A=rl.domain(null!==(e=null===(s=this.data.extents)||void 0===s?void 0:s.xMin)&&void 0!==e?e:0,null!==(r=null===(n=this.data.extents)||void 0===n?void 0:n.xMax)&&void 0!==r?r:1,{min:this.config.x.min,max:this.config.x.max}),C=rl.domain(null!==(h=null===(o=this.data.extents)||void 0===o?void 0:o.yMin)&&void 0!==h?h:0,null!==(l=null===(a=this.data.extents)||void 0===a?void 0:a.yMax)&&void 0!==l?l:1,{min:this.config.y.min,max:this.config.y.max});for(let t=0;t<2;t++){const t=Math.max(10,this.availableWidth-f.left-f.right-O-w);k={x:f.left+O,y:f.top+x+M,width:t,height:t/this.config.aspect},R=new nl(L,T,k,this.styles.scaleFactors.panelGap*d);const i=R.panelRect(0).height,s=Math.max(4,Math.min(8,Math.round(i/(4*d)))),e=new rl(C[0],C[1],i,0);E=e.ticks(s);const n=hl(E,this.yPercent);O=Math.max(...E.map((t=>this.textWidth(ol(t,n,this.styles.locale,this.yPercent)))),d)+this.styles.scaleFactors.axisTickLength*d+.4*d}this.canvasHeight=k.y+k.height+_+("bottom"===this.config.legend.position&&b?y.height+d:0)+f.bottom,""!==this.config.chartTitle&&this.drawText(v,this.config.chartTitle,f.left,f.top+d,{bold:!0}),""!==S&&this.drawAxisTitleText(v,this.config.y,p,f.left,k.y-.6*d,"start");const P=this.buildPanels(R,A,C),N=P[0].xScale.ticks(Math.max(3,Math.min(8,Math.round(P[0].rect.width/(7*d))))),D=hl(N,this.xPercent),U=hl(E,this.yPercent),z=this.config.sizeAreaPerUnit>0?ml.grouped(this.config.sizeAreaPerUnit):ml.local(null!==(u=null===(c=this.data.extents)||void 0===c?void 0:c.sizeMax)&&void 0!==u?u:0,this.styles.scaleFactors.bubbleMaxRadius*d,this.styles.scaleFactors.bubbleMinRadius*d);0===this.data.facets.length?this.drawPanel(v,P[0],{key:"",points:[]},z,N,E,D,U,!0,!0):this.data.facets.forEach(((t,i)=>{this.drawPanel(v,P[i],t,z,N,E,D,U,R.isOuterLeft(i),R.isOuterBottom(i),this.data.facets.length>1?t.key:"")})),""!==$&&this.drawAxisTitleText(v,this.config.x,p,k.x+k.width,k.y+k.height+2.6*d,"end"),b&&("right"===this.config.legend.position?g.draw(v,m,k.x+k.width+d,k.y,"right"):g.draw(v,m,k.x,k.y+k.height+_,"bottom")),this.scaleOverflowCount>0&&this.addWarningOnce("bubble-scale-overflow",{count:String(this.scaleOverflowCount)}),t.group().addClass("annotations")}drawAxisTitleText(t,i,s,e,n,r){var o;const h=null!==(o=i.label)&&void 0!==o?o:"",a=void 0!==i.unit&&""!==i.unit?`${s} ${i.unit}`:"",l=.3*this.em;"start"===r?(this.drawText(t,h,e,n,{bold:!0}),""!==a&&this.drawText(t,a,e+this.textWidth(h,!0)+l,n,{})):""!==a?(this.drawText(t,a,e,n,{anchor:"end"}),this.drawText(t,h,e-this.textWidth(a)-l,n,{anchor:"end",bold:!0})):this.drawText(t,h,e,n,{anchor:"end",bold:!0})}buildPanels(t,i,s){const e=[];for(let n=0;n<t.count;n++){const r=t.panelRect(n),o=new rl(i[0],i[1],r.x,r.x+r.width),h=new rl(s[0],s[1],r.y+r.height,r.y);e.push({rect:r,xScale:o,yScale:h,frame:new bl(o,h,r,this.styles)})}return e}treatmentFill(t,i,s){return!0!==t.hatch?t.fill:(this.ensureHatchPattern(i,s),`url(#xy-fc-${i})`)}ensureHatchPattern(t,i){this.hatchPatterns.has(t)||null===this.svgRoot||(this.hatchPatterns.add(t),this.svgRoot.defs().pattern(10,10,(t=>{t.rect(10,10).fill("#ffffff"),t.line(0,10,10,0).stroke({color:i,width:2}),t.line(-2.5,2.5,2.5,-2.5).stroke({color:i,width:2}),t.line(7.5,12.5,12.5,7.5).stroke({color:i,width:2})})).id(`xy-fc-${t}`))}drawPanel(t,i,s,e,n,r,o,h,a,l,c=""){var u,d,f,p;const v=t.group(),g=this.em;i.frame.drawBands(v,this.config.x.highlight,this.config.y.highlight),i.frame.drawGrid(v,r,void 0===this.config.x.refLine&&void 0===this.config.y.refLine&&i.rect.width>30*g?n:void 0),i.frame.drawRefLines(v,this.config.x.refLine,this.config.y.refLine),i.frame.drawFrame(v);const m=v.group().id("compare"),b=v.group().id("primary"),y=new gl(i.rect,this.styles.scaleFactors.labelToMark*g),w=[...s.points].sort(((t,i)=>{var s,e;return(null!==(s=i.size)&&void 0!==s?s:0)-(null!==(e=t.size)&&void 0!==e?e:0)})),x=[];for(const t of w){const s=null!==(d=null===(u=this.data.series.find((i=>i.key===t.seriesKey)))||void 0===u?void 0:u.index)&&void 0!==d?d:0,n=this.seriesHue(s),r=$(this.primaryColorIndex(),n,"bubble"),o=i.xScale.scale(t.x),h=i.yScale.scale(t.y),a=e.radius(null!==(f=t.size)&&void 0!==f?f:0);if(this.config.sizeAreaPerUnit>0&&this.bubbleExceedsPanel(i.rect,o,h,a)&&this.scaleOverflowCount++,null!=t.compare){const r=$(this.compareColorIndex(),n,"bubble"),o=i.xScale.scale(t.compare.x),h=i.yScale.scale(t.compare.y),a=e.radius(null!==(p=t.compare.size)&&void 0!==p?p:0);this.drawBubble(m,o,h,a,r,s,n),y.registerMark(o,h,a),this.config.labels.values&&void 0!==t.compare.size&&a>=1.2*g&&this.drawValueLabel(m,o,h,a,t.compare.size,r.fill)}this.drawBubble(b,o,h,a,r,s,n),y.registerMark(o,h,a),void 0!==t.share&&a>0&&this.drawShareSlice(b,o,h,a,t.share,M(n)),this.config.labels.values&&void 0!==t.size&&this.drawValueLabel(b,o,h,a,t.size,!0===r.hatch?"#ffffff":r.fill),x.push({point:t,cx:o,cy:h,r:a,seriesIndex:s,hue:n,treatment:r})}this.drawNameLabels(v,y,x),i.frame.drawTickLabels(v,{ticksX:n,ticksY:r,xDecimals:o,yDecimals:h,xPercent:this.xPercent,yPercent:this.yPercent,showXLabels:l,showYLabels:a}),""!==c&&i.frame.drawPanelTitle(v,c)}bubbleExceedsPanel(t,i,s,e){return i-e<t.x||i+e>t.x+t.width||s-e<t.y||s+e>t.y+t.height}drawBubble(t,i,s,e,n,r,o){e<=0||t.circle(2*e).center(i,s).fill(this.treatmentFill(n,r,o)).stroke({color:n.stroke,width:n.strokeWidth})}drawShareSlice(t,i,s,e,n,r){if(n<=0)return;if(n>=1)return void t.circle(2*e).center(i,s).fill(r);const o=2*n*Math.PI,h=i+e*Math.sin(o),a=s-e*Math.cos(o),l=o>Math.PI?1:0;t.path(`M ${i} ${s} L ${i} ${s-e} A ${e} ${e} 0 ${l} 1 ${h} ${a} Z`).fill(r).stroke("none")}drawValueLabel(t,i,s,e,n,r){const o=ol(n,this.valueDecimals(),this.styles.locale,this.sizePercent);this.textWidth(o)+.4*this.em>2*e||this.drawText(t,o,i,s+.35*this.em,{anchor:"middle",color:el(r)})}drawNameLabels(t,i,s){const e=[...s].sort(((t,i)=>{var s,e;return(null!==(s=i.point.size)&&void 0!==s?s:0)-(null!==(e=t.point.size)&&void 0!==e?e:0)})),{selected:n,unknownNames:r}=i.selectCandidates(e,this.config.labels.points,this.config.labels.max,(t=>t.point.name));r.length>0&&this.addWarningOnce("xy-label-unknown",{names:r.join(", ")});const o=n.map((t=>({name:t.point.name,cx:t.cx,cy:t.cy,r:t.r,width:this.textWidth(t.point.name),height:1.1*this.em})));for(const s of i.place(o))this.drawText(t,s.candidate.name,s.x,s.y+.9*s.candidate.height,{})}valueDecimals(){var t,i,s;let e=0;for(const n of this.data.facets)for(const r of n.points)e=Math.max(e,Math.abs(null!==(t=r.size)&&void 0!==t?t:0),Math.abs(null!==(s=null===(i=r.compare)||void 0===i?void 0:i.size)&&void 0!==s?s:0));return e>0&&Number.isFinite(e)?(this.sizePercent&&(e*=100),rl.stepDecimals(Math.pow(10,Math.floor(Math.log10(e))-2))):1}}const El=["xy-duplicate-point","xy-point-clipped","xy-variance-nodata","xy-label-unknown","xy-series-overflow","xy-point-budget","bubble-size-negative","bubble-share-range","bubble-scale-overflow"],Ll=class{constructor(i){t(this,i),this.tableName="",this.dataVersion=0,this.chartTitle="",this.share=null,this.compareFamily=null,this.facet=null,this.pointLevel="category",this.seriesLevel=null,this.aspect=16/9,this.limit=0,this.filter="",this.sizeAreaPerUnit=0,this.i18n=new Map,this.containerWidth=0,this.svgMarkup="",a(this)}getDb(){return this.stores||(this.stores=u(this.element)),this.stores.db.db}componentWillLoad(){this.rebuild()}componentWillUpdate(){this.rebuild()}rebuild(){const t=this.prepareStyle(),i=_(this.getDb(),this.tableName,this.filter);this.chart=new kl(new Ge(this.ruleSetConfig),this.getDb(),i,{chartTitle:this.chartTitle,x:this.x,y:this.y,size:this.size,share:this.share,compareFamily:this.compareFamily,labels:this.labels,legend:this.legend,facet:this.facet,pointLevel:this.pointLevel,seriesLevel:this.seriesLevel,aspect:this.aspect,limit:this.limit,sizeAreaPerUnit:this.sizeAreaPerUnit},t,this.containerWidth||0),this.chart.setI18n(this.i18n),this.svgMarkup=this.chart.hasNoData()?"":this.chart.toString(),this.syncWarnings(this.chart.getWarnings()),ni(this.errors,this.chart.getQueryError())}syncWarnings(t){if(void 0===this.errors)return;const i=new Map(t.map((t=>[t.code,t.data])));for(const t of El){const s=`WARN_${t}`;if(i.has(t)){const e=void 0!==this.translate?this.translate(`.${t}`,i.get(t)):t;this.errors.addOrReplace({id:s,type:"warning",message:e})}else this.errors.remove(s)}}prepareStyle(){var t,i;const s=new Qe(new tn,new Ie,new qe(new Xe),new Be).adapt(this.styles);return s.locale=(null===(i=null===(t=u(this.element).context)||void 0===t?void 0:t.state)||void 0===i?void 0:i.locale)||"de",s}render(){var t;if(void 0===this.chart||void 0!==this.chart.getQueryError())return i(s,null);if(this.chart.hasNoData()){const e=null!==(t=this.i18n.get("no-data"))&&void 0!==t?t:"No Data";return i(s,{class:"no-data"},i("div",{class:"empty-state"},e))}return i(s,null,i("div",{innerHTML:this.svgMarkup}))}get element(){return e(this)}};Ll.style=':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{position:relative;display:inline-block}';class Tl{constructor(t,i,s){this.pos=t,this.neg=i,this.neu=s,this.needleHeadColour="#000000"}getSVGStyle(t){return"pos"===t?this.pos:"neg"===t?this.neg:this.neu}}class Al{constructor(t){this.svgStyleAdapter=t}adapt(t){const i=new Tl(this.svgStyleAdapter.defaultPos(),this.svgStyleAdapter.defaultNeg(),this.svgStyleAdapter.defaultNeu());return E.isExisting(t.pos)&&(i.pos=this.svgStyleAdapter.adapt(t.pos)),E.isExisting(t.neg)&&(i.neg=this.svgStyleAdapter.adapt(t.neg)),E.isExisting(t.pp)&&(i.neu=this.svgStyleAdapter.adapt(t.neu)),E.isString(t.needleHeadColour)&&(i.needleHeadColour=t.needleHeadColour),i}default(){return new Tl(this.svgStyleAdapter.defaultPos(),this.svgStyleAdapter.defaultNeg(),this.svgStyleAdapter.defaultNeu())}}class Cl{constructor(t,i,s,e,n,r){this.ruleSet=t,this.config=e,this.styles=n,this.availableWidth=r,this.rows=[],this.warnings=[],this.i18nMap=new Map,this.populateModel(i,s),this.normalized="target"===this.config.normalize&&this.rows.some((t=>null!==t.fraction)),null!==this.config.target&&this.rows.length>0&&!this.rows.some((t=>null!==t.target))&&this.warnings.push({code:"bullet-target-none",data:{}})}populateModel(t,i){var s,e,n;if(""===i)return;const r=this.config.level,o=this.config.order,h=this.config.actual.measure,a=null!==(e=null===(s=this.config.target)||void 0===s?void 0:s.measure)&&void 0!==e?e:null,l="transformOperator(operation)",c=[h,...null!==a?[a]:[]].map((t=>`CASE WHEN MIN(${l}) = MAX(${l}) THEN SUM(${t}) ELSE SUM(${t} * ${l}) END as ${t}, SUM(ABS(${t})) as ${t}_gross, COUNT(ISNULL(${t})) as ${t}_cnt`)).join(", ");let u;try{u=t.exec(`SELECT ${this.createSelectString(r,o)}, ${c},\n MIN(transformOperator(operation)) as opMin, MAX(transformOperator(operation)) as opMax\n FROM ${i}\n GROUP BY ${this.createGroupByStr(r,o)}\n ORDER BY ${this.createOrderStr(r,o)}`)}catch(t){return void(this.queryError=ei(t))}let d=null!=u?u:[];this.config.limit>0&&(d=d.slice(0,this.config.limit));let f=0,p=0,v=0,g=0;for(const t of d){const i="number"==typeof t.opMin?t.opMin:1,s="number"==typeof t.opMax?t.opMax:1;let e=-1===i&&-1===s?"-":"+";i!==s&&(e="+",f++);const r=this.readValue(t,h),o=null!==a?this.readValue(t,a):null;null!==r&&r<0&&g++;let l=null;"target"===this.config.normalize&&(null===o?null!==a&&p++:o<=0?v++:null!==r&&r>=0&&(l=r/o)),this.rows.push({category:String(null!==(n=t.category)&&void 0!==n?n:""),actual:r,target:o,operation:e,sentiment:this.sentiment(r,o,e),fraction:l})}f>0&&this.warnings.push({code:"bullet-mixed-operation",data:{count:String(f)}}),p>0&&this.warnings.push({code:"bullet-target-missing",data:{count:String(p)}}),v>0&&this.warnings.push({code:"bullet-target-invalid",data:{count:String(v)}}),g>0&&this.warnings.push({code:"bullet-actual-negative",data:{count:String(g)}})}readValue(t,i){if(0===t[`${i}_cnt`])return null;const s=t[i],e=t[`${i}_gross`];return"number"==typeof s&&"number"==typeof e&&Math.abs(s)<=1e-9*e?0:"number"==typeof s&&isFinite(s)?s:null}sentiment(t,i,s){return null===t||null===i||t===i?"neu":t>i!=("-"===s)?"pos":"neg"}createSelectString(t,i){return t===z.CATEGORY&&i.hierarchy.includes(G.CATEGORYINDEX)?`${G.CATEGORYINDEX}, ${z.CATEGORY} as category`:t===z.ROWGROUP&&i.hierarchy.includes(G.ROWGROUPINDEX)?`${G.ROWGROUPINDEX}, ${z.ROWGROUP} as category`:t===z.SUBCATEGORY&&i.hierarchy.includes(G.SUBCATEGORYINDEX)?`${G.SUBCATEGORYINDEX}, ${z.SUBCATEGORY} as category`:`${t.toString()} as category`}createGroupByStr(t,i){return t===z.CATEGORY&&i.hierarchy.includes(G.CATEGORYINDEX)?`${G.CATEGORYINDEX}, ${z.CATEGORY}`:t===z.ROWGROUP&&i.hierarchy.includes(G.ROWGROUPINDEX)?`${G.ROWGROUPINDEX}, ${z.ROWGROUP}`:t===z.SUBCATEGORY&&i.hierarchy.includes(G.SUBCATEGORYINDEX)?`${G.SUBCATEGORYINDEX}, ${z.SUBCATEGORY}`:`${t.toString()}`}createOrderStr(t,i){let s=`${t.toLowerCase()}`;return i.hierarchy.length>=1&&(s=i.hierarchy.map((t=>`${t} ${i.direction}`)).toString()),s}get em(){return this.styles.fontStyles.size}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}textWidth(t,i=!1){const s=os(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:i?"bold":"normal"}).width;return Number.isFinite(s)&&s>0?s:.6*t.length*this.em}drawText(t,i,s,e,n={}){var r,o,h;t.text(i).font({size:null!==(r=n.size)&&void 0!==r?r:this.styles.fontStyles.size,weight:n.bold?"bold":"normal",anchor:null!==(o=n.anchor)&&void 0!==o?o:"start"}).fill(null!==(h=n.color)&&void 0!==h?h:this.styles.fontStyles.color).attr({x:s,y:e,"font-family":this.fontFamily()})}setI18n(t){this.i18nMap=t}hasNoData(){return 0===this.rows.length}getWarnings(){return this.warnings}getQueryError(){return this.queryError}getAllocatedCanvasWidth(){return this.availableWidth}getAllocatedCanvasHeight(){return this.styles.padding.top+this.titleHeight()+this.headerHeight()+this.rows.length*this.rowBlockHeight()+this.styles.padding.bottom}titleHeight(){return""!==this.config.chartTitle?1.6*this.em:0}headerHeight(){return this.rows.length>0?1.2*this.em:0}rowBlockHeight(){const t=this.em,i=this.styles.scaleFactors.rowHeight*t;return this.normalized?i:i+this.styles.scaleFactors.tickStripHeight*t}valueLabel(t){return null===t||"none"===this.config.labels.show?"":hs.number(t,"decimal",this.config.labels.decimals,0,1,this.styles.locale)}targetFamily(){var t,i,s;const e=null!==(i=null===(t=this.config.target)||void 0===t?void 0:t.measure)&&void 0!==i?i:"pl1";return null!==(s={10:"ac",20:"pp",30:"fc",50:"pl"}[this.ruleSet.getScenarioColorIndex(e)])&&void 0!==s?s:N(e)}actualLabel(){var t;return null!==(t=this.config.actual.label)&&void 0!==t?t:hs.translateScenarioLabel(this.config.actual.measure,this.i18nMap)}targetLabel(){return null===this.config.target?"":void 0!==this.config.target.label?this.config.target.label:this.normalized?this.i18nMap.get("target")||"Target":hs.translateScenarioLabel(this.config.target.measure,this.i18nMap)}toString(){const t=new ba;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}draw(t){var i,s;const e=this.em,n=this.styles.scaleFactors,r=this.styles.padding,o=t.group();if(""!==this.config.chartTitle&&this.drawText(o,this.config.chartTitle,r.left,r.top+e,{bold:!0}),0===this.rows.length)return void t.group().addClass("annotations");const h=n.rowHeight*e,a=this.rowBlockHeight(),l=r.top+this.titleHeight()+this.headerHeight(),c=l+(this.rows.length-1)*a+h,u=Math.max(...this.rows.map((t=>this.textWidth(t.category,!0))),e),d=this.rows.map((t=>this.valueLabel(t.actual))),f="none"===this.config.labels.show?0:Math.max(...d.map((t=>this.textWidth(t))),0),p=r.left+u+n.labelToAxis*e,v=Math.max(10,this.availableWidth-p-r.right-f-(f>0?n.labelToBar*e:0)),g=null!==(i=this.config.actual.unit)&&void 0!==i?i:null===(s=this.config.target)||void 0===s?void 0:s.unit,m=this.i18nMap.get("axis.in")||"in",b=l-.35*e;void 0!==g&&""!==g&&this.drawText(o,`${m} ${g}`,r.left,b,{}),this.drawText(o,this.actualLabel(),p+.2*e,b,{}),this.normalized?this.drawNormalized(o,p,v,l,c,h,a,d):this.drawClassic(o,p,v,l,h,a,d),this.rows.forEach(((t,i)=>{this.drawText(o,t.category,p-n.labelToAxis*e,l+i*a+h/2+.35*e,{anchor:"end",bold:!0})})),o.line(p,l-.2*e,p,c+.2*e).stroke({color:this.styles.axisStyles.ac.stroke,width:n.axisLineWidth}),t.group().addClass("annotations")}drawNormalized(t,i,s,e,n,r,o,h){const a=this.em,l=this.styles.scaleFactors,c=Math.max(1,...this.rows.map((t=>{var i;return null!==(i=t.fraction)&&void 0!==i?i:0}))),u=1.05*c,d=t=>i+t/u*s,f=d(1),p=this.styles.barStyles.getSVGStyle(this.targetFamily()),v=t.line(f,e-.3*a,f,n+.3*a).stroke({color:p.stroke,width:l.targetLineWidth});void 0!==p.dasharray&&v.attr("stroke-dasharray",p.dasharray),this.drawText(t,this.targetLabel(),f,e-.35*a,{anchor:"middle",bold:!0}),this.rows.forEach(((s,n)=>{const c=e+n*o+r/2;if(null===s.fraction)return void this.drawValueText(t,h[n],i+l.labelToBar*a,c);const u=l.barHeight*a,p=d(s.fraction);if(t.rect(Math.max(0,p-i),u).move(i,c-u/2).fill(this.styles.barStyles.ac.fill).stroke({color:this.styles.barStyles.ac.stroke,width:this.styles.barStyles.ac.width}),this.config.showVariances&&"neu"!==s.sentiment){const i=l.varianceHeight*a,e=this.styles.varianceStyles.getSVGStyle(s.sentiment);t.rect(Math.abs(p-f),i).move(Math.min(p,f),c-i/2).fill(e.fill).stroke({color:e.stroke,width:e.width})}this.drawValueText(t,h[n],Math.max(p,f)+l.labelToBar*a,c)}))}drawClassic(t,i,s,e,n,r,o){const h=this.em,a=this.styles.scaleFactors,l=a.barHeight*h,c=this.config.ranges.length>0;this.rows.forEach(((u,d)=>{var f,p;const v=e+d*r,g=v+n/2,m=c&&null!==u.target?this.config.ranges.map((t=>t*u.target)):[],b=Math.max(null!==(f=u.actual)&&void 0!==f?f:0,null!==(p=u.target)&&void 0!==p?p:0,...m);if(b<=0)return void this.drawValueText(t,o[d],i+a.labelToBar*h,g);const y=rl.niceStep(b,4),w=Math.ceil(b/y-1e-9*y)*y,x=new rl(0,w,i,i+s);let S=i;m.forEach(((i,s)=>{const e=.8*n;t.rect(Math.max(0,x.scale(i)-S),e).move(S,g-e/2).fill(this.styles.rangeColors[Math.min(s,this.styles.rangeColors.length-1)]).stroke("none"),S=x.scale(i)}));let $=i;if(null!==u.actual&&u.actual>0){const s=x.scale(u.actual);t.rect(s-i,l).move(i,g-l/2).fill(this.styles.barStyles.ac.fill).stroke({color:this.styles.barStyles.ac.stroke,width:this.styles.barStyles.ac.width}),$=s}if(null!==u.target&&u.target>0){const i=x.scale(u.target),s=a.targetTickHeight*h,n=this.styles.barStyles.getSVGStyle(this.targetFamily()),r=t.line(i,g-s/2,i,g+s/2).stroke({color:n.stroke,width:a.targetLineWidth});void 0!==n.dasharray&&r.attr("stroke-dasharray",n.dasharray),0===d&&this.drawText(t,this.targetLabel(),i,e-.35*h,{anchor:"middle"}),$=Math.max($,i)}$=Math.max($,S),this.drawValueText(t,o[d],$+a.labelToBar*h,g);const M=x.ticks(4),_=rl.tickDecimals(M),R=v+n;for(const i of M){const s=x.scale(i);t.line(s,R,s,R+a.axisTickLength*h).stroke({color:this.styles.axisStyles.ac.stroke,width:a.axisLineWidth}),this.drawText(t,hs.number(i,"decimal",_,_,1,this.styles.locale),s,R+a.tickStripHeight*h-.2*h,{anchor:"middle"})}}))}drawValueText(t,i,s,e){""!==i&&this.drawText(t,i,s,e+.35*this.em,{})}}class Pl{constructor(){this.rowHeight=1.9,this.barHeight=.66,this.varianceHeight=.4,this.targetTickHeight=1.1,this.targetLineWidth=2,this.axisLineWidth=1,this.labelToBar=.3,this.labelToAxis=.3,this.axisTickLength=.35,this.tickStripHeight=1.2}}class Nl{adapt(t){const i=new Pl;return E.isNumber(t.rowHeight)&&(i.rowHeight=t.rowHeight),E.isNumber(t.barHeight)&&(i.barHeight=t.barHeight),E.isNumber(t.varianceHeight)&&(i.varianceHeight=t.varianceHeight),E.isNumber(t.targetTickHeight)&&(i.targetTickHeight=t.targetTickHeight),E.isNumber(t.targetLineWidth)&&(i.targetLineWidth=t.targetLineWidth),E.isNumber(t.axisLineWidth)&&(i.axisLineWidth=t.axisLineWidth),E.isNumber(t.labelToBar)&&(i.labelToBar=t.labelToBar),E.isNumber(t.labelToAxis)&&(i.labelToAxis=t.labelToAxis),E.isNumber(t.axisTickLength)&&(i.axisTickLength=t.axisTickLength),E.isNumber(t.tickStripHeight)&&(i.tickStripHeight=t.tickStripHeight),i}default(){return new Pl}}class Dl{constructor(t,i,s,e,n,r){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=s,this.barStyles=e,this.varianceStyles=n,this.padding=r,this.rangeColors=["#D9D9D9","#EFEFEF"],this.locale="de"}}class Ul{constructor(t,i,s,e,n){this.scaleFactorsBulletChartAdapter=t,this.fontStyleAdapter=i,this.svgStyleGroupAdapter=s,this.svgVariancesStyleGroupAdapter=e,this.paddingAdapter=n}adapt(t){const i=this.default();return E.isExisting(t)&&(E.isExisting(t.scaleFactors)&&(i.scaleFactors=this.scaleFactorsBulletChartAdapter.adapt(t.scaleFactors)),E.isExisting(t.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(t.fontStyles)),E.isExisting(t.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(t.axisStyles)),E.isExisting(t.barStyles)&&(i.barStyles=this.svgStyleGroupAdapter.adapt(t.barStyles)),E.isExisting(t.varianceStyles)&&(i.varianceStyles=this.svgVariancesStyleGroupAdapter.adapt(t.varianceStyles)),E.isExisting(t.padding)&&(i.padding=this.paddingAdapter.adapt(t.padding)),Array.isArray(t.rangeColors)&&t.rangeColors.length>0&&(i.rangeColors=t.rangeColors)),i}default(){return new Dl(this.scaleFactorsBulletChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingAdapter.default())}}const zl=["bullet-target-missing","bullet-target-invalid","bullet-actual-negative","bullet-mixed-operation","bullet-target-none"],Fl=class{constructor(i){t(this,i),this.tableName="",this.dataVersion=0,this.chartTitle="",this.target=null,this.ranges=[],this.normalize="target",this.showVariances=!0,this.level=z.CATEGORY,this.limit=0,this.filter="",this.i18n=new Map,this.containerWidth=0,this.svgMarkup="",a(this)}getDb(){return this.stores||(this.stores=u(this.element)),this.stores.db.db}componentWillLoad(){this.rebuild()}componentWillUpdate(){this.rebuild()}rebuild(){const t=this.prepareStyle(),i=_(this.getDb(),this.tableName,this.filter);this.chart=new Cl(new Ge(this.ruleSetConfig),this.getDb(),i,{chartTitle:this.chartTitle,actual:this.actual,target:this.target,ranges:this.ranges,normalize:this.normalize,showVariances:this.showVariances,level:this.level,order:this.order,limit:this.limit,labels:this.labels},t,this.containerWidth||0),this.chart.setI18n(this.i18n),this.svgMarkup=this.chart.hasNoData()?"":this.chart.toString(),this.syncWarnings(this.chart.getWarnings()),ni(this.errors,this.chart.getQueryError())}syncWarnings(t){if(void 0===this.errors)return;const i=new Map(t.map((t=>[t.code,t.data])));for(const t of zl){const s=`WARN_${t}`;if(i.has(t)){const e=void 0!==this.translate?this.translate(`.${t}`,i.get(t)):t;this.errors.addOrReplace({id:s,type:"warning",message:e})}else this.errors.remove(s)}}prepareStyle(){var t,i;const s=new Ul(new Nl,new Ie,new qe(new Xe),new Al(new Xe),new Be).adapt(this.styles);return s.locale=(null===(i=null===(t=u(this.element).context)||void 0===t?void 0:t.state)||void 0===i?void 0:i.locale)||"de",s}render(){var t;if(void 0===this.chart||void 0!==this.chart.getQueryError())return i(s,null);if(this.chart.hasNoData()){const e=null!==(t=this.i18n.get("no-data"))&&void 0!==t?t:"No Data";return i(s,{class:"no-data"},i("div",{class:"empty-state"},e))}return i(s,null,i("div",{innerHTML:this.svgMarkup}))}get element(){return e(this)}};Fl.style=':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{position:relative;display:inline-block}';class Wl{constructor(t,i){this.xScale=t,this.yScale=i}isPositiveDomain(){return this.xScale.domainMin>0&&this.yScale.domainMin>0}static autoK(t){const i=t.filter((t=>t>0)).sort(((t,i)=>t-i));if(0===i.length)return[];const s=t=>i[Math.min(i.length-1,Math.floor(t*i.length))];let e=Wl.ladderValues(s(.25),s(.75));if(e.length<2&&(e=Wl.ladderValues(i[0],i[i.length-1])),0===e.length)return[];if(1===e.length)return e;if(e.length<=4)return e;const n=[];for(let t=0;t<4;t++)n.push(e[Math.round(t*(e.length-1)/3)]);return[...new Set(n)]}static ladderValues(t,i){if(t<=0||i<t)return[];const s=[];for(let e=Math.floor(Math.log10(t))-1;e<=Math.ceil(Math.log10(i));e++)for(const n of[1,2,5]){const r=n*Math.pow(10,e);r>=t&&r<=i&&s.push(r)}return s}visibleRange(t){if(!this.isPositiveDomain()||t<=0)return null;const i=Math.max(this.xScale.domainMin,t/this.yScale.domainMax),s=Math.min(this.xScale.domainMax,t/this.yScale.domainMin);return i>=s?null:[i,s]}samples(t){const i=this.visibleRange(t);if(null===i)return null;const[s,e]=i,n=[];for(let i=0;i<64;i++){const r=s*Math.pow(e/s,i/63);n.push({x:this.xScale.scale(r),y:this.yScale.scale(t/r)})}return n}path(t){const i=this.samples(t);return null===i?null:i.map(((t,i)=>`${0===i?"M":"L"} ${t.x} ${t.y}`)).join(" ")}exitPoint(t){const i=this.visibleRange(t);if(null===i)return null;const s=i[1],e=s>=this.xScale.domainMax-1e-9*Math.abs(this.xScale.domainMax);return{x:this.xScale.scale(s),y:this.yScale.scale(t/s),edge:e?"right":"bottom"}}regionPath(t){if(!this.isPositiveDomain()||t<=0)return null;const i=this.xScale.domainMin,s=this.xScale.domainMax,e=this.yScale.domainMin,n=this.yScale.domainMax,r=this.xScale.scale(i),o=this.xScale.scale(s),h=this.yScale.scale(n),a=this.yScale.scale(e);if(t>=s*n)return null;if(t<=i*e)return`M ${r} ${h} L ${o} ${h} L ${o} ${a} L ${r} ${a} Z`;const l=this.samples(t),[c,u]=this.visibleRange(t),d=c>i,f=u>=s-1e-9*Math.abs(s),p=l.map(((t,i)=>`${0===i?"M":"L"} ${t.x} ${t.y}`));return f||p.push(`L ${o} ${a}`),p.push(`L ${o} ${h}`),d||p.push(`L ${r} ${h}`),p.push("Z"),p.join(" ")}}class Gl{constructor(t,i,s,e,n,r){var o,h;this.ruleSet=t,this.config=e,this.styles=n,this.availableWidth=r,this.warnings=[],this.canvasHeight=0,this.i18nMap=new Map,this.config=Object.assign(Object.assign({},e),{x:Ot(e.x),y:Ot(e.y)});const a=new Sl;let l=[];try{""!==s&&(l=i.exec(`SELECT * FROM ${s}`))}catch(t){this.queryError=ei(t)}const c=(null!=l?l:[]).map((t=>a.adapt(t)));this.data=Ol(c,{pointLevel:e.pointLevel,seriesLevel:e.seriesLevel,facetLevel:null!==e.facet?"rowgroup"===e.facet.level?"rowGroup":"category":null,measures:{x:null!==(o=P(e.x.measure))&&void 0!==o?o:{kind:"scenario",slot:"ac1"},y:null!==(h=P(e.y.measure))&&void 0!==h?h:{kind:"scenario",slot:"ac2"}},domains:{x:{min:this.config.x.min,max:this.config.x.max},y:{min:this.config.y.min,max:this.config.y.max}},limit:e.limit,limitBy:"order"}),this.warnings.push(...this.data.warnings)}get em(){return this.styles.fontStyles.size}get xPercent(){return kt(this.config.x.measure)}get yPercent(){return kt(this.config.y.measure)}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}textWidth(t,i=!1){const s=os(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:i?"bold":"normal"}).width;return Number.isFinite(s)&&s>0?s:.6*t.length*this.em}drawText(t,i,s,e,n={}){var r,o,h;t.text(i).font({size:null!==(r=n.size)&&void 0!==r?r:this.styles.fontStyles.size,weight:n.bold?"bold":"normal",anchor:null!==(o=n.anchor)&&void 0!==o?o:"start"}).fill(null!==(h=n.color)&&void 0!==h?h:this.styles.fontStyles.color).attr({x:s,y:e,"font-family":this.fontFamily()})}hasNoData(){return 0===this.data.totalPoints}getWarnings(){return this.warnings}getQueryError(){return this.queryError}getAllocatedCanvasWidth(){return this.availableWidth}getAllocatedCanvasHeight(){return this.canvasHeight}axisTitle(t,i){var s;const e=null!==(s=t.label)&&void 0!==s?s:"";return""===e?"":void 0===t.unit||""===t.unit?e:`${e} ${i} ${t.unit}`}setI18n(t){this.i18nMap=t}legendModel(){const t=this.data.series.map((t=>{var i;return{label:""===t.key?null!==(i=this.ruleSet.getScenario("").name)&&void 0!==i?i:"Series":t.key,treatment:this.seriesTreatment(t.index)}}));return{sizeCaption:[],title:this.i18nMap.get("legend.title")||null,compareEntries:[],entries:t}}primaryColorIndex(){const t=P(this.config.x.measure);return null===t||"variance"===t.kind?10:this.ruleSet.getScenarioColorIndex(t.slot)}seriesTreatment(t){const{color:i,overflowed:s}=S(t,this.styles.seriesColors);return s&&this.addWarningOnce("xy-series-overflow",{}),$(this.primaryColorIndex(),i,"dot")}addWarningOnce(t,i){this.warnings.some((i=>i.code===t))||this.warnings.push({code:t,data:i})}toString(){const t=new ba;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}draw(t){var i,s,e,n,r,o,h,a,l,c;this.warnings=this.data.warnings.slice();const u=this.em,d=this.styles.padding,f=this.i18nMap.get("axis.in")||"in",p=t.group(),v=new yl(this.styles),g=this.legendModel(),m=this.config.legend.show&&g.entries.length>0,b=m?v.measure(g,this.config.legend.position):{width:0,height:0},y=null!==this.config.iso,w=y?Math.max(3*u,...this.isoValueLabels().map((t=>this.textWidth(t)+u)),this.textWidth(null!==(i=this.config.iso.label)&&void 0!==i?i:"",!0)+u,this.textWidth(void 0!==this.config.iso.unit&&""!==this.config.iso.unit?`${f} ${this.config.iso.unit}`:"")+u):0,x="right"===this.config.legend.position?Math.max(m?b.width+u:0,w):w,S=""!==this.config.chartTitle?1.6*u:0,$=this.axisTitle(this.config.y,f),M=this.axisTitle(this.config.x,f),_=""!==$?1.4*u:.4*u,R=1.4*u+(""!==M?1.3*u:0);let O,k=3*u,E={x:0,y:0,width:0,height:0},L=[];const T=Math.max(1,this.data.facets.length),A=null===(s=this.config.facet)||void 0===s?void 0:s.columns,C=rl.domain(null!==(n=null===(e=this.data.extents)||void 0===e?void 0:e.xMin)&&void 0!==n?n:0,null!==(o=null===(r=this.data.extents)||void 0===r?void 0:r.xMax)&&void 0!==o?o:1,{min:this.config.x.min,max:this.config.x.max}),P=rl.domain(null!==(a=null===(h=this.data.extents)||void 0===h?void 0:h.yMin)&&void 0!==a?a:0,null!==(c=null===(l=this.data.extents)||void 0===l?void 0:l.yMax)&&void 0!==c?c:1,{min:this.config.y.min,max:this.config.y.max});for(let t=0;t<2;t++){const t=Math.max(10,this.availableWidth-d.left-d.right-k-x);E={x:d.left+k,y:d.top+S+_,width:t,height:t/this.config.aspect},O=new nl(T,A,E,this.styles.scaleFactors.panelGap*u);const i=O.panelRect(0).height,s=Math.max(4,Math.min(8,Math.round(i/(4*u)))),e=new rl(P[0],P[1],i,0);L=e.ticks(s);const n=hl(L,this.yPercent);k=Math.max(...L.map((t=>this.textWidth(ol(t,n,this.styles.locale,this.yPercent)))),u)+this.styles.scaleFactors.axisTickLength*u+.4*u}this.canvasHeight=E.y+E.height+R+("bottom"===this.config.legend.position&&m?b.height+u:0)+d.bottom,""!==this.config.chartTitle&&this.drawText(p,this.config.chartTitle,d.left,d.top+u,{bold:!0}),""!==$&&this.drawAxisTitleText(p,this.config.y,f,d.left,E.y-.6*u,"start");const N=this.buildPanels(O,C,P),D=N[0].xScale.ticks(Math.max(3,Math.min(8,Math.round(N[0].rect.width/(7*u))))),U=hl(D,this.xPercent),z=hl(L,this.yPercent);let F=!1;y&&(C[0]>0&&P[0]>0?F=!0:this.addWarningOnce("xy-iso-domain",{})),0===this.data.facets.length?this.drawPanel(p,N[0],{key:"",points:[]},D,L,U,z,!0,!0,F):this.data.facets.forEach(((t,i)=>{this.drawPanel(p,N[i],t,D,L,U,z,O.isOuterLeft(i),O.isOuterBottom(i),F,this.data.facets.length>1?t.key:"")})),""!==M&&this.drawAxisTitleText(p,this.config.x,f,E.x+E.width,E.y+E.height+2.6*u,"end"),m&&("right"===this.config.legend.position?v.draw(p,g,E.x+E.width+u,E.y,"right"):v.draw(p,g,E.x,E.y+E.height+R,"bottom")),t.group().addClass("annotations")}drawAxisTitleText(t,i,s,e,n,r){var o;const h=null!==(o=i.label)&&void 0!==o?o:"",a=void 0!==i.unit&&""!==i.unit?`${s} ${i.unit}`:"",l=.3*this.em;"start"===r?(this.drawText(t,h,e,n,{bold:!0}),""!==a&&this.drawText(t,a,e+this.textWidth(h,!0)+l,n,{})):""!==a?(this.drawText(t,a,e,n,{anchor:"end"}),this.drawText(t,h,e-this.textWidth(a)-l,n,{anchor:"end",bold:!0})):this.drawText(t,h,e,n,{anchor:"end",bold:!0})}buildPanels(t,i,s){const e=[];for(let n=0;n<t.count;n++){const r=t.panelRect(n),o=new rl(i[0],i[1],r.x,r.x+r.width),h=new rl(s[0],s[1],r.y+r.height,r.y);e.push({rect:r,xScale:o,yScale:h,frame:new bl(o,h,r,this.styles)})}return e}drawPanel(t,i,s,e,n,r,o,h,a,l,c=""){var u,d;const f=t.group(),p=this.em;i.frame.drawBands(f,this.config.x.highlight,this.config.y.highlight),i.frame.drawGrid(f,n,void 0===this.config.x.refLine&&void 0===this.config.y.refLine&&i.rect.width>30*p?e:void 0),l&&null!==this.config.iso&&this.drawIso(f,i),i.frame.drawRefLines(f,this.config.x.refLine,this.config.y.refLine),i.frame.drawFrame(f);const v=this.styles.scaleFactors.pointRadius*p,g=new gl(i.rect,this.styles.scaleFactors.labelToMark*p),m=[];for(const t of s.points){const s=null!==(d=null===(u=this.data.series.find((i=>i.key===t.seriesKey)))||void 0===u?void 0:u.index)&&void 0!==d?d:0,e=this.seriesTreatment(s),n=i.xScale.scale(t.x),r=i.yScale.scale(t.y);m.push({point:t,cx:n,cy:r,treatment:e});const o=f.circle(2*v).center(n,r).fill(e.fill).stroke({color:e.stroke,width:e.strokeWidth});void 0!==e.dasharray&&o.attr("stroke-dasharray",e.dasharray),g.registerMark(n,r,v)}this.drawPointLabels(f,g,m,v),i.frame.drawTickLabels(f,{ticksX:e,ticksY:n,xDecimals:r,yDecimals:o,xPercent:this.xPercent,yPercent:this.yPercent,showXLabels:a,showYLabels:h}),""!==c&&i.frame.drawPanelTitle(f,c)}drawPointLabels(t,i,s,e){const n=s.reduce(((t,i)=>t+i.cx),0)/Math.max(1,s.length),r=s.reduce(((t,i)=>t+i.cy),0)/Math.max(1,s.length),o=[...s].sort(((t,i)=>Math.hypot(i.cx-n,i.cy-r)-Math.hypot(t.cx-n,t.cy-r))),{selected:h,unknownNames:a}=i.selectCandidates(o,this.config.labels.points,this.config.labels.max,(t=>t.point.name));a.length>0&&this.addWarningOnce("xy-label-unknown",{names:a.join(", ")});const l=h.map((t=>({name:t.point.name,cx:t.cx,cy:t.cy,r:e,width:this.textWidth(t.point.name),height:1.1*this.em})));for(const s of i.place(l))this.drawText(t,s.candidate.name,s.x,s.y+.9*s.candidate.height,{})}drawIso(t,i){const s=this.config.iso,e=new Wl(i.xScale,i.yScale),n=this.i18nMap.get("axis.in")||"in",r=this.isoValues(),o=this.isoValueLabels();if(void 0!==s.highlight){const i=e.regionPath(s.highlight.from);null!==i&&t.path(i).fill(this.styles.axisStyles.pl.fill).stroke("none")}const h={color:this.styles.axisStyles.fc.stroke,width:this.styles.scaleFactors.gridLineWidth};let a=null;for(const[i,s]of r.entries()){const n=e.path(s);if(null===n)continue;t.path(n).fill("none").stroke(h);const r=e.exitPoint(s);null!==r&&(this.drawText(t,o[i],r.x+.4*this.em,"right"===r.edge?r.y+.35*this.em:r.y-.5*this.em,{}),(null===a||r.y<a.y)&&(a=r))}if(null!==a&&void 0!==s.label&&""!==s.label){const i=void 0!==s.unit&&""!==s.unit?`${n} ${s.unit}`:"";this.drawText(t,s.label,a.x+.4*this.em,a.y-1.6*this.em,{bold:!0}),""!==i&&this.drawText(t,i,a.x+.4*this.em,a.y-.5*this.em,{})}}isoValues(){const t=this.config.iso;return"auto"!==t.values?t.values:Wl.autoK(this.data.facets.flatMap((t=>t.points.map((t=>t.x*t.y)))))}isoValueLabels(){const t=this.isoValues(),i=Math.max(0,...t.map((t=>rl.stepDecimals(Math.abs(t)))));return t.map((t=>ol(t,i,this.styles.locale)))}}const jl=["xy-duplicate-point","xy-point-clipped","xy-variance-nodata","xy-iso-domain","xy-label-unknown","xy-series-overflow","xy-point-budget"],Il=class{constructor(i){t(this,i),this.tableName="",this.dataVersion=0,this.chartTitle="",this.iso=null,this.facet=null,this.pointLevel="category",this.seriesLevel=null,this.aspect=16/9,this.limit=0,this.filter="",this.i18n=new Map,this.containerWidth=0,this.svgMarkup="",a(this)}getDb(){return this.stores||(this.stores=u(this.element)),this.stores.db.db}componentWillLoad(){this.rebuild()}componentWillUpdate(){this.rebuild()}rebuild(){const t=this.prepareStyle(),i=_(this.getDb(),this.tableName,this.filter);this.chart=new Gl(new Ge(this.ruleSetConfig),this.getDb(),i,{chartTitle:this.chartTitle,x:this.x,y:this.y,iso:this.iso,labels:this.labels,legend:this.legend,facet:this.facet,pointLevel:this.pointLevel,seriesLevel:this.seriesLevel,aspect:this.aspect,limit:this.limit},t,this.containerWidth||0),this.chart.setI18n(this.i18n),this.svgMarkup=this.chart.hasNoData()?"":this.chart.toString(),this.syncWarnings(this.chart.getWarnings()),ni(this.errors,this.chart.getQueryError())}syncWarnings(t){if(void 0===this.errors)return;const i=new Map(t.map((t=>[t.code,t.data])));for(const t of jl){const s=`WARN_${t}`;if(i.has(t)){const e=void 0!==this.translate?this.translate(`.${t}`,i.get(t)):t;this.errors.addOrReplace({id:s,type:"warning",message:e})}else this.errors.remove(s)}}prepareStyle(){var t,i;const s=new Qe(new tn,new Ie,new qe(new Xe),new Be).adapt(this.styles);return s.locale=(null===(i=null===(t=u(this.element).context)||void 0===t?void 0:t.state)||void 0===i?void 0:i.locale)||"de",s}render(){var t;if(void 0===this.chart||void 0!==this.chart.getQueryError())return i(s,null);if(this.chart.hasNoData()){const e=null!==(t=this.i18n.get("no-data"))&&void 0!==t?t:"No Data";return i(s,{class:"no-data"},i("div",{class:"empty-state"},e))}return i(s,null,i("div",{innerHTML:this.svgMarkup}))}get element(){return e(this)}};Il.style=':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{position:relative;display:inline-block}';let Yl=class{constructor(t,i,s,e,n,r,o,h,a=!1){this.categoryPosition={x:0,y:0},this.spacings={scenarioOffset:0,markerOffset:0,scenarioLabelToBar:0,labelToBar:0,labelToAxis:0,needleWidth:0,needleHeadWidth:0,barWidth:0,varianceAxisLineWidth:0,axisLineWidth:0,auxiliaryLineWidth:0,scenarioLineWidth:0,markerWidth:0,categoryWidth:0,axisTickLength:0},this.categoriesBoxOffset={width:0,height:0},this.padding=t,this.scaleFactors=i,this.fontSize=s,this.axisPosition={x:0,y:0},this.numberOfColumns=e,this.leftSideLengthSync=n,this.topSideLabelHeight=r>0?this.fontSize:0,this.hasStackedHeaders=a,this.leftSideLabelLength=this.calculateSideLabelLength(r,o,h),this.calculateSpacings(),this.calculateCategoryPosition(),this.calculateAxisPosition()}getBarPositionX(){return this.axisPosition.x}getBarCenterPositionY(t){return this.categoryPosition.y+this.spacings.scenarioOffset+t*this.spacings.categoryWidth}getBarPositionY(t,i){return i?this.getBarCenterPositionY(t):this.getBarCenterPositionY(t)-this.spacings.scenarioOffset}getCategoryPositionX(t){let i=this.spacings.labelToAxis;return t&&(i=-this.spacings.labelToAxis),this.getAxisPositionX()+i}getAxisTitlePositionX(){return this.axisPosition.x}getAxisTitlePositionY(){return this.axisPosition.y-this.spacings.labelToAxis-this.getTopLabelOverhang()}getStackedHeaderPositionY(){return this.getBarCenterPositionY(0)-.5*this.spacings.barWidth-this.spacings.scenarioLabelToBar}getNeedleWidth(){return this.spacings.needleWidth}getAxisPositionX(){return this.leftSideLabelLength+this.padding.left+this.spacings.labelToAxis}getAxisPositionY(){return this.padding.top+this.getAxisTitleOffset()}loadCategoriesBox(t){this.categoriesBoxOffset=t,this.calculateAxisPosition()}addOffsetByNegativeDataPoints(t,i,s,e){null!=t&&null!=t.value&&t.value<0&&(s&&t.isClipped()?this.axisPosition.x+=Math.abs(t.getClippedValue()*t.pixelPerUnit):this.axisPosition.x+=Math.abs(t.value*t.pixelPerUnit),this.axisPosition.x+=i,this.axisPosition.x+=this.spacings.labelToBar),this.axisPosition.x<e/2&&(this.axisPosition.x=e/2+this.spacings.labelToBar)}getLabelPositionX(t){let i=this.spacings.labelToBar;return t<0&&(i*=-1),this.axisPosition.x+t+i}getLabelPositionY(t){return this.axisPosition.y+t+this.spacings.labelToBar}getCategoryToAxisSpaceing(){return this.spacings.labelToAxis}getCategoryToTopSpaceing(){return this.spacings.scenarioOffset}getCategoryToBottomSpaceing(){return this.spacings.scenarioOffset}getAxisEndPositionY(){return this.getAxisPositionY()+(this.numberOfColumns+.5)*this.spacings.categoryWidth}getScenarioLabelPositionOffsetY(t){if(t){const t=.5*this.getBarWidth()+this.spacings.scenarioLabelToBar;return Math.max(t,this.spacings.categoryWidth-this.spacings.scenarioOffset+this.spacings.labelToAxis)}return-(.5*this.getBarWidth()+this.spacings.scenarioLabelToBar)}getBarWidth(){return this.spacings.barWidth}getMarkerPositionY(t,i){return i?this.getBarCenterPositionY(t)-this.spacings.markerOffset-.5*this.getBarWidth():this.getBarCenterPositionY(t)+this.spacings.markerOffset+.5*this.getBarWidth()}getMarkerPositionX(){return this.getBarPositionX()}getMarkerScenarioLabelPositionOffsetY(t){return t?-(.5*this.spacings.markerWidth+this.spacings.scenarioLabelToBar):this.spacings.scenarioLabelToBar+.5*this.spacings.markerWidth}getAxisEndPositionX(){return this.getAxisPositionX()}calculateSpacings(){this.spacings={scenarioOffset:this.fontSize*this.scaleFactors.scenarioOffset,markerOffset:this.fontSize*this.scaleFactors.markerOffset,scenarioLabelToBar:this.fontSize*this.scaleFactors.scenarioLabelToBar,labelToBar:this.fontSize*this.scaleFactors.labelToBar,labelToAxis:this.fontSize*this.scaleFactors.labelToAxis,needleWidth:this.fontSize*this.scaleFactors.needleWidth,needleHeadWidth:this.fontSize*this.scaleFactors.needleHeadWidth,barWidth:this.fontSize*this.scaleFactors.barWidth,varianceAxisLineWidth:this.fontSize*this.scaleFactors.varianceAxisLineWidth,axisLineWidth:this.fontSize*this.scaleFactors.axisLineWidth,auxiliaryLineWidth:this.fontSize*this.scaleFactors.auxiliaryLineWidth,scenarioLineWidth:this.fontSize*this.scaleFactors.scenarioLineWidth,markerWidth:this.fontSize*this.scaleFactors.markerWidth,categoryWidth:this.fontSize*this.scaleFactors.categoryWidth,axisTickLength:this.fontSize*this.scaleFactors.axisTickLength}}calculateCategoryPosition(){this.categoryPosition={x:this.padding.left,y:this.getAxisPositionY()+.5*this.spacings.categoryWidth}}calculateAxisPosition(){this.axisPosition={x:this.getAxisPositionX(),y:this.getAxisPositionY()}}recalculatePositions(){this.calculateCategoryPosition(),this.calculateAxisPosition()}getAxisTitleOffset(){return this.topSideLabelHeight+this.spacings.labelToAxis+this.getTopLabelOverhang()}getTopLabelOverhang(){return this.hasStackedHeaders?this.getStackedHeaderOverhang():this.getTopScenarioLabelOverhang()}getStackedHeaderOverhang(){return Math.max(0,this.fontSize+this.spacings.scenarioLabelToBar+.5*this.spacings.barWidth-(.5*this.spacings.categoryWidth+this.spacings.scenarioOffset))}getTopScenarioLabelOverhang(){return Math.max(0,this.fontSize+.5*this.spacings.barWidth+this.spacings.scenarioLabelToBar-.5*this.spacings.categoryWidth,this.fontSize+.5*this.spacings.markerWidth+this.spacings.scenarioLabelToBar+this.spacings.markerOffset+.5*this.spacings.barWidth-(.5*this.spacings.categoryWidth+this.spacings.scenarioOffset))}calculateSideLabelLength(t,i,s){if(this.leftSideLengthSync)return this.leftSideLengthSync;const e=t/2;let n=i;return e>n&&(n=e),s>n&&(n=s),n}},Bl=class{constructor(t){this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right}addBoxTopLeft(t){return this.top+=t.height|this.top,this.left+=t.width|this.top,this}},Hl=class{constructor(t){const i=1*t,s=.7*t;this.bgOffset=(i-s)/2,this.markerUp={top:s/2+",0",left:"0,"+s,right:s+","+s},this.markerUpBackground={top:i/2+",0",left:"0,"+i,right:i+","+i},this.markerDown={bottom:s/2+","+s,left:"0,0",right:s+",0"},this.markerDownBackground={bottom:i/2+","+i,left:"0,0",right:i+",0"}}upMarkerPatternStrings(){return{background:this.markerUpBackground.left+" "+this.markerUpBackground.right+" "+this.markerUpBackground.top+" "+this.markerUpBackground.left,foreground:this.markerUp.left+" "+this.markerUp.right+" "+this.markerUp.top+" "+this.markerUp.left,bgOffset:this.bgOffset}}downMarkerPatternStrings(){return{background:this.markerDownBackground.left+" "+this.markerDownBackground.right+" "+this.markerDownBackground.bottom+" "+this.markerDownBackground.left,foreground:this.markerDown.left+" "+this.markerDown.right+" "+this.markerDown.bottom+" "+this.markerDown.left,bgOffset:this.bgOffset}}createPatternMapForStructureBar(){const t=new Map;return t.set("marker-up",this.upMarkerPatternStrings()),t.set("marker-down",this.downMarkerPatternStrings()),t}},Vl=class{constructor(t){this.container=new ba,this.pattern=this.createFCPattern(this.container.group(),t),this.styles=t;let i=10;null!=t&&null!=t.fontStyles&&t.fontStyles.size&&(i=t.fontStyles.size),this.bgOffset=(1*i-.7*i)/2}createFCPattern(t,i){const s=i;return t.pattern(10,10,(function(t){t.rect(10,10).fill(s.barStyles.fc.fill),t.line(0,5,5,0).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"}),t.line(5,10,10,5).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"})})).id("pattern-structure-fc")}getFCPolygonPattern(){return{background:"",foreground:"",bgOffset:0,pattern:this.pattern}}toString(){return this.container.svg()}};var Xl,Jl,ql;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(Xl||(Xl={})),function(t){t.RELATIVE="dr",t.ABSOLUTE="d",t.NONE=""}(Jl||(Jl={})),function(t){t[t.Y=1e24]="Y",t[t.Z=1e21]="Z",t[t.E=1e18]="E",t[t.P=1e15]="P",t[t.T=1e12]="T",t[t.G=1e9]="G",t[t.M=1e6]="M",t[t.k=1e3]="k",t[t.h=100]="h",t[t.da=10]="da",t[t.d=.1]="d",t[t.c=.01]="c",t[t.m=.001]="m",t[t.my=1e-6]="my",t[t.n=1e-9]="n",t[t.p=1e-12]="p",t[t.f=1e-15]="f",t[t.a=1e-18]="a",t[t.z=1e-21]="z",t[t.y=1e-24]="y"}(ql||(ql={}));class Kl{static calculateMeasureScale(t,i,s,e,n){var r,o;if("_"===e)return new al;if("μ"===e&&(e="my"),null!=e&&[...this.unitsLeast,...this.unitsGreat].includes(e))return this.lookupPrefix(e);const h=s.filter((t=>3===t.length));if(0===h.length||!i)return new al;const a=`SELECT MAX(GREATEST(${h.map((t=>"ABS("+t+")")).toString()})) as prefixvalue\n FROM ${i}`,l=`SELECT MIN(LEAST(${h.map((t=>"ABS("+t+")")).toString()})) as prefixvalue\n FROM ${i}`;let c,u=a;"LEAST"===(null==e?void 0:e.toUpperCase())&&(u=l);try{c=null!==(o=null===(r=t.exec(u)[0])||void 0===r?void 0:r.prefixvalue)&&void 0!==o?o:0}catch(t){return null==n||n(t),new al}return this.determinePrefix(Math.abs(c))}static determinePrefix(t){if(!Number.isFinite(t)||t<=0)return new al;if(t>=1e3){const i=Math.min(Math.floor(Math.log10(t)/3),this.unitsGreat.length)-1;return new al(this.unitsGreat[i],Math.pow(1e3,i+1))}if(t<=.001){const i=Math.min(-Math.floor(Math.log10(t)/3),this.unitsLeast.length)-1;return new al(this.unitsLeast[i],Math.pow(1e3,-(i+1)))}return new al}static lookupPrefix(t){return new al(t,ql[t])}}Kl.unitsGreat=["k","M","G","T","P","E","Z","Y"],Kl.unitsLeast=["m","my","n","p","f","a","z","y"];class Ql{adapt(t){return Et.adaptDefaultString(t)}default(){return""}}class Zl{constructor(t,i){this.data=t,this.scenarios=i,this.variances=[],this.title="",this.hideCategories=!1,this.pixelPerUnit=10,this.pixelPerPercentage=50,this.limit=0,this.sortOrder=new Lt(new Ql).default(),this.level=z.CATEGORY,this.filter="",this.measureScale=new al,this.measureUnit="",this.showMeasureScale=!0,this.dataFormatDigits={decimal:1,percent:2},this.stackConfig=null}}class tc{constructor(t,i,s,e,n,r,o){this.dataRowAdapter=t,this.orderAdapter=i,this.stringAdapter=s,this.dataFormatDigitsAdapter=e,this.db=n,this.fromExpr=r,this.onQueryError=o}adapt(t){const i=Et.adaptArray(t.data,this.dataRowAdapter),s=Et.adaptArray(t.scenarios,this.stringAdapter),e=new Zl(i,s);return E.isArray(t.variances)&&(e.variances=Et.adaptArray(t.variances,this.stringAdapter)),E.isString(t.title)&&(e.title=t.title),E.isBoolean(t.hideCategories)&&(e.hideCategories=t.hideCategories),E.isNumber(t.pixelPerUnit)&&(e.pixelPerUnit=t.pixelPerUnit),E.isNumber(t.pixelPerPercentage)&&(e.pixelPerPercentage=t.pixelPerPercentage),E.isNumber(t.limit)&&(e.limit=t.limit),E.isExisting(t.sortOrder)&&(e.sortOrder=this.orderAdapter.adapt(t.sortOrder)),E.isExisting(t.level)&&(e.level=t.level),E.isString(t.filter)&&(e.filter=t.filter.trim()),E.isExisting(t.measureScale)&&(e.measureScale=Kl.calculateMeasureScale(this.db,this.fromExpr,e.scenarios,t.measureScale,this.onQueryError)),E.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),E.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),E.isExisting(t.dataFormatDigits)&&(e.dataFormatDigits=this.dataFormatDigitsAdapter.adapt(t.dataFormatDigits)),E.isExisting(t.stackConfig)&&(e.stackConfig=t.stackConfig),e}default(){return new Zl([],[])}}let ic=class{constructor(t,i,s,e){this.value=t,this.scenario=i,this.pixelPerUnit=s||1,this.variance="neg"===e||e===ac.NEG?ac.NEG:"pos"===e||e===ac.POS?ac.POS:ac.NEU}isEmpty(){return null==this.value||null==this.scenario}getScaledUnit(){return null==this.value?0:this.value*this.pixelPerUnit}getScaledPercentUnit(){return null==this.value?0:Math.abs(this.value)>1.45?this.value>=0?1.45*this.pixelPerUnit:-1.45*this.pixelPerUnit:this.value*this.pixelPerUnit}getVarianceStyle(){return null==this.value||this.value>=0?this.variance:ac.NEU===this.variance?ac.NEU:ac.POS===this.variance?ac.NEG:ac.POS}isClipped(){return null!=this.value&&Math.abs(this.value)>1.45}getClippedValue(){return 145}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}};class sc{constructor(){this.operation="+"}addRowGroup(t,i){this.rowGroup=t,this.rowGroupIndex=i}addCategory(t,i){this.category=t,this.categoryIndex=i}addSubCategory(t,i){this.subCategory=t,this.subCategoryIndex=i}addColumnGroup(t,i){this.columnGroup=t,this.columnGroupIndex=i}addSubColumnGroup(t,i){this.columnSubGroup=t,this.columnSubGroupIndex=i}}class ec{constructor(){}adapt(t){const i=new sc;return E.isOperator(t.operation)&&(i.operation=t.operation),E.isNumber(t.rowGroupIndex)&&E.isString(t.rowGroup)&&i.addRowGroup(t.rowGroup,t.rowGroupIndex),E.isNumber(t.categoryIndex)&&E.isString(t.category)&&i.addCategory(t.category,t.categoryIndex),E.isNumber(t.subCategoryIndex)&&E.isString(t.subCategory)&&i.addSubCategory(t.subCategory,t.subCategoryIndex),E.isNumber(t.columnGroupIndex)&&E.isString(t.columnGroup)&&i.addColumnGroup(t.columnGroup,t.columnGroupIndex),E.isNumber(t.columnSubGroupIndex)&&E.isString(t.columnSubGroup)&&i.addSubColumnGroup(t.columnSubGroup,t.columnSubGroupIndex),this.setActualValues(t,i),this.setPlanValues(t,i),this.setPreviousPeriodValues(t,i),this.setForecastValues(t,i),i}default(){return new sc}setActualValues(t,i){E.isNumber(t.ac1)&&(i.ac1=t.ac1),E.isNumber(t.ac2)&&(i.ac2=t.ac2),E.isNumber(t.ac3)&&(i.ac3=t.ac3),E.isNumber(t.ac4)&&(i.ac4=t.ac4)}setPlanValues(t,i){E.isNumber(t.pl1)&&(i.pl1=t.pl1),E.isNumber(t.pl2)&&(i.pl2=t.pl2),E.isNumber(t.pl3)&&(i.pl3=t.pl3),E.isNumber(t.pl4)&&(i.pl4=t.pl4)}setPreviousPeriodValues(t,i){E.isNumber(t.pp1)&&(i.pp1=t.pp1),E.isNumber(t.pp2)&&(i.pp2=t.pp2),E.isNumber(t.pp3)&&(i.pp3=t.pp3),E.isNumber(t.pp4)&&(i.pp4=t.pp4)}setForecastValues(t,i){E.isNumber(t.fc1)&&(i.fc1=t.fc1),E.isNumber(t.fc2)&&(i.fc2=t.fc2),E.isNumber(t.fc3)&&(i.fc3=t.fc3),E.isNumber(t.fc4)&&(i.fc4=t.fc4)}}class nc{constructor(t,i,s,e,n,r){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=s,this.barStyles=e,this.varianceStyles=n,this.padding=r,this.pattern=new Map,this.stackColors=["#000000","#c0c0c0","#808080"],this.locale="de"}}class rc{constructor(t,i,s,e,n){this.scaleFactorsStructureChartAdapter=t,this.fontStyleAdapter=i,this.svgStyleGroupAdapter=s,this.svgVariancesStyleGroupAdapter=e,this.paddingadapter=n}adapt(t){const i=new nc(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default());return E.isExisting(t)&&(E.isExisting(t.scaleFactors)&&(i.scaleFactors=this.scaleFactorsStructureChartAdapter.adapt(t.scaleFactors)),E.isExisting(t.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(t.fontStyles)),E.isExisting(t.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(t.axisStyles)),E.isExisting(t.barStyles)&&(i.barStyles=this.svgStyleGroupAdapter.adapt(t.barStyles)),E.isExisting(t.varianceStyles)&&(i.varianceStyles=this.svgVariancesStyleGroupAdapter.adapt(t.varianceStyles)),E.isExisting(t.padding)&&(i.padding=this.paddingadapter.adapt(t.padding)),Array.isArray(t.stackColors)&&t.stackColors.length>0&&(i.stackColors=t.stackColors),i.pattern=new Hl(i.fontStyles.size).createPatternMapForStructureBar()),i}default(){return new nc(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default())}}class oc{constructor(){this.scenarioOffset=.3,this.scenarioLabelToBar=.1,this.labelToBar=.3,this.labelToAxis=.3,this.needleWidth=.3,this.needleHeadWidth=.6,this.barWidth=1.2,this.varianceAxisLineWidth=.3,this.axisLineWidth=.1,this.auxiliaryLineWidth=.1,this.scenarioLineWidth=.2,this.markerWidth=.7,this.markerOffset=0,this.categoryWidth=1.9,this.axisTickLength=.3}}class hc{adapt(t){const i=new oc;return E.isNumber(t.scenarioOffset)&&(i.scenarioOffset=t.scenarioOffset),E.isNumber(t.scenarioLabelToBar)&&(i.scenarioLabelToBar=t.scenarioLabelToBar),E.isNumber(t.labelToBar)&&(i.labelToBar=t.labelToBar),E.isNumber(t.labelToAxis)&&(i.labelToAxis=t.labelToAxis),E.isNumber(t.needleWidth)&&(i.needleWidth=t.needleWidth),E.isNumber(t.needleHeadWidth)&&(i.needleHeadWidth=t.needleHeadWidth),E.isNumber(t.barWidth)&&(i.barWidth=t.barWidth),E.isNumber(t.varianceAxisLineWidth)&&(i.varianceAxisLineWidth=t.varianceAxisLineWidth),E.isNumber(t.axisLineWidth)&&(i.axisLineWidth=t.axisLineWidth),E.isNumber(t.auxiliaryLineWidth)&&(i.auxiliaryLineWidth=t.auxiliaryLineWidth),E.isNumber(t.scenarioLineWidth)&&(i.scenarioLineWidth=t.scenarioLineWidth),E.isNumber(t.markerWidth)&&(i.markerWidth=t.markerWidth),E.isNumber(t.markerOffset)&&(i.markerOffset=t.markerOffset),E.isNumber(t.categoryWidth)&&(i.categoryWidth=t.categoryWidth),E.isNumber(t.axisTickLength)&&(i.axisTickLength=t.axisTickLength),i}default(){return new oc}}var ac,lc,cc;!function(t){t.AC1="ac1",t.PP1="pp1",t.FC1="fc1",t.PL1="pl1",t.AC2="ac2",t.PP2="pp2",t.FC2="fc2",t.PL2="pl2",t.AC3="ac3",t.PP3="pp3",t.FC3="fc3",t.PL3="pl3",t.AC4="ac4",t.PP4="pp4",t.FC4="fc4",t.PL4="pl4",t.POS="pos",t.NEG="neg",t.NEU="neu"}(ac||(ac={})),function(t){t.LIST="LIST",t.SUM="SUM",t.OPT="OPT"}(lc||(lc={})),function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right",t[t.Top=3]="Top",t[t.Bottom=4]="Bottom"}(cc||(cc={}));class uc{constructor(t,i,s,e,n,r,o,h){this.group=null,this.segmentFillColor=null,this.maxWidth=null,this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.x=i,this.y=s,this.value=n,null!=t&&(this.group=t.group().id(this.createElementID(t.toString(),e))),this.styles=r,this.isVarianceLabel=!1,this.isRelativeLabel=!1,this.verticalHookLocation=o||cc.Top,this.horizontalHookLocation=h||cc.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}setMaxWidth(t){return this.maxWidth=t,this}updateGroup(t){return this.group=t,this}createElementID(t,i){return t+"_"+i+"_"+this.ID_SCENARIOLABEL}draw(t={percent:2,decimal:1},i=new al){var s;if(this.isEmpty())return this;const e=this.group;let n;const r=this.styles.fontStyles.background||"#ffffff";let o="",h="start";if(!1===Number.isNaN(Number(this.value))){let s=t.percent,e=t.percent,r=1,a="percent";!1===this.isRelativeLabel&&(s=t.decimal,e=t.decimal,r=i.value,a="decimal"),n=hs.number(Number(this.value),a,s,e,r,this.styles.locale),Number(this.value)<0&&(h="end"),this.isVarianceLabel&&Number(this.value)>=0&&(o="+")}else n=""+this.value,h="start";const a=e.text(o+n);a.move(this.x,this.y);const l=a.bbox(),c=l.w,u=l.h;return null!=this.maxWidth&&c>this.maxWidth?(null===(s=this.group)||void 0===s||s.remove(),this.group=null,this):(this.horizontalHookLocation===cc.Right?(h="end",a.move(a.x()-a.length(),a.y())):this.horizontalHookLocation===cc.Center&&(h="middle",a.move(a.x()-a.length()/2,a.y())),this.verticalHookLocation===cc.Center?a.move(a.x(),a.y()-u/2):this.verticalHookLocation===cc.Bottom&&a.move(a.x(),a.y()-u),a.font({anchor:h}),null!=this.segmentFillColor?a.fill(el(this.segmentFillColor)):null==e||e.rect(c,.9*u).stroke(r).fill(r).opacity(.7).move(a.x(),a.y()+.1*u).insertBefore(a),this)}isEmpty(){return null==this.value||""===this.value}setPos(t,i){return this.x=t,this.y=i,this}}let dc=class{constructor(t,i,s,e){this.height=0,this.ID_AXIS="axis",this.ID_AXIS_TITLE="axis-title",this.CSS_AXIS_TITLE="categories",this.scenarioType=t.scenarioType,this.labelText=t.labelText||null,this.position=i,this.style=e,this.label=new uc(s,this.position.getAxisTitlePositionX(),this.position.getAxisTitlePositionY(),this.ID_AXIS_TITLE,this.labelText,this.style,cc.Bottom,cc.Center),this.svgGroup=s.group().id(this.ID_AXIS)}draw(){return this.labelText&&this.label.draw(),this.svgGroup.line(this.position.getAxisPositionX(),this.position.getAxisPositionY(),this.position.getAxisEndPositionX(),this.position.getAxisEndPositionY()).addClass(this.ID_AXIS+"-"+this.convertScenarioType()),this.height=this.svgGroup.height(),this}convertScenarioType(){return void 0===this.scenarioType||null==this.scenarioType?"default":`${this.scenarioType}`.slice(0,2)}};class fc{constructor(t,i,s,e,n,r,o,h=null){if(this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.scenarioLabel=null,this.barGroup=null,this.isVarianceBar=!1,this.overflowConfig=null,this.isOverflowing=!1,this.overdriveWidth=0,this.dimensions={barLength:0,xPos:0,yPos:0,labelXPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=e,this.isPrimaryBar=n,this.position=t,this.barStyles=i.barStyles,this.overflowConfig=h,this.scenarioGroup=r,this.styles=i,null!=r&&(this.barGroup=r.group().id(r.toString()+"_"+this.ID_RECT)),!0!==(null==s?void 0:s.isEmpty())&&null!=s.value){this.hasData=!0;let i=cc.Left;s.value<0&&(i=cc.Right),this.dimensions=this.createDimensions(t,s,e,n),this.label=new uc(this.scenarioGroup,this.dimensions.labelXPos,this.dimensions.yPos,this.ID_DATA_PREFIX,s.value,this.styles,cc.Center,i),this.scenarioLabel=this.getScenarioLabel(o)}}setAsVariance(){var t;return this.isVarianceBar=!0,null===(t=this.label)||void 0===t||t.setToVarianceLabel(),this}isRelativeVariance(){var t;return this.isVarianceBar=!0,null===(t=this.label)||void 0===t||t.setToRelativeVarianceLabel(),this}updateLabelGroup(t){var i;return this.isEmpty()||null==t||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(t={percent:2,decimal:1},i=new al){if(this.isEmpty()||null==this.dataPoint.getScenario())return this;let s=this.barStyles.getSVGStyle(this.dataPoint.getScenario());this.isVarianceBar&&(s=this.styles.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()));const e=this.convertToSVGStyle(s,"stroke");let n=this.convertToSVGStyle(s,"fill");const r=this.barStyles.getSVGStyle(this.dataPoint.getScenario()).fillpattern;if(null!=r){const t=this.styles.pattern.get(r);null!=t&&(n=t.pattern)}null!=this.barGroup&&(this.isOverflowing&&this.overflowConfig?this.drawOverdriveBar(n,e):this.barGroup.rect(this.dimensions.barLength,this.position.getBarWidth()).fill(n).stroke(e).cy(this.dimensions.yPos).x(this.dimensions.xPos)),this.drawBarDataLabel(t,i),this.drawScenarioLabel()}drawOverdriveBar(t,i){if(!this.barGroup||!this.overflowConfig)return;const s=this.position.getBarPositionX(),e=this.position.getBarWidth(),n=this.dimensions.barLength,{breakGap:r}=this.overflowConfig;this.dataPoint.getScaledUnit()<0?(this.barGroup.rect(n,e).fill(t).stroke(i).x(s-n).cy(this.dimensions.yPos),this.barGroup.rect(this.overdriveWidth,e).fill(t).stroke(i).x(s-n-r-this.overdriveWidth).cy(this.dimensions.yPos),this.drawBreakIndicator(s-n-r,r)):(this.barGroup.rect(n,e).fill(t).stroke(i).x(s).cy(this.dimensions.yPos),this.barGroup.rect(this.overdriveWidth,e).fill(t).stroke(i).x(s+n+r).cy(this.dimensions.yPos),this.drawBreakIndicator(s+n,r))}drawBreakIndicator(t,i){if(!this.barGroup)return;const s=this.position.getBarWidth(),e=this.dimensions.yPos-s/2,n=t+i/2,r=.35*i,o=s/3;let h=`M ${n-r} ${e}`;for(let t=0;t<3;t++)h+=` L ${n-r-.3*i} ${e+o*(t+.5)} L ${n-r} ${e+o*(t+1)}`;let a=`M ${n+r} ${e}`;for(let t=0;t<3;t++)a+=` L ${n+r+.3*i} ${e+o*(t+.5)} L ${n+r} ${e+o*(t+1)}`;this.barGroup.rect(i,s+2).fill("#ffffff").stroke("none").x(t).cy(this.dimensions.yPos),this.barGroup.path(h).fill("none").stroke({color:"#000000",width:1}),this.barGroup.path(a).fill("none").stroke({color:"#000000",width:1})}createDimensions(t,i,s,e){const n=i.getScaledUnit(),r=Math.abs(n);if(this.overflowConfig&&r>0){const o="ac"===i.getScenario()?this.overflowConfig.cutWidth:this.overflowConfig.cutWidth-this.overflowConfig.scenarioCutOffset;if(r>o){this.isOverflowing=!0;const{breakGap:i,overdriveZoneWidth:h,maxOverflow:a}=this.overflowConfig;this.overdriveWidth=a>0?(r-o)/a*h:0;const l=o+i+this.overdriveWidth;return n<0?{clipped:!1,barLength:o,xPos:t.getBarPositionX()-o,yPos:t.getBarPositionY(s,e),labelXPos:t.getLabelPositionX(-l),scenarioLabelXPos:t.getBarPositionX()-.5*o,scenarioLabelYPos:t.getBarPositionY(s,e)+t.getScenarioLabelPositionOffsetY(e)}:{clipped:!1,barLength:o,xPos:t.getBarPositionX(),yPos:t.getBarPositionY(s,e),labelXPos:t.getLabelPositionX(l),scenarioLabelXPos:t.getBarPositionX()+.5*o,scenarioLabelYPos:t.getBarPositionY(s,e)+t.getScenarioLabelPositionOffsetY(e)}}}return n<0?{clipped:!1,barLength:r,xPos:t.getBarPositionX()+n,yPos:t.getBarPositionY(s,e),labelXPos:this.position.getLabelPositionX(n),scenarioLabelXPos:this.position.getBarPositionX()-.5*r,scenarioLabelYPos:this.position.getBarPositionY(s,e)+this.position.getScenarioLabelPositionOffsetY(e)}:{clipped:!1,barLength:n,xPos:t.getBarPositionX(),yPos:t.getBarPositionY(s,e),labelXPos:this.position.getLabelPositionX(n),scenarioLabelXPos:this.position.getBarPositionX()+.5*r,scenarioLabelYPos:this.position.getBarPositionY(s,e)+this.position.getScenarioLabelPositionOffsetY(e)}}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}drawScenarioLabel(){null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.isVarianceBar||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw()}drawBarDataLabel(t,i=new al){var s;this.isPrimaryBar&&(null===(s=this.label)||void 0===s||s.draw(t,i))}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}getScenarioLabel(t){return new uc(this.scenarioGroup,-1,-1,this.ID_SCENARIO_PREFIX,t,this.styles,this.isPrimaryBar?cc.Top:cc.Bottom,cc.Center)}}let pc=class{constructor(t,i,s,e,n,r,o,h,a){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.FALLBACK_COLOUR="#000000",this.scenarioLabel=null,this._defaultMarkerPattern=null,this.dimensions={barLength:0,xPos:0,yPos:0,labelXPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.position=t,this.markerGroup=i||null,this.markerPattern=s||this._defaultMarkerPattern,this.styles=n,this.barStyles=n?n.barStyles:null,this.scenario=e,!0!==(null==r?void 0:r.isEmpty())&&(this.hasData=!0,this.dimensions=this.createMarkerDimensions(r,o,a),this.scenarioLabel=this.getScenarioLabel(h,n,a))}createMarkerDimensions(t,i,s){return t.getScaledUnit()<0?{clipped:!1,labelXPos:0,barLength:Math.abs(t.getScaledUnit()),xPos:this.position.getMarkerPositionX()-Math.abs(t.getScaledUnit()),yPos:this.position.getMarkerPositionY(i,s),scenarioLabelXPos:this.position.getMarkerPositionX()-Math.abs(t.getScaledUnit()),scenarioLabelYPos:this.position.getMarkerPositionY(i,s)+this.position.getMarkerScenarioLabelPositionOffsetY(s)}:{clipped:!1,labelXPos:0,barLength:t.getScaledUnit(),xPos:this.position.getMarkerPositionX()+t.getScaledUnit(),yPos:this.position.getMarkerPositionY(i,s),scenarioLabelXPos:this.position.getMarkerPositionX()+t.getScaledUnit(),scenarioLabelYPos:this.position.getMarkerPositionY(i,s)+this.position.getMarkerScenarioLabelPositionOffsetY(s)}}getScenarioLabel(t,i,s){return null==this.markerGroup?null:new uc(this.markerGroup,-1,-1,this.ID_DATA_PREFIX,t,i,s?cc.Bottom:cc.Top,cc.Center)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}draw(){if(this.isEmpty())return this;const t=this.convertToSVGStyle(this.barStyles[this.getScenario()],"stroke");let i=this.convertToSVGStyle(this.barStyles[this.getScenario()],"fill");const s=this.barStyles[this.getScenario()];if(null!=s&&s.fillpattern){const t=this.styles.pattern.get(s.fillpattern);null!=t&&(i=t.pattern)}return this.markerGroup.polygon(this.markerPattern.background).fill("#ffffff").cy(this.dimensions.yPos).cx(this.dimensions.xPos),this.markerGroup.polygon(this.markerPattern.foreground).fill(i).stroke(t).cy(this.dimensions.yPos).cx(this.dimensions.xPos),null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(),this}isEmpty(){return!1===this.hasData}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}},vc=class{constructor(t,i,s,e,n){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.dimensions={barLength:0,xPos:0,yPos:0,labelXPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=e,this.position=t,this.barStyles=i.barStyles,this.scenarioGroup=n,this.styles=i,this.barGroup=n.group().id(n.toString()+"_"+this.ID_RECT);const r=void 0===(null==s?void 0:s.value)&&null!=(null==s?void 0:s.scenario);if(!0!==(null==s?void 0:s.isEmpty())&&null!=s.value||r){this.hasData=!0,this.dimensions=this.createDimensions(t,s,e);let i=cc.Left;s.value<0&&(i=cc.Right),this.label=new uc(this.scenarioGroup,this.dimensions.labelXPos,this.dimensions.yPos,this.ID_DATA_PREFIX,r?Tt:s.value,this.styles,cc.Center,i),this.label.setToRelativeVarianceLabel()}}updateLabelGroup(t){var i;return this.isEmpty()||null==t||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(){var t,i,s;if(void 0===(null===(t=this.dataPoint)||void 0===t?void 0:t.value))return null===(i=this.label)||void 0===i||i.draw(),this;if(this.isEmpty())return this;if(null==this.dimensions)return this;const e=this.styles.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()),n=e.stroke;let r=e.fill;const o=this.barStyles[this.dataPoint.getScenario()];if(null!=o&&o.fillpattern){const t=this.styles.pattern.get(o.fillpattern);null!=t&&null!=t.pattern&&(r=t.pattern)}this.drawNeedleHead(r,n),this.barGroup.rect(this.dimensions.barLength,this.position.getNeedleWidth()).fill(r).stroke(n).cy(this.dimensions.yPos).x(this.dimensions.xPos),null===(s=this.label)||void 0===s||s.draw()}createDimensions(t,i,s){return i.getScaledPercentUnit()<0?{barLength:Math.abs(i.getScaledPercentUnit()),xPos:t.getBarPositionX()+i.getScaledPercentUnit(),yPos:t.getBarCenterPositionY(s),labelXPos:this.position.getLabelPositionX(i.getScaledPercentUnit()-this.position.getNeedleWidth()),clipped:i.isClipped(),scenarioLabelXPos:0,scenarioLabelYPos:0}:{barLength:i.getScaledPercentUnit(),xPos:t.getBarPositionX(),yPos:t.getBarCenterPositionY(s),labelXPos:this.position.getLabelPositionX(i.getScaledPercentUnit()+this.position.getNeedleWidth()),clipped:i.isClipped(),scenarioLabelXPos:0,scenarioLabelYPos:0}}drawNeedleHead(t,i){if(null===this.dimensions)return;const s=this.styles.varianceStyles.needleHeadColour,e=this.styles.varianceStyles.needleHeadColour;if(this.dimensions.clipped){let s="13,0 4,-5 4,5 13,0 8,0 0,-5 0,5 8,0";null!=this.dataPoint.value&&this.dataPoint.value<0&&(s="0,0 9,-5 9,5 0,0 5,0 13,-5 13,5 5,0"),this.barGroup.polygon(s).fill(t).cx(this.getHeadXPosition()).cy(this.dimensions.yPos).fill(t).stroke(i)}else this.barGroup.rect(2*this.position.getNeedleWidth(),2*this.position.getNeedleWidth()).cx(this.getHeadXPosition()).cy(this.dimensions.yPos).fill(s).stroke(e)}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}getHeadXPosition(){let t=this.dimensions.xPos;return null!=this.dataPoint.value&&this.dataPoint.value>0&&(t+=this.dimensions.barLength),t}};class gc{constructor(t,i,s,e,n,r,o,h,a,l,c){this.hasData=!1,this.position=t,this.styles=i,this.dataPoint=s,this.index=e,this.segment=n,this.segmentIndex=o,this.stackMode=h,this.stack=a,this.group=c,this.barGroup=c.group().id(`stacked_bar_${e}_seg_${o}`),!0!==(null==s?void 0:s.isEmpty())&&null!=s.value&&(this.hasData=!0)}draw(t={percent:2,decimal:1},i=new al){if(!this.hasData||!Number.isFinite(this.dataPoint.value))return;const s=this.dataPoint.value,e=this.dataPoint.pixelPerUnit,n=this.position.getBarPositionX(),r=this.position.getBarWidth(),o=Math.abs(this.segment.end-this.segment.start)*e,h=n+Math.min(this.segment.start,this.segment.end)*e,a=this.position.getBarPositionY(this.index,!0),l=this.styles.stackColors,c=l[this.segmentIndex%l.length],u={color:c},d={color:c,width:.5};this.barGroup.rect(Math.max(o,.5),r).fill(u).stroke(d).cy(a).x(h);const f=o-6;if(f>0){const e=h+o/2;if(this.stackMode===q.RELATIVE||this.stackMode===q.ABSOLUTE_RELATIVE){const i=hs.number(this.segment.share,"percent",t.percent,t.percent,1,this.styles.locale);new uc(this.group,e,a,"STACK_SEG",i,this.styles,cc.Center,cc.Center).setSegmentFill(c).setMaxWidth(f).draw()}else new uc(this.group,e,a,"STACK_SEG",s,this.styles,cc.Center,cc.Center).setSegmentFill(c).setMaxWidth(f).draw(t,i)}}drawTotalLabel(t={percent:2,decimal:1},i=new al){if(this.stackMode===q.RELATIVE)return;const s=this.stack.total<0,e=this.position.getLabelPositionX((s?0-this.stack.negative:this.stack.positive)*this.dataPoint.pixelPerUnit),n=this.position.getBarPositionY(this.index,!0);new uc(this.group,e,n,"STACK_TOTAL",this.stack.total,this.styles,cc.Center,s?cc.Right:cc.Left).draw(t,i)}}let mc=class{constructor(t,i,s,e,n){this.overflowConfig=null,this.i18n=n;const r=i.group().id("Scenario1"),o=i.group().id("Scenario2").insertBefore(r);this.svgGroups={parent:i,scenario1:r,scenario2:o,scenario3:i.group().id("Scenario3"),scenario4:i.group().id("Scenario4"),scenario1Label:i.group().id("label")},this.styles=s,this.position=t,this.elementCnt=e}setOverflowConfig(t){this.overflowConfig=t}isLastDataPoint(t){return this.elementCnt-1===t}isFirsttDataPoint(t){return 0===t}createPrimaryBar(t,i){var s,e,n,r;const o=null===(e=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario1)||void 0===e?void 0:e.group().id(""+i),h=null===(r=null===(n=this.svgGroups)||void 0===n?void 0:n.scenario1Label)||void 0===r?void 0:r.group().id(""+i);let a=null;return this.isLastDataPoint(i)&&(a=`${this.i18n.get(t.scenario)||t.scenario}`),new fc(this.position,this.styles,t,i,!0,o,a,this.overflowConfig).updateLabelGroup(h)}createVarianceBar(t,i){var s,e,n,r;const o=null===(e=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario1)||void 0===e?void 0:e.group().id(""+i),h=null===(r=null===(n=this.svgGroups)||void 0===n?void 0:n.scenario1Label)||void 0===r?void 0:r.group().id(""+i);let a=null;return this.isLastDataPoint(i)&&(a=`${this.i18n.get(t.scenario)||t.scenario}`),new fc(this.position,this.styles,t,i,!0,o,a,this.overflowConfig).updateLabelGroup(h).setAsVariance()}createRelativeVarianceBar(t,i){var s,e,n,r;const o=null===(e=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario1)||void 0===e?void 0:e.group().id(""+i),h=null===(r=null===(n=this.svgGroups)||void 0===n?void 0:n.scenario1Label)||void 0===r?void 0:r.group().id(""+i);return new vc(this.position,this.styles,t,i,o).updateLabelGroup(h)}createSecondaryBar(t,i){var s,e;const n=null===(e=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario2)||void 0===e?void 0:e.group().id(""+i);let r=null;return this.isFirsttDataPoint(i)&&(r=`${this.i18n.get(t.scenario)||t.scenario}`),new fc(this.position,this.styles,t,i,!1,n,r,this.overflowConfig)}createPrimaryMarker(t,i){var s,e;const n=null===(e=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario3)||void 0===e?void 0:e.group().id(""+i),r=this.styles.pattern.get("marker-down")||{foreground:"0,0 1,0 1,1 0,1",background:"0,0 1,0 1,1 0,1",bgOffset:0};let o=null;return this.isFirstDataPoint(i)&&(o=`${this.i18n.get(t.scenario)||t.scenario}`),new pc(this.position,n,r,t.scenario,this.styles,t,i,o,!0)}createSecondaryMarker(t,i){var s,e;const n=null===(e=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario4)||void 0===e?void 0:e.group().id(""+i),r=this.styles.pattern.get("marker-up")||{foreground:"0,0 1,0 1,1 0,1",background:"0,0 1,0 1,1 0,1",bgOffset:0};let o=null;return this.isLastDataPoint(i)&&(o=`${this.i18n.get(t.scenario)||t.scenario}`),new pc(this.position,n,r,t.scenario,this.styles,t,i,o,!1)}isFirstDataPoint(t){return 0===t}};const bc=.001;function yc(t){return null!=t.fixedDomain?Math.max(0,t.fixedDomain):t.relativeVariance?0:Math.max(0,t.maxPositive)+Math.abs(Math.min(0,t.minNegative))}function wc(t){var i;if(!t.relativeVariance)return 0;const s=null!==(i=t.sideClamp)&&void 0!==i?i:1.45;return Math.min(s,Math.max(0,t.maxPositive))+Math.min(s,Math.abs(Math.min(0,t.minNegative)))}function xc(t){const i=t.unitExtent+t.pctExtent;if(i<=0)return{};const s=Math.max(bc,(t.target-(t.measured-t.unitExtent*t.currentPpu-t.pctExtent*t.currentPpp))/i);return{ppu:t.unitExtent>0?s:void 0,ppp:t.pctExtent>0?s:void 0}}function Sc(t,i=0){let s=0,e=0,n=0;const r=t.map((t=>{const i=Number.isFinite(t)?t:0;if(n+=i,i<0||Object.is(i,-0)){const t=0-e;return e-=i,{value:i,start:t,end:0-e}}const r=s;return s+=i,{value:i,start:r,end:s}})),o=s+e;let h=1;return i>0&&(h=o>0?i/o:0),{segments:r.map((t=>({start:t.start*h,end:t.end*h,share:o>0?t.value/o:0}))),positive:s*h,negative:e*h,total:n}}function $c(t){const i={positive:0,negative:0,maxTotal:0,minTotal:0};for(const s of t)i.positive=Math.max(i.positive,s.positive),i.negative=Math.max(i.negative,s.negative),i.maxTotal=Math.max(i.maxTotal,s.total),i.minTotal=Math.min(i.minTotal,s.total);return i}function Mc(t,i=()=>0){const s=t[t.length-1],e=null!=s&&s.total<0,n=t.map((t=>(e?t.positive:t.negative)+((e?t.total>=0:t.total<0)?i(t):0)));return{flipped:e,clearance:Math.max(0,...n)}}class _c{constructor(t,i,s,e,n){this.dataModel=[],this.variancesDataModel=[],this.title="",this.configTitle="",this.configVariances=[],this.smallestDataPointValue=new ic(0,ac.AC1,1,ac.NEU),this.highestDataPointValue=new ic(0,ac.AC1,1,ac.NEU),this.smallestVarianceDataPointValue=new ic(0,ac.AC1,1,ac.NEU),this.highestVarianceDataPointValue=new ic(0,ac.AC1,1,ac.NEU),this.pixelPerUnit=1,this.pixelPerPercentage=1,this.hideCategories=!1,this.axisScenario=ac.AC1,this.CSS_CATEGORIES="categories",this.state=Xl.DIRTY,this.titleLength=0,this.leftSideOffsetForHorizontalSync=0,this.limit=0,this.measureScale=new al,this.measureUnit="",this.dataFormatDigits={percent:2,decimal:1},this.stackConfig=null,this.scenarioPropOrder=[],this.overflowConfig=null,this.stackSides=$c([]),this.stackLabelClearance={left:0,right:0},this.fromExpr="",this.rowCount=0,this.db=i,this.tableName=s,this.ruleSet=t||new Ge,this.i18n=this.createI18n(new Map),this.styles=n,this.setConfig(e),this.position=this.createElementPosition()}updatePosition(){this.position=this.createElementPosition()}createElementPosition(){this.titleLength=this.calculateTitleLength(0);let t=this.calculateLeftSideWidth(this.getVarianceType());const i=this.calculateCategoryWidth();return this.titleLength>t&&(t=this.titleLength),new Yl(new Bl(this.styles.padding),this.styles.scaleFactors,this.styles.fontStyles.size,this.dataModel.length,this.leftSideOffsetForHorizontalSync,this.titleLength,t,i,!!this.stackConfig&&0===this.variancesDataModel.length)}setStyles(t){this.styles=t}setRuleSet(t){this.ruleSet=t||new Ge}setConfig(t){var i;this.state=Xl.DIRTY,this.scenarioPropOrder=[...t.scenarios];const s=this.sortScenariosbyVisualisationRules(t.scenarios);this.hideCategories=t.hideCategories||!1,this.limit=t.limit,this.pixelPerUnit=t.pixelPerUnit||1,this.pixelPerPercentage=t.pixelPerPercentage||100,this.setSource(t.filter),this.dataModel=this.populateModel(s,t.level,t.sortOrder),t.stackConfig&&t.stackConfig.by!==X.SCENARIOS&&this.populateDimensionStackSegments(s,t.stackConfig,t.level),this.variancesDataModel=this.populateVarianceModel(t.variances,this.dataModel),this.configTitle=t.title,this.configVariances=null!==(i=null==t?void 0:t.variances)&&void 0!==i?i:[],this.updateTitle(),this.smallestDataPointValue=this.findSmallestDataPointValue(this.dataModel),this.smallestVarianceDataPointValue=this.findSmallestDataPointValue(this.variancesDataModel),this.highestDataPointValue=this.findHighestDataPointValue(this.dataModel),this.highestVarianceDataPointValue=this.findHighestDataPointValue(this.variancesDataModel),this.axisScenario=this.setAxisScenario(t.variances),this.measureScale=t.measureScale,this.measureUnit=t.measureUnit,this.dataFormatDigits=t.dataFormatDigits,this.stackConfig=t.stackConfig,this.measureStacks(),this.updatePosition()}sortScenariosbyVisualisationRules(t){const i=this;return[...t].sort(((t,s)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(s))).reverse()}setI18n(t){this.i18n=this.createI18n(t),this.updateTitle()}updateTitle(){var t;this.title=this.configTitle||hs.translateScenarioLabel(null===(t=this.configVariances)||void 0===t?void 0:t.toString(),this.i18n)}createI18n(t){this.state=Xl.DIRTY;const i=new Map([["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"]]);return new Map([...i,...t])}setSource(t){var i,s;if(this.state=Xl.DIRTY,this.queryError=void 0,this.fromExpr=_(this.db,this.tableName,t),this.fromExpr)try{const t=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(s=null===(i=t[0])||void 0===i?void 0:i.cnt)&&void 0!==s?s:0}catch(t){this.rowCount=0,this.failQuery(t)}else this.rowCount=0}getQueryError(){return this.queryError}failQuery(t){var i;null!==(i=this.queryError)&&void 0!==i||(this.queryError=ei(t))}getUnitBarExtent(){var t,i;const s=this.isStacked(),e=this.getVarianceType(),n=e!==Jl.NONE,r=n?this.highestVarianceDataPointValue:this.highestDataPointValue,o=n?this.smallestVarianceDataPointValue:this.smallestDataPointValue;return yc({fixedDomain:s?this.stackSides.positive+this.stackSides.negative:void 0,relativeVariance:e===Jl.RELATIVE,maxPositive:null!==(t=null==r?void 0:r.value)&&void 0!==t?t:0,minNegative:null!==(i=null==o?void 0:o.value)&&void 0!==i?i:0})}getPercentBarExtent(){var t,i,s,e;return wc({relativeVariance:this.getVarianceType()===Jl.RELATIVE,maxPositive:null!==(i=null===(t=this.highestVarianceDataPointValue)||void 0===t?void 0:t.value)&&void 0!==i?i:0,minNegative:null!==(e=null===(s=this.smallestVarianceDataPointValue)||void 0===s?void 0:s.value)&&void 0!==e?e:0})}getAllocatedCanvasWidth(){const t=this.position.getAxisPositionX(),i=this.calculateRightSideWidth(this.getVarianceType());let s=t+i+ +this.styles.padding.left+this.styles.padding.right;return i<this.titleLength/2&&(s+=this.titleLength/2),t<this.titleLength/2&&(s+=this.titleLength/2),s}getAllocatedCanvasHeight(){return this.position.getAxisEndPositionY()+this.position.spacings.labelToAxis+this.position.fontSize+this.styles.padding.bottom}patternToString(){return"<svg></svg>"}layout(){this.draw(new ba)}toString(){const t=new ba;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.svg()}applyFontToContainer(t){t.attr({"font-size":this.styles.fontStyles.size,"font-family":this.styles.fontStyles.family})}draw(t){this.cleanSVGforRedraw(t),this.applyFontToContainer(t),this.state===Xl.DIRTY&&(this.state=Xl.UP_TO_DATE),this.variancesDataModel&&this.variancesDataModel.length>0?(this.drawVarianceScenario(this.variancesDataModel,t),this.drawAxisAndLabels(this.variancesDataModel,t)):null!=this.stackConfig?(this.drawStackedScenarios(this.dataModel,t),this.drawStackedHeaders(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t,!0)):(this.drawScenarios(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t))}setPattern(t,i){this.styles.pattern.set(t,i)}calculateTitleLength(t){const i=os(this.title.length>7?this.title:"_______",{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width;return i<t?t:i/2}getFooter(){return 1===this.measureScale.value&&""===this.measureUnit?" ":hs.translateScenarioLabel("in",this.i18n)+" "+this.measureScale.prefix+this.measureUnit}setAxisScenario(t){let i=ac.AC1;if(null!=t&&t.length>0){const s=new ts(t.toString());s.isValid&&(i=s.delta)}return null===i&&(i=ac.AC1),i}populateModel(t,i,s){if(0===this.rowCount||!this.fromExpr)return[];const e=[],n=this.createOrderStr(i,s),r=this.createSelectString(i,s),o=this.createGroupByStr(i,s);let h;try{h=this.db.exec(`SELECT ${r} ${t.length>0?","+t.map((t=>`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`)).join(","):""}\n FROM ${this.fromExpr}\n GROUP BY ${o}\n ORDER BY ${n}`)}catch(t){return this.failQuery(t),[]}return this.detectNaNCells(t,h),this.createDataRows(this.limit>0?h.slice(0,this.limit):h,e,t),this.crateRESTRow(h,t,e),e}detectNaNCells(t,i){i.forEach((i=>(t.forEach((t=>{const s=new ts(t);!0===s.isValid?0!==i[s.base+"_cnt"]&&0!==i[s.delta+"_cnt"]||(i[t]=Number.NaN):0===i[t+"_cnt"]&&(i[t]=Number.NaN)})),i)))}crateRESTRow(t,i,s){if(this.limit<=0||this.limit>=t.length)return;const e=[];this.createDataRows(t.slice(this.limit),e,i);const n=(t,i)=>Number.isFinite(i)?(Number.isFinite(t)?t:0)+i:t,r=e.reduce((function(t,s){return{id:t.id,category:t.category,type:t.type,scenario1:new ic(n(t.scenario1.value,s.scenario1.value),i[0],t.scenario1.pixelPerUnit,ac.NEU),scenario2:new ic(n(t.scenario2.value,s.scenario2.value),i[1],t.scenario2.pixelPerUnit,ac.NEU),scenario3:new ic(n(t.scenario3.value,s.scenario3.value),i[2],t.scenario3.pixelPerUnit,ac.NEU),scenario4:new ic(n(t.scenario4.value,s.scenario4.value),i[3],t.scenario4.pixelPerUnit,ac.NEU)}}),{id:9999,category:"REST",type:Jl.NONE,scenario1:new ic(NaN,i[0],this.pixelPerUnit,ac.NEU),scenario2:new ic(NaN,i[1],this.pixelPerUnit,ac.NEU),scenario3:new ic(NaN,i[2],this.pixelPerUnit,ac.NEU),scenario4:new ic(NaN,i[3],this.pixelPerUnit,ac.NEU)});s.push(r)}createDataRows(t,i,s){t.forEach(((t,e)=>{i.push({id:e,category:t.category,type:Jl.NONE,scenario1:new ic(t[s[0]],s[0],this.pixelPerUnit,ac.NEU),scenario2:new ic(t[s[1]],s[1],this.pixelPerUnit,ac.NEU),scenario3:new ic(t[s[2]],s[2],this.pixelPerUnit,ac.NEU),scenario4:new ic(t[s[3]],s[3],this.pixelPerUnit,ac.NEU)})}))}createOrderStr(t,i){let s=`${t.toLowerCase()}`;return i.hierarchy.length>=1&&(s=i.hierarchy.map((t=>`${t} ${i.direction}`)).toString()),s}createSelectString(t,i){return t===z.CATEGORY&&i.hierarchy.includes(G.CATEGORYINDEX)?`${G.CATEGORYINDEX}, ${z.CATEGORY} as category`:t===z.ROWGROUP&&i.hierarchy.includes(G.ROWGROUPINDEX)?`${G.ROWGROUPINDEX}, ${z.ROWGROUP} as category`:t===z.SUBCATEGORY&&i.hierarchy.includes(G.SUBCATEGORYINDEX)?`${G.SUBCATEGORYINDEX}, ${z.SUBCATEGORY} as category`:`${t.toString()} as category`}createGroupByStr(t,i){return t===z.CATEGORY&&i.hierarchy.includes(G.CATEGORYINDEX)?`${G.CATEGORYINDEX}, ${z.CATEGORY}`:t===z.ROWGROUP&&i.hierarchy.includes(G.ROWGROUPINDEX)?`${G.ROWGROUPINDEX}, ${z.ROWGROUP}`:t===z.SUBCATEGORY&&i.hierarchy.includes(G.SUBCATEGORYINDEX)?`${G.SUBCATEGORYINDEX}, ${z.SUBCATEGORY}`:`${t.toString()}`}calculateCategoryWidth(){if(this.hideCategories)return 5;let t=0;for(const i of this.dataModel){const s=os(i.category,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"});s.width>t&&(t=s.width)}return 1.1125*t}findSmallestDataPointValue(t){let i=new ic(0,"default",this.pixelPerUnit,null);for(const s of t)for(const t of[s.scenario1,s.scenario2,s.scenario3,s.scenario4])null!=t&&null!=i.value&&t.value<i.value&&(i=t);return i}findHighestDataPointValue(t){let i=new ic(0,"default",this.pixelPerUnit,null);for(const s of t)for(const t of[s.scenario1,s.scenario2,s.scenario3,s.scenario4])null!=t&&null!=i.value&&t.value>i.value&&(i=t);return i}stackGroups(t){if(!this.stackConfig)return[];const i=this.stackConfig.by===X.SCENARIOS;let s=[];for(const e of i?["scenario1","scenario2","scenario3","scenario4"]:["scenario1"]){const i=t[e];i&&!i.isEmpty()&&null!=i.value&&s.push({value:i.value,scenario:i.scenario,dataPoint:i})}if(0===s.length)return[];const e=this.stackConfig.mode===q.RELATIVE?1:0,n=(t,i)=>({prefix:t,segments:i,layout:Sc(i.map((t=>t.value)),e),hasValue:i.some((t=>Number.isFinite(t.value)))});if(i){this.sortSegmentsByPropOrder(s);const t=new Map;for(const i of s){const s=sl(i.scenario);t.has(s)||t.set(s,[]),t.get(s).push(i)}if(t.size>1){const i=[];for(const s of il)t.has(s)&&(i.push(n(s,t.get(s))),t.delete(s));for(const[s,e]of t)i.push(n(s,e));return i}}else t.stackSegments&&t.stackSegments.length>0&&(s=t.stackSegments.map((t=>({value:t.value,scenario:t.label,dataPoint:t.dataPoint}))));const r=t=>Number.isFinite(t.value)?t.value:0;return"asc"===this.stackConfig.order?s.sort(((t,i)=>r(t)-r(i))):"desc"===this.stackConfig.order&&s.sort(((t,i)=>r(i)-r(t))),[n("",s)]}measureStacks(){const t=[];this.stackLabelClearance={left:0,right:0};for(const i of this.dataModel){const{flipped:s,clearance:e}=this.stackLabelPlace(i),n=this.drawnStackLayouts(i),r=s?"right":"left";this.stackLabelClearance[r]=Math.max(this.stackLabelClearance[r],e),t.push(...n)}this.stackSides=$c(t)}stackLabelPlace(t){const i=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;return Mc(this.drawnStackLayouts(t),(t=>{var s;return(null===(s=this.stackConfig)||void 0===s?void 0:s.mode)===q.RELATIVE?0:(i+this.calculateTotalLabelWidth(t.total))/this.pixelPerUnit}))}drawnStackLayouts(t){return this.stackGroups(t).filter((t=>t.hasValue)).map((t=>t.layout))}calculateTotalLabelWidth(t){const i=this.dataFormatDigits.decimal;return os(hs.number(t,"decimal",i,i,this.measureScale.value,this.styles.locale),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width}isStacked(){return null!=this.stackConfig&&this.stackSides.positive+this.stackSides.negative>0}populateVarianceModel(t,i){const s=[];if(0===t.length)return s;let e=null;null!=i&&i.length>0&&(e=i[0]);for(const n in t){const r=new ts(t[n]);if(r.isValid){const t=this.mapScenarios(r,e),n=r.direction;let o=this.pixelPerUnit;"dr"===r.type&&(o=this.pixelPerPercentage);for(const e in i)s.push({id:Number(e),category:i[e].category,type:"dr"===r.type?Jl.RELATIVE:Jl.ABSOLUTE,scenario1:new ic(this.calculateVariance(r,i[e],t),r.base,o,n),scenario2:new ic(null,null,null,null),scenario3:new ic(null,null,null,null),scenario4:new ic(null,null,null,null)})}}return s}calculateVariance(t,i,s){const e=s.get(t.base),n=s.get(t.delta);return null==e||null==n?null:t.type===Jl.RELATIVE?At(i[e].value-i[n].value,i[n].value):i[e].value-i[n].value}mapScenarios(t,i){const s=new Map;return null==i||["scenario1","scenario2","scenario3","scenario4"].forEach((e=>{i[e].scenario===t.delta?s.set(t.delta,e):i[e].scenario===t.base&&s.set(t.base,e)})),s}calculateTextBoxWidth(t){return os(hs.number(t,"decimal",1,0,1,this.styles.locale),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width}calculatePercentageTextBoxWidth(t){let i=0;return t>=0&&(i+=os("+",{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width),i+=os(" %",{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width,os(hs.number(t,"decimal",1,1,1,this.styles.locale),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width+i+i}cleanSVGforRedraw(t){t.clear()}drawAxisAndLabels(t,i,s=!1){const e=i.group().id("AxisAndDateLables");let n=!1;this.hideCategories||t.forEach(((t,i)=>{t.type===Jl.RELATIVE&&(n=!0);let r=cc.Right,o=!0,h=0;if(s){const i=this.stackLabelPlace(t);o=!i.flipped,h=i.clearance*this.pixelPerUnit*(i.flipped?1:-1)}else t.scenario1.value<0&&(o=!1);o||(r=cc.Left),new uc(e,this.position.getCategoryPositionX(o)+h,this.position.getBarCenterPositionY(i),"",this.i18n.get(t.category)||t.category,this.styles,cc.Center,r).draw()})),new dc({scenarioType:this.axisScenario,labelText:this.title,isRelative:n},this.position,e,this.styles).draw()}drawScenarios(t,i){const s=i.group().id("Scenarios"),e=new mc(this.position,s,this.styles,t.length,this.i18n);e.setOverflowConfig(this.overflowConfig),t.forEach(((t,i)=>{e.createPrimaryBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale),e.createSecondaryBar(t.scenario2,i).draw(),e.createPrimaryMarker(t.scenario3,i).draw(),e.createSecondaryMarker(t.scenario4,i).draw()}))}drawVarianceScenario(t,i){const s=i.group().id("Scenarios"),e=new mc(this.position,s,this.styles,t.length,this.i18n);return e.setOverflowConfig(this.overflowConfig),t.forEach(((t,i)=>{t.type===Jl.RELATIVE?e.createRelativeVarianceBar(t.scenario1,i).draw():e.createVarianceBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale)})),s}sortSegmentsByPropOrder(t){if(0===this.scenarioPropOrder.length)return;const i=this.scenarioPropOrder;t.sort(((t,s)=>{const e=i.indexOf(t.scenario),n=i.indexOf(s.scenario);return(-1===e?i.length:e)-(-1===n?i.length:n)}))}drawStackedScenarios(t,i){if(!this.stackConfig)return;const s=i.group().id("StackedScenarios"),e=this.stackConfig.by===X.SCENARIOS;t.forEach(((t,i)=>{const n=this.stackGroups(t);n.forEach(((t,r)=>{let o=null;t.segments.forEach(((h,a)=>{const l=new gc(this.position,this.styles,h.dataPoint,i,t.layout.segments[a],h.scenario,n.length>1?n.length-1-r:a,this.stackConfig.mode,t.layout,e,s);l.draw(this.dataFormatDigits,this.measureScale),o=l})),o&&t.hasValue&&o.drawTotalLabel(this.dataFormatDigits,this.measureScale)}))}))}drawStackedHeaders(t,i){if(!this.stackConfig||0===t.length)return;const s=t[0];if(this.stackConfig.by!==X.SCENARIOS&&(!s.stackSegments||0===s.stackSegments.length))return;const e=this.stackGroups(s);if(0===e.length)return;const n=i.group().id("StackedHeaders"),r=this.position.getBarPositionX(),o=this.position.getStackedHeaderPositionY(),h=(t,i)=>{new uc(n,t,o,"STACK_HEADER",i,this.styles,cc.Bottom,cc.Center).draw()};if(e.length>1)return void e.forEach((t=>{h(r+(t.layout.positive-t.layout.negative)/2*t.segments[0].dataPoint.pixelPerUnit,this.i18n.get(t.prefix+"1")||t.prefix.toUpperCase())}));const[a]=e;a.segments.forEach(((t,i)=>{const{start:s,end:e}=a.layout.segments[i];h(r+(s+e)/2*t.dataPoint.pixelPerUnit,this.i18n.get(t.scenario)||t.scenario)}))}getVarianceType(){return this.variancesDataModel.length>0?this.variancesDataModel[0].type:Jl.NONE}calculateLeftSideWidth(t){var i,s,e;let n=0;const r=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;if(Jl.NONE===t&&this.isStacked())this.stackSides.negative>0&&(n=this.stackSides.negative*this.pixelPerUnit,this.stackSides.minTotal<0&&(n+=r+this.calculateTotalLabelWidth(this.stackSides.minTotal))),this.stackLabelClearance.left>0&&(n=Math.max(n,this.stackLabelClearance.left*this.pixelPerUnit+this.calculateCategoryWidth()));else if(Jl.NONE===t&&null!=(null===(i=this.smallestDataPointValue)||void 0===i?void 0:i.value)&&this.smallestDataPointValue.value<0){const t=this.calculateTextBoxWidth(this.smallestDataPointValue.value);n=Math.abs(this.smallestDataPointValue.getScaledUnit())+r+t}else if(Jl.RELATIVE===t&&null!=(null===(s=this.smallestVarianceDataPointValue)||void 0===s?void 0:s.value)&&this.smallestVarianceDataPointValue.value<0){const t=this.calculatePercentageTextBoxWidth(this.smallestVarianceDataPointValue.value);n=Math.abs(this.smallestVarianceDataPointValue.getScaledPercentUnit())+r+t}else if(Jl.ABSOLUTE===t&&null!=(null===(e=this.smallestVarianceDataPointValue)||void 0===e?void 0:e.value)&&this.smallestVarianceDataPointValue.value<0){const t=this.calculateTextBoxWidth(this.smallestVarianceDataPointValue.value);n=Math.abs(this.smallestVarianceDataPointValue.getScaledUnit())+r+t}return n<=this.titleLength?this.titleLength:n}calculateRightSideWidth(t){var i,s,e;if(this.isStacked()){const t=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar,i=this.calculateTextBoxWidth(this.stackSides.maxTotal);let s=this.stackSides.positive*this.pixelPerUnit+t+i;return this.stackSides.minTotal<0&&(s=Math.max(s,this.stackLabelClearance.right*this.pixelPerUnit+this.position.getCategoryToAxisSpaceing()+this.calculateCategoryWidth())),Math.max(s,this.titleLength)}let n=0;const r=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;if(Jl.NONE===t&&null!=(null===(i=this.highestDataPointValue)||void 0===i?void 0:i.value)&&this.highestDataPointValue.value>=0){const t=this.calculateTextBoxWidth(this.highestDataPointValue.value);n=Math.abs(this.highestDataPointValue.getScaledUnit())+r+t}else if(Jl.RELATIVE===t&&null!=(null===(s=this.highestVarianceDataPointValue)||void 0===s?void 0:s.value)&&this.highestVarianceDataPointValue.value>=0){const t=this.calculatePercentageTextBoxWidth(this.highestVarianceDataPointValue.value);n=Math.abs(this.highestVarianceDataPointValue.getScaledPercentUnit())+r+t}else if(Jl.ABSOLUTE===t&&null!=(null===(e=this.highestVarianceDataPointValue)||void 0===e?void 0:e.value)&&this.highestVarianceDataPointValue.value>=0){const t=this.calculateTextBoxWidth(this.highestVarianceDataPointValue.value);n=Math.abs(this.highestVarianceDataPointValue.getScaledUnit())+r+t}return n<=this.titleLength?this.titleLength:n}populateDimensionStackSegments(t,i,s){if(0===this.rowCount||!this.fromExpr||0===t.length)return;const e={[z.ROWGROUP]:"category",[z.ROWGROUPINDEX]:"category",[z.CATEGORY]:"subCategory",[z.CATEGORYINDEX]:"subCategory"}[s];if(!e)return;const n=s.toString(),r=t[0];let o;try{o=this.db.exec(`SELECT [${n}] as displayGroup, [${e}] as stackLabel, SUM([${r}] * transformOperator(operation)) as stackValue FROM ${this.fromExpr} GROUP BY [${n}], [${e}]`)}catch(t){return void this.failQuery(t)}const h=new Map;for(const t of o){const i=t.displayGroup;h.has(i)||h.set(i,[]),null!=t.stackValue&&null!=t.stackLabel&&h.get(i).push({label:t.stackLabel,value:t.stackValue})}for(const t of this.dataModel){const i=h.get(t.category);t.stackSegments=i&&i.length>0?i.map((t=>({label:t.label,value:t.value,dataPoint:new ic(t.value,r,this.pixelPerUnit,ac.NEU)}))):[]}}hasNoData(){return 0===this.dataModel.length}setAvailableWidth(t){if(this.pixelPerUnit<=0||t<=0)this.overflowConfig=null;else if(null==this.stackConfig){if(this.overflowConfig=this.calculateOverflowConfig(t),this.overflowConfig){const{cutWidth:t,overdriveZoneWidth:i,breakGap:s}=this.overflowConfig,e=t+i+s;this.variancesDataModel&&this.variancesDataModel.length>0?(this.highestVarianceDataPointValue.getScaledUnit()>t&&(this.highestVarianceDataPointValue=new ic(e,this.highestVarianceDataPointValue.scenario,1,this.highestVarianceDataPointValue.variance)),null!=this.smallestVarianceDataPointValue.value&&Math.abs(this.smallestVarianceDataPointValue.getScaledUnit())>t&&(this.smallestVarianceDataPointValue=new ic(-e,this.smallestVarianceDataPointValue.scenario,1,this.smallestVarianceDataPointValue.variance))):(this.highestDataPointValue.getScaledUnit()>t&&(this.highestDataPointValue=new ic(e,this.highestDataPointValue.scenario,1,this.highestDataPointValue.variance)),null!=this.smallestDataPointValue.value&&Math.abs(this.smallestDataPointValue.getScaledUnit())>t&&(this.smallestDataPointValue=new ic(-e,this.smallestDataPointValue.scenario,1,this.smallestDataPointValue.variance))),this.updatePosition()}}else this.overflowConfig=null}calculateOverflowConfig(t){const i=this.variancesDataModel&&this.variancesDataModel.length>0;if(this.getVarianceType()===Jl.RELATIVE)return null;const s=i?this.highestVarianceDataPointValue:this.highestDataPointValue,e=i?this.smallestVarianceDataPointValue:this.smallestDataPointValue,n=s.getScaledUnit(),r=null!=e.value?Math.abs(e.getScaledUnit()):0,o=Math.max(n,r);if(o<=0)return null;const h=this.styles.fontStyles.size,a=h*this.styles.scaleFactors.labelToBar,l=1.5*h,c=.3*h,u=.8*h,d=t-this.position.getAxisPositionX()-this.styles.padding.left-this.styles.padding.right-a-this.calculateTextBoxWidth(s.value||0)-l-c;if(d<=u)return null;const f=d-u;return o<=f?null:{cutWidth:d,overdriveZoneWidth:l,breakGap:c,maxOverflow:o-f,scenarioCutOffset:u}}}class Rc{constructor(t=2,i=1){this.percent=t,this.decimal=i}}class Oc{adapt(t){const i=new Rc;return E.isNumber(t.percent)&&(i.percent=t.percent),E.isNumber(t.decimal)&&(i.decimal=t.decimal),i}default(){return new Rc}}const kc=class{constructor(i){t(this,i),this.tableName="",this.dataVersion=0,this.chartTitle="",this.scenarios=[],this.variances=[],this.hideCategories=!1,this.pixelPerUnit=10,this.pixelPerPercentage=50,this.limit=0,this.i18n=new Map,this.order={hierarchy:[],direction:F.ASC},this.level=z.CATEGORY,this.filter="",this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.dataFormatDigits={percent:2,decimal:1},this.stackConfig=null,this.parentDimensions={width:0,height:0},a(this)}getDb(){return this.stores||(this.stores=u(this.element)),this.stores.db.db}render(){var t,e,n,r;if(void 0===this.chart||void 0!==this.queryError)return i(s,null);if(this.chart.hasNoData()){const e=null!==(t=this.i18n.get("no-data"))&&void 0!==t?t:"No Data";return i(s,{class:"no-data"},i("div",{class:"empty-state"},e))}return i(s,null,i("div",{innerHTML:null===(e=this.pattern)||void 0===e?void 0:e.toString(),class:"hidePatternContainer"}),i("div",{class:this.showMeasureScale?"footer":"footer-hide"},null===(n=this.chart)||void 0===n?void 0:n.getFooter()),i("div",{innerHTML:null===(r=this.chart)||void 0===r?void 0:r.toString()}))}syncQueryError(){var t,i;this.queryError=null!==(t=this.measureScaleError)&&void 0!==t?t:null===(i=this.chart)||void 0===i?void 0:i.getQueryError(),ni(this.errors,this.queryError)}async componentWillLoad(){var t;const i=this.getDb(),s=this.prepareConfig(),e=this.prepareStyle();this.chart=new _c(new Ge(this.ruleSetConfig),i,this.tableName,s,e),this.chart.setI18n(this.i18n);const n=s.pixelPerUnit<=0;this.autoFitScaling(s,e),this.chart.setAvailableWidth(n?0:(null===(t=this.parentDimensions)||void 0===t?void 0:t.width)||0),this.pattern=new Vl(this.chart.styles),this.chart.setPattern("hatched",this.pattern.getFCPolygonPattern()),this.syncQueryError()}async componentWillUpdate(){var t;if(null==this.chart)return;const i=this.prepareConfig(),s=this.prepareStyle();this.chart.setI18n(this.i18n),this.chart.setStyles(s),this.chart.setRuleSet(new Ge(this.ruleSetConfig)),this.chart.setConfig(i);const e=i.pixelPerUnit<=0;this.autoFitScaling(i,s),this.chart.setAvailableWidth(e?0:(null===(t=this.parentDimensions)||void 0===t?void 0:t.width)||0),this.pattern=new Vl(this.chart.styles),this.chart.setPattern("hatched",this.pattern.getFCPolygonPattern()),this.syncQueryError()}autoFitScaling(t,i){var s;const e=t.pixelPerUnit<=0,n=t.pixelPerPercentage<=0;if(!e&&!n)return;const r=()=>{var i;null===(i=this.reportAutoScaling)||void 0===i||i.call(this,{unit:e?t.pixelPerUnit:void 0,percentage:n?t.pixelPerPercentage:void 0})},o=null===(s=this.parentDimensions)||void 0===s?void 0:s.width,h=this.getDb(),a=()=>{this.chart=new _c(new Ge(this.ruleSetConfig),h,this.tableName,t,i),this.chart.setI18n(this.i18n)},l=()=>(this.chart.layout(),this.chart.getAllocatedCanvasWidth());if(!o||o<=0)return e&&(t.pixelPerUnit=1),n&&(t.pixelPerPercentage=50),a(),void r();e&&(t.pixelPerUnit=1),n&&(t.pixelPerPercentage=1),a();let c=l();if(c<=0)return void r();const u=Math.max(bc,.9*o/c);let d=!1,f=!1,p=null;for(let i=0;i<=3;i++){const i=xc({target:o,measured:c,unitExtent:e?this.chart.getUnitBarExtent():0,pctExtent:n?this.chart.getPercentBarExtent():0,currentPpu:t.pixelPerUnit,currentPpp:t.pixelPerPercentage});if(void 0===i.ppu&&void 0===i.ppp)break;if(e&&void 0!==i.ppu&&(t.pixelPerUnit=i.ppu,d=!0),n&&void 0!==i.ppp&&(t.pixelPerPercentage=i.ppp,f=!0),a(),c=l(),c<=o+.5&&(p={ppu:t.pixelPerUnit,ppp:t.pixelPerPercentage},c>=.98*o))break}let v=!1;if(e&&!d&&(t.pixelPerUnit=u,v=!0),n&&!f&&(t.pixelPerPercentage=u,v=!0),c>o+.5){if(p)d&&(t.pixelPerUnit=p.ppu),f&&(t.pixelPerPercentage=p.ppp);else{const i=o/c;e&&(t.pixelPerUnit=Math.max(bc,t.pixelPerUnit*i)),n&&(t.pixelPerPercentage=Math.max(bc,t.pixelPerPercentage*i))}v=!0}v&&a(),r()}async componentWillRender(){}componentDidLoad(){}componentDidUpdate(){}prepareConfig(){const t=this.getDb(),i=_(t,this.tableName,this.filter);return this.measureScaleError=void 0,new tc(new ec,new Lt(new Ql),new Ql,new Oc,t,i,(t=>{this.measureScaleError=ei(t)})).adapt({scenarios:this.scenarios,variances:this.variances,title:this.chartTitle,hideCategories:this.hideCategories,pixelPerUnit:this.pixelPerUnit,pixelPerPercentage:this.pixelPerPercentage,level:this.level,limit:this.limit,sortOrder:this.order,filter:this.filter,measureScale:this.measureScale,measureUnit:this.measureUnit,showMeasureScale:this.showMeasureScale,dataFormatDigits:this.dataFormatDigits,stackConfig:this.stackConfig})}prepareStyle(){var t,i;const s=new rc(new hc,new Ie,new qe(new Xe),new Al(new Xe),new Be).adapt(this.styles);return s.locale=(null===(i=null===(t=u(this.element).context)||void 0===t?void 0:t.state)||void 0===i?void 0:i.locale)||"de",s}get element(){return e(this)}};kc.style=':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}svg#drawCanvas{display:block}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}';class Ec{constructor(){this.scenarioOffset=.3,this.scenarioLabelToColumn=.3,this.labelToColumn=.3,this.labelToAxis=.3,this.needleWidth=.3,this.needleHeadWidth=.6,this.columnWidth=2,this.varianceAxisLineWidth=.3,this.axisLineWidth=.1,this.auxiliaryLineWidth=.1,this.scenarioLineWidth=.2,this.markerWidth=.7,this.markerOffset=0,this.categoryWidth=3,this.axisTickLength=.3}}class Lc{adapt(t){const i=new Ec;return E.isNumber(t.scenarioOffset)&&(i.scenarioOffset=t.scenarioOffset),E.isNumber(t.scenarioLabelToColumn)&&(i.scenarioLabelToColumn=t.scenarioLabelToColumn),E.isNumber(t.labelToColumn)&&(i.labelToColumn=t.labelToColumn),E.isNumber(t.labelToAxis)&&(i.labelToAxis=t.labelToAxis),E.isNumber(t.needleWidth)&&(i.needleWidth=t.needleWidth),E.isNumber(t.needleHeadWidth)&&(i.needleHeadWidth=t.needleHeadWidth),E.isNumber(t.columnWidth)&&(i.columnWidth=t.columnWidth),E.isNumber(t.varianceAxisLineWidth)&&(i.varianceAxisLineWidth=t.varianceAxisLineWidth),E.isNumber(t.axisLineWidth)&&(i.axisLineWidth=t.axisLineWidth),E.isNumber(t.auxiliaryLineWidth)&&(i.auxiliaryLineWidth=t.auxiliaryLineWidth),E.isNumber(t.scenarioLineWidth)&&(i.scenarioLineWidth=t.scenarioLineWidth),E.isNumber(t.markerWidth)&&(i.markerWidth=t.markerWidth),E.isNumber(t.markerOffset)&&(i.markerOffset=t.markerOffset),E.isNumber(t.categoryWidth)&&(i.categoryWidth=t.categoryWidth),E.isNumber(t.axisTickLength)&&(i.axisTickLength=t.axisTickLength),i}default(){return new Ec}}class Tc{constructor(t,i,s,e,n,r,o){this.categoryPosition={x:0,y:0},this.spacings=new Ec,this.categoriesBoxOffset={width:0,height:0},this.padding=t,this.scaleFactors=i,this.fontStlye=s,this.dataLabelHeight=this.caluculateDataLabelHeight(),this.axisPosition={x:0,y:0},this.columnValue={min:e,max:n},this.numberOfColumns=r,this.leftSideLabelLength=o,this.calculateSpacings(),this.calculateCategoryPosition(),this.calculateAxisPosition()}caluculateDataLabelHeight(){return 1.1*os("123456789",{font:this.fontStlye.font,fontSize:this.fontStlye.size+"px"}).height}getColumnCenterPositionX(t){return this.categoryPosition.y+this.spacings.scenarioOffset+t*this.spacings.categoryWidth+this.leftSideLabelLength+.5*this.spacings.columnWidth}getAxisPositionY(t){let i=this.columnValue.max.getScaledUnit();return t&&(i=this.columnValue.max.getScaledPercentUnit()+this.getNeedleWidth()),i+this.dataLabelHeight+this.spacings.labelToAxis+this.padding.top}getAxisPositionX(){return this.padding.left+this.leftSideLabelLength}getColumnPositionX(t,i){return i?this.getColumnCenterPositionX(t):this.getColumnCenterPositionX(t)-this.spacings.scenarioOffset}getColumnPositionY(){return this.columnValue.max.getScaledUnit()+this.dataLabelHeight+this.spacings.labelToColumn+this.padding.top}getNeedlePositionY(){return this.columnValue.max.getScaledPercentUnit()+this.dataLabelHeight+this.spacings.labelToColumn+this.getNeedleWidth()+this.padding.top}getMarkerPositionX(t,i){return i?this.getColumnCenterPositionX(t)-this.spacings.markerOffset-.5*this.getColumnWidth():this.getColumnCenterPositionX(t)+this.spacings.markerOffset+.5*this.getColumnWidth()}getMarkerPositionY(){return this.getColumnPositionY()}getAxisTitlePositionX(t){const i=t.width();return this.axisPosition.x-i}getAxisTitlePositionY(t,i){let s=this.columnValue.max.getScaledUnit();return i&&(s=this.columnValue.max.getScaledPercentUnit()),t?s+this.dataLabelHeight+this.spacings.labelToAxis:s}getColumnDataLabelPositionY(t){const i=this.spacings.labelToColumn;return t<0?this.getColumnPositionY()+Math.abs(t)+i:this.getColumnPositionY()-t-i}getNeedleDataLabelPositionY(t){const i=this.spacings.labelToColumn;return t<0?this.getNeedlePositionY()+Math.abs(t)+i+2*this.getNeedleWidth():this.getNeedlePositionY()-t-i-2*this.getNeedleWidth()}getAxisEndPositionX(){return this.getAxisPositionX()+(this.numberOfColumns+.5)*this.spacings.categoryWidth}getColumnWidth(){return this.spacings.columnWidth}getNeedleWidth(){return this.spacings.needleWidth}getNeedleHeadWidth(){return this.spacings.needleHeadWidth}getScenarioLabelPositionOffsetX(t){return t?.5*this.getColumnWidth()+this.spacings.scenarioLabelToColumn:-(.5*this.getColumnWidth()+this.spacings.scenarioLabelToColumn)}calculateSpacings(){this.spacings={scenarioOffset:this.fontStlye.size*this.scaleFactors.scenarioOffset,scenarioLabelToColumn:this.fontStlye.size*this.scaleFactors.scenarioLabelToColumn,markerOffset:this.fontStlye.size*this.scaleFactors.markerOffset,labelToColumn:this.fontStlye.size*this.scaleFactors.labelToColumn,labelToAxis:this.fontStlye.size*this.scaleFactors.labelToAxis,needleWidth:this.fontStlye.size*this.scaleFactors.needleWidth,needleHeadWidth:this.fontStlye.size*this.scaleFactors.needleHeadWidth,columnWidth:this.fontStlye.size*this.scaleFactors.columnWidth,varianceAxisLineWidth:this.fontStlye.size*this.scaleFactors.varianceAxisLineWidth,axisLineWidth:this.fontStlye.size*this.scaleFactors.axisLineWidth,auxiliaryLineWidth:this.fontStlye.size*this.scaleFactors.auxiliaryLineWidth,scenarioLineWidth:this.fontStlye.size*this.scaleFactors.scenarioLineWidth,markerWidth:this.fontStlye.size*this.scaleFactors.markerWidth,categoryWidth:this.fontStlye.size*this.scaleFactors.categoryWidth,axisTickLength:this.fontStlye.size*this.scaleFactors.axisTickLength}}calculateCategoryPosition(){this.categoryPosition={x:this.padding.left+.5*this.spacings.columnWidth,y:this.padding.top}}calculateAxisPosition(){this.axisPosition={x:this.getAxisPositionX(),y:this.getAxisPositionY(!1)}}getMarkerScenarioLabelPositionOffsetX(t){return t?this.spacings.labelToColumn-this.fontStlye.size:this.spacings.labelToColumn+.5*this.spacings.markerWidth}}class Ac{constructor(t){this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right}addBoxTopLeft(t){return this.top+=t.height|this.top,this.left+=t.width|this.top,this}}class Cc{constructor(t){const i=1*t,s=.7*t;this.bgOffset=(i-s)/2,this.markerUp={top:s/2+",0",left:"0,"+s,right:s+","+s},this.markerUpBackground={top:i/2+",0",left:"0,"+i,right:i+","+i},this.markerDown={bottom:s/2+","+s,left:"0,0",right:s+",0"},this.markerDownBackground={bottom:i/2+","+i,left:"0,0",right:i+",0"},this.markerRight={bottom:"0,"+s,top:"0,0",right:s+","+s/2},this.markerRightBackground={bottom:"0,"+i,top:"0,0",right:i+","+i/2},this.markerLeft={bottom:s+","+s,top:s+",0",left:"0,"+s/2},this.markerLeftBackground={bottom:i+","+i,top:i+",0",Left:"0,"+i/2}}upMarkerPatternStrings(){return{background:this.markerUpBackground.left+" "+this.markerUpBackground.right+" "+this.markerUpBackground.top+" "+this.markerUpBackground.left,foreground:this.markerUp.left+" "+this.markerUp.right+" "+this.markerUp.top+" "+this.markerUp.left,bgOffset:this.bgOffset}}downMarkerPatternStrings(){return{background:this.markerDownBackground.left+" "+this.markerDownBackground.right+" "+this.markerDownBackground.bottom+" "+this.markerDownBackground.left,foreground:this.markerDown.left+" "+this.markerDown.right+" "+this.markerDown.bottom+" "+this.markerDown.left,bgOffset:this.bgOffset}}rightMarkerPatternStrings(){return{background:this.markerRightBackground.top+" "+this.markerRightBackground.right+" "+this.markerRightBackground.bottom+" "+this.markerRightBackground.top,foreground:this.markerRight.top+" "+this.markerRight.right+" "+this.markerRight.bottom+" "+this.markerRight.top,bgOffset:this.bgOffset}}leftMarkerPatternStrings(){return{background:this.markerLeftBackground.top+" "+this.markerLeftBackground.Left+" "+this.markerLeftBackground.bottom+" "+this.markerLeftBackground.top,foreground:this.markerLeft.top+" "+this.markerLeft.left+" "+this.markerLeft.bottom+" "+this.markerLeft.top,bgOffset:this.bgOffset}}createPatternMapForStructureBar(){const t=new Map;return t.set("marker-up",this.upMarkerPatternStrings()),t.set("marker-down",this.downMarkerPatternStrings()),t.set("marker-right",this.rightMarkerPatternStrings()),t.set("marker-left",this.leftMarkerPatternStrings()),t}}class Pc{constructor(t){this.container=new ba,this.pattern=this.createFCPattern(this.container.group(),t),this.styles=t;let i=10;null!=t&&null!=t.fontStyles&&t.fontStyles.size&&(i=t.fontStyles.size),this.bgOffset=(1*i-.7*i)/2}createFCPattern(t,i){const s=i;return t.pattern(10,10,(function(t){t.rect(10,10).fill(s.barStyles.fc.fill),t.line(0,5,5,0).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"}),t.line(5,10,10,5).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"})})).id("pattern-time-fc")}getFCPolygonPattern(){return{background:"",foreground:"",bgOffset:0,pattern:this.pattern}}toString(){return this.container.svg()}}class Nc{constructor(t,i,s,e){this.value=t,this.scenario=i,this.pixelPerUnit=s||1,this.variance="neg"===e||e===Wc.NEG?Wc.NEG:"pos"===e||e===Wc.POS?Wc.POS:Wc.NEU}isEmpty(){return void 0===this.value||null==this.scenario}getScaledUnit(){return null==this.value?0:this.value*this.pixelPerUnit}getScaledPercentUnit(){return null==this.value?0:this.value>1.45?1.45*this.pixelPerUnit:this.value<-1.45?-1.45*this.pixelPerUnit:this.value*this.pixelPerUnit}getVarianceStyle(){return null==this.value||this.value>=0?this.variance:Wc.NEU===this.variance?Wc.NEU:Wc.POS===this.variance?Wc.NEG:Wc.POS}isClipped(){return null!=this.value&&Math.abs(this.value)>1.45}getClippedValue(){return 145}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}class Dc{constructor(){this.operation="+"}addRowGroup(t,i){this.rowGroup=t,this.rowGroupIndex=i}addCategory(t,i){this.category=t,this.categoryIndex=i}addSubCategory(t,i){this.subCategory=t,this.subCategoryIndex=i}addColumnGroup(t,i){this.columnGroup=t,this.columnGroupIndex=i}addSubColumnGroup(t,i){this.columnSubGroup=t,this.columnSubGroupIndex=i}}class Uc{constructor(){}adapt(t){const i=new Dc;return E.isString(t.date)&&(i.date=this.parseDateString(t.date)),E.isOperator(t.operation)&&(i.operation=t.operation),E.isNumber(t.rowGroupIndex)&&E.isString(t.rowGroup)&&i.addRowGroup(t.rowGroup,t.rowGroupIndex),E.isNumber(t.categoryIndex)&&E.isString(t.category)&&i.addCategory(t.category,t.categoryIndex),E.isNumber(t.subCategoryIndex)&&E.isString(t.subCategory)&&i.addSubCategory(t.subCategory,t.subCategoryIndex),E.isNumber(t.columnGroupIndex)&&E.isString(t.columnGroup)&&i.addColumnGroup(t.columnGroup,t.columnGroupIndex),E.isNumber(t.columnSubGroupIndex)&&E.isString(t.columnSubGroup)&&i.addSubColumnGroup(t.columnSubGroup,t.columnSubGroupIndex),this.setActualValues(t,i),this.setPlanValues(t,i),this.setPreviousPeriodValues(t,i),this.setForecastValues(t,i),i}parseDateString(t){if("string"!=typeof t)return;const i=y.fromISO(t,{zone:"utc"});if(i.isValid)return i;console.warn(`TimeChartDataRow: invalid date value '${t}' - skipping row`)}default(){return new Dc}setActualValues(t,i){E.isNumber(t.ac1)&&(i.ac1=t.ac1),E.isNumber(t.ac2)&&(i.ac2=t.ac2),E.isNumber(t.ac3)&&(i.ac3=t.ac3),E.isNumber(t.ac4)&&(i.ac4=t.ac4)}setPlanValues(t,i){E.isNumber(t.pl1)&&(i.pl1=t.pl1),E.isNumber(t.pl2)&&(i.pl2=t.pl2),E.isNumber(t.pl3)&&(i.pl3=t.pl3),E.isNumber(t.pl4)&&(i.pl4=t.pl4)}setPreviousPeriodValues(t,i){E.isNumber(t.pp1)&&(i.pp1=t.pp1),E.isNumber(t.pp2)&&(i.pp2=t.pp2),E.isNumber(t.pp3)&&(i.pp3=t.pp3),E.isNumber(t.pp4)&&(i.pp4=t.pp4)}setForecastValues(t,i){E.isNumber(t.fc1)&&(i.fc1=t.fc1),E.isNumber(t.fc2)&&(i.fc2=t.fc2),E.isNumber(t.fc3)&&(i.fc3=t.fc3),E.isNumber(t.fc4)&&(i.fc4=t.fc4)}}class zc{constructor(t,i,s,e,n,r){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=s,this.barStyles=e,this.varianceStyles=n,this.padding=r,this.pattern=new Map,this.stackColors=["#000000","#c0c0c0","#808080"],this.locale="de"}}class Fc{constructor(t,i,s,e,n){this.scaleFactorsStructureChartAdapter=t,this.fontStyleAdapter=i,this.svgStyleGroupAdapter=s,this.svgVariancesStyleGroupAdapter=e,this.paddingadapter=n}adapt(t){const i=new zc(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default());return E.isExisting(t)&&(E.isExisting(t.scaleFactors)&&(i.scaleFactors=this.scaleFactorsStructureChartAdapter.adapt(t.scaleFactors)),E.isExisting(t.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(t.fontStyles)),E.isExisting(t.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(t.axisStyles)),E.isExisting(t.barStyles)&&(i.barStyles=this.svgStyleGroupAdapter.adapt(t.barStyles)),E.isExisting(t.varianceStyles)&&(i.varianceStyles=this.svgVariancesStyleGroupAdapter.adapt(t.varianceStyles)),E.isExisting(t.padding)&&(i.padding=this.paddingadapter.adapt(t.padding)),Array.isArray(t.stackColors)&&t.stackColors.length>0&&(i.stackColors=t.stackColors),i.pattern=new Cc(i.fontStyles.size).createPatternMapForStructureBar()),i}default(){return new zc(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default())}}var Wc,Gc;!function(t){t.AC1="ac1",t.PP1="pp1",t.FC1="fc1",t.PL1="pl1",t.AC2="ac2",t.PP2="pp2",t.FC2="fc2",t.PL2="pl2",t.AC3="ac3",t.PP3="pp3",t.FC3="fc3",t.PL3="pl3",t.AC4="ac4",t.PP4="pp4",t.FC4="fc4",t.PL4="pl4",t.POS="pos",t.NEG="neg",t.NEU="neu"}(Wc||(Wc={})),function(t){t.LIST="LIST",t.SUM="SUM",t.OPT="OPT"}(Gc||(Gc={}));class jc{constructor(t,i,s){this.ID_AXIS="axis",this.CSS_AXIS_TITLE="categories",this.scenarioType=t.scenarioType,this.labelText=t.labelText||null,this.isRelative=t.isRelative||!1,this.position=i,this.svgGroup=s.group().id(this.ID_AXIS)}drawAxisTitle(t,i){null==i&&(i=""),t.text(i).addClass(this.CSS_AXIS_TITLE).attr("text-anchor","middle").move(this.position.getAxisTitlePositionX(t),this.position.getAxisTitlePositionY(!0,this.isRelative))}draw(){return this.labelText&&this.drawAxisTitle(this.svgGroup,this.labelText),this.svgGroup.line(this.position.getAxisPositionX(),this.position.getAxisPositionY(this.isRelative),this.position.getAxisEndPositionX(),this.position.getAxisPositionY(this.isRelative)).addClass(this.ID_AXIS+"-"+this.convertScenarioType()),this}convertScenarioType(){return void 0===this.scenarioType||null==this.scenarioType?"default":`${this.scenarioType}`.slice(0,2)}}class Ic{constructor(t,i,s,e,n,r,o,h=null){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.scenarioLabel=null,this.isVarianceColumn=!1,this.overflowConfig=null,this.isOverflowing=!1,this.overdriveHeight=0,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=e,this.isPrimaryColumn=n,this.position=t,this.columnBarStyles=i.barStyles,this.overflowConfig=h,this.scenarioGroup=r,this.styles=i,this.columnGroup=r.group().id(r.toString()+"_"+this.ID_RECT),!0!==(null==s?void 0:s.isEmpty())&&(this.hasData=!0,this.dimensions=this.createDimensions(s,e,n),this.label=this.getDataLabel(s),this.scenarioLabel=this.getScenarioLabel(o))}setAsVariance(){var t;return this.isVarianceColumn=!0,null===(t=this.label)||void 0===t||t.setToVarianceLabel(),this}updateLabelGroup(t){var i;return this.isEmpty()||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(t={percent:2,decimal:1},i=new al){if(this.isEmpty())return this;const s=this.getScenarioStyle(),e=this.convertToSVGStyle(s,"stroke"),n=this.getFillStyle(s);null!=this.columnGroup&&(this.isOverflowing&&this.overflowConfig?this.drawOverdriveBar(n,e):this.columnGroup.rect(this.position.getColumnWidth(),this.dimensions.columnLength).fill(n).stroke(e).y(this.dimensions.yPos).cx(this.dimensions.xPos)),this.drawColumnDataLabel(t,i),this.drawScenarioLabel()}drawOverdriveBar(t,i){if(!this.columnGroup||!this.overflowConfig)return;const s=this.position.getColumnPositionY(),e=this.position.getColumnWidth(),n=this.dimensions.columnLength,{breakGap:r}=this.overflowConfig,o=s-n;this.columnGroup.rect(e,n).fill(t).stroke(i).y(o).cx(this.dimensions.xPos);const h=o-r-this.overdriveHeight;this.columnGroup.rect(e,this.overdriveHeight).fill(t).stroke(i).y(h).cx(this.dimensions.xPos),this.drawBreakIndicator(o,r)}drawBreakIndicator(t,i){if(!this.columnGroup)return;const s=this.position.getColumnWidth(),e=this.dimensions.xPos-s/2,n=t-i/2,r=.35*i,o=s/3;let h=`M ${e} ${n-r}`;for(let t=0;t<3;t++)h+=` L ${e+o*(t+.5)} ${n-r-.3*i} L ${e+o*(t+1)} ${n-r}`;let a=`M ${e} ${n+r}`;for(let t=0;t<3;t++)a+=` L ${e+o*(t+.5)} ${n+r+.3*i} L ${e+o*(t+1)} ${n+r}`;this.columnGroup.rect(s+2,i).fill("#ffffff").stroke("none").y(t-i).cx(this.dimensions.xPos),this.columnGroup.path(h).fill("none").stroke({color:"#000000",width:1}),this.columnGroup.path(a).fill("none").stroke({color:"#000000",width:1})}createDimensions(t,i,s){const e=t.getScaledUnit();if(this.overflowConfig&&e>0){const n="ac"===t.getScenario()?this.overflowConfig.cutHeight:this.overflowConfig.cutHeight-this.overflowConfig.scenarioCutOffset;if(e>n){this.isOverflowing=!0;const{breakGap:t,overdriveZoneHeight:r,maxOverflow:o}=this.overflowConfig;this.overdriveHeight=o>0?(e-n)/o*r:0;const h=n+t+this.overdriveHeight,a=this.position.getColumnPositionY();return{clipped:!1,columnLength:n,xPos:this.position.getColumnPositionX(i,s),yPos:a-n,labelYPos:a-h-this.position.spacings.labelToColumn,scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:a-.5*n}}}return e<0?{clipped:!1,columnLength:Math.abs(e),xPos:this.position.getColumnPositionX(i,s),yPos:this.position.getColumnPositionY(),labelYPos:this.position.getColumnDataLabelPositionY(e),scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getColumnPositionY()+.5*Math.abs(e)}:{clipped:!1,columnLength:e,xPos:this.position.getColumnPositionX(i,s),yPos:this.position.getColumnPositionY()-e,labelYPos:this.position.getColumnDataLabelPositionY(e),scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getColumnPositionY()-.5*Math.abs(e)}}getDataLabel(t){let i=ll.Bottom;null!=t.value&&t.value<0&&(i=ll.Top);const s=this.isOverflowing?this.dimensions.labelYPos:this.position.getColumnDataLabelPositionY(this.dataPoint.getScaledUnit());return new cl(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),s,this.ID_DATA_PREFIX,t.value,this.styles,i,ll.Center)}getScenarioLabel(t){return new cl(this.scenarioGroup,-1,-1,this.ID_SCENARIO_PREFIX,t,this.styles,ll.Center,this.isPrimaryColumn?ll.Left:ll.Right)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}drawScenarioLabel(){null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.isVarianceColumn||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(!0)}drawColumnDataLabel(t,i=new al){var s;null===(s=this.label)||void 0===s||s.draw(this.isPrimaryColumn,t,i)}getFillStyle(t){var i,s,e,n;const r=this.columnBarStyles[this.dataPoint.getScenario()];return(null==r?void 0:r.fillpattern)&&(null===(i=this.styles.pattern.get(r.fillpattern))||void 0===i?void 0:i.pattern)?null===(n=null===(e=null===(s=this.styles)||void 0===s?void 0:s.pattern)||void 0===e?void 0:e.get(r.fillpattern))||void 0===n?void 0:n.pattern:this.convertToSVGStyle(t,"fill")}getScenarioStyle(){var t;return this.isVarianceColumn?null===(t=this.styles)||void 0===t?void 0:t.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()):this.columnBarStyles[this.dataPoint.getScenario()]}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}}class Yc{constructor(t,i,s,e,n,r,o,h,a){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.FALLBACK_COLOUR="#000000",this.scenarioLabel=null,this._defaultMarkerPattern=null,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.position=t,this.markerGroup=i||null,this.markerPattern=s||this._defaultMarkerPattern,this.styles=n,this.barStyles=n?n.barStyles:null,this.scenario=e,!0!==(null==r?void 0:r.isEmpty())&&(this.hasData=!0,this.dimensions=this.createMarkerDimensions(r,o,a),this.scenarioLabel=this.getScenarioLabel(h,n,a))}draw(){if(this.isEmpty())return this;const t=this.convertToSVGStyle(this.barStyles[this.getScenario()],"stroke");let i=this.convertToSVGStyle(this.barStyles[this.getScenario()],"fill");const s=this.barStyles[this.getScenario()];if(null!=s&&s.fillpattern){const t=this.styles.pattern.get(s.fillpattern);null!=t&&(i=t.pattern)}return this.markerGroup.polygon(this.markerPattern.background).fill("#ffffff").cy(this.dimensions.yPos-this.dimensions.columnLength).cx(this.dimensions.xPos),this.markerGroup.polygon(this.markerPattern.foreground).fill(i).stroke(t).cy(this.dimensions.yPos-this.dimensions.columnLength).cx(this.dimensions.xPos),null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(),this}createMarkerDimensions(t,i,s){return t.getScaledUnit()<0?{clipped:!1,labelYPos:0,columnLength:t.getScaledUnit(),xPos:this.position.getMarkerPositionX(i,s),yPos:this.position.getMarkerPositionY(),scenarioLabelXPos:this.position.getMarkerPositionX(i,s)+this.position.getMarkerScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getMarkerPositionY()+Math.abs(t.getScaledUnit())}:{clipped:!1,labelYPos:0,columnLength:t.getScaledUnit(),xPos:this.position.getMarkerPositionX(i,s),yPos:this.position.getMarkerPositionY(),scenarioLabelXPos:this.position.getMarkerPositionX(i,s)+this.position.getMarkerScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getMarkerPositionY()-Math.abs(t.getScaledUnit())}}getScenarioLabel(t,i,s){return null==this.markerGroup?null:new cl(this.markerGroup,-1,-1,this.ID_DATA_PREFIX,t,i,ll.Center,s?ll.Right:ll.Left)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}isEmpty(){return!1===this.hasData}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}class Bc{constructor(t,i,s,e,n){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.dataLabel=null,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=e,this.position=t,this.barStyles=i.barStyles,this.scenarioGroup=n,this.styles=i,this.barGroup=n.group().id(n.toString()+"_"+this.ID_RECT);const r=void 0===(null==s?void 0:s.value)&&null!=(null==s?void 0:s.scenario);(!0!==(null==s?void 0:s.isEmpty())||r)&&(this.hasData=!0,this.dimensions=this.createDimensions(t,s,e),this.dataLabel=new cl(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),this.position.getNeedleDataLabelPositionY(this.dataPoint.getScaledPercentUnit()),this.ID_DATA_PREFIX,r?Tt:s.value,this.styles,ll.Center,ll.Center),this.dataLabel.setToRelativeVarianceLabel())}updateLabelGroup(t){var i;return this.isEmpty()||null===(i=this.dataLabel)||void 0===i||i.updateGroup(t),this}draw(){var t,i,s;if(void 0===(null===(t=this.dataPoint)||void 0===t?void 0:t.value))return null===(i=this.dataLabel)||void 0===i||i.draw(),this;if(this.isEmpty())return this;const e=this.styles.varianceStyles[this.dataPoint.getVarianceStyle()],n=this.convertToSVGStyle(e,"stroke");let r=this.convertToSVGStyle(e,"fill");const o=this.convertToSVGStyle(this.styles.varianceStyles.ac,"stroke"),h=this.convertToSVGStyle(this.styles.varianceStyles.ac,"fill"),a=this.barStyles[this.dataPoint.getScenario()];if(null!=a&&a.fillpattern){const t=this.styles.pattern.get(a.fillpattern);null!=t&&(r=t.pattern)}this.dimensions.clipped?this.createClippedNeedleHead(r,n):this.createNeedleHead(o,h),this.barGroup.rect(this.position.getNeedleWidth(),this.dimensions.columnLength).cx(this.dimensions.xPos).y(this.dimensions.yPos).fill(r).stroke(n),null===(s=this.dataLabel)||void 0===s||s.draw()}createDimensions(t,i,s){return i.getScaledPercentUnit()<0?{labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,columnLength:Math.abs(i.getScaledPercentUnit()),xPos:t.getColumnCenterPositionX(s),yPos:t.getNeedlePositionY(),clipped:i.isClipped()}:{columnLength:i.getScaledPercentUnit(),xPos:t.getColumnCenterPositionX(s),yPos:t.getNeedlePositionY()-i.getScaledPercentUnit(),labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:i.isClipped()}}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}createClippedNeedleHead(t,i){const s=this.barGroup.polygon("0,0 5,9 -5,9 0,0 0,5 5,13 -5,13 0,5").fill(t).cx(this.dimensions.xPos).cy(this.getHeadYPosition()).fill(t).stroke(i);null!=this.dataPoint.value&&this.dataPoint.value<0&&s.flip("y")}createNeedleHead(t,i){this.barGroup.rect(2*this.position.getNeedleWidth(),this.position.getNeedleHeadWidth()).cx(this.dimensions.xPos).cy(this.getHeadYPosition()).fill(t).stroke(i)}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}getHeadYPosition(){let t=this.dimensions.yPos;return null!=this.dataPoint.value&&this.dataPoint.value<0&&(t+=this.dimensions.columnLength),t}}const Hc={ac:{markerFill:"#000000",markerStroke:"#000000",lineColor:"#000000"},pp:{markerFill:"#999999",markerStroke:"#999999",lineColor:"#999999"},fc:{markerFill:"#ffffff",markerStroke:"#000000",lineColor:"#000000",lineDashArray:"4,4"},pl:{markerFill:"#ffffff",markerStroke:"#000000",lineColor:"#000000"}};class Vc{constructor(t,i,s,e,n,r,o,h,a=null){this.MARKER_SIZE=8,this.LINE_WIDTH=2,this.ID_LINE_PREFIX="LINE",this.ID_MARKER_PREFIX="MARKER",this.ID_LABEL_PREFIX="LABEL",this.ESTIMATED_LABEL_WIDTH=56,this.ESTIMATED_LABEL_HEIGHT=24,this.position=t,this.styles=i,this.dataPoints=s,this.scenarioGroup=e,this.labelGroup=n,this.scenarioName=r,this.scenarioLabel=o,this.collisionManager=a}draw(t={percent:2,decimal:1},i=new al){return this.drawGeometry(),this.drawLabels(t,i),this}drawGeometry(){if(0===this.dataPoints.length)return this;const t=this.getLineStyle();return this.drawLines(t),this.drawMarkers(t),this}drawLabels(t={percent:2,decimal:1},i=new al){return 0===this.dataPoints.length||(this.drawScenarioLabel(),this.drawValueLabels(t,i)),this}getLineStyle(){var t,i;const s=(null===(i=null===(t=this.scenarioName)||void 0===t?void 0:t.slice(0,2))||void 0===i?void 0:i.toLowerCase())||"ac";return Hc[s]||Hc.ac}getScenarioVariant(){var t;const i=parseInt((null===(t=this.scenarioName)||void 0===t?void 0:t.slice(-1))||"1",10);return isNaN(i)?1:Math.min(Math.max(i,1),4)}drawSquareMarker(t,i,s,e){const n=this.MARKER_SIZE/2;t.rect(this.MARKER_SIZE,this.MARKER_SIZE).fill(e.markerFill).stroke({color:e.markerStroke,width:1}).move(i-n,s-n)}drawCircleMarker(t,i,s,e){t.circle(this.MARKER_SIZE).fill(e.markerFill).stroke({color:e.markerStroke,width:1}).center(i,s)}drawTriangleMarker(t,i,s,e){const n=this.MARKER_SIZE/2;t.polygon(`${i},${s-n} ${i-n},${s+n} ${i+n},${s+n}`).fill(e.markerFill).stroke({color:e.markerStroke,width:1})}drawDiamondMarker(t,i,s,e){const n=this.MARKER_SIZE/2;t.polygon(`${i},${s-n} ${i+n},${s} ${i},${s+n} ${i-n},${s}`).fill(e.markerFill).stroke({color:e.markerStroke,width:1})}drawLines(t){const i=this.scenarioGroup.group().id(this.ID_LINE_PREFIX);for(let s=1;s<this.dataPoints.length;s++){const e=this.dataPoints[s-1],n=this.dataPoints[s];if(e.dataPoint.isEmpty()||n.dataPoint.isEmpty())continue;const r=this.position.getColumnCenterPositionX(e.index),o=this.position.getColumnPositionY()-e.dataPoint.getScaledUnit(),h=this.position.getColumnCenterPositionX(n.index),a=this.position.getColumnPositionY()-n.dataPoint.getScaledUnit(),l=i.line([[r,o],[h,a]]).stroke({color:t.lineColor,width:this.LINE_WIDTH,linecap:"round"}).fill("none");t.lineDashArray&&l.attr("stroke-dasharray",t.lineDashArray)}}drawMarkers(t){const i=this.scenarioGroup.group().id(this.ID_MARKER_PREFIX),s=this.getScenarioVariant();for(const e of this.dataPoints){if(e.dataPoint.isEmpty())continue;const n=this.position.getColumnCenterPositionX(e.index),r=this.position.getColumnPositionY()-e.dataPoint.getScaledUnit();switch(s){case 2:this.drawCircleMarker(i,n,r,t);break;case 3:this.drawTriangleMarker(i,n,r,t);break;case 4:this.drawDiamondMarker(i,n,r,t);break;default:this.drawSquareMarker(i,n,r,t)}}}getLabelPositionPriority(t){const i=this.dataPoints[t];let s=null;for(let i=t+1;i<this.dataPoints.length;i++)if(!this.dataPoints[i].dataPoint.isEmpty()){s=this.dataPoints[i];break}let e=null;for(let i=t-1;i>=0;i--)if(!this.dataPoints[i].dataPoint.isEmpty()){e=this.dataPoints[i];break}const n=i.dataPoint.getScaledUnit();return e&&s&&e.dataPoint.getScaledUnit()>n&&s.dataPoint.getScaledUnit()>n?[dl.Below,dl.Left,dl.Right,dl.Above]:[dl.Above,dl.Left,dl.Right,dl.Below]}getScenarioType(){var t,i;return(null===(i=null===(t=this.scenarioName)||void 0===t?void 0:t.slice(0,2))||void 0===i?void 0:i.toLowerCase())||"ac"}drawValueLabels(t,i){const s=this.getScenarioType();for(let e=0;e<this.dataPoints.length;e++){const n=this.dataPoints[e];if(n.dataPoint.isEmpty()||null===n.dataPoint.value)continue;const r=this.position.getColumnCenterPositionX(n.index),o=this.position.getColumnPositionY()-n.dataPoint.getScaledUnit();let h=r,a=o-this.MARKER_SIZE/2-2,l=ll.Bottom,c=ll.Center;if(this.collisionManager){const t=this.getLabelPositionPriority(e),i=this.collisionManager.getOptimalPlacement(r,o,this.ESTIMATED_LABEL_WIDTH,this.ESTIMATED_LABEL_HEIGHT,n.index,this.MARKER_SIZE,s,t);if(null===i)continue;h=i.labelX,a=i.labelY,l=i.verticalHook,c=i.horizontalHook;const u=Object.assign(Object.assign({},i.bounds),{scenarioType:s});this.collisionManager.register(u)}new cl(this.labelGroup,h,a,this.ID_LABEL_PREFIX,n.dataPoint.value,this.styles,l,c).draw(!0,t,i)}}drawScenarioLabel(){if(!this.scenarioLabel)return;let t=null;for(let i=this.dataPoints.length-1;i>=0;i--)if(!this.dataPoints[i].dataPoint.isEmpty()){t=this.dataPoints[i];break}if(!t)return;const i=this.position.getColumnCenterPositionX(t.index)+this.MARKER_SIZE+4,s=this.position.getColumnPositionY()-t.dataPoint.getScaledUnit(),e=this.getScenarioType();if(this.collisionManager){if(this.collisionManager.shouldHideScenarioLabel(i,s,e))return;this.collisionManager.registerScenarioLabel(i,s,e)}new cl(this.labelGroup,i,s,"SCENARIO_LABEL",this.scenarioLabel,this.styles,ll.Center,ll.Left).forceStringTypeDraw()}}class Xc{constructor(t,i,s,e,n,r,o,h,a,l,c){this.hasData=!1,this.position=t,this.styles=i,this.dataPoint=s,this.index=e,this.segment=n,this.segmentIndex=o,this.stackMode=h,this.stack=a,this.group=c,this.columnGroup=c.group().id(`stacked_col_${e}_seg_${o}`),!0!==(null==s?void 0:s.isEmpty())&&null!=s.value&&(this.hasData=!0)}draw(t={percent:2,decimal:1},i=new al){if(!this.hasData||!Number.isFinite(this.dataPoint.value))return;const s=this.dataPoint.value,e=this.dataPoint.pixelPerUnit,n=this.position.getColumnPositionY(),r=Math.abs(this.segment.end-this.segment.start)*e,o=n-Math.max(this.segment.start,this.segment.end)*e,h=this.position.getColumnCenterPositionX(this.index),a=this.position.getColumnWidth(),l=this.styles.stackColors,c=l[this.segmentIndex%l.length],u={color:c},d={color:c,width:.5};if(this.columnGroup.rect(a,Math.max(r,.5)).fill(u).stroke(d).y(o).cx(h),r>=18){const e=o+r/2;if(this.stackMode===q.RELATIVE||this.stackMode===q.ABSOLUTE_RELATIVE){const i=hs.number(this.segment.share,"percent",t.percent,t.percent,1,this.styles.locale);new cl(this.group,h,e,"STACK_SEG",i,this.styles,ll.Center,ll.Center).setSegmentFill(c).forceStringTypeDraw()}else new cl(this.group,h,e,"STACK_SEG",s,this.styles,ll.Center,ll.Center).setSegmentFill(c).draw(!0,t,i)}}drawTotalLabel(t={percent:2,decimal:1},i=new al){if(this.stackMode===q.RELATIVE)return;const s=this.stack.total<0,e=s?0-this.stack.negative:this.stack.positive,n=this.position.getColumnCenterPositionX(this.index),r=this.position.getColumnDataLabelPositionY(e*this.dataPoint.pixelPerUnit);new cl(this.group,n,r,"STACK_TOTAL",this.stack.total,this.styles,s?ll.Top:ll.Bottom,ll.Center).draw(!0,t,i)}}const Jc={ac:{fill:"#000000",opacity:.3,lineColor:"#000000"},pp:{fill:"#999999",opacity:.3,lineColor:"#999999"},fc:{fill:"#000000",opacity:.2,lineColor:"#000000",dashArray:"4,4"},pl:{fill:"#000000",opacity:.1,lineColor:"#000000"}},qc=[{fill:"#000000",opacity:.3},{fill:"#555555",opacity:.25},{fill:"#999999",opacity:.2},{fill:"#bbbbbb",opacity:.15},{fill:"#dddddd",opacity:.1}];class Kc{constructor(t,i,s,e,n,r){this.group=t.group().id(`area_fill_${n}`),this.upperPoints=i,this.lowerPoints=s,this.scenarioType=e,this.segmentIndex=n,this.isScenarioStack=r}draw(){if(this.upperPoints.length<2||this.lowerPoints.length<2)return;let t,i,s=`M ${this.upperPoints[0].x},${this.upperPoints[0].y}`;for(let t=1;t<this.upperPoints.length;t++)s+=` L ${this.upperPoints[t].x},${this.upperPoints[t].y}`;for(let t=this.lowerPoints.length-1;t>=0;t--)s+=` L ${this.lowerPoints[t].x},${this.lowerPoints[t].y}`;if(s+=" Z",this.isScenarioStack&&this.scenarioType){const s=this.scenarioType.slice(0,2).toLowerCase(),e=Jc[s]||Jc.ac;t=e.fill,i=e.opacity}else{const s=Math.min(this.segmentIndex,qc.length-1);t=qc[s].fill,i=qc[s].opacity}this.group.path(s).fill(t).opacity(i).stroke("none")}drawBoundaryLine(){if(this.upperPoints.length<2)return;let t,i="#000000";if(this.isScenarioStack&&this.scenarioType){const s=this.scenarioType.slice(0,2).toLowerCase(),e=Jc[s]||Jc.ac;i=e.lineColor,t=e.dashArray}const s=this.group.polyline(this.upperPoints.map((t=>[t.x,t.y]))).fill("none").stroke({color:i,width:1.5});t&&s.attr("stroke-dasharray",t)}}class Qc{constructor(t,i,s,e,n,r,o,h){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.scenarioLabel=null,this.isVarianceLine=!1,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.previousDimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=n,this.isPrimaryLine=r,this.position=t,this.LineBarStyles=i.barStyles,this.scenarioGroup=o,this.styles=i,this.LineGroup=o.group().id(o.toString()+"_"+this.ID_RECT),!0!==(null==s?void 0:s.isEmpty())&&(this.hasData=!0,this.dimensions=this.createDimensions(s,n,r),this.label=this.getDataLabel(s),this.scenarioLabel=this.getScenarioLabel(h)),this.previousDimensions=this.createDimensions(e,n-1,r)}setAsVariance(){var t;return this.isVarianceLine=!0,null===(t=this.label)||void 0===t||t.setToVarianceLabel(),this}updateLabelGroup(t){var i;return this.isEmpty()||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(t={percent:2,decimal:1},i=new al){if(this.isEmpty())return this;const s=this.getScenarioStyle(),e=this.getFillStyle(s);null!=this.LineGroup&&this.LineGroup.line([[this.previousDimensions.xPos,this.previousDimensions.yPos],[this.dimensions.xPos,this.dimensions.yPos]]).fill(e).stroke({color:"#f06",width:3,linecap:"round"}),this.drawLineDataLabel(t,i),this.drawScenarioLabel()}createDimensions(t,i,s){return{clipped:!1,columnLength:t.getScaledUnit(),xPos:this.position.getColumnPositionX(i,s),yPos:this.position.getColumnPositionY()-t.getScaledUnit(),labelYPos:this.position.getColumnDataLabelPositionY(t.getScaledUnit()),scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getColumnPositionY()-t.getScaledUnit()}}getDataLabel(t){let i=ll.Bottom;return null!=t.value&&t.value<0&&(i=ll.Top),new cl(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),this.position.getColumnDataLabelPositionY(this.dataPoint.getScaledUnit()),this.ID_DATA_PREFIX,t.value,this.styles,i,ll.Center)}getScenarioLabel(t){return new cl(this.scenarioGroup,0,0,this.ID_SCENARIO_PREFIX,t,this.styles,ll.Bottom,ll.Left)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}drawScenarioLabel(){null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.isVarianceLine||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(!0)}drawLineDataLabel(t,i=new al){var s;null===(s=this.label)||void 0===s||s.draw(this.isPrimaryLine,t,i)}getFillStyle(t){var i,s,e,n;const r=this.LineBarStyles[this.dataPoint.getScenario()];return(null==r?void 0:r.fillpattern)&&(null===(i=this.styles.pattern.get(r.fillpattern))||void 0===i?void 0:i.pattern)?null===(n=null===(e=null===(s=this.styles)||void 0===s?void 0:s.pattern)||void 0===e?void 0:e.get(r.fillpattern))||void 0===n?void 0:n.pattern:this.convertToSVGStyle(t,"fill")}getScenarioStyle(){var t;return this.isVarianceLine?null===(t=this.styles)||void 0===t?void 0:t.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()):this.LineBarStyles[this.dataPoint.getScenario()]}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}}class Zc{constructor(t,i,s,e,n){this.pixelPerUnit=1,this.collisionManager=null,this.overflowConfig=null,this.i18n=n;const r=i.group().id("Scenario1"),o=i.group().id("Scenario2").insertBefore(r);this.svgGroups={parent:i,scenario1:r,scenario2:o,scenario3:i.group().id("Scenario3"),scenario4:i.group().id("Scenario4"),scenario1Label:i.group().id("label")},this.styles=s,this.position=t,this.elementCnt=e}setOverflowConfig(t){this.overflowConfig=t}createLine(t,i,s,e){const n=this.svgGroups.scenario1.group().id(""+e),r=this.svgGroups.scenario1Label.group().id(""+e);let o=null;return this.isLastDataPoint(e-1)&&(o=t),new Qc(this.position,this.styles,i,s,e,!1,n,o).updateLabelGroup(r)}createPrimaryBar(t,i){const s=this.svgGroups.scenario1.group().id(""+i),e=this.svgGroups.scenario1Label.group().id(""+i);let n=null;return this.isLastDataPoint(i)&&(n=`${this.i18n.get(t.scenario)||t.scenario}`),new Ic(this.position,this.styles,t,i,!0,s,n,this.overflowConfig).updateLabelGroup(e)}createVarianceBar(t,i){const s=this.svgGroups.scenario1.group().id(""+i),e=this.svgGroups.scenario1Label.group().id(""+i);let n=null;return this.isLastDataPoint(i)&&(n=`${this.i18n.get(t.scenario)||t.scenario}`),new Ic(this.position,this.styles,t,i,!0,s,n,this.overflowConfig).updateLabelGroup(e).setAsVariance()}createRelativeVarianceBar(t,i){const s=this.svgGroups.scenario1.group().id(""+i),e=this.svgGroups.scenario1Label.group().id(""+i);return new Bc(this.position,this.styles,t,i,s).updateLabelGroup(e)}createSecondaryBar(t,i){const s=this.svgGroups.scenario2.group().id(""+i);let e=null;return this.isFirstDataPoint(i)&&(e=`${this.i18n.get(t.scenario)||t.scenario}`),new Ic(this.position,this.styles,t,i,!1,s,e,this.overflowConfig)}createPrimaryMarker(t,i){const s=this.svgGroups.scenario3.group().id(""+i),e=this.styles.pattern.get("marker-right")||{foreground:"#000000",background:"#ffffff",bgOffset:0};let n=null;return this.isFirstDataPoint(i)&&(n=`${this.i18n.get(t.scenario)||t.scenario}`),new Yc(this.position,s,e,t.scenario,this.styles,t,i,n,!0)}createSecondaryMarker(t,i){const s=this.svgGroups.scenario4.group().id(""+i),e=this.styles.pattern.get("marker-left")||{foreground:"#000000",background:"#ffffff",bgOffset:0};let n=null;return this.isLastDataPoint(i)&&(n=`${this.i18n.get(t.scenario)||t.scenario}`),new Yc(this.position,s,e,t.scenario,this.styles,t,i,n,!1)}isLastDataPoint(t){return this.elementCnt-1===t}isFirstDataPoint(t){return 0===t}setCollisionManager(t){this.collisionManager=t}moveLabelsToFront(){this.svgGroups.scenario1Label.front()}createLineSeries(t,i){const s=this.svgGroups.parent.group().id("LineSeries_"+i),e=this.svgGroups.scenario1Label.group().id("LineSeries_Label_"+i),n=`${this.i18n.get(i)||i}`;return new Vc(this.position,this.styles,t,s,e,i,n,this.i18n,this.collisionManager)}}const tu="bn-measurement-host";function iu(t,i){const s=function(){if("undefined"==typeof document||!document.body)return null;let t=document.getElementById(tu);return t||(t=document.createElement("div"),t.id=tu,t.style.cssText="opacity:0;position:absolute;left:-100%;top:-100%;overflow:hidden",t.setAttribute("aria-hidden","true"),document.body.appendChild(t)),t}();if(s){s.appendChild(t.node);try{i()}finally{t.node.parentNode===s&&s.removeChild(t.node)}}else i()}var su,eu;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(su||(su={})),function(t){t.RELATIVE="dr",t.ABSOLUTE="d",t.NONE=""}(eu||(eu={}));class nu{constructor(t,i,s,e,n,r=0){this.CSS_CATEGORIES="categories",this.dataModel=[],this.variancesDataModel=[],this.title="",this.configTitle="",this.configVariances=[],this.smallestDataPointValue=new Nc(0,Wc.AC1,1,Wc.NEU),this.highestDataPointValue=new Nc(0,Wc.AC1,1,Wc.NEU),this.smallestVarianceDataPointValue=new Nc(0,Wc.AC1,1,Wc.NEU),this.highestVarianceDataPointValue=new Nc(0,Wc.AC1,1,Wc.NEU),this.pixelPerUnit=1,this.pixelPerPercentage=1,this.hideAxisLabels=!1,this.axisScenario=Wc.AC1,this.fromExpr="",this.rowCount=0,this.axisCategoryArea={width:0,height:0},this.scenariosArea={width:0,height:0},this.state=su.DIRTY,this.i18n=new Map,this.leftSideOffsetForHorizontalSync=-1,this.dateInterval=tt.DAY,this.locale="de",this.axisLabelsMode=it.SMART,this.intervalSpanLimit=32,this.measureScale=new al,this.measureUnit="",this.dataFormatDigits={percent:2,decimal:1},this.showOverlayMedian=!1,this.showOverlayAvg=!1,this.chartMode=st.BAR,this.maxBars=28,this.stackConfig=null,this.scenarioPropOrder=[],this.lineFullWidth=!0,this.availableWidth=0,this.overflowConfig=null,this.lastScenarios=[],this.db=i,this.tableName=s,this.ruleSet=t||new Ge,this.i18n=this.createI18n(new Map),this.styles=n,this.availableWidth=r,this.setConfig(e),this.position=this.createElementPosition(this.lastScenarios)}updatePosition(t){this.position=this.createElementPosition(t)}setStyles(t){this.styles=t}setRuleSet(t){this.ruleSet=t||new Ge}setAvailableWidth(t){this.availableWidth=t}setAvailableHeight(t){this.pixelPerUnit<=0||t<=0?this.overflowConfig=null:null==this.stackConfig&&this.determineEffectiveChartMode()===st.BAR?(this.overflowConfig=this.calculateOverflowConfig(t),this.overflowConfig&&this.updatePosition(this.lastScenarios)):this.overflowConfig=null}calculateOverflowConfig(t){const i=(this.isVarianceChart()?this.highestVarianceDataPointValue:this.highestDataPointValue).getScaledUnit();if(i<=0)return null;const s=this.styles.fontStyles.size,e=1.5*s,n=.3*s,r=t-(this.position.dataLabelHeight+this.position.spacings.labelToColumn+this.position.padding.top+this.position.padding.bottom+this.position.spacings.labelToAxis+s)-e-n,o=.8*s;if(r<=o)return null;const h=r-o;return i<=h?null:{cutHeight:r,overdriveZoneHeight:e,breakGap:n,maxOverflow:i-h,scenarioCutOffset:o}}setConfig(t){var i;this.state=su.DIRTY,this.locale=t.locale,this.scenarioPropOrder=[...t.scenarios];const s=this.sortScenariosbyVisualisationRules(t.scenarios);if(this.setSource(t.filter),this.hideAxisLabels=t.hideAxisLabels||!1,this.pixelPerUnit=t.pixelPerUnit,this.pixelPerPercentage=t.pixelPerPercentage,this.axisLabelsMode=t.axisLabelsMode,this.intervalSpanLimit=t.intervalSpanLimit,this.dateInterval=this.findDateInterval(t.dateInterval),this.dataModel=this.populateModel(s,this.dateInterval,t.level,t.sortOrder),this.variancesDataModel=this.populateVarianceModel(t.variances,this.dataModel),this.configTitle=t.title,this.configVariances=null!==(i=null==t?void 0:t.variances)&&void 0!==i?i:[],this.updateTitle(),this.smallestDataPointValue=this.findSmallestDataPointValue(this.dataModel),this.smallestVarianceDataPointValue=this.findSmallestDataPointValue(this.variancesDataModel),this.highestDataPointValue=this.findHighestDataPointValue(this.dataModel),this.highestVarianceDataPointValue=this.findHighestDataPointValue(this.variancesDataModel),this.axisScenario=this.setAxisScenario(t.variances),this.leftSideOffsetForHorizontalSync=t.leftSideOffsetForHorizontalSync,this.measureScale=t.measureScale,this.measureUnit=t.measureUnit,this.dataFormatDigits=t.dataFormatDigits,this.showOverlayMedian=t.showOverlayMedian,this.showOverlayAvg=t.showOverlayAvg,this.chartMode=t.chartMode,this.maxBars=t.maxBars,this.stackConfig=t.stackConfig,this.lineFullWidth=t.lineFullWidth,this.lastScenarios=s,null!=this.stackConfig){const t=[];for(const i of this.dataModel)t.push(...this.stackGroups(i).map((t=>t.layout)));const i=$c(t),{scenario:s,variance:e}=this.highestDataPointValue;this.highestDataPointValue=new Nc(i.positive,s,this.pixelPerUnit,e),this.smallestDataPointValue=new Nc(0-i.negative,s,this.pixelPerUnit,e)}this.updatePosition(s)}getFooter(){return 1===this.measureScale.value&&""===this.measureUnit?" ":hs.translateScenarioLabel("in",this.i18n)+" "+this.measureScale.prefix+this.measureUnit}sortScenariosbyVisualisationRules(t){const i=this;return[...t].sort(((t,s)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(s))).reverse()}setI18n(t){this.i18n=this.createI18n(t),this.updateTitle()}updateTitle(){var t;this.title=this.configTitle||hs.translateScenarioLabel(null===(t=this.configVariances)||void 0===t?void 0:t.toString(),this.i18n)}setSource(t){var i,s;if(this.state=su.DIRTY,this.queryError=void 0,this.fromExpr=_(this.db,this.tableName,t),this.fromExpr)try{const t=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(s=null===(i=t[0])||void 0===i?void 0:i.cnt)&&void 0!==s?s:0}catch(t){this.rowCount=0,this.failQuery(t)}else this.rowCount=0}getQueryError(){return this.queryError}failQuery(t){var i;null!==(i=this.queryError)&&void 0!==i||(this.queryError=ei(t))}getAllocatedCanvasWidth(){const t=this.position.getAxisEndPositionX(),i=3*this.styles.fontStyles.size,s=Math.max(this.axisCategoryArea.width,this.scenariosArea.width);return Math.max(t+i,s>0?s+this.position.leftSideLabelLength:0)}getAllocatedCanvasHeight(){if(null==this.smallestVarianceDataPointValue.value||null==this.highestVarianceDataPointValue.value||null==this.smallestDataPointValue.value||null==this.highestDataPointValue.value)return 0;const t=this.isVarianceChart()&&this.variancesDataModel.some((t=>t.type===eu.RELATIVE)),i=this.position.getAxisPositionY(t),s=this.position.spacings.labelToAxis+this.position.dataLabelHeight+this.styles.padding.bottom;let e;if(this.isOnSameAxisSide())e=i+s;else{const t=this.isVarianceChart()?this.smallestVarianceDataPointValue:this.smallestDataPointValue;e=i+Math.abs(t.getScaledUnit())+this.position.spacings.labelToColumn+this.position.dataLabelHeight+s}const n=this.isOnSameAxisSide();return Math.max(e,n?this.axisCategoryArea.height+this.scenariosArea.height:this.scenariosArea.height)}getUnitBarExtent(){var t,i;const s=this.isVarianceChart()&&this.variancesDataModel.some((t=>t.type===eu.RELATIVE)),e=this.isVarianceChart(),n=e?this.highestVarianceDataPointValue:this.highestDataPointValue,r=e?this.smallestVarianceDataPointValue:this.smallestDataPointValue;return yc({relativeVariance:s,maxPositive:null!==(t=null==n?void 0:n.value)&&void 0!==t?t:0,minNegative:this.isOnSameAxisSide()?0:null!==(i=null==r?void 0:r.value)&&void 0!==i?i:0})}getPercentBarExtent(){var t,i,s,e;return wc({relativeVariance:this.isVarianceChart()&&this.variancesDataModel.some((t=>t.type===eu.RELATIVE)),maxPositive:null!==(i=null===(t=this.highestVarianceDataPointValue)||void 0===t?void 0:t.value)&&void 0!==i?i:0,minNegative:this.isOnSameAxisSide()?0:null!==(e=null===(s=this.smallestVarianceDataPointValue)||void 0===s?void 0:s.value)&&void 0!==e?e:0})}layout(){const t=new ba;iu(t,(()=>this.draw(t)))}toString(){const t=new ba;return iu(t,(()=>this.draw(t))),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}applyFontToContainer(t){t.attr({"font-size":this.styles.fontStyles.size,"font-family":this.styles.fontStyles.family})}draw(t){this.cleanSVGforRedraw(t),this.applyFontToContainer(t),this.state===su.DIRTY&&(this.state=su.UP_TO_DATE),this.isVarianceChart()?(this.drawVarianceScenario(this.variancesDataModel,t),this.drawAxisAndLabels(this.variancesDataModel,t)):null!=this.stackConfig?this.determineEffectiveChartMode()===st.LINE?(this.drawStackedAreaScenarios(this.dataModel,t),this.drawAxisAndLabelsForLineChart(this.dataModel,t)):(this.drawStackedScenarios(this.dataModel,t),this.drawStackedHeaders(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t)):this.determineEffectiveChartMode()===st.LINE?(this.drawLineScenarios(this.dataModel,t),this.drawAxisAndLabelsForLineChart(this.dataModel,t)):(this.drawScenarios(this.dataModel,t),this.drawOverlayLayer(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t))}determineEffectiveChartMode(){return this.chartMode===st.LINE||this.chartMode===st.AUTO&&this.dataModel.length>this.maxBars?st.LINE:st.BAR}setPattern(t,i){this.styles.pattern.set(t,i)}hasNoData(){return 0===this.dataModel.length}isOnSameAxisSide(){return null!=this.smallestVarianceDataPointValue.value&&null!=this.highestVarianceDataPointValue.value&&null!=this.smallestDataPointValue.value&&null!=this.highestDataPointValue.value&&(this.isVarianceChart()?Math.sign(this.smallestVarianceDataPointValue.value)===Math.sign(this.highestVarianceDataPointValue.value)||0===this.smallestDataPointValue.value&&1===Math.sign(this.highestDataPointValue.value):Math.sign(this.smallestDataPointValue.value)===Math.sign(this.highestDataPointValue.value)||0===this.smallestDataPointValue.value&&1===Math.sign(this.highestDataPointValue.value))}createI18n(t){this.state=su.DIRTY;const i=new Map([["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"]]);return new Map([...i,...t])}createElementPosition(t){let i;const s=os(t.filter(((t,i)=>1===i||2===i)).map((t=>hs.translateScenarioLabel(t,this.i18n))).reduce(((t,i)=>t.length<i.length?i:t),""),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width,e=this.calculateTitleLength(this.leftSideOffsetForHorizontalSync);let n,r;if(i=s>e?s:e,null!=this.position&&(i+=this.position.spacings.labelToColumn),this.leftSideOffsetForHorizontalSync>-1&&(i=this.leftSideOffsetForHorizontalSync),this.isVarianceChart()?(n=this.smallestVarianceDataPointValue,r=this.highestVarianceDataPointValue):(n=this.smallestDataPointValue,r=this.highestDataPointValue),this.overflowConfig){const{cutHeight:t,overdriveZoneHeight:i,breakGap:s}=this.overflowConfig;r=new Nc(t+i+s,r.scenario,1,r.variance)}let o=this.styles.scaleFactors;const h=this.determineEffectiveChartMode();if(this.lineFullWidth&&this.availableWidth>0&&this.dataModel.length>0&&!this.isVarianceChart()&&h===st.LINE){const t=this.styles.fontStyles.size,s=this.styles.padding,e=this.styles.scaleFactors,n=this.availableWidth-(s.left+s.right+t*e.scenarioOffset+i+t*e.columnWidth);if(n>0){const i=Math.max(n/this.dataModel.length/t,1.2*e.columnWidth),s=new Ec;Object.assign(s,e),s.categoryWidth=i,o=s}}return new Tc(new Ac(this.styles.padding),o,this.styles.fontStyles,n,r,this.dataModel.length,i)}calculateTitleLength(t){let i="_______";i.length<this.title.length&&(i=this.title);const s=os(i,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width;return s<t?t:s}setAxisScenario(t){let i=Wc.AC1;if(null!=t&&t.length>0){const s=new ts(t.toString());s.isValid&&(i=s.delta)}return null===i&&(i=Wc.AC1),i}populateModel(t,i,s,e){if(0===this.rowCount||!this.fromExpr)return[];let n=this.queryDataSet(i,"","");return this.detectNaNCells(t,n),n=this.leftOuterJoinDates(n,i),this.createDataRows(n,t)}detectNaNCells(t,i){i.forEach((i=>(t.forEach((t=>{const s=new ts(t);!0===s.isValid?0!==i[s.base+"_cnt"]&&0!==i[s.delta+"_cnt"]||(i[t]=Number.NaN):0===i[t+"_cnt"]&&(i[t]=Number.NaN)})),i)))}findDateInterval(t){if(t!==tt.AUTO)return t;const i=this.queryDates();if(0===i.length)return tt.DAY;let s=i[0],e=i[0];for(const t of i)t<s&&(s=t),t>e&&(e=t);return(new nt).calculateDistanceType(s,e,this.intervalSpanLimit)}queryDates(){if(0===this.rowCount)return[];let t;try{t=this.db.exec(`SELECT DISTINCT [date] FROM ${this.fromExpr}`)}catch(t){return this.failQuery(t),[]}return t.map((t=>nu.coerceDateTime(t.date))).filter((t=>null!=t))}static coerceDateTime(t){if(null!=t){if("string"==typeof t){const i=y.fromISO(t,{zone:"utc"});return i.isValid?i:void 0}if("number"==typeof t){const i=y.fromMillis(t,{zone:"utc"});return i.isValid?i:void 0}return"boolean"==typeof t.isValid?t:void 0}}queryDataSet(t,i,s){const e=["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"],n=`normalizeDate([date], '${t}' , '${this.locale}') as calcdate`;let r;try{r=this.db.exec(`SELECT p.calcdate ${i},\n ${e.map((t=>`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`)).join(",")}\n\n FROM (SELECT ${n} ${i},\n ac1,\n ac2,\n ac3,\n ac4,\n pp1,\n pp2,\n pp3,\n pp4,\n fc1,\n fc2,\n fc3,\n fc4,\n pl1,\n pl2,\n pl3,\n pl4\n FROM ${this.fromExpr}) as p\n GROUP BY calcdate ${s}\n ORDER BY calcdate asc`)}catch(t){return this.failQuery(t),[]}return r}createDataRows(t,i){const s=[];return t.forEach(((t,e)=>{s.push({id:e,category:t.category,type:eu.NONE,date:t.calcdate,scenario1:new Nc(t[i[0]],i[0],this.pixelPerUnit,Wc.NEU),scenario2:new Nc(t[i[1]],i[1],this.pixelPerUnit,Wc.NEU),scenario3:new Nc(t[i[2]],i[2],this.pixelPerUnit,Wc.NEU),scenario4:new Nc(t[i[3]],i[3],this.pixelPerUnit,Wc.NEU)})})),s}findSmallestDataPointValue(t){const i=this.isVarianceChart()?this.pixelPerPercentage:this.pixelPerUnit;let s=new Nc(0,"default",i,Wc.NEU);for(const i of t)for(const t of[i.scenario1,i.scenario2,i.scenario3,i.scenario4])t&&null!=t.value&&t.value<Number(s.value)&&(s=t);return s}findHighestDataPointValue(t){const i=this.isVarianceChart()?this.pixelPerPercentage:this.pixelPerUnit;let s=new Nc(0,"default",i,Wc.NEU);for(const i of t)for(const t of[i.scenario1,i.scenario2,i.scenario3,i.scenario4])null!=t&&t.value>Number(s.value)&&(s=t);return s}populateVarianceModel(t,i){const s=[];if(null==t||0===t.length)return s;let e=null;null!=i&&i.length>0&&(e=i[0]);for(const n in t){const r=new ts(t[n]);if(r.isValid){const t=this.mapScenarios(r,e),n=r.direction,o="dr"===r.type?this.pixelPerPercentage:this.pixelPerUnit;for(const e in i)s.push({id:Number(e),category:i[e].category,type:"dr"===r.type?eu.RELATIVE:eu.ABSOLUTE,date:i[e].date,scenario1:new Nc(this.calculateVariance(r,i[e],t),r.delta,o,n),scenario2:new Nc(null,null,null,null),scenario3:new Nc(null,null,null,null),scenario4:new Nc(null,null,null,null)})}}return s}calculateVariance(t,i,s){const e=s.get(t.base),n=s.get(t.delta);return null==e||null==n||null==i[e].value||null==i[n].value?null:t.type===eu.RELATIVE?At(i[e].value-i[n].value,i[n].value):i[e].value-i[n].value}mapScenarios(t,i){const s=new Map;return null==i||["scenario1","scenario2","scenario3","scenario4"].forEach((e=>{i[e].scenario===t.delta?s.set(t.delta,e):i[e].scenario===t.base&&s.set(t.base,e)})),s}cleanSVGforRedraw(t){t.clear()}isVarianceChart(){return this.variancesDataModel&&this.variancesDataModel.length>0}createDateFactory(){const t=new nt;return t.setLocale(this.locale),t}dateLabelPlace(t){let i=t.scenario1.value<0,s=this.position.spacings.labelToAxis;if(null!=this.stackConfig&&!this.isVarianceChart()){const e=this.stackConfig.mode!==q.RELATIVE&&this.determineEffectiveChartMode()!==st.LINE?(this.position.spacings.labelToColumn+this.position.dataLabelHeight)/this.pixelPerUnit:0,n=this.stackGroups(t).filter((t=>t.hasValue)).map((t=>t.layout));let r=Mc(n,(()=>e));r.flipped&&e>0&&n.some((t=>t.total>=0))&&(r={flipped:!1,clearance:Math.max(...n.map((t=>t.negative+(t.total<0?e:0))))}),i=r.flipped,s+=r.clearance*this.pixelPerUnit}return i?{hookLocation:ll.Bottom,offset:-s}:{hookLocation:ll.Top,offset:s}}drawAxisAndLabels(t,i){const s=this.createDateFactory(),e=i.group().id("AxisAndDateLables");let n=!1;if(!1===this.hideAxisLabels)t.forEach(((t,i)=>{const{hookLocation:r,offset:o}=this.dateLabelPlace(t);t.type===eu.RELATIVE&&(n=!0);let h=s.getDateString(t.date,this.dateInterval);this.axisLabelsMode===it.SMART?(h=s.getSmartDateString(t.date,this.dateInterval),0===i&&this.dateInterval!==tt.YEAR&&(h=s.getShortDateString(t.date,this.dateInterval))):this.axisLabelsMode===it.SHORT&&(h=s.getShortDateString(t.date,this.dateInterval)),new cl(e,this.position.getColumnCenterPositionX(i),this.position.getAxisPositionY(n)+o,"",h,this.styles,r,ll.Center).forceStringTypeDraw()}));else{const i=null==t?void 0:t[0];i&&i.type===eu.RELATIVE&&(n=!0)}new jc({scenarioType:this.axisScenario,labelText:this.title,isRelative:n},this.position,e).draw();const r=e.bbox();this.axisCategoryArea={height:r.height,width:r.width}}drawScenarios(t,i){const s=i.group().id("Scenarios"),e=new Zc(this.position,s,this.styles,t.length,this.i18n);e.setOverflowConfig(this.overflowConfig);let n=!1;t.forEach(((t,i)=>{e.createPrimaryBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale),e.createSecondaryBar(t.scenario2,i).draw(),e.createPrimaryMarker(t.scenario3,i).draw(),e.createSecondaryMarker(t.scenario4,i).draw(),!1===t.scenario1.isEmpty()&&(n=!0)}));let r=0;!1===n&&(r=this.isOnSameAxisSide()?this.position.dataLabelHeight:2*this.position.dataLabelHeight);const o=s.bbox();this.scenariosArea={height:o.height+this.styles.padding.top+this.styles.padding.bottom+r,width:o.width+this.position.spacings.columnWidth}}drawLineScenarios(t,i){var s,e;const n=i.group().id("LineScenarios"),r=new fl,o=new Zc(this.position,n,this.styles,t.length,this.i18n);o.setCollisionManager(r);const h=["ac1","pp1","fc1","pl1"],a=[[],[],[],[]];t.forEach(((t,i)=>{["scenario1","scenario2","scenario3","scenario4"].forEach(((s,e)=>{t[s]&&a[e].push({dataPoint:t[s],index:i})}))}));const l=[];for(let t=0;t<a.length;t++){const i=a[t];if(i.length>0&&i.some((t=>!t.dataPoint.isEmpty()))){const n=(null===(e=null===(s=i[0])||void 0===s?void 0:s.dataPoint)||void 0===e?void 0:e.scenario)||h[t],r=n.slice(0,2).toLowerCase();l.push({points:i,scenarioName:n,scenarioType:r})}}l.sort(((t,i)=>(ul[i.scenarioType]||99)-(ul[t.scenarioType]||99)));const c=[];for(const t of l){const i=o.createLineSeries(t.points,t.scenarioName);c.push({series:i,scenarioType:t.scenarioType})}for(const t of c)t.series.drawGeometry();o.moveLabelsToFront();const u=[...c].sort(((t,i)=>(ul[t.scenarioType]||99)-(ul[i.scenarioType]||99)));for(const t of u)t.series.drawLabels(this.dataFormatDigits,this.measureScale);const d=this.position.getColumnPositionY(),f=n.bbox();this.scenariosArea={height:Math.max(f.height+this.styles.padding.top,d)+this.styles.padding.bottom,width:f.width+this.position.spacings.columnWidth}}drawAxisAndLabelsForLineChart(t,i){const s=this.createDateFactory(),e=i.group().id("AxisAndDateLabelsLine"),n=!1,r=t.length-1;!1===this.hideAxisLabels&&t.forEach(((i,o)=>{if(!this.shouldShowLineChartAxisLabel(t,o))return;const{hookLocation:h,offset:a}=this.dateLabelPlace(i);let l;this.lineFullWidth&&this.availableWidth>0?this.axisLabelsMode===it.SMART?(l=s.getSmartDateString(i.date,this.dateInterval),0===o&&this.dateInterval!==tt.YEAR&&(l=s.getShortDateString(i.date,this.dateInterval))):l=this.axisLabelsMode===it.SHORT?s.getShortDateString(i.date,this.dateInterval):s.getDateString(i.date,this.dateInterval):l=s.getShortDateString(i.date,this.dateInterval),new cl(e,this.position.getColumnCenterPositionX(o),this.position.getAxisPositionY(n)+a,"",l,this.styles,h,ll.Center).forceStringTypeDraw(),o>0&&o<r&&this.isYearChange(t,o)&&this.drawYearSeparatorLine(e,o,n)})),new jc({scenarioType:this.axisScenario,labelText:this.title,isRelative:n},this.position,e).draw();const o=e.bbox();this.axisCategoryArea={height:o.height,width:o.width}}shouldShowLineChartAxisLabel(t,i){return!!(this.lineFullWidth&&this.availableWidth>0)||(0===i||i===t.length-1||this.isYearChange(t,i))}isYearChange(t,i){var s,e;if(0===i)return!1;const n=null===(s=t[i])||void 0===s?void 0:s.date,r=null===(e=t[i-1])||void 0===e?void 0:e.date;return!(!n||!r)&&(this.dateInterval===tt.WEEK?n.weekYear!==r.weekYear:n.year!==r.year)}drawYearSeparatorLine(t,i,s){const e=this.position.getColumnCenterPositionX(i)-this.position.spacings.columnWidth/2,n=this.position.columnValue.max.getScaledUnit()+this.position.dataLabelHeight,r=this.position.getAxisPositionY(s)-n,o=this.position.getAxisPositionY(s);t.line([[e,r],[e,o]]).stroke({color:"#999999",width:1,dasharray:"4,4"}).attr("stroke-dasharray","4,4")}drawVarianceScenario(t,i){const s=i.group().id("Scenarios"),e=new Zc(this.position,s,this.styles,t.length,this.i18n);e.setOverflowConfig(this.overflowConfig),t.forEach(((t,i)=>{t.type===eu.RELATIVE?e.createRelativeVarianceBar(t.scenario1,i).draw():e.createVarianceBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale)}));const n=s.bbox();return this.scenariosArea={height:n.height+this.styles.padding.top+this.styles.padding.bottom,width:n.width+this.position.spacings.columnWidth},s}sortSegmentsByPropOrder(t){if(0===this.scenarioPropOrder.length)return;const i=this.scenarioPropOrder;t.sort(((t,s)=>{const e=i.indexOf(t.scenario),n=i.indexOf(s.scenario);return(-1===e?i.length:e)-(-1===n?i.length:n)}))}stackGroups(t){if(!this.stackConfig)return[];const i=this.stackConfig.by===X.SCENARIOS,s=this.determineEffectiveChartMode()===st.LINE,e=[];for(const n of i||s?["scenario1","scenario2","scenario3","scenario4"]:["scenario1"]){const i=t[n];i&&!i.isEmpty()&&null!=i.value&&e.push({value:i.value,scenario:i.scenario,dataPoint:i})}if(0===e.length)return[];const n=this.stackConfig.mode===q.RELATIVE?Ct:0,r=(t,i)=>({prefix:t,segments:i,layout:Sc(i.map((t=>t.value)),n),hasValue:i.some((t=>Number.isFinite(t.value)))});if(i&&this.sortSegmentsByPropOrder(e),s)return[r("",e)];if(i){const t=new Map;for(const i of e){const s=sl(i.scenario);t.has(s)||t.set(s,[]),t.get(s).push(i)}if(t.size>1){const i=[];for(const s of il)t.has(s)&&(i.push(r(s,t.get(s))),t.delete(s));for(const[s,e]of t)i.push(r(s,e));return i}}const o=t=>Number.isFinite(t.value)?t.value:0;return"asc"===this.stackConfig.order?e.sort(((t,i)=>o(t)-o(i))):"desc"===this.stackConfig.order&&e.sort(((t,i)=>o(i)-o(t))),[r("",e)]}drawStackedScenarios(t,i){if(!this.stackConfig)return;const s=i.group().id("StackedScenarios"),e=this.stackConfig.by===X.SCENARIOS;t.forEach(((t,i)=>{const n=this.stackGroups(t);n.forEach(((t,r)=>{let o=null;t.segments.forEach(((h,a)=>{const l=new Xc(this.position,this.styles,h.dataPoint,i,t.layout.segments[a],h.scenario,n.length>1?n.length-1-r:a,this.stackConfig.mode,t.layout,e,s);l.draw(this.dataFormatDigits,this.measureScale),o=l})),o&&t.hasValue&&o.drawTotalLabel(this.dataFormatDigits,this.measureScale)}))}));const n=s.bbox();this.scenariosArea={height:n.height+this.styles.padding.top+this.styles.padding.bottom,width:n.width+this.position.spacings.columnWidth}}drawStackedHeaders(t,i){if(!this.stackConfig||0===t.length)return;if(this.stackConfig.by!==X.SCENARIOS)return;const s=i.group().id("StackedHeaders"),e=this.stackGroups(t[0]);if(0===e.length)return;const n=this.position.getColumnPositionY(),r=this.position.getColumnCenterPositionX(0)-this.position.getColumnWidth()/2-this.position.spacings.labelToColumn,o=(t,i)=>{new cl(s,r,t,"STACK_HEADER",i,this.styles,ll.Center,ll.Right).forceStringTypeDraw()};if(e.length>1)return void e.forEach(((t,i)=>{const{positive:s,negative:r,total:h}=t.layout;o(n-(i===e.length-1?(s-r)/2:h<0?0-r:s)*t.segments[0].dataPoint.pixelPerUnit,this.i18n.get(t.prefix+"1")||t.prefix.toUpperCase())}));const[h]=e;h.segments.forEach(((t,i)=>{const{start:s,end:e}=h.layout.segments[i];o(n-(s+e)/2*t.dataPoint.pixelPerUnit,this.i18n.get(t.scenario)||t.scenario)}))}drawStackedAreaScenarios(t,i){if(!this.stackConfig)return;const s=i.group().id("StackedAreaScenarios"),e=this.stackConfig.by===X.SCENARIOS,n=this.stackConfig.mode,r=["scenario1","scenario2","scenario3","scenario4"];if(0===(e?r.filter((i=>t.some((t=>t[i]&&!t[i].isEmpty())))).length:1))return;const o=[],h=[];for(const i of r)t.some((t=>t[i]&&!t[i].isEmpty()))&&h.push(i);if(e&&this.scenarioPropOrder.length>0){const i=this.scenarioPropOrder;h.sort(((s,e)=>{var n,r,o,h;const a=i.indexOf(null!==(r=null===(n=t[0][s])||void 0===n?void 0:n.scenario)&&void 0!==r?r:""),l=i.indexOf(null!==(h=null===(o=t[0][e])||void 0===o?void 0:o.scenario)&&void 0!==h?h:"");return(-1===a?i.length:a)-(-1===l?i.length:l)}))}for(const i of h){const s=t[0][i];o.push((null==s?void 0:s.scenario)||"ac1")}const a=(t,i)=>{const s=t[i];return s&&!s.isEmpty()&&Number.isFinite(s.value)?s.value:0},l=h.map((i=>t.reduce(((t,s)=>t+a(s,i)),0)<0?-0:0)),c=n===q.RELATIVE?Ct:0,u=t.map((t=>Sc(h.map(((i,s)=>a(t,i)||l[s])),c))),d=this.position.getColumnPositionY(),f=this.pixelPerUnit,p=(t,i)=>u.map(((s,e)=>({x:this.position.getColumnCenterPositionX(e),y:d-s.segments[t][i]*f})));for(let t=0;t<h.length;t++){const i=p(t,"end"),n=p(t,"start"),r=new Kc(s,i,n,e?o[t]:null,t,e);r.draw(),r.drawBoundaryLine()}const v=s.bbox();this.scenariosArea={height:v.height+this.styles.padding.top+this.styles.padding.bottom,width:v.width+this.position.spacings.columnWidth}}drawOverlayLayer(t,i){if(0===t.length)return;const s=i.group().id("Overlay"),e=new Zc(this.position,s,this.styles,t.length,this.i18n);if(!0===this.showOverlayAvg){let i=null;const s=function(t){const i=ru(t),s=i.length>0?i.reduce(((t,i)=>t+i),0)/i.length:NaN,e=Object.assign(Object.assign({},t[0]),{scenario1:new Nc(s,t[0].scenario1.scenario,t[0].scenario1.pixelPerUnit,t[0].scenario1.variance)}),n=Object.assign(Object.assign({},t[t.length-1]),{scenario1:new Nc(s,t[t.length-1].scenario1.scenario,t[t.length-1].scenario1.pixelPerUnit,t[t.length-1].scenario1.variance)});return[e,...t.map((t=>Object.assign(Object.assign({},t),{scenario1:new Nc(s,t.scenario1.scenario,t.scenario1.pixelPerUnit,t.scenario1.variance)}))),n]}(t);s.forEach(((t,s)=>{null!=i&&e.createLine(`Ø ${this.i18n.get(t.scenario1.scenario)||t.scenario1.scenario}`,t.scenario1,i,s-1).draw(this.dataFormatDigits,this.measureScale),i=t.scenario1}))}if(!0===this.showOverlayMedian){let i=null;const s=function(t){const i=ru(t).sort(((t,i)=>t-i)),s=i.length%2==0?(i[i.length/2-1]+i[i.length/2])/2:i[Math.floor(i.length/2)],e=Object.assign(Object.assign({},t[0]),{scenario1:new Nc(s,t[0].scenario1.scenario,t[0].scenario1.pixelPerUnit,t[0].scenario1.variance)}),n=Object.assign(Object.assign({},t[t.length-1]),{scenario1:new Nc(s,t[t.length-1].scenario1.scenario,t[t.length-1].scenario1.pixelPerUnit,t[t.length-1].scenario1.variance)});return[e,...t.map((t=>Object.assign(Object.assign({},t),{scenario1:new Nc(s,t.scenario1.scenario,t.scenario1.pixelPerUnit,t.scenario1.variance)}))),n]}(t);s.forEach(((t,s)=>{null!=i&&e.createLine(`Mdn ${this.i18n.get(t.scenario1.scenario)||t.scenario1.scenario}`,t.scenario1,i,s-1).draw(this.dataFormatDigits,this.measureScale),i=t.scenario1}))}}leftOuterJoinDates(t,i){const s=t.map((t=>t.calcdate)).filter((t=>null!=t&&"boolean"==typeof t.isValid&&t.isValid));if(0===s.length)return t;const e=y.max(...s),n=y.min(...s),r=new nt;if(r.countBetween(n,e,i)>1e4)return t;const o=r.datesBetween(n,e,i),h=new Map;return o.forEach(((t,i)=>{h.set(t.toISO(),{id:i,calcdate:t,category:null,ac1:null,ac2:null,ac3:null,ac4:null,pp1:null,pp2:null,pp3:null,pp4:null,fc1:null,fc2:null,fc3:null,fc4:null,pl1:null,pl2:null,pl3:null,pl4:null,isEmpty:!0})})),t.forEach((t=>{const i=t.calcdate.toISO(),s=h.get(i);s&&s.isEmpty&&h.set(i,{id:s.id,calcdate:t.calcdate,category:t.category,ac1:t.ac1,ac2:t.ac2,ac3:t.ac3,ac4:t.ac4,pp1:t.pp1,pp2:t.pp2,pp3:t.pp3,pp4:t.pp4,fc1:t.fc1,fc2:t.fc2,fc3:t.fc3,fc4:t.fc4,pl1:t.pl1,pl2:t.pl2,pl3:t.pl3,pl4:t.pl4,isEmpty:!1})})),Array.from(h.values())}}function ru(t){return t.map((t=>{var i;return null===(i=t.scenario1)||void 0===i?void 0:i.value})).filter((t=>Number.isFinite(t)))}class ou{constructor(t,i){this.data=t,this.scenarios=i,this.variances=[],this.title="",this.hideAxisLabels=!1,this.pixelPerUnit=10,this.pixelPerPercentage=50,this.limit=0,this.sortOrder=new Lt(new Ql).default(),this.level=z.CATEGORY,this.leftSideOffsetForHorizontalSync=-1,this.dateInterval=tt.AUTO,this.axisLabelsMode=it.SMART,this.intervalSpanLimit=28,this.filter="",this.measureScale=new al,this.measureUnit="",this.showMeasureScale=!0,this.dataFormatDigits={decimal:1,percent:2},this.showOverlayMedian=!0,this.showOverlayAvg=!0,this.chartMode=st.BAR,this.maxBars=28,this.stackConfig=null,this.lineFullWidth=!0,this.locale="de"}}class hu{constructor(t,i,s,e,n,r,o){this.dataRowAdapter=t,this.orderAdapter=i,this.stringAdapter=s,this.dataFormatDigitsAdapter=e,this.db=n,this.fromExpr=r,this.onQueryError=o}adapt(t){const i=Et.adaptArray(t.data,this.dataRowAdapter),s=Et.adaptArray(t.scenarios,this.stringAdapter),e=new ou(i,s);return E.isArray(t.variances)&&(e.variances=Et.adaptArray(t.variances,this.stringAdapter)),E.isString(t.title)&&(e.title=t.title),E.isBoolean(t.hideAxisLabels)&&(e.hideAxisLabels=t.hideAxisLabels),E.isNumber(t.pixelPerUnit)&&(e.pixelPerUnit=t.pixelPerUnit),E.isNumber(t.pixelPerPercentage)&&(e.pixelPerPercentage=t.pixelPerPercentage),E.isNumber(t.limit)&&(e.limit=t.limit),E.isExisting(t.sortOrder)&&(e.sortOrder=this.orderAdapter.adapt(t.sortOrder)),E.isExisting(t.level)&&(e.level=t.level),E.isExisting(t.dateInterval)&&(e.dateInterval=t.dateInterval),E.isExisting(t.axisLabelsMode)&&(e.axisLabelsMode=t.axisLabelsMode),E.isNumber(t.leftSideOffsetForHorizontalSync)&&(e.leftSideOffsetForHorizontalSync=t.leftSideOffsetForHorizontalSync),E.isNumber(t.intervalSpanLimit)&&(e.intervalSpanLimit=t.intervalSpanLimit),E.isString(t.filter)&&(e.filter=t.filter),E.isExisting(t.measureScale)&&(e.measureScale=Kl.calculateMeasureScale(this.db,this.fromExpr,e.scenarios,t.measureScale,this.onQueryError)),E.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),E.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),E.isExisting(t.dataFormatDigits)&&(e.dataFormatDigits=this.dataFormatDigitsAdapter.adapt(t.dataFormatDigits)),E.isBoolean(t.showOverlayAvg)&&(e.showOverlayAvg=t.showOverlayAvg),E.isBoolean(t.showOverlayMedian)&&(e.showOverlayMedian=t.showOverlayMedian),E.isExisting(t.chartMode)&&(e.chartMode=t.chartMode),E.isNumber(t.maxBars)&&(e.maxBars=t.maxBars),E.isExisting(t.stackConfig)&&(e.stackConfig=t.stackConfig),E.isBoolean(t.lineFullWidth)&&(e.lineFullWidth=t.lineFullWidth),E.isString(t.locale)&&(e.locale=t.locale),e}default(){return new ou([],[])}}const au=class{constructor(i){t(this,i),this.tableName="",this.dataVersion=0,this.scenarios=[],this.variances=[],this.hideAxisLabels=!1,this.pixelPerUnit=2,this.pixelPerPercentage=50,this.limit=0,this.leftSideOffsetForHorizontalSync=-1,this.i18n=new Map,this.order={hierarchy:[],direction:F.ASC},this.level=z.CATEGORY,this.dateInterval=tt.AUTO,this.intervalSpanLimit=28,this.axisLabelsMode=it.SMART,this.filter="",this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.showOverlayMedian=!1,this.showOverlayAvg=!1,this.chartMode=st.BAR,this.maxBars=28,this.stackConfig=null,this.lineFullWidth=!0,this.containerWidth=0,this.dataFormatDigits={percent:2,decimal:1},this.parentDimensions={width:0,height:0},a(this)}getDb(){return this.stores||(this.stores=u(this.element)),this.stores.db.db}render(){var t,e,n,r;if(void 0===this.chart||void 0!==this.queryError)return i(s,null);if(this.chart.hasNoData()){const e=null!==(t=this.i18n.get("no-data"))&&void 0!==t?t:"No Data";return i(s,{class:"no-data"},i("div",{class:"empty-state"},e))}return i(s,null,i("div",{innerHTML:null===(e=this.pattern)||void 0===e?void 0:e.toString(),class:"hidePatternContainer"}),i("div",{class:this.showMeasureScale?"footer":"footer-hide"},null===(n=this.chart)||void 0===n?void 0:n.getFooter()),i("div",{innerHTML:null===(r=this.chart)||void 0===r?void 0:r.toString()}))}syncQueryError(){var t,i;this.queryError=null!==(t=this.measureScaleError)&&void 0!==t?t:null===(i=this.chart)||void 0===i?void 0:i.getQueryError(),ni(this.errors,this.queryError)}async componentWillLoad(){var t;const i=this.prepareConfig(),s=this.prepareStyle(),e=this.containerWidth||0;this.chart=new nu(new Ge(this.ruleSetConfig),this.getDb(),this.tableName,i,s,e),this.chart.setI18n(this.i18n);const n=i.pixelPerUnit<=0;this.autoFitScaling(i,s),this.chart.setAvailableHeight(n?0:(null===(t=this.parentDimensions)||void 0===t?void 0:t.height)||0),this.pattern=new Pc(this.chart.styles),this.chart.setPattern("hatched",this.pattern.getFCPolygonPattern()),this.syncQueryError()}async componentWillUpdate(){var t;if(null==this.chart)return;const i=this.prepareConfig(),s=this.prepareStyle();this.chart.setI18n(this.i18n),this.chart.setStyles(s),this.chart.setAvailableWidth(this.containerWidth||0),this.chart.setRuleSet(new Ge(this.ruleSetConfig)),this.chart.setConfig(i);const e=i.pixelPerUnit<=0;this.autoFitScaling(i,s),this.chart.setAvailableHeight(e?0:(null===(t=this.parentDimensions)||void 0===t?void 0:t.height)||0),this.pattern=new Pc(this.chart.styles),this.chart.setPattern("hatched",this.pattern.getFCPolygonPattern()),this.syncQueryError()}autoFitScaling(t,i){var s;const e=t.pixelPerUnit<=0,n=t.pixelPerPercentage<=0;if(!e&&!n)return;const r=()=>{var i;null===(i=this.reportAutoScaling)||void 0===i||i.call(this,{unit:e?t.pixelPerUnit:void 0,percentage:n?t.pixelPerPercentage:void 0})},o=null===(s=this.parentDimensions)||void 0===s?void 0:s.height,h=this.containerWidth||0,a=()=>{this.chart=new nu(new Ge(this.ruleSetConfig),this.getDb(),this.tableName,t,i,h),this.chart.setI18n(this.i18n)},l=()=>(this.chart.layout(),this.chart.getAllocatedCanvasHeight());if(!o||o<=0)return e&&(t.pixelPerUnit=1),n&&(t.pixelPerPercentage=50),a(),void r();e&&(t.pixelPerUnit=1),n&&(t.pixelPerPercentage=1),a();let c=l();if(c<=0)return void r();const u=Math.max(bc,.9*o/c);let d=!1,f=!1,p=null;for(let i=0;i<=3;i++){const i=xc({target:o,measured:c,unitExtent:e?this.chart.getUnitBarExtent():0,pctExtent:n?this.chart.getPercentBarExtent():0,currentPpu:t.pixelPerUnit,currentPpp:t.pixelPerPercentage});if(void 0===i.ppu&&void 0===i.ppp)break;if(e&&void 0!==i.ppu&&(t.pixelPerUnit=i.ppu,d=!0),n&&void 0!==i.ppp&&(t.pixelPerPercentage=i.ppp,f=!0),a(),c=l(),c<=o+.5&&(p={ppu:t.pixelPerUnit,ppp:t.pixelPerPercentage},c>=.98*o))break}let v=!1;if(e&&!d&&(t.pixelPerUnit=u,v=!0),n&&!f&&(t.pixelPerPercentage=u,v=!0),c>o+.5){if(p)d&&(t.pixelPerUnit=p.ppu),f&&(t.pixelPerPercentage=p.ppp);else{const i=o/c;e&&(t.pixelPerUnit=Math.max(bc,t.pixelPerUnit*i)),n&&(t.pixelPerPercentage=Math.max(bc,t.pixelPerPercentage*i))}v=!0}v&&a(),r()}async componentWillRender(){}componentDidLoad(){}componentDidUpdate(){}prepareConfig(){var t,i,s;const e=this.getDb(),n=_(e,this.tableName,this.filter);return this.measureScaleError=void 0,new hu(new Uc,new Lt(new Ql),new Ql,new Oc,e,n,(t=>{this.measureScaleError=ei(t)})).adapt({scenarios:this.scenarios,variances:this.variances,title:this.chartTitle,hideAxisLabels:this.hideAxisLabels,pixelPerUnit:this.pixelPerUnit,pixelPerPercentage:this.pixelPerPercentage,level:this.level,dateInterval:this.dateInterval,axisLabelsMode:this.axisLabelsMode,limit:this.limit,sortOrder:this.order,leftSideOffsetForHorizontalSync:this.leftSideOffsetForHorizontalSync,intervalSpanLimit:this.intervalSpanLimit,filter:this.filter,measureScale:this.measureScale,measureUnit:this.measureUnit,showMeasureScale:this.showMeasureScale,dataFormatDigits:this.dataFormatDigits,showOverlayMedian:this.showOverlayMedian,showOverlayAvg:this.showOverlayAvg,chartMode:this.chartMode,maxBars:this.maxBars,stackConfig:this.stackConfig,lineFullWidth:this.lineFullWidth,locale:(null===(s=null===(i=null===(t=this.stores)||void 0===t?void 0:t.context)||void 0===i?void 0:i.state)||void 0===s?void 0:s.locale)||"de"})}prepareStyle(){var t,i;const s=new Fc(new Lc,new Ie,new qe(new Xe),new Al(new Xe),new Be).adapt(this.styles);return s.locale=(null===(i=null===(t=u(this.element).context)||void 0===t?void 0:t.state)||void 0===i?void 0:i.locale)||"de",s}get element(){return e(this)}};au.style=':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{position:relative;display:inline-block}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-default{stroke:black;stroke-width:0.1em}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}.hide{opacity:0}.footer{margin:0.2em;font-size:0.6em}.footer-hide{display:none}svg#drawCanvas{display:block}';const lu=/[\s\u200e\u200f\u061c]*[%\u066a][\s\u200e\u200f\u061c]*/;class cu{constructor(t,i,s,e,n,r,o,h,a){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=i,this.value=s,this.prefix=r||"",this.cssStyle=e||"",this.prefixStyle=o||"prefix",this.type=n,this.mark=void 0,this.colSpan=h||1,this.measureScale=a||1}getAsHeaderList(){if(null==this.value)return[""];const t=[];for(const i of this.value.toString().split("<br/>"))t.push(i);return t}draw(t,i){let s=this.value;if("undefined"===s||void 0===s||null==s)return"";if(Number.isNaN(Number(s)))return s;if(""===this.type||void 0===this.type||null==this.type)return s;let e=t.percent,n=t.percent;return"percentpoint"===this.type?hs.number(Number(s),"percent",e,n,1,i).replace(lu,""):("decimal"===this.type&&(s=+s/this.measureScale,e=t.decimal,n=t.decimal),hs.number(Number(s),this.type,e,n,1,i))}drawPrefix(){return null==this.prefix?"":this.prefix}}class uu{constructor(t,i,s){this.index=t,this.groupindex=i,this.type=s,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case ye.HEADER:return"groupheader";case ye.SEPERATORLINE:return"";case ye.DRILLELEMENT:return"ofit";case ye.PARTELEMENT:return"partof";case ye.STANDARD:return"";case ye.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,i,s,e,n,r,o,h,a,l=!1,c,u=1,d){let f=r;"category"===i&&null!=h&&(f=`category-${h.toString()}`),this.type===ye.HEADER?f="headerlabel":this.type===ye.SEPERATORLINE&&(f=i),this.type===ye.PARTELEMENT&&("percent"===e&&(t="-"),"category"!==i&&"operation"!==i&&(e="percent",f="")),("-"===t||t===Tt&&"percent"===e)&&(f="");let p="prefix-first";o&&(p="prefix-second"),s&&(f=`${f} ${s}`);const v=new cu(i,this.elements.length,t,f,e,n,p,u,a);v.isBarChart=l,v.columnStats=c,v.waterfall=d,this.elements.push(v)}}const du=.85;function fu(t,i){return Math.max(0,(t-.5)*i)}function pu(t,i){return Math.max(1,(t?1:0)+(i?1:0))}function vu(t,i,s,e){const n=fu(t,i),r=pu(s,e),o=Math.min(2.85*i,n/(2*r)),h=(n-o*r)/r,a=Math.min(.3*i,.2*h),l=.15*h;return{totalWidth:n,labelAreaWidth:o,maxBarWidth:h,axisX:s?o+h:0,breakGap:a,overdriveZoneWidth:l,cutWidth:Math.max(0,h-a-l),labelGap:.3*i}}function gu(t,i,s,e){const n=fu(t,i),r=pu(s,e),o=Math.min(3.375*i,n/2),h=n-o,a=h/r,l=Math.min(.375*i,.2*a);return{totalWidth:n,labelAreaWidth:o,maxPinLength:Math.max(0,a-l),pinPadding:l,axisX:s?a:0,labelX:h+.3*i}}const mu={positive:{stroke:"#008f96",fill:"#008f96",fillpattern:"solid"},negative:{stroke:"#ff0000",fill:"#ff0000",fillpattern:"solid"},neutral:{stroke:"#808080",fill:"#808080",fillpattern:"outlined"},scenarios:{ac:{stroke:"#404040",fill:"#404040",fillpattern:"solid"},pp:{stroke:"#A6A6A6",fill:"#A6A6A6",fillpattern:"solid"},fc:{stroke:"#404040",fill:"#ffffff",fillpattern:"hatched"},pl:{stroke:"#404040",fill:"#ffffff",fillpattern:"outlined"}},fontColor:"#000000",fontSize:11.333305,emPx:13.3333,fontFamily:"'Noto Sans', sans-serif",unitScaling:.01,percentageScaling:.5,scaleFactor:1},bu="#666666";function yu(t,i){return`pattern-${t}-${i.replace("#","")}`}const wu=({styles:t})=>{const s=t.scaleFactor,e=6*s,n=[{id:yu("pos",t.positive.stroke),stroke:t.positive.stroke,fill:t.positive.fill},{id:yu("neg",t.negative.stroke),stroke:t.negative.stroke,fill:t.negative.fill},{id:yu("neu",t.neutral.stroke),stroke:t.neutral.stroke,fill:t.neutral.fill},...["ac","pp","fc","pl"].map((i=>({id:yu(i,t.scenarios[i].stroke),stroke:t.scenarios[i].stroke,fill:t.scenarios[i].fill})))];return i("defs",null,n.map((t=>i("pattern",{id:t.id,patternUnits:"userSpaceOnUse",width:e,height:e},i("rect",{width:e,height:e,fill:"#ffffff"}),i("line",{x1:"0",y1:e,x2:e,y2:"0",stroke:t.stroke,"stroke-width":1.5*s})))))};function xu(t,i,s=1,e,n=0){const r=t>=0?"+":"";if(i){const i=i=>r+hs.number(t,"percent",i,i,1,e);let s=Math.min(20,Math.max(0,Math.trunc(n)||0));for(;s>0&&i(s).length>7;)s--;return i(s)}const o=t/s,h=Math.abs(o);let a=1,l="";return h>=9995e5?(a=1e9,l="B"):h>=999500?(a=1e6,l="M"):h>=999.5&&(a=1e3,l="K"),r+hs.number(o/a,"decimal",h>=10*a?0:1,0,1,e)+l}function Su(t){const i=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(i)}function $u(t){const i=t.slice(0,2).toLowerCase();return"pp"===i?"pp":"fc"===i?"fc":"pl"===i?"pl":"ac"}function Mu(t,i,s,e){return Su(t)?function(t,i){const s=$u(t);return i.scenarios[s]}(t,e):function(t,i,s){const e=t>=0;return i?e?s.positive:s.negative:e?s.negative:s.positive}(i,s,e)}function _u(t,i){const s=t.fillpattern;return"hatched"===s?`url(#${yu(i,t.stroke)})`:"outlined"===s?"transparent":t.fill}function Ru(t){return"outlined"===t.fillpattern?{stroke:t.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0}}const Ou=t=>{const{value:s,scenario:e,columnStats:n,height:r,isPositiveGood:o,formattedValue:h,measureScale:a,locale:l,columnWidthEm:c=10,styles:u=mu}=t,d=u.scaleFactor,f=u.fontSize,p=n.min<0,v=n.max>0,{totalWidth:g,axisX:m,breakGap:b,overdriveZoneWidth:y,cutWidth:w,labelGap:x}=vu(c,u.emPx,p,v),S=Math.abs(s)*u.unitScaling*f,$=S-w>1e-6,M=Math.max(0,n.absMax*u.unitScaling*f-w),_=Math.max(0,S-w),R=M>0?_/M*y:0,O=2*d,k=r-2*O,E=O,L=s>=0,T=Mu(e,s,o,u),A=_u(T,Su(e)?$u(e):o?L?"pos":"neg":L?"neg":"pos"),{stroke:C,strokeWidth:P}=Ru(T),N=h||xu(s,!1,a,l),D=$?w:S,U=$?w+b+R:S,z=L?m+U+x:m-U-x,F=L?"start":"end";return i("svg",{width:g,height:r,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},i(wu,{styles:u}),i("line",{x1:m,y1:0,x2:m,y2:r,stroke:bu,"stroke-width":1*d}),D>0&&i("rect",{x:L?m:m-D,y:E,width:D,height:k,fill:A,stroke:C,"stroke-width":P*d}),$&&R>0&&i("rect",{x:L?m+w+b:m-w-b-R,y:E,width:R,height:k,fill:A,stroke:C,"stroke-width":P*d}),$&&function(t,s,e,n,r){const o=t+s/2,h=.35*s,a=n/3,l=.3*s;let c=`M ${o-h} ${e}`;for(let t=0;t<3;t++)c+=` L ${o-h-l} ${e+a*(t+.5)} L ${o-h} ${e+a*(t+1)}`;let u=`M ${o+h} ${e}`;for(let t=0;t<3;t++)u+=` L ${o+h+l} ${e+a*(t+.5)} L ${o+h} ${e+a*(t+1)}`;return[i("rect",{x:t,y:e-1,width:s,height:n+2,fill:"#ffffff"}),i("path",{d:c,fill:"none",stroke:"#000000","stroke-width":1*r}),i("path",{d:u,fill:"none",stroke:"#000000","stroke-width":1*r})]}(L?m+w:m-w-b,b,E,k,d),i("text",{x:z,y:r/2,dy:"0.35em","text-anchor":F,fill:u.fontColor,"font-size":f,"font-family":u.fontFamily},N))},ku=t=>{const{value:s,scenario:e,columnStats:n,height:r,isPositiveGood:o,formattedValue:h,measureScale:a,locale:l,percentDigits:c,columnWidthEm:u=10,styles:d=mu}=t,f=d.scaleFactor,p=d.fontSize,v=n.min<0,g=n.max>0,{totalWidth:m,maxPinLength:b,axisX:y,labelX:w}=gu(u,d.emPx,v,g),x=r/2,S=100*Math.abs(s)*d.percentageScaling*p,$=S>b,M=Math.min(S,b),_=s>=0,R=_?y+M:y-M,O=Mu(e,s,o,d),k=3*f,E=h||xu(s,!0,a,l,c);return i("svg",{width:m,height:r,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},i("line",{x1:y,y1:0,x2:y,y2:r,stroke:bu,"stroke-width":1*f}),!$&&i("circle",{cx:R,cy:x,r:k,fill:d.fontColor}),i("line",{x1:y,y1:x,x2:R,y2:x,stroke:O.fill,"stroke-width":2*f}),$&&_&&i("polygon",{points:`${y+b},${x} ${y+b-6*f},${x-3*f} ${y+b-6*f},${x+3*f}`,fill:O.fill}),$&&!_&&i("polygon",{points:`${y-b},${x} ${y-b+6*f},${x-3*f} ${y-b+6*f},${x+3*f}`,fill:O.fill}),i("text",{x:w,y:r/2,dy:"0.35em","text-anchor":"start",fill:d.fontColor,"font-size":p,"font-style":"italic","font-family":d.fontFamily},E))},Eu=t=>{const{value:s,columnStats:e,isRelative:n,styles:r=mu}=t;return null==s||isNaN(s)||!e||0===e.absMax?i("span",{class:"bar-chart-empty",style:{color:r.fontColor,fontStyle:"italic"}},"-"):i(n?ku:Ou,Object.assign({},t))},Lu=t=>{const{value:s,scenario:e,height:n,measureScale:r,locale:o,columnWidthEm:h=10,styles:a=mu,waterfall:l}=t,c=a.scaleFactor,u=a.fontSize,d=l.max-l.min;if(null==s||isNaN(s)||d<=0)return i("span",{class:"bar-chart-empty",style:{color:a.fontColor,fontStyle:"italic"}},"-");const{totalWidth:f,labelAreaWidth:p,barAreaWidth:v,labelGap:g}=function(t,i){const s=fu(t,i),e=Math.min(2.85*i,s/4);return{totalWidth:s,labelAreaWidth:e,barAreaWidth:s-2*e,labelGap:.3*i}}(h,a.emPx),m=v/d,b=t=>p+(t-l.min)*m,y=2*c,w=n-2*y,x=y,S=b(0),$=b(l.start),M=b(l.end),_=Math.min($,M),R=Math.abs(M-$),O=Mu(e,s,!1,a),k=_u(O,$u(e)),{stroke:E,strokeWidth:L}=Ru(O),T=xu(s,"partof"===l.kind,r,o).replace(/^\+/,""),A=M<$,C=A?_-g:_+R+g,P=A?"end":"start";return i("svg",{width:f,height:n,class:"cell-bar-chart waterfall-bar",style:{overflow:"visible"}},i(wu,{styles:a}),i("line",{x1:S,y1:0,x2:S,y2:n,stroke:bu,"stroke-width":1*c}),void 0!==l.parentStart&&void 0!==l.parentEnd&&i("line",{x1:b(l.parentStart),y1:0,x2:b(l.parentStart),y2:n,stroke:bu,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),void 0!==l.parentStart&&void 0!==l.parentEnd&&i("line",{x1:b(l.parentEnd),y1:0,x2:b(l.parentEnd),y2:n,stroke:bu,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),R>0&&i("rect",{x:_,y:x,width:R,height:w,fill:k,stroke:E,"stroke-width":L*c}),i("text",{x:C,y:n/2,dy:"0.35em","text-anchor":P,fill:a.fontColor,"font-size":u,"font-family":a.fontFamily},T))},Tu=`IFNULL(${is.ROWGROUP}, '')`;class Au{constructor(t){this.groups=[is.CATEGORY,is.CATEGORYINDEX],me.OPT!==t.type&&me.OPTNOTOTAL!==t.type||this.groups.unshift(is.OPERATION),t.grouped&&(this.groups.push(is.ROWGROUP),this.groups.push(is.ROWGROUPINDEX))}toString(){return this.groups.map((t=>t===is.ROWGROUP?Tu:t)).toString()}select(){return this.groups.map((t=>t===is.ROWGROUP?`${Tu} as ${t}`:t)).toString()}noCategory(){return this.groups.filter((t=>t!==is.CATEGORY))}toArray(){return this.groups}}class Cu{constructor(t,i){this.hasPartOf=!1,this.params=[],this.hasBlankRowGroup=!1,this.config=t,this.i18n=i}execute(t,i){var s;this.db=t,this.fromExpr=i;for(const t of[...this.config.scenarios,...this.config.categoryThereOf.keys()])if(!Pt.test(t))throw new Error(`invalid identifier "${t}"`);const e=[],n=[],r=[],o=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),h=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),a=this.getRelativeScenarios(),l=this.config.attributes.map((t=>this.translateAttributeSQL(t))).toString(),c=new Au(this.config);let u=["",""];this.config.sortOrder.hierarchy.length>0&&(u=this.createOrderString(this.config.sortOrder)),this.hasPartOf=this.checkConfigForPartOf();const{hierarchy:d,direction:f}=this.config.sortOrder,p=d.filter((t=>t===is.ROWGROUP||t===is.ROWGROUPINDEX||t.toUpperCase()in Nt)),v=p.filter((t=>t.toUpperCase()in Nt)).map((t=>`, SUM(${t} * transformOperator(operation)) as ${t}`)).join(""),g=p.length>0?p.map((t=>`${t} ${f}`)).toString():`${is.ROWGROUPINDEX} asc`,m=t.exec(`SELECT COUNT(DISTINCT ${is.CATEGORY}) as ${is.TOTALROWCOUNT} ${this.config.grouped?`, ${Tu} as ${is.ROWGROUP}, FIRST(${is.ROWGROUPINDEX}) as ${is.ROWGROUPINDEX}${v}`:""}\n FROM ${i} ${this.config.grouped?`GROUP BY ${Tu} ORDER BY ${g}`:""}`);return 0===m.length||1===m.length&&0===(null!==(s=m[0][is.TOTALROWCOUNT])&&void 0!==s?s:0)&&!this.config.grouped?[]:(this.hasBlankRowGroup=this.config.grouped&&m.some((t=>""===t.rowGroup)),m.forEach((t=>{const i=this.config.grouped?""===t.rowGroup?`WHERE (${is.ROWGROUP} IS NULL OR ${is.ROWGROUP} = '')`:`WHERE ${is.ROWGROUP} = ${this.bind(t.rowGroup)}`:"";let s="";this.config.limit&&(s=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,e),this.createDataRow(e,t,c,o,l,i,u,s),this.createRestRow(t,e,c,o,i,u),this.createGroupSumRow(e,n,t,h,i,u)})),this.createTotalSumRow(e,n,h),e.forEach((t=>r.push(this.exec(t)))),this.detectNaNCells(this.config.scenarios,r),this.createThereOfDrillRows(o,l,u,r),this.createPartOfDrillRows(o,u,n,r),this.createIntervalColumns(r),this.createThereOfDrillColumns(this.config.categoryThereOf,r),this.calculateColumnGroupRest(r,this.config.categoryThereOf),this.calculateRelativeVariances(r,a),r)}detectNaNCells(t,i){i.forEach((i=>{i.map((i=>(t.forEach((t=>{const s=new ts(t);!0===s.isValid?0!==i[s.base+"_cnt"]&&0!==i[s.delta+"_cnt"]||(i[t]=Number.NaN):0===i[t+"_cnt"]&&(i[t]=Number.NaN)})),i)))}))}createPartOfDrillRows(t,i,s,e){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===me.LIST)return;const n=this.createPartOfQuery(t,i);let r=[];const o=this.db,h=this.params;n.forEach((t=>{r.push(...this.exec(t))}));const a=this.exctractScenarioNames(t),l=[];s.forEach((function(t){l.push(...o.exec(t,h))}));const c=new Map;l.forEach((t=>c.set(t[is.ROWGROUP],t))),r=this.reduceResDrillByCategoryGroups(r,a),r.forEach((function(t){a.forEach((i=>{try{t[i]=t[i]/c.get(t[is.ROWGROUP])[i]}catch(s){console.error("DataQuery: partOf drill row calculation failed",i,s),t[i]=Number.NaN}}))})),this.injectDrillRowsToResultRows(r,e)}createRestRow(t,i,s,e,n,r){if(t.totalRowCnt-this.config.limit>0&&0!==this.config.limit){const o=this.exctractScenarioNames(e).map((t=>`SUM(${t}) as ${t}`)).join(", ");i.push(`SELECT ${is.ROWNR}, 1 as ${is.ROWGROUPINDEX} , 'ENTRY' as ${is.TYPE}, 'NO_GROUP' as ${is.ROWGROUP}, 'REST' as ${is.CATEGORY} ${o.length>0?", "+o:""} FROM (SELECT ROWNUM() AS ${is.ROWNR}, ${i.length} as ${is.ROWGROUPINDEX} , 'ENTRY' as ${is.TYPE}, ${this.bind(String(t.rowGroup||"NO_GROUP"))} as ${is.ROWGROUP}, ${s.select()} ${e.length>0?",".concat(e):""} FROM ${this.fromExpr} ${n} GROUP BY ${s} ORDER BY ${r[0]}) t WHERE t.rowNr > ${this.config.limit}`)}}createDataRow(t,i,s,e,n,r,o,h){t.push(`SELECT ROWNUM() AS ${is.ROWNR},\n ${t.length} as ${is.ROWGROUPINDEX},\n 'ENTRY' as ${is.TYPE},\n ${this.bind(String(i.rowGroup||"NO_GROUP"))} as ${is.ROWGROUP},\n '${is.CATEGORYINDEX}',\n ${s.select()} ${e.length>0?",".concat(e):""} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr} ${r}\n GROUP BY ${s}\n ORDER BY ${o[0]} ${h}`)}createGroupHeaderRow(t,i){if(!0===this.config.grouped){const s=this.bind(String(t.rowGroup)),e=""===t.rowGroup?this.bind("-"):s;i.push(`SELECT ROWNUM() AS ${is.ROWNR},\n ${i.length} as ${is.ROWGROUPINDEX},\n 'GROUPHEAD' as ${is.TYPE},\n ${s} as ${is.ROWGROUP} ${this.config.showGroupTitle?`,${e} as ${is.CATEGORY}`:""}\n FROM ${this.fromExpr}\n GROUP BY '1'`)}}createGroupSumRow(t,i,s,e,n,r){if(!0===this.config.grouped&&(me.SUM===this.config.type||me.SUMNOTOTAL===this.config.type||me.OPT===this.config.type||me.OPTNOTOTAL===this.config.type)){const o=this.bind(String(s.rowGroup));t.push(`SELECT ${t.length} as ${is.ROWGROUPINDEX},\n '=' as ${is.OPERATION},\n ${o} as ${is.ROWGROUP},\n ROWNUM() AS ${is.ROWNR},\n 'GROUP_SUM' as ${is.TYPE} ${e.length>0?",".concat(e):""}\n FROM ${this.fromExpr} ${n}\n ORDER BY ${r[0]} `),i.push(`SELECT ${t.length} as ${is.ROWGROUPINDEX},\n '=' as ${is.OPERATION},\n ${o} as ${is.ROWGROUP},\n ROWNUM() AS ${is.ROWNR},\n 'GROUP_SUM' as ${is.TYPE} ${e.length>0?",".concat(e):""}\n FROM ${this.fromExpr} ${n}\n ORDER BY ${r[0]} `)}}createTotalSumRow(t,i,s){var e;if(me.SUM===this.config.type||me.OPT===this.config.type){const i=(null===(e=this.config.title)||void 0===e?void 0:e.trim())||"SUM_TOTAL",n=this.hasPartOf&&!1===this.config.grouped&&"SUM_TOTAL"!==i?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} ${i}`:i;t.push(`SELECT ${t.length} as ${is.ROWGROUPINDEX},\n ${this.bind(n)} as ${is.ROWGROUP},\n '=' as ${is.OPERATION},\n 'SUM' as ${is.TYPE} ${s.length>0?",".concat(s):""}\n FROM ${this.fromExpr} `)}i.push(`SELECT ${t.length} as ${is.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${is.ROWGROUP},\n '=' as ${is.OPERATION},\n 'SUM' as ${is.TYPE} ${s.length>0?",".concat(s):""}\n FROM ${this.fromExpr} `)}reduceResDrillByCategoryGroups(t,i){const s=new Map;return t.forEach((function(t){const e=t.rowNr+t.rowGroup+t.type+t.category;if(s.has(e)){const n=s.get(e);i.forEach((i=>{try{n[i]+=t[i]}catch(t){console.error("DataQuery: drill row aggregation failed",i,t)}}))}else s.set(e,t)})),[...s.values()]}injectDrillRowsToResultRows(t,i){const s=new Map;if(!0===this.config.grouped)t.forEach((function(t){i.forEach((function(i){const e=i.findIndex((i=>i.category===t.category&&i.rowGroup===t.rowGroup));if(e>=0){if(s.has(`${t.category}_${t.rowGroup}`)){const i=s.get(`${t.category}_${t.rowGroup}`)||0;s.set(`${t.category}_${t.rowGroup}`,i+1)}else s.set(`${t.category}_${t.rowGroup}`,1);t[is.ROWNR]=s.get(`${t.category}_${t.rowGroup}`),i.splice(e+t[is.ROWNR],0,t)}}))}));else{const e=this.findDuplicateSubCategories(t);t.forEach((function(t){i.forEach((function(i){const n=i.findIndex((i=>null!=i.category&&i.category===t.category));if(n>=0){if(s.has(`${t.category}`)){const i=s.get(`${t.category}`)||0;s.set(`${t.category}`,i+1)}else s.set(`${t.category}`,1);null!=t.rowGroup&&""!==t.rowGroup&&e.includes(`${t.category}##${t.subCategory}`)&&(t.subCategory=`${t.subCategory} (${t.rowGroup})`),i.splice(n+t[is.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,i,s,e){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const n=[],r=[];this.config.thereOf.forEach((e=>{let r=!0,o="1 <> 1 OR ( ";null!=e.category&&0!==e.category.length&&e.category.trim()&&(o+=` ${is.CATEGORY} = ${this.bind(e.category)}`,r=!1),null!=e.rowGroup&&0!==e.rowGroup.length&&e.rowGroup.trim()&&(o+=` ${r?"":"AND"} ${is.ROWGROUP} = ${this.bind(e.rowGroup)}`,r=!1),null!=e.subCategory&&0!==e.subCategory.length&&e.subCategory.trim()&&(o+=` ${r?"":"AND"} ${is.SUBCATEGORY} = ${this.bind(e.subCategory)}`),o+=")",n.push(`SELECT ROWNUM() AS ${is.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${is.TYPE},\n ${is.CATEGORY},\n ${is.SUBCATEGORY},\n ${this.drillRowGroup} as ${is.ROWGROUP},\n ${t} ${i.length>0?",".concat(i):""}\n FROM ${this.fromExpr}\n WHERE ${o}\n GROUP BY ${this.drillRowGroup}, ${is.CATEGORY}, ${is.SUBCATEGORY}\n ORDER BY ${s[1]}`)})),n.forEach((t=>{r.push(...this.exec(t))})),this.injectDrillRowsToResultRows(r,e)}calculateRelativeVariances(t,i){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[is.TYPE]&&i.forEach(((i,s)=>{var e;t[s]=null!==(e=At(t[s],t[i]))&&void 0!==e?e:Tt}))}))}))}calculateColumnGroupRest(t,i){if(null==i||0===i.size)return;const s=new Map,e=new Map;i.forEach(((t,i)=>{const n=t,r=[];for(const t of n)r.push(`${i}##${t.name}`);s.set(i,r),e.set(`${i}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[is.TYPE]&&s.forEach(((i,s)=>{let n=0;i.forEach((i=>{void 0!==t[i]&&(n+=t[i])})),t[`${s}##REST`]=t[s]-n,0!==t[`${s}##REST`]&&e.set(`${s}##REST`,!0)}))}))}));const n=Array.from(e.entries()).filter((([t,i])=>!i)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const i of n)delete t[i]}))}))}createIntervalColumns(t){var i,s,e,n,r;if(this.config.interval===we||this.config.categoryThereOf.size>0||0===this.config.scenarios.length)return;const o="##",h=`(SELECT *, ${Se(this.config.interval)} as __interval FROM ${this.fromExpr}) as p`,a=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),l=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),c=[...new Set(this.exctractScenarioNames(a))],u=this.getRelativeScenarios(),d=new Au(this.config),f=me.OPT===this.config.type||me.OPTNOTOTAL===this.config.type,p=this.config.grouped&&(me.SUM===this.config.type||me.SUMNOTOTAL===this.config.type||me.OPT===this.config.type||me.OPTNOTOTAL===this.config.type),v=this.checkConfigForPartOf()&&this.config.type!==me.LIST,g=t=>this.exec(t),m=t=>(this.config.scenarios.forEach((i=>{const s=new ts(i);!0===s.isValid?0!==t[s.base+"_cnt"]&&0!==t[s.delta+"_cnt"]||(t[i]=Number.NaN):0===t[i+"_cnt"]&&(t[i]=Number.NaN)})),u.forEach(((i,s)=>{var e;t[s]=null!==(e=At(t[s],t[i]))&&void 0!==e?e:Tt})),t),b=(t,i,s)=>{for(const e of this.config.scenarios)t[e+o+s]=i[e]},y=g(`SELECT ${d.select()}, __interval ${a.length>0?",".concat(a):""}\n FROM ${h}\n GROUP BY ${d}, __interval`);if(this.config.limit>0)for(let e=0;e<t.length;e++){const n=t[e].find((t=>"ENTRY"===t.type&&"REST"===t.category));if(!n)continue;let r;for(let i=e-1;i>=0&&!r;i--){const s=t[i].filter((t=>"ENTRY"===t.type&&"REST"!==t.category));s.length>0&&(r=s)}if(!r)continue;const o=new Set(r.map((t=>t.category))),h=r[0].rowGroup,a=new Map;for(const t of y){if(this.config.grouped&&t.rowGroup!==h)continue;if(o.has(t.category))continue;const e=$e(t.__interval);let n=a.get(e);n||(n={},a.set(e,n));for(const e of c)n[e]=(null!==(i=n[e])&&void 0!==i?i:0)+(null!==(s=t[e])&&void 0!==s?s:0)}a.forEach(((t,i)=>{b(n,m(t),i)}))}for(const i of y){const s=$e(i.__interval);m(i);for(const e of t)for(const t of e)"ENTRY"===t.type&&"REST"!==t.category&&t.category===i.category&&(this.config.grouped&&t.rowGroup!==i.rowGroup||f&&t.operation!==i.operation||b(t,i,s))}const w=p||v&&this.config.grouped?g(`SELECT ${Tu} as ${is.ROWGROUP}, __interval ${l.length>0?",".concat(l):""}\n FROM ${h}\n GROUP BY ${Tu}, __interval`):[],x=new Map;if(w.forEach((t=>x.set(`${t.rowGroup}${o}${$e(t.__interval)}`,t))),p)for(const i of w){const s=$e(i.__interval),e=m(Object.assign({},i));for(const n of t)for(const t of n)"GROUP_SUM"===t.type&&t.rowGroup===i.rowGroup&&b(t,e,s)}const S=me.SUM===this.config.type||me.OPT===this.config.type,$=S||v&&!this.config.grouped?g(`SELECT __interval ${l.length>0?",".concat(l):""}\n FROM ${h}\n GROUP BY __interval`):[],M=new Map;if($.forEach((t=>M.set($e(t.__interval),t))),S)for(const i of $){const s=$e(i.__interval),e=m(Object.assign({},i));for(const i of t)for(const t of i)"SUM"===t.type&&b(t,e,s)}if(null!=this.config.thereOf&&this.config.thereOf.length>0){const i=[];this.config.thereOf.forEach((t=>{i.push(...g(`SELECT ${this.drillRowGroup} as ${is.ROWGROUP}, ${is.CATEGORY}, ${is.SUBCATEGORY}, __interval ${a.length>0?",".concat(a):""}\n FROM ${h}\n WHERE ${this.createThereOfWhereClause(t)}\n GROUP BY ${this.drillRowGroup}, ${is.CATEGORY}, ${is.SUBCATEGORY}, __interval`))}));for(const s of i){const i=$e(s.__interval);m(s);for(const e of t)for(const t of e)"DRILLELEMENT"===t.type&&t.category===s.category&&t.rowGroup===s.rowGroup&&(t.subCategory!==s.subCategory&&t.subCategory!==`${s.subCategory} (${s.rowGroup})`||b(t,s,i))}}if(v){let i="1 <> 1 ";null===(e=this.config.partOf)||void 0===e||e.forEach((t=>{i+=`OR (${is.CATEGORY} = ${this.bind(t.category)}`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(i+=`and ${is.ROWGROUP} = ${this.bind(t.rowGroup)}`),i+=")"}));const s=g(`SELECT ${is.CATEGORY}, ${this.config.grouped?`${is.ROWGROUP}`:`'SUM_TOTAL' as ${is.ROWGROUP}`}, __interval ${a.length>0?",".concat(a):""}\n FROM ${h}\n WHERE ${i}\n GROUP BY ${is.ROWGROUP}, ${is.CATEGORY}, __interval`),l=new Map;for(const t of s){const i=`${t.rowGroup}${o}${t.category}${o}${$e(t.__interval)}`,s=l.get(i);if(s)for(const i of c)s[i]=(null!==(n=s[i])&&void 0!==n?n:0)+(null!==(r=t[i])&&void 0!==r?r:0);else l.set(i,t)}l.forEach((i=>{const s=$e(i.__interval),e=this.config.grouped?x.get(`${i.rowGroup}${o}${s}`):M.get(s);for(const t of c)i[t]=i[t]/(e?e[t]:Number.NaN);m(i);for(const e of t)for(const t of e)"PARTELEMENT"===t.type&&t.category===i.category&&t.rowGroup===i.rowGroup&&b(t,i,s)}))}}createThereOfWhereClause(t){let i=!0,s="1 <> 1 OR ( ";return null!=t.category&&0!==t.category.length&&t.category.trim()&&(s+=` ${is.CATEGORY} = ${this.bind(t.category)}`,i=!1),null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(s+=` ${i?"":"AND"} ${is.ROWGROUP} = ${this.bind(t.rowGroup)}`,i=!1),null!=t.subCategory&&0!==t.subCategory.length&&t.subCategory.trim()&&(s+=` ${i?"":"AND"} ${is.SUBCATEGORY} = ${this.bind(t.subCategory)}`),s+")"}getRelativeScenarios(){const t=new Map;return this.config.scenarios.forEach((i=>{const s=this.createRelativeScenario(i);null!=s&&t.set(s.key,s.value)})),t}translateScenarioSQL(t,i,s){const e=new ts(t);return me.OPT===s||me.OPTNOTOTAL===s?e.isValid?"dr"===e.type?`SUM(${e.base} - ${e.delta}) as ${t}, SUM(${e.delta}) as dr_${e.delta}`:`SUM(${e.base} - ${e.delta}) as ${t}`:i?`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:`SUM(${t}) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:e.isValid?"dr"===e.type?`SUM((${e.base} * transformOperator(operation)) - (${e.delta} * transformOperator(operation))) as ${t}, SUM(${e.delta} * transformOperator(operation)) as dr_${e.delta}`:`SUM((${e.base} * transformOperator(operation))- (${e.delta} * transformOperator(operation))) as ${t}`:`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}translateAttributeSQL(t){const i=`[${t.arg}]`,s=/^(ac|pp|fc|pl)[1-4]$/.test(t.arg)&&this.config.type!==me.OPT&&this.config.type!==me.OPTNOTOTAL;switch(t.fn){case"set":return`SETAGG(${i}) as ${t.alias}`;case"first":return`FIRST(${i}) as ${t.alias}`;case"last":return`LAST(${i}) as ${t.alias}`;case"min":return`MIN(${i}) as ${t.alias}`;case"max":return`MAX(${i}) as ${t.alias}`;case"avg":return s?`AVG(${i} * transformOperator(operation)) as ${t.alias}`:`AVG(${i}) as ${t.alias}`;case"sum":return s?`SUM(${i} * transformOperator(operation)) as ${t.alias}`:`SUM(${i}) as ${t.alias}`;case"lit":{const i=t.arg;return`${this.bind(""===i||Number.isNaN(Number(i))?i:Number(i))} as ${t.alias}`}}}get drillRowGroup(){return this.config.grouped?Tu:is.ROWGROUP}exec(t){const i=this.db.exec(t,this.params);return this.config.grouped&&i.forEach((t=>t.rowGroup=null==t.rowGroup?"":String(t.rowGroup))),i}bind(t){return`$${this.params.push(t)-1} `}createOrderString(t){const i=be.ASC===t.direction?be.DESC:be.ASC;return[t.hierarchy.map((i=>`${i} ${t.direction}`)).toString(),t.hierarchy.map((t=>`${t} ${i}`)).toString()]}createRelativeScenario(t){const i=new ts(t);return i.isValid&&"dr"===i.type?{key:`${t}`,value:`dr_${i.delta}`}:null}exctractScenarioNames(t){const i=[];return t.split(",").forEach((t=>t.length>=2?i.push(t.split("as")[1].trim()):null)),i}findDuplicateSubCategories(t){const i=t.map((t=>({count:1,subCategory:`${t.category}##${t.subCategory}`}))).reduce(((t,i)=>(t[i.subCategory]=(t[i.subCategory]||0)+i.count,t)),{});return Object.keys(i).filter((t=>i[t]>1))}createPartOfQuery(t,i){var s;const e=[];let n="1 <> 1 ",r=` ${this.drillRowGroup} as ${is.ROWGROUP}`,o="ROWNUM()";return null===(s=this.config.partOf)||void 0===s||s.forEach((t=>{n+=`OR (${is.CATEGORY} = ${this.bind(t.category)}`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(n+=`and ${is.ROWGROUP} = ${this.bind(t.rowGroup)}`),!1===this.config.grouped&&(r=` 'SUM_TOTAL' as ${is.ROWGROUP} `,o="1"),n+=")"})),e.push(`SELECT ${o} AS ${is.ROWNR},\n 'PARTELEMENT' as ${is.TYPE},\n ${is.CATEGORY},\n ${r},\n ${t}\n FROM ${this.fromExpr}\n WHERE ${n}\n GROUP BY ${this.drillRowGroup}, ${is.CATEGORY}, ${is.TYPE}\n ORDER BY ${i[1]}`),e}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,i){if(null==t||0===t.size)return;const s=[],e=[],n=this.fromExpr;t.forEach(((t,i)=>{let e="1 <> 1 ";t.forEach((t=>{e+=` or columnGroup = ${this.bind(String(t.name))} `})),s.push(`SELECT 'ENTRY' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${e}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),s.push(`SELECT 'ENTRY' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n columnSubGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${e}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),s.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${e}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),s.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n columnSubGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${e}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),s.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${e}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),s.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n columnSubGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${e}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),s.push(`SELECT 'SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n columnGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${e}\n GROUP BY rowlevel, columnGroup, scenario`),s.push(`SELECT 'SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n columnGroup,\n columnSubGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${e}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of s)e.push(...this.db.exec(t,this.params));this.injectDrillColumnsToResultRows(e,i)}injectDrillColumnsToResultRows(t,i){const s="##";for(const e of t)for(const t of i)for(const i of t)if(i.type===e.rowlevel)if("ENTRY"===e.rowlevel)"COLUMNGROUP"===e.columnlevel&&i.category===e.category?i[e.scenario+s+e.columnGroup]=e.val:"SUBGROUP"===e.columnlevel&&i.category===e.category&&(i[e.scenario+s+e.columnGroup+s+e.columnSubGroup]=e.val);else if("DRILLELEMENT"===e.rowlevel){if(!this.config.grouped&&i.rowGroup!==e.rowGroup)continue;"COLUMNGROUP"===e.columnlevel&&i.category===e.category&&i.subCategory===e.subCategory?i[e.scenario+s+e.columnGroup]=e.val:"SUBGROUP"===e.columnlevel&&i.category===e.category&&i.subCategory===e.subCategory?i[e.scenario+s+e.columnGroup+s+e.columnSubGroup]=e.val:"COLUMNGROUP"===e.columnlevel&&i.category===e.category&&i.subCategory===`${e.subCategory} (${e.rowGroup})`?i[e.scenario+s+e.columnGroup]=e.val:"SUBGROUP"===e.columnlevel&&i.category===e.category&&i.subCategory===`${e.subCategory} (${e.rowGroup})`&&(i[e.scenario+s+e.columnGroup+s+e.columnSubGroup]=e.val)}else("SUM"===e.rowlevel||"GROUP_SUM"===e.rowlevel)&&("COLUMNGROUP"===e.columnlevel&&i.category===e.category&&i.subCategory===e.subCategory&&(i[e.scenario+s+e.columnGroup]=e.val),"SUBGROUP"===e.columnlevel&&i.category===e.category&&i.subCategory===e.subCategory&&(i[e.scenario+s+e.columnGroup+s+e.columnSubGroup]=e.val))}}class Pu{constructor(){this.geometry=new Map}set(t,i,s){let e=this.geometry.get(t);e||(e=new Map,this.geometry.set(t,e)),e.set(i,s)}get(t,i){var s;return null===(s=this.geometry.get(t))||void 0===s?void 0:s.get(i)}}function Nu(t,i,s){const e=t[i];if(null==e)return null;const n=Number(e);return isNaN(n)?null:s!==me.OPT&&s!==me.OPTNOTOTAL||t[is.TYPE]!==ye.ENTRY||"-"!==t[is.OPERATION]?n:-n}class Du{constructor(){this.normalizedHeader=[],this.attributesByAlias=new Map,this.hasBlankRowGroup=!1}getNormalizedHeader(){return this.normalizedHeader}createHeader(t,i,s,e,n,r,o=[]){const h=[];this.attributesByAlias=new Map(o.map((t=>[t.alias,t]))),this.normalizedHeader=this.normalizeHeader(t,i,o);const a=this.normalizedHeader.some((t=>void 0!==t.bucket));a&&h.push(this.createIntervalBandRow());const l=new uu(a?1:0,0,ye.HEADER),c=new uu(a?2:1,0,ye.SEPERATORLINE);for(const t of this.normalizedHeader){const i=this.attributesByAlias.get(t.name);l.createElement(i?s.get(i.label)||i.label:hs.translateScenarioLabel(t.name,s),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,s,e,n,r),null,null,null,null),c.createElement(null,t.type,this.createColumnType(t),null,null,null,null,null,null)}return h.push(l),h.push(c),h}createIntervalBandRow(){const t=new uu(0,0,ye.HEADER);let i=0;for(;i<this.normalizedHeader.length;){const s=this.normalizedHeader[i];if(void 0===s.bucket){t.createElement(null,s.type,"filler",null,null,null,null,null,null),i+=1;continue}let e=1;for(;i+e<this.normalizedHeader.length&&this.normalizedHeader[i+e].bucket===s.bucket;)e+=1;t.createElement(s.bucketLabel,s.type,"intervalGroup",null,null,null,null,null,null,!1,void 0,e),i+=e}return t}setHeaderPrefix(t,i,s,e,n){let r="";return"category"===t.name&&n&&(0===s.prefix.length&&0===e.length||(r=hs.translateScenarioLabel("in",i)+" "+s.prefix+e)),t.order&&(r+=hs.translateScenarioLabel("ORDER_"+t.order,i)),r}normalizeHeader(t,i,s){let e=[{name:is.CATEGORY,group:is.CATEGORY,type:is.CATEGORY,order:void 0}];me.OPT!==t&&me.OPTNOTOTAL!==t||(e=[{name:is.OPERATION,group:is.OPERATION,type:is.OPERATION,order:void 0},{name:is.CATEGORY,group:is.CATEGORY,type:is.CATEGORY,order:void 0}]);const n=s.map((t=>({name:t.alias,group:t.alias,type:t.alias,order:void 0})));return[...e,...n,...i]}createBodyRows(t,i,s,e){var n;const r=[];let o=-1;const h=new Cu(t,i),a=h.execute(s,e);this.hasBlankRowGroup=h.hasBlankRowGroup;const l=this.calculateColumnStatistics(a,t.barColumns,t.interval!==we),c=(null!==(n=t.barColumns)&&void 0!==n?n:[]).filter((t=>t.toUpperCase().trim()in Nt)),u=c.length>0&&t.interval===we&&0===t.categoryThereOf.size&&function(t){for(const i of t)for(const t of i){const i=t[is.TYPE];if(i===ye.SUM||i===ye.GROUPSUM||i===ye.DRILLELEMENT||i===ye.PARTELEMENT)return!0}return!1}(a)?function(t,i,s){const e=new Pu;for(const n of i){let i,r=0,o=0;const h=[],a=(t,i)=>{h.push(i),e.set(t,n,i)};for(const e of t)for(const t of e){const e=t[is.TYPE];if(e===ye.GROUPHEAD){i=void 0;continue}const h=Nu(t,n,s);if(e===ye.ENTRY){if(null===h){i=void 0;continue}a(t,{start:r,end:r+h,min:0,max:0,kind:"cascade"}),i={start:r,end:r+h},o=i.start,r+=h}else if(e===ye.SUM||e===ye.GROUPSUM){if(null===h){i=void 0;continue}a(t,{start:0,end:h,min:0,max:0,kind:"anchor"}),i={start:0,end:h},o=0,r=h}else if(e===ye.DRILLELEMENT){if(null===h||void 0===i)continue;const s=o+(Math.sign(i.end-i.start)||1)*Math.abs(h);a(t,{start:o,end:s,min:0,max:0,kind:"thereof",parentStart:i.start,parentEnd:i.end}),o=s}else if(e===ye.PARTELEMENT){if(null===h||void 0===i)continue;const s=o+h*(i.end-i.start);a(t,{start:o,end:s,min:0,max:0,kind:"partof",parentStart:i.start,parentEnd:i.end}),o=s}}let l=0,c=0;for(const t of h)l=Math.min(l,t.start,t.end),c=Math.max(c,t.start,t.end);for(const t of h)t.min=l,t.max=c}return e}(a,c,t.type):void 0;for(const s of a)o+=1,r.push(...this.createRow(t.i18n,i,t.scenariosUnitType,s,o,-1,t.categoryWidth,t.measureScale,t.barColumns,l,u));return r}calculateColumnStatistics(t,i,s=!1){const e=new Map;if(!i||0===i.length)return e;const n=new Map;for(const t of i)e.set(t,{min:1/0,max:-1/0,absMax:0,median:0}),n.set(t,[]);for(const r of t)for(const t of r){const r=t[is.TYPE];if(r!==ye.SUM&&r!==ye.GROUPSUM)for(const r of i){const i=s?this.extractIntervalColumnValues(t,r):[this.extractColumnValue(t,r)];for(const t of i)if(null!==t&&!isNaN(t)){const i=e.get(r);i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),n.get(r).push(Math.abs(t))}}}for(const[t,i]of e){i.min!==1/0&&i.max!==-1/0||(i.min=0,i.max=0),i.absMax=Math.max(Math.abs(i.min),Math.abs(i.max));const s=n.get(t);if(s.length>0){s.sort(((t,i)=>t-i));const t=Math.floor(s.length/2);i.median=s.length%2==0?(s[t-1]+s[t])/2:s[t]}e.set(t,i)}return e}extractIntervalColumnValues(t,i){const s=i+"##",e=[];for(const i of Object.keys(t))if(i.startsWith(s)){const s=Number(t[i]);e.push(isNaN(s)?null:s)}return e}extractColumnValue(t,i){if(void 0!==t[i]){const s=Number(t[i]);return isNaN(s)?null:s}for(const s of Object.keys(t))if(s===i||s.endsWith("##"+i)||s===i+"##"+i){const i=Number(t[s]);if(!isNaN(i))return i}return null}createRow(t,i,s,e,n,r,o,h,a,l,c){var u;const d=[];for(const f of e){const p=f[is.ROWGROUP],v=""===p?"-":p,g=f[is.SUBCATEGORY],m=f[is.TYPE],b=f[is.ROWNR]>=2,y=this.createDetailRow(m,r+=1,n,e.length);for(const e of this.normalizedHeader){const n=this.getRawDataRowElement(f,e),r=null!==(u=null==a?void 0:a.includes(e.type))&&void 0!==u&&u,d=r?null==l?void 0:l.get(e.type):void 0,p=r&&void 0===e.bucket&&e.name===e.group&&e.name===e.type?null==c?void 0:c.get(f,e.type):void 0;y.createElement(this.translateSumCellLabel(t,i,n,v,g,m,e.type),e.type,this.createColumnType(e),this.setCellType(e.type,s),this.translateCellPrefix(i,m,e.type),this.translateScenarioCSS(e.type,n),b,o,null==h?void 0:h.value,r,d,1,p)}d.push(y)}return d}getRawDataRowElement(t,i){return void 0!==i.bucket?t[i.type+"##"+i.bucket]:i.name===i.group&&i.name===i.type?t[i.name]:i.name===i.group&&i.name!==i.type?t[i.type+"##"+i.name]:t[i.type+"##"+i.group+"##"+i.name]}createDetailRow(t,i,s,e){switch(t){case ye.GROUPHEAD:return new uu(i,s,ye.HEADER);case ye.SUM:case ye.GROUPSUM:return new uu(e+2,s,ye.SUM);case ye.DRILLELEMENT:return new uu(e+2,s,ye.DRILLELEMENT);case ye.PARTELEMENT:return new uu(e+2,s,ye.PARTELEMENT);default:return new uu(i,s,ye.STANDARD)}}translateSumCellLabel(t,i,s,e,n,r,o){return this.attributesByAlias.has(o)||!1===Number.isNaN(Number(s))||this.isOperationColumn(o)?s:this.isGroupHeadCategory(r,o)?t===gt.ALL?`${i.get(s)||s}`:s:this.isEntryCategory(r,o)?t===gt.ALL||"REST"===s?`${i.get(s)||s}`:s:this.isDrillElementCategory(r,o)?t===gt.ALL?`${i.get(n)||n}`:`${n}`:this.isPartElementCategory(r,o)?t===gt.ALL||"SUM_TOTAL"===e?`${i.get(e)||e}`:`${e}`:this.isSumElementCategory(r,o)?t===gt.ALL||"SUM_TOTAL"===e?`${i.get(e)||e}`:e:"GROUPHEAD"===r&&null==s||s===Tt?s:Number.isNaN(Number(s))?"-":Number(s)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,i){if(this.attributesByAlias.has(t))return"attribute";const s=new ts(t);let e="pos";return i<0&&(e="neg"),s.isValid?e+"_"+s.direction+("dr"===s.type?" relative_variance":""):t}setCellType(t,i){if("category"===t)return"";const s=this.attributesByAlias.get(t);if(s)return s.isNumeric?"decimal":"";let e;const n=new ts(t);return i===vt.PERCENT?(e="percent",n.isValid&&"d"===n.type&&(e="percentpoint")):(e="decimal",n.isValid&&"dr"===n.type&&(e="percent")),e}isDrillElementCategory(t,i){return"DRILLELEMENT"===t&&"category"===i}isPartElementCategory(t,i){return"PARTELEMENT"===t&&"category"===i}isSumElementCategory(t,i){return("GROUP_SUM"===t||"SUM"===t)&&"category"===i}isEntryCategory(t,i){return"ENTRY"===t&&"category"===i}isGroupHeadCategory(t,i){return"GROUPHEAD"===t&&"category"===i}translateCellPrefix(t,i,s){return this.isOperationColumn(s)||this.isGroupHeadCategory(i,s)||this.isEntryCategory(i,s)?null:this.isDrillElementCategory(i,s)?`${t.get("there_of")} `:this.isPartElementCategory(i,s)?`${t.get("part_of")} `:null}createColumnType(t){return t.name===t.group&&t.name===t.type?"base":t.name===t.group?"columnGroup":"columnSubGroup"}}class Uu{constructor(t,i,s,e){this.fromExpr="",this.rowCount=0,this.headerRows=[],this.bodyRows=[],this.intervalBuckets=[],this.ruleSet=t||new Ge,this.db=i,this.dataSetFactory=new Du,this.config=this.initConfig(e),this.i18n=this.initI18n(new Map),this.setSource(s,e.filter)}setI18n(t){this.i18n=this.initI18n(t)}initI18n(t){const i=new Map([["",""],["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"]]);return this.state=ge.DIRTY,new Map([...i,...t||new Map])}initConfig(t){this.state=ge.DIRTY;const i=t,s=this;return t.scenarios.sort(((t,i)=>s.ruleSet.getScenarioSorIndex(t)-s.ruleSet.getScenarioSorIndex(i))),i}setConfig(t){this.config=this.initConfig(t)}setSource(t,i){var s,e;if(this.state=ge.DIRTY,this.fromExpr=_(this.db,t,i),!this.fromExpr)return void(this.rowCount=0);const n=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(e=null===(s=n[0])||void 0===s?void 0:s.cnt)&&void 0!==e?e:0}update(){this.prepareIntervalBuckets();const t=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder,this.intervalBuckets);this.headerRows=this.dataSetFactory.createHeader(this.config.type,t,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale,this.config.attributes),this.bodyRows=0!==this.rowCount&&this.fromExpr?this.dataSetFactory.createBodyRows(this.config,this.i18n,this.db,this.fromExpr):[],this.state=ge.UP_TO_DATE}getHeader(){return this.state===ge.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===ge.DIRTY&&this.update(),this.bodyRows}getColumns(){return this.state===ge.DIRTY&&this.update(),this.dataSetFactory.getNormalizedHeader()}prepareIntervalBuckets(){this.intervalBuckets=[],this.config.interval===we||!this.fromExpr||this.config.categoryThereOf.size>0?this.config.interval=we:(this.config.interval=function(t,i,s){var e;if(s!==tt.AUTO)return s;const n=t.exec(`SELECT [date] as d FROM ${i}`);let r,o;for(const t of n){const i=null===(e=Me(t.d))||void 0===e?void 0:e.toMillis();void 0!==i&&(r=void 0===r?i:Math.min(r,i),o=void 0===o?i:Math.max(o,i))}return void 0===r||void 0===o?tt.DAY:(new nt).calculateDistanceType(y.fromMillis(r),y.fromMillis(o))}(this.db,this.fromExpr,this.config.interval),this.intervalBuckets=function(t,i,s,e){const n=t.exec(`SELECT ${Se(s)} as __interval FROM ${i}`);if(s===xe){const t=new Set,i=[];for(const s of n){const e=$e(s.__interval);t.has(e)||(t.add(e),i.push({key:e,label:0===e.length?"-":e}))}return i}const r=new Set,o=[];for(const t of n){const i=Me(t.__interval);if(!i)continue;const s=i.toISO();r.has(s)||(r.add(s),o.push(i))}o.sort(((t,i)=>t.toMillis()-i.toMillis()));const h=new nt;return h.setLocale(e),o.map((t=>({key:t.toISO(),label:h.getDateString(t,s)})))}(this.db,this.fromExpr,this.config.interval,this.config.locale),0===this.intervalBuckets.length&&(this.config.interval=we))}normalizeScenarios(t,i,s,e=[]){var n,r;const o=[];if(e.length>0){for(const i of e)for(const e of t)o.push({name:e,group:e,type:e,order:(null===(n=null==s?void 0:s.hierarchy)||void 0===n?void 0:n.at(0))===e?s.direction:void 0,bucket:i.key,bucketLabel:i.label});return o}for(const e of t){if(null==i?void 0:i.has(e)){const t=i.get(e);for(const i of t){o.push({name:i.name,group:i.name,type:e,order:void 0});for(const t of i.subGroups)o.push({name:t,group:i.name,type:e,order:void 0})}o.push({name:"REST",group:"REST",type:e,order:void 0})}let t;(null===(r=null==s?void 0:s.hierarchy)||void 0===r?void 0:r.at(0))===e&&(t=s.direction),o.push({name:e,group:e,type:e,order:t})}return o}hasNoData(){return 0===this.rowCount}hasBlankRowGroup(){return this.dataSetFactory.hasBlankRowGroup}}class zu{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=vt.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.attributes=[],this.sortOrder=new Lt(new Ql).default(),this.type=me.LIST,this.limit=0,this.i18n=gt.ALL,this.categoryWidth=mt.W25,this.measureScale=new al,this.measureUnit="",this.measureType=bt.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[],this.interval="none",this.locale="de"}}class Fu{constructor(t,i,s,e,n,r){this.tableDrillGroupAdapter=t,this.stringAdapter=i,this.orderAdapter=s,this.db=e,this.fromExpr=n,this.onQueryError=r}adapt(t){const i=new zu;return E.isString(t.title)&&(i.title=t.title),E.isArray(t.scenarios)&&(i.scenarios=Et.adaptArray(t.scenarios,this.stringAdapter)),E.isExisting(t.scenariosUnitType)&&(i.scenariosUnitType=t.scenariosUnitType),E.isBoolean(t.grouped)&&(i.grouped=t.grouped),E.isBoolean(t.showGroupTitle)&&(i.showGroupTitle=t.showGroupTitle),E.isBoolean(t.showMeasureScale)&&(i.showMeasureScale=t.showMeasureScale),E.isArray(t.thereOf)&&(i.thereOf=Et.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),E.isExisting(t.categoryThereOf)&&(i.categoryThereOf=t.categoryThereOf),E.isArray(t.partOf)&&(i.partOf=Et.adaptArray(t.partOf,this.tableDrillGroupAdapter)),E.isArray(t.attributes)&&(i.attributes=t.attributes),E.isExisting(t.order)&&(i.sortOrder=this.orderAdapter.adapt(t.order)),E.isExisting(t.type)&&(i.type=t.type),E.isNumber(t.limit)&&(i.limit=t.limit),E.isExisting(t.i18n)&&(i.i18n=t.i18n),E.isExisting(t.categoryWidth)&&(i.categoryWidth=t.categoryWidth),E.isExisting(t.measureScale)&&(i.measureScale=Kl.calculateMeasureScale(this.db,this.fromExpr,i.scenarios,t.measureScale,this.onQueryError)),E.isExisting(t.measureType)&&(i.measureType=t.measureType),E.isString(t.measureUnit)&&(i.measureUnit=t.measureUnit),E.isString(t.filter)&&(i.filter=t.filter.trim()),E.isArray(t.barColumns)&&(i.barColumns=t.barColumns),E.isString(t.interval)&&(i.interval=t.interval),E.isString(t.locale)&&(i.locale=t.locale),i}default(){return new zu}}class Wu{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class Gu{constructor(){}adapt(t){const i=new Wu;return E.isString(t.rowGroup)&&(i.rowGroup=t.rowGroup),E.isString(t.category)&&(i.category=t.category),E.isString(t.subCategory)&&(i.subCategory=t.subCategory),E.isString(t.partOf)&&(i.partOf=t.partOf),i}default(){return new Wu}}const ju=class{constructor(i){t(this,i),this.tableName="",this.dataVersion=0,this.sumTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=vt.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.thereof=[],this.partof=[],this.order={hierarchy:[],direction:be.ASC},this.categorythereof=new Map,this.attributeColumns=[],this.type=me.LIST,this.categoryWidth=mt.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=gt.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=bt.VOLUME,this.filter="",this.barColumns=[],this.interval="none",this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new Rc,a(this),this.componentStyle=O(this)}async getLayoutDetail(t,i){var s,e,n;const r={regions:[],metadata:{},diagnostics:[]},o=null===(s=this.element.shadowRoot)||void 0===s?void 0:s.querySelector("table");if(r.metadata.hasNoData=null===(n=null===(e=this.table)||void 0===e?void 0:e.hasNoData())||void 0===n||n,!this.table||!o)return r;const h=o.querySelector("thead"),a=o.querySelector("tbody");h&&r.regions.push({id:"header",rect:Ut(h,t)}),a&&r.regions.push({id:"body",rect:Ut(a,t)});const l=this.table.getHeader(),c=this.table.getBody(),u=this.table.getColumns();if(r.metadata.headerRowCount=l.length,r.metadata.rowCount=c.length,r.metadata.columnCount=u.length,r.metadata.cellCount=c.reduce(((t,i)=>t+i.getCells().length),0),"full"!==i)return r;const d=[],f=[],p=(i,s,e)=>{const n=e?Array.from(e.children).filter((t=>"tr"===t.localName)):[];s.forEach(((s,e)=>{const o=n[e];if(!o)return;d.push({section:i,index:e,type:s.type,rect:Ut(o,t)});const h=s.getCells(),a=Array.from(o.children);h.length===a.length?h.forEach(((s,n)=>{var r,o;const h=a[n],l={kind:"header"===i?"headerCell":"cell",row:e,column:s.index,key:s.key||void 0,colSpan:s.colSpan,value:null!==(r=s.value)&&void 0!==r?r:void 0,text:(null===(o=h.textContent)||void 0===o?void 0:o.trim())||void 0,type:s.type||void 0,rect:Ut(h,t)},c=h.querySelector("svg.cell-bar-chart");c&&(l.bar={variant:c.classList.contains("waterfall-bar")?"waterfall":c.classList.contains("relative-variance")?"relative":"absolute",rect:Ut(c,t)}),f.push(l)})):r.diagnostics.push({id:`LAYOUT_cellPairing_${i}_${e}`,type:"warning",message:`layout-state: model/DOM cell count mismatch in ${i} row ${e} (${h.length} vs ${a.length}); cell details skipped for this row.`})}))};return p("header",l,h),p("body",c,a),r.elements=f,r.table={rows:d,columns:u.map(((t,i)=>({index:i,key:t.name,group:t.group,type:t.type,bucket:t.bucket})))},r}render(){var t;return i(s,{class:{"no-data":!0===(null===(t=this.table)||void 0===t?void 0:t.hasNoData())}},(()=>{var t,s,e,n;if(void 0===this.table)return;if(this.table.hasNoData()){const s=null!==(t=this.i18n.get("no-data"))&&void 0!==t?t:"No Data";return i("div",{class:"empty-state"},s)}const r=null===(n=null===(e=null===(s=this.stores)||void 0===s?void 0:s.context)||void 0===e?void 0:e.state)||void 0===n?void 0:n.locale;return i("table",null,i("thead",null,this.table.getHeader().map((t=>i("tr",{class:t.cssStyle},t.getCells().map((t=>i("th",{colSpan:t.colSpan,class:t.cssStyle},t.getAsHeaderList().map(((s,e,n)=>i("span",null,e===n.length-1?i("span",{class:" "===s?"table-footer":""},s,t.drawPrefix()," "):i("span",null,s,t.drawPrefix(),i("br",null)))))))))))),i("tbody",null,this.table.getBody().map((t=>i("tr",{class:t.cssStyle},null==t?void 0:t.getCells().map((s=>i("td",{colSpan:s.colSpan,class:s.type?`${s.cssStyle} ${s.type}`:s.cssStyle},null!=s.prefix?i("span",{class:s.cssStyle+" "+s.prefixStyle},s.drawPrefix()):"",s.isBarChart&&s.columnStats&&s.value!==Tt&&(void 0!==s.waterfall||t.type!==ye.SUM)?void 0!==s.waterfall?i(Lu,{value:s.value,scenario:s.key,columnStats:s.columnStats,height:18*this.scaleFactor,isRelative:!1,isPositiveGood:s.key.endsWith("_pos"),measureScale:s.measureScale,locale:r,columnWidthEm:this.barColumnMaxWidth,styles:this.barChartStyles,waterfall:s.waterfall}):i(Eu,{value:s.value,scenario:s.key,columnStats:s.columnStats,height:18*this.scaleFactor,isRelative:s.key.startsWith("dr"),isPositiveGood:s.key.endsWith("_pos"),measureScale:"percentpoint"===s.type?.01:s.measureScale,locale:r,percentDigits:this.componentDataFormatDigits.percent,columnWidthEm:this.barColumnMaxWidth,styles:this.barChartStyles}):s.draw(this.componentDataFormatDigits,r)))))))))})())}componentWillRender(){var t,i,s,e,n;this.stores||(this.stores=u(this.element));const r=this.stores.db.db;this.componentDataFormatDigits=(new Oc).adapt(this.dataFormatDigits);try{const i=this.prepareConfig(r);this.table=new Uu(new Ge(this.ruleSetConfig),r,this.tableName,i),this.table.setI18n(this.i18n),this.table.hasNoData()||this.table.getBody(),null===(t=this.errors)||void 0===t||t.remove("ERR_sql")}catch(t){console.error("ibcs-table: query failed",t),this.table=void 0,null===(i=this.errors)||void 0===i||i.addOrReplace({id:"ERR_sql",type:"error",message:`Query failed: ${t instanceof Error?t.message:t}`})}(null===(s=this.table)||void 0===s?void 0:s.hasBlankRowGroup())?null===(e=this.errors)||void 0===e||e.addOrReplace({id:"WARN_blankRowGroup",type:"warning",message:"grouped: rows with blank rowGroup found, they are grouped under '-'."}):null===(n=this.errors)||void 0===n||n.remove("WARN_blankRowGroup"),this.barChartStyles=this.prepareBarChartStyles()}prepareConfig(t){var i,s,e;const n=_(t,this.tableName,this.filter);return new Fu(new Gu,new Ql,new Lt(new Ql),t,n,(t=>{throw t})).adapt({title:this.sumTitle,scenarios:this.scenarios,scenariosUnitType:this.scenariosDataFormat,grouped:this.grouped,showGroupTitle:this.showGroupTitle,thereOf:this.thereof,partOf:this.partof,categoryThereOf:this.categorythereof,attributes:this.attributeColumns,order:this.order,type:this.type,limit:this.limit,i18n:this.i18nMode,categoryWidth:this.categoryWidth,measureScale:this.measureScale,measureUnit:this.measureUnit,measureType:this.measureType,showMeasureScale:this.showMeasureScale,filter:this.filter,barColumns:this.barColumns,interval:this.interval,locale:(null===(e=null===(s=null===(i=this.stores)||void 0===i?void 0:i.context)||void 0===s?void 0:s.state)||void 0===e?void 0:e.locale)||"de"})}prepareBarChartStyles(){var t;const i=!(this.unitScaling>0),s=!(this.percentageScaling>0),e=i?this.autoUnitScaling():this.unitScaling,n=s?this.autoPercentageScaling():this.percentageScaling;return(i||s)&&(null===(t=this.reportAutoScaling)||void 0===t||t.call(this,{unit:i?e:void 0,percentage:s?n:void 0})),this.componentStyle((t=>{var i,s,r,o,h,a,l,c,u,d,f,p,v,g,m,b,y,w,x,S,$,M,_,R,O,k,E;const L=null===(i=t["bn-chart-time"])||void 0===i?void 0:i.varianceStyles,T=null===(s=t["bn-chart-time"])||void 0===s?void 0:s.barStyles;return{positive:{stroke:(null===(r=null==L?void 0:L.pos)||void 0===r?void 0:r.stroke)||"#008f96",fill:(null===(o=null==L?void 0:L.pos)||void 0===o?void 0:o.fill)||"#008f96",fillpattern:He(null===(h=null==L?void 0:L.pos)||void 0===h?void 0:h.fillpattern)||"solid"},negative:{stroke:(null===(a=null==L?void 0:L.neg)||void 0===a?void 0:a.stroke)||"#ff0000",fill:(null===(l=null==L?void 0:L.neg)||void 0===l?void 0:l.fill)||"#ff0000",fillpattern:He(null===(c=null==L?void 0:L.neg)||void 0===c?void 0:c.fillpattern)||"solid"},neutral:{stroke:(null===(u=null==L?void 0:L.neu)||void 0===u?void 0:u.stroke)||"#808080",fill:(null===(d=null==L?void 0:L.neu)||void 0===d?void 0:d.fill)||"#808080",fillpattern:He(null===(f=null==L?void 0:L.neu)||void 0===f?void 0:f.fillpattern)||"outlined"},scenarios:{ac:{stroke:(null===(p=null==T?void 0:T.ac)||void 0===p?void 0:p.stroke)||"#404040",fill:(null===(v=null==T?void 0:T.ac)||void 0===v?void 0:v.fill)||"#404040",fillpattern:He(null===(g=null==T?void 0:T.ac)||void 0===g?void 0:g.fillpattern)||"solid"},pp:{stroke:(null===(m=null==T?void 0:T.pp)||void 0===m?void 0:m.stroke)||"#A6A6A6",fill:(null===(b=null==T?void 0:T.pp)||void 0===b?void 0:b.fill)||"#A6A6A6",fillpattern:He(null===(y=null==T?void 0:T.pp)||void 0===y?void 0:y.fillpattern)||"solid"},fc:{stroke:(null===(w=null==T?void 0:T.fc)||void 0===w?void 0:w.stroke)||"#404040",fill:(null===(x=null==T?void 0:T.fc)||void 0===x?void 0:x.fill)||"#ffffff",fillpattern:He(null===(S=null==T?void 0:T.fc)||void 0===S?void 0:S.fillpattern)||"hatched"},pl:{stroke:(null===($=null==T?void 0:T.pl)||void 0===$?void 0:$.stroke)||"#404040",fill:(null===(M=null==T?void 0:T.pl)||void 0===M?void 0:M.fill)||"#ffffff",fillpattern:He(null===(_=null==T?void 0:T.pl)||void 0===_?void 0:_.fillpattern)||"outlined"}},fontColor:(null===(R=t.global)||void 0===R?void 0:R.fontColor)||"#000000",fontSize:((null===(O=t.global)||void 0===O?void 0:O.fontSizePx)||13.3333)*du*this.scaleFactor,emPx:((null===(k=t.global)||void 0===k?void 0:k.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:(null===(E=t.global)||void 0===E?void 0:E.fontFamily)||"'Noto Sans', sans-serif",unitScaling:e,percentageScaling:n,scaleFactor:this.scaleFactor}}))}emPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.scaleFactor}autoUnitScaling(){const t=this.emPx(),i=t*du,{absMax:s,hasNeg:e,hasPos:n}=this.getAbsBarColumnStats();if(s<=0||i<=0)return.01;const{maxBarWidth:r,cutWidth:o}=vu(this.barColumnMaxWidth,t,e,n);return Math.min(.8*r,o)/(s*i)}autoPercentageScaling(){const t=this.emPx(),i=t*du,{absMax:s,hasNeg:e,hasPos:n}=this.getRelativeBarColumnStats();if(s<=0||i<=0)return.5;const{maxPinLength:r}=gu(this.barColumnMaxWidth,t,e,n);return.8*r/(s*i)}getAbsBarColumnStats(){return this.collectBarColumnStats((t=>!t.key.startsWith("dr")&&!t.waterfall),1)}getRelativeBarColumnStats(){return this.collectBarColumnStats((t=>t.key.startsWith("dr")),100)}collectBarColumnStats(t,i){const s={absMax:0,hasNeg:!1,hasPos:!1};if(!this.table)return s;for(const e of this.table.getBody())if(e.type!==ye.SUM)for(const n of e.getCells())n.isBarChart&&n.columnStats&&t(n)&&(s.absMax=Math.max(s.absMax,n.columnStats.absMax*i),s.hasNeg=s.hasNeg||n.columnStats.min<0,s.hasPos=s.hasPos||n.columnStats.max>0);return s}get element(){return e(this)}};ju.style=':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{position:relative;display:inline-block}table{background-color:var(--bn-font-background, white);font-size:var(--bn-font-size, 1em);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);border-spacing:0.3em 0}thead{border-style:none}tr:first-child td{border-top:none;padding-top:0.5em}td.ac1,td.ac2,td.ac3,td.ac4,td.pp1,td.pp2,td.pp3,td.pp4,td.pl1,td.pl2,td.pl3,td.pl4,td.fc1,td.fc2,td.fc3,td.fc4,td.share,td.variance,td.pos_pos,td.pos_neg,td.neg_pos,td.neg_neg,td.pos_neutral,td.neg_neutral{text-align:right}.category-w100{min-width:100em;max-width:100em}.category-w50{min-width:50em;max-width:50em}.category-w25{min-width:25em;max-width:25em}.category-w20{min-width:20em;max-width:20em}.category-w15{min-width:15em;max-width:15em}.category-w10{min-width:10em;max-width:10em}.category-w5{min-width:5em;max-width:5em}.prefix-second{color:transparent;font-style:normal}.prefix-first{font-style:normal}th{border-bottom:0.1em solid black;text-align:right;font-weight:normal;vertical-align:text-top}td.columnGroup,th.columnGroup{font-size:0.6em}td.columnSubGroup,th.columnSubGroup{font-size:0.6em;border-spacing:0em 0;font-style:italic}td.base,th.base{font-style:normal}th.ofit,td.ofit,tr.ofit,th.partof,td.partof,tr.partof{font-size:0.6em;font-style:italic}td.ofit,td.partof{font-size:0.6em;font-style:italic}th.ofit td,tr.ofit td,th.partof td,tr.partof td{border-top:0em solid black;padding-left:1em}th.ofit share,th.partof share,tr.share td{border-top:0em solid black}th.share,tr.share,td.share{font-size:0.6em;font-style:italic}th.filler{border-bottom:0em solid black;text-align:right}td.filler{border-top:0em none !important;border-bottom:0em none;text-align:right}th.group{text-align:center;border-spacing:1em 0}th.headerlabel{border-bottom:0em none black;padding-bottom:0em}th.intervalGroup{border-bottom:0.1em solid black;text-align:center;font-weight:bold}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal,td.percentpoint{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em dashed #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}';class Iu{constructor(){}createMeasures(t,i,s){if(this.allMeasuresUseSameUnit(t)){const e=t.length;let n="",r="";for(let o=0;o<e;o++){let h="";o>0&&(h=i.get("SEPERATOR_WS")),e>1&&o===e-1&&(h=i.get("CONNECTOR_WS")),s===gt.ALL?(n=(i.get(n)||n)+h+(i.get(t[o].name)||t[o].name),r=i.get(t[o].unit)||t[o].unit):(n=n+h+t[o].name,r=t[o].unit)}return[{name:n,unit:r}]}return t}createDimension(t,i,s,e,n,r="de"){let o="";if(void 0!==i){const t=new nt;t.setLocale(r),o=t.getDateLinkString(i.start,i.end,i.link,i.format,n)}const h=t.map((t=>{let i="";return null!=s&&null!=s.hierarchy&&s.hierarchy.find((i=>i===t))&&(i=e.get("asc"===s.direction?"ORDER_asc":"ORDER_desc")),"".concat(" ",hs.translateScenarioLabel(t,e),i)})).toString();return o+h}allMeasuresUseSameUnit(t){const i=new Map;return t.forEach((function(t){i.set(t.unit,!0)})),1===i.size}}class Yu{constructor(){this.businessunit="",this.measures=[],this.scenarios=[],this.i18nMode=gt.ALL,this.intervalSpanLimit=32,this.locale="de"}}class Bu{constructor(t,i,s,e){this.measureEntryAdapter=t,this.timePeriodAdapter=i,this.orderAdapter=s,this.stringAdapter=e}adapt(t){const i=new Yu;return E.isString(t.businessunit)&&(i.businessunit=t.businessunit),E.isArray(t.measures)&&(i.measures=Et.adaptArray(t.measures,this.measureEntryAdapter)),E.isArray(t.scenarios)&&(i.scenarios=Et.adaptArray(t.scenarios,this.stringAdapter)),E.isExisting(t.timeperiod)&&(i.timeperiod=this.timePeriodAdapter.adapt(t.timeperiod)),E.isNumber(t.intervalSpanLimit)&&(i.intervalSpanLimit=t.intervalSpanLimit),E.isExisting(t.i18nMode)&&(i.i18nMode=t.i18nMode),E.isExisting(t.order)&&(i.order=this.orderAdapter.adapt(t.order)),E.isString(t.locale)&&(i.locale=t.locale),i}default(){return new Yu}}var Hu;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(Hu||(Hu={}));class Vu{constructor(t){this.i18n=new Map,this.unit="",this.measures=[],this.dimension="",this.config=new Yu,this.state=Hu.DIRTY,this.ruleSet=t||new Ge,this.dataSetFactory=new Iu,this.state=Hu.DIRTY,this.setI18n(new Map)}setRuleSet(t){this.ruleSet=t||new Ge}setI18n(t){this.state=Hu.DIRTY;const i=new Map([["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"],["CONNECTOR_WS"," und "]]);this.i18n=new Map([...i,...t||new Map])}update(){return Hu.DIRTY===this.state&&(this.unit=this.config.businessunit,this.measures=this.dataSetFactory.createMeasures(this.config.measures,this.i18n,this.config.i18nMode),this.dimension=this.dataSetFactory.createDimension(this.config.scenarios,this.config.timeperiod,this.config.order,this.i18n,this.config.intervalSpanLimit,this.config.locale),this.state=Hu.UP_TO_DATE),this}setConfig(t){this.config=this.initConfig(t)}initConfig(t){this.state=Hu.DIRTY;const i=t,s=this;return t.scenarios.sort(((t,i)=>s.ruleSet.getScenarioSorIndex(t)-s.ruleSet.getScenarioSorIndex(i))),i}}class Xu{constructor(t="",i=""){this.name=t,this.unit=i}}class Ju{construnctor(){}adapt(t){const i=new Xu;return E.isString(t.name)&&(i.name=t.name),E.isString(t.unit)&&(i.unit=t.unit),i}default(){return new Xu("","")}}class qu{constructor(t=y.now(),i=y.now(),s=tt.AUTO,e=_t.AUTO){this.start=t,this.end=i,this.format=s,this.link=e}}class Ku{construnctor(){}adapt(t){const i=new qu;return E.isDate(t.start)&&(i.start=t.start),E.isDate(t.end)&&(i.end=t.end),E.isExisting(t.format)&&(i.format=t.format),E.isExisting(t.link)&&(i.link=t.link),i}default(){return new qu}}const Qu=class{constructor(i){t(this,i),this.businessUnit="",this.scenarios=[],this.measures=[],this.intervalSpanLimit=28,this.order={hierarchy:[],direction:F.ASC},this.i18n=new Map,this.i18nMode=gt.ALL,this.locale="de",this.title=new Vu(new Ge),a(this)}async setBusinessUnit(t){this.businessUnit=t}async setProps(t){Object.keys(t).forEach((i=>{this[i]=t[i]}))}render(){return i("div",{key:"68a7e372d76be178503c975f345429b7ecf46680"},i("div",{key:"f76203c7c56228f71226596bd6fc21f4308dc0b0",innerHTML:ii(this.title.unit)}),i("div",{key:"8f0b7907d043b9564b51f51780abebb831b71651"},this.title.measures.map(((t,s)=>i("span",null,this.isFirstElement(s)?this.title.i18n.get("SEPERATOR_WS"):"",i("span",{class:"measure"},t.name)," ",t.unit?this.title.i18n.get("in"):""," ",t.unit)))),i("div",{key:"f05ed5b36f8b362c1daa19c1c40502b346046a19"},this.title.dimension))}componentWillLoad(){const t=this.prepareConfig();this.title=new Vu(new Ge(this.ruleSetConfig)),this.title.setI18n(this.i18n),this.title.setConfig(t)}componentWillUpdate(){const t=this.prepareConfig();this.title.setI18n(this.i18n),this.title.setRuleSet(new Ge(this.ruleSetConfig)),this.title.setConfig(t)}componentWillRender(){this.title.update()}isFirstElement(t){return 0!==t}prepareConfig(){return new Bu(new Ju,new Ku,new Lt(new Ql),new Ql).adapt({businessunit:this.businessUnit,measures:this.measures,scenarios:this.scenarios,timeperiod:this.timeperiod,intervalSpanLimit:this.intervalSpanLimit,i18nMode:this.i18nMode,order:this.order,locale:this.locale})}};Qu.style=':host{display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.measure{font-weight:bold}div{background-color:var(--bn-font-background, white);color:var(--bn-font-color, black)}p{margin:0}';export{ri as bn_asset,oi as bn_body,hi as bn_card,Gi as bn_chart_bubble,qi as bn_chart_bullet,Qi as bn_chart_scatter,Zi as bn_chart_structure,as as bn_chart_time,ls as bn_component_style,bs as bn_context,Qs as bn_dataset,Zs as bn_datasource,te as bn_footer,ce as bn_layout_card,ue as bn_layout_page,de as bn_message,fe as bn_page,pe as bn_scaling_group,_e as bn_table,Re as bn_title,We as bn_tree,Ll as ibcs_chart_bubble,Fl as ibcs_chart_bullet,Il as ibcs_chart_scatter,kc as ibcs_chart_structure,au as ibcs_chart_time,ju as ibcs_table,Qu as ibcs_title}
|