@bino-bi/bn-template-engine 1.0.0-next.21 → 1.0.0-next.23

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 (164) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-28d5c266.entry.js → p-0a49cf00.entry.js} +1 -1
  3. package/dist/bn-template-engine/{p-b9e94127.entry.js → p-22b8d044.entry.js} +1 -1
  4. package/dist/bn-template-engine/{p-6c7f0076.entry.js → p-251bb53d.entry.js} +1 -1
  5. package/dist/bn-template-engine/p-2aed639e.entry.js +1 -0
  6. package/dist/bn-template-engine/{p-7e9dbc93.entry.js → p-4616b879.entry.js} +1 -1
  7. package/dist/bn-template-engine/{p-99477a27.entry.js → p-629edcca.entry.js} +1 -1
  8. package/dist/bn-template-engine/p-686d8e44.entry.js +1 -0
  9. package/dist/bn-template-engine/{p-a4ea9a79.entry.js → p-68aa61cc.entry.js} +1 -1
  10. package/dist/bn-template-engine/{p-DwYUTvvI.js → p-B5x8M8OC.js} +1 -1
  11. package/dist/bn-template-engine/{p-fFtEvsY-.js → p-BGrnfif3.js} +1 -1
  12. package/dist/bn-template-engine/{p-6lOdN-fB.js → p-BVfLus3u.js} +1 -1
  13. package/dist/bn-template-engine/{p-CJThzFZm.js → p-BcZ5GQZ8.js} +1 -1
  14. package/dist/bn-template-engine/{p-CYE0I1Mx.js → p-Bca5V28_.js} +1 -1
  15. package/dist/bn-template-engine/p-C5UYpZUU.js +2 -0
  16. package/dist/bn-template-engine/{p-BgIpdpfH.js → p-C7T4DAAW.js} +1 -1
  17. package/dist/bn-template-engine/p-CDo04UEU.js +1 -0
  18. package/dist/bn-template-engine/p-CTrNbSXN.js +1 -0
  19. package/dist/bn-template-engine/{p-C5uvAEKI.js → p-CbciPY-M.js} +1 -1
  20. package/dist/bn-template-engine/{p-BpWWgN6k.js → p-CuR4S456.js} +1 -1
  21. package/dist/bn-template-engine/p-DWtTjg0f.js +1 -0
  22. package/dist/bn-template-engine/{p-eEfqksk-.js → p-DdqXNsKP.js} +1 -1
  23. package/dist/bn-template-engine/{p-B4JfKvVT.js → p-DtLI_CzV.js} +1 -1
  24. package/dist/bn-template-engine/p-UtNHLX1j.js +1 -0
  25. package/dist/bn-template-engine/{p-ba912130.entry.js → p-aecb5de3.entry.js} +1 -1
  26. package/dist/bn-template-engine/{p-687032d5.entry.js → p-ba43d46e.entry.js} +1 -1
  27. package/dist/bn-template-engine/{p-6077155f.entry.js → p-c476e7bb.entry.js} +1 -1
  28. package/dist/bn-template-engine/{p-2d3ea756.entry.js → p-d7c670ec.entry.js} +1 -1
  29. package/dist/bn-template-engine/{p-a1380d7c.entry.js → p-e4a584a8.entry.js} +1 -1
  30. package/dist/bn-template-engine/{p-de29986f.entry.js → p-f12fb09b.entry.js} +1 -1
  31. package/dist/bn-template-engine/p-f9a721bb.entry.js +1 -0
  32. package/dist/cjs/{AxisConfig-D7CAyPLO.js → AxisConfig-DmP4U3JM.js} +1 -1
  33. package/dist/cjs/{LabelCollisionManager-DkdQ9Xdg.js → LabelCollisionManager-Cet3WPm0.js} +2 -2
  34. package/dist/cjs/{Order-IPfAP0q8.js → Order-DlKLywO_.js} +1 -1
  35. package/dist/cjs/{SVGStyle-BD8jApd4.js → SVGStyle-D78RaNnj.js} +2 -2
  36. package/dist/cjs/{SVGVariancesStyleGroup-BaWzR951.js → SVGVariancesStyleGroup-XvNAnYYA.js} +1 -1
  37. package/dist/cjs/{VarianceMeasure-BBWTgv2e.js → VarianceMeasure-BfZLlICl.js} +4 -4
  38. package/dist/cjs/{XYChartDataRow-BoR0CTfl.js → XYChartDataRow-B0NNOqxB.js} +4 -4
  39. package/dist/cjs/bn-asset_21.cjs.entry.js +1052 -314
  40. package/dist/cjs/bn-chart-bubble.cjs.entry.js +25 -15
  41. package/dist/cjs/bn-chart-bullet.cjs.entry.js +9 -9
  42. package/dist/cjs/bn-chart-scatter.cjs.entry.js +9 -9
  43. package/dist/cjs/bn-grid.cjs.entry.js +6 -6
  44. package/dist/cjs/bn-image.cjs.entry.js +6 -6
  45. package/dist/cjs/bn-internationalization.cjs.entry.js +4 -4
  46. package/dist/cjs/bn-ruleset.cjs.entry.js +4 -4
  47. package/dist/cjs/bn-template-engine.cjs.js +3 -3
  48. package/dist/cjs/bn-template.cjs.entry.js +2 -2
  49. package/dist/cjs/bn-text.cjs.entry.js +7 -7
  50. package/dist/cjs/bn-tree.cjs.entry.js +6 -6
  51. package/dist/cjs/{context-protocol-BBhT9B52.js → context-protocol-DeLmu5s2.js} +1 -1
  52. package/dist/cjs/editor-companion.cjs.entry.js +2 -2
  53. package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +6 -6
  54. package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +6 -6
  55. package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +6 -6
  56. package/dist/cjs/{index-CDKG4xmO.js → index-C1Z9vO7z.js} +61 -19
  57. package/dist/cjs/{layoutObserver-DUYYkDMQ.js → layoutObserver-CrzQQGpv.js} +5 -5
  58. package/dist/cjs/loader.cjs.js +2 -2
  59. package/dist/cjs/{scaling-BIJQ2NV1.js → scaling-JAU6IJnR.js} +85 -3
  60. package/dist/cjs/{withBodyObserver-BKUE_ypL.js → withBodyObserver-DJO98AJ-.js} +2 -2
  61. package/dist/cjs/{withHasError-Cl2gTQzA.js → withHasError-BdDmiOXM.js} +1 -1
  62. package/dist/cjs/{withScalingGroup-D5clRvRe.js → withScalingGroup-Bu5gatHT.js} +3 -3
  63. package/dist/cjs/{withStyled-Cm9dWQhu.js → withStyled-50UepUwV.js} +8 -8
  64. package/dist/collection/collection-manifest.json +1 -1
  65. package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +15 -5
  66. package/dist/collection/components/bn-chart-structure/bn-chart-structure.css +6 -0
  67. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +149 -57
  68. package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +135 -28
  69. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +30 -19
  70. package/dist/collection/components/bn-chart-time/bn-chart-time.js +186 -49
  71. package/dist/collection/components/bn-chart-time/ibcs-chart-time.css +9 -3
  72. package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +141 -22
  73. package/dist/collection/components/bn-chart-time/utils/TimeChart.js +36 -0
  74. package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +76 -19
  75. package/dist/collection/components/bn-table/bn-table.js +121 -49
  76. package/dist/collection/components/bn-table/ibcs-table.js +83 -42
  77. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +20 -34
  78. package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +4 -5
  79. package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +89 -0
  80. package/dist/collection/utils/autoFit.js +63 -0
  81. package/dist/collection/utils/constants.js +3 -3
  82. package/dist/collection/utils/dataAnalyzer.js +17 -8
  83. package/dist/collection/utils/scaling.js +79 -0
  84. package/dist/collection/utils/validate.js +3 -3
  85. package/dist/components/DataFormatDigits.js +1 -1
  86. package/dist/components/autoFit.js +1 -0
  87. package/dist/components/bn-chart-bubble.js +1 -1
  88. package/dist/components/bn-chart-bullet.js +1 -1
  89. package/dist/components/bn-chart-scatter.js +1 -1
  90. package/dist/components/bn-chart-structure.js +1 -1
  91. package/dist/components/bn-chart-time.js +1 -1
  92. package/dist/components/bn-grid.js +1 -1
  93. package/dist/components/bn-scaling-group.js +1 -1
  94. package/dist/components/bn-table.js +1 -1
  95. package/dist/components/bn-text.js +1 -1
  96. package/dist/components/bn-tree.js +1 -1
  97. package/dist/components/ibcs-chart-structure2.js +1 -1
  98. package/dist/components/ibcs-chart-time2.js +1 -1
  99. package/dist/components/ibcs-table2.js +1 -1
  100. package/dist/components/scaling.js +1 -0
  101. package/dist/components/validate.js +1 -1
  102. package/dist/components/withDataset.js +1 -1
  103. package/dist/components/withStyled.js +1 -1
  104. package/dist/esm/{AxisConfig-ByIP5J-9.js → AxisConfig-Cjy_RANi.js} +1 -1
  105. package/dist/esm/{LabelCollisionManager-DaNiDiM9.js → LabelCollisionManager-B_NUM9yq.js} +2 -2
  106. package/dist/esm/{Order-BQeJE_yi.js → Order-B-aF6Rwn.js} +1 -1
  107. package/dist/esm/{SVGStyle-BwBlY3Km.js → SVGStyle-8FfAtUF-.js} +2 -2
  108. package/dist/esm/{SVGVariancesStyleGroup-BpGW4CvN.js → SVGVariancesStyleGroup-DD4mIOjT.js} +1 -1
  109. package/dist/esm/{VarianceMeasure-CE3N8Bea.js → VarianceMeasure-DLOuIIJ7.js} +4 -4
  110. package/dist/esm/{XYChartDataRow-DeMI1JKU.js → XYChartDataRow-CKfILBFG.js} +4 -4
  111. package/dist/esm/bn-asset_21.entry.js +1052 -314
  112. package/dist/esm/bn-chart-bubble.entry.js +25 -15
  113. package/dist/esm/bn-chart-bullet.entry.js +9 -9
  114. package/dist/esm/bn-chart-scatter.entry.js +9 -9
  115. package/dist/esm/bn-grid.entry.js +6 -6
  116. package/dist/esm/bn-image.entry.js +6 -6
  117. package/dist/esm/bn-internationalization.entry.js +4 -4
  118. package/dist/esm/bn-ruleset.entry.js +4 -4
  119. package/dist/esm/bn-template-engine.js +4 -4
  120. package/dist/esm/bn-template.entry.js +2 -2
  121. package/dist/esm/bn-text.entry.js +7 -7
  122. package/dist/esm/bn-tree.entry.js +6 -6
  123. package/dist/esm/{context-protocol-d8MHrEo8.js → context-protocol-BoEL0caI.js} +1 -1
  124. package/dist/esm/editor-companion.entry.js +2 -2
  125. package/dist/esm/ibcs-chart-bubble.entry.js +6 -6
  126. package/dist/esm/ibcs-chart-bullet.entry.js +6 -6
  127. package/dist/esm/ibcs-chart-scatter.entry.js +6 -6
  128. package/dist/esm/{index-B_d-jp99.js → index-C5UYpZUU.js} +61 -19
  129. package/dist/esm/{layoutObserver-BJBEyhNf.js → layoutObserver-cgIXg2sg.js} +5 -5
  130. package/dist/esm/loader.js +3 -3
  131. package/dist/esm/{scaling-BGnpSN1j.js → scaling-CxyNpMQM.js} +83 -4
  132. package/dist/esm/{withBodyObserver-IokS6fHD.js → withBodyObserver-Cb9ZC5_J.js} +2 -2
  133. package/dist/esm/{withHasError-DW_vMDUp.js → withHasError-Bh1Viz52.js} +1 -1
  134. package/dist/esm/{withScalingGroup-CC3UcvC5.js → withScalingGroup-Yv9nGGe1.js} +3 -3
  135. package/dist/esm/{withStyled-2l5Tx3cf.js → withStyled-By9Jd-Oy.js} +8 -8
  136. package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +5 -2
  137. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +47 -19
  138. package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +17 -3
  139. package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +11 -3
  140. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +52 -18
  141. package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +18 -3
  142. package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +12 -0
  143. package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +28 -8
  144. package/dist/types/components/bn-table/bn-table.d.ts +45 -19
  145. package/dist/types/components/bn-table/ibcs-table.d.ts +23 -6
  146. package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +9 -1
  147. package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +51 -0
  148. package/dist/types/components.d.ts +91 -55
  149. package/dist/types/stencil-public-runtime.d.ts +1 -0
  150. package/dist/types/utils/autoFit.d.ts +79 -0
  151. package/dist/types/utils/constants.d.ts +3 -3
  152. package/dist/types/utils/dataAnalyzer.d.ts +5 -1
  153. package/dist/types/utils/scaling.d.ts +63 -0
  154. package/dist/types/utils/validate.d.ts +2 -2
  155. package/package.json +1 -1
  156. package/readme.md +2 -0
  157. package/dist/bn-template-engine/p-2fba7c99.entry.js +0 -1
  158. package/dist/bn-template-engine/p-A8xyE4b1.js +0 -1
  159. package/dist/bn-template-engine/p-B_d-jp99.js +0 -2
  160. package/dist/bn-template-engine/p-BjBz5cSL.js +0 -1
  161. package/dist/bn-template-engine/p-C8Q0lsaU.js +0 -1
  162. package/dist/bn-template-engine/p-C9i1Xsib.js +0 -1
  163. package/dist/bn-template-engine/p-a8291de2.entry.js +0 -1
  164. package/dist/bn-template-engine/p-b5274369.entry.js +0 -1
@@ -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 i,Q as r,V as l,I as a}from"./formatter.js";import{S as c,I as h,D as u,C as f,d,M as p}from"./CompareUtil.js";import{D as $}from"./luxon.js";import{a as m,b as v}from"./DateStringFactory.js";import{d as R,g}from"./context-protocol.js";import{D as w,a as S,b as E}from"./DataFormatDigits.js";import{A as b,c as y}from"./Order.js";import{S as O}from"./StringAdapter.js";import{S as M}from"./SiPrefix.js";import{w as U}from"./withComponentStyle.js";var T,G,_,N,C;!function(t){t[t.ALL=-1]="ALL"}(T||(T={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(G||(G={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(_||(_={})),function(t){t.ASC="asc",t.DESC="desc"}(N||(N={})),function(t){t.HEADER="HEADER",t.GROUPHEAD="GROUPHEAD",t.SEPERATORLINE="SEPERATORLINE",t.SUM="SUM",t.GROUPSUM="GROUP_SUM",t.DRILLELEMENT="DRILLELEMENT",t.STANDARD="STANDARD",t.PARTELEMENT="PARTELEMENT",t.ENTRY="ENTRY"}(C||(C={}));const L="none",x="setname";function k(t){return t===x?"COALESCE([setname],[setName])":`normalizeDate([date], '${t}')`}function P(t){if(null==t)return"";if("string"==typeof t)return t.trim();const e=A(t);return e?e.toISO():String(t)}function A(t){if(null!=t){if("string"==typeof t){const e=$.fromISO(t);return e.isValid?e:void 0}if("number"==typeof t){const e=$.fromMillis(t);return e.isValid?e:void 0}if("boolean"==typeof t.isValid)return t.isValid?t:void 0}}class D{constructor(t,e,o,n,s,i,r,l,a){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=e,this.value=o,this.prefix=i||"",this.cssStyle=n||"",this.prefixStyle=r||"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),i.number(Number(e),this.type,o,n)}drawPrefix(){return null==this.prefix?"":this.prefix}}class B{constructor(t,e,o){this.index=t,this.groupindex=e,this.type=o,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case C.HEADER:return"groupheader";case C.SEPERATORLINE:return"";case C.DRILLELEMENT:return"ofit";case C.PARTELEMENT:return"partof";case C.STANDARD:return"";case C.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,e,o,n,s,i,r,l,a,c=!1,h,u=1,f){let d=i;"category"===e&&null!=l&&(d=`category-${l.toString()}`),this.type===C.HEADER?d="headerlabel":this.type===C.SEPERATORLINE&&(d=e),this.type===C.PARTELEMENT&&("percent"===n&&(t="-"),"category"!==e&&"operation"!==e&&(n="percent",d="")),"-"===t&&(d="");let p="prefix-first";r&&(p="prefix-second"),o&&(d=`${d} ${o}`);const $=new D(e,this.elements.length,t,d,n,s,p,u,a);$.isBarChart=c,$.columnStats=h,$.waterfall=f,this.elements.push($)}}const F={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},Y="#666666";function W(t,e){return`pattern-${t}-${e.replace("#","")}`}const H=({styles:e})=>{const o=e.scaleFactor,n=6*o,s=[{id:W("pos",e.positive.stroke),stroke:e.positive.stroke,fill:e.positive.fill},{id:W("neg",e.negative.stroke),stroke:e.negative.stroke,fill:e.negative.fill},{id:W("neu",e.neutral.stroke),stroke:e.neutral.stroke,fill:e.neutral.fill},...["ac","pp","fc","pl"].map((t=>({id:W(t,e.scenarios[t].stroke),stroke:e.scenarios[t].stroke,fill:e.scenarios[t].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 I(t,e,o=1){let n,s;const i=t>=0?"+":"";if(e)return n=100*t,i+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"),i+e}}function j(t){const e=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(e)}function z(t){const e=t.slice(0,2).toLowerCase();return"pp"===e?"pp":"fc"===e?"fc":"pl"===e?"pl":"ac"}function V(t,e,o,n){return j(t)?function(t,e){const o=z(t);return e.scenarios[o]}(t,n):function(t,e,o){const n=t>=0;return e?n?o.positive:o.negative:n?o.negative:o.positive}(e,o,n)}function Q(t,e){const o=t.fillpattern;return"hatched"===o?`url(#${W(e,t.stroke)})`:"outlined"===o?"transparent":t.fill}function q(t){return"outlined"===t.fillpattern?{stroke:t.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0}}const K=e=>{const{value:o,scenario:n,columnStats:s,height:i,isPositiveGood:r,formattedValue:l,measureScale:a,maxBarWidth:c=10,styles:h=F}=e,u=h.scaleFactor,f=h.fontSize,d=38*u,p=c*f,$=4*u,m=.15*p,v=p-$-m,R=Math.abs(o)*h.unitScaling*f,g=R>v,w=Math.max(0,s.absMax*h.unitScaling*f-v),S=Math.max(0,R-v),E=w>0?S/w*m:0,b=s.min<0,y=s.max>0,O=b?p:0,M=(b?d:0)+(O+(y?p:0))+(y?d:0),U=2*u,T=i-2*U,G=(b?d:0)+O,_=U,N=o>=0,C=V(n,o,r,h),L=Q(C,j(n)?z(n):r?N?"pos":"neg":N?"neg":"pos"),{stroke:x,strokeWidth:k}=q(C),P=l||I(o,!1,a),A=g?v:R,D=g?v+$+E:R,B=N?G+D+4*u:G-D-4*u,W=N?"start":"end";return t("svg",{width:M,height:i,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},t(H,{styles:h}),t("line",{x1:G,y1:0,x2:G,y2:i,stroke:Y,"stroke-width":1*u}),A>0&&t("rect",{x:N?G:G-A,y:_,width:A,height:T,fill:L,stroke:x,"stroke-width":k*u}),g&&E>0&&t("rect",{x:N?G+v+$:G-v-$-E,y:_,width:E,height:T,fill:L,stroke:x,"stroke-width":k*u}),g&&function(e,o,n,s,i){const r=e+o/2,l=.35*o,a=s/3,c=.3*o;let h=`M ${r-l} ${n}`;for(let t=0;t<3;t++)h+=` L ${r-l-c} ${n+a*(t+.5)} L ${r-l} ${n+a*(t+1)}`;let u=`M ${r+l} ${n}`;for(let t=0;t<3;t++)u+=` L ${r+l+c} ${n+a*(t+.5)} L ${r+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*i}),t("path",{d:u,fill:"none",stroke:"#000000","stroke-width":1*i})]}(N?G+v:G-v-$,$,_,T,u),t("text",{x:B,y:i/2,dy:"0.35em","text-anchor":W,fill:h.fontColor,"font-size":f,"font-family":h.fontFamily},P))},X=e=>{const{value:o,scenario:n,columnStats:s,height:i,isPositiveGood:r,formattedValue:l,measureScale:a,maxBarWidth:c=10,styles:h=F}=e,u=h.scaleFactor,f=h.fontSize,d=Math.round(.67*c*f),p=5*u,$=s.min<0?d+p:0,m=$+(s.max>0?d+p:0),v=m+45*u,R=$,g=i/2,w=100*Math.abs(o)*h.percentageScaling*f,S=w>d,E=Math.min(w,d),b=o>=0,y=b?R+E:R-E,O=V(n,o,r,h),M=3*u,U=l||I(o,!0,a),T=m+4*u;return t("svg",{width:v,height:i,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},t("line",{x1:R,y1:0,x2:R,y2:i,stroke:Y,"stroke-width":1*u}),!S&&t("circle",{cx:y,cy:g,r:M,fill:h.fontColor}),t("line",{x1:R,y1:g,x2:y,y2:g,stroke:O.fill,"stroke-width":2*u}),S&&b&&t("polygon",{points:`${R+d},${g} ${R+d-6*u},${g-3*u} ${R+d-6*u},${g+3*u}`,fill:O.fill}),S&&!b&&t("polygon",{points:`${R-d},${g} ${R-d+6*u},${g-3*u} ${R-d+6*u},${g+3*u}`,fill:O.fill}),t("text",{x:T,y:i/2,dy:"0.35em","text-anchor":"start",fill:h.fontColor,"font-size":f,"font-style":"italic","font-family":h.fontFamily},U))},J=e=>{const{value:o,columnStats:n,isRelative:s,styles:i=F}=e;return null==o||isNaN(o)||!n||0===n.absMax?t("span",{class:"bar-chart-empty",style:{color:i.fontColor,fontStyle:"italic"}},"-"):t(s?X:K,Object.assign({},e))},Z=e=>{const{value:o,scenario:n,height:s,measureScale:i,maxBarWidth:r=10,styles:l=F,waterfall:a}=e,c=l.scaleFactor,h=l.fontSize,u=a.max-a.min;if(null==o||isNaN(o)||u<=0)return t("span",{class:"bar-chart-empty",style:{color:l.fontColor,fontStyle:"italic"}},"-");const f=38*c,d=r*h,p=f+d+f,$=d/u,m=t=>f+(t-a.min)*$,v=2*c,R=s-2*v,g=v,w=m(0),S=m(a.start),E=m(a.end),b=Math.min(S,E),y=Math.abs(E-S),O=V(n,o,!1,l),M=Q(O,z(n)),{stroke:U,strokeWidth:T}=q(O),G=I(o,"partof"===a.kind,i).replace(/^\+/,""),_=E<S,N=_?b-4*c:b+y+4*c,C=_?"end":"start";return t("svg",{width:p,height:s,class:"cell-bar-chart waterfall-bar",style:{overflow:"visible"}},t(H,{styles:l}),t("line",{x1:w,y1:0,x2:w,y2:s,stroke:Y,"stroke-width":1*c}),void 0!==a.parentStart&&void 0!==a.parentEnd&&t("line",{x1:m(a.parentStart),y1:0,x2:m(a.parentStart),y2:s,stroke:Y,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),void 0!==a.parentStart&&void 0!==a.parentEnd&&t("line",{x1:m(a.parentEnd),y1:0,x2:m(a.parentEnd),y2:s,stroke:Y,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),y>0&&t("rect",{x:b,y:g,width:y,height:R,fill:M,stroke:U,"stroke-width":T*c}),t("text",{x:N,y:s/2,dy:"0.35em","text-anchor":C,fill:l.fontColor,"font-size":h,"font-family":l.fontFamily},G))};class tt{constructor(t){this.groups=[r.CATEGORY,r.CATEGORYINDEX],_.OPT!==t.type&&_.OPTNOTOTAL!==t.type||this.groups.unshift(r.OPERATION),t.grouped&&(this.groups.push(r.ROWGROUP),this.groups.push(r.ROWGROUPINDEX))}toString(){return this.groups.map((t=>`${t}`)).toString()}noCategory(){return this.groups.filter((t=>t!==r.CATEGORY))}toArray(){return this.groups}}class et{constructor(t,e){this.hasPartOf=!1,this.config=t,this.i18n=e}execute(t,e){var o;this.db=t,this.fromExpr=e;const n=[],s=[],i=[],l=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),a=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),c=this.getRelativeScenarios(),h=this.config.attributes.map((t=>this.translateAttributeSQL(t))).toString(),u=new tt(this.config),f=this.config.grouped?[r.ROWGROUP,r.ROWGROUPINDEX]:[];let d,p=["",""];this.config.sortOrder.hierarchy.length>0&&(p=this.createOrderString(this.config.sortOrder)),this.hasPartOf=this.checkConfigForPartOf();try{d=t.exec(`SELECT COUNT(DISTINCT ${r.CATEGORY}) as ${r.TOTALROWCOUNT} ${f.length>0?","+f:""}\n FROM ${e} ${f.length>0?"GROUP BY "+f:""}\n ORDER BY ${p[0]}`)}catch(t){return console.error("DataQuery: meta query failed",t),[]}return 0===d.length||1===d.length&&0===(null!==(o=d[0][r.TOTALROWCOUNT])&&void 0!==o?o:0)&&0===f.length?[]:(d.forEach((t=>{const e=t.rowGroup&&t.rowGroup.length>0?`WHERE ${r.ROWGROUP} = '${t.rowGroup}'`:"";let o="";this.config.limit&&(o=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,n),this.createDataRow(n,t,u,l,h,e,p,o),this.createRestRow(t,n,u,l,e,p),this.createGroupSumRow(n,s,t,a,p)})),this.createTotalSumRow(n,s,a),n.forEach((e=>{try{i.push(t.exec(e))}catch(t){console.error("DataQuery: SQL query execution failed",e,t)}})),this.detectNaNCells(this.config.scenarios,i),this.createThereOfDrillRows(l,h,p,i),this.createPartOfDrillRows(l,p,s,i),this.createIntervalColumns(i),this.createThereOfDrillColumns(this.config.categoryThereOf,i),this.calculateColumnGroupRest(i,this.config.categoryThereOf),this.calculateRelativeVariances(i,c),i)}detectNaNCells(t,e){e.forEach((e=>{e.map((e=>(t.forEach((t=>{const o=new l(t);!0===o.isValid?0!==e[o.base+"_cnt"]&&0!==e[o.delta+"_cnt"]||(e[t]=Number.NaN):0===e[t+"_cnt"]&&(e[t]=Number.NaN)})),e)))}))}createPartOfDrillRows(t,e,o,n){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===_.LIST)return;const s=this.createPartOfQuery(t,e);let i=[];const l=this.db;s.forEach((function(t){i.push(...l.exec(t))}));const a=this.exctractScenarioNames(t),c=[];o.forEach((function(t){c.push(...l.exec(t))}));const h=new Map;c.forEach((t=>h.set(t[r.ROWGROUP],t))),i=this.reduceResDrillByCategoryGroups(i,a),i.forEach((function(t){a.forEach((e=>{try{t[e]=t[e]/h.get(t[r.ROWGROUP])[e]}catch(o){console.error("DataQuery: partOf drill row calculation failed",e,o),t[e]=Number.NaN}}))})),this.injectDrillRowsToResultRows(i,n)}createRestRow(t,e,o,n,s,i){if(t.totalRowCnt-this.config.limit>0&&0!==this.config.limit){const l=this.exctractScenarioNames(n).map((t=>`SUM(${t}) as ${t}`)).join(", ");e.push(`SELECT ${r.ROWNR}, 1 as ${r.ROWGROUPINDEX} , 'ENTRY' as ${r.TYPE}, 'NO_GROUP' as ${r.ROWGROUP}, 'REST' as ${r.CATEGORY} ${l.length>0?", "+l:""} FROM (SELECT ROWNUM() AS ${r.ROWNR}, ${e.length} as ${r.ROWGROUPINDEX} , 'ENTRY' as ${r.TYPE}, '${t.rowGroup||"NO_GROUP"}' as ${r.ROWGROUP}, ${o} ${n.length>0?",".concat(n):""} FROM ${this.fromExpr} ${s} GROUP BY ${o} ORDER BY ${i[0]}) t WHERE t.rowNr > ${this.config.limit}`)}}createDataRow(t,e,o,n,s,i,l,a){t.push(`SELECT ROWNUM() AS ${r.ROWNR},\n ${t.length} as ${r.ROWGROUPINDEX},\n 'ENTRY' as ${r.TYPE},\n '${e.rowGroup||"NO_GROUP"}' as ${r.ROWGROUP},\n '${r.CATEGORYINDEX}',\n ${o} ${n.length>0?",".concat(n):""} ${s.length>0?",".concat(s):""}\n FROM ${this.fromExpr} ${i}\n GROUP BY ${o}\n ORDER BY ${l[0]} ${a}`)}createGroupHeaderRow(t,e){!0===this.config.grouped&&e.push(`SELECT ROWNUM() AS ${r.ROWNR},\n ${e.length} as ${r.ROWGROUPINDEX},\n 'GROUPHEAD' as ${r.TYPE},\n '${t.rowGroup}' as ${r.ROWGROUP} ${this.config.showGroupTitle?`,'${t.rowGroup}' as ${r.CATEGORY}`:""}\n FROM ${this.fromExpr}\n GROUP BY '1'`)}createGroupSumRow(t,e,o,n,s){!0!==this.config.grouped||_.SUM!==this.config.type&&_.SUMNOTOTAL!==this.config.type&&_.OPT!==this.config.type&&_.OPTNOTOTAL!==this.config.type||(t.push(`SELECT ${t.length} as ${r.ROWGROUPINDEX},\n '=' as ${r.OPERATION},\n '${o.rowGroup}' as ${r.ROWGROUP},\n ROWNUM() AS ${r.ROWNR},\n 'GROUP_SUM' as ${r.TYPE} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr}\n WHERE ${r.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${s[0]} `),e.push(`SELECT ${t.length} as ${r.ROWGROUPINDEX},\n '=' as ${r.OPERATION},\n '${o.rowGroup}' as ${r.ROWGROUP},\n ROWNUM() AS ${r.ROWNR},\n 'GROUP_SUM' as ${r.TYPE} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr}\n WHERE ${r.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${s[0]} `))}createTotalSumRow(t,e,o){var n;if(_.SUM===this.config.type||_.OPT===this.config.type){const e=(null===(n=this.config.title)||void 0===n?void 0:n.trim())||"SUM_TOTAL",s=this.hasPartOf&&!1===this.config.grouped&&"SUM_TOTAL"!==e?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} ${e}`:e;t.push(`SELECT ${t.length} as ${r.ROWGROUPINDEX},\n '${s}' as ${r.ROWGROUP},\n '=' as ${r.OPERATION},\n 'SUM' as ${r.TYPE} ${o.length>0?",".concat(o):""}\n FROM ${this.fromExpr} `)}e.push(`SELECT ${t.length} as ${r.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${r.ROWGROUP},\n '=' as ${r.OPERATION},\n 'SUM' as ${r.TYPE} ${o.length>0?",".concat(o):""}\n FROM ${this.fromExpr} `)}reduceResDrillByCategoryGroups(t,e){const o=new Map;return t.forEach((function(t){const n=t.rowNr+t.rowGroup+t.type+t.category;if(o.has(n)){const 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[r.ROWNR]=o.get(`${t.category}_${t.rowGroup}`),e.splice(n+t[r.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[r.ROWNR]||n.includes(t.subCategory))&&(t.subCategory=`${t.subCategory} (${t.rowGroup})`),e.splice(s+t[r.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,e,o,n){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const s=[],i=[];this.config.thereOf.forEach((n=>{let i=!0,l="1 <> 1 OR ( ";null!=n.category&&0!==n.category.length&&n.category.trim()&&(l+=` ${r.CATEGORY} = '${n.category}'`,i=!1),null!=n.rowGroup&&0!==n.rowGroup.length&&n.rowGroup.trim()&&(l+=` ${i?"":"AND"} ${r.ROWGROUP} = '${n.rowGroup}'`,i=!1),null!=n.subCategory&&0!==n.subCategory.length&&n.subCategory.trim()&&(l+=` ${i?"":"AND"} ${r.SUBCATEGORY} = '${n.subCategory}'`),l+=")",s.push(`SELECT ROWNUM() AS ${r.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${r.TYPE},\n ${r.CATEGORY},\n ${r.SUBCATEGORY},\n ${r.ROWGROUP} as ${r.ROWGROUP},\n ${t} ${e.length>0?",".concat(e):""}\n FROM ${this.fromExpr}\n WHERE ${l}\n GROUP BY ${r.ROWGROUP}, ${r.CATEGORY}, ${r.SUBCATEGORY}\n ORDER BY ${o[1]}`)}));const l=this.db;s.forEach((function(t){i.push(...l.exec(t))})),this.injectDrillRowsToResultRows(i,n)}calculateRelativeVariances(t,e){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[r.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,i=[];for(const t of s)i.push(`${e}##${t.name}`);o.set(e,i),n.set(`${e}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[r.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]}))}))}createIntervalColumns(t){var e,o,n,s,i;if(this.config.interval===L||this.config.categoryThereOf.size>0||0===this.config.scenarios.length)return;const a="##",c=`(SELECT *, ${k(this.config.interval)} as __interval FROM ${this.fromExpr}) as p`,h=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),u=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),f=this.exctractScenarioNames(h),d=this.getRelativeScenarios(),p=new tt(this.config),$=_.OPT===this.config.type||_.OPTNOTOTAL===this.config.type,m=this.config.grouped&&(_.SUM===this.config.type||_.SUMNOTOTAL===this.config.type||_.OPT===this.config.type||_.OPTNOTOTAL===this.config.type),v=this.checkConfigForPartOf()&&this.config.type!==_.LIST,R=t=>{try{return this.db.exec(t)}catch(e){return console.error("DataQuery: interval query failed",t,e),[]}},g=t=>(this.config.scenarios.forEach((e=>{const o=new l(e);!0===o.isValid?0!==t[o.base+"_cnt"]&&0!==t[o.delta+"_cnt"]||(t[e]=Number.NaN):0===t[e+"_cnt"]&&(t[e]=Number.NaN)})),d.forEach(((e,o)=>{t[o]=t[o]/t[e]})),t),w=(t,e,o)=>{for(const n of this.config.scenarios)t[n+a+o]=e[n]},S=R(`SELECT ${p}, __interval ${h.length>0?",".concat(h):""}\n FROM ${c}\n GROUP BY ${p}, __interval`);if(this.config.limit>0)for(let n=0;n<t.length;n++){const s=t[n].find((t=>"ENTRY"===t.type&&"REST"===t.category));if(!s)continue;let i;for(let e=n-1;e>=0&&!i;e--){const o=t[e].filter((t=>"ENTRY"===t.type&&"REST"!==t.category));o.length>0&&(i=o)}if(!i)continue;const r=new Set(i.map((t=>t.category))),l=i[0].rowGroup,a=new Map;for(const t of S){if(this.config.grouped&&t.rowGroup!==l)continue;if(r.has(t.category))continue;const n=P(t.__interval);let s=a.get(n);s||(s={},a.set(n,s));for(const n of f)s[n]=(null!==(e=s[n])&&void 0!==e?e:0)+(null!==(o=t[n])&&void 0!==o?o:0)}a.forEach(((t,e)=>{w(s,g(t),e)}))}for(const e of S){const o=P(e.__interval);g(e);for(const n of t)for(const t of n)"ENTRY"===t.type&&"REST"!==t.category&&t.category===e.category&&(this.config.grouped&&t.rowGroup!==e.rowGroup||$&&t.operation!==e.operation||w(t,e,o))}const E=m||v&&this.config.grouped?R(`SELECT ${r.ROWGROUP}, __interval ${u.length>0?",".concat(u):""}\n FROM ${c}\n GROUP BY ${r.ROWGROUP}, __interval`):[],b=new Map;if(E.forEach((t=>b.set(`${t.rowGroup}${a}${P(t.__interval)}`,t))),m)for(const e of E){const o=P(e.__interval),n=g(Object.assign({},e));for(const s of t)for(const t of s)"GROUP_SUM"===t.type&&t.rowGroup===e.rowGroup&&w(t,n,o)}const y=_.SUM===this.config.type||_.OPT===this.config.type,O=y||v&&!this.config.grouped?R(`SELECT __interval ${u.length>0?",".concat(u):""}\n FROM ${c}\n GROUP BY __interval`):[],M=new Map;if(O.forEach((t=>M.set(P(t.__interval),t))),y)for(const e of O){const o=P(e.__interval),n=g(Object.assign({},e));for(const e of t)for(const t of e)"SUM"===t.type&&w(t,n,o)}if(null!=this.config.thereOf&&this.config.thereOf.length>0){const e=[];this.config.thereOf.forEach((t=>{e.push(...R(`SELECT ${r.ROWGROUP}, ${r.CATEGORY}, ${r.SUBCATEGORY}, __interval ${h.length>0?",".concat(h):""}\n FROM ${c}\n WHERE ${this.createThereOfWhereClause(t)}\n GROUP BY ${r.ROWGROUP}, ${r.CATEGORY}, ${r.SUBCATEGORY}, __interval`))}));for(const o of e){const e=P(o.__interval);g(o);for(const n of t)for(const t of n)"DRILLELEMENT"===t.type&&t.category===o.category&&(t.subCategory!==o.subCategory&&t.subCategory!==`${o.subCategory} (${o.rowGroup})`||w(t,o,e))}}if(v){let e="1 <> 1 ";null===(n=this.config.partOf)||void 0===n||n.forEach((t=>{e+=`OR (${r.CATEGORY} = '${t.category}'`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(e+=`and ${r.ROWGROUP} = '${t.rowGroup}'`),e+=")"}));const o=R(`SELECT ${r.CATEGORY}, ${this.config.grouped?`${r.ROWGROUP}`:`'SUM_TOTAL' as ${r.ROWGROUP}`}, __interval ${h.length>0?",".concat(h):""}\n FROM ${c}\n WHERE ${e}\n GROUP BY ${r.ROWGROUP}, ${r.CATEGORY}, __interval`),l=new Map;for(const t of o){const e=`${t.rowGroup}${a}${t.category}${a}${P(t.__interval)}`,o=l.get(e);if(o)for(const e of f)o[e]=(null!==(s=o[e])&&void 0!==s?s:0)+(null!==(i=t[e])&&void 0!==i?i:0);else l.set(e,t)}l.forEach((e=>{const o=P(e.__interval),n=this.config.grouped?b.get(`${e.rowGroup}${a}${o}`):M.get(o);for(const t of f)e[t]=e[t]/(n?n[t]:Number.NaN);g(e);for(const n of t)for(const t of n)"PARTELEMENT"===t.type&&t.category===e.category&&t.rowGroup===e.rowGroup&&w(t,e,o)}))}}createThereOfWhereClause(t){let e=!0,o="1 <> 1 OR ( ";return null!=t.category&&0!==t.category.length&&t.category.trim()&&(o+=` ${r.CATEGORY} = '${t.category}'`,e=!1),null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(o+=` ${e?"":"AND"} ${r.ROWGROUP} = '${t.rowGroup}'`,e=!1),null!=t.subCategory&&0!==t.subCategory.length&&t.subCategory.trim()&&(o+=` ${e?"":"AND"} ${r.SUBCATEGORY} = '${t.subCategory}'`),o+")"}getRelativeScenarios(){const t=new Map;return this.config.scenarios.forEach((e=>{const o=this.createRelativeScenario(e);null!=o&&t.set(o.key,o.value)})),t}translateScenarioSQL(t,e,o){const n=new l(t);return _.OPT===o||_.OPTNOTOTAL===o?n.isValid?"dr"===n.type?`SUM(${n.base} - ${n.delta}) as ${t}, SUM(${n.delta}) as dr_${n.delta}`:`SUM(${n.base} - ${n.delta}) as ${t}`:e?`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:`SUM(${t}) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:n.isValid?"dr"===n.type?`SUM((${n.base} * transformOperator(operation)) - (${n.delta} * transformOperator(operation))) as ${t}, SUM(${n.delta} * transformOperator(operation)) as dr_${n.delta}`:`SUM((${n.base} * transformOperator(operation))- (${n.delta} * transformOperator(operation))) as ${t}`:`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}translateAttributeSQL(t){const e=`[${t.arg}]`,o=/^(ac|pp|fc|pl)[1-4]$/.test(t.arg)&&this.config.type!==_.OPT&&this.config.type!==_.OPTNOTOTAL;switch(t.fn){case"set":return`SETAGG(${e}) as ${t.alias}`;case"first":return`FIRST(${e}) as ${t.alias}`;case"last":return`LAST(${e}) as ${t.alias}`;case"min":return`MIN(${e}) as ${t.alias}`;case"max":return`MAX(${e}) as ${t.alias}`;case"avg":return o?`AVG(${e} * transformOperator(operation)) as ${t.alias}`:`AVG(${e}) as ${t.alias}`;case"sum":return o?`SUM(${e} * transformOperator(operation)) as ${t.alias}`:`SUM(${e}) as ${t.alias}`;case"lit":return`${this.sqlLiteral(t.arg)} as ${t.alias}`}}sqlLiteral(t){return""===t||Number.isNaN(Number(t))?`'${t.replace(/'/g,"''")}'`:t}createOrderString(t){return[`${t.hierarchy.toString()} ${t.direction}`,`${t.hierarchy.toString()} ${N.ASC===t.direction?N.DESC:N.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 ",i=` ${r.ROWGROUP}`,l="ROWNUM()";return null===(o=this.config.partOf)||void 0===o||o.forEach((t=>{s+=`OR (${r.CATEGORY} = '${t.category}'`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(s+=`and ${r.ROWGROUP} = '${t.rowGroup}'`),!1===this.config.grouped&&(i=` 'SUM_TOTAL' as ${r.ROWGROUP} `,l="1"),s+=")"})),n.push(`SELECT ${l} AS ${r.ROWNR},\n 'PARTELEMENT' as ${r.TYPE},\n ${r.CATEGORY},\n ${i},\n ${t}\n FROM ${this.fromExpr}\n WHERE ${s}\n GROUP BY ${r.ROWGROUP}, ${r.CATEGORY}, ${r.TYPE}\n ORDER BY ${e[1]}`),n}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,e){if(null==t||0===t.size)return;const o=[],n=[],s=this.fromExpr;t.forEach(((t,e)=>{let n="1 <> 1 ";t.forEach((t=>{n+=` or columnGroup = '${t.name}' `})),o.push(`SELECT 'ENTRY' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),o.push(`SELECT 'ENTRY' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),o.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),o.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),o.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),o.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),o.push(`SELECT 'SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, columnGroup, scenario`),o.push(`SELECT 'SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of o)n.push(...this.db.exec(t));this.injectDrillColumnsToResultRows(n,e)}injectDrillColumnsToResultRows(t,e){const o="##";for(const n of t)for(const t of e)for(const e of t)e.type===n.rowlevel&&("ENTRY"===n.rowlevel?"COLUMNGROUP"===n.columnlevel&&e.category===n.category?e[n.scenario+o+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&(e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val):"DRILLELEMENT"===n.rowlevel?"COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory?e[n.scenario+o+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory?e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val:"COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===`${n.subCategory} (${n.rowGroup})`?e[n.scenario+o+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===`${n.subCategory} (${n.rowGroup})`&&(e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val):("SUM"===n.rowlevel||"GROUP_SUM"===n.rowlevel)&&("COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory&&(e[n.scenario+o+n.columnGroup]=n.val),"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory&&(e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val)))}}class ot{constructor(){this.geometry=new Map}set(t,e,o){let n=this.geometry.get(t);n||(n=new Map,this.geometry.set(t,n)),n.set(e,o)}get(t,e){var o;return null===(o=this.geometry.get(t))||void 0===o?void 0:o.get(e)}}function nt(t,e,o){const n=t[e];if(null==n)return null;const s=Number(n);return isNaN(s)?null:o!==_.OPT&&o!==_.OPTNOTOTAL||t[r.TYPE]!==C.ENTRY||"-"!==t[r.OPERATION]?s:-s}class st{constructor(){this.normalizedHeader=[],this.attributesByAlias=new Map}createHeader(t,e,o,n,s,r,l=[]){const a=[];this.attributesByAlias=new Map(l.map((t=>[t.alias,t]))),this.normalizedHeader=this.normalizeHeader(t,e,l);const c=this.normalizedHeader.some((t=>void 0!==t.bucket));c&&a.push(this.createIntervalBandRow());const h=new B(c?1:0,0,C.HEADER),u=new B(c?2:1,0,C.SEPERATORLINE);for(const t of this.normalizedHeader){const e=this.attributesByAlias.get(t.name);h.createElement(e?o.get(e.label)||e.label:i.translateScenarioLabel(t.name,o),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,o,n,s,r),null,null,null,null),u.createElement(null,t.type,this.createColumnType(t),null,null,null,null,null,null)}return a.push(h),a.push(u),a}createIntervalBandRow(){const t=new B(0,0,C.HEADER);let e=0;for(;e<this.normalizedHeader.length;){const o=this.normalizedHeader[e];if(void 0===o.bucket){t.createElement(null,o.type,"filler",null,null,null,null,null,null),e+=1;continue}let n=1;for(;e+n<this.normalizedHeader.length&&this.normalizedHeader[e+n].bucket===o.bucket;)n+=1;t.createElement(o.bucketLabel,o.type,"intervalGroup",null,null,null,null,null,null,!1,void 0,n),e+=n}return t}setHeaderPrefix(t,e,o,n,s){let r="";return"category"===t.name&&s&&(0===o.prefix.length&&0===n.length||(r=i.translateScenarioLabel("in",e)+" "+o.prefix+n)),t.order&&(r+=i.translateScenarioLabel("ORDER_"+t.order,e)),r}normalizeHeader(t,e,o){let n=[{name:r.CATEGORY,group:r.CATEGORY,type:r.CATEGORY,order:void 0}];_.OPT!==t&&_.OPTNOTOTAL!==t||(n=[{name:r.OPERATION,group:r.OPERATION,type:r.OPERATION,order:void 0},{name:r.CATEGORY,group:r.CATEGORY,type:r.CATEGORY,order:void 0}]);const s=o.map((t=>({name:t.alias,group:t.alias,type:t.alias,order:void 0})));return[...n,...s,...e]}createBodyRows(t,e,o,n){var s;const i=[];let l=-1;const a=new et(t,e).execute(o,n),h=this.calculateColumnStatistics(a,t.barColumns,t.interval!==L),u=(null!==(s=t.barColumns)&&void 0!==s?s:[]).filter((t=>t.toUpperCase().trim()in c)),f=u.length>0&&t.interval===L&&0===t.categoryThereOf.size&&function(t){for(const e of t)for(const t of e){const e=t[r.TYPE];if(e===C.SUM||e===C.GROUPSUM||e===C.DRILLELEMENT||e===C.PARTELEMENT)return!0}return!1}(a)?function(t,e,o){const n=new ot;for(const s of e){let e,i=0,l=0;const a=[],c=(t,e)=>{a.push(e),n.set(t,s,e)};for(const n of t)for(const t of n){const n=t[r.TYPE];if(n===C.GROUPHEAD){e=void 0;continue}const a=nt(t,s,o);if(n===C.ENTRY){if(null===a){e=void 0;continue}c(t,{start:i,end:i+a,min:0,max:0,kind:"cascade"}),e={start:i,end:i+a},l=e.start,i+=a}else if(n===C.SUM||n===C.GROUPSUM){if(null===a){e=void 0;continue}c(t,{start:0,end:a,min:0,max:0,kind:"anchor"}),e={start:0,end:a},l=0,i=a}else if(n===C.DRILLELEMENT){if(null===a||void 0===e)continue;const o=l+(Math.sign(e.end-e.start)||1)*Math.abs(a);c(t,{start:l,end:o,min:0,max:0,kind:"thereof",parentStart:e.start,parentEnd:e.end}),l=o}else if(n===C.PARTELEMENT){if(null===a||void 0===e)continue;const o=l+a*(e.end-e.start);c(t,{start:l,end:o,min:0,max:0,kind:"partof",parentStart:e.start,parentEnd:e.end}),l=o}}let h=0,u=0;for(const t of a)h=Math.min(h,t.start,t.end),u=Math.max(u,t.start,t.end);for(const t of a)t.min=h,t.max=u}return n}(a,u,t.type):void 0;for(const o of a)l+=1,i.push(...this.createRow(t.i18n,e,t.scenariosUnitType,o,l,-1,t.categoryWidth,t.measureScale,t.barColumns,h,f));return i}calculateColumnStatistics(t,e,o=!1){const n=new Map;if(!e||0===e.length)return n;const s=new Map;for(const t of e)n.set(t,{min:1/0,max:-1/0,absMax:0,median:0}),s.set(t,[]);for(const i of t)for(const t of i)for(const i of e){const e=o?this.extractIntervalColumnValues(t,i):[this.extractColumnValue(t,i)];for(const t of e)if(null!==t&&!isNaN(t)){const e=n.get(i);e.min=Math.min(e.min,t),e.max=Math.max(e.max,t),s.get(i).push(Math.abs(t))}}for(const[t,e]of n){e.min!==1/0&&e.max!==-1/0||(e.min=0,e.max=0),e.absMax=Math.max(Math.abs(e.min),Math.abs(e.max));const o=s.get(t);if(o.length>0){o.sort(((t,e)=>t-e));const t=Math.floor(o.length/2);e.median=o.length%2==0?(o[t-1]+o[t])/2:o[t]}n.set(t,e)}return n}extractIntervalColumnValues(t,e){const o=e+"##",n=[];for(const e of Object.keys(t))if(e.startsWith(o)){const o=Number(t[e]);n.push(isNaN(o)?null:o)}return n}extractColumnValue(t,e){if(void 0!==t[e]){const o=Number(t[e]);return isNaN(o)?null:o}for(const o of Object.keys(t))if(o===e||o.endsWith("##"+e)||o===e+"##"+e){const e=Number(t[o]);if(!isNaN(e))return e}return null}createRow(t,e,o,n,s,i,l,a,c,h,u){var f;const d=[];for(const p of n){const $=p[r.ROWGROUP],m=p[r.SUBCATEGORY],v=p[r.TYPE],R=p[r.ROWNR]>=2,g=this.createDetailRow(v,i+=1,s,n.length);for(const n of this.normalizedHeader){const s=this.getRawDataRowElement(p,n),i=null!==(f=null==c?void 0:c.includes(n.type))&&void 0!==f&&f,r=i?null==h?void 0:h.get(n.type):void 0,d=i&&void 0===n.bucket&&n.name===n.group&&n.name===n.type?null==u?void 0:u.get(p,n.type):void 0;g.createElement(this.translateSumCellLabel(t,e,s,$,m,v,n.type),n.type,this.createColumnType(n),this.setCellType(n.type,o),this.translateCellPrefix(e,v,n.type),this.translateScenarioCSS(n.type,s),R,l,null==a?void 0:a.value,i,r,1,d)}d.push(g)}return d}getRawDataRowElement(t,e){return void 0!==e.bucket?t[e.type+"##"+e.bucket]:e.name===e.group&&e.name===e.type?t[e.name]:e.name===e.group&&e.name!==e.type?t[e.type+"##"+e.name]:t[e.type+"##"+e.group+"##"+e.name]}createDetailRow(t,e,o,n){switch(t){case C.GROUPHEAD:return new B(e,o,C.HEADER);case C.SUM:case C.GROUPSUM:return new B(n+2,o,C.SUM);case C.DRILLELEMENT:return new B(n+2,o,C.DRILLELEMENT);case C.PARTELEMENT:return new B(n+2,o,C.PARTELEMENT);default:return new B(e,o,C.STANDARD)}}translateSumCellLabel(t,e,o,n,s,i,r){return this.attributesByAlias.has(r)||!1===Number.isNaN(Number(o))||this.isOperationColumn(r)?o:this.isGroupHeadCategory(i,r)?t===h.ALL?`${e.get(o)||o}`:o:this.isEntryCategory(i,r)?t===h.ALL||"REST"===o?`${e.get(o)||o}`:o:this.isDrillElementCategory(i,r)?t===h.ALL?`${e.get(s)||s}`:`${s}`:this.isPartElementCategory(i,r)?t===h.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:`${n}`:this.isSumElementCategory(i,r)?t===h.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:n:"GROUPHEAD"===i&&null==o?o:Number.isNaN(Number(o))?"-":Number(o)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,e){if(this.attributesByAlias.has(t))return"attribute";const o=new l(t);let n="pos";return e<0&&(n="neg"),o.isValid?n+"_"+o.direction+("dr"===o.type?" relative_variance":""):t}setCellType(t,e){if("category"===t)return"";const o=this.attributesByAlias.get(t);if(o)return o.isNumeric?"decimal":"";let n;const s=new l(t);return e===u.PERCENT?(n="percent",s.isValid&&"d"===s.type&&(n="decimal")):(n="decimal",s.isValid&&"dr"===s.type&&(n="percent")),n}isDrillElementCategory(t,e){return"DRILLELEMENT"===t&&"category"===e}isPartElementCategory(t,e){return"PARTELEMENT"===t&&"category"===e}isSumElementCategory(t,e){return("GROUP_SUM"===t||"SUM"===t)&&"category"===e}isEntryCategory(t,e){return"ENTRY"===t&&"category"===e}isGroupHeadCategory(t,e){return"GROUPHEAD"===t&&"category"===e}translateCellPrefix(t,e,o){return this.isOperationColumn(o)||this.isGroupHeadCategory(e,o)||this.isEntryCategory(e,o)?null:this.isDrillElementCategory(e,o)?`${t.get("there_of")} `:this.isPartElementCategory(e,o)?`${t.get("part_of")} `:null}createColumnType(t){return t.name===t.group&&t.name===t.type?"base":t.name===t.group?"columnGroup":"columnSubGroup"}}class it{constructor(t,e,o,n){this.fromExpr="",this.rowCount=0,this.headerRows=[],this.bodyRows=[],this.intervalBuckets=[],this.ruleSet=t||new a,this.db=e,this.dataSetFactory=new st,this.config=this.initConfig(n),this.i18n=this.initI18n(new Map),this.setSource(o,n.filter),this.state=G.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"],["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=G.DIRTY,new Map([...e,...t||new Map])}initConfig(t){this.state=G.DIRTY;const e=t,o=this;return t.scenarios.sort(((t,e)=>o.ruleSet.getScenarioSorIndex(t)-o.ruleSet.getScenarioSorIndex(e))),e}setConfig(t){this.config=this.initConfig(t)}setSource(t,e){var o,n;if(!t)return this.fromExpr="",void(this.rowCount=0);this.fromExpr=R(t,e);try{const t=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(n=null===(o=t[0])||void 0===o?void 0:o.cnt)&&void 0!==n?n:0}catch(t){this.rowCount=0}this.prepareIntervalBuckets();const s=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder,this.intervalBuckets);this.headerRows=this.dataSetFactory.createHeader(this.config.type,s,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale,this.config.attributes),this.bodyRows=0===this.rowCount?[]:this.dataSetFactory.createBodyRows(this.config,this.i18n,this.db,this.fromExpr),this.state=G.UP_TO_DATE}update(){this.prepareIntervalBuckets();const t=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder,this.intervalBuckets);this.headerRows=this.dataSetFactory.createHeader(this.config.type,t,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale,this.config.attributes),this.bodyRows=0!==this.rowCount&&this.fromExpr?this.dataSetFactory.createBodyRows(this.config,this.i18n,this.db,this.fromExpr):[],this.state=G.UP_TO_DATE}getHeader(){return this.state===G.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===G.DIRTY&&this.update(),this.bodyRows}prepareIntervalBuckets(){this.intervalBuckets=[],this.config.interval===L||!this.fromExpr||this.config.categoryThereOf.size>0?this.config.interval=L:(this.config.interval=function(t,e,o){var n;if(o!==m.AUTO)return o;let s,i,r;try{s=t.exec(`SELECT [date] as d FROM ${e}`)}catch(t){return console.error("IntervalColumns: date query failed",t),m.DAY}for(const t of s){const e=null===(n=A(t.d))||void 0===n?void 0:n.toMillis();void 0!==e&&(i=void 0===i?e:Math.min(i,e),r=void 0===r?e:Math.max(r,e))}return void 0===i||void 0===r?m.DAY:(new v).calculateDistanceType($.fromMillis(i),$.fromMillis(r))}(this.db,this.fromExpr,this.config.interval),this.intervalBuckets=function(t,e,o,n){let s;try{s=t.exec(`SELECT ${k(o)} as __interval FROM ${e}`)}catch(t){return console.error("IntervalColumns: bucket query failed",t),[]}if(o===x){const t=new Set,e=[];for(const o of s){const n=P(o.__interval);t.has(n)||(t.add(n),e.push({key:n,label:0===n.length?"—":n}))}return e}const i=new Set,r=[];for(const t of s){const e=A(t.__interval);if(!e)continue;const o=e.toISO();i.has(o)||(i.add(o),r.push(e))}r.sort(((t,e)=>t.toMillis()-e.toMillis()));const l=new v;return l.setLocale(n),r.map((t=>({key:t.toISO(),label:l.getDateString(t,o)})))}(this.db,this.fromExpr,this.config.interval,this.config.locale),0===this.intervalBuckets.length&&(this.config.interval=L))}normalizeScenarios(t,e,o,n=[]){var s,i;const r=[];if(n.length>0){for(const e of n)for(const n of t)r.push({name:n,group:n,type:n,order:(null===(s=null==o?void 0:o.hierarchy)||void 0===s?void 0:s.at(0))===n?o.direction:void 0,bucket:e.key,bucketLabel:e.label});return r}for(const n of t){if(null==e?void 0:e.has(n)){const t=e.get(n);for(const e of t){r.push({name:e.name,group:e.name,type:n,order:void 0});for(const t of e.subGroups)r.push({name:t,group:e.name,type:n,order:void 0})}r.push({name:"REST",group:"REST",type:n,order:void 0})}let t;(null===(i=null==o?void 0:o.hierarchy)||void 0===i?void 0:i.at(0))===n&&(t=o.direction),r.push({name:n,group:n,type:n,order:t})}return r}hasNoData(){return 0===this.rowCount}}class rt{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=u.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.attributes=[],this.sortOrder=new y(new O).default(),this.type=_.LIST,this.limit=0,this.i18n=h.ALL,this.categoryWidth=d.W25,this.measureScale=new M,this.measureUnit="",this.measureType=p.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[],this.interval="none",this.locale="de"}}class lt{constructor(t,e,o,n,s){this.tableDrillGroupAdapter=t,this.stringAdapter=e,this.orderAdapter=o,this.db=n,this.fromExpr=s}adapt(t){const e=new rt;return f.isString(t.title)&&(e.title=t.title),f.isArray(t.scenarios)&&(e.scenarios=b.adaptArray(t.scenarios,this.stringAdapter)),f.isExisting(t.scenariosUnitType)&&(e.scenariosUnitType=t.scenariosUnitType),f.isBoolean(t.grouped)&&(e.grouped=t.grouped),f.isBoolean(t.showGroupTitle)&&(e.showGroupTitle=t.showGroupTitle),f.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),f.isArray(t.thereOf)&&(e.thereOf=b.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),f.isExisting(t.categoryThereOf)&&(e.categoryThereOf=t.categoryThereOf),f.isArray(t.partOf)&&(e.partOf=b.adaptArray(t.partOf,this.tableDrillGroupAdapter)),f.isArray(t.attributes)&&(e.attributes=t.attributes),f.isExisting(t.order)&&(e.sortOrder=this.orderAdapter.adapt(t.order)),f.isExisting(t.type)&&(e.type=t.type),f.isNumber(t.limit)&&(e.limit=t.limit),f.isExisting(t.i18n)&&(e.i18n=t.i18n),f.isExisting(t.categoryWidth)&&(e.categoryWidth=t.categoryWidth),f.isExisting(t.measureScale)&&(e.measureScale=w.calculateMeasureScale(this.db,this.fromExpr,e.scenarios,t.measureScale)),f.isExisting(t.measureType)&&(e.measureType=t.measureType),f.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),f.isString(t.filter)&&(e.filter=t.filter.trim()),f.isArray(t.barColumns)&&(e.barColumns=t.barColumns),f.isString(t.interval)&&(e.interval=t.interval),f.isString(t.locale)&&(e.locale=t.locale),e}default(){return new rt}}class at{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class ct{constructor(){}adapt(t){const e=new at;return f.isString(t.rowGroup)&&(e.rowGroup=t.rowGroup),f.isString(t.category)&&(e.category=t.category),f.isString(t.subCategory)&&(e.subCategory=t.subCategory),f.isString(t.partOf)&&(e.partOf=t.partOf),e}default(){return new at}}const ht=e(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.sumTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=u.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.thereof=[],this.partof=[],this.order={hierarchy:[],direction:N.ASC},this.categorythereof=new Map,this.attributeColumns=[],this.type=_.LIST,this.categoryWidth=d.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=h.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=p.VOLUME,this.filter="",this.barColumns=[],this.interval="none",this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new S,this.componentStyle=U(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&&(void 0!==o.waterfall||e.type!==C.SUM)?void 0!==o.waterfall?t(Z,{value:o.value,scenario:o.key,columnStats:o.columnStats,height:18*this.scaleFactor,isRelative:!1,isPositiveGood:o.key.endsWith("_pos"),measureScale:o.measureScale,maxBarWidth:this.barColumnMaxWidth,styles:this.barChartStyles,waterfall:o.waterfall}):t(J,{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(){this.stores||(this.stores=g(this.element));const t=this.stores.db.db,e=this.prepareConfig(t);this.componentDataFormatDigits=(new E).adapt(this.dataFormatDigits),this.table=new it(new a(this.ruleSetConfig),t,this.tableName,e),this.table.setI18n(this.i18n),this.barChartStyles=this.prepareBarChartStyles()}prepareConfig(t){var e,o,n;const s=this.tableName?this.filter&&this.filter.length>0?`(SELECT * FROM \`${this.tableName}\` WHERE ${this.filter}) AS __src`:`\`${this.tableName}\``:"";return new lt(new ct,new O,new y(new O),t,s).adapt({title:this.sumTitle,scenarios:this.scenarios,scenariosUnitType:this.scenariosDataFormat,grouped:this.grouped,showGroupTitle:this.showGroupTitle,thereOf:this.thereof,partOf:this.partof,categoryThereOf:this.categorythereof,attributes:this.attributeColumns,order:this.order,type:this.type,limit:this.limit,i18n:this.i18nMode,categoryWidth:this.categoryWidth,measureScale:this.measureScale,measureUnit:this.measureUnit,measureType:this.measureType,showMeasureScale:this.showMeasureScale,filter:this.filter,barColumns:this.barColumns,interval:this.interval,locale:(null===(n=null===(o=null===(e=this.stores)||void 0===e?void 0:e.context)||void 0===o?void 0:o.state)||void 0===n?void 0:n.locale)||"de"})}prepareBarChartStyles(){return this.componentStyle((t=>{var e,o,n,s,i,r,l,a,c,h,u,f,d,p,$,m,v,R,g,w,S,E,b,y,O,M;const U=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.varianceStyles,T=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===(i=null==U?void 0:U.pos)||void 0===i?void 0:i.fillpattern)||"solid"},negative:{stroke:(null===(r=null==U?void 0:U.neg)||void 0===r?void 0:r.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===(f=null==T?void 0:T.ac)||void 0===f?void 0:f.stroke)||"#404040",fill:(null===(d=null==T?void 0:T.ac)||void 0===d?void 0:d.fill)||"#404040",fillpattern:(null===(p=null==T?void 0:T.ac)||void 0===p?void 0:p.fillpattern)||"solid"},pp:{stroke:(null===($=null==T?void 0:T.pp)||void 0===$?void 0:$.stroke)||"#A6A6A6",fill:(null===(m=null==T?void 0:T.pp)||void 0===m?void 0:m.fill)||"#A6A6A6",fillpattern:(null===(v=null==T?void 0:T.pp)||void 0===v?void 0:v.fillpattern)||"solid"},fc:{stroke:(null===(R=null==T?void 0:T.fc)||void 0===R?void 0:R.stroke)||"#404040",fill:(null===(g=null==T?void 0:T.fc)||void 0===g?void 0:g.fill)||"#ffffff",fillpattern:(null===(w=null==T?void 0:T.fc)||void 0===w?void 0:w.fillpattern)||"hatched"},pl:{stroke:(null===(S=null==T?void 0:T.pl)||void 0===S?void 0:S.stroke)||"#404040",fill:(null===(E=null==T?void 0:T.pl)||void 0===E?void 0:E.fill)||"#ffffff",fillpattern:(null===(b=null==T?void 0:T.pl)||void 0===b?void 0:b.fillpattern)||"outlined"}},fontColor:(null===(y=t.global)||void 0===y?void 0:y.fontColor)||"#000000",fontSize:.85*((null===(O=t.global)||void 0===O?void 0:O.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!==C.SUM)for(const o of e.getCells())o.isBarChart&&o.columnStats&&!o.key.startsWith("dr")&&!o.waterfall&&(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!==C.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}th.intervalGroup{border-bottom:0.1em solid black;text-align:center;font-weight:bold}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em dashed #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}'}},[1,"ibcs-table",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],selectedStyle:[513,"selected-style"],sumTitle:[1,"sum-title"],scenarios:[16],scenariosDataFormat:[1,"scenarios-data-format"],grouped:[4],limit:[2],showGroupTitle:[4,"show-group-title"],thereof:[16],partof:[16],order:[16],categorythereof:[16],attributeColumns:[16],type:[1],categoryWidth:[1,"category-width"],dataFormatDigits:[16],ruleSetConfig:[16],i18n:[1040],i18nMode:[1,"i18n-mode"],measureScale:[1,"measure-scale"],measureUnit:[1,"measure-unit"],showMeasureScale:[4,"show-measure-scale"],measureType:[1,"measure-type"],filter:[1],barColumns:[16],interval:[1],barColumnMaxWidth:[2,"bar-column-max-width"],unitScaling:[2,"unit-scaling"],percentageScaling:[2,"percentage-scaling"],scaleFactor:[2,"scale-factor"]}]);function ut(){"undefined"!=typeof customElements&&["ibcs-table"].forEach((t=>{"ibcs-table"===t&&(customElements.get(s(t))||customElements.define(s(t),ht))}))}export{ht as I,_ as T,L as a,x as b,ut as d}
1
+ import{h as t,proxyCustomElement as e,HTMLElement as n,Host as o,transformTag as i}from"@stencil/core/internal/client";import{F as s,Q as r,V as a,I as l}from"./formatter.js";import{S as c,I as h,D as u,C as d,d as f,M as p}from"./CompareUtil.js";import{D as $}from"./luxon.js";import{a as m,b as v}from"./DateStringFactory.js";import{d as g,g as b}from"./context-protocol.js";import{D as R,a as w,b as S}from"./DataFormatDigits.js";import{A as E,c as y}from"./Order.js";import{S as O}from"./StringAdapter.js";import{S as M}from"./SiPrefix.js";import{w as U}from"./withComponentStyle.js";var T,G,_,N,C;!function(t){t[t.ALL=-1]="ALL"}(T||(T={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(G||(G={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(_||(_={})),function(t){t.ASC="asc",t.DESC="desc"}(N||(N={})),function(t){t.HEADER="HEADER",t.GROUPHEAD="GROUPHEAD",t.SEPERATORLINE="SEPERATORLINE",t.SUM="SUM",t.GROUPSUM="GROUP_SUM",t.DRILLELEMENT="DRILLELEMENT",t.STANDARD="STANDARD",t.PARTELEMENT="PARTELEMENT",t.ENTRY="ENTRY"}(C||(C={}));const L="none",x="setname";function P(t){return t===x?"COALESCE([setname],[setName])":`normalizeDate([date], '${t}')`}function k(t){if(null==t)return"";if("string"==typeof t)return t.trim();const e=A(t);return e?e.toISO():String(t)}function A(t){if(null!=t){if("string"==typeof t){const e=$.fromISO(t);return e.isValid?e:void 0}if("number"==typeof t){const e=$.fromMillis(t);return e.isValid?e:void 0}if("boolean"==typeof t.isValid)return t.isValid?t:void 0}}class D{constructor(t,e,n,o,i,s,r,a,l){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=e,this.value=n,this.prefix=s||"",this.cssStyle=o||"",this.prefixStyle=r||"prefix",this.type=i,this.mark=void 0,this.colSpan=a||1,this.measureScale=l||1}getAsHeaderList(){if(null==this.value)return[""];const t=[];for(const e of this.value.toString().split("<br/>"))t.push(e);return t}draw(t){let e=this.value;if("undefined"===e||void 0===e||null==e)return"";if(Number.isNaN(Number(e)))return e;if(""===this.type||void 0===this.type||null==this.type)return e;let n=t.percent,o=t.percent;return"decimal"===this.type&&(e=+e/this.measureScale,n=t.decimal,o=t.decimal),s.number(Number(e),this.type,n,o)}drawPrefix(){return null==this.prefix?"":this.prefix}}class W{constructor(t,e,n){this.index=t,this.groupindex=e,this.type=n,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case C.HEADER:return"groupheader";case C.SEPERATORLINE:return"";case C.DRILLELEMENT:return"ofit";case C.PARTELEMENT:return"partof";case C.STANDARD:return"";case C.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,e,n,o,i,s,r,a,l,c=!1,h,u=1,d){let f=s;"category"===e&&null!=a&&(f=`category-${a.toString()}`),this.type===C.HEADER?f="headerlabel":this.type===C.SEPERATORLINE&&(f=e),this.type===C.PARTELEMENT&&("percent"===o&&(t="-"),"category"!==e&&"operation"!==e&&(o="percent",f="")),"-"===t&&(f="");let p="prefix-first";r&&(p="prefix-second"),n&&(f=`${f} ${n}`);const $=new D(e,this.elements.length,t,f,o,i,p,u,l);$.isBarChart=c,$.columnStats=h,$.waterfall=d,this.elements.push($)}}const B=.85;function F(t,e){return Math.max(0,(t-.5)*e)}function Y(t,e){return Math.max(1,(t?1:0)+(e?1:0))}function H(t,e,n,o){const i=F(t,e),s=Y(n,o),r=Math.min(2.85*e,i/(2*s)),a=(i-r*s)/s,l=Math.min(.3*e,.2*a),c=.15*a;return{totalWidth:i,labelAreaWidth:r,maxBarWidth:a,axisX:n?r+a:0,breakGap:l,overdriveZoneWidth:c,cutWidth:Math.max(0,a-l-c),labelGap:.3*e}}function I(t,e,n,o){const i=F(t,e),s=Y(n,o),r=Math.min(3.375*e,i/2),a=i-r,l=a/s,c=Math.min(.375*e,.2*l);return{totalWidth:i,labelAreaWidth:r,maxPinLength:Math.max(0,l-c),pinPadding:c,axisX:n?l:0,labelX:a+.3*e}}const j={positive:{stroke:"#008f96",fill:"#008f96",fillpattern:"solid"},negative:{stroke:"#ff0000",fill:"#ff0000",fillpattern:"solid"},neutral:{stroke:"#808080",fill:"#808080",fillpattern:"outlined"},scenarios:{ac:{stroke:"#404040",fill:"#404040",fillpattern:"solid"},pp:{stroke:"#A6A6A6",fill:"#A6A6A6",fillpattern:"solid"},fc:{stroke:"#404040",fill:"#ffffff",fillpattern:"hatched"},pl:{stroke:"#404040",fill:"#ffffff",fillpattern:"outlined"}},fontColor:"#000000",fontSize:11.333305,emPx:13.3333,fontFamily:"'Noto Sans', sans-serif",unitScaling:.01,percentageScaling:.5,scaleFactor:1},z="#666666";function Q(t,e){return`pattern-${t}-${e.replace("#","")}`}const V=({styles:e})=>{const n=e.scaleFactor,o=6*n,i=[{id:Q("pos",e.positive.stroke),stroke:e.positive.stroke,fill:e.positive.fill},{id:Q("neg",e.negative.stroke),stroke:e.negative.stroke,fill:e.negative.fill},{id:Q("neu",e.neutral.stroke),stroke:e.neutral.stroke,fill:e.neutral.fill},...["ac","pp","fc","pl"].map((t=>({id:Q(t,e.scenarios[t].stroke),stroke:e.scenarios[t].stroke,fill:e.scenarios[t].fill})))];return t("defs",null,i.map((e=>t("pattern",{id:e.id,patternUnits:"userSpaceOnUse",width:o,height:o},t("rect",{width:o,height:o,fill:"#ffffff"}),t("line",{x1:"0",y1:o,x2:o,y2:"0",stroke:e.stroke,"stroke-width":1.5*n})))))};function X(t,e,n=1){let o,i;const s=t>=0?"+":"";if(e)return o=100*t,s+Math.round(o).toString()+"%";{let e;return o=t/n,i=Math.abs(o),e=i>=1e9?(o/1e9).toFixed(i>=1e10?0:1)+"B":i>=1e6?(o/1e6).toFixed(i>=1e7?0:1)+"M":i>=1e3?(o/1e3).toFixed(i>=1e4?0:1)+"K":o.toFixed(i>=10?0:1),e=e.replace(/\.0([KMB]?)$/,"$1"),s+e}}function q(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 Z(t,e,n,o){return q(t)?function(t,e){const n=K(t);return e.scenarios[n]}(t,o):function(t,e,n){const o=t>=0;return e?o?n.positive:n.negative:o?n.negative:n.positive}(e,n,o)}function J(t,e){const n=t.fillpattern;return"hatched"===n?`url(#${Q(e,t.stroke)})`:"outlined"===n?"transparent":t.fill}function tt(t){return"outlined"===t.fillpattern?{stroke:t.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0}}const et=e=>{const{value:n,scenario:o,columnStats:i,height:s,isPositiveGood:r,formattedValue:a,measureScale:l,columnWidthEm:c=10,styles:h=j}=e,u=h.scaleFactor,d=h.fontSize,f=i.min<0,p=i.max>0,{totalWidth:$,axisX:m,breakGap:v,overdriveZoneWidth:g,cutWidth:b,labelGap:R}=H(c,h.emPx,f,p),w=Math.abs(n)*h.unitScaling*d,S=w>b,E=Math.max(0,i.absMax*h.unitScaling*d-b),y=Math.max(0,w-b),O=E>0?y/E*g:0,M=2*u,U=s-2*M,T=M,G=n>=0,_=Z(o,n,r,h),N=J(_,q(o)?K(o):r?G?"pos":"neg":G?"neg":"pos"),{stroke:C,strokeWidth:L}=tt(_),x=a||X(n,!1,l),P=S?b:w,k=S?b+v+O:w,A=G?m+k+R:m-k-R,D=G?"start":"end";return t("svg",{width:$,height:s,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},t(V,{styles:h}),t("line",{x1:m,y1:0,x2:m,y2:s,stroke:z,"stroke-width":1*u}),P>0&&t("rect",{x:G?m:m-P,y:T,width:P,height:U,fill:N,stroke:C,"stroke-width":L*u}),S&&O>0&&t("rect",{x:G?m+b+v:m-b-v-O,y:T,width:O,height:U,fill:N,stroke:C,"stroke-width":L*u}),S&&function(e,n,o,i,s){const r=e+n/2,a=.35*n,l=i/3,c=.3*n;let h=`M ${r-a} ${o}`;for(let t=0;t<3;t++)h+=` L ${r-a-c} ${o+l*(t+.5)} L ${r-a} ${o+l*(t+1)}`;let u=`M ${r+a} ${o}`;for(let t=0;t<3;t++)u+=` L ${r+a+c} ${o+l*(t+.5)} L ${r+a} ${o+l*(t+1)}`;return[t("rect",{x:e,y:o-1,width:n,height:i+2,fill:"#ffffff"}),t("path",{d:h,fill:"none",stroke:"#000000","stroke-width":1*s}),t("path",{d:u,fill:"none",stroke:"#000000","stroke-width":1*s})]}(G?m+b:m-b-v,v,T,U,u),t("text",{x:A,y:s/2,dy:"0.35em","text-anchor":D,fill:h.fontColor,"font-size":d,"font-family":h.fontFamily},x))},nt=e=>{const{value:n,scenario:o,columnStats:i,height:s,isPositiveGood:r,formattedValue:a,measureScale:l,columnWidthEm:c=10,styles:h=j}=e,u=h.scaleFactor,d=h.fontSize,f=i.min<0,p=i.max>0,{totalWidth:$,maxPinLength:m,axisX:v,labelX:g}=I(c,h.emPx,f,p),b=s/2,R=100*Math.abs(n)*h.percentageScaling*d,w=R>m,S=Math.min(R,m),E=n>=0,y=E?v+S:v-S,O=Z(o,n,r,h),M=3*u,U=a||X(n,!0,l);return t("svg",{width:$,height:s,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},t("line",{x1:v,y1:0,x2:v,y2:s,stroke:z,"stroke-width":1*u}),!w&&t("circle",{cx:y,cy:b,r:M,fill:h.fontColor}),t("line",{x1:v,y1:b,x2:y,y2:b,stroke:O.fill,"stroke-width":2*u}),w&&E&&t("polygon",{points:`${v+m},${b} ${v+m-6*u},${b-3*u} ${v+m-6*u},${b+3*u}`,fill:O.fill}),w&&!E&&t("polygon",{points:`${v-m},${b} ${v-m+6*u},${b-3*u} ${v-m+6*u},${b+3*u}`,fill:O.fill}),t("text",{x:g,y:s/2,dy:"0.35em","text-anchor":"start",fill:h.fontColor,"font-size":d,"font-style":"italic","font-family":h.fontFamily},U))},ot=e=>{const{value:n,columnStats:o,isRelative:i,styles:s=j}=e;return null==n||isNaN(n)||!o||0===o.absMax?t("span",{class:"bar-chart-empty",style:{color:s.fontColor,fontStyle:"italic"}},"-"):t(i?nt:et,Object.assign({},e))},it=e=>{const{value:n,scenario:o,height:i,measureScale:s,columnWidthEm:r=10,styles:a=j,waterfall:l}=e,c=a.scaleFactor,h=a.fontSize,u=l.max-l.min;if(null==n||isNaN(n)||u<=0)return t("span",{class:"bar-chart-empty",style:{color:a.fontColor,fontStyle:"italic"}},"-");const{totalWidth:d,labelAreaWidth:f,barAreaWidth:p,labelGap:$}=function(t,e){const n=F(t,e),o=Math.min(2.85*e,n/4);return{totalWidth:n,labelAreaWidth:o,barAreaWidth:n-2*o,labelGap:.3*e}}(r,a.emPx),m=p/u,v=t=>f+(t-l.min)*m,g=2*c,b=i-2*g,R=g,w=v(0),S=v(l.start),E=v(l.end),y=Math.min(S,E),O=Math.abs(E-S),M=Z(o,n,!1,a),U=J(M,K(o)),{stroke:T,strokeWidth:G}=tt(M),_=X(n,"partof"===l.kind,s).replace(/^\+/,""),N=E<S,C=N?y-$:y+O+$,L=N?"end":"start";return t("svg",{width:d,height:i,class:"cell-bar-chart waterfall-bar",style:{overflow:"visible"}},t(V,{styles:a}),t("line",{x1:w,y1:0,x2:w,y2:i,stroke:z,"stroke-width":1*c}),void 0!==l.parentStart&&void 0!==l.parentEnd&&t("line",{x1:v(l.parentStart),y1:0,x2:v(l.parentStart),y2:i,stroke:z,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),void 0!==l.parentStart&&void 0!==l.parentEnd&&t("line",{x1:v(l.parentEnd),y1:0,x2:v(l.parentEnd),y2:i,stroke:z,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),O>0&&t("rect",{x:y,y:R,width:O,height:b,fill:U,stroke:T,"stroke-width":G*c}),t("text",{x:C,y:i/2,dy:"0.35em","text-anchor":L,fill:a.fontColor,"font-size":h,"font-family":a.fontFamily},_))};class st{constructor(t){this.groups=[r.CATEGORY,r.CATEGORYINDEX],_.OPT!==t.type&&_.OPTNOTOTAL!==t.type||this.groups.unshift(r.OPERATION),t.grouped&&(this.groups.push(r.ROWGROUP),this.groups.push(r.ROWGROUPINDEX))}toString(){return this.groups.map((t=>`${t}`)).toString()}noCategory(){return this.groups.filter((t=>t!==r.CATEGORY))}toArray(){return this.groups}}class rt{constructor(t,e){this.hasPartOf=!1,this.config=t,this.i18n=e}execute(t,e){var n;this.db=t,this.fromExpr=e;const o=[],i=[],s=[],a=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),l=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),c=this.getRelativeScenarios(),h=this.config.attributes.map((t=>this.translateAttributeSQL(t))).toString(),u=new st(this.config),d=this.config.grouped?[r.ROWGROUP,r.ROWGROUPINDEX]:[];let f,p=["",""];this.config.sortOrder.hierarchy.length>0&&(p=this.createOrderString(this.config.sortOrder)),this.hasPartOf=this.checkConfigForPartOf();try{f=t.exec(`SELECT COUNT(DISTINCT ${r.CATEGORY}) as ${r.TOTALROWCOUNT} ${d.length>0?","+d:""}\n FROM ${e} ${d.length>0?"GROUP BY "+d:""}\n ORDER BY ${p[0]}`)}catch(t){return console.error("DataQuery: meta query failed",t),[]}return 0===f.length||1===f.length&&0===(null!==(n=f[0][r.TOTALROWCOUNT])&&void 0!==n?n:0)&&0===d.length?[]:(f.forEach((t=>{const e=t.rowGroup&&t.rowGroup.length>0?`WHERE ${r.ROWGROUP} = '${t.rowGroup}'`:"";let n="";this.config.limit&&(n=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,o),this.createDataRow(o,t,u,a,h,e,p,n),this.createRestRow(t,o,u,a,e,p),this.createGroupSumRow(o,i,t,l,p)})),this.createTotalSumRow(o,i,l),o.forEach((e=>{try{s.push(t.exec(e))}catch(t){console.error("DataQuery: SQL query execution failed",e,t)}})),this.detectNaNCells(this.config.scenarios,s),this.createThereOfDrillRows(a,h,p,s),this.createPartOfDrillRows(a,p,i,s),this.createIntervalColumns(s),this.createThereOfDrillColumns(this.config.categoryThereOf,s),this.calculateColumnGroupRest(s,this.config.categoryThereOf),this.calculateRelativeVariances(s,c),s)}detectNaNCells(t,e){e.forEach((e=>{e.map((e=>(t.forEach((t=>{const n=new a(t);!0===n.isValid?0!==e[n.base+"_cnt"]&&0!==e[n.delta+"_cnt"]||(e[t]=Number.NaN):0===e[t+"_cnt"]&&(e[t]=Number.NaN)})),e)))}))}createPartOfDrillRows(t,e,n,o){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===_.LIST)return;const i=this.createPartOfQuery(t,e);let s=[];const a=this.db;i.forEach((function(t){s.push(...a.exec(t))}));const l=this.exctractScenarioNames(t),c=[];n.forEach((function(t){c.push(...a.exec(t))}));const h=new Map;c.forEach((t=>h.set(t[r.ROWGROUP],t))),s=this.reduceResDrillByCategoryGroups(s,l),s.forEach((function(t){l.forEach((e=>{try{t[e]=t[e]/h.get(t[r.ROWGROUP])[e]}catch(n){console.error("DataQuery: partOf drill row calculation failed",e,n),t[e]=Number.NaN}}))})),this.injectDrillRowsToResultRows(s,o)}createRestRow(t,e,n,o,i,s){if(t.totalRowCnt-this.config.limit>0&&0!==this.config.limit){const a=this.exctractScenarioNames(o).map((t=>`SUM(${t}) as ${t}`)).join(", ");e.push(`SELECT ${r.ROWNR}, 1 as ${r.ROWGROUPINDEX} , 'ENTRY' as ${r.TYPE}, 'NO_GROUP' as ${r.ROWGROUP}, 'REST' as ${r.CATEGORY} ${a.length>0?", "+a:""} FROM (SELECT ROWNUM() AS ${r.ROWNR}, ${e.length} as ${r.ROWGROUPINDEX} , 'ENTRY' as ${r.TYPE}, '${t.rowGroup||"NO_GROUP"}' as ${r.ROWGROUP}, ${n} ${o.length>0?",".concat(o):""} FROM ${this.fromExpr} ${i} GROUP BY ${n} ORDER BY ${s[0]}) t WHERE t.rowNr > ${this.config.limit}`)}}createDataRow(t,e,n,o,i,s,a,l){t.push(`SELECT ROWNUM() AS ${r.ROWNR},\n ${t.length} as ${r.ROWGROUPINDEX},\n 'ENTRY' as ${r.TYPE},\n '${e.rowGroup||"NO_GROUP"}' as ${r.ROWGROUP},\n '${r.CATEGORYINDEX}',\n ${n} ${o.length>0?",".concat(o):""} ${i.length>0?",".concat(i):""}\n FROM ${this.fromExpr} ${s}\n GROUP BY ${n}\n ORDER BY ${a[0]} ${l}`)}createGroupHeaderRow(t,e){!0===this.config.grouped&&e.push(`SELECT ROWNUM() AS ${r.ROWNR},\n ${e.length} as ${r.ROWGROUPINDEX},\n 'GROUPHEAD' as ${r.TYPE},\n '${t.rowGroup}' as ${r.ROWGROUP} ${this.config.showGroupTitle?`,'${t.rowGroup}' as ${r.CATEGORY}`:""}\n FROM ${this.fromExpr}\n GROUP BY '1'`)}createGroupSumRow(t,e,n,o,i){!0!==this.config.grouped||_.SUM!==this.config.type&&_.SUMNOTOTAL!==this.config.type&&_.OPT!==this.config.type&&_.OPTNOTOTAL!==this.config.type||(t.push(`SELECT ${t.length} as ${r.ROWGROUPINDEX},\n '=' as ${r.OPERATION},\n '${n.rowGroup}' as ${r.ROWGROUP},\n ROWNUM() AS ${r.ROWNR},\n 'GROUP_SUM' as ${r.TYPE} ${o.length>0?",".concat(o):""}\n FROM ${this.fromExpr}\n WHERE ${r.ROWGROUP} = '${n.rowGroup}'\n ORDER BY ${i[0]} `),e.push(`SELECT ${t.length} as ${r.ROWGROUPINDEX},\n '=' as ${r.OPERATION},\n '${n.rowGroup}' as ${r.ROWGROUP},\n ROWNUM() AS ${r.ROWNR},\n 'GROUP_SUM' as ${r.TYPE} ${o.length>0?",".concat(o):""}\n FROM ${this.fromExpr}\n WHERE ${r.ROWGROUP} = '${n.rowGroup}'\n ORDER BY ${i[0]} `))}createTotalSumRow(t,e,n){var o;if(_.SUM===this.config.type||_.OPT===this.config.type){const e=(null===(o=this.config.title)||void 0===o?void 0:o.trim())||"SUM_TOTAL",i=this.hasPartOf&&!1===this.config.grouped&&"SUM_TOTAL"!==e?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} ${e}`:e;t.push(`SELECT ${t.length} as ${r.ROWGROUPINDEX},\n '${i}' as ${r.ROWGROUP},\n '=' as ${r.OPERATION},\n 'SUM' as ${r.TYPE} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr} `)}e.push(`SELECT ${t.length} as ${r.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${r.ROWGROUP},\n '=' as ${r.OPERATION},\n 'SUM' as ${r.TYPE} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr} `)}reduceResDrillByCategoryGroups(t,e){const n=new Map;return t.forEach((function(t){const o=t.rowNr+t.rowGroup+t.type+t.category;if(n.has(o)){const i=n.get(o);e.forEach((e=>{try{i[e]+=t[e]}catch(t){console.error("DataQuery: drill row aggregation failed",e,t)}}))}else n.set(o,t)})),[...n.values()]}injectDrillRowsToResultRows(t,e){const n=new Map;if(!0===this.config.grouped)t.forEach((function(t){e.forEach((function(e){const o=e.findIndex((e=>e.category===t.category&&e.rowGroup===t.rowGroup));if(o>=0){if(n.has(`${t.category}_${t.rowGroup}`)){const e=n.get(`${t.category}_${t.rowGroup}`)||0;n.set(`${t.category}_${t.rowGroup}`,e+1)}else n.set(`${t.category}_${t.rowGroup}`,1);t[r.ROWNR]=n.get(`${t.category}_${t.rowGroup}`),e.splice(o+t[r.ROWNR],0,t)}}))}));else{const o=this.findDuplicateSubCategories(t);t.forEach((function(t){e.forEach((function(e){const i=e.findIndex((e=>null!=e.category&&e.category===t.category));if(i>=0){if(n.has(`${t.category}`)){const e=n.get(`${t.category}`)||0;n.set(`${t.category}`,e+1)}else n.set(`${t.category}`,1);(1===t[r.ROWNR]||o.includes(t.subCategory))&&(t.subCategory=`${t.subCategory} (${t.rowGroup})`),e.splice(i+t[r.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,e,n,o){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const i=[],s=[];this.config.thereOf.forEach((o=>{let s=!0,a="1 <> 1 OR ( ";null!=o.category&&0!==o.category.length&&o.category.trim()&&(a+=` ${r.CATEGORY} = '${o.category}'`,s=!1),null!=o.rowGroup&&0!==o.rowGroup.length&&o.rowGroup.trim()&&(a+=` ${s?"":"AND"} ${r.ROWGROUP} = '${o.rowGroup}'`,s=!1),null!=o.subCategory&&0!==o.subCategory.length&&o.subCategory.trim()&&(a+=` ${s?"":"AND"} ${r.SUBCATEGORY} = '${o.subCategory}'`),a+=")",i.push(`SELECT ROWNUM() AS ${r.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${r.TYPE},\n ${r.CATEGORY},\n ${r.SUBCATEGORY},\n ${r.ROWGROUP} as ${r.ROWGROUP},\n ${t} ${e.length>0?",".concat(e):""}\n FROM ${this.fromExpr}\n WHERE ${a}\n GROUP BY ${r.ROWGROUP}, ${r.CATEGORY}, ${r.SUBCATEGORY}\n ORDER BY ${n[1]}`)}));const a=this.db;i.forEach((function(t){s.push(...a.exec(t))})),this.injectDrillRowsToResultRows(s,o)}calculateRelativeVariances(t,e){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[r.TYPE]&&e.forEach(((e,n)=>{t[n]=t[n]/t[e]}))}))}))}calculateColumnGroupRest(t,e){if(null==e||0===e.size)return;const n=new Map,o=new Map;e.forEach(((t,e)=>{const i=t,s=[];for(const t of i)s.push(`${e}##${t.name}`);n.set(e,s),o.set(`${e}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[r.TYPE]&&n.forEach(((e,n)=>{let i=0;e.forEach((e=>{void 0!==t[e]&&(i+=t[e])})),t[`${n}##REST`]=t[n]-i,0!==t[`${n}##REST`]&&o.set(`${n}##REST`,!0)}))}))}));const i=Array.from(o.entries()).filter((([t,e])=>!e)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const e of i)delete t[e]}))}))}createIntervalColumns(t){var e,n,o,i,s;if(this.config.interval===L||this.config.categoryThereOf.size>0||0===this.config.scenarios.length)return;const l="##",c=`(SELECT *, ${P(this.config.interval)} as __interval FROM ${this.fromExpr}) as p`,h=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),u=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),d=this.exctractScenarioNames(h),f=this.getRelativeScenarios(),p=new st(this.config),$=_.OPT===this.config.type||_.OPTNOTOTAL===this.config.type,m=this.config.grouped&&(_.SUM===this.config.type||_.SUMNOTOTAL===this.config.type||_.OPT===this.config.type||_.OPTNOTOTAL===this.config.type),v=this.checkConfigForPartOf()&&this.config.type!==_.LIST,g=t=>{try{return this.db.exec(t)}catch(e){return console.error("DataQuery: interval query failed",t,e),[]}},b=t=>(this.config.scenarios.forEach((e=>{const n=new a(e);!0===n.isValid?0!==t[n.base+"_cnt"]&&0!==t[n.delta+"_cnt"]||(t[e]=Number.NaN):0===t[e+"_cnt"]&&(t[e]=Number.NaN)})),f.forEach(((e,n)=>{t[n]=t[n]/t[e]})),t),R=(t,e,n)=>{for(const o of this.config.scenarios)t[o+l+n]=e[o]},w=g(`SELECT ${p}, __interval ${h.length>0?",".concat(h):""}\n FROM ${c}\n GROUP BY ${p}, __interval`);if(this.config.limit>0)for(let o=0;o<t.length;o++){const i=t[o].find((t=>"ENTRY"===t.type&&"REST"===t.category));if(!i)continue;let s;for(let e=o-1;e>=0&&!s;e--){const n=t[e].filter((t=>"ENTRY"===t.type&&"REST"!==t.category));n.length>0&&(s=n)}if(!s)continue;const r=new Set(s.map((t=>t.category))),a=s[0].rowGroup,l=new Map;for(const t of w){if(this.config.grouped&&t.rowGroup!==a)continue;if(r.has(t.category))continue;const o=k(t.__interval);let i=l.get(o);i||(i={},l.set(o,i));for(const o of d)i[o]=(null!==(e=i[o])&&void 0!==e?e:0)+(null!==(n=t[o])&&void 0!==n?n:0)}l.forEach(((t,e)=>{R(i,b(t),e)}))}for(const e of w){const n=k(e.__interval);b(e);for(const o of t)for(const t of o)"ENTRY"===t.type&&"REST"!==t.category&&t.category===e.category&&(this.config.grouped&&t.rowGroup!==e.rowGroup||$&&t.operation!==e.operation||R(t,e,n))}const S=m||v&&this.config.grouped?g(`SELECT ${r.ROWGROUP}, __interval ${u.length>0?",".concat(u):""}\n FROM ${c}\n GROUP BY ${r.ROWGROUP}, __interval`):[],E=new Map;if(S.forEach((t=>E.set(`${t.rowGroup}${l}${k(t.__interval)}`,t))),m)for(const e of S){const n=k(e.__interval),o=b(Object.assign({},e));for(const i of t)for(const t of i)"GROUP_SUM"===t.type&&t.rowGroup===e.rowGroup&&R(t,o,n)}const y=_.SUM===this.config.type||_.OPT===this.config.type,O=y||v&&!this.config.grouped?g(`SELECT __interval ${u.length>0?",".concat(u):""}\n FROM ${c}\n GROUP BY __interval`):[],M=new Map;if(O.forEach((t=>M.set(k(t.__interval),t))),y)for(const e of O){const n=k(e.__interval),o=b(Object.assign({},e));for(const e of t)for(const t of e)"SUM"===t.type&&R(t,o,n)}if(null!=this.config.thereOf&&this.config.thereOf.length>0){const e=[];this.config.thereOf.forEach((t=>{e.push(...g(`SELECT ${r.ROWGROUP}, ${r.CATEGORY}, ${r.SUBCATEGORY}, __interval ${h.length>0?",".concat(h):""}\n FROM ${c}\n WHERE ${this.createThereOfWhereClause(t)}\n GROUP BY ${r.ROWGROUP}, ${r.CATEGORY}, ${r.SUBCATEGORY}, __interval`))}));for(const n of e){const e=k(n.__interval);b(n);for(const o of t)for(const t of o)"DRILLELEMENT"===t.type&&t.category===n.category&&(t.subCategory!==n.subCategory&&t.subCategory!==`${n.subCategory} (${n.rowGroup})`||R(t,n,e))}}if(v){let e="1 <> 1 ";null===(o=this.config.partOf)||void 0===o||o.forEach((t=>{e+=`OR (${r.CATEGORY} = '${t.category}'`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(e+=`and ${r.ROWGROUP} = '${t.rowGroup}'`),e+=")"}));const n=g(`SELECT ${r.CATEGORY}, ${this.config.grouped?`${r.ROWGROUP}`:`'SUM_TOTAL' as ${r.ROWGROUP}`}, __interval ${h.length>0?",".concat(h):""}\n FROM ${c}\n WHERE ${e}\n GROUP BY ${r.ROWGROUP}, ${r.CATEGORY}, __interval`),a=new Map;for(const t of n){const e=`${t.rowGroup}${l}${t.category}${l}${k(t.__interval)}`,n=a.get(e);if(n)for(const e of d)n[e]=(null!==(i=n[e])&&void 0!==i?i:0)+(null!==(s=t[e])&&void 0!==s?s:0);else a.set(e,t)}a.forEach((e=>{const n=k(e.__interval),o=this.config.grouped?E.get(`${e.rowGroup}${l}${n}`):M.get(n);for(const t of d)e[t]=e[t]/(o?o[t]:Number.NaN);b(e);for(const o of t)for(const t of o)"PARTELEMENT"===t.type&&t.category===e.category&&t.rowGroup===e.rowGroup&&R(t,e,n)}))}}createThereOfWhereClause(t){let e=!0,n="1 <> 1 OR ( ";return null!=t.category&&0!==t.category.length&&t.category.trim()&&(n+=` ${r.CATEGORY} = '${t.category}'`,e=!1),null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(n+=` ${e?"":"AND"} ${r.ROWGROUP} = '${t.rowGroup}'`,e=!1),null!=t.subCategory&&0!==t.subCategory.length&&t.subCategory.trim()&&(n+=` ${e?"":"AND"} ${r.SUBCATEGORY} = '${t.subCategory}'`),n+")"}getRelativeScenarios(){const t=new Map;return this.config.scenarios.forEach((e=>{const n=this.createRelativeScenario(e);null!=n&&t.set(n.key,n.value)})),t}translateScenarioSQL(t,e,n){const o=new a(t);return _.OPT===n||_.OPTNOTOTAL===n?o.isValid?"dr"===o.type?`SUM(${o.base} - ${o.delta}) as ${t}, SUM(${o.delta}) as dr_${o.delta}`:`SUM(${o.base} - ${o.delta}) as ${t}`:e?`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:`SUM(${t}) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:o.isValid?"dr"===o.type?`SUM((${o.base} * transformOperator(operation)) - (${o.delta} * transformOperator(operation))) as ${t}, SUM(${o.delta} * transformOperator(operation)) as dr_${o.delta}`:`SUM((${o.base} * transformOperator(operation))- (${o.delta} * transformOperator(operation))) as ${t}`:`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}translateAttributeSQL(t){const e=`[${t.arg}]`,n=/^(ac|pp|fc|pl)[1-4]$/.test(t.arg)&&this.config.type!==_.OPT&&this.config.type!==_.OPTNOTOTAL;switch(t.fn){case"set":return`SETAGG(${e}) as ${t.alias}`;case"first":return`FIRST(${e}) as ${t.alias}`;case"last":return`LAST(${e}) as ${t.alias}`;case"min":return`MIN(${e}) as ${t.alias}`;case"max":return`MAX(${e}) as ${t.alias}`;case"avg":return n?`AVG(${e} * transformOperator(operation)) as ${t.alias}`:`AVG(${e}) as ${t.alias}`;case"sum":return n?`SUM(${e} * transformOperator(operation)) as ${t.alias}`:`SUM(${e}) as ${t.alias}`;case"lit":return`${this.sqlLiteral(t.arg)} as ${t.alias}`}}sqlLiteral(t){return""===t||Number.isNaN(Number(t))?`'${t.replace(/'/g,"''")}'`:t}createOrderString(t){return[`${t.hierarchy.toString()} ${t.direction}`,`${t.hierarchy.toString()} ${N.ASC===t.direction?N.DESC:N.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 n;const o=[];let i="1 <> 1 ",s=` ${r.ROWGROUP}`,a="ROWNUM()";return null===(n=this.config.partOf)||void 0===n||n.forEach((t=>{i+=`OR (${r.CATEGORY} = '${t.category}'`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(i+=`and ${r.ROWGROUP} = '${t.rowGroup}'`),!1===this.config.grouped&&(s=` 'SUM_TOTAL' as ${r.ROWGROUP} `,a="1"),i+=")"})),o.push(`SELECT ${a} AS ${r.ROWNR},\n 'PARTELEMENT' as ${r.TYPE},\n ${r.CATEGORY},\n ${s},\n ${t}\n FROM ${this.fromExpr}\n WHERE ${i}\n GROUP BY ${r.ROWGROUP}, ${r.CATEGORY}, ${r.TYPE}\n ORDER BY ${e[1]}`),o}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,e){if(null==t||0===t.size)return;const n=[],o=[],i=this.fromExpr;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 ${i}\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 ${i}\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 ${i}\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 ${i}\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 ${i}\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 ${i}\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 ${i}\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 ${i}\n WHERE ${o}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of n)o.push(...this.db.exec(t));this.injectDrillColumnsToResultRows(o,e)}injectDrillColumnsToResultRows(t,e){const n="##";for(const o of t)for(const t of e)for(const e of t)e.type===o.rowlevel&&("ENTRY"===o.rowlevel?"COLUMNGROUP"===o.columnlevel&&e.category===o.category?e[o.scenario+n+o.columnGroup]=o.val:"SUBGROUP"===o.columnlevel&&e.category===o.category&&(e[o.scenario+n+o.columnGroup+n+o.columnSubGroup]=o.val):"DRILLELEMENT"===o.rowlevel?"COLUMNGROUP"===o.columnlevel&&e.category===o.category&&e.subCategory===o.subCategory?e[o.scenario+n+o.columnGroup]=o.val:"SUBGROUP"===o.columnlevel&&e.category===o.category&&e.subCategory===o.subCategory?e[o.scenario+n+o.columnGroup+n+o.columnSubGroup]=o.val:"COLUMNGROUP"===o.columnlevel&&e.category===o.category&&e.subCategory===`${o.subCategory} (${o.rowGroup})`?e[o.scenario+n+o.columnGroup]=o.val:"SUBGROUP"===o.columnlevel&&e.category===o.category&&e.subCategory===`${o.subCategory} (${o.rowGroup})`&&(e[o.scenario+n+o.columnGroup+n+o.columnSubGroup]=o.val):("SUM"===o.rowlevel||"GROUP_SUM"===o.rowlevel)&&("COLUMNGROUP"===o.columnlevel&&e.category===o.category&&e.subCategory===o.subCategory&&(e[o.scenario+n+o.columnGroup]=o.val),"SUBGROUP"===o.columnlevel&&e.category===o.category&&e.subCategory===o.subCategory&&(e[o.scenario+n+o.columnGroup+n+o.columnSubGroup]=o.val)))}}class at{constructor(){this.geometry=new Map}set(t,e,n){let o=this.geometry.get(t);o||(o=new Map,this.geometry.set(t,o)),o.set(e,n)}get(t,e){var n;return null===(n=this.geometry.get(t))||void 0===n?void 0:n.get(e)}}function lt(t,e,n){const o=t[e];if(null==o)return null;const i=Number(o);return isNaN(i)?null:n!==_.OPT&&n!==_.OPTNOTOTAL||t[r.TYPE]!==C.ENTRY||"-"!==t[r.OPERATION]?i:-i}class ct{constructor(){this.normalizedHeader=[],this.attributesByAlias=new Map}createHeader(t,e,n,o,i,r,a=[]){const l=[];this.attributesByAlias=new Map(a.map((t=>[t.alias,t]))),this.normalizedHeader=this.normalizeHeader(t,e,a);const c=this.normalizedHeader.some((t=>void 0!==t.bucket));c&&l.push(this.createIntervalBandRow());const h=new W(c?1:0,0,C.HEADER),u=new W(c?2:1,0,C.SEPERATORLINE);for(const t of this.normalizedHeader){const e=this.attributesByAlias.get(t.name);h.createElement(e?n.get(e.label)||e.label:s.translateScenarioLabel(t.name,n),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,n,o,i,r),null,null,null,null),u.createElement(null,t.type,this.createColumnType(t),null,null,null,null,null,null)}return l.push(h),l.push(u),l}createIntervalBandRow(){const t=new W(0,0,C.HEADER);let e=0;for(;e<this.normalizedHeader.length;){const n=this.normalizedHeader[e];if(void 0===n.bucket){t.createElement(null,n.type,"filler",null,null,null,null,null,null),e+=1;continue}let o=1;for(;e+o<this.normalizedHeader.length&&this.normalizedHeader[e+o].bucket===n.bucket;)o+=1;t.createElement(n.bucketLabel,n.type,"intervalGroup",null,null,null,null,null,null,!1,void 0,o),e+=o}return t}setHeaderPrefix(t,e,n,o,i){let r="";return"category"===t.name&&i&&(0===n.prefix.length&&0===o.length||(r=s.translateScenarioLabel("in",e)+" "+n.prefix+o)),t.order&&(r+=s.translateScenarioLabel("ORDER_"+t.order,e)),r}normalizeHeader(t,e,n){let o=[{name:r.CATEGORY,group:r.CATEGORY,type:r.CATEGORY,order:void 0}];_.OPT!==t&&_.OPTNOTOTAL!==t||(o=[{name:r.OPERATION,group:r.OPERATION,type:r.OPERATION,order:void 0},{name:r.CATEGORY,group:r.CATEGORY,type:r.CATEGORY,order:void 0}]);const i=n.map((t=>({name:t.alias,group:t.alias,type:t.alias,order:void 0})));return[...o,...i,...e]}createBodyRows(t,e,n,o){var i;const s=[];let a=-1;const l=new rt(t,e).execute(n,o),h=this.calculateColumnStatistics(l,t.barColumns,t.interval!==L),u=(null!==(i=t.barColumns)&&void 0!==i?i:[]).filter((t=>t.toUpperCase().trim()in c)),d=u.length>0&&t.interval===L&&0===t.categoryThereOf.size&&function(t){for(const e of t)for(const t of e){const e=t[r.TYPE];if(e===C.SUM||e===C.GROUPSUM||e===C.DRILLELEMENT||e===C.PARTELEMENT)return!0}return!1}(l)?function(t,e,n){const o=new at;for(const i of e){let e,s=0,a=0;const l=[],c=(t,e)=>{l.push(e),o.set(t,i,e)};for(const o of t)for(const t of o){const o=t[r.TYPE];if(o===C.GROUPHEAD){e=void 0;continue}const l=lt(t,i,n);if(o===C.ENTRY){if(null===l){e=void 0;continue}c(t,{start:s,end:s+l,min:0,max:0,kind:"cascade"}),e={start:s,end:s+l},a=e.start,s+=l}else if(o===C.SUM||o===C.GROUPSUM){if(null===l){e=void 0;continue}c(t,{start:0,end:l,min:0,max:0,kind:"anchor"}),e={start:0,end:l},a=0,s=l}else if(o===C.DRILLELEMENT){if(null===l||void 0===e)continue;const n=a+(Math.sign(e.end-e.start)||1)*Math.abs(l);c(t,{start:a,end:n,min:0,max:0,kind:"thereof",parentStart:e.start,parentEnd:e.end}),a=n}else if(o===C.PARTELEMENT){if(null===l||void 0===e)continue;const n=a+l*(e.end-e.start);c(t,{start:a,end:n,min:0,max:0,kind:"partof",parentStart:e.start,parentEnd:e.end}),a=n}}let h=0,u=0;for(const t of l)h=Math.min(h,t.start,t.end),u=Math.max(u,t.start,t.end);for(const t of l)t.min=h,t.max=u}return o}(l,u,t.type):void 0;for(const n of l)a+=1,s.push(...this.createRow(t.i18n,e,t.scenariosUnitType,n,a,-1,t.categoryWidth,t.measureScale,t.barColumns,h,d));return s}calculateColumnStatistics(t,e,n=!1){const o=new Map;if(!e||0===e.length)return o;const i=new Map;for(const t of e)o.set(t,{min:1/0,max:-1/0,absMax:0,median:0}),i.set(t,[]);for(const s of t)for(const t of s)for(const s of e){const e=n?this.extractIntervalColumnValues(t,s):[this.extractColumnValue(t,s)];for(const t of e)if(null!==t&&!isNaN(t)){const e=o.get(s);e.min=Math.min(e.min,t),e.max=Math.max(e.max,t),i.get(s).push(Math.abs(t))}}for(const[t,e]of o){e.min!==1/0&&e.max!==-1/0||(e.min=0,e.max=0),e.absMax=Math.max(Math.abs(e.min),Math.abs(e.max));const n=i.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}extractIntervalColumnValues(t,e){const n=e+"##",o=[];for(const e of Object.keys(t))if(e.startsWith(n)){const n=Number(t[e]);o.push(isNaN(n)?null:n)}return o}extractColumnValue(t,e){if(void 0!==t[e]){const n=Number(t[e]);return isNaN(n)?null:n}for(const n of Object.keys(t))if(n===e||n.endsWith("##"+e)||n===e+"##"+e){const e=Number(t[n]);if(!isNaN(e))return e}return null}createRow(t,e,n,o,i,s,a,l,c,h,u){var d;const f=[];for(const p of o){const $=p[r.ROWGROUP],m=p[r.SUBCATEGORY],v=p[r.TYPE],g=p[r.ROWNR]>=2,b=this.createDetailRow(v,s+=1,i,o.length);for(const o of this.normalizedHeader){const i=this.getRawDataRowElement(p,o),s=null!==(d=null==c?void 0:c.includes(o.type))&&void 0!==d&&d,r=s?null==h?void 0:h.get(o.type):void 0,f=s&&void 0===o.bucket&&o.name===o.group&&o.name===o.type?null==u?void 0:u.get(p,o.type):void 0;b.createElement(this.translateSumCellLabel(t,e,i,$,m,v,o.type),o.type,this.createColumnType(o),this.setCellType(o.type,n),this.translateCellPrefix(e,v,o.type),this.translateScenarioCSS(o.type,i),g,a,null==l?void 0:l.value,s,r,1,f)}f.push(b)}return f}getRawDataRowElement(t,e){return void 0!==e.bucket?t[e.type+"##"+e.bucket]:e.name===e.group&&e.name===e.type?t[e.name]:e.name===e.group&&e.name!==e.type?t[e.type+"##"+e.name]:t[e.type+"##"+e.group+"##"+e.name]}createDetailRow(t,e,n,o){switch(t){case C.GROUPHEAD:return new W(e,n,C.HEADER);case C.SUM:case C.GROUPSUM:return new W(o+2,n,C.SUM);case C.DRILLELEMENT:return new W(o+2,n,C.DRILLELEMENT);case C.PARTELEMENT:return new W(o+2,n,C.PARTELEMENT);default:return new W(e,n,C.STANDARD)}}translateSumCellLabel(t,e,n,o,i,s,r){return this.attributesByAlias.has(r)||!1===Number.isNaN(Number(n))||this.isOperationColumn(r)?n:this.isGroupHeadCategory(s,r)?t===h.ALL?`${e.get(n)||n}`:n:this.isEntryCategory(s,r)?t===h.ALL||"REST"===n?`${e.get(n)||n}`:n:this.isDrillElementCategory(s,r)?t===h.ALL?`${e.get(i)||i}`:`${i}`:this.isPartElementCategory(s,r)?t===h.ALL||"SUM_TOTAL"===o?`${e.get(o)||o}`:`${o}`:this.isSumElementCategory(s,r)?t===h.ALL||"SUM_TOTAL"===o?`${e.get(o)||o}`:o:"GROUPHEAD"===s&&null==n?n:Number.isNaN(Number(n))?"-":Number(n)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,e){if(this.attributesByAlias.has(t))return"attribute";const n=new a(t);let o="pos";return e<0&&(o="neg"),n.isValid?o+"_"+n.direction+("dr"===n.type?" relative_variance":""):t}setCellType(t,e){if("category"===t)return"";const n=this.attributesByAlias.get(t);if(n)return n.isNumeric?"decimal":"";let o;const i=new a(t);return e===u.PERCENT?(o="percent",i.isValid&&"d"===i.type&&(o="decimal")):(o="decimal",i.isValid&&"dr"===i.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,n){return this.isOperationColumn(n)||this.isGroupHeadCategory(e,n)||this.isEntryCategory(e,n)?null:this.isDrillElementCategory(e,n)?`${t.get("there_of")} `:this.isPartElementCategory(e,n)?`${t.get("part_of")} `:null}createColumnType(t){return t.name===t.group&&t.name===t.type?"base":t.name===t.group?"columnGroup":"columnSubGroup"}}class ht{constructor(t,e,n,o){this.fromExpr="",this.rowCount=0,this.headerRows=[],this.bodyRows=[],this.intervalBuckets=[],this.ruleSet=t||new l,this.db=e,this.dataSetFactory=new ct,this.config=this.initConfig(o),this.i18n=this.initI18n(new Map),this.setSource(n,o.filter),this.state=G.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"],["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=G.DIRTY,new Map([...e,...t||new Map])}initConfig(t){this.state=G.DIRTY;const e=t,n=this;return t.scenarios.sort(((t,e)=>n.ruleSet.getScenarioSorIndex(t)-n.ruleSet.getScenarioSorIndex(e))),e}setConfig(t){this.config=this.initConfig(t)}setSource(t,e){var n,o;if(!t)return this.fromExpr="",void(this.rowCount=0);this.fromExpr=g(t,e);try{const t=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(o=null===(n=t[0])||void 0===n?void 0:n.cnt)&&void 0!==o?o:0}catch(t){this.rowCount=0}this.prepareIntervalBuckets();const i=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder,this.intervalBuckets);this.headerRows=this.dataSetFactory.createHeader(this.config.type,i,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale,this.config.attributes),this.bodyRows=0===this.rowCount?[]:this.dataSetFactory.createBodyRows(this.config,this.i18n,this.db,this.fromExpr),this.state=G.UP_TO_DATE}update(){this.prepareIntervalBuckets();const t=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder,this.intervalBuckets);this.headerRows=this.dataSetFactory.createHeader(this.config.type,t,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale,this.config.attributes),this.bodyRows=0!==this.rowCount&&this.fromExpr?this.dataSetFactory.createBodyRows(this.config,this.i18n,this.db,this.fromExpr):[],this.state=G.UP_TO_DATE}getHeader(){return this.state===G.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===G.DIRTY&&this.update(),this.bodyRows}prepareIntervalBuckets(){this.intervalBuckets=[],this.config.interval===L||!this.fromExpr||this.config.categoryThereOf.size>0?this.config.interval=L:(this.config.interval=function(t,e,n){var o;if(n!==m.AUTO)return n;let i,s,r;try{i=t.exec(`SELECT [date] as d FROM ${e}`)}catch(t){return console.error("IntervalColumns: date query failed",t),m.DAY}for(const t of i){const e=null===(o=A(t.d))||void 0===o?void 0:o.toMillis();void 0!==e&&(s=void 0===s?e:Math.min(s,e),r=void 0===r?e:Math.max(r,e))}return void 0===s||void 0===r?m.DAY:(new v).calculateDistanceType($.fromMillis(s),$.fromMillis(r))}(this.db,this.fromExpr,this.config.interval),this.intervalBuckets=function(t,e,n,o){let i;try{i=t.exec(`SELECT ${P(n)} as __interval FROM ${e}`)}catch(t){return console.error("IntervalColumns: bucket query failed",t),[]}if(n===x){const t=new Set,e=[];for(const n of i){const o=k(n.__interval);t.has(o)||(t.add(o),e.push({key:o,label:0===o.length?"—":o}))}return e}const s=new Set,r=[];for(const t of i){const e=A(t.__interval);if(!e)continue;const n=e.toISO();s.has(n)||(s.add(n),r.push(e))}r.sort(((t,e)=>t.toMillis()-e.toMillis()));const a=new v;return a.setLocale(o),r.map((t=>({key:t.toISO(),label:a.getDateString(t,n)})))}(this.db,this.fromExpr,this.config.interval,this.config.locale),0===this.intervalBuckets.length&&(this.config.interval=L))}normalizeScenarios(t,e,n,o=[]){var i,s;const r=[];if(o.length>0){for(const e of o)for(const o of t)r.push({name:o,group:o,type:o,order:(null===(i=null==n?void 0:n.hierarchy)||void 0===i?void 0:i.at(0))===o?n.direction:void 0,bucket:e.key,bucketLabel:e.label});return r}for(const o of t){if(null==e?void 0:e.has(o)){const t=e.get(o);for(const e of t){r.push({name:e.name,group:e.name,type:o,order:void 0});for(const t of e.subGroups)r.push({name:t,group:e.name,type:o,order:void 0})}r.push({name:"REST",group:"REST",type:o,order:void 0})}let t;(null===(s=null==n?void 0:n.hierarchy)||void 0===s?void 0:s.at(0))===o&&(t=n.direction),r.push({name:o,group:o,type:o,order:t})}return r}hasNoData(){return 0===this.rowCount}}class ut{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=u.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.attributes=[],this.sortOrder=new y(new O).default(),this.type=_.LIST,this.limit=0,this.i18n=h.ALL,this.categoryWidth=f.W25,this.measureScale=new M,this.measureUnit="",this.measureType=p.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[],this.interval="none",this.locale="de"}}class dt{constructor(t,e,n,o,i){this.tableDrillGroupAdapter=t,this.stringAdapter=e,this.orderAdapter=n,this.db=o,this.fromExpr=i}adapt(t){const e=new ut;return d.isString(t.title)&&(e.title=t.title),d.isArray(t.scenarios)&&(e.scenarios=E.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=E.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),d.isExisting(t.categoryThereOf)&&(e.categoryThereOf=t.categoryThereOf),d.isArray(t.partOf)&&(e.partOf=E.adaptArray(t.partOf,this.tableDrillGroupAdapter)),d.isArray(t.attributes)&&(e.attributes=t.attributes),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=R.calculateMeasureScale(this.db,this.fromExpr,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),d.isString(t.interval)&&(e.interval=t.interval),d.isString(t.locale)&&(e.locale=t.locale),e}default(){return new ut}}class ft{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class pt{constructor(){}adapt(t){const e=new ft;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 ft}}const $t=e(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.sumTitle="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:N.ASC},this.categorythereof=new Map,this.attributeColumns=[],this.type=_.LIST,this.categoryWidth=f.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=h.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=p.VOLUME,this.filter="",this.barColumns=[],this.interval="none",this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new w,this.componentStyle=U(this)}render(){return t(o,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(((n,o,i)=>t("span",null,o===i.length-1?t("span",{class:" "===n?"table-footer":""},n,e.drawPrefix()," "):t("span",null,n,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((n=>t("td",{colSpan:n.colSpan,class:n.type?`${n.cssStyle} ${n.type}`:n.cssStyle},null!=n.prefix?t("span",{class:n.cssStyle+" "+n.prefixStyle},n.drawPrefix()):"",n.isBarChart&&n.columnStats&&(void 0!==n.waterfall||e.type!==C.SUM)?void 0!==n.waterfall?t(it,{value:n.value,scenario:n.key,columnStats:n.columnStats,height:18*this.scaleFactor,isRelative:!1,isPositiveGood:n.key.endsWith("_pos"),measureScale:n.measureScale,columnWidthEm:this.barColumnMaxWidth,styles:this.barChartStyles,waterfall:n.waterfall}):t(ot,{value:n.value,scenario:n.key,columnStats:n.columnStats,height:18*this.scaleFactor,isRelative:n.key.startsWith("dr"),isPositiveGood:n.key.endsWith("_pos"),measureScale:n.measureScale,columnWidthEm:this.barColumnMaxWidth,styles:this.barChartStyles}):n.draw(this.componentDataFormatDigits)))))))))}})())}componentWillRender(){this.stores||(this.stores=b(this.element));const t=this.stores.db.db,e=this.prepareConfig(t);this.componentDataFormatDigits=(new S).adapt(this.dataFormatDigits),this.table=new ht(new l(this.ruleSetConfig),t,this.tableName,e),this.table.setI18n(this.i18n),this.barChartStyles=this.prepareBarChartStyles()}prepareConfig(t){var e,n,o;const i=this.tableName?this.filter&&this.filter.length>0?`(SELECT * FROM \`${this.tableName}\` WHERE ${this.filter}) AS __src`:`\`${this.tableName}\``:"";return new dt(new pt,new O,new y(new O),t,i).adapt({title:this.sumTitle,scenarios:this.scenarios,scenariosUnitType:this.scenariosDataFormat,grouped:this.grouped,showGroupTitle:this.showGroupTitle,thereOf:this.thereof,partOf:this.partof,categoryThereOf:this.categorythereof,attributes:this.attributeColumns,order:this.order,type:this.type,limit:this.limit,i18n:this.i18nMode,categoryWidth:this.categoryWidth,measureScale:this.measureScale,measureUnit:this.measureUnit,measureType:this.measureType,showMeasureScale:this.showMeasureScale,filter:this.filter,barColumns:this.barColumns,interval:this.interval,locale:(null===(o=null===(n=null===(e=this.stores)||void 0===e?void 0:e.context)||void 0===n?void 0:n.state)||void 0===o?void 0:o.locale)||"de"})}prepareBarChartStyles(){var t;const e=!(this.unitScaling>0),n=!(this.percentageScaling>0),o=e?this.autoUnitScaling():this.unitScaling,i=n?this.autoPercentageScaling():this.percentageScaling;return(e||n)&&(null===(t=this.reportAutoScaling)||void 0===t||t.call(this,{unit:e?o:void 0,percentage:n?i:void 0})),this.componentStyle((t=>{var e,n,s,r,a,l,c,h,u,d,f,p,$,m,v,g,b,R,w,S,E,y,O,M,U,T,G;const _=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.varianceStyles,N=null===(n=t["bn-chart-time"])||void 0===n?void 0:n.barStyles;return{positive:{stroke:(null===(s=null==_?void 0:_.pos)||void 0===s?void 0:s.stroke)||"#008f96",fill:(null===(r=null==_?void 0:_.pos)||void 0===r?void 0:r.fill)||"#008f96",fillpattern:(null===(a=null==_?void 0:_.pos)||void 0===a?void 0:a.fillpattern)||"solid"},negative:{stroke:(null===(l=null==_?void 0:_.neg)||void 0===l?void 0:l.stroke)||"#ff0000",fill:(null===(c=null==_?void 0:_.neg)||void 0===c?void 0:c.fill)||"#ff0000",fillpattern:(null===(h=null==_?void 0:_.neg)||void 0===h?void 0:h.fillpattern)||"solid"},neutral:{stroke:(null===(u=null==_?void 0:_.neu)||void 0===u?void 0:u.stroke)||"#808080",fill:(null===(d=null==_?void 0:_.neu)||void 0===d?void 0:d.fill)||"#808080",fillpattern:(null===(f=null==_?void 0:_.neu)||void 0===f?void 0:f.fillpattern)||"outlined"},scenarios:{ac:{stroke:(null===(p=null==N?void 0:N.ac)||void 0===p?void 0:p.stroke)||"#404040",fill:(null===($=null==N?void 0:N.ac)||void 0===$?void 0:$.fill)||"#404040",fillpattern:(null===(m=null==N?void 0:N.ac)||void 0===m?void 0:m.fillpattern)||"solid"},pp:{stroke:(null===(v=null==N?void 0:N.pp)||void 0===v?void 0:v.stroke)||"#A6A6A6",fill:(null===(g=null==N?void 0:N.pp)||void 0===g?void 0:g.fill)||"#A6A6A6",fillpattern:(null===(b=null==N?void 0:N.pp)||void 0===b?void 0:b.fillpattern)||"solid"},fc:{stroke:(null===(R=null==N?void 0:N.fc)||void 0===R?void 0:R.stroke)||"#404040",fill:(null===(w=null==N?void 0:N.fc)||void 0===w?void 0:w.fill)||"#ffffff",fillpattern:(null===(S=null==N?void 0:N.fc)||void 0===S?void 0:S.fillpattern)||"hatched"},pl:{stroke:(null===(E=null==N?void 0:N.pl)||void 0===E?void 0:E.stroke)||"#404040",fill:(null===(y=null==N?void 0:N.pl)||void 0===y?void 0:y.fill)||"#ffffff",fillpattern:(null===(O=null==N?void 0:N.pl)||void 0===O?void 0:O.fillpattern)||"outlined"}},fontColor:(null===(M=t.global)||void 0===M?void 0:M.fontColor)||"#000000",fontSize:((null===(U=t.global)||void 0===U?void 0:U.fontSizePx)||13.3333)*B*this.scaleFactor,emPx:((null===(T=t.global)||void 0===T?void 0:T.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:(null===(G=t.global)||void 0===G?void 0:G.fontFamily)||"'Noto Sans', sans-serif",unitScaling:o,percentageScaling:i,scaleFactor:this.scaleFactor}}))}emPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.scaleFactor}autoUnitScaling(){const t=this.emPx(),e=t*B,{absMax:n,hasNeg:o,hasPos:i}=this.getAbsBarColumnStats();if(n<=0||e<=0)return.01;const{maxBarWidth:s,cutWidth:r}=H(this.barColumnMaxWidth,t,o,i);return Math.min(.8*s,r)/(n*e)}autoPercentageScaling(){const t=this.emPx(),e=t*B,{absMax:n,hasNeg:o,hasPos:i}=this.getRelativeBarColumnStats();if(n<=0||e<=0)return.5;const{maxPinLength:s}=I(this.barColumnMaxWidth,t,o,i);return.8*s/(n*e)}getAbsBarColumnStats(){return this.collectBarColumnStats((t=>!t.key.startsWith("dr")&&!t.waterfall),1)}getRelativeBarColumnStats(){return this.collectBarColumnStats((t=>t.key.startsWith("dr")),100)}collectBarColumnStats(t,e){const n={absMax:0,hasNeg:!1,hasPos:!1};if(!this.table)return n;for(const o of this.table.getBody())if(o.type!==C.SUM)for(const i of o.getCells())i.isBarChart&&i.columnStats&&t(i)&&(n.absMax=Math.max(n.absMax,i.columnStats.absMax*e),n.hasNeg=n.hasNeg||i.columnStats.min<0,n.hasPos=n.hasPos||i.columnStats.max>0);return n}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}th.intervalGroup{border-bottom:0.1em solid black;text-align:center;font-weight:bold}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em dashed #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}'}},[1,"ibcs-table",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],selectedStyle:[513,"selected-style"],sumTitle:[1,"sum-title"],scenarios:[16],scenariosDataFormat:[1,"scenarios-data-format"],grouped:[4],limit:[2],showGroupTitle:[4,"show-group-title"],thereof:[16],partof:[16],order:[16],categorythereof:[16],attributeColumns:[16],type:[1],categoryWidth:[1,"category-width"],dataFormatDigits:[16],ruleSetConfig:[16],i18n:[1040],i18nMode:[1,"i18n-mode"],measureScale:[1,"measure-scale"],measureUnit:[1,"measure-unit"],showMeasureScale:[4,"show-measure-scale"],measureType:[1,"measure-type"],filter:[1],barColumns:[16],interval:[1],barColumnMaxWidth:[2,"bar-column-max-width"],unitScaling:[2,"unit-scaling"],percentageScaling:[2,"percentage-scaling"],reportAutoScaling:[16],scaleFactor:[2,"scale-factor"]}]);function mt(){"undefined"!=typeof customElements&&["ibcs-table"].forEach((t=>{"ibcs-table"===t&&(customElements.get(i(t))||customElements.define(i(t),$t))}))}export{$t as I,_ as T,L as a,x as b,mt as d}
@@ -0,0 +1 @@
1
+ function n(n){if(null==n||""===n)return{mode:"empty"};if("none"===n)return{mode:"none"};if("auto"===n)return{mode:"auto"};const e=Number(n);return!isNaN(e)&&e>0?{mode:"factor",factor:e}:{mode:"empty"}}const e={k:1e3,K:1e3,M:1e6,G:1e9,T:1e12},r=/^(\d+(?:\.\d+)?|\.\d+)\s*([kKMGT])?$/;function t(n){var t;if("number"==typeof n)return Number.isFinite(n)&&n>0?{kind:"number",value:n}:{kind:"invalid",raw:String(n)};const u=null!==(t=null==n?void 0:n.toString().trim())&&void 0!==t?t:"";if("auto"===u.toLowerCase())return{kind:"auto"};const i=r.exec(u);if(i){const n=Number(i[1])*(i[2]?e[i[2]]:1);if(Number.isFinite(n)&&n>0)return{kind:"number",value:n}}return{kind:"invalid",raw:u}}function u(n,e){const r=t(n);if("auto"===r.kind)return{kind:"auto"};if("string"==typeof n){const r=n.trim();if(e.has(r))return{kind:"value",value:e.get(r)}}return"number"===r.kind?{kind:"value",value:r.value}:{kind:"invalid",raw:r.raw}}const i=[[1e12,"T"],[1e9,"G"],[1e6,"M"],[1e3,"k"]];function o(n){if(!Number.isFinite(n)||n<=0)return String(n);const e=n=>String(Number(n.toPrecision(3)));for(const[r,t]of i)if(n>=r)return`${e(n/r)}${t}`;return e(n)}export{t as a,o as f,n as p,u as r}
@@ -1 +1 @@
1
- import{S as n,a as t,A as r,b as e,T as u,D as i,c as o,M as s,d as a}from"./CompareUtil.js";import{a as c,D as l}from"./DateStringFactory.js";import{a as f,O as d}from"./Order.js";import{r as v}from"./VarianceMeasure.js";const m=/^\s*(set|first|last|min|max|avg|sum|lit)\(\s*(.*?)\s*\)\s*$/,S=/^[A-Za-z_][A-Za-z0-9_]*$/,y=["min","max","avg","sum"];class N{constructor(n,t,r,e){this.label=n,this.alias=t,this.fn=r,this.arg=e}get isNumeric(){return y.includes(this.fn)}}function O(n){if("string"!=typeof n)return!1;const t=m.exec(n);if(!t)return!1;const[,r,e]=t;return"lit"===r?e.length>0:S.test(e)}function b(n,t,r){if(!O(r))return null;const[,e,u]=m.exec(r);return new N(n,t,e,u)}function J(n){return null==n||""===n||"null"===n}function p(t){return J(t)||"auto"===t.trim().toLowerCase()?[]:h((null==t?void 0:t.split(",").filter((t=>!(t.toUpperCase().trim()in n)))).toString())}function h(r){return J(r)?[]:r.replace(";",",").split(",").filter((r=>{var e,u,i;const o=r.split("_"),s=null===(e=o[0])||void 0===e?void 0:e.replace(/^dr|^d/,"").toUpperCase().trim(),a=null===(u=o[1])||void 0===u?void 0:u.toUpperCase().trim(),c=null===(i=o[2])||void 0===i?void 0:i.toUpperCase().trim();return 3!==o.length||!(s in n)||!(a in n)||!(c in t)}))}function A(t){return J(t)?[]:h(t.split(",").filter((t=>!(t.toUpperCase().trim()in n))).toString())}function g(n){return J(n)||"auto"===n.trim().toLowerCase()?[]:h(n.split(",").filter((n=>!(n.toUpperCase()in f))).toString())}function j(n){return!J(n)&&Number.isInteger(Number(n))}function k(n){return!J(n)&&!Number.isNaN(Number(n))}function T(n){return!J(n)&&(null==n?void 0:n.toUpperCase())in d}function $(n){return"auto"===(null==n?void 0:n.toLowerCase())||(null==n?void 0:n.toUpperCase())in r}function G(n){if(J(n))return[];try{const t=JSON.parse(n);if(t instanceof Array)return t.filter((n=>!(n.hasOwnProperty("name")&&n.hasOwnProperty("unit"))))}catch(n){console.error("validateMeasureList: failed to parse JSON",n)}return["Invalid JSON structure"]}function I(n){const t=Date.parse(n);return Number.isInteger(t)}function w(n){return(null==n?void 0:n.toUpperCase())in l}function x(n){return(null==n?void 0:n.toUpperCase())in c}function z(n){return(null==n?void 0:n.toUpperCase())in e}function D(n){return!J(n)&&(null==n?void 0:n.toUpperCase())in i}function E(n){return!J(n)&&["true","false",!0,!1].some((t=>t===n))}function M(n){return!J(n)&&(null==n?void 0:n.toUpperCase())in o}function _(n){if(J(n))return[];try{const t=JSON.parse(n);if(t instanceof Array)return t.filter((n=>!(n.hasOwnProperty("rowGroup")&&n.hasOwnProperty("category")&&n.hasOwnProperty("subCategory"))))}catch(n){console.error("validateThereOfJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function C(n){if(J(n))return[];try{const t=JSON.parse(n);if(null!==t&&"object"==typeof t&&!(t instanceof Array))return Object.entries(t).filter((([,n])=>"string"!=typeof n||!O(n))).map((([n,t])=>`${n}: ${t}`))}catch(n){console.error("validateAttributesJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function P(n){if(J(n))return[];try{const t=JSON.parse(n);if(t instanceof Array)return t.filter((n=>!(n.hasOwnProperty("rowGroup")&&n.hasOwnProperty("category"))))}catch(n){console.error("validatePartOfJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function Z(n){return(null==n?void 0:n.trim().toUpperCase())in s}function q(n){return["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(null==n?void 0:n.trim())||["GREATEST","LEAST"].includes(null==n?void 0:n.trim().toUpperCase())}function L(n){return(null==n?void 0:n.toUpperCase().trim())in a}function B(n){return(null==n?void 0:n.toUpperCase().trim())in u}function F(n){if(J(n))return[];try{return JSON.parse(n).filter((n=>!(n.hasOwnProperty("scenario")&&n.hasOwnProperty("name")&&n.hasOwnProperty("subGroups"))))}catch(n){console.error("validateColumnThereOfJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function R(n){if(J(n))return[];try{const t=JSON.parse(n);if("object"!=typeof t||null===t||Array.isArray(t))return["stack: must be a JSON object"];const r=[];if(t.hasOwnProperty("by")){const n=["scenarios","dimensions"];n.includes(t.by)||r.push(`stack: 'by' must be one of: ${n.join(", ")}`)}else r.push("stack: 'by' is required");if(t.hasOwnProperty("mode")){const n=["absolute","relative","absolute-relative"];n.includes(t.mode)||r.push(`stack: 'mode' must be one of: ${n.join(", ")}`)}if(t.hasOwnProperty("order")){const n=["asc","desc","dataset"];n.includes(t.order)||r.push(`stack: 'order' must be one of: ${n.join(", ")}`)}return r}catch(n){return["stack: invalid JSON"]}}function U(n){return!J(n)&&null!==v(n)}export{C as A,b as B,h as a,g as b,T as c,G as d,I as e,x as f,w as g,j as h,J as i,U as j,k,$ as l,E as m,q as n,R as o,z as p,A as q,B as r,D as s,M as t,_ as u,p as v,P as w,Z as x,L as y,F as z}
1
+ import{S as n,a as t,A as r,b as e,T as u,D as i,c as o,M as s,d as a}from"./CompareUtil.js";import{a as c,D as l}from"./DateStringFactory.js";import{a as f,O as d}from"./Order.js";import{r as v}from"./VarianceMeasure.js";const m=/^\s*(set|first|last|min|max|avg|sum|lit)\(\s*(.*?)\s*\)\s*$/,S=/^[A-Za-z_][A-Za-z0-9_]*$/,y=["min","max","avg","sum"];class N{constructor(n,t,r,e){this.label=n,this.alias=t,this.fn=r,this.arg=e}get isNumeric(){return y.includes(this.fn)}}function O(n){if("string"!=typeof n)return!1;const t=m.exec(n);if(!t)return!1;const[,r,e]=t;return"lit"===r?e.length>0:S.test(e)}function b(n,t,r){if(!O(r))return null;const[,e,u]=m.exec(r);return new N(n,t,e,u)}function J(n){return null==n||""===n||"null"===n}function p(t){return J(t)||"auto"===t.trim().toLowerCase()?[]:h((null==t?void 0:t.split(",").filter((t=>!(t.toUpperCase().trim()in n)))).toString())}function h(r){return J(r)?[]:r.replace(";",",").split(",").filter((r=>{var e,u,i;const o=r.split("_"),s=null===(e=o[0])||void 0===e?void 0:e.replace(/^dr|^d/,"").toUpperCase().trim(),a=null===(u=o[1])||void 0===u?void 0:u.toUpperCase().trim(),c=null===(i=o[2])||void 0===i?void 0:i.toUpperCase().trim();return 3!==o.length||!(s in n)||!(a in n)||!(c in t)}))}function A(t){return J(t)?[]:h(t.split(",").filter((t=>!(t.toUpperCase().trim()in n))).toString())}function g(n){return J(n)||"auto"===n.trim().toLowerCase()?[]:h(n.split(",").filter((n=>!(n.toUpperCase()in f))).toString())}function j(n){return!J(n)&&Number.isInteger(Number(n))}function k(n){return!J(n)&&!Number.isNaN(Number(n))}function T(n){return!J(n)&&(null==n?void 0:n.toUpperCase())in d}function $(n){return"auto"===(null==n?void 0:n.toLowerCase())||(null==n?void 0:n.toUpperCase())in r}function G(n){if(J(n))return[];try{const t=JSON.parse(n);if(t instanceof Array)return t.filter((n=>!(n.hasOwnProperty("name")&&n.hasOwnProperty("unit"))))}catch(n){console.error("validateMeasureList: failed to parse JSON",n)}return["Invalid JSON structure"]}function I(n){const t=Date.parse(n);return Number.isInteger(t)}function w(n){return(null==n?void 0:n.toUpperCase())in l}function x(n){return(null==n?void 0:n.toUpperCase())in c}function z(n){return(null==n?void 0:n.toUpperCase())in e}function D(n){return!J(n)&&(null==n?void 0:n.toUpperCase())in i}function E(n){return!J(n)&&["true","false",!0,!1].some((t=>t===n))}function M(n){return!J(n)&&(null==n?void 0:n.toUpperCase())in o}function _(n){if(J(n))return[];try{const t=JSON.parse(n);if(t instanceof Array)return t.filter((n=>!(n.hasOwnProperty("rowGroup")&&n.hasOwnProperty("category")&&n.hasOwnProperty("subCategory"))))}catch(n){console.error("validateThereOfJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function C(n){if(J(n))return[];try{const t=JSON.parse(n);if(null!==t&&"object"==typeof t&&!(t instanceof Array))return Object.entries(t).filter((([,n])=>"string"!=typeof n||!O(n))).map((([n,t])=>`${n}: ${t}`))}catch(n){console.error("validateAttributesJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function Z(n){if(J(n))return[];try{const t=JSON.parse(n);if(t instanceof Array)return t.filter((n=>!(n.hasOwnProperty("rowGroup")&&n.hasOwnProperty("category"))))}catch(n){console.error("validatePartOfJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function q(n){return(null==n?void 0:n.trim().toUpperCase())in s}function L(n){return["_","k","M","G","T","P","E","Z","Y","m","my","μ","n","p","f","a","z","y"].includes(null==n?void 0:n.trim())||["GREATEST","LEAST"].includes(null==n?void 0:n.trim().toUpperCase())}function P(n){return(null==n?void 0:n.toUpperCase().trim())in a}function B(n){return(null==n?void 0:n.toUpperCase().trim())in u}function F(n){if(J(n))return[];try{return JSON.parse(n).filter((n=>!(n.hasOwnProperty("scenario")&&n.hasOwnProperty("name")&&n.hasOwnProperty("subGroups"))))}catch(n){console.error("validateColumnThereOfJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function R(n){if(J(n))return[];try{const t=JSON.parse(n);if("object"!=typeof t||null===t||Array.isArray(t))return["stack: must be a JSON object"];const r=[];if(t.hasOwnProperty("by")){const n=["scenarios","dimensions"];n.includes(t.by)||r.push(`stack: 'by' must be one of: ${n.join(", ")}`)}else r.push("stack: 'by' is required");if(t.hasOwnProperty("mode")){const n=["absolute","relative","absolute-relative"];n.includes(t.mode)||r.push(`stack: 'mode' must be one of: ${n.join(", ")}`)}if(t.hasOwnProperty("order")){const n=["asc","desc","dataset"];n.includes(t.order)||r.push(`stack: 'order' must be one of: ${n.join(", ")}`)}return r}catch(n){return["stack: invalid JSON"]}}function U(n){return!J(n)&&null!==v(n)}export{C as A,b as B,h as a,g as b,T as c,G as d,I as e,x as f,w as g,j as h,J as i,U as j,$ as k,E as l,L as m,R as n,k as o,z as p,A as q,B as r,D as s,M as t,_ as u,p as v,Z as w,q as x,P as y,F as z}
@@ -1 +1 @@
1
- import{g as t,c as e}from"./context-protocol.js";import{r as n}from"./utils.js";import{getElement as o}from"@stencil/core/internal/client";function a(t,e=!1){const n=r(t);if(!n)return e&&console.log("[parentDims] no layout parent found for",t.tagName),{width:0,height:0};const o=getComputedStyle(n),a=n.clientWidth-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight),i=function(t,e=!1){let n=r(t),o=0,a=null,i=1;for(;n;){if(n.hasAttribute("data-bn-fit-content")){e&&console.log(`[height:${o}]`,n.tagName,"fit-content region → discarding inner candidate"),a=null;const t=parseInt(n.getAttribute("data-bn-fit-content"),10);!isNaN(t)&&t>1&&(i*=t),n=s(n),o++;continue}const t=getComputedStyle(n),r=t.overflowY;if(e&&console.log(`[height:${o}]`,n.tagName,n.className||"(no class)",`overflow=${r} clientH=${n.clientHeight} h=${t.height}`),null===a)if("hidden"===r||"scroll"===r||"auto"===r)a=n.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom),e&&console.log(`[height] candidate at depth ${o}: ${Math.round(a)}px`);else if("none"!==t.maxHeight){const e=parseFloat(t.maxHeight);!isNaN(e)&&e>0&&(a=Math.min(e,n.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)))}n=s(n),o++}return null!==a?a/i:(e&&console.log("[height] NO constrained ancestor → viewport fallback"),"undefined"!=typeof window?window.innerHeight/i:0)}(t,e);return e&&console.log("[parentDims]",t.tagName,"→ layoutParent:",n.tagName,n.className||"(no class)",`clientW=${n.clientWidth} → w=${Math.round(a)}, h=${Math.round(i)}`,"overflow:",o.overflow),{width:Math.max(0,a),height:Math.max(0,i)}}function r(t){var e;const n=t.parentElement;return(null===(e=null==n?void 0:n.assignedSlot)||void 0===e?void 0:e.parentElement)?n.assignedSlot.parentElement:n}function s(t){var e;if(null===(e=t.assignedSlot)||void 0===e?void 0:e.parentElement)return t.assignedSlot.parentElement;if(t.parentElement)return t.parentElement;const n=t.getRootNode();return n instanceof ShadowRoot?n.host:null}function i(t){if(null==t||""===t)return{mode:"empty"};if("none"===t)return{mode:"none"};if("auto"===t)return{mode:"auto"};const e=Number(t);return!isNaN(e)&&e>0?{mode:"factor",factor:e}:{mode:"empty"}}const c=(t,e)=>{const n=[],o=[];for(const a of e)(t(a)?n:o).push(a);return[n,o]},l="WARN_use_dataset",u=(t,e)=>{const n=t.errors;if(n)if(e.length>0){const t=e.map((t=>t.substring(1))).join(", ");n.addOrReplace({id:l,type:"warning",message:`Using datasource(s) "${t}" directly. Prefer using a dataset (bn-dataset) for query support and metadata.`})}else n.remove(l)},d=(a,r,s)=>{let i,l,d=[],f=[],p=[];const h=(t,e)=>{const n=e?t.substring(1):t;let o;try{o=l.db.db.exec(`SELECT * FROM \`${n}\``)}catch(t){o=[]}r(t,o)},m=()=>{d.forEach((t=>t())),d=[],f.forEach((t=>{t&&(d.push(l.db.subscribe(t,(()=>h(t,!1)))),h(t,!1),(t=>{if(s){const e=l.datasetsMeta.get(t);e&&s(t,e)}})(t))})),p.forEach((t=>{t&&(d.push(l.db.subscribe(t.substring(1),(()=>h(t,!0)))),h(t,!0))}))},g=new MutationObserver((t=>{t.forEach((t=>{"datasets"===t.attributeName&&([p,f]=c((t=>t.startsWith("$")),o(a).getAttribute("datasets").split(",")),u(a,p),m())}))})),w=a.connectedCallback;a.connectedCallback=()=>{const e=o(a);l=t(e),[p,f]=c((t=>t.startsWith("$")),(e.getAttribute("datasets")||"").split(",")),u(a,p),m(),g.observe(e,{attributes:!0,attributeFilter:["datasets"]}),s&&(i=l.datasetsMeta.on("set",((t,e)=>{f.includes(t)&&s(t,e)}))),n(w,a)};const $=a.disconnectedCallback;return a.disconnectedCallback=()=>{g.disconnect(),d.forEach((t=>t())),d=[],n(i),e(o(a)),n($,a)},t=>{f=t,m()}};export{a as g,i as p,d as w}
1
+ import{g as t,c as n}from"./context-protocol.js";import{r as e}from"./utils.js";import{getElement as o}from"@stencil/core/internal/client";function a(t,n=!1){const e=s(t);if(!e)return n&&console.log("[parentDims] no layout parent found for",t.tagName),{width:0,height:0};const o=getComputedStyle(e),a=e.clientWidth-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight),i=function(t,n=!1){let e=s(t),o=0,a=null,i=1;for(;e;){if(e.hasAttribute("data-bn-fit-content")){n&&console.log(`[height:${o}]`,e.tagName,"fit-content region → discarding inner candidate"),a=null;const t=parseInt(e.getAttribute("data-bn-fit-content"),10);!isNaN(t)&&t>1&&(i*=t),e=r(e),o++;continue}const t=getComputedStyle(e),s=t.overflowY;if(n&&console.log(`[height:${o}]`,e.tagName,e.className||"(no class)",`overflow=${s} clientH=${e.clientHeight} h=${t.height}`),null===a)if("hidden"===s||"scroll"===s||"auto"===s)a=e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom),n&&console.log(`[height] candidate at depth ${o}: ${Math.round(a)}px`);else if("none"!==t.maxHeight){const n=parseFloat(t.maxHeight);!isNaN(n)&&n>0&&(a=Math.min(n,e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)))}e=r(e),o++}return null!==a?a/i:(n&&console.log("[height] NO constrained ancestor → viewport fallback"),"undefined"!=typeof window?window.innerHeight/i:0)}(t,n);return n&&console.log("[parentDims]",t.tagName,"→ layoutParent:",e.tagName,e.className||"(no class)",`clientW=${e.clientWidth} → w=${Math.round(a)}, h=${Math.round(i)}`,"overflow:",o.overflow),{width:Math.max(0,a),height:Math.max(0,i)}}function s(t){var n;const e=t.parentElement;return(null===(n=null==e?void 0:e.assignedSlot)||void 0===n?void 0:n.parentElement)?e.assignedSlot.parentElement:e}function r(t){var n;if(null===(n=t.assignedSlot)||void 0===n?void 0:n.parentElement)return t.assignedSlot.parentElement;if(t.parentElement)return t.parentElement;const e=t.getRootNode();return e instanceof ShadowRoot?e.host:null}const i=(t,n)=>{const e=[],o=[];for(const a of n)(t(a)?e:o).push(a);return[e,o]},l="WARN_use_dataset",c=(t,n)=>{const e=t.errors;if(e)if(n.length>0){const t=n.map((t=>t.substring(1))).join(", ");e.addOrReplace({id:l,type:"warning",message:`Using datasource(s) "${t}" directly. Prefer using a dataset (bn-dataset) for query support and metadata.`})}else e.remove(l)},d=(a,s,r)=>{let l,d,u=[],f=[],h=[];const p=(t,n)=>{const e=n?t.substring(1):t;let o;try{o=d.db.db.exec(`SELECT * FROM \`${e}\``)}catch(t){o=[]}s(t,o)},g=()=>{u.forEach((t=>t())),u=[],f.forEach((t=>{t&&(u.push(d.db.subscribe(t,(()=>p(t,!1)))),p(t,!1),(t=>{if(r){const n=d.datasetsMeta.get(t);n&&r(t,n)}})(t))})),h.forEach((t=>{t&&(u.push(d.db.subscribe(t.substring(1),(()=>p(t,!0)))),p(t,!0))}))},w=new MutationObserver((t=>{t.forEach((t=>{"datasets"===t.attributeName&&([h,f]=i((t=>t.startsWith("$")),o(a).getAttribute("datasets").split(",")),c(a,h),g())}))})),$=a.connectedCallback;a.connectedCallback=()=>{const n=o(a);d=t(n),[h,f]=i((t=>t.startsWith("$")),(n.getAttribute("datasets")||"").split(",")),c(a,h),g(),w.observe(n,{attributes:!0,attributeFilter:["datasets"]}),r&&(l=d.datasetsMeta.on("set",((t,n)=>{f.includes(t)&&r(t,n)}))),e($,a)};const m=a.disconnectedCallback;return a.disconnectedCallback=()=>{w.disconnect(),u.forEach((t=>t())),u=[],e(l),n(o(a)),e(m,a)},t=>{f=t,g()}};export{a as g,d as w}
@@ -1 +1 @@
1
- import{m as t}from"./emotion-hash.esm.js";import{k as s}from"./validate.js";import{forceUpdate as e,getElement as a}from"@stencil/core/internal/client";import{r as o}from"./utils.js";class r{constructor(){this.cache=new Map,this.tag=r.makeStyleTag()}static makeStyleTag(){const t=document.createElement("style");return t.type="text/css",t.setAttribute("data-bn-computed-style",""),t.append(document.createTextNode("")),(document.head||document.querySelector("head")).append(t),t}apply(t){t.forEach((t=>this.cache.set(t.className,t.style))),this.tag.innerHTML=Array.from(this.cache.values()).map((t=>t)).join("\n")}}const n=new r,m=t=>s(t)?`${t}px`:t,c={width:{className:"w",cssName:"width",attrName:"width",transform:m},height:{className:"h",cssName:"height",attrName:"height",transform:m},position:{className:"pst",cssName:"position",attrName:"position"},top:{className:"top",cssName:"top",attrName:"top",transform:m},right:{className:"rgt",cssName:"right",attrName:"right",transform:m},bottom:{className:"btm",cssName:"bottom",attrName:"bottom",transform:m},left:{className:"lft",cssName:"left",attrName:"left",transform:m},"font-size":{className:"fts",cssName:"font-size",attrName:"font-size",transform:m},"grid-column":{className:"gdc",cssName:"grid-column",attrName:"grid-column"},"grid-row":{className:"gdr",cssName:"grid-row",attrName:"grid-row"}},i=Object.keys(c);function l(s,e){const a=function(s,e){const a=t(e);return`bn-c-${s.className}_${a}`}(s,e),o=function(t,s,e){return`.${s} {${t.cssName}: ${e};}`}(s,a,e);return{className:a,style:o}}const N=t=>{const s=new Map;return i.forEach((e=>{const a=t.getAttribute(e);a&&(["top","left","right","bottom"].includes(e)&&s.set("position",l(c.position,"absolute")),s.set(e,l(c[e],(c[e].transform||function(t){return t})(a))))})),s},f=new MutationObserver((t=>{for(const s of t){const t=s.target,a=N(t);n.apply(a);const o=Array.from(a.values()).map((t=>t.className));t.className=t.className.split(" ").filter((t=>!t.startsWith("bn-c-"))).concat(...o).join(" "),e(t)}})),u=t=>{const s=t.connectedCallback,e=t.disconnectedCallback;t.connectedCallback=()=>{const e=a(t);if(!e)throw new Error("Can't find element field in component undefined");(t=>{const s=N(t);n.apply(s);const e=Array.from(s.values()).map((t=>t.className));t.className=t.className.split(" ").filter((t=>!t.startsWith("bn-c-"))).concat(...e).join(" "),f.observe(t,{attributes:!0,attributeFilter:i,childList:!1,subtree:!1})})(e),o(s,t)},t.disconnectedCallback=()=>{o(e,t)}};export{u as w}
1
+ import{m as t}from"./emotion-hash.esm.js";import{o as s}from"./validate.js";import{forceUpdate as e,getElement as a}from"@stencil/core/internal/client";import{r as o}from"./utils.js";class r{constructor(){this.cache=new Map,this.tag=r.makeStyleTag()}static makeStyleTag(){const t=document.createElement("style");return t.type="text/css",t.setAttribute("data-bn-computed-style",""),t.append(document.createTextNode("")),(document.head||document.querySelector("head")).append(t),t}apply(t){t.forEach((t=>this.cache.set(t.className,t.style))),this.tag.innerHTML=Array.from(this.cache.values()).map((t=>t)).join("\n")}}const n=new r,m=t=>s(t)?`${t}px`:t,c={width:{className:"w",cssName:"width",attrName:"width",transform:m},height:{className:"h",cssName:"height",attrName:"height",transform:m},position:{className:"pst",cssName:"position",attrName:"position"},top:{className:"top",cssName:"top",attrName:"top",transform:m},right:{className:"rgt",cssName:"right",attrName:"right",transform:m},bottom:{className:"btm",cssName:"bottom",attrName:"bottom",transform:m},left:{className:"lft",cssName:"left",attrName:"left",transform:m},"font-size":{className:"fts",cssName:"font-size",attrName:"font-size",transform:m},"grid-column":{className:"gdc",cssName:"grid-column",attrName:"grid-column"},"grid-row":{className:"gdr",cssName:"grid-row",attrName:"grid-row"}},i=Object.keys(c);function l(s,e){const a=function(s,e){const a=t(e);return`bn-c-${s.className}_${a}`}(s,e),o=function(t,s,e){return`.${s} {${t.cssName}: ${e};}`}(s,a,e);return{className:a,style:o}}const N=t=>{const s=new Map;return i.forEach((e=>{const a=t.getAttribute(e);a&&(["top","left","right","bottom"].includes(e)&&s.set("position",l(c.position,"absolute")),s.set(e,l(c[e],(c[e].transform||function(t){return t})(a))))})),s},f=new MutationObserver((t=>{for(const s of t){const t=s.target,a=N(t);n.apply(a);const o=Array.from(a.values()).map((t=>t.className));t.className=t.className.split(" ").filter((t=>!t.startsWith("bn-c-"))).concat(...o).join(" "),e(t)}})),u=t=>{const s=t.connectedCallback,e=t.disconnectedCallback;t.connectedCallback=()=>{const e=a(t);if(!e)throw new Error("Can't find element field in component undefined");(t=>{const s=N(t);n.apply(s);const e=Array.from(s.values()).map((t=>t.className));t.className=t.className.split(" ").filter((t=>!t.startsWith("bn-c-"))).concat(...e).join(" "),f.observe(t,{attributes:!0,attributeFilter:i,childList:!1,subtree:!1})})(e),o(s,t)},t.disconnectedCallback=()=>{o(e,t)}};export{u as w}
@@ -1,4 +1,4 @@
1
- import { C as CompareUtil } from './VarianceMeasure-CE3N8Bea.js';
1
+ import { C as CompareUtil } from './VarianceMeasure-DLOuIIJ7.js';
2
2
 
3
3
  /**
4
4
  * Parses a raw object-prop attribute value. A blank value yields `data: null`
@@ -1,5 +1,5 @@
1
- import { F as Formatter } from './SVGStyle-BwBlY3Km.js';
2
- import './VarianceMeasure-CE3N8Bea.js';
1
+ import { F as Formatter } from './SVGStyle-8FfAtUF-.js';
2
+ import './VarianceMeasure-DLOuIIJ7.js';
3
3
 
4
4
  /** SI metric prefix for number scaling (e.g. prefix="M", value=1000000 divides displayed values by one million). */
5
5
  class SiPrefix {
@@ -1,4 +1,4 @@
1
- import { C as CompareUtil } from './VarianceMeasure-CE3N8Bea.js';
1
+ import { C as CompareUtil } from './VarianceMeasure-DLOuIIJ7.js';
2
2
 
3
3
  /** Shared utilities for the adapter layer, used by all component config adapters. */
4
4
  class AdapterUtils {
@@ -1,5 +1,5 @@
1
- import { d as getDefaultExportFromCjs, S as SYSTEM_RULESET_DEFAULTS } from './context-protocol-d8MHrEo8.js';
2
- import { m as merge, C as CompareUtil } from './VarianceMeasure-CE3N8Bea.js';
1
+ import { d as getDefaultExportFromCjs, S as SYSTEM_RULESET_DEFAULTS } from './context-protocol-BoEL0caI.js';
2
+ import { m as merge, C as CompareUtil } from './VarianceMeasure-DLOuIIJ7.js';
3
3
 
4
4
  /**
5
5
  * Parses an IBCS variance column name into its constituent parts.
@@ -1,4 +1,4 @@
1
- import { C as CompareUtil } from './VarianceMeasure-CE3N8Bea.js';
1
+ import { C as CompareUtil } from './VarianceMeasure-DLOuIIJ7.js';
2
2
 
3
3
  class SVGVariancesStyleGroup {
4
4
  constructor(pos, neg, neu) {
@@ -1,4 +1,4 @@
1
- import { D as DateTime } from './context-protocol-d8MHrEo8.js';
1
+ import { D as DateTime } from './context-protocol-BoEL0caI.js';
2
2
 
3
3
  const isObject = (obj) => {
4
4
  if (typeof obj === 'object' && obj !== null) {
@@ -123,7 +123,7 @@ var TableType;
123
123
  TableType["OPT"] = "opt";
124
124
  TableType["OPTNOTOTAL"] = "optnototal";
125
125
  })(TableType || (TableType = {}));
126
- /** Width of the category label column as a percentage of the table width. INF = auto/infinite. */
126
+ /** Width of the category label column, in em of the table font. INF = auto/infinite. */
127
127
  var TableCategoryWidth;
128
128
  (function (TableCategoryWidth) {
129
129
  TableCategoryWidth["INF"] = "inf";
@@ -135,7 +135,7 @@ var TableCategoryWidth;
135
135
  TableCategoryWidth["W10"] = "w10";
136
136
  TableCategoryWidth["W5"] = "w5";
137
137
  })(TableCategoryWidth || (TableCategoryWidth = {}));
138
- /** Width preset for inline bar/pin chart columns. Value = max bar width in em. */
138
+ /** Width preset for inline bar/pin chart columns. Value = total column width in em. */
139
139
  var TableBarColumnWidth;
140
140
  (function (TableBarColumnWidth) {
141
141
  TableBarColumnWidth["W5"] = "w5";
@@ -149,7 +149,7 @@ var TableBarColumnWidth;
149
149
  TableBarColumnWidth["W80"] = "w80";
150
150
  TableBarColumnWidth["W100"] = "w100";
151
151
  })(TableBarColumnWidth || (TableBarColumnWidth = {}));
152
- /** Maps TableBarColumnWidth presets to max bar width in em. */
152
+ /** Maps TableBarColumnWidth presets to total bar column width in em. */
153
153
  const BAR_COLUMN_WIDTH_EM = {
154
154
  [TableBarColumnWidth.W5]: 5,
155
155
  [TableBarColumnWidth.W10]: 10,
@@ -1,7 +1,7 @@
1
- import { C as CompareUtil, a as scenarioSlotNumber } from './VarianceMeasure-CE3N8Bea.js';
2
- import { X as XY_SERIES_PALETTE, D as DateTime } from './context-protocol-d8MHrEo8.js';
3
- import { L as LabelCollisionManager, H as HookLocation } from './LabelCollisionManager-DaNiDiM9.js';
4
- import { F as Formatter, C as CalculateSize } from './SVGStyle-BwBlY3Km.js';
1
+ import { C as CompareUtil, a as scenarioSlotNumber } from './VarianceMeasure-DLOuIIJ7.js';
2
+ import { X as XY_SERIES_PALETTE, D as DateTime } from './context-protocol-BoEL0caI.js';
3
+ import { L as LabelCollisionManager, H as HookLocation } from './LabelCollisionManager-B_NUM9yq.js';
4
+ import { F as Formatter, C as CalculateSize } from './SVGStyle-8FfAtUF-.js';
5
5
 
6
6
  /**
7
7
  * Aggregates all style configuration for an XY chart (scatter/bubble):