@bino-bi/bn-template-engine 1.0.0-next.51 → 1.0.0-next.52

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.
Files changed (25) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-4d99f1bb.entry.js +1 -0
  3. package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +101 -32
  4. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +72 -30
  7. package/dist/collection/components/bn-chart-structure/utils/elements/Bar.js +6 -0
  8. package/dist/collection/components/bn-chart-structure/utils/elements/Needle.js +6 -0
  9. package/dist/collection/components/bn-chart-structure/utils/helper/ElementPositions.js +3 -0
  10. package/dist/collection/components/bn-context/bn-context.js +14 -2
  11. package/dist/components/bn-chart-structure-renderer.js +1 -1
  12. package/dist/components/bn-chart-structure.js +1 -1
  13. package/dist/components/bn-context.js +1 -1
  14. package/dist/components/p-iJP2X4dc.js +1 -0
  15. package/dist/esm/bn-annotation-layer_30.entry.js +101 -32
  16. package/dist/esm/bn-template-engine.js +1 -1
  17. package/dist/esm/loader.js +1 -1
  18. package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +8 -1
  19. package/dist/types/components/bn-chart-structure/utils/elements/Bar.d.ts +2 -0
  20. package/dist/types/components/bn-chart-structure/utils/elements/Needle.d.ts +2 -0
  21. package/dist/types/components/bn-chart-structure/utils/helper/ElementPositions.d.ts +2 -0
  22. package/dist/types/components/bn-context/bn-context.d.ts +2 -1
  23. package/package.json +1 -1
  24. package/dist/bn-template-engine/p-0cad5598.entry.js +0 -1
  25. package/dist/components/p-Dpc8_R-Y.js +0 -1
@@ -145,10 +145,9 @@ export class StructureChart {
145
145
  // a sum row has no bar: it does not count for the scale
146
146
  const bars = this.dataModel.filter((row) => !row.sum);
147
147
  this.smallestDataPointValue = this.findSmallestDataPointValue(bars);
148
- const varianceBars = this.variancesDataModel.filter((row) => !row.sum);
149
- this.smallestVarianceDataPointValue = this.findSmallestDataPointValue(varianceBars);
148
+ this.smallestVarianceDataPointValue = this.findSmallestDataPointValue(this.variancesDataModel);
150
149
  this.highestDataPointValue = this.findHighestDataPointValue(bars);
151
- this.highestVarianceDataPointValue = this.findHighestDataPointValue(varianceBars);
150
+ this.highestVarianceDataPointValue = this.findHighestDataPointValue(this.variancesDataModel);
152
151
  this.axisScenario = this.setAxisScenario(config.variances);
153
152
  this.measureScale = config.measureScale;
154
153
  this.measureUnit = config.measureUnit;
@@ -889,37 +888,83 @@ export class StructureChart {
889
888
  this.position.getBarPositionX() + this.position.spacings.labelToAxis, this.position.getStackedHeaderPositionY(), "SCENARIO_HEADER", this.i18n.get(scenario) || scenario, this.styles, HookLocation.Bottom, HookLocation.Left).draw();
890
889
  }
891
890
  }
892
- /** The value of a sum row of a chart with plain bars or variances: a bold number at the axis, no bar. */
891
+ /** The scenarios of a sum row of a chart with plain bars that have a value, in the order of the `scenarios` prop. */
892
+ sumPoints(row) {
893
+ const points = [row.scenario1, row.scenario2, row.scenario3, row.scenario4].filter((point) => point != null && !point.isEmpty() && Number.isFinite(point.value));
894
+ const order = this.scenarioPropOrder;
895
+ const place = (point) => {
896
+ const index = order.indexOf(point.scenario);
897
+ return index === -1 ? order.length : index;
898
+ };
899
+ return points.sort((a, b) => place(a) - place(b));
900
+ }
901
+ /** How wide the numbers of a sum row of a chart with plain bars are, from the axis on. */
902
+ sumValuesWidth(row) {
903
+ const font = this.styles.fontStyles.size;
904
+ const labelToBar = font * this.styles.scaleFactors.labelToBar;
905
+ const points = this.sumPoints(row);
906
+ if (points.length === 0)
907
+ return 0;
908
+ const numbers = points.map((point) => this.boldWidth(this.sumText(point.value)));
909
+ if (points.length === 1)
910
+ return labelToBar + numbers[0];
911
+ return labelToBar + numbers.reduce((sum, width) => sum + font * 0.9 + width, 0) + (points.length - 1) * font * 1.4;
912
+ }
913
+ /**
914
+ * The sum row of a chart with plain bars: bold numbers at the axis, no bar. One
915
+ * scenario is a plain number. Several get a small square each, in the look of the scenario.
916
+ */
893
917
  drawSumValue(row, index, group) {
894
- const point = row.scenario1;
895
- if (point.isEmpty() || !Number.isFinite(point.value))
918
+ const points = this.sumPoints(row);
919
+ if (points.length === 0)
896
920
  return;
897
- const negative = point.value < 0;
898
- const label = new Label(group,
899
- // like the label of a bar without length: a negative number stands left of the axis
900
- this.position.getLabelPositionX(negative ? -0.000001 : 0), this.position.getBarCenterPositionY(index), "SUM_" + index, point.value, this.styles, HookLocation.Center, negative ? HookLocation.Right : HookLocation.Left)
901
- .setEmphasis(true, false)
902
- .setPoint(point.key);
903
- if (row.type === VarianceType.RELATIVE)
904
- label.setToRelativeVarianceLabel();
905
- else if (row.type === VarianceType.ABSOLUTE)
906
- label.setToVarianceLabel();
907
- label.draw(this.dataFormatDigits, this.measureScale);
921
+ const font = this.styles.fontStyles.size;
922
+ const y = this.position.getBarCenterPositionY(index);
923
+ const sumGroup = group.group().id(`sum_${index}`);
924
+ const number = (point, x, hook) => {
925
+ new Label(sumGroup, x, y, `SUM_${point.scenario}`, point.value, this.styles, HookLocation.Center, hook)
926
+ .setEmphasis(true, false)
927
+ .setPoint(point.key)
928
+ .draw(this.dataFormatDigits, this.measureScale);
929
+ };
930
+ if (points.length === 1) {
931
+ // like the label of a bar without length: a negative number stands left of the axis
932
+ const negative = points[0].value < 0;
933
+ number(points[0], this.position.getLabelPositionX(negative ? -0.000001 : 0), negative ? HookLocation.Right : HookLocation.Left);
934
+ return;
935
+ }
936
+ const key = font * 0.6;
937
+ const barStyles = this.scenarioStyles().barStyles;
938
+ let x = this.position.getLabelPositionX(0);
939
+ for (const point of points) {
940
+ const style = barStyles.getSVGStyle(point.getScenario());
941
+ sumGroup
942
+ .rect(key, key)
943
+ .fill({ color: (style === null || style === void 0 ? void 0 : style.fill) || "#000000" })
944
+ .stroke({ color: (style === null || style === void 0 ? void 0 : style.stroke) || "#000000", width: 1 })
945
+ .cy(y)
946
+ .x(x);
947
+ number(point, x + key + font * 0.3, HookLocation.Left);
948
+ x += font * 0.9 + this.boldWidth(this.sumText(point.value)) + font * 1.4;
949
+ }
908
950
  }
909
951
  drawVarianceScenario(dataModel, svgContainer) {
910
952
  const barsGroup = svgContainer.group().id("Scenarios");
911
953
  const scenarioFactory = new ScenarioFactory(this.position, barsGroup, this.scenarioStyles(), dataModel.length, this.i18n);
912
954
  scenarioFactory.setOverflowConfig(this.overflowConfig);
913
955
  dataModel.forEach((elements, index) => {
914
- if (elements.sum) {
915
- this.drawSumValue(elements, index, barsGroup);
916
- return;
917
- }
956
+ // the variance of a sum row is a bar like the others, with a bold number
918
957
  if (elements["type"] === VarianceType.RELATIVE) {
919
- scenarioFactory.createRelativeVarianceBar(elements["scenario1"], index).draw(this.dataFormatDigits);
958
+ const needle = scenarioFactory.createRelativeVarianceBar(elements["scenario1"], index);
959
+ if (elements.sum)
960
+ needle.emphasize();
961
+ needle.draw(this.dataFormatDigits);
920
962
  }
921
963
  else {
922
- scenarioFactory.createVarianceBar(elements["scenario1"], index).draw(this.dataFormatDigits, this.measureScale);
964
+ const bar = scenarioFactory.createVarianceBar(elements["scenario1"], index);
965
+ if (elements.sum)
966
+ bar.emphasize();
967
+ bar.draw(this.dataFormatDigits, this.measureScale);
923
968
  }
924
969
  });
925
970
  return barsGroup;
@@ -1114,7 +1159,7 @@ export class StructureChart {
1114
1159
  width = Math.max(width, this.referenceLineExtent());
1115
1160
  // the bold number of a sum row stands at the axis
1116
1161
  for (const row of this.dataModel) {
1117
- if (row.sum && VarianceType.NONE === varianceType && Number.isFinite(row.scenario1.value)) {
1162
+ if (row.sum && VarianceType.NONE === varianceType) {
1118
1163
  width = Math.max(width, this.sumRowExtent(row));
1119
1164
  }
1120
1165
  }
@@ -1338,10 +1383,9 @@ export class StructureChart {
1338
1383
  const rowWeight = weights[index];
1339
1384
  start.push(at);
1340
1385
  weight.push(rowWeight);
1341
- at +=
1342
- rowWeight + (row.gapAfter && index < rows.length - 1 ? 0.5 : 0) + (nameBelow && index === lastBar ? 0.8 : 0);
1386
+ at += rowWeight + (row.gapAfter && index < rows.length - 1 ? 0.5 : 0) + (nameBelow && index === lastBar ? 1 : 0);
1343
1387
  });
1344
- return { start, weight, total: at };
1388
+ return { start, weight, total: at, nameBelowBar: nameBelow };
1345
1389
  }
1346
1390
  /**
1347
1391
  * The height of each row in units of a normal row: by its total, with the same height
@@ -1461,9 +1505,7 @@ export class StructureChart {
1461
1505
  const total = this.stackConfig.labels === "value" ? labelToBar + this.boldWidth(this.sumText((_c = row.scenario1.value) !== null && _c !== void 0 ? _c : 0)) : 0;
1462
1506
  return this.stackSides.positive * this.pixelPerUnit + total;
1463
1507
  }
1464
- return Number.isFinite(row.scenario1.value)
1465
- ? labelToBar + this.boldWidth(this.sumText(row.scenario1.value))
1466
- : 0;
1508
+ return this.sumValuesWidth(row);
1467
1509
  }
1468
1510
  /** Where the reference line stands, as distance from the axis in px. Null without a line in this chart. */
1469
1511
  referenceLineOffset() {
@@ -75,6 +75,12 @@ export class Bar {
75
75
  (_a = this.label) === null || _a === void 0 ? void 0 : _a.setToRelativeVarianceLabel();
76
76
  return this;
77
77
  }
78
+ /** Prints the value in bold: the bar of a sum row. */
79
+ emphasize() {
80
+ var _a;
81
+ (_a = this.label) === null || _a === void 0 ? void 0 : _a.setEmphasis(true, false);
82
+ return this;
83
+ }
78
84
  updateLabelGroup(newGroup) {
79
85
  var _a;
80
86
  if (this.isEmpty() || newGroup == null) {
@@ -49,6 +49,12 @@ export class Needle {
49
49
  this.label.setToRelativeVarianceLabel().setPoint(dataPoint.key);
50
50
  }
51
51
  }
52
+ /** Prints the value in bold: the bar of a sum row. */
53
+ emphasize() {
54
+ var _a;
55
+ (_a = this.label) === null || _a === void 0 ? void 0 : _a.setEmphasis(true, false);
56
+ return this;
57
+ }
52
58
  updateLabelGroup(newGroup) {
53
59
  var _a;
54
60
  if (this.isEmpty() || newGroup == null) {
@@ -148,11 +148,14 @@ export class ElementPositions {
148
148
  return this.getAxisPositionY() + (rows + 1 / 2) * this.spacings.categoryWidth;
149
149
  }
150
150
  getScenarioLabelPositionOffsetY(isPrimaryBar) {
151
+ var _a;
151
152
  if (isPrimaryBar) {
152
153
  // The label belongs to the last bar, but the axis line runs past that bar's
153
154
  // center by (categoryWidth - scenarioOffset); place the label below the axis
154
155
  // end so the line does not strike through it.
155
156
  const belowBar = this.getBarWidth() * 0.5 + this.spacings.scenarioLabelToBar;
157
+ if ((_a = this.rows) === null || _a === void 0 ? void 0 : _a.nameBelowBar)
158
+ return belowBar;
156
159
  const belowAxisEnd = this.spacings.categoryWidth - this.spacings.scenarioOffset + this.spacings.labelToAxis;
157
160
  return Math.max(belowBar, belowAxisEnd);
158
161
  }
@@ -54,6 +54,18 @@ export class Context {
54
54
  withComponentStatus(this);
55
55
  this.errors = withHasError(this);
56
56
  }
57
+ watchGroupSeparator(newValue) {
58
+ var _a;
59
+ const before = Formatter.groupSeparator;
60
+ this.setGroupSeparator(newValue);
61
+ // the numbers are drawn with the old separator: what follows the locale draws again
62
+ const state = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.context.state;
63
+ if (state && Formatter.groupSeparator !== before) {
64
+ const locale = state.locale;
65
+ state.locale = "";
66
+ state.locale = locale;
67
+ }
68
+ }
57
69
  setGroupSeparator(newValue) {
58
70
  var _a;
59
71
  const named = { "thin-space": "\u2009", space: "\u00a0", none: "" };
@@ -250,7 +262,7 @@ export class Context {
250
262
  componentWillUpdate() { }
251
263
  componentDidUpdate() { }
252
264
  render() {
253
- return (h(Host, { key: '71bdc7dcbcadcae35b67f4d3fbb47e8ee204b3bb' }, h("slot", { key: 'c2fb4c85cb1a3b3af6ec013d0e558c0ef611358d' })));
265
+ return (h(Host, { key: '30cd6749c3af25eb4f287ee2771aff0858f4368d' }, h("slot", { key: 'ea8bab237f0103f3e3e259ff660004af9a30f982' })));
254
266
  }
255
267
  static get is() { return "bn-context"; }
256
268
  static get encapsulation() { return "shadow"; }
@@ -467,7 +479,7 @@ export class Context {
467
479
  static get watchers() {
468
480
  return [{
469
481
  "propName": "groupSeparator",
470
- "methodName": "setGroupSeparator"
482
+ "methodName": "watchGroupSeparator"
471
483
  }, {
472
484
  "propName": "locale",
473
485
  "methodName": "setLocale"
@@ -1 +1 @@
1
- import{B as o,d as p}from"./p-Dpc8_R-Y.js";const s=o,r=p;export{s as BnChartStructureRenderer,r as defineCustomElement}
1
+ import{B as o,d as s}from"./p-iJP2X4dc.js";const p=o,r=s;export{p as BnChartStructureRenderer,r as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as i,w as e,f as s,h as a,d as r,t as n}from"./p-BnmylmXF.js";import{h as o,a as l}from"./p-6242qMx1.js";import{k as c,v as h,a as d,i as p,l as u,b as v,c as m,h as g,m as f,n as b}from"./p-CcfvGlBq.js";import{v as y}from"./p-Zz3fAPcH.js";import{w as S}from"./p-CZzlLTQc.js";import{w}from"./p-BrQCbmG0.js";import{i as O,w as k,a as A}from"./p-D65TnLS9.js";import{w as _}from"./p-Bp5Xj4-s.js";import{w as D}from"./p-CU9CdEBF.js";import{w as x}from"./p-JG4Sx1lE.js";import{r as N}from"./p-D0v9GMIf.js";import{w as T}from"./p-Bs5V6Ibu.js";import{w as L,r as R}from"./p-D32TsLzd.js";import{g as W}from"./p-Dsvjkuy3.js";import{r as C,f as U,p as M}from"./p-Xb6Ilq8u.js";import{o as P}from"./p-B6kka9sT.js";import{A as j,e as F,f as z,g as $}from"./p-DguYWLBj.js";import{a as I,O as E}from"./p-BBdzTx8V.js";import{L as B}from"./p-DY5fMUX8.js";import{o as G,m as H}from"./p-DdvG1D18.js";import{r as J,a as V}from"./p-CckAR27O.js";import{a as X}from"./p-BXP6aagM.js";import{a as q}from"./p-JofGXz75.js";import{s as Y}from"./p-DakXa7Dp.js";import{d as Z}from"./p-Dpc8_R-Y.js";const Q=t(class t extends i{validateFilter(t){const i="ERR_filter";o(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateScenario(t){const i="WARN_scenarios";if(O(t)||c(t))return void this.errors.remove(i);const e=h(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="WARN_variances";if(O(t))return void this.errors.remove(i);const e=d(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateUnitScaling(t){const i="WARN_unitScaling";p(t)?this.errors.remove(i):"invalid"===C(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="WARN_percentageScaling";p(t)?this.errors.remove(i):"invalid"===C(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="WARN_level";p(t)||u(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="WARN_order";if(O(t))return void this.errors.remove(i);const e=v(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="WARN_orderDirection";O(t)||p(t)||m(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLimit(t){const i="WARN_limit";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureScale(t){const i="WARN_measureScale";f(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateDataFormatDigitsDecimal(t){this.validateDigits("dataFormatDigitsDecimal",t)}validateDataFormatDigitsPercent(t){this.validateDigits("dataFormatDigitsPercent",t)}validateDigits(t,i){const e="WARN_"+t;!g(i)||Number(i)<0||Number(i)>100?this.errors.addOrReplace({id:e,type:"warning",message:t+": invalid value '"+i+"' is not supported."}):this.errors.remove(e)}validateSums(t){this.warnUnless("sums",["none","groups","total","all"].includes(t),t)}validateScenarioLabelPosition(t){this.warnUnless("scenarioLabelPosition",["bottom","top"].includes(t),t)}validateReferenceLine(t){this.warnUnless("referenceLine",p(t)||null!==this.prepareReferenceLine(),t)}validateItalicCategories(t){this.warnUnless("italicCategories",p(t)||null!==this.prepareItalicCategories(),t)}warnUnless(t,i,e){const s="WARN_"+t;i?this.errors.remove(s):this.errors.addOrReplace({id:s,type:"warning",message:t+": invalid value '"+e+"' is not supported."})}prepareReferenceLine(){if(p(this.referenceLine))return null;try{const t=JSON.parse(this.referenceLine);return"number"==typeof(null==t?void 0:t.value)&&Number.isFinite(t.value)?{value:t.value,label:"string"==typeof t.label?t.label:void 0}:null}catch(t){return null}}prepareItalicCategories(){if(p(this.italicCategories))return[];try{const t=JSON.parse(this.italicCategories);return Array.isArray(t)&&t.every((t=>"string"==typeof t))?t:null}catch(t){return null}}validateStack(t){const i="WARN_stack",e=b(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("WARN_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"WARN_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("WARN_scale")}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),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=!0,this.measureScale="greatest",this.showMeasureScale=!1,this.measureUnit="",this.dataFormatDigitsDecimal=1,this.dataFormatDigitsPercent=2,this.sums="none",this.sumTitle="",this.scenarioLabelPosition="bottom",this.referenceLine="",this.italicCategories="",this.stack="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=i=>{var e,s,a,r,n,o;this.lastAutoScalingReport={unit:null!==(e=i.unit)&&void 0!==e?e:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(a=i.percentage)&&void 0!==a?a:null===(r=this.lastAutoScalingReport)||void 0===r?void 0:r.percentage};const l=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),c=this.getEffectiveFontPx();if(void 0!==i.unit&&i.unit>0&&this.autoUnitWarningActive){const e=c/i.unit;l(e,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=e,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(((null!==(n=this.unitScaling)&&void 0!==n?n:"")+"").trim())}, auto-fitted to 1 em ≈ ${U(e)} units.`}))}if(void 0!==i.percentage&&i.percentage>0&&this.autoPctWarningActive){const e=100*c/i.percentage;l(e,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=e,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(((null!==(o=this.percentageScaling)&&void 0!==o?o:"")+"").trim())}, auto-fitted to 1 em ≈ ${U(e)} percentage points.`}))}},D(this),w(this),S(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),_(this),this.componentStyle=x(this),this.ruleSetConfig=T(this),this.t=k(this).t,this.resolveInherited=A(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.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal),this.validateDataFormatDigitsPercent(this.dataFormatDigitsPercent),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateMeasureScale(this.measureScale),this.validateStack(this.stack),this.validateSums(this.sums),this.validateScenarioLabelPosition(this.scenarioLabelPosition),this.validateReferenceLine(this.referenceLine),this.validateItalicCategories(this.italicCategories),this.validateScaling(this.scale)}componentDidRender(){Y(this.element,"bn-chart-structure-renderer");const{mode:t}=M(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}=W(i);if(s<=0)return void this.checkOverflow();this._lastScaledParentHeight=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=i.scrollHeight,n=this.appliedScaleFactor;if(r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,n*(s-1)/r);Math.abs(o-n)<.01||(i.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=P(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=W(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=W(this.element);this._lastScaledParentHeight=t,s(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("bn-chart-structure-renderer");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,r;const n=parseFloat(null!==(r=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("width"))&&void 0!==r?r:"");Number.isNaN(n)||(e+=n,s=!0)})),s?Math.max(Math.floor(e),this.element.scrollWidth):this.element.scrollWidth}checkOverflow(){const t=W(this.element),i=this.measureContentWidth(),e=this.element.scrollHeight,s=t.width>0&&i>t.width+1,a=t.height>0&&e>t.height+1;if(!s&&!a)return void R(this.errors,null);const r=this.prepareVariances().some((t=>t.startsWith("dr"))),n="value"===C(this.unitScaling,this.pixelPerUnitGroupMap).kind,o=r&&"value"===C(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:l}=M(this.scale),c="auto"!==l&&"empty"!==l,h=[];s&&n&&h.push("unit-scaling"),s&&o&&h.push("percentage-scaling"),a&&c&&h.push("scale");const d=[];s&&d.push(`width (${Math.round(i)}px > ${Math.round(t.width)}px)`),a&&d.push(`height (${Math.round(e)}px > ${Math.round(t.height)}px)`),R(this.errors,`Chart exceeds available ${d.join(" and ")}. `+(h.length>0?`Adjust ${h.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container."),h.length>0)}prepareDimension(){const t=W(this.element),i=Math.max(1,this.prepareSegments().length);return this.canvasWidthSegmented=t.width/i,{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(a.inherited)return this.errors.remove("AUTO_scenarios"),a.value.split(",").map((t=>t.trim()));if(c(a.value))return this.errors.remove("AUTO_scenarios"),[];const r="auto"===(null===(t=a.value)||void 0===t?void 0:t.trim().toLowerCase());return p(a.value)||r?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(r||a.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===(s=a.value)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return p(t)?[]:null==t?void 0:t.split(",").map((t=>t.trim()))}hidesScenarios(){const t=this.resolveInherited("scenarios",this.scenarios);return!t.inherited&&c(t.value)}prepareSegments(){return this.hidesScenarios()?this.prepareVariances():["",...this.prepareVariances()]}prepareHideCategories(t){return t>=1||!this.showCategories}prepareI18n(){const t=l,i=new Map(["no-data","REST"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries(),...N(this.ruleSetConfig("user"))])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const i=C(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/i.value):"auto"===i.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: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const i=C(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/i.value):"auto"===i.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: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return p(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),j[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),j[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),e=i.value,s=this.resolveInherited("orderDirection",this.orderDirection).value,a="auto"===(null==e?void 0:e.trim().toLowerCase());let r;return p(e)||a?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(a||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=e:(this.errors.remove("AUTO_order"),r=e),{hierarchy:null==r?void 0:r.split(",").map((t=>E[null==t?void 0:t.toUpperCase()])),direction:I[null==s?void 0:s.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=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:`${e}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:e,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.hidesScenarios()?"":this.chartTitle}prepareStackConfig(){if(p(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),this.errors.remove("WARN_stack_thickness_variances"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===F.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,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(e)}else this.errors.remove(e);const s="total"===t.thickness,a=s&&this.prepareVariances().length>0;return a?this.errors.addOrReplace({id:"WARN_stack_thickness_variances",type:"warning",message:"stack thickness total: not used together with variances, the rows keep one height."}):this.errors.remove("WARN_stack_thickness_variances"),{by:i,mode:t.mode||$.ABSOLUTE,order:t.order||z.DATASET,percentMark:!0===t.percentMark,labels:"value"===t.labels?"value":"share",thickness:s&&!a?"total":"equal",totalTitle:"string"==typeof t.totalTitle?t.totalTitle:void 0}}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 p(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&&this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,i){var e;const s=this.preparePixelPerUnit(),r=this.preparePixelPerPercentage(),n=this.prepareStackConfig(),o=""===t,l=this.hidesScenarios()?y([t]):this.prepareScenarios(),c=o&&(null==n?void 0:n.by)===F.DIMENSIONS?l.slice(0,1):l;return a("bn-chart-structure-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:c,variances:[t],hideCategories:this.prepareHideCategories(i),pixelPerUnit:s,pixelPerPercentage:r,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(i),stackConfig:n,sums:["groups","total","all"].includes(this.sums)?this.sums:"none",sumTitle:this.sumTitle,scenarioLabelTop:"top"===this.scenarioLabelPosition,referenceLine:o?this.prepareReferenceLine():null,italicCategories:null!==(e=this.prepareItalicCategories())&&void 0!==e?e:[],dataFormatDigits:{percent:this.dataFormatDigitsPercent,decimal:this.dataFormatDigitsDecimal},parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getBaseline(){return q(this.element,"bn-chart-structure-renderer")}async getLayoutState(t){var i,e,s,a;const r=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",n=G(this.element),o=this.getEffectiveScaleFactor(),l=Number.isFinite(o)&&o>0?o:1,c=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*l,h=this.prepareVariances(),d=X(this.element,"bn-chart-structure-renderer",this.prepareSegments().map((t=>t||"base")),n,r),p=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("bn-chart-structure-renderer"),u={version:B,tag:this.element.localName,id:V(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:H(this.element,n),em:{fontSizePx:c,appliedScaleFactor:l},regions:d.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(a=null==p?void 0:p.scenarios)&&void 0!==a?a:[],variances:h,barCount:d.barCount,hasNoData:0===d.barCount},diagnostics:J(this.element),scaling:this.resolveScalingInfo(c),baseline:d.baseline};return d.elements&&(u.elements=d.elements),u}resolveScalingInfo(t){var i,e;const s={},a=C(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===a.kind)s.unitMode="fixed",s.unitsPerEm=a.value,s.unitPxPerUnit=t/a.value;else{s.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(s.unitPxPerUnit=e,s.unitsPerEm=t/e)}const r=C(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===r.kind)s.percentageMode="fixed",s.percentagePointsPerEm=r.value,s.percentagePxPerPoint=t/r.value;else{s.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(s.percentagePxPerPoint=i/100,s.percentagePointsPerEm=100*t/i)}return s}getEffectiveScaleFactor(){const{mode:t,factor:i}=M(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.prepareSegments();0===t.length?this.errors.addOrReplace({id:"WARN_scenarios_none",type:"warning",message:"scenarios: none needs at least one variance, the chart is empty."}):this.errors.remove("WARN_scenarios_none");const i=this.getFontStyles();return a(r,{key:"eb0b081632a3d8e9475f280357c0b22b17b23df3",style:i},a("div",{key:"8ecaea33bcd96b312e39868f008aa630e12077c2",class:"container"},t.map(this.chartTemplate)))}get element(){return 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}],measureScale:[{validateMeasureScale:0}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDataFormatDigitsPercent:0}],sums:[{validateSums:0}],scenarioLabelPosition:[{validateScenarioLabelPosition:0}],referenceLine:[{validateReferenceLine:0}],italicCategories:[{validateItalicCategories:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}static get style(){return':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}'}},[1,"bn-chart-structure",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],chartTitle:[1,"chart-title"],ruleset:[513],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[4,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[4,"show-measure-scale"],measureUnit:[1,"measure-unit"],dataFormatDigitsDecimal:[2,"data-format-digits-decimal"],dataFormatDigitsPercent:[2,"data-format-digits-percent"],sums:[1],sumTitle:[1,"sum-title"],scenarioLabelPosition:[1,"scenario-label-position"],referenceLine:[1,"reference-line"],italicCategories:[1,"italic-categories"],stack:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{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}],measureScale:[{validateMeasureScale:0}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDataFormatDigitsPercent:0}],sums:[{validateSums:0}],scenarioLabelPosition:[{validateScenarioLabelPosition:0}],referenceLine:[{validateReferenceLine:0}],italicCategories:[{validateItalicCategories:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),K=Q,tt=function(){"undefined"!=typeof customElements&&["bn-chart-structure","bn-chart-structure-renderer"].forEach((t=>{switch(t){case"bn-chart-structure":customElements.get(n(t))||customElements.define(n(t),Q);break;case"bn-chart-structure-renderer":customElements.get(n(t))||Z()}}))};export{K as BnChartStructure,tt as defineCustomElement}
1
+ import{p as t,H as i,w as e,f as s,h as a,d as r,t as n}from"./p-BnmylmXF.js";import{h as o,a as l}from"./p-6242qMx1.js";import{k as c,v as h,a as d,i as p,l as u,b as v,c as m,h as g,m as f,n as b}from"./p-CcfvGlBq.js";import{v as y}from"./p-Zz3fAPcH.js";import{w as S}from"./p-CZzlLTQc.js";import{w}from"./p-BrQCbmG0.js";import{i as O,w as k,a as A}from"./p-D65TnLS9.js";import{w as _}from"./p-Bp5Xj4-s.js";import{w as D}from"./p-CU9CdEBF.js";import{w as x}from"./p-JG4Sx1lE.js";import{r as N}from"./p-D0v9GMIf.js";import{w as T}from"./p-Bs5V6Ibu.js";import{w as L,r as R}from"./p-D32TsLzd.js";import{g as W}from"./p-Dsvjkuy3.js";import{r as C,f as P,p as U}from"./p-Xb6Ilq8u.js";import{o as M}from"./p-B6kka9sT.js";import{A as j,e as F,f as z,g as $}from"./p-DguYWLBj.js";import{a as I,O as E}from"./p-BBdzTx8V.js";import{L as B}from"./p-DY5fMUX8.js";import{o as G,m as H}from"./p-DdvG1D18.js";import{r as J,a as V}from"./p-CckAR27O.js";import{a as X}from"./p-BXP6aagM.js";import{a as q}from"./p-JofGXz75.js";import{s as Y}from"./p-DakXa7Dp.js";import{d as Z}from"./p-iJP2X4dc.js";const Q=t(class t extends i{validateFilter(t){const i="ERR_filter";o(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateScenario(t){const i="WARN_scenarios";if(O(t)||c(t))return void this.errors.remove(i);const e=h(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="WARN_variances";if(O(t))return void this.errors.remove(i);const e=d(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateUnitScaling(t){const i="WARN_unitScaling";p(t)?this.errors.remove(i):"invalid"===C(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="WARN_percentageScaling";p(t)?this.errors.remove(i):"invalid"===C(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="WARN_level";p(t)||u(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="WARN_order";if(O(t))return void this.errors.remove(i);const e=v(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="WARN_orderDirection";O(t)||p(t)||m(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLimit(t){const i="WARN_limit";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureScale(t){const i="WARN_measureScale";f(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateDataFormatDigitsDecimal(t){this.validateDigits("dataFormatDigitsDecimal",t)}validateDataFormatDigitsPercent(t){this.validateDigits("dataFormatDigitsPercent",t)}validateDigits(t,i){const e="WARN_"+t;!g(i)||Number(i)<0||Number(i)>100?this.errors.addOrReplace({id:e,type:"warning",message:t+": invalid value '"+i+"' is not supported."}):this.errors.remove(e)}validateSums(t){this.warnUnless("sums",["none","groups","total","all"].includes(t),t)}validateScenarioLabelPosition(t){this.warnUnless("scenarioLabelPosition",["bottom","top"].includes(t),t)}validateReferenceLine(t){this.warnUnless("referenceLine",p(t)||null!==this.prepareReferenceLine(),t)}validateItalicCategories(t){this.warnUnless("italicCategories",p(t)||null!==this.prepareItalicCategories(),t)}warnUnless(t,i,e){const s="WARN_"+t;i?this.errors.remove(s):this.errors.addOrReplace({id:s,type:"warning",message:t+": invalid value '"+e+"' is not supported."})}prepareReferenceLine(){if(p(this.referenceLine))return null;try{const t=JSON.parse(this.referenceLine);return"number"==typeof(null==t?void 0:t.value)&&Number.isFinite(t.value)?{value:t.value,label:"string"==typeof t.label?t.label:void 0}:null}catch(t){return null}}prepareItalicCategories(){if(p(this.italicCategories))return[];try{const t=JSON.parse(this.italicCategories);return Array.isArray(t)&&t.every((t=>"string"==typeof t))?t:null}catch(t){return null}}validateStack(t){const i="WARN_stack",e=b(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("WARN_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"WARN_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("WARN_scale")}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),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=!0,this.measureScale="greatest",this.showMeasureScale=!1,this.measureUnit="",this.dataFormatDigitsDecimal=1,this.dataFormatDigitsPercent=2,this.sums="none",this.sumTitle="",this.scenarioLabelPosition="bottom",this.referenceLine="",this.italicCategories="",this.stack="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=i=>{var e,s,a,r,n,o;this.lastAutoScalingReport={unit:null!==(e=i.unit)&&void 0!==e?e:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(a=i.percentage)&&void 0!==a?a:null===(r=this.lastAutoScalingReport)||void 0===r?void 0:r.percentage};const l=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),c=this.getEffectiveFontPx();if(void 0!==i.unit&&i.unit>0&&this.autoUnitWarningActive){const e=c/i.unit;l(e,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=e,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(((null!==(n=this.unitScaling)&&void 0!==n?n:"")+"").trim())}, auto-fitted to 1 em ≈ ${P(e)} units.`}))}if(void 0!==i.percentage&&i.percentage>0&&this.autoPctWarningActive){const e=100*c/i.percentage;l(e,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=e,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(((null!==(o=this.percentageScaling)&&void 0!==o?o:"")+"").trim())}, auto-fitted to 1 em ≈ ${P(e)} percentage points.`}))}},D(this),w(this),S(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),_(this),this.componentStyle=x(this),this.ruleSetConfig=T(this),this.t=k(this).t,this.resolveInherited=A(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.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal),this.validateDataFormatDigitsPercent(this.dataFormatDigitsPercent),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateMeasureScale(this.measureScale),this.validateStack(this.stack),this.validateSums(this.sums),this.validateScenarioLabelPosition(this.scenarioLabelPosition),this.validateReferenceLine(this.referenceLine),this.validateItalicCategories(this.italicCategories),this.validateScaling(this.scale)}componentDidRender(){Y(this.element,"bn-chart-structure-renderer");const{mode:t}=U(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}=W(i);if(s<=0)return void this.checkOverflow();this._lastScaledParentHeight=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=i.scrollHeight,n=this.appliedScaleFactor;if(r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,n*(s-1)/r);Math.abs(o-n)<.01||(i.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=M(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=W(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=W(this.element);this._lastScaledParentHeight=t,s(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("bn-chart-structure-renderer");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,r;const n=parseFloat(null!==(r=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("width"))&&void 0!==r?r:"");Number.isNaN(n)||(e+=n,s=!0)})),s?Math.max(Math.floor(e),this.element.scrollWidth):this.element.scrollWidth}checkOverflow(){const t=W(this.element),i=this.measureContentWidth(),e=this.element.scrollHeight,s=t.width>0&&i>t.width+1,a=t.height>0&&e>t.height+1;if(!s&&!a)return void R(this.errors,null);const r=this.prepareVariances().some((t=>t.startsWith("dr"))),n="value"===C(this.unitScaling,this.pixelPerUnitGroupMap).kind,o=r&&"value"===C(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:l}=U(this.scale),c="auto"!==l&&"empty"!==l,h=[];s&&n&&h.push("unit-scaling"),s&&o&&h.push("percentage-scaling"),a&&c&&h.push("scale");const d=[];s&&d.push(`width (${Math.round(i)}px > ${Math.round(t.width)}px)`),a&&d.push(`height (${Math.round(e)}px > ${Math.round(t.height)}px)`),R(this.errors,`Chart exceeds available ${d.join(" and ")}. `+(h.length>0?`Adjust ${h.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container."),h.length>0)}prepareDimension(){const t=W(this.element),i=Math.max(1,this.prepareSegments().length);return this.canvasWidthSegmented=t.width/i,{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(a.inherited)return this.errors.remove("AUTO_scenarios"),a.value.split(",").map((t=>t.trim()));if(c(a.value))return this.errors.remove("AUTO_scenarios"),[];const r="auto"===(null===(t=a.value)||void 0===t?void 0:t.trim().toLowerCase());return p(a.value)||r?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(r||a.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===(s=a.value)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return p(t)?[]:null==t?void 0:t.split(",").map((t=>t.trim()))}hidesScenarios(){const t=this.resolveInherited("scenarios",this.scenarios);return!t.inherited&&c(t.value)}prepareSegments(){return this.hidesScenarios()?this.prepareVariances():["",...this.prepareVariances()]}prepareHideCategories(t){return t>=1||!this.showCategories}prepareI18n(){const t=l,i=new Map(["no-data","REST"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries(),...N(this.ruleSetConfig("user"))])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const i=C(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/i.value):"auto"===i.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: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const i=C(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/i.value):"auto"===i.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: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return p(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),j[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),j[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),e=i.value,s=this.resolveInherited("orderDirection",this.orderDirection).value,a="auto"===(null==e?void 0:e.trim().toLowerCase());let r;return p(e)||a?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(a||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=e:(this.errors.remove("AUTO_order"),r=e),{hierarchy:null==r?void 0:r.split(",").map((t=>E[null==t?void 0:t.toUpperCase()])),direction:I[null==s?void 0:s.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=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:`${e}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:e,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.hidesScenarios()?"":this.chartTitle}prepareStackConfig(){if(p(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),this.errors.remove("WARN_stack_thickness_variances"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===F.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,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(e)}else this.errors.remove(e);const s="total"===t.thickness,a=s&&this.prepareVariances().length>0;return a?this.errors.addOrReplace({id:"WARN_stack_thickness_variances",type:"warning",message:"stack thickness total: not used together with variances, the rows keep one height."}):this.errors.remove("WARN_stack_thickness_variances"),{by:i,mode:t.mode||$.ABSOLUTE,order:t.order||z.DATASET,percentMark:!0===t.percentMark,labels:"value"===t.labels?"value":"share",thickness:s&&!a?"total":"equal",totalTitle:"string"==typeof t.totalTitle?t.totalTitle:void 0}}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 p(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&&this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,i){var e;const s=this.preparePixelPerUnit(),r=this.preparePixelPerPercentage(),n=this.prepareStackConfig(),o=""===t,l=this.hidesScenarios()?y([t]):this.prepareScenarios(),c=o&&(null==n?void 0:n.by)===F.DIMENSIONS?l.slice(0,1):l;return a("bn-chart-structure-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:c,variances:[t],hideCategories:this.prepareHideCategories(i),pixelPerUnit:s,pixelPerPercentage:r,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(i),stackConfig:n,sums:["groups","total","all"].includes(this.sums)?this.sums:"none",sumTitle:this.sumTitle,scenarioLabelTop:"top"===this.scenarioLabelPosition,referenceLine:o?this.prepareReferenceLine():null,italicCategories:null!==(e=this.prepareItalicCategories())&&void 0!==e?e:[],dataFormatDigits:{percent:this.dataFormatDigitsPercent,decimal:this.dataFormatDigitsDecimal},parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getBaseline(){return q(this.element,"bn-chart-structure-renderer")}async getLayoutState(t){var i,e,s,a;const r=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",n=G(this.element),o=this.getEffectiveScaleFactor(),l=Number.isFinite(o)&&o>0?o:1,c=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*l,h=this.prepareVariances(),d=X(this.element,"bn-chart-structure-renderer",this.prepareSegments().map((t=>t||"base")),n,r),p=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("bn-chart-structure-renderer"),u={version:B,tag:this.element.localName,id:V(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:H(this.element,n),em:{fontSizePx:c,appliedScaleFactor:l},regions:d.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(a=null==p?void 0:p.scenarios)&&void 0!==a?a:[],variances:h,barCount:d.barCount,hasNoData:0===d.barCount},diagnostics:J(this.element),scaling:this.resolveScalingInfo(c),baseline:d.baseline};return d.elements&&(u.elements=d.elements),u}resolveScalingInfo(t){var i,e;const s={},a=C(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===a.kind)s.unitMode="fixed",s.unitsPerEm=a.value,s.unitPxPerUnit=t/a.value;else{s.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(s.unitPxPerUnit=e,s.unitsPerEm=t/e)}const r=C(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===r.kind)s.percentageMode="fixed",s.percentagePointsPerEm=r.value,s.percentagePxPerPoint=t/r.value;else{s.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(s.percentagePxPerPoint=i/100,s.percentagePointsPerEm=100*t/i)}return s}getEffectiveScaleFactor(){const{mode:t,factor:i}=U(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.prepareSegments();0===t.length?this.errors.addOrReplace({id:"WARN_scenarios_none",type:"warning",message:"scenarios: none needs at least one variance, the chart is empty."}):this.errors.remove("WARN_scenarios_none");const i=this.getFontStyles();return a(r,{key:"eb0b081632a3d8e9475f280357c0b22b17b23df3",style:i},a("div",{key:"8ecaea33bcd96b312e39868f008aa630e12077c2",class:"container"},t.map(this.chartTemplate)))}get element(){return 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}],measureScale:[{validateMeasureScale:0}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDataFormatDigitsPercent:0}],sums:[{validateSums:0}],scenarioLabelPosition:[{validateScenarioLabelPosition:0}],referenceLine:[{validateReferenceLine:0}],italicCategories:[{validateItalicCategories:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}static get style(){return':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}'}},[1,"bn-chart-structure",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],chartTitle:[1,"chart-title"],ruleset:[513],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[4,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[4,"show-measure-scale"],measureUnit:[1,"measure-unit"],dataFormatDigitsDecimal:[2,"data-format-digits-decimal"],dataFormatDigitsPercent:[2,"data-format-digits-percent"],sums:[1],sumTitle:[1,"sum-title"],scenarioLabelPosition:[1,"scenario-label-position"],referenceLine:[1,"reference-line"],italicCategories:[1,"italic-categories"],stack:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{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}],measureScale:[{validateMeasureScale:0}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDataFormatDigitsPercent:0}],sums:[{validateSums:0}],scenarioLabelPosition:[{validateScenarioLabelPosition:0}],referenceLine:[{validateReferenceLine:0}],italicCategories:[{validateItalicCategories:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),K=Q,tt=function(){"undefined"!=typeof customElements&&["bn-chart-structure","bn-chart-structure-renderer"].forEach((t=>{switch(t){case"bn-chart-structure":customElements.get(n(t))||customElements.define(n(t),Q);break;case"bn-chart-structure-renderer":customElements.get(n(t))||Z()}}))};export{K as BnChartStructure,tt as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as e,e as o,f as n,h as i,d as a,t as s}from"./p-BnmylmXF.js";import{F as r}from"./p-Zz3fAPcH.js";import{S as c,e as l}from"./p-6242qMx1.js";import{L as p}from"./p-DY5fMUX8.js";import{m as u,t as m}from"./p-DdvG1D18.js";import{r as d,a as h,b,c as g}from"./p-CckAR27O.js";import{b as f}from"./p-VtNvNyZK.js";import{w as y}from"./p-BrQCbmG0.js";import{m as v}from"./p-JG4Sx1lE.js";import{w as x}from"./p-D32TsLzd.js";import{b as S}from"./p-DM7fwmH4.js";function w(t){if("function"==typeof getComputedStyle){const e=parseFloat(getComputedStyle(t).fontSize);if(Number.isFinite(e)&&e>0)return e}return c.global.fontSizePx}function j(t,e){var o;return{version:p,tag:t.localName,id:h(t),slot:null!==(o=t.getAttribute("slot"))&&void 0!==o?o:void 0,rect:u(t,e),em:{fontSizePx:w(t),appliedScaleFactor:1},regions:[],metadata:{},diagnostics:d(t)}}const L=["format","orientation","page-format","page-orientation","render-orientation","page-number"],P=(t,e,o)=>{const n=t[e];return"string"==typeof n?n:e in t?null:t.getAttribute(o)},D=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.bnNotationChange=o(this,"bnNotationChange",7),this.groupSeparator="",this.setsGroupSeparator=!1,this.assignedPageNumbers=new WeakMap,this.notationSubscriptions=[],y(this),this.errors=x(this)}setGroupSeparator(t){var e;r.groupSeparator=t?null!==(e={"thin-space":" ",space:" ",none:""}[t])&&void 0!==e?e:t:null,this.setsGroupSeparator=!!t}setLocale(t){this.stores.context.state.locale=t}connectedCallback(){this.stores=l(this.element),this.locale&&(this.stores.context.state.locale=this.locale),this.groupSeparator&&this.setGroupSeparator(this.groupSeparator);const t=()=>this.bnNotationChange.emit();this.notationSubscriptions=[this.stores.scalingGroups.on("set",t),this.stores.componentStyles.on("set",t)],this.syncPages(),this.pageObserver=new MutationObserver((()=>this.syncPages())),this.pageObserver.observe(this.element,{childList:!0,subtree:!0,attributes:!0,attributeFilter:L})}disconnectedCallback(){var t,e;this.setsGroupSeparator&&(r.groupSeparator=null,this.setsGroupSeparator=!1),this.notationSubscriptions.forEach((t=>t())),this.notationSubscriptions=[],null===(t=this.pageObserver)||void 0===t||t.disconnect(),null===(e=this.pageSizeStyle)||void 0===e||e.remove(),this.pageSizeStyle=void 0}syncPages(){const t=Array.from(this.element.querySelectorAll("bn-page, bn-layout-page"));t.forEach(((t,e)=>{const o="bn-layout-page"===t.localName?t:t.querySelector("bn-footer");if(!o)return;const n=P(o,"pageNumber","page-number");if(null!==n&&n!==this.assignedPageNumbers.get(o))return;const i=""+(e+1);this.assignedPageNumbers.set(o,i),n!==i&&o.setAttribute("page-number",i)}));const e=this.element.getAttribute("render-orientation");void 0!==this.lastRenderOrientation&&this.lastRenderOrientation!==e&&t.filter((t=>"bn-layout-page"===t.localName)).forEach((t=>n(t))),this.lastRenderOrientation=e,this.writePageSize(t[0],e)}writePageSize(t,e){var o;if(!t||document.querySelector("bn-context")!==this.element)return null===(o=this.pageSizeStyle)||void 0===o||o.remove(),void(this.pageSizeStyle=void 0);const n="bn-layout-page"===t.localName?S(P(t,"pageFormat","page-format"),P(t,"pageOrientation","page-orientation"),e):S(P(t,"format","format"),P(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!==n&&(this.pageSizeStyle.textContent=n)}async getLayoutState(t){var e,o;const n=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",i=Array.from(this.element.querySelectorAll("bn-annotation-layer, bn-annotation-list, 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-text, bn-title, bn-tree"));await Promise.all(i.map((t=>{var e,o,n;return null!==(n=null===(o=(e=t).componentOnReady)||void 0===o?void 0:o.call(e))&&void 0!==n?n:Promise.resolve()})));const a=this.element.getBoundingClientRect(),s={x:a.left,y:a.top},r=await Promise.all(i.map((async t=>{const e=t.getBoundingClientRect(),o={context:s,component:{x:e.left,y:e.top}};try{const e=t;return"function"==typeof e.getLayoutState?await e.getLayoutState({detail:n}):j(t,o)}catch(e){let n;try{n=j(t,o)}catch(e){const o={x:0,y:0,width:0,height:0};n={version:p,tag:t.localName,id:t.localName,rect:{context:Object.assign({},o),component:Object.assign({},o)},em:{fontSizePx:0,appliedScaleFactor:1},regions:[],metadata:{},diagnostics:[]}}return n.error=(e instanceof Error?e.message:e)+"",n}}))),c=b(i.map((t=>({tag:t.localName,explicitId:g(t)}))));return r.forEach(((t,e)=>{t.id=c[e]})),{version:p,generatedAt:(new Date).toISOString(),detail:n,context:{viewport:m(a),locale:null===(o=this.stores)||void 0===o?void 0:o.context.state.locale},components:r}}async getNotation(t){const e=Array.from(this.element.querySelectorAll("bn-component-style, bn-scaling-group"));return await Promise.all(e.map((t=>{var e,o;return null!==(o=null===(e=t.componentOnReady)||void 0===e?void 0:e.call(t))&&void 0!==o?o:Promise.resolve()}))),f(v(this.stores.componentStyles.state,t),this.stores.scalingGroups.state)}componentWillLoad(){}componentDidLoad(){}componentShouldUpdate(){}componentWillRender(){}componentDidRender(){}componentWillUpdate(){}componentDidUpdate(){}render(){return i(a,{key:"71bdc7dcbcadcae35b67f4d3fbb47e8ee204b3bb"},i("slot",{key:"c2fb4c85cb1a3b3af6ec013d0e558c0ef611358d"}))}get element(){return this}static get watchers(){return{groupSeparator:[{setGroupSeparator:0}],locale:[{setLocale:0}]}}static get style(){return":host{display:block}"}},[257,"bn-context",{locale:[1],i18nNamespace:[513,"i18n-namespace"],renderOrientation:[513,"render-orientation"],groupSeparator:[1,"group-separator"],getLayoutState:[64],getNotation:[64]},void 0,{groupSeparator:[{setGroupSeparator:0}],locale:[{setLocale:0}]}]),N=D,k=function(){"undefined"!=typeof customElements&&["bn-context"].forEach((t=>{"bn-context"===t&&(customElements.get(s(t))||customElements.define(s(t),D))}))};export{N as BnContext,k as defineCustomElement}
1
+ import{p as t,H as e,e as o,f as n,h as a,d as i,t as s}from"./p-BnmylmXF.js";import{F as r}from"./p-Zz3fAPcH.js";import{S as c,e as l}from"./p-6242qMx1.js";import{L as p}from"./p-DY5fMUX8.js";import{m as h,t as u}from"./p-DdvG1D18.js";import{r as m,a as d,b,c as f}from"./p-CckAR27O.js";import{b as g}from"./p-VtNvNyZK.js";import{w as v}from"./p-BrQCbmG0.js";import{m as y}from"./p-JG4Sx1lE.js";import{w as S}from"./p-D32TsLzd.js";import{b as x}from"./p-DM7fwmH4.js";function w(t){if("function"==typeof getComputedStyle){const e=parseFloat(getComputedStyle(t).fontSize);if(Number.isFinite(e)&&e>0)return e}return c.global.fontSizePx}function j(t,e){var o;return{version:p,tag:t.localName,id:d(t),slot:null!==(o=t.getAttribute("slot"))&&void 0!==o?o:void 0,rect:h(t,e),em:{fontSizePx:w(t),appliedScaleFactor:1},regions:[],metadata:{},diagnostics:m(t)}}const L=["format","orientation","page-format","page-orientation","render-orientation","page-number"],P=(t,e,o)=>{const n=t[e];return"string"==typeof n?n:e in t?null:t.getAttribute(o)},D=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.bnNotationChange=o(this,"bnNotationChange",7),this.groupSeparator="",this.setsGroupSeparator=!1,this.assignedPageNumbers=new WeakMap,this.notationSubscriptions=[],v(this),this.errors=S(this)}watchGroupSeparator(t){var e;const o=r.groupSeparator;this.setGroupSeparator(t);const n=null===(e=this.stores)||void 0===e?void 0:e.context.state;if(n&&r.groupSeparator!==o){const t=n.locale;n.locale="",n.locale=t}}setGroupSeparator(t){var e;r.groupSeparator=t?null!==(e={"thin-space":" ",space:" ",none:""}[t])&&void 0!==e?e:t:null,this.setsGroupSeparator=!!t}setLocale(t){this.stores.context.state.locale=t}connectedCallback(){this.stores=l(this.element),this.locale&&(this.stores.context.state.locale=this.locale),this.groupSeparator&&this.setGroupSeparator(this.groupSeparator);const t=()=>this.bnNotationChange.emit();this.notationSubscriptions=[this.stores.scalingGroups.on("set",t),this.stores.componentStyles.on("set",t)],this.syncPages(),this.pageObserver=new MutationObserver((()=>this.syncPages())),this.pageObserver.observe(this.element,{childList:!0,subtree:!0,attributes:!0,attributeFilter:L})}disconnectedCallback(){var t,e;this.setsGroupSeparator&&(r.groupSeparator=null,this.setsGroupSeparator=!1),this.notationSubscriptions.forEach((t=>t())),this.notationSubscriptions=[],null===(t=this.pageObserver)||void 0===t||t.disconnect(),null===(e=this.pageSizeStyle)||void 0===e||e.remove(),this.pageSizeStyle=void 0}syncPages(){const t=Array.from(this.element.querySelectorAll("bn-page, bn-layout-page"));t.forEach(((t,e)=>{const o="bn-layout-page"===t.localName?t:t.querySelector("bn-footer");if(!o)return;const n=P(o,"pageNumber","page-number");if(null!==n&&n!==this.assignedPageNumbers.get(o))return;const a=""+(e+1);this.assignedPageNumbers.set(o,a),n!==a&&o.setAttribute("page-number",a)}));const e=this.element.getAttribute("render-orientation");void 0!==this.lastRenderOrientation&&this.lastRenderOrientation!==e&&t.filter((t=>"bn-layout-page"===t.localName)).forEach((t=>n(t))),this.lastRenderOrientation=e,this.writePageSize(t[0],e)}writePageSize(t,e){var o;if(!t||document.querySelector("bn-context")!==this.element)return null===(o=this.pageSizeStyle)||void 0===o||o.remove(),void(this.pageSizeStyle=void 0);const n="bn-layout-page"===t.localName?x(P(t,"pageFormat","page-format"),P(t,"pageOrientation","page-orientation"),e):x(P(t,"format","format"),P(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!==n&&(this.pageSizeStyle.textContent=n)}async getLayoutState(t){var e,o;const n=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",a=Array.from(this.element.querySelectorAll("bn-annotation-layer, bn-annotation-list, 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-text, bn-title, bn-tree"));await Promise.all(a.map((t=>{var e,o,n;return null!==(n=null===(o=(e=t).componentOnReady)||void 0===o?void 0:o.call(e))&&void 0!==n?n:Promise.resolve()})));const i=this.element.getBoundingClientRect(),s={x:i.left,y:i.top},r=await Promise.all(a.map((async t=>{const e=t.getBoundingClientRect(),o={context:s,component:{x:e.left,y:e.top}};try{const e=t;return"function"==typeof e.getLayoutState?await e.getLayoutState({detail:n}):j(t,o)}catch(e){let n;try{n=j(t,o)}catch(e){const o={x:0,y:0,width:0,height:0};n={version:p,tag:t.localName,id:t.localName,rect:{context:Object.assign({},o),component:Object.assign({},o)},em:{fontSizePx:0,appliedScaleFactor:1},regions:[],metadata:{},diagnostics:[]}}return n.error=(e instanceof Error?e.message:e)+"",n}}))),c=b(a.map((t=>({tag:t.localName,explicitId:f(t)}))));return r.forEach(((t,e)=>{t.id=c[e]})),{version:p,generatedAt:(new Date).toISOString(),detail:n,context:{viewport:u(i),locale:null===(o=this.stores)||void 0===o?void 0:o.context.state.locale},components:r}}async getNotation(t){const e=Array.from(this.element.querySelectorAll("bn-component-style, bn-scaling-group"));return await Promise.all(e.map((t=>{var e,o;return null!==(o=null===(e=t.componentOnReady)||void 0===e?void 0:e.call(t))&&void 0!==o?o:Promise.resolve()}))),g(y(this.stores.componentStyles.state,t),this.stores.scalingGroups.state)}componentWillLoad(){}componentDidLoad(){}componentShouldUpdate(){}componentWillRender(){}componentDidRender(){}componentWillUpdate(){}componentDidUpdate(){}render(){return a(i,{key:"30cd6749c3af25eb4f287ee2771aff0858f4368d"},a("slot",{key:"ea8bab237f0103f3e3e259ff660004af9a30f982"}))}get element(){return this}static get watchers(){return{groupSeparator:[{watchGroupSeparator:0}],locale:[{setLocale:0}]}}static get style(){return":host{display:block}"}},[257,"bn-context",{locale:[1],i18nNamespace:[513,"i18n-namespace"],renderOrientation:[513,"render-orientation"],groupSeparator:[1,"group-separator"],getLayoutState:[64],getNotation:[64]},void 0,{groupSeparator:[{watchGroupSeparator:0}],locale:[{setLocale:0}]}]),N=D,k=function(){"undefined"!=typeof customElements&&["bn-context"].forEach((t=>{"bn-context"===t&&(customElements.get(s(t))||customElements.define(s(t),D))}))};export{N as BnContext,k as defineCustomElement}