@bino-bi/bn-template-engine 1.0.0-next.32 → 1.0.0-next.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-66ed6259.entry.js +1 -0
  3. package/dist/bn-template-engine/p-789bfd06.entry.js +1 -0
  4. package/dist/bn-template-engine/{p-BTbeDWM9.js → p-CAvWZ3a5.js} +1 -1
  5. package/dist/bn-template-engine/p-_SKPuKfK.js +1 -0
  6. package/dist/bn-template-engine/p-dc12ff1b.entry.js +1 -0
  7. package/dist/bn-template-engine/p-dec6837c.entry.js +1 -0
  8. package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +76 -28
  9. package/dist/cjs/bn-grid.cjs.entry.js +52 -15
  10. package/dist/cjs/bn-image.cjs.entry.js +1 -1
  11. package/dist/cjs/bn-text.cjs.entry.js +2 -2
  12. package/dist/cjs/{withStyled-Ds3e64Nz.js → withStyled-eHD8Yt2K.js} +6 -1
  13. package/dist/cjs/{withTranslation-Cjvvs3gL.js → withTranslation-yJ-j0lsu.js} +1 -1
  14. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +2 -2
  15. package/dist/collection/components/bn-chart-structure/utils/model/DataPoint.js +5 -2
  16. package/dist/collection/components/bn-chart-time/bn-chart-time.js +2 -2
  17. package/dist/collection/components/bn-chart-time/utils/model/DataPoint.js +5 -2
  18. package/dist/collection/components/bn-grid/bn-grid.js +51 -14
  19. package/dist/collection/components/bn-layout-card/bn-layout-card.css +8 -0
  20. package/dist/collection/components/bn-layout-card/bn-layout-card.js +2 -2
  21. package/dist/collection/components/bn-layout-page/bn-layout-page.js +2 -2
  22. package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +1 -1
  23. package/dist/collection/components/bn-table/bn-table.js +2 -2
  24. package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +23 -6
  25. package/dist/collection/components/bn-table/utils/helper/DataQuery.js +15 -6
  26. package/dist/collection/components/bn-title/bn-title.js +2 -2
  27. package/dist/collection/utils/constants.js +5 -0
  28. package/dist/collection/utils/model/VarianceScenario.js +21 -2
  29. package/dist/collection/utils/xy/VarianceMeasure.js +1 -1
  30. package/dist/components/bn-chart-bubble-renderer.js +1 -1
  31. package/dist/components/bn-chart-bubble.js +1 -1
  32. package/dist/components/bn-chart-bullet-renderer.js +1 -1
  33. package/dist/components/bn-chart-bullet.js +1 -1
  34. package/dist/components/bn-chart-scatter-renderer.js +1 -1
  35. package/dist/components/bn-chart-scatter.js +1 -1
  36. package/dist/components/bn-chart-structure-renderer.js +1 -1
  37. package/dist/components/bn-chart-structure.js +1 -1
  38. package/dist/components/bn-chart-time-renderer.js +1 -1
  39. package/dist/components/bn-chart-time.js +1 -1
  40. package/dist/components/bn-grid.js +1 -1
  41. package/dist/components/bn-image.js +1 -1
  42. package/dist/components/bn-layout-card.js +1 -1
  43. package/dist/components/bn-layout-page.js +1 -1
  44. package/dist/components/bn-page.js +1 -1
  45. package/dist/components/bn-table-renderer.js +1 -1
  46. package/dist/components/bn-table.js +1 -1
  47. package/dist/components/bn-text.js +1 -1
  48. package/dist/components/bn-title-renderer.js +1 -1
  49. package/dist/components/bn-title.js +1 -1
  50. package/dist/components/bn-tree.js +1 -1
  51. package/dist/components/{p-0gehv1XG.js → p-4BanAktr.js} +1 -1
  52. package/dist/components/{p-BoUkFdpu.js → p-B3F_c9GB.js} +1 -1
  53. package/dist/components/{p-CtBM3KFY.js → p-B4pmO5QQ.js} +1 -1
  54. package/dist/components/{p-DyO09Jk6.js → p-B7UDMyar.js} +1 -1
  55. package/dist/components/{p-CxPSvrcF.js → p-BNWZoAip.js} +1 -1
  56. package/dist/components/p-BT2WH_CP.js +1 -0
  57. package/dist/components/{p-BPJsmv3o.js → p-BVnYDfb8.js} +1 -1
  58. package/dist/components/p-BWRE5w0i.js +1 -0
  59. package/dist/components/{p-DPLcGhVt.js → p-BXt0ers2.js} +1 -1
  60. package/dist/components/{p-BpCL2bfw.js → p-BldMZbAf.js} +1 -1
  61. package/dist/components/p-BtH2oezK.js +1 -0
  62. package/dist/components/{p-CMM8vtHW.js → p-C-oNdJj9.js} +1 -1
  63. package/dist/components/{p-D5-dYgK_.js → p-CJtE8Pyr.js} +1 -1
  64. package/dist/components/p-CLkpoHdg.js +1 -0
  65. package/dist/components/{p-z56_ZQ42.js → p-CPC9Vkmg.js} +1 -1
  66. package/dist/components/p-CYqHwYgQ.js +1 -0
  67. package/dist/components/{p-DYG9FH_u.js → p-CYv_8LrR.js} +1 -1
  68. package/dist/components/p-Ckl1aEvn.js +1 -0
  69. package/dist/components/p-D5LDmR4u.js +1 -0
  70. package/dist/components/{p-COqIkH1M.js → p-DHAoxu6M.js} +1 -1
  71. package/dist/components/{p-DdGnuNtc.js → p-DLLljAll.js} +1 -1
  72. package/dist/components/p-DdG2Ylar.js +1 -0
  73. package/dist/components/{p-LZ9lAY8T.js → p-Dn3DJxQQ.js} +1 -1
  74. package/dist/components/{p-BohXdw3-.js → p-GrpYAVHb.js} +1 -1
  75. package/dist/components/p-M6hn0BuZ.js +1 -0
  76. package/dist/components/{p-Dlb4ncGF.js → p-VIw66ez1.js} +1 -1
  77. package/dist/components/p-nHZ8466v.js +1 -0
  78. package/dist/esm/bn-annotation-layer_30.entry.js +76 -28
  79. package/dist/esm/bn-grid.entry.js +52 -15
  80. package/dist/esm/bn-image.entry.js +1 -1
  81. package/dist/esm/bn-text.entry.js +2 -2
  82. package/dist/esm/{withStyled-B-cbWCe2.js → withStyled-Cxua0iTP.js} +6 -1
  83. package/dist/esm/{withTranslation-_8q-7Y9C.js → withTranslation-BeAbw2--.js} +1 -1
  84. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +1 -0
  85. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +4 -1
  86. package/dist/types/components/bn-grid/bn-grid.d.ts +6 -2
  87. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +4 -3
  88. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +4 -3
  89. package/dist/types/components/bn-table/bn-table.d.ts +4 -1
  90. package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -0
  91. package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +4 -0
  92. package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +3 -3
  93. package/dist/types/components/bn-title/bn-title.d.ts +1 -1
  94. package/dist/types/components.d.ts +12 -12
  95. package/dist/types/utils/constants.d.ts +6 -1
  96. package/dist/types/utils/model/VarianceScenario.d.ts +13 -1
  97. package/package.json +1 -1
  98. package/dist/bn-template-engine/p-225cd474.entry.js +0 -1
  99. package/dist/bn-template-engine/p-58b10778.entry.js +0 -1
  100. package/dist/bn-template-engine/p-9f3cbc5f.entry.js +0 -1
  101. package/dist/bn-template-engine/p-BjR3nkhl.js +0 -1
  102. package/dist/bn-template-engine/p-ce39e111.entry.js +0 -1
  103. package/dist/components/p-B2jqpOF9.js +0 -1
  104. package/dist/components/p-BQMKgvEC.js +0 -1
  105. package/dist/components/p-BpsXOtoW.js +0 -1
  106. package/dist/components/p-CDoSPw-I.js +0 -1
  107. package/dist/components/p-CujsXn-l.js +0 -1
  108. package/dist/components/p-D4FY_yoG.js +0 -1
  109. package/dist/components/p-oJjMz8JF.js +0 -1
  110. package/dist/components/p-xpguaboj.js +0 -1
  111. package/dist/components/p-yH-XxIy9.js +0 -1
  112. package/dist/components/p-zf8cTH63.js +0 -1
@@ -0,0 +1 @@
1
+ import{p as t,H as i,h as s,a as h,t as e}from"./p-D6YGOYV1.js";import{S as n,F as r,a as o,P as a}from"./p-CJtE8Pyr.js";import{C as l,A as c,g as u,e as d}from"./p-D5LDmR4u.js";import{D as f,b as p}from"./p-VIw66ez1.js";import{c as v,O as g,a as b}from"./p-BNWZoAip.js";import{S as m}from"./p-CeE4_3wQ.js";import{a as w,F as P,I as y,C as S,b as x,V as L,s as k}from"./p-M6hn0BuZ.js";import{g as M,a as C,I as T}from"./p-4q8nRcWC.js";import{d as O,l as A,S as $}from"./p-DHAoxu6M.js";import{N,r as _}from"./p-fCjsrD7I.js";import{s as E,c as W,a as D,l as R,b as B,d as j,M as Y}from"./p-BTnRaHPb.js";import{d as V,g as X}from"./p-BcOud3dQ.js";import{e as z,r as H}from"./p-ClruFZD_.js";import{S as F}from"./p-BT2WH_CP.js";import{w as G}from"./p-DEHnizot.js";import{S as U}from"./p-B4pmO5QQ.js";import{A as I}from"./p-C-oNdJj9.js";class Q{constructor(t,i,s,h,e,n,r,o,a=!1){this.categoryPosition={x:0,y:0},this.spacings={scenarioOffset:0,markerOffset:0,scenarioLabelToBar:0,labelToBar:0,labelToAxis:0,needleWidth:0,needleHeadWidth:0,barWidth:0,varianceAxisLineWidth:0,axisLineWidth:0,auxiliaryLineWidth:0,scenarioLineWidth:0,markerWidth:0,categoryWidth:0,axisTickLength:0},this.categoriesBoxOffset={width:0,height:0},this.padding=t,this.scaleFactors=i,this.fontSize=s,this.axisPosition={x:0,y:0},this.numberOfColumns=h,this.leftSideLengthSync=e,this.topSideLabelHeight=n>0?this.fontSize:0,this.hasStackedHeaders=a,this.leftSideLabelLength=this.calculateSideLabelLength(n,r,o),this.calculateSpacings(),this.calculateCategoryPosition(),this.calculateAxisPosition()}getBarPositionX(){return this.axisPosition.x}getBarCenterPositionY(t){return this.categoryPosition.y+this.spacings.scenarioOffset+t*this.spacings.categoryWidth}getBarPositionY(t,i){return i?this.getBarCenterPositionY(t):this.getBarCenterPositionY(t)-this.spacings.scenarioOffset}getCategoryPositionX(t){let i=this.spacings.labelToAxis;return t&&(i=-this.spacings.labelToAxis),this.getAxisPositionX()+i}getAxisTitlePositionX(){return this.axisPosition.x}getAxisTitlePositionY(){return this.axisPosition.y-this.spacings.labelToAxis-this.getTopLabelOverhang()}getStackedHeaderPositionY(){return this.getBarCenterPositionY(0)-.5*this.spacings.barWidth-this.spacings.scenarioLabelToBar}getNeedleWidth(){return this.spacings.needleWidth}getAxisPositionX(){return this.leftSideLabelLength+this.padding.left+this.spacings.labelToAxis}getAxisPositionY(){return this.padding.top+this.getAxisTitleOffset()}loadCategoriesBox(t){this.categoriesBoxOffset=t,this.calculateAxisPosition()}addOffsetByNegativeDataPoints(t,i,s,h){null!=t&&null!=t.value&&t.value<0&&(s&&t.isClipped()?this.axisPosition.x+=Math.abs(t.getClippedValue()*t.pixelPerUnit):this.axisPosition.x+=Math.abs(t.value*t.pixelPerUnit),this.axisPosition.x+=i,this.axisPosition.x+=this.spacings.labelToBar),this.axisPosition.x<h/2&&(this.axisPosition.x=h/2+this.spacings.labelToBar)}getLabelPositionX(t){let i=this.spacings.labelToBar;return t<0&&(i*=-1),this.axisPosition.x+t+i}getLabelPositionY(t){return this.axisPosition.y+t+this.spacings.labelToBar}getCategoryToAxisSpaceing(){return this.spacings.labelToAxis}getCategoryToTopSpaceing(){return this.spacings.scenarioOffset}getCategoryToBottomSpaceing(){return this.spacings.scenarioOffset}getAxisEndPositionY(){return this.getAxisPositionY()+(this.numberOfColumns+.5)*this.spacings.categoryWidth}getScenarioLabelPositionOffsetY(t){if(t){const t=.5*this.getBarWidth()+this.spacings.scenarioLabelToBar;return Math.max(t,this.spacings.categoryWidth-this.spacings.scenarioOffset+this.spacings.labelToAxis)}return-(.5*this.getBarWidth()+this.spacings.scenarioLabelToBar)}getBarWidth(){return this.spacings.barWidth}getMarkerPositionY(t,i){return i?this.getBarCenterPositionY(t)-this.spacings.markerOffset-.5*this.getBarWidth():this.getBarCenterPositionY(t)+this.spacings.markerOffset+.5*this.getBarWidth()}getMarkerPositionX(){return this.getBarPositionX()}getMarkerScenarioLabelPositionOffsetY(t){return t?-(.5*this.spacings.markerWidth+this.spacings.scenarioLabelToBar):this.spacings.scenarioLabelToBar+.5*this.spacings.markerWidth}getAxisEndPositionX(){return this.getAxisPositionX()}calculateSpacings(){this.spacings={scenarioOffset:this.fontSize*this.scaleFactors.scenarioOffset,markerOffset:this.fontSize*this.scaleFactors.markerOffset,scenarioLabelToBar:this.fontSize*this.scaleFactors.scenarioLabelToBar,labelToBar:this.fontSize*this.scaleFactors.labelToBar,labelToAxis:this.fontSize*this.scaleFactors.labelToAxis,needleWidth:this.fontSize*this.scaleFactors.needleWidth,needleHeadWidth:this.fontSize*this.scaleFactors.needleHeadWidth,barWidth:this.fontSize*this.scaleFactors.barWidth,varianceAxisLineWidth:this.fontSize*this.scaleFactors.varianceAxisLineWidth,axisLineWidth:this.fontSize*this.scaleFactors.axisLineWidth,auxiliaryLineWidth:this.fontSize*this.scaleFactors.auxiliaryLineWidth,scenarioLineWidth:this.fontSize*this.scaleFactors.scenarioLineWidth,markerWidth:this.fontSize*this.scaleFactors.markerWidth,categoryWidth:this.fontSize*this.scaleFactors.categoryWidth,axisTickLength:this.fontSize*this.scaleFactors.axisTickLength}}calculateCategoryPosition(){this.categoryPosition={x:this.padding.left,y:this.getAxisPositionY()+.5*this.spacings.categoryWidth}}calculateAxisPosition(){this.axisPosition={x:this.getAxisPositionX(),y:this.getAxisPositionY()}}recalculatePositions(){this.calculateCategoryPosition(),this.calculateAxisPosition()}getAxisTitleOffset(){return this.topSideLabelHeight+this.spacings.labelToAxis+this.getTopLabelOverhang()}getTopLabelOverhang(){return this.hasStackedHeaders?this.getStackedHeaderOverhang():this.getTopScenarioLabelOverhang()}getStackedHeaderOverhang(){return Math.max(0,this.fontSize+this.spacings.scenarioLabelToBar+.5*this.spacings.barWidth-(.5*this.spacings.categoryWidth+this.spacings.scenarioOffset))}getTopScenarioLabelOverhang(){return Math.max(0,this.fontSize+.5*this.spacings.barWidth+this.spacings.scenarioLabelToBar-.5*this.spacings.categoryWidth,this.fontSize+.5*this.spacings.markerWidth+this.spacings.scenarioLabelToBar+this.spacings.markerOffset+.5*this.spacings.barWidth-(.5*this.spacings.categoryWidth+this.spacings.scenarioOffset))}calculateSideLabelLength(t,i,s){if(this.leftSideLengthSync)return this.leftSideLengthSync;const h=t/2;let e=i;return h>e&&(e=h),s>e&&(e=s),e}}class Z{constructor(t){this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right}addBoxTopLeft(t){return this.top+=t.height|this.top,this.left+=t.width|this.top,this}}class K{constructor(t){const i=1*t,s=.7*t;this.bgOffset=(i-s)/2,this.markerUp={top:s/2+",0",left:"0,"+s,right:s+","+s},this.markerUpBackground={top:i/2+",0",left:"0,"+i,right:i+","+i},this.markerDown={bottom:s/2+","+s,left:"0,0",right:s+",0"},this.markerDownBackground={bottom:i/2+","+i,left:"0,0",right:i+",0"}}upMarkerPatternStrings(){return{background:this.markerUpBackground.left+" "+this.markerUpBackground.right+" "+this.markerUpBackground.top+" "+this.markerUpBackground.left,foreground:this.markerUp.left+" "+this.markerUp.right+" "+this.markerUp.top+" "+this.markerUp.left,bgOffset:this.bgOffset}}downMarkerPatternStrings(){return{background:this.markerDownBackground.left+" "+this.markerDownBackground.right+" "+this.markerDownBackground.bottom+" "+this.markerDownBackground.left,foreground:this.markerDown.left+" "+this.markerDown.right+" "+this.markerDown.bottom+" "+this.markerDown.left,bgOffset:this.bgOffset}}createPatternMapForStructureBar(){const t=new Map;return t.set("marker-up",this.upMarkerPatternStrings()),t.set("marker-down",this.downMarkerPatternStrings()),t}}class q{constructor(t){this.container=new n,this.pattern=this.createFCPattern(this.container.group(),t),this.styles=t;let i=10;null!=t&&null!=t.fontStyles&&t.fontStyles.size&&(i=t.fontStyles.size),this.bgOffset=(1*i-.7*i)/2}createFCPattern(t,i){const s=i;return t.pattern(10,10,(function(t){t.rect(10,10).fill(s.barStyles.fc.fill),t.line(0,5,5,0).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"}),t.line(5,10,10,5).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"})})).id("pattern-structure-fc")}getFCPolygonPattern(){return{background:"",foreground:"",bgOffset:0,pattern:this.pattern}}toString(){return this.container.svg()}}var J,tt,it,st,ht;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(J||(J={})),function(t){t.RELATIVE="dr",t.ABSOLUTE="d",t.NONE=""}(tt||(tt={}));class et{constructor(t,i){this.data=t,this.scenarios=i,this.variances=[],this.title="",this.hideCategories=!1,this.pixelPerUnit=10,this.pixelPerPercentage=50,this.limit=0,this.sortOrder=new v(new F).default(),this.level=c.CATEGORY,this.filter="",this.measureScale=new m,this.measureUnit="",this.showMeasureScale=!0,this.dataFormatDigits={decimal:1,percent:2},this.stackConfig=null}}class nt{constructor(t,i,s,h,e,n,r){this.dataRowAdapter=t,this.orderAdapter=i,this.stringAdapter=s,this.dataFormatDigitsAdapter=h,this.db=e,this.fromExpr=n,this.onQueryError=r}adapt(t){const i=I.adaptArray(t.data,this.dataRowAdapter),s=I.adaptArray(t.scenarios,this.stringAdapter),h=new et(i,s);return l.isArray(t.variances)&&(h.variances=I.adaptArray(t.variances,this.stringAdapter)),l.isString(t.title)&&(h.title=t.title),l.isBoolean(t.hideCategories)&&(h.hideCategories=t.hideCategories),l.isNumber(t.pixelPerUnit)&&(h.pixelPerUnit=t.pixelPerUnit),l.isNumber(t.pixelPerPercentage)&&(h.pixelPerPercentage=t.pixelPerPercentage),l.isNumber(t.limit)&&(h.limit=t.limit),l.isExisting(t.sortOrder)&&(h.sortOrder=this.orderAdapter.adapt(t.sortOrder)),l.isExisting(t.level)&&(h.level=t.level),l.isString(t.filter)&&(h.filter=t.filter.trim()),l.isExisting(t.measureScale)&&(h.measureScale=f.calculateMeasureScale(this.db,this.fromExpr,h.scenarios,t.measureScale,this.onQueryError)),l.isString(t.measureUnit)&&(h.measureUnit=t.measureUnit),l.isBoolean(t.showMeasureScale)&&(h.showMeasureScale=t.showMeasureScale),l.isExisting(t.dataFormatDigits)&&(h.dataFormatDigits=this.dataFormatDigitsAdapter.adapt(t.dataFormatDigits)),l.isExisting(t.stackConfig)&&(h.stackConfig=t.stackConfig),h}default(){return new et([],[])}}class rt{constructor(t,i,s,h){this.value=t,this.scenario=i,this.pixelPerUnit=s||1;const e="string"==typeof h?w(h,null,!0):h;this.variance="neg"===e||e===it.NEG?it.NEG:"pos"===e||e===it.POS?it.POS:it.NEU}isEmpty(){return null==this.value||null==this.scenario}getScaledUnit(){return null==this.value?0:this.value*this.pixelPerUnit}getScaledPercentUnit(){return null==this.value?0:Math.abs(this.value)>1.45?this.value>=0?1.45*this.pixelPerUnit:-1.45*this.pixelPerUnit:this.value*this.pixelPerUnit}getVarianceStyle(){return null==this.value||this.value>=0?this.variance:it.NEU===this.variance?it.NEU:it.POS===this.variance?it.NEG:it.POS}isClipped(){return null!=this.value&&Math.abs(this.value)>1.45}getClippedValue(){return 145}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}class ot{constructor(){this.operation="+"}addRowGroup(t,i){this.rowGroup=t,this.rowGroupIndex=i}addCategory(t,i){this.category=t,this.categoryIndex=i}addSubCategory(t,i){this.subCategory=t,this.subCategoryIndex=i}addColumnGroup(t,i){this.columnGroup=t,this.columnGroupIndex=i}addSubColumnGroup(t,i){this.columnSubGroup=t,this.columnSubGroupIndex=i}}class at{constructor(){}adapt(t){const i=new ot;return l.isOperator(t.operation)&&(i.operation=t.operation),l.isNumber(t.rowGroupIndex)&&l.isString(t.rowGroup)&&i.addRowGroup(t.rowGroup,t.rowGroupIndex),l.isNumber(t.categoryIndex)&&l.isString(t.category)&&i.addCategory(t.category,t.categoryIndex),l.isNumber(t.subCategoryIndex)&&l.isString(t.subCategory)&&i.addSubCategory(t.subCategory,t.subCategoryIndex),l.isNumber(t.columnGroupIndex)&&l.isString(t.columnGroup)&&i.addColumnGroup(t.columnGroup,t.columnGroupIndex),l.isNumber(t.columnSubGroupIndex)&&l.isString(t.columnSubGroup)&&i.addSubColumnGroup(t.columnSubGroup,t.columnSubGroupIndex),this.setActualValues(t,i),this.setPlanValues(t,i),this.setPreviousPeriodValues(t,i),this.setForecastValues(t,i),i}default(){return new ot}setActualValues(t,i){l.isNumber(t.ac1)&&(i.ac1=t.ac1),l.isNumber(t.ac2)&&(i.ac2=t.ac2),l.isNumber(t.ac3)&&(i.ac3=t.ac3),l.isNumber(t.ac4)&&(i.ac4=t.ac4)}setPlanValues(t,i){l.isNumber(t.pl1)&&(i.pl1=t.pl1),l.isNumber(t.pl2)&&(i.pl2=t.pl2),l.isNumber(t.pl3)&&(i.pl3=t.pl3),l.isNumber(t.pl4)&&(i.pl4=t.pl4)}setPreviousPeriodValues(t,i){l.isNumber(t.pp1)&&(i.pp1=t.pp1),l.isNumber(t.pp2)&&(i.pp2=t.pp2),l.isNumber(t.pp3)&&(i.pp3=t.pp3),l.isNumber(t.pp4)&&(i.pp4=t.pp4)}setForecastValues(t,i){l.isNumber(t.fc1)&&(i.fc1=t.fc1),l.isNumber(t.fc2)&&(i.fc2=t.fc2),l.isNumber(t.fc3)&&(i.fc3=t.fc3),l.isNumber(t.fc4)&&(i.fc4=t.fc4)}}class lt{constructor(t,i,s,h,e,n){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=s,this.barStyles=h,this.varianceStyles=e,this.padding=n,this.pattern=new Map,this.stackColors=["#000000","#c0c0c0","#808080"],this.locale="de"}}class ct{constructor(t,i,s,h,e){this.scaleFactorsStructureChartAdapter=t,this.fontStyleAdapter=i,this.svgStyleGroupAdapter=s,this.svgVariancesStyleGroupAdapter=h,this.paddingadapter=e}adapt(t){const i=new lt(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default());return l.isExisting(t)&&(l.isExisting(t.scaleFactors)&&(i.scaleFactors=this.scaleFactorsStructureChartAdapter.adapt(t.scaleFactors)),l.isExisting(t.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(t.fontStyles)),l.isExisting(t.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(t.axisStyles)),l.isExisting(t.barStyles)&&(i.barStyles=this.svgStyleGroupAdapter.adapt(t.barStyles)),l.isExisting(t.varianceStyles)&&(i.varianceStyles=this.svgVariancesStyleGroupAdapter.adapt(t.varianceStyles)),l.isExisting(t.padding)&&(i.padding=this.paddingadapter.adapt(t.padding)),Array.isArray(t.stackColors)&&t.stackColors.length>0&&(i.stackColors=t.stackColors),i.pattern=new K(i.fontStyles.size).createPatternMapForStructureBar()),i}default(){return new lt(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default())}}class ut{constructor(){this.scenarioOffset=.3,this.scenarioLabelToBar=.1,this.labelToBar=.3,this.labelToAxis=.3,this.needleWidth=.3,this.needleHeadWidth=.6,this.barWidth=1.2,this.varianceAxisLineWidth=.3,this.axisLineWidth=.1,this.auxiliaryLineWidth=.1,this.scenarioLineWidth=.2,this.markerWidth=.7,this.markerOffset=0,this.categoryWidth=1.9,this.axisTickLength=.3}}class dt{adapt(t){const i=new ut;return l.isNumber(t.scenarioOffset)&&(i.scenarioOffset=t.scenarioOffset),l.isNumber(t.scenarioLabelToBar)&&(i.scenarioLabelToBar=t.scenarioLabelToBar),l.isNumber(t.labelToBar)&&(i.labelToBar=t.labelToBar),l.isNumber(t.labelToAxis)&&(i.labelToAxis=t.labelToAxis),l.isNumber(t.needleWidth)&&(i.needleWidth=t.needleWidth),l.isNumber(t.needleHeadWidth)&&(i.needleHeadWidth=t.needleHeadWidth),l.isNumber(t.barWidth)&&(i.barWidth=t.barWidth),l.isNumber(t.varianceAxisLineWidth)&&(i.varianceAxisLineWidth=t.varianceAxisLineWidth),l.isNumber(t.axisLineWidth)&&(i.axisLineWidth=t.axisLineWidth),l.isNumber(t.auxiliaryLineWidth)&&(i.auxiliaryLineWidth=t.auxiliaryLineWidth),l.isNumber(t.scenarioLineWidth)&&(i.scenarioLineWidth=t.scenarioLineWidth),l.isNumber(t.markerWidth)&&(i.markerWidth=t.markerWidth),l.isNumber(t.markerOffset)&&(i.markerOffset=t.markerOffset),l.isNumber(t.categoryWidth)&&(i.categoryWidth=t.categoryWidth),l.isNumber(t.axisTickLength)&&(i.axisTickLength=t.axisTickLength),i}default(){return new ut}}!function(t){t.AC1="ac1",t.PP1="pp1",t.FC1="fc1",t.PL1="pl1",t.AC2="ac2",t.PP2="pp2",t.FC2="fc2",t.PL2="pl2",t.AC3="ac3",t.PP3="pp3",t.FC3="fc3",t.PL3="pl3",t.AC4="ac4",t.PP4="pp4",t.FC4="fc4",t.PL4="pl4",t.POS="pos",t.NEG="neg",t.NEU="neu"}(it||(it={})),function(t){t.LIST="LIST",t.SUM="SUM",t.OPT="OPT"}(st||(st={})),function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right",t[t.Top=3]="Top",t[t.Bottom=4]="Bottom"}(ht||(ht={}));class ft{constructor(t,i,s,h,e,n,r,o){this.group=null,this.segmentFillColor=null,this.maxWidth=null,this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.pointPart="label",this.x=i,this.y=s,this.value=e,null!=t&&(this.group=t.group().id(this.createElementID(t.toString(),h))),this.styles=n,this.isVarianceLabel=!1,this.isRelativeLabel=!1,this.verticalHookLocation=r||ht.Top,this.horizontalHookLocation=o||ht.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}setMaxWidth(t){return this.maxWidth=t,this}setPoint(t,i="label"){return this.pointKey=t,this.pointPart=i,this}updateGroup(t){return this.group=t,this}createElementID(t,i){return t+"_"+i+"_"+this.ID_SCENARIOLABEL}draw(t={percent:2,decimal:1},i=new m){var s;if(this.isEmpty())return this;const h=this.group;let e;const n=this.styles.fontStyles.background||"#ffffff";let r="",o="start";if(!1===Number.isNaN(Number(this.value))){let s=t.percent,h=t.percent,n=1,a="percent";!1===this.isRelativeLabel&&(s=t.decimal,h=t.decimal,n=i.value,a="decimal"),e=P.number(Number(this.value),a,s,h,n,this.styles.locale),Number(this.value)<0&&(o="end"),this.isVarianceLabel&&Number(this.value)>=0&&(r="+")}else e=""+this.value,o="start";const a=h.text(r+e);a.move(this.x,this.y);const l=a.bbox(),c=l.w,u=l.h;return null!=this.maxWidth&&c>this.maxWidth?(null===(s=this.group)||void 0===s||s.remove(),this.group=null,this):(this.horizontalHookLocation===ht.Right?(o="end",a.move(a.x()-a.length(),a.y())):this.horizontalHookLocation===ht.Center&&(o="middle",a.move(a.x()-a.length()/2,a.y())),this.verticalHookLocation===ht.Center?a.move(a.x(),a.y()-u/2):this.verticalHookLocation===ht.Bottom&&a.move(a.x(),a.y()-u),a.font({anchor:o}),null!=this.segmentFillColor?a.fill(M(this.segmentFillColor)):null==h||h.rect(c,.9*u).stroke(n).fill(n).opacity(.7).move(a.x(),a.y()+.1*u).insertBefore(a),this.pointKey&&(null==h||h.attr(O(this.pointKey,this.pointPart))),this)}isEmpty(){return null==this.value||""===this.value}setPos(t,i){return this.x=t,this.y=i,this}}class pt{constructor(t,i,s,h){this.height=0,this.ID_AXIS="axis",this.ID_AXIS_TITLE="axis-title",this.CSS_AXIS_TITLE="categories",this.scenarioType=t.scenarioType,this.labelText=t.labelText||null,this.position=i,this.style=h,this.label=new ft(s,this.position.getAxisTitlePositionX(),this.position.getAxisTitlePositionY(),this.ID_AXIS_TITLE,this.labelText,this.style,ht.Bottom,ht.Center),this.svgGroup=s.group().id(this.ID_AXIS)}draw(){return this.labelText&&this.label.draw(),this.svgGroup.line(this.position.getAxisPositionX(),this.position.getAxisPositionY(),this.position.getAxisEndPositionX(),this.position.getAxisEndPositionY()).addClass(this.ID_AXIS+"-"+this.convertScenarioType()),this.height=this.svgGroup.height(),this}convertScenarioType(){return void 0===this.scenarioType||null==this.scenarioType?"default":`${this.scenarioType}`.slice(0,2)}}class vt{constructor(t,i,s,h,e,n,r,o=null){if(this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.scenarioLabel=null,this.barGroup=null,this.isVarianceBar=!1,this.overflowConfig=null,this.isOverflowing=!1,this.overdriveWidth=0,this.dimensions={barLength:0,xPos:0,yPos:0,labelXPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=h,this.isPrimaryBar=e,this.position=t,this.barStyles=i.barStyles,this.overflowConfig=o,this.scenarioGroup=n,this.styles=i,null!=n&&(this.barGroup=n.group().id(n.toString()+"_"+this.ID_RECT)),!0!==(null==s?void 0:s.isEmpty())&&null!=s.value){this.hasData=!0;let i=ht.Left;s.value<0&&(i=ht.Right),this.dimensions=this.createDimensions(t,s,h,e),this.label=new ft(this.scenarioGroup,this.dimensions.labelXPos,this.dimensions.yPos,this.ID_DATA_PREFIX,s.value,this.styles,ht.Center,i).setPoint(s.key),this.scenarioLabel=this.getScenarioLabel(r)}}setAsVariance(){var t;return this.isVarianceBar=!0,null===(t=this.label)||void 0===t||t.setToVarianceLabel(),this}isRelativeVariance(){var t;return this.isVarianceBar=!0,null===(t=this.label)||void 0===t||t.setToRelativeVarianceLabel(),this}updateLabelGroup(t){var i;return this.isEmpty()||null==t||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(t={percent:2,decimal:1},i=new m){var s,h;if(this.isEmpty()||null==this.dataPoint.getScenario())return this;let e=this.barStyles.getSVGStyle(this.dataPoint.getScenario());this.isVarianceBar&&(e=this.styles.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()));const n=this.convertToSVGStyle(e,"stroke");let r=this.convertToSVGStyle(e,"fill");const o=this.barStyles.getSVGStyle(this.dataPoint.getScenario()).fillpattern;if(null!=o){const t=this.styles.pattern.get(o);null!=t&&(r=t.pattern)}null===(s=this.scenarioGroup)||void 0===s||s.attr(O(this.dataPoint.key)),null===(h=this.barGroup)||void 0===h||h.attr(O(this.dataPoint.key,"element")),null!=this.barGroup&&(this.isOverflowing&&this.overflowConfig?this.drawOverdriveBar(r,n):this.barGroup.rect(this.dimensions.barLength,this.position.getBarWidth()).fill(r).stroke(n).cy(this.dimensions.yPos).x(this.dimensions.xPos)),this.drawBarDataLabel(t,i),this.drawScenarioLabel()}drawOverdriveBar(t,i){if(!this.barGroup||!this.overflowConfig)return;const s=this.position.getBarPositionX(),h=this.position.getBarWidth(),e=this.dimensions.barLength,{breakGap:n}=this.overflowConfig;this.dataPoint.getScaledUnit()<0?(this.barGroup.rect(e,h).fill(t).stroke(i).x(s-e).cy(this.dimensions.yPos),this.barGroup.rect(this.overdriveWidth,h).fill(t).stroke(i).x(s-e-n-this.overdriveWidth).cy(this.dimensions.yPos),this.drawBreakIndicator(s-e-n,n)):(this.barGroup.rect(e,h).fill(t).stroke(i).x(s).cy(this.dimensions.yPos),this.barGroup.rect(this.overdriveWidth,h).fill(t).stroke(i).x(s+e+n).cy(this.dimensions.yPos),this.drawBreakIndicator(s+e,n))}drawBreakIndicator(t,i){if(!this.barGroup)return;const s=this.position.getBarWidth(),h=this.dimensions.yPos-s/2,e=t+i/2,n=.35*i,r=s/3;let o=`M ${e-n} ${h}`;for(let t=0;t<3;t++)o+=` L ${e-n-.3*i} ${h+r*(t+.5)} L ${e-n} ${h+r*(t+1)}`;let a=`M ${e+n} ${h}`;for(let t=0;t<3;t++)a+=` L ${e+n+.3*i} ${h+r*(t+.5)} L ${e+n} ${h+r*(t+1)}`;this.barGroup.rect(i,s+2).fill("#ffffff").stroke("none").x(t).cy(this.dimensions.yPos),this.barGroup.path(o).fill("none").stroke({color:"#000000",width:1}),this.barGroup.path(a).fill("none").stroke({color:"#000000",width:1})}createDimensions(t,i,s,h){const e=i.getScaledUnit(),n=Math.abs(e);if(this.overflowConfig&&n>0){const r="ac"===i.getScenario()?this.overflowConfig.cutWidth:this.overflowConfig.cutWidth-this.overflowConfig.scenarioCutOffset;if(n>r){this.isOverflowing=!0;const{breakGap:i,overdriveZoneWidth:o,maxOverflow:a}=this.overflowConfig;this.overdriveWidth=a>0?(n-r)/a*o:0;const l=r+i+this.overdriveWidth;return e<0?{clipped:!1,barLength:r,xPos:t.getBarPositionX()-r,yPos:t.getBarPositionY(s,h),labelXPos:t.getLabelPositionX(-l),scenarioLabelXPos:t.getBarPositionX()-.5*r,scenarioLabelYPos:t.getBarPositionY(s,h)+t.getScenarioLabelPositionOffsetY(h)}:{clipped:!1,barLength:r,xPos:t.getBarPositionX(),yPos:t.getBarPositionY(s,h),labelXPos:t.getLabelPositionX(l),scenarioLabelXPos:t.getBarPositionX()+.5*r,scenarioLabelYPos:t.getBarPositionY(s,h)+t.getScenarioLabelPositionOffsetY(h)}}}return e<0?{clipped:!1,barLength:n,xPos:t.getBarPositionX()+e,yPos:t.getBarPositionY(s,h),labelXPos:this.position.getLabelPositionX(e),scenarioLabelXPos:this.position.getBarPositionX()-.5*n,scenarioLabelYPos:this.position.getBarPositionY(s,h)+this.position.getScenarioLabelPositionOffsetY(h)}:{clipped:!1,barLength:e,xPos:t.getBarPositionX(),yPos:t.getBarPositionY(s,h),labelXPos:this.position.getLabelPositionX(e),scenarioLabelXPos:this.position.getBarPositionX()+.5*n,scenarioLabelYPos:this.position.getBarPositionY(s,h)+this.position.getScenarioLabelPositionOffsetY(h)}}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}drawScenarioLabel(){null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.isVarianceBar||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw()}drawBarDataLabel(t,i=new m){var s;this.isPrimaryBar&&(null===(s=this.label)||void 0===s||s.draw(t,i))}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}getScenarioLabel(t){return new ft(this.scenarioGroup,-1,-1,this.ID_SCENARIO_PREFIX,t,this.styles,this.isPrimaryBar?ht.Top:ht.Bottom,ht.Center)}}class gt{constructor(t,i,s,h,e,n,r,o,a){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.FALLBACK_COLOUR="#000000",this.scenarioLabel=null,this._defaultMarkerPattern=null,this.dimensions={barLength:0,xPos:0,yPos:0,labelXPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.position=t,this.markerGroup=i||null,this.markerPattern=s||this._defaultMarkerPattern,this.styles=e,this.barStyles=e?e.barStyles:null,this.scenario=h,!0!==(null==n?void 0:n.isEmpty())&&(this.hasData=!0,this.pointKey=n.key,this.dimensions=this.createMarkerDimensions(n,r,a),this.scenarioLabel=this.getScenarioLabel(o,e,a))}createMarkerDimensions(t,i,s){return t.getScaledUnit()<0?{clipped:!1,labelXPos:0,barLength:Math.abs(t.getScaledUnit()),xPos:this.position.getMarkerPositionX()-Math.abs(t.getScaledUnit()),yPos:this.position.getMarkerPositionY(i,s),scenarioLabelXPos:this.position.getMarkerPositionX()-Math.abs(t.getScaledUnit()),scenarioLabelYPos:this.position.getMarkerPositionY(i,s)+this.position.getMarkerScenarioLabelPositionOffsetY(s)}:{clipped:!1,labelXPos:0,barLength:t.getScaledUnit(),xPos:this.position.getMarkerPositionX()+t.getScaledUnit(),yPos:this.position.getMarkerPositionY(i,s),scenarioLabelXPos:this.position.getMarkerPositionX()+t.getScaledUnit(),scenarioLabelYPos:this.position.getMarkerPositionY(i,s)+this.position.getMarkerScenarioLabelPositionOffsetY(s)}}getScenarioLabel(t,i,s){return null==this.markerGroup?null:new ft(this.markerGroup,-1,-1,this.ID_DATA_PREFIX,t,i,s?ht.Bottom:ht.Top,ht.Center)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}draw(){if(this.isEmpty())return this;const t=this.convertToSVGStyle(this.barStyles[this.getScenario()],"stroke");let i=this.convertToSVGStyle(this.barStyles[this.getScenario()],"fill");const s=this.barStyles[this.getScenario()];if(null!=s&&s.fillpattern){const t=this.styles.pattern.get(s.fillpattern);null!=t&&(i=t.pattern)}return this.markerGroup.attr(O(this.pointKey)),this.markerGroup.polygon(this.markerPattern.background).fill("#ffffff").cy(this.dimensions.yPos).cx(this.dimensions.xPos),this.markerGroup.polygon(this.markerPattern.foreground).fill(i).stroke(t).cy(this.dimensions.yPos).cx(this.dimensions.xPos).attr(O(this.pointKey,"element")),null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(),this}isEmpty(){return!1===this.hasData}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}class bt{constructor(t,i,s,h,e){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.dimensions={barLength:0,xPos:0,yPos:0,labelXPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=h,this.position=t,this.barStyles=i.barStyles,this.scenarioGroup=e,this.styles=i,this.barGroup=e.group().id(e.toString()+"_"+this.ID_RECT);const n=void 0===(null==s?void 0:s.value)&&null!=(null==s?void 0:s.scenario);if(!0!==(null==s?void 0:s.isEmpty())&&null!=s.value||n){this.hasData=!0,this.dimensions=this.createDimensions(t,s,h);let i=ht.Left;s.value<0&&(i=ht.Right),this.label=new ft(this.scenarioGroup,this.dimensions.labelXPos,this.dimensions.yPos,this.ID_DATA_PREFIX,n?N:s.value,this.styles,ht.Center,i),this.label.setToRelativeVarianceLabel().setPoint(s.key)}}updateLabelGroup(t){var i;return this.isEmpty()||null==t||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(){var t,i,s;if(void 0===(null===(t=this.dataPoint)||void 0===t?void 0:t.value))return null===(i=this.label)||void 0===i||i.draw(),this;if(this.isEmpty())return this;if(null==this.dimensions)return this;this.scenarioGroup.attr(O(this.dataPoint.key)),this.barGroup.attr(O(this.dataPoint.key,"element"));const h=this.styles.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()),e=h.stroke;let n=h.fill;const r=this.barStyles[this.dataPoint.getScenario()];if(null!=r&&r.fillpattern){const t=this.styles.pattern.get(r.fillpattern);null!=t&&null!=t.pattern&&(n=t.pattern)}this.drawNeedleHead(n,e),this.barGroup.rect(this.dimensions.barLength,this.position.getNeedleWidth()).fill(n).stroke(e).cy(this.dimensions.yPos).x(this.dimensions.xPos),null===(s=this.label)||void 0===s||s.draw()}createDimensions(t,i,s){return i.getScaledPercentUnit()<0?{barLength:Math.abs(i.getScaledPercentUnit()),xPos:t.getBarPositionX()+i.getScaledPercentUnit(),yPos:t.getBarCenterPositionY(s),labelXPos:this.position.getLabelPositionX(i.getScaledPercentUnit()-this.position.getNeedleWidth()),clipped:i.isClipped(),scenarioLabelXPos:0,scenarioLabelYPos:0}:{barLength:i.getScaledPercentUnit(),xPos:t.getBarPositionX(),yPos:t.getBarCenterPositionY(s),labelXPos:this.position.getLabelPositionX(i.getScaledPercentUnit()+this.position.getNeedleWidth()),clipped:i.isClipped(),scenarioLabelXPos:0,scenarioLabelYPos:0}}drawNeedleHead(t,i){if(null===this.dimensions)return;const s=this.styles.varianceStyles.needleHeadColour,h=this.styles.varianceStyles.needleHeadColour;if(this.dimensions.clipped){let s="13,0 4,-5 4,5 13,0 8,0 0,-5 0,5 8,0";null!=this.dataPoint.value&&this.dataPoint.value<0&&(s="0,0 9,-5 9,5 0,0 5,0 13,-5 13,5 5,0"),this.barGroup.polygon(s).fill(t).cx(this.getHeadXPosition()).cy(this.dimensions.yPos).fill(t).stroke(i)}else this.barGroup.rect(2*this.position.getNeedleWidth(),2*this.position.getNeedleWidth()).cx(this.getHeadXPosition()).cy(this.dimensions.yPos).fill(s).stroke(h)}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}getHeadXPosition(){let t=this.dimensions.xPos;return null!=this.dataPoint.value&&this.dataPoint.value>0&&(t+=this.dimensions.barLength),t}}class mt{constructor(t,i,s,h,e,n,r,o,a,l,c){this.hasData=!1,this.position=t,this.styles=i,this.dataPoint=s,this.index=h,this.segment=e,this.segmentIndex=r,this.stackMode=o,this.stack=a,this.group=c,this.barGroup=c.group().id(`stacked_bar_${h}_seg_${r}`),!0!==(null==s?void 0:s.isEmpty())&&null!=s.value&&(this.hasData=!0)}draw(t={percent:2,decimal:1},i=new m){if(!this.hasData||!Number.isFinite(this.dataPoint.value))return;const s=this.dataPoint.value,h=this.dataPoint.pixelPerUnit,e=this.position.getBarPositionX(),n=this.position.getBarWidth(),r=Math.abs(this.segment.end-this.segment.start)*h,o=e+Math.min(this.segment.start,this.segment.end)*h,a=this.position.getBarPositionY(this.index,!0),l=this.styles.stackColors,c=l[this.segmentIndex%l.length],d={color:c},f={color:c,width:.5};this.barGroup.attr(O(this.dataPoint.key,"element")),this.barGroup.rect(Math.max(r,.5),n).fill(d).stroke(f).cy(a).x(o);const p=r-6;if(p>0){const h=o+r/2;if(this.stackMode===u.RELATIVE||this.stackMode===u.ABSOLUTE_RELATIVE){const i=P.number(this.segment.share,"percent",t.percent,t.percent,1,this.styles.locale);new ft(this.group,h,a,"STACK_SEG",i,this.styles,ht.Center,ht.Center).setSegmentFill(c).setMaxWidth(p).setPoint(this.dataPoint.key).draw()}else new ft(this.group,h,a,"STACK_SEG",s,this.styles,ht.Center,ht.Center).setSegmentFill(c).setMaxWidth(p).setPoint(this.dataPoint.key).draw(t,i)}}drawTotalLabel(t={percent:2,decimal:1},i=new m,s){if(this.stackMode===u.RELATIVE)return;const h=this.stack.total<0,e=this.position.getLabelPositionX((h?0-this.stack.negative:this.stack.positive)*this.dataPoint.pixelPerUnit),n=this.position.getBarPositionY(this.index,!0);new ft(this.group,e,n,"STACK_TOTAL",this.stack.total,this.styles,ht.Center,h?ht.Right:ht.Left).setPoint(s,"total").draw(t,i)}}class wt{constructor(t,i,s,h,e){this.overflowConfig=null,this.i18n=e;const n=i.group().id("Scenario1"),r=i.group().id("Scenario2").insertBefore(n);this.svgGroups={parent:i,scenario1:n,scenario2:r,scenario3:i.group().id("Scenario3"),scenario4:i.group().id("Scenario4"),scenario1Label:i.group().id("label")},this.styles=s,this.position=t,this.elementCnt=h}setOverflowConfig(t){this.overflowConfig=t}isLastDataPoint(t){return this.elementCnt-1===t}isFirsttDataPoint(t){return 0===t}createPrimaryBar(t,i){var s,h,e,n;const r=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario1)||void 0===h?void 0:h.group().id(""+i),o=null===(n=null===(e=this.svgGroups)||void 0===e?void 0:e.scenario1Label)||void 0===n?void 0:n.group().id(""+i);let a=null;return this.isLastDataPoint(i)&&(a=`${this.i18n.get(t.scenario)||t.scenario}`),new vt(this.position,this.styles,t,i,!0,r,a,this.overflowConfig).updateLabelGroup(o)}createVarianceBar(t,i){var s,h,e,n;const r=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario1)||void 0===h?void 0:h.group().id(""+i),o=null===(n=null===(e=this.svgGroups)||void 0===e?void 0:e.scenario1Label)||void 0===n?void 0:n.group().id(""+i);let a=null;return this.isLastDataPoint(i)&&(a=`${this.i18n.get(t.scenario)||t.scenario}`),new vt(this.position,this.styles,t,i,!0,r,a,this.overflowConfig).updateLabelGroup(o).setAsVariance()}createRelativeVarianceBar(t,i){var s,h,e,n;const r=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario1)||void 0===h?void 0:h.group().id(""+i),o=null===(n=null===(e=this.svgGroups)||void 0===e?void 0:e.scenario1Label)||void 0===n?void 0:n.group().id(""+i);return new bt(this.position,this.styles,t,i,r).updateLabelGroup(o)}createSecondaryBar(t,i){var s,h;const e=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario2)||void 0===h?void 0:h.group().id(""+i);let n=null;return this.isFirsttDataPoint(i)&&(n=`${this.i18n.get(t.scenario)||t.scenario}`),new vt(this.position,this.styles,t,i,!1,e,n,this.overflowConfig)}createPrimaryMarker(t,i){var s,h;const e=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario3)||void 0===h?void 0:h.group().id(""+i),n=this.styles.pattern.get("marker-down")||{foreground:"0,0 1,0 1,1 0,1",background:"0,0 1,0 1,1 0,1",bgOffset:0};let r=null;return this.isFirstDataPoint(i)&&(r=`${this.i18n.get(t.scenario)||t.scenario}`),new gt(this.position,e,n,t.scenario,this.styles,t,i,r,!0)}createSecondaryMarker(t,i){var s,h;const e=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario4)||void 0===h?void 0:h.group().id(""+i),n=this.styles.pattern.get("marker-up")||{foreground:"0,0 1,0 1,1 0,1",background:"0,0 1,0 1,1 0,1",bgOffset:0};let r=null;return this.isLastDataPoint(i)&&(r=`${this.i18n.get(t.scenario)||t.scenario}`),new gt(this.position,e,n,t.scenario,this.styles,t,i,r,!1)}isFirstDataPoint(t){return 0===t}}class Pt{constructor(t,i,s,h,e){this.dataModel=[],this.variancesDataModel=[],this.title="",this.configTitle="",this.configVariances=[],this.smallestDataPointValue=new rt(0,it.AC1,1,it.NEU),this.highestDataPointValue=new rt(0,it.AC1,1,it.NEU),this.smallestVarianceDataPointValue=new rt(0,it.AC1,1,it.NEU),this.highestVarianceDataPointValue=new rt(0,it.AC1,1,it.NEU),this.pixelPerUnit=1,this.pixelPerPercentage=1,this.level=c.CATEGORY,this.hideCategories=!1,this.axisScenario=it.AC1,this.CSS_CATEGORIES="categories",this.state=J.DIRTY,this.titleLength=0,this.leftSideOffsetForHorizontalSync=0,this.limit=0,this.measureScale=new m,this.measureUnit="",this.dataFormatDigits={percent:2,decimal:1},this.stackConfig=null,this.scenarioPropOrder=[],this.overflowConfig=null,this.stackSides=E([]),this.stackLabelClearance={left:0,right:0},this.fromExpr="",this.rowCount=0,this.db=i,this.tableName=s,this.ruleSet=t||new y,this.i18n=this.createI18n(new Map),this.styles=e,this.setConfig(h),this.position=this.createElementPosition()}updatePosition(){this.position=this.createElementPosition()}createElementPosition(){this.titleLength=this.calculateTitleLength(0);let t=this.calculateLeftSideWidth(this.getVarianceType());const i=this.calculateCategoryWidth();return this.titleLength>t&&(t=this.titleLength),new Q(new Z(this.styles.padding),this.styles.scaleFactors,this.styles.fontStyles.size,this.dataModel.length,this.leftSideOffsetForHorizontalSync,this.titleLength,t,i,!!this.stackConfig&&0===this.variancesDataModel.length)}setStyles(t){this.styles=t}setRuleSet(t){this.ruleSet=t||new y}setConfig(t){var i,s;this.state=J.DIRTY,this.scenarioPropOrder=[...t.scenarios];const h=this.sortScenariosbyVisualisationRules(t.scenarios);this.hideCategories=t.hideCategories||!1,this.limit=t.limit,this.pixelPerUnit=t.pixelPerUnit||1,this.pixelPerPercentage=t.pixelPerPercentage||100,this.setSource(t.filter),this.level=t.level,this.dataModel=this.populateModel(h,t.level,t.sortOrder);for(const t of this.dataModel)for(const s of[t.scenario1,t.scenario2,t.scenario3,t.scenario4])null==s.value||Number.isNaN(s.value)||(s.key=Object.assign(Object.assign({},A(this.level,t.category)),{scenario:null!==(i=s.scenario)&&void 0!==i?i:void 0}));t.stackConfig&&t.stackConfig.by!==d.SCENARIOS&&this.populateDimensionStackSegments(h,t.stackConfig,t.level),this.variancesDataModel=this.populateVarianceModel(t.variances,this.dataModel),this.configTitle=t.title,this.configVariances=null!==(s=null==t?void 0:t.variances)&&void 0!==s?s:[],this.updateTitle(),this.smallestDataPointValue=this.findSmallestDataPointValue(this.dataModel),this.smallestVarianceDataPointValue=this.findSmallestDataPointValue(this.variancesDataModel),this.highestDataPointValue=this.findHighestDataPointValue(this.dataModel),this.highestVarianceDataPointValue=this.findHighestDataPointValue(this.variancesDataModel),this.axisScenario=this.setAxisScenario(t.variances),this.measureScale=t.measureScale,this.measureUnit=t.measureUnit,this.dataFormatDigits=t.dataFormatDigits,this.stackConfig=t.stackConfig,this.measureStacks(),this.updatePosition()}sortScenariosbyVisualisationRules(t){const i=this;return[...t].sort(((t,s)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(s))).reverse()}setI18n(t){this.i18n=this.createI18n(t),this.updateTitle()}updateTitle(){var t;this.title=this.configTitle||P.translateScenarioLabel(null===(t=this.configVariances)||void 0===t?void 0:t.toString(),this.i18n)}createI18n(t){this.state=J.DIRTY;const i=new Map([["SEPARATOR_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"," "],["thereof","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"]]);return new Map([...i,...t])}setSource(t){var i,s;if(this.state=J.DIRTY,this.queryError=void 0,this.fromExpr=V(this.db,this.tableName,t),this.fromExpr)try{const t=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(s=null===(i=t[0])||void 0===i?void 0:i.cnt)&&void 0!==s?s:0}catch(t){this.rowCount=0,this.failQuery(t)}else this.rowCount=0}getQueryError(){return this.queryError}failQuery(t){var i;null!==(i=this.queryError)&&void 0!==i||(this.queryError=z(t))}getUnitBarExtent(){var t,i;const s=this.isStacked(),h=this.getVarianceType(),e=h!==tt.NONE,n=e?this.highestVarianceDataPointValue:this.highestDataPointValue,r=e?this.smallestVarianceDataPointValue:this.smallestDataPointValue;return W({fixedDomain:s?this.stackSides.positive+this.stackSides.negative:void 0,relativeVariance:h===tt.RELATIVE,maxPositive:null!==(t=null==n?void 0:n.value)&&void 0!==t?t:0,minNegative:null!==(i=null==r?void 0:r.value)&&void 0!==i?i:0})}getPercentBarExtent(){var t,i,s,h;return D({relativeVariance:this.getVarianceType()===tt.RELATIVE,maxPositive:null!==(i=null===(t=this.highestVarianceDataPointValue)||void 0===t?void 0:t.value)&&void 0!==i?i:0,minNegative:null!==(h=null===(s=this.smallestVarianceDataPointValue)||void 0===s?void 0:s.value)&&void 0!==h?h:0})}getAllocatedCanvasWidth(){const t=this.position.getAxisPositionX(),i=this.calculateRightSideWidth(this.getVarianceType());let s=t+i+ +this.styles.padding.left+this.styles.padding.right;return i<this.titleLength/2&&(s+=this.titleLength/2),t<this.titleLength/2&&(s+=this.titleLength/2),s}getAllocatedCanvasHeight(){return this.position.getAxisEndPositionY()+this.position.spacings.labelToAxis+this.position.fontSize+this.styles.padding.bottom}patternToString(){return"<svg></svg>"}layout(){this.draw(new n)}toString(){const t=new n;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.svg()}applyFontToContainer(t){t.attr({"font-size":this.styles.fontStyles.size,"font-family":this.styles.fontStyles.family})}draw(t){this.cleanSVGforRedraw(t),this.applyFontToContainer(t),this.state===J.DIRTY&&(this.state=J.UP_TO_DATE),this.variancesDataModel&&this.variancesDataModel.length>0?(this.drawVarianceScenario(this.variancesDataModel,t),this.drawAxisAndLabels(this.variancesDataModel,t)):null!=this.stackConfig?(this.drawStackedScenarios(this.dataModel,t),this.drawStackedHeaders(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t,!0)):(this.drawScenarios(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t))}setPattern(t,i){this.styles.pattern.set(t,i)}calculateTitleLength(t){const i=S(this.title.length>7?this.title:"_______",{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width;return i<t?t:i/2}getFooter(){return 1===this.measureScale.value&&""===this.measureUnit?" ":P.translateScenarioLabel("in",this.i18n)+" "+this.measureScale.prefix+this.measureUnit}scenarioStyles(){const t=x(this.styles.barStyles,this.ruleSet);return t===this.styles.barStyles?this.styles:Object.assign(Object.create(Object.getPrototypeOf(this.styles)),this.styles,{barStyles:t})}setAxisScenario(t){let i=it.AC1;if(null!=t&&t.length>0){const s=new L(t.toString());s.isValid&&(i=k(this.ruleSet.getScenarioColorIndex(s.delta))+s.delta.slice(2))}return null===i&&(i=it.AC1),i}populateModel(t,i,s){if(0===this.rowCount||!this.fromExpr)return[];const h=[],e=this.createOrderStr(i,s),n=this.createSelectString(i,s),r=this.createGroupByStr(i,s);let o;try{o=this.db.exec(`SELECT ${n} ${t.length>0?","+t.map((t=>`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`)).join(","):""}\n FROM ${this.fromExpr}\n GROUP BY ${r}\n ORDER BY ${e}`)}catch(t){return this.failQuery(t),[]}return this.detectNaNCells(t,o),this.createDataRows(this.limit>0?o.slice(0,this.limit):o,h,t),this.crateRESTRow(o,t,h),h}detectNaNCells(t,i){i.forEach((i=>(t.forEach((t=>{const s=new L(t);!0===s.isValid?0!==i[s.base+"_cnt"]&&0!==i[s.delta+"_cnt"]||(i[t]=Number.NaN):0===i[t+"_cnt"]&&(i[t]=Number.NaN)})),i)))}crateRESTRow(t,i,s){if(this.limit<=0||this.limit>=t.length)return;const h=[];this.createDataRows(t.slice(this.limit),h,i);const e=(t,i)=>Number.isFinite(i)?(Number.isFinite(t)?t:0)+i:t,n=h.reduce((function(t,s){return{id:t.id,category:t.category,type:t.type,scenario1:new rt(e(t.scenario1.value,s.scenario1.value),i[0],t.scenario1.pixelPerUnit,it.NEU),scenario2:new rt(e(t.scenario2.value,s.scenario2.value),i[1],t.scenario2.pixelPerUnit,it.NEU),scenario3:new rt(e(t.scenario3.value,s.scenario3.value),i[2],t.scenario3.pixelPerUnit,it.NEU),scenario4:new rt(e(t.scenario4.value,s.scenario4.value),i[3],t.scenario4.pixelPerUnit,it.NEU)}}),{id:9999,category:"REST",type:tt.NONE,scenario1:new rt(NaN,i[0],this.pixelPerUnit,it.NEU),scenario2:new rt(NaN,i[1],this.pixelPerUnit,it.NEU),scenario3:new rt(NaN,i[2],this.pixelPerUnit,it.NEU),scenario4:new rt(NaN,i[3],this.pixelPerUnit,it.NEU)});s.push(n)}createDataRows(t,i,s){t.forEach(((t,h)=>{i.push({id:h,category:t.category,type:tt.NONE,scenario1:new rt(t[s[0]],s[0],this.pixelPerUnit,it.NEU),scenario2:new rt(t[s[1]],s[1],this.pixelPerUnit,it.NEU),scenario3:new rt(t[s[2]],s[2],this.pixelPerUnit,it.NEU),scenario4:new rt(t[s[3]],s[3],this.pixelPerUnit,it.NEU)})}))}createOrderStr(t,i){let s=`${t.toLowerCase()}`;return i.hierarchy.length>=1&&(s=i.hierarchy.map((t=>`${t} ${i.direction}`)).toString()),s}createSelectString(t,i){return t===c.CATEGORY&&i.hierarchy.includes(g.CATEGORYINDEX)?`${g.CATEGORYINDEX}, ${c.CATEGORY} as category`:t===c.ROWGROUP&&i.hierarchy.includes(g.ROWGROUPINDEX)?`${g.ROWGROUPINDEX}, ${c.ROWGROUP} as category`:t===c.SUBCATEGORY&&i.hierarchy.includes(g.SUBCATEGORYINDEX)?`${g.SUBCATEGORYINDEX}, ${c.SUBCATEGORY} as category`:`${t.toString()} as category`}createGroupByStr(t,i){return t===c.CATEGORY&&i.hierarchy.includes(g.CATEGORYINDEX)?`${g.CATEGORYINDEX}, ${c.CATEGORY}`:t===c.ROWGROUP&&i.hierarchy.includes(g.ROWGROUPINDEX)?`${g.ROWGROUPINDEX}, ${c.ROWGROUP}`:t===c.SUBCATEGORY&&i.hierarchy.includes(g.SUBCATEGORYINDEX)?`${g.SUBCATEGORYINDEX}, ${c.SUBCATEGORY}`:`${t.toString()}`}calculateCategoryWidth(){if(this.hideCategories)return 5;let t=0;for(const i of this.dataModel){const s=S(i.category,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"});s.width>t&&(t=s.width)}return 1.1125*t}findSmallestDataPointValue(t){let i=new rt(0,"default",this.pixelPerUnit,null);for(const s of t)for(const t of[s.scenario1,s.scenario2,s.scenario3,s.scenario4])null!=t&&null!=i.value&&t.value<i.value&&(i=t);return i}findHighestDataPointValue(t){let i=new rt(0,"default",this.pixelPerUnit,null);for(const s of t)for(const t of[s.scenario1,s.scenario2,s.scenario3,s.scenario4])null!=t&&null!=i.value&&t.value>i.value&&(i=t);return i}stackGroups(t){if(!this.stackConfig)return[];const i=this.stackConfig.by===d.SCENARIOS;let s=[];for(const h of i?["scenario1","scenario2","scenario3","scenario4"]:["scenario1"]){const i=t[h];i&&!i.isEmpty()&&null!=i.value&&s.push({value:i.value,scenario:i.scenario,dataPoint:i})}if(0===s.length)return[];const h=this.stackConfig.mode===u.RELATIVE?1:0,e=(t,i)=>({prefix:t,segments:i,layout:R(i.map((t=>t.value)),h),hasValue:i.some((t=>Number.isFinite(t.value)))});if(i){this.sortSegmentsByPropOrder(s);const t=new Map;for(const i of s){const s=C(i.scenario);t.has(s)||t.set(s,[]),t.get(s).push(i)}if(t.size>1){const i=[];for(const s of T)t.has(s)&&(i.push(e(s,t.get(s))),t.delete(s));for(const[s,h]of t)i.push(e(s,h));return i}}else t.stackSegments&&t.stackSegments.length>0&&(s=t.stackSegments.map((t=>({value:t.value,scenario:t.label,dataPoint:t.dataPoint}))));const n=t=>Number.isFinite(t.value)?t.value:0;return"asc"===this.stackConfig.order?s.sort(((t,i)=>n(t)-n(i))):"desc"===this.stackConfig.order&&s.sort(((t,i)=>n(i)-n(t))),[e("",s)]}measureStacks(){const t=[];this.stackLabelClearance={left:0,right:0};for(const i of this.dataModel){const{flipped:s,clearance:h}=this.stackLabelPlace(i),e=this.drawnStackLayouts(i),n=s?"right":"left";this.stackLabelClearance[n]=Math.max(this.stackLabelClearance[n],h),t.push(...e)}this.stackSides=E(t)}stackLabelPlace(t){const i=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;return B(this.drawnStackLayouts(t),(t=>{var s;return(null===(s=this.stackConfig)||void 0===s?void 0:s.mode)===u.RELATIVE?0:(i+this.calculateTotalLabelWidth(t.total))/this.pixelPerUnit}))}drawnStackLayouts(t){return this.stackGroups(t).filter((t=>t.hasValue)).map((t=>t.layout))}calculateTotalLabelWidth(t){const i=this.dataFormatDigits.decimal;return S(P.number(t,"decimal",i,i,this.measureScale.value,this.styles.locale),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width}isStacked(){return null!=this.stackConfig&&this.stackSides.positive+this.stackSides.negative>0}populateVarianceModel(t,i){const s=[];if(0===t.length)return s;let h=null;null!=i&&i.length>0&&(h=i[0]);for(const e in t){const n=new L(t[e]);if(n.isValid){const r=this.mapScenarios(n,h),o=n.direction;let a=this.pixelPerUnit;"dr"===n.type&&(a=this.pixelPerPercentage);for(const h in i){const l=new rt(this.calculateVariance(n,i[h],r),n.base,a,o);null===l.value||Number.isNaN(l.value)||(l.key=Object.assign(Object.assign({},A(this.level,i[h].category)),{scenario:t[e]})),s.push({id:Number(h),category:i[h].category,type:"dr"===n.type?tt.RELATIVE:tt.ABSOLUTE,scenario1:l,scenario2:new rt(null,null,null,null),scenario3:new rt(null,null,null,null),scenario4:new rt(null,null,null,null)})}}}return s}calculateVariance(t,i,s){const h=s.get(t.base),e=s.get(t.delta);return null==h||null==e?null:t.type===tt.RELATIVE?_(i[h].value-i[e].value,i[e].value):i[h].value-i[e].value}mapScenarios(t,i){const s=new Map;return null==i||["scenario1","scenario2","scenario3","scenario4"].forEach((h=>{i[h].scenario===t.delta?s.set(t.delta,h):i[h].scenario===t.base&&s.set(t.base,h)})),s}calculateTextBoxWidth(t){return S(P.number(t,"decimal",1,0,1,this.styles.locale),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width}calculatePercentageTextBoxWidth(t){let i=0;return t>=0&&(i+=S("+",{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width),i+=S(" %",{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width,S(P.number(t,"decimal",1,1,1,this.styles.locale),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width+i+i}cleanSVGforRedraw(t){t.clear()}drawAxisAndLabels(t,i,s=!1){const h=i.group().id("AxisAndDateLables");let e=!1;this.hideCategories||t.forEach(((t,i)=>{t.type===tt.RELATIVE&&(e=!0);let n=ht.Right,r=!0,o=0;if(s){const i=this.stackLabelPlace(t);r=!i.flipped,o=i.clearance*this.pixelPerUnit*(i.flipped?1:-1)}else t.scenario1.value<0&&(r=!1);r||(n=ht.Left),new ft(h,this.position.getCategoryPositionX(r)+o,this.position.getBarCenterPositionY(i),"",this.i18n.get(t.category)||t.category,this.styles,ht.Center,n).draw()})),new pt({scenarioType:this.axisScenario,labelText:this.title,isRelative:e},this.position,h,this.styles).draw()}drawScenarios(t,i){const s=i.group().id("Scenarios"),h=new wt(this.position,s,this.scenarioStyles(),t.length,this.i18n);h.setOverflowConfig(this.overflowConfig),t.forEach(((t,i)=>{h.createPrimaryBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale),h.createSecondaryBar(t.scenario2,i).draw(),h.createPrimaryMarker(t.scenario3,i).draw(),h.createSecondaryMarker(t.scenario4,i).draw()}))}drawVarianceScenario(t,i){const s=i.group().id("Scenarios"),h=new wt(this.position,s,this.scenarioStyles(),t.length,this.i18n);return h.setOverflowConfig(this.overflowConfig),t.forEach(((t,i)=>{t.type===tt.RELATIVE?h.createRelativeVarianceBar(t.scenario1,i).draw():h.createVarianceBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale)})),s}sortSegmentsByPropOrder(t){if(0===this.scenarioPropOrder.length)return;const i=this.scenarioPropOrder;t.sort(((t,s)=>{const h=i.indexOf(t.scenario),e=i.indexOf(s.scenario);return(-1===h?i.length:h)-(-1===e?i.length:e)}))}drawStackedScenarios(t,i){if(!this.stackConfig)return;const s=i.group().id("StackedScenarios"),h=this.stackConfig.by===d.SCENARIOS;t.forEach(((t,i)=>{const e=this.stackGroups(t);e.forEach(((n,r)=>{let o=null;n.segments.forEach(((t,a)=>{const l=new mt(this.position,this.styles,t.dataPoint,i,n.layout.segments[a],t.scenario,e.length>1?e.length-1-r:a,this.stackConfig.mode,n.layout,h,s);l.draw(this.dataFormatDigits,this.measureScale),o=l})),o&&n.hasValue&&o.drawTotalLabel(this.dataFormatDigits,this.measureScale,Object.assign(Object.assign({},A(this.level,t.category)),{scenario:e.length>1?n.prefix:void 0}))}))}))}drawStackedHeaders(t,i){if(!this.stackConfig||0===t.length)return;const s=t[0];if(this.stackConfig.by!==d.SCENARIOS&&(!s.stackSegments||0===s.stackSegments.length))return;const h=this.stackGroups(s);if(0===h.length)return;const e=i.group().id("StackedHeaders"),n=this.position.getBarPositionX(),r=this.position.getStackedHeaderPositionY(),o=(t,i)=>{new ft(e,t,r,"STACK_HEADER",i,this.styles,ht.Bottom,ht.Center).draw()};if(h.length>1)return void h.forEach((t=>{o(n+(t.layout.positive-t.layout.negative)/2*t.segments[0].dataPoint.pixelPerUnit,this.i18n.get(t.prefix+"1")||t.prefix.toUpperCase())}));const[a]=h;a.segments.forEach(((t,i)=>{const{start:s,end:h}=a.layout.segments[i];o(n+(s+h)/2*t.dataPoint.pixelPerUnit,this.i18n.get(t.scenario)||t.scenario)}))}getVarianceType(){return this.variancesDataModel.length>0?this.variancesDataModel[0].type:tt.NONE}calculateLeftSideWidth(t){var i,s,h;let e=0;const n=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;if(tt.NONE===t&&this.isStacked())this.stackSides.negative>0&&(e=this.stackSides.negative*this.pixelPerUnit,this.stackSides.minTotal<0&&(e+=n+this.calculateTotalLabelWidth(this.stackSides.minTotal))),this.stackLabelClearance.left>0&&(e=Math.max(e,this.stackLabelClearance.left*this.pixelPerUnit+this.calculateCategoryWidth()));else if(tt.NONE===t&&null!=(null===(i=this.smallestDataPointValue)||void 0===i?void 0:i.value)&&this.smallestDataPointValue.value<0){const t=this.calculateTextBoxWidth(this.smallestDataPointValue.value);e=Math.abs(this.smallestDataPointValue.getScaledUnit())+n+t}else if(tt.RELATIVE===t&&null!=(null===(s=this.smallestVarianceDataPointValue)||void 0===s?void 0:s.value)&&this.smallestVarianceDataPointValue.value<0){const t=this.calculatePercentageTextBoxWidth(this.smallestVarianceDataPointValue.value);e=Math.abs(this.smallestVarianceDataPointValue.getScaledPercentUnit())+n+t}else if(tt.ABSOLUTE===t&&null!=(null===(h=this.smallestVarianceDataPointValue)||void 0===h?void 0:h.value)&&this.smallestVarianceDataPointValue.value<0){const t=this.calculateTextBoxWidth(this.smallestVarianceDataPointValue.value);e=Math.abs(this.smallestVarianceDataPointValue.getScaledUnit())+n+t}return e<=this.titleLength?this.titleLength:e}calculateRightSideWidth(t){var i,s,h;if(this.isStacked()){const t=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar,i=this.calculateTextBoxWidth(this.stackSides.maxTotal);let s=this.stackSides.positive*this.pixelPerUnit+t+i;return this.stackSides.minTotal<0&&(s=Math.max(s,this.stackLabelClearance.right*this.pixelPerUnit+this.position.getCategoryToAxisSpaceing()+this.calculateCategoryWidth())),Math.max(s,this.titleLength)}let e=0;const n=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;if(tt.NONE===t&&null!=(null===(i=this.highestDataPointValue)||void 0===i?void 0:i.value)&&this.highestDataPointValue.value>=0){const t=this.calculateTextBoxWidth(this.highestDataPointValue.value);e=Math.abs(this.highestDataPointValue.getScaledUnit())+n+t}else if(tt.RELATIVE===t&&null!=(null===(s=this.highestVarianceDataPointValue)||void 0===s?void 0:s.value)&&this.highestVarianceDataPointValue.value>=0){const t=this.calculatePercentageTextBoxWidth(this.highestVarianceDataPointValue.value);e=Math.abs(this.highestVarianceDataPointValue.getScaledPercentUnit())+n+t}else if(tt.ABSOLUTE===t&&null!=(null===(h=this.highestVarianceDataPointValue)||void 0===h?void 0:h.value)&&this.highestVarianceDataPointValue.value>=0){const t=this.calculateTextBoxWidth(this.highestVarianceDataPointValue.value);e=Math.abs(this.highestVarianceDataPointValue.getScaledUnit())+n+t}return e<=this.titleLength?this.titleLength:e}populateDimensionStackSegments(t,i,s){if(0===this.rowCount||!this.fromExpr||0===t.length)return;const h={[c.ROWGROUP]:"category",[c.ROWGROUPINDEX]:"category",[c.CATEGORY]:"subCategory",[c.CATEGORYINDEX]:"subCategory"}[s];if(!h)return;const e=s.toString(),n=t[0];let r;try{r=this.db.exec(`SELECT [${e}] as displayGroup, [${h}] as stackLabel, SUM([${n}] * transformOperator(operation)) as stackValue FROM ${this.fromExpr} GROUP BY [${e}], [${h}]`)}catch(t){return void this.failQuery(t)}const o=new Map;for(const t of r){const i=t.displayGroup;o.has(i)||o.set(i,[]),null!=t.stackValue&&null!=t.stackLabel&&o.get(i).push({label:t.stackLabel,value:t.stackValue})}for(const t of this.dataModel){const i=o.get(t.category);t.stackSegments=i&&i.length>0?i.map((i=>{const s=new rt(i.value,n,this.pixelPerUnit,it.NEU);return s.key=Object.assign(Object.assign({},A(this.level,t.category)),{[h]:i.label,scenario:n}),{label:i.label,value:i.value,dataPoint:s}})):[]}}hasNoData(){return 0===this.dataModel.length}setAvailableWidth(t){if(this.pixelPerUnit<=0||t<=0)this.overflowConfig=null;else if(null==this.stackConfig){if(this.overflowConfig=this.calculateOverflowConfig(t),this.overflowConfig){const{cutWidth:t,overdriveZoneWidth:i,breakGap:s}=this.overflowConfig,h=t+i+s;this.variancesDataModel&&this.variancesDataModel.length>0?(this.highestVarianceDataPointValue.getScaledUnit()>t&&(this.highestVarianceDataPointValue=new rt(h,this.highestVarianceDataPointValue.scenario,1,this.highestVarianceDataPointValue.variance)),null!=this.smallestVarianceDataPointValue.value&&Math.abs(this.smallestVarianceDataPointValue.getScaledUnit())>t&&(this.smallestVarianceDataPointValue=new rt(-h,this.smallestVarianceDataPointValue.scenario,1,this.smallestVarianceDataPointValue.variance))):(this.highestDataPointValue.getScaledUnit()>t&&(this.highestDataPointValue=new rt(h,this.highestDataPointValue.scenario,1,this.highestDataPointValue.variance)),null!=this.smallestDataPointValue.value&&Math.abs(this.smallestDataPointValue.getScaledUnit())>t&&(this.smallestDataPointValue=new rt(-h,this.smallestDataPointValue.scenario,1,this.smallestDataPointValue.variance))),this.updatePosition()}}else this.overflowConfig=null}calculateOverflowConfig(t){const i=this.variancesDataModel&&this.variancesDataModel.length>0;if(this.getVarianceType()===tt.RELATIVE)return null;const s=i?this.highestVarianceDataPointValue:this.highestDataPointValue,h=i?this.smallestVarianceDataPointValue:this.smallestDataPointValue,e=s.getScaledUnit(),n=null!=h.value?Math.abs(h.getScaledUnit()):0,r=Math.max(e,n);if(r<=0)return null;const o=this.styles.fontStyles.size,a=o*this.styles.scaleFactors.labelToBar,l=1.5*o,c=.3*o,u=.8*o,d=t-this.position.getAxisPositionX()-this.styles.padding.left-this.styles.padding.right-a-this.calculateTextBoxWidth(s.value||0)-l-c;if(d<=u)return null;const f=d-u;return r<=f?null:{cutWidth:d,overdriveZoneWidth:l,breakGap:c,maxOverflow:r-f,scenarioCutOffset:u}}}const yt=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.chartTitle="",this.scenarios=[],this.variances=[],this.hideCategories=!1,this.pixelPerUnit=10,this.pixelPerPercentage=50,this.limit=0,this.i18n=new Map,this.order={hierarchy:[],direction:b.ASC},this.level=c.CATEGORY,this.filter="",this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.dataFormatDigits={percent:2,decimal:1},this.stackConfig=null,this.parentDimensions={width:0,height:0},G(this)}getDb(){return this.stores||(this.stores=X(this.element)),this.stores.db.db}render(){var t,i,e,n;if(void 0===this.chart||void 0!==this.queryError)return s(h,null);if(this.chart.hasNoData()){const i=null!==(t=this.i18n.get("no-data"))&&void 0!==t?t:"No Data";return s(h,{class:"no-data"},s("div",{class:"empty-state"},i))}return s(h,null,s("div",{innerHTML:null===(i=this.pattern)||void 0===i?void 0:i.toString(),class:"hidePatternContainer",style:{width:"0",height:"0",overflow:"hidden"}}),s("div",{class:this.showMeasureScale?"footer":"footer-hide"},null===(e=this.chart)||void 0===e?void 0:e.getFooter()),s("div",{innerHTML:null===(n=this.chart)||void 0===n?void 0:n.toString()}))}syncQueryError(){var t,i;this.queryError=null!==(t=this.measureScaleError)&&void 0!==t?t:null===(i=this.chart)||void 0===i?void 0:i.getQueryError(),H(this.errors,this.queryError)}async componentWillLoad(){var t;const i=this.getDb(),s=this.prepareConfig(),h=this.prepareStyle();this.chart=new Pt(new y(this.ruleSetConfig),i,this.tableName,s,h),this.chart.setI18n(this.i18n);const e=s.pixelPerUnit<=0;this.autoFitScaling(s,h),this.chart.setAvailableWidth(e?0:(null===(t=this.parentDimensions)||void 0===t?void 0:t.width)||0),this.pattern=new q(this.chart.styles),this.chart.setPattern("hatched",this.pattern.getFCPolygonPattern()),this.syncQueryError()}async componentWillUpdate(){var t;if(null==this.chart)return;const i=this.prepareConfig(),s=this.prepareStyle();this.chart.setI18n(this.i18n),this.chart.setStyles(s),this.chart.setRuleSet(new y(this.ruleSetConfig)),this.chart.setConfig(i);const h=i.pixelPerUnit<=0;this.autoFitScaling(i,s),this.chart.setAvailableWidth(h?0:(null===(t=this.parentDimensions)||void 0===t?void 0:t.width)||0),this.pattern=new q(this.chart.styles),this.chart.setPattern("hatched",this.pattern.getFCPolygonPattern()),this.syncQueryError()}autoFitScaling(t,i){var s;const h=t.pixelPerUnit<=0,e=t.pixelPerPercentage<=0;if(!h&&!e)return;const n=()=>{var i;null===(i=this.reportAutoScaling)||void 0===i||i.call(this,{unit:h?t.pixelPerUnit:void 0,percentage:e?t.pixelPerPercentage:void 0})},r=null===(s=this.parentDimensions)||void 0===s?void 0:s.width,o=this.getDb(),a=()=>{this.chart=new Pt(new y(this.ruleSetConfig),o,this.tableName,t,i),this.chart.setI18n(this.i18n)},l=()=>(this.chart.layout(),this.chart.getAllocatedCanvasWidth());if(!r||r<=0)return h&&(t.pixelPerUnit=1),e&&(t.pixelPerPercentage=50),a(),void n();h&&(t.pixelPerUnit=1),e&&(t.pixelPerPercentage=1),a();let c=l();if(c<=0)return void n();const u=Math.max(Y,.9*r/c);let d=!1,f=!1,p=null;for(let i=0;i<=3;i++){const i=j({target:r,measured:c,unitExtent:h?this.chart.getUnitBarExtent():0,pctExtent:e?this.chart.getPercentBarExtent():0,currentPpu:t.pixelPerUnit,currentPpp:t.pixelPerPercentage});if(void 0===i.ppu&&void 0===i.ppp)break;if(h&&void 0!==i.ppu&&(t.pixelPerUnit=i.ppu,d=!0),e&&void 0!==i.ppp&&(t.pixelPerPercentage=i.ppp,f=!0),a(),c=l(),c<=r+.5&&(p={ppu:t.pixelPerUnit,ppp:t.pixelPerPercentage},c>=.98*r))break}let v=!1;if(h&&!d&&(t.pixelPerUnit=u,v=!0),e&&!f&&(t.pixelPerPercentage=u,v=!0),c>r+.5){if(p)d&&(t.pixelPerUnit=p.ppu),f&&(t.pixelPerPercentage=p.ppp);else{const i=r/c;h&&(t.pixelPerUnit=Math.max(Y,t.pixelPerUnit*i)),e&&(t.pixelPerPercentage=Math.max(Y,t.pixelPerPercentage*i))}v=!0}v&&a(),n()}async componentWillRender(){}componentDidLoad(){}componentDidUpdate(){}prepareConfig(){const t=this.getDb(),i=V(t,this.tableName,this.filter);return this.measureScaleError=void 0,new nt(new at,new v(new F),new F,new p,t,i,(t=>{this.measureScaleError=z(t)})).adapt({scenarios:this.scenarios,variances:this.variances,title:this.chartTitle,hideCategories:this.hideCategories,pixelPerUnit:this.pixelPerUnit,pixelPerPercentage:this.pixelPerPercentage,level:this.level,limit:this.limit,sortOrder:this.order,filter:this.filter,measureScale:this.measureScale,measureUnit:this.measureUnit,showMeasureScale:this.showMeasureScale,dataFormatDigits:this.dataFormatDigits,stackConfig:this.stackConfig})}prepareStyle(){var t,i;const s=new ct(new dt,new r,new o(new $),new U(new $),new a).adapt(this.styles);return s.locale=(null===(i=null===(t=X(this.element).context)||void 0===t?void 0:t.state)||void 0===i?void 0:i.locale)||"de",s}get element(){return this}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}svg#drawCanvas{display:block}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure-renderer",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],chartTitle:[1,"chart-title"],scenarios:[16],variances:[16],hideCategories:[4,"hide-categories"],pixelPerUnit:[2,"pixel-per-unit"],pixelPerPercentage:[2,"pixel-per-percentage"],reportAutoScaling:[16],errors:[16],limit:[2],styles:[1040],i18n:[1040],order:[16],level:[1],filter:[1],measureScale:[1,"measure-scale"],measureUnit:[1,"measure-unit"],showMeasureScale:[4,"show-measure-scale"],dataFormatDigits:[16],stackConfig:[16],parentDimensions:[16],ruleSetConfig:[16]}]);function St(){"undefined"!=typeof customElements&&["bn-chart-structure-renderer"].forEach((t=>{"bn-chart-structure-renderer"===t&&(customElements.get(e(t))||customElements.define(e(t),yt))}))}export{yt as B,St as d}
@@ -1 +1 @@
1
- import{S as n,a as t,A as r,b as o,T as u,D as e,c as i,M as a,d as s}from"./p-BQMKgvEC.js";import{i as c}from"./p-DCPLGEs_.js";import{D as l,a as f}from"./p-xhiPDAZa.js";import{O as d,a as v}from"./p-CxPSvrcF.js";import{r as m}from"./p-BpsXOtoW.js";function S(n){return null==n||""===n||"null"===n}function p(t){return S(t)||"auto"===t.trim().toLowerCase()?[]:O((null==t?void 0:t.split(",").filter((t=>!(t.toUpperCase().trim()in n)))).toString())}function O(r){return S(r)?[]:r.replace(";",",").split(",").filter((r=>{var o,u,e;const i=r.split("_"),a=null===(o=i[0])||void 0===o?void 0:o.replace(/^dr|^d/,"").toUpperCase().trim(),s=null===(u=i[1])||void 0===u?void 0:u.toUpperCase().trim(),c=null===(e=i[2])||void 0===e?void 0:e.toUpperCase().trim();return 3!==i.length||!(a in n)||!(s in n)||!(c in t)}))}function b(t){return S(t)?[]:O(t.split(",").filter((t=>!(t.toUpperCase().trim()in n))).toString())}function y(n){return S(n)||"auto"===n.trim().toLowerCase()?[]:O(n.split(",").filter((n=>!(n.toUpperCase()in d))).toString())}function N(n){return!S(n)&&Number.isInteger(Number(n))}function J(n){return!S(n)&&!Number.isNaN(Number(n))}function h(n){return!S(n)&&(null==n?void 0:n.toUpperCase())in v}function j(n){return"auto"===(null==n?void 0:n.toLowerCase())||(null==n?void 0:n.toUpperCase())in r}function A(n){if(S(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 k(n){const t=Date.parse(n);return Number.isInteger(t)}function T(n){return(null==n?void 0:n.toUpperCase())in f}function g(n){return(null==n?void 0:n.toUpperCase())in l}function E(n){return(null==n?void 0:n.toUpperCase())in o}function G(n){return!S(n)&&(null==n?void 0:n.toUpperCase())in e}function C(n){return!S(n)&&(null==n?void 0:n.toUpperCase())in i}function D(n){if(S(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 I(n){if(S(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||!c(n))).map((([n,t])=>`${n}: ${t}`))}catch(n){console.error("validateAttributesJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function P(n){if(S(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 $(n){return(null==n?void 0:n.trim().toUpperCase())in a}function x(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 M(n){return(null==n?void 0:n.toUpperCase().trim())in s}function w(n){return(null==n?void 0:n.toUpperCase().trim())in u}function L(n){if(S(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 _(n){if(S(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 q(n){return!S(n)&&null!==m(n)}export{O as a,y as b,h as c,A as d,k as e,g as f,T as g,N as h,S as i,q as j,j as k,x as l,_ as m,J as n,E as o,b as p,w as q,G as r,C as s,D as t,P as u,p as v,$ as w,M as x,L as y,I as z}
1
+ import{S as n,a as t,A as r,b as o,T as u,D as e,c as i,M as a,d as s}from"./p-D5LDmR4u.js";import{i as c}from"./p-DCPLGEs_.js";import{D as l,a as f}from"./p-xhiPDAZa.js";import{O as d,a as v}from"./p-BNWZoAip.js";import{r as m}from"./p-CLkpoHdg.js";function p(n){return null==n||""===n||"null"===n}function S(t){return p(t)||"auto"===t.trim().toLowerCase()?[]:N((null==t?void 0:t.split(",").filter((t=>!(t.toUpperCase().trim()in n)))).toString())}function N(r){return p(r)?[]:r.replace(";",",").split(",").filter((r=>{var o,u,e;const i=r.split("_"),a=null===(o=i[0])||void 0===o?void 0:o.replace(/^dr|^d/,"").toUpperCase().trim(),s=null===(u=i[1])||void 0===u?void 0:u.toUpperCase().trim(),c=null===(e=i[2])||void 0===e?void 0:e.toUpperCase().trim();return 3!==i.length||!(a in n)||!(s in n)||!(c in t)}))}function b(t){return p(t)?[]:N(t.split(",").filter((t=>!(t.toUpperCase().trim()in n))).toString())}function y(n){return p(n)||"auto"===n.trim().toLowerCase()?[]:N(n.split(",").filter((n=>!(n.toUpperCase()in d))).toString())}function O(n){return!p(n)&&Number.isInteger(Number(n))}function J(n){return!p(n)&&!Number.isNaN(Number(n))}function A(n){return!p(n)&&(null==n?void 0:n.toUpperCase())in v}function h(n){return"auto"===(null==n?void 0:n.toLowerCase())||(null==n?void 0:n.toUpperCase())in r}function j(n){if(p(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 k(n){const t=Date.parse(n);return Number.isInteger(t)}function D(n){return(null==n?void 0:n.toUpperCase())in f}function T(n){return(null==n?void 0:n.toUpperCase())in l}function g(n){return(null==n?void 0:n.toUpperCase())in o}function G(n){return!p(n)&&(null==n?void 0:n.toUpperCase())in e}function E(n){return!p(n)&&(null==n?void 0:n.toUpperCase())in i}function I(n){if(p(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 L(n){if(p(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||!c(n))).map((([n,t])=>`${n}: ${t}`))}catch(n){console.error("validateAttributesJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function $(n){if(p(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 C(n){return(null==n?void 0:n.trim().toUpperCase())in a}function P(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 w(n){return(null==n?void 0:n.toUpperCase().trim())in s}function x(n){return(null==n?void 0:n.toUpperCase().trim())in u}function M(n){if(p(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 Z(n){if(p(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 _(n){return!p(n)&&null!==m(n)}export{N as a,y as b,A as c,j as d,k as e,T as f,D as g,O as h,p as i,_ as j,h as k,P as l,Z as m,J as n,g as o,b as p,x as q,G as r,E as s,I as t,$ as u,S as v,C as w,w as x,M as y,L as z}
@@ -0,0 +1 @@
1
+ import{h as t,p as e,H as o,a as i,t as n}from"./p-D6YGOYV1.js";import{m as s,a as r,b as a}from"./p-DSkyHSIL.js";import{p as l,n as h,r as c,d as u}from"./p-DHAoxu6M.js";import{F as d,Q as f,V as p,s as $,a as m,I as v,b as g}from"./p-M6hn0BuZ.js";import{S as b,I as w,D as R,C as S,d as y,M as E}from"./p-D5LDmR4u.js";import{N as O,r as M}from"./p-fCjsrD7I.js";import{D as U,w as G}from"./p-DEHnizot.js";import{D as N,b as T}from"./p-xhiPDAZa.js";import{F as _}from"./p-DCPLGEs_.js";import{d as C,g as L}from"./p-BcOud3dQ.js";import{D as x,a as P,b as k}from"./p-VIw66ez1.js";import{A}from"./p-C-oNdJj9.js";import{S as D}from"./p-BT2WH_CP.js";import{c as W}from"./p-BNWZoAip.js";import{S as B}from"./p-CeE4_3wQ.js";import{w as F}from"./p-C6XrNN2m.js";var Y,H,I,j,z;!function(t){t[t.ALL=-1]="ALL"}(Y||(Y={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(H||(H={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(I||(I={})),function(t){t.ASC="asc",t.DESC="desc"}(j||(j={})),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"}(z||(z={}));const V="none",Q="setname";function X(t){return t===Q?"COALESCE([setname],[setName])":`normalizeDate([date], '${t}')`}function Z(t){if(null==t)return"";if("string"==typeof t)return t.trim();const e=q(t);return e?e.toISO():String(t)}function q(t){if(null!=t){if("string"==typeof t){const e=U.fromISO(t,{zone:"utc"});return e.isValid?e:void 0}if("number"==typeof t){const e=U.fromMillis(t,{zone:"utc"});return e.isValid?e:void 0}if("boolean"==typeof t.isValid)return t.isValid?t:void 0}}const K=/[\s\u200e\u200f\u061c]*[%\u066a][\s\u200e\u200f\u061c]*/;class J{constructor(t,e,o,i,n,s,r,a,l){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=e,this.value=o,this.prefix=s||"",this.cssStyle=i||"",this.prefixStyle=r||"prefix",this.type=n,this.mark=void 0,this.colSpan=a||1,this.measureScale=l||1}getAsHeaderList(){if(null==this.value)return[""];const t=[];for(const e of this.value.toString().split("<br/>"))t.push(e);return t}draw(t,e){let o=this.value;if("undefined"===o||void 0===o||null==o)return"";if(Number.isNaN(Number(o)))return o;if(""===this.type||void 0===this.type||null==this.type)return o;let i=t.percent,n=t.percent;return"percentpoint"===this.type?d.number(Number(o),"percent",i,n,1,e).replace(K,""):("decimal"===this.type&&(o=+o/this.measureScale,i=t.decimal,n=t.decimal),d.number(Number(o),this.type,i,n,1,e))}drawPrefix(){return null==this.prefix?"":this.prefix}}class tt{constructor(t,e,o){this.index=t,this.groupindex=e,this.type=o,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case z.HEADER:return"groupheader";case z.SEPERATORLINE:return"";case z.DRILLELEMENT:return"ofit";case z.PARTELEMENT:return"partof";case z.STANDARD:return"";case z.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,e,o,i,n,s,r,a,l,h=!1,c,u=1,d){let f=s;"category"===e&&null!=a&&(f=`category-${a.toString()}`),this.type===z.HEADER?f="headerlabel":this.type===z.SEPERATORLINE&&(f=null!=s?s:e),this.type===z.PARTELEMENT&&("percent"===i&&(t="-"),"category"!==e&&"operation"!==e&&(i="percent",f="")),("-"===t||t===O&&"percent"===i)&&(f="");let p="prefix-first";r&&(p="prefix-second"),o&&(f=`${f} ${o}`);const $=new J(e,this.elements.length,t,f,i,n,p,u,l);$.isBarChart=h,$.columnStats=c,$.waterfall=d,this.elements.push($)}}const et=.85;function ot(t,e){return Math.max(0,(t-.5)*e)}function it(t,e){return Math.max(1,(t?1:0)+(e?1:0))}function nt(t,e,o,i){const n=ot(t,e),s=it(o,i),r=Math.min(2.85*e,n/(2*s)),a=(n-r*s)/s,l=Math.min(.3*e,.2*a),h=.15*a;return{totalWidth:n,labelAreaWidth:r,maxBarWidth:a,axisX:o?r+a:0,breakGap:l,overdriveZoneWidth:h,cutWidth:Math.max(0,a-l-h),labelGap:.3*e}}function st(t,e,o,i){const n=ot(t,e),s=it(o,i),r=Math.min(3.375*e,n/2),a=n-r,l=a/s,h=Math.min(.375*e,.2*l);return{totalWidth:n,labelAreaWidth:r,maxPinLength:Math.max(0,l-h),pinPadding:h,axisX:o?l:0,labelX:a+.3*e}}const rt={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},at="#666666";function lt(t,e){return`pattern-${t}-${e.replace("#","")}`}const ht=({styles:e})=>{const o=e.scaleFactor,i=6*o,n=[{id:lt("pos",e.positive.stroke),stroke:e.positive.stroke,fill:e.positive.fill},{id:lt("neg",e.negative.stroke),stroke:e.negative.stroke,fill:e.negative.fill},{id:lt("neu",e.neutral.stroke),stroke:e.neutral.stroke,fill:e.neutral.fill},...["ac","pp","fc","pl"].map((t=>({id:lt(t,e.scenarios[t].stroke),stroke:e.scenarios[t].stroke,fill:e.scenarios[t].fill})))];return t("defs",null,n.map((e=>t("pattern",{id:e.id,patternUnits:"userSpaceOnUse",width:i,height:i},t("rect",{width:i,height:i,fill:"#ffffff"}),t("line",{x1:"0",y1:i,x2:i,y2:"0",stroke:e.stroke,"stroke-width":1.5*o})))))};function ct(t,e,o=1,i,n=0){const s=t>=0?"+":"";if(e){const e=e=>s+d.number(t,"percent",e,e,1,i);let o=Math.min(20,Math.max(0,Math.trunc(n)||0));for(;o>0&&e(o).length>7;)o--;return e(o)}const r=t/o,a=Math.abs(r);let l=1,h="";return a>=9995e5?(l=1e9,h="B"):a>=999500?(l=1e6,h="M"):a>=999.5&&(l=1e3,h="K"),s+d.number(r/l,"decimal",a>=10*l?0:1,0,1,i)+h}function ut(t){const e=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(e)}function dt(t){const e=t.slice(0,2).toLowerCase();return"pp"===e?"pp":"fc"===e?"fc":"pl"===e?"pl":"ac"}function ft(t,e,o,i){return ut(t)?function(t,e){const o=dt(t);return e.scenarios[o]}(t,i):function(t,e,o){const i=t>=0;return e?i?o.positive:o.negative:i?o.negative:o.positive}(e,o,i)}function pt(t,e){const o=t.fillpattern;return"hatched"===o?`url(#${lt(e,t.stroke)})`:"outlined"===o?"transparent":t.fill}function $t(t){return"outlined"===t.fillpattern?{stroke:t.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0}}const mt=e=>{const{value:o,scenario:i,columnStats:n,height:s,isPositiveGood:r,formattedValue:a,measureScale:l,locale:h,columnWidthEm:c=10,styles:u=rt}=e,d=u.scaleFactor,f=u.fontSize,p=n.min<0,$=n.max>0,{totalWidth:m,axisX:v,breakGap:g,overdriveZoneWidth:b,cutWidth:w,labelGap:R}=nt(c,u.emPx,p,$),S=Math.abs(o)*u.unitScaling*f,y=S-w>1e-6,E=Math.max(0,n.absMax*u.unitScaling*f-w),O=Math.max(0,S-w),M=E>0?O/E*b:0,U=2*d,G=s-2*U,N=U,T=o>=0,_=ft(i,o,r,u),C=pt(_,ut(i)?dt(i):r?T?"pos":"neg":T?"neg":"pos"),{stroke:L,strokeWidth:x}=$t(_),P=a||ct(o,!1,l,h),k=y?w:S,A=y?w+g+M:S,D=T?v+A+R:v-A-R,W=T?"start":"end";return t("svg",{width:m,height:s,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},t(ht,{styles:u}),t("line",{x1:v,y1:0,x2:v,y2:s,stroke:at,"stroke-width":1*d}),k>0&&t("rect",{x:T?v:v-k,y:N,width:k,height:G,fill:C,stroke:L,"stroke-width":x*d}),y&&M>0&&t("rect",{x:T?v+w+g:v-w-g-M,y:N,width:M,height:G,fill:C,stroke:L,"stroke-width":x*d}),y&&function(e,o,i,n,s){const r=e+o/2,a=.35*o,l=n/3,h=.3*o;let c=`M ${r-a} ${i}`;for(let t=0;t<3;t++)c+=` L ${r-a-h} ${i+l*(t+.5)} L ${r-a} ${i+l*(t+1)}`;let u=`M ${r+a} ${i}`;for(let t=0;t<3;t++)u+=` L ${r+a+h} ${i+l*(t+.5)} L ${r+a} ${i+l*(t+1)}`;return[t("rect",{x:e,y:i-1,width:o,height:n+2,fill:"#ffffff"}),t("path",{d:c,fill:"none",stroke:"#000000","stroke-width":1*s}),t("path",{d:u,fill:"none",stroke:"#000000","stroke-width":1*s})]}(T?v+w:v-w-g,g,N,G,d),t("text",{x:D,y:s/2,dy:"0.35em","text-anchor":W,fill:u.fontColor,"font-size":f,"font-family":u.fontFamily},P))},vt=e=>{const{value:o,scenario:i,columnStats:n,height:s,isPositiveGood:r,formattedValue:a,measureScale:l,locale:h,percentDigits:c,columnWidthEm:u=10,styles:d=rt}=e,f=d.scaleFactor,p=d.fontSize,$=n.min<0,m=n.max>0,{totalWidth:v,maxPinLength:g,axisX:b,labelX:w}=st(u,d.emPx,$,m),R=s/2,S=100*Math.abs(o)*d.percentageScaling*p,y=S>g,E=Math.min(S,g),O=o>=0,M=O?b+E:b-E,U=ft(i,o,r,d),G=3*f,N=a||ct(o,!0,l,h,c);return t("svg",{width:v,height:s,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},t("line",{x1:b,y1:0,x2:b,y2:s,stroke:at,"stroke-width":1*f}),!y&&t("circle",{cx:M,cy:R,r:G,fill:d.fontColor}),t("line",{x1:b,y1:R,x2:M,y2:R,stroke:U.fill,"stroke-width":2*f}),y&&O&&t("polygon",{points:`${b+g},${R} ${b+g-6*f},${R-3*f} ${b+g-6*f},${R+3*f}`,fill:U.fill}),y&&!O&&t("polygon",{points:`${b-g},${R} ${b-g+6*f},${R-3*f} ${b-g+6*f},${R+3*f}`,fill:U.fill}),t("text",{x:w,y:s/2,dy:"0.35em","text-anchor":"start",fill:d.fontColor,"font-size":p,"font-style":"italic","font-family":d.fontFamily},N))},gt=e=>{const{value:o,columnStats:i,isRelative:n,styles:s=rt}=e;return null==o||isNaN(o)||!i||0===i.absMax?t("span",{class:"bar-chart-empty",style:{color:s.fontColor,fontStyle:"italic"}},"-"):t(n?vt:mt,Object.assign({},e))},bt=e=>{const{value:o,scenario:i,height:n,measureScale:s,locale:r,columnWidthEm:a=10,styles:l=rt,waterfall:h}=e,c=l.scaleFactor,u=l.fontSize,d=h.max-h.min;if(null==o||isNaN(o)||d<=0)return t("span",{class:"bar-chart-empty",style:{color:l.fontColor,fontStyle:"italic"}},"-");const{totalWidth:f,labelAreaWidth:p,barAreaWidth:$,labelGap:m}=function(t,e){const o=ot(t,e),i=Math.min(2.85*e,o/4);return{totalWidth:o,labelAreaWidth:i,barAreaWidth:o-2*i,labelGap:.3*e}}(a,l.emPx),v=$/d,g=t=>p+(t-h.min)*v,b=2*c,w=n-2*b,R=b,S=g(0),y=g(h.start),E=g(h.end),O=Math.min(y,E),M=Math.abs(E-y),U=ft(i,o,!1,l),G=pt(U,dt(i)),{stroke:N,strokeWidth:T}=$t(U),_=ct(o,"partof"===h.kind,s,r).replace(/^\+/,""),C=E<y,L=C?O-m:O+M+m,x=C?"end":"start";return t("svg",{width:f,height:n,class:"cell-bar-chart waterfall-bar",style:{overflow:"visible"}},t(ht,{styles:l}),t("line",{x1:S,y1:0,x2:S,y2:n,stroke:at,"stroke-width":1*c}),void 0!==h.parentStart&&void 0!==h.parentEnd&&t("line",{x1:g(h.parentStart),y1:0,x2:g(h.parentStart),y2:n,stroke:at,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),void 0!==h.parentStart&&void 0!==h.parentEnd&&t("line",{x1:g(h.parentEnd),y1:0,x2:g(h.parentEnd),y2:n,stroke:at,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),M>0&&t("rect",{x:O,y:R,width:M,height:w,fill:G,stroke:N,"stroke-width":T*c}),t("text",{x:L,y:n/2,dy:"0.35em","text-anchor":x,fill:l.fontColor,"font-size":u,"font-family":l.fontFamily},_))},wt=`IFNULL(${f.ROWGROUP}, '')`;class Rt{constructor(t){this.groups=[f.CATEGORY,f.CATEGORYINDEX],I.OPT!==t.type&&I.OPTNOTOTAL!==t.type||this.groups.unshift(f.OPERATION),t.grouped&&(this.groups.push(f.ROWGROUP),this.groups.push(f.ROWGROUPINDEX))}toString(){return this.groups.map((t=>t===f.ROWGROUP?wt:t)).toString()}select(){return this.groups.map((t=>t===f.ROWGROUP?`${wt} as ${t}`:t)).toString()}noCategory(){return this.groups.filter((t=>t!==f.CATEGORY))}toArray(){return this.groups}}class St{constructor(t,e){this.hasPartOf=!1,this.params=[],this.hasBlankRowGroup=!1,this.config=t,this.i18n=e}execute(t,e){var o;this.db=t,this.fromExpr=e;for(const t of[...this.config.scenarios,...this.config.categoryThereOf.keys()])if(!_.test(t))throw new Error(`invalid identifier "${t}"`);const i=[],n=[],s=[],r=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(),l=this.getRelativeScenarios(),h=this.config.attributes.map((t=>this.translateAttributeSQL(t))).toString(),c=new Rt(this.config);let u=["",""];this.config.sortOrder.hierarchy.length>0&&(u=this.createOrderString(this.config.sortOrder)),this.hasPartOf=this.checkConfigForPartOf();const{hierarchy:d,direction:p}=this.config.sortOrder,$=d.filter((t=>t===f.ROWGROUP||t===f.ROWGROUPINDEX||t.toUpperCase()in b)),m=$.filter((t=>t.toUpperCase()in b)).map((t=>`, SUM(${t} * transformOperator(operation)) as ${t}`)).join(""),v=$.length>0?$.map((t=>`${t} ${p}`)).toString():`${f.ROWGROUPINDEX} asc`,g=t.exec(`SELECT COUNT(DISTINCT ${f.CATEGORY}) as ${f.TOTALROWCOUNT} ${this.config.grouped?`, ${wt} as ${f.ROWGROUP}, FIRST(${f.ROWGROUPINDEX}) as ${f.ROWGROUPINDEX}${m}`:""}\n FROM ${e} ${this.config.grouped?`GROUP BY ${wt} ORDER BY ${v}`:""}`);return 0===g.length||1===g.length&&0===(null!==(o=g[0][f.TOTALROWCOUNT])&&void 0!==o?o:0)&&!this.config.grouped?[]:(this.hasBlankRowGroup=this.config.grouped&&g.some((t=>""===t.rowGroup)),g.forEach((t=>{const e=this.config.grouped?""===t.rowGroup?`WHERE (${f.ROWGROUP} IS NULL OR ${f.ROWGROUP} = '')`:`WHERE ${f.ROWGROUP} = ${this.bind(t.rowGroup)}`:"";let o="";this.config.limit&&(o=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,i),this.createDataRow(i,t,c,r,h,e,u,o),this.createRestRow(t,i,c,r,e,u),this.createGroupSumRow(i,n,t,a,e,u)})),this.createTotalSumRow(i,n,a),i.forEach((t=>s.push(this.exec(t)))),this.detectNaNCells(this.config.scenarios,s),this.createThereOfDrillRows(r,h,u,s),this.createPartOfDrillRows(r,u,n,s),this.createIntervalColumns(s),this.createThereOfDrillColumns(this.config.categoryThereOf,s),this.calculateColumnGroupRest(s,this.config.categoryThereOf),this.calculateRelativeVariances(s,l),s)}detectNaNCells(t,e){e.forEach((e=>{e.map((e=>(t.forEach((t=>{const o=new p(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,i){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===I.LIST)return;const n=this.createPartOfQuery(t,e);let s=[];const r=this.db,a=this.params;n.forEach((t=>{s.push(...this.exec(t))}));const l=this.exctractScenarioNames(t),h=[];o.forEach((function(t){h.push(...r.exec(t,a))}));const c=new Map;h.forEach((t=>c.set(t[f.ROWGROUP],t))),s=this.reduceResDrillByCategoryGroups(s,l),s.forEach((function(t){l.forEach((e=>{try{t[e]=t[e]/c.get(t[f.ROWGROUP])[e]}catch(o){console.error("DataQuery: partOf drill row calculation failed",e,o),t[e]=Number.NaN}}))})),this.injectDrillRowsToResultRows(s,i)}createRestRow(t,e,o,i,n,s){var r;if(t.totalRowCnt-this.config.limit>0&&0!==this.config.limit){const a=this.exctractScenarioNames(i).map((t=>`SUM(${t}) as ${t}`)).join(", "),l=I.OPT===this.config.type||I.OPTNOTOTAL===this.config.type?", CASE WHEN MAX(transformOperator(operation)) = -1 THEN '-' ELSE '+' END as restOperation":"";e.push(`SELECT ${f.ROWNR}, 1 as ${f.ROWGROUPINDEX} , 'ENTRY' as ${f.TYPE}, 'NO_GROUP' as ${f.ROWGROUP}, ${this.bind(String(null!==(r=t.rowGroup)&&void 0!==r?r:""))} as restRowGroup, 'REST' as ${f.CATEGORY}${l} ${a.length>0?", "+a:""} FROM (SELECT ROWNUM() AS ${f.ROWNR}, ${e.length} as ${f.ROWGROUPINDEX} , 'ENTRY' as ${f.TYPE}, ${this.bind(String(t.rowGroup||"NO_GROUP"))} as ${f.ROWGROUP}, ${o.select()} ${i.length>0?",".concat(i):""} FROM ${this.fromExpr} ${n} GROUP BY ${o} ORDER BY ${s[0]}) t WHERE t.rowNr > ${this.config.limit}`)}}createDataRow(t,e,o,i,n,s,r,a){t.push(`SELECT ROWNUM() AS ${f.ROWNR},\n ${t.length} as ${f.ROWGROUPINDEX},\n 'ENTRY' as ${f.TYPE},\n ${this.bind(String(e.rowGroup||"NO_GROUP"))} as ${f.ROWGROUP},\n '${f.CATEGORYINDEX}',\n ${o.select()} ${i.length>0?",".concat(i):""} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr} ${s}\n GROUP BY ${o}\n ORDER BY ${r[0]} ${a}`)}createGroupHeaderRow(t,e){if(!0===this.config.grouped){const o=this.bind(String(t.rowGroup)),i=""===t.rowGroup?this.bind("-"):o;e.push(`SELECT ROWNUM() AS ${f.ROWNR},\n ${e.length} as ${f.ROWGROUPINDEX},\n 'GROUPHEAD' as ${f.TYPE},\n ${o} as ${f.ROWGROUP} ${this.config.showGroupTitle?`,${i} as ${f.CATEGORY}`:""}\n FROM ${this.fromExpr}\n GROUP BY '1'`)}}createGroupSumRow(t,e,o,i,n,s){if(!0===this.config.grouped&&(I.SUM===this.config.type||I.SUMNOTOTAL===this.config.type||I.OPT===this.config.type||I.OPTNOTOTAL===this.config.type)){const r=this.bind(String(o.rowGroup));t.push(`SELECT ${t.length} as ${f.ROWGROUPINDEX},\n '=' as ${f.OPERATION},\n ${r} as ${f.ROWGROUP},\n ROWNUM() AS ${f.ROWNR},\n 'GROUP_SUM' as ${f.TYPE} ${i.length>0?",".concat(i):""}\n FROM ${this.fromExpr} ${n}\n ORDER BY ${s[0]} `),e.push(`SELECT ${t.length} as ${f.ROWGROUPINDEX},\n '=' as ${f.OPERATION},\n ${r} as ${f.ROWGROUP},\n ROWNUM() AS ${f.ROWNR},\n 'GROUP_SUM' as ${f.TYPE} ${i.length>0?",".concat(i):""}\n FROM ${this.fromExpr} ${n}\n ORDER BY ${s[0]} `)}}createTotalSumRow(t,e,o){var i;if(I.SUM===this.config.type||I.OPT===this.config.type){const e=(null===(i=this.config.title)||void 0===i?void 0:i.trim())||"SUM_TOTAL",n=this.hasPartOf&&!1===this.config.grouped&&"SUM_TOTAL"!==e?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} ${e}`:e;t.push(`SELECT ${t.length} as ${f.ROWGROUPINDEX},\n ${this.bind(n)} as ${f.ROWGROUP},\n '=' as ${f.OPERATION},\n 'SUM' as ${f.TYPE} ${o.length>0?",".concat(o):""}\n FROM ${this.fromExpr} `)}e.push(`SELECT ${t.length} as ${f.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${f.ROWGROUP},\n '=' as ${f.OPERATION},\n 'SUM' as ${f.TYPE} ${o.length>0?",".concat(o):""}\n FROM ${this.fromExpr} `)}reduceResDrillByCategoryGroups(t,e){const o=new Map;return t.forEach((function(t){const i=t.rowNr+t.rowGroup+t.type+t.category;if(o.has(i)){const n=o.get(i);e.forEach((e=>{try{n[e]+=t[e]}catch(t){console.error("DataQuery: drill row aggregation failed",e,t)}}))}else o.set(i,t)})),[...o.values()]}injectDrillRowsToResultRows(t,e){const o=new Map;if(!0===this.config.grouped)t.forEach((function(t){e.forEach((function(e){const i=e.findIndex((e=>e.category===t.category&&e.rowGroup===t.rowGroup));if(i>=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[f.ROWNR]=o.get(`${t.category}_${t.rowGroup}`),e.splice(i+t[f.ROWNR],0,t)}}))}));else{const i=this.findDuplicateSubCategories(t);t.forEach((function(t){e.forEach((function(e){const n=e.findIndex((e=>null!=e.category&&e.category===t.category));if(n>=0){if(o.has(`${t.category}`)){const e=o.get(`${t.category}`)||0;o.set(`${t.category}`,e+1)}else o.set(`${t.category}`,1);null!=t.rowGroup&&""!==t.rowGroup&&i.includes(`${t.category}##${t.subCategory}`)&&(t.rawSubCategory=t.subCategory,t.subCategory=`${t.subCategory} (${t.rowGroup})`),e.splice(n+t[f.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,e,o,i){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const n=[],s=[];this.config.thereOf.forEach((i=>{let s=!0,r="1 <> 1 OR ( ";null!=i.category&&0!==i.category.length&&i.category.trim()&&(r+=` ${f.CATEGORY} = ${this.bind(i.category)}`,s=!1),null!=i.rowGroup&&0!==i.rowGroup.length&&i.rowGroup.trim()&&(r+=` ${s?"":"AND"} ${f.ROWGROUP} = ${this.bind(i.rowGroup)}`,s=!1),null!=i.subCategory&&0!==i.subCategory.length&&i.subCategory.trim()&&(r+=` ${s?"":"AND"} ${f.SUBCATEGORY} = ${this.bind(i.subCategory)}`),r+=")",n.push(`SELECT ROWNUM() AS ${f.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${f.TYPE},\n ${f.CATEGORY},\n ${f.SUBCATEGORY},\n ${this.drillRowGroup} as ${f.ROWGROUP},\n ${t} ${e.length>0?",".concat(e):""}\n FROM ${this.fromExpr}\n WHERE ${r}\n GROUP BY ${this.drillRowGroup}, ${f.CATEGORY}, ${f.SUBCATEGORY}\n ORDER BY ${o[1]}`)})),n.forEach((t=>{s.push(...this.exec(t))})),this.injectDrillRowsToResultRows(s,i)}calculateRelativeVariances(t,e){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[f.TYPE]&&e.forEach(((e,o)=>{var i;t[o]=null!==(i=M(t[o],t[e]))&&void 0!==i?i:O}))}))}))}calculateColumnGroupRest(t,e){if(null==e||0===e.size)return;const o=new Map,i=new Map;e.forEach(((t,e)=>{const n=t,s=[];for(const t of n)s.push(`${e}##${t.name}`);o.set(e,s),i.set(`${e}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[f.TYPE]&&o.forEach(((e,o)=>{let n=0;e.forEach((e=>{void 0!==t[e]&&(n+=t[e])})),t[`${o}##REST`]=t[o]-n,0!==t[`${o}##REST`]&&i.set(`${o}##REST`,!0)}))}))}));const n=Array.from(i.entries()).filter((([t,e])=>!e)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const e of n)delete t[e]}))}))}createIntervalColumns(t){var e,o,i,n,s;if(this.config.interval===V||this.config.categoryThereOf.size>0||0===this.config.scenarios.length)return;const r="##",a=`(SELECT *, ${X(this.config.interval)} as __interval FROM ${this.fromExpr}) as p`,l=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),h=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),c=[...new Set(this.exctractScenarioNames(l))],u=this.getRelativeScenarios(),d=new Rt(this.config),$=I.OPT===this.config.type||I.OPTNOTOTAL===this.config.type,m=this.config.grouped&&(I.SUM===this.config.type||I.SUMNOTOTAL===this.config.type||I.OPT===this.config.type||I.OPTNOTOTAL===this.config.type),v=this.checkConfigForPartOf()&&this.config.type!==I.LIST,g=t=>this.exec(t),b=t=>(this.config.scenarios.forEach((e=>{const o=new p(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)})),u.forEach(((e,o)=>{var i;t[o]=null!==(i=M(t[o],t[e]))&&void 0!==i?i:O})),t),w=(t,e,o)=>{for(const i of this.config.scenarios)t[i+r+o]=e[i]},R=g(`SELECT ${d.select()}, __interval ${l.length>0?",".concat(l):""}\n FROM ${a}\n GROUP BY ${d}, __interval`);if(this.config.limit>0)for(let i=0;i<t.length;i++){const n=t[i].find((t=>"ENTRY"===t.type&&"REST"===t.category));if(!n)continue;let s;for(let e=i-1;e>=0&&!s;e--){const o=t[e].filter((t=>"ENTRY"===t.type&&"REST"!==t.category));o.length>0&&(s=o)}if(!s)continue;const r=new Set(s.map((t=>t.category))),a=s[0].rowGroup,l=new Map;for(const t of R){if(this.config.grouped&&t.rowGroup!==a)continue;if(r.has(t.category))continue;const i=Z(t.__interval);let n=l.get(i);n||(n={},l.set(i,n));for(const i of c)n[i]=(null!==(e=n[i])&&void 0!==e?e:0)+(null!==(o=t[i])&&void 0!==o?o:0)}l.forEach(((t,e)=>{w(n,b(t),e)}))}for(const e of R){const o=Z(e.__interval);b(e);for(const i of t)for(const t of i)"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 S=m||v&&this.config.grouped?g(`SELECT ${wt} as ${f.ROWGROUP}, __interval ${h.length>0?",".concat(h):""}\n FROM ${a}\n GROUP BY ${wt}, __interval`):[],y=new Map;if(S.forEach((t=>y.set(`${t.rowGroup}${r}${Z(t.__interval)}`,t))),m)for(const e of S){const o=Z(e.__interval),i=b(Object.assign({},e));for(const n of t)for(const t of n)"GROUP_SUM"===t.type&&t.rowGroup===e.rowGroup&&w(t,i,o)}const E=I.SUM===this.config.type||I.OPT===this.config.type,U=E||v&&!this.config.grouped?g(`SELECT __interval ${h.length>0?",".concat(h):""}\n FROM ${a}\n GROUP BY __interval`):[],G=new Map;if(U.forEach((t=>G.set(Z(t.__interval),t))),E)for(const e of U){const o=Z(e.__interval),i=b(Object.assign({},e));for(const e of t)for(const t of e)"SUM"===t.type&&w(t,i,o)}if(null!=this.config.thereOf&&this.config.thereOf.length>0){const e=[];this.config.thereOf.forEach((t=>{e.push(...g(`SELECT ${this.drillRowGroup} as ${f.ROWGROUP}, ${f.CATEGORY}, ${f.SUBCATEGORY}, __interval ${l.length>0?",".concat(l):""}\n FROM ${a}\n WHERE ${this.createThereOfWhereClause(t)}\n GROUP BY ${this.drillRowGroup}, ${f.CATEGORY}, ${f.SUBCATEGORY}, __interval`))}));for(const o of e){const e=Z(o.__interval);b(o);for(const i of t)for(const t of i)"DRILLELEMENT"===t.type&&t.category===o.category&&t.rowGroup===o.rowGroup&&(t.subCategory!==o.subCategory&&t.subCategory!==`${o.subCategory} (${o.rowGroup})`||w(t,o,e))}}if(v){let e="1 <> 1 ";null===(i=this.config.partOf)||void 0===i||i.forEach((t=>{e+=`OR (${f.CATEGORY} = ${this.bind(t.category)}`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(e+=`and ${f.ROWGROUP} = ${this.bind(t.rowGroup)}`),e+=")"}));const o=g(`SELECT ${f.CATEGORY}, ${this.config.grouped?`${f.ROWGROUP}`:`'SUM_TOTAL' as ${f.ROWGROUP}`}, __interval ${l.length>0?",".concat(l):""}\n FROM ${a}\n WHERE ${e}\n GROUP BY ${f.ROWGROUP}, ${f.CATEGORY}, __interval`),h=new Map;for(const t of o){const e=`${t.rowGroup}${r}${t.category}${r}${Z(t.__interval)}`,o=h.get(e);if(o)for(const e of c)o[e]=(null!==(n=o[e])&&void 0!==n?n:0)+(null!==(s=t[e])&&void 0!==s?s:0);else h.set(e,t)}h.forEach((e=>{const o=Z(e.__interval),i=this.config.grouped?y.get(`${e.rowGroup}${r}${o}`):G.get(o);for(const t of c)e[t]=e[t]/(i?i[t]:Number.NaN);b(e);for(const i of t)for(const t of i)"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+=` ${f.CATEGORY} = ${this.bind(t.category)}`,e=!1),null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(o+=` ${e?"":"AND"} ${f.ROWGROUP} = ${this.bind(t.rowGroup)}`,e=!1),null!=t.subCategory&&0!==t.subCategory.length&&t.subCategory.trim()&&(o+=` ${e?"":"AND"} ${f.SUBCATEGORY} = ${this.bind(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 i=new p(t);if(I.OPT===o||I.OPTNOTOTAL===o){if(i.isValid){const o=e?" * transformOperator(operation)":"",n=e?`SUM((${i.base} - ${i.delta})${o}) as ${t}`:`SUM(${i.base} - ${i.delta}) as ${t}`;return"dr"===i.type?`${n}, SUM(${i.delta}${o}) as dr_${i.delta}`:n}return e?`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:`SUM(${t}) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}return i.isValid?"dr"===i.type?`SUM((${i.base} * transformOperator(operation)) - (${i.delta} * transformOperator(operation))) as ${t}, SUM(${i.delta} * transformOperator(operation)) as dr_${i.delta}`:`SUM((${i.base} * transformOperator(operation))- (${i.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!==I.OPT&&this.config.type!==I.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":{const e=t.arg;return`${this.bind(""===e||Number.isNaN(Number(e))?e:Number(e))} as ${t.alias}`}}}get drillRowGroup(){return this.config.grouped?wt:f.ROWGROUP}exec(t){const e=this.db.exec(t,this.params);return this.config.grouped&&e.forEach((t=>t.rowGroup=null==t.rowGroup?"":String(t.rowGroup))),e}bind(t){return`$${this.params.push(t)-1} `}createOrderString(t){const e=j.ASC===t.direction?j.DESC:j.ASC;return[t.hierarchy.map((e=>`${e} ${t.direction}`)).toString(),t.hierarchy.map((t=>`${t} ${e}`)).toString()]}createRelativeScenario(t){const e=new p(t);return e.isValid&&"dr"===e.type?{key:`${t}`,value:`dr_${e.delta}`}:null}exctractScenarioNames(t){const e=[];return t.split(",").forEach((t=>t.length>=2?e.push(t.split("as")[1].trim()):null)),e}findDuplicateSubCategories(t){const e=t.map((t=>({count:1,subCategory:`${t.category}##${t.subCategory}`}))).reduce(((t,e)=>(t[e.subCategory]=(t[e.subCategory]||0)+e.count,t)),{});return Object.keys(e).filter((t=>e[t]>1))}createPartOfQuery(t,e){var o;const i=[];let n="1 <> 1 ",s=` ${this.drillRowGroup} as ${f.ROWGROUP}`,r="ROWNUM()";return null===(o=this.config.partOf)||void 0===o||o.forEach((t=>{n+=`OR (${f.CATEGORY} = ${this.bind(t.category)}`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(n+=`and ${f.ROWGROUP} = ${this.bind(t.rowGroup)}`),!1===this.config.grouped&&(s=` 'SUM_TOTAL' as ${f.ROWGROUP} `,r="1"),n+=")"})),i.push(`SELECT ${r} AS ${f.ROWNR},\n 'PARTELEMENT' as ${f.TYPE},\n ${f.CATEGORY},\n ${s},\n ${t}\n FROM ${this.fromExpr}\n WHERE ${n}\n GROUP BY ${this.drillRowGroup}, ${f.CATEGORY}, ${f.TYPE}\n ORDER BY ${e[1]}`),i}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,e){if(null==t||0===t.size)return;const o=[],i=[],n=this.fromExpr;t.forEach(((t,e)=>{let i="1 <> 1 ";t.forEach((t=>{i+=` or columnGroup = ${this.bind(String(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 ${n}\n WHERE ${i}\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 ${n}\n WHERE ${i}\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 ${n}\n WHERE ${i}\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 ${n}\n WHERE ${i}\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 ${n}\n WHERE ${i}\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 ${n}\n WHERE ${i}\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 ${n}\n WHERE ${i}\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 ${n}\n WHERE ${i}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of o)i.push(...this.db.exec(t,this.params));this.injectDrillColumnsToResultRows(i,e)}injectDrillColumnsToResultRows(t,e){const o="##";for(const i of t)for(const t of e)for(const e of t)if(e.type===i.rowlevel)if("ENTRY"===i.rowlevel)"COLUMNGROUP"===i.columnlevel&&e.category===i.category?e[i.scenario+o+i.columnGroup]=i.val:"SUBGROUP"===i.columnlevel&&e.category===i.category&&(e[i.scenario+o+i.columnGroup+o+i.columnSubGroup]=i.val);else if("DRILLELEMENT"===i.rowlevel){if(!this.config.grouped&&e.rowGroup!==i.rowGroup)continue;"COLUMNGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===i.subCategory?e[i.scenario+o+i.columnGroup]=i.val:"SUBGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===i.subCategory?e[i.scenario+o+i.columnGroup+o+i.columnSubGroup]=i.val:"COLUMNGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===`${i.subCategory} (${i.rowGroup})`?e[i.scenario+o+i.columnGroup]=i.val:"SUBGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===`${i.subCategory} (${i.rowGroup})`&&(e[i.scenario+o+i.columnGroup+o+i.columnSubGroup]=i.val)}else("SUM"===i.rowlevel||"GROUP_SUM"===i.rowlevel)&&("COLUMNGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===i.subCategory&&(e[i.scenario+o+i.columnGroup]=i.val),"SUBGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===i.subCategory&&(e[i.scenario+o+i.columnGroup+o+i.columnSubGroup]=i.val))}}class yt{constructor(){this.geometry=new Map}set(t,e,o){let i=this.geometry.get(t);i||(i=new Map,this.geometry.set(t,i)),i.set(e,o)}get(t,e){var o;return null===(o=this.geometry.get(t))||void 0===o?void 0:o.get(e)}}function Et(t,e,o){const i=t[e];if(null==i)return null;const n=Number(i);return isNaN(n)?null:o!==I.OPT&&o!==I.OPTNOTOTAL||t[f.TYPE]!==z.ENTRY||"-"!==t[f.OPERATION]?n:-n}class Ot{constructor(t){this.ruleSet=t,this.normalizedHeader=[],this.attributesByAlias=new Map,this.hasBlankRowGroup=!1,this.dateBuckets=!1,this.unsignedEntries=!1}underlineClass(t){return this.ruleSet&&/^(ac|pp|fc|pl)[1-4]$/.test(t)?$(this.ruleSet.getScenarioColorIndex(t))+t.slice(2):null}getNormalizedHeader(){return this.normalizedHeader}createHeader(t,e,o,i,n,s,r=[]){const a=[];this.attributesByAlias=new Map(r.map((t=>[t.alias,t]))),this.normalizedHeader=this.normalizeHeader(t,e,r);const l=this.normalizedHeader.some((t=>void 0!==t.bucket));l&&a.push(this.createIntervalBandRow());const h=new tt(l?1:0,0,z.HEADER),c=new tt(l?2:1,0,z.SEPERATORLINE);for(const t of this.normalizedHeader){const e=this.attributesByAlias.get(t.name);h.createElement(e?o.get(e.label)||e.label:d.translateScenarioLabel(t.name,o),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,o,i,n,s),null,null,null,null),c.createElement(null,t.type,this.createColumnType(t),null,null,this.underlineClass(t.type),null,null,null)}return a.push(h),a.push(c),a}createIntervalBandRow(){const t=new tt(0,0,z.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 i=1;for(;e+i<this.normalizedHeader.length&&this.normalizedHeader[e+i].bucket===o.bucket;)i+=1;t.createElement(o.bucketLabel,o.type,"intervalGroup",null,null,null,null,null,null,!1,void 0,i),e+=i}return t}setHeaderPrefix(t,e,o,i,n){let s="";return"category"===t.name&&n&&(0===o.prefix.length&&0===i.length||(s=d.translateScenarioLabel("in",e)+" "+o.prefix+i)),t.order&&(s+=d.translateScenarioLabel("ORDER_"+t.order,e)),s}normalizeHeader(t,e,o){let i=[{name:f.CATEGORY,group:f.CATEGORY,type:f.CATEGORY,order:void 0}];I.OPT!==t&&I.OPTNOTOTAL!==t||(i=[{name:f.OPERATION,group:f.OPERATION,type:f.OPERATION,order:void 0},{name:f.CATEGORY,group:f.CATEGORY,type:f.CATEGORY,order:void 0}]);const n=o.map((t=>({name:t.alias,group:t.alias,type:t.alias,order:void 0})));return[...i,...n,...e]}createBodyRows(t,e,o,i){var n;const s=[];let r=-1;const a=new St(t,e);var l;this.dateBuckets=(l=t.interval)!==V&&l!==Q,this.unsignedEntries=I.OPT===t.type||I.OPTNOTOTAL===t.type;const h=a.execute(o,i);this.hasBlankRowGroup=a.hasBlankRowGroup;const c=this.calculateColumnStatistics(h,t.barColumns,t.interval!==V),u=(null!==(n=t.barColumns)&&void 0!==n?n:[]).filter((t=>t.toUpperCase().trim()in b)),d=u.length>0&&t.interval===V&&0===t.categoryThereOf.size&&function(t){for(const e of t)for(const t of e){const e=t[f.TYPE];if(e===z.SUM||e===z.GROUPSUM||e===z.DRILLELEMENT||e===z.PARTELEMENT)return!0}return!1}(h)?function(t,e,o){const i=new yt;for(const n of e){let e,s=0,r=0;const a=[],l=(t,e)=>{a.push(e),i.set(t,n,e)};for(const i of t)for(const t of i){const i=t[f.TYPE];if(i===z.GROUPHEAD){e=void 0;continue}const a=Et(t,n,o);if(i===z.ENTRY){if(null===a){e=void 0;continue}l(t,{start:s,end:s+a,min:0,max:0,kind:"cascade"}),e={start:s,end:s+a},r=e.start,s+=a}else if(i===z.SUM||i===z.GROUPSUM){if(null===a){e=void 0;continue}l(t,{start:0,end:a,min:0,max:0,kind:"anchor"}),e={start:0,end:a},r=0,s=a}else if(i===z.DRILLELEMENT){if(null===a||void 0===e)continue;const o=r+(Math.sign(e.end-e.start)||1)*Math.abs(a);l(t,{start:r,end:o,min:0,max:0,kind:"thereof",parentStart:e.start,parentEnd:e.end}),r=o}else if(i===z.PARTELEMENT){if(null===a||void 0===e)continue;const o=r+a*(e.end-e.start);l(t,{start:r,end:o,min:0,max:0,kind:"partof",parentStart:e.start,parentEnd:e.end}),r=o}}let h=0,c=0;for(const t of a)h=Math.min(h,t.start,t.end),c=Math.max(c,t.start,t.end);for(const t of a)t.min=h,t.max=c}return i}(h,u,t.type):void 0;for(const o of h)r+=1,s.push(...this.createRow(t.i18n,e,t.scenariosUnitType,o,r,-1,t.categoryWidth,t.measureScale,t.barColumns,c,d));return s}calculateColumnStatistics(t,e,o=!1){const i=new Map;if(!e||0===e.length)return i;const n=new Map;for(const t of e)i.set(t,{min:1/0,max:-1/0,absMax:0,median:0}),n.set(t,[]);for(const s of t)for(const t of s){const s=t[f.TYPE];if(s!==z.SUM&&s!==z.GROUPSUM)for(const s of e){const e=o?this.extractIntervalColumnValues(t,s):[this.extractColumnValue(t,s)];for(const t of e)if(null!==t&&!isNaN(t)){const e=i.get(s);e.min=Math.min(e.min,t),e.max=Math.max(e.max,t),n.get(s).push(Math.abs(t))}}}for(const[t,e]of i){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=n.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]}i.set(t,e)}return i}extractIntervalColumnValues(t,e){const o=e+"##",i=[];for(const e of Object.keys(t))if(e.startsWith(o)){const o=Number(t[e]);i.push(isNaN(o)?null:o)}return i}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,i,n,s,r,a,h,c,u){var d,$,m;const v=[];let g;for(const b of i){const w=b[f.ROWGROUP],R=""===w?"-":w,S=b[f.SUBCATEGORY],y=b[f.TYPE],E=b[f.ROWNR]>=2;g=null!==($=null!==(d=b.operation)&&void 0!==d?d:b.restOperation)&&void 0!==$?$:g;const O=this.createDetailRow(y,s+=1,n,i.length);O.key=this.rowKey(b);for(const i of this.normalizedHeader){const n=this.getRawDataRowElement(b,i),s=null!==(m=null==h?void 0:h.includes(i.type))&&void 0!==m&&m,d=s?null==c?void 0:c.get(i.type):void 0,f=s&&void 0===i.bucket&&i.name===i.group&&i.name===i.type?null==u?void 0:u.get(b,i.type):void 0;O.createElement(this.translateSumCellLabel(t,e,n,R,S,y,i.type),i.type,this.createColumnType(i),this.setCellType(i.type,o),this.translateCellPrefix(e,y,i.type),this.translateScenarioCSS(i.type,n,g),E,r,null==a?void 0:a.value,s,d,1,f);const $=O.elements[O.elements.length-1];this.dateBuckets&&void 0!==i.bucket&&($.date=l(i.bucket));const v=new p(i.type);v.isValid&&($.direction=this.resolveDirection(v,g))}v.push(O)}return v}rowKey(t){var e;const o=null!=t.restRowGroup?t.restRowGroup:"NO_GROUP"===t.rowGroup?void 0:t.rowGroup;switch(t.type){case z.ENTRY:return{rowGroup:o,category:t.category,subCategory:t.subCategory};case z.DRILLELEMENT:return{rowGroup:o,category:t.category,subCategory:null!==(e=t.rawSubCategory)&&void 0!==e?e:t.subCategory};case z.GROUPSUM:return{rowGroup:o,row:"subtotal"};case z.SUM:return{row:"total"};default:return}}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,i){switch(t){case z.GROUPHEAD:return new tt(e,o,z.HEADER);case z.SUM:case z.GROUPSUM:return new tt(i+2,o,z.SUM);case z.DRILLELEMENT:return new tt(i+2,o,z.DRILLELEMENT);case z.PARTELEMENT:return new tt(i+2,o,z.PARTELEMENT);default:return new tt(e,o,z.STANDARD)}}translateSumCellLabel(t,e,o,i,n,s,r){return this.attributesByAlias.has(r)||!1===Number.isNaN(Number(o))||this.isOperationColumn(r)?o:this.isGroupHeadCategory(s,r)?t===w.ALL?`${e.get(o)||o}`:o:this.isEntryCategory(s,r)?t===w.ALL||"REST"===o?`${e.get(o)||o}`:o:this.isDrillElementCategory(s,r)?t===w.ALL?`${e.get(n)||n}`:`${n}`:this.isPartElementCategory(s,r)?t===w.ALL||"SUM_TOTAL"===i?`${e.get(i)||i}`:`${i}`:this.isSumElementCategory(s,r)?t===w.ALL||"SUM_TOTAL"===i?`${e.get(i)||i}`:i:"GROUPHEAD"===s&&null==o||o===O?o:Number.isNaN(Number(o))?"-":Number(o)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,e,o){if(this.attributesByAlias.has(t))return"attribute";const i=new p(t);let n="pos";return e<0&&(n="neg"),i.isValid?n+"_"+this.resolveDirection(i,o)+("dr"===i.type?" relative_variance":""):t}resolveDirection(t,e){return m(t.direction,e,!this.unsignedEntries)}setCellType(t,e){if("category"===t)return"";const o=this.attributesByAlias.get(t);if(o)return o.isNumeric?"decimal":"";let i;const n=new p(t);return e===R.PERCENT?(i="percent",n.isValid&&"d"===n.type&&(i="percentpoint")):(i="decimal",n.isValid&&"dr"===n.type&&(i="percent")),i}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("thereof")} `: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 Mt{constructor(t,e,o,i){this.fromExpr="",this.rowCount=0,this.headerRows=[],this.bodyRows=[],this.intervalBuckets=[],this.ruleSet=t||new v,this.db=e,this.dataSetFactory=new Ot(this.ruleSet),this.config=this.initConfig(i),this.i18n=this.initI18n(new Map),this.setSource(o,i.filter)}setI18n(t){this.i18n=this.initI18n(t)}initI18n(t){const e=new Map([["",""],["SEPARATOR_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"," "],["thereof","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"]]);return this.state=H.DIRTY,new Map([...e,...t||new Map])}initConfig(t){this.state=H.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,i;if(this.state=H.DIRTY,this.fromExpr=C(this.db,t,e),!this.fromExpr)return void(this.rowCount=0);const n=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(i=null===(o=n[0])||void 0===o?void 0:o.cnt)&&void 0!==i?i:0}update(){this.prepareIntervalBuckets();const t=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder,this.intervalBuckets);this.headerRows=this.dataSetFactory.createHeader(this.config.type,t,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale,this.config.attributes),this.bodyRows=0!==this.rowCount&&this.fromExpr?this.dataSetFactory.createBodyRows(this.config,this.i18n,this.db,this.fromExpr):[],this.state=H.UP_TO_DATE}getHeader(){return this.state===H.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===H.DIRTY&&this.update(),this.bodyRows}getColumns(){return this.state===H.DIRTY&&this.update(),this.dataSetFactory.getNormalizedHeader()}prepareIntervalBuckets(){this.intervalBuckets=[],this.config.interval===V||!this.fromExpr||this.config.categoryThereOf.size>0?this.config.interval=V:(this.config.interval=function(t,e,o){var i;if(o!==N.AUTO)return o;const n=t.exec(`SELECT [date] as d FROM ${e}`);let s,r;for(const t of n){const e=null===(i=q(t.d))||void 0===i?void 0:i.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?N.DAY:(new T).calculateDistanceType(U.fromMillis(s),U.fromMillis(r))}(this.db,this.fromExpr,this.config.interval),this.intervalBuckets=function(t,e,o,i){const n=t.exec(`SELECT ${X(o)} as __interval FROM ${e}`);if(o===Q){const t=new Set,e=[];for(const o of n){const i=Z(o.__interval);t.has(i)||(t.add(i),e.push({key:i,label:0===i.length?"-":i}))}return e}const s=new Set,r=[];for(const t of n){const e=q(t.__interval);if(!e)continue;const o=e.toISO();s.has(o)||(s.add(o),r.push(e))}r.sort(((t,e)=>t.toMillis()-e.toMillis()));const a=new T;return a.setLocale(i),r.map((t=>({key:t.toISO(),label:a.getDateString(t,o)})))}(this.db,this.fromExpr,this.config.interval,this.config.locale),0===this.intervalBuckets.length&&(this.config.interval=V))}normalizeScenarios(t,e,o,i=[]){var n,s;const r=[];if(i.length>0){for(const e of i)for(const i of t)r.push({name:i,group:i,type:i,order:(null===(n=null==o?void 0:o.hierarchy)||void 0===n?void 0:n.at(0))===i?o.direction:void 0,bucket:e.key,bucketLabel:e.label});return r}for(const i of t){if(null==e?void 0:e.has(i)){const t=e.get(i);for(const e of t){r.push({name:e.name,group:e.name,type:i,order:void 0});for(const t of e.subGroups)r.push({name:t,group:e.name,type:i,order:void 0})}r.push({name:"REST",group:"REST",type:i,order:void 0})}let t;(null===(s=null==o?void 0:o.hierarchy)||void 0===s?void 0:s.at(0))===i&&(t=o.direction),r.push({name:i,group:i,type:i,order:t})}return r}hasNoData(){return 0===this.rowCount}hasBlankRowGroup(){return this.dataSetFactory.hasBlankRowGroup}}class Ut{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=R.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.attributes=[],this.sortOrder=new W(new D).default(),this.type=I.LIST,this.limit=0,this.i18n=w.ALL,this.categoryWidth=y.W25,this.measureScale=new B,this.measureUnit="",this.measureType=E.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[],this.interval="none",this.locale="de"}}class Gt{constructor(t,e,o,i,n,s){this.tableDrillGroupAdapter=t,this.stringAdapter=e,this.orderAdapter=o,this.db=i,this.fromExpr=n,this.onQueryError=s}adapt(t){const e=new Ut;return S.isString(t.title)&&(e.title=t.title),S.isArray(t.scenarios)&&(e.scenarios=A.adaptArray(t.scenarios,this.stringAdapter)),S.isExisting(t.scenariosUnitType)&&(e.scenariosUnitType=t.scenariosUnitType),S.isBoolean(t.grouped)&&(e.grouped=t.grouped),S.isBoolean(t.showGroupTitle)&&(e.showGroupTitle=t.showGroupTitle),S.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),S.isArray(t.thereOf)&&(e.thereOf=A.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),S.isExisting(t.categoryThereOf)&&(e.categoryThereOf=t.categoryThereOf),S.isArray(t.partOf)&&(e.partOf=A.adaptArray(t.partOf,this.tableDrillGroupAdapter)),S.isArray(t.attributes)&&(e.attributes=t.attributes),S.isExisting(t.order)&&(e.sortOrder=this.orderAdapter.adapt(t.order)),S.isExisting(t.type)&&(e.type=t.type),S.isNumber(t.limit)&&(e.limit=t.limit),S.isExisting(t.i18n)&&(e.i18n=t.i18n),S.isExisting(t.categoryWidth)&&(e.categoryWidth=t.categoryWidth),S.isExisting(t.measureScale)&&(e.measureScale=x.calculateMeasureScale(this.db,this.fromExpr,e.scenarios,t.measureScale,this.onQueryError)),S.isExisting(t.measureType)&&(e.measureType=t.measureType),S.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),S.isString(t.filter)&&(e.filter=t.filter.trim()),S.isArray(t.barColumns)&&(e.barColumns=t.barColumns),S.isString(t.interval)&&(e.interval=t.interval),S.isString(t.locale)&&(e.locale=t.locale),e}default(){return new Ut}}class Nt{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class Tt{constructor(){}adapt(t){const e=new Nt;return S.isString(t.rowGroup)&&(e.rowGroup=t.rowGroup),S.isString(t.category)&&(e.category=t.category),S.isString(t.subCategory)&&(e.subCategory=t.subCategory),S.isString(t.partOf)&&(e.partOf=t.partOf),e}default(){return new Nt}}const _t=e(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.sumTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=R.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.thereof=[],this.partof=[],this.order={hierarchy:[],direction:j.ASC},this.categorythereof=new Map,this.attributeColumns=[],this.type=I.LIST,this.categoryWidth=y.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=w.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=E.VOLUME,this.filter="",this.barColumns=[],this.interval="none",this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new P,G(this),this.componentStyle=F(this)}async getLayoutDetail(t,e){var o,i,n;const l={regions:[],metadata:{},diagnostics:[]},h=null===(o=this.element.shadowRoot)||void 0===o?void 0:o.querySelector("table");if(l.metadata.hasNoData=null===(n=null===(i=this.table)||void 0===i?void 0:i.hasNoData())||void 0===n||n,!this.table||!h)return l;const u=h.querySelector("thead"),d=h.querySelector("tbody");u&&l.regions.push({id:"header",rect:s(u,t)}),d&&l.regions.push({id:"body",rect:s(d,t)});const f=this.table.getHeader(),p=this.table.getBody(),$=this.table.getColumns();if(l.metadata.headerRowCount=f.length,l.metadata.rowCount=p.length,l.metadata.columnCount=$.length,l.metadata.cellCount=p.reduce(((t,e)=>t+e.getCells().length),0),"full"!==e)return l;const m=[],v=[],g=(e,o,i)=>{const n=i?Array.from(i.children).filter((t=>"tr"===t.localName)):[];o.forEach(((o,i)=>{const h=n[i];if(!h)return;m.push({section:e,index:i,type:o.type,rect:s(h,t),point:c(h)});const u=o.getCells(),d=Array.from(h.children);u.length===d.length?u.forEach(((o,n)=>{var l,h;const u=d[n],f={kind:"header"===e?"headerCell":"cell",row:i,column:o.index,key:o.key||void 0,colSpan:o.colSpan,value:null!==(l=o.value)&&void 0!==l?l:void 0,text:(null===(h=u.textContent)||void 0===h?void 0:h.trim())||void 0,type:o.type||void 0,rect:s(u,t),point:c(u)};f.point&&(f.content=r(u,t),f.contentSign=a(u)||void 0);const p=u.querySelector("svg.cell-bar-chart");p&&(f.bar={variant:p.classList.contains("waterfall-bar")?"waterfall":p.classList.contains("relative-variance")?"relative":"absolute",rect:s(p,t)}),v.push(f)})):l.diagnostics.push({id:`WARN_layout_cell_pairing_${e}_${i}`,type:"warning",message:`layout-state: model/DOM cell count mismatch in ${e} row ${i} (${u.length} vs ${d.length}); cell details skipped for this row.`})}))};return g("header",f,u),g("body",p,d),l.elements=v,l.table={rows:m,columns:$.map(((t,e)=>({index:e,key:t.name,group:t.group,type:t.type,bucket:t.bucket})))},l}render(){var e;return t(i,{class:{"no-data":!0===(null===(e=this.table)||void 0===e?void 0:e.hasNoData())}},(()=>{var e,o,i,n;if(void 0===this.table)return;if(this.table.hasNoData()){const o=null!==(e=this.i18n.get("no-data"))&&void 0!==e?e:"No Data";return t("div",{class:"empty-state"},o)}const s=null===(n=null===(i=null===(o=this.stores)||void 0===o?void 0:o.context)||void 0===i?void 0:i.state)||void 0===n?void 0:n.locale;return t("table",null,t("thead",null,this.table.getHeader().map((e=>t("tr",{class:e.cssStyle},e.getCells().map((e=>t("th",{colSpan:e.colSpan,class:e.cssStyle},e.getAsHeaderList().map(((o,i,n)=>t("span",null,i===n.length-1?t("span",{class:" "===o?"table-footer":""},o,e.drawPrefix()," "):t("span",null,o,e.drawPrefix(),t("br",null)))))))))))),t("tbody",null,this.table.getBody().map((e=>t("tr",Object.assign({class:e.cssStyle},u(e.key,"element")),null==e?void 0:e.getCells().map((o=>t("td",Object.assign({colSpan:o.colSpan,class:o.type?`${o.cssStyle} ${o.type}`:o.cssStyle},e.key&&null!=o.value&&""!==o.value&&"-"!==o.value?u(Object.assign(Object.assign({},e.key),{date:o.date,scenario:o.key}),"element"):{}),null!=o.prefix?t("span",{class:o.cssStyle+" "+o.prefixStyle},o.drawPrefix()):"",o.isBarChart&&o.columnStats&&o.value!==O&&(void 0!==o.waterfall||e.type!==z.SUM)?void 0!==o.waterfall?t(bt,{value:o.value,scenario:o.key,columnStats:o.columnStats,height:18*this.scaleFactor,isRelative:!1,isPositiveGood:"pos"===o.direction,measureScale:o.measureScale,locale:s,columnWidthEm:this.barColumnMaxWidth,styles:this.barChartStyles,waterfall:o.waterfall}):t(gt,{value:o.value,scenario:o.key,columnStats:o.columnStats,height:18*this.scaleFactor,isRelative:o.key.startsWith("dr"),isPositiveGood:"pos"===o.direction,measureScale:"percentpoint"===o.type?.01:o.measureScale,locale:s,percentDigits:this.componentDataFormatDigits.percent,columnWidthEm:this.barColumnMaxWidth,styles:this.barChartStyles}):o.draw(this.componentDataFormatDigits,s)))))))))})())}componentWillRender(){var t,e,o,i,n;this.stores||(this.stores=L(this.element));const s=this.stores.db.db;this.componentDataFormatDigits=(new k).adapt(this.dataFormatDigits);try{const e=this.prepareConfig(s);this.table=new Mt(new v(this.ruleSetConfig),s,this.tableName,e),this.table.setI18n(this.i18n),this.table.hasNoData()||this.table.getBody(),null===(t=this.errors)||void 0===t||t.remove("ERR_sql")}catch(t){console.error("bn-table-renderer: query failed",t),this.table=void 0,null===(e=this.errors)||void 0===e||e.addOrReplace({id:"ERR_sql",type:"error",message:`Query failed: ${t instanceof Error?t.message:t}`})}(null===(o=this.table)||void 0===o?void 0:o.hasBlankRowGroup())?null===(i=this.errors)||void 0===i||i.addOrReplace({id:"WARN_blankRowGroup",type:"warning",message:"grouped: rows with blank rowGroup found, they are grouped under '-'."}):null===(n=this.errors)||void 0===n||n.remove("WARN_blankRowGroup"),this.barChartStyles=this.prepareBarChartStyles()}prepareConfig(t){var e,o,i;const n=C(t,this.tableName,this.filter);return new Gt(new Tt,new D,new W(new D),t,n,(t=>{throw t})).adapt({title:this.sumTitle,scenarios:this.scenarios,scenariosUnitType:this.scenariosDataFormat,grouped:this.grouped,showGroupTitle:this.showGroupTitle,thereOf:this.thereof,partOf:this.partof,categoryThereOf:this.categorythereof,attributes:this.attributeColumns,order:this.order,type:this.type,limit:this.limit,i18n:this.i18nMode,categoryWidth:this.categoryWidth,measureScale:this.measureScale,measureUnit:this.measureUnit,measureType:this.measureType,showMeasureScale:this.showMeasureScale,filter:this.filter,barColumns:this.barColumns,interval:this.interval,locale:(null===(i=null===(o=null===(e=this.stores)||void 0===e?void 0:e.context)||void 0===o?void 0:o.state)||void 0===i?void 0:i.locale)||"de"})}prepareBarChartStyles(){var t;const e=!(this.unitScaling>0),o=!(this.percentageScaling>0),i=e?this.autoUnitScaling():this.unitScaling,n=o?this.autoPercentageScaling():this.percentageScaling;return(e||o)&&(null===(t=this.reportAutoScaling)||void 0===t||t.call(this,{unit:e?i:void 0,percentage:o?n:void 0})),this.componentStyle((t=>{var e,o,s,r,a,l,c,u,d,f,p,$,m,b,w,R,S,y,E,O,M,U,G,N,T,_,C;const L=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.varianceStyles,x=null===(o=t["bn-chart-time"])||void 0===o?void 0:o.barStyles;return{positive:{stroke:(null===(s=null==L?void 0:L.pos)||void 0===s?void 0:s.stroke)||"#008f96",fill:(null===(r=null==L?void 0:L.pos)||void 0===r?void 0:r.fill)||"#008f96",fillpattern:h(null===(a=null==L?void 0:L.pos)||void 0===a?void 0:a.fillpattern)||"solid"},negative:{stroke:(null===(l=null==L?void 0:L.neg)||void 0===l?void 0:l.stroke)||"#ff0000",fill:(null===(c=null==L?void 0:L.neg)||void 0===c?void 0:c.fill)||"#ff0000",fillpattern:h(null===(u=null==L?void 0:L.neg)||void 0===u?void 0:u.fillpattern)||"solid"},neutral:{stroke:(null===(d=null==L?void 0:L.neu)||void 0===d?void 0:d.stroke)||"#808080",fill:(null===(f=null==L?void 0:L.neu)||void 0===f?void 0:f.fill)||"#808080",fillpattern:h(null===(p=null==L?void 0:L.neu)||void 0===p?void 0:p.fillpattern)||"outlined"},scenarios:g({ac:{stroke:(null===($=null==x?void 0:x.ac)||void 0===$?void 0:$.stroke)||"#404040",fill:(null===(m=null==x?void 0:x.ac)||void 0===m?void 0:m.fill)||"#404040",fillpattern:h(null===(b=null==x?void 0:x.ac)||void 0===b?void 0:b.fillpattern)||"solid"},pp:{stroke:(null===(w=null==x?void 0:x.pp)||void 0===w?void 0:w.stroke)||"#A6A6A6",fill:(null===(R=null==x?void 0:x.pp)||void 0===R?void 0:R.fill)||"#A6A6A6",fillpattern:h(null===(S=null==x?void 0:x.pp)||void 0===S?void 0:S.fillpattern)||"solid"},fc:{stroke:(null===(y=null==x?void 0:x.fc)||void 0===y?void 0:y.stroke)||"#404040",fill:(null===(E=null==x?void 0:x.fc)||void 0===E?void 0:E.fill)||"#ffffff",fillpattern:h(null===(O=null==x?void 0:x.fc)||void 0===O?void 0:O.fillpattern)||"hatched"},pl:{stroke:(null===(M=null==x?void 0:x.pl)||void 0===M?void 0:M.stroke)||"#404040",fill:(null===(U=null==x?void 0:x.pl)||void 0===U?void 0:U.fill)||"#ffffff",fillpattern:h(null===(G=null==x?void 0:x.pl)||void 0===G?void 0:G.fillpattern)||"outlined"}},new v(this.ruleSetConfig)),fontColor:(null===(N=t.global)||void 0===N?void 0:N.fontColor)||"#000000",fontSize:((null===(T=t.global)||void 0===T?void 0:T.fontSizePx)||13.3333)*et*this.scaleFactor,emPx:((null===(_=t.global)||void 0===_?void 0:_.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:(null===(C=t.global)||void 0===C?void 0:C.fontFamily)||"'Noto Sans', sans-serif",unitScaling:i,percentageScaling:n,scaleFactor:this.scaleFactor}}))}emPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.scaleFactor}autoUnitScaling(){const t=this.emPx(),e=t*et,{absMax:o,hasNeg:i,hasPos:n}=this.getAbsBarColumnStats();if(o<=0||e<=0)return.01;const{maxBarWidth:s,cutWidth:r}=nt(this.barColumnMaxWidth,t,i,n);return Math.min(.8*s,r)/(o*e)}autoPercentageScaling(){const t=this.emPx(),e=t*et,{absMax:o,hasNeg:i,hasPos:n}=this.getRelativeBarColumnStats();if(o<=0||e<=0)return.5;const{maxPinLength:s}=st(this.barColumnMaxWidth,t,i,n);return.8*s/(o*e)}getAbsBarColumnStats(){return this.collectBarColumnStats((t=>!t.key.startsWith("dr")&&!t.waterfall),1)}getRelativeBarColumnStats(){return this.collectBarColumnStats((t=>t.key.startsWith("dr")),100)}collectBarColumnStats(t,e){const o={absMax:0,hasNeg:!1,hasPos:!1};if(!this.table)return o;for(const i of this.table.getBody())if(i.type!==z.SUM)for(const n of i.getCells())n.isBarChart&&n.columnStats&&t(n)&&(o.absMax=Math.max(o.absMax,n.columnStats.absMax*e),o.hasNeg=o.hasNeg||n.columnStats.min<0,o.hasPos=o.hasPos||n.columnStats.max>0);return o}get element(){return this}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{position:relative;display:inline-block}table{background-color:var(--bn-font-background, white);font-size:var(--bn-font-size, 1em);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);border-spacing:0.3em 0}thead{border-style:none}tr:first-child td{border-top:none;padding-top:0.5em}td.ac1,td.ac2,td.ac3,td.ac4,td.pp1,td.pp2,td.pp3,td.pp4,td.pl1,td.pl2,td.pl3,td.pl4,td.fc1,td.fc2,td.fc3,td.fc4,td.share,td.variance,td.pos_pos,td.pos_neg,td.neg_pos,td.neg_neg,td.pos_neutral,td.neg_neutral{text-align:right}.category-w100{min-width:100em;max-width:100em}.category-w50{min-width:50em;max-width:50em}.category-w25{min-width:25em;max-width:25em}.category-w20{min-width:20em;max-width:20em}.category-w15{min-width:15em;max-width:15em}.category-w10{min-width:10em;max-width:10em}.category-w5{min-width:5em;max-width:5em}.prefix-second{color:transparent;font-style:normal}.prefix-first{font-style:normal}th{border-bottom:0.1em solid black;text-align:right;font-weight:normal;vertical-align:text-top}td.columnGroup,th.columnGroup{font-size:0.6em}td.columnSubGroup,th.columnSubGroup{font-size:0.6em;border-spacing:0em 0;font-style:italic}td.base,th.base{font-style:normal}th.ofit,td.ofit,tr.ofit,th.partof,td.partof,tr.partof{font-size:0.6em;font-style:italic}td.ofit,td.partof{font-size:0.6em;font-style:italic}th.ofit td,tr.ofit td,th.partof td,tr.partof td{border-top:0em solid black;padding-left:1em}th.ofit share,th.partof share,tr.share td{border-top:0em solid black}th.share,tr.share,td.share{font-size:0.6em;font-style:italic}th.filler{border-bottom:0em solid black;text-align:right}td.filler{border-top:0em none !important;border-bottom:0em none;text-align:right}th.group{text-align:center;border-spacing:1em 0}th.headerlabel{border-bottom:0em none black;padding-bottom:0em}th.intervalGroup{border-bottom:0.1em solid black;text-align:center;font-weight:bold}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal,td.percentpoint{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em dashed #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}'}},[1,"bn-table-renderer",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],selectedStyle:[513,"selected-style"],sumTitle:[1,"sum-title"],scenarios:[16],scenariosDataFormat:[1,"scenarios-data-format"],grouped:[4],limit:[2],showGroupTitle:[4,"show-group-title"],thereof:[16],partof:[16],order:[16],categorythereof:[16],attributeColumns:[16],type:[1],categoryWidth:[1,"category-width"],dataFormatDigits:[16],ruleSetConfig:[16],i18n:[1040],i18nMode:[1,"i18n-mode"],measureScale:[1,"measure-scale"],measureUnit:[1,"measure-unit"],showMeasureScale:[4,"show-measure-scale"],measureType:[1,"measure-type"],filter:[1],barColumns:[16],interval:[1],barColumnMaxWidth:[2,"bar-column-max-width"],unitScaling:[2,"unit-scaling"],percentageScaling:[2,"percentage-scaling"],reportAutoScaling:[16],errors:[16],scaleFactor:[2,"scale-factor"],getLayoutDetail:[64]}]);function Ct(){"undefined"!=typeof customElements&&["bn-table-renderer"].forEach((t=>{"bn-table-renderer"===t&&(customElements.get(n(t))||customElements.define(n(t),_t))}))}export{_t as B,V as I,I as T,Q as a,Ct as d}
@@ -0,0 +1 @@
1
+ import{D as t}from"./p-DEHnizot.js";var n,a,s,o,e,r,i,c;!function(t){t.ALL="all",t.META="meta"}(n||(n={})),function(t){t.CURRENCY="currency",t.VOLUME="volume"}(a||(a={})),function(t){t.AC1="ac1",t.AC2="ac2",t.AC3="ac3",t.AC4="ac4",t.PP1="pp1",t.PP2="pp2",t.PP3="pp3",t.PP4="pp4",t.FC1="fc1",t.FC2="fc2",t.FC3="fc3",t.FC4="fc4",t.PL1="pl1",t.PL2="pl2",t.PL3="pl3",t.PL4="pl4"}(s||(s={})),function(t){t.POS="pos",t.NEG="neg",t.NEU="neu",t.OP="op",t.OPINV="opinv"}(o||(o={})),function(t){t.DECIMAL="decimal",t.PERCENT="percent"}(e||(e={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(r||(r={})),function(t){t.INF="inf",t.W100="w100",t.W50="w50",t.W25="w25",t.W20="w20",t.W15="w15",t.W10="w10",t.W5="w5"}(i||(i={})),function(t){t.W5="w5",t.W10="w10",t.W15="w15",t.W20="w20",t.W25="w25",t.W30="w30",t.W40="w40",t.W60="w60",t.W80="w80",t.W100="w100"}(c||(c={}));const u={[c.W5]:5,[c.W10]:10,[c.W15]:15,[c.W20]:20,[c.W25]:25,[c.W30]:30,[c.W40]:40,[c.W60]:60,[c.W80]:80,[c.W100]:100};var f,l,p,w,m,b;!function(t){t.ROWGROUP="rowGroup",t.ROWGROUPINDEX="rowGroupIndex",t.CATEGORY="category",t.CATEGORYINDEX="categoryIndex",t.SUBCATEGORY="subCategory",t.SUBCATEGORYINDEX="subCategoryIndex"}(f||(f={})),function(t){t.SMART="smart",t.LONG="long",t.SHORT="short"}(l||(l={})),function(t){t.COLUMN="column",t.LINE="line",t.WATERFALL="waterfall"}(p||(p={})),function(t){t.BAR="bar",t.LINE="line",t.AUTO="auto"}(w||(w={})),function(t){t.SCENARIOS="scenarios",t.DIMENSIONS="dimensions"}(m||(m={})),function(t){t.ABSOLUTE="absolute",t.RELATIVE="relative",t.ABSOLUTE_RELATIVE="absolute-relative"}(b||(b={}));const y=100;var g;!function(t){t.ASC="asc",t.DESC="desc",t.DATASET="dataset"}(g||(g={}));class d{static isExisting(t){return null!=t}static isString(t){return"string"==typeof t}static isNumber(t){return"number"==typeof t&&!Number.isNaN(t)}static isBoolean(t){return"boolean"==typeof t}static isArray(t){return Array.isArray(t)}static isObject(t){return"object"==typeof t&&null!==t}static isOperator(t){return"+"===t||"-"===t}static isDate(n){return n instanceof t&&n.isValid}}export{f as A,u as B,d as C,e as D,n as I,a as M,y as R,s as S,c as T,o as a,l as b,r as c,i as d,m as e,g as f,b as g,w as h}
@@ -1 +1 @@
1
- import{C as t}from"./p-BQMKgvEC.js";const n=[["rowGroup","data-bn-row-group"],["category","data-bn-category"],["subCategory","data-bn-sub-category"],["date","data-bn-date"],["scenario","data-bn-scenario"],["row","data-bn-row"]],r="data-bn-part";function e(t,e){const a={};if(!t)return a;for(const[r,e]of n){const n=t[r];null!=n&&""!==n&&(a[e]=String(n))}return e&&(a[r]=e),a}function a(t){const e=t.getAttribute(r);if(!e)return;const a={part:e};for(const[r,e]of n){const n=t.getAttribute(e);null!=n&&(a[r]=n)}return a}function o(t){if(!t)return;const n=/^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})/.exec(t);return n?"00:00:00"===n[2]?n[1]:`${n[1]}T${n[2]}`:t}function u(t,n){return null==n?{}:t.startsWith("rowGroup")?{rowGroup:String(n)}:t.startsWith("subCategory")?{subCategory:String(n)}:{category:String(n)}}function f(t){return"fc"===t||"hatched"===t?"hatched":"solid"===t||"outlined"===t?t:void 0}class s{constructor(t="#000000",n="#000000",r=.1){this.stroke=t,this.fill=n,this.width=r}}class d{adapt(n){const r=new s(n.stroke,n.fill,n.width);return r.fillpattern=f(n.fillpattern),"outlined"===r.fillpattern&&(r.fill="transparent"),t.isString(n.dasharray)&&(r.dasharray=n.dasharray),r}default(){return new s("#000000","#000000",.3)}defaultAC(){return new s("#000000","#000000",.3)}defaultFC(){const t=new s("#000000","#000000",.3);return t.dasharray="10 5 5 5",t.fillpattern="hatched",t}defaultPP(){return new s("#999999","#999999",.3)}defaultPL(){return new s("#000000","#ffffff",.3)}defaultPos(){return new s("#00ff00","#00ff00",.3)}defaultNeg(){return new s("#ff0000","#ff0000",.3)}defaultNeu(){return new s("#999999","#999999",.3)}}export{d as S,e as d,u as l,f as n,o as p,a as r}
1
+ import{C as t}from"./p-D5LDmR4u.js";const n=[["rowGroup","data-bn-row-group"],["category","data-bn-category"],["subCategory","data-bn-sub-category"],["date","data-bn-date"],["scenario","data-bn-scenario"],["row","data-bn-row"]],r="data-bn-part";function e(t,e){const a={};if(!t)return a;for(const[r,e]of n){const n=t[r];null!=n&&""!==n&&(a[e]=String(n))}return e&&(a[r]=e),a}function a(t){const e=t.getAttribute(r);if(!e)return;const a={part:e};for(const[r,e]of n){const n=t.getAttribute(e);null!=n&&(a[r]=n)}return a}function o(t){if(!t)return;const n=/^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})/.exec(t);return n?"00:00:00"===n[2]?n[1]:`${n[1]}T${n[2]}`:t}function u(t,n){return null==n?{}:t.startsWith("rowGroup")?{rowGroup:String(n)}:t.startsWith("subCategory")?{subCategory:String(n)}:{category:String(n)}}function f(t){return"fc"===t||"hatched"===t?"hatched":"solid"===t||"outlined"===t?t:void 0}class s{constructor(t="#000000",n="#000000",r=.1){this.stroke=t,this.fill=n,this.width=r}}class d{adapt(n){const r=new s(n.stroke,n.fill,n.width);return r.fillpattern=f(n.fillpattern),"outlined"===r.fillpattern&&(r.fill="transparent"),t.isString(n.dasharray)&&(r.dasharray=n.dasharray),r}default(){return new s("#000000","#000000",.3)}defaultAC(){return new s("#000000","#000000",.3)}defaultFC(){const t=new s("#000000","#000000",.3);return t.dasharray="10 5 5 5",t.fillpattern="hatched",t}defaultPP(){return new s("#999999","#999999",.3)}defaultPL(){return new s("#000000","#ffffff",.3)}defaultPos(){return new s("#00ff00","#00ff00",.3)}defaultNeg(){return new s("#ff0000","#ff0000",.3)}defaultNeu(){return new s("#999999","#999999",.3)}}export{d as S,e as d,u as l,f as n,o as p,a as r}
@@ -1 +1 @@
1
- import{m as t}from"./p-BYBpC0EO.js";import{n as s}from"./p-DYG9FH_u.js";import{f as e,g as o}from"./p-D6YGOYV1.js";import{r as a}from"./p-DEHnizot.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.textContent=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 f(t,s,e){return`.${s} {${t.cssName}: ${e};}`}function N(s,e){const o=document.createElement("div").style;o.setProperty(s.cssName,e);const a=o.getPropertyValue(s.cssName);if(o.cssText=`${s.cssName}:${a};--bn-end:1`,!a||a.includes("<")||"1"!==o.getPropertyValue("--bn-end"))return;const r=function(s,e){const o=t(e);return`bn-c-${s.className}_${o}`}(s,e);return{className:r,style:f(s,r,a)}}const l=t=>{const s=new Map;return i.forEach((e=>{const o=t.getAttribute(e);if(o){["top","left","right","bottom"].includes(e)&&s.set("position",N(c.position,"absolute"));const t=N(c[e],(c[e].transform||function(t){return t})(o));t&&s.set(e,t)}})),s},u=new MutationObserver((t=>{for(const s of t){const t=s.target,o=l(t);n.apply(o);const a=Array.from(o.values()).map((t=>t.className));t.className=t.className.split(" ").filter((t=>!t.startsWith("bn-c-"))).concat(...a).join(" "),e(t)}})),d=t=>{const s=t.connectedCallback,e=t.disconnectedCallback;t.connectedCallback=()=>{const e=o(t);if(!e)throw new Error("Can't find element field in component undefined");(t=>{const s=l(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(" "),u.observe(t,{attributes:!0,attributeFilter:i,childList:!1,subtree:!1})})(e),a(s,t)},t.disconnectedCallback=()=>{a(e,t)}};export{d as w}
1
+ import{m as t}from"./p-BYBpC0EO.js";import{n as s}from"./p-CYv_8LrR.js";import{f as e,g as o}from"./p-D6YGOYV1.js";import{r as a}from"./p-DEHnizot.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.textContent=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 f(t,s,e){return`.${s} {${t.cssName}: ${e};}`}function N(s,e){const o=document.createElement("div").style;o.setProperty(s.cssName,e);const a=o.getPropertyValue(s.cssName);if(o.cssText=`${s.cssName}:${a};--bn-end:1`,!a||a.includes("<")||"1"!==o.getPropertyValue("--bn-end"))return;const r=function(s,e){const o=t(e);return`bn-c-${s.className}_${o}`}(s,e);return{className:r,style:f(s,r,a)}}const l=t=>{const s=new Map;return i.forEach((e=>{const o=t.getAttribute(e);if(o){["top","left","right","bottom"].includes(e)&&s.set("position",N(c.position,"absolute"));const t=N(c[e],(c[e].transform||function(t){return t})(o));t&&s.set(e,t)}})),s},d=new MutationObserver((t=>{for(const s of t){const t=s.target,o=l(t);n.apply(o);const a=Array.from(o.values()).map((t=>t.className));t.className=t.className.split(" ").filter((t=>!t.startsWith("bn-c-"))).concat(...a).join(" "),e(t)}})),p=t=>{const s=t.connectedCallback,e=t.disconnectedCallback;t.connectedCallback=()=>{const e=o(t);if(!e)throw new Error("Can't find element field in component undefined");(t=>{const s=l(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(" "),d.observe(t,{attributes:!0,attributeFilter:i,childList:!1,subtree:!1})})(e),a(s,t)},t.disconnectedCallback=()=>{a(e,t)}};export{p as w}
@@ -0,0 +1 @@
1
+ import{p as t,H as e,h as i,a,t as s}from"./p-D6YGOYV1.js";import{v as r,a as n,b as o,c as d,d as l,e as h,i as u,f as v,g as p}from"./p-CYv_8LrR.js";import{w as m,D as c}from"./p-DEHnizot.js";import{w as f}from"./p-B3F_c9GB.js";import{a as b,g}from"./p-BcOud3dQ.js";import{w as D}from"./p-DLLljAll.js";import{w as y}from"./p-C6XrNN2m.js";import{r as w}from"./p-M6hn0BuZ.js";import{w as S}from"./p-BWRE5w0i.js";import{w as N}from"./p-CGI6XIaK.js";import{I as k}from"./p-D5LDmR4u.js";import{a as E}from"./p-BNWZoAip.js";import{a as R,D as j}from"./p-xhiPDAZa.js";import{d as A}from"./p-BldMZbAf.js";const L=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.businessUnit="",this.order="category",this.orderDirection="asc",this.dateFormat="none",this.dateLink="none",D(this),m(this),this.t=f(this).t,this.errors=N(this),this.componentStyle=y(this),this.ruleSetConfig=S(this)}validateScenario(t){const e="WARN_scenarios",i=r(t);i.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"scenarios: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."}):this.errors.remove(e)}validateVariances(t){const e="WARN_variances",i=n(t);i.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"variances: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."}):this.errors.remove(e)}validateOrder(t){const e=o(t),i="WARN_order";e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+(null==e?void 0:e.toString())+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const e="WARN_orderDirection";d(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateMeasures(t){const e="WARN_measures",i=l(t);i.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"measures: invalid value(s) '"+(null==i?void 0:i.toString())+'\' are not supported. Valid format example: [{"name": "Bruttoumsatz", "unit": "mEUR"}]'}):this.errors.remove(e)}validateDateStart(t){const e="WARN_dateStart";h(t)||u(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"dateStart: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateDateEnd(t){const e="WARN_dateEnd";h(t)||u(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"dateStart: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateDateFormat(t){const e="WARN_dateFormat";v(t)||u(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"dateFormat: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateDateLink(t){const e="WARN_dateLink";p(t)||u(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"dateLink: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateMeasures(this.measures),this.validateDateStart(this.dateStart),this.validateDateEnd(this.dateEnd),this.validateDateFormat(this.dateFormat),this.validateDateLink(this.dateLink),this.validateOrderDirection(this.orderDirection),this.validateOrder(this.order)}prepareI18n(){const t=b,e=new Map(["SEPARATOR_WS","in","CONNECTOR_WS"].map((t=>[t,this.t(".".concat(t))]))),i=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...i.entries(),...e.entries(),...w(this.ruleSetConfig("user"))])}prepareI18nMode(){return k.META}prepareLocale(){return g(this.element).context.state.locale||"de"}prepareTitleOrder(){var t;return u(this.order)||u(this.orderDirection)?null:{hierarchy:this.order.split(",").map((t=>t.trim())),direction:E[null===(t=this.orderDirection)||void 0===t?void 0:t.toUpperCase()]}}prepareTitleTimePeriod(){var t,e;return u(this.dateStart)&&u(this.dateEnd)||u(this.dateLink)?null:{start:c.fromISO(this.dateStart,{zone:"utc"}),end:c.fromISO(this.dateEnd,{zone:"utc"}),format:j[null===(t=this.dateFormat)||void 0===t?void 0:t.toUpperCase()],link:R[null===(e=this.dateLink)||void 0===e?void 0:e.toUpperCase()]}}prepareMeasures(){if(u(this.measures))return[];try{return JSON.parse(this.measures)}catch(t){return[]}}prepareScenarios(){var t,e,i,a;if(u(this.scenarios)&&u(this.variances))return[];let s=[];return(null===(t=this.scenarios)||void 0===t?void 0:t.trim().length)>0&&(s=s.concat(null===(e=this.scenarios)||void 0===e?void 0:e.split(","))),(null===(i=this.variances)||void 0===i?void 0:i.trim().length)>0&&(s=s.concat(null===(a=this.variances)||void 0===a?void 0:a.split(","))),s.map((t=>t.trim()))}prepareBusinessUnit(){return u(this.businessUnit)||"null"===this.businessUnit?null:this.businessUnit}getFontStyles(){return this.componentStyle((t=>{var e,i,a,s;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(a=t.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(s=t.global)||void 0===s?void 0:s.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles();return i(a,{key:"3fab16c08a9023801ce8d6cf2bea9a87945fd1d0",style:t},i("bn-title-renderer",{key:"056569256646abf17f0aaf4151f5add7065439a4",businessUnit:this.prepareBusinessUnit(),scenarios:this.prepareScenarios(),measures:this.prepareMeasures(),timeperiod:this.prepareTitleTimePeriod(),order:this.prepareTitleOrder(),i18n:this.prepareI18n(),"i18n-mode":this.prepareI18nMode(),locale:this.prepareLocale(),ruleSetConfig:this.ruleSetConfig()}))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],measures:[{validateMeasures:0}],dateStart:[{validateDateStart:0}],dateEnd:[{validateDateEnd:0}],dateFormat:[{validateDateFormat:0}],dateLink:[{validateDateLink:0}]}}static get style(){return':host{padding:0.5em;margin-bottom:0.5em;box-sizing:border-box;-webkit-box-sizing:border-box;width:100%;display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}'}},[1,"bn-title",{selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],businessUnit:[1,"business-unit"],scenarios:[1],variances:[1],order:[1],orderDirection:[1,"order-direction"],measures:[1],dateStart:[1,"date-start"],dateEnd:[1,"date-end"],dateFormat:[1,"date-format"],dateLink:[1,"date-link"]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],measures:[{validateMeasures:0}],dateStart:[{validateDateStart:0}],dateEnd:[{validateDateEnd:0}],dateFormat:[{validateDateFormat:0}],dateLink:[{validateDateLink:0}]}]);function W(){"undefined"!=typeof customElements&&["bn-title","bn-title-renderer"].forEach((t=>{switch(t){case"bn-title":customElements.get(s(t))||customElements.define(s(t),L);break;case"bn-title-renderer":customElements.get(s(t))||A()}}))}export{L as T,W as d}
@@ -1 +1 @@
1
- import{C as n}from"./p-BQMKgvEC.js";function i(n,i){var o;const e=null!==(o=null==n?void 0:n.trim())&&void 0!==o?o:"";if(""===e||"null"===e)return{data:null,parseError:!1};if(e.startsWith("{")||e.startsWith("["))try{const n=JSON.parse(e);return"object"!=typeof n||null===n||Array.isArray(n)?{data:null,parseError:!0}:{data:n,parseError:!1}}catch(n){return{data:null,parseError:!0}}return null!==i?{data:{[i]:e},parseError:!1}:{data:null,parseError:!0}}function o(n,i){return Object.keys(n).filter((n=>!i.includes(n)))}function e(i,o,e){if(n.isExisting(i[o]))return n.isString(i[o])?i[o]:void e.push(o)}function r(i,o,e){if(n.isExisting(i[o]))return n.isNumber(i[o])?i[o]:void e.push(o)}const t=["measure","label","unit","min","max","refLine","highlight"];function u(i){const u=[],l=e(i,"measure",u);if(void 0===l||""===l.trim())return u.push("measure"),{config:null,unknownKeys:o(i,t),invalidFields:u};const s={measure:l.trim()};return s.label=e(i,"label",u),s.unit=e(i,"unit",u),s.min=r(i,"min",u),s.max=r(i,"max",u),s.refLine=r(i,"refLine",u),s.highlight=function(i,o){if(!n.isExisting(i.highlight))return;if(!n.isObject(i.highlight)||Array.isArray(i.highlight))return void o.push("highlight");const e=i.highlight,t={},u=r(e,"from",o),l=r(e,"to",o);return void 0!==u&&(t.from=u),void 0!==l&&(t.to=l),t}(i,u),{config:s,unknownKeys:o(i,t),invalidFields:u}}const l=["measure","label","unit","group"];function s(n){const i=[],r=e(n,"measure",i);if(void 0===r||""===r.trim())return i.push("measure"),{config:null,unknownKeys:o(n,l),invalidFields:i};const t={measure:r.trim()};return t.label=e(n,"label",i),t.unit=e(n,"unit",i),t.group=e(n,"group",i),{config:t,unknownKeys:o(n,l),invalidFields:i}}const a=["measure"];function c(n){const i=[],r=e(n,"measure",i);return void 0===r||""===r.trim()?(i.push("measure"),{config:null,unknownKeys:o(n,a),invalidFields:i}):{config:{measure:r.trim()},unknownKeys:o(n,a),invalidFields:i}}const f=["values","label","unit","highlight"];function d(i){const t=[];let u=null;if("auto"===i.values?u="auto":n.isArray(i.values)&&i.values.every((i=>n.isNumber(i)))?u=i.values:t.push("values"),null===u)return{config:null,unknownKeys:o(i,f),invalidFields:t};const l={values:u};if(l.label=e(i,"label",t),l.unit=e(i,"unit",t),n.isExisting(i.highlight))if(n.isObject(i.highlight)&&!Array.isArray(i.highlight)){const n=r(i.highlight,"from",t);void 0!==n&&(l.highlight={from:n})}else t.push("highlight");return{config:l,unknownKeys:o(i,f),invalidFields:t}}const v=["points","values","max"];function g(i,e){const r=[],t={points:e.points,values:e.values,max:e.max};return n.isExisting(i.points)&&("auto"===i.points||"none"===i.points||"all"===i.points||n.isArray(i.points)&&i.points.every((i=>n.isString(i)))?t.points=i.points:r.push("points")),n.isExisting(i.values)&&(n.isBoolean(i.values)?t.values=i.values:r.push("values")),n.isExisting(i.max)&&(n.isNumber(i.max)&&i.max>0?t.max=Math.floor(i.max):r.push("max")),{config:t,unknownKeys:o(i,v),invalidFields:r}}const m=["level","columns"];function h(i){const e=[],r=n.isString(i.level)?i.level.toLowerCase():null;if("rowgroup"!==r&&"category"!==r)return e.push("level"),{config:null,unknownKeys:o(i,m),invalidFields:e};const t={level:r};return n.isExisting(i.columns)&&(n.isNumber(i.columns)&&i.columns>=1?t.columns=Math.floor(i.columns):e.push("columns")),{config:t,unknownKeys:o(i,m),invalidFields:e}}const p=["show","position"];function y(i){const e=[],r={show:!0,position:"right"};return n.isExisting(i.show)&&(n.isBoolean(i.show)?r.show=i.show:e.push("show")),n.isExisting(i.position)&&("right"===i.position||"bottom"===i.position?r.position=i.position:e.push("position")),{config:r,unknownKeys:o(i,p),invalidFields:e}}export{s as a,c as b,h as c,g as d,y as e,d as f,i as p,u as t}
1
+ import{C as n}from"./p-D5LDmR4u.js";function i(n,i){var o;const e=null!==(o=null==n?void 0:n.trim())&&void 0!==o?o:"";if(""===e||"null"===e)return{data:null,parseError:!1};if(e.startsWith("{")||e.startsWith("["))try{const n=JSON.parse(e);return"object"!=typeof n||null===n||Array.isArray(n)?{data:null,parseError:!0}:{data:n,parseError:!1}}catch(n){return{data:null,parseError:!0}}return null!==i?{data:{[i]:e},parseError:!1}:{data:null,parseError:!0}}function o(n,i){return Object.keys(n).filter((n=>!i.includes(n)))}function e(i,o,e){if(n.isExisting(i[o]))return n.isString(i[o])?i[o]:void e.push(o)}function r(i,o,e){if(n.isExisting(i[o]))return n.isNumber(i[o])?i[o]:void e.push(o)}const t=["measure","label","unit","min","max","refLine","highlight"];function u(i){const u=[],l=e(i,"measure",u);if(void 0===l||""===l.trim())return u.push("measure"),{config:null,unknownKeys:o(i,t),invalidFields:u};const s={measure:l.trim()};return s.label=e(i,"label",u),s.unit=e(i,"unit",u),s.min=r(i,"min",u),s.max=r(i,"max",u),s.refLine=r(i,"refLine",u),s.highlight=function(i,o){if(!n.isExisting(i.highlight))return;if(!n.isObject(i.highlight)||Array.isArray(i.highlight))return void o.push("highlight");const e=i.highlight,t={},u=r(e,"from",o),l=r(e,"to",o);return void 0!==u&&(t.from=u),void 0!==l&&(t.to=l),t}(i,u),{config:s,unknownKeys:o(i,t),invalidFields:u}}const l=["measure","label","unit","group"];function s(n){const i=[],r=e(n,"measure",i);if(void 0===r||""===r.trim())return i.push("measure"),{config:null,unknownKeys:o(n,l),invalidFields:i};const t={measure:r.trim()};return t.label=e(n,"label",i),t.unit=e(n,"unit",i),t.group=e(n,"group",i),{config:t,unknownKeys:o(n,l),invalidFields:i}}const a=["measure"];function c(n){const i=[],r=e(n,"measure",i);return void 0===r||""===r.trim()?(i.push("measure"),{config:null,unknownKeys:o(n,a),invalidFields:i}):{config:{measure:r.trim()},unknownKeys:o(n,a),invalidFields:i}}const f=["values","label","unit","highlight"];function d(i){const t=[];let u=null;if("auto"===i.values?u="auto":n.isArray(i.values)&&i.values.every((i=>n.isNumber(i)))?u=i.values:t.push("values"),null===u)return{config:null,unknownKeys:o(i,f),invalidFields:t};const l={values:u};if(l.label=e(i,"label",t),l.unit=e(i,"unit",t),n.isExisting(i.highlight))if(n.isObject(i.highlight)&&!Array.isArray(i.highlight)){const n=r(i.highlight,"from",t);void 0!==n&&(l.highlight={from:n})}else t.push("highlight");return{config:l,unknownKeys:o(i,f),invalidFields:t}}const v=["points","values","max"];function m(i,e){const r=[],t={points:e.points,values:e.values,max:e.max};return n.isExisting(i.points)&&("auto"===i.points||"none"===i.points||"all"===i.points||n.isArray(i.points)&&i.points.every((i=>n.isString(i)))?t.points=i.points:r.push("points")),n.isExisting(i.values)&&(n.isBoolean(i.values)?t.values=i.values:r.push("values")),n.isExisting(i.max)&&(n.isNumber(i.max)&&i.max>0?t.max=Math.floor(i.max):r.push("max")),{config:t,unknownKeys:o(i,v),invalidFields:r}}const g=["level","columns"];function h(i){const e=[],r=n.isString(i.level)?i.level.toLowerCase():null;if("rowgroup"!==r&&"category"!==r)return e.push("level"),{config:null,unknownKeys:o(i,g),invalidFields:e};const t={level:r};return n.isExisting(i.columns)&&(n.isNumber(i.columns)&&i.columns>=1?t.columns=Math.floor(i.columns):e.push("columns")),{config:t,unknownKeys:o(i,g),invalidFields:e}}const p=["show","position"];function y(i){const e=[],r={show:!0,position:"right"};return n.isExisting(i.show)&&(n.isBoolean(i.show)?r.show=i.show:e.push("show")),n.isExisting(i.position)&&("right"===i.position||"bottom"===i.position?r.position=i.position:e.push("position")),{config:r,unknownKeys:o(i,p),invalidFields:e}}export{s as a,c as b,h as c,m as d,y as e,d as f,i as p,u as t}
@@ -1 +1 @@
1
- import{r as n}from"./p-t4xPltK2.js";import{r as t}from"./p-COqIkH1M.js";import{r as i,a as e}from"./p-CckAR27O.js";import{m as o}from"./p-DSkyHSIL.js";import{LAYOUT_STATE_VERSION as r}from"./index.js";const l=/^Scenario([1-4])$/,d=/^stacked_(?:col|bar)_(\d+)_seg_\d+$/,a='g[id^="stacked_col_"], g[id^="stacked_bar_"]';function s(n,t){var i;let e=n.parentElement;for(;e&&e!==t;){const n=l.exec(null!==(i=e.id)&&void 0!==i?i:"");if(n)return`scenario${n[1]}`;e=e.parentElement}}function c(n){if(""===n)return;const t=Number(n.split("_")[0]);return Number.isFinite(t)?t:void 0}function u(n){const t=n.getAttribute("data-bn-index");return null===t?void 0:Number(t)}function v(n,t){var i;return(null!==(i=n.getAttribute("class"))&&void 0!==i?i:"").split(/\s+/).includes(t)}function f(i,e,r,l,f){var m,g;const b={regions:[],barCount:0,baseline:{}},p=[];return Array.from(null!==(g=null===(m=i.shadowRoot)||void 0===m?void 0:m.querySelectorAll(e))&&void 0!==g?g:[]).forEach(((e,m)=>{var g,x,k,_;const A=null!==(g=r[m])&&void 0!==g?g:`segment${m}`,$=null===(x=e.shadowRoot)||void 0===x?void 0:x.querySelector("svg#drawCanvas");if($&&(b.regions.push({id:`canvas:${A}`,rect:o($,l)}),0===m&&(b.barCount=function(n){const t=n.querySelector('g[id="Scenario1"]');if(t)return Array.from(t.children).filter((n=>{var t;return/^\d+$/.test(null!==(t=n.id)&&void 0!==t?t:"")})).length;const i=new Set;return n.querySelectorAll(a).forEach((n=>{const t=d.exec(n.id);t&&n.querySelector("rect")&&i.add(t[1])})),i.size}($),b.baseline=n($,i)),"full"===f&&p.push(...function(n,i,e){const r=[],l=new Set;return n.querySelectorAll('g[id$="_RECT"]').forEach(((d,a)=>{var u;l.add(d);const v={kind:"bar",id:d.id,segment:i,scenario:s(d,n),index:null!==(u=c(d.id))&&void 0!==u?u:a,rect:o(d,e),point:t(d)};r.push(v)})),n.querySelectorAll(a).forEach((n=>{var a,s,c;const u=d.exec(n.id);if(!u||!n.querySelector("rect"))return;l.add(n);const v=t(n),f={kind:"bar",id:n.id,segment:i,scenario:`stack:${null!==(c=null!==(s=null!==(a=null==v?void 0:v.scenario)&&void 0!==a?a:null==v?void 0:v.subCategory)&&void 0!==s?s:null==v?void 0:v.category)&&void 0!==c?c:""}`,index:Number(u[1]),rect:o(n,e),point:v};r.push(f)})),["DATA","SCENARIO"].forEach((d=>{n.querySelectorAll(`g[id$="_${d}_Label"]`).forEach(((n,a)=>{var s,u,f;if(v(n,"hide"))return;const m=null!==(u=null===(s=n.textContent)||void 0===s?void 0:s.trim())&&void 0!==u?u:"";if(!m)return;l.add(n);const g={kind:"label",id:n.id,role:"DATA"===d?"data":"scenario",text:m,segment:i,index:null!==(f=c(n.id))&&void 0!==f?f:a,rect:o(n,e),point:t(n)};r.push(g)}))})),n.querySelectorAll("[data-bn-part]").forEach(((d,a)=>{var s,v,f;if(l.has(d))return;const m=t(d),g=null!==(s=u(d))&&void 0!==s?s:function(n,t){var i;for(let e=n;e&&e!==t;e=e.parentElement){const n=c(null!==(i=e.id)&&void 0!==i?i:"");if(void 0!==n)return n}}(d,n);if("element"===m.part){const n={kind:"point",series:m.scenario,index:null!=g?g:a,rect:o(d,e),point:m};return void r.push(n)}const b={kind:"label",id:d.id||void 0,role:"data",text:null!==(f=null===(v=d.textContent)||void 0===v?void 0:v.trim())&&void 0!==f?f:"",segment:i,index:g,rect:o(d,e),point:m};r.push(b)})),n.querySelectorAll('g[id="axis"] line').forEach((n=>{var t;const l=(null!==(t=n.getAttribute("class"))&&void 0!==t?t:"").split(/\s+/).find((n=>n.startsWith("axis-"))),d=o(n,e),a={kind:"axis",style:null==l?void 0:l.slice(5),orientation:d.context.width>=d.context.height?"horizontal":"vertical",segment:i,rect:d};r.push(a)})),n.querySelectorAll('g[id="AxisAndDateLables"] text, g[id="AxisAndDateLabelsLine"] text').forEach((t=>{var l,d;if(v(t,"hide")||function(n,t){var i;let e=n.parentElement;for(;e&&e!==t;){if((null!==(i=e.id)&&void 0!==i?i:"").endsWith("_Label"))return!0;e=e.parentElement}return!1}(t,n))return;const a=null!==(d=null===(l=t.textContent)||void 0===l?void 0:l.trim())&&void 0!==d?d:"";if(!a)return;const s={kind:"label",role:v(t,"categories")?"title":"category",text:a,segment:i,rect:o(t,e)};r.push(s)})),r}($,A,l))),"full"===f){const n=null===(k=e.shadowRoot)||void 0===k?void 0:k.querySelector(".footer"),t=null===(_=null==n?void 0:n.textContent)||void 0===_?void 0:_.trim();t&&p.push({kind:"label",role:"footer",text:t,segment:A,rect:o(n,l)})}})),"full"===f&&(b.elements=p),b}function m(l,d,a,s,c,v){var f,m,g,b;const p={version:r,tag:l.localName,id:e(l),slot:null!==(f=l.getAttribute("slot"))&&void 0!==f?f:void 0,rect:o(l,c),em:s,regions:[],metadata:{title:a},diagnostics:i(l)},x=null===(b=null===(g=null===(m=l.shadowRoot)||void 0===m?void 0:m.querySelector(d))||void 0===g?void 0:g.shadowRoot)||void 0===b?void 0:b.querySelector("svg#drawCanvas");return x&&(p.regions.push({id:"canvas",rect:o(x,c)}),p.metadata.pointCount=x.querySelectorAll("circle, ellipse").length,p.baseline=n(x,l),"full"===v&&(p.elements=function(n,i){const e=[];return n.querySelectorAll("circle, ellipse").forEach(((n,r)=>{const l={kind:"point",index:r,rect:o(n,i),point:t(n)};e.push(l)})),n.querySelectorAll('rect[data-bn-part="element"]').forEach(((n,r)=>{var l;const d=t(n),a={kind:"bar",segment:"base",scenario:null==d?void 0:d.scenario,index:null!==(l=u(n))&&void 0!==l?l:r,rect:o(n,i),point:d};e.push(a)})),n.querySelectorAll("text").forEach((n=>{var r,l;const d=null!==(l=null===(r=n.textContent)||void 0===r?void 0:r.trim())&&void 0!==l?l:"";if(!d)return;const a={kind:"label",role:"data",text:d,rect:o(n,i),point:t(n)};e.push(a)})),e}(x,c))),p}export{f as a,m as c}
1
+ import{r as n}from"./p-t4xPltK2.js";import{r as t}from"./p-DHAoxu6M.js";import{r as i,a as e}from"./p-CckAR27O.js";import{m as o}from"./p-DSkyHSIL.js";import{LAYOUT_STATE_VERSION as r}from"./index.js";const l=/^Scenario([1-4])$/,d=/^stacked_(?:col|bar)_(\d+)_seg_\d+$/,a='g[id^="stacked_col_"], g[id^="stacked_bar_"]';function s(n,t){var i;let e=n.parentElement;for(;e&&e!==t;){const n=l.exec(null!==(i=e.id)&&void 0!==i?i:"");if(n)return`scenario${n[1]}`;e=e.parentElement}}function c(n){if(""===n)return;const t=Number(n.split("_")[0]);return Number.isFinite(t)?t:void 0}function u(n){const t=n.getAttribute("data-bn-index");return null===t?void 0:Number(t)}function v(n,t){var i;return(null!==(i=n.getAttribute("class"))&&void 0!==i?i:"").split(/\s+/).includes(t)}function f(i,e,r,l,f){var m,g;const x={regions:[],barCount:0,baseline:{}},b=[];return Array.from(null!==(g=null===(m=i.shadowRoot)||void 0===m?void 0:m.querySelectorAll(e))&&void 0!==g?g:[]).forEach(((e,m)=>{var g,p,k,A;const _=null!==(g=r[m])&&void 0!==g?g:`segment${m}`,$=null===(p=e.shadowRoot)||void 0===p?void 0:p.querySelector("svg#drawCanvas");if($&&(x.regions.push({id:`canvas:${_}`,rect:o($,l)}),0===m&&(x.barCount=function(n){const t=n.querySelector('g[id="Scenario1"]');if(t)return Array.from(t.children).filter((n=>{var t;return/^\d+$/.test(null!==(t=n.id)&&void 0!==t?t:"")})).length;const i=new Set;return n.querySelectorAll(a).forEach((n=>{const t=d.exec(n.id);t&&n.querySelector("rect")&&i.add(t[1])})),i.size}($),x.baseline=n($,i)),"full"===f&&b.push(...function(n,i,e){const r=[],l=new Set;return n.querySelectorAll('g[id$="_RECT"]').forEach(((d,a)=>{var u;l.add(d);const v={kind:"bar",id:d.id,segment:i,scenario:s(d,n),index:null!==(u=c(d.id))&&void 0!==u?u:a,rect:o(d,e),point:t(d)};r.push(v)})),n.querySelectorAll(a).forEach((n=>{var a,s,c;const u=d.exec(n.id);if(!u||!n.querySelector("rect"))return;l.add(n);const v=t(n),f={kind:"bar",id:n.id,segment:i,scenario:`stack:${null!==(c=null!==(s=null!==(a=null==v?void 0:v.scenario)&&void 0!==a?a:null==v?void 0:v.subCategory)&&void 0!==s?s:null==v?void 0:v.category)&&void 0!==c?c:""}`,index:Number(u[1]),rect:o(n,e),point:v};r.push(f)})),["DATA","SCENARIO"].forEach((d=>{n.querySelectorAll(`g[id$="_${d}_Label"]`).forEach(((n,a)=>{var s,u,f;if(v(n,"hide"))return;const m=null!==(u=null===(s=n.textContent)||void 0===s?void 0:s.trim())&&void 0!==u?u:"";if(!m)return;l.add(n);const g={kind:"label",id:n.id,role:"DATA"===d?"data":"scenario",text:m,segment:i,index:null!==(f=c(n.id))&&void 0!==f?f:a,rect:o(n,e),point:t(n)};r.push(g)}))})),n.querySelectorAll("[data-bn-part]").forEach(((d,a)=>{var s,v,f;if(l.has(d))return;const m=t(d),g=null!==(s=u(d))&&void 0!==s?s:function(n,t){var i;for(let e=n;e&&e!==t;e=e.parentElement){const n=c(null!==(i=e.id)&&void 0!==i?i:"");if(void 0!==n)return n}}(d,n);if("element"===m.part){const n={kind:"point",series:m.scenario,index:null!=g?g:a,rect:o(d,e),point:m};return void r.push(n)}const x={kind:"label",id:d.id||void 0,role:"data",text:null!==(f=null===(v=d.textContent)||void 0===v?void 0:v.trim())&&void 0!==f?f:"",segment:i,index:g,rect:o(d,e),point:m};r.push(x)})),n.querySelectorAll('g[id="axis"] line').forEach((n=>{var t;const l=(null!==(t=n.getAttribute("class"))&&void 0!==t?t:"").split(/\s+/).find((n=>n.startsWith("axis-"))),d=o(n,e),a={kind:"axis",style:null==l?void 0:l.slice(5),orientation:d.context.width>=d.context.height?"horizontal":"vertical",segment:i,rect:d};r.push(a)})),n.querySelectorAll('g[id="AxisAndDateLables"] text, g[id="AxisAndDateLabelsLine"] text').forEach((t=>{var l,d;if(v(t,"hide")||function(n,t){var i;let e=n.parentElement;for(;e&&e!==t;){if((null!==(i=e.id)&&void 0!==i?i:"").endsWith("_Label"))return!0;e=e.parentElement}return!1}(t,n))return;const a=null!==(d=null===(l=t.textContent)||void 0===l?void 0:l.trim())&&void 0!==d?d:"";if(!a)return;const s={kind:"label",role:v(t,"categories")?"title":"category",text:a,segment:i,rect:o(t,e)};r.push(s)})),r}($,_,l))),"full"===f){const n=null===(k=e.shadowRoot)||void 0===k?void 0:k.querySelector(".footer"),t=null===(A=null==n?void 0:n.textContent)||void 0===A?void 0:A.trim();t&&b.push({kind:"label",role:"footer",text:t,segment:_,rect:o(n,l)})}})),"full"===f&&(x.elements=b),x}function m(l,d,a,s,c,v){var f,m,g,x;const b={version:r,tag:l.localName,id:e(l),slot:null!==(f=l.getAttribute("slot"))&&void 0!==f?f:void 0,rect:o(l,c),em:s,regions:[],metadata:{title:a},diagnostics:i(l)},p=null===(x=null===(g=null===(m=l.shadowRoot)||void 0===m?void 0:m.querySelector(d))||void 0===g?void 0:g.shadowRoot)||void 0===x?void 0:x.querySelector("svg#drawCanvas");return p&&(b.regions.push({id:"canvas",rect:o(p,c)}),b.metadata.pointCount=p.querySelectorAll("circle, ellipse").length,b.baseline=n(p,l),"full"===v&&(b.elements=function(n,i){const e=[];return n.querySelectorAll("circle, ellipse").forEach(((n,r)=>{const l={kind:"point",index:r,rect:o(n,i),point:t(n)};e.push(l)})),n.querySelectorAll('rect[data-bn-part="element"]').forEach(((n,r)=>{var l;const d=t(n),a={kind:"bar",segment:"base",scenario:null==d?void 0:d.scenario,index:null!==(l=u(n))&&void 0!==l?l:r,rect:o(n,i),point:d};e.push(a)})),n.querySelectorAll("text").forEach((n=>{var r,l;const d=null!==(l=null===(r=n.textContent)||void 0===r?void 0:r.trim())&&void 0!==l?l:"";if(!d)return;const a={kind:"label",role:"data",text:d,rect:o(n,i),point:t(n)};e.push(a)})),e}(p,c))),b}export{f as a,m as c}
@@ -0,0 +1 @@
1
+ import{S as t,g as n}from"./p-DEHnizot.js";import{m as r}from"./p-B2NXsfMz.js";class o{constructor(t){this.type="",this.base="",this.delta="",this.direction="",this.isValid=!1;const n=/(d|dr)(pl\d|ac\d|fc\d|pp\d)_(pl\d|ac\d|fc\d|pp\d)_(pos|neg|neu|opinv|op)/;if(n.test(t)){const r=n.exec(t);null!=r&&(this.type=String(r[1]),this.base=String(r[2]),this.delta=String(r[3]),this.direction=String(r[4]),this.isValid=!0)}}}function e(t,n,r){return"op"!==t&&"opinv"!==t?t:"op"===t!=(!r&&"-"===n)?"pos":"neg"}const i=["ac","pp","fc","pl"],s={10:"ac",20:"pp",30:"fc",50:"pl"};function c(t){var n;return null!==(n=s[t])&&void 0!==n?n:"ac"}function a(t,n){const r=i.map((t=>c(n.getScenarioColorIndex(`${t}1`))));if(r.every(((t,n)=>t===i[n])))return t;const o=Object.assign(Object.create(Object.getPrototypeOf(t)),t);return i.forEach(((n,e)=>{o[n]=t[r[e]]})),o}function u(t){var n,r;const o=new Map;for(const e of i){const i=null===(r=null===(n=null==t?void 0:t.scenarios)||void 0===n?void 0:n[e])||void 0===r?void 0:r.name;if(i)for(const t of[1,2,3,4])o.set(`${e}${t}`,1===t?i:`${i}${t}`)}return o}class l{constructor(n){this._dateFormat={year:"YYYY",quarter:"Q[Q] YYYY",month:"MMM YYYY",locale:"[KW]WW YYYY",day:"DD.MM.YYYY"},this._dateLinkFormat={avg:"Ø[DATE]",interval:"[DATE]..[DATE]",start:".[DATE]",end:"[DATE].",ytd:"_[DATE]",ytg:"[DATE]_",cum:"[DATE]_[DATE]",mat:"~[DATE]",none:"[DATE]"},this._scenarioMap=new Map;const o=r([t,null!=n?n:{}]);Object.entries(o.scenarios).forEach((([t,n])=>{var r,o,e;this.createScenarioMapEntry(t,null!==(r=n.name)&&void 0!==r?r:t,null!==(o=n.colorIndex)&&void 0!==o?o:10,null!==(e=n.sortIndex)&&void 0!==e?e:0)})),this._fallBackScenario=o.fallback}createScenarioMapEntry(t,n,r,o){const e=n,i=r;[1,2,3,4].forEach((r=>{this._scenarioMap.set(t+r,{name:n+r,group:e,colorIndex:i,sortIndex:o+10*r})}))}getScenario(t){return this._scenarioMap.has(t)?this._scenarioMap.get(t):this._fallBackScenario}getScenarioGroup(t){return this._scenarioMap.has(t)?this._scenarioMap.get(t).name:this._fallBackScenario.name}getScenarioColorIndex(t){return this._scenarioMap.has(t)?this._scenarioMap.get(t).colorIndex:this._fallBackScenario.colorIndex}getScenarioSorIndex(t){const n=this.normalizeVarianceScenario(t);return this._scenarioMap.has(n)?this._scenarioMap.get(n).sortIndex:this._fallBackScenario.sortIndex}normalizeVarianceScenario(t){if(null==t)return"";const n=new o(t);return n.isValid?n.type+n.delta:t}}var p,d,h={},f=n(function(){if(p)return h;p=1;var t={};return Object.defineProperty(h,"__esModule",{value:!0}),h.default=function(n,r){void 0===r&&(r={});var o=JSON.stringify({text:n,options:r});if(t[o])return t[o];r.font=r.font||"Times",r.fontSize=r.fontSize||"16px",r.fontWeight=r.fontWeight||"normal",r.width=r.width||"auto";var e=function(t,n){var r=document.createElement("div"),o=document.createTextNode(t);return r.appendChild(o),r.style.fontFamily=n.font,r.style.fontSize=n.fontSize,r.style.fontWeight=n.fontWeight,r.style.position="absolute",r.style.visibility="hidden",r.style.left="-999px",r.style.top="-999px",r.style.width=n.width,r.style.height="auto",document.body.appendChild(r),r}(n,r),i={width:e.offsetWidth,height:e.offsetHeight};return function(t){t.parentNode.removeChild(t)}(e),t[o]=i,i},h}());!function(t){t.OPERATION="operation",t.ROWGROUP="rowGroup",t.ROWGROUPINDEX="rowGroupIndex",t.CURRENTROW="currentRow",t.CATEGORY="category",t.CATEGORYINDEX="categoryIndex",t.SUBCATEGORY="subCategory",t.SUBCATEGORYINDEX="subCategoryIndex",t.COLUMNGROUP="columnGroup",t.COLUMNGROUPINDEX="columnIndex",t.COLUMNSUBGROUP="columnSubGroup",t.COLUMNSUBGROUPINDEX="columnSubGroupIndex",t.AC1="ac1",t.AC2="ac2",t.AC3="ac3",t.AC4="ac4",t.PP1="pp1",t.PP2="pp2",t.PP3="pp3",t.PP4="pp4",t.FC1="fc1",t.FC2="fc2",t.FC3="fc3",t.FC4="fc4",t.PL1="pl1",t.PL2="pl2",t.PL3="pl3",t.PL4="pl4",t.TOTALROWCOUNT="totalRowCnt",t.ROWNR="rowNr",t.TYPE="type"}(d||(d={}));class m{static number(t,n="decimal",r=1,o=0,e=1,i="de"){const s=`${i}|${n}|${r}|${o}`;let c=this.formats.get(s);if(!c){const t={style:n,useGrouping:!0,maximumFractionDigits:r,minimumFractionDigits:o};try{c=new Intl.NumberFormat([i,"de-DE"],t)}catch(n){c=new Intl.NumberFormat("de-DE",t)}this.formats.set(s,c)}const a=c.format(t/e);return(a===c.format(-0)?c.format(0):a).replace(/\s+(%)/g,"$1")}static translateScenarioLabel(t,n){if(null==t)return"";const r=new o(t);if(!r.isValid)return`${n.get(t)||t}`;let e,i;return d.AC1===r.base?(e=n.get("dr"===r.type?"ibcssymbol_delta_ac_relative":"ibcssymbol_delta_ac"),i=n.get(r.delta)||r.delta):(e=n.get("dr"===r.type?"ibcssymbol_delta_generic_relative":"ibcssymbol_delta_generic"),i=`${n.get(r.base)||r.base} - ${n.get(r.delta)||r.delta}`),void 0===e&&(e="{%}"),`${e.replace("{%}",i)}`}static getMaxWidthOfArrayItems(t,n,r){return f(t.map((t=>m.translateScenarioLabel(t,n))).reduce(((t,n)=>t.length<n.length?n:t),""),{font:r.fontStyles.font,fontSize:r.fontStyles.size+"px"}).width}}m.formats=new Map;export{f as C,m as F,l as I,d as Q,o as V,e as a,a as b,u as r,c as s}
@@ -1 +1 @@
1
- import{S as e}from"./p-CeE4_3wQ.js";import{C as t}from"./p-BQMKgvEC.js";var r;!function(e){e[e.Y=1e24]="Y",e[e.Z=1e21]="Z",e[e.E=1e18]="E",e[e.P=1e15]="P",e[e.T=1e12]="T",e[e.G=1e9]="G",e[e.M=1e6]="M",e[e.k=1e3]="k",e[e.h=100]="h",e[e.da=10]="da",e[e.d=.1]="d",e[e.c=.01]="c",e[e.m=.001]="m",e[e.my=1e-6]="my",e[e.n=1e-9]="n",e[e.p=1e-12]="p",e[e.f=1e-15]="f",e[e.a=1e-18]="a",e[e.z=1e-21]="z",e[e.y=1e-24]="y"}(r||(r={}));class n{static calculateMeasureScale(t,r,n,a,s){var i,u;if("_"===a)return new e;if("μ"===a&&(a="my"),null!=a&&[...this.unitsLeast,...this.unitsGreat].includes(a))return this.lookupPrefix(a);const h=n.filter((e=>3===e.length));if(0===h.length||!r)return new e;const l=`SELECT MAX(GREATEST(${h.map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ${r}`,c=`SELECT MIN(LEAST(${h.map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ${r}`;let o,M=l;"LEAST"===(null==a?void 0:a.toUpperCase())&&(M=c);try{o=null!==(u=null===(i=t.exec(M)[0])||void 0===i?void 0:i.prefixvalue)&&void 0!==u?u:0}catch(t){return null==s||s(t),new e}return this.determinePrefix(Math.abs(o))}static determinePrefix(t){if(!Number.isFinite(t)||t<=0)return new e;if(t>=1e3){const r=Math.min(Math.floor(Math.log10(t)/3),this.unitsGreat.length)-1;return new e(this.unitsGreat[r],Math.pow(1e3,r+1))}if(t<=.001){const r=Math.min(-Math.floor(Math.log10(t)/3),this.unitsLeast.length)-1;return new e(this.unitsLeast[r],Math.pow(1e3,-(r+1)))}return new e}static lookupPrefix(t){return new e(t,r[t])}}n.unitsGreat=["k","M","G","T","P","E","Z","Y"],n.unitsLeast=["m","my","n","p","f","a","z","y"];class a{constructor(e=2,t=1){this.percent=e,this.decimal=t}}class s{adapt(e){const r=new a;return t.isNumber(e.percent)&&(r.percent=e.percent),t.isNumber(e.decimal)&&(r.decimal=e.decimal),r}default(){return new a}}export{n as D,a,s as b}
1
+ import{S as e}from"./p-CeE4_3wQ.js";import{C as t}from"./p-D5LDmR4u.js";var r;!function(e){e[e.Y=1e24]="Y",e[e.Z=1e21]="Z",e[e.E=1e18]="E",e[e.P=1e15]="P",e[e.T=1e12]="T",e[e.G=1e9]="G",e[e.M=1e6]="M",e[e.k=1e3]="k",e[e.h=100]="h",e[e.da=10]="da",e[e.d=.1]="d",e[e.c=.01]="c",e[e.m=.001]="m",e[e.my=1e-6]="my",e[e.n=1e-9]="n",e[e.p=1e-12]="p",e[e.f=1e-15]="f",e[e.a=1e-18]="a",e[e.z=1e-21]="z",e[e.y=1e-24]="y"}(r||(r={}));class n{static calculateMeasureScale(t,r,n,a,s){var i,u;if("_"===a)return new e;if("μ"===a&&(a="my"),null!=a&&[...this.unitsLeast,...this.unitsGreat].includes(a))return this.lookupPrefix(a);const h=n.filter((e=>3===e.length));if(0===h.length||!r)return new e;const l=`SELECT MAX(GREATEST(${h.map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ${r}`,c=`SELECT MIN(LEAST(${h.map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ${r}`;let o,f=l;"LEAST"===(null==a?void 0:a.toUpperCase())&&(f=c);try{o=null!==(u=null===(i=t.exec(f)[0])||void 0===i?void 0:i.prefixvalue)&&void 0!==u?u:0}catch(t){return null==s||s(t),new e}return this.determinePrefix(Math.abs(o))}static determinePrefix(t){if(!Number.isFinite(t)||t<=0)return new e;if(t>=1e3){const r=Math.min(Math.floor(Math.log10(t)/3),this.unitsGreat.length)-1;return new e(this.unitsGreat[r],Math.pow(1e3,r+1))}if(t<=.001){const r=Math.min(-Math.floor(Math.log10(t)/3),this.unitsLeast.length)-1;return new e(this.unitsLeast[r],Math.pow(1e3,-(r+1)))}return new e}static lookupPrefix(t){return new e(t,r[t])}}n.unitsGreat=["k","M","G","T","P","E","Z","Y"],n.unitsLeast=["m","my","n","p","f","a","z","y"];class a{constructor(e=2,t=1){this.percent=e,this.decimal=t}}class s{adapt(e){const r=new a;return t.isNumber(e.percent)&&(r.percent=e.percent),t.isNumber(e.decimal)&&(r.decimal=e.decimal),r}default(){return new a}}export{n as D,a,s as b}