@bino-bi/bn-template-engine 1.0.0-alpha.7 → 1.0.0-alpha.8

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 (107) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-0d41c5d8.entry.js +1 -0
  3. package/dist/bn-template-engine/p-67538176.entry.js +1 -0
  4. package/dist/bn-template-engine/p-825a07a8.entry.js +1 -0
  5. package/dist/bn-template-engine/p-916296a5.entry.js +1 -0
  6. package/dist/bn-template-engine/{p-1164c0b0.entry.js → p-96006b06.entry.js} +1 -1
  7. package/dist/bn-template-engine/p-B4JfKvVT.js +1 -0
  8. package/dist/bn-template-engine/{p-JNHhIe7t.js → p-B_d-jp99.js} +1 -1
  9. package/dist/bn-template-engine/p-Ck-NYtot.js +1 -0
  10. package/dist/bn-template-engine/p-CnDq0oVa.js +1 -0
  11. package/dist/bn-template-engine/p-DSXNgKLa.js +1 -0
  12. package/dist/bn-template-engine/p-bc711fb0.entry.js +1 -0
  13. package/dist/bn-template-engine/p-e6f646b1.entry.js +1 -0
  14. package/dist/bn-template-engine/p-f41d9242.entry.js +1 -0
  15. package/dist/bn-template-engine/{p-B0lsgVuN.js → p-gFbbuhtl.js} +1 -1
  16. package/dist/cjs/{SVGVariancesStyleGroup-BqAdPYtL.js → bn-asset_20.cjs.entry.js} +21948 -6938
  17. package/dist/cjs/bn-grid.cjs.entry.js +6 -9
  18. package/dist/cjs/bn-image.cjs.entry.js +6 -9
  19. package/dist/cjs/bn-internationalization.cjs.entry.js +5 -6
  20. package/dist/cjs/bn-template-engine.cjs.js +2 -2
  21. package/dist/cjs/bn-template.cjs.entry.js +3 -4
  22. package/dist/cjs/bn-text.cjs.entry.js +7 -10
  23. package/dist/cjs/bn-tree.cjs.entry.js +6 -9
  24. package/dist/cjs/{context-protocol-DRQWrwsA.js → context-protocol-ohYzcb5F.js} +1 -1
  25. package/dist/cjs/editor-companion.cjs.entry.js +2 -2
  26. package/dist/cjs/{index-Cjw0q6gP.js → index-CDKG4xmO.js} +1 -0
  27. package/dist/cjs/loader.cjs.js +2 -2
  28. package/dist/cjs/{scaling-BidPsO53.js → scaling-CIAClQR5.js} +3 -3
  29. package/dist/cjs/{withBodyObserver-C6gLgq_e.js → withBodyObserver-D7BKWN2N.js} +2 -2
  30. package/dist/cjs/{withHasError-B8gHkfV2.js → withHasError-Cl2gTQzA.js} +106 -2
  31. package/dist/cjs/{Order-BGx39pS5.js → withStyled-qd94SSb4.js} +648 -6
  32. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +20 -4
  33. package/dist/collection/components/bn-chart-time/bn-chart-time.js +20 -4
  34. package/dist/collection/components/bn-layout-card/bn-layout-card.js +12 -6
  35. package/dist/collection/components/bn-layout-page/bn-layout-page.js +12 -7
  36. package/dist/collection/components/bn-table/bn-table.js +25 -7
  37. package/dist/collection/components/bn-table/ibcs-table.js +68 -3
  38. package/dist/components/bn-chart-structure.js +1 -1
  39. package/dist/components/bn-chart-time.js +1 -1
  40. package/dist/components/bn-layout-card.js +1 -1
  41. package/dist/components/bn-layout-page.js +1 -1
  42. package/dist/components/bn-table.js +1 -1
  43. package/dist/components/ibcs-table2.js +1 -1
  44. package/dist/esm/{SVGVariancesStyleGroup-DOIT-zvI.js → bn-asset_20.entry.js} +22048 -7042
  45. package/dist/esm/bn-grid.entry.js +4 -7
  46. package/dist/esm/bn-image.entry.js +4 -7
  47. package/dist/esm/bn-internationalization.entry.js +4 -5
  48. package/dist/esm/bn-template-engine.js +3 -3
  49. package/dist/esm/bn-template.entry.js +2 -3
  50. package/dist/esm/bn-text.entry.js +5 -8
  51. package/dist/esm/bn-tree.entry.js +4 -7
  52. package/dist/esm/{context-protocol-2peaD4y8.js → context-protocol-DdbSplvE.js} +2 -2
  53. package/dist/esm/editor-companion.entry.js +2 -2
  54. package/dist/esm/{index-JNHhIe7t.js → index-B_d-jp99.js} +1 -1
  55. package/dist/esm/loader.js +3 -3
  56. package/dist/esm/{scaling-BOcjT8M0.js → scaling-DGKKkuL9.js} +4 -4
  57. package/dist/esm/{withBodyObserver-DczL5ia8.js → withBodyObserver-AFk2wwHT.js} +2 -2
  58. package/dist/esm/{withHasError-B3QX2emi.js → withHasError-DW_vMDUp.js} +106 -2
  59. package/dist/esm/{Order-sRO-lj7X.js → withStyled-BIkqU2w4.js} +616 -1
  60. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +1 -0
  61. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +1 -0
  62. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +8 -2
  63. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +8 -3
  64. package/dist/types/components/bn-table/ibcs-table.d.ts +19 -0
  65. package/dist/types/components.d.ts +8 -8
  66. package/package.json +1 -1
  67. package/dist/bn-template-engine/p-0fabe296.entry.js +0 -1
  68. package/dist/bn-template-engine/p-355abdf0.entry.js +0 -1
  69. package/dist/bn-template-engine/p-79KuA4Ox.js +0 -1
  70. package/dist/bn-template-engine/p-859cc06d.entry.js +0 -1
  71. package/dist/bn-template-engine/p-8acec99e.entry.js +0 -1
  72. package/dist/bn-template-engine/p-8f490c45.entry.js +0 -1
  73. package/dist/bn-template-engine/p-9721a5bb.entry.js +0 -1
  74. package/dist/bn-template-engine/p-9a564f8f.entry.js +0 -1
  75. package/dist/bn-template-engine/p-9cee22fa.entry.js +0 -1
  76. package/dist/bn-template-engine/p-B7p8beYH.js +0 -1
  77. package/dist/bn-template-engine/p-BDh7GfC5.js +0 -1
  78. package/dist/bn-template-engine/p-BoMtoHJB.js +0 -1
  79. package/dist/bn-template-engine/p-Bs8BqBsb.js +0 -1
  80. package/dist/bn-template-engine/p-CYjZRKdI.js +0 -1
  81. package/dist/bn-template-engine/p-DG-1MR_T.js +0 -1
  82. package/dist/bn-template-engine/p-Dnkv5rt8.js +0 -1
  83. package/dist/bn-template-engine/p-bdd2b243.entry.js +0 -1
  84. package/dist/bn-template-engine/p-f27995c9.entry.js +0 -1
  85. package/dist/bn-template-engine/p-f6ecb265.entry.js +0 -1
  86. package/dist/bn-template-engine/p-sRO-lj7X.js +0 -1
  87. package/dist/bn-template-engine/p-tzFCK9qn.js +0 -1
  88. package/dist/cjs/bn-asset_16.cjs.entry.js +0 -9099
  89. package/dist/cjs/bn-card.cjs.entry.js +0 -36
  90. package/dist/cjs/bn-chart-time.cjs.entry.js +0 -1031
  91. package/dist/cjs/bn-layout-card.cjs.entry.js +0 -279
  92. package/dist/cjs/formatter-4XCS0d2B.js +0 -221
  93. package/dist/cjs/ibcs-chart-time.cjs.entry.js +0 -4137
  94. package/dist/cjs/withComponentStatus-_x4LQZ0N.js +0 -109
  95. package/dist/cjs/withComponentStyle-ClSJfCku.js +0 -128
  96. package/dist/cjs/withInheritedProps-BH2KNER3.js +0 -157
  97. package/dist/cjs/withStyled-9tG024gQ.js +0 -522
  98. package/dist/esm/bn-asset_16.entry.js +0 -9082
  99. package/dist/esm/bn-card.entry.js +0 -34
  100. package/dist/esm/bn-chart-time.entry.js +0 -1029
  101. package/dist/esm/bn-layout-card.entry.js +0 -277
  102. package/dist/esm/formatter-BDh7GfC5.js +0 -215
  103. package/dist/esm/ibcs-chart-time.entry.js +0 -4135
  104. package/dist/esm/withComponentStatus-DodoSXe-.js +0 -107
  105. package/dist/esm/withComponentStyle-D3VWOsto.js +0 -126
  106. package/dist/esm/withInheritedProps-BlXDxhHK.js +0 -154
  107. package/dist/esm/withStyled-CE3_3taP.js +0 -495
@@ -1 +1 @@
1
- import{proxyCustomElement as t,HTMLElement as e,h as r,Fragment as i,transformTag as s}from"@stencil/core/internal/client";import{g as a}from"./context-protocol.js";import{a as o}from"./withHasError.js";import{w as n}from"./withInheritedProps.js";import{d as c}from"./bn-body2.js";import{d as l}from"./bn-card2.js";import{d}from"./bn-footer2.js";import{d as h}from"./bn-title2.js";import{d as m}from"./ibcs-title2.js";const b=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.titleImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.titleNamespace="_system",this.footerText="",this.cardLayout="full",this.cardCustomTemplate='"a b" "c d"',this.cardGridGap="0",this.cardFitToContent=!0,this.cardShowBorder=!0,this.templateMap=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"'],["custom-template",'"a b" "c c c"'],["gold3",'"a c" "b c"'],["gold4",'"a b c c" "d d c c"']]),this.errors=o(this),this.resolveInherited=n(this,[{propName:"titleScenarios",ancestorAttr:"title-scenarios"},{propName:"titleVariances",ancestorAttr:"title-variances"},{propName:"titleOrder",ancestorAttr:"title-order"},{propName:"titleOrderDirection",ancestorAttr:"title-order-direction"}])}connectedCallback(){this.stores=a(this.element),this.reflectInheritedAttrs()}getCommonStyles(){let t="100%",e="100%";return!0===this.cardFitToContent&&(e="fit-content",t="fit-content"),{display:"grid",height:t,width:e,gap:this.cardGridGap+"px"}}calculatePercentages(t){const e=t.trim().split(/\s+/).length;if(0===e)return"100%";const r=(100/e).toFixed(0)+"%";return Array(e).fill(r).join(" ")}getGridTemplateColumns(t){const e=this.getTemplatePattern(t).match(/"[\w\d\s.]+"/g);return e&&0!==e.length?this.calculatePercentages(e[0]):"100%"}getGridTemplateRows(t){const e=this.getTemplatePattern(t).match(/"[\w\d\s.]+"/g),r=e?e.length:1;return this.cardFitToContent?Array(r).fill("auto").join(" "):Array(r).fill("1fr").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplatePattern(this.cardLayout),"grid-template-columns":this.getGridTemplateColumns(this.cardLayout),"grid-template-rows":this.getGridTemplateRows(this.cardLayout)})}createDivAreaStyles(t){return t.map((t=>({width:"100%",overflow:"hidden","grid-area":t,height:"100%"})))}getSlots(t){const e=this.createDivAreaStyles(t);return r(i,null,e.map(((t,e)=>r("div",{style:t},r("slot",{name:"card-slot-"+e})))))}extractSlotNames(t){if(null==t)return[];const e=t.match(/\b\w+\b/g);return e?Array.from(new Set(e)):[]}getTemplatePattern(t){return!1===this.templateMap.has(t)&&"custom-template"!==t?'"a"':"custom-template"===t?this.cardCustomTemplate:this.templateMap.get(t)}async getNumberOfSlot(t){const e=this.getTemplatePattern(t);return this.extractSlotNames(e).length}componentDidUpdate(){}setCardClass(){return!0===this.cardShowBorder?"card_box border":"card_box"}reflectInheritedAttrs(){const t=[{prop:"titleScenarios",attr:"title-scenarios"},{prop:"titleVariances",attr:"title-variances"},{prop:"titleOrder",attr:"title-order"},{prop:"titleOrderDirection",attr:"title-order-direction"}];for(const{prop:e,attr:r}of t){const t=this.resolveInherited(e,this[e]);void 0!==t&&this.element.setAttribute(r,t)}}prepareTitleImage(t){if(null==t||""===t)return"";const e=this.stores.assets.state;return t.startsWith("asset:")?e[t.substring(6)]:e[t]||t}render(){var t,e,i,s;const a=this.getLayoutStyle(),o=this.extractSlotNames(a["grid-template-areas"]);return r("bn-card",{key:"1dfcca605e2780bdfbb0108a5f34ff1259ecd666",styles:this.styles,class:this.setCardClass()},r("div",{key:"7bdf2d4d7ddc82af78fe932a2af866b3b17d8b4d",class:"cardtitle"},r("bn-title",{key:"799fa36d7368bbc2bc446f01fa3a46c8e363dcd0",namespace:this.titleNamespace,"business-unit":this.titleBusinessUnit,scenarios:null!==(t=this.resolveInherited("titleScenarios",this.titleScenarios))&&void 0!==t?t:this.titleScenarios,variances:null!==(e=this.resolveInherited("titleVariances",this.titleVariances))&&void 0!==e?e:this.titleVariances,order:null!==(i=this.resolveInherited("titleOrder",this.titleOrder))&&void 0!==i?i:this.titleOrder,"order-direction":null!==(s=this.resolveInherited("titleOrderDirection",this.titleOrderDirection))&&void 0!==s?s:this.titleOrderDirection,measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),null!=this.titleImage&&""!==this.titleImage?r("img",{class:"image",src:this.prepareTitleImage(this.titleImage)}):""),r("bn-body",{key:"9743d34c350907dfe0561444cd548d5884224f3a"},r("div",{key:"a622ae652dfefaac4a86d1f71a05fe776a811430",style:a},this.getSlots(o))),r("bn-footer",{key:"ebffcd673c94d7666fe6b46216792784f3dfb988",text:this.footerText,"page-number":0,"display-page-number":"false"}))}get element(){return this}static get style(){return':host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:block;flex-direction:column;overflow:hidden;float:left;clear:left}.cardtitle{display:inline-flex}.image{margin-right:0.5em;margin-top:0.5em;z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:inline}'}},[257,"bn-layout-card",{styles:[1],titleImage:[1,"title-image"],titleBusinessUnit:[1,"title-business-unit"],titleScenarios:[1,"title-scenarios"],titleVariances:[1,"title-variances"],titleOrder:[1,"title-order"],titleOrderDirection:[1,"title-order-direction"],titleMeasures:[1,"title-measures"],titleDateStart:[1,"title-date-start"],titleDateEnd:[1,"title-date-end"],titleDateFormat:[1,"title-date-format"],titleDateLink:[1,"title-date-link"],titleNamespace:[1,"title-namespace"],footerText:[1,"footer-text"],cardLayout:[1,"card-layout"],cardCustomTemplate:[1,"card-custom-template"],cardGridGap:[1,"card-grid-gap"],cardFitToContent:[4,"card-fit-to-content"],cardShowBorder:[4,"card-show-border"],getNumberOfSlot:[64]}]),f=b,u=function(){"undefined"!=typeof customElements&&["bn-layout-card","bn-body","bn-card","bn-footer","bn-title","ibcs-title"].forEach((t=>{switch(t){case"bn-layout-card":customElements.get(s(t))||customElements.define(s(t),b);break;case"bn-body":customElements.get(s(t))||c();break;case"bn-card":customElements.get(s(t))||l();break;case"bn-footer":customElements.get(s(t))||d();break;case"bn-title":customElements.get(s(t))||h();break;case"ibcs-title":customElements.get(s(t))||m()}}))};export{f as BnLayoutCard,u as defineCustomElement}
1
+ import{proxyCustomElement as t,HTMLElement as e,h as r,Fragment as i,transformTag as s}from"@stencil/core/internal/client";import{g as a}from"./context-protocol.js";import{a as o}from"./withHasError.js";import{w as n}from"./withInheritedProps.js";import{d as c}from"./bn-body2.js";import{d as l}from"./bn-card2.js";import{d}from"./bn-footer2.js";import{d as h}from"./bn-title2.js";import{d as m}from"./ibcs-title2.js";const b=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.titleImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.titleNamespace="_system",this.footerText="",this.cardLayout="full",this.cardCustomTemplate='"a b" "c d"',this.cardGridGap="0",this.cardFitToContent=!1,this.cardShowBorder=!0,this.templateMap=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"'],["custom-template",'"a b" "c c c"'],["gold3",'"a c" "b c"'],["gold4",'"a b c c" "d d c c"']]),this.errors=o(this),this.resolveInherited=n(this,[{propName:"titleScenarios",ancestorAttr:"title-scenarios"},{propName:"titleVariances",ancestorAttr:"title-variances"},{propName:"titleOrder",ancestorAttr:"title-order"},{propName:"titleOrderDirection",ancestorAttr:"title-order-direction"}])}connectedCallback(){this.stores=a(this.element),this.reflectInheritedAttrs()}getCommonStyles(){let t="100%",e="100%";return!0===this.cardFitToContent&&(e="fit-content",t="fit-content"),{display:"grid",height:t,width:e,gap:this.cardGridGap+"px"}}calculatePercentages(t){const e=t.trim().split(/\s+/).length;if(0===e)return"100%";const r=(100/e).toFixed(0)+"%";return Array(e).fill(r).join(" ")}getGridTemplateColumns(t){const e=this.getTemplatePattern(t).match(/"[\w\d\s.]+"/g);return e&&0!==e.length?this.calculatePercentages(e[0]):"100%"}getGridTemplateRows(t){const e=this.getTemplatePattern(t).match(/"[\w\d\s.]+"/g),r=e?e.length:1;return this.cardFitToContent?Array(r).fill("auto").join(" "):Array(r).fill("1fr").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplatePattern(this.cardLayout),"grid-template-columns":this.getGridTemplateColumns(this.cardLayout),"grid-template-rows":this.getGridTemplateRows(this.cardLayout)})}createDivAreaStyles(t){return t.map((t=>({width:"100%",overflow:"hidden","grid-area":t,height:"100%"})))}getSlots(t){const e=this.createDivAreaStyles(t);return r(i,null,e.map(((t,e)=>r("div",{style:t},r("slot",{name:"card-slot-"+e})))))}extractSlotNames(t){if(null==t)return[];const e=t.match(/\b\w+\b/g);return e?Array.from(new Set(e)):[]}getTemplatePattern(t){return!1===this.templateMap.has(t)&&"custom-template"!==t?'"a"':"custom-template"===t?this.cardCustomTemplate:this.templateMap.get(t)}async getNumberOfSlot(t){const e=this.getTemplatePattern(t);return this.extractSlotNames(e).length}componentDidUpdate(){}setCardClass(){return!0===this.cardShowBorder?"card_box border":"card_box"}reflectInheritedAttrs(){const t=[{prop:"titleScenarios",attr:"title-scenarios"},{prop:"titleVariances",attr:"title-variances"},{prop:"titleOrder",attr:"title-order"},{prop:"titleOrderDirection",attr:"title-order-direction"}];for(const{prop:e,attr:r}of t){const t=this.resolveInherited(e,this[e]);void 0!==t&&this.element.setAttribute(r,t)}}prepareTitleImage(t){if(null==t||""===t)return"";const e=this.stores.assets.state;return t.startsWith("asset:")?e[t.substring(6)]:e[t]||t}render(){var t,e,i,s;const a=this.getLayoutStyle(),o=this.extractSlotNames(a["grid-template-areas"]);return r("bn-card",{key:"a27b2ea13406067ff661c293af1ef1d89cfdc4f1",styles:this.styles,class:this.setCardClass()},r("div",{key:"a4eb313d41e4b3e267057406fd6d469129e90003",class:"cardtitle"},r("bn-title",{key:"999442b2f789bccbb00c7dd8e75e61c3a438596d",namespace:this.titleNamespace,"business-unit":this.titleBusinessUnit,scenarios:null!==(t=this.resolveInherited("titleScenarios",this.titleScenarios))&&void 0!==t?t:this.titleScenarios,variances:null!==(e=this.resolveInherited("titleVariances",this.titleVariances))&&void 0!==e?e:this.titleVariances,order:null!==(i=this.resolveInherited("titleOrder",this.titleOrder))&&void 0!==i?i:this.titleOrder,"order-direction":null!==(s=this.resolveInherited("titleOrderDirection",this.titleOrderDirection))&&void 0!==s?s:this.titleOrderDirection,measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),null!=this.titleImage&&""!==this.titleImage?r("img",{class:"image",src:this.prepareTitleImage(this.titleImage)}):""),r("bn-body",{key:"1cf38b212c60db9e4110f8340cda992d67fec350"},r("div",{key:"a1ac4631dfdeee4b5b87f09c2d047c86b886144a",style:a},this.getSlots(o))),r("bn-footer",{key:"4397cc9f836c0271d4469a90a2f5168c7fc3cfea",text:this.footerText,"page-number":0,"display-page-number":"false"}))}get element(){return this}static get style(){return':host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:block;flex-direction:column;overflow:hidden;float:left;clear:left}.cardtitle{display:inline-flex}.image{margin-right:0.5em;margin-top:0.5em;z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:inline}'}},[257,"bn-layout-card",{styles:[1],titleImage:[1,"title-image"],titleBusinessUnit:[1,"title-business-unit"],titleScenarios:[1,"title-scenarios"],titleVariances:[1,"title-variances"],titleOrder:[1,"title-order"],titleOrderDirection:[1,"title-order-direction"],titleMeasures:[1,"title-measures"],titleDateStart:[1,"title-date-start"],titleDateEnd:[1,"title-date-end"],titleDateFormat:[1,"title-date-format"],titleDateLink:[1,"title-date-link"],titleNamespace:[1,"title-namespace"],footerText:[1,"footer-text"],cardLayout:[1,"card-layout"],cardCustomTemplate:[1,"card-custom-template"],cardGridGap:[1,"card-grid-gap"],cardFitToContent:[4,"card-fit-to-content"],cardShowBorder:[4,"card-show-border"],getNumberOfSlot:[64]}]),u=b,f=function(){"undefined"!=typeof customElements&&["bn-layout-card","bn-body","bn-card","bn-footer","bn-title","ibcs-title"].forEach((t=>{switch(t){case"bn-layout-card":customElements.get(s(t))||customElements.define(s(t),b);break;case"bn-body":customElements.get(s(t))||c();break;case"bn-card":customElements.get(s(t))||l();break;case"bn-footer":customElements.get(s(t))||d();break;case"bn-title":customElements.get(s(t))||h();break;case"ibcs-title":customElements.get(s(t))||m()}}))};export{u as BnLayoutCard,f as defineCustomElement}
@@ -1 +1 @@
1
- import{proxyCustomElement as t,HTMLElement as e,h as s,Fragment as a,transformTag as i}from"@stencil/core/internal/client";import{a as r}from"./withHasError.js";import{d as o}from"./bn-body2.js";import{d as n}from"./bn-footer2.js";import{d as l}from"./bn-message2.js";import{d as c}from"./bn-page2.js";import{d as m}from"./bn-title2.js";import{d}from"./ibcs-title2.js";const b=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.messageText="",this.messageImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.titleNamespace="_system",this.footerDisplayPageNumber=!0,this.pageLayout="full",this.pageCustomTemplate='"a b" "c d"',this.pageGridGap="0",this.pageFitToContent=!0,this.templateMap=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"'],["custom-template",'"a b" "c c c"'],["gold3",'"a c" "b c"'],["gold4",'"a b c c" "d d c c"']]),this.errors=r(this)}getCommonStyles(){let t="100%";return!0===this.pageFitToContent&&(t="fit-content"),{display:"grid",height:t,width:"100%",gap:this.pageGridGap+"px"}}getGridTemplateRows(t){const e=this.getTemplateAreas(t).match(/"[\w\d\s.]+"/g),s=e?e.length:1;return this.pageFitToContent?Array(s).fill("auto").join(" "):Array(s).fill("1fr").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplateAreas(this.pageLayout),"grid-template-columns":this.getGridTemplateColumns(this.pageLayout),"grid-template-rows":this.getGridTemplateRows(this.pageLayout)})}createDivAreaStyles(t){return t.map((t=>({width:"100%",overflow:"hidden","grid-area":t,height:"100%"})))}getSlots(t){const e=this.createDivAreaStyles(t);return s(a,null,e.map(((t,e)=>s("div",{style:t},s("slot",{name:"slot-"+e})))))}extractSlotNames(t){if(null==t)return[];const e=t.match(/\b\w+\b/g);return e?Array.from(new Set(e)):[]}getTemplateAreas(t){return!1===this.templateMap.has(t)&&"custom-template"!==t?'"a"':"custom-template"===t?this.pageCustomTemplate:this.templateMap.get(t)}calculatePercentages(t){const e=t.trim().split(/\s+/).length;if(0===e)return"100%";const s=(100/e).toFixed(0)+"%";return Array(e).fill(s).join(" ")}getGridTemplateColumns(t){if(!1===this.templateMap.has(t)&&"custom-template"!==t)return"100%";let e;e="custom-template"===t?this.pageCustomTemplate:this.templateMap.get(t);const s=e.match(/"[\w\d\s.]+"/g);return this.calculatePercentages(s[0])}async getNumberOfSlot(t){const e=this.getTemplateAreas(t);return this.extractSlotNames(e).length}componentDidUpdate(){const t=this.element.closest("bn-context").getAttribute("render-orientation");if(t&&t!==this.pageOrientation){const t=this.element.shadowRoot.querySelector("bn-page"),e=this.element.closest("bn-layout-page");e&&t&&(t.style.transform="rotate(-90deg) translate(-100%)",t.style.transformOrigin="top left",e.style.width=t.clientHeight+"px",e.style.height=t.clientWidth+"px")}}render(){const t=this.getLayoutStyle(),e=this.extractSlotNames(t["grid-template-areas"]);return s("bn-page",{key:"1c262428d9e69966f3089f5018b5a71e348c31b7",styles:this.styles,format:this.pageFormat,orientation:this.pageOrientation},s("bn-message",{key:"c687e6d660a7301202663644f2bce0e20d148420",text:this.messageText,image:this.messageImage}),s("bn-title",{key:"6e30d548765d8b32f7ab85c6203c1af2142d55c5",namespace:this.titleNamespace,"business-unit":this.titleBusinessUnit,scenarios:this.titleScenarios,variances:this.titleVariances,order:this.titleOrder,"order-direction":this.titleOrderDirection,measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),s("bn-body",{key:"a691c212bcf2ed7c95792de989be4a5c5d30aa5f"},s("div",{key:"150f9e5941e723f527166ef9071b721b194101fe",style:t},this.getSlots(e))),s("bn-footer",{key:"9868b2deab6302fc029b6d9f9780d84269245979",text:this.footerText,"page-number":this.pageNumber,"display-page-number":this.footerDisplayPageNumber}))}get element(){return this}static get style(){return':host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:block;flex-direction:column;overflow:hidden;float:left;clear:left}'}},[257,"bn-layout-page",{styles:[1],messageText:[1,"message-text"],messageImage:[1,"message-image"],titleBusinessUnit:[1,"title-business-unit"],titleScenarios:[1,"title-scenarios"],titleVariances:[1,"title-variances"],titleOrder:[1,"title-order"],titleOrderDirection:[1,"title-order-direction"],titleMeasures:[1,"title-measures"],titleDateStart:[1,"title-date-start"],titleDateEnd:[1,"title-date-end"],titleDateFormat:[1,"title-date-format"],titleDateLink:[1,"title-date-link"],titleNamespace:[1,"title-namespace"],pageFormat:[1,"page-format"],pageOrientation:[1,"page-orientation"],pageNumber:[1,"page-number"],footerText:[1,"footer-text"],footerDisplayPageNumber:[4,"footer-display-page-number"],pageLayout:[1,"page-layout"],pageCustomTemplate:[1,"page-custom-template"],pageGridGap:[1,"page-grid-gap"],pageFitToContent:[4,"page-fit-to-content"],getNumberOfSlot:[64]}]),h=b,p=function(){"undefined"!=typeof customElements&&["bn-layout-page","bn-body","bn-footer","bn-message","bn-page","bn-title","ibcs-title"].forEach((t=>{switch(t){case"bn-layout-page":customElements.get(i(t))||customElements.define(i(t),b);break;case"bn-body":customElements.get(i(t))||o();break;case"bn-footer":customElements.get(i(t))||n();break;case"bn-message":customElements.get(i(t))||l();break;case"bn-page":customElements.get(i(t))||c();break;case"bn-title":customElements.get(i(t))||m();break;case"ibcs-title":customElements.get(i(t))||d()}}))};export{h as BnLayoutPage,p as defineCustomElement}
1
+ import{proxyCustomElement as t,HTMLElement as e,h as s,Fragment as a,transformTag as i}from"@stencil/core/internal/client";import{a as r}from"./withHasError.js";import{d as o}from"./bn-body2.js";import{d as n}from"./bn-footer2.js";import{d as l}from"./bn-message2.js";import{d as c}from"./bn-page2.js";import{d as m}from"./bn-title2.js";import{d as b}from"./ibcs-title2.js";const d=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.messageText="",this.messageImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.titleNamespace="_system",this.footerDisplayPageNumber=!0,this.pageLayout="full",this.pageCustomTemplate='"a b" "c d"',this.pageGridGap="0",this.pageFitToContent=!1,this.templateMap=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"'],["custom-template",'"a b" "c c c"'],["gold3",'"a c" "b c"'],["gold4",'"a b c c" "d d c c"']]),this.errors=r(this)}getCommonStyles(){let t="100%";return!0===this.pageFitToContent&&(t="fit-content"),{display:"grid",height:t,width:"100%",gap:this.pageGridGap+"px"}}getGridTemplateRows(t){const e=this.getTemplateAreas(t).match(/"[\w\d\s.]+"/g),s=e?e.length:1;return this.pageFitToContent?Array(s).fill("auto").join(" "):Array(s).fill("1fr").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplateAreas(this.pageLayout),"grid-template-columns":this.getGridTemplateColumns(this.pageLayout),"grid-template-rows":this.getGridTemplateRows(this.pageLayout)})}createDivAreaStyles(t){return t.map((t=>({width:"100%",overflow:"hidden","grid-area":t,height:"100%"})))}getSlots(t){const e=this.createDivAreaStyles(t);return s(a,null,e.map(((t,e)=>s("div",{style:t},s("slot",{name:"slot-"+e})))))}extractSlotNames(t){if(null==t)return[];const e=t.match(/\b\w+\b/g);return e?Array.from(new Set(e)):[]}getTemplateAreas(t){return!1===this.templateMap.has(t)&&"custom-template"!==t?'"a"':"custom-template"===t?this.pageCustomTemplate:this.templateMap.get(t)}calculatePercentages(t){const e=t.trim().split(/\s+/).length;if(0===e)return"100%";const s=(100/e).toFixed(0)+"%";return Array(e).fill(s).join(" ")}getGridTemplateColumns(t){if(!1===this.templateMap.has(t)&&"custom-template"!==t)return"100%";let e;e="custom-template"===t?this.pageCustomTemplate:this.templateMap.get(t);const s=e.match(/"[\w\d\s.]+"/g);return this.calculatePercentages(s[0])}async getNumberOfSlot(t){const e=this.getTemplateAreas(t);return this.extractSlotNames(e).length}componentDidUpdate(){const t=this.element.closest("bn-context").getAttribute("render-orientation");if(t&&t!==this.pageOrientation){const t=this.element.shadowRoot.querySelector("bn-page"),e=this.element.closest("bn-layout-page");e&&t&&(t.style.transform="rotate(-90deg) translate(-100%)",t.style.transformOrigin="top left",e.style.width=t.clientHeight+"px",e.style.height=t.clientWidth+"px")}}render(){const t=this.getLayoutStyle(),e=this.extractSlotNames(t["grid-template-areas"]);return s("bn-page",{key:"39d3769df89423fae025d924e9a69ebb3742461b",styles:this.styles,format:this.pageFormat,orientation:this.pageOrientation},s("bn-message",{key:"0a2a28f6af09d6f58799f66c75a17c02464d57b1",text:this.messageText,image:this.messageImage}),s("bn-title",{key:"63e3dedb613fc8d4b11416321d148a22cf96af84",namespace:this.titleNamespace,"business-unit":this.titleBusinessUnit,scenarios:this.titleScenarios,variances:this.titleVariances,order:this.titleOrder,"order-direction":this.titleOrderDirection,measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),s("bn-body",{key:"1946d3d11bb663b3ba5faf73bfe5d1b2bd4329ac"},s("div",{key:"7a97d5481163d44f582c8c8ec352954f4e75c1bb",style:t},this.getSlots(e))),s("bn-footer",{key:"863e721cfdb44ab5860687f5fb4dc4705f83d81b",text:this.footerText,"page-number":this.pageNumber,"display-page-number":this.footerDisplayPageNumber}))}get element(){return this}static get style(){return':host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:block;flex-direction:column;overflow:hidden;float:left;clear:left}'}},[257,"bn-layout-page",{styles:[1],messageText:[1,"message-text"],messageImage:[1,"message-image"],titleBusinessUnit:[1,"title-business-unit"],titleScenarios:[1,"title-scenarios"],titleVariances:[1,"title-variances"],titleOrder:[1,"title-order"],titleOrderDirection:[1,"title-order-direction"],titleMeasures:[1,"title-measures"],titleDateStart:[1,"title-date-start"],titleDateEnd:[1,"title-date-end"],titleDateFormat:[1,"title-date-format"],titleDateLink:[1,"title-date-link"],titleNamespace:[1,"title-namespace"],pageFormat:[1,"page-format"],pageOrientation:[1,"page-orientation"],pageNumber:[1,"page-number"],footerText:[1,"footer-text"],footerDisplayPageNumber:[4,"footer-display-page-number"],pageLayout:[1,"page-layout"],pageCustomTemplate:[1,"page-custom-template"],pageGridGap:[1,"page-grid-gap"],pageFitToContent:[4,"page-fit-to-content"],getNumberOfSlot:[64]}]),h=d,p=function(){"undefined"!=typeof customElements&&["bn-layout-page","bn-body","bn-footer","bn-message","bn-page","bn-title","ibcs-title"].forEach((t=>{switch(t){case"bn-layout-page":customElements.get(i(t))||customElements.define(i(t),d);break;case"bn-body":customElements.get(i(t))||o();break;case"bn-footer":customElements.get(i(t))||n();break;case"bn-message":customElements.get(i(t))||l();break;case"bn-page":customElements.get(i(t))||c();break;case"bn-title":customElements.get(i(t))||m();break;case"ibcs-title":customElements.get(i(t))||b()}}))};export{h as BnLayoutPage,p as defineCustomElement}
@@ -1 +1 @@
1
- import{proxyCustomElement as t,HTMLElement as i,h as e,Host as a,transformTag as s}from"@stencil/core/internal/client";import{v as r,a as n,i as o,p as l,h as d,q as h,l as p,r as u,k as c,s as v,t as m,b as g,c as y,u as f,m as b,w,x as S}from"./validate.js";import{w as O,g as T,p as R}from"./scaling.js";import{w as D,a as _}from"./withHasError.js";import{a as E}from"./context-protocol.js";import{w as M}from"./withTranslation.js";import{w as C}from"./withStyled.js";import{w as F}from"./withComponentStyle.js";import{w as G,i as N}from"./withInheritedProps.js";import{D as W,b as A,O as P,I as U,e as x,M as j,B as I,T as L}from"./Order.js";import{T as k,d as B}from"./ibcs-table2.js";const J=t(class extends i{validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.data=[],this.datasetMeta=null,this.appliedScaleFactor=1,this.tableTitle="",this.filter="",this.measureUnit="",this.barColumnWidth="w10",this.unitScaling=.01,this.percentageScaling=.5,this.pixelPerUnitGroupMap=new Map,this.dataFormat="decimal",this.grouped="false",this.showMeasureScale="false",this.showGroupTitle="true",this.type="list",this.limit=0,this.thereof="[]",this.partof="[]",this.order="category",this.orderDirection="asc",this.measureType="volume",this.measureScale="greatest",this.dataFormatDigitsDecimal=1,this.dataFormatDigitsPercent=2,this.categoryWidth="w15",this.columnthereof=null,this._autoScaleGuard=!1,C(this),D(this),this.errors=_(this),this.componentStyle=F(this),O(this,((t,i)=>{this.data=i||[]}),((t,i)=>{this.datasetMeta=i})),this.t=M(this).t,this.resolveInherited=G(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}])}validateScenario(t){const i="ERR_scenarios";if(N(t))return void this.errors.remove(i);const e=r(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+(null==e?void 0:""+e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(N(t))return void this.errors.remove(i);const e=n(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateBarColumns(t){const i="ERR_barColumns";if(o(t))return void this.errors.remove(i);const e=n(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"barColumns: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateBarColumnWidth(t){const i="ERR_barColumnWidth";l(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"barColumnWidth: invalid value '"+t+"' is not supported."})}validateUnitScaling(t){const i="ERR_unitScaling";d(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value '"+t+"' is not supported."})}validatePercentageScaling(t){const i="ERR_percentageScaling";d(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value '"+t+"' is not supported."})}validateDataFormat(t){const i="ERR_dataFormat";h(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormat: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateGrouped(t){const i="ERR_grouped";p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"grouped: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowMeasureScale(t){const i="ERR_grouped";p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowGroupTitle(t){const i="ERR_showGroupTitle";p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showGroupTitle: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateType(t){const i="ERR_type";u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"type: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateLimit(t){const i="ERR_limit";c(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateThereOf(t){const i="ERR_thereof",e=v(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"ThereOf: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validatePartOf(t){const i="ERR_partof",e=m(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"partof: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderList(t){const i="ERR_order";if(N(t))return void this.errors.remove(i);const e=g(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";N(t)||y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureType(t){const i="ERR_measureType";f(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureType: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureScale(t){const i="ERR_measureScale";b(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateDataFormatDigitsDecimal(t){const i="ERR_dataFormatDigitsDecimal";c(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormatDigitsDecimal: invalid value(s) '"+t+"' are not supported."})}validateDateFormatDigitsPercent(t){const i="ERR_dataFormatDigitsPercent";c(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormatDigitsPercent: invalid value(s) '"+t+"' are not supported."})}validateCategoryWidth(t){const i="ERR_categoryWidth";w(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"categoryWidth: invalid value(s) '"+t+"' are not supported."})}validateColumnThereOf(t){const i=S(t),e="ERR_categorythereof";i.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"columnthereof: invalid value(s) '"+JSON.stringify(i)+"' are not supported."}):this.errors.remove(e)}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateDataFormat(this.dataFormat),this.validateGrouped(this.grouped),this.validateShowGroupTitle(this.showGroupTitle),this.validateType(this.type),this.validateLimit(this.limit),this.validateThereOf(this.thereof),this.validatePartOf(this.partof),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal),this.validateDateFormatDigitsPercent(this.dataFormatDigitsPercent),this.validateCategoryWidth(this.categoryWidth),this.validateMeasureType(this.measureType),this.validateMeasureScale(this.measureScale),this.validateColumnThereOf(this.columnthereof),this.validateShowMeasureScale(this.showMeasureScale),this.validateBarColumns(this.barColumns),this.validateBarColumnWidth(this.barColumnWidth),this.validateUnitScaling(this.unitScaling),this.validatePercentageScaling(this.percentageScaling),this.validateScaling(this.scale)}disconnectedCallback(){this.unsubscribe()}componentDidRender(){const{mode:t}=R(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const i=this.element,{width:e}=T(i);if(e<=0)return;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),s=i.scrollWidth,r=this.appliedScaleFactor,n=r>0?s/r:s;if(n<=e+1)return this.errors.remove("AUTO_scale"),void(1!==this.appliedScaleFactor&&(i.style.setProperty("--bn-font-size",a+"px"),this._autoScaleGuard=!0,this.appliedScaleFactor=1));const o=(e-1)/n;i.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled table by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),Math.abs(o-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,this.appliedScaleFactor=o)}prepareDataFormat(){var t;return W[null===(t=this.dataFormat)||void 0===t?void 0:t.toUpperCase()]}prepareGrouped(){return"true"===this.grouped}prepareShowGroupTitle(){return"true"===this.showGroupTitle}prepareTableType(){var t;return k[null===(t=this.type)||void 0===t?void 0:t.toUpperCase()]}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareThereOf(){return null==this.thereof||""===this.thereof.trim()?[]:JSON.parse(this.thereof)}preparePartOf(){return null==this.partof||""===this.partof.trim()?[]:JSON.parse(this.partof)}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),e=this.resolveInherited("orderDirection",this.orderDirection),a=null!=i?i:this.order,s=null!=e?e:this.orderDirection,r="auto"===(null==a?void 0:a.trim().toLowerCase());let n=a;return r&&(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)&&(n=this.datasetMeta.suggestedOrder),{hierarchy:n.split(",").map((t=>P[null==t?void 0:t.toUpperCase()])),direction:A[null==s?void 0:s.toUpperCase()]}}prepareI18nMode(){return U.META}prepareI18n(){const t=E,i=new Map(["in","category","operation","there_of","part_of","SUM_TOTAL"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries()])}prepareDataFormatDigits(){return{percent:this.dataFormatDigitsPercent,decimal:this.dataFormatDigitsDecimal}}prepareScenarios(){var t,i,e,a,s,r,n,l,d;const h=this.resolveInherited("scenarios",this.scenarios),p=this.resolveInherited("variances",this.variances);if(void 0!==h||void 0!==p){this.errors.remove("AUTO_scenarios");let i=[];return void 0!==h?i=i.concat(h.split(",")):o(this.scenarios)||(i=i.concat(this.scenarios.split(","))),void 0!==p?i=i.concat(p.split(",")):(null===(t=this.variances)||void 0===t?void 0:t.trim().length)>0&&(i=i.concat(this.variances.split(","))),i.map((t=>t.trim()))}const u="auto"===(null===(i=this.scenarios)||void 0===i?void 0:i.trim().toLowerCase());if((o(this.scenarios)||u)&&o(this.variances))return(null===(a=null===(e=this.datasetMeta)||void 0===e?void 0:e.availableScenarios)||void 0===a?void 0:a.length)>0?(u?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[];let c=[];return u||o(this.scenarios)?(null===(r=null===(s=this.datasetMeta)||void 0===s?void 0:s.availableScenarios)||void 0===r?void 0:r.length)>0&&(u?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),c=c.concat(this.datasetMeta.availableScenarios)):(this.errors.remove("AUTO_scenarios"),c=c.concat(null===(n=this.scenarios)||void 0===n?void 0:n.split(","))),(null===(l=this.variances)||void 0===l?void 0:l.trim().length)>0&&(c=c.concat(null===(d=this.variances)||void 0===d?void 0:d.split(","))),c.map((t=>t.trim()))}prepareCategoryWidth(){var t;return o(this.categoryWidth)?x.INF:x[null===(t=this.categoryWidth)||void 0===t?void 0:t.toUpperCase()]}prepareMeasureScale(){return o(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareMeasureType(){var t;return o(this.measureType)?j.VOLUME:j[null===(t=this.measureType)||void 0===t?void 0:t.toUpperCase()]}prepareColumnThereOf(){if(null==this.columnthereof||""===this.columnthereof.trim())return new Map;const t=JSON.parse(this.columnthereof),i=new Map;for(const[e,a]of Object.entries(t))!1===i.has(a.scenario)&&i.set(a.scenario,[]),i.get(a.scenario).push(a);return i}prepareTableTitle(){return""===this.tableTitle||null==this.tableTitle?"SUM_TOTAL":this.tableTitle}prepareShowMeasureScale(){return"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareBarColumnWidth(){var t;const i=null===(t=this.barColumnWidth)||void 0===t?void 0:t.toUpperCase(),e=L[i];return e?I[e]:I[L.W10]}prepareBarColumns(){return o(this.barColumns)?[]:this.barColumns.split(",").map((t=>t.trim()))}prepareUnitScaling(){return this.pixelPerUnitGroupMap.has(this.unitScaling)?this.pixelPerUnitGroupMap.get(this.unitScaling):Number(this.unitScaling)}preparePercentageScaling(){return this.pixelPerUnitGroupMap.has(this.percentageScaling)?this.pixelPerUnitGroupMap.get(this.percentageScaling):Number(this.percentageScaling)}getDataStructure(){return{ITableDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}getEffectiveScaleFactor(){const{mode:t,factor:i}=R(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,a,s,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(a=i.global)||void 0===a?void 0:a.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(s=i.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles(),i=this.getEffectiveScaleFactor();return e(a,{key:"90572dbaa427d46b526c5a04fd04b94882fcb519",style:t},e("div",{key:"947d9a31764fd0def10d902901f300c2a526dc55"},e("ibcs-table",{key:"ef57aa654318568eb5a8356a5257a0b75bf55e3a",data:this.data,"table-title":this.prepareTableTitle(),scenarios:this.prepareScenarios(),"scenarios-data-format":this.prepareDataFormat(),grouped:this.prepareGrouped(),limit:this.prepareLimit(),showGroupTitle:this.prepareShowGroupTitle(),thereof:this.prepareThereOf(),partof:this.preparePartOf(),order:this.prepareOrder(),categorythereof:this.prepareColumnThereOf(),type:this.prepareTableType(),"category-width":this.prepareCategoryWidth(),dataFormatDigits:this.prepareDataFormatDigits(),i18n:this.prepareI18n(),"i18n-mode":this.prepareI18nMode(),"measure-scale":this.prepareMeasureScale(),"measure-type":this.prepareMeasureType(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(),filter:this.prepareFilter(),barColumns:this.prepareBarColumns(),barColumnMaxWidth:this.prepareBarColumnWidth(),unitScaling:this.prepareUnitScaling(),percentageScaling:this.preparePercentageScaling(),scaleFactor:i})))}get element(){return this}static get watchers(){return{scale:[{validateScaling:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],barColumns:[{validateBarColumns:0}],barColumnWidth:[{validateBarColumnWidth:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dataFormat:[{validateDataFormat:0}],grouped:[{validateGrouped:0}],showMeasureScale:[{validateShowMeasureScale:0}],showGroupTitle:[{validateShowGroupTitle:0}],type:[{validateType:0}],limit:[{validateLimit:0}],thereof:[{validateThereOf:0}],partof:[{validatePartOf:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],measureType:[{validateMeasureType:0}],measureScale:[{validateMeasureScale:0}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDateFormatDigitsPercent:0}],categoryWidth:[{validateCategoryWidth:0}],columnthereof:[{validateColumnThereOf:0}]}}static get style(){return":host{display:inline-block;position:relative;overflow:hidden}"}},[1,"bn-table",{scale:[1],tableTitle:[1,"table-title"],filter:[1],measureUnit:[1,"measure-unit"],scenarios:[1],variances:[1],barColumns:[1,"bar-columns"],barColumnWidth:[1,"bar-column-width"],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],dataFormat:[1,"data-format"],grouped:[1],showMeasureScale:[1,"show-measure-scale"],showGroupTitle:[1,"show-group-title"],type:[1],limit:[2],thereof:[1],partof:[1],order:[1],orderDirection:[1,"order-direction"],measureType:[1,"measure-type"],measureScale:[1,"measure-scale"],dataFormatDigitsDecimal:[2,"data-format-digits-decimal"],dataFormatDigitsPercent:[2,"data-format-digits-percent"],categoryWidth:[1,"category-width"],columnthereof:[1],data:[32],datasetMeta:[32],appliedScaleFactor:[32]},void 0,{scale:[{validateScaling:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],barColumns:[{validateBarColumns:0}],barColumnWidth:[{validateBarColumnWidth:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dataFormat:[{validateDataFormat:0}],grouped:[{validateGrouped:0}],showMeasureScale:[{validateShowMeasureScale:0}],showGroupTitle:[{validateShowGroupTitle:0}],type:[{validateType:0}],limit:[{validateLimit:0}],thereof:[{validateThereOf:0}],partof:[{validatePartOf:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],measureType:[{validateMeasureType:0}],measureScale:[{validateMeasureScale:0}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDateFormatDigitsPercent:0}],categoryWidth:[{validateCategoryWidth:0}],columnthereof:[{validateColumnThereOf:0}]}]),z=J,V=function(){"undefined"!=typeof customElements&&["bn-table","ibcs-table"].forEach((t=>{switch(t){case"bn-table":customElements.get(s(t))||customElements.define(s(t),J);break;case"ibcs-table":customElements.get(s(t))||B()}}))};export{z as BnTable,V as defineCustomElement}
1
+ import{proxyCustomElement as t,HTMLElement as i,writeTask as e,h as a,Host as s,transformTag as r}from"@stencil/core/internal/client";import{v as n,a as o,i as l,p as d,h,q as p,l as u,r as c,k as v,s as m,t as g,b as y,c as f,u as b,m as w,w as S,x as O}from"./validate.js";import{w as T,g as R,p as D}from"./scaling.js";import{w as _,a as E}from"./withHasError.js";import{a as M}from"./context-protocol.js";import{w as C}from"./withTranslation.js";import{w as F}from"./withStyled.js";import{w as G}from"./withComponentStyle.js";import{w as N,i as W}from"./withInheritedProps.js";import{D as A,b as P,O as U,I as x,e as j,M as I,B as L,T as k}from"./Order.js";import{T as B,d as J}from"./ibcs-table2.js";const z=t(class extends i{validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.data=[],this.datasetMeta=null,this.appliedScaleFactor=1,this.tableTitle="",this.filter="",this.measureUnit="",this.barColumnWidth="w10",this.unitScaling=.01,this.percentageScaling=.5,this.pixelPerUnitGroupMap=new Map,this.dataFormat="decimal",this.grouped="false",this.showMeasureScale="false",this.showGroupTitle="true",this.type="list",this.limit=0,this.thereof="[]",this.partof="[]",this.order="category",this.orderDirection="asc",this.measureType="volume",this.measureScale="greatest",this.dataFormatDigitsDecimal=1,this.dataFormatDigitsPercent=2,this.categoryWidth="w15",this.columnthereof=null,this._autoScaleGuard=!1,F(this),_(this),this.errors=E(this),this.componentStyle=G(this),T(this,((t,i)=>{this.data=i||[]}),((t,i)=>{this.datasetMeta=i})),this.t=C(this).t,this.resolveInherited=N(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}])}validateScenario(t){const i="ERR_scenarios";if(W(t))return void this.errors.remove(i);const e=n(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+(null==e?void 0:""+e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(W(t))return void this.errors.remove(i);const e=o(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateBarColumns(t){const i="ERR_barColumns";if(l(t))return void this.errors.remove(i);const e=o(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"barColumns: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateBarColumnWidth(t){const i="ERR_barColumnWidth";d(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"barColumnWidth: invalid value '"+t+"' is not supported."})}validateUnitScaling(t){const i="ERR_unitScaling";"auto"===(null==t?void 0:(""+t).trim().toLowerCase())||h(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value '"+t+"' is not supported."})}validatePercentageScaling(t){const i="ERR_percentageScaling";"auto"===(null==t?void 0:(""+t).trim().toLowerCase())||h(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value '"+t+"' is not supported."})}validateDataFormat(t){const i="ERR_dataFormat";p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormat: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateGrouped(t){const i="ERR_grouped";u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"grouped: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowMeasureScale(t){const i="ERR_grouped";u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowGroupTitle(t){const i="ERR_showGroupTitle";u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showGroupTitle: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateType(t){const i="ERR_type";c(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"type: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateLimit(t){const i="ERR_limit";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateThereOf(t){const i="ERR_thereof",e=m(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"ThereOf: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validatePartOf(t){const i="ERR_partof",e=g(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"partof: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderList(t){const i="ERR_order";if(W(t))return void this.errors.remove(i);const e=y(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";W(t)||f(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureType(t){const i="ERR_measureType";b(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureType: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureScale(t){const i="ERR_measureScale";w(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateDataFormatDigitsDecimal(t){const i="ERR_dataFormatDigitsDecimal";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormatDigitsDecimal: invalid value(s) '"+t+"' are not supported."})}validateDateFormatDigitsPercent(t){const i="ERR_dataFormatDigitsPercent";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormatDigitsPercent: invalid value(s) '"+t+"' are not supported."})}validateCategoryWidth(t){const i="ERR_categoryWidth";S(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"categoryWidth: invalid value(s) '"+t+"' are not supported."})}validateColumnThereOf(t){const i=O(t),e="ERR_categorythereof";i.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"columnthereof: invalid value(s) '"+JSON.stringify(i)+"' are not supported."}):this.errors.remove(e)}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateDataFormat(this.dataFormat),this.validateGrouped(this.grouped),this.validateShowGroupTitle(this.showGroupTitle),this.validateType(this.type),this.validateLimit(this.limit),this.validateThereOf(this.thereof),this.validatePartOf(this.partof),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal),this.validateDateFormatDigitsPercent(this.dataFormatDigitsPercent),this.validateCategoryWidth(this.categoryWidth),this.validateMeasureType(this.measureType),this.validateMeasureScale(this.measureScale),this.validateColumnThereOf(this.columnthereof),this.validateShowMeasureScale(this.showMeasureScale),this.validateBarColumns(this.barColumns),this.validateBarColumnWidth(this.barColumnWidth),this.validateUnitScaling(this.unitScaling),this.validatePercentageScaling(this.percentageScaling),this.validateScaling(this.scale)}disconnectedCallback(){this.unsubscribe()}componentDidRender(){const{mode:t}=D(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const i=this.element,{width:a}=R(i);if(a<=0)return;const s=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=i.scrollWidth,n=this.appliedScaleFactor,o=n>0?r/n:r;if(o<=a+1)return this.errors.remove("AUTO_scale"),void(1!==this.appliedScaleFactor&&(i.style.setProperty("--bn-font-size",s+"px"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=1}))));const l=(a-1)/o;i.style.setProperty("--bn-font-size",s*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled table by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),Math.abs(l-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=l})))}prepareDataFormat(){var t;return A[null===(t=this.dataFormat)||void 0===t?void 0:t.toUpperCase()]}prepareGrouped(){return"true"===this.grouped}prepareShowGroupTitle(){return"true"===this.showGroupTitle}prepareTableType(){var t;return B[null===(t=this.type)||void 0===t?void 0:t.toUpperCase()]}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareThereOf(){return null==this.thereof||""===this.thereof.trim()?[]:JSON.parse(this.thereof)}preparePartOf(){return null==this.partof||""===this.partof.trim()?[]:JSON.parse(this.partof)}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),e=this.resolveInherited("orderDirection",this.orderDirection),a=null!=i?i:this.order,s=null!=e?e:this.orderDirection,r="auto"===(null==a?void 0:a.trim().toLowerCase());let n=a;return r&&(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)&&(n=this.datasetMeta.suggestedOrder),{hierarchy:n.split(",").map((t=>U[null==t?void 0:t.toUpperCase()])),direction:P[null==s?void 0:s.toUpperCase()]}}prepareI18nMode(){return x.META}prepareI18n(){const t=M,i=new Map(["in","category","operation","there_of","part_of","SUM_TOTAL"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries()])}prepareDataFormatDigits(){return{percent:this.dataFormatDigitsPercent,decimal:this.dataFormatDigitsDecimal}}prepareScenarios(){var t,i,e,a,s,r,n,o,d;const h=this.resolveInherited("scenarios",this.scenarios),p=this.resolveInherited("variances",this.variances);if(void 0!==h||void 0!==p){this.errors.remove("AUTO_scenarios");let i=[];return void 0!==h?i=i.concat(h.split(",")):l(this.scenarios)||(i=i.concat(this.scenarios.split(","))),void 0!==p?i=i.concat(p.split(",")):(null===(t=this.variances)||void 0===t?void 0:t.trim().length)>0&&(i=i.concat(this.variances.split(","))),i.map((t=>t.trim()))}const u="auto"===(null===(i=this.scenarios)||void 0===i?void 0:i.trim().toLowerCase());if((l(this.scenarios)||u)&&l(this.variances))return(null===(a=null===(e=this.datasetMeta)||void 0===e?void 0:e.availableScenarios)||void 0===a?void 0:a.length)>0?(u?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[];let c=[];return u||l(this.scenarios)?(null===(r=null===(s=this.datasetMeta)||void 0===s?void 0:s.availableScenarios)||void 0===r?void 0:r.length)>0&&(u?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),c=c.concat(this.datasetMeta.availableScenarios)):(this.errors.remove("AUTO_scenarios"),c=c.concat(null===(n=this.scenarios)||void 0===n?void 0:n.split(","))),(null===(o=this.variances)||void 0===o?void 0:o.trim().length)>0&&(c=c.concat(null===(d=this.variances)||void 0===d?void 0:d.split(","))),c.map((t=>t.trim()))}prepareCategoryWidth(){var t;return l(this.categoryWidth)?j.INF:j[null===(t=this.categoryWidth)||void 0===t?void 0:t.toUpperCase()]}prepareMeasureScale(){return l(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareMeasureType(){var t;return l(this.measureType)?I.VOLUME:I[null===(t=this.measureType)||void 0===t?void 0:t.toUpperCase()]}prepareColumnThereOf(){if(null==this.columnthereof||""===this.columnthereof.trim())return new Map;const t=JSON.parse(this.columnthereof),i=new Map;for(const[e,a]of Object.entries(t))!1===i.has(a.scenario)&&i.set(a.scenario,[]),i.get(a.scenario).push(a);return i}prepareTableTitle(){return""===this.tableTitle||null==this.tableTitle?"SUM_TOTAL":this.tableTitle}prepareShowMeasureScale(){return"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareBarColumnWidth(){var t;const i=null===(t=this.barColumnWidth)||void 0===t?void 0:t.toUpperCase(),e=k[i];return e?L[e]:L[k.W10]}prepareBarColumns(){return l(this.barColumns)?[]:this.barColumns.split(",").map((t=>t.trim()))}prepareUnitScaling(){var t;return this.pixelPerUnitGroupMap.has(this.unitScaling)?this.pixelPerUnitGroupMap.get(this.unitScaling):"auto"===(null===(t=this.unitScaling)||void 0===t?void 0:(""+t).trim().toLowerCase())?0:Number(this.unitScaling)}preparePercentageScaling(){var t;return this.pixelPerUnitGroupMap.has(this.percentageScaling)?this.pixelPerUnitGroupMap.get(this.percentageScaling):"auto"===(null===(t=this.percentageScaling)||void 0===t?void 0:(""+t).trim().toLowerCase())?0:Number(this.percentageScaling)}getDataStructure(){return{ITableDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}getEffectiveScaleFactor(){const{mode:t,factor:i}=D(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,a,s,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(a=i.global)||void 0===a?void 0:a.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(s=i.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles(),i=this.getEffectiveScaleFactor();return a(s,{key:"95a43b9087d7d5d0be75c361795ef0a5a1cb30fe",style:t},a("div",{key:"a905e16727e619222b478fcc4dbe0c903306c420"},a("ibcs-table",{key:"454d019b157c730ec0b3f7cfcf16ae0e56c4a255",data:this.data,"table-title":this.prepareTableTitle(),scenarios:this.prepareScenarios(),"scenarios-data-format":this.prepareDataFormat(),grouped:this.prepareGrouped(),limit:this.prepareLimit(),showGroupTitle:this.prepareShowGroupTitle(),thereof:this.prepareThereOf(),partof:this.preparePartOf(),order:this.prepareOrder(),categorythereof:this.prepareColumnThereOf(),type:this.prepareTableType(),"category-width":this.prepareCategoryWidth(),dataFormatDigits:this.prepareDataFormatDigits(),i18n:this.prepareI18n(),"i18n-mode":this.prepareI18nMode(),"measure-scale":this.prepareMeasureScale(),"measure-type":this.prepareMeasureType(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(),filter:this.prepareFilter(),barColumns:this.prepareBarColumns(),barColumnMaxWidth:this.prepareBarColumnWidth(),unitScaling:this.prepareUnitScaling(),percentageScaling:this.preparePercentageScaling(),scaleFactor:i})))}get element(){return this}static get watchers(){return{scale:[{validateScaling:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],barColumns:[{validateBarColumns:0}],barColumnWidth:[{validateBarColumnWidth:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dataFormat:[{validateDataFormat:0}],grouped:[{validateGrouped:0}],showMeasureScale:[{validateShowMeasureScale:0}],showGroupTitle:[{validateShowGroupTitle:0}],type:[{validateType:0}],limit:[{validateLimit:0}],thereof:[{validateThereOf:0}],partof:[{validatePartOf:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],measureType:[{validateMeasureType:0}],measureScale:[{validateMeasureScale:0}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDateFormatDigitsPercent:0}],categoryWidth:[{validateCategoryWidth:0}],columnthereof:[{validateColumnThereOf:0}]}}static get style(){return":host{display:inline-block;position:relative;overflow:hidden}"}},[1,"bn-table",{scale:[1],tableTitle:[1,"table-title"],filter:[1],measureUnit:[1,"measure-unit"],scenarios:[1],variances:[1],barColumns:[1,"bar-columns"],barColumnWidth:[1,"bar-column-width"],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],dataFormat:[1,"data-format"],grouped:[1],showMeasureScale:[1,"show-measure-scale"],showGroupTitle:[1,"show-group-title"],type:[1],limit:[2],thereof:[1],partof:[1],order:[1],orderDirection:[1,"order-direction"],measureType:[1,"measure-type"],measureScale:[1,"measure-scale"],dataFormatDigitsDecimal:[2,"data-format-digits-decimal"],dataFormatDigitsPercent:[2,"data-format-digits-percent"],categoryWidth:[1,"category-width"],columnthereof:[1],data:[32],datasetMeta:[32],appliedScaleFactor:[32]},void 0,{scale:[{validateScaling:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],barColumns:[{validateBarColumns:0}],barColumnWidth:[{validateBarColumnWidth:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dataFormat:[{validateDataFormat:0}],grouped:[{validateGrouped:0}],showMeasureScale:[{validateShowMeasureScale:0}],showGroupTitle:[{validateShowGroupTitle:0}],type:[{validateType:0}],limit:[{validateLimit:0}],thereof:[{validateThereOf:0}],partof:[{validatePartOf:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],measureType:[{validateMeasureType:0}],measureScale:[{validateMeasureScale:0}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDateFormatDigitsPercent:0}],categoryWidth:[{validateCategoryWidth:0}],columnthereof:[{validateColumnThereOf:0}]}]),V=z,q=function(){"undefined"!=typeof customElements&&["bn-table","ibcs-table"].forEach((t=>{switch(t){case"bn-table":customElements.get(r(t))||customElements.define(r(t),z);break;case"ibcs-table":customElements.get(r(t))||J()}}))};export{V as BnTable,q as defineCustomElement}
@@ -1 +1 @@
1
- import{h as t,proxyCustomElement as e,HTMLElement as o,Host as n,transformTag as s}from"@stencil/core/internal/client";import{F as r,Q as i,V as l,I as a,S as c}from"./ibcsRuleSet.js";import{I as h,D as u,j as d,k as f,l as p,e as m,M as $}from"./Order.js";import{a as v}from"./alasql.min.js";import{D as g,S as R,a as w,b}from"./DataFormatDigits.js";import{w as S}from"./withComponentStyle.js";var E,O,y,M,U;!function(t){t[t.ALL=-1]="ALL"}(E||(E={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(O||(O={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(y||(y={})),function(t){t.ASC="asc",t.DESC="desc"}(M||(M={})),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"}(U||(U={}));class G{constructor(t,e,o,n,s,r,i,l,a){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=e,this.value=o,this.prefix=r||"",this.cssStyle=n||"",this.prefixStyle=i||"prefix",this.type=s,this.mark=void 0,this.colSpan=l||1,this.measureScale=a||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 T{constructor(t,e,o){this.index=t,this.groupindex=e,this.type=o,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case U.HEADER:return"groupheader";case U.SEPERATORLINE:return"";case U.DRILLELEMENT:return"ofit";case U.PARTELEMENT:return"partof";case U.STANDARD:return"";case U.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,e,o,n,s,r,i,l,a,c=!1,h){let u=r;"category"===e&&null!=l&&(u=`category-${l.toString()}`),this.type===U.HEADER?u="headerlabel":this.type===U.SEPERATORLINE&&(u=e),this.type===U.PARTELEMENT&&("percent"===n&&(t="-"),"category"!==e&&"operation"!==e&&(n="percent",u="")),"-"===t&&(u="");let d="prefix-first";i&&(d="prefix-second"),o&&(u=`${u} ${o}`);const f=new G(e,this.elements.length,t,u,n,s,d,1,a);f.isBarChart=c,f.columnStats=h,this.elements.push(f)}}const _={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,fontFamily:"'Noto Sans', sans-serif",unitScaling:.01,percentageScaling:.5,scaleFactor:1},C="#666666";function L(t,e){return`pattern-${t}-${e.replace("#","")}`}const N=({styles:e})=>{const o=e.scaleFactor,n=6*o,s=[{id:L("pos",e.positive.stroke),stroke:e.positive.stroke,fill:e.positive.fill},{id:L("neg",e.negative.stroke),stroke:e.negative.stroke,fill:e.negative.fill},{id:L("neu",e.neutral.stroke),stroke:e.neutral.stroke,fill:e.neutral.fill}];return t("defs",null,s.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 P(t,e,o=1){let n,s;const r=t>=0?"+":"";if(e)return n=100*t,r+Math.round(n).toString()+"%";{let e;return n=t/o,s=Math.abs(n),e=s>=1e9?(n/1e9).toFixed(s>=1e10?0:1)+"B":s>=1e6?(n/1e6).toFixed(s>=1e7?0:1)+"M":s>=1e3?(n/1e3).toFixed(s>=1e4?0:1)+"K":n.toFixed(s>=10?0:1),e=e.replace(/\.0([KMB]?)$/,"$1"),r+e}}function x(t){const e=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(e)}function k(t){const e=t.slice(0,2).toLowerCase();return"pp"===e?"pp":"fc"===e?"fc":"pl"===e?"pl":"ac"}function A(t,e,o,n){return x(t)?function(t,e){const o=k(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)}const D=e=>{const{value:o,scenario:n,columnStats:s,height:r,isPositiveGood:i,formattedValue:l,measureScale:a,maxBarWidth:c=10,styles:h=_}=e,u=h.scaleFactor,d=h.fontSize,f=38*u,p=c*d,m=4*u,$=.15*p,v=p-m-$,g=Math.abs(o)*h.unitScaling*d,R=g>v,w=Math.max(0,s.absMax*h.unitScaling*d-v),b=Math.max(0,g-v),S=w>0?b/w*$:0,E=s.min<0,O=s.max>0,y=E?p:0,M=(E?f:0)+(y+(O?p:0))+(O?f:0),U=2*u,G=r-2*U,T=(E?f:0)+y,D=U,B=o>=0,F=A(n,o,i,h),Y=function(t,e){const o=t.fillpattern;return"hatched"===o?`url(#${L(e,t.stroke)})`:"outlined"===o?"transparent":t.fill}(F,x(n)?k(n):i?B?"pos":"neg":B?"neg":"pos"),{stroke:W,strokeWidth:H}="outlined"===(I=F).fillpattern?{stroke:I.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0};var I;const z=l||P(o,!1,a),j=R?v:g,V=R?v+m+S:g,Q=B?T+V+4*u:T-V-4*u,q=B?"start":"end";return t("svg",{width:M,height:r,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},t(N,{styles:h}),t("line",{x1:T,y1:0,x2:T,y2:r,stroke:C,"stroke-width":1*u}),j>0&&t("rect",{x:B?T:T-j,y:D,width:j,height:G,fill:Y,stroke:W,"stroke-width":H*u}),R&&S>0&&t("rect",{x:B?T+v+m:T-v-m-S,y:D,width:S,height:G,fill:Y,stroke:W,"stroke-width":H*u}),R&&function(e,o,n,s,r){const i=e+o/2,l=.35*o,a=s/3,c=.3*o;let h=`M ${i-l} ${n}`;for(let t=0;t<3;t++)h+=` L ${i-l-c} ${n+a*(t+.5)} L ${i-l} ${n+a*(t+1)}`;let u=`M ${i+l} ${n}`;for(let t=0;t<3;t++)u+=` L ${i+l+c} ${n+a*(t+.5)} L ${i+l} ${n+a*(t+1)}`;return[t("rect",{x:e,y:n-1,width:o,height:s+2,fill:"#ffffff"}),t("path",{d:h,fill:"none",stroke:"#000000","stroke-width":1*r}),t("path",{d:u,fill:"none",stroke:"#000000","stroke-width":1*r})]}(B?T+v:T-v-m,m,D,G,u),t("text",{x:Q,y:r/2,dy:"0.35em","text-anchor":q,fill:h.fontColor,"font-size":d,"font-family":h.fontFamily},z))},B=e=>{const{value:o,scenario:n,columnStats:s,height:r,isPositiveGood:i,formattedValue:l,measureScale:a,maxBarWidth:c=10,styles:h=_}=e,u=h.scaleFactor,d=h.fontSize,f=Math.round(.67*c*d),p=5*u,m=s.min<0?f+p:0,$=m+(s.max>0?f+p:0),v=$+45*u,g=m,R=r/2,w=100*Math.abs(o)*h.percentageScaling*d,b=w>f,S=Math.min(w,f),E=o>=0,O=E?g+S:g-S,y=A(n,o,i,h),M=3*u,U=l||P(o,!0,a),G=$+4*u;return t("svg",{width:v,height:r,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},t("line",{x1:g,y1:0,x2:g,y2:r,stroke:C,"stroke-width":1*u}),!b&&t("circle",{cx:O,cy:R,r:M,fill:h.fontColor}),t("line",{x1:g,y1:R,x2:O,y2:R,stroke:y.fill,"stroke-width":2*u}),b&&E&&t("polygon",{points:`${g+f},${R} ${g+f-6*u},${R-3*u} ${g+f-6*u},${R+3*u}`,fill:y.fill}),b&&!E&&t("polygon",{points:`${g-f},${R} ${g-f+6*u},${R-3*u} ${g-f+6*u},${R+3*u}`,fill:y.fill}),t("text",{x:G,y:r/2,dy:"0.35em","text-anchor":"start",fill:h.fontColor,"font-size":d,"font-style":"italic","font-family":h.fontFamily},U))},F=e=>{const{value:o,columnStats:n,isRelative:s,styles:r=_}=e;return null==o||isNaN(o)||!n||0===n.absMax?t("span",{class:"bar-chart-empty",style:{color:r.fontColor,fontStyle:"italic"}},"-"):t(s?B:D,Object.assign({},e))};class Y{constructor(t){v.fn.transformOperator=function(t){return"-"===t?-1:1},this.groups=[i.CATEGORY,i.CATEGORYINDEX],y.OPT!==t.type&&y.OPTNOTOTAL!==t.type||this.groups.unshift(i.OPERATION),t.grouped&&(this.groups.push(i.ROWGROUP),this.groups.push(i.ROWGROUPINDEX))}toString(){return this.groups.map((t=>`${t}`)).toString()}noCategory(){return this.groups.filter((t=>t!==i.CATEGORY))}toArray(){return this.groups}}class W{constructor(t,e){this.hasPartOf=!1,this.config=t,this.i18n=e}execute(t){if(0===t.length)return[];const e=[],o=[],n=[],s=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),r=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),l=this.getRelativeScenarios(),a=new Y(this.config),c=this.config.grouped?[i.ROWGROUP,i.ROWGROUPINDEX]:[];let h=["",""];return this.config.sortOrder.hierarchy.length>0&&(h=this.createOrderString(this.config.sortOrder)),this.hasPartOf=this.checkConfigForPartOf(),v(`SELECT COUNT(DISTINCT ${i.CATEGORY}) as ${i.TOTALROWCOUNT} ${c.length>0?","+c:""}\n FROM ? ${c.length>0?"GROUP BY "+c:""} \n ORDER BY ${h[0]}`,[t]).forEach((t=>{const n=t.rowGroup&&t.rowGroup.length>0?`WHERE ${i.ROWGROUP} = '${t.rowGroup}'`:"";let l="";this.config.limit&&(l=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,e),this.createDataRow(e,t,a,s,n,h,l),this.createRestRow(t,e,a,s,n,h),this.createGroupSumRow(e,o,t,r,h)})),this.createTotalSumRow(e,o,r),e.forEach((e=>{try{n.push(v(e,[t]))}catch(t){console.error("DataQuery: SQL query execution failed",e,t)}})),this.detectNaNCells(this.config.scenarios,n),this.createThereOfDrillRows(s,h,t,n),this.createPartOfDrillRows(s,h,o,t,n),this.createThereOfDrillColumns(this.config.categoryThereOf,t,n),this.calculateColumnGroupRest(n,this.config.categoryThereOf),this.calculateRelativeVariances(n,l),n}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,s){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===y.LIST||null==n||0===n.length)return;const r=this.createPartOfQuery(t,e);let l=[];r.forEach((function(t){l.push(...v(t,[n]))}));const a=this.exctractScenarioNames(t),c=[];o.forEach((function(t){c.push(...v(t,[n]))}));const h=new Map;c.forEach((t=>h.set(t[i.ROWGROUP],t))),l=this.reduceResDrillByCategoryGroups(l,a),l.forEach((function(t){a.forEach((e=>{try{t[e]=t[e]/h.get(t[i.ROWGROUP])[e]}catch(o){console.error("DataQuery: partOf drill row calculation failed",e,o),t[e]=Number.NaN}}))})),this.injectDrillRowsToResultRows(l,s)}createRestRow(t,e,o,n,s,r){t.totalRowCnt-this.config.limit>0&&0!==this.config.limit&&e.push(`SELECT ${i.ROWNR}, 1 as ${i.ROWGROUPINDEX} , 'ENTRY' as ${i.TYPE}, 'NO_GROUP' as ${i.ROWGROUP}, 'REST' as ${i.CATEGORY} , SUM(ac1) as ac1, SUM(pp1) as pp1, SUM(dpp1_ac1_pos) as dpp1_ac1_pos, SUM(drpp1_ac1_pos) as drpp1_ac1_pos, SUM(dr_pp1) as dr_pp1 FROM (SELECT ROWNUM() AS ${i.ROWNR}, ${e.length} as ${i.ROWGROUPINDEX} , 'ENTRY' as ${i.TYPE}, '${t.rowGroup||"NO_GROUP"}' as ${i.ROWGROUP}, ${o} ${n.length>0?",".concat(n):""} FROM ? ${s} GROUP BY ${o} ORDER BY ${r[0]}) t WHERE t.rowNr > ${this.config.limit}`)}createDataRow(t,e,o,n,s,r,l){t.push(`SELECT ROWNUM() AS ${i.ROWNR},\n ${t.length} as ${i.ROWGROUPINDEX},\n 'ENTRY' as ${i.TYPE},\n '${e.rowGroup||"NO_GROUP"}' as ${i.ROWGROUP},\n '${i.CATEGORYINDEX}',\n ${o} ${n.length>0?",".concat(n):""}\n FROM ? ${s}\n GROUP BY ${o}\n ORDER BY ${r[0]} ${l}`)}createGroupHeaderRow(t,e){!0===this.config.grouped&&e.push(`SELECT ROWNUM() AS ${i.ROWNR},\n ${e.length} as ${i.ROWGROUPINDEX},\n 'GROUPHEAD' as ${i.TYPE},\n '${t.rowGroup}' as ${i.ROWGROUP} ${this.config.showGroupTitle?`,'${t.rowGroup}' as ${i.CATEGORY}`:""}\n FROM ?\n GROUP BY '1'`)}createGroupSumRow(t,e,o,n,s){!0!==this.config.grouped||y.SUM!==this.config.type&&y.SUMNOTOTAL!==this.config.type&&y.OPT!==this.config.type&&y.OPTNOTOTAL!==this.config.type||(t.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n '=' as ${i.OPERATION},\n '${o.rowGroup}' as ${i.ROWGROUP},\n ROWNUM() AS ${i.ROWNR},\n 'GROUP_SUM' as ${i.TYPE} ${n.length>0?",".concat(n):""}\n FROM ?\n WHERE ${i.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${s[0]} `),e.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n '=' as ${i.OPERATION},\n '${o.rowGroup}' as ${i.ROWGROUP},\n ROWNUM() AS ${i.ROWNR},\n 'GROUP_SUM' as ${i.TYPE} ${n.length>0?",".concat(n):""}\n FROM ?\n WHERE ${i.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${s[0]} `))}createTotalSumRow(t,e,o){if(y.SUM===this.config.type||y.OPT===this.config.type){const e=`${this.hasPartOf&&!1===this.config.grouped?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} `:""}${this.config.title}`;t.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n '${e}' as ${i.ROWGROUP},\n '=' as ${i.OPERATION},\n 'SUM' as ${i.TYPE} ${o.length>0?",".concat(o):""}\n FROM ? `)}e.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${i.ROWGROUP},\n '=' as ${i.OPERATION},\n 'SUM' as ${i.TYPE} ${o.length>0?",".concat(o):""}\n FROM ? `)}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 s=o.get(n);e.forEach((e=>{try{s[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[i.ROWNR]=o.get(`${t.category}_${t.rowGroup}`),e.splice(n+t[i.ROWNR],0,t)}}))}));else{const n=this.findDuplicateSubCategories(t);t.forEach((function(t){e.forEach((function(e){const s=e.findIndex((e=>null!=e.category&&e.category===t.category));if(s>=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[i.ROWNR]||n.includes(t.subCategory))&&(t.subCategory=`${t.subCategory} (${t.rowGroup})`),e.splice(s+t[i.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,e,o,n){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const s=[],r=[];this.config.thereOf.forEach((o=>{let n=!0,r="1 <> 1 OR ( ";null!=o.category&&0!==o.category.length&&o.category.trim()&&(r+=` ${i.CATEGORY} = '${o.category}'`,n=!1),null!=o.rowGroup&&0!==o.rowGroup.length&&o.rowGroup.trim()&&(r+=` ${n?"":"AND"} ${i.ROWGROUP} = '${o.rowGroup}'`,n=!1),null!=o.subCategory&&0!==o.subCategory.length&&o.subCategory.trim()&&(r+=` ${n?"":"AND"} ${i.SUBCATEGORY} = '${o.subCategory}'`),r+=")",s.push(`SELECT ROWNUM() AS ${i.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${i.TYPE},\n ${i.CATEGORY},\n ${i.SUBCATEGORY},\n ${i.ROWGROUP} as ${i.ROWGROUP},\n ${t}\n FROM ?\n WHERE ${r}\n GROUP BY ${i.ROWGROUP}, ${i.CATEGORY}, ${i.SUBCATEGORY}\n ORDER BY ${e[1]}`)})),s.forEach((function(t){r.push(...v(t,[o]))})),this.injectDrillRowsToResultRows(r,n)}calculateRelativeVariances(t,e){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[i.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 s=t,r=[];for(const t of s)r.push(`${e}##${t.name}`);o.set(e,r),n.set(`${e}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[i.TYPE]&&o.forEach(((e,o)=>{let s=0;e.forEach((e=>{void 0!==t[e]&&(s+=t[e])})),t[`${o}##REST`]=t[o]-s,0!==t[`${o}##REST`]&&n.set(`${o}##REST`,!0)}))}))}));const s=Array.from(n.entries()).filter((([t,e])=>!e)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const e of s)delete t[e]}))}))}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 y.OPT===o||y.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`}createOrderString(t){return[`${t.hierarchy.toString()} ${t.direction}`,`${t.hierarchy.toString()} ${M.ASC===t.direction?M.DESC:M.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 s="1 <> 1 ",r=` ${i.ROWGROUP}`,l="ROWNUM()";return null===(o=this.config.partOf)||void 0===o||o.forEach((t=>{s+=`OR (${i.CATEGORY} = '${t.category}'`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(s+=`and ${i.ROWGROUP} = '${t.rowGroup}'`),!1===this.config.grouped&&(r=` 'SUM_TOTAL' as ${i.ROWGROUP} `,l="1"),s+=")"})),n.push(`SELECT ${l} AS ${i.ROWNR},\n 'PARTELEMENT' as ${i.TYPE},\n ${i.CATEGORY},\n ${r},\n ${t}\n FROM ?\n WHERE ${s}\n GROUP BY ${i.ROWGROUP}, ${i.CATEGORY}, ${i.TYPE}\n ORDER BY ${e[1]}`),n}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,e,o){if(null==t||0===t.size)return;const n=[],s=[];t.forEach(((t,e)=>{let o="1 <> 1 ";t.forEach((t=>{o+=` or columnGroup = '${t.name}' `})),n.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 WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),n.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 WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),n.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 WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),n.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 WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),n.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 WHERE ${o}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),n.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 WHERE ${o}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),n.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 WHERE ${o}\n GROUP BY rowlevel, columnGroup, scenario`),n.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 WHERE ${o}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of n)s.push(...v(t,[e]));this.injectDrillColumnsToResultRows(s,o)}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 H{constructor(){this.normalizedHeader=[]}createHeader(t,e,o,n,s,i){const l=[];this.normalizedHeader=this.normalizeHeader(t,e);const a=new T(0,0,U.HEADER),c=new T(1,0,U.SEPERATORLINE);for(const t of this.normalizedHeader)a.createElement(r.translateScenarioLabel(t.name,o),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,o,n,s,i),null,null,null,null),c.createElement(null,t.type,this.createColumnType(t),null,null,null,null,null,null);return l.push(a),l.push(c),l}setHeaderPrefix(t,e,o,n,s){let i="";return"category"===t.name&&s&&(0===o.prefix.length&&0===n.length||(i=r.translateScenarioLabel("in",e)+" "+o.prefix+n)),t.order&&(i+=r.translateScenarioLabel("ORDER_"+t.order,e)),i}normalizeHeader(t,e){let o=[{name:i.CATEGORY,group:i.CATEGORY,type:i.CATEGORY,order:void 0}];return y.OPT!==t&&y.OPTNOTOTAL!==t||(o=[{name:i.OPERATION,group:i.OPERATION,type:i.OPERATION,order:void 0},{name:i.CATEGORY,group:i.CATEGORY,type:i.CATEGORY,order:void 0}]),[...o,...e]}createBodyRows(t,e,o){const n=[];let s=-1;const r=new W(t,e).execute(o),i=this.calculateColumnStatistics(r,t.barColumns);for(const o of r)s+=1,n.push(...this.createRow(t.i18n,e,t.scenariosUnitType,o,s,-1,t.categoryWidth,t.measureScale,t.barColumns,i));return n}calculateColumnStatistics(t,e){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)for(const s of e){const e=this.extractColumnValue(t,s);if(null!==e&&!isNaN(e)){const t=o.get(s);t.min=Math.min(t.min,e),t.max=Math.max(t.max,e),n.get(s).push(Math.abs(e))}}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 s=n.get(t);if(s.length>0){s.sort(((t,e)=>t-e));const t=Math.floor(s.length/2);e.median=s.length%2==0?(s[t-1]+s[t])/2:s[t]}o.set(t,e)}return o}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,s,r,l,a,c,h){var u;const d=[];for(const f of n){const p=f[i.ROWGROUP],m=f[i.SUBCATEGORY],$=f[i.TYPE],v=f[i.ROWNR]>=2,g=this.createDetailRow($,r+=1,s,n.length);for(const n of this.normalizedHeader){const s=this.getRawDataRowElement(f,n),r=null!==(u=null==c?void 0:c.includes(n.type))&&void 0!==u&&u,i=r?null==h?void 0:h.get(n.type):void 0;g.createElement(this.translateSumCellLabel(t,e,s,p,m,$,n.type),n.type,this.createColumnType(n),this.setCellType(n.type,o),this.translateCellPrefix(e,$,n.type),this.translateScenarioCSS(n.type,s),v,l,null==a?void 0:a.value,r,i)}d.push(g)}return d}getRawDataRowElement(t,e){return 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 U.GROUPHEAD:return new T(e,o,U.HEADER);case U.SUM:case U.GROUPSUM:return new T(n+2,o,U.SUM);case U.DRILLELEMENT:return new T(n+2,o,U.DRILLELEMENT);case U.PARTELEMENT:return new T(n+2,o,U.PARTELEMENT);default:return new T(e,o,U.STANDARD)}}translateSumCellLabel(t,e,o,n,s,r,i){return!1===Number.isNaN(Number(o))||this.isOperationColumn(i)?o:this.isGroupHeadCategory(r,i)||this.isEntryCategory(r,i)?t===h.ALL?`${e.get(o)||o}`:o:this.isDrillElementCategory(r,i)?t===h.ALL?`${e.get(s)||s}`:`${s}`:this.isPartElementCategory(r,i)?t===h.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:`${n}`:this.isSumElementCategory(r,i)?t===h.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:n:"GROUPHEAD"===r&&null==o?o:Number.isNaN(Number(o))?"-":Number(o)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,e){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"";let o;const n=new l(t);return e===u.PERCENT?(o="percent",n.isValid&&"d"===n.type&&(o="decimal")):(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,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 I{constructor(t,e,o){this.data=[],this.headerRows=[],this.bodyRows=[],this.ruleSet=t||new a,this.dataSetFactory=new H,this.config=this.initConfig(o),this.i18n=this.initI18n(new Map),this.setData(e,o.filter),this.state=O.DIRTY}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"],["in","in"],["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=O.DIRTY,new Map([...e,...t||new Map])}initConfig(t){this.state=O.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)}setData(t,e){if(null==t)return;if(null!=e&&e.length>0)try{this.data=v(`SELECT * FROM ? WHERE ${e}`,[t])}catch(o){console.error("Table: filter query failed, using unfiltered data",e,o),this.data=t}else this.data=t;const o=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder);this.headerRows=this.dataSetFactory.createHeader(this.config.type,o,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale),this.bodyRows=this.dataSetFactory.createBodyRows(this.config,this.i18n,this.data),this.state=O.UP_TO_DATE}update(){const t=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder);this.headerRows=this.dataSetFactory.createHeader(this.config.type,t,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale),this.bodyRows=this.dataSetFactory.createBodyRows(this.config,this.i18n,this.data),this.state=O.UP_TO_DATE}getHeader(){return this.state===O.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===O.DIRTY&&this.update(),this.bodyRows}normalizeScenarios(t,e,o){var n;const s=[];for(const r of t){if(null==e?void 0:e.has(r)){const t=e.get(r);for(const e of t){s.push({name:e.name,group:e.name,type:r,order:void 0});for(const t of e.subGroups)s.push({name:t,group:e.name,type:r,order:void 0})}s.push({name:"REST",group:"REST",type:r,order:void 0})}let t;(null===(n=null==o?void 0:o.hierarchy)||void 0===n?void 0:n.at(0))===r&&(t=o.direction),s.push({name:r,group:r,type:r,order:t})}return s}hasNoData(){return 0===this.data.length}}class z{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=u.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.sortOrder=new p(new c).default(),this.type=y.LIST,this.limit=0,this.i18n=h.ALL,this.categoryWidth=m.W25,this.measureScale=new R,this.measureUnit="",this.measureType=$.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[]}}class j{constructor(t,e,o,n){this.tableDrillGroupAdapter=t,this.stringAdapter=e,this.orderAdapter=o,this.dataSet=n}adapt(t){const e=new z;return d.isString(t.title)&&(e.title=t.title),d.isArray(t.scenarios)&&(e.scenarios=f.adaptArray(t.scenarios,this.stringAdapter)),d.isExisting(t.scenariosUnitType)&&(e.scenariosUnitType=t.scenariosUnitType),d.isBoolean(t.grouped)&&(e.grouped=t.grouped),d.isBoolean(t.showGroupTitle)&&(e.showGroupTitle=t.showGroupTitle),d.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),d.isArray(t.thereOf)&&(e.thereOf=f.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),d.isExisting(t.categoryThereOf)&&(e.categoryThereOf=t.categoryThereOf),d.isArray(t.partOf)&&(e.partOf=f.adaptArray(t.partOf,this.tableDrillGroupAdapter)),d.isExisting(t.order)&&(e.sortOrder=this.orderAdapter.adapt(t.order)),d.isExisting(t.type)&&(e.type=t.type),d.isNumber(t.limit)&&(e.limit=t.limit),d.isExisting(t.i18n)&&(e.i18n=t.i18n),d.isExisting(t.categoryWidth)&&(e.categoryWidth=t.categoryWidth),d.isExisting(t.measureScale)&&(e.measureScale=g.calculateMeasureScale(this.dataSet,e.scenarios,t.measureScale)),d.isExisting(t.measureType)&&(e.measureType=t.measureType),d.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),d.isString(t.filter)&&(e.filter=t.filter.trim()),d.isArray(t.barColumns)&&(e.barColumns=t.barColumns),e}default(){return new z}}class V{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class Q{constructor(){}adapt(t){const e=new V;return d.isString(t.rowGroup)&&(e.rowGroup=t.rowGroup),d.isString(t.category)&&(e.category=t.category),d.isString(t.subCategory)&&(e.subCategory=t.subCategory),d.isString(t.partOf)&&(e.partOf=t.partOf),e}default(){return new V}}class q{constructor(){this.operation="+"}addRowGroup(t,e){this.rowGroup=t,this.rowGroupIndex=e}addCategory(t,e){this.category=t,this.categoryIndex=e}addSubCategory(t,e){this.subCategory=t,this.subCategoryIndex=e}addColumnGroup(t,e){this.columnGroup=t,this.columnGroupIndex=e}addSubColumnGroup(t,e){this.columnSubGroup=t,this.columnSubGroupIndex=e}}class K{constructor(){}adapt(t){const e=new q;return d.isOperator(t.operation)&&(e.operation=t.operation),d.isNumber(t.rowGroupIndex)&&d.isString(t.rowGroup)&&e.addRowGroup(t.rowGroup,t.rowGroupIndex),d.isNumber(t.categoryIndex)&&d.isString(t.category)&&e.addCategory(t.category,t.categoryIndex),d.isNumber(t.subCategoryIndex)&&d.isString(t.subCategory)&&e.addSubCategory(t.subCategory,t.subCategoryIndex),d.isNumber(t.columnGroupIndex)&&d.isString(t.columnGroup)&&e.addColumnGroup(t.columnGroup,t.columnGroupIndex),d.isNumber(t.columnSubGroupIndex)&&d.isString(t.columnSubGroup)&&e.addSubColumnGroup(t.columnSubGroup,t.columnSubGroupIndex),this.setActualValues(t,e),this.setPlanValues(t,e),this.setPreviousPeriodValues(t,e),this.setForecastValues(t,e),e}default(){return new q}setActualValues(t,e){d.isNumber(t.ac1)&&(e.ac1=t.ac1),d.isNumber(t.ac2)&&(e.ac2=t.ac2),d.isNumber(t.ac3)&&(e.ac3=t.ac3),d.isNumber(t.ac4)&&(e.ac4=t.ac4)}setPlanValues(t,e){d.isNumber(t.pp1)&&(e.pp1=t.pp1),d.isNumber(t.pp2)&&(e.pp2=t.pp2),d.isNumber(t.pp3)&&(e.pp3=t.pp3),d.isNumber(t.pp4)&&(e.pp4=t.pp4)}setPreviousPeriodValues(t,e){d.isNumber(t.pl1)&&(e.pl1=t.pl1),d.isNumber(t.pl2)&&(e.pl2=t.pl2),d.isNumber(t.pl3)&&(e.pl3=t.pl3),d.isNumber(t.pl4)&&(e.pl4=t.pl4)}setForecastValues(t,e){d.isNumber(t.fc1)&&(e.fc1=t.fc1),d.isNumber(t.fc2)&&(e.fc2=t.fc2),d.isNumber(t.fc3)&&(e.fc3=t.fc3),d.isNumber(t.fc4)&&(e.fc4=t.fc4)}}const J=e(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.data=[],this.tableTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=u.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.thereof=[],this.partof=[],this.order={hierarchy:[],direction:M.ASC},this.categorythereof=new Map,this.type=y.LIST,this.categoryWidth=m.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=h.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=$.VOLUME,this.filter="",this.barColumns=[],this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new w,this.componentStyle=S(this)}render(){return t(n,null,(()=>{if(void 0!==this.table){if(this.table.hasNoData()){const e=this.i18n.get("NO_DATA")||"==No Data==";return t("p",{class:"warning"},e)}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,s)=>t("span",null,n===s.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&&e.type!==U.SUM?t(F,{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,maxBarWidth:this.barColumnMaxWidth,styles:this.barChartStyles}):o.draw(this.componentDataFormatDigits)))))))))}})())}componentWillRender(){const t=this.prepareConfig(),e=this.prepareData();this.componentDataFormatDigits=(new b).adapt(this.dataFormatDigits),this.barChartStyles=this.prepareBarChartStyles(),this.table=new I(new a,e,t),this.table.setI18n(this.i18n)}prepareConfig(){return new j(new Q,new c,new p(new c),this.data).adapt({title:this.tableTitle,scenarios:this.scenarios,scenariosUnitType:this.scenariosDataFormat,grouped:this.grouped,showGroupTitle:this.showGroupTitle,thereOf:this.thereof,partOf:this.partof,categoryThereOf:this.categorythereof,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})}prepareData(){return f.adaptArray(this.data,new K)}prepareBarChartStyles(){return this.componentStyle((t=>{var e,o,n,s,r,i,l,a,c,h,u,d,f,p,m,$,v,g,R,w,b,S,E,O,y,M;const U=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.varianceStyles,G=null===(o=t["bn-chart-time"])||void 0===o?void 0:o.barStyles;return{positive:{stroke:(null===(n=null==U?void 0:U.pos)||void 0===n?void 0:n.stroke)||"#008f96",fill:(null===(s=null==U?void 0:U.pos)||void 0===s?void 0:s.fill)||"#008f96",fillpattern:(null===(r=null==U?void 0:U.pos)||void 0===r?void 0:r.fillpattern)||"solid"},negative:{stroke:(null===(i=null==U?void 0:U.neg)||void 0===i?void 0:i.stroke)||"#ff0000",fill:(null===(l=null==U?void 0:U.neg)||void 0===l?void 0:l.fill)||"#ff0000",fillpattern:(null===(a=null==U?void 0:U.neg)||void 0===a?void 0:a.fillpattern)||"solid"},neutral:{stroke:(null===(c=null==U?void 0:U.neu)||void 0===c?void 0:c.stroke)||"#808080",fill:(null===(h=null==U?void 0:U.neu)||void 0===h?void 0:h.fill)||"#808080",fillpattern:(null===(u=null==U?void 0:U.neu)||void 0===u?void 0:u.fillpattern)||"outlined"},scenarios:{ac:{stroke:(null===(d=null==G?void 0:G.ac)||void 0===d?void 0:d.stroke)||"#404040",fill:(null===(f=null==G?void 0:G.ac)||void 0===f?void 0:f.fill)||"#404040",fillpattern:(null===(p=null==G?void 0:G.ac)||void 0===p?void 0:p.fillpattern)||"solid"},pp:{stroke:(null===(m=null==G?void 0:G.pp)||void 0===m?void 0:m.stroke)||"#A6A6A6",fill:(null===($=null==G?void 0:G.pp)||void 0===$?void 0:$.fill)||"#A6A6A6",fillpattern:(null===(v=null==G?void 0:G.pp)||void 0===v?void 0:v.fillpattern)||"solid"},fc:{stroke:(null===(g=null==G?void 0:G.fc)||void 0===g?void 0:g.stroke)||"#404040",fill:(null===(R=null==G?void 0:G.fc)||void 0===R?void 0:R.fill)||"#ffffff",fillpattern:(null===(w=null==G?void 0:G.fc)||void 0===w?void 0:w.fillpattern)||"hatched"},pl:{stroke:(null===(b=null==G?void 0:G.pl)||void 0===b?void 0:b.stroke)||"#404040",fill:(null===(S=null==G?void 0:G.pl)||void 0===S?void 0:S.fill)||"#ffffff",fillpattern:(null===(E=null==G?void 0:G.pl)||void 0===E?void 0:E.fillpattern)||"outlined"}},fontColor:(null===(O=t.global)||void 0===O?void 0:O.fontColor)||"#000000",fontSize:.85*((null===(y=t.global)||void 0===y?void 0:y.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:(null===(M=t.global)||void 0===M?void 0:M.fontFamily)||"'Noto Sans', sans-serif",unitScaling:this.unitScaling,percentageScaling:this.percentageScaling,scaleFactor:this.scaleFactor}}))}get element(){return this}static get style(){return':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}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",{data:[16],tableTitle:[1,"table-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],type:[1],categoryWidth:[1,"category-width"],dataFormatDigits:[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],barColumnMaxWidth:[2,"bar-column-max-width"],unitScaling:[2,"unit-scaling"],percentageScaling:[2,"percentage-scaling"],scaleFactor:[2,"scale-factor"]}]);function X(){"undefined"!=typeof customElements&&["ibcs-table"].forEach((t=>{"ibcs-table"===t&&(customElements.get(s(t))||customElements.define(s(t),J))}))}export{J as I,y as T,X as d}
1
+ import{h as t,proxyCustomElement as e,HTMLElement as o,Host as s,transformTag as n}from"@stencil/core/internal/client";import{F as r,Q as i,V as a,I as l,S as c}from"./ibcsRuleSet.js";import{I as h,D as u,j as d,k as f,l as p,e as m,M as $}from"./Order.js";import{a as v}from"./alasql.min.js";import{D as g,S as R,a as w,b}from"./DataFormatDigits.js";import{w as S}from"./withComponentStyle.js";var E,O,y,M,U;!function(t){t[t.ALL=-1]="ALL"}(E||(E={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(O||(O={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(y||(y={})),function(t){t.ASC="asc",t.DESC="desc"}(M||(M={})),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"}(U||(U={}));class G{constructor(t,e,o,s,n,r,i,a,l){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=e,this.value=o,this.prefix=r||"",this.cssStyle=s||"",this.prefixStyle=i||"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){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,s=t.percent;return"decimal"===this.type&&(e=+e/this.measureScale,o=t.decimal,s=t.decimal),r.number(Number(e),this.type,o,s)}drawPrefix(){return null==this.prefix?"":this.prefix}}class T{constructor(t,e,o){this.index=t,this.groupindex=e,this.type=o,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case U.HEADER:return"groupheader";case U.SEPERATORLINE:return"";case U.DRILLELEMENT:return"ofit";case U.PARTELEMENT:return"partof";case U.STANDARD:return"";case U.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,e,o,s,n,r,i,a,l,c=!1,h){let u=r;"category"===e&&null!=a&&(u=`category-${a.toString()}`),this.type===U.HEADER?u="headerlabel":this.type===U.SEPERATORLINE&&(u=e),this.type===U.PARTELEMENT&&("percent"===s&&(t="-"),"category"!==e&&"operation"!==e&&(s="percent",u="")),"-"===t&&(u="");let d="prefix-first";i&&(d="prefix-second"),o&&(u=`${u} ${o}`);const f=new G(e,this.elements.length,t,u,s,n,d,1,l);f.isBarChart=c,f.columnStats=h,this.elements.push(f)}}const _={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,fontFamily:"'Noto Sans', sans-serif",unitScaling:.01,percentageScaling:.5,scaleFactor:1},C="#666666";function L(t,e){return`pattern-${t}-${e.replace("#","")}`}const N=({styles:e})=>{const o=e.scaleFactor,s=6*o,n=[{id:L("pos",e.positive.stroke),stroke:e.positive.stroke,fill:e.positive.fill},{id:L("neg",e.negative.stroke),stroke:e.negative.stroke,fill:e.negative.fill},{id:L("neu",e.neutral.stroke),stroke:e.neutral.stroke,fill:e.neutral.fill}];return t("defs",null,n.map((e=>t("pattern",{id:e.id,patternUnits:"userSpaceOnUse",width:s,height:s},t("rect",{width:s,height:s,fill:"#ffffff"}),t("line",{x1:"0",y1:s,x2:s,y2:"0",stroke:e.stroke,"stroke-width":1.5*o})))))};function P(t,e,o=1){let s,n;const r=t>=0?"+":"";if(e)return s=100*t,r+Math.round(s).toString()+"%";{let e;return s=t/o,n=Math.abs(s),e=n>=1e9?(s/1e9).toFixed(n>=1e10?0:1)+"B":n>=1e6?(s/1e6).toFixed(n>=1e7?0:1)+"M":n>=1e3?(s/1e3).toFixed(n>=1e4?0:1)+"K":s.toFixed(n>=10?0:1),e=e.replace(/\.0([KMB]?)$/,"$1"),r+e}}function x(t){const e=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(e)}function k(t){const e=t.slice(0,2).toLowerCase();return"pp"===e?"pp":"fc"===e?"fc":"pl"===e?"pl":"ac"}function A(t,e,o,s){return x(t)?function(t,e){const o=k(t);return e.scenarios[o]}(t,s):function(t,e,o){const s=t>=0;return e?s?o.positive:o.negative:s?o.negative:o.positive}(e,o,s)}const D=e=>{const{value:o,scenario:s,columnStats:n,height:r,isPositiveGood:i,formattedValue:a,measureScale:l,maxBarWidth:c=10,styles:h=_}=e,u=h.scaleFactor,d=h.fontSize,f=38*u,p=c*d,m=4*u,$=.15*p,v=p-m-$,g=Math.abs(o)*h.unitScaling*d,R=g>v,w=Math.max(0,n.absMax*h.unitScaling*d-v),b=Math.max(0,g-v),S=w>0?b/w*$:0,E=n.min<0,O=n.max>0,y=E?p:0,M=(E?f:0)+(y+(O?p:0))+(O?f:0),U=2*u,G=r-2*U,T=(E?f:0)+y,D=U,B=o>=0,F=A(s,o,i,h),Y=function(t,e){const o=t.fillpattern;return"hatched"===o?`url(#${L(e,t.stroke)})`:"outlined"===o?"transparent":t.fill}(F,x(s)?k(s):i?B?"pos":"neg":B?"neg":"pos"),{stroke:W,strokeWidth:H}="outlined"===(I=F).fillpattern?{stroke:I.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0};var I;const z=a||P(o,!1,l),j=R?v:g,V=R?v+m+S:g,Q=B?T+V+4*u:T-V-4*u,q=B?"start":"end";return t("svg",{width:M,height:r,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},t(N,{styles:h}),t("line",{x1:T,y1:0,x2:T,y2:r,stroke:C,"stroke-width":1*u}),j>0&&t("rect",{x:B?T:T-j,y:D,width:j,height:G,fill:Y,stroke:W,"stroke-width":H*u}),R&&S>0&&t("rect",{x:B?T+v+m:T-v-m-S,y:D,width:S,height:G,fill:Y,stroke:W,"stroke-width":H*u}),R&&function(e,o,s,n,r){const i=e+o/2,a=.35*o,l=n/3,c=.3*o;let h=`M ${i-a} ${s}`;for(let t=0;t<3;t++)h+=` L ${i-a-c} ${s+l*(t+.5)} L ${i-a} ${s+l*(t+1)}`;let u=`M ${i+a} ${s}`;for(let t=0;t<3;t++)u+=` L ${i+a+c} ${s+l*(t+.5)} L ${i+a} ${s+l*(t+1)}`;return[t("rect",{x:e,y:s-1,width:o,height:n+2,fill:"#ffffff"}),t("path",{d:h,fill:"none",stroke:"#000000","stroke-width":1*r}),t("path",{d:u,fill:"none",stroke:"#000000","stroke-width":1*r})]}(B?T+v:T-v-m,m,D,G,u),t("text",{x:Q,y:r/2,dy:"0.35em","text-anchor":q,fill:h.fontColor,"font-size":d,"font-family":h.fontFamily},z))},B=e=>{const{value:o,scenario:s,columnStats:n,height:r,isPositiveGood:i,formattedValue:a,measureScale:l,maxBarWidth:c=10,styles:h=_}=e,u=h.scaleFactor,d=h.fontSize,f=Math.round(.67*c*d),p=5*u,m=n.min<0?f+p:0,$=m+(n.max>0?f+p:0),v=$+45*u,g=m,R=r/2,w=100*Math.abs(o)*h.percentageScaling*d,b=w>f,S=Math.min(w,f),E=o>=0,O=E?g+S:g-S,y=A(s,o,i,h),M=3*u,U=a||P(o,!0,l),G=$+4*u;return t("svg",{width:v,height:r,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},t("line",{x1:g,y1:0,x2:g,y2:r,stroke:C,"stroke-width":1*u}),!b&&t("circle",{cx:O,cy:R,r:M,fill:h.fontColor}),t("line",{x1:g,y1:R,x2:O,y2:R,stroke:y.fill,"stroke-width":2*u}),b&&E&&t("polygon",{points:`${g+f},${R} ${g+f-6*u},${R-3*u} ${g+f-6*u},${R+3*u}`,fill:y.fill}),b&&!E&&t("polygon",{points:`${g-f},${R} ${g-f+6*u},${R-3*u} ${g-f+6*u},${R+3*u}`,fill:y.fill}),t("text",{x:G,y:r/2,dy:"0.35em","text-anchor":"start",fill:h.fontColor,"font-size":d,"font-style":"italic","font-family":h.fontFamily},U))},F=e=>{const{value:o,columnStats:s,isRelative:n,styles:r=_}=e;return null==o||isNaN(o)||!s||0===s.absMax?t("span",{class:"bar-chart-empty",style:{color:r.fontColor,fontStyle:"italic"}},"-"):t(n?B:D,Object.assign({},e))};class Y{constructor(t){v.fn.transformOperator=function(t){return"-"===t?-1:1},this.groups=[i.CATEGORY,i.CATEGORYINDEX],y.OPT!==t.type&&y.OPTNOTOTAL!==t.type||this.groups.unshift(i.OPERATION),t.grouped&&(this.groups.push(i.ROWGROUP),this.groups.push(i.ROWGROUPINDEX))}toString(){return this.groups.map((t=>`${t}`)).toString()}noCategory(){return this.groups.filter((t=>t!==i.CATEGORY))}toArray(){return this.groups}}class W{constructor(t,e){this.hasPartOf=!1,this.config=t,this.i18n=e}execute(t){if(0===t.length)return[];const e=[],o=[],s=[],n=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),r=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),a=this.getRelativeScenarios(),l=new Y(this.config),c=this.config.grouped?[i.ROWGROUP,i.ROWGROUPINDEX]:[];let h=["",""];return this.config.sortOrder.hierarchy.length>0&&(h=this.createOrderString(this.config.sortOrder)),this.hasPartOf=this.checkConfigForPartOf(),v(`SELECT COUNT(DISTINCT ${i.CATEGORY}) as ${i.TOTALROWCOUNT} ${c.length>0?","+c:""}\n FROM ? ${c.length>0?"GROUP BY "+c:""} \n ORDER BY ${h[0]}`,[t]).forEach((t=>{const s=t.rowGroup&&t.rowGroup.length>0?`WHERE ${i.ROWGROUP} = '${t.rowGroup}'`:"";let a="";this.config.limit&&(a=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,e),this.createDataRow(e,t,l,n,s,h,a),this.createRestRow(t,e,l,n,s,h),this.createGroupSumRow(e,o,t,r,h)})),this.createTotalSumRow(e,o,r),e.forEach((e=>{try{s.push(v(e,[t]))}catch(t){console.error("DataQuery: SQL query execution failed",e,t)}})),this.detectNaNCells(this.config.scenarios,s),this.createThereOfDrillRows(n,h,t,s),this.createPartOfDrillRows(n,h,o,t,s),this.createThereOfDrillColumns(this.config.categoryThereOf,t,s),this.calculateColumnGroupRest(s,this.config.categoryThereOf),this.calculateRelativeVariances(s,a),s}detectNaNCells(t,e){e.forEach((e=>{e.map((e=>(t.forEach((t=>{const o=new a(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,s,n){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===y.LIST||null==s||0===s.length)return;const r=this.createPartOfQuery(t,e);let a=[];r.forEach((function(t){a.push(...v(t,[s]))}));const l=this.exctractScenarioNames(t),c=[];o.forEach((function(t){c.push(...v(t,[s]))}));const h=new Map;c.forEach((t=>h.set(t[i.ROWGROUP],t))),a=this.reduceResDrillByCategoryGroups(a,l),a.forEach((function(t){l.forEach((e=>{try{t[e]=t[e]/h.get(t[i.ROWGROUP])[e]}catch(o){console.error("DataQuery: partOf drill row calculation failed",e,o),t[e]=Number.NaN}}))})),this.injectDrillRowsToResultRows(a,n)}createRestRow(t,e,o,s,n,r){t.totalRowCnt-this.config.limit>0&&0!==this.config.limit&&e.push(`SELECT ${i.ROWNR}, 1 as ${i.ROWGROUPINDEX} , 'ENTRY' as ${i.TYPE}, 'NO_GROUP' as ${i.ROWGROUP}, 'REST' as ${i.CATEGORY} , SUM(ac1) as ac1, SUM(pp1) as pp1, SUM(dpp1_ac1_pos) as dpp1_ac1_pos, SUM(drpp1_ac1_pos) as drpp1_ac1_pos, SUM(dr_pp1) as dr_pp1 FROM (SELECT ROWNUM() AS ${i.ROWNR}, ${e.length} as ${i.ROWGROUPINDEX} , 'ENTRY' as ${i.TYPE}, '${t.rowGroup||"NO_GROUP"}' as ${i.ROWGROUP}, ${o} ${s.length>0?",".concat(s):""} FROM ? ${n} GROUP BY ${o} ORDER BY ${r[0]}) t WHERE t.rowNr > ${this.config.limit}`)}createDataRow(t,e,o,s,n,r,a){t.push(`SELECT ROWNUM() AS ${i.ROWNR},\n ${t.length} as ${i.ROWGROUPINDEX},\n 'ENTRY' as ${i.TYPE},\n '${e.rowGroup||"NO_GROUP"}' as ${i.ROWGROUP},\n '${i.CATEGORYINDEX}',\n ${o} ${s.length>0?",".concat(s):""}\n FROM ? ${n}\n GROUP BY ${o}\n ORDER BY ${r[0]} ${a}`)}createGroupHeaderRow(t,e){!0===this.config.grouped&&e.push(`SELECT ROWNUM() AS ${i.ROWNR},\n ${e.length} as ${i.ROWGROUPINDEX},\n 'GROUPHEAD' as ${i.TYPE},\n '${t.rowGroup}' as ${i.ROWGROUP} ${this.config.showGroupTitle?`,'${t.rowGroup}' as ${i.CATEGORY}`:""}\n FROM ?\n GROUP BY '1'`)}createGroupSumRow(t,e,o,s,n){!0!==this.config.grouped||y.SUM!==this.config.type&&y.SUMNOTOTAL!==this.config.type&&y.OPT!==this.config.type&&y.OPTNOTOTAL!==this.config.type||(t.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n '=' as ${i.OPERATION},\n '${o.rowGroup}' as ${i.ROWGROUP},\n ROWNUM() AS ${i.ROWNR},\n 'GROUP_SUM' as ${i.TYPE} ${s.length>0?",".concat(s):""}\n FROM ?\n WHERE ${i.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${n[0]} `),e.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n '=' as ${i.OPERATION},\n '${o.rowGroup}' as ${i.ROWGROUP},\n ROWNUM() AS ${i.ROWNR},\n 'GROUP_SUM' as ${i.TYPE} ${s.length>0?",".concat(s):""}\n FROM ?\n WHERE ${i.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${n[0]} `))}createTotalSumRow(t,e,o){if(y.SUM===this.config.type||y.OPT===this.config.type){const e=`${this.hasPartOf&&!1===this.config.grouped?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} `:""}${this.config.title}`;t.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n '${e}' as ${i.ROWGROUP},\n '=' as ${i.OPERATION},\n 'SUM' as ${i.TYPE} ${o.length>0?",".concat(o):""}\n FROM ? `)}e.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${i.ROWGROUP},\n '=' as ${i.OPERATION},\n 'SUM' as ${i.TYPE} ${o.length>0?",".concat(o):""}\n FROM ? `)}reduceResDrillByCategoryGroups(t,e){const o=new Map;return t.forEach((function(t){const s=t.rowNr+t.rowGroup+t.type+t.category;if(o.has(s)){const n=o.get(s);e.forEach((e=>{try{n[e]+=t[e]}catch(t){console.error("DataQuery: drill row aggregation failed",e,t)}}))}else o.set(s,t)})),[...o.values()]}injectDrillRowsToResultRows(t,e){const o=new Map;if(!0===this.config.grouped)t.forEach((function(t){e.forEach((function(e){const s=e.findIndex((e=>e.category===t.category&&e.rowGroup===t.rowGroup));if(s>=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[i.ROWNR]=o.get(`${t.category}_${t.rowGroup}`),e.splice(s+t[i.ROWNR],0,t)}}))}));else{const s=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(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[i.ROWNR]||s.includes(t.subCategory))&&(t.subCategory=`${t.subCategory} (${t.rowGroup})`),e.splice(n+t[i.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,e,o,s){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const n=[],r=[];this.config.thereOf.forEach((o=>{let s=!0,r="1 <> 1 OR ( ";null!=o.category&&0!==o.category.length&&o.category.trim()&&(r+=` ${i.CATEGORY} = '${o.category}'`,s=!1),null!=o.rowGroup&&0!==o.rowGroup.length&&o.rowGroup.trim()&&(r+=` ${s?"":"AND"} ${i.ROWGROUP} = '${o.rowGroup}'`,s=!1),null!=o.subCategory&&0!==o.subCategory.length&&o.subCategory.trim()&&(r+=` ${s?"":"AND"} ${i.SUBCATEGORY} = '${o.subCategory}'`),r+=")",n.push(`SELECT ROWNUM() AS ${i.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${i.TYPE},\n ${i.CATEGORY},\n ${i.SUBCATEGORY},\n ${i.ROWGROUP} as ${i.ROWGROUP},\n ${t}\n FROM ?\n WHERE ${r}\n GROUP BY ${i.ROWGROUP}, ${i.CATEGORY}, ${i.SUBCATEGORY}\n ORDER BY ${e[1]}`)})),n.forEach((function(t){r.push(...v(t,[o]))})),this.injectDrillRowsToResultRows(r,s)}calculateRelativeVariances(t,e){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[i.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,s=new Map;e.forEach(((t,e)=>{const n=t,r=[];for(const t of n)r.push(`${e}##${t.name}`);o.set(e,r),s.set(`${e}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[i.TYPE]&&o.forEach(((e,o)=>{let n=0;e.forEach((e=>{void 0!==t[e]&&(n+=t[e])})),t[`${o}##REST`]=t[o]-n,0!==t[`${o}##REST`]&&s.set(`${o}##REST`,!0)}))}))}));const n=Array.from(s.entries()).filter((([t,e])=>!e)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const e of n)delete t[e]}))}))}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 s=new a(t);return y.OPT===o||y.OPTNOTOTAL===o?s.isValid?"dr"===s.type?`SUM(${s.base} - ${s.delta}) as ${t}, SUM(${s.delta}) as dr_${s.delta}`:`SUM(${s.base} - ${s.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`:s.isValid?"dr"===s.type?`SUM((${s.base} * transformOperator(operation)) - (${s.delta} * transformOperator(operation))) as ${t}, SUM(${s.delta} * transformOperator(operation)) as dr_${s.delta}`:`SUM((${s.base} * transformOperator(operation))- (${s.delta} * transformOperator(operation))) as ${t}`:`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}createOrderString(t){return[`${t.hierarchy.toString()} ${t.direction}`,`${t.hierarchy.toString()} ${M.ASC===t.direction?M.DESC:M.ASC}`]}createRelativeScenario(t){const e=new a(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 s=[];let n="1 <> 1 ",r=` ${i.ROWGROUP}`,a="ROWNUM()";return null===(o=this.config.partOf)||void 0===o||o.forEach((t=>{n+=`OR (${i.CATEGORY} = '${t.category}'`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(n+=`and ${i.ROWGROUP} = '${t.rowGroup}'`),!1===this.config.grouped&&(r=` 'SUM_TOTAL' as ${i.ROWGROUP} `,a="1"),n+=")"})),s.push(`SELECT ${a} AS ${i.ROWNR},\n 'PARTELEMENT' as ${i.TYPE},\n ${i.CATEGORY},\n ${r},\n ${t}\n FROM ?\n WHERE ${n}\n GROUP BY ${i.ROWGROUP}, ${i.CATEGORY}, ${i.TYPE}\n ORDER BY ${e[1]}`),s}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,e,o){if(null==t||0===t.size)return;const s=[],n=[];t.forEach(((t,e)=>{let o="1 <> 1 ";t.forEach((t=>{o+=` or columnGroup = '${t.name}' `})),s.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 WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),s.push(`SELECT 'ENTRY' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),s.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),s.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),s.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),s.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),s.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 WHERE ${o}\n GROUP BY rowlevel, columnGroup, scenario`),s.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 WHERE ${o}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of s)n.push(...v(t,[e]));this.injectDrillColumnsToResultRows(n,o)}injectDrillColumnsToResultRows(t,e){const o="##";for(const s of t)for(const t of e)for(const e of t)e.type===s.rowlevel&&("ENTRY"===s.rowlevel?"COLUMNGROUP"===s.columnlevel&&e.category===s.category?e[s.scenario+o+s.columnGroup]=s.val:"SUBGROUP"===s.columnlevel&&e.category===s.category&&(e[s.scenario+o+s.columnGroup+o+s.columnSubGroup]=s.val):"DRILLELEMENT"===s.rowlevel?"COLUMNGROUP"===s.columnlevel&&e.category===s.category&&e.subCategory===s.subCategory?e[s.scenario+o+s.columnGroup]=s.val:"SUBGROUP"===s.columnlevel&&e.category===s.category&&e.subCategory===s.subCategory?e[s.scenario+o+s.columnGroup+o+s.columnSubGroup]=s.val:"COLUMNGROUP"===s.columnlevel&&e.category===s.category&&e.subCategory===`${s.subCategory} (${s.rowGroup})`?e[s.scenario+o+s.columnGroup]=s.val:"SUBGROUP"===s.columnlevel&&e.category===s.category&&e.subCategory===`${s.subCategory} (${s.rowGroup})`&&(e[s.scenario+o+s.columnGroup+o+s.columnSubGroup]=s.val):("SUM"===s.rowlevel||"GROUP_SUM"===s.rowlevel)&&("COLUMNGROUP"===s.columnlevel&&e.category===s.category&&e.subCategory===s.subCategory&&(e[s.scenario+o+s.columnGroup]=s.val),"SUBGROUP"===s.columnlevel&&e.category===s.category&&e.subCategory===s.subCategory&&(e[s.scenario+o+s.columnGroup+o+s.columnSubGroup]=s.val)))}}class H{constructor(){this.normalizedHeader=[]}createHeader(t,e,o,s,n,i){const a=[];this.normalizedHeader=this.normalizeHeader(t,e);const l=new T(0,0,U.HEADER),c=new T(1,0,U.SEPERATORLINE);for(const t of this.normalizedHeader)l.createElement(r.translateScenarioLabel(t.name,o),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,o,s,n,i),null,null,null,null),c.createElement(null,t.type,this.createColumnType(t),null,null,null,null,null,null);return a.push(l),a.push(c),a}setHeaderPrefix(t,e,o,s,n){let i="";return"category"===t.name&&n&&(0===o.prefix.length&&0===s.length||(i=r.translateScenarioLabel("in",e)+" "+o.prefix+s)),t.order&&(i+=r.translateScenarioLabel("ORDER_"+t.order,e)),i}normalizeHeader(t,e){let o=[{name:i.CATEGORY,group:i.CATEGORY,type:i.CATEGORY,order:void 0}];return y.OPT!==t&&y.OPTNOTOTAL!==t||(o=[{name:i.OPERATION,group:i.OPERATION,type:i.OPERATION,order:void 0},{name:i.CATEGORY,group:i.CATEGORY,type:i.CATEGORY,order:void 0}]),[...o,...e]}createBodyRows(t,e,o){const s=[];let n=-1;const r=new W(t,e).execute(o),i=this.calculateColumnStatistics(r,t.barColumns);for(const o of r)n+=1,s.push(...this.createRow(t.i18n,e,t.scenariosUnitType,o,n,-1,t.categoryWidth,t.measureScale,t.barColumns,i));return s}calculateColumnStatistics(t,e){const o=new Map;if(!e||0===e.length)return o;const s=new Map;for(const t of e)o.set(t,{min:1/0,max:-1/0,absMax:0,median:0}),s.set(t,[]);for(const n of t)for(const t of n)for(const n of e){const e=this.extractColumnValue(t,n);if(null!==e&&!isNaN(e)){const t=o.get(n);t.min=Math.min(t.min,e),t.max=Math.max(t.max,e),s.get(n).push(Math.abs(e))}}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 n=s.get(t);if(n.length>0){n.sort(((t,e)=>t-e));const t=Math.floor(n.length/2);e.median=n.length%2==0?(n[t-1]+n[t])/2:n[t]}o.set(t,e)}return o}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,s,n,r,a,l,c,h){var u;const d=[];for(const f of s){const p=f[i.ROWGROUP],m=f[i.SUBCATEGORY],$=f[i.TYPE],v=f[i.ROWNR]>=2,g=this.createDetailRow($,r+=1,n,s.length);for(const s of this.normalizedHeader){const n=this.getRawDataRowElement(f,s),r=null!==(u=null==c?void 0:c.includes(s.type))&&void 0!==u&&u,i=r?null==h?void 0:h.get(s.type):void 0;g.createElement(this.translateSumCellLabel(t,e,n,p,m,$,s.type),s.type,this.createColumnType(s),this.setCellType(s.type,o),this.translateCellPrefix(e,$,s.type),this.translateScenarioCSS(s.type,n),v,a,null==l?void 0:l.value,r,i)}d.push(g)}return d}getRawDataRowElement(t,e){return 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,s){switch(t){case U.GROUPHEAD:return new T(e,o,U.HEADER);case U.SUM:case U.GROUPSUM:return new T(s+2,o,U.SUM);case U.DRILLELEMENT:return new T(s+2,o,U.DRILLELEMENT);case U.PARTELEMENT:return new T(s+2,o,U.PARTELEMENT);default:return new T(e,o,U.STANDARD)}}translateSumCellLabel(t,e,o,s,n,r,i){return!1===Number.isNaN(Number(o))||this.isOperationColumn(i)?o:this.isGroupHeadCategory(r,i)||this.isEntryCategory(r,i)?t===h.ALL?`${e.get(o)||o}`:o:this.isDrillElementCategory(r,i)?t===h.ALL?`${e.get(n)||n}`:`${n}`:this.isPartElementCategory(r,i)?t===h.ALL||"SUM_TOTAL"===s?`${e.get(s)||s}`:`${s}`:this.isSumElementCategory(r,i)?t===h.ALL||"SUM_TOTAL"===s?`${e.get(s)||s}`:s:"GROUPHEAD"===r&&null==o?o:Number.isNaN(Number(o))?"-":Number(o)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,e){const o=new a(t);let s="pos";return e<0&&(s="neg"),o.isValid?s+"_"+o.direction+("dr"===o.type?" relative_variance":""):t}setCellType(t,e){if("category"===t)return"";let o;const s=new a(t);return e===u.PERCENT?(o="percent",s.isValid&&"d"===s.type&&(o="decimal")):(o="decimal",s.isValid&&"dr"===s.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,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 I{constructor(t,e,o){this.data=[],this.headerRows=[],this.bodyRows=[],this.ruleSet=t||new l,this.dataSetFactory=new H,this.config=this.initConfig(o),this.i18n=this.initI18n(new Map),this.setData(e,o.filter),this.state=O.DIRTY}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"],["in","in"],["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=O.DIRTY,new Map([...e,...t||new Map])}initConfig(t){this.state=O.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)}setData(t,e){if(null==t)return;if(null!=e&&e.length>0)try{this.data=v(`SELECT * FROM ? WHERE ${e}`,[t])}catch(o){console.error("Table: filter query failed, using unfiltered data",e,o),this.data=t}else this.data=t;const o=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder);this.headerRows=this.dataSetFactory.createHeader(this.config.type,o,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale),this.bodyRows=this.dataSetFactory.createBodyRows(this.config,this.i18n,this.data),this.state=O.UP_TO_DATE}update(){const t=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder);this.headerRows=this.dataSetFactory.createHeader(this.config.type,t,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale),this.bodyRows=this.dataSetFactory.createBodyRows(this.config,this.i18n,this.data),this.state=O.UP_TO_DATE}getHeader(){return this.state===O.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===O.DIRTY&&this.update(),this.bodyRows}normalizeScenarios(t,e,o){var s;const n=[];for(const r of t){if(null==e?void 0:e.has(r)){const t=e.get(r);for(const e of t){n.push({name:e.name,group:e.name,type:r,order:void 0});for(const t of e.subGroups)n.push({name:t,group:e.name,type:r,order:void 0})}n.push({name:"REST",group:"REST",type:r,order:void 0})}let t;(null===(s=null==o?void 0:o.hierarchy)||void 0===s?void 0:s.at(0))===r&&(t=o.direction),n.push({name:r,group:r,type:r,order:t})}return n}hasNoData(){return 0===this.data.length}}class z{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=u.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.sortOrder=new p(new c).default(),this.type=y.LIST,this.limit=0,this.i18n=h.ALL,this.categoryWidth=m.W25,this.measureScale=new R,this.measureUnit="",this.measureType=$.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[]}}class j{constructor(t,e,o,s){this.tableDrillGroupAdapter=t,this.stringAdapter=e,this.orderAdapter=o,this.dataSet=s}adapt(t){const e=new z;return d.isString(t.title)&&(e.title=t.title),d.isArray(t.scenarios)&&(e.scenarios=f.adaptArray(t.scenarios,this.stringAdapter)),d.isExisting(t.scenariosUnitType)&&(e.scenariosUnitType=t.scenariosUnitType),d.isBoolean(t.grouped)&&(e.grouped=t.grouped),d.isBoolean(t.showGroupTitle)&&(e.showGroupTitle=t.showGroupTitle),d.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),d.isArray(t.thereOf)&&(e.thereOf=f.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),d.isExisting(t.categoryThereOf)&&(e.categoryThereOf=t.categoryThereOf),d.isArray(t.partOf)&&(e.partOf=f.adaptArray(t.partOf,this.tableDrillGroupAdapter)),d.isExisting(t.order)&&(e.sortOrder=this.orderAdapter.adapt(t.order)),d.isExisting(t.type)&&(e.type=t.type),d.isNumber(t.limit)&&(e.limit=t.limit),d.isExisting(t.i18n)&&(e.i18n=t.i18n),d.isExisting(t.categoryWidth)&&(e.categoryWidth=t.categoryWidth),d.isExisting(t.measureScale)&&(e.measureScale=g.calculateMeasureScale(this.dataSet,e.scenarios,t.measureScale)),d.isExisting(t.measureType)&&(e.measureType=t.measureType),d.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),d.isString(t.filter)&&(e.filter=t.filter.trim()),d.isArray(t.barColumns)&&(e.barColumns=t.barColumns),e}default(){return new z}}class V{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class Q{constructor(){}adapt(t){const e=new V;return d.isString(t.rowGroup)&&(e.rowGroup=t.rowGroup),d.isString(t.category)&&(e.category=t.category),d.isString(t.subCategory)&&(e.subCategory=t.subCategory),d.isString(t.partOf)&&(e.partOf=t.partOf),e}default(){return new V}}class q{constructor(){this.operation="+"}addRowGroup(t,e){this.rowGroup=t,this.rowGroupIndex=e}addCategory(t,e){this.category=t,this.categoryIndex=e}addSubCategory(t,e){this.subCategory=t,this.subCategoryIndex=e}addColumnGroup(t,e){this.columnGroup=t,this.columnGroupIndex=e}addSubColumnGroup(t,e){this.columnSubGroup=t,this.columnSubGroupIndex=e}}class K{constructor(){}adapt(t){const e=new q;return d.isOperator(t.operation)&&(e.operation=t.operation),d.isNumber(t.rowGroupIndex)&&d.isString(t.rowGroup)&&e.addRowGroup(t.rowGroup,t.rowGroupIndex),d.isNumber(t.categoryIndex)&&d.isString(t.category)&&e.addCategory(t.category,t.categoryIndex),d.isNumber(t.subCategoryIndex)&&d.isString(t.subCategory)&&e.addSubCategory(t.subCategory,t.subCategoryIndex),d.isNumber(t.columnGroupIndex)&&d.isString(t.columnGroup)&&e.addColumnGroup(t.columnGroup,t.columnGroupIndex),d.isNumber(t.columnSubGroupIndex)&&d.isString(t.columnSubGroup)&&e.addSubColumnGroup(t.columnSubGroup,t.columnSubGroupIndex),this.setActualValues(t,e),this.setPlanValues(t,e),this.setPreviousPeriodValues(t,e),this.setForecastValues(t,e),e}default(){return new q}setActualValues(t,e){d.isNumber(t.ac1)&&(e.ac1=t.ac1),d.isNumber(t.ac2)&&(e.ac2=t.ac2),d.isNumber(t.ac3)&&(e.ac3=t.ac3),d.isNumber(t.ac4)&&(e.ac4=t.ac4)}setPlanValues(t,e){d.isNumber(t.pp1)&&(e.pp1=t.pp1),d.isNumber(t.pp2)&&(e.pp2=t.pp2),d.isNumber(t.pp3)&&(e.pp3=t.pp3),d.isNumber(t.pp4)&&(e.pp4=t.pp4)}setPreviousPeriodValues(t,e){d.isNumber(t.pl1)&&(e.pl1=t.pl1),d.isNumber(t.pl2)&&(e.pl2=t.pl2),d.isNumber(t.pl3)&&(e.pl3=t.pl3),d.isNumber(t.pl4)&&(e.pl4=t.pl4)}setForecastValues(t,e){d.isNumber(t.fc1)&&(e.fc1=t.fc1),d.isNumber(t.fc2)&&(e.fc2=t.fc2),d.isNumber(t.fc3)&&(e.fc3=t.fc3),d.isNumber(t.fc4)&&(e.fc4=t.fc4)}}const J=e(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.data=[],this.tableTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=u.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.thereof=[],this.partof=[],this.order={hierarchy:[],direction:M.ASC},this.categorythereof=new Map,this.type=y.LIST,this.categoryWidth=m.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=h.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=$.VOLUME,this.filter="",this.barColumns=[],this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new w,this.componentStyle=S(this)}render(){return t(s,null,(()=>{if(void 0!==this.table){if(this.table.hasNoData()){const e=this.i18n.get("NO_DATA")||"==No Data==";return t("p",{class:"warning"},e)}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,s,n)=>t("span",null,s===n.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&&e.type!==U.SUM?t(F,{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,maxBarWidth:this.barColumnMaxWidth,styles:this.barChartStyles}):o.draw(this.componentDataFormatDigits)))))))))}})())}componentWillRender(){const t=this.prepareConfig(),e=this.prepareData();this.componentDataFormatDigits=(new b).adapt(this.dataFormatDigits),this.table=new I(new l,e,t),this.table.setI18n(this.i18n),this.barChartStyles=this.prepareBarChartStyles()}prepareConfig(){return new j(new Q,new c,new p(new c),this.data).adapt({title:this.tableTitle,scenarios:this.scenarios,scenariosUnitType:this.scenariosDataFormat,grouped:this.grouped,showGroupTitle:this.showGroupTitle,thereOf:this.thereof,partOf:this.partof,categoryThereOf:this.categorythereof,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})}prepareData(){return f.adaptArray(this.data,new K)}prepareBarChartStyles(){return this.componentStyle((t=>{var e,o,s,n,r,i,a,l,c,h,u,d,f,p,m,$,v,g,R,w,b,S,E,O,y,M;const U=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.varianceStyles,G=null===(o=t["bn-chart-time"])||void 0===o?void 0:o.barStyles;return{positive:{stroke:(null===(s=null==U?void 0:U.pos)||void 0===s?void 0:s.stroke)||"#008f96",fill:(null===(n=null==U?void 0:U.pos)||void 0===n?void 0:n.fill)||"#008f96",fillpattern:(null===(r=null==U?void 0:U.pos)||void 0===r?void 0:r.fillpattern)||"solid"},negative:{stroke:(null===(i=null==U?void 0:U.neg)||void 0===i?void 0:i.stroke)||"#ff0000",fill:(null===(a=null==U?void 0:U.neg)||void 0===a?void 0:a.fill)||"#ff0000",fillpattern:(null===(l=null==U?void 0:U.neg)||void 0===l?void 0:l.fillpattern)||"solid"},neutral:{stroke:(null===(c=null==U?void 0:U.neu)||void 0===c?void 0:c.stroke)||"#808080",fill:(null===(h=null==U?void 0:U.neu)||void 0===h?void 0:h.fill)||"#808080",fillpattern:(null===(u=null==U?void 0:U.neu)||void 0===u?void 0:u.fillpattern)||"outlined"},scenarios:{ac:{stroke:(null===(d=null==G?void 0:G.ac)||void 0===d?void 0:d.stroke)||"#404040",fill:(null===(f=null==G?void 0:G.ac)||void 0===f?void 0:f.fill)||"#404040",fillpattern:(null===(p=null==G?void 0:G.ac)||void 0===p?void 0:p.fillpattern)||"solid"},pp:{stroke:(null===(m=null==G?void 0:G.pp)||void 0===m?void 0:m.stroke)||"#A6A6A6",fill:(null===($=null==G?void 0:G.pp)||void 0===$?void 0:$.fill)||"#A6A6A6",fillpattern:(null===(v=null==G?void 0:G.pp)||void 0===v?void 0:v.fillpattern)||"solid"},fc:{stroke:(null===(g=null==G?void 0:G.fc)||void 0===g?void 0:g.stroke)||"#404040",fill:(null===(R=null==G?void 0:G.fc)||void 0===R?void 0:R.fill)||"#ffffff",fillpattern:(null===(w=null==G?void 0:G.fc)||void 0===w?void 0:w.fillpattern)||"hatched"},pl:{stroke:(null===(b=null==G?void 0:G.pl)||void 0===b?void 0:b.stroke)||"#404040",fill:(null===(S=null==G?void 0:G.pl)||void 0===S?void 0:S.fill)||"#ffffff",fillpattern:(null===(E=null==G?void 0:G.pl)||void 0===E?void 0:E.fillpattern)||"outlined"}},fontColor:(null===(O=t.global)||void 0===O?void 0:O.fontColor)||"#000000",fontSize:.85*((null===(y=t.global)||void 0===y?void 0:y.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:(null===(M=t.global)||void 0===M?void 0:M.fontFamily)||"'Noto Sans', sans-serif",unitScaling:this.unitScaling>0?this.unitScaling:this.autoUnitScaling(),percentageScaling:this.percentageScaling>0?this.percentageScaling:this.autoPercentageScaling(),scaleFactor:this.scaleFactor}}))}autoUnitScaling(){const t=this.componentStyle((t=>{var e;return.85*((null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333)*this.scaleFactor})),e=this.barColumnMaxWidth*t*.8,o=this.getMaxAbsValue();return o<=0||t<=0?.01:e/(o*t)}autoPercentageScaling(){const t=this.componentStyle((t=>{var e;return.85*((null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333)*this.scaleFactor})),e=.8*Math.round(.67*this.barColumnMaxWidth*t),o=this.getMaxRelativeValue();return o<=0||t<=0?.5:e/(o*t)}getMaxAbsValue(){if(!this.table)return 0;let t=0;for(const e of this.table.getBody())if(e.type!==U.SUM)for(const o of e.getCells())o.isBarChart&&o.columnStats&&!o.key.startsWith("dr")&&(t=Math.max(t,o.columnStats.absMax));return t}getMaxRelativeValue(){if(!this.table)return 0;let t=0;for(const e of this.table.getBody())if(e.type!==U.SUM)for(const o of e.getCells())o.isBarChart&&o.columnStats&&o.key.startsWith("dr")&&(t=Math.max(t,100*o.columnStats.absMax));return t}get element(){return this}static get style(){return':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}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",{data:[16],tableTitle:[1,"table-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],type:[1],categoryWidth:[1,"category-width"],dataFormatDigits:[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],barColumnMaxWidth:[2,"bar-column-max-width"],unitScaling:[2,"unit-scaling"],percentageScaling:[2,"percentage-scaling"],scaleFactor:[2,"scale-factor"]}]);function X(){"undefined"!=typeof customElements&&["ibcs-table"].forEach((t=>{"ibcs-table"===t&&(customElements.get(n(t))||customElements.define(n(t),J))}))}export{J as I,y as T,X as d}