@bino-bi/bn-template-engine 1.0.0-next.39 → 1.0.0-next.41
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-2dd69cb9.entry.js +1 -0
- package/dist/bn-template-engine/{p-9a61f59d.entry.js → p-8b28c9bd.entry.js} +1 -1
- package/dist/bn-template-engine/{p-DyupX-Z-.js → p-BjozxTTW.js} +1 -1
- package/dist/bn-template-engine/p-EcC0qLtU.js +1 -0
- package/dist/bn-template-engine/{p-eea538f1.entry.js → p-a4b76176.entry.js} +1 -1
- package/dist/bn-template-engine/{p-93b8387f.entry.js → p-ce764078.entry.js} +1 -1
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +785 -378
- package/dist/cjs/bn-grid.cjs.entry.js +1 -1
- package/dist/cjs/bn-image.cjs.entry.js +1 -1
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{withStyled-DfE0aW7D.js → withStyled-BZb6snOx.js} +74 -0
- package/dist/cjs/{withTranslation-0gkn9xoC.js → withTranslation-FxXGUB3H.js} +1 -1
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +4 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +3 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Label.js +3 -1
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.css +25 -1
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +156 -11
- package/dist/collection/components/bn-table/bn-table.js +134 -5
- package/dist/collection/components/bn-table/utils/elements/Cell.js +10 -1
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +25 -10
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +50 -12
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +44 -14
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +63 -2
- package/dist/collection/components/bn-table/utils/helper/WaterfallCalculator.js +123 -11
- package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +57 -9
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +16 -1
- package/dist/collection/components/bn-table/utils/model/index.js +6 -0
- package/dist/collection/utils/validate.js +4 -0
- package/dist/components/bn-chart-bubble-renderer.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter-renderer.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure-renderer.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time-renderer.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-page.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-title.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/p-1B_s8oPY.js +1 -0
- package/dist/components/{p-BqUB56k1.js → p-B4L069XF.js} +1 -1
- package/dist/components/p-BZXiWkDS.js +1 -0
- package/dist/components/p-BiSytXUy.js +1 -0
- package/dist/components/p-Bn7J1pgl.js +1 -0
- package/dist/components/{p-BmOWXYHF.js → p-CEf5X8MZ.js} +1 -1
- package/dist/components/p-CGySoYRH.js +1 -0
- package/dist/components/{p-Cyf5ZEXs.js → p-CUSAlS2o.js} +1 -1
- package/dist/components/p-CvEdUq8i.js +1 -0
- package/dist/components/{p-OquycEMA.js → p-D40Am1Ap.js} +1 -1
- package/dist/components/{p-B4Cf0cVi.js → p-DM4Up10X.js} +1 -1
- package/dist/components/{p-Bo_R7f_T.js → p-DwuXVo2h.js} +1 -1
- package/dist/components/{p-DTmqMQpw.js → p-Y9bth2Y_.js} +1 -1
- package/dist/components/{p-BU_53KVT.js → p-xIWChKGS.js} +1 -1
- package/dist/esm/bn-annotation-layer_30.entry.js +903 -496
- package/dist/esm/bn-grid.entry.js +1 -1
- package/dist/esm/bn-image.entry.js +1 -1
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-text.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{withStyled-CIoJ86RM.js → withStyled-CzzXg64f.js} +77 -4
- package/dist/esm/{withTranslation-BX9T3dfm.js → withTranslation-Daq2JXkv.js} +1 -1
- package/dist/types/components/bn-table/bn-table-renderer/bn-table-renderer.d.ts +20 -1
- package/dist/types/components/bn-table/bn-table.d.ts +49 -1
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +3 -0
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +26 -0
- package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +22 -2
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +13 -0
- package/dist/types/components/bn-table/utils/helper/WaterfallCalculator.d.ts +30 -2
- package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +24 -4
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +7 -1
- package/dist/types/components/bn-table/utils/model/index.d.ts +5 -0
- package/dist/types/components.d.ts +49 -4
- package/dist/types/utils/validate.d.ts +1 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-8c84d57e.entry.js +0 -1
- package/dist/bn-template-engine/p-BVU4bIsi.js +0 -1
- package/dist/components/p-BsJOvfIg.js +0 -1
- package/dist/components/p-DCPLGEs_.js +0 -1
- package/dist/components/p-DT04Cka0.js +0 -1
- package/dist/components/p-Dm6EAaJ9.js +0 -1
- package/dist/components/p-dRPJiQB6.js +0 -1
- package/dist/components/p-tkB96Ena.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as t,p as e,H as i,f as n,a as o,t as s}from"./p-D6YGOYV1.js";import{b as r,a as l,F as a,O as h,T as c,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 N,D as _,C as G,d as U,M as x}from"./p-B5tixDPM.js";import{N as T,r as k}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 I,b as Y}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 it{constructor(t,e,i,n,o,s,r,l,a){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=e,this.value=i,this.prefix=s||"",this.cssStyle=n||"",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,i){let n=t;if("undefined"===n||void 0===n||null==n)return"";if(Number.isNaN(Number(n)))return n;if(""===this.type||void 0===this.type||null==this.type)return n;let o=e.percent,s=e.percent;return"percentpoint"===this.type?b.number(Number(n),"percent",o,s,1,i).replace(et,""):("decimal"===this.type&&(n=+n/this.measureScale,o=e.decimal,s=e.decimal),b.number(Number(n),this.type,o,s,1,i))}drawPrefix(){return null==this.prefix?"":this.prefix}}class nt{constructor(t,e,i){this.index=t,this.groupindex=e,this.type=i,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,i,n,o,s,l,a,h,c=!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"===n&&(t="-"),"category"!==e&&"operation"!==e&&(n="percent",p="")),("-"===t||t===T&&"percent"===n)&&(p="");let v="prefix-first";l&&(v="prefix-second"),i&&(p=`${p} ${i}`);const m=new it(e,this.elements.length,t,p,n,o,v,d,h);m.isBarChart=c,m.columnStats=u,m.waterfall=f,this.elements.push(m)}}const ot=.85,st=.3,rt=.25,lt={".":.28,",":.28,"-":.34,"%":.89," ":.28," ":.28," ":.28,M:.9};let at;function ht(t,e,i,n,o=!1){const s=()=>function(t,e){var i;let n=0;for(const e of t)n+=null!==(i=lt[e])&&void 0!==i?i:/[0-9+]/.test(e)?.59:.72;return n*e*1.1}(t,e)*(o?1.08:1),r=function(){var t,e,i;if(void 0===at)try{at="undefined"==typeof document?null:null!==(i=null===(e=(t=document.createElement("canvas")).getContext)||void 0===e?void 0:e.call(t,"2d"))&&void 0!==i?i:null}catch(t){at=null}return at}();if(r){r.font="1px __bn_font_sentinel__";const l=r.font;if(r.font=`${n?"italic ":""}${o?"bold ":""}${e}px ${i}`,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 ct(t,e){return Math.max(0,(t-.5)*e)}function ut(t,e,i){const n=void 0!==t.neg,o=void 0!==t.pos||!n,s=(t,n)=>t?e+i+(null!=n?n:0):0;return{sides:(n?1:0)+(o?1:0),neg:s(n,t.neg),pos:s(o,t.pos)}}function dt(t,e,i,n){const{sides:o,neg:s,pos:r}=ut(e,i,n),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 ft(t,e,i,n){const o=ct(t,e),{sides:s,neg:r,pos:l}=ut(i,n/2,st*e);return r+l+s*function(t,e,i){return Math.min(1*e,t/(2*i))}(o,e,s)<=o+1e-6}function pt(t,e){const i=.15*t;return{maxBarWidth:t,breakGap:e,overdriveZoneWidth:i,cutWidth:Math.max(0,t-e-i)}}function vt(t,e,i,n){var o,s;const r=ct(t,e),l=st*e,{extent:a,axisX:h}=dt(r,i,rt*e/2,l),c=Math.min(.3*e,.2*a),u=void 0!==i.neg,d=void 0!==i.pos||!u;let f=u?a:0;const p=Math.max(0,null!==(o=null==n?void 0:n.neg)&&void 0!==o?o:0),v=Math.max(0,null!==(s=null==n?void 0:n.pos)&&void 0!==s?s:0);u&&d&&p+v>0&&(f=(c+(2*a*.85-2*c)*p/(p+v))/.85);const m=d?u?2*a-f:a:0;return{totalWidth:r,neg:pt(f,c),pos:pt(m,c),axisX:u?h-a+f:0,labelGap:l}}function mt(t,e,i,n,o){var s,r;const l=ct(t,e),a=st*e,{extent:h,axisX:c}=dt(l,i,n/2,a),u=void 0!==i.neg,d=void 0!==i.pos||!u;let f=u?h:0,p=d?h:0;if(o&&u&&d){const t=2*h,e=Math.max(0,null!==(s=o.neg)&&void 0!==s?s:0),i=Math.max(0,null!==(r=o.pos)&&void 0!==r?r:0);e+i<=t+1e-6?(f=e+(t-e-i)/2,p=t-f):e<h?(f=e,p=t-f):i<h&&(p=i,f=t-p)}return{totalWidth:l,maxPinLength:Math.max(f,p),negPinLength:f,posPinLength:p,axisX:u?c-h+f:0,labelGap:a}}function $t(t,e,i){const n=ct(t,e),o=st*e,s=Math.min(2.85*e,n/4);let r=s,l=s;const a=i?i.max-i.min:0;if(i&&a>0){const t=(t,e)=>Math.max(0,...i.labels.filter((e=>e.pointsLeft===t)).map((n=>n.width+o-(t?n.end-i.min:i.max-n.end)*e)));r=t(!0,0),l=t(!1,0);const e=n/2;for(let i=0;i<8;i++){const i=Math.max(0,n-r-l)/a,o=Math.min(r,t(!0,i)),s=Math.min(l,t(!1,i)),h=o+s<=e||o===r&&s===l;if(r=o,l=s,h)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:n,labelAreaLeft:r,labelAreaRight:l,barAreaWidth:n-r-l,labelGap:o}}const gt={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},bt="#666666";function wt(t,e){return`pattern-${t}-${e.replace("#","")}`}const yt=({styles:e})=>{const i=e.scaleFactor,n=6*i,o=[{id:wt("pos",e.positive.stroke),stroke:e.positive.stroke,fill:e.positive.fill},{id:wt("neg",e.negative.stroke),stroke:e.negative.stroke,fill:e.negative.fill},{id:wt("neu",e.neutral.stroke),stroke:e.neutral.stroke,fill:e.neutral.fill},...["ac","pp","fc","pl"].map((t=>({id:wt(t,e.scenarios[t].stroke),stroke:e.scenarios[t].stroke,fill:e.scenarios[t].fill})))];return t("defs",null,o.map((e=>t("pattern",{id:e.id,patternUnits:"userSpaceOnUse",width:n,height:n},t("rect",{width:n,height:n,fill:"#ffffff"}),t("line",{x1:"0",y1:n,x2:n,y2:"0",stroke:e.stroke,"stroke-width":1.5*i})))))};function St(t,e,i=1,n,o=0,s=!0,r){const l=(e,i)=>(t>0&&e!==i?"+":"")+e;if(e){const e=(t,e)=>s?b.number(t,"percent",e,e,1,n):b.number(100*t,"decimal",e,e,1,n),i=i=>l(e(t,i),e(0,i));let r=Math.min(20,Math.max(0,Math.trunc(o)||0));for(;r>0&&i(r).length>7;)r--;return i(r)}const a=t/i;if(void 0!==r){const t=t=>b.number(t,"decimal",r,r,1,n);return l(t(a),t(0))}const h=Math.abs(a);let c=1,u="";h>=9995e5?(c=1e9,u="B"):h>=999500?(c=1e6,u="M"):h>=999.5&&(c=1e3,u="K");const d=h>=10*c?0:1;return l(b.number(a/c,"decimal",d,0,1,n),b.number(0,"decimal",d,0,1,n))+u}function Rt(t){const e=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(e)}function Et(t){const e=t.slice(0,2).toLowerCase();return"pp"===e?"pp":"fc"===e?"fc":"pl"===e?"pl":"ac"}function Mt(t,e){if(Rt(t))return null;const i=new w(t);if(!i.isValid)return null;const n=Et(i.base),o=Et(i.delta);return{minuend:e.scenarios[n],minuendSlot:n,reference:e.scenarios[o],referenceSlot:o}}const Ot=({x:e,height:i,look:n,styles:o})=>{const s=o.scaleFactor,r=rt*o.emPx,{reference:l,referenceSlot:a}=n;let h;if("outlined"===l.fillpattern){const n=r/2-.5*s;h=[e-n,e+n].map((e=>t("line",{x1:e,y1:0,x2:e,y2:i,stroke:l.stroke,"stroke-width":1*s})))}else h=t("line","hatched"===l.fillpattern?{x1:e,y1:0,x2:e,y2:i,stroke:l.stroke,"stroke-width":r,"stroke-dasharray":""+2*s}:{x1:e,y1:0,x2:e,y2:i,stroke:l.fill,"stroke-width":r});return t("g",{class:`variance-axis axis-${a}`},h)};function Nt(t){return void 0!==t.pos||void 0===t.neg}function _t(t,e){return{neg:t.min<0?e:void 0,pos:t.max>0?e:void 0}}function Gt(t,e,i,n){return Rt(t)?function(t,e){const i=Et(t);return e.scenarios[i]}(t,n):function(t,e,i){const n=t>=0;return e?n?i.positive:i.negative:n?i.negative:i.positive}(e,i,n)}function Ut(t,e){const i=t.fillpattern;return"hatched"===i?`url(#${wt(e,t.stroke)})`:"outlined"===i?"transparent":t.fill}function xt(t){return"outlined"===t.fillpattern?{stroke:t.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0}}const Tt=e=>{const{value:i,scenario:n,columnStats:o,height:s,isPositiveGood:r,formattedValue:l,measureScale:a,locale:h,decimalDigits:c,columnWidthEm:u=10,labelWidths:d,sideMax:f,bold:p,styles:v=gt}=e,m=v.scaleFactor,$=v.fontSize,g=l||St(i,!1,a,h,0,!0,c),b=null!=d?d:_t(o,ht(g,$,v.fontFamily,!1,p)),w=i>0||0===i&&Nt(b),{neg:y=Math.max(0,-o.min),pos:S=Math.max(0,o.max)}=null!=f?f:{},R=vt(u,v.emPx,b,{neg:y,pos:S}),{totalWidth:E,axisX:M,labelGap:O}=R,{breakGap:N,overdriveZoneWidth:_,cutWidth:G}=w?R.pos:R.neg,U=Math.abs(i)*v.unitScaling*$,x=U-G>1e-6,T=Math.max(0,(w?S:y)*v.unitScaling*$-G),k=Math.max(0,U-G),L=T>0?k/T*_:0,C=2*m,P=s-2*C,A=C,W=Mt(n,v),D=Gt(n,i,r,v),B=null==W?void 0:W.minuend.fillpattern,F="hatched"===B||"outlined"===B?Object.assign(Object.assign({},D),{fillpattern:B}):D,H=Ut(F,Rt(n)?Et(n):r?w?"pos":"neg":w?"neg":"pos"),{stroke:I,strokeWidth:Y}=W&&"hatched"===F.fillpattern?{stroke:F.stroke,strokeWidth:1}:xt(F),j=W?rt*v.emPx/2:0,z=w?M+j:M-j,Q=x?G:U,X=x?G+N+L:U,V=w?z+X+O:z-X-O,Z=w?"start":"end";return t("svg",{width:E,height:s,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},t(yt,{styles:v}),!W&&t("line",{x1:M,y1:0,x2:M,y2:s,stroke:bt,"stroke-width":1*m}),Q>0&&t("rect",{x:w?z:z-Q,y:A,width:Q,height:P,fill:H,stroke:I,"stroke-width":Y*m}),x&&L>0&&t("rect",{x:w?z+G+N:z-G-N-L,y:A,width:L,height:P,fill:H,stroke:I,"stroke-width":Y*m}),x&&function(e,i,n,o,s){const r=e+i/2,l=.35*i,a=o/3,h=.3*i;let c=`M ${r-l} ${n}`;for(let t=0;t<3;t++)c+=` L ${r-l-h} ${n+a*(t+.5)} L ${r-l} ${n+a*(t+1)}`;let u=`M ${r+l} ${n}`;for(let t=0;t<3;t++)u+=` L ${r+l+h} ${n+a*(t+.5)} L ${r+l} ${n+a*(t+1)}`;return[t("rect",{x:e,y:n-1,width:i,height:o+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})]}(w?z+G:z-G-N,N,A,P,m),W&&t(Ot,{x:M,height:s,look:W,styles:v}),t("text",{x:V,y:s/2,dy:"0.35em","text-anchor":Z,fill:v.fontColor,"font-size":$,"font-family":v.fontFamily},g))},kt=e=>{var i,n;const{value:o,scenario:s,columnStats:r,height:l,isPositiveGood:a,formattedValue:h,measureScale:c,locale:u,percentDigits:d,percentSign:f,columnWidthEm:p=10,labelWidths:v,sideMax:m,bold:$,styles:g=gt}=e,b=g.scaleFactor,w=g.fontSize,y=10*b,S=100*g.percentageScaling*w,R=h||St(o,!0,c,u,d,f),E=ht(R,w,g.fontFamily,!0,$),M=null!=v?v:_t(r,E),{neg:O=Math.max(0,-r.min),pos:N=Math.max(0,r.max)}=null!=m?m:{},{totalWidth:_,negPinLength:G,posPinLength:U,axisX:x,labelGap:T}=mt(p,g.emPx,M,y,{neg:O*S,pos:N*S}),k=l/2,L=Math.abs(o)*S,C=o>0||0===o&&Nt(M),P=C?U:G,A=L-P>1e-6,W=C?1:-1,D=x+W*Math.min(L,P),B=Gt(s,o,a,g),F=Mt(s,g),H=null!==(i=null==F?void 0:F.minuend)&&void 0!==i?i:g.scenarios.ac,I=x+W*(P+y/2),Y=1.2*y,j=I-W*Y,z=.2*w,Q=E+2*z,X=Math.abs(j-x)-rt*g.emPx/2,V=A&&X>=Q+2*z,Z=j-W*(z+Q/2)-Q/2,q=V?Z+Q/2:(A?I:D+W*(y/2))+W*T;return t("svg",{width:_,height:l,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},t(yt,{styles:g}),F?t(Ot,{x,height:l,look:F,styles:g}):t("line",{x1:x,y1:0,x2:x,y2:l,stroke:bt,"stroke-width":1*b}),t("line",{x1:x,y1:k,x2:A?j:D,y2:k,stroke:B.fill,"stroke-width":3*b}),A?t("polygon",{points:`${I},${k} ${j},${k-Y/2} ${j},${k+Y/2}`,fill:B.fill}):t("rect",{x:D-y/2,y:k-y/2,width:y,height:y,fill:"outlined"===H.fillpattern?"#ffffff":Ut(H,null!==(n=null==F?void 0:F.minuendSlot)&&void 0!==n?n:"ac"),stroke:H.stroke,"stroke-width":1*b}),V&&t("rect",{class:"pin-label-band",x:Z,y:k-3*b/2,width:Q,height:3*b,fill:"#ffffff","fill-opacity":"0.5"}),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))},Lt=e=>{const{value:i,columnStats:n,isRelative:o,styles:s=gt}=e;return null==i||isNaN(i)||!n||0===n.absMax?t("span",{class:"bar-chart-empty",style:{color:s.fontColor,fontStyle:"italic"}},"-"):t(o?kt:Tt,Object.assign({},e))};function Ct(t,e,i,n,o,s=!1){const r=St(t,"partof"===e,i,n,0,!0,o);return s?r:r.replace(/^\+/,"")}const Pt=e=>{var i;const{value:n,scenario:o,height:s,isPositiveGood:r,measureScale:l,locale:a,decimalDigits:h,columnWidthEm:c=10,styles:u=gt,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==n||isNaN(n)||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:$t(c,u.emPx),R=y/g,E=t=>w+(t-d.min)*R,M=2*m,O=s-2*M,N=M,_=E(0),G=E(d.start),U=E(d.end),x=Math.min(G,U),T=Math.abs(U-G),k=Mt(o,u),L=Gt(o,n,r,u),C=null==k?void 0:k.minuend.fillpattern,P="hatched"===C||"outlined"===C?Object.assign(Object.assign({},L),{fillpattern:C}):L,A=Ut(P,k?L===u.positive?"pos":"neg":Et(o)),{stroke:W,strokeWidth:D}=k&&"hatched"===P.fillpattern?{stroke:P.stroke,strokeWidth:1}:xt(P),B=Ct(n,d.kind,l,a,h,null!==k),F=U<G,H=F?x-S:x+T+S,I=F?"end":"start",Y=ht(B,$,u.fontFamily,!1,p),j=S/2,z=(F?H-Y:H)-j,Q=(F?H:H+Y)+j,X=t=>t>z&&t<Q,V=void 0!==d.parentEnd?E(d.parentEnd):void 0,Z=s/2-$/2,q=s/2+$/2,K=(t,e,i,n=0)=>t+n>z&&t-n<Q?[[e,Math.min(i,Z)],[Math.max(e,q),i]].filter((([t,e])=>e>t)):[[e,i]],J=-v.top,tt=s+v.bottom;return t("svg",{width:b,height:s,class:"cell-bar-chart waterfall-bar"+(k?" variance-waterfall":""),style:{overflow:"visible"}},t(yt,{styles:u}),!k&&!X(_)&&t("line",{x1:_,y1:0,x2:_,y2:s,stroke:bt,"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:bt,"stroke-width":1*m,"stroke-dasharray":`${2*m},${2*m}`}),void 0!==d.parentStart&&void 0!==V&&!X(V)&&t("line",{x1:V,y1:0,x2:V,y2:s,stroke:bt,"stroke-width":1*m,"stroke-dasharray":`${2*m},${2*m}`}),null===(i=d.connectors)||void 0===i?void 0:i.map((({at:e,part:i})=>K(E(e),"bottom"===i?N+O:J,"top"===i?N:tt).map((([i,n])=>t("line",{class:"waterfall-connector",x1:E(e),y1:i,x2:E(e),y2:n,stroke:bt,"stroke-width":1*m}))))),T>0&&t("rect",{x,y:N,width:T,height:O,fill:A,stroke:W,"stroke-width":D*m}),k&&K(_,J,tt,rt*u.emPx/2).map((([e,i])=>t("g",{transform:`translate(0,${e})`},t(Ot,{x:_,height:i-e,look:k,styles:u})))),t("text",{x:H,y:s/2,dy:"0.35em","text-anchor":I,fill:u.fontColor,"font-size":$,"font-family":u.fontFamily},B))},At=`IFNULL(${y.ROWGROUP}, '')`;class Wt{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?At:t)).toString()}select(){return this.groups.map((t=>t===y.ROWGROUP?`${At} as ${t}`:t)).toString()}noCategory(){return this.groups.filter((t=>t!==y.CATEGORY))}toArray(){return this.groups}}function Dt(t,e){return Math.abs(t-e)<=1e-9*Math.max(1,Math.abs(t),Math.abs(e))}function Bt(t,e){const i=(t,e,i)=>{var n;t.connectors=[...null!==(n=t.connectors)&&void 0!==n?n:[],{at:e,part:i}]},n=(t,e,n,o)=>{i(t,o,"bottom"),e.forEach((t=>i(t,o,"through"))),i(n,o,"top")};let o=null;for(const i of t){if(null===i){o=null;continue}const{main:t,children:s}=i,r="anchor"===t.kind?t.end:t.start;if(o&&!i.gapAbove&&Dt(o.main.end,r)&&n(o.main,e?s:o.children,t,r),!i.gapAbove&&!i.gapBelow&&(s.forEach(((t,e)=>{e>0&&n(s[e-1],[],t,t.start)})),s.length>0)){const i=s[s.length-1];e?Dt(i.end,t.end)&&n(i,[],t,t.end):n(t,[],s[0],t.start)}o=i.gapBelow?null:i}}class Ft{constructor(){this.geometry=new Map,this.columns=new Set}set(t,e,i){let n=this.geometry.get(t);n||(n=new Map,this.geometry.set(t,n)),n.set(e,i),this.columns.add(e)}get(t,e){var i;return null===(i=this.geometry.get(t))||void 0===i?void 0:i.get(e)}has(t){return this.columns.has(t)}}function Ht(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 It(t){return`${t}__signed`}function Yt(t){var e;return"-"===(null!==(e=t[y.OPERATION])&&void 0!==e?e:t.restOperation)?-1:1}function jt(t,e,i){const n=t[e];if(null==n)return null;const o=Number(n);if(isNaN(o))return null;if((i===l.OPT||i===l.OPTNOTOTAL)&&t[y.TYPE]===r.ENTRY){const i=t[It(e)];return"number"==typeof i?i:Yt(t)*o}return o}function zt(t,e){return null==t&&null==e?e:(null!=t?t:0)+(null!=e?e:0)}class Qt{constructor(t,e){this.hasPartOf=!1,this.params=[],this.sortSelect="",this.hasBlankRowGroup=!1,this.config=t,this.i18n=e}execute(t,e){var i;this.db=t,this.fromExpr=e;for(const t of[...this.config.scenarios,...this.config.categoryThereOf.keys()])if(!a.test(t))throw new Error(`invalid identifier "${t}"`);const n=[],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(),h=this.getRelativeScenarios(),c=this.config.attributes.map((t=>this.translateAttributeSQL(t))).toString(),u=new Wt(this.config),d=this.config.interval===Z?this.config.sortOrder:{hierarchy:this.config.sortOrder.hierarchy.map((t=>{var e,i;return null!==(i=null===(e=W(t))||void 0===e?void 0:e.column)&&void 0!==i?i: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?`, ${At} as ${y.ROWGROUP}, FIRST(${y.ROWGROUPINDEX}) as ${y.ROWGROUPINDEX}${$}`:""}\n FROM ${e} ${this.config.grouped?`GROUP BY ${At} ORDER BY ${g}`:""}`);return 0===b.length||1===b.length&&0===(null!==(i=b[0][y.TOTALROWCOUNT])&&void 0!==i?i:0)&&!this.config.grouped?[]:(this.hasBlankRowGroup=this.config.grouped&&b.some((t=>""===t.rowGroup)),b.forEach((t=>{const e=this.config.grouped?""===t.rowGroup?`WHERE (${y.ROWGROUP} IS NULL OR ${y.ROWGROUP} = '')`:`WHERE ${y.ROWGROUP} = ${this.bind(t.rowGroup)}`:"";let i="";this.config.limit&&(i=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,n),this.createDataRow(n,t,u,r,c,e,f,i),this.createRestRow(t,n,u,r,e,f),this.createGroupSumRow(n,o,t,l,e,f)})),this.createTotalSumRow(n,o,l),n.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,c,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,h),s)}detectNaNCells(t,e){e.forEach((e=>{e.map((e=>(t.forEach((t=>{const i=new w(t);!0===i.isValid?0!==e[i.base+"_cnt"]&&0!==e[i.delta+"_cnt"]||(e[t]=Number.NaN):0===e[t+"_cnt"]&&(e[t]=Number.NaN)})),e)))}))}createPartOfDrillRows(t,e,i,n){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 h=this.exctractScenarioNames(t),c=[];i.forEach((function(t){c.push(...r.exec(t,a))}));const u=new Map;c.forEach((t=>u.set(t[y.ROWGROUP],t))),s=this.reduceResDrillByCategoryGroups(s,h),s.forEach((function(t){h.forEach((e=>{try{t[e]=t[e]/u.get(t[y.ROWGROUP])[e]}catch(i){console.error("DataQuery: partOf drill row calculation failed",e,i),t[e]=Number.NaN}}))})),this.injectDrillRowsToResultRows(s,n)}createRestRow(t,e,i,n,o,s){var r;if(t.totalRowCnt-this.config.limit>0&&0!==this.config.limit){const a=this.exctractScenarioNames(n).map((t=>`SUM(${t}) as ${t}`)).join(", "),h=this.exctractScenarioNames(n).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 ${It(t)}`)).join(""),c=l.OPT===this.config.type||l.OPTNOTOTAL===this.config.type?`, CASE WHEN MAX(transformOperator(operation)) = -1 THEN '-' ELSE '+' END as restOperation${h}`:"";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}${c} ${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}, ${i.select()} ${n.length>0?",".concat(n):""}${this.sortSelect} FROM ${this.fromExpr} ${o} GROUP BY ${i} ORDER BY ${s[0]}) t WHERE t.rowNr > ${this.config.limit}`)}}createDataRow(t,e,i,n,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 ${i.select()} ${n.length>0?",".concat(n):""} ${o.length>0?",".concat(o):""}${this.sortSelect}\n FROM ${this.fromExpr} ${s}\n GROUP BY ${i}\n ORDER BY ${r[0]} ${l}`)}createGroupHeaderRow(t,e){if(!0===this.config.grouped&&(this.config.showGroupTitle||!this.hasGroupSum())){const i=this.bind(String(t.rowGroup)),n=""===t.rowGroup?this.bind("-"):i;e.push(`SELECT ROWNUM() AS ${y.ROWNR},\n ${e.length} as ${y.ROWGROUPINDEX},\n 'GROUPHEAD' as ${y.TYPE},\n ${i} as ${y.ROWGROUP} ${this.config.showGroupTitle?`,${n} 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 i={};for(const n of t)for(const t of n)if("GROUP_SUM"===t[y.TYPE])for(const n of e)i[n]=zt(i[n],t[n]),t[n]=i[n]}createGroupSumRow(t,e,i,n,o,s){if(!0===this.config.grouped&&this.hasGroupSum()){const r=this.bind(String(i.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} ${n.length>0?",".concat(n):""}\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} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr} ${o}\n ORDER BY ${s[0]} `)}}createTotalSumRow(t,e,i){var n;if(l.SUM===this.config.type||l.OPT===this.config.type){const e=(null===(n=this.config.title)||void 0===n?void 0:n.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} ${i.length>0?",".concat(i):""}\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} ${i.length>0?",".concat(i):""}\n FROM ${this.fromExpr} `)}reduceResDrillByCategoryGroups(t,e){const i=new Map;return t.forEach((function(t){const n=t.rowNr+t.rowGroup+t.type+t.category;if(i.has(n)){const o=i.get(n);e.forEach((e=>{try{o[e]+=t[e]}catch(t){console.error("DataQuery: drill row aggregation failed",e,t)}}))}else i.set(n,t)})),[...i.values()]}injectDrillRowsToResultRows(t,e){const i=new Map;if(!0===this.config.grouped)t.forEach((function(t){e.forEach((function(e){const n=e.findIndex((e=>e.category===t.category&&e.rowGroup===t.rowGroup));if(n>=0){if(i.has(`${t.category}_${t.rowGroup}`)){const e=i.get(`${t.category}_${t.rowGroup}`)||0;i.set(`${t.category}_${t.rowGroup}`,e+1)}else i.set(`${t.category}_${t.rowGroup}`,1);t[y.ROWNR]=i.get(`${t.category}_${t.rowGroup}`),e.splice(n+t[y.ROWNR],0,t)}}))}));else{const n=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(i.has(`${t.category}`)){const e=i.get(`${t.category}`)||0;i.set(`${t.category}`,e+1)}else i.set(`${t.category}`,1);null!=t.rowGroup&&""!==t.rowGroup&&n.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,i,n){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const o=[],s=[];this.config.thereOf.forEach((n=>{let s=!0,r="1 <> 1 OR ( ";null!=n.category&&0!==n.category.length&&n.category.trim()&&(r+=` ${y.CATEGORY} = ${this.bind(n.category)}`,s=!1),null!=n.rowGroup&&0!==n.rowGroup.length&&n.rowGroup.trim()&&(r+=` ${s?"":"AND"} ${y.ROWGROUP} = ${this.bind(n.rowGroup)}`,s=!1),null!=n.subCategory&&0!==n.subCategory.length&&n.subCategory.trim()&&(r+=` ${s?"":"AND"} ${y.SUBCATEGORY} = ${this.bind(n.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 ${i[1]}`)})),o.forEach((t=>{s.push(...this.exec(t))})),this.injectDrillRowsToResultRows(s,n)}calculateRelativeVariances(t,e){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[y.TYPE]&&e.forEach(((e,i)=>{var n;t[i]=null!==(n=k(t[i],t[e]))&&void 0!==n?n:T}))}))}))}calculateColumnGroupRest(t,e){if(null==e||0===e.size)return;const i=new Map,n=new Map;e.forEach(((t,e)=>{const o=t,s=[];for(const t of o)s.push(`${e}##${t.name}`);i.set(e,s),n.set(`${e}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[y.TYPE]&&i.forEach(((e,i)=>{let o=0;e.forEach((e=>{void 0!==t[e]&&(o+=t[e])})),t[`${i}##REST`]=t[i]-o,0!==t[`${i}##REST`]&&n.set(`${i}##REST`,!0)}))}))}));const o=Array.from(n.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,i,n,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`,h=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),c=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),u=[...new Set(this.exctractScenarioNames(h))],d=this.getRelativeScenarios(),f=new Wt(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 i=new w(e);!0===i.isValid?0!==t[i.base+"_cnt"]&&0!==t[i.delta+"_cnt"]||(t[e]=Number.NaN):0===t[e+"_cnt"]&&(t[e]=Number.NaN)})),d.forEach(((e,i)=>{var n;t[i]=null!==(n=k(t[i],t[e]))&&void 0!==n?n:T})),t),b=(t,e,i)=>{for(const n of this.config.scenarios)t[n+r+i]=e[n]},S=$(`SELECT ${f.select()}, __interval ${h.length>0?",".concat(h):""}\n FROM ${a}\n GROUP BY ${f}, __interval`),R=t=>"ENTRY"===t.type&&null!=t.restRowGroup;if(this.config.limit>0)for(let n=0;n<t.length;n++){const o=t[n].find(R);if(!o)continue;let s;for(let e=n-1;e>=0&&!s;e--){const i=t[e].filter((t=>"ENTRY"===t.type&&!R(t)));i.length>0&&(s=i)}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 n=J(t.__interval);let o=a.get(n);o||(o={},a.set(n,o));for(const n of u)o[n]=(null!==(e=o[n])&&void 0!==e?e:0)+(null!==(i=t[n])&&void 0!==i?i:0)}a.forEach(((t,e)=>{b(o,g(t),e)}))}for(const e of S){const i=J(e.__interval);g(e);for(const n of t)for(const t of n)"ENTRY"!==t.type||R(t)||t.category!==e.category||this.config.grouped&&t.rowGroup!==e.rowGroup||p&&t.operation!==e.operation||b(t,e,i)}const E=v||m&&this.config.grouped?$(`SELECT ${At} as ${y.ROWGROUP}, __interval ${c.length>0?",".concat(c):""}\n FROM ${a}\n GROUP BY ${At}, __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(c))],i=t.flat().filter((t=>"GROUP_SUM"===t.type));for(const t of new Set(E.map((t=>J(t.__interval))))){let n;for(const o of i){const i=M.get(`${o.rowGroup}${r}${t}`);if(i){null!=n||(n={});for(const t of e)n[t]=zt(n[t],i[t])}n&&b(o,g(Object.assign({},n)),t)}}}else if(v)for(const e of E){const i=J(e.__interval),n=g(Object.assign({},e));for(const o of t)for(const t of o)"GROUP_SUM"===t.type&&t.rowGroup===e.rowGroup&&b(t,n,i)}const O=l.SUM===this.config.type||l.OPT===this.config.type,N=O||m&&!this.config.grouped?$(`SELECT __interval ${c.length>0?",".concat(c):""}\n FROM ${a}\n GROUP BY __interval`):[],_=new Map;if(N.forEach((t=>_.set(J(t.__interval),t))),O)for(const e of N){const i=J(e.__interval),n=g(Object.assign({},e));for(const e of t)for(const t of e)"SUM"===t.type&&b(t,n,i)}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 ${h.length>0?",".concat(h):""}\n FROM ${a}\n WHERE ${this.createThereOfWhereClause(t)}\n GROUP BY ${this.drillRowGroup}, ${y.CATEGORY}, ${y.SUBCATEGORY}, __interval`))}));for(const i of e){const e=J(i.__interval);g(i);for(const n of t)for(const t of n)"DRILLELEMENT"===t.type&&t.category===i.category&&t.rowGroup===i.rowGroup&&(t.subCategory!==i.subCategory&&t.subCategory!==`${i.subCategory} (${i.rowGroup})`||b(t,i,e))}}if(m){let e="1 <> 1 ";null===(n=this.config.partOf)||void 0===n||n.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 i=$(`SELECT ${y.CATEGORY}, ${this.config.grouped?`${y.ROWGROUP}`:`'SUM_TOTAL' as ${y.ROWGROUP}`}, __interval ${h.length>0?",".concat(h):""}\n FROM ${a}\n WHERE ${e}\n GROUP BY ${y.ROWGROUP}, ${y.CATEGORY}, __interval`),l=new Map;for(const t of i){const e=`${t.rowGroup}${r}${t.category}${r}${J(t.__interval)}`,i=l.get(e);if(i)for(const e of u)i[e]=(null!==(o=i[e])&&void 0!==o?o:0)+(null!==(s=t[e])&&void 0!==s?s:0);else l.set(e,t)}l.forEach((e=>{const i=J(e.__interval),n=this.config.grouped?M.get(`${e.rowGroup}${r}${i}`):_.get(i);for(const t of u)e[t]=e[t]/(n?n[t]:Number.NaN);g(e);for(const n of t)for(const t of n)"PARTELEMENT"===t.type&&t.category===e.category&&t.rowGroup===e.rowGroup&&b(t,e,i)}))}}createThereOfWhereClause(t){let e=!0,i="1 <> 1 OR ( ";return null!=t.category&&0!==t.category.length&&t.category.trim()&&(i+=` ${y.CATEGORY} = ${this.bind(t.category)}`,e=!1),null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(i+=` ${e?"":"AND"} ${y.ROWGROUP} = ${this.bind(t.rowGroup)}`,e=!1),null!=t.subCategory&&0!==t.subCategory.length&&t.subCategory.trim()&&(i+=` ${e?"":"AND"} ${y.SUBCATEGORY} = ${this.bind(t.subCategory)}`),i+")"}getRelativeScenarios(){const t=new Map;return this.config.scenarios.forEach((e=>{const i=this.createRelativeScenario(e);null!=i&&t.set(i.key,i.value)})),t}translateScenarioSQL(t,e,i){const n=new w(t);if(l.OPT===i||l.OPTNOTOTAL===i){if(n.isValid){const i=e?" * transformOperator(operation)":"",o=e?`SUM((${n.base} - ${n.delta})${i}) as ${t}`:`SUM(${n.base} - ${n.delta}) as ${t}`;return"dr"===n.type?`${o}, SUM(${n.delta}${i}) as dr_${n.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 n.isValid?"dr"===n.type?`SUM((${n.base} * transformOperator(operation)) - (${n.delta} * transformOperator(operation))) as ${t}, SUM(${n.delta} * transformOperator(operation)) as dr_${n.delta}`:`SUM((${n.base} * transformOperator(operation))- (${n.delta} * transformOperator(operation))) as ${t}`:`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}translateAttributeSQL(t){const e=`[${t.arg}]`,i=/^(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 i?`AVG(${e} * transformOperator(operation)) as ${t.alias}`:`AVG(${e}) as ${t.alias}`;case"sum":return i?`SUM(${e} * transformOperator(operation)) as ${t.alias}`:`SUM(${e}) as ${t.alias}`;case"lit":{const e=t.arg;return`${this.bind(""===e||Number.isNaN(Number(e))?e:Number(e))} as ${t.alias}`}}}get drillRowGroup(){return this.config.grouped?At: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=h.ASC===t.direction?h.DESC:h.ASC,i=new Map;t.hierarchy.forEach(((t,e)=>{const n=W(t),o=null==n?void 0:n.bucket;("variance"===(null==n?void 0:n.kind)||"scenario"===(null==n?void 0:n.kind)&&void 0!==o)&&i.set(e,this.translateSortKeySQL(n,o,e))})),this.sortSelect=[...i.values()].map((t=>`, ${t}`)).join("");const n=t.hierarchy.some((t=>{var e;const i=null===(e=W(t))||void 0===e?void 0:e.kind;return"scenario"===i||"variance"===i}));n&&(this.sortSelect+=`, CASE WHEN ${y.CATEGORY} = 'REST' THEN 1 ELSE 0 END as __sortrest`);const o=(t,e,n)=>i.has(e)?`__sortnull${e} asc, __sort${e} ${n}`:`${t} ${n}`,s=t.hierarchy.map(((e,i)=>o(e,i,t.direction))).toString(),r=t.hierarchy.map(((t,i)=>o(t,i,e))).toString();return n?[`__sortrest asc, ${s}`,`__sortrest desc, ${r}`]:[s,r]}translateSortKeySQL(t,e,i){const n=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}${n})`,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${i}, CASE WHEN ${r(t.column)} THEN 1 ELSE 0 END as __sortnull${i}`;const a=`(${s(t.base)} - ${s(t.delta)})`;let h=a,c=`${r(t.base)} OR ${r(t.delta)}`;if("dr"===t.type){const e=s(t.delta),i=`ABS(${e}) <= ABS(${a}) * 0.000000001`;h=`CASE WHEN ${i} THEN 0 ELSE ${a} / ABS(${e}) END`,c+=` OR ${i}`}return`${h} as __sort${i}, CASE WHEN ${c} THEN 1 ELSE 0 END as __sortnull${i}`}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 i;const n=[];let o="1 <> 1 ",s=` ${this.drillRowGroup} as ${y.ROWGROUP}`,r="ROWNUM()";return null===(i=this.config.partOf)||void 0===i||i.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+=")"})),n.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]}`),n}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,e){if(null==t||0===t.size)return;const i=[],n=[],o=this.fromExpr;t.forEach(((t,e)=>{let n="1 <> 1 ";t.forEach((t=>{n+=` or columnGroup = ${this.bind(String(t.name))} `})),i.push(`SELECT 'ENTRY' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),i.push(`SELECT 'ENTRY' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),i.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),i.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),i.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),i.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),i.push(`SELECT 'SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, columnGroup, scenario`),i.push(`SELECT 'SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of i)n.push(...this.db.exec(t,this.params));this.injectDrillColumnsToResultRows(n,e)}injectDrillColumnsToResultRows(t,e){const i="##";for(const n of t)for(const t of e)for(const e of t)if(e.type===n.rowlevel)if("ENTRY"===n.rowlevel)"COLUMNGROUP"===n.columnlevel&&e.category===n.category?e[n.scenario+i+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&(e[n.scenario+i+n.columnGroup+i+n.columnSubGroup]=n.val);else if("DRILLELEMENT"===n.rowlevel){if(!this.config.grouped&&e.rowGroup!==n.rowGroup)continue;"COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory?e[n.scenario+i+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory?e[n.scenario+i+n.columnGroup+i+n.columnSubGroup]=n.val:"COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===`${n.subCategory} (${n.rowGroup})`?e[n.scenario+i+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===`${n.subCategory} (${n.rowGroup})`&&(e[n.scenario+i+n.columnGroup+i+n.columnSubGroup]=n.val)}else("SUM"===n.rowlevel||"GROUP_SUM"===n.rowlevel)&&("COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory&&(e[n.scenario+i+n.columnGroup]=n.val),"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory&&(e[n.scenario+i+n.columnGroup+i+n.columnSubGroup]=n.val))}}class Xt{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,i,n,o,s,l=[],a=0){const h=[];this.attributesByAlias=new Map(l.map((t=>[t.alias,t]))),this.normalizedHeader=this.normalizeHeader(t,e,l,a);const c=this.normalizedHeader.some((t=>void 0!==t.bucket));c&&h.push(this.createIntervalBandRow());const u=new nt(c?1:0,0,r.HEADER),d=new nt(c?2:1,0,r.SEPERATORLINE);for(const t of this.normalizedHeader){const e=this.attributesByAlias.get(t.name);u.createElement(e?i.get(e.label)||e.label:b.translateScenarioLabel(t.name,i),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,i,n,o,s),null,null,null,null),d.createElement(null,t.type,this.createColumnType(t),null,null,this.underlineClass(t.type),null,null,null)}return h.push(u),h.push(d),h}createIntervalBandRow(){const t=new nt(0,0,r.HEADER);let e=0;for(;e<this.normalizedHeader.length;){const i=this.normalizedHeader[e];if(void 0===i.bucket){t.createElement(null,i.type,"filler",null,null,null,null,null,null),e+=1;continue}let n=1;for(;e+n<this.normalizedHeader.length&&this.normalizedHeader[e+n].bucket===i.bucket;)n+=1;t.createElement(i.bucketLabel,i.type,"intervalGroup",null,null,null,null,null,null,!1,void 0,n),e+=n}return t}setHeaderPrefix(t,e,i,n,o){let s="";return"category"===t.name&&o&&(0===i.prefix.length&&0===n.length||(s=b.translateScenarioLabel("in",e)+" "+i.prefix+n)),t.order&&(s+=b.translateScenarioLabel("ORDER_"+t.order,e)),s}normalizeHeader(t,e,i,n=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=i.map((t=>({name:t.alias,group:t.alias,type:t.alias,order:void 0})));return[...e.slice(0,n),...o,...s,...e.slice(n)]}createBodyRows(t,e,i,n){var o;const s=[];let a=-1;const h=new Qt(t,e);var u;this.dateBuckets=(u=t.interval)!==V&&u!==Z,this.unsignedEntries=l.OPT===t.type||l.OPTNOTOTAL===t.type;const d=h.execute(i,n);this.hasBlankRowGroup=h.hasBlankRowGroup;const f=this.calculateColumnStatistics(d,t.barColumns,t.interval!==V),p=t.thereOfPosition===c.ABOVE,v=null!==(o=t.barColumns)&&void 0!==o?o:[],m=v.filter((t=>t.toUpperCase().trim()in O)),$=[...m.length>0&&Ht(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,i,n=!1,o=!1){const s=new Ft,a=i===l.OPT||i===l.OPTNOTOTAL;for(const l of e){const e=new w(l).isValid;let h,c=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){n||(c=0),h=void 0,m(null);continue}const d=jt(t,l,i);if(s===r.ENTRY){if(null===d){h=void 0,m(null);continue}m(v(t,{start:c,end:c+d,min:0,max:0,kind:"cascade"})),h={start:c,end:c+d,sign:a?Yt(t):1},u=h.start,c+=d}else if(s===r.SUM||s===r.GROUPSUM){if(null===d){h=void 0,m(null);continue}m(v(t,{start:0,end:d,min:0,max:0,kind:"anchor"})),h={start:0,end:d,sign:1},u=0,c=s!==r.GROUPSUM||n?d:0}else if(!e||s!==r.DRILLELEMENT&&s!==r.PARTELEMENT){if(s===r.DRILLELEMENT){if(null===d||void 0===h)continue;const e=u+(Math.sign(h.end-h.start)||1)*Math.abs(d);v(t,{start:u,end:e,min:0,max:0,kind:"thereof",parentStart:h.start,parentEnd:h.end}),u=e}else if(s===r.PARTELEMENT){if(null===d||void 0===h)continue;const e=u+d*(h.end-h.start);v(t,{start:u,end:e,min:0,max:0,kind:"partof",parentStart:h.start,parentEnd:h.end}),u=e}}else if(s===r.DRILLELEMENT&&null!==d&&void 0!==h&&p){const e=u+h.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&&Bt(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,h.hasRunningSum(),p):void 0;for(const i of d)a+=1,s.push(...this.createRow(t.i18n,e,t.scenariosUnitType,i,a,-1,t.categoryWidth,t.measureScale,t.barColumns,f,g,p));return s}calculateColumnStatistics(t,e,i=!1){const n=new Map;if(!e||0===e.length)return n;const o=new Map;for(const t of e)n.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=i?this.extractIntervalColumnValues(t,s):[this.extractColumnValue(t,s)];for(const t of e)if(null!==t&&!isNaN(t)){const e=n.get(s);e.min=Math.min(e.min,t),e.max=Math.max(e.max,t),o.get(s).push(Math.abs(t))}}}for(const[t,e]of n){e.min!==1/0&&e.max!==-1/0||(e.min=0,e.max=0),e.absMax=Math.max(Math.abs(e.min),Math.abs(e.max));const i=o.get(t);if(i.length>0){i.sort(((t,e)=>t-e));const t=Math.floor(i.length/2);e.median=i.length%2==0?(i[t-1]+i[t])/2:i[t]}n.set(t,e)}return n}extractIntervalColumnValues(t,e){const i=e+"##",n=[];for(const e of Object.keys(t))if(e.startsWith(i)){const i=Number(t[e]);n.push(isNaN(i)?null:i)}return n}extractColumnValue(t,e){if(void 0!==t[e]){const i=Number(t[e]);return isNaN(i)?null:i}for(const i of Object.keys(t))if(i===e||i.endsWith("##"+e)||i===e+"##"+e){const e=Number(t[i]);if(!isNaN(e))return e}return null}createRow(t,e,i,n,o,s,l,a,h,c,u,d=!1){var f,p,m;const $=[];let g,b,S=-1;for(const R of n){const E=R[y.ROWGROUP],M=""===E?"-":E,O=R[y.SUBCATEGORY],N=R[y.TYPE],_=R[y.ROWNR]>=2;b=null!==(p=null!==(f=R.operation)&&void 0!==f?f:R.restOperation)&&void 0!==p?p:b;const G=d&&N===r.DRILLELEMENT&&void 0!==g&&g[y.CATEGORY]===R[y.CATEGORY]&&("NO_GROUP"===g[y.ROWGROUP]||g[y.ROWGROUP]===E),U=this.createDetailRow(N,s+=1,o,n.length);U.key=this.rowKey(R);for(const n of this.normalizedHeader){const o=this.getRawDataRowElement(R,n),s=null!==(m=null==h?void 0:h.includes(n.type))&&void 0!==m&&m,d=s&&void 0===n.bucket&&n.name===n.group&&n.name===n.type?null==u?void 0:u.get(R,n.type):void 0,f=s&&!(N===r.PARTELEMENT&&new w(n.type).isValid&&(null==u?void 0:u.has(n.type))),p=f?null==c?void 0:c.get(n.type):void 0;U.createElement(this.translateSumCellLabel(t,e,o,M,O,N,n.type),n.type,this.createColumnType(n),this.setCellType(n.type,i),G?null:this.translateCellPrefix(e,N,n.type),this.translateScenarioCSS(n.type,o,b),_,l,null==a?void 0:a.value,f,p,1,d);const $=U.elements[U.elements.length-1];this.dateBuckets&&void 0!==n.bucket&&($.date=v(n.bucket));const g=new w(n.type);g.isValid&&($.direction=this.resolveDirection(g,b))}G?(U.cssStyle="ofit-above",$[S].cssStyle="ofit-sum",$.splice(S,0,U),S+=1):(N===r.ENTRY&&(S=$.length,g=R),$.push(U))}return $}rowKey(t){var e;const i=null!=t.restRowGroup?t.restRowGroup:"NO_GROUP"===t.rowGroup?void 0:t.rowGroup;switch(t.type){case r.ENTRY:return{rowGroup:i,category:t.category,subCategory:t.subCategory};case r.DRILLELEMENT:return{rowGroup:i,category:t.category,subCategory:null!==(e=t.rawSubCategory)&&void 0!==e?e:t.subCategory};case r.GROUPSUM:return{rowGroup:i,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,i,n){switch(t){case r.GROUPHEAD:return new nt(e,i,r.HEADER);case r.SUM:case r.GROUPSUM:return new nt(n+2,i,r.SUM);case r.DRILLELEMENT:return new nt(n+2,i,r.DRILLELEMENT);case r.PARTELEMENT:return new nt(n+2,i,r.PARTELEMENT);default:return new nt(e,i,r.STANDARD)}}translateSumCellLabel(t,e,i,n,o,s,r){return this.attributesByAlias.has(r)||!1===Number.isNaN(Number(i))||this.isOperationColumn(r)?i:this.isGroupHeadCategory(s,r)?t===N.ALL?`${e.get(i)||i}`:i:this.isEntryCategory(s,r)?t===N.ALL||"REST"===i?`${e.get(i)||i}`:i:this.isDrillElementCategory(s,r)?t===N.ALL?`${e.get(o)||o}`:`${o}`:this.isPartElementCategory(s,r)?t===N.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:`${n}`:this.isSumElementCategory(s,r)?t===N.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:n:"GROUPHEAD"===s&&null==i||i===T?i:Number.isNaN(Number(i))?"-":Number(i)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,e,i){if(this.attributesByAlias.has(t))return"attribute";const n=new w(t);let o="pos";return e<0&&(o="neg"),n.isValid?o+"_"+this.resolveDirection(n,i)+("dr"===n.type?" relative_variance":""):t}resolveDirection(t,e){return R(t.direction,e,!this.unsignedEntries)}setCellType(t,e){if("category"===t)return"";const i=this.attributesByAlias.get(t);if(i)return i.isNumeric?"decimal":"";let n;const o=new w(t);return e===_.PERCENT?(n="percent",o.isValid&&"d"===o.type&&(n="percentpoint")):(n="decimal",o.isValid&&"dr"===o.type&&(n="percent")),n}isDrillElementCategory(t,e){return"DRILLELEMENT"===t&&"category"===e}isPartElementCategory(t,e){return"PARTELEMENT"===t&&"category"===e}isSumElementCategory(t,e){return("GROUP_SUM"===t||"SUM"===t)&&"category"===e}isEntryCategory(t,e){return"ENTRY"===t&&"category"===e}isGroupHeadCategory(t,e){return"GROUPHEAD"===t&&"category"===e}translateCellPrefix(t,e,i){return this.isOperationColumn(i)||this.isGroupHeadCategory(e,i)||this.isEntryCategory(e,i)?null:this.isDrillElementCategory(e,i)?`${t.get("thereof")} `:this.isPartElementCategory(e,i)?`${t.get("part_of")} `:null}createColumnType(t){return t.name===t.group&&t.name===t.type?"base":t.name===t.group?"columnGroup":"columnSubGroup"}}class Vt{constructor(t,e,i,n){this.fromExpr="",this.rowCount=0,this.headerRows=[],this.bodyRows=[],this.intervalBuckets=[],this.ruleSet=t||new E,this.db=e,this.dataSetFactory=new Xt(this.ruleSet),this.config=this.initConfig(n),this.i18n=this.initI18n(new Map),this.setSource(i,n.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,i=this;return t.scenarios.sort(((t,e)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(e))),e}setConfig(t){this.config=this.initConfig(t)}setSource(t,e){var i,n;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!==(n=null===(i=o[0])||void 0===i?void 0:i.cnt)&&void 0!==n?n: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,i){var n;if(i!==P.AUTO)return i;const o=t.exec(`SELECT [date] as d FROM ${e}`);let s,r;for(const t of o){const e=null===(n=tt(t.d))||void 0===n?void 0:n.toMillis();void 0!==e&&(s=void 0===s?e:Math.min(s,e),r=void 0===r?e:Math.max(r,e))}return void 0===s||void 0===r?P.DAY:(new A).calculateDistanceType(L.fromMillis(s),L.fromMillis(r))}(this.db,this.fromExpr,this.config.interval),this.intervalBuckets=function(t,e,i,n){if(i===Z){const n=t.exec(`SELECT ${q(i)} as __interval, COALESCE([setnameIndex],[setNameIndex]) as __index FROM ${e}`),o=new Set,s=new Map,r=[];for(const t of n){const e=J(t.__interval);o.has(e)||(o.add(e),r.push({key:e,label:0===e.length?"-":e}));const i=K(t.__index),n=s.get(e);void 0!==i&&(void 0===n||i<n)&&s.set(e,i)}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,i)=>t(e)===t(i)?0:t(e)<t(i)?-1:1))}return r}const o=t.exec(`SELECT ${q(i)} as __interval FROM ${e}`),s=new Set,r=[];for(const t of o){const e=tt(t.__interval);if(!e)continue;const i=e.toISO();s.has(i)||(s.add(i),r.push(e))}r.sort(((t,e)=>t.toMillis()-e.toMillis()));const l=new A;return l.setLocale(n),r.map((t=>({key:t.toISO(),label:l.getDateString(t,i)})))}(this.db,this.fromExpr,this.config.interval,this.config.locale),0===this.intervalBuckets.length&&(this.config.interval=V))}normalizeScenarios(t,e,i,n=[]){var o;const s=[],r=null===(o=null==i?void 0:i.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 n;return null==r||(null===(n=W(t))||void 0===n?void 0:n.column)!==r.column||void 0!==l&&l!==e?void 0:i.direction};if(n.length>0){for(const e of n)for(const i of t)s.push({name:i,group:i,type:i,order:a(i,e.key),bucket:e.key,bucketLabel:e.label});return s}for(const i of t){if(null==e?void 0:e.has(i)){const t=e.get(i);for(const e of t){s.push({name:e.name,group:e.name,type:i,order:void 0});for(const t of e.subGroups)s.push({name:t,group:e.name,type:i,order:void 0})}s.push({name:"REST",group:"REST",type:i,order:void 0})}s.push({name:i,group:i,type:i,order:a(i)})}return s}hasNoData(){return 0===this.rowCount}orderBucketWarning(){var t,e;if(this.hasNoData()||this.state!==u.UP_TO_DATE)return;const i=(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===i.length)return;if(this.config.interval!==Z)return`order: '@${i[0]}' needs interval setname, the bucket is ignored.`;const n=i.find((t=>!this.intervalBuckets.some((e=>e.key===t))));return void 0===n?void 0:`order: setname '${n}' 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 Zt{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=_.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.runningSum=!1,this.varianceWaterfall=!1,this.thereOf=[],this.thereOfPosition=c.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=N.ALL,this.categoryWidth=U.W25,this.measureScale=new Q,this.measureUnit="",this.measureType=x.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[],this.interval="none",this.categoryIntervalPosition=0,this.locale="de"}}class qt{constructor(t,e,i,n,o,s){this.tableDrillGroupAdapter=t,this.stringAdapter=e,this.orderAdapter=i,this.db=n,this.fromExpr=o,this.onQueryError=s}adapt(t){const e=new Zt;return G.isString(t.title)&&(e.title=t.title),G.isArray(t.scenarios)&&(e.scenarios=j.adaptArray(t.scenarios,this.stringAdapter)),G.isExisting(t.scenariosUnitType)&&(e.scenariosUnitType=t.scenariosUnitType),G.isBoolean(t.grouped)&&(e.grouped=t.grouped),G.isBoolean(t.showGroupTitle)&&(e.showGroupTitle=t.showGroupTitle),G.isBoolean(t.runningSum)&&(e.runningSum=t.runningSum),G.isBoolean(t.varianceWaterfall)&&(e.varianceWaterfall=t.varianceWaterfall),t.thereOfPosition===c.ABOVE&&(e.thereOfPosition=c.ABOVE),G.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),G.isArray(t.thereOf)&&(e.thereOf=j.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),G.isExisting(t.categoryThereOf)&&(e.categoryThereOf=t.categoryThereOf),G.isArray(t.partOf)&&(e.partOf=j.adaptArray(t.partOf,this.tableDrillGroupAdapter)),G.isArray(t.attributes)&&(e.attributes=t.attributes),G.isExisting(t.order)&&(e.sortOrder=this.orderAdapter.adapt(t.order)),G.isExisting(t.type)&&(e.type=t.type),G.isNumber(t.limit)&&(e.limit=t.limit),G.isExisting(t.i18n)&&(e.i18n=t.i18n),G.isExisting(t.categoryWidth)&&(e.categoryWidth=t.categoryWidth),G.isExisting(t.measureScale)&&(e.measureScale=H.calculateMeasureScale(this.db,this.fromExpr,e.scenarios,t.measureScale,this.onQueryError)),G.isExisting(t.measureType)&&(e.measureType=t.measureType),G.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),G.isString(t.filter)&&(e.filter=t.filter.trim()),G.isArray(t.barColumns)&&(e.barColumns=t.barColumns),G.isString(t.interval)&&(e.interval=t.interval),G.isNumber(t.categoryIntervalPosition)&&(e.categoryIntervalPosition=t.categoryIntervalPosition),G.isString(t.locale)&&(e.locale=t.locale),e}default(){return new Zt}}class Kt{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class Jt{constructor(){}adapt(t){const e=new Kt;return G.isString(t.rowGroup)&&(e.rowGroup=t.rowGroup),G.isString(t.category)&&(e.category=t.category),G.isString(t.subCategory)&&(e.subCategory=t.subCategory),G.isString(t.partOf)&&(e.partOf=t.partOf),e}default(){return new Kt}}const te=e(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.sumTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=_.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.runningSum=!1,this.varianceWaterfall=!1,this.thereof=[],this.thereofPosition=c.BELOW,this.partof=[],this.order={hierarchy:[],direction:h.ASC},this.categorythereof=new Map,this.attributeColumns=[],this.type=l.LIST,this.categoryWidth=U.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=N.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=x.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 I,this.barColumnLayouts=new Map,this.waterfallGeometries=new Map,this.relayout=()=>{(this.barColumnLayouts.size>0||this.waterfallGeometries.size>0)&&n(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 i,n,o;const s={regions:[],metadata:{},diagnostics:[]},r=null===(i=this.element.shadowRoot)||void 0===i?void 0:i.querySelector("table");if(s.metadata.hasNoData=null===(o=null===(n=this.table)||void 0===n?void 0:n.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 h=this.table.getHeader(),c=this.table.getBody(),u=this.table.getColumns();if(s.metadata.headerRowCount=h.length,s.metadata.rowCount=c.length,s.metadata.columnCount=u.length,s.metadata.cellCount=c.reduce(((t,e)=>t+e.getCells().length),0),"full"!==e)return s;const v=[],m=[],g=(e,i,n)=>{const o=n?Array.from(n.children).filter((t=>"tr"===t.localName)):[];i.forEach(((i,n)=>{const r=o[n];if(!r)return;v.push({section:e,index:n,type:i.type,rect:d(r,t),point:$(r)});const l=i.getCells(),a=Array.from(r.children);l.length===a.length?l.forEach(((i,o)=>{var s,r;const l=a[o],h={kind:"header"===e?"headerCell":"cell",row:n,column:i.index,key:i.key||void 0,colSpan:i.colSpan,value:null!==(s=i.value)&&void 0!==s?s:void 0,text:(null===(r=l.textContent)||void 0===r?void 0:r.trim())||void 0,type:i.type||void 0,rect:d(l,t),point:$(l)};h.point&&(h.content=f(l,t),h.contentSign=p(l)||void 0);const c=l.querySelector("svg.cell-bar-chart");c&&(h.bar={variant:c.classList.contains("waterfall-bar")?"waterfall":c.classList.contains("relative-variance")?"relative":"absolute",rect:d(c,t)}),m.push(h)})):s.diagnostics.push({id:`WARN_layout_cell_pairing_${e}_${n}`,type:"warning",message:`layout-state: model/DOM cell count mismatch in ${e} row ${n} (${l.length} vs ${a.length}); cell details skipped for this row.`})}))};return g("header",h,l),g("body",c,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,i,n,o;if(void 0===this.table)return;if(this.table.hasNoData()){const i=null!==(e=this.i18n.get("no-data"))&&void 0!==e?e:"No Data";return t("div",{class:"empty-state"},i)}const s=null===(o=null===(n=null===(i=this.stores)||void 0===i?void 0:i.context)||void 0===n?void 0:n.state)||void 0===o?void 0:o.locale;return t("table",null,t("thead",null,this.table.getHeader().map((e=>t("tr",{class:e.cssStyle},e.getCells().map((e=>t("th",{colSpan:e.colSpan,class:e.cssStyle},e.getAsHeaderList().map(((i,n,o)=>t("span",null,n===o.length-1?t("span",{class:" "===i?"table-footer":""},i,e.drawPrefix()," "):t("span",null,i,e.drawPrefix(),t("br",null)))))))))))),t("tbody",null,this.table.getBody().map((e=>t("tr",Object.assign({class:e.cssStyle},g(e.key,"element")),null==e?void 0:e.getCells().map((i=>{var n,o,l,a,h;return t("td",Object.assign({colSpan:i.colSpan,class:i.type?`${this.cellClass(i,s)} ${i.type}`:i.cssStyle},e.key&&null!=i.value&&""!==i.value&&"-"!==i.value?g(Object.assign(Object.assign({},e.key),{date:i.date,scenario:i.key}),"element"):{}),null!=i.prefix?t("span",{class:this.cellClass(i,s)+" "+i.prefixStyle},i.drawPrefix()):"",!i.isBarChart||!i.columnStats||i.value===T||!this.showGroupTitle&&e.type===r.HEADER||void 0===i.waterfall&&e.type===r.SUM||void 0!==i.direction&&i.waterfall&&i.waterfall.max===i.waterfall.min?i.draw(this.componentDataFormatDigits,s):void 0!==i.waterfall?t(Pt,{value:i.value,scenario:i.key,columnStats:i.columnStats,height:18*this.scaleFactor,isRelative:!1,isPositiveGood:"pos"===i.direction,measureScale:ie(i),locale:s,decimalDigits:ne(i,this.componentDataFormatDigits),columnWidthEm:this.barColumnMaxWidth,styles:this.barChartStyles,waterfall:i.waterfall,geometry:this.waterfallGeometries.get(i.key),bold:ee(e),connectorReach:this.connectorReach(e)}):t(Lt,{value:i.value,scenario:i.key,columnStats:i.columnStats,height:18*this.scaleFactor,isRelative:i.key.startsWith("dr"),isPositiveGood:"pos"===i.direction,measureScale:ie(i),locale:s,decimalDigits:ne(i,this.componentDataFormatDigits),percentDigits:null!==(o=null===(n=this.barColumnLayouts.get(i.key))||void 0===n?void 0:n.percentDigits)&&void 0!==o?o:this.componentDataFormatDigits.percent,percentSign:null===(l=this.barColumnLayouts.get(i.key))||void 0===l?void 0:l.percentSign,columnWidthEm:this.barColumnMaxWidth,labelWidths:null===(a=this.barColumnLayouts.get(i.key))||void 0===a?void 0:a.labels,sideMax:null===(h=this.barColumnLayouts.get(i.key))||void 0===h?void 0:h.sideMax,bold:ee(e),styles:this.barChartStyles}))})))))))})())}componentWillRender(){var t,e,i,n,o,s,r,l,a,h,c;this.stores||(this.stores=F(this.element));const u=this.stores.db.db;this.componentDataFormatDigits=(new Y).adapt(this.dataFormatDigits);try{const e=this.prepareConfig(u);this.table=new Vt(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===(i=this.table)||void 0===i?void 0:i.hasBlankRowGroup())?null===(n=this.errors)||void 0===n||n.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===(h=this.errors)||void 0===h||h.addOrReplace({id:t,type:"warning",message:f.message}):null===(c=this.errors)||void 0===c||c.remove(t);this.barColumnLayouts=this.collectBarColumnLayouts(),this.waterfallGeometries=this.collectWaterfallGeometries(),this.barChartStyles=this.prepareBarChartStyles()}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,i,n;const o=B(t,this.tableName,this.filter);return new qt(new Jt,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===(n=null===(i=null===(e=this.stores)||void 0===e?void 0:e.context)||void 0===i?void 0:i.state)||void 0===n?void 0:n.locale)||"de"})}prepareBarChartStyles(){var t;const e=!(this.unitScaling>0),i=!(this.percentageScaling>0),n=e?this.autoUnitScaling():this.unitScaling,o=i?this.autoPercentageScaling():this.percentageScaling;return(e||i)&&(null===(t=this.reportAutoScaling)||void 0===t||t.call(this,{unit:e?n:void 0,percentage:i?o:void 0})),this.componentStyle((t=>{var e,i,s,r,l,a,h,c,u,d,f,p,v,$,g,b,w,y,S,R,O,N,_,G,U,x;const T=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.varianceStyles,k=null===(i=t["bn-chart-time"])||void 0===i?void 0:i.barStyles;return{positive:{stroke:(null===(s=null==T?void 0:T.pos)||void 0===s?void 0:s.stroke)||"#008f96",fill:(null===(r=null==T?void 0:T.pos)||void 0===r?void 0:r.fill)||"#008f96",fillpattern:m(null===(l=null==T?void 0:T.pos)||void 0===l?void 0:l.fillpattern)||"solid"},negative:{stroke:(null===(a=null==T?void 0:T.neg)||void 0===a?void 0:a.stroke)||"#ff0000",fill:(null===(h=null==T?void 0:T.neg)||void 0===h?void 0:h.fill)||"#ff0000",fillpattern:m(null===(c=null==T?void 0:T.neg)||void 0===c?void 0:c.fillpattern)||"solid"},neutral:{stroke:(null===(u=null==T?void 0:T.neu)||void 0===u?void 0:u.stroke)||"#808080",fill:(null===(d=null==T?void 0:T.neu)||void 0===d?void 0:d.fill)||"#808080",fillpattern:m(null===(f=null==T?void 0:T.neu)||void 0===f?void 0:f.fillpattern)||"outlined"},scenarios:M({ac:{stroke:(null===(p=null==k?void 0:k.ac)||void 0===p?void 0:p.stroke)||"#404040",fill:(null===(v=null==k?void 0:k.ac)||void 0===v?void 0:v.fill)||"#404040",fillpattern:m(null===($=null==k?void 0:k.ac)||void 0===$?void 0:$.fillpattern)||"solid"},pp:{stroke:(null===(g=null==k?void 0:k.pp)||void 0===g?void 0:g.stroke)||"#A6A6A6",fill:(null===(b=null==k?void 0:k.pp)||void 0===b?void 0:b.fill)||"#A6A6A6",fillpattern:m(null===(w=null==k?void 0:k.pp)||void 0===w?void 0:w.fillpattern)||"solid"},fc:{stroke:(null===(y=null==k?void 0:k.fc)||void 0===y?void 0:y.stroke)||"#404040",fill:(null===(S=null==k?void 0:k.fc)||void 0===S?void 0:S.fill)||"#ffffff",fillpattern:m(null===(R=null==k?void 0:k.fc)||void 0===R?void 0:R.fillpattern)||"hatched"},pl:{stroke:(null===(O=null==k?void 0:k.pl)||void 0===O?void 0:O.stroke)||"#404040",fill:(null===(N=null==k?void 0:k.pl)||void 0===N?void 0:N.fill)||"#ffffff",fillpattern:m(null===(_=null==k?void 0:k.pl)||void 0===_?void 0:_.fillpattern)||"outlined"}},new E(this.ruleSetConfig)),fontColor:(null===(G=t.global)||void 0===G?void 0:G.fontColor)||"#000000",fontSize:((null===(U=t.global)||void 0===U?void 0:U.fontSizePx)||13.3333)*ot*this.scaleFactor,emPx:((null===(x=t.global)||void 0===x?void 0:x.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:this.labelFontFamily(),unitScaling:n,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(),i=e*ot;let n=1/0;for(const{isRelative:o,absMax:s,labels:r,sideMax:l}of this.barColumnLayouts.values()){if(o||s<=0)continue;const a=vt(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];n=Math.min(n,Math.min(.8*s,r)/(o*i))}}return Number.isFinite(n)&&i>0?n:.01}autoPercentageScaling(){var t,e;const i=this.emPx(),n=i*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 h=10*this.scaleFactor,{negPinLength:c,posPinLength:u}=mt(this.barColumnMaxWidth,i,l,h),d=100*((null!==(t=a.neg)&&void 0!==t?t:0)+(null!==(e=a.pos)&&void 0!==e?e:0));o=Math.min(o,(c+u)/(d*n))}return Number.isFinite(o)&&n>0?o:.5}collectBarColumnLayouts(){var t,e,i,n;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 i of e.getCells())i.isBarChart&&i.columnStats&&void 0===i.waterfall&&("number"!=typeof i.value||isNaN(i.value)||s.set(i.key,[...null!==(t=s.get(i.key))&&void 0!==t?t:[],{cell:i,bold:ee(e)}]));const l=this.emPx(),a=l*ot,h=10*this.scaleFactor,c=null===(n=null===(i=null===(e=this.stores)||void 0===e?void 0:e.context)||void 0===i?void 0:i.state)||void 0===n?void 0:n.locale,u=this.labelFontFamily();for(const[t,e]of s){const i=t.startsWith("dr"),n=e.map((({cell:t})=>t.value)),s=(t,o)=>{var s;const r={neg:n.some((t=>t<0))?0:void 0,pos:n.some((t=>t>0))?0:void 0},l=Nt(r);for(const{cell:n,bold:h}of e){const e=n.value,d=e>0||0===e&&l?"pos":"neg",f=St(e,i,ie(n),c,t,o,ne(n,this.componentDataFormatDigits));r[d]=Math.max(null!==(s=r[d])&&void 0!==s?s:0,ht(f,a,u,i,h))}return r};let r=Math.min(20,Math.max(0,Math.trunc(this.componentDataFormatDigits.percent)||0)),d=!0,f=s(r,d);for(;i&&(r>0||d)&&!ft(this.barColumnMaxWidth,l,f,h);)r>0?r--:d=!1,f=s(r,d);const p=Math.max(...n.map(Math.abs))*(i?100:1),v={neg:void 0===f.neg?void 0:Math.max(0,...n.map((t=>-t))),pos:void 0===f.pos?void 0:Math.max(0,...n)};o.set(t,{isRelative:i,absMax:p,labels:f,sideMax:v,percentDigits:r,percentSign:d})}return o}connectorReach(t){const e=this.emPx();return{top:.1*e,bottom:t.type===r.SUM?.5*e:0}}collectWaterfallGeometries(){var t,e,i,n;const o=new Map;if(!this.table||this.table.hasNoData())return o;const s=this.emPx(),r=s*ot,l=null===(i=null===(e=null===(t=this.stores)||void 0===t?void 0:t.context)||void 0===e?void 0:e.state)||void 0===i?void 0:i.locale,a=this.labelFontFamily(),h=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:i,end:o,min:s,max:c,kind:u}=e.waterfall,d=Ct(e.value,u,ie(e),l,ne(e,this.componentDataFormatDigits),void 0!==e.direction),f=null!==(n=h.get(e.key))&&void 0!==n?n:{min:s,max:c,labels:[]};f.labels.push({end:o,pointsLeft:o<i,width:ht(d,r,a,!1,ee(t))}),h.set(e.key,f)}for(const[t,e]of h)o.set(t,$t(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.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.ofit-above td[class^=category]{padding-left:1em}tr.ofit-sum td{border-top:0.1em solid black;font-weight:bold}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(.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 ee(t){return t.type===r.SUM||"ofit-sum"===t.cssStyle}function ie(t){return"percentpoint"===t.type?.01:t.measureScale}function ne(t,e){return"percentpoint"===t.type?e.percent:"decimal"===t.type?e.decimal:void 0}function oe(){"undefined"!=typeof customElements&&["bn-table-renderer"].forEach((t=>{"bn-table-renderer"===t&&(customElements.get(s(t))||customElements.define(s(t),te))}))}export{te as B,V as I,Z as a,K as c,oe as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as t}from"./p-B5tixDPM.js";import{X as s}from"./p-DDvWTgk1.js";import{L as i,H as n}from"./p-Dm6EAaJ9.js";import{F as o,C as e}from"./p-CniN8ALm.js";import{N as r}from"./p-BJmwHV0a.js";import{s as h}from"./p-Xb6Ilq8u.js";import{B as l}from"./p-XFZYX7DZ.js";import{D as a}from"./p-Dq9dG0Kr.js";import{b as c}from"./p-BXXjh6We.js";class u{constructor(t,i,n,o){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=n,this.padding=o,this.seriesColors=[...s],this.locale="de"}}class f{constructor(t,s,i,n){this.scaleFactorsXYChartAdapter=t,this.fontStyleAdapter=s,this.svgStyleGroupAdapter=i,this.paddingAdapter=n}adapt(s){const i=this.default();return t.isExisting(s)&&(t.isExisting(s.scaleFactors)&&(i.scaleFactors=this.scaleFactorsXYChartAdapter.adapt(s.scaleFactors)),t.isExisting(s.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(s.fontStyles)),t.isExisting(s.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(s.axisStyles)),t.isExisting(s.padding)&&(i.padding=this.paddingAdapter.adapt(s.padding)),Array.isArray(s.seriesColors)&&s.seriesColors.length>0&&(i.seriesColors=s.seriesColors)),i}default(){return new u(this.scaleFactorsXYChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.paddingAdapter.default())}}class d{constructor(){this.pointRadius=.4,this.bubbleMaxRadius=3.2,this.bubbleMinRadius=.35,this.axisTickLength=.35,this.labelToMark=.3,this.legendSwatch=.9,this.panelGap=1.6,this.refLineWidth=.075,this.gridLineWidth=.075}}class v{adapt(s){const i=new d;return t.isNumber(s.pointRadius)&&(i.pointRadius=s.pointRadius),t.isNumber(s.bubbleMaxRadius)&&(i.bubbleMaxRadius=s.bubbleMaxRadius),t.isNumber(s.bubbleMinRadius)&&(i.bubbleMinRadius=s.bubbleMinRadius),t.isNumber(s.axisTickLength)&&(i.axisTickLength=s.axisTickLength),t.isNumber(s.labelToMark)&&(i.labelToMark=s.labelToMark),t.isNumber(s.legendSwatch)&&(i.legendSwatch=s.legendSwatch),t.isNumber(s.panelGap)&&(i.panelGap=s.panelGap),t.isNumber(s.refLineWidth)&&(i.refLineWidth=s.refLineWidth),t.isNumber(s.gridLineWidth)&&(i.gridLineWidth=s.gridLineWidth),i}default(){return new d}}function m(t,s,i){const n={[i.pointLevel]:t.name};return null!==i.seriesLevel&&""!==t.seriesKey&&(n[i.seriesLevel]=t.seriesKey),null!==i.facet&&""!==s&&(n["rowgroup"===i.facet.level?"rowGroup":"category"]=s),n}class p{constructor(t,s,i,n){this.count=t,this.drawingRect=i,this.panelGapPx=n,this.columns=Math.max(1,Math.min(null!=s?s:t,t)),this.rows=Math.max(1,Math.ceil(t/this.columns))}panelRect(t){const s=t%this.columns,i=Math.floor(t/this.columns),n=(this.drawingRect.width-(this.columns-1)*this.panelGapPx)/this.columns,o=(this.drawingRect.height-(this.rows-1)*this.panelGapPx)/this.rows;return{x:this.drawingRect.x+s*(n+this.panelGapPx),y:this.drawingRect.y+i*(o+this.panelGapPx),width:n,height:o}}isOuterLeft(t){return t%this.columns==0}isOuterBottom(t){return t+this.columns>=this.count}}function w(t,s,i,n=!1){return o.number(t,n?"percent":"decimal",s,s,1,i)}function x(t,s){return r.tickDecimals(s?t.map((t=>100*t)):t)}const y=["n","ne","e","se","s","sw","w","nw"],b=Math.SQRT1_2;class g{constructor(t,s,n=new i){this.frame=t,this.gapPx=s,this.manager=n}registerMark(t,s,i){this.manager.register(this.bounds(t-i,s-i,2*i,2*i))}selectCandidates(t,s,i,n){if("none"===s)return{selected:[],unknownNames:[]};if("all"===s)return{selected:[...t],unknownNames:[]};if("auto"===s)return{selected:t.slice(0,i),unknownNames:[]};const o=new Set(s),e=t.filter((t=>o.has(n(t)))),r=new Set(e.map((t=>n(t))));return{selected:e,unknownNames:s.filter((t=>!r.has(t)))}}place(t){const s=[];for(const i of t)for(const t of y){const n=this.anchorBox(i,t);if(!this.insideFrame(n.x,n.y,i.width,i.height))continue;const o=this.bounds(n.x,n.y,i.width,i.height);if(!this.manager.hasCollision(o)){this.manager.register(o),s.push({candidate:i,x:n.x,y:n.y,anchor:t});break}}return s}anchorBox(t,s){const i=t.r+this.gapPx,n=t.r*b+.5*this.gapPx;switch(s){case"n":return{x:t.cx-t.width/2,y:t.cy-i-t.height};case"ne":return{x:t.cx+n,y:t.cy-n-t.height};case"e":return{x:t.cx+i,y:t.cy-t.height/2};case"se":return{x:t.cx+n,y:t.cy+n};case"s":return{x:t.cx-t.width/2,y:t.cy+i};case"sw":return{x:t.cx-n-t.width,y:t.cy+n};case"w":return{x:t.cx-i-t.width,y:t.cy-t.height/2};case"nw":return{x:t.cx-n-t.width,y:t.cy-n-t.height}}}insideFrame(t,s,i,n){return t>=this.frame.x&&s>=this.frame.y&&t+i<=this.frame.x+this.frame.width&&s+n<=this.frame.y+this.frame.height}bounds(t,s,i,o){return{x:t,y:s,width:i,height:o,pointIndex:0,preferredHook:n.Center}}}class M{constructor(t,s,i,n){this.xScale=t,this.yScale=s,this.rect=i,this.styles=n}get em(){return this.styles.fontStyles.size}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}drawBands(t,s,i){var n,o,e,r;const h=this.styles.axisStyles.pl.fill;if(void 0!==s&&(void 0!==s.from||void 0!==s.to)){const i=this.xScale.scale(null!==(n=s.from)&&void 0!==n?n:this.xScale.domainMin),e=this.xScale.scale(null!==(o=s.to)&&void 0!==o?o:this.xScale.domainMax);t.rect(Math.abs(e-i),this.rect.height).move(Math.min(i,e),this.rect.y).fill(h)}if(void 0!==i&&(void 0!==i.from||void 0!==i.to)){const s=this.yScale.scale(null!==(e=i.from)&&void 0!==e?e:this.yScale.domainMin),n=this.yScale.scale(null!==(r=i.to)&&void 0!==r?r:this.yScale.domainMax);t.rect(this.rect.width,Math.abs(s-n)).move(this.rect.x,Math.min(s,n)).fill(h)}}drawGrid(t,s,i){const n={color:this.styles.axisStyles.pp.stroke,width:h(this.styles.scaleFactors.gridLineWidth,this.em)};for(const i of s){const s=this.yScale.scale(i);t.line(this.rect.x,s,this.rect.x+this.rect.width,s).stroke(n)}if(void 0!==i)for(const s of i){const i=this.xScale.scale(s);t.line(i,this.rect.y,i,this.rect.y+this.rect.height).stroke(n)}}drawRefLines(t,s,i){const n={color:this.styles.axisStyles.fc.stroke,width:h(this.styles.scaleFactors.refLineWidth,this.em)};if(void 0!==s){const i=this.xScale.scale(s);t.line(i,this.rect.y,i,this.rect.y+this.rect.height).stroke(n)}if(void 0!==i){const s=this.yScale.scale(i);t.line(this.rect.x,s,this.rect.x+this.rect.width,s).stroke(n)}}drawFrame(t){t.rect(this.rect.width,this.rect.height).move(this.rect.x,this.rect.y).fill("none").stroke({color:this.styles.axisStyles.ac.stroke,width:h(this.styles.scaleFactors.gridLineWidth,this.em)}).attr(l,"frame")}drawTickLabels(t,s){const i=this.styles.scaleFactors.axisTickLength*this.em,n={size:this.styles.fontStyles.size,anchor:"start"},o=this.fontFamily(),e=this.styles.fontStyles.color;if(s.showXLabels)for(const r of s.ticksX){const h=this.xScale.scale(r);t.text(w(r,s.xDecimals,this.styles.locale,s.xPercent)).font(Object.assign(Object.assign({},n),{anchor:"middle"})).fill(e).attr({x:h,y:this.rect.y+this.rect.height+i+.8*this.em,"font-family":o})}if(s.showYLabels)for(const r of s.ticksY){const h=this.yScale.scale(r);t.text(w(r,s.yDecimals,this.styles.locale,s.yPercent)).font(Object.assign(Object.assign({},n),{anchor:"end"})).fill(e).attr({x:this.rect.x-i,y:h+.35*this.em,"font-family":o})}}drawPanelTitle(t,s){""!==s&&t.text(s).font({size:this.styles.fontStyles.size,weight:"bold",anchor:"start"}).fill(this.styles.fontStyles.color).attr({x:this.rect.x+.5*this.em,y:this.rect.y+1.2*this.em,"font-family":this.fontFamily()})}}class N{constructor(t){this.styles=t}get em(){return this.styles.fontStyles.size}get rowHeight(){return 1.5*this.em}get swatchSize(){return this.styles.scaleFactors.legendSwatch*this.em}textWidth(t,s=!1){const i=e(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:s?"bold":"normal"}).width;return Number.isFinite(i)&&i>0?i:.6*t.length*this.em}rows(t){const s=[];t.sizeCaption.forEach(((t,i)=>{s.push({text:t,bold:0===i,treatment:null})})),null!==t.title&&""!==t.title&&s.push({text:t.title,bold:!0,treatment:null});for(const i of[...t.compareEntries,...t.entries])s.push({text:i.label,bold:!1,treatment:i.treatment,fill:i.fill});return s}measure(t,s){const i=this.rows(t);if(0===i.length)return{width:0,height:0};const n=this.swatchSize+.4*this.em;if("bottom"===s){let t=0;for(const s of i)t+=(null!==s.treatment?n:0)+this.textWidth(s.text,s.bold)+1.5*this.em;return{width:t,height:this.rowHeight}}let o=0;for(const t of i)o=Math.max(o,(null!==t.treatment?n:0)+this.textWidth(t.text,t.bold));return{width:o,height:i.length*this.rowHeight}}draw(t,s,i,n,o){var e;const r=this.rows(s),h=this.swatchSize+.4*this.em;let l=i,a=n;for(const s of r){let i=l;if(null!==s.treatment){const n=t.circle(this.swatchSize).move(l,a+(this.rowHeight-this.swatchSize)/2).fill(null!==(e=s.fill)&&void 0!==e?e:s.treatment.hatch?"#ffffff":s.treatment.fill).stroke({color:"#ffffff"===s.treatment.stroke?s.treatment.fill:s.treatment.stroke,width:s.treatment.strokeWidth});void 0!==s.treatment.dasharray&&n.attr("stroke-dasharray",s.treatment.dasharray),i+=h}t.text(s.text).font({size:this.styles.fontStyles.size,weight:s.bold?"bold":"normal",anchor:"start"}).fill(this.styles.fontStyles.color).attr({x:i,y:a+this.rowHeight/2+.35*this.em,"font-family":this.fontFamily()}),"bottom"===o?l=i+this.textWidth(s.text,s.bold)+1.5*this.em:a+=this.rowHeight}}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}}class j{constructor(){this.operation="+",this.custom={},this.counts={}}slotValue(s){const i=this[s];return t.isNumber(i)?i:null}slotHasNoData(t){return 0===this.counts[t]}}const S=["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"];class k{adapt(s){const i=new j;if(t.isOperator(s.operation)&&(i.operation=s.operation),t.isString(s.date)){const t=a.fromISO(s.date);i.date=t.isValid?t:void 0}t.isString(s.rowGroup)&&t.isNumber(s.rowGroupIndex)&&(i.rowGroup=s.rowGroup,i.rowGroupIndex=s.rowGroupIndex),t.isString(s.category)&&t.isNumber(s.categoryIndex)&&(i.category=s.category,i.categoryIndex=s.categoryIndex),t.isString(s.subCategory)&&t.isNumber(s.subCategoryIndex)&&(i.subCategory=s.subCategory,i.subCategoryIndex=s.subCategoryIndex),t.isString(s.columnGroup)&&t.isNumber(s.columnGroupIndex)&&(i.columnGroup=s.columnGroup,i.columnGroupIndex=s.columnGroupIndex),t.isString(s.columnSubGroup)&&t.isNumber(s.columnSubGroupIndex)&&(i.columnSubGroup=s.columnSubGroup,i.columnSubGroupIndex=s.columnSubGroupIndex);for(const n of S){t.isNumber(s[n])&&(i[n]=s[n]);const o=s[`${n}_cnt`];t.isNumber(o)&&(i.counts[n]=o)}for(const t of Object.keys(s))t.startsWith("_")&&(i.custom[t]=s[t]);return i}default(){return new j}}const D={rowGroup:"rowGroupIndex",category:"categoryIndex",subCategory:"subCategoryIndex"};function z(t,s){if("scenario"===s.kind)return{value:t.slotValue(s.slot),varianceNoData:!1};if(t.slotHasNoData(s.measure.base)||t.slotHasNoData(s.measure.delta))return{value:null,varianceNoData:!0};const i=s.measure.compute(t.slotValue(s.measure.base),t.slotValue(s.measure.delta));return{value:i,varianceNoData:null===i}}function B(t,s){return void 0!==s&&(void 0!==s.min&&t<s.min||void 0!==s.max&&t>s.max)}function F(t,s){return"scenario"!==t.kind?null:s+c(t.slot)}function O(t,s){var i,n,o,e,r,h,l,a,c;const u=[],f=new Set,d=[];let v=0,m=0,p=0,w=0,x=0;const y=new Map,b=new Map,g=new Map,M=null!==(i=s.compareFamily)&&void 0!==i?i:null,N=null!==M?F(s.measures.x,M):null,j=null!==M?F(s.measures.y,M):null,S=null!==M&&void 0!==s.measures.size?F(s.measures.size,M):null;for(const i of t){const t=i[s.pointLevel];if(null==t||""===t)continue;const u=null!==(n=null!==s.facetLevel?i[s.facetLevel]:"")&&void 0!==n?n:"",M=null!==(o=null!==s.seriesLevel?i[s.seriesLevel]:"")&&void 0!==o?o:"",k=`${u}\0${M}\0${t}`;if(f.has(k)){v++,d.length<5&&!d.includes(t)&&d.push(t);continue}const F=z(i,s.measures.x),O=z(i,s.measures.y);if(null===F.value||null===O.value){(F.varianceNoData||O.varianceNoData)&&m++;continue}if(B(F.value,null===(e=s.domains)||void 0===e?void 0:e.x)||B(O.value,null===(r=s.domains)||void 0===r?void 0:r.y)){p++;continue}const X={name:t,seriesKey:M,facetKey:u,x:F.value,y:O.value,row:i};if(void 0!==s.measures.size){const t=z(i,s.measures.size).value;if(null===t)continue;if(t<0){w++;continue}X.size=t}if(void 0!==s.measures.share){const t=z(i,s.measures.share).value;null!==t&&(t<0||t>1?(x++,X.share=Math.min(1,Math.max(0,t))):X.share=t)}if(null!==N&&null!==j){const t=i.slotValue(N),n=i.slotValue(j),o=null!==S?i.slotValue(S):null;null===t||null===n||null!==S&&null===o?X.compare=null:B(t,null===(h=s.domains)||void 0===h?void 0:h.x)||B(n,null===(l=s.domains)||void 0===l?void 0:l.y)?(p++,X.compare=null):(X.compare={x:t,y:n},null!==o&&(X.compare.size=o))}if(f.add(k),g.has(u)||g.set(u,[]),g.get(u).push(X),null!==s.facetLevel){const t=i[D[s.facetLevel]];null!=t&&t<(null!==(a=y.get(u))&&void 0!==a?a:Number.POSITIVE_INFINITY)&&y.set(u,t)}if(null!==s.seriesLevel){const t=i[D[s.seriesLevel]];null!=t&&t<(null!==(c=b.get(M))&&void 0!==c?c:Number.POSITIVE_INFINITY)&&b.set(M,t)}}const k=[...g.keys()].sort(((t,s)=>{var i,n;return(null!==(i=y.get(t))&&void 0!==i?i:Number.MAX_SAFE_INTEGER)-(null!==(n=y.get(s))&&void 0!==n?n:Number.MAX_SAFE_INTEGER)})),O=k.map((t=>{let i=g.get(t);return s.limit>0&&i.length>s.limit&&(i="size"===s.limitBy?[...i].sort(((t,s)=>{var i,n;return(null!==(i=s.size)&&void 0!==i?i:0)-(null!==(n=t.size)&&void 0!==n?n:0)})).slice(0,s.limit):i.slice(0,s.limit)),{key:t,points:i}})),X=new Set;for(const t of O)for(const s of t.points)X.add(s.seriesKey);const C=[...X].sort(((t,s)=>{var i,n;return(null!==(i=b.get(t))&&void 0!==i?i:Number.MAX_SAFE_INTEGER)-(null!==(n=b.get(s))&&void 0!==n?n:Number.MAX_SAFE_INTEGER)})).map(((t,s)=>({key:t,index:s})));let H=null,I=0;for(const t of O)for(const s of t.points){I++;const t=[s.x],i=[s.y],n=void 0!==s.size?[s.size]:[];null!=s.compare&&(t.push(s.compare.x),i.push(s.compare.y),void 0!==s.compare.size&&n.push(s.compare.size)),null===H&&(H={xMin:t[0],xMax:t[0],yMin:i[0],yMax:i[0],sizeMax:0});for(const s of t)H.xMin=Math.min(H.xMin,s),H.xMax=Math.max(H.xMax,s);for(const t of i)H.yMin=Math.min(H.yMin,t),H.yMax=Math.max(H.yMax,t);for(const t of n)H.sizeMax=Math.max(H.sizeMax,t)}return v>0&&u.push({code:"xy-duplicate-point",data:{count:String(v),names:d.join(", ")}}),m>0&&u.push({code:"xy-variance-nodata",data:{count:String(m)}}),p>0&&u.push({code:"xy-point-clipped",data:{count:String(p)}}),w>0&&u.push({code:"bubble-size-negative",data:{count:String(w)}}),x>0&&u.push({code:"bubble-share-range",data:{count:String(x)}}),I>5e3&&u.push({code:"xy-point-budget",data:{count:String(I)}}),{facets:O,series:C,extents:H,warnings:u,totalPoints:I}}export{p as F,g as P,v as S,k as X,N as a,M as b,m as c,f as d,w as f,O as r,x}
|
|
1
|
+
import{C as t}from"./p-B5tixDPM.js";import{X as s}from"./p-DDvWTgk1.js";import{L as i,H as n}from"./p-CvEdUq8i.js";import{F as o,C as e}from"./p-CniN8ALm.js";import{N as r}from"./p-BJmwHV0a.js";import{s as h}from"./p-Xb6Ilq8u.js";import{B as l}from"./p-XFZYX7DZ.js";import{D as a}from"./p-Dq9dG0Kr.js";import{b as c}from"./p-BXXjh6We.js";class u{constructor(t,i,n,o){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=n,this.padding=o,this.seriesColors=[...s],this.locale="de"}}class f{constructor(t,s,i,n){this.scaleFactorsXYChartAdapter=t,this.fontStyleAdapter=s,this.svgStyleGroupAdapter=i,this.paddingAdapter=n}adapt(s){const i=this.default();return t.isExisting(s)&&(t.isExisting(s.scaleFactors)&&(i.scaleFactors=this.scaleFactorsXYChartAdapter.adapt(s.scaleFactors)),t.isExisting(s.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(s.fontStyles)),t.isExisting(s.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(s.axisStyles)),t.isExisting(s.padding)&&(i.padding=this.paddingAdapter.adapt(s.padding)),Array.isArray(s.seriesColors)&&s.seriesColors.length>0&&(i.seriesColors=s.seriesColors)),i}default(){return new u(this.scaleFactorsXYChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.paddingAdapter.default())}}class d{constructor(){this.pointRadius=.4,this.bubbleMaxRadius=3.2,this.bubbleMinRadius=.35,this.axisTickLength=.35,this.labelToMark=.3,this.legendSwatch=.9,this.panelGap=1.6,this.refLineWidth=.075,this.gridLineWidth=.075}}class v{adapt(s){const i=new d;return t.isNumber(s.pointRadius)&&(i.pointRadius=s.pointRadius),t.isNumber(s.bubbleMaxRadius)&&(i.bubbleMaxRadius=s.bubbleMaxRadius),t.isNumber(s.bubbleMinRadius)&&(i.bubbleMinRadius=s.bubbleMinRadius),t.isNumber(s.axisTickLength)&&(i.axisTickLength=s.axisTickLength),t.isNumber(s.labelToMark)&&(i.labelToMark=s.labelToMark),t.isNumber(s.legendSwatch)&&(i.legendSwatch=s.legendSwatch),t.isNumber(s.panelGap)&&(i.panelGap=s.panelGap),t.isNumber(s.refLineWidth)&&(i.refLineWidth=s.refLineWidth),t.isNumber(s.gridLineWidth)&&(i.gridLineWidth=s.gridLineWidth),i}default(){return new d}}function m(t,s,i){const n={[i.pointLevel]:t.name};return null!==i.seriesLevel&&""!==t.seriesKey&&(n[i.seriesLevel]=t.seriesKey),null!==i.facet&&""!==s&&(n["rowgroup"===i.facet.level?"rowGroup":"category"]=s),n}class p{constructor(t,s,i,n){this.count=t,this.drawingRect=i,this.panelGapPx=n,this.columns=Math.max(1,Math.min(null!=s?s:t,t)),this.rows=Math.max(1,Math.ceil(t/this.columns))}panelRect(t){const s=t%this.columns,i=Math.floor(t/this.columns),n=(this.drawingRect.width-(this.columns-1)*this.panelGapPx)/this.columns,o=(this.drawingRect.height-(this.rows-1)*this.panelGapPx)/this.rows;return{x:this.drawingRect.x+s*(n+this.panelGapPx),y:this.drawingRect.y+i*(o+this.panelGapPx),width:n,height:o}}isOuterLeft(t){return t%this.columns==0}isOuterBottom(t){return t+this.columns>=this.count}}function w(t,s,i,n=!1){return o.number(t,n?"percent":"decimal",s,s,1,i)}function x(t,s){return r.tickDecimals(s?t.map((t=>100*t)):t)}const y=["n","ne","e","se","s","sw","w","nw"],b=Math.SQRT1_2;class g{constructor(t,s,n=new i){this.frame=t,this.gapPx=s,this.manager=n}registerMark(t,s,i){this.manager.register(this.bounds(t-i,s-i,2*i,2*i))}selectCandidates(t,s,i,n){if("none"===s)return{selected:[],unknownNames:[]};if("all"===s)return{selected:[...t],unknownNames:[]};if("auto"===s)return{selected:t.slice(0,i),unknownNames:[]};const o=new Set(s),e=t.filter((t=>o.has(n(t)))),r=new Set(e.map((t=>n(t))));return{selected:e,unknownNames:s.filter((t=>!r.has(t)))}}place(t){const s=[];for(const i of t)for(const t of y){const n=this.anchorBox(i,t);if(!this.insideFrame(n.x,n.y,i.width,i.height))continue;const o=this.bounds(n.x,n.y,i.width,i.height);if(!this.manager.hasCollision(o)){this.manager.register(o),s.push({candidate:i,x:n.x,y:n.y,anchor:t});break}}return s}anchorBox(t,s){const i=t.r+this.gapPx,n=t.r*b+.5*this.gapPx;switch(s){case"n":return{x:t.cx-t.width/2,y:t.cy-i-t.height};case"ne":return{x:t.cx+n,y:t.cy-n-t.height};case"e":return{x:t.cx+i,y:t.cy-t.height/2};case"se":return{x:t.cx+n,y:t.cy+n};case"s":return{x:t.cx-t.width/2,y:t.cy+i};case"sw":return{x:t.cx-n-t.width,y:t.cy+n};case"w":return{x:t.cx-i-t.width,y:t.cy-t.height/2};case"nw":return{x:t.cx-n-t.width,y:t.cy-n-t.height}}}insideFrame(t,s,i,n){return t>=this.frame.x&&s>=this.frame.y&&t+i<=this.frame.x+this.frame.width&&s+n<=this.frame.y+this.frame.height}bounds(t,s,i,o){return{x:t,y:s,width:i,height:o,pointIndex:0,preferredHook:n.Center}}}class M{constructor(t,s,i,n){this.xScale=t,this.yScale=s,this.rect=i,this.styles=n}get em(){return this.styles.fontStyles.size}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}drawBands(t,s,i){var n,o,e,r;const h=this.styles.axisStyles.pl.fill;if(void 0!==s&&(void 0!==s.from||void 0!==s.to)){const i=this.xScale.scale(null!==(n=s.from)&&void 0!==n?n:this.xScale.domainMin),e=this.xScale.scale(null!==(o=s.to)&&void 0!==o?o:this.xScale.domainMax);t.rect(Math.abs(e-i),this.rect.height).move(Math.min(i,e),this.rect.y).fill(h)}if(void 0!==i&&(void 0!==i.from||void 0!==i.to)){const s=this.yScale.scale(null!==(e=i.from)&&void 0!==e?e:this.yScale.domainMin),n=this.yScale.scale(null!==(r=i.to)&&void 0!==r?r:this.yScale.domainMax);t.rect(this.rect.width,Math.abs(s-n)).move(this.rect.x,Math.min(s,n)).fill(h)}}drawGrid(t,s,i){const n={color:this.styles.axisStyles.pp.stroke,width:h(this.styles.scaleFactors.gridLineWidth,this.em)};for(const i of s){const s=this.yScale.scale(i);t.line(this.rect.x,s,this.rect.x+this.rect.width,s).stroke(n)}if(void 0!==i)for(const s of i){const i=this.xScale.scale(s);t.line(i,this.rect.y,i,this.rect.y+this.rect.height).stroke(n)}}drawRefLines(t,s,i){const n={color:this.styles.axisStyles.fc.stroke,width:h(this.styles.scaleFactors.refLineWidth,this.em)};if(void 0!==s){const i=this.xScale.scale(s);t.line(i,this.rect.y,i,this.rect.y+this.rect.height).stroke(n)}if(void 0!==i){const s=this.yScale.scale(i);t.line(this.rect.x,s,this.rect.x+this.rect.width,s).stroke(n)}}drawFrame(t){t.rect(this.rect.width,this.rect.height).move(this.rect.x,this.rect.y).fill("none").stroke({color:this.styles.axisStyles.ac.stroke,width:h(this.styles.scaleFactors.gridLineWidth,this.em)}).attr(l,"frame")}drawTickLabels(t,s){const i=this.styles.scaleFactors.axisTickLength*this.em,n={size:this.styles.fontStyles.size,anchor:"start"},o=this.fontFamily(),e=this.styles.fontStyles.color;if(s.showXLabels)for(const r of s.ticksX){const h=this.xScale.scale(r);t.text(w(r,s.xDecimals,this.styles.locale,s.xPercent)).font(Object.assign(Object.assign({},n),{anchor:"middle"})).fill(e).attr({x:h,y:this.rect.y+this.rect.height+i+.8*this.em,"font-family":o})}if(s.showYLabels)for(const r of s.ticksY){const h=this.yScale.scale(r);t.text(w(r,s.yDecimals,this.styles.locale,s.yPercent)).font(Object.assign(Object.assign({},n),{anchor:"end"})).fill(e).attr({x:this.rect.x-i,y:h+.35*this.em,"font-family":o})}}drawPanelTitle(t,s){""!==s&&t.text(s).font({size:this.styles.fontStyles.size,weight:"bold",anchor:"start"}).fill(this.styles.fontStyles.color).attr({x:this.rect.x+.5*this.em,y:this.rect.y+1.2*this.em,"font-family":this.fontFamily()})}}class N{constructor(t){this.styles=t}get em(){return this.styles.fontStyles.size}get rowHeight(){return 1.5*this.em}get swatchSize(){return this.styles.scaleFactors.legendSwatch*this.em}textWidth(t,s=!1){const i=e(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:s?"bold":"normal"}).width;return Number.isFinite(i)&&i>0?i:.6*t.length*this.em}rows(t){const s=[];t.sizeCaption.forEach(((t,i)=>{s.push({text:t,bold:0===i,treatment:null})})),null!==t.title&&""!==t.title&&s.push({text:t.title,bold:!0,treatment:null});for(const i of[...t.compareEntries,...t.entries])s.push({text:i.label,bold:!1,treatment:i.treatment,fill:i.fill});return s}measure(t,s){const i=this.rows(t);if(0===i.length)return{width:0,height:0};const n=this.swatchSize+.4*this.em;if("bottom"===s){let t=0;for(const s of i)t+=(null!==s.treatment?n:0)+this.textWidth(s.text,s.bold)+1.5*this.em;return{width:t,height:this.rowHeight}}let o=0;for(const t of i)o=Math.max(o,(null!==t.treatment?n:0)+this.textWidth(t.text,t.bold));return{width:o,height:i.length*this.rowHeight}}draw(t,s,i,n,o){var e;const r=this.rows(s),h=this.swatchSize+.4*this.em;let l=i,a=n;for(const s of r){let i=l;if(null!==s.treatment){const n=t.circle(this.swatchSize).move(l,a+(this.rowHeight-this.swatchSize)/2).fill(null!==(e=s.fill)&&void 0!==e?e:s.treatment.hatch?"#ffffff":s.treatment.fill).stroke({color:"#ffffff"===s.treatment.stroke?s.treatment.fill:s.treatment.stroke,width:s.treatment.strokeWidth});void 0!==s.treatment.dasharray&&n.attr("stroke-dasharray",s.treatment.dasharray),i+=h}t.text(s.text).font({size:this.styles.fontStyles.size,weight:s.bold?"bold":"normal",anchor:"start"}).fill(this.styles.fontStyles.color).attr({x:i,y:a+this.rowHeight/2+.35*this.em,"font-family":this.fontFamily()}),"bottom"===o?l=i+this.textWidth(s.text,s.bold)+1.5*this.em:a+=this.rowHeight}}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}}class j{constructor(){this.operation="+",this.custom={},this.counts={}}slotValue(s){const i=this[s];return t.isNumber(i)?i:null}slotHasNoData(t){return 0===this.counts[t]}}const S=["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"];class k{adapt(s){const i=new j;if(t.isOperator(s.operation)&&(i.operation=s.operation),t.isString(s.date)){const t=a.fromISO(s.date);i.date=t.isValid?t:void 0}t.isString(s.rowGroup)&&t.isNumber(s.rowGroupIndex)&&(i.rowGroup=s.rowGroup,i.rowGroupIndex=s.rowGroupIndex),t.isString(s.category)&&t.isNumber(s.categoryIndex)&&(i.category=s.category,i.categoryIndex=s.categoryIndex),t.isString(s.subCategory)&&t.isNumber(s.subCategoryIndex)&&(i.subCategory=s.subCategory,i.subCategoryIndex=s.subCategoryIndex),t.isString(s.columnGroup)&&t.isNumber(s.columnGroupIndex)&&(i.columnGroup=s.columnGroup,i.columnGroupIndex=s.columnGroupIndex),t.isString(s.columnSubGroup)&&t.isNumber(s.columnSubGroupIndex)&&(i.columnSubGroup=s.columnSubGroup,i.columnSubGroupIndex=s.columnSubGroupIndex);for(const n of S){t.isNumber(s[n])&&(i[n]=s[n]);const o=s[`${n}_cnt`];t.isNumber(o)&&(i.counts[n]=o)}for(const t of Object.keys(s))t.startsWith("_")&&(i.custom[t]=s[t]);return i}default(){return new j}}const D={rowGroup:"rowGroupIndex",category:"categoryIndex",subCategory:"subCategoryIndex"};function z(t,s){if("scenario"===s.kind)return{value:t.slotValue(s.slot),varianceNoData:!1};if(t.slotHasNoData(s.measure.base)||t.slotHasNoData(s.measure.delta))return{value:null,varianceNoData:!0};const i=s.measure.compute(t.slotValue(s.measure.base),t.slotValue(s.measure.delta));return{value:i,varianceNoData:null===i}}function B(t,s){return void 0!==s&&(void 0!==s.min&&t<s.min||void 0!==s.max&&t>s.max)}function C(t,s){return"scenario"!==t.kind?null:s+c(t.slot)}function F(t,s){var i,n,o,e,r,h,l,a,c;const u=[],f=new Set,d=[];let v=0,m=0,p=0,w=0,x=0;const y=new Map,b=new Map,g=new Map,M=null!==(i=s.compareFamily)&&void 0!==i?i:null,N=null!==M?C(s.measures.x,M):null,j=null!==M?C(s.measures.y,M):null,S=null!==M&&void 0!==s.measures.size?C(s.measures.size,M):null;for(const i of t){const t=i[s.pointLevel];if(null==t||""===t)continue;const u=null!==(n=null!==s.facetLevel?i[s.facetLevel]:"")&&void 0!==n?n:"",M=null!==(o=null!==s.seriesLevel?i[s.seriesLevel]:"")&&void 0!==o?o:"",k=`${u}\0${M}\0${t}`;if(f.has(k)){v++,d.length<5&&!d.includes(t)&&d.push(t);continue}const C=z(i,s.measures.x),F=z(i,s.measures.y);if(null===C.value||null===F.value){(C.varianceNoData||F.varianceNoData)&&m++;continue}if(B(C.value,null===(e=s.domains)||void 0===e?void 0:e.x)||B(F.value,null===(r=s.domains)||void 0===r?void 0:r.y)){p++;continue}const O={name:t,seriesKey:M,facetKey:u,x:C.value,y:F.value,row:i};if(void 0!==s.measures.size){const t=z(i,s.measures.size).value;if(null===t)continue;if(t<0){w++;continue}O.size=t}if(void 0!==s.measures.share){const t=z(i,s.measures.share).value;null!==t&&(t<0||t>1?(x++,O.share=Math.min(1,Math.max(0,t))):O.share=t)}if(null!==N&&null!==j){const t=i.slotValue(N),n=i.slotValue(j),o=null!==S?i.slotValue(S):null;null===t||null===n||null!==S&&null===o?O.compare=null:B(t,null===(h=s.domains)||void 0===h?void 0:h.x)||B(n,null===(l=s.domains)||void 0===l?void 0:l.y)?(p++,O.compare=null):(O.compare={x:t,y:n},null!==o&&(O.compare.size=o))}if(f.add(k),g.has(u)||g.set(u,[]),g.get(u).push(O),null!==s.facetLevel){const t=i[D[s.facetLevel]];null!=t&&t<(null!==(a=y.get(u))&&void 0!==a?a:Number.POSITIVE_INFINITY)&&y.set(u,t)}if(null!==s.seriesLevel){const t=i[D[s.seriesLevel]];null!=t&&t<(null!==(c=b.get(M))&&void 0!==c?c:Number.POSITIVE_INFINITY)&&b.set(M,t)}}const k=[...g.keys()].sort(((t,s)=>{var i,n;return(null!==(i=y.get(t))&&void 0!==i?i:Number.MAX_SAFE_INTEGER)-(null!==(n=y.get(s))&&void 0!==n?n:Number.MAX_SAFE_INTEGER)})),F=k.map((t=>{let i=g.get(t);return s.limit>0&&i.length>s.limit&&(i="size"===s.limitBy?[...i].sort(((t,s)=>{var i,n;return(null!==(i=s.size)&&void 0!==i?i:0)-(null!==(n=t.size)&&void 0!==n?n:0)})).slice(0,s.limit):i.slice(0,s.limit)),{key:t,points:i}})),O=new Set;for(const t of F)for(const s of t.points)O.add(s.seriesKey);const X=[...O].sort(((t,s)=>{var i,n;return(null!==(i=b.get(t))&&void 0!==i?i:Number.MAX_SAFE_INTEGER)-(null!==(n=b.get(s))&&void 0!==n?n:Number.MAX_SAFE_INTEGER)})).map(((t,s)=>({key:t,index:s})));let H=null,I=0;for(const t of F)for(const s of t.points){I++;const t=[s.x],i=[s.y],n=void 0!==s.size?[s.size]:[];null!=s.compare&&(t.push(s.compare.x),i.push(s.compare.y),void 0!==s.compare.size&&n.push(s.compare.size)),null===H&&(H={xMin:t[0],xMax:t[0],yMin:i[0],yMax:i[0],sizeMax:0});for(const s of t)H.xMin=Math.min(H.xMin,s),H.xMax=Math.max(H.xMax,s);for(const t of i)H.yMin=Math.min(H.yMin,t),H.yMax=Math.max(H.yMax,t);for(const t of n)H.sizeMax=Math.max(H.sizeMax,t)}return v>0&&u.push({code:"xy-duplicate-point",data:{count:String(v),names:d.join(", ")}}),m>0&&u.push({code:"xy-variance-nodata",data:{count:String(m)}}),p>0&&u.push({code:"xy-point-clipped",data:{count:String(p)}}),w>0&&u.push({code:"bubble-size-negative",data:{count:String(w)}}),x>0&&u.push({code:"bubble-share-range",data:{count:String(x)}}),I>5e3&&u.push({code:"xy-point-budget",data:{count:String(I)}}),{facets:F,series:X,extents:H,warnings:u,totalPoints:I}}export{p as F,g as P,v as S,k as X,N as a,M as b,m as c,f as d,w as f,F as r,x}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as t}from"./p-CeE4_3wQ.js";import{F as s}from"./p-CniN8ALm.js";import"./p-B5tixDPM.js";import{g as i}from"./p-4q8nRcWC.js";import{d as e}from"./p-BzjGUtYh.js";var r;!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"}(r||(r={}));class h{constructor(t,s,i,e,h,n,o,a){this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.isRelativeLabel=!1,this.segmentFillColor=null,this.pointPart="label",this.x=s,this.y=i,this.value=h,this.group=t.group().id(this.createElementID(t.toString(),e)),this.styles=n,this.isVarianceLabel=!1,this.verticalHookLocation=o||r.Top,this.horizontalHookLocation=a||r.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}setPoint(t,s="label"){return this.pointKey=t,this.pointPart=s,this}updateGroup(t){return this.group=t,this}draw(i=!0,r={percent:2,decimal:1},h=new t){if(this.isEmpty())return this;const n=this.group;let o,a="";if(!1===Number.isNaN(Number(this.value))){let t="percent",i=r.percent,e=r.percent,n=1;!1===this.isRelativeLabel&&(i=r.decimal,e=r.decimal,n=h.value,t="decimal"),o=s.number(Number(this.value),t,i,e,n,this.styles.locale);const l=s.number(0,t,i,e,n,this.styles.locale);this.isVarianceLabel&&Number(this.value)>0&&o!==l&&(a="+")}else o=""+this.value;const l=this.drawLabel(n,a+o);return!1===i?(l.addClass("hide"),n.addClass("hide")):this.pointKey&&n.attr(e(this.pointKey,this.pointPart)),this}isEmpty(){return null==this.value||""===this.value}setPos(t,s){return this.x=t,this.y=s,this}forceStringTypeDraw(){const t=this.group;return this.drawLabel(t,""+this.value),this.pointKey&&t.attr(e(this.pointKey,this.pointPart)),this}drawLabel(t,s){const e=this.styles.fontStyles.background||"#ffffff";let h="start";const n=t.text(s);n.move(this.x,this.y);const o=n.bbox(),a=o.w,l=o.h;let c=0,u=0;const f=n.x();let p=n.y();return this.horizontalHookLocation===r.Left?(h="left",c=n.x()):this.horizontalHookLocation===r.Center?(h="middle",c=n.x()-(a+2)/2):this.horizontalHookLocation===r.Right&&(h="end",c=n.x()-a),this.verticalHookLocation===r.Center?(p=n.y()-1.2*l/2,u=p+.2*l):this.verticalHookLocation===r.Top?(p-=l/4,u=p+.2*l):this.verticalHookLocation===r.Bottom&&(p-=l,u=p+.2*l),n.move(f,p),n.font({anchor:h}),null!=this.segmentFillColor?n.fill(i(this.segmentFillColor)):t.rect(a+2,.8*l).stroke(e).fill(e).opacity(.9).move(c-1,u).insertBefore(n),n}createElementID(t,s){return t+"_"+s+"_"+this.ID_SCENARIOLABEL}}const n={ac:1,pp:2,fc:3,pl:4};var o;!function(t){t[t.Above=0]="Above",t[t.Below=1]="Below",t[t.Left=2]="Left",t[t.Right=3]="Right"}(o||(o={}));class a{constructor(){this.labels=[],this.scenarioLabels=[]}clear(){this.labels=[],this.scenarioLabels=[]}register(t){this.labels.push(t)}hasCollision(t){return this.labels.some((s=>this.intersects(t,s)))}getOptimalPlacement(t,s,i,e,r,h,o,a){const l=n[o]||99,c=h/2;for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.hasCollision(n.bounds))return n}for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.collidesWithHigherPriority(n.bounds,l))return n}return null}calculatePlacementForDirection(t,s,i,e,h,n,a,l){let c,u,f,p,m,b;switch(l){case o.Above:c=t,u=s-n-a,f=r.Bottom,p=r.Center,m=t-i/2,b=s-n-a-e;break;case o.Below:c=t,u=s+n+a,f=r.Top,p=r.Center,m=t-i/2,b=s+n+a-e/4;break;case o.Left:c=t-n-a,u=s,f=r.Center,p=r.Right,m=t-n-a-i,b=s-.6*e;break;case o.Right:c=t+n+a,u=s,f=r.Center,p=r.Left,m=t+n+a,b=s-.6*e}return{labelX:c,labelY:u,verticalHook:f,horizontalHook:p,bounds:{x:m,y:b,width:i,height:e,pointIndex:h,preferredHook:f}}}collidesWithHigherPriority(t,s){return this.labels.some((i=>!!i.scenarioType&&((n[i.scenarioType]||99)<s&&this.intersects(t,i))))}shouldHideScenarioLabel(t,s,i,e=20){const r=n[i]||99;return!(r<=1)&&this.scenarioLabels.some((i=>{if((n[i.scenarioType]||99)>=r)return!1;const h=Math.abs(s-i.y),o=Math.abs(t-i.x);return h<e&&o<e}))}registerScenarioLabel(t,s,i){this.scenarioLabels.push({x:t,y:s,scenarioType:i})}intersects(t,s){return!(t.x+t.width<s.x||s.x+s.width<t.x||t.y+t.height<s.y||s.y+s.height<t.y)}getLabelCount(){return this.labels.length}}export{r as H,a as L,n as S,h as a,o as b}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as t,g as s}from"./p-D6YGOYV1.js";import{g as r,c as e}from"./p-DDvWTgk1.js";import{r as o}from"./p-Dq9dG0Kr.js";import{i as l,f as a,r as u}from"./p-
|
|
1
|
+
import{f as t,g as s}from"./p-D6YGOYV1.js";import{g as r,c as e}from"./p-DDvWTgk1.js";import{r as o}from"./p-Dq9dG0Kr.js";import{i as l,f as a,r as u}from"./p-xIWChKGS.js";import{m as i}from"./p-B2NXsfMz.js";const n=n=>{let f,m,p,c,b,j=null;const D=()=>{const t=m.ruleSets.state;b=i([t._default||{},t[p]||{}]),c=i([t._system||{},b])},g=()=>{const r=s(n),e=r.getAttribute("ruleset");if(j&&(j.disconnect(),j=null),e&&l(e)){const s=a(r,e);if(p=u(s,"ruleset"),s.length>0){j=new MutationObserver((()=>{p=u(s,"ruleset"),D(),t(n)}));for(const t of s)j.observe(t,{attributes:!0,attributeFilter:["ruleset"]})}}else p=e},v=new MutationObserver((s=>{s.forEach((s=>{"ruleset"===s.attributeName&&(g(),D(),t(n))}))})),w=n.connectedCallback;n.connectedCallback=()=>{const e=s(n);m=r(e),c=m.ruleSets.state._system,v.observe(e,{attributes:!0,attributeFilter:["ruleset"]}),g(),D(),f=m.ruleSets.on("set",(r=>{r!==p&&"_default"!==r||(g(),D(),t(s(n)))})),o(w,n)};const G=n.disconnectedCallback;return n.disconnectedCallback=()=>{v.disconnect(),j&&(j.disconnect(),j=null),o(f),e(s(n)),o(G,n)},(t="all")=>"user"===t?b:c};export{n as w}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as i,h as s,a as e,t as h}from"./p-D6YGOYV1.js";import{r as n,m as o,s as r,g as a,d as l}from"./p-DDvWTgk1.js";import{C as d,I as c}from"./p-CniN8ALm.js";import{w as u}from"./p-Dq9dG0Kr.js";import{e as v,r as m}from"./p-ClruFZD_.js";import{S as f,F as b,a as p,P as w}from"./p-eWxolPDU.js";import{d as g,S as y}from"./p-BzjGUtYh.js";import{X as x,r as M,a as $,x as z,f as j,b as L,P as S,c as P,F as W,d as C,S as D}from"./p-Cyf5ZEXs.js";import{g as k}from"./p-4q8nRcWC.js";import{N}from"./p-BJmwHV0a.js";import{a as E,r as F,i as T}from"./p-BXXjh6We.js";class A{constructor(t,i,s,e,h){this.mode=t,this.vMax=i,this.rMaxPx=s,this.rMinPx=e,this.areaPerUnitPx2=h}static local(t,i,s){return new A("local",t,i,s,0)}static grouped(t){return new A("grouped",0,0,0,t)}radius(t){return"grouped"===this.mode?t<=0?0:Math.sqrt(this.areaPerUnitPx2*t/Math.PI):this.vMax<=0||t<=0?this.rMinPx:Math.max(this.rMinPx,this.rMaxPx*Math.sqrt(t/this.vMax))}}class B{constructor(t,i,s,e,h,n){var o,r,a,l;this.ruleSet=t,this.config=e,this.styles=h,this.availableWidth=n,this.warnings=[],this.canvasHeight=0,this.i18nMap=new Map,this.hatchPatterns=new Set,this.scaleOverflowCount=0,this.svgRoot=null,this.config=Object.assign(Object.assign({},e),{x:E(e.x),y:E(e.y)});const d=new x;let c=[];try{""!==s&&(c=i.exec(`SELECT * FROM ${s}`))}catch(t){this.queryError=v(t)}const u=(null!=c?c:[]).map((t=>d.adapt(t)));this.data=M(u,{pointLevel:e.pointLevel,seriesLevel:e.seriesLevel,facetLevel:null!==e.facet?"rowgroup"===e.facet.level?"rowGroup":"category":null,measures:{x:null!==(o=F(e.x.measure))&&void 0!==o?o:{kind:"scenario",slot:"ac1"},y:null!==(r=F(e.y.measure))&&void 0!==r?r:{kind:"scenario",slot:"ac2"},size:null!==(a=F(e.size.measure))&&void 0!==a?a:{kind:"scenario",slot:"ac3"},share:null!==e.share&&null!==(l=F(e.share.measure))&&void 0!==l?l:void 0},compareFamily:e.compareFamily,domains:{x:{min:this.config.x.min,max:this.config.x.max},y:{min:this.config.y.min,max:this.config.y.max}},limit:e.limit,limitBy:"size"}),this.warnings.push(...this.data.warnings)}get em(){return this.styles.fontStyles.size}get xPercent(){return T(this.config.x.measure)}get yPercent(){return T(this.config.y.measure)}get sizePercent(){return T(this.config.size.measure)}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}textWidth(t,i=!1){const s=d(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:i?"bold":"normal"}).width;return Number.isFinite(s)&&s>0?s:.6*t.length*this.em}drawText(t,i,s,e,h={}){var n,o;return t.text(i).font({size:this.styles.fontStyles.size,weight:h.bold?"bold":"normal",anchor:null!==(n=h.anchor)&&void 0!==n?n:"start"}).fill(null!==(o=h.color)&&void 0!==o?o:this.styles.fontStyles.color).attr({x:s,y:e,"font-family":this.fontFamily()})}hasNoData(){return 0===this.data.totalPoints}getWarnings(){return this.warnings}getQueryError(){return this.queryError}getAllocatedCanvasWidth(){return this.availableWidth}getAllocatedCanvasHeight(){return this.canvasHeight}setI18n(t){this.i18nMap=t}addWarningOnce(t,i){this.warnings.some((i=>i.code===t))||this.warnings.push({code:t,data:i})}primaryColorIndex(){const t=F(this.config.size.measure);return null===t||"variance"===t.kind?10:this.ruleSet.getScenarioColorIndex(t.slot)}compareColorIndex(){return this.ruleSet.getScenarioColorIndex(`${this.config.compareFamily}1`)}seriesHue(t){const{color:i,overflowed:s}=n(t,this.styles.seriesColors);return s&&this.addWarningOnce("xy-series-overflow",{}),i}familyDisplayName(t){return this.ruleSet.getScenario(`${t}1`).group}legendModel(){var t,i;const s=[],e=null!==(i=null!==(t=this.config.size.label)&&void 0!==t?t:this.i18nMap.get("legend.size"))&&void 0!==i?i:"";""!==e&&(s.push(e),void 0!==this.config.size.unit&&""!==this.config.size.unit&&s.push(`${this.i18nMap.get("axis.in")||"in"} ${this.config.size.unit}`));const h=[];if(null!==this.config.compareFamily){const t=F(this.config.size.measure),i=null!==t&&"scenario"===t.kind?t.slot.replace(/\d+$/,""):"ac";h.push(this.legendEntry(this.familyDisplayName(this.config.compareFamily),this.compareColorIndex(),0)),h.push(this.legendEntry(this.familyDisplayName(i),this.primaryColorIndex(),0))}const n=this.data.series.map((t=>{var i;return this.legendEntry(""===t.key?null!==(i=this.ruleSet.getScenario("").name)&&void 0!==i?i:"Series":t.key,this.primaryColorIndex(),t.index)}));return{sizeCaption:s,title:this.i18nMap.get("legend.title")||null,compareEntries:h,entries:n}}legendEntry(t,i,s){const e=this.seriesHue(s),h=o(i,e,"bubble");return{label:t,treatment:h,fill:this.treatmentFill(h,s,e)}}toString(){const t=new f;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}axisTitle(t,i){var s;const e=null!==(s=t.label)&&void 0!==s?s:"";return""===e?"":void 0===t.unit||""===t.unit?e:`${e} ${i} ${t.unit}`}draw(t){var i,s,e,h,n,o,r,a,l,d,c;this.warnings=this.data.warnings.slice(),this.hatchPatterns.clear(),this.scaleOverflowCount=0,this.svgRoot=t;const u=this.em,v=this.styles.padding,m=this.i18nMap.get("axis.in")||"in",f=t.group(),b=new $(this.styles),p=this.legendModel(),w=this.config.legend.show&&(p.entries.length>0||p.sizeCaption.length>0),g=w?b.measure(p,this.config.legend.position):{width:0,height:0},y="right"===this.config.legend.position&&w?g.width+u:0,x=""!==this.config.chartTitle?1.6*u:0,M=this.axisTitle(this.config.y,m),L=this.axisTitle(this.config.x,m),S=""!==M?1.4*u:.4*u,P=1.4*u+(""!==L?1.3*u:0);let C,D=3*u,k={x:0,y:0,width:0,height:0},E=[];const F=Math.max(1,this.data.facets.length),T=null===(i=this.config.facet)||void 0===i?void 0:i.columns,B=N.domain(null!==(e=null===(s=this.data.extents)||void 0===s?void 0:s.xMin)&&void 0!==e?e:0,null!==(n=null===(h=this.data.extents)||void 0===h?void 0:h.xMax)&&void 0!==n?n:1,{min:this.config.x.min,max:this.config.x.max}),X=N.domain(null!==(r=null===(o=this.data.extents)||void 0===o?void 0:o.yMin)&&void 0!==r?r:0,null!==(l=null===(a=this.data.extents)||void 0===a?void 0:a.yMax)&&void 0!==l?l:1,{min:this.config.y.min,max:this.config.y.max});for(let t=0;t<2;t++){const t=Math.max(10,this.availableWidth-v.left-v.right-D-y);k={x:v.left+D,y:v.top+x+S,width:t,height:t/this.config.aspect},C=new W(F,T,k,this.styles.scaleFactors.panelGap*u);const i=C.panelRect(0).height,s=Math.max(4,Math.min(8,Math.round(i/(4*u)))),e=new N(X[0],X[1],i,0);E=e.ticks(s);const h=z(E,this.yPercent);D=Math.max(...E.map((t=>this.textWidth(j(t,h,this.styles.locale,this.yPercent)))),u)+this.styles.scaleFactors.axisTickLength*u+.4*u}this.canvasHeight=k.y+k.height+P+("bottom"===this.config.legend.position&&w?g.height+u:0)+v.bottom,""!==this.config.chartTitle&&this.drawText(f,this.config.chartTitle,v.left,v.top+u,{bold:!0}),""!==M&&this.drawAxisTitleText(f,this.config.y,m,v.left,k.y-.6*u,"start");const H=this.buildPanels(C,B,X),I=H[0].xScale.ticks(Math.max(3,Math.min(8,Math.round(H[0].rect.width/(7*u))))),O=z(I,this.xPercent),U=z(E,this.yPercent),Y=this.config.sizeAreaPerUnit>0?A.grouped(this.config.sizeAreaPerUnit):A.local(null!==(c=null===(d=this.data.extents)||void 0===d?void 0:d.sizeMax)&&void 0!==c?c:0,this.styles.scaleFactors.bubbleMaxRadius*u,this.styles.scaleFactors.bubbleMinRadius*u);0===this.data.facets.length?this.drawPanel(f,H[0],{key:"",points:[]},Y,I,E,O,U,!0,!0):this.data.facets.forEach(((t,i)=>{this.drawPanel(f,H[i],t,Y,I,E,O,U,C.isOuterLeft(i),C.isOuterBottom(i),this.data.facets.length>1?t.key:"")})),""!==L&&this.drawAxisTitleText(f,this.config.x,m,k.x+k.width,k.y+k.height+2.6*u,"end"),w&&("right"===this.config.legend.position?b.draw(f,p,k.x+k.width+u,k.y,"right"):b.draw(f,p,k.x,k.y+k.height+P,"bottom")),this.scaleOverflowCount>0&&this.addWarningOnce("bubble-scale-overflow",{count:String(this.scaleOverflowCount)}),t.group().addClass("annotations")}drawAxisTitleText(t,i,s,e,h,n){var o;const r=null!==(o=i.label)&&void 0!==o?o:"",a=void 0!==i.unit&&""!==i.unit?`${s} ${i.unit}`:"",l=.3*this.em;"start"===n?(this.drawText(t,r,e,h,{bold:!0}),""!==a&&this.drawText(t,a,e+this.textWidth(r,!0)+l,h,{})):""!==a?(this.drawText(t,a,e,h,{anchor:"end"}),this.drawText(t,r,e-this.textWidth(a)-l,h,{anchor:"end",bold:!0})):this.drawText(t,r,e,h,{anchor:"end",bold:!0})}buildPanels(t,i,s){const e=[];for(let h=0;h<t.count;h++){const n=t.panelRect(h),o=new N(i[0],i[1],n.x,n.x+n.width),r=new N(s[0],s[1],n.y+n.height,n.y);e.push({rect:n,xScale:o,yScale:r,frame:new L(o,r,n,this.styles)})}return e}treatmentFill(t,i,s){return!0!==t.hatch?t.fill:(this.ensureHatchPattern(i,s),`url(#xy-fc-${i})`)}ensureHatchPattern(t,i){this.hatchPatterns.has(t)||null===this.svgRoot||(this.hatchPatterns.add(t),this.svgRoot.defs().pattern(10,10,(t=>{t.rect(10,10).fill("#ffffff"),t.line(0,10,10,0).stroke({color:i,width:2}),t.line(-2.5,2.5,2.5,-2.5).stroke({color:i,width:2}),t.line(7.5,12.5,12.5,7.5).stroke({color:i,width:2})})).id(`xy-fc-${t}`))}drawPanel(t,i,s,e,h,n,a,l,d,c,u=""){var v,m,f,b,p,w;const y=t.group(),x=this.em;i.frame.drawBands(y,this.config.x.highlight,this.config.y.highlight),i.frame.drawGrid(y,n,void 0===this.config.x.refLine&&void 0===this.config.y.refLine&&i.rect.width>30*x?h:void 0),i.frame.drawRefLines(y,this.config.x.refLine,this.config.y.refLine),i.frame.drawFrame(y);const M=y.group().id("compare"),$=y.group().id("primary"),z=new S(i.rect,this.styles.scaleFactors.labelToMark*x),j=[...s.points].sort(((t,i)=>{var s,e;return(null!==(s=i.size)&&void 0!==s?s:0)-(null!==(e=t.size)&&void 0!==e?e:0)})),L=[];for(const t of j){const h=null!==(m=null===(v=this.data.series.find((i=>i.key===t.seriesKey)))||void 0===v?void 0:v.index)&&void 0!==m?m:0,n=this.seriesHue(h),a=o(this.primaryColorIndex(),n,"bubble"),l=i.xScale.scale(t.x),d=i.yScale.scale(t.y),c=e.radius(null!==(f=t.size)&&void 0!==f?f:0);if(this.config.sizeAreaPerUnit>0&&this.bubbleExceedsPanel(i.rect,l,d,c)&&this.scaleOverflowCount++,null!=t.compare){const s=o(this.compareColorIndex(),n,"bubble"),r=i.xScale.scale(t.compare.x),a=i.yScale.scale(t.compare.y),l=e.radius(null!==(b=t.compare.size)&&void 0!==b?b:0);this.drawBubble(M,r,a,l,s,h,n),z.registerMark(r,a,l),this.config.labels.values&&void 0!==t.compare.size&&l>=1.2*x&&this.drawValueLabel(M,r,a,l,t.compare.size,s.fill)}const u=P(t,s.key,this.config);null===(p=this.drawBubble($,l,d,c,a,h,n))||void 0===p||p.attr(g(u,"element")),z.registerMark(l,d,c),void 0!==t.share&&c>0&&(null===(w=this.drawShareSlice($,l,d,c,t.share,r(n)))||void 0===w||w.attr(g(u))),this.config.labels.values&&void 0!==t.size&&this.drawValueLabel($,l,d,c,t.size,!0===a.hatch?"#ffffff":a.fill),L.push({point:t,cx:l,cy:d,r:c,seriesIndex:h,hue:n,treatment:a})}this.drawNameLabels(y,z,L,s.key),i.frame.drawTickLabels(y,{ticksX:h,ticksY:n,xDecimals:a,yDecimals:l,xPercent:this.xPercent,yPercent:this.yPercent,showXLabels:c,showYLabels:d}),""!==u&&i.frame.drawPanelTitle(y,u)}bubbleExceedsPanel(t,i,s,e){return i-e<t.x||i+e>t.x+t.width||s-e<t.y||s+e>t.y+t.height}drawBubble(t,i,s,e,h,n,o){if(!(e<=0))return t.circle(2*e).center(i,s).fill(this.treatmentFill(h,n,o)).stroke({color:h.stroke,width:h.strokeWidth})}drawShareSlice(t,i,s,e,h,n){if(h<=0)return;if(h>=1)return t.circle(2*e).center(i,s).fill(n);const o=2*h*Math.PI,r=i+e*Math.sin(o),a=s-e*Math.cos(o),l=o>Math.PI?1:0;return t.path(`M ${i} ${s} L ${i} ${s-e} A ${e} ${e} 0 ${l} 1 ${r} ${a} Z`).fill(n).stroke("none")}drawValueLabel(t,i,s,e,h,n){const o=j(h,this.valueDecimals(),this.styles.locale,this.sizePercent);this.textWidth(o)+.4*this.em>2*e||this.drawText(t,o,i,s+.35*this.em,{anchor:"middle",color:k(n)})}drawNameLabels(t,i,s,e){const h=[...s].sort(((t,i)=>{var s,e;return(null!==(s=i.point.size)&&void 0!==s?s:0)-(null!==(e=t.point.size)&&void 0!==e?e:0)})),{selected:n,unknownNames:o}=i.selectCandidates(h,this.config.labels.points,this.config.labels.max,(t=>t.point.name));o.length>0&&this.addWarningOnce("xy-label-unknown",{names:o.join(", ")});const r=new Map,a=n.map((t=>{const i={name:t.point.name,cx:t.cx,cy:t.cy,r:t.r,width:this.textWidth(t.point.name),height:1.1*this.em};return r.set(i,t.point),i}));for(const s of i.place(a))this.drawText(t,s.candidate.name,s.x,s.y+.9*s.candidate.height,{}).attr(g(P(r.get(s.candidate),e,this.config),"label"))}valueDecimals(){var t,i,s;let e=0;for(const h of this.data.facets)for(const n of h.points)e=Math.max(e,Math.abs(null!==(t=n.size)&&void 0!==t?t:0),Math.abs(null!==(s=null===(i=n.compare)||void 0===i?void 0:i.size)&&void 0!==s?s:0));return e>0&&Number.isFinite(e)?(this.sizePercent&&(e*=100),N.stepDecimals(Math.pow(10,Math.floor(Math.log10(e))-2))):1}}const X=["xy-duplicate-point","xy-point-clipped","xy-variance-nodata","xy-label-unknown","xy-series-overflow","xy-point-budget","bubble-size-negative","bubble-share-range","bubble-scale-overflow"],H=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.chartTitle="",this.share=null,this.compareFamily=null,this.facet=null,this.pointLevel="category",this.seriesLevel=null,this.aspect=16/9,this.limit=0,this.filter="",this.sizeAreaPerUnit=0,this.i18n=new Map,this.containerWidth=0,this.svgMarkup="",u(this)}getDb(){return this.stores||(this.stores=a(this.element)),this.stores.db.db}componentWillLoad(){this.rebuild()}componentWillUpdate(){this.rebuild()}rebuild(){const t=this.prepareStyle(),i=l(this.getDb(),this.tableName,this.filter);this.chart=new B(new c(this.ruleSetConfig),this.getDb(),i,{chartTitle:this.chartTitle,x:this.x,y:this.y,size:this.size,share:this.share,compareFamily:this.compareFamily,labels:this.labels,legend:this.legend,facet:this.facet,pointLevel:this.pointLevel,seriesLevel:this.seriesLevel,aspect:this.aspect,limit:this.limit,sizeAreaPerUnit:this.sizeAreaPerUnit},t,this.containerWidth||0),this.chart.setI18n(this.i18n),this.svgMarkup=this.chart.hasNoData()?"":this.chart.toString(),this.syncWarnings(this.chart.getWarnings()),m(this.errors,this.chart.getQueryError())}syncWarnings(t){if(void 0===this.errors)return;const i=new Map(t.map((t=>[t.code,t.data])));for(const t of X){const s=`WARN_${t.replace(/-/g,"_")}`;if(i.has(t)){const e=void 0!==this.translator?this.translator(`.${t}`,i.get(t)):t;this.errors.addOrReplace({id:s,type:"warning",message:e})}else this.errors.remove(s)}}prepareStyle(){var t,i;const s=new C(new D,new b,new p(new y),new w).adapt(this.styles);return s.locale=(null===(i=null===(t=a(this.element).context)||void 0===t?void 0:t.state)||void 0===i?void 0:i.locale)||"de",s}render(){var t;if(void 0===this.chart||void 0!==this.chart.getQueryError())return s(e,null);if(this.chart.hasNoData()){const i=null!==(t=this.i18n.get("no-data"))&&void 0!==t?t:"No Data";return s(e,{class:"no-data"},s("div",{class:"empty-state"},i))}return s(e,null,s("div",{innerHTML:this.svgMarkup}))}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}'}},[1,"bn-chart-bubble-renderer",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],chartTitle:[1,"chart-title"],x:[16],y:[16],size:[16],share:[16],compareFamily:[1,"compare-family"],labels:[16],legend:[16],facet:[16],pointLevel:[1,"point-level"],seriesLevel:[1,"series-level"],aspect:[2],limit:[2],filter:[1],sizeAreaPerUnit:[2,"size-area-per-unit"],styles:[16],i18n:[16],containerWidth:[2,"container-width"],ruleSetConfig:[16],errors:[16],translator:[16]}]);function I(){"undefined"!=typeof customElements&&["bn-chart-bubble-renderer"].forEach((t=>{"bn-chart-bubble-renderer"===t&&(customElements.get(h(t))||customElements.define(h(t),H))}))}export{H as B,I as d}
|
|
1
|
+
import{p as t,H as i,h as s,a as e,t as h}from"./p-D6YGOYV1.js";import{r as n,m as o,s as r,g as a,d as l}from"./p-DDvWTgk1.js";import{C as d,I as c}from"./p-CniN8ALm.js";import{w as u}from"./p-Dq9dG0Kr.js";import{e as v,r as m}from"./p-ClruFZD_.js";import{S as f,F as b,a as p,P as w}from"./p-eWxolPDU.js";import{d as g,S as y}from"./p-BzjGUtYh.js";import{X as x,r as M,a as $,x as z,f as S,b as j,P as L,c as P,F as W,d as C,S as D}from"./p-CUSAlS2o.js";import{g as k}from"./p-4q8nRcWC.js";import{N}from"./p-BJmwHV0a.js";import{a as A,r as E,i as F}from"./p-BXXjh6We.js";class T{constructor(t,i,s,e,h){this.mode=t,this.vMax=i,this.rMaxPx=s,this.rMinPx=e,this.areaPerUnitPx2=h}static local(t,i,s){return new T("local",t,i,s,0)}static grouped(t){return new T("grouped",0,0,0,t)}radius(t){return"grouped"===this.mode?t<=0?0:Math.sqrt(this.areaPerUnitPx2*t/Math.PI):this.vMax<=0||t<=0?this.rMinPx:Math.max(this.rMinPx,this.rMaxPx*Math.sqrt(t/this.vMax))}}class B{constructor(t,i,s,e,h,n){var o,r,a,l;this.ruleSet=t,this.config=e,this.styles=h,this.availableWidth=n,this.warnings=[],this.canvasHeight=0,this.i18nMap=new Map,this.hatchPatterns=new Set,this.scaleOverflowCount=0,this.svgRoot=null,this.config=Object.assign(Object.assign({},e),{x:A(e.x),y:A(e.y)});const d=new x;let c=[];try{""!==s&&(c=i.exec(`SELECT * FROM ${s}`))}catch(t){this.queryError=v(t)}const u=(null!=c?c:[]).map((t=>d.adapt(t)));this.data=M(u,{pointLevel:e.pointLevel,seriesLevel:e.seriesLevel,facetLevel:null!==e.facet?"rowgroup"===e.facet.level?"rowGroup":"category":null,measures:{x:null!==(o=E(e.x.measure))&&void 0!==o?o:{kind:"scenario",slot:"ac1"},y:null!==(r=E(e.y.measure))&&void 0!==r?r:{kind:"scenario",slot:"ac2"},size:null!==(a=E(e.size.measure))&&void 0!==a?a:{kind:"scenario",slot:"ac3"},share:null!==e.share&&null!==(l=E(e.share.measure))&&void 0!==l?l:void 0},compareFamily:e.compareFamily,domains:{x:{min:this.config.x.min,max:this.config.x.max},y:{min:this.config.y.min,max:this.config.y.max}},limit:e.limit,limitBy:"size"}),this.warnings.push(...this.data.warnings)}get em(){return this.styles.fontStyles.size}get xPercent(){return F(this.config.x.measure)}get yPercent(){return F(this.config.y.measure)}get sizePercent(){return F(this.config.size.measure)}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}textWidth(t,i=!1){const s=d(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:i?"bold":"normal"}).width;return Number.isFinite(s)&&s>0?s:.6*t.length*this.em}drawText(t,i,s,e,h={}){var n,o;return t.text(i).font({size:this.styles.fontStyles.size,weight:h.bold?"bold":"normal",anchor:null!==(n=h.anchor)&&void 0!==n?n:"start"}).fill(null!==(o=h.color)&&void 0!==o?o:this.styles.fontStyles.color).attr({x:s,y:e,"font-family":this.fontFamily()})}hasNoData(){return 0===this.data.totalPoints}getWarnings(){return this.warnings}getQueryError(){return this.queryError}getAllocatedCanvasWidth(){return this.availableWidth}getAllocatedCanvasHeight(){return this.canvasHeight}setI18n(t){this.i18nMap=t}addWarningOnce(t,i){this.warnings.some((i=>i.code===t))||this.warnings.push({code:t,data:i})}primaryColorIndex(){const t=E(this.config.size.measure);return null===t||"variance"===t.kind?10:this.ruleSet.getScenarioColorIndex(t.slot)}compareColorIndex(){return this.ruleSet.getScenarioColorIndex(`${this.config.compareFamily}1`)}seriesHue(t){const{color:i,overflowed:s}=n(t,this.styles.seriesColors);return s&&this.addWarningOnce("xy-series-overflow",{}),i}familyDisplayName(t){return this.ruleSet.getScenario(`${t}1`).group}legendModel(){var t,i;const s=[],e=null!==(i=null!==(t=this.config.size.label)&&void 0!==t?t:this.i18nMap.get("legend.size"))&&void 0!==i?i:"";""!==e&&(s.push(e),void 0!==this.config.size.unit&&""!==this.config.size.unit&&s.push(`${this.i18nMap.get("axis.in")||"in"} ${this.config.size.unit}`));const h=[];if(null!==this.config.compareFamily){const t=E(this.config.size.measure),i=null!==t&&"scenario"===t.kind?t.slot.replace(/\d+$/,""):"ac";h.push(this.legendEntry(this.familyDisplayName(this.config.compareFamily),this.compareColorIndex(),0)),h.push(this.legendEntry(this.familyDisplayName(i),this.primaryColorIndex(),0))}const n=this.data.series.map((t=>{var i;return this.legendEntry(""===t.key?null!==(i=this.ruleSet.getScenario("").name)&&void 0!==i?i:"Series":t.key,this.primaryColorIndex(),t.index)}));return{sizeCaption:s,title:this.i18nMap.get("legend.title")||null,compareEntries:h,entries:n}}legendEntry(t,i,s){const e=this.seriesHue(s),h=o(i,e,"bubble");return{label:t,treatment:h,fill:this.treatmentFill(h,s,e)}}toString(){const t=new f;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}axisTitle(t,i){var s;const e=null!==(s=t.label)&&void 0!==s?s:"";return""===e?"":void 0===t.unit||""===t.unit?e:`${e} ${i} ${t.unit}`}draw(t){var i,s,e,h,n,o,r,a,l,d,c;this.warnings=this.data.warnings.slice(),this.hatchPatterns.clear(),this.scaleOverflowCount=0,this.svgRoot=t;const u=this.em,v=this.styles.padding,m=this.i18nMap.get("axis.in")||"in",f=t.group(),b=new $(this.styles),p=this.legendModel(),w=this.config.legend.show&&(p.entries.length>0||p.sizeCaption.length>0),g=w?b.measure(p,this.config.legend.position):{width:0,height:0},y="right"===this.config.legend.position&&w?g.width+u:0,x=""!==this.config.chartTitle?1.6*u:0,M=this.axisTitle(this.config.y,m),j=this.axisTitle(this.config.x,m),L=""!==M?1.4*u:.4*u,P=1.4*u+(""!==j?1.3*u:0);let C,D=3*u,k={x:0,y:0,width:0,height:0},A=[];const E=Math.max(1,this.data.facets.length),F=null===(i=this.config.facet)||void 0===i?void 0:i.columns,B=N.domain(null!==(e=null===(s=this.data.extents)||void 0===s?void 0:s.xMin)&&void 0!==e?e:0,null!==(n=null===(h=this.data.extents)||void 0===h?void 0:h.xMax)&&void 0!==n?n:1,{min:this.config.x.min,max:this.config.x.max}),U=N.domain(null!==(r=null===(o=this.data.extents)||void 0===o?void 0:o.yMin)&&void 0!==r?r:0,null!==(l=null===(a=this.data.extents)||void 0===a?void 0:a.yMax)&&void 0!==l?l:1,{min:this.config.y.min,max:this.config.y.max});for(let t=0;t<2;t++){const t=Math.max(10,this.availableWidth-v.left-v.right-D-y);k={x:v.left+D,y:v.top+x+L,width:t,height:t/this.config.aspect},C=new W(E,F,k,this.styles.scaleFactors.panelGap*u);const i=C.panelRect(0).height,s=Math.max(4,Math.min(8,Math.round(i/(4*u)))),e=new N(U[0],U[1],i,0);A=e.ticks(s);const h=z(A,this.yPercent);D=Math.max(...A.map((t=>this.textWidth(S(t,h,this.styles.locale,this.yPercent)))),u)+this.styles.scaleFactors.axisTickLength*u+.4*u}this.canvasHeight=k.y+k.height+P+("bottom"===this.config.legend.position&&w?g.height+u:0)+v.bottom,""!==this.config.chartTitle&&this.drawText(f,this.config.chartTitle,v.left,v.top+u,{bold:!0}),""!==M&&this.drawAxisTitleText(f,this.config.y,m,v.left,k.y-.6*u,"start");const H=this.buildPanels(C,B,U),I=H[0].xScale.ticks(Math.max(3,Math.min(8,Math.round(H[0].rect.width/(7*u))))),O=z(I,this.xPercent),X=z(A,this.yPercent),Y=this.config.sizeAreaPerUnit>0?T.grouped(this.config.sizeAreaPerUnit):T.local(null!==(c=null===(d=this.data.extents)||void 0===d?void 0:d.sizeMax)&&void 0!==c?c:0,this.styles.scaleFactors.bubbleMaxRadius*u,this.styles.scaleFactors.bubbleMinRadius*u);0===this.data.facets.length?this.drawPanel(f,H[0],{key:"",points:[]},Y,I,A,O,X,!0,!0):this.data.facets.forEach(((t,i)=>{this.drawPanel(f,H[i],t,Y,I,A,O,X,C.isOuterLeft(i),C.isOuterBottom(i),this.data.facets.length>1?t.key:"")})),""!==j&&this.drawAxisTitleText(f,this.config.x,m,k.x+k.width,k.y+k.height+2.6*u,"end"),w&&("right"===this.config.legend.position?b.draw(f,p,k.x+k.width+u,k.y,"right"):b.draw(f,p,k.x,k.y+k.height+P,"bottom")),this.scaleOverflowCount>0&&this.addWarningOnce("bubble-scale-overflow",{count:String(this.scaleOverflowCount)}),t.group().addClass("annotations")}drawAxisTitleText(t,i,s,e,h,n){var o;const r=null!==(o=i.label)&&void 0!==o?o:"",a=void 0!==i.unit&&""!==i.unit?`${s} ${i.unit}`:"",l=.3*this.em;"start"===n?(this.drawText(t,r,e,h,{bold:!0}),""!==a&&this.drawText(t,a,e+this.textWidth(r,!0)+l,h,{})):""!==a?(this.drawText(t,a,e,h,{anchor:"end"}),this.drawText(t,r,e-this.textWidth(a)-l,h,{anchor:"end",bold:!0})):this.drawText(t,r,e,h,{anchor:"end",bold:!0})}buildPanels(t,i,s){const e=[];for(let h=0;h<t.count;h++){const n=t.panelRect(h),o=new N(i[0],i[1],n.x,n.x+n.width),r=new N(s[0],s[1],n.y+n.height,n.y);e.push({rect:n,xScale:o,yScale:r,frame:new j(o,r,n,this.styles)})}return e}treatmentFill(t,i,s){return!0!==t.hatch?t.fill:(this.ensureHatchPattern(i,s),`url(#xy-fc-${i})`)}ensureHatchPattern(t,i){this.hatchPatterns.has(t)||null===this.svgRoot||(this.hatchPatterns.add(t),this.svgRoot.defs().pattern(10,10,(t=>{t.rect(10,10).fill("#ffffff"),t.line(0,10,10,0).stroke({color:i,width:2}),t.line(-2.5,2.5,2.5,-2.5).stroke({color:i,width:2}),t.line(7.5,12.5,12.5,7.5).stroke({color:i,width:2})})).id(`xy-fc-${t}`))}drawPanel(t,i,s,e,h,n,a,l,d,c,u=""){var v,m,f,b,p,w;const y=t.group(),x=this.em;i.frame.drawBands(y,this.config.x.highlight,this.config.y.highlight),i.frame.drawGrid(y,n,void 0===this.config.x.refLine&&void 0===this.config.y.refLine&&i.rect.width>30*x?h:void 0),i.frame.drawRefLines(y,this.config.x.refLine,this.config.y.refLine),i.frame.drawFrame(y);const M=y.group().id("compare"),$=y.group().id("primary"),z=new L(i.rect,this.styles.scaleFactors.labelToMark*x),S=[...s.points].sort(((t,i)=>{var s,e;return(null!==(s=i.size)&&void 0!==s?s:0)-(null!==(e=t.size)&&void 0!==e?e:0)})),j=[];for(const t of S){const h=null!==(m=null===(v=this.data.series.find((i=>i.key===t.seriesKey)))||void 0===v?void 0:v.index)&&void 0!==m?m:0,n=this.seriesHue(h),a=o(this.primaryColorIndex(),n,"bubble"),l=i.xScale.scale(t.x),d=i.yScale.scale(t.y),c=e.radius(null!==(f=t.size)&&void 0!==f?f:0);if(this.config.sizeAreaPerUnit>0&&this.bubbleExceedsPanel(i.rect,l,d,c)&&this.scaleOverflowCount++,null!=t.compare){const s=o(this.compareColorIndex(),n,"bubble"),r=i.xScale.scale(t.compare.x),a=i.yScale.scale(t.compare.y),l=e.radius(null!==(b=t.compare.size)&&void 0!==b?b:0);this.drawBubble(M,r,a,l,s,h,n),z.registerMark(r,a,l),this.config.labels.values&&void 0!==t.compare.size&&l>=1.2*x&&this.drawValueLabel(M,r,a,l,t.compare.size,s.fill)}const u=P(t,s.key,this.config);null===(p=this.drawBubble($,l,d,c,a,h,n))||void 0===p||p.attr(g(u,"element")),z.registerMark(l,d,c),void 0!==t.share&&c>0&&(null===(w=this.drawShareSlice($,l,d,c,t.share,r(n)))||void 0===w||w.attr(g(u))),this.config.labels.values&&void 0!==t.size&&this.drawValueLabel($,l,d,c,t.size,!0===a.hatch?"#ffffff":a.fill),j.push({point:t,cx:l,cy:d,r:c,seriesIndex:h,hue:n,treatment:a})}this.drawNameLabels(y,z,j,s.key),i.frame.drawTickLabels(y,{ticksX:h,ticksY:n,xDecimals:a,yDecimals:l,xPercent:this.xPercent,yPercent:this.yPercent,showXLabels:c,showYLabels:d}),""!==u&&i.frame.drawPanelTitle(y,u)}bubbleExceedsPanel(t,i,s,e){return i-e<t.x||i+e>t.x+t.width||s-e<t.y||s+e>t.y+t.height}drawBubble(t,i,s,e,h,n,o){if(!(e<=0))return t.circle(2*e).center(i,s).fill(this.treatmentFill(h,n,o)).stroke({color:h.stroke,width:h.strokeWidth})}drawShareSlice(t,i,s,e,h,n){if(h<=0)return;if(h>=1)return t.circle(2*e).center(i,s).fill(n);const o=2*h*Math.PI,r=i+e*Math.sin(o),a=s-e*Math.cos(o),l=o>Math.PI?1:0;return t.path(`M ${i} ${s} L ${i} ${s-e} A ${e} ${e} 0 ${l} 1 ${r} ${a} Z`).fill(n).stroke("none")}drawValueLabel(t,i,s,e,h,n){const o=S(h,this.valueDecimals(),this.styles.locale,this.sizePercent);this.textWidth(o)+.4*this.em>2*e||this.drawText(t,o,i,s+.35*this.em,{anchor:"middle",color:k(n)})}drawNameLabels(t,i,s,e){const h=[...s].sort(((t,i)=>{var s,e;return(null!==(s=i.point.size)&&void 0!==s?s:0)-(null!==(e=t.point.size)&&void 0!==e?e:0)})),{selected:n,unknownNames:o}=i.selectCandidates(h,this.config.labels.points,this.config.labels.max,(t=>t.point.name));o.length>0&&this.addWarningOnce("xy-label-unknown",{names:o.join(", ")});const r=new Map,a=n.map((t=>{const i={name:t.point.name,cx:t.cx,cy:t.cy,r:t.r,width:this.textWidth(t.point.name),height:1.1*this.em};return r.set(i,t.point),i}));for(const s of i.place(a))this.drawText(t,s.candidate.name,s.x,s.y+.9*s.candidate.height,{}).attr(g(P(r.get(s.candidate),e,this.config),"label"))}valueDecimals(){var t,i,s;let e=0;for(const h of this.data.facets)for(const n of h.points)e=Math.max(e,Math.abs(null!==(t=n.size)&&void 0!==t?t:0),Math.abs(null!==(s=null===(i=n.compare)||void 0===i?void 0:i.size)&&void 0!==s?s:0));return e>0&&Number.isFinite(e)?(this.sizePercent&&(e*=100),N.stepDecimals(Math.pow(10,Math.floor(Math.log10(e))-2))):1}}const U=["xy-duplicate-point","xy-point-clipped","xy-variance-nodata","xy-label-unknown","xy-series-overflow","xy-point-budget","bubble-size-negative","bubble-share-range","bubble-scale-overflow"],H=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.chartTitle="",this.share=null,this.compareFamily=null,this.facet=null,this.pointLevel="category",this.seriesLevel=null,this.aspect=16/9,this.limit=0,this.filter="",this.sizeAreaPerUnit=0,this.i18n=new Map,this.containerWidth=0,this.svgMarkup="",u(this)}getDb(){return this.stores||(this.stores=a(this.element)),this.stores.db.db}componentWillLoad(){this.rebuild()}componentWillUpdate(){this.rebuild()}rebuild(){const t=this.prepareStyle(),i=l(this.getDb(),this.tableName,this.filter);this.chart=new B(new c(this.ruleSetConfig),this.getDb(),i,{chartTitle:this.chartTitle,x:this.x,y:this.y,size:this.size,share:this.share,compareFamily:this.compareFamily,labels:this.labels,legend:this.legend,facet:this.facet,pointLevel:this.pointLevel,seriesLevel:this.seriesLevel,aspect:this.aspect,limit:this.limit,sizeAreaPerUnit:this.sizeAreaPerUnit},t,this.containerWidth||0),this.chart.setI18n(this.i18n),this.svgMarkup=this.chart.hasNoData()?"":this.chart.toString(),this.syncWarnings(this.chart.getWarnings()),m(this.errors,this.chart.getQueryError())}syncWarnings(t){if(void 0===this.errors)return;const i=new Map(t.map((t=>[t.code,t.data])));for(const t of U){const s=`WARN_${t.replace(/-/g,"_")}`;if(i.has(t)){const e=void 0!==this.translator?this.translator(`.${t}`,i.get(t)):t;this.errors.addOrReplace({id:s,type:"warning",message:e})}else this.errors.remove(s)}}prepareStyle(){var t,i;const s=new C(new D,new b,new p(new y),new w).adapt(this.styles);return s.locale=(null===(i=null===(t=a(this.element).context)||void 0===t?void 0:t.state)||void 0===i?void 0:i.locale)||"de",s}render(){var t;if(void 0===this.chart||void 0!==this.chart.getQueryError())return s(e,null);if(this.chart.hasNoData()){const i=null!==(t=this.i18n.get("no-data"))&&void 0!==t?t:"No Data";return s(e,{class:"no-data"},s("div",{class:"empty-state"},i))}return s(e,null,s("div",{innerHTML:this.svgMarkup}))}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}'}},[1,"bn-chart-bubble-renderer",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],chartTitle:[1,"chart-title"],x:[16],y:[16],size:[16],share:[16],compareFamily:[1,"compare-family"],labels:[16],legend:[16],facet:[16],pointLevel:[1,"point-level"],seriesLevel:[1,"series-level"],aspect:[2],limit:[2],filter:[1],sizeAreaPerUnit:[2,"size-area-per-unit"],styles:[16],i18n:[16],containerWidth:[2,"container-width"],ruleSetConfig:[16],errors:[16],translator:[16]}]);function I(){"undefined"!=typeof customElements&&["bn-chart-bubble-renderer"].forEach((t=>{"bn-chart-bubble-renderer"===t&&(customElements.get(h(t))||customElements.define(h(t),H))}))}export{H as B,I as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as t}from"./p-BYBpC0EO.js";import{n as s}from"./p-
|
|
1
|
+
import{m as t}from"./p-BYBpC0EO.js";import{n as s}from"./p-BiSytXUy.js";import{f as e,g as a}from"./p-D6YGOYV1.js";import{r as o}from"./p-Dq9dG0Kr.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 a=document.createElement("div").style;a.setProperty(s.cssName,e);const o=a.getPropertyValue(s.cssName);if(a.cssText=`${s.cssName}:${o};--bn-end:1`,!o||o.includes("<")||"1"!==a.getPropertyValue("--bn-end"))return;const r=function(s,e){const a=t(e);return`bn-c-${s.className}_${a}`}(s,e);return{className:r,style:f(s,r,o)}}const l=t=>{const s=new Map;return i.forEach((e=>{const a=t.getAttribute(e);if(a){["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})(a));t&&s.set(e,t)}})),s},d=new MutationObserver((t=>{for(const s of t){const t=s.target,a=l(t);n.apply(a);const o=Array.from(a.values()).map((t=>t.className));t.className=t.className.split(" ").filter((t=>!t.startsWith("bn-c-"))).concat(...o).join(" "),e(t)}})),p=t=>{const s=t.connectedCallback,e=t.disconnectedCallback;t.connectedCallback=()=>{const e=a(t);if(!e)throw new Error("Can't find element field in component undefined");(t=>{const s=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),o(s,t)},t.disconnectedCallback=()=>{o(e,t)}};export{p as w}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as e,h as i,a as s,t as a}from"./p-D6YGOYV1.js";import{i as o}from"./p-
|
|
1
|
+
import{p as t,H as e,h as i,a as s,t as a}from"./p-D6YGOYV1.js";import{i as o}from"./p-BiSytXUy.js";import{w as n}from"./p-Dq9dG0Kr.js";import{w as r}from"./p-DjPWZfry.js";import{w as f}from"./p-4vVbchX2.js";import{V as l,a as d,p as h}from"./p-DM7fwmH4.js";const m=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),n(this),this.errors=f(this),this.componentStyle=r(this)}validateFormat(t){const e="WARN_format";o(t)||l.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`format: invalid value '${t}' is not supported. Valid values: ${l.join(", ")}`})}validateOrientation(t){const e="WARN_orientation";o(t)||d.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`orientation: invalid value '${t}' is not supported. Valid values: ${d.join(", ")}`})}componentWillLoad(){this.validateFormat(this.format),this.validateOrientation(this.orientation)}render(){return i(s,{key:"b2d1a2638c7bee2b2e134d5fedbac63fe38e9830",format:this.format,orientation:this.orientation,style:this.prepareStyle()},i("slot",{key:"4769d18000916a16ee9da8fb0c19b5d8b12393c0"}))}prepareStyle(){const t={"font-family":this.componentStyle((t=>t.global.fontFamily)),"font-size":`${this.componentStyle((t=>t.global.fontSizePx))}px`,"--bn-font-family":this.componentStyle((t=>t.global.fontFamily))||"'Noto Sans', sans-serif","--bn-font-size":`${this.componentStyle((t=>t.global.fontSizePx))||13.3333}px`,"--bn-font-color":this.componentStyle((t=>t.global.fontColor))||"#000000","--bn-font-background":this.componentStyle((t=>t.global.fontBackgroundColor))||"#ffffff"};if(l.includes(this.format)){const{width:e,height:i}=h(this.format,this.orientation);t.width=e,t.height=i}return t}get element(){return this}static get watchers(){return{format:[{validateFormat:0}],orientation:[{validateOrientation:0}]}}static get style(){return':host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);height:768px;width:1024px;display:flex;flex-direction:column;page-break-after:always;overflow:hidden}'}},[257,"bn-page",{selectedStyle:[513,"selected-style"],format:[1],orientation:[1]},void 0,{format:[{validateFormat:0}],orientation:[{validateOrientation:0}]}]);function p(){"undefined"!=typeof customElements&&["bn-page"].forEach((t=>{"bn-page"===t&&(customElements.get(a(t))||customElements.define(a(t),m))}))}export{m as P,p as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as n,c as o,R as t}from"./p-DDvWTgk1.js";import{f as e,g as i}from"./p-D6YGOYV1.js";import{r}from"./p-Dq9dG0Kr.js";import{i as s}from"./p-
|
|
1
|
+
import{g as n,c as o,R as t}from"./p-DDvWTgk1.js";import{f as e,g as i}from"./p-D6YGOYV1.js";import{r}from"./p-Dq9dG0Kr.js";import{i as s}from"./p-BiSytXUy.js";const l="inherited-page",u="bn-layout-page";function a(n){return"inherited-closest"===n||n===l}function c(n,o){const t=[];let e=n.parentNode;for(;e;){const n=e.nodeName.toLowerCase();if(n===u){t.push(e);break}if("bn-layout-card"===n&&o!==l&&t.push(e),e.parentNode)e=e.parentNode;else{if(!(e instanceof ShadowRoot))break;e=e.host}}return t}function d(n,o){var t;const e=n=>{const t=n.getAttribute(o),e=null==t?void 0:t.trim();return s(e)||a(e)?void 0:t};for(const i of n){if((null===(t=i.getAttribute(o))||void 0===t?void 0:t.trim())===l){const o=n.find((n=>n.nodeName.toLowerCase()===u)),t=o&&e(o);if(void 0!==t)return t;continue}const r=e(i);if(void 0!==r)return r}}const v=(n,o,t)=>{const s=new Map,u=new Map;let v=null;const f=()=>{var t;const r=i(n);s.clear(),u.clear(),v&&(v.disconnect(),v=null);const l=new Map;for(const e of o){const o=n[e.propName];if("string"!=typeof o||!a(o))continue;u.set(e.propName,o);const i=c(r,o),v=d(i,e.ancestorAttr);void 0!==v&&s.set(e.propName,v);for(const n of i)l.set(n,[...null!==(t=l.get(n))&&void 0!==t?t:[],e.ancestorAttr])}if(l.size>0){v=new MutationObserver((()=>{f(),e(n)}));for(const[n,o]of l)v.observe(n,{attributes:!0,attributeFilter:o})}},p=n.connectedCallback;n.connectedCallback=()=>{f(),r(p,n)};const m=n.disconnectedCallback;n.disconnectedCallback=()=>{v&&(v.disconnect(),v=null),s.clear(),u.clear(),r(m,n)};const b=n=>{var t;return null===(t=o.find((o=>o.propName===n)))||void 0===t?void 0:t.ancestorAttr.replace(/-(\w)/g,((n,o)=>o.toUpperCase()))};return(n,o,e)=>{const i=`WARN_inherited_${n}`,r=a(o);r&&u.get(n)!==o&&f();const c=r?s.get(n):void 0;return r&&void 0===c?(null==t||t.addOrReplace({id:i,type:"warning",message:`${n}: '${o}' could not be resolved, no surrounding ${o===l?"page":"card or page"} sets ${b(n)}`}),{value:e,inherited:!1,unresolved:!0}):(null==t||t.remove(i),{value:null!=c?c:o,inherited:void 0!==c,unresolved:!1})}},f=s=>{let l,u,a,c,d=null;const v=()=>{const n=i(s);if(d&&(d.disconnect(),d=null),a=s.i18nNamespace,u=a,null!=u)return;const o=function(n){let o=n.parentNode;for(;o;){if(o instanceof HTMLElement&&o.hasAttribute("i18n-namespace"))return o;if(o.parentNode)o=o.parentNode;else{if(!(o instanceof ShadowRoot))break;o=o.host}}}(n);o&&(u=o.getAttribute("i18n-namespace"),d=new MutationObserver((()=>{v(),e(s)})),d.observe(o,{attributes:!0,attributeFilter:["i18n-namespace"]}))},f=s.connectedCallback;s.connectedCallback=()=>{const o=i(s);c=n(o),v(),l=c.internationalization.on("set",(n=>{n!==u&&"_system"!==n||e(s)})),r(f,s)};const p=s.disconnectedCallback;return s.disconnectedCallback=()=>{d&&(d.disconnect(),d=null),r(l),o(i(s)),r(p,s)},{t:(n,o)=>{var e,r,l,d,f;void 0!==c&&s.i18nNamespace!==a&&v(),n.startsWith(".")&&(n=i(s).localName+n),Object.prototype.hasOwnProperty.call(t,n)&&(n=t[n]);const p=c.internationalization.state,m=c.context.state.locale,b=null!==(l=null===(r=null===(e=p[u])||void 0===e?void 0:e[m])||void 0===r?void 0:r[n])&&void 0!==l?l:null===(f=null===(d=p._system)||void 0===d?void 0:d[m])||void 0===f?void 0:f[n];return null==b?n:b.replace(/{{([\s\S]+?)}}/g,((n,t)=>{var e;return null!==(e=null==o?void 0:o[t.trim()])&&void 0!==e?e:""}))}}};export{v as a,c as f,a as i,d as r,f as w}
|