@bino-bi/bn-template-engine 1.0.0-alpha.7 → 1.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/p-0d41c5d8.entry.js +1 -0
- package/dist/bn-template-engine/p-67538176.entry.js +1 -0
- package/dist/bn-template-engine/p-825a07a8.entry.js +1 -0
- package/dist/bn-template-engine/p-916296a5.entry.js +1 -0
- package/dist/bn-template-engine/{p-1164c0b0.entry.js → p-96006b06.entry.js} +1 -1
- package/dist/bn-template-engine/p-B4JfKvVT.js +1 -0
- package/dist/bn-template-engine/{p-JNHhIe7t.js → p-B_d-jp99.js} +1 -1
- package/dist/bn-template-engine/p-Ck-NYtot.js +1 -0
- package/dist/bn-template-engine/p-CnDq0oVa.js +1 -0
- package/dist/bn-template-engine/p-DSXNgKLa.js +1 -0
- package/dist/bn-template-engine/p-bc711fb0.entry.js +1 -0
- package/dist/bn-template-engine/p-e6f646b1.entry.js +1 -0
- package/dist/bn-template-engine/p-f41d9242.entry.js +1 -0
- package/dist/bn-template-engine/{p-B0lsgVuN.js → p-gFbbuhtl.js} +1 -1
- package/dist/cjs/{SVGVariancesStyleGroup-BqAdPYtL.js → bn-asset_20.cjs.entry.js} +21948 -6938
- package/dist/cjs/bn-grid.cjs.entry.js +6 -9
- package/dist/cjs/bn-image.cjs.entry.js +6 -9
- package/dist/cjs/bn-internationalization.cjs.entry.js +5 -6
- package/dist/cjs/bn-template-engine.cjs.js +2 -2
- package/dist/cjs/bn-template.cjs.entry.js +3 -4
- package/dist/cjs/bn-text.cjs.entry.js +7 -10
- package/dist/cjs/bn-tree.cjs.entry.js +6 -9
- package/dist/cjs/{context-protocol-DRQWrwsA.js → context-protocol-ohYzcb5F.js} +1 -1
- package/dist/cjs/editor-companion.cjs.entry.js +2 -2
- package/dist/cjs/{index-Cjw0q6gP.js → index-CDKG4xmO.js} +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{scaling-BidPsO53.js → scaling-CIAClQR5.js} +3 -3
- package/dist/cjs/{withBodyObserver-C6gLgq_e.js → withBodyObserver-D7BKWN2N.js} +2 -2
- package/dist/cjs/{withHasError-B8gHkfV2.js → withHasError-Cl2gTQzA.js} +106 -2
- package/dist/cjs/{Order-BGx39pS5.js → withStyled-qd94SSb4.js} +648 -6
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +20 -4
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +20 -4
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +12 -6
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +12 -7
- package/dist/collection/components/bn-table/bn-table.js +25 -7
- package/dist/collection/components/bn-table/ibcs-table.js +68 -3
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.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-table.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/esm/{SVGVariancesStyleGroup-DOIT-zvI.js → bn-asset_20.entry.js} +22048 -7042
- package/dist/esm/bn-grid.entry.js +4 -7
- package/dist/esm/bn-image.entry.js +4 -7
- package/dist/esm/bn-internationalization.entry.js +4 -5
- package/dist/esm/bn-template-engine.js +3 -3
- package/dist/esm/bn-template.entry.js +2 -3
- package/dist/esm/bn-text.entry.js +5 -8
- package/dist/esm/bn-tree.entry.js +4 -7
- package/dist/esm/{context-protocol-2peaD4y8.js → context-protocol-DdbSplvE.js} +2 -2
- package/dist/esm/editor-companion.entry.js +2 -2
- package/dist/esm/{index-JNHhIe7t.js → index-B_d-jp99.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{scaling-BOcjT8M0.js → scaling-DGKKkuL9.js} +4 -4
- package/dist/esm/{withBodyObserver-DczL5ia8.js → withBodyObserver-AFk2wwHT.js} +2 -2
- package/dist/esm/{withHasError-B3QX2emi.js → withHasError-DW_vMDUp.js} +106 -2
- package/dist/esm/{Order-sRO-lj7X.js → withStyled-BIkqU2w4.js} +616 -1
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +1 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +1 -0
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +8 -2
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +8 -3
- package/dist/types/components/bn-table/ibcs-table.d.ts +19 -0
- package/dist/types/components.d.ts +8 -8
- package/package.json +1 -1
- package/dist/bn-template-engine/p-0fabe296.entry.js +0 -1
- package/dist/bn-template-engine/p-355abdf0.entry.js +0 -1
- package/dist/bn-template-engine/p-79KuA4Ox.js +0 -1
- package/dist/bn-template-engine/p-859cc06d.entry.js +0 -1
- package/dist/bn-template-engine/p-8acec99e.entry.js +0 -1
- package/dist/bn-template-engine/p-8f490c45.entry.js +0 -1
- package/dist/bn-template-engine/p-9721a5bb.entry.js +0 -1
- package/dist/bn-template-engine/p-9a564f8f.entry.js +0 -1
- package/dist/bn-template-engine/p-9cee22fa.entry.js +0 -1
- package/dist/bn-template-engine/p-B7p8beYH.js +0 -1
- package/dist/bn-template-engine/p-BDh7GfC5.js +0 -1
- package/dist/bn-template-engine/p-BoMtoHJB.js +0 -1
- package/dist/bn-template-engine/p-Bs8BqBsb.js +0 -1
- package/dist/bn-template-engine/p-CYjZRKdI.js +0 -1
- package/dist/bn-template-engine/p-DG-1MR_T.js +0 -1
- package/dist/bn-template-engine/p-Dnkv5rt8.js +0 -1
- package/dist/bn-template-engine/p-bdd2b243.entry.js +0 -1
- package/dist/bn-template-engine/p-f27995c9.entry.js +0 -1
- package/dist/bn-template-engine/p-f6ecb265.entry.js +0 -1
- package/dist/bn-template-engine/p-sRO-lj7X.js +0 -1
- package/dist/bn-template-engine/p-tzFCK9qn.js +0 -1
- package/dist/cjs/bn-asset_16.cjs.entry.js +0 -9099
- package/dist/cjs/bn-card.cjs.entry.js +0 -36
- package/dist/cjs/bn-chart-time.cjs.entry.js +0 -1031
- package/dist/cjs/bn-layout-card.cjs.entry.js +0 -279
- package/dist/cjs/formatter-4XCS0d2B.js +0 -221
- package/dist/cjs/ibcs-chart-time.cjs.entry.js +0 -4137
- package/dist/cjs/withComponentStatus-_x4LQZ0N.js +0 -109
- package/dist/cjs/withComponentStyle-ClSJfCku.js +0 -128
- package/dist/cjs/withInheritedProps-BH2KNER3.js +0 -157
- package/dist/cjs/withStyled-9tG024gQ.js +0 -522
- package/dist/esm/bn-asset_16.entry.js +0 -9082
- package/dist/esm/bn-card.entry.js +0 -34
- package/dist/esm/bn-chart-time.entry.js +0 -1029
- package/dist/esm/bn-layout-card.entry.js +0 -277
- package/dist/esm/formatter-BDh7GfC5.js +0 -215
- package/dist/esm/ibcs-chart-time.entry.js +0 -4135
- package/dist/esm/withComponentStatus-DodoSXe-.js +0 -107
- package/dist/esm/withComponentStyle-D3VWOsto.js +0 -126
- package/dist/esm/withInheritedProps-BlXDxhHK.js +0 -154
- package/dist/esm/withStyled-CE3_3taP.js +0 -495
|
@@ -57,4 +57,23 @@ export declare class IbcsTable {
|
|
|
57
57
|
* Scenario styles (ac, pp, fc, pl) use barStyles for IBCS-compliant grayscale coloring.
|
|
58
58
|
*/
|
|
59
59
|
private prepareBarChartStyles;
|
|
60
|
+
/**
|
|
61
|
+
* Auto-calculate unitScaling so the largest absolute variance bar
|
|
62
|
+
* fills ~80% of the bar column width.
|
|
63
|
+
*/
|
|
64
|
+
private autoUnitScaling;
|
|
65
|
+
/**
|
|
66
|
+
* Auto-calculate percentageScaling so the largest relative variance pin
|
|
67
|
+
* fills ~80% of the pin area.
|
|
68
|
+
*/
|
|
69
|
+
private autoPercentageScaling;
|
|
70
|
+
/**
|
|
71
|
+
* Find the maximum absolute value across all absolute variance columns (d_*) in the table body.
|
|
72
|
+
*/
|
|
73
|
+
private getMaxAbsValue;
|
|
74
|
+
/**
|
|
75
|
+
* Find the maximum percentage value across all relative variance columns (dr_*) in the table body.
|
|
76
|
+
* Values are stored as decimals (e.g. 0.2 = 20%), returned as percentage (20).
|
|
77
|
+
*/
|
|
78
|
+
private getMaxRelativeValue;
|
|
60
79
|
}
|
|
@@ -419,8 +419,8 @@ export namespace Components {
|
|
|
419
419
|
*/
|
|
420
420
|
"cardCustomTemplate": string;
|
|
421
421
|
/**
|
|
422
|
-
* When `true`, the card shrinks to fit its content (`fit-content`) for both width and height. When `false
|
|
423
|
-
* @default
|
|
422
|
+
* When `true`, the card shrinks to fit its content (`fit-content`) for both width and height. When `false` (default), the card stretches to fill its parent (`100%`). <br /><br /> Use `false` (default) when the card contains components with auto-scaling (e.g. `unit-scaling="auto"`), because auto-scaling needs a fixed parent width to calculate dimensions. `fit-content` creates a circular dependency where the card width depends on the child content but the child needs the card width to render.
|
|
423
|
+
* @default false
|
|
424
424
|
*/
|
|
425
425
|
"cardFitToContent": boolean;
|
|
426
426
|
/**
|
|
@@ -547,8 +547,8 @@ export namespace Components {
|
|
|
547
547
|
*/
|
|
548
548
|
"pageCustomTemplate": string;
|
|
549
549
|
/**
|
|
550
|
-
* When `true`, the page body height shrinks to fit its content (`fit-content`). When `false
|
|
551
|
-
* @default
|
|
550
|
+
* When `true`, the page body height shrinks to fit its content (`fit-content`). When `false` (default), the body stretches to fill the full page height (`100%`). Width is always `100%` regardless of this setting. <br /><br /> Use `false` (default) when the page contains components with auto-scaling (e.g. `unit-scaling="auto"` or `scale="auto"`), because auto-scaling needs a fixed parent height to calculate dimensions.
|
|
551
|
+
* @default false
|
|
552
552
|
*/
|
|
553
553
|
"pageFitToContent": boolean;
|
|
554
554
|
/**
|
|
@@ -1910,8 +1910,8 @@ declare namespace LocalJSX {
|
|
|
1910
1910
|
*/
|
|
1911
1911
|
"cardCustomTemplate"?: string;
|
|
1912
1912
|
/**
|
|
1913
|
-
* When `true`, the card shrinks to fit its content (`fit-content`) for both width and height. When `false
|
|
1914
|
-
* @default
|
|
1913
|
+
* When `true`, the card shrinks to fit its content (`fit-content`) for both width and height. When `false` (default), the card stretches to fill its parent (`100%`). <br /><br /> Use `false` (default) when the card contains components with auto-scaling (e.g. `unit-scaling="auto"`), because auto-scaling needs a fixed parent width to calculate dimensions. `fit-content` creates a circular dependency where the card width depends on the child content but the child needs the card width to render.
|
|
1914
|
+
* @default false
|
|
1915
1915
|
*/
|
|
1916
1916
|
"cardFitToContent"?: boolean;
|
|
1917
1917
|
/**
|
|
@@ -2036,8 +2036,8 @@ declare namespace LocalJSX {
|
|
|
2036
2036
|
*/
|
|
2037
2037
|
"pageCustomTemplate"?: string;
|
|
2038
2038
|
/**
|
|
2039
|
-
* When `true`, the page body height shrinks to fit its content (`fit-content`). When `false
|
|
2040
|
-
* @default
|
|
2039
|
+
* When `true`, the page body height shrinks to fit its content (`fit-content`). When `false` (default), the body stretches to fill the full page height (`100%`). Width is always `100%` regardless of this setting. <br /><br /> Use `false` (default) when the page contains components with auto-scaling (e.g. `unit-scaling="auto"` or `scale="auto"`), because auto-scaling needs a fixed parent height to calculate dimensions.
|
|
2040
|
+
* @default false
|
|
2041
2041
|
*/
|
|
2042
2042
|
"pageFitToContent"?: boolean;
|
|
2043
2043
|
/**
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as s,H as i,g as o}from"./p-JNHhIe7t.js";import{w as r}from"./p-B7p8beYH.js";import{w as e}from"./p-CYjZRKdI.js";import{w as n}from"./p-BoMtoHJB.js";import{a as l}from"./p-B0lsgVuN.js";import{w as a}from"./p-tzFCK9qn.js";import"./p-sRO-lj7X.js";const f=class{constructor(s){t(this,s),r(this),e(this),this.errors=a(this),this.componentStyle=n(this)}connectedCallback(){this.stores=l(this.element)}getFontStyles(){return this.componentStyle((t=>{var s,i,o,r;return{"--bn-font-family":(null===(s=t.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(o=t.global)||void 0===o?void 0:o.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}prepareAssetUrl(t){if(null==t||""===t)return"";const s=this.stores.assets.state;return t.startsWith("asset:")?s[t.substring(6)]:s[t]||t}render(){return s(i,{key:"656f301d5fb1a7650f4c7d0cbb3fe1ef15b8ae92",style:this.getFontStyles()},null!=this.source&&""!==this.source?s("img",{src:this.prepareAssetUrl(this.source)}):"")}get element(){return o(this)}};f.style=":host{display:inline-block;position:relative;overflow:hidden}img{max-width:100%;height:auto}";export{f as bn_image}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as o,H as i,g as e}from"./p-JNHhIe7t.js";import{a as n,w as s,g as a,p as r}from"./p-79KuA4Ox.js";import{w as l}from"./p-CYjZRKdI.js";import{w as d}from"./p-B7p8beYH.js";import{w as c}from"./p-BoMtoHJB.js";import{w as h}from"./p-tzFCK9qn.js";import"./p-B0lsgVuN.js";import"./p-sRO-lj7X.js";const f=new Set(["br","b","i","strong","em","span","p","div","table","tr","td","th","thead","tbody","tfoot","ul","ol","li","h1","h2","h3","h4","h5","h6","sub","sup","small","hr","a","img"]),u=new Set(["class","style","colspan","rowspan","href","title","src","alt","width","height"]),v=/\b(__proto__|globalThis)\b|\.constructor\b/;function p(t){const o=document.createElement("div");return o.innerHTML=t,b(o),o.innerHTML}function b(t){for(const o of Array.from(t.childNodes)){if(o.nodeType!==Node.ELEMENT_NODE)continue;const i=o;if(f.has(i.tagName.toLowerCase())){for(const t of Array.from(i.attributes)){const o=t.name.toLowerCase();o.startsWith("on")||!u.has(o)?i.removeAttribute(t.name):"href"!==o&&"src"!==o||!/^\s*javascript:/i.test(t.value)?"style"===o&&/expression|javascript/i.test(t.value)&&i.removeAttribute(t.name):i.removeAttribute(t.name)}b(i)}else t.replaceChild(document.createTextNode(i.textContent||""),i)}}const m=class{constructor(o){t(this,o),this.data={},d(this),l(this),this.errors=h(this),this.t=n(this).t,s(this,((t,o)=>{this.data=Object.assign(Object.assign({},this.data),{[t]:o})})),this.componentStyle=c(this)}validateValue(t){"string"!=typeof t||""===t?this.errors.addOrReplace({id:"no_value",type:"warning",message:"Empty value"}):this.errors.remove("no_value")}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const o=Number(t);isNaN(o)||o<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}componentWillLoad(){this.validateValue(this.value),this.validateScaling(this.scale)}evalTemplate(t){if(!t)return"";if(v.test(t))return this.errors.addOrReplace({id:"ERR_value_eval",type:"error",message:"Template contains forbidden pattern"}),"";try{const o=new Proxy({data:this.data,t:this.t},{has:()=>!0,get:(t,o)=>o===Symbol.unscopables?void 0:t[o],set:()=>!0}),i=new Function("sandbox","with(sandbox){try{return`"+t+'`}catch(e){return""}}').call(o,o);return this.errors.remove("ERR_value_eval"),null!=i?String(i):""}catch(t){return this.errors.addOrReplace({id:"ERR_value_eval",type:"error",message:`Template evaluation failed: ${t instanceof Error?t.message:String(t)}`}),""}}prepareStyle(){return this.componentStyle((t=>{var o,i,e,n,s,a,r,l,d,c,h,f,u,v,p,b,m,g,y,w,_,R;return{fontStyles:{font:`${null!==(n=null!==(i=null===(o=t["bn-text"])||void 0===o?void 0:o.fontSizePx)&&void 0!==i?i:null===(e=t.global)||void 0===e?void 0:e.fontSizePx)&&void 0!==n?n:13.3333}px ${null!==(l=null!==(a=null===(s=t["bn-text"])||void 0===s?void 0:s.fontFamily)&&void 0!==a?a:null===(r=t.global)||void 0===r?void 0:r.fontFamily)&&void 0!==l?l:"'Noto Sans', sans-serif"}`,size:null!==(f=null!==(c=null===(d=t["bn-text"])||void 0===d?void 0:d.fontSizePx)&&void 0!==c?c:null===(h=t.global)||void 0===h?void 0:h.fontSizePx)&&void 0!==f?f:13.3333,color:null!==(b=null!==(v=null===(u=t["bn-text"])||void 0===u?void 0:u.fontColor)&&void 0!==v?v:null===(p=t.global)||void 0===p?void 0:p.fontColor)&&void 0!==b?b:"#000000",background:null!==(w=null!==(g=null===(m=t["bn-text"])||void 0===m?void 0:m.fontBackgroundColor)&&void 0!==g?g:null===(y=t.global)||void 0===y?void 0:y.fontBackgroundColor)&&void 0!==w?w:"#ffffff",leading:null!==(R=null===(_=t["bn-text"])||void 0===_?void 0:_.leading)&&void 0!==R?R:1.8}}}))}applyScaling(t){const o=this.element,{mode:i,factor:e}=r(this.scale),{width:n,height:s}=a(o),l=o.scrollHeight>o.clientHeight+1?o.clientHeight:s,d=n,c=d>0&&o.scrollWidth>d+1,h=l>0&&o.scrollHeight>l+1,f=c||h;if(d<=0&&l<=0)return;if("none"===i){if(f){const t=[];c&&t.push(`w:${o.scrollWidth}>${Math.round(d)}`),h&&t.push(`h:${o.scrollHeight}>${Math.round(l)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows container (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}if("factor"===i){if(f){const t=[];c&&t.push(`w:${o.scrollWidth}>${Math.round(d)}`),h&&t.push(`h:${o.scrollHeight}>${Math.round(l)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows with factor ${e} (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}o.style.setProperty("--bn-font-size",`${t}px`);const u=o.scrollWidth,v=o.scrollHeight,p=o.clientHeight,b=v>p+1?p:s,m=d<=0||u<=d+1,g=b<=0||v<=b+1;if(m&&g)return void this.errors.remove("AUTO_scale");const y=Math.min(1,!m&&d>0?d/u:1,!g&&b>0?b/v:1);o.style.setProperty("--bn-font-size",t*y+"px"),"empty"===i?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled font by factor ${y.toFixed(3)}`}):this.errors.remove("AUTO_scale")}componentDidRender(){this.container.innerHTML=p(this.evalTemplate(this.value)),this.applyScaling(this.prepareStyle().fontStyles.size)}render(){const{fontStyles:t}=this.prepareStyle(),{mode:e,factor:n}=r(this.scale),s="factor"===e?t.size*n+"px":`${t.size}px`,a={"--bn-font-family":t.font.substring(t.font.indexOf("px ")+3),"--bn-font-size":s,"--bn-font-color":t.color,"--bn-font-background":t.background};return o(i,{key:"49a4060ebb36623a64a41efbdefcdcc9060457c3",style:a},o("div",{key:"19f66b3d17d38d3c8119f9cb6b046e0d18c0f022"},o("span",{key:"3b8cf9f75aeb668cb0c32a7a3540e0ed8f336050",class:"container",ref:t=>{this.container=t}})))}get element(){return e(this)}static get watchers(){return{value:[{validateValue:0}],scale:[{validateScaling:0}]}}};m.style=':host{padding:0.5em;display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000);background-color:var(--bn-font-background, white)}span.container p{margin:0}';export{m as bn_text}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as t,c as e}from"./p-B0lsgVuN.js";import{r as n}from"./p-tzFCK9qn.js";import{g as s,f as a}from"./p-JNHhIe7t.js";const o=(t,e)=>{const n=[],s=[];for(const a of e)(t(a)?n:s).push(a);return[n,s]},r="WARN_use_dataset",i=(t,e)=>{const n=t.errors;if(n)if(e.length>0){const t=e.map((t=>t.substring(1))).join(", ");n.addOrReplace({id:r,type:"warning",message:`Using datasource(s) "${t}" directly. Prefer using a dataset (bn-dataset) for query support and metadata.`})}else n.remove(r)},u=(a,r,u)=>{let d,l,c,f,p=[],m=[];const v=t=>{if(u){const e=f.datasetsMeta.get(t);e&&u(t,e)}},g=new MutationObserver((t=>{t.forEach((t=>{"datasets"===t.attributeName&&([m,p]=o((t=>t.startsWith("$")),s(a).getAttribute("datasets").split(",")),i(a,m),p.forEach((t=>{r(t,f.datasets.get(t)),v(t)})),m.forEach((t=>{r(t,f.datasources.get(t.substring(1)))})))}))})),h=a.connectedCallback;a.connectedCallback=()=>{const e=s(a);f=t(e),[m,p]=o((t=>t.startsWith("$")),(e.getAttribute("datasets")||"").split(",")),i(a,m),p.forEach((t=>{r(t,f.datasets.get(t)),v(t)})),m.forEach((t=>{r(t,f.datasources.get(t.substring(1)))})),g.observe(e,{attributes:!0,attributeFilter:["datasets"]}),d=f.datasets.on("set",((t,e)=>{p.includes(t)&&r(t,e)})),l=f.datasources.on("set",((t,e)=>{m.includes("$"+t)&&r("$"+t,e)})),u&&(c=f.datasetsMeta.on("set",((t,e)=>{p.includes(t)&&u(t,e)}))),n(h,a)};const w=a.disconnectedCallback;return a.disconnectedCallback=()=>{g.disconnect(),n(d),n(l),n(c),e(s(a)),n(w,a)},t=>{p=t,t.forEach((t=>{r(t,f.datasets.get(t)),v(t)}))}},d=o=>{let r,i,u;const d=new MutationObserver((t=>{t.forEach((t=>{"namespace"===t.attributeName&&(i=s(o).getAttribute("namespace"),a(o))}))})),l=o.connectedCallback;o.connectedCallback=()=>{const e=s(o);u=t(e),d.observe(e,{attributes:!0,attributeFilter:["namespace"]}),i=s(o).getAttribute("namespace"),r=u.internationalization.on("set",(t=>{t===i&&a(o)})),n(l,o)};const c=o.disconnectedCallback;return o.disconnectedCallback=()=>{d.disconnect(),n(r),e(s(o)),n(c,o)},{t:(t,e)=>{var n,a;t.startsWith(".")&&(t=s(o).localName+t);const r=u.internationalization.state,d=u.context.state.locale;let l=i;return null==(null===(a=null===(n=r[l])||void 0===n?void 0:n[d])||void 0===a?void 0:a[t])&&(l="_system"),r[l][d][t].replace(/{{([\s\S]+?)}}/g,((t,n)=>{var s;return null!==(s=null==e?void 0:e[n.trim()])&&void 0!==s?s:""}))}}};function l(t){const e=c(t);if(!e)return{width:0,height:0};const n=getComputedStyle(e),s=e.clientWidth-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight),a=function(t){let e=c(t);for(;e;){const t=getComputedStyle(e),n=t.overflowY;if("hidden"===n||"scroll"===n||"auto"===n)return e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom);if("none"!==t.maxHeight){const n=parseFloat(t.maxHeight);if(!isNaN(n)&&n>0)return Math.min(n,e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom))}e=f(e)}return"undefined"!=typeof window?window.innerHeight:0}(t);return{width:Math.max(0,s),height:Math.max(0,a)}}function c(t){var e;const n=t.parentElement;return(null===(e=null==n?void 0:n.assignedSlot)||void 0===e?void 0:e.parentElement)?n.assignedSlot.parentElement:n}function f(t){var e;return(null===(e=t.assignedSlot)||void 0===e?void 0:e.parentElement)?t.assignedSlot.parentElement:t.parentElement}function p(t){if(null==t||""===t)return{mode:"empty"};if("none"===t)return{mode:"none"};if("auto"===t)return{mode:"auto"};const e=Number(t);return!isNaN(e)&&e>0?{mode:"factor",factor:e}:{mode:"empty"}}export{d as a,l as g,p,u as w}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as e,H as n,g as s}from"./p-JNHhIe7t.js";import{i as r,j as i,w as o}from"./p-B7p8beYH.js";import{w as a}from"./p-CYjZRKdI.js";import{w as l}from"./p-BoMtoHJB.js";import{w as c}from"./p-tzFCK9qn.js";import"./p-sRO-lj7X.js";import"./p-B0lsgVuN.js";const d=["*","/","+","-","x","÷","none"];function u(t){switch(t){case"*":case"x":return"×";case"/":case"÷":return"÷";case"+":return"+";case"-":return"−";default:return""}}function h(t,e,n){return t.find((t=>t.from===e&&t.to===n))}function f(t){return 2*(t-1)+1}function p(t){return 2*(t-1)+1}function g(t,e){const n=t.getBoundingClientRect(),s=n.left-e.left,r=n.top-e.top;return{left:s,top:r,width:n.width,height:n.height,centerX:s+n.width/2,centerY:r+n.height/2}}function y(t,e,n){switch(n){case"ltr":return e?{x:t.left+t.width,y:t.centerY}:{x:t.left,y:t.centerY};case"rtl":return e?{x:t.left,y:t.centerY}:{x:t.left+t.width,y:t.centerY};case"ttb":return e?{x:t.centerX,y:t.top+t.height}:{x:t.centerX,y:t.top};case"btt":return e?{x:t.centerX,y:t.top}:{x:t.centerX,y:t.top+t.height}}}function v(t,e,n,s,r=8){const i=-(s-1)*r/2+n*r;switch(e){case"ltr":return{x:t.left,y:t.centerY+i};case"rtl":return{x:t.left+t.width,y:t.centerY+i};case"ttb":return{x:t.centerX+i,y:t.top};case"btt":return{x:t.centerX+i,y:t.top+t.height}}}function m(t,e,n,s){switch(n){case"straight":return function(t,e){return{path:`M ${t.x} ${t.y} L ${e.x} ${e.y}`,midpoint:{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}}(t,e);case"curved":return function(t,e,n){let s,r;if("ltr"===n||"rtl"===n){const n=(t.x+e.x)/2;s={x:n,y:t.y},r={x:n,y:e.y}}else{const n=(t.y+e.y)/2;s={x:t.x,y:n},r={x:e.x,y:n}}return{path:`M ${t.x} ${t.y} C ${s.x} ${s.y}, ${r.x} ${r.y}, ${e.x} ${e.y}`,midpoint:{x:.125*t.x+.375*s.x+.375*r.x+.125*e.x,y:.125*t.y+.375*s.y+.375*r.y+.125*e.y}}}(t,e,s);default:return function(t,e,n){let s,r;if("ltr"===n||"rtl"===n){const n=t.x+.7*(e.x-t.x);s=`M ${t.x} ${t.y} L ${n} ${t.y} L ${n} ${e.y} L ${e.x} ${e.y}`,r={x:n,y:(t.y+e.y)/2}}else{const n=t.y+.7*(e.y-t.y);s=`M ${t.x} ${t.y} L ${t.x} ${n} L ${e.x} ${n} L ${e.x} ${e.y}`,r={x:(t.x+e.x)/2,y:n}}return{path:s,midpoint:r}}(t,e,s)}}function b(t,e,n,s){const r=.7;switch(s){case"ltr":{const s=t.left+t.width;return{x:s+(Math.min(e.left,n.left)-s)*r,y:t.centerY}}case"rtl":{const s=t.left,i=Math.max(e.left+e.width,n.left+n.width);return{x:i+(s-i)*r,y:t.centerY}}case"ttb":{const s=t.top+t.height,i=Math.min(e.top,n.top);return{x:t.centerX,y:s+(i-s)*r}}case"btt":{const s=t.top,i=Math.max(e.top+e.height,n.top+n.height);return{x:t.centerX,y:i+(s-i)*r}}}}function $(t,e,n){var s,r;return Object.assign({stroke:null!==(s=null==n?void 0:n.color)&&void 0!==s?s:t,strokeWidth:null!==(r=null==n?void 0:n.width)&&void 0!==r?r:e},(null==n?void 0:n.dasharray)?{strokeDasharray:n.dasharray}:{})}const x=class{validateEdgesProp(t){const e="ERR_edges",n=function(t){const e=[];if(!t||""===t.trim())return e.push("edges: value is required"),e;let n;try{n=JSON.parse(t)}catch(t){return e.push("edges: invalid JSON structure"),e}if(!Array.isArray(n))return e.push("edges: must be an array"),e;if(0===n.length)return e.push("edges: array must not be empty"),e;const s=new Set,r=new Set;n.forEach(((t,n)=>{if("object"!=typeof t||null===t)return void e.push(`edges[${n}]: must be an object`);const i=t;if("string"!=typeof i.from||""===i.from.trim()?e.push(`edges[${n}]: 'from' is required and must be a non-empty string`):s.add(i.from),"string"!=typeof i.to||""===i.to.trim()?e.push(`edges[${n}]: 'to' is required and must be a non-empty string`):(s.add(i.to),r.add(i.to)),void 0!==i.operator&&("string"==typeof i.operator&&d.includes(i.operator)||e.push(`edges[${n}]: 'operator' must be one of: ${d.join(", ")}`)),void 0!==i.label&&"string"!=typeof i.label&&e.push(`edges[${n}]: 'label' must be a string`),void 0!==i.style)if("object"!=typeof i.style||null===i.style)e.push(`edges[${n}]: 'style' must be an object`);else{const t=i.style;void 0!==t.color&&"string"!=typeof t.color&&e.push(`edges[${n}]: 'style.color' must be a string`),void 0!==t.width&&"number"!=typeof t.width&&e.push(`edges[${n}]: 'style.width' must be a number`),void 0!==t.dasharray&&"string"!=typeof t.dasharray&&e.push(`edges[${n}]: 'style.dasharray' must be a string`)}}));const i=Array.from(s).filter((t=>!r.has(t)));return 0===i.length?e.push("edges: tree has no root node (circular reference detected)"):i.length>1&&e.push(`edges: tree has multiple root nodes: ${i.join(", ")}`),e}(t);n.length>0?(this.errors.addOrReplace({id:e,type:"error",message:`edges: ${n.join("; ")}`}),this.treeConfig=null):(this.errors.remove(e),this.treeConfig=function(t){if(!t||""===t.trim())return null;try{const e=JSON.parse(t);if(!Array.isArray(e))return null;const n=e,s=function(t){const e=new Map;for(const n of t){const t=e.get(n.from)||[];t.push(n.to),e.set(n.from,t)}return e}(n),r=function(t){const e=new Set;for(const n of t)e.add(n.from),e.add(n.to);return e}(n),i=function(t,e){const n=new Set;for(const e of t)n.add(e.to);const s=Array.from(e).filter((t=>!n.has(t)));return 1===s.length?s[0]:null}(n,r);return{edges:n,adjacencyList:s,rootNode:i,allNodes:r}}catch(t){return console.error("parseTreeConfig: failed to parse tree configuration",t),null}}(t)),this.recalculateLayout()}validateDirection(t){const e="ERR_direction",n=["ltr","rtl","ttb","btt"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`direction: invalid value '${t}', must be one of: ${n.join(", ")}`}),this.recalculateLayout()}validateLevelSpacing(t){const e="ERR_levelSpacing";!r(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`level-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateNodeSpacing(t){const e="ERR_nodeSpacing";!r(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`node-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateEdgeStyle(t){const e="ERR_edgeStyle",n=["straight","orthogonal","curved"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`edge-style: invalid value '${t}', must be one of: ${n.join(", ")}`})}validateShowOperators(t){const e="ERR_showOperators";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-operators: invalid value '${t}', must be 'true' or 'false'`})}constructor(e){t(this,e),this.treeConfig=null,this.layout=null,this.nodeRects=new Map,this.svgWidth=0,this.svgHeight=0,this.resizeObserver=null,this.gridContainer=null,this.direction="ltr",this.levelSpacing=60,this.nodeSpacing=20,this.edgeStyle="orthogonal",this.showOperators="true",o(this),a(this),this.errors=c(this),this.componentStyle=l(this)}getTreeStyle(){return this.componentStyle((t=>({edgeColor:t["bn-tree"].edgeColor,edgeWidth:t["bn-tree"].edgeWidth,operatorCircleRadius:t["bn-tree"].operatorCircleRadius,operatorFontSize:t.global.fontSizePx*t["bn-tree"].operatorFontSizeScale,operatorColor:t["bn-tree"].operatorColor})))}componentWillLoad(){this.validateEdgesProp(this.edges),this.validateDirection(this.direction),this.validateLevelSpacing(this.levelSpacing),this.validateNodeSpacing(this.nodeSpacing),this.validateEdgeStyle(this.edgeStyle),this.validateShowOperators(this.showOperators)}componentDidLoad(){this.setupResizeObserver(),this.updateNodeRects()}disconnectedCallback(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}setupResizeObserver(){var t;this.gridContainer=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelector(".tree-grid"),this.gridContainer&&(this.resizeObserver=new ResizeObserver((()=>{this.updateNodeRects()})),this.resizeObserver.observe(this.gridContainer),this.element.querySelectorAll("[slot]").forEach((t=>{this.resizeObserver.observe(t)})))}recalculateLayout(){this.layout=this.treeConfig?function(t,e,n,s){if(!t.rootNode)return{positions:new Map,gridTemplateColumns:"",gridTemplateRows:"",maxLevel:0,maxIndex:0};const r=function(t){const e=new Map;if(!t.rootNode)return e;const n=[{node:t.rootNode,level:0}],s=new Set;for(;n.length>0;){const{node:r,level:i}=n.shift();if(s.has(r))continue;s.add(r),e.set(r,i);const o=t.adjacencyList.get(r)||[];for(const t of o)s.has(t)||n.push({node:t,level:i+1})}return e}(t),i=function(t){const e=new Map;if(!t.rootNode)return e;let n=0;return function s(r){const i=e.get(r);if(i)return i;const o=t.adjacencyList.get(r)||[];if(0===o.length){const t={startIndex:n,endIndex:n};return e.set(r,t),n++,t}let a=1/0,l=-1/0;for(const t of o){const e=s(t);a=Math.min(a,e.startIndex),l=Math.max(l,e.endIndex)}const c={startIndex:a,endIndex:l};return e.set(r,c),c}(t.rootNode),e}(t),o=function(t,e,n,s){var r,i;const o=new Map,a=Math.max(...Array.from(e.values()));for(const l of t.allNodes){const t=null!==(r=e.get(l))&&void 0!==r?r:0,c=null!==(i=n.get(l))&&void 0!==i?i:{startIndex:0,endIndex:0};let d,u,h;switch(s){case"ltr":d=t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"rtl":d=a-t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"ttb":u=t+1,d=c.startIndex+1,h=1;break;case"btt":u=a-t+1,d=c.startIndex+1,h=1}o.set(l,{nodeId:l,level:t,index:c.startIndex,gridColumn:d,gridRow:u,gridRowSpan:h})}return o}(t,r,i,e),a=Math.max(...Array.from(r.values())),l=Math.max(...Array.from(i.values()).map((t=>t.endIndex))),{gridTemplateColumns:c,gridTemplateRows:d}=function(t,e,n,s,r){const i=t+1,o=e+1;if("ltr"===n||"rtl"===n){const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:t.join(" "),gridTemplateRows:e.join(" ")}}{const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:e.join(" "),gridTemplateRows:t.join(" ")}}}(a,l,e,n,s);return{positions:o,gridTemplateColumns:c,gridTemplateRows:d,maxLevel:a,maxIndex:l}}(this.treeConfig,this.direction,this.levelSpacing,this.nodeSpacing):null}updateNodeRects(){if(!this.treeConfig||!this.gridContainer)return;const t=this.gridContainer.getBoundingClientRect(),e=new Map;for(const n of this.treeConfig.allNodes){const s=this.element.querySelector(`[slot="${n}"]`);s&&e.set(n,g(s,t))}this.nodeRects=e,this.svgWidth=t.width,this.svgHeight=t.height}getSlotStyle(t){if(!this.layout)return{};const e=this.layout.positions.get(t);return e?"ltr"===this.direction||"rtl"===this.direction?{"grid-column":String(f(e.gridColumn)),"grid-row":`${p(e.gridRow)} / span ${n=e.gridRowSpan,n<=1?1:2*(n-1)+1}`,"align-self":"center"}:{"grid-row":String(p(e.gridRow)),"grid-column":String(f(e.gridColumn)),"justify-self":"center"}:{};var n}renderEdges(){var t;if(!this.treeConfig||0===this.nodeRects.size)return null;const n=this.getTreeStyle(),s=[],r=[],i=new Map;for(const t of this.treeConfig.edges){const e=i.get(t.to)||[];e.push(t.from),i.set(t.to,e)}for(const t of this.treeConfig.edges){const r=this.nodeRects.get(t.from),o=this.nodeRects.get(t.to);if(!r||!o)continue;const a=y(r,!0,this.direction),l=i.get(t.to)||[];let c;if(l.length>1){const e=l.indexOf(t.from);c=v(o,this.direction,e,l.length)}else c=y(o,!1,this.direction);const{path:d}=m(a,c,this.edgeStyle,this.direction),u=$(n.edgeColor,n.edgeWidth,t.style);s.push(e("path",{key:`edge-${t.from}-${t.to}`,d,fill:"none",stroke:u.stroke,"stroke-width":u.strokeWidth,"stroke-dasharray":u.strokeDasharray}))}if("true"===this.showOperators)for(const[s,i]of this.treeConfig.adjacencyList.entries()){const o=this.nodeRects.get(s);if(o)for(let a=0;a<i.length-1;a++){const l=i[a],c=i[a+1],d=h(this.treeConfig.edges,s,l);if(!(null==d?void 0:d.operator)||"none"===d.operator)continue;const f=this.nodeRects.get(l),p=this.nodeRects.get(c);if(!f||!p)continue;const g=null!==(t=d.label)&&void 0!==t?t:u(d.operator),y=b(o,f,p,this.direction);r.push(e("g",{key:`operator-${s}-${l}`,class:"operator-group"},e("circle",{cx:y.x,cy:y.y,r:n.operatorCircleRadius,fill:"white",stroke:n.edgeColor,"stroke-width":n.edgeWidth}),e("text",{x:y.x,y:y.y,"text-anchor":"middle","dominant-baseline":"central",style:{fontSize:`${n.operatorFontSize}px`,fill:n.operatorColor,fontWeight:"bold"}},g)))}}return e("svg",{class:"edge-layer",width:this.svgWidth,height:this.svgHeight,style:{position:"absolute",top:"0",left:"0",pointerEvents:"none"}},s,r)}renderSlots(){return this.treeConfig&&this.layout?Array.from(this.treeConfig.allNodes).map((t=>e("div",{key:t,class:"tree-node",style:this.getSlotStyle(t)},e("slot",{name:t})))):null}getFontStyles(){return this.componentStyle((t=>{var e,n,s,r;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(n=t.global)||void 0===n?void 0:n.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(s=t.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles();return e(n,{style:t},this.treeConfig&&this.layout?e("div",{class:"tree-container"},e("div",{class:"tree-grid",style:{display:"grid","grid-template-columns":this.layout.gridTemplateColumns,"grid-template-rows":this.layout.gridTemplateRows,position:"relative"}},this.renderEdges(),this.renderSlots())):e("div",{class:"tree-container tree-error"},e("slot",null)))}get element(){return s(this)}static get watchers(){return{edges:[{validateEdgesProp:0}],direction:[{validateDirection:0}],levelSpacing:[{validateLevelSpacing:0}],nodeSpacing:[{validateNodeSpacing:0}],edgeStyle:[{validateEdgeStyle:0}],showOperators:[{validateShowOperators:0}]}}};x.style=':host{display:inline-block;position:relative;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.tree-container{position:relative;display:inline-block}.tree-grid{position:relative;display:grid;align-items:center}.tree-node{position:relative;z-index:1;border:1px solid #404040;background:var(--bn-font-background, white)}.edge-layer{position:absolute;top:0;left:0;z-index:0;pointer-events:none;overflow:visible}.tree-error{display:flex;flex-wrap:wrap;gap:20px}';export{x as bn_tree}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as e,H as s,g as r}from"./p-JNHhIe7t.js";import{j as i,w as o}from"./p-B7p8beYH.js";import{w as n}from"./p-CYjZRKdI.js";import{w as a}from"./p-BoMtoHJB.js";import{w as d}from"./p-tzFCK9qn.js";import"./p-sRO-lj7X.js";import"./p-B0lsgVuN.js";function l(t){if(!t||""===t.trim()||"[]"===t)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e.map(((t,e)=>{var s,r,i;return"string"==typeof t?{label:t,id:String(e)}:"object"==typeof t&&null!==t?{label:null!==(r=null!==(s=t.label)&&void 0!==s?s:t.name)&&void 0!==r?r:String(e),id:null!==(i=t.id)&&void 0!==i?i:String(e)}:{label:String(t),id:String(e)}})):[]}catch(t){return console.error("parseHeaders: failed to parse JSON",t),[]}}function h(t){if(!t||""===t.trim()||"[]"===t)return[];try{const e=JSON.parse(t);if(!Array.isArray(e))return["Headers must be an array"];const s=[],r=new Set;return e.forEach(((t,e)=>{"object"==typeof t&&null!==t&&void 0!==t.id&&("string"!=typeof t.id?s.push(`Header[${e}]: 'id' must be a string`):r.has(t.id)?s.push(`Header[${e}]: duplicate id '${t.id}'`):r.add(t.id),void 0!==t.label&&"string"!=typeof t.label&&s.push(`Header[${e}]: 'label' must be a string`))})),s}catch(t){return console.error("validateHeadersJson: failed to parse JSON",t),["Invalid JSON structure"]}}const u=class{validateRowHeaders(t){const e="ERR_rowHeaders",s=h(t);s.length>0?this.errors.addOrReplace({id:e,type:"error",message:`row-headers: ${s.join("; ")}`}):this.errors.remove(e),this.updateGridConfig()}validateColumnHeaders(t){const e="ERR_columnHeaders",s=h(t);s.length>0?this.errors.addOrReplace({id:e,type:"error",message:`column-headers: ${s.join("; ")}`}):this.errors.remove(e),this.updateGridConfig()}validateShowRowHeaders(t){const e="ERR_showRowHeaders";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-row-headers: invalid value '${t}', must be 'true' or 'false'`})}validateShowColumnHeaders(t){const e="ERR_showColumnHeaders";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-column-headers: invalid value '${t}', must be 'true' or 'false'`})}validateShowBorders(t){const e="ERR_showBorders";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-borders: invalid value '${t}', must be 'true' or 'false'`})}constructor(e){t(this,e),this.gridConfig={rows:[],columns:[]},this.chartTitle="",this.rowHeaders="[]",this.columnHeaders="[]",this.showRowHeaders="true",this.showColumnHeaders="true",this.showBorders="true",this.rowHeaderWidth="auto",this.cellGap="0px",o(this),n(this),this.errors=d(this),this.componentStyle=a(this)}getGridStyle(){return this.componentStyle((t=>t["bn-grid"]))}componentWillLoad(){this.validateRowHeaders(this.rowHeaders),this.validateColumnHeaders(this.columnHeaders),this.validateShowRowHeaders(this.showRowHeaders),this.validateShowColumnHeaders(this.showColumnHeaders),this.validateShowBorders(this.showBorders)}updateGridConfig(){var t;this.gridConfig=(t=this.columnHeaders,{rows:l(this.rowHeaders),columns:l(t)})}shouldShowRowHeaders(){return"true"===this.showRowHeaders&&this.gridConfig.rows.length>0}shouldShowColumnHeaders(){return"true"===this.showColumnHeaders&&this.gridConfig.columns.length>0}shouldShowBorders(){return"true"===this.showBorders}getGridTemplateColumns(){const t=[];this.shouldShowRowHeaders()&&t.push(this.rowHeaderWidth);const e=this.gridConfig.columns.length||1;for(let s=0;s<e;s++)t.push("auto");return t.join(" ")}getGridTemplateRows(){const t=[];this.chartTitle&&t.push("auto"),this.shouldShowColumnHeaders()&&t.push("auto");const e=this.gridConfig.rows.length||1;for(let s=0;s<e;s++)t.push("auto");return t.join(" ")}renderTitle(){if(!this.chartTitle)return null;const t=(this.shouldShowRowHeaders()?1:0)+this.gridConfig.columns.length;return e("div",{class:"grid-title",style:{"grid-column":`1 / span ${t}`,"grid-row":"1"}},this.chartTitle)}renderColumnHeaders(){if(!this.shouldShowColumnHeaders())return null;const t=this.getGridStyle(),s=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",r=this.shouldShowRowHeaders()?2:1,i=this.chartTitle?2:1;return this.gridConfig.columns.map(((o,n)=>{const a=n>0;return e("div",{key:`col-header-${o.id}`,class:"grid-header grid-header-col",style:{"grid-column":String(r+n),"grid-row":String(i),"border-left":a?s:"none",padding:`${t.cellPadding}px`,"padding-left":a?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},o.label)}))}renderDataCells(){const t=this.getGridStyle(),s=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",r=this.shouldShowRowHeaders()?2:1,i=(this.chartTitle?1:0)+(this.shouldShowColumnHeaders()?1:0)+1,o=[];return this.gridConfig.rows.length>0&&this.gridConfig.columns.length>0&&this.gridConfig.rows.forEach(((n,a)=>{if(this.shouldShowRowHeaders()){const r=a>0;o.push(e("div",{key:`row-header-${n.id}`,class:"grid-header grid-header-row",style:{"grid-column":"1","grid-row":String(i+a),"border-top":r?s:"none",padding:`${t.cellPadding}px`,"padding-top":r?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},n.label))}this.gridConfig.columns.forEach(((d,l)=>{const h=function(t,e){return`${t.id}-${e.id}`}(n,d),u=l>0,c=a>0;o.push(e("div",{key:`cell-${h}`,class:"grid-cell",style:{"grid-column":String(r+l),"grid-row":String(i+a),"border-left":u?s:"none","border-top":c?s:"none","padding-left":u?`${t.cellPadding+4}px`:"0","padding-top":c?`${t.cellPadding+4}px`:"0"}},e("slot",{name:h})))}))})),o}getFontStyles(){return this.componentStyle((t=>{var e,s,r,i;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(s=t.global)||void 0===s?void 0:s.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(r=t.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(i=t.global)||void 0===i?void 0:i.fontBackgroundColor)||"#ffffff"}}))}render(){const t={display:"inline-grid","grid-template-columns":this.getGridTemplateColumns(),"grid-template-rows":this.getGridTemplateRows(),gap:this.cellGap};return e(s,{key:"e84402bafd778e7069cd17bd86687a6648dbafe0",style:this.getFontStyles()},e("div",{key:"91941a42bc41fbbaf53c66551035bf97765a9f88",class:"grid-container",style:t},this.renderTitle(),this.renderColumnHeaders(),this.renderDataCells()),e("slot",{key:"349958090f4bf35b9ec768c8994bdf5a96636a36"}))}get element(){return r(this)}static get watchers(){return{rowHeaders:[{validateRowHeaders:0}],columnHeaders:[{validateColumnHeaders:0}],showRowHeaders:[{validateShowRowHeaders:0}],showColumnHeaders:[{validateShowColumnHeaders:0}],showBorders:[{validateShowBorders:0}]}}};u.style=':host{display:inline-block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.grid-container{display:inline-grid;box-sizing:border-box}.grid-title{font-weight:normal;padding-bottom:8px}.grid-header{display:flex;align-items:flex-end;box-sizing:border-box}.grid-header-row{justify-content:flex-end;padding-right:8px}.grid-header-col{white-space:nowrap;justify-content:flex-start}.grid-cell{position:relative;box-sizing:border-box}';export{u as bn_grid}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i,H as s,g as h}from"./p-JNHhIe7t.js";import{S as e,a as n,g as r,I as o,b as l,c as a,d as c,D as u,e as d,f,F as p,h as w,i as v,j as b,P as g}from"./p-Bs8BqBsb.js";import{k as m,l as L,c as P,D as S,A as y,C as k,m as M,S as C,n as x,o as A,f as O,O as T}from"./p-sRO-lj7X.js";import{C as $,F as _,V as D}from"./p-BDh7GfC5.js";class E{constructor(){this.scenarioOffset=.3,this.scenarioLabelToColumn=.3,this.labelToColumn=.3,this.labelToAxis=.3,this.needleWidth=.3,this.needleHeadWidth=.6,this.columnWidth=2,this.varianceAxisLineWidth=.3,this.axisLineWidth=.1,this.auxiliaryLineWidth=.1,this.scenarioLineWidth=.2,this.markerWidth=.7,this.markerOffset=0,this.categoryWidth=3,this.axisTickLength=.3}}class Y{adapt(t){const i=new E;return m.isNumber(t.scenarioOffset)&&(i.scenarioOffset=t.scenarioOffset),m.isNumber(t.scenarioLabelToColumn)&&(i.scenarioLabelToColumn=t.scenarioLabelToColumn),m.isNumber(t.labelToColumn)&&(i.labelToColumn=t.labelToColumn),m.isNumber(t.labelToAxis)&&(i.labelToAxis=t.labelToAxis),m.isNumber(t.needleWidth)&&(i.needleWidth=t.needleWidth),m.isNumber(t.needleHeadWidth)&&(i.needleHeadWidth=t.needleHeadWidth),m.isNumber(t.columnWidth)&&(i.columnWidth=t.columnWidth),m.isNumber(t.varianceAxisLineWidth)&&(i.varianceAxisLineWidth=t.varianceAxisLineWidth),m.isNumber(t.axisLineWidth)&&(i.axisLineWidth=t.axisLineWidth),m.isNumber(t.auxiliaryLineWidth)&&(i.auxiliaryLineWidth=t.auxiliaryLineWidth),m.isNumber(t.scenarioLineWidth)&&(i.scenarioLineWidth=t.scenarioLineWidth),m.isNumber(t.markerWidth)&&(i.markerWidth=t.markerWidth),m.isNumber(t.markerOffset)&&(i.markerOffset=t.markerOffset),m.isNumber(t.categoryWidth)&&(i.categoryWidth=t.categoryWidth),m.isNumber(t.axisTickLength)&&(i.axisTickLength=t.axisTickLength),i}default(){return new E}}class N{constructor(t,i,s,h,e,n,r){this.categoryPosition={x:0,y:0},this.spacings=new E,this.categoriesBoxOffset={width:0,height:0},this.padding=t,this.scaleFactors=i,this.fontStlye=s,this.dataLabelHeight=this.caluculateDataLabelHeight(),this.axisPosition={x:0,y:0},this.columnValue={min:h,max:e},this.numberOfColumns=n,this.leftSideLabelLength=r,this.calculateSpacings(),this.calculateCategoryPosition(),this.calculateAxisPosition()}caluculateDataLabelHeight(){return 1.1*$("123456789",{font:this.fontStlye.font,fontSize:this.fontStlye.size+"px"}).height}getColumnCenterPositionX(t){return this.categoryPosition.y+this.spacings.scenarioOffset+t*this.spacings.categoryWidth+this.leftSideLabelLength+.5*this.spacings.columnWidth}getAxisPositionY(t){let i=this.columnValue.max.getScaledUnit();return t&&(i=this.columnValue.max.getScaledPercentUnit()+this.getNeedleWidth()),i+this.dataLabelHeight+this.spacings.labelToAxis+this.padding.top}getAxisPositionX(){return this.padding.left+this.leftSideLabelLength}getColumnPositionX(t,i){return i?this.getColumnCenterPositionX(t):this.getColumnCenterPositionX(t)-this.spacings.scenarioOffset}getColumnPositionY(){return this.columnValue.max.getScaledUnit()+this.dataLabelHeight+this.spacings.labelToColumn+this.padding.top}getNeedlePositionY(){return this.columnValue.max.getScaledPercentUnit()+this.dataLabelHeight+this.spacings.labelToColumn+this.getNeedleWidth()+this.padding.top}getMarkerPositionX(t,i){return i?this.getColumnCenterPositionX(t)-this.spacings.markerOffset-.5*this.getColumnWidth():this.getColumnCenterPositionX(t)+this.spacings.markerOffset+.5*this.getColumnWidth()}getMarkerPositionY(){return this.getColumnPositionY()}getAxisTitlePositionX(t){const i=t.width();return this.axisPosition.x-i}getAxisTitlePositionY(t,i){let s=this.columnValue.max.getScaledUnit();return i&&(s=this.columnValue.max.getScaledPercentUnit()),t?s+this.dataLabelHeight+this.spacings.labelToAxis:s}getColumnDataLabelPositionY(t){const i=this.spacings.labelToColumn;return t<0?this.getColumnPositionY()+Math.abs(t)+i:this.getColumnPositionY()-t-i}getNeedleDataLabelPositionY(t){const i=this.spacings.labelToColumn;return t<0?this.getNeedlePositionY()+Math.abs(t)+i+2*this.getNeedleWidth():this.getNeedlePositionY()-t-i-2*this.getNeedleWidth()}getAxisEndPositionX(){return this.getAxisPositionX()+(this.numberOfColumns+.5)*this.spacings.categoryWidth}getColumnWidth(){return this.spacings.columnWidth}getNeedleWidth(){return this.spacings.needleWidth}getNeedleHeadWidth(){return this.spacings.needleHeadWidth}getScenarioLabelPositionOffsetX(t){return t?.5*this.getColumnWidth()+this.spacings.scenarioLabelToColumn:-(.5*this.getColumnWidth()+this.spacings.scenarioLabelToColumn)}calculateSpacings(){this.spacings={scenarioOffset:this.fontStlye.size*this.scaleFactors.scenarioOffset,scenarioLabelToColumn:this.fontStlye.size*this.scaleFactors.scenarioLabelToColumn,markerOffset:this.fontStlye.size*this.scaleFactors.markerOffset,labelToColumn:this.fontStlye.size*this.scaleFactors.labelToColumn,labelToAxis:this.fontStlye.size*this.scaleFactors.labelToAxis,needleWidth:this.fontStlye.size*this.scaleFactors.needleWidth,needleHeadWidth:this.fontStlye.size*this.scaleFactors.needleHeadWidth,columnWidth:this.fontStlye.size*this.scaleFactors.columnWidth,varianceAxisLineWidth:this.fontStlye.size*this.scaleFactors.varianceAxisLineWidth,axisLineWidth:this.fontStlye.size*this.scaleFactors.axisLineWidth,auxiliaryLineWidth:this.fontStlye.size*this.scaleFactors.auxiliaryLineWidth,scenarioLineWidth:this.fontStlye.size*this.scaleFactors.scenarioLineWidth,markerWidth:this.fontStlye.size*this.scaleFactors.markerWidth,categoryWidth:this.fontStlye.size*this.scaleFactors.categoryWidth,axisTickLength:this.fontStlye.size*this.scaleFactors.axisTickLength}}calculateCategoryPosition(){this.categoryPosition={x:this.padding.left+.5*this.spacings.columnWidth,y:this.padding.top}}calculateAxisPosition(){this.axisPosition={x:this.getAxisPositionX(),y:this.getAxisPositionY(!1)}}getMarkerScenarioLabelPositionOffsetX(t){return t?this.spacings.labelToColumn-this.fontStlye.size:this.spacings.labelToColumn+.5*this.spacings.markerWidth}}class R{constructor(t){this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right}addBoxTopLeft(t){return this.top+=t.height|this.top,this.left+=t.width|this.top,this}}class H{constructor(t){const i=1*t,s=.7*t;this.bgOffset=(i-s)/2,this.markerUp={top:s/2+",0",left:"0,"+s,right:s+","+s},this.markerUpBackground={top:i/2+",0",left:"0,"+i,right:i+","+i},this.markerDown={bottom:s/2+","+s,left:"0,0",right:s+",0"},this.markerDownBackground={bottom:i/2+","+i,left:"0,0",right:i+",0"},this.markerRight={bottom:"0,"+s,top:"0,0",right:s+","+s/2},this.markerRightBackground={bottom:"0,"+i,top:"0,0",right:i+","+i/2},this.markerLeft={bottom:s+","+s,top:s+",0",left:"0,"+s/2},this.markerLeftBackground={bottom:i+","+i,top:i+",0",Left:"0,"+i/2}}upMarkerPatternStrings(){return{background:this.markerUpBackground.left+" "+this.markerUpBackground.right+" "+this.markerUpBackground.top+" "+this.markerUpBackground.left,foreground:this.markerUp.left+" "+this.markerUp.right+" "+this.markerUp.top+" "+this.markerUp.left,bgOffset:this.bgOffset}}downMarkerPatternStrings(){return{background:this.markerDownBackground.left+" "+this.markerDownBackground.right+" "+this.markerDownBackground.bottom+" "+this.markerDownBackground.left,foreground:this.markerDown.left+" "+this.markerDown.right+" "+this.markerDown.bottom+" "+this.markerDown.left,bgOffset:this.bgOffset}}rightMarkerPatternStrings(){return{background:this.markerRightBackground.top+" "+this.markerRightBackground.right+" "+this.markerRightBackground.bottom+" "+this.markerRightBackground.top,foreground:this.markerRight.top+" "+this.markerRight.right+" "+this.markerRight.bottom+" "+this.markerRight.top,bgOffset:this.bgOffset}}leftMarkerPatternStrings(){return{background:this.markerLeftBackground.top+" "+this.markerLeftBackground.Left+" "+this.markerLeftBackground.bottom+" "+this.markerLeftBackground.top,foreground:this.markerLeft.top+" "+this.markerLeft.left+" "+this.markerLeft.bottom+" "+this.markerLeft.top,bgOffset:this.bgOffset}}createPatternMapForStructureBar(){const t=new Map;return t.set("marker-up",this.upMarkerPatternStrings()),t.set("marker-down",this.downMarkerPatternStrings()),t.set("marker-right",this.rightMarkerPatternStrings()),t.set("marker-left",this.leftMarkerPatternStrings()),t}}class F{constructor(t){this.container=new e,this.pattern=this.createFCPattern(this.container.group(),t),this.styles=t;let i=10;null!=t&&null!=t.fontStyles&&t.fontStyles.size&&(i=t.fontStyles.size),this.bgOffset=(1*i-.7*i)/2}createFCPattern(t,i){const s=i;return t.pattern(10,10,(function(t){t.rect(10,10).fill(s.barStyles.fc.fill),t.line(0,5,5,0).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"}),t.line(5,10,10,5).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"})})).id("pattern-time-fc")}getFCPolygonPattern(){return{background:"",foreground:"",bgOffset:0,pattern:this.pattern}}toString(){return this.container.svg()}}var V;!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"}(V||(V={}));class j{constructor(t,i,s,h,e,n,r,o){this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.isRelativeLabel=!1,this.segmentFillColor=null,this.x=i,this.y=s,this.value=e,this.group=t.group().id(this.createElementID(t.toString(),h)),this.styles=n,this.isVarianceLabel=!1,this.verticalHookLocation=r||V.Top,this.horizontalHookLocation=o||V.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}updateGroup(t){return this.group=t,this}draw(t=!0,i={percent:2,decimal:1},s=new n){if(this.isEmpty())return this;const h=this.group;let e,r="";if(!1===Number.isNaN(Number(this.value))){let t="percent",h=i.percent,n=i.percent,o=1;!1===this.isRelativeLabel&&(h=i.decimal,n=i.decimal,o=s.value,t="decimal"),e=_.number(Number(this.value),t,h,n,o),this.isVarianceLabel&&Number(this.value)>=0&&(r="+")}else e=""+this.value;const o=this.drawLabel(h,r+e);return!1===t&&(o.addClass("hide"),h.addClass("hide")),this}isEmpty(){return null==this.value||""===this.value}setPos(t,i){return this.x=t,this.y=i,this}forceStringTypeDraw(){return this.drawLabel(this.group,""+this.value),this}drawLabel(t,i){const s=this.styles.fontStyles.background||"#ffffff";let h="start";const e=t.text(i);e.move(this.x,this.y);const n=e.bbox().w,o=e.bbox().h;let l=0,a=0;const c=e.x();let u=e.y();return this.horizontalHookLocation===V.Left?(h="left",l=e.x()):this.horizontalHookLocation===V.Center?(h="middle",l=e.x()-(n+2)/2):this.horizontalHookLocation===V.Right&&(h="end",l=e.x()-n),this.verticalHookLocation===V.Center?(u=e.y()-1.2*o/2,a=u+.2*o):this.verticalHookLocation===V.Top?(u-=o/4,a=u+.2*o):this.verticalHookLocation===V.Bottom&&(u-=o,a=u+.2*o),e.move(c,u),e.font({anchor:h}),null!=this.segmentFillColor?e.fill(r(this.segmentFillColor)):t.rect(n+2,.8*o).stroke(s).fill(s).opacity(.9).move(l-1,a).insertBefore(e),e}createElementID(t,i){return t+"_"+i+"_"+this.ID_SCENARIOLABEL}}const X={ac:1,pp:2,fc:3,pl:4};var G,W,B;!function(t){t[t.Above=0]="Above",t[t.Below=1]="Below",t[t.Left=2]="Left",t[t.Right=3]="Right"}(G||(G={}));class I{constructor(){this.labels=[],this.scenarioLabels=[]}clear(){this.labels=[],this.scenarioLabels=[]}register(t){this.labels.push(t)}hasCollision(t){return this.labels.some((i=>this.intersects(t,i)))}getOptimalPlacement(t,i,s,h,e,n,r,o){const l=X[r]||99,a=n/2;for(const n of o){const r=this.calculatePlacementForDirection(t,i,s,h,e,a,8,n);if(!this.hasCollision(r.bounds))return r}for(const n of o){const r=this.calculatePlacementForDirection(t,i,s,h,e,a,8,n);if(!this.collidesWithHigherPriority(r.bounds,l))return r}return null}calculatePlacementForDirection(t,i,s,h,e,n,r,o){let l,a,c,u,d,f;switch(o){case G.Above:l=t,a=i-n-r,c=V.Bottom,u=V.Center,d=t-s/2,f=i-n-r-h;break;case G.Below:l=t,a=i+n+r,c=V.Top,u=V.Center,d=t-s/2,f=i+n+r-h/4;break;case G.Left:l=t-n-r,a=i,c=V.Center,u=V.Right,d=t-n-r-s,f=i-.6*h;break;case G.Right:l=t+n+r,a=i,c=V.Center,u=V.Left,d=t+n+r,f=i-.6*h}return{labelX:l,labelY:a,verticalHook:c,horizontalHook:u,bounds:{x:d,y:f,width:s,height:h,pointIndex:e,preferredHook:c}}}collidesWithHigherPriority(t,i){return this.labels.some((s=>!!s.scenarioType&&((X[s.scenarioType]||99)<i&&this.intersects(t,s))))}shouldHideScenarioLabel(t,i,s,h=20){const e=X[s]||99;return!(e<=1)&&this.scenarioLabels.some((s=>{if((X[s.scenarioType]||99)>=e)return!1;const n=Math.abs(i-s.y),r=Math.abs(t-s.x);return n<h&&r<h}))}registerScenarioLabel(t,i,s){this.scenarioLabels.push({x:t,y:i,scenarioType:s})}intersects(t,i){return!(t.x+t.width<i.x||i.x+i.width<t.x||t.y+t.height<i.y||i.y+i.height<t.y)}getLabelCount(){return this.labels.length}}class z{constructor(t,i,s,h){this.value=t,this.scenario=i,this.pixelPerUnit=s||1,this.variance="neg"===h||h===W.NEG?W.NEG:"pos"===h||h===W.POS?W.POS:W.NEU}isEmpty(){return void 0===this.value||null==this.scenario}getScaledUnit(){return null==this.value?0:this.value*this.pixelPerUnit}getScaledPercentUnit(){return null==this.value?0:this.value>1.45?1.45*this.pixelPerUnit:this.value<-1.45?-1.45*this.pixelPerUnit:this.value*this.pixelPerUnit}getVarianceStyle(){return null==this.value||this.value>=0?this.variance:W.NEU===this.variance?W.NEU:W.POS===this.variance?W.NEG:W.POS}isClipped(){return null!=this.value&&Math.abs(this.value)>1.45}getClippedValue(){return 145}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}class U{constructor(){this.operation="+"}addRowGroup(t,i){this.rowGroup=t,this.rowGroupIndex=i}addCategory(t,i){this.category=t,this.categoryIndex=i}addSubCategory(t,i){this.subCategory=t,this.subCategoryIndex=i}addColumnGroup(t,i){this.columnGroup=t,this.columnGroupIndex=i}addSubColumnGroup(t,i){this.columnSubGroup=t,this.columnSubGroupIndex=i}}class q{constructor(){}adapt(t){const i=new U;return m.isString(t.date)&&(i.date=this.parseDateString(t.date)),m.isOperator(t.operation)&&(i.operation=t.operation),m.isNumber(t.rowGroupIndex)&&m.isString(t.rowGroup)&&i.addRowGroup(t.rowGroup,t.rowGroupIndex),m.isNumber(t.categoryIndex)&&m.isString(t.category)&&i.addCategory(t.category,t.categoryIndex),m.isNumber(t.subCategoryIndex)&&m.isString(t.subCategory)&&i.addSubCategory(t.subCategory,t.subCategoryIndex),m.isNumber(t.columnGroupIndex)&&m.isString(t.columnGroup)&&i.addColumnGroup(t.columnGroup,t.columnGroupIndex),m.isNumber(t.columnSubGroupIndex)&&m.isString(t.columnSubGroup)&&i.addSubColumnGroup(t.columnSubGroup,t.columnSubGroupIndex),this.setActualValues(t,i),this.setPlanValues(t,i),this.setPreviousPeriodValues(t,i),this.setForecastValues(t,i),i}parseDateString(t){const i=L.fromISO(t);if(i.isValid)return i;console.warn(`TimeChartDataRow: invalid date value '${t}' — skipping row`)}default(){return new U}setActualValues(t,i){m.isNumber(t.ac1)&&(i.ac1=t.ac1),m.isNumber(t.ac2)&&(i.ac2=t.ac2),m.isNumber(t.ac3)&&(i.ac3=t.ac3),m.isNumber(t.ac4)&&(i.ac4=t.ac4)}setPlanValues(t,i){m.isNumber(t.pl1)&&(i.pl1=t.pl1),m.isNumber(t.pl2)&&(i.pl2=t.pl2),m.isNumber(t.pl3)&&(i.pl3=t.pl3),m.isNumber(t.pl4)&&(i.pl4=t.pl4)}setPreviousPeriodValues(t,i){m.isNumber(t.pp1)&&(i.pp1=t.pp1),m.isNumber(t.pp2)&&(i.pp2=t.pp2),m.isNumber(t.pp3)&&(i.pp3=t.pp3),m.isNumber(t.pp4)&&(i.pp4=t.pp4)}setForecastValues(t,i){m.isNumber(t.fc1)&&(i.fc1=t.fc1),m.isNumber(t.fc2)&&(i.fc2=t.fc2),m.isNumber(t.fc3)&&(i.fc3=t.fc3),m.isNumber(t.fc4)&&(i.fc4=t.fc4)}}class K{constructor(t,i,s,h,e,n){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=s,this.barStyles=h,this.varianceStyles=e,this.padding=n,this.pattern=new Map,this.stackColors=["#000000","#c0c0c0","#808080"]}}class Z{constructor(t,i,s,h,e){this.scaleFactorsStructureChartAdapter=t,this.fontStyleAdapter=i,this.svgStyleGroupAdapter=s,this.svgVariancesStyleGroupAdapter=h,this.paddingadapter=e}adapt(t){const i=new K(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default());return m.isExisting(t)&&(m.isExisting(t.scaleFactors)&&(i.scaleFactors=this.scaleFactorsStructureChartAdapter.adapt(t.scaleFactors)),m.isExisting(t.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(t.fontStyles)),m.isExisting(t.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(t.axisStyles)),m.isExisting(t.barStyles)&&(i.barStyles=this.svgStyleGroupAdapter.adapt(t.barStyles)),m.isExisting(t.varianceStyles)&&(i.varianceStyles=this.svgVariancesStyleGroupAdapter.adapt(t.varianceStyles)),m.isExisting(t.padding)&&(i.padding=this.paddingadapter.adapt(t.padding)),Array.isArray(t.stackColors)&&t.stackColors.length>0&&(i.stackColors=t.stackColors),i.pattern=new H(i.fontStyles.size).createPatternMapForStructureBar()),i}default(){return new K(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default())}}!function(t){t.AC1="ac1",t.PP1="pp1",t.FC1="fc1",t.PL1="pl1",t.AC2="ac2",t.PP2="pp2",t.FC2="fc2",t.PL2="pl2",t.AC3="ac3",t.PP3="pp3",t.FC3="fc3",t.PL3="pl3",t.AC4="ac4",t.PP4="pp4",t.FC4="fc4",t.PL4="pl4",t.POS="pos",t.NEG="neg",t.NEU="neu"}(W||(W={})),function(t){t.LIST="LIST",t.SUM="SUM",t.OPT="OPT"}(B||(B={}));class J{constructor(t,i,s){this.ID_AXIS="axis",this.CSS_AXIS_TITLE="categories",this.scenarioType=t.scenarioType,this.labelText=t.labelText||null,this.isRelative=t.isRelative||!1,this.position=i,this.svgGroup=s.group().id(this.ID_AXIS)}drawAxisTitle(t,i){null==i&&(i=""),t.text(i).addClass(this.CSS_AXIS_TITLE).attr("text-anchor","middle").move(this.position.getAxisTitlePositionX(t),this.position.getAxisTitlePositionY(!0,this.isRelative))}draw(){return this.labelText&&this.drawAxisTitle(this.svgGroup,this.labelText),this.svgGroup.line(this.position.getAxisPositionX(),this.position.getAxisPositionY(this.isRelative),this.position.getAxisEndPositionX(),this.position.getAxisPositionY(this.isRelative)).addClass(this.ID_AXIS+"-"+this.convertScenarioType()),this}convertScenarioType(){return void 0===this.scenarioType||null==this.scenarioType?"default":`${this.scenarioType}`.slice(0,2)}}class Q{constructor(t,i,s,h,e,n,r,o=null){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.scenarioLabel=null,this.isVarianceColumn=!1,this.overflowConfig=null,this.isOverflowing=!1,this.overdriveHeight=0,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=h,this.isPrimaryColumn=e,this.position=t,this.columnBarStyles=i.barStyles,this.overflowConfig=o,this.scenarioGroup=n,this.styles=i,this.columnGroup=n.group().id(n.toString()+"_"+this.ID_RECT),!0!==(null==s?void 0:s.isEmpty())&&(this.hasData=!0,this.dimensions=this.createDimensions(s,h,e),this.label=this.getDataLabel(s),this.scenarioLabel=this.getScenarioLabel(r))}setAsVariance(){var t;return this.isVarianceColumn=!0,null===(t=this.label)||void 0===t||t.setToVarianceLabel(),this}updateLabelGroup(t){var i;return this.isEmpty()||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(t={percent:2,decimal:1},i=new n){if(this.isEmpty())return this;const s=this.getScenarioStyle(),h=this.convertToSVGStyle(s,"stroke"),e=this.getFillStyle(s);null!=this.columnGroup&&(this.isOverflowing&&this.overflowConfig?this.drawOverdriveBar(e,h):this.columnGroup.rect(this.position.getColumnWidth(),this.dimensions.columnLength).fill(e).stroke(h).y(this.dimensions.yPos).cx(this.dimensions.xPos)),this.drawColumnDataLabel(t,i),this.drawScenarioLabel()}drawOverdriveBar(t,i){if(!this.columnGroup||!this.overflowConfig)return;const s=this.position.getColumnPositionY(),h=this.position.getColumnWidth(),e=this.dimensions.columnLength,{breakGap:n}=this.overflowConfig,r=s-e;this.columnGroup.rect(h,e).fill(t).stroke(i).y(r).cx(this.dimensions.xPos);const o=r-n-this.overdriveHeight;this.columnGroup.rect(h,this.overdriveHeight).fill(t).stroke(i).y(o).cx(this.dimensions.xPos),this.drawBreakIndicator(r,n)}drawBreakIndicator(t,i){if(!this.columnGroup)return;const s=this.position.getColumnWidth(),h=this.dimensions.xPos-s/2,e=t-i/2,n=.35*i,r=s/3;let o=`M ${h} ${e-n}`;for(let t=0;t<3;t++)o+=` L ${h+r*(t+.5)} ${e-n-.3*i} L ${h+r*(t+1)} ${e-n}`;let l=`M ${h} ${e+n}`;for(let t=0;t<3;t++)l+=` L ${h+r*(t+.5)} ${e+n+.3*i} L ${h+r*(t+1)} ${e+n}`;this.columnGroup.rect(s+2,i).fill("#ffffff").stroke("none").y(t-i).cx(this.dimensions.xPos),this.columnGroup.path(o).fill("none").stroke({color:"#000000",width:1}),this.columnGroup.path(l).fill("none").stroke({color:"#000000",width:1})}createDimensions(t,i,s){const h=t.getScaledUnit();if(this.overflowConfig&&h>0){const e="ac"===t.getScenario()?this.overflowConfig.cutHeight:this.overflowConfig.cutHeight-this.overflowConfig.scenarioCutOffset;if(h>e){this.isOverflowing=!0;const{breakGap:t,overdriveZoneHeight:n,maxOverflow:r}=this.overflowConfig;this.overdriveHeight=r>0?(h-e)/r*n:0;const o=e+t+this.overdriveHeight,l=this.position.getColumnPositionY();return{clipped:!1,columnLength:e,xPos:this.position.getColumnPositionX(i,s),yPos:l-e,labelYPos:l-o-this.position.spacings.labelToColumn,scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:l-.5*e}}}return h<0?{clipped:!1,columnLength:Math.abs(h),xPos:this.position.getColumnPositionX(i,s),yPos:this.position.getColumnPositionY(),labelYPos:this.position.getColumnDataLabelPositionY(h),scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getColumnPositionY()+.5*Math.abs(h)}:{clipped:!1,columnLength:h,xPos:this.position.getColumnPositionX(i,s),yPos:this.position.getColumnPositionY()-h,labelYPos:this.position.getColumnDataLabelPositionY(h),scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getColumnPositionY()-.5*Math.abs(h)}}getDataLabel(t){let i=V.Bottom;null!=t.value&&t.value<0&&(i=V.Top);const s=this.isOverflowing?this.dimensions.labelYPos:this.position.getColumnDataLabelPositionY(this.dataPoint.getScaledUnit());return new j(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),s,this.ID_DATA_PREFIX,t.value,this.styles,i,V.Center)}getScenarioLabel(t){return new j(this.scenarioGroup,-1,-1,this.ID_SCENARIO_PREFIX,t,this.styles,V.Center,this.isPrimaryColumn?V.Left:V.Right)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}drawScenarioLabel(){null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.isVarianceColumn||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(!0)}drawColumnDataLabel(t,i=new n){var s;null===(s=this.label)||void 0===s||s.draw(this.isPrimaryColumn,t,i)}getFillStyle(t){var i,s,h,e;const n=this.columnBarStyles[this.dataPoint.getScenario()];return(null==n?void 0:n.fillpattern)&&(null===(i=this.styles.pattern.get(n.fillpattern))||void 0===i?void 0:i.pattern)?null===(e=null===(h=null===(s=this.styles)||void 0===s?void 0:s.pattern)||void 0===h?void 0:h.get(n.fillpattern))||void 0===e?void 0:e.pattern:this.convertToSVGStyle(t,"fill")}getScenarioStyle(){var t;return this.isVarianceColumn?null===(t=this.styles)||void 0===t?void 0:t.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()):this.columnBarStyles[this.dataPoint.getScenario()]}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}}class tt{constructor(t,i,s,h,e,n,r,o,l){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.FALLBACK_COLOUR="#000000",this.scenarioLabel=null,this._defaultMarkerPattern=null,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.position=t,this.markerGroup=i||null,this.markerPattern=s||this._defaultMarkerPattern,this.styles=e,this.barStyles=e?e.barStyles:null,this.scenario=h,!0!==(null==n?void 0:n.isEmpty())&&(this.hasData=!0,this.dimensions=this.createMarkerDimensions(n,r,l),this.scenarioLabel=this.getScenarioLabel(o,e,l))}draw(){if(this.isEmpty())return this;const t=this.convertToSVGStyle(this.barStyles[this.getScenario()],"stroke");let i=this.convertToSVGStyle(this.barStyles[this.getScenario()],"fill");const s=this.barStyles[this.getScenario()];if(null!=s&&s.fillpattern){const t=this.styles.pattern.get(s.fillpattern);null!=t&&(i=t.pattern)}return this.markerGroup.polygon(this.markerPattern.background).fill("#ffffff").cy(this.dimensions.yPos-this.dimensions.columnLength).cx(this.dimensions.xPos),this.markerGroup.polygon(this.markerPattern.foreground).fill(i).stroke(t).cy(this.dimensions.yPos-this.dimensions.columnLength).cx(this.dimensions.xPos),null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(),this}createMarkerDimensions(t,i,s){return t.getScaledUnit()<0?{clipped:!1,labelYPos:0,columnLength:t.getScaledUnit(),xPos:this.position.getMarkerPositionX(i,s),yPos:this.position.getMarkerPositionY(),scenarioLabelXPos:this.position.getMarkerPositionX(i,s)+this.position.getMarkerScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getMarkerPositionY()+Math.abs(t.getScaledUnit())}:{clipped:!1,labelYPos:0,columnLength:t.getScaledUnit(),xPos:this.position.getMarkerPositionX(i,s),yPos:this.position.getMarkerPositionY(),scenarioLabelXPos:this.position.getMarkerPositionX(i,s)+this.position.getMarkerScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getMarkerPositionY()-Math.abs(t.getScaledUnit())}}getScenarioLabel(t,i,s){return null==this.markerGroup?null:new j(this.markerGroup,-1,-1,this.ID_DATA_PREFIX,t,i,V.Center,s?V.Right:V.Left)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}isEmpty(){return!1===this.hasData}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}class it{constructor(t,i,s,h,e){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.dataLabel=null,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=h,this.position=t,this.barStyles=i.barStyles,this.scenarioGroup=e,this.styles=i,this.barGroup=e.group().id(e.toString()+"_"+this.ID_RECT),!0!==(null==s?void 0:s.isEmpty())&&(this.hasData=!0,this.dimensions=this.createDimensions(t,s,h),this.dataLabel=new j(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),this.position.getNeedleDataLabelPositionY(this.dataPoint.getScaledPercentUnit()),this.ID_DATA_PREFIX,s.value,this.styles,V.Center,V.Center),this.dataLabel.setToRelativeVarianceLabel())}updateLabelGroup(t){var i;return this.isEmpty()||null===(i=this.dataLabel)||void 0===i||i.updateGroup(t),this}draw(){var t;if(this.isEmpty())return this;const i=this.styles.varianceStyles[this.dataPoint.getVarianceStyle()],s=this.convertToSVGStyle(i,"stroke");let h=this.convertToSVGStyle(i,"fill");const e=this.convertToSVGStyle(this.styles.varianceStyles.ac,"stroke"),n=this.convertToSVGStyle(this.styles.varianceStyles.ac,"fill"),r=this.barStyles[this.dataPoint.getScenario()];if(null!=r&&r.fillpattern){const t=this.styles.pattern.get(r.fillpattern);null!=t&&(h=t.pattern)}this.dimensions.clipped?this.createClippedNeedleHead(h,s):this.createNeedleHead(e,n),this.barGroup.rect(this.position.getNeedleWidth(),this.dimensions.columnLength).cx(this.dimensions.xPos).y(this.dimensions.yPos).fill(h).stroke(s),null===(t=this.dataLabel)||void 0===t||t.draw()}createDimensions(t,i,s){return i.getScaledPercentUnit()<0?{labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,columnLength:Math.abs(i.getScaledPercentUnit()),xPos:t.getColumnCenterPositionX(s),yPos:t.getNeedlePositionY(),clipped:i.isClipped()}:{columnLength:i.getScaledPercentUnit(),xPos:t.getColumnCenterPositionX(s),yPos:t.getNeedlePositionY()-i.getScaledPercentUnit(),labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:i.isClipped()}}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}createClippedNeedleHead(t,i){const s=this.barGroup.polygon("0,0 5,9 -5,9 0,0 0,5 5,13 -5,13 0,5").fill(t).cx(this.dimensions.xPos).cy(this.getHeadYPosition()).fill(t).stroke(i);null!=this.dataPoint.value&&this.dataPoint.value<0&&s.flip("y")}createNeedleHead(t,i){this.barGroup.rect(2*this.position.getNeedleWidth(),this.position.getNeedleHeadWidth()).cx(this.dimensions.xPos).cy(this.getHeadYPosition()).fill(t).stroke(i)}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}getHeadYPosition(){let t=this.dimensions.yPos;return null!=this.dataPoint.value&&this.dataPoint.value<0&&(t+=this.dimensions.columnLength),t}}const st={ac:{markerFill:"#000000",markerStroke:"#000000",lineColor:"#000000"},pp:{markerFill:"#999999",markerStroke:"#999999",lineColor:"#999999"},fc:{markerFill:"#ffffff",markerStroke:"#000000",lineColor:"#000000",lineDashArray:"4,4"},pl:{markerFill:"#ffffff",markerStroke:"#000000",lineColor:"#000000"}};class ht{constructor(t,i,s,h,e,n,r,o,l=null){this.MARKER_SIZE=8,this.LINE_WIDTH=2,this.ID_LINE_PREFIX="LINE",this.ID_MARKER_PREFIX="MARKER",this.ID_LABEL_PREFIX="LABEL",this.ESTIMATED_LABEL_WIDTH=56,this.ESTIMATED_LABEL_HEIGHT=24,this.position=t,this.styles=i,this.dataPoints=s,this.scenarioGroup=h,this.labelGroup=e,this.scenarioName=n,this.scenarioLabel=r,this.collisionManager=l}draw(t={percent:2,decimal:1},i=new n){return this.drawGeometry(),this.drawLabels(t,i),this}drawGeometry(){if(0===this.dataPoints.length)return this;const t=this.getLineStyle();return this.drawLines(t),this.drawMarkers(t),this}drawLabels(t={percent:2,decimal:1},i=new n){return 0===this.dataPoints.length||(this.drawScenarioLabel(),this.drawValueLabels(t,i)),this}getLineStyle(){var t,i;const s=(null===(i=null===(t=this.scenarioName)||void 0===t?void 0:t.slice(0,2))||void 0===i?void 0:i.toLowerCase())||"ac";return st[s]||st.ac}getScenarioVariant(){var t;const i=parseInt((null===(t=this.scenarioName)||void 0===t?void 0:t.slice(-1))||"1",10);return isNaN(i)?1:Math.min(Math.max(i,1),4)}drawSquareMarker(t,i,s,h){const e=this.MARKER_SIZE/2;t.rect(this.MARKER_SIZE,this.MARKER_SIZE).fill(h.markerFill).stroke({color:h.markerStroke,width:1}).move(i-e,s-e)}drawCircleMarker(t,i,s,h){t.circle(this.MARKER_SIZE).fill(h.markerFill).stroke({color:h.markerStroke,width:1}).center(i,s)}drawTriangleMarker(t,i,s,h){const e=this.MARKER_SIZE/2;t.polygon(`${i},${s-e} ${i-e},${s+e} ${i+e},${s+e}`).fill(h.markerFill).stroke({color:h.markerStroke,width:1})}drawDiamondMarker(t,i,s,h){const e=this.MARKER_SIZE/2;t.polygon(`${i},${s-e} ${i+e},${s} ${i},${s+e} ${i-e},${s}`).fill(h.markerFill).stroke({color:h.markerStroke,width:1})}drawLines(t){const i=this.scenarioGroup.group().id(this.ID_LINE_PREFIX);for(let s=1;s<this.dataPoints.length;s++){const h=this.dataPoints[s-1],e=this.dataPoints[s];if(h.dataPoint.isEmpty()||e.dataPoint.isEmpty())continue;const n=this.position.getColumnCenterPositionX(h.index),r=this.position.getColumnPositionY()-h.dataPoint.getScaledUnit(),o=this.position.getColumnCenterPositionX(e.index),l=this.position.getColumnPositionY()-e.dataPoint.getScaledUnit(),a=i.line([[n,r],[o,l]]).stroke({color:t.lineColor,width:this.LINE_WIDTH,linecap:"round"}).fill("none");t.lineDashArray&&a.attr("stroke-dasharray",t.lineDashArray)}}drawMarkers(t){const i=this.scenarioGroup.group().id(this.ID_MARKER_PREFIX),s=this.getScenarioVariant();for(const h of this.dataPoints){if(h.dataPoint.isEmpty())continue;const e=this.position.getColumnCenterPositionX(h.index),n=this.position.getColumnPositionY()-h.dataPoint.getScaledUnit();switch(s){case 2:this.drawCircleMarker(i,e,n,t);break;case 3:this.drawTriangleMarker(i,e,n,t);break;case 4:this.drawDiamondMarker(i,e,n,t);break;default:this.drawSquareMarker(i,e,n,t)}}}getLabelPositionPriority(t){const i=this.dataPoints[t];let s=null;for(let i=t+1;i<this.dataPoints.length;i++)if(!this.dataPoints[i].dataPoint.isEmpty()){s=this.dataPoints[i];break}let h=null;for(let i=t-1;i>=0;i--)if(!this.dataPoints[i].dataPoint.isEmpty()){h=this.dataPoints[i];break}const e=i.dataPoint.getScaledUnit();return h&&s&&h.dataPoint.getScaledUnit()>e&&s.dataPoint.getScaledUnit()>e?[G.Below,G.Left,G.Right,G.Above]:[G.Above,G.Left,G.Right,G.Below]}getScenarioType(){var t,i;return(null===(i=null===(t=this.scenarioName)||void 0===t?void 0:t.slice(0,2))||void 0===i?void 0:i.toLowerCase())||"ac"}drawValueLabels(t,i){const s=this.getScenarioType();for(let h=0;h<this.dataPoints.length;h++){const e=this.dataPoints[h];if(e.dataPoint.isEmpty()||null===e.dataPoint.value)continue;const n=this.position.getColumnCenterPositionX(e.index),r=this.position.getColumnPositionY()-e.dataPoint.getScaledUnit();let o=n,l=r-this.MARKER_SIZE/2-2,a=V.Bottom,c=V.Center;if(this.collisionManager){const t=this.getLabelPositionPriority(h),i=this.collisionManager.getOptimalPlacement(n,r,this.ESTIMATED_LABEL_WIDTH,this.ESTIMATED_LABEL_HEIGHT,e.index,this.MARKER_SIZE,s,t);if(null===i)continue;o=i.labelX,l=i.labelY,a=i.verticalHook,c=i.horizontalHook;const u=Object.assign(Object.assign({},i.bounds),{scenarioType:s});this.collisionManager.register(u)}new j(this.labelGroup,o,l,this.ID_LABEL_PREFIX,e.dataPoint.value,this.styles,a,c).draw(!0,t,i)}}drawScenarioLabel(){if(!this.scenarioLabel)return;let t=null;for(let i=this.dataPoints.length-1;i>=0;i--)if(!this.dataPoints[i].dataPoint.isEmpty()){t=this.dataPoints[i];break}if(!t)return;const i=this.position.getColumnCenterPositionX(t.index)+this.MARKER_SIZE+4,s=this.position.getColumnPositionY()-t.dataPoint.getScaledUnit(),h=this.getScenarioType();if(this.collisionManager){if(this.collisionManager.shouldHideScenarioLabel(i,s,h))return;this.collisionManager.registerScenarioLabel(i,s,h)}new j(this.labelGroup,i,s,"SCENARIO_LABEL",this.scenarioLabel,this.styles,V.Center,V.Left).forceStringTypeDraw()}}class et{constructor(t,i,s,h,e,n,r,o,l,a,c){this.hasData=!1,this.position=t,this.styles=i,this.dataPoint=s,this.index=h,this.baselineValue=e,this.segmentIndex=r,this.stackMode=o,this.totalValue=l,this.group=c,this.columnGroup=c.group().id(`stacked_col_${h}_seg_${r}`),!0!==(null==s?void 0:s.isEmpty())&&null!=s.value&&(this.hasData=!0)}draw(t={percent:2,decimal:1},i=new n){if(!this.hasData||null==this.dataPoint.value)return;const s=this.dataPoint.value,h=this.dataPoint.pixelPerUnit;let e,r;const o=this.position.getColumnPositionY();if(this.stackMode===P.RELATIVE){const t=h;e=(0!==this.totalValue?Math.abs(s)/Math.abs(this.totalValue):0)*t,r=o-this.baselineValue/Math.abs(this.totalValue)*t-e}else e=Math.abs(s*h),r=o-this.baselineValue*h-e;const l=this.position.getColumnCenterPositionX(this.index),a=this.position.getColumnWidth(),c=this.styles.stackColors,u=c[this.segmentIndex%c.length],d={color:u},f={color:u,width:.5};if(this.columnGroup.rect(a,Math.max(e,.5)).fill(d).stroke(f).y(r).cx(l),e>=18){const h=r+e/2;if(this.stackMode===P.RELATIVE||this.stackMode===P.ABSOLUTE_RELATIVE){const i=(0!==this.totalValue?s/this.totalValue*100:0).toFixed(t.percent)+"%";new j(this.group,l,h,"STACK_SEG",i,this.styles,V.Center,V.Center).setSegmentFill(u).forceStringTypeDraw()}else new j(this.group,l,h,"STACK_SEG",s,this.styles,V.Center,V.Center).setSegmentFill(u).draw(!0,t,i)}}drawTotalLabel(t={percent:2,decimal:1},i=new n){if(this.stackMode===P.RELATIVE)return;const s=this.position.getColumnCenterPositionX(this.index),h=this.position.getColumnPositionY();new j(this.group,s,h-this.totalValue*this.dataPoint.pixelPerUnit-this.position.spacings.labelToColumn,"STACK_TOTAL",this.totalValue,this.styles,V.Bottom,V.Center).draw(!0,t,i)}}const nt={ac:{fill:"#000000",opacity:.3,lineColor:"#000000"},pp:{fill:"#999999",opacity:.3,lineColor:"#999999"},fc:{fill:"#000000",opacity:.2,lineColor:"#000000",dashArray:"4,4"},pl:{fill:"#000000",opacity:.1,lineColor:"#000000"}},rt=[{fill:"#000000",opacity:.3},{fill:"#555555",opacity:.25},{fill:"#999999",opacity:.2},{fill:"#bbbbbb",opacity:.15},{fill:"#dddddd",opacity:.1}];class ot{constructor(t,i,s,h,e,n){this.group=t.group().id(`area_fill_${e}`),this.upperPoints=i,this.lowerPoints=s,this.scenarioType=h,this.segmentIndex=e,this.isScenarioStack=n}draw(){if(this.upperPoints.length<2||this.lowerPoints.length<2)return;let t,i,s=`M ${this.upperPoints[0].x},${this.upperPoints[0].y}`;for(let t=1;t<this.upperPoints.length;t++)s+=` L ${this.upperPoints[t].x},${this.upperPoints[t].y}`;for(let t=this.lowerPoints.length-1;t>=0;t--)s+=` L ${this.lowerPoints[t].x},${this.lowerPoints[t].y}`;if(s+=" Z",this.isScenarioStack&&this.scenarioType){const s=this.scenarioType.slice(0,2).toLowerCase(),h=nt[s]||nt.ac;t=h.fill,i=h.opacity}else{const s=Math.min(this.segmentIndex,rt.length-1);t=rt[s].fill,i=rt[s].opacity}this.group.path(s).fill(t).opacity(i).stroke("none")}drawBoundaryLine(){if(this.upperPoints.length<2)return;let t,i="#000000";if(this.isScenarioStack&&this.scenarioType){const s=this.scenarioType.slice(0,2).toLowerCase(),h=nt[s]||nt.ac;i=h.lineColor,t=h.dashArray}const s=this.group.polyline(this.upperPoints.map((t=>[t.x,t.y]))).fill("none").stroke({color:i,width:1.5});t&&s.attr("stroke-dasharray",t)}}class lt{constructor(t,i,s,h,e,n,r,o){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.scenarioLabel=null,this.isVarianceLine=!1,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.previousDimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=e,this.isPrimaryLine=n,this.position=t,this.LineBarStyles=i.barStyles,this.scenarioGroup=r,this.styles=i,this.LineGroup=r.group().id(r.toString()+"_"+this.ID_RECT),!0!==(null==s?void 0:s.isEmpty())&&(this.hasData=!0,this.dimensions=this.createDimensions(s,e,n),this.label=this.getDataLabel(s),this.scenarioLabel=this.getScenarioLabel(o)),this.previousDimensions=this.createDimensions(h,e-1,n)}setAsVariance(){var t;return this.isVarianceLine=!0,null===(t=this.label)||void 0===t||t.setToVarianceLabel(),this}updateLabelGroup(t){var i;return this.isEmpty()||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(t={percent:2,decimal:1},i=new n){if(this.isEmpty())return this;const s=this.getScenarioStyle(),h=this.getFillStyle(s);null!=this.LineGroup&&this.LineGroup.line([[this.previousDimensions.xPos,this.previousDimensions.yPos],[this.dimensions.xPos,this.dimensions.yPos]]).fill(h).stroke({color:"#f06",width:3,linecap:"round"}),this.drawLineDataLabel(t,i),this.drawScenarioLabel()}createDimensions(t,i,s){return{clipped:!1,columnLength:t.getScaledUnit(),xPos:this.position.getColumnPositionX(i,s),yPos:this.position.getColumnPositionY()-t.getScaledUnit(),labelYPos:this.position.getColumnDataLabelPositionY(t.getScaledUnit()),scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getColumnPositionY()-t.getScaledUnit()}}getDataLabel(t){let i=V.Bottom;return null!=t.value&&t.value<0&&(i=V.Top),new j(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),this.position.getColumnDataLabelPositionY(this.dataPoint.getScaledUnit()),this.ID_DATA_PREFIX,t.value,this.styles,i,V.Center)}getScenarioLabel(t){return new j(this.scenarioGroup,0,0,this.ID_SCENARIO_PREFIX,t,this.styles,V.Bottom,V.Left)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}drawScenarioLabel(){null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.isVarianceLine||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(!0)}drawLineDataLabel(t,i=new n){var s;null===(s=this.label)||void 0===s||s.draw(this.isPrimaryLine,t,i)}getFillStyle(t){var i,s,h,e;const n=this.LineBarStyles[this.dataPoint.getScenario()];return(null==n?void 0:n.fillpattern)&&(null===(i=this.styles.pattern.get(n.fillpattern))||void 0===i?void 0:i.pattern)?null===(e=null===(h=null===(s=this.styles)||void 0===s?void 0:s.pattern)||void 0===h?void 0:h.get(n.fillpattern))||void 0===e?void 0:e.pattern:this.convertToSVGStyle(t,"fill")}getScenarioStyle(){var t;return this.isVarianceLine?null===(t=this.styles)||void 0===t?void 0:t.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()):this.LineBarStyles[this.dataPoint.getScenario()]}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}}class at{constructor(t,i,s,h,e){this.pixelPerUnit=1,this.collisionManager=null,this.overflowConfig=null,this.i18n=e;const n=i.group().id("Scenario1"),r=i.group().id("Scenario2").insertBefore(n);this.svgGroups={parent:i,scenario1:n,scenario2:r,scenario3:i.group().id("Scenario3"),scenario4:i.group().id("Scenario4"),scenario1Label:i.group().id("label")},this.styles=s,this.position=t,this.elementCnt=h}setOverflowConfig(t){this.overflowConfig=t}createLine(t,i,s,h){const e=this.svgGroups.scenario1.group().id(""+h),n=this.svgGroups.scenario1Label.group().id(""+h);let r=null;return this.isLastDataPoint(h-1)&&(r=t),new lt(this.position,this.styles,i,s,h,!1,e,r).updateLabelGroup(n)}createPrimaryBar(t,i){const s=this.svgGroups.scenario1.group().id(""+i),h=this.svgGroups.scenario1Label.group().id(""+i);let e=null;return this.isLastDataPoint(i)&&(e=`${this.i18n.get(t.scenario)||t.scenario}`),new Q(this.position,this.styles,t,i,!0,s,e,this.overflowConfig).updateLabelGroup(h)}createVarianceBar(t,i){const s=this.svgGroups.scenario1.group().id(""+i),h=this.svgGroups.scenario1Label.group().id(""+i);let e=null;return this.isLastDataPoint(i)&&(e=`${this.i18n.get(t.scenario)||t.scenario}`),new Q(this.position,this.styles,t,i,!0,s,e,this.overflowConfig).updateLabelGroup(h).setAsVariance()}createRelativeVarianceBar(t,i){const s=this.svgGroups.scenario1.group().id(""+i),h=this.svgGroups.scenario1Label.group().id(""+i);return new it(this.position,this.styles,t,i,s).updateLabelGroup(h)}createSecondaryBar(t,i){const s=this.svgGroups.scenario2.group().id(""+i);let h=null;return this.isFirstDataPoint(i)&&(h=`${this.i18n.get(t.scenario)||t.scenario}`),new Q(this.position,this.styles,t,i,!1,s,h,this.overflowConfig)}createPrimaryMarker(t,i){const s=this.svgGroups.scenario3.group().id(""+i),h=this.styles.pattern.get("marker-right")||{foreground:"#000000",background:"#ffffff",bgOffset:0};let e=null;return this.isFirstDataPoint(i)&&(e=`${this.i18n.get(t.scenario)||t.scenario}`),new tt(this.position,s,h,t.scenario,this.styles,t,i,e,!0)}createSecondaryMarker(t,i){const s=this.svgGroups.scenario4.group().id(""+i),h=this.styles.pattern.get("marker-left")||{foreground:"#000000",background:"#ffffff",bgOffset:0};let e=null;return this.isLastDataPoint(i)&&(e=`${this.i18n.get(t.scenario)||t.scenario}`),new tt(this.position,s,h,t.scenario,this.styles,t,i,e,!1)}isLastDataPoint(t){return this.elementCnt-1===t}isFirstDataPoint(t){return 0===t}setCollisionManager(t){this.collisionManager=t}moveLabelsToFront(){this.svgGroups.scenario1Label.front()}createLineSeries(t,i){const s=this.svgGroups.parent.group().id("LineSeries_"+i),h=this.svgGroups.scenario1Label.group().id("LineSeries_Label_"+i),e=`${this.i18n.get(i)||i}`;return new ht(this.position,this.styles,t,s,h,i,e,this.i18n,this.collisionManager)}}var ct,ut;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(ct||(ct={})),function(t){t.RELATIVE="dr",t.ABSOLUTE="d",t.NONE=""}(ut||(ut={}));class dt{constructor(t,i,s,h=0){this.CSS_CATEGORIES="categories",this.dataModel=[],this.variancesDataModel=[],this.title="",this.smallestDataPointValue=new z(0,W.AC1,1,W.NEU),this.highestDataPointValue=new z(0,W.AC1,1,W.NEU),this.smallestVarianceDataPointValue=new z(0,W.AC1,1,W.NEU),this.highestVarianceDataPointValue=new z(0,W.AC1,1,W.NEU),this.pixelPerUnit=1,this.pixelPerPercentage=1,this.hideAxisLabels=!1,this.axisScenario=W.AC1,this.preparedDataSet=[],this.axisCategoryArea={width:0,height:0},this.scenariosArea={width:0,height:0},this.state=ct.DIRTY,this.i18n=new Map,this.leftSideOffsetForHorizontalSync=-1,this.dateInterval=S.DAY,this.locale="de",this.axisLabelsMode=y.SMART,this.intervalSpanLimit=32,this.measureScale=new n,this.measureUnit="",this.dataFormatDigits={percent:2,decimal:1},this.showOverlayMedian=!1,this.showOverlayAvg=!1,this.chartMode=k.BAR,this.maxBars=28,this.stackConfig=null,this.lineFullWidth=!0,this.availableWidth=0,this.overflowConfig=null,this.lastScenarios=[],this.initSQLFunctions(),this.ruleSet=t||new o,this.i18n=this.createI18n(new Map),this.styles=s,this.availableWidth=h,this.setConfig(i),this.position=this.createElementPosition(i.scenarios)}updatePosition(t){this.position=this.createElementPosition(t)}initSQLFunctions(){l.fn.transformOperator=function(t){return"-"===t?-1:1},l.fn.normalizeDate=function(t,i){if(void 0!==t&&t.isValid)return t.startOf(i)}}setStyles(t){this.styles=t}setAvailableWidth(t){this.availableWidth=t}setAvailableHeight(t){this.pixelPerUnit<=0||t<=0?this.overflowConfig=null:null==this.stackConfig&&this.determineEffectiveChartMode()===k.BAR?(this.overflowConfig=this.calculateOverflowConfig(t),this.overflowConfig&&this.updatePosition(this.lastScenarios)):this.overflowConfig=null}calculateOverflowConfig(t){const i=(this.isVarianceChart()?this.highestVarianceDataPointValue:this.highestDataPointValue).getScaledUnit();if(i<=0)return null;const s=this.styles.fontStyles.size,h=1.5*s,e=.3*s,n=t-(this.position.dataLabelHeight+this.position.spacings.labelToColumn+this.position.padding.top+this.position.padding.bottom+this.position.spacings.labelToAxis+s)-h-e,r=.8*s;if(n<=r)return null;const o=n-r;return i<=o?null:{cutHeight:n,overdriveZoneHeight:h,breakGap:e,maxOverflow:i-o,scenarioCutOffset:r}}setConfig(t){var i;this.state=ct.DIRTY,this.sortScenariosbyVisualisationRules(t),this.setData([...t.data],t.filter),this.hideAxisLabels=t.hideAxisLabels||!1,this.pixelPerUnit=t.pixelPerUnit,this.pixelPerPercentage=t.pixelPerPercentage,this.axisLabelsMode=t.axisLabelsMode,this.intervalSpanLimit=t.intervalSpanLimit,this.dateInterval=this.findDateInterval(t.dateInterval),this.dataModel=this.populateModel(t.scenarios,this.dateInterval,t.level,t.sortOrder),this.variancesDataModel=this.populateVarianceModel(t.variances,this.dataModel),this.title=t.title||_.translateScenarioLabel(null===(i=null==t?void 0:t.variances)||void 0===i?void 0:i.toString(),this.i18n),this.smallestDataPointValue=this.findSmallestDataPointValue(this.dataModel),this.smallestVarianceDataPointValue=this.findSmallestDataPointValue(this.variancesDataModel),this.highestDataPointValue=this.findHighestDataPointValue(this.dataModel),this.highestVarianceDataPointValue=this.findHighestDataPointValue(this.variancesDataModel),this.axisScenario=this.setAxisScenario(t.variances),this.leftSideOffsetForHorizontalSync=t.leftSideOffsetForHorizontalSync,this.measureScale=t.measureScale,this.measureUnit=t.measureUnit,this.dataFormatDigits=t.dataFormatDigits,this.showOverlayMedian=t.showOverlayMedian,this.showOverlayAvg=t.showOverlayAvg,this.chartMode=t.chartMode,this.maxBars=t.maxBars,this.stackConfig=t.stackConfig,this.lineFullWidth=t.lineFullWidth,this.lastScenarios=t.scenarios,this.updatePosition(t.scenarios)}getFooter(){return 1===this.measureScale.value&&""===this.measureUnit?" ":_.translateScenarioLabel("in",this.i18n)+" "+this.measureScale.prefix+this.measureUnit}sortScenariosbyVisualisationRules(t){const i=this;t.scenarios.sort(((t,s)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(s))).reverse()}setI18n(t){this.i18n=this.createI18n(t)}setData(t,i){if(null!=t)if(this.state=ct.DIRTY,this.preparedDataSet.length=0,null!=i&&i.length>0)try{this.preparedDataSet=l(`SELECT * FROM ? WHERE ${i}`,[t])}catch(s){console.error("TimeChart: filter query failed, using unfiltered data",i,s),this.preparedDataSet=t}else this.preparedDataSet=t}getAllocatedCanvasWidth(){const t=this.position.getAxisEndPositionX(),i=3*this.styles.fontStyles.size,s=Math.max(this.axisCategoryArea.width,this.scenariosArea.width);return Math.max(t+i,s>0?s+this.position.leftSideLabelLength:0)}getAllocatedCanvasHeight(){if(null==this.smallestVarianceDataPointValue.value||null==this.highestVarianceDataPointValue.value||null==this.smallestDataPointValue.value||null==this.highestDataPointValue.value)return 0;const t=this.isVarianceChart()&&this.variancesDataModel.some((t=>t.type===ut.RELATIVE)),i=this.position.getAxisPositionY(t),s=this.position.spacings.labelToAxis+this.position.dataLabelHeight+this.styles.padding.bottom;let h;if(this.isOnSameAxisSide())h=i+s;else{const t=this.isVarianceChart()?this.smallestVarianceDataPointValue:this.smallestDataPointValue;h=i+Math.abs(t.getScaledUnit())+this.position.spacings.labelToColumn+this.position.dataLabelHeight+s}const e=this.isOnSameAxisSide();return Math.max(h,e?this.axisCategoryArea.height+this.scenariosArea.height:this.scenariosArea.height)}toString(){const t=new e;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}draw(t){this.cleanSVGforRedraw(t),this.state===ct.DIRTY&&(this.state=ct.UP_TO_DATE),this.isVarianceChart()?(this.drawVarianceScenario(this.variancesDataModel,t),this.drawAxisAndLabels(this.variancesDataModel,t)):null!=this.stackConfig?this.determineEffectiveChartMode()===k.LINE?(this.drawStackedAreaScenarios(this.dataModel,t),this.drawAxisAndLabelsForLineChart(this.dataModel,t)):(this.drawStackedScenarios(this.dataModel,t),this.drawStackedHeaders(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t)):this.determineEffectiveChartMode()===k.LINE?(this.drawLineScenarios(this.dataModel,t),this.drawAxisAndLabelsForLineChart(this.dataModel,t)):(this.drawScenarios(this.dataModel,t),this.drawOverlayLayer(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t))}determineEffectiveChartMode(){return this.chartMode===k.LINE||this.chartMode===k.AUTO&&this.dataModel.length>this.maxBars?k.LINE:k.BAR}setPattern(t,i){this.styles.pattern.set(t,i)}hasNoData(){return 0===this.dataModel.length}isOnSameAxisSide(){return null!=this.smallestVarianceDataPointValue.value&&null!=this.highestVarianceDataPointValue.value&&null!=this.smallestDataPointValue.value&&null!=this.highestDataPointValue.value&&(this.isVarianceChart()?Math.sign(this.smallestVarianceDataPointValue.value)===Math.sign(this.highestVarianceDataPointValue.value)||0===this.smallestDataPointValue.value&&1===Math.sign(this.highestDataPointValue.value):Math.sign(this.smallestDataPointValue.value)===Math.sign(this.highestDataPointValue.value)||0===this.smallestDataPointValue.value&&1===Math.sign(this.highestDataPointValue.value))}createI18n(t){this.state=ct.DIRTY;const i=new Map([["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"]]);return new Map([...i,...t])}createElementPosition(t){let i;const s=$(t.filter(((t,i)=>1===i||2===i)).map((t=>_.translateScenarioLabel(t,this.i18n))).reduce(((t,i)=>t.length<i.length?i:t),""),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width,h=this.calculateTitleLength(this.leftSideOffsetForHorizontalSync);let e,n;if(i=s>h?s:h,null!=this.position&&(i+=this.position.spacings.labelToColumn),this.leftSideOffsetForHorizontalSync>-1&&(i=this.leftSideOffsetForHorizontalSync),this.isVarianceChart()?(e=this.smallestVarianceDataPointValue,n=this.highestVarianceDataPointValue):(e=this.smallestDataPointValue,n=this.highestDataPointValue),this.overflowConfig){const{cutHeight:t,overdriveZoneHeight:i,breakGap:s}=this.overflowConfig;n=new z(t+i+s,n.scenario,1,n.variance)}let r=this.styles.scaleFactors;const o=this.determineEffectiveChartMode();if(this.lineFullWidth&&this.availableWidth>0&&this.dataModel.length>0&&!this.isVarianceChart()&&o===k.LINE){const t=this.styles.fontStyles.size,s=this.styles.padding,h=this.styles.scaleFactors,e=this.availableWidth-(s.left+s.right+t*h.scenarioOffset+i+t*h.columnWidth);if(e>0){const i=Math.max(e/this.dataModel.length/t,1.2*h.columnWidth),s=new E;Object.assign(s,h),s.categoryWidth=i,r=s}}return new N(new R(this.styles.padding),r,this.styles.fontStyles,e,n,this.dataModel.length,i)}calculateTitleLength(t){let i="_______";i.length<this.title.length&&(i=this.title);const s=$(i,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width;return s<t?t:s}setAxisScenario(t){let i=W.AC1;if(null!=t&&t.length>0){const s=new D(t.toString());s.isValid&&(i=s.delta)}return null===i&&(i=W.AC1),i}populateModel(t,i,s,h){var e;if(0===(null===(e=this.preparedDataSet)||void 0===e?void 0:e.length))return[];let n=this.queryDataSet(i,"","");return this.detectNaNCells(t,n),n=this.leftOuterJoinDates(n,i),this.createDataRows(n,t)}detectNaNCells(t,i){i.forEach((i=>(t.forEach((t=>{const s=new D(t);!0===s.isValid?0!==i[s.base+"_cnt"]&&0!==i[s.delta+"_cnt"]||(i[t]=Number.NaN):0===i[t+"_cnt"]&&(i[t]=Number.NaN)})),i)))}findDateInterval(t){var i,s,h;if(t!==S.AUTO)return t;const e=this.queryMinMaxDates();let n=S.DAY;return null!=(null===(i=e[0])||void 0===i?void 0:i.mindate)&&(n=(new M).calculateDistanceType(null===(s=e[0])||void 0===s?void 0:s.mindate,null===(h=e[0])||void 0===h?void 0:h.maxdate,this.intervalSpanLimit)),n}queryMinMaxDates(){var t,i,s,h;const e=l("SELECT MAX(date) as maxdate, MIN(date) as mindate FROM ?",[this.preparedDataSet]);return null!=(null===(t=e[0])||void 0===t?void 0:t.mindate)&&(e[0].mindate=L.fromMillis(null===(i=e[0])||void 0===i?void 0:i.mindate)),null!=(null===(s=e[0])||void 0===s?void 0:s.maxdate)&&(e[0].maxdate=L.fromMillis(null===(h=e[0])||void 0===h?void 0:h.maxdate)),e}queryDataSet(t,i,s){const h=`normalizeDate([date], '${t}' , '${this.locale}') as calcdate`;return l(`SELECT p.calcdate ${i},\n ${["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"].map((t=>`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`)).join(",")} \n \n FROM (SELECT ${h} ${i},\n ac1,\n ac2,\n ac3,\n ac4,\n pp1,\n pp2,\n pp3,\n pp4,\n fc1,\n fc2,\n fc3,\n fc4,\n pl1,\n pl2,\n pl3,\n pl4\n FROM ?) as p\n GROUP BY calcdate ${s}\n ORDER BY calcdate asc`,[this.preparedDataSet])}createDataRows(t,i){const s=[];return t.forEach(((t,h)=>{s.push({id:h,category:t.category,type:ut.NONE,date:t.calcdate,scenario1:new z(t[i[0]],i[0],this.pixelPerUnit,W.NEU),scenario2:new z(t[i[1]],i[1],this.pixelPerUnit,W.NEU),scenario3:new z(t[i[2]],i[2],this.pixelPerUnit,W.NEU),scenario4:new z(t[i[3]],i[3],this.pixelPerUnit,W.NEU)})})),s}findSmallestDataPointValue(t){const i=this.isVarianceChart()?this.pixelPerPercentage:this.pixelPerUnit;let s=new z(0,"default",i,W.NEU);for(const i of t)for(const t of[i.scenario1,i.scenario2,i.scenario3,i.scenario4])t&&null!=t.value&&t.value<Number(s.value)&&(s=t);return s}findHighestDataPointValue(t){const i=this.isVarianceChart()?this.pixelPerPercentage:this.pixelPerUnit;let s=new z(0,"default",i,W.NEU);for(const i of t)for(const t of[i.scenario1,i.scenario2,i.scenario3,i.scenario4])null!=t&&t.value>Number(s.value)&&(s=t);return s}populateVarianceModel(t,i){const s=[];if(null==t||0===t.length)return s;let h=null;null!=i&&i.length>0&&(h=i[0]);for(const e in t){const n=new D(t[e]);if(n.isValid){const t=this.mapScenarios(n,h),e=n.direction,r="dr"===n.type?this.pixelPerPercentage:this.pixelPerUnit;for(const h in i)s.push({id:Number(h),category:i[h].category,type:"dr"===n.type?ut.RELATIVE:ut.ABSOLUTE,date:i[h].date,scenario1:new z(this.calculateVariance(n,i[h],t),n.delta,r,e),scenario2:new z(null,null,null,null),scenario3:new z(null,null,null,null),scenario4:new z(null,null,null,null)})}}return s}calculateVariance(t,i,s){const h=s.get(t.base),e=s.get(t.delta);return null==h||null==e||null==i[h].value||null==i[e].value?null:t.type===ut.RELATIVE?(i[h].value-i[e].value)/i[e].value:i[h].value-i[e].value}mapScenarios(t,i){const s=new Map;return null==i||["scenario1","scenario2","scenario3","scenario4"].forEach((h=>{i[h].scenario===t.delta?s.set(t.delta,h):i[h].scenario===t.base&&s.set(t.base,h)})),s}cleanSVGforRedraw(t){t.clear()}isVarianceChart(){return this.variancesDataModel&&this.variancesDataModel.length>0}createDateFactory(){return new M}drawAxisAndLabels(t,i){const s=this.createDateFactory(),h=i.group().id("AxisAndDateLables");let e=!1;if(!1===this.hideAxisLabels)t.forEach(((t,i)=>{let n=V.Top,r=this.position.spacings.labelToAxis;t.scenario1.value<0&&(n=V.Bottom,r*=-1),t.type===ut.RELATIVE&&(e=!0);let o=s.getDateString(t.date,this.dateInterval);this.axisLabelsMode===y.SMART?(o=s.getSmartDateString(t.date,this.dateInterval),0===i&&this.dateInterval!==S.YEAR&&(o=s.getShortDateString(t.date,this.dateInterval))):this.axisLabelsMode===y.SHORT&&(o=s.getShortDateString(t.date,this.dateInterval)),new j(h,this.position.getColumnCenterPositionX(i),this.position.getAxisPositionY(e)+r,"",o,this.styles,n,V.Center).forceStringTypeDraw()}));else{const i=null==t?void 0:t[0];i&&i.type===ut.RELATIVE&&(e=!0)}new J({scenarioType:this.axisScenario,labelText:this.title,isRelative:e},this.position,h).draw(),this.axisCategoryArea={height:h.height(),width:h.width()}}drawScenarios(t,i){const s=i.group().id("Scenarios"),h=new at(this.position,s,this.styles,t.length,this.i18n);h.setOverflowConfig(this.overflowConfig);let e=!1;t.forEach(((t,i)=>{h.createPrimaryBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale),h.createSecondaryBar(t.scenario2,i).draw(),h.createPrimaryMarker(t.scenario3,i).draw(),h.createSecondaryMarker(t.scenario4,i).draw(),!1===t.scenario1.isEmpty()&&(e=!0)}));let n=0;!1===e&&(n=this.isOnSameAxisSide()?this.position.dataLabelHeight:2*this.position.dataLabelHeight),this.scenariosArea={height:s.height()+this.styles.padding.top+this.styles.padding.bottom+n,width:s.width()+this.position.spacings.columnWidth}}drawLineScenarios(t,i){var s,h;const e=i.group().id("LineScenarios"),n=new I,r=new at(this.position,e,this.styles,t.length,this.i18n);r.setCollisionManager(n);const o=["ac1","pp1","fc1","pl1"],l=[[],[],[],[]];t.forEach(((t,i)=>{["scenario1","scenario2","scenario3","scenario4"].forEach(((s,h)=>{t[s]&&l[h].push({dataPoint:t[s],index:i})}))}));const a=[];for(let t=0;t<l.length;t++){const i=l[t];if(i.length>0&&i.some((t=>!t.dataPoint.isEmpty()))){const e=(null===(h=null===(s=i[0])||void 0===s?void 0:s.dataPoint)||void 0===h?void 0:h.scenario)||o[t],n=e.slice(0,2).toLowerCase();a.push({points:i,scenarioName:e,scenarioType:n})}}a.sort(((t,i)=>(X[i.scenarioType]||99)-(X[t.scenarioType]||99)));const c=[];for(const t of a){const i=r.createLineSeries(t.points,t.scenarioName);c.push({series:i,scenarioType:t.scenarioType})}for(const t of c)t.series.drawGeometry();r.moveLabelsToFront();const u=[...c].sort(((t,i)=>(X[t.scenarioType]||99)-(X[i.scenarioType]||99)));for(const t of u)t.series.drawLabels(this.dataFormatDigits,this.measureScale);const d=this.position.getColumnPositionY();this.scenariosArea={height:Math.max(e.height()+this.styles.padding.top,d)+this.styles.padding.bottom,width:e.width()+this.position.spacings.columnWidth}}drawAxisAndLabelsForLineChart(t,i){const s=this.createDateFactory(),h=i.group().id("AxisAndDateLabelsLine"),e=!1,n=t.length-1;!1===this.hideAxisLabels&&t.forEach(((i,r)=>{if(!this.shouldShowLineChartAxisLabel(t,r))return;let o,l=V.Top,a=this.position.spacings.labelToAxis;i.scenario1.value<0&&(l=V.Bottom,a*=-1),this.lineFullWidth&&this.availableWidth>0?this.axisLabelsMode===y.SMART?(o=s.getSmartDateString(i.date,this.dateInterval),0===r&&this.dateInterval!==S.YEAR&&(o=s.getShortDateString(i.date,this.dateInterval))):o=this.axisLabelsMode===y.SHORT?s.getShortDateString(i.date,this.dateInterval):s.getDateString(i.date,this.dateInterval):o=s.getShortDateString(i.date,this.dateInterval),new j(h,this.position.getColumnCenterPositionX(r),this.position.getAxisPositionY(e)+a,"",o,this.styles,l,V.Center).forceStringTypeDraw(),r>0&&r<n&&this.isYearChange(t,r)&&this.drawYearSeparatorLine(h,r,e)})),new J({scenarioType:this.axisScenario,labelText:this.title,isRelative:e},this.position,h).draw(),this.axisCategoryArea={height:h.height(),width:h.width()}}shouldShowLineChartAxisLabel(t,i){return!!(this.lineFullWidth&&this.availableWidth>0)||(0===i||i===t.length-1||this.isYearChange(t,i))}isYearChange(t,i){var s,h;if(0===i)return!1;const e=null===(s=t[i])||void 0===s?void 0:s.date,n=null===(h=t[i-1])||void 0===h?void 0:h.date;return!(!e||!n)&&e.year!==n.year}drawYearSeparatorLine(t,i,s){const h=this.position.getColumnCenterPositionX(i)-this.position.spacings.columnWidth/2,e=this.position.columnValue.max.getScaledUnit()+this.position.dataLabelHeight,n=this.position.getAxisPositionY(s)-e,r=this.position.getAxisPositionY(s);t.line([[h,n],[h,r]]).stroke({color:"#999999",width:1,dasharray:"4,4"}).attr("stroke-dasharray","4,4")}drawVarianceScenario(t,i){const s=i.group().id("Scenarios"),h=new at(this.position,s,this.styles,t.length,this.i18n);return h.setOverflowConfig(this.overflowConfig),t.forEach(((t,i)=>{t.type===ut.RELATIVE?h.createRelativeVarianceBar(t.scenario1,i).draw():h.createVarianceBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale)})),this.scenariosArea={height:s.height()+this.styles.padding.top+this.styles.padding.bottom,width:s.width()+this.position.spacings.columnWidth},s}drawStackedScenarios(t,i){if(!this.stackConfig)return;const s=i.group().id("StackedScenarios"),h=this.stackConfig.by===C.SCENARIOS;t.forEach(((t,i)=>{const e=["scenario1","scenario2","scenario3","scenario4"],n=[];if(h)for(const i of e){const s=t[i];s&&!s.isEmpty()&&null!=s.value&&n.push({value:s.value,scenario:s.scenario,dataPoint:s})}else{const i=t.scenario1;i&&!i.isEmpty()&&null!=i.value&&n.push({value:i.value,scenario:i.scenario,dataPoint:i})}if(0!==n.length)if((h?new Set(n.map((t=>a(t.scenario)))):new Set).size>1){const t=new Map;for(const i of n){const s=a(i.scenario);t.has(s)||t.set(s,[]),t.get(s).push(i)}const h=[];for(const i of c)t.has(i)&&(h.push({prefix:i,segments:t.get(i)}),t.delete(i));for(const[i,s]of t)h.push({prefix:i,segments:s});h.forEach(((t,e)=>{const n=t.segments.reduce(((t,i)=>t+Math.abs(i.value)),0),r=h.length-1-e;let o=0,l=null;t.segments.forEach((t=>{const h=new et(this.position,this.styles,t.dataPoint,i,o,t.scenario,r,this.stackConfig.mode,n,!0,s);h.draw(this.dataFormatDigits,this.measureScale),o+=Math.abs(t.value),l=h})),l&&l.drawTotalLabel(this.dataFormatDigits,this.measureScale)}))}else{"asc"===this.stackConfig.order?n.sort(((t,i)=>t.value-i.value)):"desc"===this.stackConfig.order&&n.sort(((t,i)=>i.value-t.value));const t=n.reduce(((t,i)=>t+Math.abs(i.value)),0);let e=0,r=null;n.forEach(((n,o)=>{const l=new et(this.position,this.styles,n.dataPoint,i,e,n.scenario,o,this.stackConfig.mode,t,h,s);l.draw(this.dataFormatDigits,this.measureScale),e+=Math.abs(n.value),r=l})),r&&r.drawTotalLabel(this.dataFormatDigits,this.measureScale)}})),this.scenariosArea={height:s.height()+this.styles.padding.top+this.styles.padding.bottom,width:s.width()+this.position.spacings.columnWidth}}drawStackedHeaders(t,i){if(!this.stackConfig||0===t.length)return;if(this.stackConfig.by!==C.SCENARIOS)return;const s=i.group().id("StackedHeaders"),h=t[0],e=["scenario1","scenario2","scenario3","scenario4"],n=[];for(const t of e){const i=h[t];i&&!i.isEmpty()&&null!=i.value&&n.push({value:i.value,scenario:i.scenario,dataPoint:i})}if(0===n.length)return;const r=new Set(n.map((t=>a(t.scenario)))),o=this.position.getColumnPositionY(),l=this.position.getColumnCenterPositionX(0)-this.position.getColumnWidth()/2-this.position.spacings.labelToColumn;if(r.size>1){const t=new Map;for(const i of n){const s=a(i.scenario);t.has(s)||t.set(s,[]),t.get(s).push(i)}const i=[];for(const s of c)t.has(s)&&(i.push({prefix:s,segments:t.get(s)}),t.delete(s));for(const[s,h]of t)i.push({prefix:s,segments:h});i.forEach((t=>{const i=t.segments.reduce(((t,i)=>t+Math.abs(i.value)),0),h=t.segments[0].dataPoint.pixelPerUnit,e=o-(this.stackConfig.mode===P.RELATIVE?h:i*h)/2,n=this.i18n.get(t.prefix+"1")||t.prefix.toUpperCase();new j(s,l,e,"STACK_HEADER",n,this.styles,V.Center,V.Right).forceStringTypeDraw()}))}else{"asc"===this.stackConfig.order?n.sort(((t,i)=>t.value-i.value)):"desc"===this.stackConfig.order&&n.sort(((t,i)=>i.value-t.value));const t=n.reduce(((t,i)=>t+Math.abs(i.value)),0),i=n[0].dataPoint.pixelPerUnit;let h=0;n.forEach((e=>{let n;n=this.stackConfig.mode===P.RELATIVE?(0!==t?Math.abs(e.value)/t:0)*i:Math.abs(e.value*i);const r=o-h-n/2,a=this.i18n.get(e.scenario)||e.scenario;new j(s,l,r,"STACK_HEADER",a,this.styles,V.Center,V.Right).forceStringTypeDraw(),h+=n}))}}drawStackedAreaScenarios(t,i){if(!this.stackConfig)return;const s=i.group().id("StackedAreaScenarios"),h=this.stackConfig.by===C.SCENARIOS,e=this.stackConfig.mode,n=["scenario1","scenario2","scenario3","scenario4"];if(0===(h?n.filter((i=>t.some((t=>t[i]&&!t[i].isEmpty())))).length:1))return;const r=[],o=[],l=[];for(const i of n)t.some((t=>t[i]&&!t[i].isEmpty()))&&l.push(i);for(let i=0;i<l.length;i++){const s=l[i],h=[];for(let n=0;n<t.length;n++){const o=t[n][s],a=o&&!o.isEmpty()&&null!=o.value?o.value:0,c=i>0?r[i-1][n]:0;if(e===P.RELATIVE){const i=l.reduce(((i,s)=>{const h=t[n][s];return i+(h&&!h.isEmpty()&&null!=h.value?Math.abs(h.value):0)}),0),s=0!==i?Math.abs(a)/i:0;h.push(c+s)}else h.push(c+a)}r.push(h);const n=t[0][s];o.push((null==n?void 0:n.scenario)||"ac1")}const a=this.position.getColumnPositionY(),c=this.pixelPerUnit,u=t=>t.map(((t,i)=>({x:this.position.getColumnCenterPositionX(i),y:a-t*c}))),d=t.map(((t,i)=>({x:this.position.getColumnCenterPositionX(i),y:a})));for(let t=0;t<r.length;t++){const i=u(r[t]),e=0===t?d:u(r[t-1]),n=new ot(s,i,e,h?o[t]:null,t,h);n.draw(),n.drawBoundaryLine()}this.scenariosArea={height:s.height()+this.styles.padding.top+this.styles.padding.bottom,width:s.width()+this.position.spacings.columnWidth}}drawOverlayLayer(t,i){const s=i.group().id("Overlay"),h=new at(this.position,s,this.styles,t.length,this.i18n);if(!0===this.showOverlayAvg){let i=null;const s=function(t){const i=t.reduce(((t,i)=>{var s;return t+((null===(s=i.scenario1)||void 0===s?void 0:s.value)||0)}),0),s=t.filter((t=>{var i;return void 0!==(null===(i=t.scenario1)||void 0===i?void 0:i.value)})).length,h=s>0?i/s:0,e=Object.assign(Object.assign({},t[0]),{scenario1:new z(h,t[0].scenario1.scenario,t[0].scenario1.pixelPerUnit,t[0].scenario1.variance)}),n=Object.assign(Object.assign({},t[t.length-1]),{scenario1:new z(h,t[t.length-1].scenario1.scenario,t[t.length-1].scenario1.pixelPerUnit,t[t.length-1].scenario1.variance)});return[e,...t.map((t=>Object.assign(Object.assign({},t),{scenario1:new z(h,t.scenario1.scenario,t.scenario1.pixelPerUnit,t.scenario1.variance)}))),n]}(t);s.forEach(((t,s)=>{null!=i&&h.createLine(`Ø ${this.i18n.get(t.scenario1.scenario)||t.scenario1.scenario}`,t.scenario1,i,s-1).draw(this.dataFormatDigits,this.measureScale),i=t.scenario1}))}if(!0===this.showOverlayMedian){let i=null;const s=function(t){const i=t.map((t=>{var i;return null===(i=t.scenario1)||void 0===i?void 0:i.value})).filter((t=>void 0!==t)).sort(((t,i)=>t-i)),s=i.length%2==0?(i[i.length/2-1]+i[i.length/2])/2:i[Math.floor(i.length/2)],h=Object.assign(Object.assign({},t[0]),{scenario1:new z(s,t[0].scenario1.scenario,t[0].scenario1.pixelPerUnit,t[0].scenario1.variance)}),e=Object.assign(Object.assign({},t[t.length-1]),{scenario1:new z(s,t[t.length-1].scenario1.scenario,t[t.length-1].scenario1.pixelPerUnit,t[t.length-1].scenario1.variance)});return[h,...t.map((t=>Object.assign(Object.assign({},t),{scenario1:new z(s,t.scenario1.scenario,t.scenario1.pixelPerUnit,t.scenario1.variance)}))),e]}(t);s.forEach(((t,s)=>{null!=i&&h.createLine(`Mdn ${this.i18n.get(t.scenario1.scenario)||t.scenario1.scenario}`,t.scenario1,i,s-1).draw(this.dataFormatDigits,this.measureScale),i=t.scenario1}))}}leftOuterJoinDates(t,i){const s=L.max(...t.map((function(t){return t.calcdate}))),h=L.min(...t.map((function(t){return t.calcdate}))),e=(new M).datesBetween(h,s,i,this.intervalSpanLimit),n=new Map;return e.forEach(((t,i)=>{n.set(t.toISO(),{id:i,calcdate:t,category:null,ac1:null,ac2:null,ac3:null,ac4:null,pp1:null,pp2:null,pp3:null,pp4:null,fc1:null,fc2:null,fc3:null,fc4:null,pl1:null,pl2:null,pl3:null,pl4:null,isEmpty:!0})})),t.forEach((t=>{const i=t.calcdate.toISO(),s=n.get(i);s&&s.isEmpty&&n.set(i,{id:s.id,calcdate:t.calcdate,category:t.category,ac1:t.ac1,ac2:t.ac2,ac3:t.ac3,ac4:t.ac4,pp1:t.pp1,pp2:t.pp2,pp3:t.pp3,pp4:t.pp4,fc1:t.fc1,fc2:t.fc2,fc3:t.fc3,fc4:t.fc4,pl1:t.pl1,pl2:t.pl2,pl3:t.pl3,pl4:t.pl4,isEmpty:!1})})),Array.from(n.values())}}class ft{constructor(t,i){this.data=t,this.scenarios=i,this.variances=[],this.title="",this.hideAxisLabels=!1,this.pixelPerUnit=10,this.pixelPerPercentage=50,this.limit=0,this.sortOrder=new A(new d).default(),this.level=O.CATEGORY,this.leftSideOffsetForHorizontalSync=-1,this.dateInterval=S.AUTO,this.axisLabelsMode=y.SMART,this.intervalSpanLimit=28,this.filter="",this.measureScale=new n,this.measureUnit="",this.showMeasureScale=!0,this.dataFormatDigits={decimal:1,percent:2},this.showOverlayMedian=!0,this.showOverlayAvg=!0,this.chartMode=k.BAR,this.maxBars=28,this.stackConfig=null,this.lineFullWidth=!0}}class pt{constructor(t,i,s,h,e){this.dataRowAdapter=t,this.orderAdapter=i,this.stringAdapter=s,this.dataFormatDigitsAdapter=h,this.dataSet=e}adapt(t){const i=x.adaptArray(t.data,this.dataRowAdapter),s=x.adaptArray(t.scenarios,this.stringAdapter),h=new ft(i,s);return m.isArray(t.variances)&&(h.variances=x.adaptArray(t.variances,this.stringAdapter)),m.isString(t.title)&&(h.title=t.title),m.isBoolean(t.hideAxisLabels)&&(h.hideAxisLabels=t.hideAxisLabels),m.isNumber(t.pixelPerUnit)&&(h.pixelPerUnit=t.pixelPerUnit),m.isNumber(t.pixelPerPercentage)&&(h.pixelPerPercentage=t.pixelPerPercentage),m.isNumber(t.limit)&&(h.limit=t.limit),m.isExisting(t.sortOrder)&&(h.sortOrder=this.orderAdapter.adapt(t.sortOrder)),m.isExisting(t.level)&&(h.level=t.level),m.isExisting(t.dateInterval)&&(h.dateInterval=t.dateInterval),m.isExisting(t.axisLabelsMode)&&(h.axisLabelsMode=t.axisLabelsMode),m.isNumber(t.leftSideOffsetForHorizontalSync)&&(h.leftSideOffsetForHorizontalSync=t.leftSideOffsetForHorizontalSync),m.isNumber(t.intervalSpanLimit)&&(h.intervalSpanLimit=t.intervalSpanLimit),m.isString(t.filter)&&(h.filter=t.filter),m.isExisting(t.measureScale)&&(h.measureScale=u.calculateMeasureScale(this.dataSet,h.scenarios,t.measureScale)),m.isString(t.measureUnit)&&(h.measureUnit=t.measureUnit),m.isBoolean(t.showMeasureScale)&&(h.showMeasureScale=t.showMeasureScale),m.isExisting(t.dataFormatDigits)&&(h.dataFormatDigits=this.dataFormatDigitsAdapter.adapt(t.dataFormatDigits)),m.isBoolean(t.showOverlayAvg)&&(h.showOverlayAvg=t.showOverlayAvg),m.isBoolean(t.showOverlayMedian)&&(h.showOverlayMedian=t.showOverlayMedian),m.isExisting(t.chartMode)&&(h.chartMode=t.chartMode),m.isNumber(t.maxBars)&&(h.maxBars=t.maxBars),m.isExisting(t.stackConfig)&&(h.stackConfig=t.stackConfig),m.isBoolean(t.lineFullWidth)&&(h.lineFullWidth=t.lineFullWidth),h}default(){return new ft([],[])}}const wt=class{constructor(i){t(this,i),this.data=[],this.scenarios=[],this.variances=[],this.hideAxisLabels=!1,this.pixelPerUnit=2,this.pixelPerPercentage=50,this.limit=0,this.leftSideOffsetForHorizontalSync=-1,this.i18n=new Map,this.order={hierarchy:[],direction:T.ASC},this.level=O.CATEGORY,this.dateInterval=S.AUTO,this.intervalSpanLimit=28,this.axisLabelsMode=y.SMART,this.filter="",this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.showOverlayMedian=!1,this.showOverlayAvg=!1,this.chartMode=k.BAR,this.maxBars=28,this.stackConfig=null,this.lineFullWidth=!0,this.containerWidth=0,this.dataFormatDigits={percent:2,decimal:1},this.parentDimensions={width:0,height:0}}render(){var t,h,e;if(void 0===this.chart)return i(s,null);if(this.chart.hasNoData()){const t=this.i18n.get("NO_DATA")||"==No Data==";return i(s,null,i("p",{class:"warning"},t))}return i(s,null,i("div",{innerHTML:null===(t=this.pattern)||void 0===t?void 0:t.toString(),class:"hidePatternContainer"}),i("div",{class:this.showMeasureScale?"footer":"footer-hide"},null===(h=this.chart)||void 0===h?void 0:h.getFooter()),i("div",{innerHTML:null===(e=this.chart)||void 0===e?void 0:e.toString()}))}async componentWillLoad(){var t;const i=this.prepareConfig(),s=this.prepareStyle(),h=this.containerWidth||0;this.chart=new dt(new o,i,s,h),this.chart.setI18n(this.i18n),this.autoFitScaling(i,s),this.chart.setAvailableHeight((null===(t=this.parentDimensions)||void 0===t?void 0:t.height)||0),this.pattern=new F(this.chart.styles),this.chart.setPattern("fc",this.pattern.getFCPolygonPattern())}async componentWillUpdate(){var t;if(null==this.chart)return;const i=this.prepareConfig(),s=this.prepareStyle();this.chart.setI18n(this.i18n),this.chart.setStyles(s),this.chart.setAvailableWidth(this.containerWidth||0),this.chart.setConfig(i),this.autoFitScaling(i,s),this.chart.setAvailableHeight((null===(t=this.parentDimensions)||void 0===t?void 0:t.height)||0),this.pattern=new F(this.chart.styles),this.chart.setPattern("fc",this.pattern.getFCPolygonPattern())}autoFitScaling(t,i){var s;if(t.pixelPerUnit>0)return;const h=null===(s=this.parentDimensions)||void 0===s?void 0:s.height,e=this.containerWidth||0;if(!h||h<=0)return t.pixelPerUnit=1,this.chart=new dt(new o,t,i,e),void this.chart.setI18n(this.i18n);t.pixelPerUnit=1,this.chart=new dt(new o,t,i,e),this.chart.setI18n(this.i18n),this.chart.toString();const n=this.chart.getAllocatedCanvasHeight();n<=0||(t.pixelPerUnit=.9*h/n,this.chart=new dt(new o,t,i,e),this.chart.setI18n(this.i18n))}async componentWillRender(){}componentDidLoad(){}componentDidUpdate(){}prepareConfig(){return new pt(new q,new A(new d),new d,new f,this.data).adapt({data:this.data,scenarios:this.scenarios,variances:this.variances,title:this.chartTitle,hideAxisLabels:this.hideAxisLabels,pixelPerUnit:this.pixelPerUnit,pixelPerPercentage:this.pixelPerPercentage,level:this.level,dateInterval:this.dateInterval,axisLabelsMode:this.axisLabelsMode,limit:this.limit,sortOrder:this.order,leftSideOffsetForHorizontalSync:this.leftSideOffsetForHorizontalSync,intervalSpanLimit:this.intervalSpanLimit,filter:this.filter,measureScale:this.measureScale,measureUnit:this.measureUnit,showMeasureScale:this.showMeasureScale,dataFormatDigits:this.dataFormatDigits,showOverlayMedian:this.showOverlayMedian,showOverlayAvg:this.showOverlayAvg,chartMode:this.chartMode,maxBars:this.maxBars,stackConfig:this.stackConfig,lineFullWidth:this.lineFullWidth})}prepareStyle(){return new Z(new Y,new p,new w(new v),new b(new v),new g).adapt(this.styles)}get element(){return h(this)}};wt.style=':host{position:relative;display:inline-block}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-default{stroke:black;stroke-width:0.1em}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.hide{opacity:0}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}';export{wt as ibcs_chart_time}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,h as t,H as e,g as s}from"./p-JNHhIe7t.js";import{v as a,a as r,i as n,b as o,c as l,d,e as h,f as p,g as c,h as u,j as v,k as g,w as m,l as y}from"./p-B7p8beYH.js";import{w as f,a as b,g as O,p as w}from"./p-79KuA4Ox.js";import{w as S}from"./p-CYjZRKdI.js";import{g as R}from"./p-B0lsgVuN.js";import{w as _}from"./p-BoMtoHJB.js";import{w as x}from"./p-tzFCK9qn.js";import{i as A,w as M}from"./p-Dnkv5rt8.js";import{O as L,a as T,D as E,A as C,S as I,b as U,c as N,C as k}from"./p-sRO-lj7X.js";import{F as W}from"./p-BDh7GfC5.js";var D;!function(i){i.ROWGROUP="rowGroup",i.ROWGROUPINDEX="rowGroupIndex",i.CATEGORY="category",i.CATEGORYINDEX="categoryIndex",i.SUBCATEGORY="subCategory",i.SUBCATEGORYINDEX="subCategoryIndex"}(D||(D={}));const j=class{validateScenario(i){const t="ERR_scenarios";if(A(i))return void this.errors.remove(t);const e=a(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(t)}validateVariances(i){const t="ERR_variances";if(A(i))return void this.errors.remove(t);const e=r(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(t)}validateLeftSync(i){const t="ERR_syncSpaceLeft";n(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"syncSpaceLeft: invalid value(s) '"+i+"' are not supported."})}validateLimit(i){const t="ERR_limit";o(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"limit: invalid value '"+(null==i?void 0:i.toString())+"' is not supported."})}validateUnitScaling(i){const t="ERR_unitScaling";n(i)||this.pixelPerUnitGroupMap.has(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"unitScaling: invalid value(s) '"+i+"' are not supported."})}validatePercentageScaling(i){const t="ERR_percentageScaling";n(i)||this.pixelPerUnitGroupMap.has(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"percentageScaling: invalid value(s) '"+i+"' are not supported."})}validateLevel(i){const t="ERR_level";l(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"level: invalid value(s) '"+i+"' are not supported."})}validateOrderList(i){const t="ERR_order";if(A(i))return void this.errors.remove(t);const e=d(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(t)}validateOrderDirection(i){const t="ERR_orderDirection";A(i)||h(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"orderDirection: invalid value '"+(null==i?void 0:i.toString())+"' is not supported."})}validateDateInterval(i){const t="ERR_dateInterval";p(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"dateInterval: invalid value '"+(null==i?void 0:i.toString())+"' is not supported."})}validateChartMode(i){const t="ERR_chartMode";["bar","line","auto"].includes(null==i?void 0:i.toLowerCase())?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"chartMode: invalid value '"+(null==i?void 0:i.toString())+"' is not supported. Valid values are: bar, line, auto."})}validateMaxBars(i){const t="ERR_maxBars";!o(i)||i<1?this.errors.addOrReplace({id:t,type:"warning",message:"maxBars: invalid value '"+(null==i?void 0:i.toString())+"' is not supported. Must be a positive integer."}):this.errors.remove(t)}validateStack(i){const t="ERR_stack",e=c(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:e.join("; ")}):this.errors.remove(t)}validateScaling(i){if(null==i||""===i||"none"===i||"auto"===i)return void this.errors.remove("ERR_scale");const t=Number(i);isNaN(t)||t<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${i}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}validateAxisLabelsMode(i){const t="ERR_axisLabelsMode";u(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"axisLabelsMode: invalid value '"+(null==i?void 0:i.toString())+"' is not supported."})}validateLineFullWidth(i){const t="ERR_lineFullWidth";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"lineFullWidth: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."})}validateShowCategories(i){const t="ERR_showCategories";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showCategories: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."})}validateMeasureScale(i){const t="ERR_measureScale";g(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"measureScale: invalid value '"+(null==i?void 0:i.toString())+"' is not supported."})}validateShowMeasureScale(i){const t="ERR_grouped";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."})}validateShowOverlayAvg(i){const t="ERR_grouped";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showOverlayAvg: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."})}validateShowOverlayMedian(i){const t="ERR_grouped";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showOverlayMedian: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."})}constructor(t){i(this,t),this.data=[],this.datasetMeta=null,this.appliedScaleFactor=1,this.chartTitle="",this.filter="",this.syncSpaceLeft=-1,this.limit=0,this.chartMode="bar",this.maxBars=28,this.stack="",this.intervalSpanLimit=28,this.lineFullWidth="true",this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.showOverlayAvg="true",this.showOverlayMedian="false",this.measureUnit="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,m(this),S(this),f(this,((i,t)=>{this.data=t||[]}),((i,t)=>{this.datasetMeta=t})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=x(this),this.componentStyle=_(this),this.t=b(this).t,this.resolveInherited=M(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}])}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLimit(this.limit),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateLeftSync(this.syncSpaceLeft),this.validateDateInterval(this.dateInterval),this.validateAxisLabelsMode(this.axisLabelsMode),this.validateLineFullWidth(this.lineFullWidth),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateShowOverlayAvg(this.showOverlayAvg),this.validateShowOverlayMedian(this.showOverlayMedian),this.validateChartMode(this.chartMode),this.validateMaxBars(this.maxBars),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){var i,t;const{mode:e}=w(this.scale);if("auto"!==e&&"empty"!==e){this._autoScaleGuard=!1;const i=O(this.element),t="WARN_overflow";return void(i.width>0&&this.element.scrollWidth>i.width+1?this.errors.addOrReplace({id:t,type:"warning",message:"Chart exceeds available space and will be cut off. Check unit-scaling value."}):this.errors.remove(t))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const s=this.element,{width:a}=O(s);if(a<=0)return;const r=this.componentStyle((i=>{var t;return(null===(t=i.global)||void 0===t?void 0:t.fontSizePx)||13.3333}));s.style.setProperty("--bn-font-size",`${r}px`);const n=null===(i=s.shadowRoot)||void 0===i?void 0:i.querySelector(".container"),o=null!==(t=null==n?void 0:n.scrollWidth)&&void 0!==t?t:s.scrollWidth;if(o<=a+1)return this.errors.remove("AUTO_scale"),void(1!==this.appliedScaleFactor&&(this._autoScaleGuard=!0,this.appliedScaleFactor=1));const l=(a-1)/o;s.style.setProperty("--bn-font-size",r*l+"px"),"empty"===e?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${l.toFixed(3)}`}):this.errors.remove("AUTO_scale"),Math.abs(l-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,this.appliedScaleFactor=l)}prepareDimension(){const i=O(this.element),t=this.prepareScenarios(),e=this.prepareVariances();return this.canvasWidthSegmented=i.width/(t.length+e.length||1),{width:this.canvasWidthSegmented,height:i.height}}prepareScenarios(){var i,t,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(void 0!==a)return this.errors.remove("AUTO_scenarios"),a.split(",").map((i=>i.trim()));const r="auto"===(null===(i=this.scenarios)||void 0===i?void 0:i.trim().toLowerCase());return y(this.scenarios)||r?(null===(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)||void 0===e?void 0:e.length)>0?(r?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:`scenarios: not set, auto-detected: ${this.datasetMeta.availableScenarios.join(",")}`}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((i=>i.trim())))}prepareAvg(){return"true"===this.showOverlayAvg}prepareMedian(){return"true"===this.showOverlayMedian}prepareVariances(){var i;const t=this.resolveInherited("variances",this.variances);return void 0!==t?t.split(",").map((i=>i.trim())):y(this.variances)?[]:null===(i=this.variances)||void 0===i?void 0:i.split(",").map((i=>i.trim()))}prepareHideAxisLabels(i){return i>=1||"true"!==this.showCategories}prepareI18n(){const i=R,t=new Map([].map((i=>[i,this.t(".".concat(i))]))),e=new Map(i.map((i=>[i,this.t("global.".concat(i))])));return new Map([...e.entries(),...t.entries()])}preparePixelPerUnit(){var i;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(i=this.unitScaling)||void 0===i?void 0:i.toString().trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const t=Number(this.unitScaling);return!isNaN(t)&&t>0?(this.errors.remove("AUTO_unitScaling"),t):(this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:"unit-scaling: not set, auto-calculated to fit available space."}),0)}preparePixelPerPercentage(){return this.pixelPerUnitGroupMap.has(this.percentageScaling)?this.pixelPerUnitGroupMap.get(this.percentageScaling):100*Number(this.percentageScaling)}prepareLevel(){var i,t,e;const s="auto"===(null===(i=this.level)||void 0===i?void 0:i.trim().toLowerCase());return y(this.level)||s?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:`level: not set, auto-detected: ${this.datasetMeta.suggestedLevel}`}),D[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),D[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var i,t,e;const s=this.resolveInherited("order",this.order),a=this.resolveInherited("orderDirection",this.orderDirection),r=null!=s?s:this.order,n=null!=a?a:this.orderDirection;let o=(y(this.level)||"auto"===(null===(i=this.level)||void 0===i?void 0:i.trim().toLowerCase()))&&(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedLevel)?this.datasetMeta.suggestedLevel:this.level;const l="auto"===(null==r?void 0:r.trim().toLowerCase());return y(r)||l?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel)&&(l?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:`order: not set, auto-detected: ${o}`})):(this.errors.remove("AUTO_order"),"levelindex"===(null==r?void 0:r.toLocaleLowerCase())&&(o+="Index")),{hierarchy:[T[null==o?void 0:o.toUpperCase()]],direction:L[null==n?void 0:n.toUpperCase()]}}prepareStyle(){const i=this.getEffectiveScaleFactor();return this.componentStyle((t=>{const e=t.global.fontSizePx*i;return{scaleFactors:{scenarioOffset:t["bn-chart-time"].scaleFactors.scenarioOffset,scenarioLabelToColumn:t["bn-chart-time"].scaleFactors.scenarioLabelToColumn,labelToColumn:.3,labelToColum:t["bn-chart-time"].scaleFactors.labelToColum,labelToAxis:t["bn-chart-time"].scaleFactors.labelToAxis,needleWidth:t["bn-chart-time"].scaleFactors.needleWidth,needleHeadWidth:t["bn-chart-time"].scaleFactors.needleHeadWidth,columnWidth:t["bn-chart-time"].scaleFactors.columnWidth,varianceAxisLineWidth:t["bn-chart-time"].scaleFactors.varianceAxisLineWidth,axisLineWidth:t["bn-chart-time"].scaleFactors.axisLineWidth,auxiliaryLineWidth:t["bn-chart-time"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:t["bn-chart-time"].scaleFactors.scenarioLineWidth,markerWidth:t["bn-chart-time"].scaleFactors.markerWidth,markerOffset:t["bn-chart-time"].scaleFactors.markerOffset,categoryWidth:t["bn-chart-time"].scaleFactors.categoryWidth,axisTickLength:t["bn-chart-time"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${t.global.fontFamily}`,size:e,color:t.global.fontColor,background:t.global.fontBackgroundColor,leading:1.8},axisStyles:t["bn-chart-time"].axisStyles,barStyles:t["bn-chart-time"].barStyles,varianceStyles:t["bn-chart-time"].varianceStyles,stackColors:t["bn-chart-time"].stackColors,padding:t["bn-chart-time"].padding,pattern:null}}))}prepareLeftSideOffset(i,t){return this.syncSpaceLeft>-1?this.syncSpaceLeft:W.getMaxWidthOfArrayItems([...this.prepareVariances(),...this.prepareScenarios(),this.chartTitle],i,t)}prepareChartTitle(i){return i>=1?"":this.chartTitle}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareDateInterval(){var i,t,e;const s="auto"===(null===(i=this.dateInterval)||void 0===i?void 0:i.trim().toLowerCase());return y(this.dateInterval)||s?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedDateInterval)?(s?this.errors.remove("AUTO_dateInterval"):this.errors.addOrReplace({id:"AUTO_dateInterval",type:"warning",message:`dateInterval: not set, auto-detected: ${this.datasetMeta.suggestedDateInterval}`}),E[this.datasetMeta.suggestedDateInterval.toUpperCase()]):s?E.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),E[null===(e=this.dateInterval)||void 0===e?void 0:e.toUpperCase()])}prepareIntervalSpanLimit(){return this.intervalSpanLimit}prepareAxisLabelsMode(){var i;return C[null===(i=this.axisLabelsMode)||void 0===i?void 0:i.toUpperCase()]}prepareFilter(){return 0===this.filter.length?"":this.filter}getDataStructure(){return{ITimeChartDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return y(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(i){return 0===i&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareStackConfig(){if(y(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const i=JSON.parse(this.stack),t=i.by,e="WARN_stack_dimensions_scenarios";if(t===I.DIMENSIONS){const i=this.prepareScenarios();i.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${i[0]}" is used, the rest (${i.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:t,mode:i.mode||N.ABSOLUTE,order:i.order||U.DATASET}}catch(i){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareLineFullWidth(){return"true"===this.lineFullWidth}prepareChartMode(){var i;const t=null===(i=this.chartMode)||void 0===i?void 0:i.toLowerCase();return"line"===t?k.LINE:"auto"===t?k.AUTO:k.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(i,e){const s=this.prepareI18n(),a=this.prepareStyle(),r=O(this.element).width,n=this.getEffectiveScaleFactor(),o=this.preparePixelPerUnit(),l=this.preparePixelPerPercentage(),d=this.prepareStackConfig(),h=this.prepareScenarios(),p=(null==d?void 0:d.by)===I.DIMENSIONS?h.slice(0,1):h;return t("ibcs-chart-time",{data:this.data,chartTitle:this.prepareChartTitle(e),scenarios:p,variances:[i],hideAxisLabels:this.prepareHideAxisLabels(e),pixelPerUnit:o>0?o*n:0,pixelPerPercentage:l>0?l*n:0,limit:this.prepareLimit(),leftSideOffsetForHorizontalSync:this.prepareLeftSideOffset(s,a),styles:a,i18n:s,order:this.prepareOrder(),level:this.prepareLevel(),dateInterval:this.prepareDateInterval(),intervalSpanLimit:this.prepareIntervalSpanLimit(),axisLabelsMode:this.prepareAxisLabelsMode(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showOverlayAvg:this.prepareAvg(),showOverlayMedian:this.prepareMedian(),showMeasureScale:this.prepareShowMeasureScale(e),chartMode:this.prepareChartMode(),maxBars:this.prepareMaxBars(),stackConfig:d,lineFullWidth:this.prepareLineFullWidth(),containerWidth:r,parentDimensions:this.prepareDimension()})}getEffectiveScaleFactor(){const{mode:i,factor:t}=w(this.scale);return"factor"===i?t:"auto"===i||"empty"===i?this.appliedScaleFactor:1}getFontStyles(){const i=this.getEffectiveScaleFactor();return this.componentStyle((t=>{var e,s,a,r;const n=(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=t.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*i+"px","--bn-font-color":(null===(a=t.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let i=[""];const s=this.prepareVariances();s.length>0&&(i=[...i,...s]);const a=this.getFontStyles();return t(e,{key:"d0625657fc6ddbacf7ad5c4cede189cc321109e1",style:a},t("div",{key:"393a0c8b00028b3edd08d6e199ffe55014251a5d",class:"container"},i.map(this.chartTemplate)))}get element(){return s(this)}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian:0}]}}};j.style=":host{display:inline-block;position:relative;overflow:visible;}.container{display:flex;flex-direction:column-reverse}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}";export{j as bn_chart_time}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,h as t,H as s,g as r}from"./p-JNHhIe7t.js";import{w as n}from"./p-CYjZRKdI.js";import{w as e}from"./p-BoMtoHJB.js";import{w as i}from"./p-tzFCK9qn.js";import"./p-B0lsgVuN.js";const a=class{constructor(t){o(this,t),n(this),this.errors=i(this),this.componentStyle=e(this)}render(){return t(s,{key:"92bcbc010336d3a542c86e182831bbfddda2aa9b",style:this.prepareStyle()},t("slot",{key:"d836aa5443283df158dcb50345aee0df97f74a6e"}))}prepareStyle(){return{"font-family":this.componentStyle((o=>o.global.fontFamily)),"font-size":`${this.componentStyle((o=>o.global.fontSizePx))}px`,"--bn-font-family":this.componentStyle((o=>o.global.fontFamily))||"'Noto Sans', sans-serif","--bn-font-size":`${this.componentStyle((o=>o.global.fontSizePx))||13.3333}px`,"--bn-font-color":this.componentStyle((o=>o.global.fontColor))||"#000000","--bn-font-background":this.componentStyle((o=>o.global.fontBackgroundColor))||"#ffffff"}}get element(){return r(this)}};a.style=':host{display:flex;flex-direction:column;justify-content:space-between;padding:0.25em;margin:0.5em;background-origin:content-box;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}:host(.border){box-sizing:border-box;-webkit-box-sizing:border-box;border:0.1em solid #ddd}div{color:var(--bn-font-color, black)}';export{a as bn_card}
|