@bino-bi/bn-template-engine 1.0.0-next.53 → 1.0.0-next.55

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 (112) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-3379df20.entry.js +1 -0
  3. package/dist/bn-template-engine/{p-9a24e486.entry.js → p-471ea1b2.entry.js} +1 -1
  4. package/dist/bn-template-engine/{p-fdf42a77.entry.js → p-776e091f.entry.js} +1 -1
  5. package/dist/bn-template-engine/p-B6SpWzpW.js +1 -0
  6. package/dist/bn-template-engine/{p-NxJ6P79y.js → p-BXkVoFbt.js} +1 -1
  7. package/dist/bn-template-engine/{p-BL07yV8P.js → p-CZmA8CIL.js} +1 -1
  8. package/dist/bn-template-engine/{p-Dvlw60RF.js → p-CzzF-PBk.js} +1 -1
  9. package/dist/bn-template-engine/{p-Bvunba5p.js → p-DBRtHV59.js} +1 -1
  10. package/dist/bn-template-engine/{p-b75a4b52.entry.js → p-e905e4ee.entry.js} +1 -1
  11. package/dist/bn-template-engine/{p-150bdb68.entry.js → p-ef63af53.entry.js} +1 -1
  12. package/dist/bn-template-engine/{p-ddc1b2a9.entry.js → p-f62c59b0.entry.js} +1 -1
  13. package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +34 -19
  14. package/dist/cjs/bn-grid.cjs.entry.js +3 -3
  15. package/dist/cjs/bn-image.cjs.entry.js +2 -2
  16. package/dist/cjs/bn-internationalization.cjs.entry.js +2 -2
  17. package/dist/cjs/bn-ruleset.cjs.entry.js +2 -2
  18. package/dist/cjs/bn-text.cjs.entry.js +3 -3
  19. package/dist/cjs/{localFrame-C4RBw_zT.js → localFrame-J1QUlhHH.js} +1 -1
  20. package/dist/cjs/{withBodyObserver-CIGVLQEB.js → withBodyObserver-DhrwVmn_.js} +1 -1
  21. package/dist/cjs/{withHasError-CZFrIJw0.js → withHasError-DOXAxUCF.js} +2 -0
  22. package/dist/cjs/{withStyled-BISQLGLe.js → withStyled-CHR4d8Hl.js} +1 -1
  23. package/dist/cjs/{withTranslation-B7T30EVU.js → withTranslation-Vuxqw9J7.js} +2 -2
  24. package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.js +6 -2
  25. package/dist/collection/components/bn-annotation-layer/utils/marks.js +7 -4
  26. package/dist/collection/components/bn-annotation-list/bn-annotation-list.js +6 -2
  27. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +2 -1
  28. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +1 -0
  29. package/dist/collection/components/bn-chart-structure/utils/elements/Axis.js +1 -1
  30. package/dist/collection/components/bn-chart-structure/utils/model/styles/StructureChartStyle.js +2 -0
  31. package/dist/collection/stores/componentStyles.js +2 -0
  32. package/dist/collection/utils/layoutState/svgChartElements.js +4 -4
  33. package/dist/components/bn-annotation-layer.js +1 -1
  34. package/dist/components/bn-annotation-list.js +1 -1
  35. package/dist/components/bn-asset.js +1 -1
  36. package/dist/components/bn-body.js +1 -1
  37. package/dist/components/bn-card.js +1 -1
  38. package/dist/components/bn-chart-bubble-renderer.js +1 -1
  39. package/dist/components/bn-chart-bubble.js +1 -1
  40. package/dist/components/bn-chart-bullet-renderer.js +1 -1
  41. package/dist/components/bn-chart-bullet.js +1 -1
  42. package/dist/components/bn-chart-scatter-renderer.js +1 -1
  43. package/dist/components/bn-chart-scatter.js +1 -1
  44. package/dist/components/bn-chart-structure-renderer.js +1 -1
  45. package/dist/components/bn-chart-structure.js +1 -1
  46. package/dist/components/bn-chart-time-renderer.js +1 -1
  47. package/dist/components/bn-chart-time.js +1 -1
  48. package/dist/components/bn-component-style.js +1 -1
  49. package/dist/components/bn-context.js +1 -1
  50. package/dist/components/bn-dataset.js +1 -1
  51. package/dist/components/bn-datasource.js +1 -1
  52. package/dist/components/bn-footer.js +1 -1
  53. package/dist/components/bn-grid.js +1 -1
  54. package/dist/components/bn-image.js +1 -1
  55. package/dist/components/bn-internationalization.js +1 -1
  56. package/dist/components/bn-layout-card.js +1 -1
  57. package/dist/components/bn-layout-page.js +1 -1
  58. package/dist/components/bn-message.js +1 -1
  59. package/dist/components/bn-page.js +1 -1
  60. package/dist/components/bn-ruleset.js +1 -1
  61. package/dist/components/bn-scaling-group.js +1 -1
  62. package/dist/components/bn-table-renderer.js +1 -1
  63. package/dist/components/bn-table.js +1 -1
  64. package/dist/components/bn-text.js +1 -1
  65. package/dist/components/bn-title.js +1 -1
  66. package/dist/components/bn-tree.js +1 -1
  67. package/dist/components/p-5LbdDgZ5.js +1 -0
  68. package/dist/components/{p-dSUX43yf.js → p-BAvpRnjI.js} +1 -1
  69. package/dist/components/{p-DRU71K0s.js → p-BCTmWVaW.js} +1 -1
  70. package/dist/components/{p-Bp5Xj4-s.js → p-BPvwrhvq.js} +1 -1
  71. package/dist/components/{p-CZSp0rSS.js → p-BQD7EWUn.js} +1 -1
  72. package/dist/components/p-BY1Y1Ipv.js +1 -0
  73. package/dist/components/{p-DdvG1D18.js → p-Bmb0YBzz.js} +1 -1
  74. package/dist/components/{p-CiljAoC5.js → p-BpyLanO3.js} +1 -1
  75. package/dist/components/p-CFF7b9FT.js +1 -0
  76. package/dist/components/p-CFY-zEXs.js +1 -0
  77. package/dist/components/{p-DMAaBt7n.js → p-CTX2pUU7.js} +1 -1
  78. package/dist/components/{p-DKcw-1ot.js → p-CThV2et_.js} +1 -1
  79. package/dist/components/{p-CHJ6WE0l.js → p-CWSjn_DC.js} +1 -1
  80. package/dist/components/{p-jEqo8YD5.js → p-ChMe_jnA.js} +1 -1
  81. package/dist/components/p-ClFDt6Bk.js +1 -0
  82. package/dist/components/{p-LHIKI9Dp.js → p-D7pKezNW.js} +1 -1
  83. package/dist/components/{p-NdDdfez6.js → p-Dmsa7xm_.js} +1 -1
  84. package/dist/components/{p-BOwmXBm-.js → p-LB2R8XbL.js} +1 -1
  85. package/dist/components/{p-JG4Sx1lE.js → p-NkLVO7n9.js} +1 -1
  86. package/dist/components/{p-D65TnLS9.js → p-OR6uR6gy.js} +1 -1
  87. package/dist/components/{p-2t-lysdb.js → p-YuXVqXS_.js} +1 -1
  88. package/dist/components/{p-4xaxuPVU.js → p-tz4QGm3s.js} +1 -1
  89. package/dist/esm/bn-annotation-layer_30.entry.js +34 -19
  90. package/dist/esm/bn-grid.entry.js +3 -3
  91. package/dist/esm/bn-image.entry.js +2 -2
  92. package/dist/esm/bn-internationalization.entry.js +2 -2
  93. package/dist/esm/bn-ruleset.entry.js +2 -2
  94. package/dist/esm/bn-text.entry.js +3 -3
  95. package/dist/esm/{localFrame-WNu1bAPm.js → localFrame-wBZfmzjd.js} +1 -1
  96. package/dist/esm/{withBodyObserver-wJgSN1Pj.js → withBodyObserver-DgAvBnkB.js} +1 -1
  97. package/dist/esm/{withHasError-BDWEBrrb.js → withHasError-CRNW6htv.js} +2 -0
  98. package/dist/esm/{withStyled-CrTxIZ0Q.js → withStyled-BBzg5lxJ.js} +1 -1
  99. package/dist/esm/{withTranslation-BtSJmx1J.js → withTranslation-D1H_U5az.js} +2 -2
  100. package/dist/schemas/theme.schema.json +12 -0
  101. package/dist/types/components/bn-annotation-layer/utils/marks.d.ts +1 -1
  102. package/dist/types/components/bn-chart-structure/utils/model/styles/StructureChartStyle.d.ts +1 -0
  103. package/dist/types/stores/componentStyles.d.ts +4 -0
  104. package/dist/types/utils/annotations.d.ts +2 -0
  105. package/package.json +1 -1
  106. package/dist/bn-template-engine/p-0d8eade3.entry.js +0 -1
  107. package/dist/bn-template-engine/p-7pLJBHT2.js +0 -1
  108. package/dist/components/p-6242qMx1.js +0 -1
  109. package/dist/components/p-9a9XB5Y8.js +0 -1
  110. package/dist/components/p-BXP6aagM.js +0 -1
  111. package/dist/components/p-Bs5V6Ibu.js +0 -1
  112. package/dist/components/p-CZzlLTQc.js +0 -1
@@ -174,8 +174,10 @@ export function buildMark(item, box, toBox, em, options = {}) {
174
174
  const caption = item.text == null || whole
175
175
  ? undefined
176
176
  : options.label
177
- ? // right of a value label, so both can be read
178
- { x: box.x + box.width + 0.7 * em + textWidth(item.text, em) / 2, y: box.y + box.height / 2 }
177
+ ? item.textPosition === "above"
178
+ ? { x: box.x + box.width / 2 + 0.5 * em, y: box.y - 0.8 * em }
179
+ : // right of a value label, so both can be read
180
+ { x: box.x + box.width + 0.7 * em + textWidth(item.text, em) / 2, y: box.y + box.height / 2 }
179
181
  : { x: box.x + box.width / 2, y: box.y + Math.min(box.height / 2, Math.max(0.9 * em, 0.3 * box.height)) };
180
182
  const captionBox = caption && {
181
183
  x: caption.x - textWidth(item.text, em) / 2,
@@ -329,7 +331,7 @@ export function buildPointer(item, at, em) {
329
331
  * A bracket around a range of rows of a chart with bars from left to right. A line
330
332
  * runs below the last row from `left` to the end of its bar, and from there up to the
331
333
  * end of the bar of the first row. `ends` are the x of the two values. `text` stands
332
- * in a frame at the left, above the first row.
334
+ * in a frame at the left, at half the height of the rows.
333
335
  */
334
336
  export function buildBracket(item, first, last, ends, left, text, em) {
335
337
  const firstIsUpper = first.y <= last.y;
@@ -342,7 +344,8 @@ export function buildBracket(item, first, last, ends, left, text, em) {
342
344
  [upperEnd, upper.y - 0.1 * em],
343
345
  ];
344
346
  const width = text ? textWidth(text, em) : 0;
345
- const captionY = upper.y - 0.9 * em;
347
+ // beside the rows, at half their height
348
+ const captionY = (upper.y + lower.y + lower.height) / 2;
346
349
  const caption = text ? { x: left + 0.5 * em + width / 2, y: captionY, text } : undefined;
347
350
  // the number stands behind the text, or in its place
348
351
  const badgeX = caption ? caption.x + width / 2 + 1.2 * em : left + 0.65 * em;
@@ -48,9 +48,13 @@ export class AnnotationList {
48
48
  else {
49
49
  this.errors.addOrReplace({ id: "ERR_items", type: "error", message: "items: not a JSON array of objects." });
50
50
  }
51
- const color = annotationColor(undefined, this.componentStyle(($) => $["bn-annotation"]));
51
+ const style = this.componentStyle(($) => $["bn-annotation"]);
52
+ const color = annotationColor(undefined, style);
53
+ const badgeStyle = (style === null || style === void 0 ? void 0 : style.markerStyle) === "outlined"
54
+ ? { background: "#ffffff", color, boxShadow: `inset 0 0 0 1.5px ${color}` }
55
+ : { background: color };
52
56
  const unplaced = (_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.annotationsUnplaced.state[this.pageKey]) !== null && _b !== void 0 ? _b : [];
53
- return (h(Host, { key: '69a1cb7ec4623dd722328638b93fa2ac05775dcf' }, h("ol", { key: 'cc7925db54a9015cd774242487967e25d0eb1dc0' }, (items !== null && items !== void 0 ? items : []).map((item) => (h("li", null, item.label != null && !unplaced.includes(item.label) ? (h("div", { class: "badge", style: { background: color } }, h("span", null, item.label))) : item.label != null ? (
57
+ return (h(Host, { key: 'ec249c8259923180f4bd30b8c712c0614a758911' }, h("ol", { key: '6e8cbbe5a5841c8707081f9452b11c3971cecd03' }, (items !== null && items !== void 0 ? items : []).map((item) => (h("li", null, item.label != null && !unplaced.includes(item.label) ? (h("div", { class: "badge", style: badgeStyle }, h("span", null, item.label))) : item.label != null ? (
54
58
  // keeps the room of the circle: a list that changes its height can move the marked element, and with it the answer
55
59
  h("div", { class: "badge-space" })) : null, h("div", { class: "text" }, item.title ? h("span", { class: "title" }, item.title, " ") : null, item.html ? h("span", { innerHTML: sanitizeHtml(item.html) }) : null)))))));
56
60
  }
@@ -905,6 +905,7 @@ export class Chart {
905
905
  barStyles: $["bn-chart-structure"]["barStyles"],
906
906
  varianceStyles: $["bn-chart-structure"]["varianceStyles"],
907
907
  stackColors: $["bn-chart-structure"]["stackColors"],
908
+ titleBold: $["bn-chart-structure"]["titleBold"],
908
909
  padding: $["bn-chart-structure"]["padding"],
909
910
  pattern: null,
910
911
  };
@@ -1176,7 +1177,7 @@ export class Chart {
1176
1177
  this.errors.remove("WARN_scenarios_none");
1177
1178
  }
1178
1179
  const fontStyles = this.getFontStyles();
1179
- return (h(Host, { key: '02236359d67ec2095ac560152cc6feaa8661834a', style: fontStyles }, h("div", { key: '5eb4e74f27fb0c4c5ffd286ee266ceb51eae68bf', class: "container" }, scenariosArray.map(this.chartTemplate))));
1180
+ return (h(Host, { key: 'edc57c044c2e0f55c3491a96ca102731de2baaab', style: fontStyles }, h("div", { key: 'a653beef4add78d3fef7673003c18a548b58fec1', class: "container" }, scenariosArray.map(this.chartTemplate))));
1180
1181
  }
1181
1182
  static get is() { return "bn-chart-structure"; }
1182
1183
  static get encapsulation() { return "shadow"; }
@@ -392,6 +392,7 @@ export class StructureChart {
392
392
  const width = CalculateSize(this.title.length > tmpTitle.length ? this.title : tmpTitle, {
393
393
  font: this.styles.fontStyles.font,
394
394
  fontSize: this.styles.fontStyles.size + "px",
395
+ fontWeight: this.styles.titleBold ? "bold" : "normal",
395
396
  }).width;
396
397
  if (width < minWidth) {
397
398
  return minWidth;
@@ -17,7 +17,7 @@ export class Axis {
17
17
  this.labelText = axis.labelText || null;
18
18
  this.position = position;
19
19
  this.style = style;
20
- this.label = new Label(svgParentGroup, this.position.getAxisTitlePositionX(), this.position.getAxisTitlePositionY(), this.ID_AXIS_TITLE, this.labelText, this.style, HookLocation.Bottom, HookLocation.Center);
20
+ this.label = new Label(svgParentGroup, this.position.getAxisTitlePositionX(), this.position.getAxisTitlePositionY(), this.ID_AXIS_TITLE, this.labelText, this.style, HookLocation.Bottom, HookLocation.Center).setEmphasis(this.style.titleBold, false);
21
21
  this.svgGroup = svgParentGroup.group().id(this.ID_AXIS);
22
22
  }
23
23
  draw() {
@@ -17,6 +17,7 @@ export class StructureChartStyle {
17
17
  this.padding = padding;
18
18
  this.pattern = new Map();
19
19
  this.stackColors = ["#000000", "#c0c0c0", "#808080"];
20
+ this.titleBold = false;
20
21
  /** Locale for number labels. */
21
22
  this.locale = "de";
22
23
  }
@@ -54,6 +55,7 @@ export class StructureChartStylesAdapter {
54
55
  if (Array.isArray(data.stackColors) && data.stackColors.length > 0) {
55
56
  styles.stackColors = data.stackColors;
56
57
  }
58
+ styles.titleBold = data.titleBold === true;
57
59
  styles.pattern = new MarkerPattern(styles.fontStyles.size).createPatternMapForStructureBar();
58
60
  }
59
61
  return styles;
@@ -112,6 +112,7 @@ export const SYSTEM_STYLE_DEFAULTS = {
112
112
  neu: { stroke: "#808080", fill: "#808080", width: 0.1 },
113
113
  },
114
114
  stackColors: ["#000000", "#c0c0c0", "#808080"],
115
+ titleBold: false,
115
116
  padding: {
116
117
  top: 10,
117
118
  left: 10,
@@ -181,6 +182,7 @@ export const SYSTEM_STYLE_DEFAULTS = {
181
182
  "bn-annotation": {
182
183
  color: "#0070c0",
183
184
  colors: { negative: "#ff0000", positive: "#008f96" },
185
+ markerStyle: "filled",
184
186
  },
185
187
  };
186
188
  /** Keys that are optional, so the defaults do not list them. */
@@ -113,7 +113,7 @@ export function collectChartSegmentElements(svgRoot, segment, origins) {
113
113
  });
114
114
  ["DATA", "SCENARIO"].forEach((prefix) => {
115
115
  svgRoot.querySelectorAll(`g[id$="_${prefix}_Label"]`).forEach((group, walkIndex) => {
116
- var _a, _b, _c;
116
+ var _a, _b, _c, _d;
117
117
  if (hasClass(group, "hide"))
118
118
  return;
119
119
  const text = (_b = (_a = group.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : "";
@@ -127,14 +127,14 @@ export function collectChartSegmentElements(svgRoot, segment, origins) {
127
127
  text,
128
128
  segment,
129
129
  index: (_c = indexOfGroup(group.id)) !== null && _c !== void 0 ? _c : walkIndex,
130
- rect: measure(group, origins),
130
+ rect: measure((_d = group.querySelector("text")) !== null && _d !== void 0 ? _d : group, origins),
131
131
  point: readLayoutPoint(group),
132
132
  };
133
133
  elements.push(label);
134
134
  });
135
135
  });
136
136
  svgRoot.querySelectorAll("[data-bn-part]").forEach((el, walkIndex) => {
137
- var _a, _b, _c;
137
+ var _a, _b, _c, _d;
138
138
  if (collected.has(el))
139
139
  return;
140
140
  const point = readLayoutPoint(el);
@@ -157,7 +157,7 @@ export function collectChartSegmentElements(svgRoot, segment, origins) {
157
157
  text: (_c = (_b = el.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : "",
158
158
  segment,
159
159
  index,
160
- rect: measure(el, origins),
160
+ rect: measure((_d = el.querySelector("text")) !== null && _d !== void 0 ? _d : el, origins),
161
161
  point,
162
162
  };
163
163
  elements.push(label);
@@ -1 +1 @@
1
- import{p as t,t as e,H as n,h as i,d as o}from"./p-BnmylmXF.js";import{g as r}from"./p-6242qMx1.js";import{a as l,c as s,b as a}from"./p-CHJ6WE0l.js";import{w as h,C as c}from"./p-BrQCbmG0.js";import{w as u}from"./p-JG4Sx1lE.js";import{w as d}from"./p-D32TsLzd.js";const f=t=>({x:t.x+t.width/2,y:t.y+t.height/2});function b(t,e){const n=f(t),i=e.x-n.x,o=e.y-n.y,r=Math.min(0===i?1/0:t.width/2/Math.abs(i),0===o?1/0:t.height/2/Math.abs(o));return Number.isFinite(r)?{x:n.x+i*r,y:n.y+o*r}:n}function v(t,e){return e?Object.assign(Object.assign({},t),{cx:Math.max(t.r,Math.min(t.cx,e.width-t.r)),cy:Math.max(t.r,Math.min(t.cy,e.height-t.r))}):t}const m=(t,e)=>t.x<e.x+e.width&&e.x<t.x+t.width&&t.y<e.y+e.height&&e.y<t.y+t.height;function y(t,e,n,i){var o,r,l;const s=.25*n,a=t.y+t.height/2,h=null!==(o=i.obstacles)&&void 0!==o?o:[],c=t=>{const n={x:t-e,y:a-e,width:2*e,height:2*e},o=i.area;return(!o||n.x>=0&&n.x+n.width<=o.width)&&!h.some((t=>m(n,t)))},u=t.x+t.width,d=t.x-s-e,f=u+s+e;if(c(d))return{x:d,y:a,r:e};if(c(f))return{x:f,y:a,r:e};const b=2*(e+s),v=h.filter((t=>t.y<a&&t.y+t.height>a)),y=Math.max(0,t.x-b,...v.filter((e=>e.x+e.width<=t.x)).map((t=>t.x+t.width))),x=Math.min(null!==(l=null===(r=i.area)||void 0===r?void 0:r.width)&&void 0!==l?l:1/0,u+b,...v.filter((t=>t.x>=u)).map((t=>t.x))),p=t.x-y,g=x-u;return{x:g>=p?u+g/2:t.x-p/2,y:a,r:Math.min(e,Math.max(Math.max(p,g)/2,.3*n))}}const x=(t,e)=>.6*t.length*e,p=(t,e)=>(t<0?"-":"+")+Math.abs(t).toFixed(e);function g(t,e,n,i,o,r,l){var s,a,h;if(null==i||null==o)return;const c=o-i,u=Number.isInteger(t.digits)&&t.digits>=0?t.digits:1,d="good-down"===t.sentiment?c<=0:c>=0,f=n.x+n.width/2>=e.x+e.width/2?1:-1,b=t=>1===f?t.x+t.width:t.x,v=b(n)+.9*f*r,m=v+.125*f*r,y=null!==(s=null==l?void 0:l.from)&&void 0!==s?s:e.y,g=null!==(a=null==l?void 0:l.to)&&void 0!==a?a:n.y,w=.25*r,k=t.percent&&0!==i?`(${p(c/Math.abs(i)*100,0)}%)`:void 0,M=p(c,u),$=v+.6*f*r,O=(y+g)/2,S=k?x(k,.85*r):0,j=1===f?$+.5*M.length*r+.35*r:$-S;return{kind:"difference",color:null!==(h=t.color)&&void 0!==h?h:d?"positive":"negative",lines:[{x1:b(e),y1:y,x2:m,y2:y},{x1:b(n),y1:g,x2:m,y2:g}],bar:{x:v-w/2,y:Math.min(y,g),width:w,height:Math.max(Math.abs(g-y),1)},text:{x:$,y:O,anchor:1===f?"start":"end",value:M,percent:k},frame:k&&t.highlight?{x:j-.25*r,y:O-.65*r,width:S+.5*r,height:1.3*r,r:.65*r}:void 0,badge:null!=t.label?{cx:v,cy:Math.min(y,g)-.9*r,r:.65*r,label:t.label}:void 0}}function w(t,e,n,i,o={}){var r,l,s,a;const{label:h,color:c}=t,{whole:u,area:d,text:p}=o,g=!u&&!p&&null!=o.obstacles,w=((t,e)=>t?Math.min(e,t.height/1.3):e)(null!=p?p:g?e:void 0,i);if("arrow"===t.mark){if(!n)return;const t=f(e),o=f(n);if(t.x===o.x&&t.y===o.y)return;let r=b(e,o),l=b(n,t);(l.x-r.x)*(o.x-t.x)+(l.y-r.y)*(o.y-t.y)<=0&&(r=t,l=o);const s=Math.hypot(l.x-r.x,l.y-r.y),a=Math.min(.8*i,s),u=(l.x-r.x)/s,m=(l.y-r.y)/s,y=l.x-u*a,x=l.y-m*a,p=.35*i;return{kind:"arrow",color:c,x1:r.x,y1:r.y,x2:y,y2:x,head:[`${l.x},${l.y}`,`${y-m*p},${x+u*p}`,`${y+m*p},${x-u*p}`].join(" "),badge:null!=h?v({cx:r.x,cy:r.y,r:.65*i,label:h},d):void 0}}if("frame"===t.mark){const n=null==t.text||u?void 0:o.label?{x:e.x+e.width+.7*i+x(t.text,i)/2,y:e.y+e.height/2}:{x:e.x+e.width/2,y:e.y+Math.min(e.height/2,Math.max(.9*i,.3*e.height))},s=n&&{x:n.x-x(t.text,i)/2,y:n.y-.6*i,width:x(t.text,i),height:1.2*i},a=null!==(r=null!=s?s:p)&&void 0!==r?r:e,f=null===(l=t.point)||void 0===l?void 0:l.part,b=!u&&(null!=s||null!=p||"label"===f||"total"===f),m=(b?.45:.2)*w,y=(b?.1:.2)*w,g=b?Math.max(a.width,a.height):a.width,k=a.x+a.width/2,M=1,$=Math.max(d?M:-1/0,k-g/2-m),O=Math.max(d?M:-1/0,a.y-y),S=Math.min(d?d.width-M:1/0,k+g/2+m),j=Math.min(d?d.height-M:1/0,a.y+a.height+y),z=Math.min(S-$,j-O)/2,W=u?.25*i:z,C=u?.25*i:b?Math.min((S-$)/2,1.6*z):z,N=1-Math.SQRT1_2,J=.65*w,E=b?.6*J:0;return{kind:"frame",color:c,x:$,y:O,width:S-$,height:j-O,rx:C,ry:W,badge:null!=h?v({cx:S-C*N+E,cy:O+W*N-E,r:J,label:h},d):void 0,caption:n&&Object.assign(Object.assign({},n),{text:t.text})}}if(p&&!u){const t=y(p,(null==h?.4:.65)*w,w,o);return{kind:"marker",color:c,badge:v({cx:t.x,cy:t.y,r:t.r,label:h},d)}}const k=(null==h?.4:.75)*w,M=g?Math.min(k,e.height/2):k;let $=u?{x:e.x+e.width-M,y:e.y+M}:f(e);if(!u&&o.label)$={x:e.x+e.width+.25*w+M,y:e.y+e.height/2};else if(!u&&o.stacked&&o.horizontal){const t=1.3*w+M;$=e.width/2>=t+M?{x:e.x+e.width/2+t,y:e.y+e.height/2}:{x:e.x+e.width-Math.min(M,e.width/2),y:e.y}}else!u&&o.stacked&&"label"!==(null===(s=t.point)||void 0===s?void 0:s.part)&&"total"!==(null===(a=t.point)||void 0===a?void 0:a.part)&&($={x:e.x+e.width,y:e.y+Math.min(.5*M,e.height/2)});if(g){const t={x:$.x-M,y:$.y-M,width:2*M,height:2*M},e=o.obstacles.find((e=>m(t,e)));if(e){const t=y(e,M,w,o);return{kind:"marker",color:c,badge:v({cx:t.x,cy:t.y,r:t.r,label:h},d)}}}return{kind:"marker",color:c,badge:v({cx:$.x,cy:$.y,r:M,label:h},d)}}function k(t,e,n,i,o,r,l){var s;if(null==i||null==o)return;const a=o-i,h=Number.isInteger(t.digits)&&t.digits>=0?t.digits:1,c="good-down"===t.sentiment?a<=0:a>=0,u=n.y+n.height/2>=e.y+e.height/2?1:-1,d=t=>1===u?t.y+t.height:t.y,f=.25*r,b=d(n)+.25*u*r,v=Math.min(l.from,l.to),m=Math.max(l.from,l.to),y=t.percent&&0!==i?`(${p(a/Math.abs(i)*100,0)}%)`:void 0,g=p(a,h),w=m+.5*r,k=.5*g.length*r,M=y?x(y,.85*r):0,$=w+k+.35*r;return{kind:"difference",color:null!==(s=t.color)&&void 0!==s?s:c?"positive":"negative",lines:[{x1:l.from,y1:d(e),x2:l.from,y2:b},{x1:l.to,y1:d(n),x2:l.to,y2:b}],bar:{x:v,y:b-f/2,width:Math.max(m-v,1),height:f},text:{x:w,y:b,anchor:"start",value:g,percent:y},frame:y&&t.highlight?{x:$-.25*r,y:b-.65*r,width:M+.5*r,height:1.3*r,r:.65*r}:void 0,badge:null!=t.label?{cx:v-.9*r,cy:b,r:.65*r,label:t.label}:void 0}}function M(t,e,n){const i=e.x,o=e.y-.15*n,r=o-.7*n,l=o-1.9*n,s=.55*n,a=.22*n;return{kind:"pointer",color:t.color,shape:[[i,o],[i-s,r],[i-a,r],[i-a,l],[i+a,l],[i+a,r],[i+s,r]].map((([t,e])=>`${t},${e}`)).join(" "),badge:null!=t.label?{cx:i+1.1*n,cy:l+.65*n,r:.65*n,label:t.label}:void 0}}function $(t,e,n,i,o,r,l){const s=e.y<=n.y,[a,h]=s?[e,n]:[n,e],[c,u]=s?[i.first,i.last]:[i.last,i.first],d=h.y+h.height+.2*l,f=[[o,d],[u,d],[c,a.y-.1*l]],b=r?x(r,l):0,v=a.y-.9*l,m=r?{x:o+.5*l+b/2,y:v,text:r}:void 0,y=m?m.x+b/2+1.2*l:o+.65*l;return{kind:"bracket",color:t.color,path:f.map((([t,e])=>`${t},${e}`)).join(" "),caption:m,frame:m&&{x:m.x-b/2-.45*l,y:m.y-.7*l,width:b+.9*l,height:1.4*l,r:.7*l},badge:null!=t.label?{cx:y,cy:v,r:.65*l,label:t.label}:void 0}}const O=["rowGroup","category","subCategory","date","scenario","row"];function S(t,e){var n;const i=t.table&&null==e.scenario?t.table.rows:null!==(n=t.elements)&&void 0!==n?n:[],o=null!=t.table&&null==e.subCategory;return i.filter((t=>function(t,e){var n;return!(!t||t.part!==(null!==(n=e.part)&&void 0!==n?n:"element"))&&O.every((n=>null==e[n]||e[n]+""===t[n]))}(t.point,e)&&!(o&&null!=t.point.subCategory))).map((({rect:t,content:e,contentSign:n,value:i,scenario:o,kind:r})=>({rect:t,content:e,contentSign:n,value:i,stacked:"string"==typeof o&&o.startsWith("stack:"),label:"label"===r})))}function j(t,e){const n=e.getBoundingClientRect();if(0===n.width||0===n.height)return!0;const i=t.x+t.width/2,o=t.y+t.height/2;return i>=n.left&&i<=n.right&&o>=n.top&&o<=n.bottom}const z=new Set(["bn-asset","bn-component-style","bn-dataset","bn-datasource","bn-internationalization","bn-ruleset","bn-scaling-group"]);function W(t,e){const n=e.getBoundingClientRect();return 0===n.width||0===n.height||t.x<n.right&&t.x+t.width>n.left&&t.y<n.bottom&&t.y+t.height>n.top}const C=t(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.marks=[],this.pageKey="",this.parsedItems=[],this.scheduled=!1,this.run=0,this.observed=new WeakSet,this.observedAround=new WeakSet,this.reported=new Set,this.schedule=()=>{this.scheduled||(this.scheduled=!0,this.holdStatus(new Promise((t=>{requestAnimationFrame((()=>{this.scheduled=!1,this.place().catch((t=>console.error("bn-annotation-layer: placing the marks failed",t))).finally(t)}))}))))},this.holdStatus=h(this),this.errors=d(this),this.componentStyle=u(this)}connectedCallback(){var t;this.stores=r(this.element),this.pageKey=l(this.element),this.observed=new WeakSet,this.observedAround=new WeakSet,this.resizeObserver=new ResizeObserver(this.schedule),this.mutationObserver=new MutationObserver(this.schedule),this.observeSize(this.element);const e=this.element.closest("bn-layout-page");e&&this.mutationObserver.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot","data-bino-annotation-target"]}),null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.schedule)}disconnectedCallback(){var t,e,n,i;null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(e=this.mutationObserver)||void 0===e||e.disconnect(),null===(n=document.fonts)||void 0===n||n.removeEventListener("loadingdone",this.schedule),this.run++,(null===(i=this.stores)||void 0===i?void 0:i.annotationsUnplaced.state[this.pageKey])&&this.stores.annotationsUnplaced.set(this.pageKey,void 0)}componentWillLoad(){this.parseItems()}componentDidLoad(){this.schedule()}onItemsChange(){this.parseItems(),this.schedule()}parseItems(){const t=s(this.items);t?this.errors.remove("ERR_items"):this.errors.addOrReplace({id:"ERR_items",type:"error",message:"items: not a JSON array of objects."}),this.parsedItems=null!=t?t:[]}async place(){var t,e,n,i;const o=++this.run;if(!this.element.isConnected||!this.svg)return;const r=this.element.closest("bn-layout-page"),l=new Map,s=new Map;null==r||r.querySelectorAll("[data-bino-annotation-target]").forEach((t=>{const e=Array.from(t.querySelectorAll("*")).find((t=>t.localName.startsWith("bn-")&&!z.has(t.localName))),n=null!=e?e:t;l.set(t.getAttribute("data-bino-annotation-target"),n),s.set(n,t)})),null==r||r.querySelectorAll("[slot]").forEach((t=>this.observeSize(t)));const a=new Set(this.parsedItems.flatMap((t=>[t.target,t.to]))),h=[...l].filter((([t])=>a.has(t))).map((([,t])=>t));if(await Promise.all(h.map((t=>{var e;return null===(e=t.componentOnReady)||void 0===e?void 0:e.call(t)}))),o!==this.run)return;h.forEach((t=>{this.observe(t),this.observeAround(t,r)}));const c=new Map;if(await Promise.all(h.map((async t=>{var e;c.set(t,await(null===(e=t.getLayoutState)||void 0===e?void 0:e.call(t,{detail:"full"}).catch((()=>{}))))}))),o!==this.run)return;const u=(t,e)=>{var n;const i=null!=t?l.get(t):void 0;if(!i)return{problem:`no target "${t}" on this page`};const o=i.getBoundingClientRect();if(function(t){return!t||O.every((e=>null==t[e]))&&null==t.part}(e)){const e={x:o.left,y:o.top,width:o.width,height:o.height};return function(t,e,n){if(0===t.width||0===t.height||!W(t,n))return!0;for(let n=e;n&&"bn-layout-page"!==n.localName;n=n.parentElement)if(!W(t,n))return!0;return!1}(e,s.get(i),this.element)?{problem:`"${t}" cannot be seen`}:{box:e,whole:!0}}const r=c.get(i),a=r?S(r,e):[];if(1!==a.length)return{problem:`${a.length} elements match the point ${JSON.stringify(e)} in "${t}"`};const h=({component:{x:t,y:e,width:n,height:i}})=>({x:o.left+t,y:o.top+e,width:n,height:i}),u=h(a[0].rect);if(function(t,e){for(let n=e;n&&"bn-layout-page"!==n.localName;n=n.parentElement)if(!j(t,n))return!0;return!1}(u,s.get(i))||!j(u,this.element))return{problem:`the point ${JSON.stringify(e)} in "${t}" is cut off`};const f=a[0].content;if(!r.table)return{box:u,whole:!1,stacked:a[0].stacked,label:a[0].label,horizontal:d(r)};const b=(null!==(n=r.elements)&&void 0!==n?n:[]).flatMap((t=>"cell"===t.kind&&t.content?[{box:h(t.content),sign:t.contentSign}]:[]));return{box:u,whole:!1,text:f&&{box:h(f),sign:a[0].contentSign},obstacles:b}},d=t=>{var e;return(null!==(e=null==t?void 0:t.elements)&&void 0!==e?e:[]).some((t=>"axis"===t.kind&&"vertical"===t.orientation))},f=(t,e)=>{const n=null!=t?l.get(t):void 0;if(!n)return{problem:`no target "${t}" on this page`};const i=c.get(n),o=(i&&e?S(i,Object.assign(Object.assign({},e),{part:"element"})):[]).filter((t=>null!=t.value));if(0===o.length)return{problem:`no bar with a value matches the point ${JSON.stringify(e)} in "${t}"`};if(o.length>1&&!o.every((t=>t.stacked)))return{problem:`${o.length} elements match the point ${JSON.stringify(e)} in "${t}"`};const r=n.getBoundingClientRect(),s=Math.min(...o.map((t=>t.rect.component.x))),a=Math.min(...o.map((t=>t.rect.component.y))),h=Math.max(...o.map((t=>t.rect.component.x+t.rect.component.width))),u=Math.max(...o.map((t=>t.rect.component.y+t.rect.component.height)));return{box:{x:r.left+s,y:r.top+a,width:h-s,height:u-a},negatives:o.filter((t=>t.value<0)).map((t=>(t=>({x:r.left+t.x,y:r.top+t.y,width:t.width,height:t.height}))(t.rect.component))),value:o.reduce(((t,e)=>t+e.value),0),horizontal:d(i)}},b=(t,e,n)=>{const i=l.get(t.target),o=i&&c.get(i);if(!i||!o||!t.point)return;const r=i.getBoundingClientRect(),s=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(n[i[o]]=t[i[o]])}return n}(t.point,["rowGroup","category","subCategory","date"]),a=S(o,Object.assign(Object.assign({},s),{part:"element"})).filter((t=>null!=t.value)),h=a.reduce(((t,e)=>t+e.value),0),u=a.filter((t=>{const i=r.top+t.rect.component.y+t.rect.component.height/2;return i>=e.y&&i<=n.y+n.height})).reduce(((t,e)=>t+e.value),0);return 0!==h?u/h:void 0},v=this.toLocalSpace(),m=({box:t,sign:e=0})=>{const n=v(t);return Object.assign(Object.assign({},n),{x:n.x-e,width:n.width+e})},y=parseFloat(getComputedStyle(this.svg).fontSize)||13.3333,x={width:this.element.clientWidth,height:this.element.clientHeight},p=[],C=[];for(const o of this.parsedItems){if("difference"===o.mark){const e=f(o.target,o.point),n=f(null!==(t=o.to)&&void 0!==t?t:o.target,o.toPoint),i="problem"in e?e:"problem"in n?n:void 0;if(i){C.push({item:o,problem:i.problem});continue}const[r,l]=[e,n];if(r.horizontal){const t=t=>{const e=v(t.box);return e.x+e.width-t.negatives.reduce(((t,e)=>t+v(e).width),0)},e=k(o,v(r.box),v(l.box),r.value,l.value,y,{from:t(r),to:t(l)});e&&p.push(e);continue}const s=t=>v(t.box).y+t.negatives.reduce(((t,e)=>t+v(e).height),0),a=g(o,v(r.box),v(l.box),r.value,l.value,y,{from:s(r),to:s(l)});a&&p.push(a);continue}if("pointer"===o.mark||"bracket"===o.mark){const t=f(o.target,o.point),i="bracket"===o.mark?f(null!==(e=o.to)&&void 0!==e?e:o.target,o.toPoint):t,r="problem"in t?t:"problem"in i?i:void 0;if(r){C.push({item:o,problem:r.problem});continue}const[s,a]=[t,i],h=t=>{const e=v(t.box);return t.horizontal?{x:e.x+e.width-t.negatives.reduce(((t,e)=>t+v(e).width),0),y:e.y}:{x:e.x+e.width/2,y:e.y+t.negatives.reduce(((t,e)=>t+v(e).height),0)}};if("pointer"===o.mark){p.push(M(o,h(s),y));continue}if(!s.horizontal){C.push({item:o,problem:"a bracket needs bars that run from left to right"});continue}if(null!=o.to&&o.to!==o.target){C.push({item:o,problem:"both ends of a bracket must be in one chart"});continue}const[c,u]=s.box.y<=a.box.y?[s.box,a.box]:[a.box,s.box],d=o.percent?b(o,c,u):void 0,m=l.get(o.target).getBoundingClientRect(),x=v({x:m.left,y:m.top,width:m.width,height:m.height}),g=null!==(n=o.text)&&void 0!==n?n:null!=d?Math.round(100*d)+"%":void 0;p.push($(o,v(s.box),v(a.box),{first:h(s).x,last:h(a).x},x.x,g,y));continue}const r=u(o.target,o.point),s="arrow"===o.mark?u(o.to,o.toPoint):void 0,a="problem"in r?r:s&&"problem"in s?s:void 0;if(a){C.push({item:o,problem:a.problem});continue}const h=r,c=s,d=w(o,v(h.box),c&&v(c.box),y,{whole:h.whole,area:x,text:h.text&&m(h.text),obstacles:null===(i=h.obstacles)||void 0===i?void 0:i.map(m),stacked:h.stacked,label:h.label,horizontal:h.horizontal});d?p.push(d):C.push({item:o,problem:"an arrow needs two ends at different places"})}this.marks=p,this.storeUnplaced(C.flatMap((({item:t})=>null!=t.label?[t.label]:[]))),C.length>0&&this.reportWhenQuiet(o,C)}async reportWhenQuiet(t,e){let n=0;for(let e=0;e<50&&n<2;e++){if(await new Promise((t=>window.setTimeout(t,200))),t!==this.run)return;n=0===c.componentRegisterStatus().running?n+1:0}this.report(e)}report(t){var e,n;for(const{item:i,problem:o}of t){const t=`bn-annotation-layer: ${null!==(e=i.mark)&&void 0!==e?e:"marker"} ${null!==(n=i.label)&&void 0!==n?n:"without a number"} is not drawn: ${o}.`;this.reported.has(t)||(this.reported.add(t),console.warn(t))}}toLocalSpace(){var t;const e=null===(t=this.svg.getScreenCTM())||void 0===t?void 0:t.inverse();return t=>{if(!e)return t;const n=[[t.x,t.y],[t.x+t.width,t.y+t.height]].map((([t,n])=>new DOMPoint(t,n).matrixTransform(e)));return{x:Math.min(n[0].x,n[1].x),y:Math.min(n[0].y,n[1].y),width:Math.abs(n[1].x-n[0].x),height:Math.abs(n[1].y-n[0].y)}}}storeUnplaced(t){var e,n;const i=null===(e=this.stores)||void 0===e?void 0:e.annotationsUnplaced,o=null!==(n=null==i?void 0:i.state[this.pageKey])&&void 0!==n?n:[];i&&JSON.stringify(o)!==JSON.stringify(t)&&i.set(this.pageKey,t)}observe(t){this.observeSize(t);const e=t=>{var n;t&&(this.observed.has(t)||(this.observed.add(t),null===(n=this.mutationObserver)||void 0===n||n.observe(t,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["x","y","width","height","transform","style","class"]})),t.querySelectorAll("*").forEach((t=>e(t.shadowRoot))))};e(t.shadowRoot)}observeAround(t,e){var n,i;for(let o=t.parentElement;o&&o!==e;o=o.parentElement)this.observedAround.has(o)||(this.observedAround.add(o),null===(n=this.mutationObserver)||void 0===n||n.observe(o,{attributes:!0,attributeFilter:["style"]}),o.shadowRoot&&(null===(i=this.mutationObserver)||void 0===i||i.observe(o.shadowRoot,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]})))}observeSize(t){var e;this.observed.has(t)||(this.observed.add(t),null===(e=this.resizeObserver)||void 0===e||e.observe(t))}renderBadge(t,e){return t?i("g",null,i("circle",{cx:t.cx,cy:t.cy,r:t.r,style:{fill:e}}),null!=t.label?i("text",{class:"badge-text",x:t.cx,y:t.cy,style:{fontSize:1.1*t.r+"px"}},t.label):null):null}renderMark(t){var e,n,o,r,l;const s=a(t.color,this.componentStyle((t=>t["bn-annotation"])));if("marker"===t.kind)return i("g",{class:"mark marker","data-label":t.badge.label},this.renderBadge(t.badge,s));if("frame"===t.kind)return i("g",{class:"mark frame","data-label":null===(e=t.badge)||void 0===e?void 0:e.label},i("rect",{x:t.x,y:t.y,width:t.width,height:t.height,rx:t.rx,ry:t.ry,style:{fill:t.caption?"#ffffff":"none",stroke:s,strokeWidth:"1.5"}}),t.caption?i("text",{class:"mark-text caption",x:t.caption.x,y:t.caption.y},t.caption.text):null,this.renderBadge(t.badge,s));if("difference"===t.kind){const e=a(void 0,this.componentStyle((t=>t["bn-annotation"])));return i("g",{class:"mark difference","data-label":null===(n=t.badge)||void 0===n?void 0:n.label},t.lines.map((t=>i("line",{class:"difference-line",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}))),i("rect",{x:t.bar.x,y:t.bar.y,width:t.bar.width,height:t.bar.height,style:{fill:s}}),i("text",{class:"mark-text",x:t.text.x,y:t.text.y,style:{textAnchor:t.text.anchor}},t.text.value,t.text.percent?i("tspan",{class:"percent",dx:"0.35em"},t.text.percent):null),t.frame?i("rect",{x:t.frame.x,y:t.frame.y,width:t.frame.width,height:t.frame.height,rx:t.frame.r,ry:t.frame.r,style:{fill:"none",stroke:e,strokeWidth:"1.5"}}):null,this.renderBadge(t.badge,e))}return"pointer"===t.kind?i("g",{class:"mark pointer","data-label":null===(o=t.badge)||void 0===o?void 0:o.label},i("polygon",{points:t.shape,style:{fill:s}}),this.renderBadge(t.badge,s)):"bracket"===t.kind?i("g",{class:"mark bracket","data-label":null===(r=t.badge)||void 0===r?void 0:r.label},i("polyline",{points:t.path,style:{fill:"none",stroke:s,strokeWidth:"1.5"}}),t.frame?i("rect",{x:t.frame.x,y:t.frame.y,width:t.frame.width,height:t.frame.height,rx:t.frame.r,ry:t.frame.r,style:{fill:"#ffffff",stroke:s,strokeWidth:"1.5"}}):null,t.caption?i("text",{class:"mark-text caption",x:t.caption.x,y:t.caption.y},t.caption.text):null,this.renderBadge(t.badge,s)):i("g",{class:"mark arrow","data-label":null===(l=t.badge)||void 0===l?void 0:l.label},i("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,style:{stroke:s,strokeWidth:"1.5"}}),i("polygon",{points:t.head,style:{fill:s}}),this.renderBadge(t.badge,s))}render(){return i(o,{key:"3b82cff435bdbabe51cdb7581afef428a16716b0"},i("svg",{key:"0613bd3ecb59150c6959c9f96322b0f3eafc6164",ref:t=>this.svg=t},this.marks.map((t=>this.renderMark(t)))))}get element(){return this}static get watchers(){return{items:[{onItemsChange:0}]}}static get style(){return':host{position:absolute;inset:0;z-index:1;display:block;pointer-events:none;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px)}svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}.badge-text{fill:#ffffff;font-weight:bold;text-anchor:middle;dominant-baseline:central}.mark-text{fill:#000000;dominant-baseline:central}.mark-text.caption{text-anchor:middle;font-size:0.9em}.mark-text .percent{font-size:0.85em}.difference-line{stroke:#000000;stroke-width:0.75}'}},[1,"bn-annotation-layer",{items:[1],selectedStyle:[513,"selected-style"],marks:[32]},void 0,{items:[{onItemsChange:0}]}]),N=C,J=function(){"undefined"!=typeof customElements&&["bn-annotation-layer"].forEach((t=>{"bn-annotation-layer"===t&&(customElements.get(e(t))||customElements.define(e(t),C))}))};export{N as BnAnnotationLayer,J as defineCustomElement}
1
+ import{p as t,t as e,H as n,h as i,d as o}from"./p-BnmylmXF.js";import{g as r}from"./p-5LbdDgZ5.js";import{a as l,c as s,b as a}from"./p-CWSjn_DC.js";import{w as h,C as c}from"./p-BrQCbmG0.js";import{w as u}from"./p-NkLVO7n9.js";import{w as d}from"./p-D32TsLzd.js";const f=t=>({x:t.x+t.width/2,y:t.y+t.height/2});function b(t,e){const n=f(t),i=e.x-n.x,o=e.y-n.y,r=Math.min(0===i?1/0:t.width/2/Math.abs(i),0===o?1/0:t.height/2/Math.abs(o));return Number.isFinite(r)?{x:n.x+i*r,y:n.y+o*r}:n}function v(t,e){return e?Object.assign(Object.assign({},t),{cx:Math.max(t.r,Math.min(t.cx,e.width-t.r)),cy:Math.max(t.r,Math.min(t.cy,e.height-t.r))}):t}const m=(t,e)=>t.x<e.x+e.width&&e.x<t.x+t.width&&t.y<e.y+e.height&&e.y<t.y+t.height;function y(t,e,n,i){var o,r,l;const s=.25*n,a=t.y+t.height/2,h=null!==(o=i.obstacles)&&void 0!==o?o:[],c=t=>{const n={x:t-e,y:a-e,width:2*e,height:2*e},o=i.area;return(!o||n.x>=0&&n.x+n.width<=o.width)&&!h.some((t=>m(n,t)))},u=t.x+t.width,d=t.x-s-e,f=u+s+e;if(c(d))return{x:d,y:a,r:e};if(c(f))return{x:f,y:a,r:e};const b=2*(e+s),v=h.filter((t=>t.y<a&&t.y+t.height>a)),y=Math.max(0,t.x-b,...v.filter((e=>e.x+e.width<=t.x)).map((t=>t.x+t.width))),x=Math.min(null!==(l=null===(r=i.area)||void 0===r?void 0:r.width)&&void 0!==l?l:1/0,u+b,...v.filter((t=>t.x>=u)).map((t=>t.x))),p=t.x-y,g=x-u;return{x:g>=p?u+g/2:t.x-p/2,y:a,r:Math.min(e,Math.max(Math.max(p,g)/2,.3*n))}}const x=(t,e)=>.6*t.length*e,p=(t,e)=>(t<0?"-":"+")+Math.abs(t).toFixed(e);function g(t,e,n,i,o,r,l){var s,a,h;if(null==i||null==o)return;const c=o-i,u=Number.isInteger(t.digits)&&t.digits>=0?t.digits:1,d="good-down"===t.sentiment?c<=0:c>=0,f=n.x+n.width/2>=e.x+e.width/2?1:-1,b=t=>1===f?t.x+t.width:t.x,v=b(n)+.9*f*r,m=v+.125*f*r,y=null!==(s=null==l?void 0:l.from)&&void 0!==s?s:e.y,g=null!==(a=null==l?void 0:l.to)&&void 0!==a?a:n.y,w=.25*r,k=t.percent&&0!==i?`(${p(c/Math.abs(i)*100,0)}%)`:void 0,M=p(c,u),$=v+.6*f*r,O=(y+g)/2,j=k?x(k,.85*r):0,S=1===f?$+.5*M.length*r+.35*r:$-j;return{kind:"difference",color:null!==(h=t.color)&&void 0!==h?h:d?"positive":"negative",lines:[{x1:b(e),y1:y,x2:m,y2:y},{x1:b(n),y1:g,x2:m,y2:g}],bar:{x:v-w/2,y:Math.min(y,g),width:w,height:Math.max(Math.abs(g-y),1)},text:{x:$,y:O,anchor:1===f?"start":"end",value:M,percent:k},frame:k&&t.highlight?{x:S-.25*r,y:O-.65*r,width:j+.5*r,height:1.3*r,r:.65*r}:void 0,badge:null!=t.label?{cx:v,cy:Math.min(y,g)-.9*r,r:.65*r,label:t.label}:void 0}}function w(t,e,n,i,o={}){var r,l,s,a;const{label:h,color:c}=t,{whole:u,area:d,text:p}=o,g=!u&&!p&&null!=o.obstacles,w=((t,e)=>t?Math.min(e,t.height/1.3):e)(null!=p?p:g?e:void 0,i);if("arrow"===t.mark){if(!n)return;const t=f(e),o=f(n);if(t.x===o.x&&t.y===o.y)return;let r=b(e,o),l=b(n,t);(l.x-r.x)*(o.x-t.x)+(l.y-r.y)*(o.y-t.y)<=0&&(r=t,l=o);const s=Math.hypot(l.x-r.x,l.y-r.y),a=Math.min(.8*i,s),u=(l.x-r.x)/s,m=(l.y-r.y)/s,y=l.x-u*a,x=l.y-m*a,p=.35*i;return{kind:"arrow",color:c,x1:r.x,y1:r.y,x2:y,y2:x,head:[`${l.x},${l.y}`,`${y-m*p},${x+u*p}`,`${y+m*p},${x-u*p}`].join(" "),badge:null!=h?v({cx:r.x,cy:r.y,r:.65*i,label:h},d):void 0}}if("frame"===t.mark){const n=null==t.text||u?void 0:o.label?"above"===t.textPosition?{x:e.x+e.width/2+.5*i,y:e.y-.8*i}:{x:e.x+e.width+.7*i+x(t.text,i)/2,y:e.y+e.height/2}:{x:e.x+e.width/2,y:e.y+Math.min(e.height/2,Math.max(.9*i,.3*e.height))},s=n&&{x:n.x-x(t.text,i)/2,y:n.y-.6*i,width:x(t.text,i),height:1.2*i},a=null!==(r=null!=s?s:p)&&void 0!==r?r:e,f=null===(l=t.point)||void 0===l?void 0:l.part,b=!u&&(null!=s||null!=p||"label"===f||"total"===f),m=(b?.45:.2)*w,y=(b?.1:.2)*w,g=b?Math.max(a.width,a.height):a.width,k=a.x+a.width/2,M=1,$=Math.max(d?M:-1/0,k-g/2-m),O=Math.max(d?M:-1/0,a.y-y),j=Math.min(d?d.width-M:1/0,k+g/2+m),S=Math.min(d?d.height-M:1/0,a.y+a.height+y),z=Math.min(j-$,S-O)/2,W=u?.25*i:z,C=u?.25*i:b?Math.min((j-$)/2,1.6*z):z,N=1-Math.SQRT1_2,L=.65*w,F=b?.6*L:0;return{kind:"frame",color:c,x:$,y:O,width:j-$,height:S-O,rx:C,ry:W,badge:null!=h?v({cx:j-C*N+F,cy:O+W*N-F,r:L,label:h},d):void 0,caption:n&&Object.assign(Object.assign({},n),{text:t.text})}}if(p&&!u){const t=y(p,(null==h?.4:.65)*w,w,o);return{kind:"marker",color:c,badge:v({cx:t.x,cy:t.y,r:t.r,label:h},d)}}const k=(null==h?.4:.75)*w,M=g?Math.min(k,e.height/2):k;let $=u?{x:e.x+e.width-M,y:e.y+M}:f(e);if(!u&&o.label)$={x:e.x+e.width+.25*w+M,y:e.y+e.height/2};else if(!u&&o.stacked&&o.horizontal){const t=1.3*w+M;$=e.width/2>=t+M?{x:e.x+e.width/2+t,y:e.y+e.height/2}:{x:e.x+e.width-Math.min(M,e.width/2),y:e.y}}else!u&&o.stacked&&"label"!==(null===(s=t.point)||void 0===s?void 0:s.part)&&"total"!==(null===(a=t.point)||void 0===a?void 0:a.part)&&($={x:e.x+e.width,y:e.y+Math.min(.5*M,e.height/2)});if(g){const t={x:$.x-M,y:$.y-M,width:2*M,height:2*M},e=o.obstacles.find((e=>m(t,e)));if(e){const t=y(e,M,w,o);return{kind:"marker",color:c,badge:v({cx:t.x,cy:t.y,r:t.r,label:h},d)}}}return{kind:"marker",color:c,badge:v({cx:$.x,cy:$.y,r:M,label:h},d)}}function k(t,e,n,i,o,r,l){var s;if(null==i||null==o)return;const a=o-i,h=Number.isInteger(t.digits)&&t.digits>=0?t.digits:1,c="good-down"===t.sentiment?a<=0:a>=0,u=n.y+n.height/2>=e.y+e.height/2?1:-1,d=t=>1===u?t.y+t.height:t.y,f=.25*r,b=d(n)+.25*u*r,v=Math.min(l.from,l.to),m=Math.max(l.from,l.to),y=t.percent&&0!==i?`(${p(a/Math.abs(i)*100,0)}%)`:void 0,g=p(a,h),w=m+.5*r,k=.5*g.length*r,M=y?x(y,.85*r):0,$=w+k+.35*r;return{kind:"difference",color:null!==(s=t.color)&&void 0!==s?s:c?"positive":"negative",lines:[{x1:l.from,y1:d(e),x2:l.from,y2:b},{x1:l.to,y1:d(n),x2:l.to,y2:b}],bar:{x:v,y:b-f/2,width:Math.max(m-v,1),height:f},text:{x:w,y:b,anchor:"start",value:g,percent:y},frame:y&&t.highlight?{x:$-.25*r,y:b-.65*r,width:M+.5*r,height:1.3*r,r:.65*r}:void 0,badge:null!=t.label?{cx:v-.9*r,cy:b,r:.65*r,label:t.label}:void 0}}function M(t,e,n){const i=e.x,o=e.y-.15*n,r=o-.7*n,l=o-1.9*n,s=.55*n,a=.22*n;return{kind:"pointer",color:t.color,shape:[[i,o],[i-s,r],[i-a,r],[i-a,l],[i+a,l],[i+a,r],[i+s,r]].map((([t,e])=>`${t},${e}`)).join(" "),badge:null!=t.label?{cx:i+1.1*n,cy:l+.65*n,r:.65*n,label:t.label}:void 0}}function $(t,e,n,i,o,r,l){const s=e.y<=n.y,[a,h]=s?[e,n]:[n,e],[c,u]=s?[i.first,i.last]:[i.last,i.first],d=h.y+h.height+.2*l,f=[[o,d],[u,d],[c,a.y-.1*l]],b=r?x(r,l):0,v=(a.y+h.y+h.height)/2,m=r?{x:o+.5*l+b/2,y:v,text:r}:void 0,y=m?m.x+b/2+1.2*l:o+.65*l;return{kind:"bracket",color:t.color,path:f.map((([t,e])=>`${t},${e}`)).join(" "),caption:m,frame:m&&{x:m.x-b/2-.45*l,y:m.y-.7*l,width:b+.9*l,height:1.4*l,r:.7*l},badge:null!=t.label?{cx:y,cy:v,r:.65*l,label:t.label}:void 0}}const O=["rowGroup","category","subCategory","date","scenario","row"];function j(t,e){var n;const i=t.table&&null==e.scenario?t.table.rows:null!==(n=t.elements)&&void 0!==n?n:[],o=null!=t.table&&null==e.subCategory;return i.filter((t=>function(t,e){var n;return!(!t||t.part!==(null!==(n=e.part)&&void 0!==n?n:"element"))&&O.every((n=>null==e[n]||e[n]+""===t[n]))}(t.point,e)&&!(o&&null!=t.point.subCategory))).map((({rect:t,content:e,contentSign:n,value:i,scenario:o,kind:r})=>({rect:t,content:e,contentSign:n,value:i,stacked:"string"==typeof o&&o.startsWith("stack:"),label:"label"===r})))}function S(t,e){const n=e.getBoundingClientRect();if(0===n.width||0===n.height)return!0;const i=t.x+t.width/2,o=t.y+t.height/2;return i>=n.left&&i<=n.right&&o>=n.top&&o<=n.bottom}const z=new Set(["bn-asset","bn-component-style","bn-dataset","bn-datasource","bn-internationalization","bn-ruleset","bn-scaling-group"]);function W(t,e){const n=e.getBoundingClientRect();return 0===n.width||0===n.height||t.x<n.right&&t.x+t.width>n.left&&t.y<n.bottom&&t.y+t.height>n.top}const C=t(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.marks=[],this.pageKey="",this.parsedItems=[],this.scheduled=!1,this.run=0,this.observed=new WeakSet,this.observedAround=new WeakSet,this.reported=new Set,this.schedule=()=>{this.scheduled||(this.scheduled=!0,this.holdStatus(new Promise((t=>{requestAnimationFrame((()=>{this.scheduled=!1,this.place().catch((t=>console.error("bn-annotation-layer: placing the marks failed",t))).finally(t)}))}))))},this.holdStatus=h(this),this.errors=d(this),this.componentStyle=u(this)}connectedCallback(){var t;this.stores=r(this.element),this.pageKey=l(this.element),this.observed=new WeakSet,this.observedAround=new WeakSet,this.resizeObserver=new ResizeObserver(this.schedule),this.mutationObserver=new MutationObserver(this.schedule),this.observeSize(this.element);const e=this.element.closest("bn-layout-page");e&&this.mutationObserver.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot","data-bino-annotation-target"]}),null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.schedule)}disconnectedCallback(){var t,e,n,i;null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(e=this.mutationObserver)||void 0===e||e.disconnect(),null===(n=document.fonts)||void 0===n||n.removeEventListener("loadingdone",this.schedule),this.run++,(null===(i=this.stores)||void 0===i?void 0:i.annotationsUnplaced.state[this.pageKey])&&this.stores.annotationsUnplaced.set(this.pageKey,void 0)}componentWillLoad(){this.parseItems()}componentDidLoad(){this.schedule()}onItemsChange(){this.parseItems(),this.schedule()}parseItems(){const t=s(this.items);t?this.errors.remove("ERR_items"):this.errors.addOrReplace({id:"ERR_items",type:"error",message:"items: not a JSON array of objects."}),this.parsedItems=null!=t?t:[]}async place(){var t,e,n,i;const o=++this.run;if(!this.element.isConnected||!this.svg)return;const r=this.element.closest("bn-layout-page"),l=new Map,s=new Map;null==r||r.querySelectorAll("[data-bino-annotation-target]").forEach((t=>{const e=Array.from(t.querySelectorAll("*")).find((t=>t.localName.startsWith("bn-")&&!z.has(t.localName))),n=null!=e?e:t;l.set(t.getAttribute("data-bino-annotation-target"),n),s.set(n,t)})),null==r||r.querySelectorAll("[slot]").forEach((t=>this.observeSize(t)));const a=new Set(this.parsedItems.flatMap((t=>[t.target,t.to]))),h=[...l].filter((([t])=>a.has(t))).map((([,t])=>t));if(await Promise.all(h.map((t=>{var e;return null===(e=t.componentOnReady)||void 0===e?void 0:e.call(t)}))),o!==this.run)return;h.forEach((t=>{this.observe(t),this.observeAround(t,r)}));const c=new Map;if(await Promise.all(h.map((async t=>{var e;c.set(t,await(null===(e=t.getLayoutState)||void 0===e?void 0:e.call(t,{detail:"full"}).catch((()=>{}))))}))),o!==this.run)return;const u=(t,e)=>{var n;const i=null!=t?l.get(t):void 0;if(!i)return{problem:`no target "${t}" on this page`};const o=i.getBoundingClientRect();if(function(t){return!t||O.every((e=>null==t[e]))&&null==t.part}(e)){const e={x:o.left,y:o.top,width:o.width,height:o.height};return function(t,e,n){if(0===t.width||0===t.height||!W(t,n))return!0;for(let n=e;n&&"bn-layout-page"!==n.localName;n=n.parentElement)if(!W(t,n))return!0;return!1}(e,s.get(i),this.element)?{problem:`"${t}" cannot be seen`}:{box:e,whole:!0}}const r=c.get(i),a=r?j(r,e):[];if(1!==a.length)return{problem:`${a.length} elements match the point ${JSON.stringify(e)} in "${t}"`};const h=({component:{x:t,y:e,width:n,height:i}})=>({x:o.left+t,y:o.top+e,width:n,height:i}),u=h(a[0].rect);if(function(t,e){for(let n=e;n&&"bn-layout-page"!==n.localName;n=n.parentElement)if(!S(t,n))return!0;return!1}(u,s.get(i))||!S(u,this.element))return{problem:`the point ${JSON.stringify(e)} in "${t}" is cut off`};const f=a[0].content;if(!r.table)return{box:u,whole:!1,stacked:a[0].stacked,label:a[0].label,horizontal:d(r)};const b=(null!==(n=r.elements)&&void 0!==n?n:[]).flatMap((t=>"cell"===t.kind&&t.content?[{box:h(t.content),sign:t.contentSign}]:[]));return{box:u,whole:!1,text:f&&{box:h(f),sign:a[0].contentSign},obstacles:b}},d=t=>{var e;return(null!==(e=null==t?void 0:t.elements)&&void 0!==e?e:[]).some((t=>"axis"===t.kind&&"vertical"===t.orientation))},f=(t,e)=>{const n=null!=t?l.get(t):void 0;if(!n)return{problem:`no target "${t}" on this page`};const i=c.get(n),o=(i&&e?j(i,Object.assign(Object.assign({},e),{part:"element"})):[]).filter((t=>null!=t.value));if(0===o.length)return{problem:`no bar with a value matches the point ${JSON.stringify(e)} in "${t}"`};if(o.length>1&&!o.every((t=>t.stacked)))return{problem:`${o.length} elements match the point ${JSON.stringify(e)} in "${t}"`};const r=n.getBoundingClientRect(),s=Math.min(...o.map((t=>t.rect.component.x))),a=Math.min(...o.map((t=>t.rect.component.y))),h=Math.max(...o.map((t=>t.rect.component.x+t.rect.component.width))),u=Math.max(...o.map((t=>t.rect.component.y+t.rect.component.height)));return{box:{x:r.left+s,y:r.top+a,width:h-s,height:u-a},negatives:o.filter((t=>t.value<0)).map((t=>(t=>({x:r.left+t.x,y:r.top+t.y,width:t.width,height:t.height}))(t.rect.component))),value:o.reduce(((t,e)=>t+e.value),0),horizontal:d(i)}},b=(t,e,n)=>{const i=l.get(t.target),o=i&&c.get(i);if(!i||!o||!t.point)return;const r=i.getBoundingClientRect(),s=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(n[i[o]]=t[i[o]])}return n}(t.point,["rowGroup","category","subCategory","date"]),a=j(o,Object.assign(Object.assign({},s),{part:"element"})).filter((t=>null!=t.value)),h=a.reduce(((t,e)=>t+e.value),0),u=a.filter((t=>{const i=r.top+t.rect.component.y+t.rect.component.height/2;return i>=e.y&&i<=n.y+n.height})).reduce(((t,e)=>t+e.value),0);return 0!==h?u/h:void 0},v=this.toLocalSpace(),m=({box:t,sign:e=0})=>{const n=v(t);return Object.assign(Object.assign({},n),{x:n.x-e,width:n.width+e})},y=parseFloat(getComputedStyle(this.svg).fontSize)||13.3333,x={width:this.element.clientWidth,height:this.element.clientHeight},p=[],C=[];for(const o of this.parsedItems){if("difference"===o.mark){const e=f(o.target,o.point),n=f(null!==(t=o.to)&&void 0!==t?t:o.target,o.toPoint),i="problem"in e?e:"problem"in n?n:void 0;if(i){C.push({item:o,problem:i.problem});continue}const[r,l]=[e,n];if(r.horizontal){const t=t=>{const e=v(t.box);return e.x+e.width-t.negatives.reduce(((t,e)=>t+v(e).width),0)},e=k(o,v(r.box),v(l.box),r.value,l.value,y,{from:t(r),to:t(l)});e&&p.push(e);continue}const s=t=>v(t.box).y+t.negatives.reduce(((t,e)=>t+v(e).height),0),a=g(o,v(r.box),v(l.box),r.value,l.value,y,{from:s(r),to:s(l)});a&&p.push(a);continue}if("pointer"===o.mark||"bracket"===o.mark){const t=f(o.target,o.point),i="bracket"===o.mark?f(null!==(e=o.to)&&void 0!==e?e:o.target,o.toPoint):t,r="problem"in t?t:"problem"in i?i:void 0;if(r){C.push({item:o,problem:r.problem});continue}const[s,a]=[t,i],h=t=>{const e=v(t.box);return t.horizontal?{x:e.x+e.width-t.negatives.reduce(((t,e)=>t+v(e).width),0),y:e.y}:{x:e.x+e.width/2,y:e.y+t.negatives.reduce(((t,e)=>t+v(e).height),0)}};if("pointer"===o.mark){p.push(M(o,h(s),y));continue}if(!s.horizontal){C.push({item:o,problem:"a bracket needs bars that run from left to right"});continue}if(null!=o.to&&o.to!==o.target){C.push({item:o,problem:"both ends of a bracket must be in one chart"});continue}const[c,u]=s.box.y<=a.box.y?[s.box,a.box]:[a.box,s.box],d=o.percent?b(o,c,u):void 0,m=l.get(o.target).getBoundingClientRect(),x=v({x:m.left,y:m.top,width:m.width,height:m.height}),g=null!==(n=o.text)&&void 0!==n?n:null!=d?Math.round(100*d)+"%":void 0;p.push($(o,v(s.box),v(a.box),{first:h(s).x,last:h(a).x},x.x,g,y));continue}const r=u(o.target,o.point),s="arrow"===o.mark?u(o.to,o.toPoint):void 0,a="problem"in r?r:s&&"problem"in s?s:void 0;if(a){C.push({item:o,problem:a.problem});continue}const h=r,c=s,d=w(o,v(h.box),c&&v(c.box),y,{whole:h.whole,area:x,text:h.text&&m(h.text),obstacles:null===(i=h.obstacles)||void 0===i?void 0:i.map(m),stacked:h.stacked,label:h.label,horizontal:h.horizontal});d?p.push(d):C.push({item:o,problem:"an arrow needs two ends at different places"})}this.marks=p,this.storeUnplaced(C.flatMap((({item:t})=>null!=t.label?[t.label]:[]))),C.length>0&&this.reportWhenQuiet(o,C)}async reportWhenQuiet(t,e){let n=0;for(let e=0;e<50&&n<2;e++){if(await new Promise((t=>window.setTimeout(t,200))),t!==this.run)return;n=0===c.componentRegisterStatus().running?n+1:0}this.report(e)}report(t){var e,n;for(const{item:i,problem:o}of t){const t=`bn-annotation-layer: ${null!==(e=i.mark)&&void 0!==e?e:"marker"} ${null!==(n=i.label)&&void 0!==n?n:"without a number"} is not drawn: ${o}.`;this.reported.has(t)||(this.reported.add(t),console.warn(t))}}toLocalSpace(){var t;const e=null===(t=this.svg.getScreenCTM())||void 0===t?void 0:t.inverse();return t=>{if(!e)return t;const n=[[t.x,t.y],[t.x+t.width,t.y+t.height]].map((([t,n])=>new DOMPoint(t,n).matrixTransform(e)));return{x:Math.min(n[0].x,n[1].x),y:Math.min(n[0].y,n[1].y),width:Math.abs(n[1].x-n[0].x),height:Math.abs(n[1].y-n[0].y)}}}storeUnplaced(t){var e,n;const i=null===(e=this.stores)||void 0===e?void 0:e.annotationsUnplaced,o=null!==(n=null==i?void 0:i.state[this.pageKey])&&void 0!==n?n:[];i&&JSON.stringify(o)!==JSON.stringify(t)&&i.set(this.pageKey,t)}observe(t){this.observeSize(t);const e=t=>{var n;t&&(this.observed.has(t)||(this.observed.add(t),null===(n=this.mutationObserver)||void 0===n||n.observe(t,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["x","y","width","height","transform","style","class"]})),t.querySelectorAll("*").forEach((t=>e(t.shadowRoot))))};e(t.shadowRoot)}observeAround(t,e){var n,i;for(let o=t.parentElement;o&&o!==e;o=o.parentElement)this.observedAround.has(o)||(this.observedAround.add(o),null===(n=this.mutationObserver)||void 0===n||n.observe(o,{attributes:!0,attributeFilter:["style"]}),o.shadowRoot&&(null===(i=this.mutationObserver)||void 0===i||i.observe(o.shadowRoot,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]})))}observeSize(t){var e;this.observed.has(t)||(this.observed.add(t),null===(e=this.resizeObserver)||void 0===e||e.observe(t))}renderBadge(t,e){var n;if(!t)return null;const o="outlined"===(null===(n=this.componentStyle((t=>t["bn-annotation"])))||void 0===n?void 0:n.markerStyle),r=i("circle",o?{cx:t.cx,cy:t.cy,r:t.r-.75,style:{fill:"#ffffff",stroke:e,strokeWidth:"1.5"}}:{cx:t.cx,cy:t.cy,r:t.r,style:{fill:e}});return i("g",null,r,null!=t.label?i("text",{class:"badge-text",x:t.cx,y:t.cy,style:Object.assign({fontSize:1.1*t.r+"px"},o?{fill:e}:{})},t.label):null)}renderMark(t){var e,n,o,r,l;const s=a(t.color,this.componentStyle((t=>t["bn-annotation"])));if("marker"===t.kind)return i("g",{class:"mark marker","data-label":t.badge.label},this.renderBadge(t.badge,s));if("frame"===t.kind)return i("g",{class:"mark frame","data-label":null===(e=t.badge)||void 0===e?void 0:e.label},i("rect",{x:t.x,y:t.y,width:t.width,height:t.height,rx:t.rx,ry:t.ry,style:{fill:t.caption?"#ffffff":"none",stroke:s,strokeWidth:"1.5"}}),t.caption?i("text",{class:"mark-text caption",x:t.caption.x,y:t.caption.y},t.caption.text):null,this.renderBadge(t.badge,s));if("difference"===t.kind){const e=a(void 0,this.componentStyle((t=>t["bn-annotation"])));return i("g",{class:"mark difference","data-label":null===(n=t.badge)||void 0===n?void 0:n.label},t.lines.map((t=>i("line",{class:"difference-line",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}))),i("rect",{x:t.bar.x,y:t.bar.y,width:t.bar.width,height:t.bar.height,style:{fill:s}}),i("text",{class:"mark-text",x:t.text.x,y:t.text.y,style:{textAnchor:t.text.anchor}},t.text.value,t.text.percent?i("tspan",{class:"percent",dx:"0.35em"},t.text.percent):null),t.frame?i("rect",{x:t.frame.x,y:t.frame.y,width:t.frame.width,height:t.frame.height,rx:t.frame.r,ry:t.frame.r,style:{fill:"none",stroke:e,strokeWidth:"1.5"}}):null,this.renderBadge(t.badge,e))}return"pointer"===t.kind?i("g",{class:"mark pointer","data-label":null===(o=t.badge)||void 0===o?void 0:o.label},i("polygon",{points:t.shape,style:{fill:s}}),this.renderBadge(t.badge,s)):"bracket"===t.kind?i("g",{class:"mark bracket","data-label":null===(r=t.badge)||void 0===r?void 0:r.label},i("polyline",{points:t.path,style:{fill:"none",stroke:s,strokeWidth:"1.5"}}),t.frame?i("rect",{x:t.frame.x,y:t.frame.y,width:t.frame.width,height:t.frame.height,rx:t.frame.r,ry:t.frame.r,style:{fill:"#ffffff",stroke:s,strokeWidth:"1.5"}}):null,t.caption?i("text",{class:"mark-text caption",x:t.caption.x,y:t.caption.y},t.caption.text):null,this.renderBadge(t.badge,s)):i("g",{class:"mark arrow","data-label":null===(l=t.badge)||void 0===l?void 0:l.label},i("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,style:{stroke:s,strokeWidth:"1.5"}}),i("polygon",{points:t.head,style:{fill:s}}),this.renderBadge(t.badge,s))}render(){return i(o,{key:"370b2e099f2316d584f40b02b417576ecc541291"},i("svg",{key:"ba77a53b8fe0b9dbabe25d070a87a1841ed19998",ref:t=>this.svg=t},this.marks.map((t=>this.renderMark(t)))))}get element(){return this}static get watchers(){return{items:[{onItemsChange:0}]}}static get style(){return':host{position:absolute;inset:0;z-index:1;display:block;pointer-events:none;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px)}svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}.badge-text{fill:#ffffff;font-weight:bold;text-anchor:middle;dominant-baseline:central}.mark-text{fill:#000000;dominant-baseline:central}.mark-text.caption{text-anchor:middle;font-size:0.9em}.mark-text .percent{font-size:0.85em}.difference-line{stroke:#000000;stroke-width:0.75}'}},[1,"bn-annotation-layer",{items:[1],selectedStyle:[513,"selected-style"],marks:[32]},void 0,{items:[{onItemsChange:0}]}]),N=C,L=function(){"undefined"!=typeof customElements&&["bn-annotation-layer"].forEach((t=>{"bn-annotation-layer"===t&&(customElements.get(e(t))||customElements.define(e(t),C))}))};export{N as BnAnnotationLayer,L as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as s,f as e,h as i,d as n,t as l}from"./p-BnmylmXF.js";import{g as o}from"./p-6242qMx1.js";import{a,p as r,b as d}from"./p-CHJ6WE0l.js";import{s as m}from"./p-CyUmrWfW.js";import{w as c}from"./p-BrQCbmG0.js";import{w as f}from"./p-JG4Sx1lE.js";import{w as h}from"./p-D32TsLzd.js";const p=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.pageKey="",c(this),this.errors=h(this),this.componentStyle=f(this)}connectedCallback(){this.stores=o(this.element),this.pageKey=a(this.element),this.unsubscribe=this.stores.annotationsUnplaced.on("set",(t=>{t===this.pageKey&&e(this.element)})),e(this.element)}disconnectedCallback(){var t;null===(t=this.unsubscribe)||void 0===t||t.call(this)}render(){var t,s;const e=r(this.items);e?this.errors.remove("ERR_items"):this.errors.addOrReplace({id:"ERR_items",type:"error",message:"items: not a JSON array of objects."});const l=d(void 0,this.componentStyle((t=>t["bn-annotation"]))),o=null!==(s=null===(t=this.stores)||void 0===t?void 0:t.annotationsUnplaced.state[this.pageKey])&&void 0!==s?s:[];return i(n,{key:"69a1cb7ec4623dd722328638b93fa2ac05775dcf"},i("ol",{key:"cc7925db54a9015cd774242487967e25d0eb1dc0"},(null!=e?e:[]).map((t=>i("li",null,null==t.label||o.includes(t.label)?null!=t.label?i("div",{class:"badge-space"}):null:i("div",{class:"badge",style:{background:l}},i("span",null,t.label)),i("div",{class:"text"},t.title?i("span",{class:"title"},t.title," "):null,t.html?i("span",{innerHTML:m(t.html)}):null))))))}get element(){return this}static get style(){return':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)}ol{margin:0;padding:0;list-style:none}li{display:flex;gap:0.5em;margin-bottom:0.6em;align-items:flex-start}.badge-space{flex:none;width:1.5em;height:1.5em}.badge{flex:none;display:flex;align-items:center;justify-content:center;width:1.5em;height:1.5em;border-radius:50%;color:#ffffff;font-weight:bold;line-height:1}.badge span{font-size:0.825em}.title{font-weight:bold}'}},[1,"bn-annotation-list",{items:[1],selectedStyle:[513,"selected-style"]}]),b=p,u=function(){"undefined"!=typeof customElements&&["bn-annotation-list"].forEach((t=>{"bn-annotation-list"===t&&(customElements.get(l(t))||customElements.define(l(t),p))}))};export{b as BnAnnotationList,u as defineCustomElement}
1
+ import{p as t,H as s,f as e,h as i,d as n,t as o}from"./p-BnmylmXF.js";import{g as l}from"./p-5LbdDgZ5.js";import{a,p as r,b as c}from"./p-CWSjn_DC.js";import{s as d}from"./p-CyUmrWfW.js";import{w as f}from"./p-BrQCbmG0.js";import{w as m}from"./p-NkLVO7n9.js";import{w as h}from"./p-D32TsLzd.js";const p=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.pageKey="",f(this),this.errors=h(this),this.componentStyle=m(this)}connectedCallback(){this.stores=l(this.element),this.pageKey=a(this.element),this.unsubscribe=this.stores.annotationsUnplaced.on("set",(t=>{t===this.pageKey&&e(this.element)})),e(this.element)}disconnectedCallback(){var t;null===(t=this.unsubscribe)||void 0===t||t.call(this)}render(){var t,s;const e=r(this.items);e?this.errors.remove("ERR_items"):this.errors.addOrReplace({id:"ERR_items",type:"error",message:"items: not a JSON array of objects."});const o=this.componentStyle((t=>t["bn-annotation"])),l=c(void 0,o),a="outlined"===(null==o?void 0:o.markerStyle)?{background:"#ffffff",color:l,boxShadow:"inset 0 0 0 1.5px "+l}:{background:l},f=null!==(s=null===(t=this.stores)||void 0===t?void 0:t.annotationsUnplaced.state[this.pageKey])&&void 0!==s?s:[];return i(n,{key:"ec249c8259923180f4bd30b8c712c0614a758911"},i("ol",{key:"6e8cbbe5a5841c8707081f9452b11c3971cecd03"},(null!=e?e:[]).map((t=>i("li",null,null==t.label||f.includes(t.label)?null!=t.label?i("div",{class:"badge-space"}):null:i("div",{class:"badge",style:a},i("span",null,t.label)),i("div",{class:"text"},t.title?i("span",{class:"title"},t.title," "):null,t.html?i("span",{innerHTML:d(t.html)}):null))))))}get element(){return this}static get style(){return':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)}ol{margin:0;padding:0;list-style:none}li{display:flex;gap:0.5em;margin-bottom:0.6em;align-items:flex-start}.badge-space{flex:none;width:1.5em;height:1.5em}.badge{flex:none;display:flex;align-items:center;justify-content:center;width:1.5em;height:1.5em;border-radius:50%;color:#ffffff;font-weight:bold;line-height:1}.badge span{font-size:0.825em}.title{font-weight:bold}'}},[1,"bn-annotation-list",{items:[1],selectedStyle:[513,"selected-style"]}]),b=p,u=function(){"undefined"!=typeof customElements&&["bn-annotation-list"].forEach((t=>{"bn-annotation-list"===t&&(customElements.get(o(t))||customElements.define(o(t),p))}))};export{b as BnAnnotationList,u as defineCustomElement}
@@ -1 +1 @@
1
- import{p as s,H as t,h as e,d as r,t as o}from"./p-BnmylmXF.js";import{w as i}from"./p-BrQCbmG0.js";import{g as n}from"./p-6242qMx1.js";import{w as m}from"./p-BP2sJ8k9.js";import{w as a}from"./p-D32TsLzd.js";const h=s(class extends t{constructor(s){super(),!1!==s&&this.__registerHost(),this.__attachShadow(),i(this),this.errors=a(this),m(this,(s=>{this.stores||(this.stores=n(this.element));try{const t=s.replace(/\s/g,"");this.stores.assets.set(this.name,t)}catch(t){console.error("Error parsing asset",t,s),this.stores.assets.set(this.name,void 0)}}))}render(){return e(r,{key:"9df81e3697e02833b8cb1fad7ea06a5f446852be"})}get element(){return this}static get style(){return":host{display:none}"}},[1,"bn-asset",{name:[1]}]),p=h,c=function(){"undefined"!=typeof customElements&&["bn-asset"].forEach((s=>{"bn-asset"===s&&(customElements.get(o(s))||customElements.define(o(s),h))}))};export{p as BnAsset,c as defineCustomElement}
1
+ import{p as s,H as t,h as e,d as r,t as o}from"./p-BnmylmXF.js";import{w as i}from"./p-BrQCbmG0.js";import{g as n}from"./p-5LbdDgZ5.js";import{w as m}from"./p-BP2sJ8k9.js";import{w as a}from"./p-D32TsLzd.js";const h=s(class extends t{constructor(s){super(),!1!==s&&this.__registerHost(),this.__attachShadow(),i(this),this.errors=a(this),m(this,(s=>{this.stores||(this.stores=n(this.element));try{const t=s.replace(/\s/g,"");this.stores.assets.set(this.name,t)}catch(t){console.error("Error parsing asset",t,s),this.stores.assets.set(this.name,void 0)}}))}render(){return e(r,{key:"9df81e3697e02833b8cb1fad7ea06a5f446852be"})}get element(){return this}static get style(){return":host{display:none}"}},[1,"bn-asset",{name:[1]}]),p=h,c=function(){"undefined"!=typeof customElements&&["bn-asset"].forEach((s=>{"bn-asset"===s&&(customElements.get(o(s))||customElements.define(o(s),h))}))};export{p as BnAsset,c as defineCustomElement}
@@ -1 +1 @@
1
- import{B as o,d as s}from"./p-DMAaBt7n.js";const t=o,a=s;export{t as BnBody,a as defineCustomElement}
1
+ import{B as o,d as p}from"./p-CTX2pUU7.js";const s=o,r=p;export{s as BnBody,r as defineCustomElement}
@@ -1 +1 @@
1
- import{C as o,d as s}from"./p-4xaxuPVU.js";const a=o,p=s;export{a as BnCard,p as defineCustomElement}
1
+ import{C as s,d as o}from"./p-tz4QGm3s.js";const t=s,m=o;export{t as BnCard,m as defineCustomElement}
@@ -1 +1 @@
1
- import{B as m,d as o}from"./p-BOwmXBm-.js";const s=m,p=o;export{s as BnChartBubbleRenderer,p as defineCustomElement}
1
+ import{B as o,d as s}from"./p-LB2R8XbL.js";const p=o,r=s;export{p as BnChartBubbleRenderer,r as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as e,w as i,f as s,h as a,d as r,t as n}from"./p-BnmylmXF.js";import{h as l,a as o}from"./p-6242qMx1.js";import{o as h}from"./p-DdvG1D18.js";import{c}from"./p-BXP6aagM.js";import{a as d}from"./p-JofGXz75.js";import{g as u}from"./p-Dsvjkuy3.js";import{c as p}from"./p-C50Ge-4H.js";import{o as v}from"./p-B6kka9sT.js";import{p as m}from"./p-Xb6Ilq8u.js";import{i as f,h as b,j as y}from"./p-CcfvGlBq.js";import{w as g}from"./p-BrQCbmG0.js";import{w as x}from"./p-JG4Sx1lE.js";import{w}from"./p-CZzlLTQc.js";import{w as _}from"./p-D32TsLzd.js";import{w as S}from"./p-Bs5V6Ibu.js";import{w as j}from"./p-Bp5Xj4-s.js";import{w as L}from"./p-D65TnLS9.js";import{w as R}from"./p-CU9CdEBF.js";import{r as z,s as $}from"./p-YSRTB0jS.js";import{t as E,a as A,b as N,c as C,d as W,e as k,p as F}from"./p-D362XOg2.js";import{s as O}from"./p-DakXa7Dp.js";import{d as B}from"./p-BOwmXBm-.js";const D={rowGroup:0,category:1,subCategory:2},G=["ac","pp","fc","pl"],M=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateMeasureSpec("x",t,!0,(t=>E(t)))}validateY(t){this.validateMeasureSpec("y",t,!0,(t=>E(t)))}validateSize(t){this.validateMeasureSpec("size",t,!0,(t=>A(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>N(t)))}validateCompareWith(t){const e="WARN_compareWith";f(t)||G.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`compare-with: invalid value '${t}' - expected ${G.join("/")}; ignored.`})}validateLevel(t){const e="WARN_level",i=["auto","category","subcategory"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="WARN_seriesLevel",i=["auto","rowgroup","category","none"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>C(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>W(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>k(t)))}validateAspect(t){const e="WARN_aspect";f(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="WARN_limit";b(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="WARN_scale";if(f(t))return void this.errors.remove(e);const{mode:i,factor:s}=m(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),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,e)=>this.t(t,e),R(this),g(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=_(this),j(this),this.componentStyle=x(this),this.ruleSetConfig=S(this),this.t=L(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(){O(this.element,"bn-chart-bubble-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 e=this.element,{width:s}=u(e);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l}))),this.checkOverflow()}checkOverflow(){p(this.element,"bn-chart-bubble-renderer",this.errors)}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,s(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,s(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,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===e||this.pixelPerUnitGroupMap.has(e)?null:this.t(".bubble-scale-group-unknown",{group:e}))}validateMeasureSpec(t,e,i,s){var a;const r="ERR_xy_json_"+t,n="ERR_xy_measure_"+t,l="WARN_xy_fields_"+t,{data:o,parseError:h}=F(e,"measure");if(h)return this.setBlockingError(r,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(l);if(this.setBlockingError(r,null),null===o)return this.setBlockingError(n,i?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(l);const c=null!==(a=o.measure)&&void 0!==a?a:"";y(c)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(l,t,s(o))}validateObjectSpec(t,e,i){const s="ERR_xy_json_"+t,a="WARN_xy_fields_"+t,{data:r,parseError:n}=F(e,null);if(n)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(a);this.setBlockingError(s,null),null!==r?this.reportSpecIssues(a,t,i(r)):this.errors.remove(a)}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:i,parseError:s}=F(e,"measure");if(s||null===i)return null;const{config:a}=E(i);return null!==a&&y(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareSize(){const{data:t,parseError:e}=F(this.size,"measure");if(e||null===t)return null;const{config:i}=A(t);return null!==i&&y(i.measure)?i:null}prepareShare(){const{data:t,parseError:e}=F(this.share,"measure");if(e||null===t)return null;const{config:i}=N(t);return null!==i&&y(i.measure)?i:null}prepareCompareFamily(){var t;const e=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return G.includes(e)?e:null}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=F(this.labels,null);return i||null===e?{points:t.points,values:t.values,max:t.max}:W(e,t).config}prepareLegend(){const{data:t,parseError:e}=F(this.legend,null);return e||null===t?{show:!0,position:"right"}:k(t).config}prepareFacet(){const{data:t,parseError:e}=F(this.facet,null);return e||null===t?null:C(t).config}preparePointLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var e;const i=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const i=new Set;let s=!1;for(const e of t){if(void 0===e)continue;const t=z(e);null!==t&&("scenario"===t.kind?i.add($(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const a=this.prepareCompareFamily();this.setBlockingError("ERR_xy_compare_variance",null!==a&&s?this.t(".xy-compare-variance"):null),this.setBlockingError("ERR_xy_compare_family",null!==a&&1===i.size&&i.has(a)?`compare-with: '${a}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),n=this.prepareSeriesLevel(r),l=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let o=null;if(null!==n&&D[n]>=D[r]&&(o=`series '${n}' vs point '${r}'`),null!==l){const t=null!=n?n:r;D[l]>=D[t]&&(o=`facet '${l}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==o?this.t(".xy-level-order",{detail:o}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const i=Number(e[1]),s=Number(e[2]);return i<=0||s<=0?null:i/s}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 e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===e||!this.pixelPerUnitGroupMap.has(e))return 0;const i=this.pixelPerUnitGroupMap.get(e);if(!(i>0))return 0;const s=this.getEffectiveFontPx();return s*s/i}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))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bubble"].axisStyles,seriesColors:e["bn-chart-bubble"].seriesColors,padding:e["bn-chart-bubble"].padding}}))}async getBaseline(){return d(this.element,"bn-chart-bubble-renderer")}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return c(this.element,"bn-chart-bubble-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=m(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[i,s]of Object.entries(e)){if(null===s)continue;const e=z(s.measure);null!==e&&("scenario"===e.kind?t[e.slot].description=`${i}: ${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)`))}const i=this.prepareCompareFamily();if(null!==i)for(const[s,a]of Object.entries(e)){if(null===a||"share"===s)continue;const e=z(a.measure);if(null!==e&&"scenario"===e.kind){const a=i+e.slot.replace(/^[a-z]+/,"");""===t[a].description&&(t[a].description=s+": 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),e=this.prepareAxis("y",this.y),i=this.prepareSize(),s=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure,null==i?void 0:i.measure,null==s?void 0:s.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===e||null===i)return null;const n=this.preparePointLevel(),l=this.prepareI18n(),o=this.prepareStyle(),h=u(this.element).width;return a("bn-chart-bubble-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,size:i,share:s,compareFamily:this.prepareCompareFamily(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:r,pointLevel:n,seriesLevel:this.prepareSeriesLevel(n),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,sizeAreaPerUnit:this.prepareSizeAreaPerUnit(),styles:o,i18n:l,containerWidth:h,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return a(r,{key:"2b15b5b4fc32db48b951e82ecc87f25b0afcc9f8",style:this.getFontStyles()},a("div",{key:"210d8622e1785b8c882f9c9a2fa2072af0e857b6",class:"container"},this.chartTemplate()))}get element(){return 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}]}}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:column}'}},[1,"bn-chart-bubble",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],size:[1],share:[1],compareWith:[1,"compare-with"],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{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}]}]),T=M,X=function(){"undefined"!=typeof customElements&&["bn-chart-bubble","bn-chart-bubble-renderer"].forEach((t=>{switch(t){case"bn-chart-bubble":customElements.get(n(t))||customElements.define(n(t),M);break;case"bn-chart-bubble-renderer":customElements.get(n(t))||B()}}))};export{T as BnChartBubble,X as defineCustomElement}
1
+ import{p as t,H as e,w as i,f as s,h as a,d as r,t as n}from"./p-BnmylmXF.js";import{h as l,a as o}from"./p-5LbdDgZ5.js";import{o as h}from"./p-Bmb0YBzz.js";import{c}from"./p-CFY-zEXs.js";import{a as d}from"./p-JofGXz75.js";import{g as u}from"./p-Dsvjkuy3.js";import{c as p}from"./p-C50Ge-4H.js";import{o as v}from"./p-B6kka9sT.js";import{p as m}from"./p-Xb6Ilq8u.js";import{i as f,h as b,j as y}from"./p-CcfvGlBq.js";import{w as g}from"./p-BrQCbmG0.js";import{w as x}from"./p-NkLVO7n9.js";import{w}from"./p-ClFDt6Bk.js";import{w as _}from"./p-D32TsLzd.js";import{w as S}from"./p-CFF7b9FT.js";import{w as L}from"./p-BPvwrhvq.js";import{w as j}from"./p-OR6uR6gy.js";import{w as R}from"./p-CU9CdEBF.js";import{r as z,s as $}from"./p-YSRTB0jS.js";import{t as E,a as A,b as F,c as C,d as N,e as k,p as W}from"./p-D362XOg2.js";import{s as O}from"./p-DakXa7Dp.js";import{d as B}from"./p-LB2R8XbL.js";const D={rowGroup:0,category:1,subCategory:2},G=["ac","pp","fc","pl"],M=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateMeasureSpec("x",t,!0,(t=>E(t)))}validateY(t){this.validateMeasureSpec("y",t,!0,(t=>E(t)))}validateSize(t){this.validateMeasureSpec("size",t,!0,(t=>A(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>F(t)))}validateCompareWith(t){const e="WARN_compareWith";f(t)||G.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`compare-with: invalid value '${t}' - expected ${G.join("/")}; ignored.`})}validateLevel(t){const e="WARN_level",i=["auto","category","subcategory"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="WARN_seriesLevel",i=["auto","rowgroup","category","none"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>C(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>N(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>k(t)))}validateAspect(t){const e="WARN_aspect";f(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="WARN_limit";b(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="WARN_scale";if(f(t))return void this.errors.remove(e);const{mode:i,factor:s}=m(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),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,e)=>this.t(t,e),R(this),g(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=_(this),L(this),this.componentStyle=x(this),this.ruleSetConfig=S(this),this.t=j(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(){O(this.element,"bn-chart-bubble-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 e=this.element,{width:s}=u(e);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l}))),this.checkOverflow()}checkOverflow(){p(this.element,"bn-chart-bubble-renderer",this.errors)}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,s(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,s(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,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===e||this.pixelPerUnitGroupMap.has(e)?null:this.t(".bubble-scale-group-unknown",{group:e}))}validateMeasureSpec(t,e,i,s){var a;const r="ERR_xy_json_"+t,n="ERR_xy_measure_"+t,l="WARN_xy_fields_"+t,{data:o,parseError:h}=W(e,"measure");if(h)return this.setBlockingError(r,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(l);if(this.setBlockingError(r,null),null===o)return this.setBlockingError(n,i?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(l);const c=null!==(a=o.measure)&&void 0!==a?a:"";y(c)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(l,t,s(o))}validateObjectSpec(t,e,i){const s="ERR_xy_json_"+t,a="WARN_xy_fields_"+t,{data:r,parseError:n}=W(e,null);if(n)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(a);this.setBlockingError(s,null),null!==r?this.reportSpecIssues(a,t,i(r)):this.errors.remove(a)}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:i,parseError:s}=W(e,"measure");if(s||null===i)return null;const{config:a}=E(i);return null!==a&&y(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareSize(){const{data:t,parseError:e}=W(this.size,"measure");if(e||null===t)return null;const{config:i}=A(t);return null!==i&&y(i.measure)?i:null}prepareShare(){const{data:t,parseError:e}=W(this.share,"measure");if(e||null===t)return null;const{config:i}=F(t);return null!==i&&y(i.measure)?i:null}prepareCompareFamily(){var t;const e=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return G.includes(e)?e:null}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=W(this.labels,null);return i||null===e?{points:t.points,values:t.values,max:t.max}:N(e,t).config}prepareLegend(){const{data:t,parseError:e}=W(this.legend,null);return e||null===t?{show:!0,position:"right"}:k(t).config}prepareFacet(){const{data:t,parseError:e}=W(this.facet,null);return e||null===t?null:C(t).config}preparePointLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var e;const i=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const i=new Set;let s=!1;for(const e of t){if(void 0===e)continue;const t=z(e);null!==t&&("scenario"===t.kind?i.add($(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const a=this.prepareCompareFamily();this.setBlockingError("ERR_xy_compare_variance",null!==a&&s?this.t(".xy-compare-variance"):null),this.setBlockingError("ERR_xy_compare_family",null!==a&&1===i.size&&i.has(a)?`compare-with: '${a}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),n=this.prepareSeriesLevel(r),l=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let o=null;if(null!==n&&D[n]>=D[r]&&(o=`series '${n}' vs point '${r}'`),null!==l){const t=null!=n?n:r;D[l]>=D[t]&&(o=`facet '${l}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==o?this.t(".xy-level-order",{detail:o}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const i=Number(e[1]),s=Number(e[2]);return i<=0||s<=0?null:i/s}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 e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===e||!this.pixelPerUnitGroupMap.has(e))return 0;const i=this.pixelPerUnitGroupMap.get(e);if(!(i>0))return 0;const s=this.getEffectiveFontPx();return s*s/i}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))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bubble"].axisStyles,seriesColors:e["bn-chart-bubble"].seriesColors,padding:e["bn-chart-bubble"].padding}}))}async getBaseline(){return d(this.element,"bn-chart-bubble-renderer")}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return c(this.element,"bn-chart-bubble-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=m(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[i,s]of Object.entries(e)){if(null===s)continue;const e=z(s.measure);null!==e&&("scenario"===e.kind?t[e.slot].description=`${i}: ${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)`))}const i=this.prepareCompareFamily();if(null!==i)for(const[s,a]of Object.entries(e)){if(null===a||"share"===s)continue;const e=z(a.measure);if(null!==e&&"scenario"===e.kind){const a=i+e.slot.replace(/^[a-z]+/,"");""===t[a].description&&(t[a].description=s+": 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),e=this.prepareAxis("y",this.y),i=this.prepareSize(),s=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure,null==i?void 0:i.measure,null==s?void 0:s.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===e||null===i)return null;const n=this.preparePointLevel(),l=this.prepareI18n(),o=this.prepareStyle(),h=u(this.element).width;return a("bn-chart-bubble-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,size:i,share:s,compareFamily:this.prepareCompareFamily(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:r,pointLevel:n,seriesLevel:this.prepareSeriesLevel(n),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,sizeAreaPerUnit:this.prepareSizeAreaPerUnit(),styles:o,i18n:l,containerWidth:h,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return a(r,{key:"2b15b5b4fc32db48b951e82ecc87f25b0afcc9f8",style:this.getFontStyles()},a("div",{key:"210d8622e1785b8c882f9c9a2fa2072af0e857b6",class:"container"},this.chartTemplate()))}get element(){return 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}]}}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:column}'}},[1,"bn-chart-bubble",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],size:[1],share:[1],compareWith:[1,"compare-with"],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{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}]}]),T=M,X=function(){"undefined"!=typeof customElements&&["bn-chart-bubble","bn-chart-bubble-renderer"].forEach((t=>{switch(t){case"bn-chart-bubble":customElements.get(n(t))||customElements.define(n(t),M);break;case"bn-chart-bubble-renderer":customElements.get(n(t))||B()}}))};export{T as BnChartBubble,X as defineCustomElement}
@@ -1 +1 @@
1
- import{B as o,d as s}from"./p-DKcw-1ot.js";const t=o,p=s;export{t as BnChartBulletRenderer,p as defineCustomElement}
1
+ import{B as o,d as s}from"./p-CThV2et_.js";const t=o,p=s;export{t as BnChartBulletRenderer,p as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as e,w as i,f as s,h as r,d as a,t as n}from"./p-BnmylmXF.js";import{h as l,a as o}from"./p-6242qMx1.js";import{o as u}from"./p-DdvG1D18.js";import{c as d}from"./p-BXP6aagM.js";import{a as h}from"./p-JofGXz75.js";import{C as c,A as p}from"./p-DguYWLBj.js";import{o as v}from"./p-B6kka9sT.js";import{a as m,b as g,O as f}from"./p-BBdzTx8V.js";import{g as b}from"./p-Dsvjkuy3.js";import{p as y}from"./p-Xb6Ilq8u.js";import{b as _,i as w,c as j,h as A}from"./p-CcfvGlBq.js";import{w as O}from"./p-BrQCbmG0.js";import{w as R}from"./p-JG4Sx1lE.js";import{w as N}from"./p-CZzlLTQc.js";import{w as S}from"./p-D32TsLzd.js";import{r as x}from"./p-D0v9GMIf.js";import{w as T}from"./p-Bs5V6Ibu.js";import{w as E}from"./p-D65TnLS9.js";import{w as z}from"./p-CU9CdEBF.js";import{r as D}from"./p-YSRTB0jS.js";import{p as k}from"./p-D362XOg2.js";import{s as L}from"./p-DakXa7Dp.js";import{d as W}from"./p-DKcw-1ot.js";const M=["measure","label","unit"];function $(t){const e=[],i=I(t,"measure",e);if(void 0===i||""===i.trim())return e.push("measure"),{config:null,unknownKeys:C(t,M),invalidFields:e};const s={measure:i.trim()};return s.label=I(t,"label",e),s.unit=I(t,"unit",e),{config:s,unknownKeys:C(t,M),invalidFields:e}}const B=["show","decimals"];function F(t,e){const i=[],s={show:e.show,decimals:e.decimals};return c.isExisting(t.show)&&("auto"===t.show||"none"===t.show?s.show=t.show:i.push("show")),c.isExisting(t.decimals)&&(c.isNumber(t.decimals)&&t.decimals>=0&&t.decimals<=4?s.decimals=Math.floor(t.decimals):i.push("decimals")),{config:s,unknownKeys:C(t,B),invalidFields:i}}function U(t){var e;const i=null!==(e=null==t?void 0:t.trim())&&void 0!==e?e:"";if(""===i||"null"===i)return{ranges:[],parseError:!1,issues:[]};let s;try{s=JSON.parse(i)}catch(t){return{ranges:[],parseError:!0,issues:[]}}if(!Array.isArray(s)||0===s.length)return{ranges:[],parseError:!0,issues:[]};if(!s.every((t=>c.isNumber(t)&&isFinite(t)&&t>0)))return{ranges:[],parseError:!0,issues:[]};const r=[];let a=s;const n=[...a].sort(((t,e)=>t-e));return n.some(((t,e)=>t!==a[e]))&&r.push("not ascending, sorted"),a=n,a.length>2&&(r.push(a.length+" entries, first 2 kept"),a=a.slice(0,2)),{ranges:a,parseError:!1,issues:r}}function C(t,e){return Object.keys(t).filter((t=>!e.includes(t)))}function I(t,e,i){if(c.isExisting(t[e]))return c.isString(t[e])?t[e]:void i.push(e)}const V=["pl1","pp1","fc1"],G=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateActual(t){this.validateMeasureSpec("actual",t)}validateTarget(t){this.validateMeasureSpec("target",t)}validateRanges(t){const e="ERR_bullet_json_ranges",i="WARN_bullet_ranges",s=U(t);if(s.parseError)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"ranges"})),void this.errors.remove(i);this.setBlockingError(e,null),s.issues.length>0?this.errors.addOrReplace({id:i,type:"warning",message:this.t(".bullet-ranges-invalid",{detail:s.issues.join("; ")})}):this.errors.remove(i)}validateNormalize(t){this.validateEnum("normalize","WARN_normalize",t,["target","none"],"target")}validateVariances(t){this.validateEnum("variances","WARN_variances",t,["auto","none"],"auto")}validateLevel(t){this.validateEnum("level","WARN_level",t,["auto","rowgroup","category","subcategory"],"auto")}validateOrder(t){const e="WARN_order",i=_(t).filter((t=>""!==t));0===i.length?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order: invalid value(s) '${i.join(", ")}'; using the dataset order.`})}validateOrderDirection(t){const e="WARN_orderDirection";w(t)||j(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order-direction: invalid value '${t}' - expected asc/desc; using asc.`})}validateLimit(t){const e="WARN_limit";A(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateLabels(t){const e="ERR_bullet_json_labels",i="WARN_bullet_fields_labels",{data:s,parseError:r}=k(t,null);if(r)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"labels"})),void this.errors.remove(i);this.setBlockingError(e,null),null!==s?this.reportSpecIssues(i,"labels",F(s,this.labelDefaults())):this.errors.remove(i)}validateScale(t){const e="WARN_scale";if(w(t))return void this.errors.remove(e);const{mode:i,factor:s}=y(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),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.normalizeMode="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,e)=>this.t(t,e),z(this),O(this),N(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=S(this),this.componentStyle=R(this),this.ruleSetConfig=T(this),this.t=E(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateActual(this.actual),this.validateTarget(this.target),this.validateRanges(this.ranges),this.validateNormalize(this.normalizeMode),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(){L(this.element,"bn-chart-bullet-renderer");const{mode:t}=y(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{height:s}=b(e);if(s<=0)return;this._lastScaledParentHeight=s;const r=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),a=e.scrollHeight,n=this.appliedScaleFactor;if(a<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/a);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",r*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=b(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=b(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{show:"auto",decimals:1}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateMeasureSpec(t,e){var i;const s="ERR_bullet_json_"+t,r="ERR_bullet_measure_"+t,a="WARN_bullet_fields_"+t,{data:n,parseError:l}=k(e,"measure");if(l)return this.setBlockingError(s,this.t(".bullet-prop-json",{prop:t})),this.setBlockingError(r,null),void this.errors.remove(a);if(this.setBlockingError(s,null),null===n)return this.setBlockingError(r,null),void this.errors.remove(a);const o=(null!==(i=n.measure)&&void 0!==i?i:"").trim(),u=D(o);"auto"===o.toLowerCase()||null!==u&&"scenario"===u.kind?this.setBlockingError(r,null):this.setBlockingError(r,this.t(".bullet-measure-invalid",{prop:t,measure:o})),this.reportSpecIssues(a,t,$(n))}validateEnum(t,e,i,s,r){w(i)||s.includes(i.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`${t}: invalid value '${i}' - expected ${s.join("/")}; using '${r}'.`})}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareActual(){var t,e,i,s,r;const{data:a,parseError:n}=k(this.actual,"measure");if(n)return null;const l=null!==a?$(a).config:null;if(null===l||"auto"===l.measure.toLowerCase()){const r=null!==l,a=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],n=null!==(s=a.includes("ac1")?"ac1":null!==(i=a.find((t=>t.startsWith("ac"))))&&void 0!==i?i:a[0])&&void 0!==s?s:"ac1";return r||null===this.datasetMeta?this.errors.remove("AUTO_actual"):this.errors.addOrReplace({id:"AUTO_actual",type:"warning",message:"actual: not set, auto-detected: "+n}),null===l?{measure:n}:Object.assign(Object.assign({},l),{measure:n})}return this.errors.remove("AUTO_actual"),"scenario"===(null===(r=D(l.measure))||void 0===r?void 0:r.kind)?l:null}prepareTarget(){var t,e,i;const{data:s,parseError:r}=k(this.target,"measure");if(r)return null;const a=null!==s?$(s).config:null;if(null===a||"auto"===a.measure.toLowerCase()){const i=null!==a,s=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],r=V.find((t=>s.includes(t)));return void 0===r?(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"),i||null===this.datasetMeta?this.errors.remove("AUTO_target"):this.errors.addOrReplace({id:"AUTO_target",type:"warning",message:"target: not set, auto-detected: "+r}),null===a?{measure:r}:Object.assign(Object.assign({},a),{measure:r}))}return this.errors.remove("AUTO_target"),this.errors.remove("WARN_bullet_target_unavailable"),"scenario"===(null===(i=D(a.measure))||void 0===i?void 0:i.kind)?a:null}prepareNormalize(){var t;return"none"===(null===(t=this.normalizeMode)||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,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("rowgroup"===i)return p.ROWGROUP;if("category"===i)return p.CATEGORY;if("subcategory"===i)return p.SUBCATEGORY;const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;if(void 0!==s&&""!==s){const t=p[s.toUpperCase()];if(void 0!==t)return t}return p.CATEGORY}prepareOrder(){var t,e,i,s;const r="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let a;w(this.order)||r?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedOrder)?(r?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),a=this.datasetMeta.suggestedOrder):(this.errors.remove("AUTO_order"),a=""):(this.errors.remove("AUTO_order"),a=this.order);const n=null!==(s=m[null===(i=this.orderDirection)||void 0===i?void 0:i.toUpperCase()])&&void 0!==s?s:m.ASC;if(w(a))return new g([f.CATEGORYINDEX],n);const l=a.split(",").map((t=>f[t.trim().toUpperCase()])).filter((t=>void 0!==t));return new g(l.length>0?l:[f.CATEGORYINDEX],n)}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=k(this.labels,null);return i||null===e?{show:t.show,decimals:t.decimals}:F(e,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))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries(),...x(this.ruleSetConfig("user"))])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bullet"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bullet"].axisStyles,barStyles:e["bn-chart-bullet"].barStyles,varianceStyles:e["bn-chart-bullet"].varianceStyles,rangeColors:e["bn-chart-bullet"].rangeColors,padding:e["bn-chart-bullet"].padding}}))}async getBaseline(){return h(this.element,"bn-chart-bullet-renderer")}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=u(this.element),r=this.getEffectiveScaleFactor(),a=Number.isFinite(r)&&r>0?r:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*a;return d(this.element,"bn-chart-bullet-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:a},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=y(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,r,a;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(r=e.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(a=e.global)||void 0===a?void 0:a.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={actual:this.prepareActual(),target:this.prepareTarget()};for(const[i,s]of Object.entries(e))null!==s&&void 0!==t[s.measure]&&(t[s.measure].description=`${i}: ${void 0!==s.label?s.label:s.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(),e=this.prepareTarget(),i=U(this.ranges).ranges,s=this.prepareNormalize();return this.setBlockingError("ERR_bullet_measure_same",null!==t&&null!==e&&t.measure===e.measure?this.t(".bullet-measure-same",{measure:t.measure}):null),i.length>0&&"target"===s?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:r("bn-chart-bullet-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,actual:t,target:e,ranges:i,normalizeMode:s,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:b(this.element).width,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return r(a,{key:"cdd2404977255a330652806671d1bea76c796769",style:this.getFontStyles()},r("div",{key:"0b8cfeb6209083f9144c5824bceecb9b02578f02",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalizeMode:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale: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:column}'}},[1,"bn-chart-bullet",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],actual:[1],target:[1],ranges:[1],normalizeMode:[1,"normalize"],variances:[1],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],labels:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalizeMode:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}]),X=G,q=function(){"undefined"!=typeof customElements&&["bn-chart-bullet","bn-chart-bullet-renderer"].forEach((t=>{switch(t){case"bn-chart-bullet":customElements.get(n(t))||customElements.define(n(t),G);break;case"bn-chart-bullet-renderer":customElements.get(n(t))||W()}}))};export{X as BnChartBullet,q as defineCustomElement}
1
+ import{p as t,H as e,w as i,f as s,h as r,d as a,t as n}from"./p-BnmylmXF.js";import{h as l,a as o}from"./p-5LbdDgZ5.js";import{o as u}from"./p-Bmb0YBzz.js";import{c as d}from"./p-CFY-zEXs.js";import{a as h}from"./p-JofGXz75.js";import{C as c,A as p}from"./p-DguYWLBj.js";import{o as v}from"./p-B6kka9sT.js";import{a as m,b as g,O as f}from"./p-BBdzTx8V.js";import{g as b}from"./p-Dsvjkuy3.js";import{p as y}from"./p-Xb6Ilq8u.js";import{b as _,i as w,c as O,h as j}from"./p-CcfvGlBq.js";import{w as A}from"./p-BrQCbmG0.js";import{w as R}from"./p-NkLVO7n9.js";import{w as N}from"./p-ClFDt6Bk.js";import{w as S}from"./p-D32TsLzd.js";import{r as z}from"./p-D0v9GMIf.js";import{w as T}from"./p-CFF7b9FT.js";import{w as x}from"./p-OR6uR6gy.js";import{w as E}from"./p-CU9CdEBF.js";import{r as k}from"./p-YSRTB0jS.js";import{p as D}from"./p-D362XOg2.js";import{s as F}from"./p-DakXa7Dp.js";import{d as L}from"./p-CThV2et_.js";const W=["measure","label","unit"];function B(t){const e=[],i=V(t,"measure",e);if(void 0===i||""===i.trim())return e.push("measure"),{config:null,unknownKeys:U(t,W),invalidFields:e};const s={measure:i.trim()};return s.label=V(t,"label",e),s.unit=V(t,"unit",e),{config:s,unknownKeys:U(t,W),invalidFields:e}}const $=["show","decimals"];function C(t,e){const i=[],s={show:e.show,decimals:e.decimals};return c.isExisting(t.show)&&("auto"===t.show||"none"===t.show?s.show=t.show:i.push("show")),c.isExisting(t.decimals)&&(c.isNumber(t.decimals)&&t.decimals>=0&&t.decimals<=4?s.decimals=Math.floor(t.decimals):i.push("decimals")),{config:s,unknownKeys:U(t,$),invalidFields:i}}function M(t){var e;const i=null!==(e=null==t?void 0:t.trim())&&void 0!==e?e:"";if(""===i||"null"===i)return{ranges:[],parseError:!1,issues:[]};let s;try{s=JSON.parse(i)}catch(t){return{ranges:[],parseError:!0,issues:[]}}if(!Array.isArray(s)||0===s.length)return{ranges:[],parseError:!0,issues:[]};if(!s.every((t=>c.isNumber(t)&&isFinite(t)&&t>0)))return{ranges:[],parseError:!0,issues:[]};const r=[];let a=s;const n=[...a].sort(((t,e)=>t-e));return n.some(((t,e)=>t!==a[e]))&&r.push("not ascending, sorted"),a=n,a.length>2&&(r.push(a.length+" entries, first 2 kept"),a=a.slice(0,2)),{ranges:a,parseError:!1,issues:r}}function U(t,e){return Object.keys(t).filter((t=>!e.includes(t)))}function V(t,e,i){if(c.isExisting(t[e]))return c.isString(t[e])?t[e]:void i.push(e)}const I=["pl1","pp1","fc1"],G=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateActual(t){this.validateMeasureSpec("actual",t)}validateTarget(t){this.validateMeasureSpec("target",t)}validateRanges(t){const e="ERR_bullet_json_ranges",i="WARN_bullet_ranges",s=M(t);if(s.parseError)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"ranges"})),void this.errors.remove(i);this.setBlockingError(e,null),s.issues.length>0?this.errors.addOrReplace({id:i,type:"warning",message:this.t(".bullet-ranges-invalid",{detail:s.issues.join("; ")})}):this.errors.remove(i)}validateNormalize(t){this.validateEnum("normalize","WARN_normalize",t,["target","none"],"target")}validateVariances(t){this.validateEnum("variances","WARN_variances",t,["auto","none"],"auto")}validateLevel(t){this.validateEnum("level","WARN_level",t,["auto","rowgroup","category","subcategory"],"auto")}validateOrder(t){const e="WARN_order",i=_(t).filter((t=>""!==t));0===i.length?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order: invalid value(s) '${i.join(", ")}'; using the dataset order.`})}validateOrderDirection(t){const e="WARN_orderDirection";w(t)||O(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order-direction: invalid value '${t}' - expected asc/desc; using asc.`})}validateLimit(t){const e="WARN_limit";j(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateLabels(t){const e="ERR_bullet_json_labels",i="WARN_bullet_fields_labels",{data:s,parseError:r}=D(t,null);if(r)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"labels"})),void this.errors.remove(i);this.setBlockingError(e,null),null!==s?this.reportSpecIssues(i,"labels",C(s,this.labelDefaults())):this.errors.remove(i)}validateScale(t){const e="WARN_scale";if(w(t))return void this.errors.remove(e);const{mode:i,factor:s}=y(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),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.normalizeMode="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,e)=>this.t(t,e),E(this),A(this),N(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=S(this),this.componentStyle=R(this),this.ruleSetConfig=T(this),this.t=x(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateActual(this.actual),this.validateTarget(this.target),this.validateRanges(this.ranges),this.validateNormalize(this.normalizeMode),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(){F(this.element,"bn-chart-bullet-renderer");const{mode:t}=y(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{height:s}=b(e);if(s<=0)return;this._lastScaledParentHeight=s;const r=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),a=e.scrollHeight,n=this.appliedScaleFactor;if(a<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/a);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",r*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=b(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=b(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{show:"auto",decimals:1}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateMeasureSpec(t,e){var i;const s="ERR_bullet_json_"+t,r="ERR_bullet_measure_"+t,a="WARN_bullet_fields_"+t,{data:n,parseError:l}=D(e,"measure");if(l)return this.setBlockingError(s,this.t(".bullet-prop-json",{prop:t})),this.setBlockingError(r,null),void this.errors.remove(a);if(this.setBlockingError(s,null),null===n)return this.setBlockingError(r,null),void this.errors.remove(a);const o=(null!==(i=n.measure)&&void 0!==i?i:"").trim(),u=k(o);"auto"===o.toLowerCase()||null!==u&&"scenario"===u.kind?this.setBlockingError(r,null):this.setBlockingError(r,this.t(".bullet-measure-invalid",{prop:t,measure:o})),this.reportSpecIssues(a,t,B(n))}validateEnum(t,e,i,s,r){w(i)||s.includes(i.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`${t}: invalid value '${i}' - expected ${s.join("/")}; using '${r}'.`})}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareActual(){var t,e,i,s,r;const{data:a,parseError:n}=D(this.actual,"measure");if(n)return null;const l=null!==a?B(a).config:null;if(null===l||"auto"===l.measure.toLowerCase()){const r=null!==l,a=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],n=null!==(s=a.includes("ac1")?"ac1":null!==(i=a.find((t=>t.startsWith("ac"))))&&void 0!==i?i:a[0])&&void 0!==s?s:"ac1";return r||null===this.datasetMeta?this.errors.remove("AUTO_actual"):this.errors.addOrReplace({id:"AUTO_actual",type:"warning",message:"actual: not set, auto-detected: "+n}),null===l?{measure:n}:Object.assign(Object.assign({},l),{measure:n})}return this.errors.remove("AUTO_actual"),"scenario"===(null===(r=k(l.measure))||void 0===r?void 0:r.kind)?l:null}prepareTarget(){var t,e,i;const{data:s,parseError:r}=D(this.target,"measure");if(r)return null;const a=null!==s?B(s).config:null;if(null===a||"auto"===a.measure.toLowerCase()){const i=null!==a,s=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],r=I.find((t=>s.includes(t)));return void 0===r?(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"),i||null===this.datasetMeta?this.errors.remove("AUTO_target"):this.errors.addOrReplace({id:"AUTO_target",type:"warning",message:"target: not set, auto-detected: "+r}),null===a?{measure:r}:Object.assign(Object.assign({},a),{measure:r}))}return this.errors.remove("AUTO_target"),this.errors.remove("WARN_bullet_target_unavailable"),"scenario"===(null===(i=k(a.measure))||void 0===i?void 0:i.kind)?a:null}prepareNormalize(){var t;return"none"===(null===(t=this.normalizeMode)||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,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("rowgroup"===i)return p.ROWGROUP;if("category"===i)return p.CATEGORY;if("subcategory"===i)return p.SUBCATEGORY;const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;if(void 0!==s&&""!==s){const t=p[s.toUpperCase()];if(void 0!==t)return t}return p.CATEGORY}prepareOrder(){var t,e,i,s;const r="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let a;w(this.order)||r?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedOrder)?(r?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),a=this.datasetMeta.suggestedOrder):(this.errors.remove("AUTO_order"),a=""):(this.errors.remove("AUTO_order"),a=this.order);const n=null!==(s=m[null===(i=this.orderDirection)||void 0===i?void 0:i.toUpperCase()])&&void 0!==s?s:m.ASC;if(w(a))return new g([f.CATEGORYINDEX],n);const l=a.split(",").map((t=>f[t.trim().toUpperCase()])).filter((t=>void 0!==t));return new g(l.length>0?l:[f.CATEGORYINDEX],n)}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=D(this.labels,null);return i||null===e?{show:t.show,decimals:t.decimals}:C(e,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))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries(),...z(this.ruleSetConfig("user"))])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bullet"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bullet"].axisStyles,barStyles:e["bn-chart-bullet"].barStyles,varianceStyles:e["bn-chart-bullet"].varianceStyles,rangeColors:e["bn-chart-bullet"].rangeColors,padding:e["bn-chart-bullet"].padding}}))}async getBaseline(){return h(this.element,"bn-chart-bullet-renderer")}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=u(this.element),r=this.getEffectiveScaleFactor(),a=Number.isFinite(r)&&r>0?r:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*a;return d(this.element,"bn-chart-bullet-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:a},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=y(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,r,a;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(r=e.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(a=e.global)||void 0===a?void 0:a.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={actual:this.prepareActual(),target:this.prepareTarget()};for(const[i,s]of Object.entries(e))null!==s&&void 0!==t[s.measure]&&(t[s.measure].description=`${i}: ${void 0!==s.label?s.label:s.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(),e=this.prepareTarget(),i=M(this.ranges).ranges,s=this.prepareNormalize();return this.setBlockingError("ERR_bullet_measure_same",null!==t&&null!==e&&t.measure===e.measure?this.t(".bullet-measure-same",{measure:t.measure}):null),i.length>0&&"target"===s?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:r("bn-chart-bullet-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,actual:t,target:e,ranges:i,normalizeMode:s,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:b(this.element).width,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return r(a,{key:"cdd2404977255a330652806671d1bea76c796769",style:this.getFontStyles()},r("div",{key:"0b8cfeb6209083f9144c5824bceecb9b02578f02",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalizeMode:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale: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:column}'}},[1,"bn-chart-bullet",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],actual:[1],target:[1],ranges:[1],normalizeMode:[1,"normalize"],variances:[1],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],labels:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalizeMode:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}]),X=G,q=function(){"undefined"!=typeof customElements&&["bn-chart-bullet","bn-chart-bullet-renderer"].forEach((t=>{switch(t){case"bn-chart-bullet":customElements.get(n(t))||customElements.define(n(t),G);break;case"bn-chart-bullet-renderer":customElements.get(n(t))||L()}}))};export{X as BnChartBullet,q as defineCustomElement}
@@ -1 +1 @@
1
- import{B as o,d as s}from"./p-jEqo8YD5.js";const p=o,r=s;export{p as BnChartScatterRenderer,r as defineCustomElement}
1
+ import{B as o,d as s}from"./p-ChMe_jnA.js";const p=o,r=s;export{p as BnChartScatterRenderer,r as defineCustomElement}