@bino-bi/bn-template-engine 1.0.0-next.43 → 1.0.0-next.45
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.
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/{p-ddf6cd92.entry.js → p-1b002bd5.entry.js} +1 -1
- package/dist/bn-template-engine/{p-ce764078.entry.js → p-48871742.entry.js} +1 -1
- package/dist/bn-template-engine/{p-a4b76176.entry.js → p-750b2c82.entry.js} +1 -1
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +78 -42
- package/dist/cjs/bn-grid.cjs.entry.js +2 -2
- package/dist/cjs/bn-text.cjs.entry.js +1 -1
- package/dist/cjs/{withTranslation-FxXGUB3H.js → withTranslation-1qTs5Fi7.js} +5 -2
- package/dist/collection/components/bn-grid/bn-grid.js +2 -2
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.css +9 -0
- package/dist/collection/components/bn-table/utils/elements/TableRow.js +15 -5
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +8 -6
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +50 -28
- package/dist/collection/components/bn-tree/bn-tree.js +4 -1
- package/dist/collection/utils/parentDimensions.js +5 -2
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-table-renderer.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/p-B2bvM2Ig.js +1 -0
- package/dist/components/p-C50Ge-4H.js +1 -0
- package/dist/esm/bn-annotation-layer_30.entry.js +78 -42
- package/dist/esm/bn-grid.entry.js +2 -2
- package/dist/esm/bn-text.entry.js +1 -1
- package/dist/esm/{withTranslation-Daq2JXkv.js → withTranslation-C1gL7wSU.js} +5 -2
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +10 -0
- package/package.json +1 -1
- package/dist/components/p-D2Epww9R.js +0 -1
- package/dist/components/p-DX9_keF-.js +0 -1
- /package/dist/bn-template-engine/{p-BjozxTTW.js → p-DVE0-sOv.js} +0 -0
- /package/dist/components/{p-DD1zlev_.js → p-Dsvjkuy3.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as t,p as e,H as n,f as i,a as o,t as s}from"./p-D6YGOYV1.js";import{b as r,a as l,F as a,O as c,T as h,c as u}from"./p-BZXiWkDS.js";import{m as d,a as f,b as p}from"./p-DaOm9YwQ.js";import{p as v,n as m,r as $,d as g}from"./p-BzjGUtYh.js";import{F as b,V as w,Q as y,s as S,a as R,I as E,b as M}from"./p-CniN8ALm.js";import{S as O,I as _,D as x,C as N,d as k,M as G}from"./p-B5tixDPM.js";import{N as U,r as T}from"./p-fCjsrD7I.js";import{D as L,w as C}from"./p-Dq9dG0Kr.js";import{D as P,b as A}from"./p-sLbQ7yZ1.js";import{p as W,c as D}from"./p-16rjcQ0t.js";import{d as B,g as F}from"./p-DDvWTgk1.js";import{D as H,a as Y,b as I}from"./p-7ieJFBUk.js";import{A as j}from"./p-BXg3v5AO.js";import{S as z}from"./p-BPGLOHUe.js";import{S as Q}from"./p-CeE4_3wQ.js";import{w as X}from"./p-DjPWZfry.js";const V="none",Z="setname";function q(t){return t===Z?"COALESCE([setname],[setName])":`normalizeDate([date], '${t}')`}function K(t){if("string"==typeof t?""===t.trim():"number"!=typeof t)return;const e=Number(t);return Number.isFinite(e)?e:void 0}function J(t){if(null==t)return"";if("string"==typeof t)return t.trim();const e=tt(t);return e?e.toISO():String(t)}function tt(t){if(null!=t){if("string"==typeof t){const e=L.fromISO(t,{zone:"utc"});return e.isValid?e:void 0}if("number"==typeof t){const e=L.fromMillis(t,{zone:"utc"});return e.isValid?e:void 0}if("boolean"==typeof t.isValid)return t.isValid?t:void 0}}const et=/[\s\u200e\u200f\u061c]*[%\u066a][\s\u200e\u200f\u061c]*/;class nt{constructor(t,e,n,i,o,s,r,l,a){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=e,this.value=n,this.prefix=s||"",this.cssStyle=i||"",this.prefixStyle=r||"prefix",this.type=o,this.mark=void 0,this.colSpan=l||1,this.measureScale=a||1}getAsHeaderList(){if(null==this.value)return[""];const t=[];for(const e of this.value.toString().split("<br/>"))t.push(e);return t}draw(t,e){return this.format(this.value,t,e)}roundsToZero(t,e){return"number"==typeof this.value&&!!this.type&&this.draw(t,e)===this.format(0,t,e)}format(t,e,n){let i=t;if("undefined"===i||void 0===i||null==i)return"";if(Number.isNaN(Number(i)))return i;if(""===this.type||void 0===this.type||null==this.type)return i;let o=e.percent,s=e.percent;return"percentpoint"===this.type?b.number(Number(i),"percent",o,s,1,n).replace(et,""):("decimal"===this.type&&(i=+i/this.measureScale,o=e.decimal,s=e.decimal),b.number(Number(i),this.type,o,s,1,n))}drawPrefix(){return null==this.prefix?"":this.prefix}}class it{constructor(t,e,n){this.index=t,this.groupindex=e,this.type=n,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case r.HEADER:return"groupheader";case r.SEPERATORLINE:return"";case r.DRILLELEMENT:return"ofit";case r.PARTELEMENT:return"partof";case r.STANDARD:return"";case r.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,e,n,i,o,s,l,a,c,h=!1,u,d=1,f){let p=s;"category"===e&&null!=a&&(p=`category-${a.toString()}`),this.type===r.HEADER?p="headerlabel":this.type===r.SEPERATORLINE&&(p=null!=s?s:e),this.type===r.PARTELEMENT&&("percent"===i&&(t="-"),"category"!==e&&"operation"!==e&&(i="percent",p="")),("-"===t||t===U&&"percent"===i)&&(p="");let v="prefix-first";l&&(v="prefix-second"),n&&(p=`${p} ${n}`);const m=new nt(e,this.elements.length,t,p,i,o,v,d,c);m.isBarChart=h,m.columnStats=u,m.waterfall=f,this.elements.push(m)}}const ot=.85,st=.3,rt=.25;function lt(t){const e=.6*t;return{barY:(t-e)/2,barHeight:e}}const at={".":.28,",":.28,"-":.34,"%":.89," ":.28," ":.28," ":.28,M:.9};let ct;function ht(t,e,n,i,o=!1){const s=()=>function(t,e){var n;let i=0;for(const e of t)i+=null!==(n=at[e])&&void 0!==n?n:/[0-9+]/.test(e)?.59:.72;return i*e*1.1}(t,e)*(o?1.08:1),r=function(){var t,e,n;if(void 0===ct)try{ct="undefined"==typeof document?null:null!==(n=null===(e=(t=document.createElement("canvas")).getContext)||void 0===e?void 0:e.call(t,"2d"))&&void 0!==n?n:null}catch(t){ct=null}return ct}();if(r){r.font="1px __bn_font_sentinel__";const l=r.font;if(r.font=`${i?"italic ":""}${o?"bold ":""}${e}px ${n}`,r.font===l)return s();const a=r.measureText(t).width;if(Number.isFinite(a)&&(a>0||""===t))return a+.15*e}return s()}function ut(t,e){return Math.max(0,(t-.5)*e)}function dt(t,e,n){const i=void 0!==t.neg,o=void 0!==t.pos||!i,s=(t,i)=>t?e+n+(null!=i?i:0):0;return{sides:(i?1:0)+(o?1:0),neg:s(i,t.neg),pos:s(o,t.pos)}}function ft(t,e,n,i){const{sides:o,neg:s,pos:r}=dt(e,n,i),l=s+r>0?Math.min(1,t/(s+r)):1,a=Math.max(0,(t-(s+r)*l)/o);return{extent:a,axisX:void 0!==e.neg?s*l+a:0}}function pt(t,e,n,i){const o=ut(t,e),{sides:s,neg:r,pos:l}=dt(n,i/2,st*e);return r+l+s*function(t,e,n){return Math.min(1*e,t/(2*n))}(o,e,s)<=o+1e-6}function vt(t,e){const n=.15*t;return{maxBarWidth:t,breakGap:e,overdriveZoneWidth:n,cutWidth:Math.max(0,t-e-n)}}function mt(t,e,n,i){var o,s;const r=ut(t,e),l=st*e,{extent:a,axisX:c}=ft(r,n,rt*e/2,l),h=Math.min(.3*e,.2*a),u=void 0!==n.neg,d=void 0!==n.pos||!u;let f=u?a:0;const p=Math.max(0,null!==(o=null==i?void 0:i.neg)&&void 0!==o?o:0),v=Math.max(0,null!==(s=null==i?void 0:i.pos)&&void 0!==s?s:0);u&&d&&p+v>0&&(f=(h+(2*a*.85-2*h)*p/(p+v))/.85);const m=d?u?2*a-f:a:0;return{totalWidth:r,neg:vt(f,h),pos:vt(m,h),axisX:u?c-a+f:0,labelGap:l}}function $t(t,e,n,i,o){var s,r;const l=ut(t,e),a=st*e,{extent:c,axisX:h}=ft(l,n,i/2,a),u=void 0!==n.neg,d=void 0!==n.pos||!u;let f=u?c:0,p=d?c:0;if(o&&u&&d){const t=2*c,e=Math.max(0,null!==(s=o.neg)&&void 0!==s?s:0),n=Math.max(0,null!==(r=o.pos)&&void 0!==r?r:0);e+n<=t+1e-6?(f=e+(t-e-n)/2,p=t-f):e<c?(f=e,p=t-f):n<c&&(p=n,f=t-p)}return{totalWidth:l,maxPinLength:Math.max(f,p),negPinLength:f,posPinLength:p,axisX:u?h-c+f:0,labelGap:a}}function gt(t,e,n){const i=ut(t,e),o=st*e,s=Math.min(2.85*e,i/4);let r=s,l=s;const a=n?n.max-n.min:0;if(n&&a>0){const t=(t,e)=>Math.max(0,...n.labels.filter((e=>e.pointsLeft===t)).map((i=>i.width+o-(t?i.end-n.min:n.max-i.end)*e)));r=t(!0,0),l=t(!1,0);const e=i/2;for(let n=0;n<8;n++){const n=Math.max(0,i-r-l)/a,o=Math.min(r,t(!0,n)),s=Math.min(l,t(!1,n)),c=o+s<=e||o===r&&s===l;if(r=o,l=s,c)break}if(r+l>e)if(Math.min(r,l)>s){const t=e/(r+l);r*=t,l*=t}else r<=l?l=e-r:r=e-l}return{totalWidth:i,labelAreaLeft:r,labelAreaRight:l,barAreaWidth:i-r-l,labelGap:o}}const bt={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},wt="#666666";function yt(t,e){return`pattern-${t}-${e.replace("#","")}`}function St(t,e){return yt(`head-${t}`,e)}const Rt=({styles:e})=>{const n=e.scaleFactor,i=3*n,o=[{id:yt("pos",e.positive.stroke),line:e.positive.stroke,background:"#ffffff",lineWidth:1},{id:yt("neg",e.negative.stroke),line:e.negative.stroke,background:"#ffffff",lineWidth:1},{id:yt("neu",e.neutral.stroke),line:e.neutral.stroke,background:"#ffffff",lineWidth:1},...["ac","pp","fc","pl"].flatMap((t=>[{id:yt(t,e.scenarios[t].stroke),line:e.scenarios[t].stroke,background:"#ffffff",lineWidth:1},{id:St(t,e.scenarios[t].stroke),line:"#ffffff",background:e.scenarios[t].stroke,lineWidth:.6}]))],s=[[0,i,i,0],[-n,n,n,-n],[i-n,i+n,i+n,i-n]];return t("defs",null,o.map((e=>t("pattern",{id:e.id,patternUnits:"userSpaceOnUse",width:i,height:i},t("rect",{width:i,height:i,fill:e.background}),s.map((([i,o,s,r])=>t("line",{x1:i,y1:o,x2:s,y2:r,stroke:e.line,"stroke-width":e.lineWidth*n})))))))};function Et(t,e,n=1,i,o=0,s=!0,r){const l=(e,n)=>(t>0&&e!==n?"+":"")+e;if(e){const e=(t,e)=>s?b.number(t,"percent",e,e,1,i):b.number(100*t,"decimal",e,e,1,i),n=n=>l(e(t,n),e(0,n));let r=Math.min(20,Math.max(0,Math.trunc(o)||0));for(;r>0&&n(r).length>7;)r--;return n(r)}const a=t/n;if(void 0!==r){const t=t=>b.number(t,"decimal",r,r,1,i);return l(t(a),t(0))}const c=Math.abs(a);let h=1,u="";c>=9995e5?(h=1e9,u="B"):c>=999500?(h=1e6,u="M"):c>=999.5&&(h=1e3,u="K");const d=c>=10*h?0:1;return l(b.number(a/h,"decimal",d,0,1,i),b.number(0,"decimal",d,0,1,i))+u}function Mt(t){const e=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(e)}function Ot(t){const e=t.slice(0,2).toLowerCase();return"pp"===e?"pp":"fc"===e?"fc":"pl"===e?"pl":"ac"}function _t(t,e){if(Mt(t))return null;const n=new w(t);if(!n.isValid)return null;const i=Ot(n.base),o=Ot(n.delta);return{minuend:e.scenarios[i],minuendSlot:i,reference:e.scenarios[o],referenceSlot:o}}const xt=({x:e,height:n,look:i,styles:o})=>{const s=o.scaleFactor,r=rt*o.emPx,{reference:l,referenceSlot:a}=i;let c;if("outlined"===l.fillpattern){const i=r/3,o=(r-i)/2;c=[e-o,e+o].map((e=>t("line",{x1:e,y1:0,x2:e,y2:n,stroke:l.stroke,"stroke-width":i})))}else c=t("line","hatched"===l.fillpattern?{x1:e,y1:0,x2:e,y2:n,stroke:l.stroke,"stroke-width":r,"stroke-dasharray":""+2*s}:{x1:e,y1:0,x2:e,y2:n,stroke:l.fill,"stroke-width":r});return t("g",{class:`variance-axis axis-${a}`},c)};function Nt(t){return void 0!==t.pos||void 0===t.neg}function kt(t,e){return{neg:t.min<0?e:void 0,pos:t.max>0?e:void 0}}function Gt(t,e,n,i){return Mt(t)?function(t,e){const n=Ot(t);return e.scenarios[n]}(t,i):function(t,e,n){const i=t>=0;return e?i?n.positive:n.negative:i?n.negative:n.positive}(e,n,i)}function Ut(t,e){const n=t.fillpattern;return"hatched"===n?`url(#${yt(e,t.stroke)})`:"outlined"===n?"transparent":t.fill}function Tt(t){return"outlined"===t.fillpattern?{stroke:t.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0}}const Lt=e=>{const{value:n,scenario:i,columnStats:o,height:s,isPositiveGood:r,formattedValue:l,measureScale:a,locale:c,decimalDigits:h,columnWidthEm:u=10,labelWidths:d,sideMax:f,bold:p,styles:v=bt}=e,m=v.scaleFactor,$=v.fontSize,g=l||Et(n,!1,a,c,0,!0,h),b=null!=d?d:kt(o,ht(g,$,v.fontFamily,!1,p)),w=n>0||0===n&&Nt(b),{neg:y=Math.max(0,-o.min),pos:S=Math.max(0,o.max)}=null!=f?f:{},R=mt(u,v.emPx,b,{neg:y,pos:S}),{totalWidth:E,axisX:M,labelGap:O}=R,{breakGap:_,overdriveZoneWidth:x,cutWidth:N}=w?R.pos:R.neg,k=Math.abs(n)*v.unitScaling*$,G=k-N>1e-6,U=Math.max(0,(w?S:y)*v.unitScaling*$-N),T=Math.max(0,k-N),L=U>0?T/U*x:0,{barY:C,barHeight:P}=lt(s),A=_t(i,v),W=Gt(i,n,r,v),D=null==A?void 0:A.minuend.fillpattern,B="hatched"===D||"outlined"===D?Object.assign(Object.assign({},W),{fillpattern:D}):W,F=Ut(B,Mt(i)?Ot(i):r?w?"pos":"neg":w?"neg":"pos"),{stroke:H,strokeWidth:Y}=A&&"hatched"===B.fillpattern?{stroke:B.stroke,strokeWidth:1}:Tt(B),I=A?rt*v.emPx/2:0,j=w?M+I:M-I,z=G?N:k,Q=G?N+_+L:k,X=w?j+Q+O:j-Q-O,V=w?"start":"end";return t("svg",{width:E,height:s,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},t(Rt,{styles:v}),!A&&t("line",{x1:M,y1:0,x2:M,y2:s,stroke:wt,"stroke-width":1*m}),z>0&&t("rect",{x:w?j:j-z,y:C,width:z,height:P,fill:F,stroke:H,"stroke-width":Y*m}),G&&L>0&&t("rect",{x:w?j+N+_:j-N-_-L,y:C,width:L,height:P,fill:F,stroke:H,"stroke-width":Y*m}),G&&function(e,n,i,o,s){const r=e+n/2,l=.35*n,a=o/3,c=.3*n;let h=`M ${r-l} ${i}`;for(let t=0;t<3;t++)h+=` L ${r-l-c} ${i+a*(t+.5)} L ${r-l} ${i+a*(t+1)}`;let u=`M ${r+l} ${i}`;for(let t=0;t<3;t++)u+=` L ${r+l+c} ${i+a*(t+.5)} L ${r+l} ${i+a*(t+1)}`;return[t("rect",{x:e,y:i-1,width:n,height:o+2,fill:"#ffffff"}),t("path",{d:h,fill:"none",stroke:"#000000","stroke-width":1*s}),t("path",{d:u,fill:"none",stroke:"#000000","stroke-width":1*s})]}(w?j+N:j-N-_,_,C,P,m),A&&t(xt,{x:M,height:s,look:A,styles:v}),t("text",{x:X,y:s/2,dy:"0.35em","text-anchor":V,fill:v.fontColor,"font-size":$,"font-family":v.fontFamily},g))},Ct=e=>{var n,i;const{value:o,scenario:s,columnStats:r,height:l,isPositiveGood:a,formattedValue:c,measureScale:h,locale:u,percentDigits:d,percentSign:f,columnWidthEm:p=10,labelWidths:v,sideMax:m,bold:$,styles:g=bt}=e,b=g.scaleFactor,w=g.fontSize,y=8*b,S=100*g.percentageScaling*w,R=c||Et(o,!0,h,u,d,f),E=ht(R,w,g.fontFamily,!0,$),M=null!=v?v:kt(r,E),{neg:O=Math.max(0,-r.min),pos:_=Math.max(0,r.max)}=null!=m?m:{},{totalWidth:x,negPinLength:N,posPinLength:k,axisX:G,labelGap:U}=$t(p,g.emPx,M,y,{neg:O*S,pos:_*S}),T=l/2,L=Math.abs(o)*S,C=o>0||0===o&&Nt(M),P=C?k:N,A=L-P>1e-6,W=C?1:-1,D=G+W*Math.min(L,P),B=Gt(s,o,a,g),F=_t(s,g),H=null!==(n=null==F?void 0:F.minuend)&&void 0!==n?n:g.scenarios.ac,Y=G+W*(P+y/2),I=1.2*y,j=Y-W*I,z=.2*w,Q=E+2*z,X=Math.abs(j-G)-rt*g.emPx/2,V=A&&X>=Q+2*z,Z=j-W*(z+Q/2)-Q/2,q=V?Z+Q/2:(A?Y:D+W*(y/2))+W*U;return t("svg",{width:x,height:l,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},t(Rt,{styles:g}),A?t("polygon",{points:`${Y},${T} ${j},${T-I/2} ${j},${T+I/2}`,fill:B.fill}):t("rect",{x:D-y/2,y:T-y/2,width:y,height:y,fill:"outlined"===H.fillpattern?"#ffffff":"hatched"===H.fillpattern?`url(#${St(null!==(i=null==F?void 0:F.minuendSlot)&&void 0!==i?i:"ac",H.stroke)})`:H.fill,stroke:H.stroke,"stroke-width":1*b}),t("line",{x1:G,y1:T,x2:A?j:D,y2:T,stroke:B.fill,"stroke-width":3*b}),V&&t("rect",{class:"pin-label-band",x:Z,y:T-3*b/2,width:Q,height:3*b,fill:"#ffffff","fill-opacity":"0.5"}),F?t(xt,{x:G,height:l,look:F,styles:g}):t("line",{x1:G,y1:0,x2:G,y2:l,stroke:wt,"stroke-width":1*b}),t("text",{x:q,y:l/2,dy:"0.35em","text-anchor":V?"middle":C?"start":"end",fill:g.fontColor,"font-size":w,"font-style":"italic","font-family":g.fontFamily},R))},Pt=e=>{const{value:n,columnStats:i,isRelative:o,styles:s=bt}=e;return null==n||isNaN(n)||!i||0===i.absMax?t("span",{class:"bar-chart-empty",style:{color:s.fontColor,fontStyle:"italic"}},"-"):t(o?Ct:Lt,Object.assign({},e))};function At(t,e,n,i,o,s=!1){const r=Et(t,"partof"===e,n,i,0,!0,o);return s?r:r.replace(/^\+/,"")}const Wt=e=>{var n;const{value:i,scenario:o,height:s,isPositiveGood:r,measureScale:l,locale:a,decimalDigits:c,columnWidthEm:h=10,styles:u=bt,waterfall:d,geometry:f,bold:p,connectorReach:v={top:0,bottom:0}}=e,m=u.scaleFactor,$=u.fontSize,g=d.max-d.min;if(null==i||isNaN(i)||g<=0)return t("span",{class:"bar-chart-empty",style:{color:u.fontColor,fontStyle:"italic"}},"-");const{totalWidth:b,labelAreaLeft:w,barAreaWidth:y,labelGap:S}=null!=f?f:gt(h,u.emPx),R=y/g,E=t=>w+(t-d.min)*R,{barY:M,barHeight:O}=lt(s),_=E(0),x=E(d.start),N=E(d.end),k=Math.min(x,N),G=Math.abs(N-x),U=_t(o,u),T=Gt(o,i,r,u),L=null==U?void 0:U.minuend.fillpattern,C="hatched"===L||"outlined"===L?Object.assign(Object.assign({},T),{fillpattern:L}):T,P=Ut(C,U?T===u.positive?"pos":"neg":Ot(o)),{stroke:A,strokeWidth:W}=U&&"hatched"===C.fillpattern?{stroke:C.stroke,strokeWidth:1}:Tt(C),D=At(i,d.kind,l,a,c,null!==U),B=N<x,F=B?k-S:k+G+S,H=B?"end":"start",Y=ht(D,$,u.fontFamily,!1,p),I=S/2,j=(B?F-Y:F)-I,z=(B?F:F+Y)+I,Q=t=>t>j&&t<z,X=void 0!==d.parentEnd?E(d.parentEnd):void 0,V=s/2-$/2,Z=s/2+$/2,q=(t,e,n,i=0)=>t+i>j&&t-i<z?[[e,Math.min(n,V)],[Math.max(e,Z),n]].filter((([t,e])=>e>t)):[[e,n]],K=-v.top,J=s+v.bottom;return t("svg",{width:b,height:s,class:"cell-bar-chart waterfall-bar"+(U?" variance-waterfall":""),style:{overflow:"visible"}},t(Rt,{styles:u}),!U&&!Q(_)&&t("line",{x1:_,y1:0,x2:_,y2:s,stroke:wt,"stroke-width":1*m}),void 0!==d.parentStart&&void 0!==d.parentEnd&&t("line",{x1:E(d.parentStart),y1:0,x2:E(d.parentStart),y2:s,stroke:wt,"stroke-width":1*m,"stroke-dasharray":`${2*m},${2*m}`}),void 0!==d.parentStart&&void 0!==X&&!Q(X)&&t("line",{x1:X,y1:0,x2:X,y2:s,stroke:wt,"stroke-width":1*m,"stroke-dasharray":`${2*m},${2*m}`}),null===(n=d.connectors)||void 0===n?void 0:n.map((({at:e,part:n})=>q(E(e),"bottom"===n?M+O:K,"top"===n?M:J).map((([n,i])=>t("line",{class:"waterfall-connector",x1:E(e),y1:n,x2:E(e),y2:i,stroke:wt,"stroke-width":1*m}))))),G>0&&t("rect",{x:k,y:M,width:G,height:O,fill:P,stroke:A,"stroke-width":W*m}),U&&q(_,K,J,rt*u.emPx/2).map((([e,n])=>t("g",{transform:`translate(0,${e})`},t(xt,{x:_,height:n-e,look:U,styles:u})))),t("text",{x:F,y:s/2,dy:"0.35em","text-anchor":H,fill:u.fontColor,"font-size":$,"font-family":u.fontFamily},D))},Dt=`IFNULL(${y.ROWGROUP}, '')`;class Bt{constructor(t){this.groups=[y.CATEGORY,y.CATEGORYINDEX],l.OPT!==t.type&&l.OPTNOTOTAL!==t.type||this.groups.unshift(y.OPERATION),t.grouped&&(this.groups.push(y.ROWGROUP),this.groups.push(y.ROWGROUPINDEX))}toString(){return this.groups.map((t=>t===y.ROWGROUP?Dt:t)).toString()}select(){return this.groups.map((t=>t===y.ROWGROUP?`${Dt} as ${t}`:t)).toString()}noCategory(){return this.groups.filter((t=>t!==y.CATEGORY))}toArray(){return this.groups}}function Ft(t,e){return Math.abs(t-e)<=1e-9*Math.max(1,Math.abs(t),Math.abs(e))}function Ht(t,e){const n=(t,e,n)=>{var i;t.connectors=[...null!==(i=t.connectors)&&void 0!==i?i:[],{at:e,part:n}]},i=(t,e,i,o)=>{n(t,o,"bottom"),e.forEach((t=>n(t,o,"through"))),n(i,o,"top")};let o=null;for(const n of t){if(null===n){o=null;continue}const{main:t,children:s}=n,r="anchor"===t.kind?t.end:t.start;if(o&&!n.gapAbove&&Ft(o.main.end,r)&&i(o.main,e?s:o.children,t,r),!n.gapAbove&&!n.gapBelow&&(s.forEach(((t,e)=>{e>0&&i(s[e-1],[],t,t.start)})),s.length>0)){const n=s[s.length-1];e?Ft(n.end,t.end)&&i(n,[],t,t.end):i(t,[],s[0],t.start)}o=n.gapBelow?null:n}}class Yt{constructor(){this.geometry=new Map,this.columns=new Set}set(t,e,n){let i=this.geometry.get(t);i||(i=new Map,this.geometry.set(t,i)),i.set(e,n),this.columns.add(e)}get(t,e){var n;return null===(n=this.geometry.get(t))||void 0===n?void 0:n.get(e)}has(t){return this.columns.has(t)}}function It(t){for(const e of t)for(const t of e){const e=t[y.TYPE];if(e===r.SUM||e===r.GROUPSUM||e===r.DRILLELEMENT||e===r.PARTELEMENT)return!0}return!1}function jt(t){return`${t}__signed`}function zt(t){var e;return"-"===(null!==(e=t[y.OPERATION])&&void 0!==e?e:t.restOperation)?-1:1}function Qt(t,e,n){const i=t[e];if(null==i)return null;const o=Number(i);if(isNaN(o))return null;if((n===l.OPT||n===l.OPTNOTOTAL)&&t[y.TYPE]===r.ENTRY){const n=t[jt(e)];return"number"==typeof n?n:zt(t)*o}return o}function Xt(t,e){return null==t&&null==e?e:(null!=t?t:0)+(null!=e?e:0)}class Vt{constructor(t,e){this.hasPartOf=!1,this.params=[],this.sortSelect="",this.hasBlankRowGroup=!1,this.config=t,this.i18n=e}execute(t,e){var n;this.db=t,this.fromExpr=e;for(const t of[...this.config.scenarios,...this.config.categoryThereOf.keys()])if(!a.test(t))throw new Error(`invalid identifier "${t}"`);const i=[],o=[],s=[],r=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),l=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),c=this.getRelativeScenarios(),h=this.config.attributes.map((t=>this.translateAttributeSQL(t))).toString(),u=new Bt(this.config),d=this.config.interval===Z?this.config.sortOrder:{hierarchy:this.config.sortOrder.hierarchy.map((t=>{var e,n;return null!==(n=null===(e=W(t))||void 0===e?void 0:e.column)&&void 0!==n?n:t})),direction:this.config.sortOrder.direction};let f=["",""];d.hierarchy.length>0&&(f=this.createOrderString(d)),this.hasPartOf=this.checkConfigForPartOf();const{hierarchy:p,direction:v}=d,m=p.filter((t=>t===y.ROWGROUP||t===y.ROWGROUPINDEX||t.toUpperCase()in O)),$=m.filter((t=>t.toUpperCase()in O)).map((t=>`, SUM(${t} * transformOperator(operation)) as ${t}`)).join(""),g=m.length>0?m.map((t=>`${t} ${v}`)).toString():`${y.ROWGROUPINDEX} asc`,b=t.exec(`SELECT COUNT(DISTINCT ${y.CATEGORY}) as ${y.TOTALROWCOUNT} ${this.config.grouped?`, ${Dt} as ${y.ROWGROUP}, FIRST(${y.ROWGROUPINDEX}) as ${y.ROWGROUPINDEX}${$}`:""}\n FROM ${e} ${this.config.grouped?`GROUP BY ${Dt} ORDER BY ${g}`:""}`);return 0===b.length||1===b.length&&0===(null!==(n=b[0][y.TOTALROWCOUNT])&&void 0!==n?n:0)&&!this.config.grouped?[]:(this.hasBlankRowGroup=this.config.grouped&&b.some((t=>""===t.rowGroup)),b.forEach((t=>{const e=this.config.grouped?""===t.rowGroup?`WHERE (${y.ROWGROUP} IS NULL OR ${y.ROWGROUP} = '')`:`WHERE ${y.ROWGROUP} = ${this.bind(t.rowGroup)}`:"";let n="";this.config.limit&&(n=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,i),this.createDataRow(i,t,u,r,h,e,f,n),this.createRestRow(t,i,u,r,e,f),this.createGroupSumRow(i,o,t,l,e,f)})),this.createTotalSumRow(i,o,l),i.forEach((t=>s.push(this.exec(t)))),this.hasRunningSum()&&this.accumulateGroupSums(s,[...new Set(this.exctractScenarioNames(l))]),this.detectNaNCells(this.config.scenarios,s),this.createThereOfDrillRows(r,h,f,s),this.createPartOfDrillRows(r,f,o,s),this.createIntervalColumns(s),this.createThereOfDrillColumns(this.config.categoryThereOf,s),this.calculateColumnGroupRest(s,this.config.categoryThereOf),this.calculateRelativeVariances(s,c),s)}detectNaNCells(t,e){e.forEach((e=>{e.map((e=>(t.forEach((t=>{const n=new w(t);!0===n.isValid?0!==e[n.base+"_cnt"]&&0!==e[n.delta+"_cnt"]||(e[t]=Number.NaN):0===e[t+"_cnt"]&&(e[t]=Number.NaN)})),e)))}))}createPartOfDrillRows(t,e,n,i){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===l.LIST)return;const o=this.createPartOfQuery(t,e);let s=[];const r=this.db,a=this.params;o.forEach((t=>{s.push(...this.exec(t))}));const c=this.exctractScenarioNames(t),h=[];n.forEach((function(t){h.push(...r.exec(t,a))}));const u=new Map;h.forEach((t=>u.set(t[y.ROWGROUP],t))),s=this.reduceResDrillByCategoryGroups(s,c),s.forEach((function(t){c.forEach((e=>{try{t[e]=t[e]/u.get(t[y.ROWGROUP])[e]}catch(n){console.error("DataQuery: partOf drill row calculation failed",e,n),t[e]=Number.NaN}}))})),this.injectDrillRowsToResultRows(s,i)}createRestRow(t,e,n,i,o,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(", "),c=this.exctractScenarioNames(i).filter((t=>{var e;return null===(e=this.config.barColumns)||void 0===e?void 0:e.includes(t)})).map((t=>`, SUM(${t} * transformOperator(operation)) as ${jt(t)}`)).join(""),h=l.OPT===this.config.type||l.OPTNOTOTAL===this.config.type?`, CASE WHEN MAX(transformOperator(operation)) = -1 THEN '-' ELSE '+' END as restOperation${c}`:"";e.push(`SELECT ${y.ROWNR}, 1 as ${y.ROWGROUPINDEX} , 'ENTRY' as ${y.TYPE}, 'NO_GROUP' as ${y.ROWGROUP}, ${this.bind(String(null!==(r=t.rowGroup)&&void 0!==r?r:""))} as restRowGroup, 'REST' as ${y.CATEGORY}${h} ${a.length>0?", "+a:""} FROM (SELECT ROWNUM() AS ${y.ROWNR}, ${e.length} as ${y.ROWGROUPINDEX} , 'ENTRY' as ${y.TYPE}, ${this.bind(String(t.rowGroup||"NO_GROUP"))} as ${y.ROWGROUP}, ${n.select()} ${i.length>0?",".concat(i):""}${this.sortSelect} FROM ${this.fromExpr} ${o} GROUP BY ${n} ORDER BY ${s[0]}) t WHERE t.rowNr > ${this.config.limit}`)}}createDataRow(t,e,n,i,o,s,r,l){t.push(`SELECT ROWNUM() AS ${y.ROWNR},\n ${t.length} as ${y.ROWGROUPINDEX},\n 'ENTRY' as ${y.TYPE},\n ${this.bind(String(e.rowGroup||"NO_GROUP"))} as ${y.ROWGROUP},\n '${y.CATEGORYINDEX}',\n ${n.select()} ${i.length>0?",".concat(i):""} ${o.length>0?",".concat(o):""}${this.sortSelect}\n FROM ${this.fromExpr} ${s}\n GROUP BY ${n}\n ORDER BY ${r[0]} ${l}`)}createGroupHeaderRow(t,e){if(!0===this.config.grouped&&(this.config.showGroupTitle||!this.hasGroupSum())){const n=this.bind(String(t.rowGroup)),i=""===t.rowGroup?this.bind("-"):n;e.push(`SELECT ROWNUM() AS ${y.ROWNR},\n ${e.length} as ${y.ROWGROUPINDEX},\n 'GROUPHEAD' as ${y.TYPE},\n ${n} as ${y.ROWGROUP} ${this.config.showGroupTitle?`,${i} as ${y.CATEGORY}`:""}\n FROM ${this.fromExpr}\n GROUP BY '1'`)}}hasGroupSum(){return l.SUM===this.config.type||l.SUMNOTOTAL===this.config.type||l.OPT===this.config.type||l.OPTNOTOTAL===this.config.type}hasRunningSum(){return this.config.runningSum&&this.config.grouped&&this.hasGroupSum()&&0===this.config.categoryThereOf.size}accumulateGroupSums(t,e){const n={};for(const i of t)for(const t of i)if("GROUP_SUM"===t[y.TYPE])for(const i of e)n[i]=Xt(n[i],t[i]),t[i]=n[i]}createGroupSumRow(t,e,n,i,o,s){if(!0===this.config.grouped&&this.hasGroupSum()){const r=this.bind(String(n.rowGroup));t.push(`SELECT ${t.length} as ${y.ROWGROUPINDEX},\n '=' as ${y.OPERATION},\n ${r} as ${y.ROWGROUP},\n ROWNUM() AS ${y.ROWNR},\n 'GROUP_SUM' as ${y.TYPE} ${i.length>0?",".concat(i):""}\n FROM ${this.fromExpr} ${o}\n ORDER BY ${s[0]} `),e.push(`SELECT ${t.length} as ${y.ROWGROUPINDEX},\n '=' as ${y.OPERATION},\n ${r} as ${y.ROWGROUP},\n ROWNUM() AS ${y.ROWNR},\n 'GROUP_SUM' as ${y.TYPE} ${i.length>0?",".concat(i):""}\n FROM ${this.fromExpr} ${o}\n ORDER BY ${s[0]} `)}}createTotalSumRow(t,e,n){var i;if(l.SUM===this.config.type||l.OPT===this.config.type){const e=(null===(i=this.config.title)||void 0===i?void 0:i.trim())||"SUM_TOTAL",o=this.hasPartOf&&!1===this.config.grouped&&"SUM_TOTAL"!==e?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} ${e}`:e;t.push(`SELECT ${t.length} as ${y.ROWGROUPINDEX},\n ${this.bind(o)} as ${y.ROWGROUP},\n '=' as ${y.OPERATION},\n 'SUM' as ${y.TYPE} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr} `)}e.push(`SELECT ${t.length} as ${y.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${y.ROWGROUP},\n '=' as ${y.OPERATION},\n 'SUM' as ${y.TYPE} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr} `)}reduceResDrillByCategoryGroups(t,e){const n=new Map;return t.forEach((function(t){const i=t.rowNr+t.rowGroup+t.type+t.category;if(n.has(i)){const o=n.get(i);e.forEach((e=>{try{o[e]+=t[e]}catch(t){console.error("DataQuery: drill row aggregation failed",e,t)}}))}else n.set(i,t)})),[...n.values()]}injectDrillRowsToResultRows(t,e){const n=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(n.has(`${t.category}_${t.rowGroup}`)){const e=n.get(`${t.category}_${t.rowGroup}`)||0;n.set(`${t.category}_${t.rowGroup}`,e+1)}else n.set(`${t.category}_${t.rowGroup}`,1);t[y.ROWNR]=n.get(`${t.category}_${t.rowGroup}`),e.splice(i+t[y.ROWNR],0,t)}}))}));else{const i=this.findDuplicateSubCategories(t);t.forEach((function(t){e.forEach((function(e){const o=e.findIndex((e=>null!=e.category&&e.category===t.category));if(o>=0){if(n.has(`${t.category}`)){const e=n.get(`${t.category}`)||0;n.set(`${t.category}`,e+1)}else n.set(`${t.category}`,1);null!=t.rowGroup&&""!==t.rowGroup&&i.includes(`${t.category}##${t.subCategory}`)&&(t.rawSubCategory=t.subCategory,t.subCategory=`${t.subCategory} (${t.rowGroup})`),e.splice(o+t[y.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,e,n,i){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const o=[],s=[];this.config.thereOf.forEach((i=>{let s=!0,r="1 <> 1 OR ( ";null!=i.category&&0!==i.category.length&&i.category.trim()&&(r+=` ${y.CATEGORY} = ${this.bind(i.category)}`,s=!1),null!=i.rowGroup&&0!==i.rowGroup.length&&i.rowGroup.trim()&&(r+=` ${s?"":"AND"} ${y.ROWGROUP} = ${this.bind(i.rowGroup)}`,s=!1),null!=i.subCategory&&0!==i.subCategory.length&&i.subCategory.trim()&&(r+=` ${s?"":"AND"} ${y.SUBCATEGORY} = ${this.bind(i.subCategory)}`),r+=")",o.push(`SELECT ROWNUM() AS ${y.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${y.TYPE},\n ${y.CATEGORY},\n ${y.SUBCATEGORY},\n ${this.drillRowGroup} as ${y.ROWGROUP},\n ${t} ${e.length>0?",".concat(e):""}${this.sortSelect}\n FROM ${this.fromExpr}\n WHERE ${r}\n GROUP BY ${this.drillRowGroup}, ${y.CATEGORY}, ${y.SUBCATEGORY}\n ORDER BY ${n[1]}`)})),o.forEach((t=>{s.push(...this.exec(t))})),this.injectDrillRowsToResultRows(s,i)}calculateRelativeVariances(t,e){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[y.TYPE]&&e.forEach(((e,n)=>{var i;t[n]=null!==(i=T(t[n],t[e]))&&void 0!==i?i:U}))}))}))}calculateColumnGroupRest(t,e){if(null==e||0===e.size)return;const n=new Map,i=new Map;e.forEach(((t,e)=>{const o=t,s=[];for(const t of o)s.push(`${e}##${t.name}`);n.set(e,s),i.set(`${e}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[y.TYPE]&&n.forEach(((e,n)=>{let o=0;e.forEach((e=>{void 0!==t[e]&&(o+=t[e])})),t[`${n}##REST`]=t[n]-o,0!==t[`${n}##REST`]&&i.set(`${n}##REST`,!0)}))}))}));const o=Array.from(i.entries()).filter((([t,e])=>!e)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const e of o)delete t[e]}))}))}createIntervalColumns(t){var e,n,i,o,s;if(this.config.interval===V||this.config.categoryThereOf.size>0||0===this.config.scenarios.length)return;const r="##",a=`(SELECT *, ${q(this.config.interval)} as __interval FROM ${this.fromExpr}) as p`,c=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(),u=[...new Set(this.exctractScenarioNames(c))],d=this.getRelativeScenarios(),f=new Bt(this.config),p=l.OPT===this.config.type||l.OPTNOTOTAL===this.config.type,v=this.config.grouped&&(l.SUM===this.config.type||l.SUMNOTOTAL===this.config.type||l.OPT===this.config.type||l.OPTNOTOTAL===this.config.type),m=this.checkConfigForPartOf()&&this.config.type!==l.LIST,$=t=>this.exec(t),g=t=>(this.config.scenarios.forEach((e=>{const n=new w(e);!0===n.isValid?0!==t[n.base+"_cnt"]&&0!==t[n.delta+"_cnt"]||(t[e]=Number.NaN):0===t[e+"_cnt"]&&(t[e]=Number.NaN)})),d.forEach(((e,n)=>{var i;t[n]=null!==(i=T(t[n],t[e]))&&void 0!==i?i:U})),t),b=(t,e,n)=>{for(const i of this.config.scenarios)t[i+r+n]=e[i]},S=$(`SELECT ${f.select()}, __interval ${c.length>0?",".concat(c):""}\n FROM ${a}\n GROUP BY ${f}, __interval`),R=t=>"ENTRY"===t.type&&null!=t.restRowGroup;if(this.config.limit>0)for(let i=0;i<t.length;i++){const o=t[i].find(R);if(!o)continue;let s;for(let e=i-1;e>=0&&!s;e--){const n=t[e].filter((t=>"ENTRY"===t.type&&!R(t)));n.length>0&&(s=n)}if(!s)continue;const r=new Set(s.map((t=>t.category))),l=s[0].rowGroup,a=new Map;for(const t of S){if(this.config.grouped&&t.rowGroup!==l)continue;if(r.has(t.category))continue;const i=J(t.__interval);let o=a.get(i);o||(o={},a.set(i,o));for(const i of u)o[i]=(null!==(e=o[i])&&void 0!==e?e:0)+(null!==(n=t[i])&&void 0!==n?n:0)}a.forEach(((t,e)=>{b(o,g(t),e)}))}for(const e of S){const n=J(e.__interval);g(e);for(const i of t)for(const t of i)"ENTRY"!==t.type||R(t)||t.category!==e.category||this.config.grouped&&t.rowGroup!==e.rowGroup||p&&t.operation!==e.operation||b(t,e,n)}const E=v||m&&this.config.grouped?$(`SELECT ${Dt} as ${y.ROWGROUP}, __interval ${h.length>0?",".concat(h):""}\n FROM ${a}\n GROUP BY ${Dt}, __interval`):[],M=new Map;if(E.forEach((t=>M.set(`${t.rowGroup}${r}${J(t.__interval)}`,t))),v&&this.hasRunningSum()){const e=[...new Set(this.exctractScenarioNames(h))],n=t.flat().filter((t=>"GROUP_SUM"===t.type));for(const t of new Set(E.map((t=>J(t.__interval))))){let i;for(const o of n){const n=M.get(`${o.rowGroup}${r}${t}`);if(n){null!=i||(i={});for(const t of e)i[t]=Xt(i[t],n[t])}i&&b(o,g(Object.assign({},i)),t)}}}else if(v)for(const e of E){const n=J(e.__interval),i=g(Object.assign({},e));for(const o of t)for(const t of o)"GROUP_SUM"===t.type&&t.rowGroup===e.rowGroup&&b(t,i,n)}const O=l.SUM===this.config.type||l.OPT===this.config.type,_=O||m&&!this.config.grouped?$(`SELECT __interval ${h.length>0?",".concat(h):""}\n FROM ${a}\n GROUP BY __interval`):[],x=new Map;if(_.forEach((t=>x.set(J(t.__interval),t))),O)for(const e of _){const n=J(e.__interval),i=g(Object.assign({},e));for(const e of t)for(const t of e)"SUM"===t.type&&b(t,i,n)}if(null!=this.config.thereOf&&this.config.thereOf.length>0){const e=[];this.config.thereOf.forEach((t=>{e.push(...$(`SELECT ${this.drillRowGroup} as ${y.ROWGROUP}, ${y.CATEGORY}, ${y.SUBCATEGORY}, __interval ${c.length>0?",".concat(c):""}\n FROM ${a}\n WHERE ${this.createThereOfWhereClause(t)}\n GROUP BY ${this.drillRowGroup}, ${y.CATEGORY}, ${y.SUBCATEGORY}, __interval`))}));for(const n of e){const e=J(n.__interval);g(n);for(const i of t)for(const t of i)"DRILLELEMENT"===t.type&&t.category===n.category&&t.rowGroup===n.rowGroup&&(t.subCategory!==n.subCategory&&t.subCategory!==`${n.subCategory} (${n.rowGroup})`||b(t,n,e))}}if(m){let e="1 <> 1 ";null===(i=this.config.partOf)||void 0===i||i.forEach((t=>{e+=`OR (${y.CATEGORY} = ${this.bind(t.category)}`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(e+=`and ${y.ROWGROUP} = ${this.bind(t.rowGroup)}`),e+=")"}));const n=$(`SELECT ${y.CATEGORY}, ${this.config.grouped?`${y.ROWGROUP}`:`'SUM_TOTAL' as ${y.ROWGROUP}`}, __interval ${c.length>0?",".concat(c):""}\n FROM ${a}\n WHERE ${e}\n GROUP BY ${y.ROWGROUP}, ${y.CATEGORY}, __interval`),l=new Map;for(const t of n){const e=`${t.rowGroup}${r}${t.category}${r}${J(t.__interval)}`,n=l.get(e);if(n)for(const e of u)n[e]=(null!==(o=n[e])&&void 0!==o?o:0)+(null!==(s=t[e])&&void 0!==s?s:0);else l.set(e,t)}l.forEach((e=>{const n=J(e.__interval),i=this.config.grouped?M.get(`${e.rowGroup}${r}${n}`):x.get(n);for(const t of u)e[t]=e[t]/(i?i[t]:Number.NaN);g(e);for(const i of t)for(const t of i)"PARTELEMENT"===t.type&&t.category===e.category&&t.rowGroup===e.rowGroup&&b(t,e,n)}))}}createThereOfWhereClause(t){let e=!0,n="1 <> 1 OR ( ";return null!=t.category&&0!==t.category.length&&t.category.trim()&&(n+=` ${y.CATEGORY} = ${this.bind(t.category)}`,e=!1),null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(n+=` ${e?"":"AND"} ${y.ROWGROUP} = ${this.bind(t.rowGroup)}`,e=!1),null!=t.subCategory&&0!==t.subCategory.length&&t.subCategory.trim()&&(n+=` ${e?"":"AND"} ${y.SUBCATEGORY} = ${this.bind(t.subCategory)}`),n+")"}getRelativeScenarios(){const t=new Map;return this.config.scenarios.forEach((e=>{const n=this.createRelativeScenario(e);null!=n&&t.set(n.key,n.value)})),t}translateScenarioSQL(t,e,n){const i=new w(t);if(l.OPT===n||l.OPTNOTOTAL===n){if(i.isValid){const n=e?" * transformOperator(operation)":"",o=e?`SUM((${i.base} - ${i.delta})${n}) as ${t}`:`SUM(${i.base} - ${i.delta}) as ${t}`;return"dr"===i.type?`${o}, SUM(${i.delta}${n}) as dr_${i.delta}`:o}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}]`,n=/^(ac|pp|fc|pl)[1-4]$/.test(t.arg)&&this.config.type!==l.OPT&&this.config.type!==l.OPTNOTOTAL;switch(t.fn){case"set":return`SETAGG(${e}) as ${t.alias}`;case"first":return`FIRST(${e}) as ${t.alias}`;case"last":return`LAST(${e}) as ${t.alias}`;case"min":return`MIN(${e}) as ${t.alias}`;case"max":return`MAX(${e}) as ${t.alias}`;case"avg":return n?`AVG(${e} * transformOperator(operation)) as ${t.alias}`:`AVG(${e}) as ${t.alias}`;case"sum":return n?`SUM(${e} * transformOperator(operation)) as ${t.alias}`:`SUM(${e}) as ${t.alias}`;case"lit":{const e=t.arg;return`${this.bind(""===e||Number.isNaN(Number(e))?e:Number(e))} as ${t.alias}`}}}get drillRowGroup(){return this.config.grouped?Dt:y.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=c.ASC===t.direction?c.DESC:c.ASC,n=new Map;t.hierarchy.forEach(((t,e)=>{const i=W(t),o=null==i?void 0:i.bucket;("variance"===(null==i?void 0:i.kind)||"scenario"===(null==i?void 0:i.kind)&&void 0!==o)&&n.set(e,this.translateSortKeySQL(i,o,e))})),this.sortSelect=[...n.values()].map((t=>`, ${t}`)).join("");const i=t.hierarchy.some((t=>{var e;const n=null===(e=W(t))||void 0===e?void 0:e.kind;return"scenario"===n||"variance"===n}));i&&(this.sortSelect+=`, CASE WHEN ${y.CATEGORY} = 'REST' THEN 1 ELSE 0 END as __sortrest`);const o=(t,e,i)=>n.has(e)?`__sortnull${e} asc, __sort${e} ${i}`:`${t} ${i}`,s=t.hierarchy.map(((e,n)=>o(e,n,t.direction))).toString(),r=t.hierarchy.map(((t,n)=>o(t,n,e))).toString();return i?[`__sortrest asc, ${s}`,`__sortrest desc, ${r}`]:[s,r]}translateSortKeySQL(t,e,n){const i=l.OPT===this.config.type||l.OPTNOTOTAL===this.config.type?"":" * transformOperator(operation)",o=void 0===e?"":`TRIM(CAST(${q(Z)} AS STRING)) = ${this.bind(e)}`,s=t=>`SUM(${o?`(CASE WHEN ${o} THEN ${t} ELSE 0 END)`:t}${i})`,r=t=>`SUM(CASE WHEN ${o?`${o} AND `:""}${t} IS NOT NULL THEN 1 ELSE 0 END) = 0`;if("scenario"===t.kind)return`${s(t.column)} as __sort${n}, CASE WHEN ${r(t.column)} THEN 1 ELSE 0 END as __sortnull${n}`;const a=`(${s(t.base)} - ${s(t.delta)})`;let c=a,h=`${r(t.base)} OR ${r(t.delta)}`;if("dr"===t.type){const e=s(t.delta),n=`ABS(${e}) <= ABS(${a}) * 0.000000001`;c=`CASE WHEN ${n} THEN 0 ELSE ${a} / ABS(${e}) END`,h+=` OR ${n}`}return`${c} as __sort${n}, CASE WHEN ${h} THEN 1 ELSE 0 END as __sortnull${n}`}createRelativeScenario(t){const e=new w(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 n;const i=[];let o="1 <> 1 ",s=` ${this.drillRowGroup} as ${y.ROWGROUP}`,r="ROWNUM()";return null===(n=this.config.partOf)||void 0===n||n.forEach((t=>{o+=`OR (${y.CATEGORY} = ${this.bind(t.category)}`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(o+=`and ${y.ROWGROUP} = ${this.bind(t.rowGroup)}`),!1===this.config.grouped&&(s=` 'SUM_TOTAL' as ${y.ROWGROUP} `,r="1"),o+=")"})),i.push(`SELECT ${r} AS ${y.ROWNR},\n 'PARTELEMENT' as ${y.TYPE},\n ${y.CATEGORY},\n ${s},\n ${t}${this.sortSelect}\n FROM ${this.fromExpr}\n WHERE ${o}\n GROUP BY ${this.drillRowGroup}, ${y.CATEGORY}, ${y.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 n=[],i=[],o=this.fromExpr;t.forEach(((t,e)=>{let i="1 <> 1 ";t.forEach((t=>{i+=` or columnGroup = ${this.bind(String(t.name))} `})),n.push(`SELECT 'ENTRY' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${i}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),n.push(`SELECT 'ENTRY' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${i}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),n.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${i}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),n.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${i}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),n.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${i}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),n.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${i}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),n.push(`SELECT 'SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${i}\n GROUP BY rowlevel, columnGroup, scenario`),n.push(`SELECT 'SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${i}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of n)i.push(...this.db.exec(t,this.params));this.injectDrillColumnsToResultRows(i,e)}injectDrillColumnsToResultRows(t,e){const n="##";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+n+i.columnGroup]=i.val:"SUBGROUP"===i.columnlevel&&e.category===i.category&&(e[i.scenario+n+i.columnGroup+n+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+n+i.columnGroup]=i.val:"SUBGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===i.subCategory?e[i.scenario+n+i.columnGroup+n+i.columnSubGroup]=i.val:"COLUMNGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===`${i.subCategory} (${i.rowGroup})`?e[i.scenario+n+i.columnGroup]=i.val:"SUBGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===`${i.subCategory} (${i.rowGroup})`&&(e[i.scenario+n+i.columnGroup+n+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+n+i.columnGroup]=i.val),"SUBGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===i.subCategory&&(e[i.scenario+n+i.columnGroup+n+i.columnSubGroup]=i.val))}}class Zt{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)?S(this.ruleSet.getScenarioColorIndex(t))+t.slice(2):null}getNormalizedHeader(){return this.normalizedHeader}createHeader(t,e,n,i,o,s,l=[],a=0){const c=[];this.attributesByAlias=new Map(l.map((t=>[t.alias,t]))),this.normalizedHeader=this.normalizeHeader(t,e,l,a);const h=this.normalizedHeader.some((t=>void 0!==t.bucket));h&&c.push(this.createIntervalBandRow());const u=new it(h?1:0,0,r.HEADER),d=new it(h?2:1,0,r.SEPERATORLINE);for(const t of this.normalizedHeader){const e=this.attributesByAlias.get(t.name);u.createElement(e?n.get(e.label)||e.label:b.translateScenarioLabel(t.name,n),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,n,i,o,s),null,null,null,null),d.createElement(null,t.type,this.createColumnType(t),null,null,this.underlineClass(t.type),null,null,null)}return c.push(u),c.push(d),c}createIntervalBandRow(){const t=new it(0,0,r.HEADER);let e=0;for(;e<this.normalizedHeader.length;){const n=this.normalizedHeader[e];if(void 0===n.bucket){t.createElement(null,n.type,"filler",null,null,null,null,null,null),e+=1;continue}let i=1;for(;e+i<this.normalizedHeader.length&&this.normalizedHeader[e+i].bucket===n.bucket;)i+=1;t.createElement(n.bucketLabel,n.type,"intervalGroup",null,null,null,null,null,null,!1,void 0,i),e+=i}return t}setHeaderPrefix(t,e,n,i,o){let s="";return"category"===t.name&&o&&(0===n.prefix.length&&0===i.length||(s=b.translateScenarioLabel("in",e)+" "+n.prefix+i)),t.order&&(s+=b.translateScenarioLabel("ORDER_"+t.order,e)),s}normalizeHeader(t,e,n,i=0){let o=[{name:y.CATEGORY,group:y.CATEGORY,type:y.CATEGORY,order:void 0}];l.OPT!==t&&l.OPTNOTOTAL!==t||(o=[{name:y.OPERATION,group:y.OPERATION,type:y.OPERATION,order:void 0},{name:y.CATEGORY,group:y.CATEGORY,type:y.CATEGORY,order:void 0}]);const s=n.map((t=>({name:t.alias,group:t.alias,type:t.alias,order:void 0})));return[...e.slice(0,i),...o,...s,...e.slice(i)]}createBodyRows(t,e,n,i){var o;const s=[];let a=-1;const c=new Vt(t,e);var u;this.dateBuckets=(u=t.interval)!==V&&u!==Z,this.unsignedEntries=l.OPT===t.type||l.OPTNOTOTAL===t.type;const d=c.execute(n,i);this.hasBlankRowGroup=c.hasBlankRowGroup;const f=this.calculateColumnStatistics(d,t.barColumns,t.interval!==V),p=t.thereOfPosition===h.ABOVE,v=null!==(o=t.barColumns)&&void 0!==o?o:[],m=v.filter((t=>t.toUpperCase().trim()in O)),$=[...m.length>0&&It(d)?m:[],...t.varianceWaterfall?v.filter((t=>"d"===new w(t).type)):[]],g=$.length>0&&t.interval===V&&0===t.categoryThereOf.size?function(t,e,n,i=!1,o=!1){const s=new Yt,a=n===l.OPT||n===l.OPTNOTOTAL;for(const l of e){const e=new w(l).isValid;let c,h=0,u=0;const d=[],f=[];let p=null;const v=(t,e)=>(d.push(e),s.set(t,l,e),e),m=t=>{p=t&&{main:t,children:[],gapAbove:!1,gapBelow:!1},f.push(p)};for(const s of t)for(const t of s){const s=t[y.TYPE];if(s===r.GROUPHEAD){i||(h=0),c=void 0,m(null);continue}const d=Qt(t,l,n);if(s===r.ENTRY){if(null===d){c=void 0,m(null);continue}m(v(t,{start:h,end:h+d,min:0,max:0,kind:"cascade"})),c={start:h,end:h+d,sign:a?zt(t):1},u=c.start,h+=d}else if(s===r.SUM||s===r.GROUPSUM){if(null===d){c=void 0,m(null);continue}m(v(t,{start:0,end:d,min:0,max:0,kind:"anchor"})),c={start:0,end:d,sign:1},u=0,h=s!==r.GROUPSUM||i?d:0}else if(!e||s!==r.DRILLELEMENT&&s!==r.PARTELEMENT){if(s===r.DRILLELEMENT){if(null===d||void 0===c)continue;const e=u+(Math.sign(c.end-c.start)||1)*Math.abs(d);v(t,{start:u,end:e,min:0,max:0,kind:"thereof",parentStart:c.start,parentEnd:c.end}),u=e}else if(s===r.PARTELEMENT){if(null===d||void 0===c)continue;const e=u+d*(c.end-c.start);v(t,{start:u,end:e,min:0,max:0,kind:"partof",parentStart:c.start,parentEnd:c.end}),u=e}}else if(s===r.DRILLELEMENT&&null!==d&&void 0!==c&&p){const e=u+c.sign*d;p.children.push(v(t,{start:u,end:e,min:0,max:0,kind:"thereof"})),u=e}else p&&(o&&s===r.DRILLELEMENT?p.gapAbove=!0:p.gapBelow=!0)}e&&Ht(f,o);let $=0,g=0;for(const t of d)$=Math.min($,t.start,t.end),g=Math.max(g,t.start,t.end);for(const t of d)t.min=$,t.max=g}return s}(d,$,t.type,c.hasRunningSum(),p):void 0;for(const n of d)a+=1,s.push(...this.createRow(t.i18n,e,t.scenariosUnitType,n,a,-1,t.categoryWidth,t.measureScale,t.barColumns,f,g,p));return s}calculateColumnStatistics(t,e,n=!1){const i=new Map;if(!e||0===e.length)return i;const o=new Map;for(const t of e)i.set(t,{min:1/0,max:-1/0,absMax:0,median:0}),o.set(t,[]);for(const s of t)for(const t of s){const s=t[y.TYPE];if(s!==r.SUM&&s!==r.GROUPSUM)for(const s of e){const e=n?this.extractIntervalColumnValues(t,s):[this.extractColumnValue(t,s)];for(const t of e)if(null!==t&&!isNaN(t)){const e=i.get(s);e.min=Math.min(e.min,t),e.max=Math.max(e.max,t),o.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 n=o.get(t);if(n.length>0){n.sort(((t,e)=>t-e));const t=Math.floor(n.length/2);e.median=n.length%2==0?(n[t-1]+n[t])/2:n[t]}i.set(t,e)}return i}extractIntervalColumnValues(t,e){const n=e+"##",i=[];for(const e of Object.keys(t))if(e.startsWith(n)){const n=Number(t[e]);i.push(isNaN(n)?null:n)}return i}extractColumnValue(t,e){if(void 0!==t[e]){const n=Number(t[e]);return isNaN(n)?null:n}for(const n of Object.keys(t))if(n===e||n.endsWith("##"+e)||n===e+"##"+e){const e=Number(t[n]);if(!isNaN(e))return e}return null}createRow(t,e,n,i,o,s,l,a,c,h,u,d=!1){var f,p,m;const $=[];let g,b,S=-1;for(const R of i){const E=R[y.ROWGROUP],M=""===E?"-":E,O=R[y.SUBCATEGORY],_=R[y.TYPE],x=R[y.ROWNR]>=2;b=null!==(p=null!==(f=R.operation)&&void 0!==f?f:R.restOperation)&&void 0!==p?p:b;const N=d&&_===r.DRILLELEMENT&&void 0!==g&&g[y.CATEGORY]===R[y.CATEGORY]&&("NO_GROUP"===g[y.ROWGROUP]||g[y.ROWGROUP]===E),k=this.createDetailRow(_,s+=1,o,i.length);k.key=this.rowKey(R);for(const i of this.normalizedHeader){const o=this.getRawDataRowElement(R,i),s=null!==(m=null==c?void 0:c.includes(i.type))&&void 0!==m&&m,d=s&&void 0===i.bucket&&i.name===i.group&&i.name===i.type?null==u?void 0:u.get(R,i.type):void 0,f=s&&!(_===r.PARTELEMENT&&new w(i.type).isValid&&(null==u?void 0:u.has(i.type))),p=f?null==h?void 0:h.get(i.type):void 0;k.createElement(this.translateSumCellLabel(t,e,o,M,O,_,i.type),i.type,this.createColumnType(i),this.setCellType(i.type,n),N?null:this.translateCellPrefix(e,_,i.type),this.translateScenarioCSS(i.type,o,b),x,l,null==a?void 0:a.value,f,p,1,d);const $=k.elements[k.elements.length-1];this.dateBuckets&&void 0!==i.bucket&&($.date=v(i.bucket));const g=new w(i.type);g.isValid&&($.direction=this.resolveDirection(g,b))}N?(k.cssStyle="ofit-above",$[S].cssStyle="ofit-sum",$.splice(S,0,k),S+=1):(_===r.ENTRY&&(S=$.length,g=R),$.push(k))}return $}rowKey(t){var e;const n=null!=t.restRowGroup?t.restRowGroup:"NO_GROUP"===t.rowGroup?void 0:t.rowGroup;switch(t.type){case r.ENTRY:return{rowGroup:n,category:t.category,subCategory:t.subCategory};case r.DRILLELEMENT:return{rowGroup:n,category:t.category,subCategory:null!==(e=t.rawSubCategory)&&void 0!==e?e:t.subCategory};case r.GROUPSUM:return{rowGroup:n,row:"subtotal"};case r.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,n,i){switch(t){case r.GROUPHEAD:return new it(e,n,r.HEADER);case r.SUM:case r.GROUPSUM:return new it(i+2,n,r.SUM);case r.DRILLELEMENT:return new it(i+2,n,r.DRILLELEMENT);case r.PARTELEMENT:return new it(i+2,n,r.PARTELEMENT);default:return new it(e,n,r.STANDARD)}}translateSumCellLabel(t,e,n,i,o,s,r){return this.attributesByAlias.has(r)||!1===Number.isNaN(Number(n))||this.isOperationColumn(r)?n:this.isGroupHeadCategory(s,r)?t===_.ALL?`${e.get(n)||n}`:n:this.isEntryCategory(s,r)?t===_.ALL||"REST"===n?`${e.get(n)||n}`:n:this.isDrillElementCategory(s,r)?t===_.ALL?`${e.get(o)||o}`:`${o}`:this.isPartElementCategory(s,r)?t===_.ALL||"SUM_TOTAL"===i?`${e.get(i)||i}`:`${i}`:this.isSumElementCategory(s,r)?t===_.ALL||"SUM_TOTAL"===i?`${e.get(i)||i}`:i:"GROUPHEAD"===s&&null==n||n===U?n:Number.isNaN(Number(n))?"-":Number(n)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,e,n){if(this.attributesByAlias.has(t))return"attribute";const i=new w(t);let o="pos";return e<0&&(o="neg"),i.isValid?o+"_"+this.resolveDirection(i,n)+("dr"===i.type?" relative_variance":""):t}resolveDirection(t,e){return R(t.direction,e,!this.unsignedEntries)}setCellType(t,e){if("category"===t)return"";const n=this.attributesByAlias.get(t);if(n)return n.isNumeric?"decimal":"";let i;const o=new w(t);return e===x.PERCENT?(i="percent",o.isValid&&"d"===o.type&&(i="percentpoint")):(i="decimal",o.isValid&&"dr"===o.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,n){return this.isOperationColumn(n)||this.isGroupHeadCategory(e,n)||this.isEntryCategory(e,n)?null:this.isDrillElementCategory(e,n)?`${t.get("thereof")} `:this.isPartElementCategory(e,n)?`${t.get("part_of")} `:null}createColumnType(t){return t.name===t.group&&t.name===t.type?"base":t.name===t.group?"columnGroup":"columnSubGroup"}}class qt{constructor(t,e,n,i){this.fromExpr="",this.rowCount=0,this.headerRows=[],this.bodyRows=[],this.intervalBuckets=[],this.ruleSet=t||new E,this.db=e,this.dataSetFactory=new Zt(this.ruleSet),this.config=this.initConfig(i),this.i18n=this.initI18n(new Map),this.setSource(n,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=u.DIRTY,new Map([...e,...t||new Map])}initConfig(t){this.state=u.DIRTY;const e=t,n=this;return t.scenarios.sort(((t,e)=>n.ruleSet.getScenarioSorIndex(t)-n.ruleSet.getScenarioSorIndex(e))),e}setConfig(t){this.config=this.initConfig(t)}setSource(t,e){var n,i;if(this.state=u.DIRTY,this.fromExpr=B(this.db,t,e),!this.fromExpr)return void(this.rowCount=0);const o=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(i=null===(n=o[0])||void 0===n?void 0:n.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,Math.min(this.categoryIntervalPosition(),this.intervalBuckets.length)*this.config.scenarios.length),this.bodyRows=0!==this.rowCount&&this.fromExpr?this.dataSetFactory.createBodyRows(this.config,this.i18n,this.db,this.fromExpr):[],this.state=u.UP_TO_DATE}getHeader(){return this.state===u.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===u.DIRTY&&this.update(),this.bodyRows}getColumns(){return this.state===u.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,n){var i;if(n!==P.AUTO)return n;const o=t.exec(`SELECT [date] as d FROM ${e}`);let s,r;for(const t of o){const e=null===(i=tt(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?P.DAY:(new A).calculateDistanceType(L.fromMillis(s),L.fromMillis(r))}(this.db,this.fromExpr,this.config.interval),this.intervalBuckets=function(t,e,n,i){if(n===Z){const i=t.exec(`SELECT ${q(n)} as __interval, COALESCE([setnameIndex],[setNameIndex]) as __index FROM ${e}`),o=new Set,s=new Map,r=[];for(const t of i){const e=J(t.__interval);o.has(e)||(o.add(e),r.push({key:e,label:0===e.length?"-":e}));const n=K(t.__index),i=s.get(e);void 0!==n&&(void 0===i||n<i)&&s.set(e,n)}if(s.size>0){const t=t=>{var e;return null!==(e=s.get(t.key))&&void 0!==e?e:Number.POSITIVE_INFINITY};r.sort(((e,n)=>t(e)===t(n)?0:t(e)<t(n)?-1:1))}return r}const o=t.exec(`SELECT ${q(n)} as __interval FROM ${e}`),s=new Set,r=[];for(const t of o){const e=tt(t.__interval);if(!e)continue;const n=e.toISO();s.has(n)||(s.add(n),r.push(e))}r.sort(((t,e)=>t.toMillis()-e.toMillis()));const l=new A;return l.setLocale(i),r.map((t=>({key:t.toISO(),label:l.getDateString(t,n)})))}(this.db,this.fromExpr,this.config.interval,this.config.locale),0===this.intervalBuckets.length&&(this.config.interval=V))}normalizeScenarios(t,e,n,i=[]){var o;const s=[],r=null===(o=null==n?void 0:n.hierarchy)||void 0===o?void 0:o.map((t=>W(t))).find((t=>"dim"!==(null==t?void 0:t.kind))),l=this.config.interval===Z?null==r?void 0:r.bucket:void 0,a=(t,e)=>{var i;return null==r||(null===(i=W(t))||void 0===i?void 0:i.column)!==r.column||void 0!==l&&l!==e?void 0:n.direction};if(i.length>0){for(const e of i)for(const n of t)s.push({name:n,group:n,type:n,order:a(n,e.key),bucket:e.key,bucketLabel:e.label});return s}for(const n of t){if(null==e?void 0:e.has(n)){const t=e.get(n);for(const e of t){s.push({name:e.name,group:e.name,type:n,order:void 0});for(const t of e.subGroups)s.push({name:t,group:e.name,type:n,order:void 0})}s.push({name:"REST",group:"REST",type:n,order:void 0})}s.push({name:n,group:n,type:n,order:a(n)})}return s}hasNoData(){return 0===this.rowCount}orderBucketWarning(){var t,e;if(this.hasNoData()||this.state!==u.UP_TO_DATE)return;const n=(null!==(e=null===(t=this.config.sortOrder)||void 0===t?void 0:t.hierarchy)&&void 0!==e?e:[]).map((t=>{var e;return null===(e=W(t))||void 0===e?void 0:e.bucket})).filter((t=>void 0!==t));if(0===n.length)return;if(this.config.interval!==Z)return`order: '@${n[0]}' needs interval setname, the bucket is ignored.`;const i=n.find((t=>!this.intervalBuckets.some((e=>e.key===t))));return void 0===i?void 0:`order: setname '${i}' not found, the rows are not sorted by it.`}categoryIntervalPosition(){const t=this.config.categoryIntervalPosition;return Number.isInteger(t)&&t>0?t:0}categoryIntervalPositionWarning(){const t=this.categoryIntervalPosition();if(t<=0||this.hasNoData()||this.state!==u.UP_TO_DATE)return;const e=this.intervalBuckets.length;return 0===e?{id:"WARN_categoryIntervalPositionNoInterval",message:"categoryIntervalPosition: needs an active interval, the value is ignored."}:t>e?{id:"WARN_categoryIntervalPositionRange",message:`categoryIntervalPosition: '${t}' is greater than the number of interval groups, ${e} is used.`}:void 0}hasBlankRowGroup(){return this.dataSetFactory.hasBlankRowGroup}}class Kt{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=x.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.runningSum=!1,this.varianceWaterfall=!1,this.thereOf=[],this.thereOfPosition=h.BELOW,this.categoryThereOf=new Map,this.partOf=[],this.attributes=[],this.sortOrder=new D(new z).default(),this.type=l.LIST,this.limit=0,this.i18n=_.ALL,this.categoryWidth=k.W25,this.measureScale=new Q,this.measureUnit="",this.measureType=G.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[],this.interval="none",this.categoryIntervalPosition=0,this.locale="de"}}class Jt{constructor(t,e,n,i,o,s){this.tableDrillGroupAdapter=t,this.stringAdapter=e,this.orderAdapter=n,this.db=i,this.fromExpr=o,this.onQueryError=s}adapt(t){const e=new Kt;return N.isString(t.title)&&(e.title=t.title),N.isArray(t.scenarios)&&(e.scenarios=j.adaptArray(t.scenarios,this.stringAdapter)),N.isExisting(t.scenariosUnitType)&&(e.scenariosUnitType=t.scenariosUnitType),N.isBoolean(t.grouped)&&(e.grouped=t.grouped),N.isBoolean(t.showGroupTitle)&&(e.showGroupTitle=t.showGroupTitle),N.isBoolean(t.runningSum)&&(e.runningSum=t.runningSum),N.isBoolean(t.varianceWaterfall)&&(e.varianceWaterfall=t.varianceWaterfall),t.thereOfPosition===h.ABOVE&&(e.thereOfPosition=h.ABOVE),N.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),N.isArray(t.thereOf)&&(e.thereOf=j.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),N.isExisting(t.categoryThereOf)&&(e.categoryThereOf=t.categoryThereOf),N.isArray(t.partOf)&&(e.partOf=j.adaptArray(t.partOf,this.tableDrillGroupAdapter)),N.isArray(t.attributes)&&(e.attributes=t.attributes),N.isExisting(t.order)&&(e.sortOrder=this.orderAdapter.adapt(t.order)),N.isExisting(t.type)&&(e.type=t.type),N.isNumber(t.limit)&&(e.limit=t.limit),N.isExisting(t.i18n)&&(e.i18n=t.i18n),N.isExisting(t.categoryWidth)&&(e.categoryWidth=t.categoryWidth),N.isExisting(t.measureScale)&&(e.measureScale=H.calculateMeasureScale(this.db,this.fromExpr,e.scenarios,t.measureScale,this.onQueryError)),N.isExisting(t.measureType)&&(e.measureType=t.measureType),N.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),N.isString(t.filter)&&(e.filter=t.filter.trim()),N.isArray(t.barColumns)&&(e.barColumns=t.barColumns),N.isString(t.interval)&&(e.interval=t.interval),N.isNumber(t.categoryIntervalPosition)&&(e.categoryIntervalPosition=t.categoryIntervalPosition),N.isString(t.locale)&&(e.locale=t.locale),e}default(){return new Kt}}class te{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class ee{constructor(){}adapt(t){const e=new te;return N.isString(t.rowGroup)&&(e.rowGroup=t.rowGroup),N.isString(t.category)&&(e.category=t.category),N.isString(t.subCategory)&&(e.subCategory=t.subCategory),N.isString(t.partOf)&&(e.partOf=t.partOf),e}default(){return new te}}const ne=e(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.sumTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=x.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.runningSum=!1,this.varianceWaterfall=!1,this.thereof=[],this.thereofPosition=h.BELOW,this.partof=[],this.order={hierarchy:[],direction:c.ASC},this.categorythereof=new Map,this.attributeColumns=[],this.type=l.LIST,this.categoryWidth=k.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=_.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=G.VOLUME,this.filter="",this.barColumns=[],this.interval="none",this.categoryIntervalPosition=0,this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new Y,this.blockStarts=new Set,this.barColumnLayouts=new Map,this.waterfallGeometries=new Map,this.relayout=()=>{(this.barColumnLayouts.size>0||this.waterfallGeometries.size>0)&&i(this)},C(this),this.componentStyle=X(this)}connectedCallback(){var t;null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.relayout)}disconnectedCallback(){var t;null===(t=document.fonts)||void 0===t||t.removeEventListener("loadingdone",this.relayout)}async getLayoutDetail(t,e){var n,i,o;const s={regions:[],metadata:{},diagnostics:[]},r=null===(n=this.element.shadowRoot)||void 0===n?void 0:n.querySelector("table");if(s.metadata.hasNoData=null===(o=null===(i=this.table)||void 0===i?void 0:i.hasNoData())||void 0===o||o,!this.table||!r)return s;const l=r.querySelector("thead"),a=r.querySelector("tbody");l&&s.regions.push({id:"header",rect:d(l,t)}),a&&s.regions.push({id:"body",rect:d(a,t)});const c=this.table.getHeader(),h=this.table.getBody(),u=this.table.getColumns();if(s.metadata.headerRowCount=c.length,s.metadata.rowCount=h.length,s.metadata.columnCount=u.length,s.metadata.cellCount=h.reduce(((t,e)=>t+e.getCells().length),0),"full"!==e)return s;const v=[],m=[],g=(e,n,i)=>{const o=i?Array.from(i.children).filter((t=>"tr"===t.localName)):[];n.forEach(((n,i)=>{const r=o[i];if(!r)return;v.push({section:e,index:i,type:n.type,rect:d(r,t),point:$(r)});const l=n.getCells(),a=Array.from(r.children);l.length===a.length?l.forEach(((n,o)=>{var s,r;const l=a[o],c={kind:"header"===e?"headerCell":"cell",row:i,column:n.index,key:n.key||void 0,colSpan:n.colSpan,value:null!==(s=n.value)&&void 0!==s?s:void 0,text:(null===(r=l.textContent)||void 0===r?void 0:r.trim())||void 0,type:n.type||void 0,rect:d(l,t),point:$(l)};c.point&&(c.content=f(l,t),c.contentSign=p(l)||void 0);const h=l.querySelector("svg.cell-bar-chart");h&&(c.bar={variant:h.classList.contains("waterfall-bar")?"waterfall":h.classList.contains("relative-variance")?"relative":"absolute",rect:d(h,t)}),m.push(c)})):s.diagnostics.push({id:`WARN_layout_cell_pairing_${e}_${i}`,type:"warning",message:`layout-state: model/DOM cell count mismatch in ${e} row ${i} (${l.length} vs ${a.length}); cell details skipped for this row.`})}))};return g("header",c,l),g("body",h,a),s.elements=m,s.table={rows:v,columns:u.map(((t,e)=>({index:e,key:t.name,group:t.group,type:t.type,bucket:t.bucket})))},s}render(){var e;return t(o,{class:{"no-data":!0===(null===(e=this.table)||void 0===e?void 0:e.hasNoData())}},(()=>{var e,n,i,o;if(void 0===this.table)return;if(this.table.hasNoData()){const n=null!==(e=this.i18n.get("no-data"))&&void 0!==e?e:"No Data";return t("div",{class:"empty-state"},n)}const s=null===(o=null===(i=null===(n=this.stores)||void 0===n?void 0:n.context)||void 0===i?void 0:i.state)||void 0===o?void 0:o.locale;return t("table",{class:{"grouped-list":this.groupedList()},style:{"--bn-block-gap":.6*this.emPx()+"px"}},t("thead",null,this.table.getHeader().map((e=>t("tr",{class:e.cssStyle},e.getCells().map(((e,n,i)=>t("th",{colSpan:e.colSpan,class:`${e.cssStyle}${this.isBarColumn(e.key)?" barColumn":""}${this.blockStartClass(i,n)}`},e.getAsHeaderList().map(((n,i,o)=>t("span",null,i===o.length-1?t("span",{class:" "===n?"table-footer":""},n,e.drawPrefix()," "):t("span",null,n,e.drawPrefix(),t("br",null)))))))))))),t("tbody",null,this.table.getBody().map((e=>t("tr",Object.assign({class:e.cssStyle},g(e.key,"element")),null==e?void 0:e.getCells().map(((n,i,o)=>{var l,a,c,h,u;return t("td",Object.assign({colSpan:n.colSpan,class:(n.type?`${this.cellClass(n,s)} ${n.type}`:n.cssStyle)+this.blockStartClass(o,i)},e.key&&null!=n.value&&""!==n.value&&"-"!==n.value?g(Object.assign(Object.assign({},e.key),{date:n.date,scenario:n.key}),"element"):{}),null!=n.prefix?t("span",{class:this.cellClass(n,s)+" "+n.prefixStyle},n.drawPrefix()):"",!n.isBarChart||!n.columnStats||n.value===U||!this.showGroupTitle&&e.type===r.HEADER||void 0===n.waterfall&&e.type===r.SUM||void 0!==n.direction&&n.waterfall&&n.waterfall.max===n.waterfall.min?n.draw(this.componentDataFormatDigits,s):void 0!==n.waterfall?t(Wt,{value:n.value,scenario:n.key,columnStats:n.columnStats,height:18*this.scaleFactor,isRelative:!1,isPositiveGood:"pos"===n.direction,measureScale:oe(n),locale:s,decimalDigits:se(n,this.componentDataFormatDigits),columnWidthEm:this.barColumnMaxWidth,styles:this.barChartStyles,waterfall:n.waterfall,geometry:this.waterfallGeometries.get(n.key),bold:ie(e),connectorReach:this.connectorReach(e)}):t(Pt,{value:n.value,scenario:n.key,columnStats:n.columnStats,height:18*this.scaleFactor,isRelative:n.key.startsWith("dr"),isPositiveGood:"pos"===n.direction,measureScale:oe(n),locale:s,decimalDigits:se(n,this.componentDataFormatDigits),percentDigits:null!==(a=null===(l=this.barColumnLayouts.get(n.key))||void 0===l?void 0:l.percentDigits)&&void 0!==a?a:this.componentDataFormatDigits.percent,percentSign:null===(c=this.barColumnLayouts.get(n.key))||void 0===c?void 0:c.percentSign,columnWidthEm:this.barColumnMaxWidth,labelWidths:null===(h=this.barColumnLayouts.get(n.key))||void 0===h?void 0:h.labels,sideMax:null===(u=this.barColumnLayouts.get(n.key))||void 0===u?void 0:u.sideMax,bold:ie(e),styles:this.barChartStyles}))})))))))})())}componentWillRender(){var t,e,n,i,o,s,r,l,a,c,h;this.stores||(this.stores=F(this.element));const u=this.stores.db.db;this.componentDataFormatDigits=(new I).adapt(this.dataFormatDigits);try{const e=this.prepareConfig(u);this.table=new qt(new E(this.ruleSetConfig),u,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===(n=this.table)||void 0===n?void 0:n.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===(o=this.errors)||void 0===o||o.remove("WARN_blankRowGroup");const d=null===(s=this.table)||void 0===s?void 0:s.orderBucketWarning();d?null===(r=this.errors)||void 0===r||r.addOrReplace({id:"WARN_orderBucket",type:"warning",message:d}):null===(l=this.errors)||void 0===l||l.remove("WARN_orderBucket");const f=null===(a=this.table)||void 0===a?void 0:a.categoryIntervalPositionWarning();for(const t of["WARN_categoryIntervalPositionNoInterval","WARN_categoryIntervalPositionRange"])(null==f?void 0:f.id)===t?null===(c=this.errors)||void 0===c||c.addOrReplace({id:t,type:"warning",message:f.message}):null===(h=this.errors)||void 0===h||h.remove(t);this.blockStarts=this.collectBlockStarts(),this.barColumnLayouts=this.collectBarColumnLayouts(),this.waterfallGeometries=this.collectWaterfallGeometries(),this.barChartStyles=this.prepareBarChartStyles()}collectBlockStarts(){const t=new Set;if(!this.table||this.table.hasNoData())return t;const e=this.table.getColumns().map((t=>{var e;const n=new w(t.type),i=n.isValid?`${n.base}_${n.delta}`:/^(ac|pp|fc|pl)\d/i.test(t.type)?"scenario":"rowheader";return`${null!==(e=t.bucket)&&void 0!==e?e:""}|${i}`}));return e.forEach(((n,i)=>{i>0&&n!==e[i-1]&&t.add(i)})),t}blockStartClass(t,e){let n=0;for(let i=0;i<e;i++)n+=t[i].colSpan;return this.blockStarts.has(n)?" block-start":""}groupedList(){return!0===this.grouped&&this.type!==l.OPT&&this.type!==l.OPTNOTOTAL}isBarColumn(t){return this.barColumns.includes(t)}cellClass(t,e){return void 0!==t.direction&&t.roundsToZero(this.componentDataFormatDigits,e)?t.cssStyle.replace(/^(pos|neg)_\w+/,"zero"):t.cssStyle}prepareConfig(t){var e,n,i;const o=B(t,this.tableName,this.filter);return new Jt(new ee,new z,new D(new z,!0),t,o,(t=>{throw t})).adapt({title:this.sumTitle,scenarios:this.scenarios,scenariosUnitType:this.scenariosDataFormat,grouped:this.grouped,showGroupTitle:this.showGroupTitle,runningSum:this.runningSum,varianceWaterfall:this.varianceWaterfall,thereOf:this.thereof,thereOfPosition:this.thereofPosition,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,categoryIntervalPosition:this.categoryIntervalPosition,locale:(null===(i=null===(n=null===(e=this.stores)||void 0===e?void 0:e.context)||void 0===n?void 0:n.state)||void 0===i?void 0:i.locale)||"de"})}prepareBarChartStyles(){var t;const e=!(this.unitScaling>0),n=!(this.percentageScaling>0),i=e?this.autoUnitScaling():this.unitScaling,o=n?this.autoPercentageScaling():this.percentageScaling;return(e||n)&&(null===(t=this.reportAutoScaling)||void 0===t||t.call(this,{unit:e?i:void 0,percentage:n?o:void 0})),this.componentStyle((t=>{var e,n,s,r,l,a,c,h,u,d,f,p,v,$,g,b,w,y,S,R,O,_,x,N,k,G;const U=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.varianceStyles,T=null===(n=t["bn-chart-time"])||void 0===n?void 0:n.barStyles;return{positive:{stroke:(null===(s=null==U?void 0:U.pos)||void 0===s?void 0:s.stroke)||"#008f96",fill:(null===(r=null==U?void 0:U.pos)||void 0===r?void 0:r.fill)||"#008f96",fillpattern:m(null===(l=null==U?void 0:U.pos)||void 0===l?void 0:l.fillpattern)||"solid"},negative:{stroke:(null===(a=null==U?void 0:U.neg)||void 0===a?void 0:a.stroke)||"#ff0000",fill:(null===(c=null==U?void 0:U.neg)||void 0===c?void 0:c.fill)||"#ff0000",fillpattern:m(null===(h=null==U?void 0:U.neg)||void 0===h?void 0:h.fillpattern)||"solid"},neutral:{stroke:(null===(u=null==U?void 0:U.neu)||void 0===u?void 0:u.stroke)||"#808080",fill:(null===(d=null==U?void 0:U.neu)||void 0===d?void 0:d.fill)||"#808080",fillpattern:m(null===(f=null==U?void 0:U.neu)||void 0===f?void 0:f.fillpattern)||"outlined"},scenarios:M({ac:{stroke:(null===(p=null==T?void 0:T.ac)||void 0===p?void 0:p.stroke)||"#404040",fill:(null===(v=null==T?void 0:T.ac)||void 0===v?void 0:v.fill)||"#404040",fillpattern:m(null===($=null==T?void 0:T.ac)||void 0===$?void 0:$.fillpattern)||"solid"},pp:{stroke:(null===(g=null==T?void 0:T.pp)||void 0===g?void 0:g.stroke)||"#A6A6A6",fill:(null===(b=null==T?void 0:T.pp)||void 0===b?void 0:b.fill)||"#A6A6A6",fillpattern:m(null===(w=null==T?void 0:T.pp)||void 0===w?void 0:w.fillpattern)||"solid"},fc:{stroke:(null===(y=null==T?void 0:T.fc)||void 0===y?void 0:y.stroke)||"#404040",fill:(null===(S=null==T?void 0:T.fc)||void 0===S?void 0:S.fill)||"#ffffff",fillpattern:m(null===(R=null==T?void 0:T.fc)||void 0===R?void 0:R.fillpattern)||"hatched"},pl:{stroke:(null===(O=null==T?void 0:T.pl)||void 0===O?void 0:O.stroke)||"#404040",fill:(null===(_=null==T?void 0:T.pl)||void 0===_?void 0:_.fill)||"#ffffff",fillpattern:m(null===(x=null==T?void 0:T.pl)||void 0===x?void 0:x.fillpattern)||"outlined"}},new E(this.ruleSetConfig)),fontColor:(null===(N=t.global)||void 0===N?void 0:N.fontColor)||"#000000",fontSize:((null===(k=t.global)||void 0===k?void 0:k.fontSizePx)||13.3333)*ot*this.scaleFactor,emPx:((null===(G=t.global)||void 0===G?void 0:G.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:this.labelFontFamily(),unitScaling:i,percentageScaling:o,scaleFactor:this.scaleFactor}}))}labelFontFamily(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif"}))}emPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.scaleFactor}autoUnitScaling(){var t;const e=this.emPx(),n=e*ot;let i=1/0;for(const{isRelative:o,absMax:s,labels:r,sideMax:l}of this.barColumnLayouts.values()){if(o||s<=0)continue;const a=mt(this.barColumnMaxWidth,e,r,l);for(const e of["neg","pos"]){const o=null!==(t=l[e])&&void 0!==t?t:0;if(o<=0)continue;const{maxBarWidth:s,cutWidth:r}=a[e];i=Math.min(i,Math.min(.8*s,r)/(o*n))}}return Number.isFinite(i)&&n>0?i:.01}autoPercentageScaling(){var t,e;const n=this.emPx(),i=n*ot;let o=1/0;for(const{isRelative:s,absMax:r,labels:l,sideMax:a}of this.barColumnLayouts.values()){if(!s||r<=0)continue;const c=8*this.scaleFactor,{negPinLength:h,posPinLength:u}=$t(this.barColumnMaxWidth,n,l,c),d=100*((null!==(t=a.neg)&&void 0!==t?t:0)+(null!==(e=a.pos)&&void 0!==e?e:0));o=Math.min(o,(h+u)/(d*i))}return Number.isFinite(o)&&i>0?o:.5}collectBarColumnLayouts(){var t,e,n,i;const o=new Map;if(!this.table||this.table.hasNoData())return o;const s=new Map;for(const e of this.table.getBody())if(e.type!==r.SUM)for(const n of e.getCells())n.isBarChart&&n.columnStats&&void 0===n.waterfall&&("number"!=typeof n.value||isNaN(n.value)||s.set(n.key,[...null!==(t=s.get(n.key))&&void 0!==t?t:[],{cell:n,bold:ie(e)}]));const l=this.emPx(),a=l*ot,c=8*this.scaleFactor,h=null===(i=null===(n=null===(e=this.stores)||void 0===e?void 0:e.context)||void 0===n?void 0:n.state)||void 0===i?void 0:i.locale,u=this.labelFontFamily();for(const[t,e]of s){const n=t.startsWith("dr"),i=e.map((({cell:t})=>t.value)),s=(t,o)=>{var s;const r={neg:i.some((t=>t<0))?0:void 0,pos:i.some((t=>t>0))?0:void 0},l=Nt(r);for(const{cell:i,bold:c}of e){const e=i.value,d=e>0||0===e&&l?"pos":"neg",f=Et(e,n,oe(i),h,t,o,se(i,this.componentDataFormatDigits));r[d]=Math.max(null!==(s=r[d])&&void 0!==s?s:0,ht(f,a,u,n,c))}return r};let r=Math.min(20,Math.max(0,Math.trunc(this.componentDataFormatDigits.percent)||0)),d=!0,f=s(r,d);for(;n&&(r>0||d)&&!pt(this.barColumnMaxWidth,l,f,c);)r>0?r--:d=!1,f=s(r,d);const p=Math.max(...i.map(Math.abs))*(n?100:1),v={neg:void 0===f.neg?void 0:Math.max(0,...i.map((t=>-t))),pos:void 0===f.pos?void 0:Math.max(0,...i)};o.set(t,{isRelative:n,absMax:p,labels:f,sideMax:v,percentDigits:r,percentSign:d})}return o}connectorReach(t){const e=this.emPx(),n=this.groupedList()?1:.5;return{top:.1*e,bottom:t.type===r.SUM?n*e:0}}collectWaterfallGeometries(){var t,e,n,i;const o=new Map;if(!this.table||this.table.hasNoData())return o;const s=this.emPx(),r=s*ot,l=null===(n=null===(e=null===(t=this.stores)||void 0===t?void 0:t.context)||void 0===e?void 0:e.state)||void 0===n?void 0:n.locale,a=this.labelFontFamily(),c=new Map;for(const t of this.table.getBody())for(const e of t.getCells()){if(!e.isBarChart||!e.columnStats||void 0===e.waterfall)continue;if("number"!=typeof e.value||isNaN(e.value))continue;const{start:n,end:o,min:s,max:h,kind:u}=e.waterfall,d=At(e.value,u,oe(e),l,se(e,this.componentDataFormatDigits),void 0!==e.direction),f=null!==(i=c.get(e.key))&&void 0!==i?i:{min:s,max:h,labels:[]};f.labels.push({end:o,pointsLeft:o<n,width:ht(d,r,a,!1,ie(t))}),c.set(e.key,f)}for(const[t,e]of c)o.set(t,gt(this.barColumnMaxWidth,s,e));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,td.zero{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.barColumn{text-align:center}td.block-start,th.block-start{border-left:var(--bn-block-gap, 0) solid transparent;clip-path:inset(-100em -100em -100em var(--bn-block-gap, 0))}.category-w100.block-start{min-width:calc(100em + var(--bn-block-gap, 0px));max-width:calc(100em + var(--bn-block-gap, 0px))}.category-w50.block-start{min-width:calc(50em + var(--bn-block-gap, 0px));max-width:calc(50em + var(--bn-block-gap, 0px))}.category-w25.block-start{min-width:calc(25em + var(--bn-block-gap, 0px));max-width:calc(25em + var(--bn-block-gap, 0px))}.category-w20.block-start{min-width:calc(20em + var(--bn-block-gap, 0px));max-width:calc(20em + var(--bn-block-gap, 0px))}.category-w15.block-start{min-width:calc(15em + var(--bn-block-gap, 0px));max-width:calc(15em + var(--bn-block-gap, 0px))}.category-w10.block-start{min-width:calc(10em + var(--bn-block-gap, 0px));max-width:calc(10em + var(--bn-block-gap, 0px))}.category-w5.block-start{min-width:calc(5em + var(--bn-block-gap, 0px));max-width:calc(5em + var(--bn-block-gap, 0px))}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}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}table.grouped-list tr.sum td{padding-bottom:1em}tr.ofit-above td[class^=category]{padding-left:1em}tr.ofit-sum td{border-top:0.1em solid black;font-weight:bold}tr.sum td.pos_pos,tr.sum td.pos_neg,tr.sum td.neg_pos,tr.sum td.neg_neg,tr.ofit-sum td.pos_pos,tr.ofit-sum td.pos_neg,tr.ofit-sum td.neg_pos,tr.ofit-sum td.neg_neg{color:inherit}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 solid #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(.variance-waterfall){overflow:visible}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}tr.ofit td:has(.cell-bar-chart),tr.partof td:has(.cell-bar-chart),tr.share td:has(.cell-bar-chart){padding:0 0.4166666667em}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"],runningSum:[4,"running-sum"],varianceWaterfall:[4,"variance-waterfall"],thereof:[16],thereofPosition:[1,"thereof-position"],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],categoryIntervalPosition:[2,"category-interval-position"],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 ie(t){return t.type===r.SUM||"ofit-sum"===t.cssStyle}function oe(t){return"percentpoint"===t.type?.01:t.measureScale}function se(t,e){return"percentpoint"===t.type?e.percent:"decimal"===t.type?e.decimal:void 0}function re(){"undefined"!=typeof customElements&&["bn-table-renderer"].forEach((t=>{"bn-table-renderer"===t&&(customElements.get(s(t))||customElements.define(s(t),ne))}))}export{ne as B,V as I,Z as a,K as c,re as d}
|
|
File without changes
|
|
File without changes
|