@bino-bi/bn-template-engine 1.0.0-next.27 → 1.0.0-next.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (410) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-5075771a.entry.js +1 -0
  3. package/dist/bn-template-engine/p-5d516435.entry.js +1 -0
  4. package/dist/bn-template-engine/p-5e90e728.entry.js +1 -0
  5. package/dist/bn-template-engine/p-9ef7e132.entry.js +1 -0
  6. package/dist/bn-template-engine/p-9f7a1980.entry.js +1 -0
  7. package/dist/bn-template-engine/p-BeXgxHkW.js +1 -0
  8. package/dist/bn-template-engine/p-CH0bpt_k.js +1 -0
  9. package/dist/bn-template-engine/p-ClruFZD_.js +1 -0
  10. package/dist/bn-template-engine/{p-CTrNbSXN.js → p-DFmSrSnf.js} +1 -1
  11. package/dist/bn-template-engine/p-DI3efDSV.js +1 -0
  12. package/dist/bn-template-engine/p-DXLTTILG.js +1 -0
  13. package/dist/bn-template-engine/p-DtP4jqG5.js +1 -0
  14. package/dist/bn-template-engine/p-a8281b71.entry.js +1 -0
  15. package/dist/bn-template-engine/p-b31277e7.entry.js +1 -0
  16. package/dist/bn-template-engine/p-b396ac84.entry.js +1 -0
  17. package/dist/cjs/{bn-asset_21.cjs.entry.js → bn-asset_28.cjs.entry.js} +21401 -6608
  18. package/dist/cjs/bn-grid.cjs.entry.js +4 -6
  19. package/dist/cjs/bn-image.cjs.entry.js +3 -5
  20. package/dist/cjs/bn-internationalization.cjs.entry.js +17 -6
  21. package/dist/cjs/bn-ruleset.cjs.entry.js +5 -5
  22. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  23. package/dist/cjs/bn-template.cjs.entry.js +2 -2
  24. package/dist/cjs/bn-text.cjs.entry.js +115 -43
  25. package/dist/cjs/{context-protocol-G4pi217i.js → context-protocol-C0rKepqu.js} +98 -12
  26. package/dist/cjs/{diagnostics-CRfecdNZ.js → diagnostics-Cq-qDtXq.js} +1 -1
  27. package/dist/cjs/editor-companion.cjs.entry.js +2 -2
  28. package/dist/cjs/loader.cjs.js +1 -1
  29. package/dist/cjs/queryError-BZjnIW_w.js +16 -0
  30. package/dist/cjs/{scaling-BGTK5H0H.js → sanitizeHtml-Yx1xn6i_.js} +467 -287
  31. package/dist/cjs/{withBodyObserver-DJO98AJ-.js → withBodyObserver-CaPUjuC5.js} +1 -1
  32. package/dist/cjs/withHasError-qGW_yqIv.js +426 -0
  33. package/dist/cjs/{withStyled-CZCnmfPw.js → withStyled-vSfogp9J.js} +543 -42
  34. package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +51 -28
  35. package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.js +13 -5
  36. package/dist/collection/components/bn-chart-bubble/utils/BubbleChart.js +67 -30
  37. package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +47 -29
  38. package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.js +14 -5
  39. package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +34 -18
  40. package/dist/collection/components/bn-chart-bullet/utils/model/BulletChartStyle.js +2 -0
  41. package/dist/collection/components/bn-chart-bullet/utils/model/BulletConfig.js +1 -1
  42. package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +50 -27
  43. package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.js +13 -5
  44. package/dist/collection/components/bn-chart-scatter/utils/ScatterChart.js +52 -18
  45. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +59 -43
  46. package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +56 -15
  47. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +218 -262
  48. package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +1 -1
  49. package/dist/collection/components/bn-chart-structure/utils/elements/Needle.js +11 -4
  50. package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +16 -25
  51. package/dist/collection/components/bn-chart-structure/utils/model/StructureChartComponentConfig.js +3 -2
  52. package/dist/collection/components/bn-chart-structure/utils/model/styles/StructureChartStyle.js +2 -0
  53. package/dist/collection/components/bn-chart-time/bn-chart-time.js +99 -51
  54. package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +56 -15
  55. package/dist/collection/components/bn-chart-time/utils/TimeChart.js +245 -250
  56. package/dist/collection/components/bn-chart-time/utils/elements/AreaFill.js +1 -1
  57. package/dist/collection/components/bn-chart-time/utils/elements/Label.js +1 -1
  58. package/dist/collection/components/bn-chart-time/utils/elements/LineSeries.js +1 -1
  59. package/dist/collection/components/bn-chart-time/utils/elements/Needle.js +11 -4
  60. package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +22 -34
  61. package/dist/collection/components/bn-chart-time/utils/helper/LabelCollisionManager.js +3 -3
  62. package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +4 -3
  63. package/dist/collection/components/bn-chart-time/utils/model/TimeChartDataRow.js +2 -2
  64. package/dist/collection/components/bn-chart-time/utils/model/styles/TimeChartStyle.js +2 -0
  65. package/dist/collection/components/bn-component-style/bn-component-style.js +14 -2
  66. package/dist/collection/components/bn-context/bn-context.js +92 -22
  67. package/dist/collection/components/bn-dataset/bn-dataset.js +246 -90
  68. package/dist/collection/components/bn-datasource/bn-datasource.js +169 -77
  69. package/dist/collection/components/bn-footer/bn-footer.js +6 -6
  70. package/dist/collection/components/bn-internationalization/bn-internationalization.js +14 -3
  71. package/dist/collection/components/bn-layout-card/bn-layout-card.js +25 -74
  72. package/dist/collection/components/bn-layout-page/bn-layout-page.js +59 -71
  73. package/dist/collection/components/bn-message/bn-message.js +2 -2
  74. package/dist/collection/components/bn-page/bn-page.css +0 -240
  75. package/dist/collection/components/bn-page/bn-page.js +14 -4
  76. package/dist/collection/components/bn-page/pageFormats.js +69 -0
  77. package/dist/collection/components/bn-ruleset/bn-ruleset.js +2 -2
  78. package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +7 -7
  79. package/dist/collection/components/bn-table/bn-table.js +93 -58
  80. package/dist/collection/components/bn-table/ibcs-table.css +2 -1
  81. package/dist/collection/components/bn-table/ibcs-table.js +85 -28
  82. package/dist/collection/components/bn-table/utils/Table.js +12 -13
  83. package/dist/collection/components/bn-table/utils/elements/Cell.js +9 -3
  84. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +38 -34
  85. package/dist/collection/components/bn-table/utils/elements/TableRow.js +2 -1
  86. package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +4 -4
  87. package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +17 -4
  88. package/dist/collection/components/bn-table/utils/helper/DataQuery.js +128 -98
  89. package/dist/collection/components/bn-table/utils/helper/IntervalColumns.js +6 -20
  90. package/dist/collection/components/bn-table/utils/helper/QueryGroup.js +9 -2
  91. package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +2 -2
  92. package/dist/collection/components/bn-table/utils/model/TableAttribute.js +2 -2
  93. package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +3 -2
  94. package/dist/collection/components/bn-template/bn-template.js +1 -1
  95. package/dist/collection/components/bn-text/bn-text.js +36 -39
  96. package/dist/collection/components/bn-text/utils/template.js +79 -0
  97. package/dist/collection/components/bn-title/bn-title.js +10 -4
  98. package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +3 -1
  99. package/dist/collection/components/bn-tree/bn-tree.js +119 -23
  100. package/dist/collection/components/bn-tree/utils/EdgeRenderer.js +59 -51
  101. package/dist/collection/components/bn-tree/utils/TreeLayout.js +30 -5
  102. package/dist/collection/components/bn-tree/utils/TreeParser.js +35 -0
  103. package/dist/collection/components/editor-companion/editor-companion.js +1 -1
  104. package/dist/collection/context/context-protocol.js +1 -1
  105. package/dist/collection/context/scopedDb.js +47 -4
  106. package/dist/collection/stores/componentStyles.js +39 -0
  107. package/dist/collection/stores/internationalization.js +5 -3
  108. package/dist/collection/utils/DateStringFactory.js +17 -15
  109. package/dist/collection/utils/autoFit.js +2 -2
  110. package/dist/collection/utils/componentRegister.js +60 -16
  111. package/dist/collection/utils/constants.js +2 -2
  112. package/dist/collection/utils/dataAnalyzer.js +9 -12
  113. package/dist/collection/utils/formatter.js +29 -20
  114. package/dist/collection/utils/layoutObserver.js +1 -1
  115. package/dist/collection/utils/layoutState/generic.js +1 -1
  116. package/dist/collection/utils/layoutState/svgChartElements.js +2 -2
  117. package/dist/collection/utils/layoutTemplate.js +81 -0
  118. package/dist/collection/utils/measurementHost.js +2 -2
  119. package/dist/collection/utils/model/Order.js +1 -1
  120. package/dist/collection/utils/model/styles/SVGStyle.js +12 -4
  121. package/dist/collection/utils/parentDimensions.js +35 -3
  122. package/dist/collection/utils/queryError.js +11 -0
  123. package/dist/collection/utils/relativeVariance.js +14 -0
  124. package/dist/collection/utils/sanitizeHtml.js +30 -16
  125. package/dist/collection/utils/scaling.js +2 -2
  126. package/dist/collection/utils/stackColors.js +27 -5
  127. package/dist/collection/utils/stackLayout.js +71 -0
  128. package/dist/collection/utils/styled/attributes.js +16 -3
  129. package/dist/collection/utils/styled/style-sheet.js +1 -1
  130. package/dist/collection/utils/styled/withStyled.js +1 -1
  131. package/dist/collection/utils/testing/fakeGroup.js +21 -0
  132. package/dist/collection/utils/testing/mutationObserver.js +44 -0
  133. package/dist/collection/utils/testing/structureChart.js +26 -0
  134. package/dist/collection/utils/testing/timeChart.js +28 -0
  135. package/dist/collection/utils/validate.js +1 -1
  136. package/dist/collection/utils/withComponentStatus.js +137 -12
  137. package/dist/collection/utils/withInheritedProps.js +113 -64
  138. package/dist/collection/utils/withRuleSet.js +10 -7
  139. package/dist/collection/utils/withTranslation.js +3 -3
  140. package/dist/collection/utils/xy/FacetGrid.js +1 -1
  141. package/dist/collection/utils/xy/IsoCurves.js +1 -1
  142. package/dist/collection/utils/xy/NumericScale.js +46 -15
  143. package/dist/collection/utils/xy/PointLabeler.js +2 -2
  144. package/dist/collection/utils/xy/RadiusScale.js +2 -2
  145. package/dist/collection/utils/xy/SeriesPalette.js +3 -3
  146. package/dist/collection/utils/xy/VarianceMeasure.js +22 -4
  147. package/dist/collection/utils/xy/XYFrame.js +4 -4
  148. package/dist/collection/utils/xy/XYLegend.js +5 -7
  149. package/dist/collection/utils/xy/checkXYOverflow.js +32 -0
  150. package/dist/collection/utils/xy/formatXYValue.js +13 -0
  151. package/dist/collection/utils/xy/model/XYChartDataRow.js +0 -0
  152. package/dist/collection/utils/xy/model/XYChartStyle.js +2 -0
  153. package/dist/components/DataFormatDigits.js +1 -1
  154. package/dist/components/DateStringFactory.js +1 -1
  155. package/dist/components/LabelCollisionManager.js +1 -1
  156. package/dist/components/NumericScale.js +1 -1
  157. package/dist/components/Order.js +1 -1
  158. package/dist/components/SVGStyle.js +1 -0
  159. package/dist/components/TableAttribute.js +1 -0
  160. package/dist/components/VarianceMeasure.js +1 -1
  161. package/dist/components/XYChartDataRow.js +1 -1
  162. package/dist/components/bn-asset.js +1 -1
  163. package/dist/components/bn-body2.js +1 -1
  164. package/dist/components/bn-card2.js +1 -1
  165. package/dist/components/bn-chart-bubble.js +1 -1
  166. package/dist/components/bn-chart-bullet.js +1 -1
  167. package/dist/components/bn-chart-scatter.js +1 -1
  168. package/dist/components/bn-chart-structure.js +1 -1
  169. package/dist/components/bn-chart-time.js +1 -1
  170. package/dist/components/bn-component-style.js +1 -1
  171. package/dist/components/bn-context.js +1 -1
  172. package/dist/components/bn-dataset.js +1 -1
  173. package/dist/components/bn-datasource.js +1 -1
  174. package/dist/components/bn-footer2.js +1 -1
  175. package/dist/components/bn-grid.js +1 -1
  176. package/dist/components/bn-image.js +1 -1
  177. package/dist/components/bn-internationalization.js +1 -1
  178. package/dist/components/bn-layout-card.js +1 -1
  179. package/dist/components/bn-layout-page.js +1 -1
  180. package/dist/components/bn-message2.js +1 -1
  181. package/dist/components/bn-page2.js +1 -1
  182. package/dist/components/bn-ruleset.js +1 -1
  183. package/dist/components/bn-scaling-group.js +1 -1
  184. package/dist/components/bn-table.js +1 -1
  185. package/dist/components/bn-template.js +1 -1
  186. package/dist/components/bn-text.js +1 -1
  187. package/dist/components/bn-title2.js +1 -1
  188. package/dist/components/bn-tree.js +1 -1
  189. package/dist/components/checkXYOverflow.js +1 -0
  190. package/dist/components/context-protocol.js +1 -1
  191. package/dist/components/editor-companion.js +1 -1
  192. package/dist/components/emptyState.js +1 -1
  193. package/dist/components/formatter.js +1 -1
  194. package/dist/components/ibcs-chart-bubble2.js +1 -1
  195. package/dist/components/ibcs-chart-bullet2.js +1 -1
  196. package/dist/components/ibcs-chart-scatter2.js +1 -1
  197. package/dist/components/ibcs-chart-structure2.js +1 -1
  198. package/dist/components/ibcs-chart-time2.js +1 -1
  199. package/dist/components/ibcs-table2.js +1 -1
  200. package/dist/components/ibcs-title2.js +1 -1
  201. package/dist/components/layoutObserver.js +1 -0
  202. package/dist/components/layoutTemplate.js +1 -0
  203. package/dist/components/pageFormats.js +1 -0
  204. package/dist/components/parentDimensions.js +1 -0
  205. package/dist/components/queryError.js +1 -0
  206. package/dist/components/relativeVariance.js +1 -0
  207. package/dist/components/sanitizeHtml.js +1 -1
  208. package/dist/components/stackColors.js +1 -1
  209. package/dist/components/stackLayout.js +1 -0
  210. package/dist/components/svg.esm.js +1 -1
  211. package/dist/components/validate.js +1 -1
  212. package/dist/components/withBodyObserver.js +1 -1
  213. package/dist/components/withComponentStatus.js +1 -0
  214. package/dist/components/withComponentStyle.js +1 -1
  215. package/dist/components/withDataset.js +1 -1
  216. package/dist/components/withHasError.js +1 -1
  217. package/dist/components/withRuleSet.js +1 -1
  218. package/dist/components/withScalingGroup.js +1 -1
  219. package/dist/components/withStyled.js +1 -1
  220. package/dist/components/withTranslation.js +1 -1
  221. package/dist/esm/{bn-asset_21.entry.js → bn-asset_28.entry.js} +20962 -6176
  222. package/dist/esm/bn-grid.entry.js +4 -6
  223. package/dist/esm/bn-image.entry.js +3 -5
  224. package/dist/esm/bn-internationalization.entry.js +17 -6
  225. package/dist/esm/bn-ruleset.entry.js +5 -5
  226. package/dist/esm/bn-template-engine.js +1 -1
  227. package/dist/esm/bn-template.entry.js +2 -2
  228. package/dist/esm/bn-text.entry.js +111 -39
  229. package/dist/esm/{context-protocol-D_ysqCp8.js → context-protocol-CdTp19uA.js} +96 -12
  230. package/dist/esm/{diagnostics-BjZRZraG.js → diagnostics-vw6TKMiT.js} +1 -1
  231. package/dist/esm/editor-companion.entry.js +2 -2
  232. package/dist/esm/loader.js +1 -1
  233. package/dist/esm/queryError-ClruFZD_.js +13 -0
  234. package/dist/esm/{scaling-YbP727FC.js → sanitizeHtml-C5bFtARM.js} +464 -287
  235. package/dist/esm/{withBodyObserver-Cb9ZC5_J.js → withBodyObserver-DD_-r04o.js} +1 -1
  236. package/dist/esm/withHasError-73WV2SP5.js +422 -0
  237. package/dist/esm/{withStyled-3yRswBcf.js → withStyled-BDEyKd_H.js} +513 -27
  238. package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +8 -4
  239. package/dist/types/components/bn-chart-bubble/ibcs-chart-bubble.d.ts +2 -1
  240. package/dist/types/components/bn-chart-bubble/utils/BubbleChart.d.ts +14 -2
  241. package/dist/types/components/bn-chart-bullet/bn-chart-bullet.d.ts +12 -11
  242. package/dist/types/components/bn-chart-bullet/ibcs-chart-bullet.d.ts +2 -1
  243. package/dist/types/components/bn-chart-bullet/utils/BulletChart.d.ts +8 -5
  244. package/dist/types/components/bn-chart-bullet/utils/model/BulletChartStyle.d.ts +2 -0
  245. package/dist/types/components/bn-chart-bullet/utils/model/BulletConfig.d.ts +1 -1
  246. package/dist/types/components/bn-chart-scatter/bn-chart-scatter.d.ts +8 -4
  247. package/dist/types/components/bn-chart-scatter/ibcs-chart-scatter.d.ts +2 -1
  248. package/dist/types/components/bn-chart-scatter/utils/ScatterChart.d.ts +11 -1
  249. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +13 -12
  250. package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +8 -1
  251. package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +29 -6
  252. package/dist/types/components/bn-chart-structure/utils/elements/StackedBar.d.ts +4 -3
  253. package/dist/types/components/bn-chart-structure/utils/model/DataPoint.d.ts +3 -2
  254. package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts +2 -1
  255. package/dist/types/components/bn-chart-structure/utils/model/styles/StructureChartStyle.d.ts +2 -0
  256. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +19 -15
  257. package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +8 -1
  258. package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +63 -5
  259. package/dist/types/components/bn-chart-time/utils/elements/AreaFill.d.ts +1 -1
  260. package/dist/types/components/bn-chart-time/utils/elements/StackedColumn.d.ts +9 -8
  261. package/dist/types/components/bn-chart-time/utils/model/DataPoint.d.ts +3 -2
  262. package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +3 -2
  263. package/dist/types/components/bn-chart-time/utils/model/styles/TimeChartStyle.d.ts +2 -0
  264. package/dist/types/components/bn-context/bn-context.d.ts +15 -3
  265. package/dist/types/components/bn-dataset/bn-dataset.d.ts +41 -20
  266. package/dist/types/components/bn-datasource/bn-datasource.d.ts +34 -18
  267. package/dist/types/components/bn-footer/bn-footer.d.ts +2 -2
  268. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +3 -10
  269. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +13 -6
  270. package/dist/types/components/bn-message/bn-message.d.ts +2 -1
  271. package/dist/types/components/bn-page/bn-page.d.ts +2 -1
  272. package/dist/types/components/bn-page/pageFormats.d.ts +40 -0
  273. package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +2 -2
  274. package/dist/types/components/bn-table/bn-table.d.ts +11 -10
  275. package/dist/types/components/bn-table/ibcs-table.d.ts +8 -5
  276. package/dist/types/components/bn-table/utils/Table.d.ts +3 -1
  277. package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -2
  278. package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +6 -4
  279. package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +1 -1
  280. package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +2 -0
  281. package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +14 -5
  282. package/dist/types/components/bn-table/utils/helper/IntervalColumns.d.ts +2 -2
  283. package/dist/types/components/bn-table/utils/helper/QueryGroup.d.ts +6 -1
  284. package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +2 -2
  285. package/dist/types/components/bn-table/utils/model/TableAttribute.d.ts +2 -0
  286. package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +2 -1
  287. package/dist/types/components/bn-text/bn-text.d.ts +20 -13
  288. package/dist/types/components/bn-text/utils/template.d.ts +10 -0
  289. package/dist/types/components/bn-title/ibcs-title/ibcs-title.d.ts +1 -0
  290. package/dist/types/components/bn-tree/bn-tree.d.ts +8 -1
  291. package/dist/types/components/bn-tree/utils/EdgeRenderer.d.ts +18 -5
  292. package/dist/types/components/bn-tree/utils/TreeLayout.d.ts +5 -0
  293. package/dist/types/components.d.ts +226 -184
  294. package/dist/types/context/scopedDb.d.ts +20 -0
  295. package/dist/types/stores/componentStyles.d.ts +6 -0
  296. package/dist/types/utils/DateStringFactory.d.ts +3 -2
  297. package/dist/types/utils/autoFit.d.ts +2 -2
  298. package/dist/types/utils/componentRegister.d.ts +21 -5
  299. package/dist/types/utils/constants.d.ts +2 -2
  300. package/dist/types/utils/dataAnalyzer.d.ts +1 -1
  301. package/dist/types/utils/formatter.d.ts +7 -9
  302. package/dist/types/utils/layoutState/generic.d.ts +1 -1
  303. package/dist/types/utils/layoutState/svgChartElements.d.ts +2 -2
  304. package/dist/types/utils/layoutTemplate.d.ts +16 -0
  305. package/dist/types/utils/model/ChartStyles.d.ts +1 -1
  306. package/dist/types/utils/model/DataQueryResultRow.d.ts +2 -2
  307. package/dist/types/utils/model/Order.d.ts +1 -1
  308. package/dist/types/utils/model/styles/SVGStyle.d.ts +5 -1
  309. package/dist/types/utils/parentDimensions.d.ts +9 -0
  310. package/dist/types/utils/queryError.d.ts +5 -0
  311. package/dist/types/utils/relativeVariance.d.ts +9 -0
  312. package/dist/types/utils/sanitizeHtml.d.ts +2 -2
  313. package/dist/types/utils/scaling.d.ts +1 -1
  314. package/dist/types/utils/stackColors.d.ts +3 -2
  315. package/dist/types/utils/stackLayout.d.ts +49 -0
  316. package/dist/types/utils/testing/fakeGroup.d.ts +8 -0
  317. package/dist/types/utils/testing/mutationObserver.d.ts +5 -0
  318. package/dist/types/utils/testing/structureChart.d.ts +5 -0
  319. package/dist/types/utils/testing/timeChart.d.ts +5 -0
  320. package/dist/types/utils/validate.d.ts +1 -1
  321. package/dist/types/utils/withComponentStatus.d.ts +11 -3
  322. package/dist/types/utils/withInheritedProps.d.ts +42 -15
  323. package/dist/types/utils/withRuleSet.d.ts +2 -1
  324. package/dist/types/utils/withTranslation.d.ts +2 -2
  325. package/dist/types/utils/xy/FacetGrid.d.ts +1 -1
  326. package/dist/types/utils/xy/IsoCurves.d.ts +1 -1
  327. package/dist/types/utils/xy/NumericScale.d.ts +9 -4
  328. package/dist/types/utils/xy/PointLabeler.d.ts +2 -2
  329. package/dist/types/utils/xy/RadiusScale.d.ts +2 -2
  330. package/dist/types/utils/xy/SeriesPalette.d.ts +3 -3
  331. package/dist/types/utils/xy/VarianceMeasure.d.ts +10 -2
  332. package/dist/types/utils/xy/XYFrame.d.ts +4 -1
  333. package/dist/types/utils/xy/XYLegend.d.ts +3 -1
  334. package/dist/types/utils/xy/checkXYOverflow.d.ts +8 -0
  335. package/dist/types/utils/xy/formatXYValue.d.ts +7 -0
  336. package/dist/types/utils/xy/model/AxisConfig.d.ts +1 -1
  337. package/dist/types/utils/xy/model/XYChartStyle.d.ts +2 -0
  338. package/package.json +3 -1
  339. package/readme.md +11 -11
  340. package/dist/bn-template-engine/p-0a19e8af.entry.js +0 -1
  341. package/dist/bn-template-engine/p-0f6ece5a.entry.js +0 -1
  342. package/dist/bn-template-engine/p-13db2986.entry.js +0 -1
  343. package/dist/bn-template-engine/p-1b35c4ac.entry.js +0 -1
  344. package/dist/bn-template-engine/p-4602d613.entry.js +0 -1
  345. package/dist/bn-template-engine/p-489438ed.entry.js +0 -1
  346. package/dist/bn-template-engine/p-686d8e44.entry.js +0 -1
  347. package/dist/bn-template-engine/p-6f86159c.entry.js +0 -1
  348. package/dist/bn-template-engine/p-7401e3f3.entry.js +0 -1
  349. package/dist/bn-template-engine/p-83d50a14.entry.js +0 -1
  350. package/dist/bn-template-engine/p-BA48JiHe.js +0 -1
  351. package/dist/bn-template-engine/p-BCr2-Ka-.js +0 -1
  352. package/dist/bn-template-engine/p-BEkgk7Ij.js +0 -1
  353. package/dist/bn-template-engine/p-BVYKc5cH.js +0 -1
  354. package/dist/bn-template-engine/p-BeLWoM0Q.js +0 -1
  355. package/dist/bn-template-engine/p-CHZZqoB7.js +0 -1
  356. package/dist/bn-template-engine/p-CURM2Nrr.js +0 -1
  357. package/dist/bn-template-engine/p-Ckhir6Ux.js +0 -1
  358. package/dist/bn-template-engine/p-Ct0wEGrw.js +0 -1
  359. package/dist/bn-template-engine/p-CtEA0ZQc.js +0 -1
  360. package/dist/bn-template-engine/p-DJ5KJ6GF.js +0 -1
  361. package/dist/bn-template-engine/p-DoIuKI09.js +0 -1
  362. package/dist/bn-template-engine/p-DsTzlzxQ.js +0 -1
  363. package/dist/bn-template-engine/p-DtLI_CzV.js +0 -1
  364. package/dist/bn-template-engine/p-DwGg2_vO.js +0 -1
  365. package/dist/bn-template-engine/p-Z-mcXias.js +0 -1
  366. package/dist/bn-template-engine/p-aeba74a4.entry.js +0 -1
  367. package/dist/bn-template-engine/p-b4dabaf9.entry.js +0 -1
  368. package/dist/bn-template-engine/p-d083f0e6.entry.js +0 -1
  369. package/dist/bn-template-engine/p-ee09f216.entry.js +0 -1
  370. package/dist/bn-template-engine/p-f00b189f.entry.js +0 -1
  371. package/dist/cjs/AxisConfig-CbNnsmGC.js +0 -233
  372. package/dist/cjs/LabelCollisionManager-tOT40-pH.js +0 -415
  373. package/dist/cjs/NumericScale-BAyYXpKL.js +0 -107
  374. package/dist/cjs/Order-C5XgrPzr.js +0 -87
  375. package/dist/cjs/SVGStyle-C1LhLgbT.js +0 -6513
  376. package/dist/cjs/SVGVariancesStyleGroup-C2Ys_Iz6.js +0 -50
  377. package/dist/cjs/VarianceMeasure-uph4FBRa.js +0 -372
  378. package/dist/cjs/XYChartDataRow-BNqTnXnX.js +0 -829
  379. package/dist/cjs/bn-chart-bubble.cjs.entry.js +0 -793
  380. package/dist/cjs/bn-chart-bullet.cjs.entry.js +0 -806
  381. package/dist/cjs/bn-chart-scatter.cjs.entry.js +0 -679
  382. package/dist/cjs/bn-tree.cjs.entry.js +0 -1042
  383. package/dist/cjs/emptyState-B3kPjSFO.js +0 -423
  384. package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +0 -625
  385. package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +0 -674
  386. package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +0 -668
  387. package/dist/cjs/sanitizeHtml-LuZr1IMd.js +0 -85
  388. package/dist/cjs/withHasError-BdDmiOXM.js +0 -258
  389. package/dist/cjs/withScalingGroup-DrFV_zsQ.js +0 -73
  390. package/dist/components/autoFit.js +0 -1
  391. package/dist/components/utils.js +0 -1
  392. package/dist/esm/AxisConfig-CEFoGHUN.js +0 -224
  393. package/dist/esm/LabelCollisionManager-Dou5LvUs.js +0 -407
  394. package/dist/esm/NumericScale-DsTzlzxQ.js +0 -105
  395. package/dist/esm/Order-Tn0j255j.js +0 -83
  396. package/dist/esm/SVGStyle-BSuFK9YW.js +0 -6503
  397. package/dist/esm/SVGVariancesStyleGroup-D52LMGw8.js +0 -48
  398. package/dist/esm/VarianceMeasure-BXWH7oAW.js +0 -364
  399. package/dist/esm/XYChartDataRow-D272UFel.js +0 -820
  400. package/dist/esm/bn-chart-bubble.entry.js +0 -791
  401. package/dist/esm/bn-chart-bullet.entry.js +0 -804
  402. package/dist/esm/bn-chart-scatter.entry.js +0 -677
  403. package/dist/esm/bn-tree.entry.js +0 -1040
  404. package/dist/esm/emptyState-DqkM4Yc5.js +0 -417
  405. package/dist/esm/ibcs-chart-bubble.entry.js +0 -623
  406. package/dist/esm/ibcs-chart-bullet.entry.js +0 -672
  407. package/dist/esm/ibcs-chart-scatter.entry.js +0 -666
  408. package/dist/esm/sanitizeHtml-BA48JiHe.js +0 -83
  409. package/dist/esm/withHasError-Bh1Viz52.js +0 -254
  410. package/dist/esm/withScalingGroup-Byn-W6z8.js +0 -71
@@ -1 +1 @@
1
- import{h as t,proxyCustomElement as e,HTMLElement as o,Host as n,transformTag as i}from"@stencil/core/internal/client";import{m as s}from"./geometry.js";import{F as r,Q as a,V as l,I as c}from"./formatter.js";import{S as h,I as u,D as d,C as f,d as p,M as m}from"./CompareUtil.js";import{D as $}from"./luxon.js";import{a as v,b as g}from"./DateStringFactory.js";import{e as b,g as w}from"./context-protocol.js";import{D as y,a as R,b as S}from"./DataFormatDigits.js";import{A as E,c as O}from"./Order.js";import{S as M}from"./StringAdapter.js";import{S as U}from"./SiPrefix.js";import{w as T}from"./withComponentStyle.js";var G,_,N,L,C;!function(t){t[t.ALL=-1]="ALL"}(G||(G={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(_||(_={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(N||(N={})),function(t){t.ASC="asc",t.DESC="desc"}(L||(L={})),function(t){t.HEADER="HEADER",t.GROUPHEAD="GROUPHEAD",t.SEPERATORLINE="SEPERATORLINE",t.SUM="SUM",t.GROUPSUM="GROUP_SUM",t.DRILLELEMENT="DRILLELEMENT",t.STANDARD="STANDARD",t.PARTELEMENT="PARTELEMENT",t.ENTRY="ENTRY"}(C||(C={}));const x="none",P="setname";function k(t){return t===P?"COALESCE([setname],[setName])":`normalizeDate([date], '${t}')`}function A(t){if(null==t)return"";if("string"==typeof t)return t.trim();const e=D(t);return e?e.toISO():String(t)}function D(t){if(null!=t){if("string"==typeof t){const e=$.fromISO(t);return e.isValid?e:void 0}if("number"==typeof t){const e=$.fromMillis(t);return e.isValid?e:void 0}if("boolean"==typeof t.isValid)return t.isValid?t:void 0}}class W{constructor(t,e,o,n,i,s,r,a,l){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=e,this.value=o,this.prefix=s||"",this.cssStyle=n||"",this.prefixStyle=r||"prefix",this.type=i,this.mark=void 0,this.colSpan=a||1,this.measureScale=l||1}getAsHeaderList(){if(null==this.value)return[""];const t=[];for(const e of this.value.toString().split("<br/>"))t.push(e);return t}draw(t){let e=this.value;if("undefined"===e||void 0===e||null==e)return"";if(Number.isNaN(Number(e)))return e;if(""===this.type||void 0===this.type||null==this.type)return e;let o=t.percent,n=t.percent;return"decimal"===this.type&&(e=+e/this.measureScale,o=t.decimal,n=t.decimal),r.number(Number(e),this.type,o,n)}drawPrefix(){return null==this.prefix?"":this.prefix}}class B{constructor(t,e,o){this.index=t,this.groupindex=e,this.type=o,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case C.HEADER:return"groupheader";case C.SEPERATORLINE:return"";case C.DRILLELEMENT:return"ofit";case C.PARTELEMENT:return"partof";case C.STANDARD:return"";case C.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,e,o,n,i,s,r,a,l,c=!1,h,u=1,d){let f=s;"category"===e&&null!=a&&(f=`category-${a.toString()}`),this.type===C.HEADER?f="headerlabel":this.type===C.SEPERATORLINE&&(f=e),this.type===C.PARTELEMENT&&("percent"===n&&(t="-"),"category"!==e&&"operation"!==e&&(n="percent",f="")),"-"===t&&(f="");let p="prefix-first";r&&(p="prefix-second"),o&&(f=`${f} ${o}`);const m=new W(e,this.elements.length,t,f,n,i,p,u,l);m.isBarChart=c,m.columnStats=h,m.waterfall=d,this.elements.push(m)}}const F=.85;function Y(t,e){return Math.max(0,(t-.5)*e)}function H(t,e){return Math.max(1,(t?1:0)+(e?1:0))}function I(t,e,o,n){const i=Y(t,e),s=H(o,n),r=Math.min(2.85*e,i/(2*s)),a=(i-r*s)/s,l=Math.min(.3*e,.2*a),c=.15*a;return{totalWidth:i,labelAreaWidth:r,maxBarWidth:a,axisX:o?r+a:0,breakGap:l,overdriveZoneWidth:c,cutWidth:Math.max(0,a-l-c),labelGap:.3*e}}function z(t,e,o,n){const i=Y(t,e),s=H(o,n),r=Math.min(3.375*e,i/2),a=i-r,l=a/s,c=Math.min(.375*e,.2*l);return{totalWidth:i,labelAreaWidth:r,maxPinLength:Math.max(0,l-c),pinPadding:c,axisX:o?l:0,labelX:a+.3*e}}const j={positive:{stroke:"#008f96",fill:"#008f96",fillpattern:"solid"},negative:{stroke:"#ff0000",fill:"#ff0000",fillpattern:"solid"},neutral:{stroke:"#808080",fill:"#808080",fillpattern:"outlined"},scenarios:{ac:{stroke:"#404040",fill:"#404040",fillpattern:"solid"},pp:{stroke:"#A6A6A6",fill:"#A6A6A6",fillpattern:"solid"},fc:{stroke:"#404040",fill:"#ffffff",fillpattern:"hatched"},pl:{stroke:"#404040",fill:"#ffffff",fillpattern:"outlined"}},fontColor:"#000000",fontSize:11.333305,emPx:13.3333,fontFamily:"'Noto Sans', sans-serif",unitScaling:.01,percentageScaling:.5,scaleFactor:1},Q="#666666";function V(t,e){return`pattern-${t}-${e.replace("#","")}`}const X=({styles:e})=>{const o=e.scaleFactor,n=6*o,i=[{id:V("pos",e.positive.stroke),stroke:e.positive.stroke,fill:e.positive.fill},{id:V("neg",e.negative.stroke),stroke:e.negative.stroke,fill:e.negative.fill},{id:V("neu",e.neutral.stroke),stroke:e.neutral.stroke,fill:e.neutral.fill},...["ac","pp","fc","pl"].map((t=>({id:V(t,e.scenarios[t].stroke),stroke:e.scenarios[t].stroke,fill:e.scenarios[t].fill})))];return t("defs",null,i.map((e=>t("pattern",{id:e.id,patternUnits:"userSpaceOnUse",width:n,height:n},t("rect",{width:n,height:n,fill:"#ffffff"}),t("line",{x1:"0",y1:n,x2:n,y2:"0",stroke:e.stroke,"stroke-width":1.5*o})))))};function q(t,e,o=1){let n,i;const s=t>=0?"+":"";if(e)return n=100*t,s+Math.round(n).toString()+"%";{let e;return n=t/o,i=Math.abs(n),e=i>=1e9?(n/1e9).toFixed(i>=1e10?0:1)+"B":i>=1e6?(n/1e6).toFixed(i>=1e7?0:1)+"M":i>=1e3?(n/1e3).toFixed(i>=1e4?0:1)+"K":n.toFixed(i>=10?0:1),e=e.replace(/\.0([KMB]?)$/,"$1"),s+e}}function K(t){const e=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(e)}function Z(t){const e=t.slice(0,2).toLowerCase();return"pp"===e?"pp":"fc"===e?"fc":"pl"===e?"pl":"ac"}function J(t,e,o,n){return K(t)?function(t,e){const o=Z(t);return e.scenarios[o]}(t,n):function(t,e,o){const n=t>=0;return e?n?o.positive:o.negative:n?o.negative:o.positive}(e,o,n)}function tt(t,e){const o=t.fillpattern;return"hatched"===o?`url(#${V(e,t.stroke)})`:"outlined"===o?"transparent":t.fill}function et(t){return"outlined"===t.fillpattern?{stroke:t.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0}}const ot=e=>{const{value:o,scenario:n,columnStats:i,height:s,isPositiveGood:r,formattedValue:a,measureScale:l,columnWidthEm:c=10,styles:h=j}=e,u=h.scaleFactor,d=h.fontSize,f=i.min<0,p=i.max>0,{totalWidth:m,axisX:$,breakGap:v,overdriveZoneWidth:g,cutWidth:b,labelGap:w}=I(c,h.emPx,f,p),y=Math.abs(o)*h.unitScaling*d,R=y>b,S=Math.max(0,i.absMax*h.unitScaling*d-b),E=Math.max(0,y-b),O=S>0?E/S*g:0,M=2*u,U=s-2*M,T=M,G=o>=0,_=J(n,o,r,h),N=tt(_,K(n)?Z(n):r?G?"pos":"neg":G?"neg":"pos"),{stroke:L,strokeWidth:C}=et(_),x=a||q(o,!1,l),P=R?b:y,k=R?b+v+O:y,A=G?$+k+w:$-k-w,D=G?"start":"end";return t("svg",{width:m,height:s,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},t(X,{styles:h}),t("line",{x1:$,y1:0,x2:$,y2:s,stroke:Q,"stroke-width":1*u}),P>0&&t("rect",{x:G?$:$-P,y:T,width:P,height:U,fill:N,stroke:L,"stroke-width":C*u}),R&&O>0&&t("rect",{x:G?$+b+v:$-b-v-O,y:T,width:O,height:U,fill:N,stroke:L,"stroke-width":C*u}),R&&function(e,o,n,i,s){const r=e+o/2,a=.35*o,l=i/3,c=.3*o;let h=`M ${r-a} ${n}`;for(let t=0;t<3;t++)h+=` L ${r-a-c} ${n+l*(t+.5)} L ${r-a} ${n+l*(t+1)}`;let u=`M ${r+a} ${n}`;for(let t=0;t<3;t++)u+=` L ${r+a+c} ${n+l*(t+.5)} L ${r+a} ${n+l*(t+1)}`;return[t("rect",{x:e,y:n-1,width:o,height:i+2,fill:"#ffffff"}),t("path",{d:h,fill:"none",stroke:"#000000","stroke-width":1*s}),t("path",{d:u,fill:"none",stroke:"#000000","stroke-width":1*s})]}(G?$+b:$-b-v,v,T,U,u),t("text",{x:A,y:s/2,dy:"0.35em","text-anchor":D,fill:h.fontColor,"font-size":d,"font-family":h.fontFamily},x))},nt=e=>{const{value:o,scenario:n,columnStats:i,height:s,isPositiveGood:r,formattedValue:a,measureScale:l,columnWidthEm:c=10,styles:h=j}=e,u=h.scaleFactor,d=h.fontSize,f=i.min<0,p=i.max>0,{totalWidth:m,maxPinLength:$,axisX:v,labelX:g}=z(c,h.emPx,f,p),b=s/2,w=100*Math.abs(o)*h.percentageScaling*d,y=w>$,R=Math.min(w,$),S=o>=0,E=S?v+R:v-R,O=J(n,o,r,h),M=3*u,U=a||q(o,!0,l);return t("svg",{width:m,height:s,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},t("line",{x1:v,y1:0,x2:v,y2:s,stroke:Q,"stroke-width":1*u}),!y&&t("circle",{cx:E,cy:b,r:M,fill:h.fontColor}),t("line",{x1:v,y1:b,x2:E,y2:b,stroke:O.fill,"stroke-width":2*u}),y&&S&&t("polygon",{points:`${v+$},${b} ${v+$-6*u},${b-3*u} ${v+$-6*u},${b+3*u}`,fill:O.fill}),y&&!S&&t("polygon",{points:`${v-$},${b} ${v-$+6*u},${b-3*u} ${v-$+6*u},${b+3*u}`,fill:O.fill}),t("text",{x:g,y:s/2,dy:"0.35em","text-anchor":"start",fill:h.fontColor,"font-size":d,"font-style":"italic","font-family":h.fontFamily},U))},it=e=>{const{value:o,columnStats:n,isRelative:i,styles:s=j}=e;return null==o||isNaN(o)||!n||0===n.absMax?t("span",{class:"bar-chart-empty",style:{color:s.fontColor,fontStyle:"italic"}},"-"):t(i?nt:ot,Object.assign({},e))},st=e=>{const{value:o,scenario:n,height:i,measureScale:s,columnWidthEm:r=10,styles:a=j,waterfall:l}=e,c=a.scaleFactor,h=a.fontSize,u=l.max-l.min;if(null==o||isNaN(o)||u<=0)return t("span",{class:"bar-chart-empty",style:{color:a.fontColor,fontStyle:"italic"}},"-");const{totalWidth:d,labelAreaWidth:f,barAreaWidth:p,labelGap:m}=function(t,e){const o=Y(t,e),n=Math.min(2.85*e,o/4);return{totalWidth:o,labelAreaWidth:n,barAreaWidth:o-2*n,labelGap:.3*e}}(r,a.emPx),$=p/u,v=t=>f+(t-l.min)*$,g=2*c,b=i-2*g,w=g,y=v(0),R=v(l.start),S=v(l.end),E=Math.min(R,S),O=Math.abs(S-R),M=J(n,o,!1,a),U=tt(M,Z(n)),{stroke:T,strokeWidth:G}=et(M),_=q(o,"partof"===l.kind,s).replace(/^\+/,""),N=S<R,L=N?E-m:E+O+m,C=N?"end":"start";return t("svg",{width:d,height:i,class:"cell-bar-chart waterfall-bar",style:{overflow:"visible"}},t(X,{styles:a}),t("line",{x1:y,y1:0,x2:y,y2:i,stroke:Q,"stroke-width":1*c}),void 0!==l.parentStart&&void 0!==l.parentEnd&&t("line",{x1:v(l.parentStart),y1:0,x2:v(l.parentStart),y2:i,stroke:Q,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),void 0!==l.parentStart&&void 0!==l.parentEnd&&t("line",{x1:v(l.parentEnd),y1:0,x2:v(l.parentEnd),y2:i,stroke:Q,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),O>0&&t("rect",{x:E,y:w,width:O,height:b,fill:U,stroke:T,"stroke-width":G*c}),t("text",{x:L,y:i/2,dy:"0.35em","text-anchor":C,fill:a.fontColor,"font-size":h,"font-family":a.fontFamily},_))};class rt{constructor(t){this.groups=[a.CATEGORY,a.CATEGORYINDEX],N.OPT!==t.type&&N.OPTNOTOTAL!==t.type||this.groups.unshift(a.OPERATION),t.grouped&&(this.groups.push(a.ROWGROUP),this.groups.push(a.ROWGROUPINDEX))}toString(){return this.groups.map((t=>`${t}`)).toString()}noCategory(){return this.groups.filter((t=>t!==a.CATEGORY))}toArray(){return this.groups}}class at{constructor(t,e){this.hasPartOf=!1,this.config=t,this.i18n=e}execute(t,e){var o;this.db=t,this.fromExpr=e;const n=[],i=[],s=[],r=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),l=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),c=this.getRelativeScenarios(),h=this.config.attributes.map((t=>this.translateAttributeSQL(t))).toString(),u=new rt(this.config),d=this.config.grouped?[a.ROWGROUP,a.ROWGROUPINDEX]:[];let f,p=["",""];this.config.sortOrder.hierarchy.length>0&&(p=this.createOrderString(this.config.sortOrder)),this.hasPartOf=this.checkConfigForPartOf();try{f=t.exec(`SELECT COUNT(DISTINCT ${a.CATEGORY}) as ${a.TOTALROWCOUNT} ${d.length>0?","+d:""}\n FROM ${e} ${d.length>0?"GROUP BY "+d:""}\n ORDER BY ${p[0]}`)}catch(t){return console.error("DataQuery: meta query failed",t),[]}return 0===f.length||1===f.length&&0===(null!==(o=f[0][a.TOTALROWCOUNT])&&void 0!==o?o:0)&&0===d.length?[]:(f.forEach((t=>{const e=t.rowGroup&&t.rowGroup.length>0?`WHERE ${a.ROWGROUP} = '${t.rowGroup}'`:"";let o="";this.config.limit&&(o=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,n),this.createDataRow(n,t,u,r,h,e,p,o),this.createRestRow(t,n,u,r,e,p),this.createGroupSumRow(n,i,t,l,p)})),this.createTotalSumRow(n,i,l),n.forEach((e=>{try{s.push(t.exec(e))}catch(t){console.error("DataQuery: SQL query execution failed",e,t)}})),this.detectNaNCells(this.config.scenarios,s),this.createThereOfDrillRows(r,h,p,s),this.createPartOfDrillRows(r,p,i,s),this.createIntervalColumns(s),this.createThereOfDrillColumns(this.config.categoryThereOf,s),this.calculateColumnGroupRest(s,this.config.categoryThereOf),this.calculateRelativeVariances(s,c),s)}detectNaNCells(t,e){e.forEach((e=>{e.map((e=>(t.forEach((t=>{const o=new l(t);!0===o.isValid?0!==e[o.base+"_cnt"]&&0!==e[o.delta+"_cnt"]||(e[t]=Number.NaN):0===e[t+"_cnt"]&&(e[t]=Number.NaN)})),e)))}))}createPartOfDrillRows(t,e,o,n){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===N.LIST)return;const i=this.createPartOfQuery(t,e);let s=[];const r=this.db;i.forEach((function(t){s.push(...r.exec(t))}));const l=this.exctractScenarioNames(t),c=[];o.forEach((function(t){c.push(...r.exec(t))}));const h=new Map;c.forEach((t=>h.set(t[a.ROWGROUP],t))),s=this.reduceResDrillByCategoryGroups(s,l),s.forEach((function(t){l.forEach((e=>{try{t[e]=t[e]/h.get(t[a.ROWGROUP])[e]}catch(o){console.error("DataQuery: partOf drill row calculation failed",e,o),t[e]=Number.NaN}}))})),this.injectDrillRowsToResultRows(s,n)}createRestRow(t,e,o,n,i,s){if(t.totalRowCnt-this.config.limit>0&&0!==this.config.limit){const r=this.exctractScenarioNames(n).map((t=>`SUM(${t}) as ${t}`)).join(", ");e.push(`SELECT ${a.ROWNR}, 1 as ${a.ROWGROUPINDEX} , 'ENTRY' as ${a.TYPE}, 'NO_GROUP' as ${a.ROWGROUP}, 'REST' as ${a.CATEGORY} ${r.length>0?", "+r:""} FROM (SELECT ROWNUM() AS ${a.ROWNR}, ${e.length} as ${a.ROWGROUPINDEX} , 'ENTRY' as ${a.TYPE}, '${t.rowGroup||"NO_GROUP"}' as ${a.ROWGROUP}, ${o} ${n.length>0?",".concat(n):""} FROM ${this.fromExpr} ${i} GROUP BY ${o} ORDER BY ${s[0]}) t WHERE t.rowNr > ${this.config.limit}`)}}createDataRow(t,e,o,n,i,s,r,l){t.push(`SELECT ROWNUM() AS ${a.ROWNR},\n ${t.length} as ${a.ROWGROUPINDEX},\n 'ENTRY' as ${a.TYPE},\n '${e.rowGroup||"NO_GROUP"}' as ${a.ROWGROUP},\n '${a.CATEGORYINDEX}',\n ${o} ${n.length>0?",".concat(n):""} ${i.length>0?",".concat(i):""}\n FROM ${this.fromExpr} ${s}\n GROUP BY ${o}\n ORDER BY ${r[0]} ${l}`)}createGroupHeaderRow(t,e){!0===this.config.grouped&&e.push(`SELECT ROWNUM() AS ${a.ROWNR},\n ${e.length} as ${a.ROWGROUPINDEX},\n 'GROUPHEAD' as ${a.TYPE},\n '${t.rowGroup}' as ${a.ROWGROUP} ${this.config.showGroupTitle?`,'${t.rowGroup}' as ${a.CATEGORY}`:""}\n FROM ${this.fromExpr}\n GROUP BY '1'`)}createGroupSumRow(t,e,o,n,i){!0!==this.config.grouped||N.SUM!==this.config.type&&N.SUMNOTOTAL!==this.config.type&&N.OPT!==this.config.type&&N.OPTNOTOTAL!==this.config.type||(t.push(`SELECT ${t.length} as ${a.ROWGROUPINDEX},\n '=' as ${a.OPERATION},\n '${o.rowGroup}' as ${a.ROWGROUP},\n ROWNUM() AS ${a.ROWNR},\n 'GROUP_SUM' as ${a.TYPE} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr}\n WHERE ${a.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${i[0]} `),e.push(`SELECT ${t.length} as ${a.ROWGROUPINDEX},\n '=' as ${a.OPERATION},\n '${o.rowGroup}' as ${a.ROWGROUP},\n ROWNUM() AS ${a.ROWNR},\n 'GROUP_SUM' as ${a.TYPE} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr}\n WHERE ${a.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${i[0]} `))}createTotalSumRow(t,e,o){var n;if(N.SUM===this.config.type||N.OPT===this.config.type){const e=(null===(n=this.config.title)||void 0===n?void 0:n.trim())||"SUM_TOTAL",i=this.hasPartOf&&!1===this.config.grouped&&"SUM_TOTAL"!==e?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} ${e}`:e;t.push(`SELECT ${t.length} as ${a.ROWGROUPINDEX},\n '${i}' as ${a.ROWGROUP},\n '=' as ${a.OPERATION},\n 'SUM' as ${a.TYPE} ${o.length>0?",".concat(o):""}\n FROM ${this.fromExpr} `)}e.push(`SELECT ${t.length} as ${a.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${a.ROWGROUP},\n '=' as ${a.OPERATION},\n 'SUM' as ${a.TYPE} ${o.length>0?",".concat(o):""}\n FROM ${this.fromExpr} `)}reduceResDrillByCategoryGroups(t,e){const o=new Map;return t.forEach((function(t){const n=t.rowNr+t.rowGroup+t.type+t.category;if(o.has(n)){const i=o.get(n);e.forEach((e=>{try{i[e]+=t[e]}catch(t){console.error("DataQuery: drill row aggregation failed",e,t)}}))}else o.set(n,t)})),[...o.values()]}injectDrillRowsToResultRows(t,e){const o=new Map;if(!0===this.config.grouped)t.forEach((function(t){e.forEach((function(e){const n=e.findIndex((e=>e.category===t.category&&e.rowGroup===t.rowGroup));if(n>=0){if(o.has(`${t.category}_${t.rowGroup}`)){const e=o.get(`${t.category}_${t.rowGroup}`)||0;o.set(`${t.category}_${t.rowGroup}`,e+1)}else o.set(`${t.category}_${t.rowGroup}`,1);t[a.ROWNR]=o.get(`${t.category}_${t.rowGroup}`),e.splice(n+t[a.ROWNR],0,t)}}))}));else{const n=this.findDuplicateSubCategories(t);t.forEach((function(t){e.forEach((function(e){const i=e.findIndex((e=>null!=e.category&&e.category===t.category));if(i>=0){if(o.has(`${t.category}`)){const e=o.get(`${t.category}`)||0;o.set(`${t.category}`,e+1)}else o.set(`${t.category}`,1);(1===t[a.ROWNR]||n.includes(t.subCategory))&&(t.subCategory=`${t.subCategory} (${t.rowGroup})`),e.splice(i+t[a.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,e,o,n){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const i=[],s=[];this.config.thereOf.forEach((n=>{let s=!0,r="1 <> 1 OR ( ";null!=n.category&&0!==n.category.length&&n.category.trim()&&(r+=` ${a.CATEGORY} = '${n.category}'`,s=!1),null!=n.rowGroup&&0!==n.rowGroup.length&&n.rowGroup.trim()&&(r+=` ${s?"":"AND"} ${a.ROWGROUP} = '${n.rowGroup}'`,s=!1),null!=n.subCategory&&0!==n.subCategory.length&&n.subCategory.trim()&&(r+=` ${s?"":"AND"} ${a.SUBCATEGORY} = '${n.subCategory}'`),r+=")",i.push(`SELECT ROWNUM() AS ${a.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${a.TYPE},\n ${a.CATEGORY},\n ${a.SUBCATEGORY},\n ${a.ROWGROUP} as ${a.ROWGROUP},\n ${t} ${e.length>0?",".concat(e):""}\n FROM ${this.fromExpr}\n WHERE ${r}\n GROUP BY ${a.ROWGROUP}, ${a.CATEGORY}, ${a.SUBCATEGORY}\n ORDER BY ${o[1]}`)}));const r=this.db;i.forEach((function(t){s.push(...r.exec(t))})),this.injectDrillRowsToResultRows(s,n)}calculateRelativeVariances(t,e){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[a.TYPE]&&e.forEach(((e,o)=>{t[o]=t[o]/t[e]}))}))}))}calculateColumnGroupRest(t,e){if(null==e||0===e.size)return;const o=new Map,n=new Map;e.forEach(((t,e)=>{const i=t,s=[];for(const t of i)s.push(`${e}##${t.name}`);o.set(e,s),n.set(`${e}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[a.TYPE]&&o.forEach(((e,o)=>{let i=0;e.forEach((e=>{void 0!==t[e]&&(i+=t[e])})),t[`${o}##REST`]=t[o]-i,0!==t[`${o}##REST`]&&n.set(`${o}##REST`,!0)}))}))}));const i=Array.from(n.entries()).filter((([t,e])=>!e)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const e of i)delete t[e]}))}))}createIntervalColumns(t){var e,o,n,i,s;if(this.config.interval===x||this.config.categoryThereOf.size>0||0===this.config.scenarios.length)return;const r="##",c=`(SELECT *, ${k(this.config.interval)} as __interval FROM ${this.fromExpr}) as p`,h=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),u=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),d=this.exctractScenarioNames(h),f=this.getRelativeScenarios(),p=new rt(this.config),m=N.OPT===this.config.type||N.OPTNOTOTAL===this.config.type,$=this.config.grouped&&(N.SUM===this.config.type||N.SUMNOTOTAL===this.config.type||N.OPT===this.config.type||N.OPTNOTOTAL===this.config.type),v=this.checkConfigForPartOf()&&this.config.type!==N.LIST,g=t=>{try{return this.db.exec(t)}catch(e){return console.error("DataQuery: interval query failed",t,e),[]}},b=t=>(this.config.scenarios.forEach((e=>{const o=new l(e);!0===o.isValid?0!==t[o.base+"_cnt"]&&0!==t[o.delta+"_cnt"]||(t[e]=Number.NaN):0===t[e+"_cnt"]&&(t[e]=Number.NaN)})),f.forEach(((e,o)=>{t[o]=t[o]/t[e]})),t),w=(t,e,o)=>{for(const n of this.config.scenarios)t[n+r+o]=e[n]},y=g(`SELECT ${p}, __interval ${h.length>0?",".concat(h):""}\n FROM ${c}\n GROUP BY ${p}, __interval`);if(this.config.limit>0)for(let n=0;n<t.length;n++){const i=t[n].find((t=>"ENTRY"===t.type&&"REST"===t.category));if(!i)continue;let s;for(let e=n-1;e>=0&&!s;e--){const o=t[e].filter((t=>"ENTRY"===t.type&&"REST"!==t.category));o.length>0&&(s=o)}if(!s)continue;const r=new Set(s.map((t=>t.category))),a=s[0].rowGroup,l=new Map;for(const t of y){if(this.config.grouped&&t.rowGroup!==a)continue;if(r.has(t.category))continue;const n=A(t.__interval);let i=l.get(n);i||(i={},l.set(n,i));for(const n of d)i[n]=(null!==(e=i[n])&&void 0!==e?e:0)+(null!==(o=t[n])&&void 0!==o?o:0)}l.forEach(((t,e)=>{w(i,b(t),e)}))}for(const e of y){const o=A(e.__interval);b(e);for(const n of t)for(const t of n)"ENTRY"===t.type&&"REST"!==t.category&&t.category===e.category&&(this.config.grouped&&t.rowGroup!==e.rowGroup||m&&t.operation!==e.operation||w(t,e,o))}const R=$||v&&this.config.grouped?g(`SELECT ${a.ROWGROUP}, __interval ${u.length>0?",".concat(u):""}\n FROM ${c}\n GROUP BY ${a.ROWGROUP}, __interval`):[],S=new Map;if(R.forEach((t=>S.set(`${t.rowGroup}${r}${A(t.__interval)}`,t))),$)for(const e of R){const o=A(e.__interval),n=b(Object.assign({},e));for(const i of t)for(const t of i)"GROUP_SUM"===t.type&&t.rowGroup===e.rowGroup&&w(t,n,o)}const E=N.SUM===this.config.type||N.OPT===this.config.type,O=E||v&&!this.config.grouped?g(`SELECT __interval ${u.length>0?",".concat(u):""}\n FROM ${c}\n GROUP BY __interval`):[],M=new Map;if(O.forEach((t=>M.set(A(t.__interval),t))),E)for(const e of O){const o=A(e.__interval),n=b(Object.assign({},e));for(const e of t)for(const t of e)"SUM"===t.type&&w(t,n,o)}if(null!=this.config.thereOf&&this.config.thereOf.length>0){const e=[];this.config.thereOf.forEach((t=>{e.push(...g(`SELECT ${a.ROWGROUP}, ${a.CATEGORY}, ${a.SUBCATEGORY}, __interval ${h.length>0?",".concat(h):""}\n FROM ${c}\n WHERE ${this.createThereOfWhereClause(t)}\n GROUP BY ${a.ROWGROUP}, ${a.CATEGORY}, ${a.SUBCATEGORY}, __interval`))}));for(const o of e){const e=A(o.__interval);b(o);for(const n of t)for(const t of n)"DRILLELEMENT"===t.type&&t.category===o.category&&(t.subCategory!==o.subCategory&&t.subCategory!==`${o.subCategory} (${o.rowGroup})`||w(t,o,e))}}if(v){let e="1 <> 1 ";null===(n=this.config.partOf)||void 0===n||n.forEach((t=>{e+=`OR (${a.CATEGORY} = '${t.category}'`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(e+=`and ${a.ROWGROUP} = '${t.rowGroup}'`),e+=")"}));const o=g(`SELECT ${a.CATEGORY}, ${this.config.grouped?`${a.ROWGROUP}`:`'SUM_TOTAL' as ${a.ROWGROUP}`}, __interval ${h.length>0?",".concat(h):""}\n FROM ${c}\n WHERE ${e}\n GROUP BY ${a.ROWGROUP}, ${a.CATEGORY}, __interval`),l=new Map;for(const t of o){const e=`${t.rowGroup}${r}${t.category}${r}${A(t.__interval)}`,o=l.get(e);if(o)for(const e of d)o[e]=(null!==(i=o[e])&&void 0!==i?i:0)+(null!==(s=t[e])&&void 0!==s?s:0);else l.set(e,t)}l.forEach((e=>{const o=A(e.__interval),n=this.config.grouped?S.get(`${e.rowGroup}${r}${o}`):M.get(o);for(const t of d)e[t]=e[t]/(n?n[t]:Number.NaN);b(e);for(const n of t)for(const t of n)"PARTELEMENT"===t.type&&t.category===e.category&&t.rowGroup===e.rowGroup&&w(t,e,o)}))}}createThereOfWhereClause(t){let e=!0,o="1 <> 1 OR ( ";return null!=t.category&&0!==t.category.length&&t.category.trim()&&(o+=` ${a.CATEGORY} = '${t.category}'`,e=!1),null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(o+=` ${e?"":"AND"} ${a.ROWGROUP} = '${t.rowGroup}'`,e=!1),null!=t.subCategory&&0!==t.subCategory.length&&t.subCategory.trim()&&(o+=` ${e?"":"AND"} ${a.SUBCATEGORY} = '${t.subCategory}'`),o+")"}getRelativeScenarios(){const t=new Map;return this.config.scenarios.forEach((e=>{const o=this.createRelativeScenario(e);null!=o&&t.set(o.key,o.value)})),t}translateScenarioSQL(t,e,o){const n=new l(t);return N.OPT===o||N.OPTNOTOTAL===o?n.isValid?"dr"===n.type?`SUM(${n.base} - ${n.delta}) as ${t}, SUM(${n.delta}) as dr_${n.delta}`:`SUM(${n.base} - ${n.delta}) as ${t}`:e?`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:`SUM(${t}) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:n.isValid?"dr"===n.type?`SUM((${n.base} * transformOperator(operation)) - (${n.delta} * transformOperator(operation))) as ${t}, SUM(${n.delta} * transformOperator(operation)) as dr_${n.delta}`:`SUM((${n.base} * transformOperator(operation))- (${n.delta} * transformOperator(operation))) as ${t}`:`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}translateAttributeSQL(t){const e=`[${t.arg}]`,o=/^(ac|pp|fc|pl)[1-4]$/.test(t.arg)&&this.config.type!==N.OPT&&this.config.type!==N.OPTNOTOTAL;switch(t.fn){case"set":return`SETAGG(${e}) as ${t.alias}`;case"first":return`FIRST(${e}) as ${t.alias}`;case"last":return`LAST(${e}) as ${t.alias}`;case"min":return`MIN(${e}) as ${t.alias}`;case"max":return`MAX(${e}) as ${t.alias}`;case"avg":return o?`AVG(${e} * transformOperator(operation)) as ${t.alias}`:`AVG(${e}) as ${t.alias}`;case"sum":return o?`SUM(${e} * transformOperator(operation)) as ${t.alias}`:`SUM(${e}) as ${t.alias}`;case"lit":return`${this.sqlLiteral(t.arg)} as ${t.alias}`}}sqlLiteral(t){return""===t||Number.isNaN(Number(t))?`'${t.replace(/'/g,"''")}'`:t}createOrderString(t){return[`${t.hierarchy.toString()} ${t.direction}`,`${t.hierarchy.toString()} ${L.ASC===t.direction?L.DESC:L.ASC}`]}createRelativeScenario(t){const e=new l(t);return e.isValid&&"dr"===e.type?{key:`${t}`,value:`dr_${e.delta}`}:null}exctractScenarioNames(t){const e=[];return t.split(",").forEach((t=>t.length>=2?e.push(t.split("as")[1].trim()):null)),e}findDuplicateSubCategories(t){const e=t.map((t=>({count:1,subCategory:t.subCategory}))).reduce(((t,e)=>(t[e.subCategory]=(t[e.subCategory]||0)+e.count,t)),{});return Object.keys(e).filter((t=>e[t]>1))}createPartOfQuery(t,e){var o;const n=[];let i="1 <> 1 ",s=` ${a.ROWGROUP}`,r="ROWNUM()";return null===(o=this.config.partOf)||void 0===o||o.forEach((t=>{i+=`OR (${a.CATEGORY} = '${t.category}'`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(i+=`and ${a.ROWGROUP} = '${t.rowGroup}'`),!1===this.config.grouped&&(s=` 'SUM_TOTAL' as ${a.ROWGROUP} `,r="1"),i+=")"})),n.push(`SELECT ${r} AS ${a.ROWNR},\n 'PARTELEMENT' as ${a.TYPE},\n ${a.CATEGORY},\n ${s},\n ${t}\n FROM ${this.fromExpr}\n WHERE ${i}\n GROUP BY ${a.ROWGROUP}, ${a.CATEGORY}, ${a.TYPE}\n ORDER BY ${e[1]}`),n}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,e){if(null==t||0===t.size)return;const o=[],n=[],i=this.fromExpr;t.forEach(((t,e)=>{let n="1 <> 1 ";t.forEach((t=>{n+=` or columnGroup = '${t.name}' `})),o.push(`SELECT 'ENTRY' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${i}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),o.push(`SELECT 'ENTRY' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${i}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),o.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${i}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),o.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${i}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),o.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${i}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),o.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${i}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),o.push(`SELECT 'SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${i}\n WHERE ${n}\n GROUP BY rowlevel, columnGroup, scenario`),o.push(`SELECT 'SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${i}\n WHERE ${n}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of o)n.push(...this.db.exec(t));this.injectDrillColumnsToResultRows(n,e)}injectDrillColumnsToResultRows(t,e){const o="##";for(const n of t)for(const t of e)for(const e of t)e.type===n.rowlevel&&("ENTRY"===n.rowlevel?"COLUMNGROUP"===n.columnlevel&&e.category===n.category?e[n.scenario+o+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&(e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val):"DRILLELEMENT"===n.rowlevel?"COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory?e[n.scenario+o+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory?e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val:"COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===`${n.subCategory} (${n.rowGroup})`?e[n.scenario+o+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===`${n.subCategory} (${n.rowGroup})`&&(e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val):("SUM"===n.rowlevel||"GROUP_SUM"===n.rowlevel)&&("COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory&&(e[n.scenario+o+n.columnGroup]=n.val),"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory&&(e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val)))}}class lt{constructor(){this.geometry=new Map}set(t,e,o){let n=this.geometry.get(t);n||(n=new Map,this.geometry.set(t,n)),n.set(e,o)}get(t,e){var o;return null===(o=this.geometry.get(t))||void 0===o?void 0:o.get(e)}}function ct(t,e,o){const n=t[e];if(null==n)return null;const i=Number(n);return isNaN(i)?null:o!==N.OPT&&o!==N.OPTNOTOTAL||t[a.TYPE]!==C.ENTRY||"-"!==t[a.OPERATION]?i:-i}class ht{constructor(){this.normalizedHeader=[],this.attributesByAlias=new Map}getNormalizedHeader(){return this.normalizedHeader}createHeader(t,e,o,n,i,s,a=[]){const l=[];this.attributesByAlias=new Map(a.map((t=>[t.alias,t]))),this.normalizedHeader=this.normalizeHeader(t,e,a);const c=this.normalizedHeader.some((t=>void 0!==t.bucket));c&&l.push(this.createIntervalBandRow());const h=new B(c?1:0,0,C.HEADER),u=new B(c?2:1,0,C.SEPERATORLINE);for(const t of this.normalizedHeader){const e=this.attributesByAlias.get(t.name);h.createElement(e?o.get(e.label)||e.label:r.translateScenarioLabel(t.name,o),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,o,n,i,s),null,null,null,null),u.createElement(null,t.type,this.createColumnType(t),null,null,null,null,null,null)}return l.push(h),l.push(u),l}createIntervalBandRow(){const t=new B(0,0,C.HEADER);let e=0;for(;e<this.normalizedHeader.length;){const o=this.normalizedHeader[e];if(void 0===o.bucket){t.createElement(null,o.type,"filler",null,null,null,null,null,null),e+=1;continue}let n=1;for(;e+n<this.normalizedHeader.length&&this.normalizedHeader[e+n].bucket===o.bucket;)n+=1;t.createElement(o.bucketLabel,o.type,"intervalGroup",null,null,null,null,null,null,!1,void 0,n),e+=n}return t}setHeaderPrefix(t,e,o,n,i){let s="";return"category"===t.name&&i&&(0===o.prefix.length&&0===n.length||(s=r.translateScenarioLabel("in",e)+" "+o.prefix+n)),t.order&&(s+=r.translateScenarioLabel("ORDER_"+t.order,e)),s}normalizeHeader(t,e,o){let n=[{name:a.CATEGORY,group:a.CATEGORY,type:a.CATEGORY,order:void 0}];N.OPT!==t&&N.OPTNOTOTAL!==t||(n=[{name:a.OPERATION,group:a.OPERATION,type:a.OPERATION,order:void 0},{name:a.CATEGORY,group:a.CATEGORY,type:a.CATEGORY,order:void 0}]);const i=o.map((t=>({name:t.alias,group:t.alias,type:t.alias,order:void 0})));return[...n,...i,...e]}createBodyRows(t,e,o,n){var i;const s=[];let r=-1;const l=new at(t,e).execute(o,n),c=this.calculateColumnStatistics(l,t.barColumns,t.interval!==x),u=(null!==(i=t.barColumns)&&void 0!==i?i:[]).filter((t=>t.toUpperCase().trim()in h)),d=u.length>0&&t.interval===x&&0===t.categoryThereOf.size&&function(t){for(const e of t)for(const t of e){const e=t[a.TYPE];if(e===C.SUM||e===C.GROUPSUM||e===C.DRILLELEMENT||e===C.PARTELEMENT)return!0}return!1}(l)?function(t,e,o){const n=new lt;for(const i of e){let e,s=0,r=0;const l=[],c=(t,e)=>{l.push(e),n.set(t,i,e)};for(const n of t)for(const t of n){const n=t[a.TYPE];if(n===C.GROUPHEAD){e=void 0;continue}const l=ct(t,i,o);if(n===C.ENTRY){if(null===l){e=void 0;continue}c(t,{start:s,end:s+l,min:0,max:0,kind:"cascade"}),e={start:s,end:s+l},r=e.start,s+=l}else if(n===C.SUM||n===C.GROUPSUM){if(null===l){e=void 0;continue}c(t,{start:0,end:l,min:0,max:0,kind:"anchor"}),e={start:0,end:l},r=0,s=l}else if(n===C.DRILLELEMENT){if(null===l||void 0===e)continue;const o=r+(Math.sign(e.end-e.start)||1)*Math.abs(l);c(t,{start:r,end:o,min:0,max:0,kind:"thereof",parentStart:e.start,parentEnd:e.end}),r=o}else if(n===C.PARTELEMENT){if(null===l||void 0===e)continue;const o=r+l*(e.end-e.start);c(t,{start:r,end:o,min:0,max:0,kind:"partof",parentStart:e.start,parentEnd:e.end}),r=o}}let h=0,u=0;for(const t of l)h=Math.min(h,t.start,t.end),u=Math.max(u,t.start,t.end);for(const t of l)t.min=h,t.max=u}return n}(l,u,t.type):void 0;for(const o of l)r+=1,s.push(...this.createRow(t.i18n,e,t.scenariosUnitType,o,r,-1,t.categoryWidth,t.measureScale,t.barColumns,c,d));return s}calculateColumnStatistics(t,e,o=!1){const n=new Map;if(!e||0===e.length)return n;const i=new Map;for(const t of e)n.set(t,{min:1/0,max:-1/0,absMax:0,median:0}),i.set(t,[]);for(const s of t)for(const t of s)for(const s of e){const e=o?this.extractIntervalColumnValues(t,s):[this.extractColumnValue(t,s)];for(const t of e)if(null!==t&&!isNaN(t)){const e=n.get(s);e.min=Math.min(e.min,t),e.max=Math.max(e.max,t),i.get(s).push(Math.abs(t))}}for(const[t,e]of n){e.min!==1/0&&e.max!==-1/0||(e.min=0,e.max=0),e.absMax=Math.max(Math.abs(e.min),Math.abs(e.max));const o=i.get(t);if(o.length>0){o.sort(((t,e)=>t-e));const t=Math.floor(o.length/2);e.median=o.length%2==0?(o[t-1]+o[t])/2:o[t]}n.set(t,e)}return n}extractIntervalColumnValues(t,e){const o=e+"##",n=[];for(const e of Object.keys(t))if(e.startsWith(o)){const o=Number(t[e]);n.push(isNaN(o)?null:o)}return n}extractColumnValue(t,e){if(void 0!==t[e]){const o=Number(t[e]);return isNaN(o)?null:o}for(const o of Object.keys(t))if(o===e||o.endsWith("##"+e)||o===e+"##"+e){const e=Number(t[o]);if(!isNaN(e))return e}return null}createRow(t,e,o,n,i,s,r,l,c,h,u){var d;const f=[];for(const p of n){const m=p[a.ROWGROUP],$=p[a.SUBCATEGORY],v=p[a.TYPE],g=p[a.ROWNR]>=2,b=this.createDetailRow(v,s+=1,i,n.length);for(const n of this.normalizedHeader){const i=this.getRawDataRowElement(p,n),s=null!==(d=null==c?void 0:c.includes(n.type))&&void 0!==d&&d,a=s?null==h?void 0:h.get(n.type):void 0,f=s&&void 0===n.bucket&&n.name===n.group&&n.name===n.type?null==u?void 0:u.get(p,n.type):void 0;b.createElement(this.translateSumCellLabel(t,e,i,m,$,v,n.type),n.type,this.createColumnType(n),this.setCellType(n.type,o),this.translateCellPrefix(e,v,n.type),this.translateScenarioCSS(n.type,i),g,r,null==l?void 0:l.value,s,a,1,f)}f.push(b)}return f}getRawDataRowElement(t,e){return void 0!==e.bucket?t[e.type+"##"+e.bucket]:e.name===e.group&&e.name===e.type?t[e.name]:e.name===e.group&&e.name!==e.type?t[e.type+"##"+e.name]:t[e.type+"##"+e.group+"##"+e.name]}createDetailRow(t,e,o,n){switch(t){case C.GROUPHEAD:return new B(e,o,C.HEADER);case C.SUM:case C.GROUPSUM:return new B(n+2,o,C.SUM);case C.DRILLELEMENT:return new B(n+2,o,C.DRILLELEMENT);case C.PARTELEMENT:return new B(n+2,o,C.PARTELEMENT);default:return new B(e,o,C.STANDARD)}}translateSumCellLabel(t,e,o,n,i,s,r){return this.attributesByAlias.has(r)||!1===Number.isNaN(Number(o))||this.isOperationColumn(r)?o:this.isGroupHeadCategory(s,r)?t===u.ALL?`${e.get(o)||o}`:o:this.isEntryCategory(s,r)?t===u.ALL||"REST"===o?`${e.get(o)||o}`:o:this.isDrillElementCategory(s,r)?t===u.ALL?`${e.get(i)||i}`:`${i}`:this.isPartElementCategory(s,r)?t===u.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:`${n}`:this.isSumElementCategory(s,r)?t===u.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:n:"GROUPHEAD"===s&&null==o?o:Number.isNaN(Number(o))?"-":Number(o)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,e){if(this.attributesByAlias.has(t))return"attribute";const o=new l(t);let n="pos";return e<0&&(n="neg"),o.isValid?n+"_"+o.direction+("dr"===o.type?" relative_variance":""):t}setCellType(t,e){if("category"===t)return"";const o=this.attributesByAlias.get(t);if(o)return o.isNumeric?"decimal":"";let n;const i=new l(t);return e===d.PERCENT?(n="percent",i.isValid&&"d"===i.type&&(n="decimal")):(n="decimal",i.isValid&&"dr"===i.type&&(n="percent")),n}isDrillElementCategory(t,e){return"DRILLELEMENT"===t&&"category"===e}isPartElementCategory(t,e){return"PARTELEMENT"===t&&"category"===e}isSumElementCategory(t,e){return("GROUP_SUM"===t||"SUM"===t)&&"category"===e}isEntryCategory(t,e){return"ENTRY"===t&&"category"===e}isGroupHeadCategory(t,e){return"GROUPHEAD"===t&&"category"===e}translateCellPrefix(t,e,o){return this.isOperationColumn(o)||this.isGroupHeadCategory(e,o)||this.isEntryCategory(e,o)?null:this.isDrillElementCategory(e,o)?`${t.get("there_of")} `:this.isPartElementCategory(e,o)?`${t.get("part_of")} `:null}createColumnType(t){return t.name===t.group&&t.name===t.type?"base":t.name===t.group?"columnGroup":"columnSubGroup"}}class ut{constructor(t,e,o,n){this.fromExpr="",this.rowCount=0,this.headerRows=[],this.bodyRows=[],this.intervalBuckets=[],this.ruleSet=t||new c,this.db=e,this.dataSetFactory=new ht,this.config=this.initConfig(n),this.i18n=this.initI18n(new Map),this.setSource(o,n.filter)}setI18n(t){this.i18n=this.initI18n(t)}initI18n(t){const e=new Map([["",""],["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"]]);return this.state=_.DIRTY,new Map([...e,...t||new Map])}initConfig(t){this.state=_.DIRTY;const e=t,o=this;return t.scenarios.sort(((t,e)=>o.ruleSet.getScenarioSorIndex(t)-o.ruleSet.getScenarioSorIndex(e))),e}setConfig(t){this.config=this.initConfig(t)}setSource(t,e){var o,n;if(this.state=_.DIRTY,!t)return this.fromExpr="",void(this.rowCount=0);this.fromExpr=b(t,e);try{const t=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(n=null===(o=t[0])||void 0===o?void 0:o.cnt)&&void 0!==n?n:0}catch(t){this.rowCount=0}}update(){this.prepareIntervalBuckets();const t=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder,this.intervalBuckets);this.headerRows=this.dataSetFactory.createHeader(this.config.type,t,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale,this.config.attributes),this.bodyRows=0!==this.rowCount&&this.fromExpr?this.dataSetFactory.createBodyRows(this.config,this.i18n,this.db,this.fromExpr):[],this.state=_.UP_TO_DATE}getHeader(){return this.state===_.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===_.DIRTY&&this.update(),this.bodyRows}getColumns(){return this.state===_.DIRTY&&this.update(),this.dataSetFactory.getNormalizedHeader()}prepareIntervalBuckets(){this.intervalBuckets=[],this.config.interval===x||!this.fromExpr||this.config.categoryThereOf.size>0?this.config.interval=x:(this.config.interval=function(t,e,o){var n;if(o!==v.AUTO)return o;let i,s,r;try{i=t.exec(`SELECT [date] as d FROM ${e}`)}catch(t){return console.error("IntervalColumns: date query failed",t),v.DAY}for(const t of i){const e=null===(n=D(t.d))||void 0===n?void 0:n.toMillis();void 0!==e&&(s=void 0===s?e:Math.min(s,e),r=void 0===r?e:Math.max(r,e))}return void 0===s||void 0===r?v.DAY:(new g).calculateDistanceType($.fromMillis(s),$.fromMillis(r))}(this.db,this.fromExpr,this.config.interval),this.intervalBuckets=function(t,e,o,n){let i;try{i=t.exec(`SELECT ${k(o)} as __interval FROM ${e}`)}catch(t){return console.error("IntervalColumns: bucket query failed",t),[]}if(o===P){const t=new Set,e=[];for(const o of i){const n=A(o.__interval);t.has(n)||(t.add(n),e.push({key:n,label:0===n.length?"—":n}))}return e}const s=new Set,r=[];for(const t of i){const e=D(t.__interval);if(!e)continue;const o=e.toISO();s.has(o)||(s.add(o),r.push(e))}r.sort(((t,e)=>t.toMillis()-e.toMillis()));const a=new g;return a.setLocale(n),r.map((t=>({key:t.toISO(),label:a.getDateString(t,o)})))}(this.db,this.fromExpr,this.config.interval,this.config.locale),0===this.intervalBuckets.length&&(this.config.interval=x))}normalizeScenarios(t,e,o,n=[]){var i,s;const r=[];if(n.length>0){for(const e of n)for(const n of t)r.push({name:n,group:n,type:n,order:(null===(i=null==o?void 0:o.hierarchy)||void 0===i?void 0:i.at(0))===n?o.direction:void 0,bucket:e.key,bucketLabel:e.label});return r}for(const n of t){if(null==e?void 0:e.has(n)){const t=e.get(n);for(const e of t){r.push({name:e.name,group:e.name,type:n,order:void 0});for(const t of e.subGroups)r.push({name:t,group:e.name,type:n,order:void 0})}r.push({name:"REST",group:"REST",type:n,order:void 0})}let t;(null===(s=null==o?void 0:o.hierarchy)||void 0===s?void 0:s.at(0))===n&&(t=o.direction),r.push({name:n,group:n,type:n,order:t})}return r}hasNoData(){return 0===this.rowCount}}class dt{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=d.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.attributes=[],this.sortOrder=new O(new M).default(),this.type=N.LIST,this.limit=0,this.i18n=u.ALL,this.categoryWidth=p.W25,this.measureScale=new U,this.measureUnit="",this.measureType=m.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[],this.interval="none",this.locale="de"}}class ft{constructor(t,e,o,n,i){this.tableDrillGroupAdapter=t,this.stringAdapter=e,this.orderAdapter=o,this.db=n,this.fromExpr=i}adapt(t){const e=new dt;return f.isString(t.title)&&(e.title=t.title),f.isArray(t.scenarios)&&(e.scenarios=E.adaptArray(t.scenarios,this.stringAdapter)),f.isExisting(t.scenariosUnitType)&&(e.scenariosUnitType=t.scenariosUnitType),f.isBoolean(t.grouped)&&(e.grouped=t.grouped),f.isBoolean(t.showGroupTitle)&&(e.showGroupTitle=t.showGroupTitle),f.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),f.isArray(t.thereOf)&&(e.thereOf=E.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),f.isExisting(t.categoryThereOf)&&(e.categoryThereOf=t.categoryThereOf),f.isArray(t.partOf)&&(e.partOf=E.adaptArray(t.partOf,this.tableDrillGroupAdapter)),f.isArray(t.attributes)&&(e.attributes=t.attributes),f.isExisting(t.order)&&(e.sortOrder=this.orderAdapter.adapt(t.order)),f.isExisting(t.type)&&(e.type=t.type),f.isNumber(t.limit)&&(e.limit=t.limit),f.isExisting(t.i18n)&&(e.i18n=t.i18n),f.isExisting(t.categoryWidth)&&(e.categoryWidth=t.categoryWidth),f.isExisting(t.measureScale)&&(e.measureScale=y.calculateMeasureScale(this.db,this.fromExpr,e.scenarios,t.measureScale)),f.isExisting(t.measureType)&&(e.measureType=t.measureType),f.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),f.isString(t.filter)&&(e.filter=t.filter.trim()),f.isArray(t.barColumns)&&(e.barColumns=t.barColumns),f.isString(t.interval)&&(e.interval=t.interval),f.isString(t.locale)&&(e.locale=t.locale),e}default(){return new dt}}class pt{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class mt{constructor(){}adapt(t){const e=new pt;return f.isString(t.rowGroup)&&(e.rowGroup=t.rowGroup),f.isString(t.category)&&(e.category=t.category),f.isString(t.subCategory)&&(e.subCategory=t.subCategory),f.isString(t.partOf)&&(e.partOf=t.partOf),e}default(){return new pt}}const $t=e(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.sumTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=d.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.thereof=[],this.partof=[],this.order={hierarchy:[],direction:L.ASC},this.categorythereof=new Map,this.attributeColumns=[],this.type=N.LIST,this.categoryWidth=p.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=u.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=m.VOLUME,this.filter="",this.barColumns=[],this.interval="none",this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new R,this.componentStyle=T(this)}async getLayoutDetail(t,e){var o,n,i;const r={regions:[],metadata:{},diagnostics:[]},a=null===(o=this.element.shadowRoot)||void 0===o?void 0:o.querySelector("table");if(r.metadata.hasNoData=null===(i=null===(n=this.table)||void 0===n?void 0:n.hasNoData())||void 0===i||i,!this.table||!a)return r;const l=a.querySelector("thead"),c=a.querySelector("tbody");l&&r.regions.push({id:"header",rect:s(l,t)}),c&&r.regions.push({id:"body",rect:s(c,t)});const h=this.table.getHeader(),u=this.table.getBody(),d=this.table.getColumns();if(r.metadata.headerRowCount=h.length,r.metadata.rowCount=u.length,r.metadata.columnCount=d.length,r.metadata.cellCount=u.reduce(((t,e)=>t+e.getCells().length),0),"full"!==e)return r;const f=[],p=[],m=(e,o,n)=>{const i=n?Array.from(n.children).filter((t=>"tr"===t.localName)):[];o.forEach(((o,n)=>{const a=i[n];if(!a)return;f.push({section:e,index:n,type:o.type,rect:s(a,t)});const l=o.getCells(),c=Array.from(a.children);l.length===c.length?l.forEach(((o,i)=>{var r,a;const l=c[i],h={kind:"header"===e?"headerCell":"cell",row:n,column:o.index,key:o.key||void 0,colSpan:o.colSpan,value:null!==(r=o.value)&&void 0!==r?r:void 0,text:(null===(a=l.textContent)||void 0===a?void 0:a.trim())||void 0,type:o.type||void 0,rect:s(l,t)},u=l.querySelector("svg.cell-bar-chart");u&&(h.bar={variant:u.classList.contains("waterfall-bar")?"waterfall":u.classList.contains("relative-variance")?"relative":"absolute",rect:s(u,t)}),p.push(h)})):r.diagnostics.push({id:`LAYOUT_cellPairing_${e}_${n}`,type:"warning",message:`layout-state: model/DOM cell count mismatch in ${e} row ${n} (${l.length} vs ${c.length}); cell details skipped for this row.`})}))};return m("header",h,l),m("body",u,c),r.elements=p,r.table={rows:f,columns:d.map(((t,e)=>({index:e,key:t.name,group:t.group,type:t.type,bucket:t.bucket})))},r}render(){var e;return t(n,{class:{"no-data":!0===(null===(e=this.table)||void 0===e?void 0:e.hasNoData())}},(()=>{var e;if(void 0!==this.table){if(this.table.hasNoData()){const o=null!==(e=this.i18n.get("no-data"))&&void 0!==e?e:"No Data";return t("div",{class:"empty-state"},o)}return t("table",null,t("thead",null,this.table.getHeader().map((e=>t("tr",{class:e.cssStyle},e.getCells().map((e=>t("th",{colSpan:e.colSpan,class:e.cssStyle},e.getAsHeaderList().map(((o,n,i)=>t("span",null,n===i.length-1?t("span",{class:" "===o?"table-footer":""},o,e.drawPrefix()," "):t("span",null,o,e.drawPrefix(),t("br",null)))))))))))),t("tbody",null,this.table.getBody().map((e=>t("tr",{class:e.cssStyle},null==e?void 0:e.getCells().map((o=>t("td",{colSpan:o.colSpan,class:o.type?`${o.cssStyle} ${o.type}`:o.cssStyle},null!=o.prefix?t("span",{class:o.cssStyle+" "+o.prefixStyle},o.drawPrefix()):"",o.isBarChart&&o.columnStats&&(void 0!==o.waterfall||e.type!==C.SUM)?void 0!==o.waterfall?t(st,{value:o.value,scenario:o.key,columnStats:o.columnStats,height:18*this.scaleFactor,isRelative:!1,isPositiveGood:o.key.endsWith("_pos"),measureScale:o.measureScale,columnWidthEm:this.barColumnMaxWidth,styles:this.barChartStyles,waterfall:o.waterfall}):t(it,{value:o.value,scenario:o.key,columnStats:o.columnStats,height:18*this.scaleFactor,isRelative:o.key.startsWith("dr"),isPositiveGood:o.key.endsWith("_pos"),measureScale:o.measureScale,columnWidthEm:this.barColumnMaxWidth,styles:this.barChartStyles}):o.draw(this.componentDataFormatDigits)))))))))}})())}componentWillRender(){this.stores||(this.stores=w(this.element));const t=this.stores.db.db,e=this.prepareConfig(t);this.componentDataFormatDigits=(new S).adapt(this.dataFormatDigits),this.table=new ut(new c(this.ruleSetConfig),t,this.tableName,e),this.table.setI18n(this.i18n),this.barChartStyles=this.prepareBarChartStyles()}prepareConfig(t){var e,o,n;const i=this.tableName?this.filter&&this.filter.length>0?`(SELECT * FROM \`${this.tableName}\` WHERE ${this.filter}) AS __src`:`\`${this.tableName}\``:"";return new ft(new mt,new M,new O(new M),t,i).adapt({title:this.sumTitle,scenarios:this.scenarios,scenariosUnitType:this.scenariosDataFormat,grouped:this.grouped,showGroupTitle:this.showGroupTitle,thereOf:this.thereof,partOf:this.partof,categoryThereOf:this.categorythereof,attributes:this.attributeColumns,order:this.order,type:this.type,limit:this.limit,i18n:this.i18nMode,categoryWidth:this.categoryWidth,measureScale:this.measureScale,measureUnit:this.measureUnit,measureType:this.measureType,showMeasureScale:this.showMeasureScale,filter:this.filter,barColumns:this.barColumns,interval:this.interval,locale:(null===(n=null===(o=null===(e=this.stores)||void 0===e?void 0:e.context)||void 0===o?void 0:o.state)||void 0===n?void 0:n.locale)||"de"})}prepareBarChartStyles(){var t;const e=!(this.unitScaling>0),o=!(this.percentageScaling>0),n=e?this.autoUnitScaling():this.unitScaling,i=o?this.autoPercentageScaling():this.percentageScaling;return(e||o)&&(null===(t=this.reportAutoScaling)||void 0===t||t.call(this,{unit:e?n:void 0,percentage:o?i:void 0})),this.componentStyle((t=>{var e,o,s,r,a,l,c,h,u,d,f,p,m,$,v,g,b,w,y,R,S,E,O,M,U,T,G;const _=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.varianceStyles,N=null===(o=t["bn-chart-time"])||void 0===o?void 0:o.barStyles;return{positive:{stroke:(null===(s=null==_?void 0:_.pos)||void 0===s?void 0:s.stroke)||"#008f96",fill:(null===(r=null==_?void 0:_.pos)||void 0===r?void 0:r.fill)||"#008f96",fillpattern:(null===(a=null==_?void 0:_.pos)||void 0===a?void 0:a.fillpattern)||"solid"},negative:{stroke:(null===(l=null==_?void 0:_.neg)||void 0===l?void 0:l.stroke)||"#ff0000",fill:(null===(c=null==_?void 0:_.neg)||void 0===c?void 0:c.fill)||"#ff0000",fillpattern:(null===(h=null==_?void 0:_.neg)||void 0===h?void 0:h.fillpattern)||"solid"},neutral:{stroke:(null===(u=null==_?void 0:_.neu)||void 0===u?void 0:u.stroke)||"#808080",fill:(null===(d=null==_?void 0:_.neu)||void 0===d?void 0:d.fill)||"#808080",fillpattern:(null===(f=null==_?void 0:_.neu)||void 0===f?void 0:f.fillpattern)||"outlined"},scenarios:{ac:{stroke:(null===(p=null==N?void 0:N.ac)||void 0===p?void 0:p.stroke)||"#404040",fill:(null===(m=null==N?void 0:N.ac)||void 0===m?void 0:m.fill)||"#404040",fillpattern:(null===($=null==N?void 0:N.ac)||void 0===$?void 0:$.fillpattern)||"solid"},pp:{stroke:(null===(v=null==N?void 0:N.pp)||void 0===v?void 0:v.stroke)||"#A6A6A6",fill:(null===(g=null==N?void 0:N.pp)||void 0===g?void 0:g.fill)||"#A6A6A6",fillpattern:(null===(b=null==N?void 0:N.pp)||void 0===b?void 0:b.fillpattern)||"solid"},fc:{stroke:(null===(w=null==N?void 0:N.fc)||void 0===w?void 0:w.stroke)||"#404040",fill:(null===(y=null==N?void 0:N.fc)||void 0===y?void 0:y.fill)||"#ffffff",fillpattern:(null===(R=null==N?void 0:N.fc)||void 0===R?void 0:R.fillpattern)||"hatched"},pl:{stroke:(null===(S=null==N?void 0:N.pl)||void 0===S?void 0:S.stroke)||"#404040",fill:(null===(E=null==N?void 0:N.pl)||void 0===E?void 0:E.fill)||"#ffffff",fillpattern:(null===(O=null==N?void 0:N.pl)||void 0===O?void 0:O.fillpattern)||"outlined"}},fontColor:(null===(M=t.global)||void 0===M?void 0:M.fontColor)||"#000000",fontSize:((null===(U=t.global)||void 0===U?void 0:U.fontSizePx)||13.3333)*F*this.scaleFactor,emPx:((null===(T=t.global)||void 0===T?void 0:T.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:(null===(G=t.global)||void 0===G?void 0:G.fontFamily)||"'Noto Sans', sans-serif",unitScaling:n,percentageScaling:i,scaleFactor:this.scaleFactor}}))}emPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.scaleFactor}autoUnitScaling(){const t=this.emPx(),e=t*F,{absMax:o,hasNeg:n,hasPos:i}=this.getAbsBarColumnStats();if(o<=0||e<=0)return.01;const{maxBarWidth:s,cutWidth:r}=I(this.barColumnMaxWidth,t,n,i);return Math.min(.8*s,r)/(o*e)}autoPercentageScaling(){const t=this.emPx(),e=t*F,{absMax:o,hasNeg:n,hasPos:i}=this.getRelativeBarColumnStats();if(o<=0||e<=0)return.5;const{maxPinLength:s}=z(this.barColumnMaxWidth,t,n,i);return.8*s/(o*e)}getAbsBarColumnStats(){return this.collectBarColumnStats((t=>!t.key.startsWith("dr")&&!t.waterfall),1)}getRelativeBarColumnStats(){return this.collectBarColumnStats((t=>t.key.startsWith("dr")),100)}collectBarColumnStats(t,e){const o={absMax:0,hasNeg:!1,hasPos:!1};if(!this.table)return o;for(const n of this.table.getBody())if(n.type!==C.SUM)for(const i of n.getCells())i.isBarChart&&i.columnStats&&t(i)&&(o.absMax=Math.max(o.absMax,i.columnStats.absMax*e),o.hasNeg=o.hasNeg||i.columnStats.min<0,o.hasPos=o.hasPos||i.columnStats.max>0);return o}get element(){return this}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{position:relative;display:inline-block}table{background-color:var(--bn-font-background, white);font-size:var(--bn-font-size, 1em);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);border-spacing:0.3em 0}thead{border-style:none}tr:first-child td{border-top:none;padding-top:0.5em}td.ac1,td.ac2,td.ac3,td.ac4,td.pp1,td.pp2,td.pp3,td.pp4,td.pl1,td.pl2,td.pl3,td.pl4,td.fc1,td.fc2,td.fc3,td.fc4,td.share,td.variance,td.pos_pos,td.pos_neg,td.neg_pos,td.neg_neg,td.pos_neutral,td.neg_neutral{text-align:right}.category-w100{min-width:100em;max-width:100em}.category-w50{min-width:50em;max-width:50em}.category-w25{min-width:25em;max-width:25em}.category-w20{min-width:20em;max-width:20em}.category-w15{min-width:15em;max-width:15em}.category-w10{min-width:10em;max-width:10em}.category-w5{min-width:5em;max-width:5em}.prefix-second{color:transparent;font-style:normal}.prefix-first{font-style:normal}th{border-bottom:0.1em solid black;text-align:right;font-weight:normal;vertical-align:text-top}td.columnGroup,th.columnGroup{font-size:0.6em}td.columnSubGroup,th.columnSubGroup{font-size:0.6em;border-spacing:0em 0;font-style:italic}td.base,th.base{font-style:normal}th.ofit,td.ofit,tr.ofit,th.partof,td.partof,tr.partof{font-size:0.6em;font-style:italic}td.ofit,td.partof{font-size:0.6em;font-style:italic}th.ofit td,tr.ofit td,th.partof td,tr.partof td{border-top:0em solid black;padding-left:1em}th.ofit share,th.partof share,tr.share td{border-top:0em solid black}th.share,tr.share,td.share{font-size:0.6em;font-style:italic}th.filler{border-bottom:0em solid black;text-align:right}td.filler{border-top:0em none !important;border-bottom:0em none;text-align:right}th.group{text-align:center;border-spacing:1em 0}th.headerlabel{border-bottom:0em none black;padding-bottom:0em}th.intervalGroup{border-bottom:0.1em solid black;text-align:center;font-weight:bold}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em dashed #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}'}},[1,"ibcs-table",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],selectedStyle:[513,"selected-style"],sumTitle:[1,"sum-title"],scenarios:[16],scenariosDataFormat:[1,"scenarios-data-format"],grouped:[4],limit:[2],showGroupTitle:[4,"show-group-title"],thereof:[16],partof:[16],order:[16],categorythereof:[16],attributeColumns:[16],type:[1],categoryWidth:[1,"category-width"],dataFormatDigits:[16],ruleSetConfig:[16],i18n:[1040],i18nMode:[1,"i18n-mode"],measureScale:[1,"measure-scale"],measureUnit:[1,"measure-unit"],showMeasureScale:[4,"show-measure-scale"],measureType:[1,"measure-type"],filter:[1],barColumns:[16],interval:[1],barColumnMaxWidth:[2,"bar-column-max-width"],unitScaling:[2,"unit-scaling"],percentageScaling:[2,"percentage-scaling"],reportAutoScaling:[16],scaleFactor:[2,"scale-factor"],getLayoutDetail:[64]}]);function vt(){"undefined"!=typeof customElements&&["ibcs-table"].forEach((t=>{"ibcs-table"===t&&(customElements.get(i(t))||customElements.define(i(t),$t))}))}export{$t as I,N as T,x as a,P as b,vt as d}
1
+ import{h as t,proxyCustomElement as e,HTMLElement as i,Host as o,transformTag as n}from"@stencil/core/internal/client";import{m as s}from"./geometry.js";import{F as r,Q as a,V as l,I as h}from"./formatter.js";import{S as c,I as u,D as d,C as f,d as p,M as $}from"./CompareUtil.js";import{N as m,r as v}from"./relativeVariance.js";import{D as g}from"./luxon.js";import{D as b,b as w}from"./DateStringFactory.js";import{F as R}from"./TableAttribute.js";import{e as S,g as y}from"./context-protocol.js";import{D as E,a as O,b as M}from"./DataFormatDigits.js";import{A as U,c as G}from"./Order.js";import{S as T}from"./StringAdapter.js";import{S as N}from"./SiPrefix.js";import{w as _}from"./withComponentStatus.js";import{w as L}from"./withComponentStyle.js";import{n as C}from"./SVGStyle.js";var x,k,P,A,D;!function(t){t[t.ALL=-1]="ALL"}(x||(x={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(k||(k={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(P||(P={})),function(t){t.ASC="asc",t.DESC="desc"}(A||(A={})),function(t){t.HEADER="HEADER",t.GROUPHEAD="GROUPHEAD",t.SEPERATORLINE="SEPERATORLINE",t.SUM="SUM",t.GROUPSUM="GROUP_SUM",t.DRILLELEMENT="DRILLELEMENT",t.STANDARD="STANDARD",t.PARTELEMENT="PARTELEMENT",t.ENTRY="ENTRY"}(D||(D={}));const W="none",B="setname";function F(t){return t===B?"COALESCE([setname],[setName])":`normalizeDate([date], '${t}')`}function Y(t){if(null==t)return"";if("string"==typeof t)return t.trim();const e=H(t);return e?e.toISO():String(t)}function H(t){if(null!=t){if("string"==typeof t){const e=g.fromISO(t,{zone:"utc"});return e.isValid?e:void 0}if("number"==typeof t){const e=g.fromMillis(t,{zone:"utc"});return e.isValid?e:void 0}if("boolean"==typeof t.isValid)return t.isValid?t:void 0}}const I=/[\s\u200e\u200f\u061c]*[%\u066a][\s\u200e\u200f\u061c]*/;class z{constructor(t,e,i,o,n,s,r,a,l){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=e,this.value=i,this.prefix=s||"",this.cssStyle=o||"",this.prefixStyle=r||"prefix",this.type=n,this.mark=void 0,this.colSpan=a||1,this.measureScale=l||1}getAsHeaderList(){if(null==this.value)return[""];const t=[];for(const e of this.value.toString().split("<br/>"))t.push(e);return t}draw(t,e){let i=this.value;if("undefined"===i||void 0===i||null==i)return"";if(Number.isNaN(Number(i)))return i;if(""===this.type||void 0===this.type||null==this.type)return i;let o=t.percent,n=t.percent;return"percentpoint"===this.type?r.number(Number(i),"percent",o,n,1,e).replace(I,""):("decimal"===this.type&&(i=+i/this.measureScale,o=t.decimal,n=t.decimal),r.number(Number(i),this.type,o,n,1,e))}drawPrefix(){return null==this.prefix?"":this.prefix}}class j{constructor(t,e,i){this.index=t,this.groupindex=e,this.type=i,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case D.HEADER:return"groupheader";case D.SEPERATORLINE:return"";case D.DRILLELEMENT:return"ofit";case D.PARTELEMENT:return"partof";case D.STANDARD:return"";case D.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,e,i,o,n,s,r,a,l,h=!1,c,u=1,d){let f=s;"category"===e&&null!=a&&(f=`category-${a.toString()}`),this.type===D.HEADER?f="headerlabel":this.type===D.SEPERATORLINE&&(f=e),this.type===D.PARTELEMENT&&("percent"===o&&(t="-"),"category"!==e&&"operation"!==e&&(o="percent",f="")),("-"===t||t===m&&"percent"===o)&&(f="");let p="prefix-first";r&&(p="prefix-second"),i&&(f=`${f} ${i}`);const $=new z(e,this.elements.length,t,f,o,n,p,u,l);$.isBarChart=h,$.columnStats=c,$.waterfall=d,this.elements.push($)}}const V=.85;function Q(t,e){return Math.max(0,(t-.5)*e)}function X(t,e){return Math.max(1,(t?1:0)+(e?1:0))}function q(t,e,i,o){const n=Q(t,e),s=X(i,o),r=Math.min(2.85*e,n/(2*s)),a=(n-r*s)/s,l=Math.min(.3*e,.2*a),h=.15*a;return{totalWidth:n,labelAreaWidth:r,maxBarWidth:a,axisX:i?r+a:0,breakGap:l,overdriveZoneWidth:h,cutWidth:Math.max(0,a-l-h),labelGap:.3*e}}function Z(t,e,i,o){const n=Q(t,e),s=X(i,o),r=Math.min(3.375*e,n/2),a=n-r,l=a/s,h=Math.min(.375*e,.2*l);return{totalWidth:n,labelAreaWidth:r,maxPinLength:Math.max(0,l-h),pinPadding:h,axisX:i?l:0,labelX:a+.3*e}}const K={positive:{stroke:"#008f96",fill:"#008f96",fillpattern:"solid"},negative:{stroke:"#ff0000",fill:"#ff0000",fillpattern:"solid"},neutral:{stroke:"#808080",fill:"#808080",fillpattern:"outlined"},scenarios:{ac:{stroke:"#404040",fill:"#404040",fillpattern:"solid"},pp:{stroke:"#A6A6A6",fill:"#A6A6A6",fillpattern:"solid"},fc:{stroke:"#404040",fill:"#ffffff",fillpattern:"hatched"},pl:{stroke:"#404040",fill:"#ffffff",fillpattern:"outlined"}},fontColor:"#000000",fontSize:11.333305,emPx:13.3333,fontFamily:"'Noto Sans', sans-serif",unitScaling:.01,percentageScaling:.5,scaleFactor:1},J="#666666";function tt(t,e){return`pattern-${t}-${e.replace("#","")}`}const et=({styles:e})=>{const i=e.scaleFactor,o=6*i,n=[{id:tt("pos",e.positive.stroke),stroke:e.positive.stroke,fill:e.positive.fill},{id:tt("neg",e.negative.stroke),stroke:e.negative.stroke,fill:e.negative.fill},{id:tt("neu",e.neutral.stroke),stroke:e.neutral.stroke,fill:e.neutral.fill},...["ac","pp","fc","pl"].map((t=>({id:tt(t,e.scenarios[t].stroke),stroke:e.scenarios[t].stroke,fill:e.scenarios[t].fill})))];return t("defs",null,n.map((e=>t("pattern",{id:e.id,patternUnits:"userSpaceOnUse",width:o,height:o},t("rect",{width:o,height:o,fill:"#ffffff"}),t("line",{x1:"0",y1:o,x2:o,y2:"0",stroke:e.stroke,"stroke-width":1.5*i})))))};function it(t,e,i=1,o,n=0){const s=t>=0?"+":"";if(e){const e=e=>s+r.number(t,"percent",e,e,1,o);let i=Math.min(20,Math.max(0,Math.trunc(n)||0));for(;i>0&&e(i).length>7;)i--;return e(i)}const a=t/i,l=Math.abs(a);let h=1,c="";return l>=9995e5?(h=1e9,c="B"):l>=999500?(h=1e6,c="M"):l>=999.5&&(h=1e3,c="K"),s+r.number(a/h,"decimal",l>=10*h?0:1,0,1,o)+c}function ot(t){const e=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(e)}function nt(t){const e=t.slice(0,2).toLowerCase();return"pp"===e?"pp":"fc"===e?"fc":"pl"===e?"pl":"ac"}function st(t,e,i,o){return ot(t)?function(t,e){const i=nt(t);return e.scenarios[i]}(t,o):function(t,e,i){const o=t>=0;return e?o?i.positive:i.negative:o?i.negative:i.positive}(e,i,o)}function rt(t,e){const i=t.fillpattern;return"hatched"===i?`url(#${tt(e,t.stroke)})`:"outlined"===i?"transparent":t.fill}function at(t){return"outlined"===t.fillpattern?{stroke:t.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0}}const lt=e=>{const{value:i,scenario:o,columnStats:n,height:s,isPositiveGood:r,formattedValue:a,measureScale:l,locale:h,columnWidthEm:c=10,styles:u=K}=e,d=u.scaleFactor,f=u.fontSize,p=n.min<0,$=n.max>0,{totalWidth:m,axisX:v,breakGap:g,overdriveZoneWidth:b,cutWidth:w,labelGap:R}=q(c,u.emPx,p,$),S=Math.abs(i)*u.unitScaling*f,y=S-w>1e-6,E=Math.max(0,n.absMax*u.unitScaling*f-w),O=Math.max(0,S-w),M=E>0?O/E*b:0,U=2*d,G=s-2*U,T=U,N=i>=0,_=st(o,i,r,u),L=rt(_,ot(o)?nt(o):r?N?"pos":"neg":N?"neg":"pos"),{stroke:C,strokeWidth:x}=at(_),k=a||it(i,!1,l,h),P=y?w:S,A=y?w+g+M:S,D=N?v+A+R:v-A-R,W=N?"start":"end";return t("svg",{width:m,height:s,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},t(et,{styles:u}),t("line",{x1:v,y1:0,x2:v,y2:s,stroke:J,"stroke-width":1*d}),P>0&&t("rect",{x:N?v:v-P,y:T,width:P,height:G,fill:L,stroke:C,"stroke-width":x*d}),y&&M>0&&t("rect",{x:N?v+w+g:v-w-g-M,y:T,width:M,height:G,fill:L,stroke:C,"stroke-width":x*d}),y&&function(e,i,o,n,s){const r=e+i/2,a=.35*i,l=n/3,h=.3*i;let c=`M ${r-a} ${o}`;for(let t=0;t<3;t++)c+=` L ${r-a-h} ${o+l*(t+.5)} L ${r-a} ${o+l*(t+1)}`;let u=`M ${r+a} ${o}`;for(let t=0;t<3;t++)u+=` L ${r+a+h} ${o+l*(t+.5)} L ${r+a} ${o+l*(t+1)}`;return[t("rect",{x:e,y:o-1,width:i,height:n+2,fill:"#ffffff"}),t("path",{d:c,fill:"none",stroke:"#000000","stroke-width":1*s}),t("path",{d:u,fill:"none",stroke:"#000000","stroke-width":1*s})]}(N?v+w:v-w-g,g,T,G,d),t("text",{x:D,y:s/2,dy:"0.35em","text-anchor":W,fill:u.fontColor,"font-size":f,"font-family":u.fontFamily},k))},ht=e=>{const{value:i,scenario:o,columnStats:n,height:s,isPositiveGood:r,formattedValue:a,measureScale:l,locale:h,percentDigits:c,columnWidthEm:u=10,styles:d=K}=e,f=d.scaleFactor,p=d.fontSize,$=n.min<0,m=n.max>0,{totalWidth:v,maxPinLength:g,axisX:b,labelX:w}=Z(u,d.emPx,$,m),R=s/2,S=100*Math.abs(i)*d.percentageScaling*p,y=S>g,E=Math.min(S,g),O=i>=0,M=O?b+E:b-E,U=st(o,i,r,d),G=3*f,T=a||it(i,!0,l,h,c);return t("svg",{width:v,height:s,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},t("line",{x1:b,y1:0,x2:b,y2:s,stroke:J,"stroke-width":1*f}),!y&&t("circle",{cx:M,cy:R,r:G,fill:d.fontColor}),t("line",{x1:b,y1:R,x2:M,y2:R,stroke:U.fill,"stroke-width":2*f}),y&&O&&t("polygon",{points:`${b+g},${R} ${b+g-6*f},${R-3*f} ${b+g-6*f},${R+3*f}`,fill:U.fill}),y&&!O&&t("polygon",{points:`${b-g},${R} ${b-g+6*f},${R-3*f} ${b-g+6*f},${R+3*f}`,fill:U.fill}),t("text",{x:w,y:s/2,dy:"0.35em","text-anchor":"start",fill:d.fontColor,"font-size":p,"font-style":"italic","font-family":d.fontFamily},T))},ct=e=>{const{value:i,columnStats:o,isRelative:n,styles:s=K}=e;return null==i||isNaN(i)||!o||0===o.absMax?t("span",{class:"bar-chart-empty",style:{color:s.fontColor,fontStyle:"italic"}},"-"):t(n?ht:lt,Object.assign({},e))},ut=e=>{const{value:i,scenario:o,height:n,measureScale:s,locale:r,columnWidthEm:a=10,styles:l=K,waterfall:h}=e,c=l.scaleFactor,u=l.fontSize,d=h.max-h.min;if(null==i||isNaN(i)||d<=0)return t("span",{class:"bar-chart-empty",style:{color:l.fontColor,fontStyle:"italic"}},"-");const{totalWidth:f,labelAreaWidth:p,barAreaWidth:$,labelGap:m}=function(t,e){const i=Q(t,e),o=Math.min(2.85*e,i/4);return{totalWidth:i,labelAreaWidth:o,barAreaWidth:i-2*o,labelGap:.3*e}}(a,l.emPx),v=$/d,g=t=>p+(t-h.min)*v,b=2*c,w=n-2*b,R=b,S=g(0),y=g(h.start),E=g(h.end),O=Math.min(y,E),M=Math.abs(E-y),U=st(o,i,!1,l),G=rt(U,nt(o)),{stroke:T,strokeWidth:N}=at(U),_=it(i,"partof"===h.kind,s,r).replace(/^\+/,""),L=E<y,C=L?O-m:O+M+m,x=L?"end":"start";return t("svg",{width:f,height:n,class:"cell-bar-chart waterfall-bar",style:{overflow:"visible"}},t(et,{styles:l}),t("line",{x1:S,y1:0,x2:S,y2:n,stroke:J,"stroke-width":1*c}),void 0!==h.parentStart&&void 0!==h.parentEnd&&t("line",{x1:g(h.parentStart),y1:0,x2:g(h.parentStart),y2:n,stroke:J,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),void 0!==h.parentStart&&void 0!==h.parentEnd&&t("line",{x1:g(h.parentEnd),y1:0,x2:g(h.parentEnd),y2:n,stroke:J,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),M>0&&t("rect",{x:O,y:R,width:M,height:w,fill:G,stroke:T,"stroke-width":N*c}),t("text",{x:C,y:n/2,dy:"0.35em","text-anchor":x,fill:l.fontColor,"font-size":u,"font-family":l.fontFamily},_))},dt=`IFNULL(${a.ROWGROUP}, '')`;class ft{constructor(t){this.groups=[a.CATEGORY,a.CATEGORYINDEX],P.OPT!==t.type&&P.OPTNOTOTAL!==t.type||this.groups.unshift(a.OPERATION),t.grouped&&(this.groups.push(a.ROWGROUP),this.groups.push(a.ROWGROUPINDEX))}toString(){return this.groups.map((t=>t===a.ROWGROUP?dt:t)).toString()}select(){return this.groups.map((t=>t===a.ROWGROUP?`${dt} as ${t}`:t)).toString()}noCategory(){return this.groups.filter((t=>t!==a.CATEGORY))}toArray(){return this.groups}}class pt{constructor(t,e){this.hasPartOf=!1,this.params=[],this.hasBlankRowGroup=!1,this.config=t,this.i18n=e}execute(t,e){var i;this.db=t,this.fromExpr=e;for(const t of[...this.config.scenarios,...this.config.categoryThereOf.keys()])if(!R.test(t))throw new Error(`invalid identifier "${t}"`);const o=[],n=[],s=[],r=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),l=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),h=this.getRelativeScenarios(),u=this.config.attributes.map((t=>this.translateAttributeSQL(t))).toString(),d=new ft(this.config);let f=["",""];this.config.sortOrder.hierarchy.length>0&&(f=this.createOrderString(this.config.sortOrder)),this.hasPartOf=this.checkConfigForPartOf();const{hierarchy:p,direction:$}=this.config.sortOrder,m=p.filter((t=>t===a.ROWGROUP||t===a.ROWGROUPINDEX||t.toUpperCase()in c)),v=m.filter((t=>t.toUpperCase()in c)).map((t=>`, SUM(${t} * transformOperator(operation)) as ${t}`)).join(""),g=m.length>0?m.map((t=>`${t} ${$}`)).toString():`${a.ROWGROUPINDEX} asc`,b=t.exec(`SELECT COUNT(DISTINCT ${a.CATEGORY}) as ${a.TOTALROWCOUNT} ${this.config.grouped?`, ${dt} as ${a.ROWGROUP}, FIRST(${a.ROWGROUPINDEX}) as ${a.ROWGROUPINDEX}${v}`:""}\n FROM ${e} ${this.config.grouped?`GROUP BY ${dt} ORDER BY ${g}`:""}`);return 0===b.length||1===b.length&&0===(null!==(i=b[0][a.TOTALROWCOUNT])&&void 0!==i?i:0)&&!this.config.grouped?[]:(this.hasBlankRowGroup=this.config.grouped&&b.some((t=>""===t.rowGroup)),b.forEach((t=>{const e=this.config.grouped?""===t.rowGroup?`WHERE (${a.ROWGROUP} IS NULL OR ${a.ROWGROUP} = '')`:`WHERE ${a.ROWGROUP} = ${this.bind(t.rowGroup)}`:"";let i="";this.config.limit&&(i=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,o),this.createDataRow(o,t,d,r,u,e,f,i),this.createRestRow(t,o,d,r,e,f),this.createGroupSumRow(o,n,t,l,e,f)})),this.createTotalSumRow(o,n,l),o.forEach((t=>s.push(this.exec(t)))),this.detectNaNCells(this.config.scenarios,s),this.createThereOfDrillRows(r,u,f,s),this.createPartOfDrillRows(r,f,n,s),this.createIntervalColumns(s),this.createThereOfDrillColumns(this.config.categoryThereOf,s),this.calculateColumnGroupRest(s,this.config.categoryThereOf),this.calculateRelativeVariances(s,h),s)}detectNaNCells(t,e){e.forEach((e=>{e.map((e=>(t.forEach((t=>{const i=new l(t);!0===i.isValid?0!==e[i.base+"_cnt"]&&0!==e[i.delta+"_cnt"]||(e[t]=Number.NaN):0===e[t+"_cnt"]&&(e[t]=Number.NaN)})),e)))}))}createPartOfDrillRows(t,e,i,o){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===P.LIST)return;const n=this.createPartOfQuery(t,e);let s=[];const r=this.db,l=this.params;n.forEach((t=>{s.push(...this.exec(t))}));const h=this.exctractScenarioNames(t),c=[];i.forEach((function(t){c.push(...r.exec(t,l))}));const u=new Map;c.forEach((t=>u.set(t[a.ROWGROUP],t))),s=this.reduceResDrillByCategoryGroups(s,h),s.forEach((function(t){h.forEach((e=>{try{t[e]=t[e]/u.get(t[a.ROWGROUP])[e]}catch(i){console.error("DataQuery: partOf drill row calculation failed",e,i),t[e]=Number.NaN}}))})),this.injectDrillRowsToResultRows(s,o)}createRestRow(t,e,i,o,n,s){if(t.totalRowCnt-this.config.limit>0&&0!==this.config.limit){const r=this.exctractScenarioNames(o).map((t=>`SUM(${t}) as ${t}`)).join(", ");e.push(`SELECT ${a.ROWNR}, 1 as ${a.ROWGROUPINDEX} , 'ENTRY' as ${a.TYPE}, 'NO_GROUP' as ${a.ROWGROUP}, 'REST' as ${a.CATEGORY} ${r.length>0?", "+r:""} FROM (SELECT ROWNUM() AS ${a.ROWNR}, ${e.length} as ${a.ROWGROUPINDEX} , 'ENTRY' as ${a.TYPE}, ${this.bind(String(t.rowGroup||"NO_GROUP"))} as ${a.ROWGROUP}, ${i.select()} ${o.length>0?",".concat(o):""} FROM ${this.fromExpr} ${n} GROUP BY ${i} ORDER BY ${s[0]}) t WHERE t.rowNr > ${this.config.limit}`)}}createDataRow(t,e,i,o,n,s,r,l){t.push(`SELECT ROWNUM() AS ${a.ROWNR},\n ${t.length} as ${a.ROWGROUPINDEX},\n 'ENTRY' as ${a.TYPE},\n ${this.bind(String(e.rowGroup||"NO_GROUP"))} as ${a.ROWGROUP},\n '${a.CATEGORYINDEX}',\n ${i.select()} ${o.length>0?",".concat(o):""} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr} ${s}\n GROUP BY ${i}\n ORDER BY ${r[0]} ${l}`)}createGroupHeaderRow(t,e){if(!0===this.config.grouped){const i=this.bind(String(t.rowGroup)),o=""===t.rowGroup?this.bind("-"):i;e.push(`SELECT ROWNUM() AS ${a.ROWNR},\n ${e.length} as ${a.ROWGROUPINDEX},\n 'GROUPHEAD' as ${a.TYPE},\n ${i} as ${a.ROWGROUP} ${this.config.showGroupTitle?`,${o} as ${a.CATEGORY}`:""}\n FROM ${this.fromExpr}\n GROUP BY '1'`)}}createGroupSumRow(t,e,i,o,n,s){if(!0===this.config.grouped&&(P.SUM===this.config.type||P.SUMNOTOTAL===this.config.type||P.OPT===this.config.type||P.OPTNOTOTAL===this.config.type)){const r=this.bind(String(i.rowGroup));t.push(`SELECT ${t.length} as ${a.ROWGROUPINDEX},\n '=' as ${a.OPERATION},\n ${r} as ${a.ROWGROUP},\n ROWNUM() AS ${a.ROWNR},\n 'GROUP_SUM' as ${a.TYPE} ${o.length>0?",".concat(o):""}\n FROM ${this.fromExpr} ${n}\n ORDER BY ${s[0]} `),e.push(`SELECT ${t.length} as ${a.ROWGROUPINDEX},\n '=' as ${a.OPERATION},\n ${r} as ${a.ROWGROUP},\n ROWNUM() AS ${a.ROWNR},\n 'GROUP_SUM' as ${a.TYPE} ${o.length>0?",".concat(o):""}\n FROM ${this.fromExpr} ${n}\n ORDER BY ${s[0]} `)}}createTotalSumRow(t,e,i){var o;if(P.SUM===this.config.type||P.OPT===this.config.type){const e=(null===(o=this.config.title)||void 0===o?void 0:o.trim())||"SUM_TOTAL",n=this.hasPartOf&&!1===this.config.grouped&&"SUM_TOTAL"!==e?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} ${e}`:e;t.push(`SELECT ${t.length} as ${a.ROWGROUPINDEX},\n ${this.bind(n)} as ${a.ROWGROUP},\n '=' as ${a.OPERATION},\n 'SUM' as ${a.TYPE} ${i.length>0?",".concat(i):""}\n FROM ${this.fromExpr} `)}e.push(`SELECT ${t.length} as ${a.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${a.ROWGROUP},\n '=' as ${a.OPERATION},\n 'SUM' as ${a.TYPE} ${i.length>0?",".concat(i):""}\n FROM ${this.fromExpr} `)}reduceResDrillByCategoryGroups(t,e){const i=new Map;return t.forEach((function(t){const o=t.rowNr+t.rowGroup+t.type+t.category;if(i.has(o)){const n=i.get(o);e.forEach((e=>{try{n[e]+=t[e]}catch(t){console.error("DataQuery: drill row aggregation failed",e,t)}}))}else i.set(o,t)})),[...i.values()]}injectDrillRowsToResultRows(t,e){const i=new Map;if(!0===this.config.grouped)t.forEach((function(t){e.forEach((function(e){const o=e.findIndex((e=>e.category===t.category&&e.rowGroup===t.rowGroup));if(o>=0){if(i.has(`${t.category}_${t.rowGroup}`)){const e=i.get(`${t.category}_${t.rowGroup}`)||0;i.set(`${t.category}_${t.rowGroup}`,e+1)}else i.set(`${t.category}_${t.rowGroup}`,1);t[a.ROWNR]=i.get(`${t.category}_${t.rowGroup}`),e.splice(o+t[a.ROWNR],0,t)}}))}));else{const o=this.findDuplicateSubCategories(t);t.forEach((function(t){e.forEach((function(e){const n=e.findIndex((e=>null!=e.category&&e.category===t.category));if(n>=0){if(i.has(`${t.category}`)){const e=i.get(`${t.category}`)||0;i.set(`${t.category}`,e+1)}else i.set(`${t.category}`,1);null!=t.rowGroup&&""!==t.rowGroup&&o.includes(`${t.category}##${t.subCategory}`)&&(t.subCategory=`${t.subCategory} (${t.rowGroup})`),e.splice(n+t[a.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,e,i,o){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const n=[],s=[];this.config.thereOf.forEach((o=>{let s=!0,r="1 <> 1 OR ( ";null!=o.category&&0!==o.category.length&&o.category.trim()&&(r+=` ${a.CATEGORY} = ${this.bind(o.category)}`,s=!1),null!=o.rowGroup&&0!==o.rowGroup.length&&o.rowGroup.trim()&&(r+=` ${s?"":"AND"} ${a.ROWGROUP} = ${this.bind(o.rowGroup)}`,s=!1),null!=o.subCategory&&0!==o.subCategory.length&&o.subCategory.trim()&&(r+=` ${s?"":"AND"} ${a.SUBCATEGORY} = ${this.bind(o.subCategory)}`),r+=")",n.push(`SELECT ROWNUM() AS ${a.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${a.TYPE},\n ${a.CATEGORY},\n ${a.SUBCATEGORY},\n ${this.drillRowGroup} as ${a.ROWGROUP},\n ${t} ${e.length>0?",".concat(e):""}\n FROM ${this.fromExpr}\n WHERE ${r}\n GROUP BY ${this.drillRowGroup}, ${a.CATEGORY}, ${a.SUBCATEGORY}\n ORDER BY ${i[1]}`)})),n.forEach((t=>{s.push(...this.exec(t))})),this.injectDrillRowsToResultRows(s,o)}calculateRelativeVariances(t,e){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[a.TYPE]&&e.forEach(((e,i)=>{var o;t[i]=null!==(o=v(t[i],t[e]))&&void 0!==o?o:m}))}))}))}calculateColumnGroupRest(t,e){if(null==e||0===e.size)return;const i=new Map,o=new Map;e.forEach(((t,e)=>{const n=t,s=[];for(const t of n)s.push(`${e}##${t.name}`);i.set(e,s),o.set(`${e}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[a.TYPE]&&i.forEach(((e,i)=>{let n=0;e.forEach((e=>{void 0!==t[e]&&(n+=t[e])})),t[`${i}##REST`]=t[i]-n,0!==t[`${i}##REST`]&&o.set(`${i}##REST`,!0)}))}))}));const n=Array.from(o.entries()).filter((([t,e])=>!e)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const e of n)delete t[e]}))}))}createIntervalColumns(t){var e,i,o,n,s;if(this.config.interval===W||this.config.categoryThereOf.size>0||0===this.config.scenarios.length)return;const r="##",h=`(SELECT *, ${F(this.config.interval)} as __interval FROM ${this.fromExpr}) as p`,c=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),u=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),d=[...new Set(this.exctractScenarioNames(c))],f=this.getRelativeScenarios(),p=new ft(this.config),$=P.OPT===this.config.type||P.OPTNOTOTAL===this.config.type,g=this.config.grouped&&(P.SUM===this.config.type||P.SUMNOTOTAL===this.config.type||P.OPT===this.config.type||P.OPTNOTOTAL===this.config.type),b=this.checkConfigForPartOf()&&this.config.type!==P.LIST,w=t=>this.exec(t),R=t=>(this.config.scenarios.forEach((e=>{const i=new l(e);!0===i.isValid?0!==t[i.base+"_cnt"]&&0!==t[i.delta+"_cnt"]||(t[e]=Number.NaN):0===t[e+"_cnt"]&&(t[e]=Number.NaN)})),f.forEach(((e,i)=>{var o;t[i]=null!==(o=v(t[i],t[e]))&&void 0!==o?o:m})),t),S=(t,e,i)=>{for(const o of this.config.scenarios)t[o+r+i]=e[o]},y=w(`SELECT ${p.select()}, __interval ${c.length>0?",".concat(c):""}\n FROM ${h}\n GROUP BY ${p}, __interval`);if(this.config.limit>0)for(let o=0;o<t.length;o++){const n=t[o].find((t=>"ENTRY"===t.type&&"REST"===t.category));if(!n)continue;let s;for(let e=o-1;e>=0&&!s;e--){const i=t[e].filter((t=>"ENTRY"===t.type&&"REST"!==t.category));i.length>0&&(s=i)}if(!s)continue;const r=new Set(s.map((t=>t.category))),a=s[0].rowGroup,l=new Map;for(const t of y){if(this.config.grouped&&t.rowGroup!==a)continue;if(r.has(t.category))continue;const o=Y(t.__interval);let n=l.get(o);n||(n={},l.set(o,n));for(const o of d)n[o]=(null!==(e=n[o])&&void 0!==e?e:0)+(null!==(i=t[o])&&void 0!==i?i:0)}l.forEach(((t,e)=>{S(n,R(t),e)}))}for(const e of y){const i=Y(e.__interval);R(e);for(const o of t)for(const t of o)"ENTRY"===t.type&&"REST"!==t.category&&t.category===e.category&&(this.config.grouped&&t.rowGroup!==e.rowGroup||$&&t.operation!==e.operation||S(t,e,i))}const E=g||b&&this.config.grouped?w(`SELECT ${dt} as ${a.ROWGROUP}, __interval ${u.length>0?",".concat(u):""}\n FROM ${h}\n GROUP BY ${dt}, __interval`):[],O=new Map;if(E.forEach((t=>O.set(`${t.rowGroup}${r}${Y(t.__interval)}`,t))),g)for(const e of E){const i=Y(e.__interval),o=R(Object.assign({},e));for(const n of t)for(const t of n)"GROUP_SUM"===t.type&&t.rowGroup===e.rowGroup&&S(t,o,i)}const M=P.SUM===this.config.type||P.OPT===this.config.type,U=M||b&&!this.config.grouped?w(`SELECT __interval ${u.length>0?",".concat(u):""}\n FROM ${h}\n GROUP BY __interval`):[],G=new Map;if(U.forEach((t=>G.set(Y(t.__interval),t))),M)for(const e of U){const i=Y(e.__interval),o=R(Object.assign({},e));for(const e of t)for(const t of e)"SUM"===t.type&&S(t,o,i)}if(null!=this.config.thereOf&&this.config.thereOf.length>0){const e=[];this.config.thereOf.forEach((t=>{e.push(...w(`SELECT ${this.drillRowGroup} as ${a.ROWGROUP}, ${a.CATEGORY}, ${a.SUBCATEGORY}, __interval ${c.length>0?",".concat(c):""}\n FROM ${h}\n WHERE ${this.createThereOfWhereClause(t)}\n GROUP BY ${this.drillRowGroup}, ${a.CATEGORY}, ${a.SUBCATEGORY}, __interval`))}));for(const i of e){const e=Y(i.__interval);R(i);for(const o of t)for(const t of o)"DRILLELEMENT"===t.type&&t.category===i.category&&t.rowGroup===i.rowGroup&&(t.subCategory!==i.subCategory&&t.subCategory!==`${i.subCategory} (${i.rowGroup})`||S(t,i,e))}}if(b){let e="1 <> 1 ";null===(o=this.config.partOf)||void 0===o||o.forEach((t=>{e+=`OR (${a.CATEGORY} = ${this.bind(t.category)}`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(e+=`and ${a.ROWGROUP} = ${this.bind(t.rowGroup)}`),e+=")"}));const i=w(`SELECT ${a.CATEGORY}, ${this.config.grouped?`${a.ROWGROUP}`:`'SUM_TOTAL' as ${a.ROWGROUP}`}, __interval ${c.length>0?",".concat(c):""}\n FROM ${h}\n WHERE ${e}\n GROUP BY ${a.ROWGROUP}, ${a.CATEGORY}, __interval`),l=new Map;for(const t of i){const e=`${t.rowGroup}${r}${t.category}${r}${Y(t.__interval)}`,i=l.get(e);if(i)for(const e of d)i[e]=(null!==(n=i[e])&&void 0!==n?n:0)+(null!==(s=t[e])&&void 0!==s?s:0);else l.set(e,t)}l.forEach((e=>{const i=Y(e.__interval),o=this.config.grouped?O.get(`${e.rowGroup}${r}${i}`):G.get(i);for(const t of d)e[t]=e[t]/(o?o[t]:Number.NaN);R(e);for(const o of t)for(const t of o)"PARTELEMENT"===t.type&&t.category===e.category&&t.rowGroup===e.rowGroup&&S(t,e,i)}))}}createThereOfWhereClause(t){let e=!0,i="1 <> 1 OR ( ";return null!=t.category&&0!==t.category.length&&t.category.trim()&&(i+=` ${a.CATEGORY} = ${this.bind(t.category)}`,e=!1),null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(i+=` ${e?"":"AND"} ${a.ROWGROUP} = ${this.bind(t.rowGroup)}`,e=!1),null!=t.subCategory&&0!==t.subCategory.length&&t.subCategory.trim()&&(i+=` ${e?"":"AND"} ${a.SUBCATEGORY} = ${this.bind(t.subCategory)}`),i+")"}getRelativeScenarios(){const t=new Map;return this.config.scenarios.forEach((e=>{const i=this.createRelativeScenario(e);null!=i&&t.set(i.key,i.value)})),t}translateScenarioSQL(t,e,i){const o=new l(t);return P.OPT===i||P.OPTNOTOTAL===i?o.isValid?"dr"===o.type?`SUM(${o.base} - ${o.delta}) as ${t}, SUM(${o.delta}) as dr_${o.delta}`:`SUM(${o.base} - ${o.delta}) as ${t}`:e?`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:`SUM(${t}) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:o.isValid?"dr"===o.type?`SUM((${o.base} * transformOperator(operation)) - (${o.delta} * transformOperator(operation))) as ${t}, SUM(${o.delta} * transformOperator(operation)) as dr_${o.delta}`:`SUM((${o.base} * transformOperator(operation))- (${o.delta} * transformOperator(operation))) as ${t}`:`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}translateAttributeSQL(t){const e=`[${t.arg}]`,i=/^(ac|pp|fc|pl)[1-4]$/.test(t.arg)&&this.config.type!==P.OPT&&this.config.type!==P.OPTNOTOTAL;switch(t.fn){case"set":return`SETAGG(${e}) as ${t.alias}`;case"first":return`FIRST(${e}) as ${t.alias}`;case"last":return`LAST(${e}) as ${t.alias}`;case"min":return`MIN(${e}) as ${t.alias}`;case"max":return`MAX(${e}) as ${t.alias}`;case"avg":return i?`AVG(${e} * transformOperator(operation)) as ${t.alias}`:`AVG(${e}) as ${t.alias}`;case"sum":return i?`SUM(${e} * transformOperator(operation)) as ${t.alias}`:`SUM(${e}) as ${t.alias}`;case"lit":{const e=t.arg;return`${this.bind(""===e||Number.isNaN(Number(e))?e:Number(e))} as ${t.alias}`}}}get drillRowGroup(){return this.config.grouped?dt:a.ROWGROUP}exec(t){const e=this.db.exec(t,this.params);return this.config.grouped&&e.forEach((t=>t.rowGroup=null==t.rowGroup?"":String(t.rowGroup))),e}bind(t){return`$${this.params.push(t)-1} `}createOrderString(t){const e=A.ASC===t.direction?A.DESC:A.ASC;return[t.hierarchy.map((e=>`${e} ${t.direction}`)).toString(),t.hierarchy.map((t=>`${t} ${e}`)).toString()]}createRelativeScenario(t){const e=new l(t);return e.isValid&&"dr"===e.type?{key:`${t}`,value:`dr_${e.delta}`}:null}exctractScenarioNames(t){const e=[];return t.split(",").forEach((t=>t.length>=2?e.push(t.split("as")[1].trim()):null)),e}findDuplicateSubCategories(t){const e=t.map((t=>({count:1,subCategory:`${t.category}##${t.subCategory}`}))).reduce(((t,e)=>(t[e.subCategory]=(t[e.subCategory]||0)+e.count,t)),{});return Object.keys(e).filter((t=>e[t]>1))}createPartOfQuery(t,e){var i;const o=[];let n="1 <> 1 ",s=` ${this.drillRowGroup} as ${a.ROWGROUP}`,r="ROWNUM()";return null===(i=this.config.partOf)||void 0===i||i.forEach((t=>{n+=`OR (${a.CATEGORY} = ${this.bind(t.category)}`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(n+=`and ${a.ROWGROUP} = ${this.bind(t.rowGroup)}`),!1===this.config.grouped&&(s=` 'SUM_TOTAL' as ${a.ROWGROUP} `,r="1"),n+=")"})),o.push(`SELECT ${r} AS ${a.ROWNR},\n 'PARTELEMENT' as ${a.TYPE},\n ${a.CATEGORY},\n ${s},\n ${t}\n FROM ${this.fromExpr}\n WHERE ${n}\n GROUP BY ${this.drillRowGroup}, ${a.CATEGORY}, ${a.TYPE}\n ORDER BY ${e[1]}`),o}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,e){if(null==t||0===t.size)return;const i=[],o=[],n=this.fromExpr;t.forEach(((t,e)=>{let o="1 <> 1 ";t.forEach((t=>{o+=` or columnGroup = ${this.bind(String(t.name))} `})),i.push(`SELECT 'ENTRY' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),i.push(`SELECT 'ENTRY' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),i.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),i.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),i.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),i.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),i.push(`SELECT 'SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${o}\n GROUP BY rowlevel, columnGroup, scenario`),i.push(`SELECT 'SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${o}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of i)o.push(...this.db.exec(t,this.params));this.injectDrillColumnsToResultRows(o,e)}injectDrillColumnsToResultRows(t,e){const i="##";for(const o of t)for(const t of e)for(const e of t)if(e.type===o.rowlevel)if("ENTRY"===o.rowlevel)"COLUMNGROUP"===o.columnlevel&&e.category===o.category?e[o.scenario+i+o.columnGroup]=o.val:"SUBGROUP"===o.columnlevel&&e.category===o.category&&(e[o.scenario+i+o.columnGroup+i+o.columnSubGroup]=o.val);else if("DRILLELEMENT"===o.rowlevel){if(!this.config.grouped&&e.rowGroup!==o.rowGroup)continue;"COLUMNGROUP"===o.columnlevel&&e.category===o.category&&e.subCategory===o.subCategory?e[o.scenario+i+o.columnGroup]=o.val:"SUBGROUP"===o.columnlevel&&e.category===o.category&&e.subCategory===o.subCategory?e[o.scenario+i+o.columnGroup+i+o.columnSubGroup]=o.val:"COLUMNGROUP"===o.columnlevel&&e.category===o.category&&e.subCategory===`${o.subCategory} (${o.rowGroup})`?e[o.scenario+i+o.columnGroup]=o.val:"SUBGROUP"===o.columnlevel&&e.category===o.category&&e.subCategory===`${o.subCategory} (${o.rowGroup})`&&(e[o.scenario+i+o.columnGroup+i+o.columnSubGroup]=o.val)}else("SUM"===o.rowlevel||"GROUP_SUM"===o.rowlevel)&&("COLUMNGROUP"===o.columnlevel&&e.category===o.category&&e.subCategory===o.subCategory&&(e[o.scenario+i+o.columnGroup]=o.val),"SUBGROUP"===o.columnlevel&&e.category===o.category&&e.subCategory===o.subCategory&&(e[o.scenario+i+o.columnGroup+i+o.columnSubGroup]=o.val))}}class $t{constructor(){this.geometry=new Map}set(t,e,i){let o=this.geometry.get(t);o||(o=new Map,this.geometry.set(t,o)),o.set(e,i)}get(t,e){var i;return null===(i=this.geometry.get(t))||void 0===i?void 0:i.get(e)}}function mt(t,e,i){const o=t[e];if(null==o)return null;const n=Number(o);return isNaN(n)?null:i!==P.OPT&&i!==P.OPTNOTOTAL||t[a.TYPE]!==D.ENTRY||"-"!==t[a.OPERATION]?n:-n}class vt{constructor(){this.normalizedHeader=[],this.attributesByAlias=new Map,this.hasBlankRowGroup=!1}getNormalizedHeader(){return this.normalizedHeader}createHeader(t,e,i,o,n,s,a=[]){const l=[];this.attributesByAlias=new Map(a.map((t=>[t.alias,t]))),this.normalizedHeader=this.normalizeHeader(t,e,a);const h=this.normalizedHeader.some((t=>void 0!==t.bucket));h&&l.push(this.createIntervalBandRow());const c=new j(h?1:0,0,D.HEADER),u=new j(h?2:1,0,D.SEPERATORLINE);for(const t of this.normalizedHeader){const e=this.attributesByAlias.get(t.name);c.createElement(e?i.get(e.label)||e.label:r.translateScenarioLabel(t.name,i),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,i,o,n,s),null,null,null,null),u.createElement(null,t.type,this.createColumnType(t),null,null,null,null,null,null)}return l.push(c),l.push(u),l}createIntervalBandRow(){const t=new j(0,0,D.HEADER);let e=0;for(;e<this.normalizedHeader.length;){const i=this.normalizedHeader[e];if(void 0===i.bucket){t.createElement(null,i.type,"filler",null,null,null,null,null,null),e+=1;continue}let o=1;for(;e+o<this.normalizedHeader.length&&this.normalizedHeader[e+o].bucket===i.bucket;)o+=1;t.createElement(i.bucketLabel,i.type,"intervalGroup",null,null,null,null,null,null,!1,void 0,o),e+=o}return t}setHeaderPrefix(t,e,i,o,n){let s="";return"category"===t.name&&n&&(0===i.prefix.length&&0===o.length||(s=r.translateScenarioLabel("in",e)+" "+i.prefix+o)),t.order&&(s+=r.translateScenarioLabel("ORDER_"+t.order,e)),s}normalizeHeader(t,e,i){let o=[{name:a.CATEGORY,group:a.CATEGORY,type:a.CATEGORY,order:void 0}];P.OPT!==t&&P.OPTNOTOTAL!==t||(o=[{name:a.OPERATION,group:a.OPERATION,type:a.OPERATION,order:void 0},{name:a.CATEGORY,group:a.CATEGORY,type:a.CATEGORY,order:void 0}]);const n=i.map((t=>({name:t.alias,group:t.alias,type:t.alias,order:void 0})));return[...o,...n,...e]}createBodyRows(t,e,i,o){var n;const s=[];let r=-1;const l=new pt(t,e),h=l.execute(i,o);this.hasBlankRowGroup=l.hasBlankRowGroup;const u=this.calculateColumnStatistics(h,t.barColumns,t.interval!==W),d=(null!==(n=t.barColumns)&&void 0!==n?n:[]).filter((t=>t.toUpperCase().trim()in c)),f=d.length>0&&t.interval===W&&0===t.categoryThereOf.size&&function(t){for(const e of t)for(const t of e){const e=t[a.TYPE];if(e===D.SUM||e===D.GROUPSUM||e===D.DRILLELEMENT||e===D.PARTELEMENT)return!0}return!1}(h)?function(t,e,i){const o=new $t;for(const n of e){let e,s=0,r=0;const l=[],h=(t,e)=>{l.push(e),o.set(t,n,e)};for(const o of t)for(const t of o){const o=t[a.TYPE];if(o===D.GROUPHEAD){e=void 0;continue}const l=mt(t,n,i);if(o===D.ENTRY){if(null===l){e=void 0;continue}h(t,{start:s,end:s+l,min:0,max:0,kind:"cascade"}),e={start:s,end:s+l},r=e.start,s+=l}else if(o===D.SUM||o===D.GROUPSUM){if(null===l){e=void 0;continue}h(t,{start:0,end:l,min:0,max:0,kind:"anchor"}),e={start:0,end:l},r=0,s=l}else if(o===D.DRILLELEMENT){if(null===l||void 0===e)continue;const i=r+(Math.sign(e.end-e.start)||1)*Math.abs(l);h(t,{start:r,end:i,min:0,max:0,kind:"thereof",parentStart:e.start,parentEnd:e.end}),r=i}else if(o===D.PARTELEMENT){if(null===l||void 0===e)continue;const i=r+l*(e.end-e.start);h(t,{start:r,end:i,min:0,max:0,kind:"partof",parentStart:e.start,parentEnd:e.end}),r=i}}let c=0,u=0;for(const t of l)c=Math.min(c,t.start,t.end),u=Math.max(u,t.start,t.end);for(const t of l)t.min=c,t.max=u}return o}(h,d,t.type):void 0;for(const i of h)r+=1,s.push(...this.createRow(t.i18n,e,t.scenariosUnitType,i,r,-1,t.categoryWidth,t.measureScale,t.barColumns,u,f));return s}calculateColumnStatistics(t,e,i=!1){const o=new Map;if(!e||0===e.length)return o;const n=new Map;for(const t of e)o.set(t,{min:1/0,max:-1/0,absMax:0,median:0}),n.set(t,[]);for(const s of t)for(const t of s){const s=t[a.TYPE];if(s!==D.SUM&&s!==D.GROUPSUM)for(const s of e){const e=i?this.extractIntervalColumnValues(t,s):[this.extractColumnValue(t,s)];for(const t of e)if(null!==t&&!isNaN(t)){const e=o.get(s);e.min=Math.min(e.min,t),e.max=Math.max(e.max,t),n.get(s).push(Math.abs(t))}}}for(const[t,e]of o){e.min!==1/0&&e.max!==-1/0||(e.min=0,e.max=0),e.absMax=Math.max(Math.abs(e.min),Math.abs(e.max));const i=n.get(t);if(i.length>0){i.sort(((t,e)=>t-e));const t=Math.floor(i.length/2);e.median=i.length%2==0?(i[t-1]+i[t])/2:i[t]}o.set(t,e)}return o}extractIntervalColumnValues(t,e){const i=e+"##",o=[];for(const e of Object.keys(t))if(e.startsWith(i)){const i=Number(t[e]);o.push(isNaN(i)?null:i)}return o}extractColumnValue(t,e){if(void 0!==t[e]){const i=Number(t[e]);return isNaN(i)?null:i}for(const i of Object.keys(t))if(i===e||i.endsWith("##"+e)||i===e+"##"+e){const e=Number(t[i]);if(!isNaN(e))return e}return null}createRow(t,e,i,o,n,s,r,l,h,c,u){var d;const f=[];for(const p of o){const $=p[a.ROWGROUP],m=""===$?"-":$,v=p[a.SUBCATEGORY],g=p[a.TYPE],b=p[a.ROWNR]>=2,w=this.createDetailRow(g,s+=1,n,o.length);for(const o of this.normalizedHeader){const n=this.getRawDataRowElement(p,o),s=null!==(d=null==h?void 0:h.includes(o.type))&&void 0!==d&&d,a=s?null==c?void 0:c.get(o.type):void 0,f=s&&void 0===o.bucket&&o.name===o.group&&o.name===o.type?null==u?void 0:u.get(p,o.type):void 0;w.createElement(this.translateSumCellLabel(t,e,n,m,v,g,o.type),o.type,this.createColumnType(o),this.setCellType(o.type,i),this.translateCellPrefix(e,g,o.type),this.translateScenarioCSS(o.type,n),b,r,null==l?void 0:l.value,s,a,1,f)}f.push(w)}return f}getRawDataRowElement(t,e){return void 0!==e.bucket?t[e.type+"##"+e.bucket]:e.name===e.group&&e.name===e.type?t[e.name]:e.name===e.group&&e.name!==e.type?t[e.type+"##"+e.name]:t[e.type+"##"+e.group+"##"+e.name]}createDetailRow(t,e,i,o){switch(t){case D.GROUPHEAD:return new j(e,i,D.HEADER);case D.SUM:case D.GROUPSUM:return new j(o+2,i,D.SUM);case D.DRILLELEMENT:return new j(o+2,i,D.DRILLELEMENT);case D.PARTELEMENT:return new j(o+2,i,D.PARTELEMENT);default:return new j(e,i,D.STANDARD)}}translateSumCellLabel(t,e,i,o,n,s,r){return this.attributesByAlias.has(r)||!1===Number.isNaN(Number(i))||this.isOperationColumn(r)?i:this.isGroupHeadCategory(s,r)?t===u.ALL?`${e.get(i)||i}`:i:this.isEntryCategory(s,r)?t===u.ALL||"REST"===i?`${e.get(i)||i}`:i:this.isDrillElementCategory(s,r)?t===u.ALL?`${e.get(n)||n}`:`${n}`:this.isPartElementCategory(s,r)?t===u.ALL||"SUM_TOTAL"===o?`${e.get(o)||o}`:`${o}`:this.isSumElementCategory(s,r)?t===u.ALL||"SUM_TOTAL"===o?`${e.get(o)||o}`:o:"GROUPHEAD"===s&&null==i||i===m?i:Number.isNaN(Number(i))?"-":Number(i)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,e){if(this.attributesByAlias.has(t))return"attribute";const i=new l(t);let o="pos";return e<0&&(o="neg"),i.isValid?o+"_"+i.direction+("dr"===i.type?" relative_variance":""):t}setCellType(t,e){if("category"===t)return"";const i=this.attributesByAlias.get(t);if(i)return i.isNumeric?"decimal":"";let o;const n=new l(t);return e===d.PERCENT?(o="percent",n.isValid&&"d"===n.type&&(o="percentpoint")):(o="decimal",n.isValid&&"dr"===n.type&&(o="percent")),o}isDrillElementCategory(t,e){return"DRILLELEMENT"===t&&"category"===e}isPartElementCategory(t,e){return"PARTELEMENT"===t&&"category"===e}isSumElementCategory(t,e){return("GROUP_SUM"===t||"SUM"===t)&&"category"===e}isEntryCategory(t,e){return"ENTRY"===t&&"category"===e}isGroupHeadCategory(t,e){return"GROUPHEAD"===t&&"category"===e}translateCellPrefix(t,e,i){return this.isOperationColumn(i)||this.isGroupHeadCategory(e,i)||this.isEntryCategory(e,i)?null:this.isDrillElementCategory(e,i)?`${t.get("there_of")} `:this.isPartElementCategory(e,i)?`${t.get("part_of")} `:null}createColumnType(t){return t.name===t.group&&t.name===t.type?"base":t.name===t.group?"columnGroup":"columnSubGroup"}}class gt{constructor(t,e,i,o){this.fromExpr="",this.rowCount=0,this.headerRows=[],this.bodyRows=[],this.intervalBuckets=[],this.ruleSet=t||new h,this.db=e,this.dataSetFactory=new vt,this.config=this.initConfig(o),this.i18n=this.initI18n(new Map),this.setSource(i,o.filter)}setI18n(t){this.i18n=this.initI18n(t)}initI18n(t){const e=new Map([["",""],["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"]]);return this.state=k.DIRTY,new Map([...e,...t||new Map])}initConfig(t){this.state=k.DIRTY;const e=t,i=this;return t.scenarios.sort(((t,e)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(e))),e}setConfig(t){this.config=this.initConfig(t)}setSource(t,e){var i,o;if(this.state=k.DIRTY,this.fromExpr=S(this.db,t,e),!this.fromExpr)return void(this.rowCount=0);const n=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(o=null===(i=n[0])||void 0===i?void 0:i.cnt)&&void 0!==o?o:0}update(){this.prepareIntervalBuckets();const t=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder,this.intervalBuckets);this.headerRows=this.dataSetFactory.createHeader(this.config.type,t,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale,this.config.attributes),this.bodyRows=0!==this.rowCount&&this.fromExpr?this.dataSetFactory.createBodyRows(this.config,this.i18n,this.db,this.fromExpr):[],this.state=k.UP_TO_DATE}getHeader(){return this.state===k.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===k.DIRTY&&this.update(),this.bodyRows}getColumns(){return this.state===k.DIRTY&&this.update(),this.dataSetFactory.getNormalizedHeader()}prepareIntervalBuckets(){this.intervalBuckets=[],this.config.interval===W||!this.fromExpr||this.config.categoryThereOf.size>0?this.config.interval=W:(this.config.interval=function(t,e,i){var o;if(i!==b.AUTO)return i;const n=t.exec(`SELECT [date] as d FROM ${e}`);let s,r;for(const t of n){const e=null===(o=H(t.d))||void 0===o?void 0:o.toMillis();void 0!==e&&(s=void 0===s?e:Math.min(s,e),r=void 0===r?e:Math.max(r,e))}return void 0===s||void 0===r?b.DAY:(new w).calculateDistanceType(g.fromMillis(s),g.fromMillis(r))}(this.db,this.fromExpr,this.config.interval),this.intervalBuckets=function(t,e,i,o){const n=t.exec(`SELECT ${F(i)} as __interval FROM ${e}`);if(i===B){const t=new Set,e=[];for(const i of n){const o=Y(i.__interval);t.has(o)||(t.add(o),e.push({key:o,label:0===o.length?"-":o}))}return e}const s=new Set,r=[];for(const t of n){const e=H(t.__interval);if(!e)continue;const i=e.toISO();s.has(i)||(s.add(i),r.push(e))}r.sort(((t,e)=>t.toMillis()-e.toMillis()));const a=new w;return a.setLocale(o),r.map((t=>({key:t.toISO(),label:a.getDateString(t,i)})))}(this.db,this.fromExpr,this.config.interval,this.config.locale),0===this.intervalBuckets.length&&(this.config.interval=W))}normalizeScenarios(t,e,i,o=[]){var n,s;const r=[];if(o.length>0){for(const e of o)for(const o of t)r.push({name:o,group:o,type:o,order:(null===(n=null==i?void 0:i.hierarchy)||void 0===n?void 0:n.at(0))===o?i.direction:void 0,bucket:e.key,bucketLabel:e.label});return r}for(const o of t){if(null==e?void 0:e.has(o)){const t=e.get(o);for(const e of t){r.push({name:e.name,group:e.name,type:o,order:void 0});for(const t of e.subGroups)r.push({name:t,group:e.name,type:o,order:void 0})}r.push({name:"REST",group:"REST",type:o,order:void 0})}let t;(null===(s=null==i?void 0:i.hierarchy)||void 0===s?void 0:s.at(0))===o&&(t=i.direction),r.push({name:o,group:o,type:o,order:t})}return r}hasNoData(){return 0===this.rowCount}hasBlankRowGroup(){return this.dataSetFactory.hasBlankRowGroup}}class bt{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=d.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.attributes=[],this.sortOrder=new G(new T).default(),this.type=P.LIST,this.limit=0,this.i18n=u.ALL,this.categoryWidth=p.W25,this.measureScale=new N,this.measureUnit="",this.measureType=$.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[],this.interval="none",this.locale="de"}}class wt{constructor(t,e,i,o,n,s){this.tableDrillGroupAdapter=t,this.stringAdapter=e,this.orderAdapter=i,this.db=o,this.fromExpr=n,this.onQueryError=s}adapt(t){const e=new bt;return f.isString(t.title)&&(e.title=t.title),f.isArray(t.scenarios)&&(e.scenarios=U.adaptArray(t.scenarios,this.stringAdapter)),f.isExisting(t.scenariosUnitType)&&(e.scenariosUnitType=t.scenariosUnitType),f.isBoolean(t.grouped)&&(e.grouped=t.grouped),f.isBoolean(t.showGroupTitle)&&(e.showGroupTitle=t.showGroupTitle),f.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),f.isArray(t.thereOf)&&(e.thereOf=U.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),f.isExisting(t.categoryThereOf)&&(e.categoryThereOf=t.categoryThereOf),f.isArray(t.partOf)&&(e.partOf=U.adaptArray(t.partOf,this.tableDrillGroupAdapter)),f.isArray(t.attributes)&&(e.attributes=t.attributes),f.isExisting(t.order)&&(e.sortOrder=this.orderAdapter.adapt(t.order)),f.isExisting(t.type)&&(e.type=t.type),f.isNumber(t.limit)&&(e.limit=t.limit),f.isExisting(t.i18n)&&(e.i18n=t.i18n),f.isExisting(t.categoryWidth)&&(e.categoryWidth=t.categoryWidth),f.isExisting(t.measureScale)&&(e.measureScale=E.calculateMeasureScale(this.db,this.fromExpr,e.scenarios,t.measureScale,this.onQueryError)),f.isExisting(t.measureType)&&(e.measureType=t.measureType),f.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),f.isString(t.filter)&&(e.filter=t.filter.trim()),f.isArray(t.barColumns)&&(e.barColumns=t.barColumns),f.isString(t.interval)&&(e.interval=t.interval),f.isString(t.locale)&&(e.locale=t.locale),e}default(){return new bt}}class Rt{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class St{constructor(){}adapt(t){const e=new Rt;return f.isString(t.rowGroup)&&(e.rowGroup=t.rowGroup),f.isString(t.category)&&(e.category=t.category),f.isString(t.subCategory)&&(e.subCategory=t.subCategory),f.isString(t.partOf)&&(e.partOf=t.partOf),e}default(){return new Rt}}const yt=e(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.sumTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=d.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.thereof=[],this.partof=[],this.order={hierarchy:[],direction:A.ASC},this.categorythereof=new Map,this.attributeColumns=[],this.type=P.LIST,this.categoryWidth=p.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=u.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=$.VOLUME,this.filter="",this.barColumns=[],this.interval="none",this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new O,_(this),this.componentStyle=L(this)}async getLayoutDetail(t,e){var i,o,n;const r={regions:[],metadata:{},diagnostics:[]},a=null===(i=this.element.shadowRoot)||void 0===i?void 0:i.querySelector("table");if(r.metadata.hasNoData=null===(n=null===(o=this.table)||void 0===o?void 0:o.hasNoData())||void 0===n||n,!this.table||!a)return r;const l=a.querySelector("thead"),h=a.querySelector("tbody");l&&r.regions.push({id:"header",rect:s(l,t)}),h&&r.regions.push({id:"body",rect:s(h,t)});const c=this.table.getHeader(),u=this.table.getBody(),d=this.table.getColumns();if(r.metadata.headerRowCount=c.length,r.metadata.rowCount=u.length,r.metadata.columnCount=d.length,r.metadata.cellCount=u.reduce(((t,e)=>t+e.getCells().length),0),"full"!==e)return r;const f=[],p=[],$=(e,i,o)=>{const n=o?Array.from(o.children).filter((t=>"tr"===t.localName)):[];i.forEach(((i,o)=>{const a=n[o];if(!a)return;f.push({section:e,index:o,type:i.type,rect:s(a,t)});const l=i.getCells(),h=Array.from(a.children);l.length===h.length?l.forEach(((i,n)=>{var r,a;const l=h[n],c={kind:"header"===e?"headerCell":"cell",row:o,column:i.index,key:i.key||void 0,colSpan:i.colSpan,value:null!==(r=i.value)&&void 0!==r?r:void 0,text:(null===(a=l.textContent)||void 0===a?void 0:a.trim())||void 0,type:i.type||void 0,rect:s(l,t)},u=l.querySelector("svg.cell-bar-chart");u&&(c.bar={variant:u.classList.contains("waterfall-bar")?"waterfall":u.classList.contains("relative-variance")?"relative":"absolute",rect:s(u,t)}),p.push(c)})):r.diagnostics.push({id:`LAYOUT_cellPairing_${e}_${o}`,type:"warning",message:`layout-state: model/DOM cell count mismatch in ${e} row ${o} (${l.length} vs ${h.length}); cell details skipped for this row.`})}))};return $("header",c,l),$("body",u,h),r.elements=p,r.table={rows:f,columns:d.map(((t,e)=>({index:e,key:t.name,group:t.group,type:t.type,bucket:t.bucket})))},r}render(){var e;return t(o,{class:{"no-data":!0===(null===(e=this.table)||void 0===e?void 0:e.hasNoData())}},(()=>{var e,i,o,n;if(void 0===this.table)return;if(this.table.hasNoData()){const i=null!==(e=this.i18n.get("no-data"))&&void 0!==e?e:"No Data";return t("div",{class:"empty-state"},i)}const s=null===(n=null===(o=null===(i=this.stores)||void 0===i?void 0:i.context)||void 0===o?void 0:o.state)||void 0===n?void 0:n.locale;return t("table",null,t("thead",null,this.table.getHeader().map((e=>t("tr",{class:e.cssStyle},e.getCells().map((e=>t("th",{colSpan:e.colSpan,class:e.cssStyle},e.getAsHeaderList().map(((i,o,n)=>t("span",null,o===n.length-1?t("span",{class:" "===i?"table-footer":""},i,e.drawPrefix()," "):t("span",null,i,e.drawPrefix(),t("br",null)))))))))))),t("tbody",null,this.table.getBody().map((e=>t("tr",{class:e.cssStyle},null==e?void 0:e.getCells().map((i=>t("td",{colSpan:i.colSpan,class:i.type?`${i.cssStyle} ${i.type}`:i.cssStyle},null!=i.prefix?t("span",{class:i.cssStyle+" "+i.prefixStyle},i.drawPrefix()):"",i.isBarChart&&i.columnStats&&i.value!==m&&(void 0!==i.waterfall||e.type!==D.SUM)?void 0!==i.waterfall?t(ut,{value:i.value,scenario:i.key,columnStats:i.columnStats,height:18*this.scaleFactor,isRelative:!1,isPositiveGood:i.key.endsWith("_pos"),measureScale:i.measureScale,locale:s,columnWidthEm:this.barColumnMaxWidth,styles:this.barChartStyles,waterfall:i.waterfall}):t(ct,{value:i.value,scenario:i.key,columnStats:i.columnStats,height:18*this.scaleFactor,isRelative:i.key.startsWith("dr"),isPositiveGood:i.key.endsWith("_pos"),measureScale:"percentpoint"===i.type?.01:i.measureScale,locale:s,percentDigits:this.componentDataFormatDigits.percent,columnWidthEm:this.barColumnMaxWidth,styles:this.barChartStyles}):i.draw(this.componentDataFormatDigits,s)))))))))})())}componentWillRender(){var t,e,i,o,n;this.stores||(this.stores=y(this.element));const s=this.stores.db.db;this.componentDataFormatDigits=(new M).adapt(this.dataFormatDigits);try{const e=this.prepareConfig(s);this.table=new gt(new h(this.ruleSetConfig),s,this.tableName,e),this.table.setI18n(this.i18n),this.table.hasNoData()||this.table.getBody(),null===(t=this.errors)||void 0===t||t.remove("ERR_sql")}catch(t){console.error("ibcs-table: query failed",t),this.table=void 0,null===(e=this.errors)||void 0===e||e.addOrReplace({id:"ERR_sql",type:"error",message:`Query failed: ${t instanceof Error?t.message:t}`})}(null===(i=this.table)||void 0===i?void 0:i.hasBlankRowGroup())?null===(o=this.errors)||void 0===o||o.addOrReplace({id:"WARN_blankRowGroup",type:"warning",message:"grouped: rows with blank rowGroup found, they are grouped under '-'."}):null===(n=this.errors)||void 0===n||n.remove("WARN_blankRowGroup"),this.barChartStyles=this.prepareBarChartStyles()}prepareConfig(t){var e,i,o;const n=S(t,this.tableName,this.filter);return new wt(new St,new T,new G(new T),t,n,(t=>{throw t})).adapt({title:this.sumTitle,scenarios:this.scenarios,scenariosUnitType:this.scenariosDataFormat,grouped:this.grouped,showGroupTitle:this.showGroupTitle,thereOf:this.thereof,partOf:this.partof,categoryThereOf:this.categorythereof,attributes:this.attributeColumns,order:this.order,type:this.type,limit:this.limit,i18n:this.i18nMode,categoryWidth:this.categoryWidth,measureScale:this.measureScale,measureUnit:this.measureUnit,measureType:this.measureType,showMeasureScale:this.showMeasureScale,filter:this.filter,barColumns:this.barColumns,interval:this.interval,locale:(null===(o=null===(i=null===(e=this.stores)||void 0===e?void 0:e.context)||void 0===i?void 0:i.state)||void 0===o?void 0:o.locale)||"de"})}prepareBarChartStyles(){var t;const e=!(this.unitScaling>0),i=!(this.percentageScaling>0),o=e?this.autoUnitScaling():this.unitScaling,n=i?this.autoPercentageScaling():this.percentageScaling;return(e||i)&&(null===(t=this.reportAutoScaling)||void 0===t||t.call(this,{unit:e?o:void 0,percentage:i?n:void 0})),this.componentStyle((t=>{var e,i,s,r,a,l,h,c,u,d,f,p,$,m,v,g,b,w,R,S,y,E,O,M,U,G,T;const N=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.varianceStyles,_=null===(i=t["bn-chart-time"])||void 0===i?void 0:i.barStyles;return{positive:{stroke:(null===(s=null==N?void 0:N.pos)||void 0===s?void 0:s.stroke)||"#008f96",fill:(null===(r=null==N?void 0:N.pos)||void 0===r?void 0:r.fill)||"#008f96",fillpattern:C(null===(a=null==N?void 0:N.pos)||void 0===a?void 0:a.fillpattern)||"solid"},negative:{stroke:(null===(l=null==N?void 0:N.neg)||void 0===l?void 0:l.stroke)||"#ff0000",fill:(null===(h=null==N?void 0:N.neg)||void 0===h?void 0:h.fill)||"#ff0000",fillpattern:C(null===(c=null==N?void 0:N.neg)||void 0===c?void 0:c.fillpattern)||"solid"},neutral:{stroke:(null===(u=null==N?void 0:N.neu)||void 0===u?void 0:u.stroke)||"#808080",fill:(null===(d=null==N?void 0:N.neu)||void 0===d?void 0:d.fill)||"#808080",fillpattern:C(null===(f=null==N?void 0:N.neu)||void 0===f?void 0:f.fillpattern)||"outlined"},scenarios:{ac:{stroke:(null===(p=null==_?void 0:_.ac)||void 0===p?void 0:p.stroke)||"#404040",fill:(null===($=null==_?void 0:_.ac)||void 0===$?void 0:$.fill)||"#404040",fillpattern:C(null===(m=null==_?void 0:_.ac)||void 0===m?void 0:m.fillpattern)||"solid"},pp:{stroke:(null===(v=null==_?void 0:_.pp)||void 0===v?void 0:v.stroke)||"#A6A6A6",fill:(null===(g=null==_?void 0:_.pp)||void 0===g?void 0:g.fill)||"#A6A6A6",fillpattern:C(null===(b=null==_?void 0:_.pp)||void 0===b?void 0:b.fillpattern)||"solid"},fc:{stroke:(null===(w=null==_?void 0:_.fc)||void 0===w?void 0:w.stroke)||"#404040",fill:(null===(R=null==_?void 0:_.fc)||void 0===R?void 0:R.fill)||"#ffffff",fillpattern:C(null===(S=null==_?void 0:_.fc)||void 0===S?void 0:S.fillpattern)||"hatched"},pl:{stroke:(null===(y=null==_?void 0:_.pl)||void 0===y?void 0:y.stroke)||"#404040",fill:(null===(E=null==_?void 0:_.pl)||void 0===E?void 0:E.fill)||"#ffffff",fillpattern:C(null===(O=null==_?void 0:_.pl)||void 0===O?void 0:O.fillpattern)||"outlined"}},fontColor:(null===(M=t.global)||void 0===M?void 0:M.fontColor)||"#000000",fontSize:((null===(U=t.global)||void 0===U?void 0:U.fontSizePx)||13.3333)*V*this.scaleFactor,emPx:((null===(G=t.global)||void 0===G?void 0:G.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:(null===(T=t.global)||void 0===T?void 0:T.fontFamily)||"'Noto Sans', sans-serif",unitScaling:o,percentageScaling:n,scaleFactor:this.scaleFactor}}))}emPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.scaleFactor}autoUnitScaling(){const t=this.emPx(),e=t*V,{absMax:i,hasNeg:o,hasPos:n}=this.getAbsBarColumnStats();if(i<=0||e<=0)return.01;const{maxBarWidth:s,cutWidth:r}=q(this.barColumnMaxWidth,t,o,n);return Math.min(.8*s,r)/(i*e)}autoPercentageScaling(){const t=this.emPx(),e=t*V,{absMax:i,hasNeg:o,hasPos:n}=this.getRelativeBarColumnStats();if(i<=0||e<=0)return.5;const{maxPinLength:s}=Z(this.barColumnMaxWidth,t,o,n);return.8*s/(i*e)}getAbsBarColumnStats(){return this.collectBarColumnStats((t=>!t.key.startsWith("dr")&&!t.waterfall),1)}getRelativeBarColumnStats(){return this.collectBarColumnStats((t=>t.key.startsWith("dr")),100)}collectBarColumnStats(t,e){const i={absMax:0,hasNeg:!1,hasPos:!1};if(!this.table)return i;for(const o of this.table.getBody())if(o.type!==D.SUM)for(const n of o.getCells())n.isBarChart&&n.columnStats&&t(n)&&(i.absMax=Math.max(i.absMax,n.columnStats.absMax*e),i.hasNeg=i.hasNeg||n.columnStats.min<0,i.hasPos=i.hasPos||n.columnStats.max>0);return i}get element(){return this}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{position:relative;display:inline-block}table{background-color:var(--bn-font-background, white);font-size:var(--bn-font-size, 1em);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);border-spacing:0.3em 0}thead{border-style:none}tr:first-child td{border-top:none;padding-top:0.5em}td.ac1,td.ac2,td.ac3,td.ac4,td.pp1,td.pp2,td.pp3,td.pp4,td.pl1,td.pl2,td.pl3,td.pl4,td.fc1,td.fc2,td.fc3,td.fc4,td.share,td.variance,td.pos_pos,td.pos_neg,td.neg_pos,td.neg_neg,td.pos_neutral,td.neg_neutral{text-align:right}.category-w100{min-width:100em;max-width:100em}.category-w50{min-width:50em;max-width:50em}.category-w25{min-width:25em;max-width:25em}.category-w20{min-width:20em;max-width:20em}.category-w15{min-width:15em;max-width:15em}.category-w10{min-width:10em;max-width:10em}.category-w5{min-width:5em;max-width:5em}.prefix-second{color:transparent;font-style:normal}.prefix-first{font-style:normal}th{border-bottom:0.1em solid black;text-align:right;font-weight:normal;vertical-align:text-top}td.columnGroup,th.columnGroup{font-size:0.6em}td.columnSubGroup,th.columnSubGroup{font-size:0.6em;border-spacing:0em 0;font-style:italic}td.base,th.base{font-style:normal}th.ofit,td.ofit,tr.ofit,th.partof,td.partof,tr.partof{font-size:0.6em;font-style:italic}td.ofit,td.partof{font-size:0.6em;font-style:italic}th.ofit td,tr.ofit td,th.partof td,tr.partof td{border-top:0em solid black;padding-left:1em}th.ofit share,th.partof share,tr.share td{border-top:0em solid black}th.share,tr.share,td.share{font-size:0.6em;font-style:italic}th.filler{border-bottom:0em solid black;text-align:right}td.filler{border-top:0em none !important;border-bottom:0em none;text-align:right}th.group{text-align:center;border-spacing:1em 0}th.headerlabel{border-bottom:0em none black;padding-bottom:0em}th.intervalGroup{border-bottom:0.1em solid black;text-align:center;font-weight:bold}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal,td.percentpoint{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em dashed #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}'}},[1,"ibcs-table",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],selectedStyle:[513,"selected-style"],sumTitle:[1,"sum-title"],scenarios:[16],scenariosDataFormat:[1,"scenarios-data-format"],grouped:[4],limit:[2],showGroupTitle:[4,"show-group-title"],thereof:[16],partof:[16],order:[16],categorythereof:[16],attributeColumns:[16],type:[1],categoryWidth:[1,"category-width"],dataFormatDigits:[16],ruleSetConfig:[16],i18n:[1040],i18nMode:[1,"i18n-mode"],measureScale:[1,"measure-scale"],measureUnit:[1,"measure-unit"],showMeasureScale:[4,"show-measure-scale"],measureType:[1,"measure-type"],filter:[1],barColumns:[16],interval:[1],barColumnMaxWidth:[2,"bar-column-max-width"],unitScaling:[2,"unit-scaling"],percentageScaling:[2,"percentage-scaling"],reportAutoScaling:[16],errors:[16],scaleFactor:[2,"scale-factor"],getLayoutDetail:[64]}]);function Et(){"undefined"!=typeof customElements&&["ibcs-table"].forEach((t=>{"ibcs-table"===t&&(customElements.get(n(t))||customElements.define(n(t),yt))}))}export{yt as I,P as T,W as a,B as b,Et as d}
@@ -1 +1 @@
1
- import{proxyCustomElement as t,HTMLElement as s,h as i,transformTag as e}from"@stencil/core/internal/client";import{I as n,C as r}from"./CompareUtil.js";import{b as a,a as o,D as c}from"./DateStringFactory.js";import{F as h,I as l}from"./formatter.js";import{A as u,O as p,c as d}from"./Order.js";import{D as m}from"./luxon.js";import{S as f}from"./StringAdapter.js";import{s as b}from"./sanitizeHtml.js";class w{constructor(){}createMeasures(t,s,i){if(this.allMeasuresUseSameUnit(t)){const e=t.length;let r="",a="";for(let o=0;o<e;o++){let c="";o>0&&(c=s.get("SEPERATOR_WS")),e>1&&o===e-1&&(c=s.get("CONNECTOR_WS")),i===n.ALL?(r=(s.get(r)||r)+c+(s.get(t[o].name)||t[o].name),a=s.get(t[o].unit)||t[o].unit):(r=r+c+t[o].name,a=t[o].unit)}return[{name:r,unit:a}]}return t}createDimension(t,s,i,e,n,r="de"){let o="";if(void 0!==s){const t=new a;t.setLocale(r),o=t.getDateLinkString(s.start,s.end,s.link,s.format,n)}return o+t.map((t=>{let s="";return null!=i&&null!=i.hierarchy&&i.hierarchy.find((s=>s===t))&&(s=e.get("asc"===i.direction?"ORDER_asc":"ORDER_desc")),"".concat(" ",h.translateScenarioLabel(t,e),s)})).toString()}allMeasuresUseSameUnit(t){const s=new Map;return t.forEach((function(t){s.set(t.unit,!0)})),1===s.size}}class _{constructor(){this.businessunit="",this.measures=[],this.scenarios=[],this.i18nMode=n.ALL,this.intervalSpanLimit=32,this.locale="de"}}class v{constructor(t,s,i,e){this.measureEntryAdapter=t,this.timePeriodAdapter=s,this.orderAdapter=i,this.stringAdapter=e}adapt(t){const s=new _;return r.isString(t.businessunit)&&(s.businessunit=t.businessunit),r.isArray(t.measures)&&(s.measures=u.adaptArray(t.measures,this.measureEntryAdapter)),r.isArray(t.scenarios)&&(s.scenarios=u.adaptArray(t.scenarios,this.stringAdapter)),r.isExisting(t.timeperiod)&&(s.timeperiod=this.timePeriodAdapter.adapt(t.timeperiod)),r.isNumber(t.intervalSpanLimit)&&(s.intervalSpanLimit=t.intervalSpanLimit),r.isExisting(t.i18nMode)&&(s.i18nMode=t.i18nMode),r.isExisting(t.order)&&(s.order=this.orderAdapter.adapt(t.order)),r.isString(t.locale)&&(s.locale=t.locale),s}default(){return new _}}var R;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(R||(R={}));class y{constructor(t){this.i18n=new Map,this.unit="",this.measures=[],this.dimension="",this.config=new _,this.state=R.DIRTY,this.ruleSet=t||new l,this.dataSetFactory=new w,this.state=R.DIRTY,this.setI18n(new Map)}setRuleSet(t){this.ruleSet=t||new l}setI18n(t){this.state=R.DIRTY;const s=new Map([["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"],["CONNECTOR_WS"," und "]]);this.i18n=new Map([...s,...t||new Map])}update(){return R.DIRTY===this.state&&(this.unit=this.config.businessunit,this.measures=this.dataSetFactory.createMeasures(this.config.measures,this.i18n,this.config.i18nMode),this.dimension=this.dataSetFactory.createDimension(this.config.scenarios,this.config.timeperiod,this.config.order,this.i18n,this.config.intervalSpanLimit,this.config.locale),this.state=R.UP_TO_DATE),this}setConfig(t){this.config=this.initConfig(t)}initConfig(t){this.state=R.DIRTY;const s=t,i=this;return t.scenarios.sort(((t,s)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(s))),s}}class C{constructor(t="",s=""){this.name=t,this.unit=s}}class S{construnctor(){}adapt(t){const s=new C;return r.isString(t.name)&&(s.name=t.name),r.isString(t.unit)&&(s.unit=t.unit),s}default(){return new C("","")}}class E{constructor(t=m.now(),s=m.now(),i=o.AUTO,e=c.AUTO){this.start=t,this.end=s,this.format=i,this.link=e}}class O{construnctor(){}adapt(t){const s=new E;return r.isDate(t.start)&&(s.start=t.start),r.isDate(t.end)&&(s.end=t.end),r.isExisting(t.format)&&(s.format=t.format),r.isExisting(t.link)&&(s.link=t.link),s}default(){return new E}}const g=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.businessUnit="",this.scenarios=[],this.measures=[],this.intervalSpanLimit=28,this.order={hierarchy:[],direction:p.ASC},this.i18n=new Map,this.i18nMode=n.ALL,this.locale="de",this.title=new y(new l)}async setBusinessUnit(t){this.businessUnit=t}async setProps(t){Object.keys(t).forEach((s=>{this[s]=t[s]}))}render(){return i("div",{key:"4a675a92695130e13bd690587098cf70d81028c9"},i("div",{key:"54c98ac466109f4ea1306aa57379f5cb25cf654f",innerHTML:b(this.title.unit)}),i("div",{key:"35e8592454c45c06db9e3b6db5525165a3ee4a00"},this.title.measures.map(((t,s)=>i("span",null,this.isFirstElement(s)?this.title.i18n.get("SEPERATOR_WS"):"",i("span",{class:"measure"},t.name)," ",t.unit?this.title.i18n.get("in"):""," ",t.unit)))),i("div",{key:"29c93306567a592ac956d5c97501dc5e7acf90ec"},this.title.dimension))}componentWillLoad(){const t=this.prepareConfig();this.title=new y(new l(this.ruleSetConfig)),this.title.setI18n(this.i18n),this.title.setConfig(t)}componentWillUpdate(){const t=this.prepareConfig();this.title.setI18n(this.i18n),this.title.setRuleSet(new l(this.ruleSetConfig)),this.title.setConfig(t)}componentWillRender(){this.title.update()}isFirstElement(t){return 0!==t}prepareConfig(){return new v(new S,new O,new d(new f),new f).adapt({businessunit:this.businessUnit,measures:this.measures,scenarios:this.scenarios,timeperiod:this.timeperiod,intervalSpanLimit:this.intervalSpanLimit,i18nMode:this.i18nMode,order:this.order,locale:this.locale})}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)}.measure{font-weight:bold}div{background-color:var(--bn-font-background, white);color:var(--bn-font-color, black)}p{margin:0}'}},[1,"ibcs-title",{businessUnit:[1537,"business-unit"],scenarios:[16],measures:[16],timeperiod:[16],intervalSpanLimit:[2,"interval-span-limit"],order:[16],i18n:[1040],i18nMode:[1,"i18n-mode"],locale:[1],ruleSetConfig:[16],setBusinessUnit:[64],setProps:[64]}]);function P(){"undefined"!=typeof customElements&&["ibcs-title"].forEach((t=>{"ibcs-title"===t&&(customElements.get(e(t))||customElements.define(e(t),g))}))}export{g as I,P as d}
1
+ import{proxyCustomElement as t,HTMLElement as s,h as i,transformTag as e}from"@stencil/core/internal/client";import{I as n,C as r}from"./CompareUtil.js";import{b as o,D as a,a as c}from"./DateStringFactory.js";import{F as h,I as l}from"./formatter.js";import{A as u,a as p,c as d}from"./Order.js";import{D as f}from"./luxon.js";import{S as m}from"./StringAdapter.js";import{s as b}from"./sanitizeHtml.js";import{w}from"./withComponentStatus.js";class _{constructor(){}createMeasures(t,s,i){if(this.allMeasuresUseSameUnit(t)){const e=t.length;let r="",o="";for(let a=0;a<e;a++){let c="";a>0&&(c=s.get("SEPERATOR_WS")),e>1&&a===e-1&&(c=s.get("CONNECTOR_WS")),i===n.ALL?(r=(s.get(r)||r)+c+(s.get(t[a].name)||t[a].name),o=s.get(t[a].unit)||t[a].unit):(r=r+c+t[a].name,o=t[a].unit)}return[{name:r,unit:o}]}return t}createDimension(t,s,i,e,n,r="de"){let a="";if(void 0!==s){const t=new o;t.setLocale(r),a=t.getDateLinkString(s.start,s.end,s.link,s.format,n)}return a+t.map((t=>{let s="";return null!=i&&null!=i.hierarchy&&i.hierarchy.find((s=>s===t))&&(s=e.get("asc"===i.direction?"ORDER_asc":"ORDER_desc")),"".concat(" ",h.translateScenarioLabel(t,e),s)})).toString()}allMeasuresUseSameUnit(t){const s=new Map;return t.forEach((function(t){s.set(t.unit,!0)})),1===s.size}}class v{constructor(){this.businessunit="",this.measures=[],this.scenarios=[],this.i18nMode=n.ALL,this.intervalSpanLimit=32,this.locale="de"}}class C{constructor(t,s,i,e){this.measureEntryAdapter=t,this.timePeriodAdapter=s,this.orderAdapter=i,this.stringAdapter=e}adapt(t){const s=new v;return r.isString(t.businessunit)&&(s.businessunit=t.businessunit),r.isArray(t.measures)&&(s.measures=u.adaptArray(t.measures,this.measureEntryAdapter)),r.isArray(t.scenarios)&&(s.scenarios=u.adaptArray(t.scenarios,this.stringAdapter)),r.isExisting(t.timeperiod)&&(s.timeperiod=this.timePeriodAdapter.adapt(t.timeperiod)),r.isNumber(t.intervalSpanLimit)&&(s.intervalSpanLimit=t.intervalSpanLimit),r.isExisting(t.i18nMode)&&(s.i18nMode=t.i18nMode),r.isExisting(t.order)&&(s.order=this.orderAdapter.adapt(t.order)),r.isString(t.locale)&&(s.locale=t.locale),s}default(){return new v}}var R;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(R||(R={}));class S{constructor(t){this.i18n=new Map,this.unit="",this.measures=[],this.dimension="",this.config=new v,this.state=R.DIRTY,this.ruleSet=t||new l,this.dataSetFactory=new _,this.state=R.DIRTY,this.setI18n(new Map)}setRuleSet(t){this.ruleSet=t||new l}setI18n(t){this.state=R.DIRTY;const s=new Map([["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"],["CONNECTOR_WS"," und "]]);this.i18n=new Map([...s,...t||new Map])}update(){return R.DIRTY===this.state&&(this.unit=this.config.businessunit,this.measures=this.dataSetFactory.createMeasures(this.config.measures,this.i18n,this.config.i18nMode),this.dimension=this.dataSetFactory.createDimension(this.config.scenarios,this.config.timeperiod,this.config.order,this.i18n,this.config.intervalSpanLimit,this.config.locale),this.state=R.UP_TO_DATE),this}setConfig(t){this.config=this.initConfig(t)}initConfig(t){this.state=R.DIRTY;const s=t,i=this;return t.scenarios.sort(((t,s)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(s))),s}}class y{constructor(t="",s=""){this.name=t,this.unit=s}}class E{construnctor(){}adapt(t){const s=new y;return r.isString(t.name)&&(s.name=t.name),r.isString(t.unit)&&(s.unit=t.unit),s}default(){return new y("","")}}class O{constructor(t=f.now(),s=f.now(),i=a.AUTO,e=c.AUTO){this.start=t,this.end=s,this.format=i,this.link=e}}class g{construnctor(){}adapt(t){const s=new O;return r.isDate(t.start)&&(s.start=t.start),r.isDate(t.end)&&(s.end=t.end),r.isExisting(t.format)&&(s.format=t.format),r.isExisting(t.link)&&(s.link=t.link),s}default(){return new O}}const P=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.businessUnit="",this.scenarios=[],this.measures=[],this.intervalSpanLimit=28,this.order={hierarchy:[],direction:p.ASC},this.i18n=new Map,this.i18nMode=n.ALL,this.locale="de",this.title=new S(new l),w(this)}async setBusinessUnit(t){this.businessUnit=t}async setProps(t){Object.keys(t).forEach((s=>{this[s]=t[s]}))}render(){return i("div",{key:"68a7e372d76be178503c975f345429b7ecf46680"},i("div",{key:"f76203c7c56228f71226596bd6fc21f4308dc0b0",innerHTML:b(this.title.unit)}),i("div",{key:"8f0b7907d043b9564b51f51780abebb831b71651"},this.title.measures.map(((t,s)=>i("span",null,this.isFirstElement(s)?this.title.i18n.get("SEPERATOR_WS"):"",i("span",{class:"measure"},t.name)," ",t.unit?this.title.i18n.get("in"):""," ",t.unit)))),i("div",{key:"f05ed5b36f8b362c1daa19c1c40502b346046a19"},this.title.dimension))}componentWillLoad(){const t=this.prepareConfig();this.title=new S(new l(this.ruleSetConfig)),this.title.setI18n(this.i18n),this.title.setConfig(t)}componentWillUpdate(){const t=this.prepareConfig();this.title.setI18n(this.i18n),this.title.setRuleSet(new l(this.ruleSetConfig)),this.title.setConfig(t)}componentWillRender(){this.title.update()}isFirstElement(t){return 0!==t}prepareConfig(){return new C(new E,new g,new d(new m),new m).adapt({businessunit:this.businessUnit,measures:this.measures,scenarios:this.scenarios,timeperiod:this.timeperiod,intervalSpanLimit:this.intervalSpanLimit,i18nMode:this.i18nMode,order:this.order,locale:this.locale})}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)}.measure{font-weight:bold}div{background-color:var(--bn-font-background, white);color:var(--bn-font-color, black)}p{margin:0}'}},[1,"ibcs-title",{businessUnit:[1537,"business-unit"],scenarios:[16],measures:[16],timeperiod:[16],intervalSpanLimit:[2,"interval-span-limit"],order:[16],i18n:[1040],i18nMode:[1,"i18n-mode"],locale:[1],ruleSetConfig:[16],setBusinessUnit:[64],setProps:[64]}]);function M(){"undefined"!=typeof customElements&&["ibcs-title"].forEach((t=>{"ibcs-title"===t&&(customElements.get(e(t))||customElements.define(e(t),P))}))}export{P as I,M as d}
@@ -0,0 +1 @@
1
+ function n(n,e,t=80){let o=null,l=!1,i=-1,u=-1;const r=function(n){var e;const t=n.parentElement;return(null===(e=null==t?void 0:t.assignedSlot)||void 0===e?void 0:e.parentElement)?t.assignedSlot.parentElement:t}(n);if(!r)return{disconnect(){}};const c=new ResizeObserver((n=>{var c;if(l)return;let s,v;const d=n[0];if(null===(c=null==d?void 0:d.contentBoxSize)||void 0===c?void 0:c.length){const n=d.contentBoxSize[0];s=n.inlineSize,v=n.blockSize}else s=r.clientWidth,v=r.clientHeight;Math.abs(s-i)<=2&&Math.abs(v-u)<=2||(i=s,u=v,null!=o&&clearTimeout(o),o=setTimeout((()=>{l||e()}),t))}));return c.observe(r),{disconnect(){l=!0,null!=o&&clearTimeout(o),c.disconnect()}}}export{n as o}
@@ -0,0 +1 @@
1
+ const e=new Map([["split-vertical",'"a b"'],["split-horizontal",'"a" "b"'],["2x2",'"a b" "c d"'],["3x3",'"a b c" "d e f" "g h i"'],["4x4",'"a b c d" "e f g h" "i j k l" "m n o p"'],["1-over-2",'"a a" "b c"'],["2-over-1",'"a b" "c c"'],["1-over-3",'"a a a " "b c d"'],["3-over-1",'"a b c" "d d d"'],["gold3",'"a c" "b c"'],["gold4",'"a b c c" "d d c c"']]),o="custom-template",a=/"[\w\d\s.]+"|'[\w\d\s.]+'/g,n=/"[^"]*"|'[^']*'/g;function r(e){var o;return(null!==(o=null==e?void 0:e.match(a))&&void 0!==o?o:[]).map((e=>e.slice(1,-1).split(/\s+/).filter((e=>""!==e)))).filter((e=>e.length>0))}function t(a){return a===o||e.has(a)}function l(a,n){var t;return a===o?r(n).length>0?n:'"a"':null!==(t=e.get(a))&&void 0!==t?t:'"a"'}function i(e){var o;const a=(null===(o=r(e)[0])||void 0===o?void 0:o.length)||1;return Array(a).fill("minmax(0, 1fr)").join(" ")}function d(e){var o;return Array.from(new Set(null!==(o=null==e?void 0:e.match(/\b\w+\b/g))&&void 0!==o?o:[]))}function s(e){var o;const a=r(e);if(0===a.length)return'no row found, the layout is drawn as a single cell. Write one quoted row per grid row, e.g. \'"a a" "b c"\'.';const t=null!==(o=null==e?void 0:e.match(n))&&void 0!==o?o:[];return t.some((e=>""===e.slice(1,-1).trim()))?"a pair of quotes holds no cell, so the browser ignores the template.":t.length!==a.length?"a row cannot be read. Use only letters, digits, '_' and '.' in a cell name, and open and close every row with the same kind of quote.":a.some((e=>e.length!==a[0].length))?"the rows have different numbers of cells, so the browser ignores the template.":void 0}export{o as C,r as a,d as b,l as c,s as d,t as i,i as t}
@@ -0,0 +1 @@
1
+ const n={xga:[1024,768,"px"],hd:[1280,720,"px"],"full-hd":[1920,1080,"px"],"4k":[3840,2160,"px"],"4k2k":[4096,2160,"px"],a6:[4.13,5.83,"in"],a5:[5.83,8.27,"in"],a4:[8.27,11.69,"in"],a3:[11.69,16.54,"in"],a2:[16.54,23.39,"in"],a1:[23.39,33.11,"in"],a0:[33.11,46.81,"in"],letter:[8.5,11,"in"],legal:[8.5,14,"in"],tabloid:[11,17,"in"],ledger:[17,11,"in"]},t=Object.keys(n),i=["landscape","portrait"];function a(a,e){const r=null!=a&&t.includes(a),[l,h,o]=n[r?a:"xga"],s=l>=h?"landscape":"portrait",d=r&&i.includes(null!=e?e:"")?e:s,[p,u]=d===s?[l,h]:[h,l];return{width:`${p}${o}`,height:`${u}${o}`,orientation:d}}function e(n,t,e){const r=a(n,t),l=i.includes(null!=e?e:"")&&e!==r.orientation;return l?{width:r.height,height:r.width,turned:l}:{width:r.width,height:r.height,turned:l}}function r(n,t,i){const{width:a,height:r}=e(n,t,i);return`@page { size: ${a} ${r}; }`}export{t as V,i as a,r as b,a as p,e as s}
@@ -0,0 +1 @@
1
+ function t(t,e=!1){const a=n(t);if(!a)return e&&console.log("[parentDims] no layout parent found for",t.tagName),{width:0,height:0};const i=getComputedStyle(a),l=a.clientWidth-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight),r=function(t,e=!1){let a=n(t),i=0,l=null,r=1;for(;a;){if(a.hasAttribute("data-bn-fit-content")){e&&console.log(`[height:${i}]`,a.tagName,"fit-content region → discarding inner candidate"),l=null;const t=parseInt(a.getAttribute("data-bn-fit-content"),10);!isNaN(t)&&t>1&&(r*=t),a=o(a),i++;continue}const t=getComputedStyle(a),n=t.overflowY;if(e&&console.log(`[height:${i}]`,a.tagName,a.className||"(no class)",`overflow=${n} clientH=${a.clientHeight} h=${t.height}`),null===l)if("hidden"===n||"scroll"===n||"auto"===n)l=a.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom),e&&console.log(`[height] candidate at depth ${i}: ${Math.round(l)}px`);else if("none"!==t.maxHeight){const n=parseFloat(t.maxHeight);!isNaN(n)&&n>0&&(l=Math.min(n,a.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)))}a=o(a),i++}return null!==l?l/r:(e&&console.log("[height] NO constrained ancestor → viewport fallback"),"undefined"!=typeof window?window.innerHeight/r:0)}(t,e);return e&&console.log("[parentDims]",t.tagName,"→ layoutParent:",a.tagName,a.className||"(no class)",`clientW=${a.clientWidth} → w=${Math.round(l)}, h=${Math.round(r)}`,"overflow:",i.overflow),{width:Math.max(0,l),height:Math.max(0,r)}}function n(t){var n;const o=t.parentElement;return(null===(n=null==o?void 0:o.assignedSlot)||void 0===n?void 0:n.parentElement)?o.assignedSlot.parentElement:o}function o(t){var n;if(null===(n=t.assignedSlot)||void 0===n?void 0:n.parentElement)return t.assignedSlot.parentElement;if(t.parentElement)return t.parentElement;const o=t.getRootNode();return o instanceof ShadowRoot?o.host:null}function e(t,n){const e=t.getBoundingClientRect(),a=t.offsetHeight>0?e.height/t.offsetHeight:0;if(!(a>0)||Math.abs(a-(t.offsetWidth>0?e.width/t.offsetWidth:0))>.01*a)return 0;const i=e.top+n*a;let l=0;for(let n=t;n;n=o(n)){const t=getComputedStyle(n).overflowY;if("hidden"===t||"clip"===t)l=Math.max(l,i-n.getBoundingClientRect().bottom);else if(("auto"===t||"scroll"===t)&&n.scrollHeight>n.clientHeight+1)break}return l/a}export{e as a,t as g}
@@ -0,0 +1 @@
1
+ const r=r=>r instanceof Error?r.message:String(r),e=(r,e)=>{void 0===e?null==r||r.remove("ERR_sql"):null==r||r.addOrReplace({id:"ERR_sql",type:"error",message:`Query failed: ${e}`})};export{r as e,e as r}
@@ -0,0 +1 @@
1
+ const t="n/a";function a(t,a){if(!(Math.abs(a)<=1e-9*Math.abs(t)))return t/Math.abs(a)}export{t as N,a as r}
@@ -1 +1 @@
1
- const t=new Set(["br","b","i","strong","em","span","p","div","table","tr","td","th","thead","tbody","tfoot","ul","ol","li","h1","h2","h3","h4","h5","h6","sub","sup","small","hr","a","img"]),s=new Set(["class","style","colspan","rowspan","href","title","src","alt","width","height"]);function o(t){if(!t)return"";const s=document.createElement("div");return s.innerHTML=t,e(s),s.innerHTML}function e(o){for(const n of Array.from(o.childNodes)){if(n.nodeType!==Node.ELEMENT_NODE)continue;const r=n;if(t.has(r.tagName.toLowerCase())){for(const t of Array.from(r.attributes)){const o=t.name.toLowerCase();o.startsWith("on")||!s.has(o)?r.removeAttribute(t.name):"href"!==o&&"src"!==o||!/^\s*javascript:/i.test(t.value)?"style"===o&&/expression|javascript/i.test(t.value)&&r.removeAttribute(t.name):r.removeAttribute(t.name)}e(r)}else o.replaceChild(document.createTextNode(r.textContent||""),r)}}export{o as s}
1
+ const t=new Set(["br","b","i","strong","em","span","p","div","table","tr","td","th","thead","tbody","tfoot","ul","ol","li","h1","h2","h3","h4","h5","h6","sub","sup","small","hr","a","img","code","pre","blockquote","del"]),e=new Set(["class","style","colspan","rowspan","href","title","src","alt","width","height"]),n=new Set(["http:","https:","mailto:"]),o=/^\s*text-align:\s*(left|center|right)\s*;?\s*$/i;function r(t){if(!t)return"";const e=(new DOMParser).parseFromString(t,"text/html").body;return s(e),e.innerHTML}function s(n){for(const r of Array.from(n.childNodes)){if(r.nodeType===Node.TEXT_NODE)continue;const l=r;if(r.nodeType!==Node.ELEMENT_NODE||!t.has(l.localName)){n.removeChild(r);continue}for(const t of Array.from(l.attributes)){const n=t.name.toLowerCase();e.has(n)&&("href"!==n&&"src"!==n||c(n,t.value))||l.removeAttribute(t.name)}const h=l.getAttribute("style");null===h||o.test(h)||l.removeAttribute("style"),s(l)}}function c(t,e){try{const{protocol:o}=new URL(e,"http://a");return n.has(o)||"src"===t&&"data:"===o}catch(t){return!1}}export{r as s}
@@ -1 +1 @@
1
- const n=["pl","fc","pp","ac"];function f(n){return n.replace(/\d+$/,"")}function t(n){return.299*parseInt(n.slice(1,3),16)+.587*parseInt(n.slice(3,5),16)+.114*parseInt(n.slice(5,7),16)>128?"#000000":"#ffffff"}export{n as I,f as a,t as g}
1
+ const n=["pl","fc","pp","ac"];function t(n){return n.replace(/\d+$/,"")}function r(n){const t=function(n){const t=/^#([0-9a-f]+)$/i.exec(n.trim());if(t){const n=t[1];return 3===n.length||4===n.length?[0,1,2].map((t=>parseInt(n[t]+n[t],16))):6===n.length||8===n.length?[0,2,4].map((t=>parseInt(n.slice(t,t+2),16))):null}const r=/^rgba?\(\s*([\d.]+%?)[\s,]+([\d.]+%?)[\s,]+([\d.]+%?)/i.exec(n.trim());return r?r.slice(1,4).map((n=>n.endsWith("%")?2.55*parseFloat(n):parseFloat(n))):null}(n);if(null===t)return"#000000";const[r,s,a]=t;return.299*r+.587*s+.114*a>128?"#000000":"#ffffff"}export{n as I,t as a,r as g}
@@ -0,0 +1 @@
1
+ const t=.001;function n(t){return null!=t.fixedDomain?Math.max(0,t.fixedDomain):t.relativeVariance?0:Math.max(0,t.maxPositive)+Math.abs(Math.min(0,t.minNegative))}function a(t){var n;if(!t.relativeVariance)return 0;const a=null!==(n=t.sideClamp)&&void 0!==n?n:1.45;return Math.min(a,Math.max(0,t.maxPositive))+Math.min(a,Math.abs(Math.min(0,t.minNegative)))}function e(t){const n=t.unitExtent+t.pctExtent;if(n<=0)return{};const a=Math.max(.001,(t.target-(t.measured-t.unitExtent*t.currentPpu-t.pctExtent*t.currentPpp))/n);return{ppu:t.unitExtent>0?a:void 0,ppp:t.pctExtent>0?a:void 0}}function r(t,n=0){let a=0,e=0,r=0;const o=t.map((t=>{const n=Number.isFinite(t)?t:0;if(r+=n,n<0||Object.is(n,-0)){const t=0-e;return e-=n,{value:n,start:t,end:0-e}}const o=a;return a+=n,{value:n,start:o,end:a}})),s=a+e;let u=1;return n>0&&(u=s>0?n/s:0),{segments:o.map((t=>({start:t.start*u,end:t.end*u,share:s>0?t.value/s:0}))),positive:a*u,negative:e*u,total:r}}function o(t){const n={positive:0,negative:0,maxTotal:0,minTotal:0};for(const a of t)n.positive=Math.max(n.positive,a.positive),n.negative=Math.max(n.negative,a.negative),n.maxTotal=Math.max(n.maxTotal,a.total),n.minTotal=Math.min(n.minTotal,a.total);return n}function s(t,n=()=>0){const a=t[t.length-1],e=null!=a&&a.total<0,r=t.map((t=>(e?t.positive:t.negative)+((e?t.total>=0:t.total<0)?n(t):0)));return{flipped:e,clearance:Math.max(0,...r)}}export{t as M,a,s as b,n as c,e as d,r as l,o as s}