@bino-bi/bn-template-engine 1.0.0-next.39 → 1.0.0-next.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/p-2dd69cb9.entry.js +1 -0
- package/dist/bn-template-engine/{p-9a61f59d.entry.js → p-8b28c9bd.entry.js} +1 -1
- package/dist/bn-template-engine/{p-DyupX-Z-.js → p-BjozxTTW.js} +1 -1
- package/dist/bn-template-engine/p-EcC0qLtU.js +1 -0
- package/dist/bn-template-engine/{p-eea538f1.entry.js → p-a4b76176.entry.js} +1 -1
- package/dist/bn-template-engine/{p-93b8387f.entry.js → p-ce764078.entry.js} +1 -1
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +785 -378
- package/dist/cjs/bn-grid.cjs.entry.js +1 -1
- package/dist/cjs/bn-image.cjs.entry.js +1 -1
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{withStyled-DfE0aW7D.js → withStyled-BZb6snOx.js} +74 -0
- package/dist/cjs/{withTranslation-0gkn9xoC.js → withTranslation-FxXGUB3H.js} +1 -1
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +4 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +3 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Label.js +3 -1
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.css +25 -1
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +156 -11
- package/dist/collection/components/bn-table/bn-table.js +134 -5
- package/dist/collection/components/bn-table/utils/elements/Cell.js +10 -1
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +25 -10
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +50 -12
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +44 -14
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +63 -2
- package/dist/collection/components/bn-table/utils/helper/WaterfallCalculator.js +123 -11
- package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +57 -9
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +16 -1
- package/dist/collection/components/bn-table/utils/model/index.js +6 -0
- package/dist/collection/utils/validate.js +4 -0
- package/dist/components/bn-chart-bubble-renderer.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter-renderer.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure-renderer.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time-renderer.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-page.js +1 -1
- package/dist/components/bn-table-renderer.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/p-1B_s8oPY.js +1 -0
- package/dist/components/{p-BqUB56k1.js → p-B4L069XF.js} +1 -1
- package/dist/components/p-BZXiWkDS.js +1 -0
- package/dist/components/p-BiSytXUy.js +1 -0
- package/dist/components/p-Bn7J1pgl.js +1 -0
- package/dist/components/{p-BmOWXYHF.js → p-CEf5X8MZ.js} +1 -1
- package/dist/components/p-CGySoYRH.js +1 -0
- package/dist/components/{p-Cyf5ZEXs.js → p-CUSAlS2o.js} +1 -1
- package/dist/components/p-CvEdUq8i.js +1 -0
- package/dist/components/{p-OquycEMA.js → p-D40Am1Ap.js} +1 -1
- package/dist/components/{p-B4Cf0cVi.js → p-DM4Up10X.js} +1 -1
- package/dist/components/{p-Bo_R7f_T.js → p-DwuXVo2h.js} +1 -1
- package/dist/components/{p-DTmqMQpw.js → p-Y9bth2Y_.js} +1 -1
- package/dist/components/{p-BU_53KVT.js → p-xIWChKGS.js} +1 -1
- package/dist/esm/bn-annotation-layer_30.entry.js +903 -496
- package/dist/esm/bn-grid.entry.js +1 -1
- package/dist/esm/bn-image.entry.js +1 -1
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-text.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{withStyled-CIoJ86RM.js → withStyled-CzzXg64f.js} +77 -4
- package/dist/esm/{withTranslation-BX9T3dfm.js → withTranslation-Daq2JXkv.js} +1 -1
- package/dist/types/components/bn-table/bn-table-renderer/bn-table-renderer.d.ts +20 -1
- package/dist/types/components/bn-table/bn-table.d.ts +49 -1
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +3 -0
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +26 -0
- package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +22 -2
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +13 -0
- package/dist/types/components/bn-table/utils/helper/WaterfallCalculator.d.ts +30 -2
- package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +24 -4
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +7 -1
- package/dist/types/components/bn-table/utils/model/index.d.ts +5 -0
- package/dist/types/components.d.ts +49 -4
- package/dist/types/utils/validate.d.ts +1 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-8c84d57e.entry.js +0 -1
- package/dist/bn-template-engine/p-BVU4bIsi.js +0 -1
- package/dist/components/p-BsJOvfIg.js +0 -1
- package/dist/components/p-DCPLGEs_.js +0 -1
- package/dist/components/p-DT04Cka0.js +0 -1
- package/dist/components/p-Dm6EAaJ9.js +0 -1
- package/dist/components/p-dRPJiQB6.js +0 -1
- package/dist/components/p-tkB96Ena.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as t,f as e}from"./p-CCZcKl0Q.js";import{g as n,r,c as s,D as a}from"./p-D0tNATZq.js";const i=t=>{if("object"==typeof t&&null!==t){if("function"==typeof Object.getPrototypeOf){const e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}return"[object Object]"===Object.prototype.toString.call(t)}return!1},o=(t,e)=>e,c=(t,e)=>[...new Set([...t,...e])],u=(t,e)=>{const n=(t=>{return{arrayMergeType:"combine",arrayMerge:(e=t?t.arrayMergeType:"combine","overwrite"===e?o:c),...t};var e})(e);return t.reduce(((t,e)=>(Object.keys(e).forEach((r=>{Array.isArray(t[r])&&Array.isArray(e[r])?n&&n.arrayMerge&&(t[r]=n.arrayMerge(t[r],e[r])):t[r]=i(t[r])&&i(e[r])?u([t[r],e[r]],n):e[r]})),t)),{})},l=a=>{let i,o,c,l;const f=()=>{const t=o.componentStyles.state;l=u([t._system||{},t._default||{},t[c]||{}],{arrayMergeType:"overwrite"})},d=a.connectedCallback;a.connectedCallback=()=>{const s=t(a);o=n(s),l=o.componentStyles.state._system,c=a.selectedStyle,f(),i=o.componentStyles.on("set",(n=>{n!==c&&"_default"!==n||(c=a.selectedStyle,f(),e(t(a)))})),r(d,a)};const h=a.disconnectedCallback;return a.disconnectedCallback=()=>{r(i),s(t(a)),r(h,a)},t=>(void 0!==o&&a.selectedStyle!==c&&(c=a.selectedStyle,f()),t(l))};var f,d,h,m,y,p,b,v;!function(t){t.ALL="all",t.META="meta"}(f||(f={})),function(t){t.CURRENCY="currency",t.VOLUME="volume"}(d||(d={})),function(t){t.AC1="ac1",t.AC2="ac2",t.AC3="ac3",t.AC4="ac4",t.PP1="pp1",t.PP2="pp2",t.PP3="pp3",t.PP4="pp4",t.FC1="fc1",t.FC2="fc2",t.FC3="fc3",t.FC4="fc4",t.PL1="pl1",t.PL2="pl2",t.PL3="pl3",t.PL4="pl4"}(h||(h={})),function(t){t.POS="pos",t.NEG="neg",t.NEU="neu",t.OP="op",t.OPINV="opinv"}(m||(m={})),function(t){t.DECIMAL="decimal",t.PERCENT="percent"}(y||(y={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(p||(p={})),function(t){t.INF="inf",t.W100="w100",t.W50="w50",t.W25="w25",t.W20="w20",t.W15="w15",t.W10="w10",t.W5="w5"}(b||(b={})),function(t){t.W5="w5",t.W10="w10",t.W15="w15",t.W20="w20",t.W25="w25",t.W30="w30",t.W40="w40",t.W60="w60",t.W80="w80",t.W100="w100"}(v||(v={}));const g={[v.W5]:5,[v.W10]:10,[v.W15]:15,[v.W20]:20,[v.W25]:25,[v.W30]:30,[v.W40]:40,[v.W60]:60,[v.W80]:80,[v.W100]:100};var w,N,k,S,O,D;!function(t){t.ROWGROUP="rowGroup",t.ROWGROUPINDEX="rowGroupIndex",t.CATEGORY="category",t.CATEGORYINDEX="categoryIndex",t.SUBCATEGORY="subCategory",t.SUBCATEGORYINDEX="subCategoryIndex"}(w||(w={})),function(t){t.SMART="smart",t.LONG="long",t.SHORT="short"}(N||(N={})),function(t){t.COLUMN="column",t.LINE="line",t.WATERFALL="waterfall"}(k||(k={})),function(t){t.BAR="bar",t.LINE="line",t.AUTO="auto"}(S||(S={})),function(t){t.SCENARIOS="scenarios",t.DIMENSIONS="dimensions"}(O||(O={})),function(t){t.ABSOLUTE="absolute",t.RELATIVE="relative",t.ABSOLUTE_RELATIVE="absolute-relative"}(D||(D={}));const T=100;var A;!function(t){t.ASC="asc",t.DESC="desc",t.DATASET="dataset"}(A||(A={}));const M=/^\s*(set|first|last|min|max|avg|sum|lit)\(\s*(.*?)\s*\)\s*$/,j=/^[A-Za-z_][A-Za-z0-9_]*$/,$=["min","max","avg","sum"];class J{constructor(t,e,n,r){this.label=t,this.alias=e,this.fn=n,this.arg=r}get isNumeric(){return $.includes(this.fn)}}function F(t){if("string"!=typeof t)return!1;const e=M.exec(t);if(!e)return!1;const[,n,r]=e;return"lit"===n?r.length>0:j.test(r)}function E(t,e,n){if(!F(n))return null;const[,r,s]=M.exec(n);return new J(t,e,r,s)}var L,I,W,_;!function(t){t.YEAR="year",t.QUARTER="quarter",t.MONTH="month",t.WEEK="week",t.DAY="day",t.HOUR="hour",t.MINUTE="minute",t.SECOND="second",t.MILLISECOND="millisecond",t.NONE="fallback",t.AUTO="auto"}(L||(L={})),function(t){t.AVG="avg",t.INTERVAL="interval",t.START="start",t.END="end",t.YTD="ytd",t.YTG="ytg",t.CUM="cum",t.MAT="mat",t.NONE="none",t.AUTO="auto"}(I||(I={}));class x{constructor(){this._dateFormat={year:"yyyy",quarter:"q'Q' yyyy",month:"LLL yyyy",week:"'KW'WW kkkk",day:"dd.MM.yyyy",hour:"TT",minute:"TT",second:"TT",millisecond:"TT:SSS",fallback:"dd.MM.yyyy"},this._dateFormatShort={year:"yy",quarter:"q'Q'",month:"LLL",week:"'KW'WW",day:"dd",hour:"hh'h'",minute:"mm'm'",second:"ss's'",millisecond:"SSS'ms'",fallback:"dd.MM.yyyy"},this._dateLinkFormat={avg:"Ø[LINK]",interval:"[DATE]..[DATE2]",start:".[DATE]",end:"[DATE].",ytd:"_[DATE]",ytg:"[DATE]_",cum:"[DATE]_[DATE2]",mat:"~[DATE]",none:"[DATE]"},this.locale="de",this.dateFormatPinned=!1,this.dateFormatShortPinned=!1,this.dateFormat=this._dateFormat,this.dateLinkFormat=this._dateLinkFormat,this.dateFormatShort=this._dateFormatShort}setDateLinkFormat(t){this.dateLinkFormat=t}setDateFormat(t){this.dateFormat=t,this.dateFormatPinned=!0}setDateFormatShort(t){this.dateFormatShort=t,this.dateFormatShortPinned=!0}setLocale(t){this.locale=t,this.dateFormatPinned||(this.dateFormat=Object.assign(Object.assign({},this._dateFormat),x.LOCALE_DATE_FORMAT[t]||{})),this.dateFormatShortPinned||(this.dateFormatShort=Object.assign(Object.assign({},this._dateFormatShort),x.LOCALE_DATE_FORMAT_SHORT[t]||{}))}getDateString(t,e){return t.setLocale(this.locale).toFormat(this.dateFormat[e]||this.dateFormat.fallback)}getSmartDateString(t,e){switch(e){case L.DAY:return this.getFormatedDayDate(t);case L.MONTH:return this.getFormatedMonthDate(t);case L.QUARTER:return this.getFormatedQuarterDate(t);case L.WEEK:return this.getFormatedWeekDate(t);case L.HOUR:return this.getFormatedHourDate(t);case L.MINUTE:return this.getFormatedMinuteDate(t);case L.SECOND:return this.getFormatedSecondDate(t);case L.MILLISECOND:return this.getFormatedMilliSecondDate(t);default:return this.getDateString(t,e)}}calculateDistanceType(t,e,n=32){if(null==e)return L.DAY;const r="number"==typeof t?a.fromMillis(t):t,s="number"==typeof e?a.fromMillis(e):e;return 0===s.diff(r).as("milliseconds")?L.DAY:s.diff(r).as("milliseconds")<n?L.MILLISECOND:s.diff(r).as("seconds")<n?L.SECOND:s.diff(r).as("minutes")<n?L.MINUTE:s.diff(r).as("hours")<n?L.HOUR:s.diff(r).as("days")<n?L.DAY:s.diff(r).as("weeks")<n?L.WEEK:s.diff(r).as("months")<n?L.MONTH:s.diff(r).as("quarters")<n?L.QUARTER:L.YEAR}datesBetween(t,e,n){const r=this.convertDateDistanceToMomentunitOfTime(n),s=t.startOf(r),a=e.endOf(r),i=[];let o=s;do{i.push(o),o=o.plus(this.createDiratonLike(r,1))}while(o<=a);return i}countBetween(t,e,n){const r=this.convertDateDistanceToMomentunitOfTime(n);return Math.floor(e.startOf(r).diff(t.startOf(r),r).as(r))+1}getDateLinkString(t,e,n,r,s){if(null==t&&null==e)return"";if(null==t&&n!==I.END&&n!==I.YTD)return"";if(null==e&&(I.INTERVAL===n||I.CUM===n||I.END===n||I.YTD===n))return"";const i=t||a.now(),o=e;r===L.AUTO&&(r=this.calculateDistanceType(i,o,s));let c=this.getDateString(i,r),u="",l=I.NONE;return null!=o&&(u=this.getDateString(o,r),l=I.INTERVAL,c===u&&n===I.INTERVAL&&(n=I.NONE),c===u&&n===I.AVG&&(l=I.NONE),I.END!==n&&I.YTD!==n||(c=u),n!==I.INTERVAL&&n!==I.CUM&&n!==I.AVG||(r===L.QUARTER?i.quarter===o.quarter&&i.year===o.year?u=u.replace(" "+o.year,""):i.year===o.year&&(c=c.replace(" "+i.year,"")):r===L.MONTH?i.month===o.month&&i.year===o.year?u=u.replace(" "+o.year,""):i.year===o.year&&(c=c.replace(" "+i.year,"")):r===L.WEEK&&(i.weekNumber===o.weekNumber&&i.weekYear===o.weekYear?u=u.replace(" "+o.weekYear,""):i.weekYear===o.weekYear&&(c=c.replace(" "+i.weekYear,""))))),this.dateLinkFormat[n].replace("[LINK]",this.dateLinkFormat[l]).replace("[DATE]",c).replace("[DATE2]",u)}getShortDateString(t,e){return t.setLocale(this.locale).toFormat(this.dateFormatShort[e]||this.dateFormatShort.fallback)}getFormatedDayDate(t){let e=this.dateFormatShort.day;return this.isFirstInMonth(t)&&(e+=" "+this.dateFormatShort.month),this.isJanuary(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedMonthDate(t){let e=this.dateFormatShort.month;return this.isJanuary(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedQuarterDate(t){let e=this.dateFormatShort.quarter;return this.isFirstQuarter(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedWeekDate(t){let e=this.dateFormatShort.week;return this.isFirstWeek(t)&&(e+=" kk"),t.setLocale(this.locale).toFormat(e)}getFormatedHourDate(t){let e=this.dateFormatShort.hour;return this.isFirstHour(t)&&(e+=" "+this.dateFormatShort.day),t.setLocale(this.locale).toFormat(e)}getFormatedMinuteDate(t){let e=this.dateFormatShort.minute;return this.isFirstMinute(t)&&(e=this.dateFormatShort.hour+":"+e),t.setLocale(this.locale).toFormat(e)}getFormatedSecondDate(t){let e=this.dateFormatShort.second;return this.isFirstSecond(t)&&(e=this.dateFormatShort.minute+":"+e),t.setLocale(this.locale).toFormat(e)}getFormatedMilliSecondDate(t){let e=this.dateFormatShort.millisecond;return this.isFirstMilliSecond(t)&&(e=this.dateFormatShort.second+":"+e),t.setLocale(this.locale).toFormat(e)}isFirstInMonth(t){return 1===t.day}isJanuary(t){return 1===t.month}isFirstQuarter(t){return 1===t.quarter}isFirstWeek(t){return 1===t.weekNumber}isFirstHour(t){return 0===t.hour}isFirstMinute(t){return 0===t.minute}isFirstSecond(t){return 0===t.second}isFirstMilliSecond(t){return 0===t.millisecond}convertDateDistanceToMomentunitOfTime(t){let e;switch(t){case L.YEAR:e="year";break;case L.MONTH:e="month";break;case L.QUARTER:e="quarter";break;case L.WEEK:e="week";break;case L.DAY:e="day";break;case L.HOUR:e="hour";break;case L.MINUTE:e="minute";break;case L.SECOND:e="second";break;case L.MILLISECOND:e="millisecond";break;default:e="day"}return e}createDiratonLike(t,e){switch(t){case"year":return{years:e};case"month":return{months:e};case"quarter":return{quarters:e};case"week":return{weeks:e};case"day":default:return{days:e};case"hour":return{hours:e};case"minute":return{minutes:e};case"second":return{seconds:e};case"millisecond":return{milliseconds:e}}}}x.LOCALE_DATE_FORMAT={en:{week:"'W'WW kkkk",day:"MM/dd/yyyy",fallback:"MM/dd/yyyy"}},x.LOCALE_DATE_FORMAT_SHORT={en:{week:"'W'WW",fallback:"MM/dd/yyyy"}};class q{static isExisting(t){return null!=t}static isString(t){return"string"==typeof t}static isNumber(t){return"number"==typeof t&&!Number.isNaN(t)}static isBoolean(t){return"boolean"==typeof t}static isArray(t){return Array.isArray(t)}static isObject(t){return"object"==typeof t&&null!==t}static isOperator(t){return"+"===t||"-"===t}static isDate(t){return t instanceof a&&t.isValid}}class C{static adaptDefaultString(t){return q.isString(t)?t.trim():""}static adaptArray(t,e){const n=[];return q.isArray(t)&&t.forEach((t=>{n.push(e.adapt(t))})),n}}!function(t){t.ASC="asc",t.DESC="desc"}(W||(W={})),function(t){t.ROWGROUP="rowGroup",t.ROWGROUPINDEX="rowGroupIndex",t.CATEGORY="category",t.CATEGORYINDEX="categoryIndex",t.SUBCATEGORY="subCategory",t.SUBCATEGORYINDEX="subCategoryIndex",t.AC1="ac1",t.AC2="ac2",t.AC3="ac3",t.AC4="ac4",t.PP1="pp1",t.PP2="pp2",t.PP3="pp3",t.PP4="pp4",t.FC1="fc1",t.FC2="fc2",t.FC3="fc3",t.FC4="fc4",t.PL1="pl1",t.PL2="pl2",t.PL3="pl3",t.PL4="pl4"}(_||(_={}));class G{constructor(t=["category"],e=W.ASC){this.hierarchy=t,this.direction=e}}const z=[_.ROWGROUP,_.ROWGROUPINDEX,_.CATEGORY,_.CATEGORYINDEX,_.SUBCATEGORY,_.SUBCATEGORYINDEX],K=/^(?:ac|fc|pp|pl)[1-4]$/,Q=/^(dr|d)((?:ac|fc|pp|pl)[1-4])_((?:ac|fc|pp|pl)[1-4])(?:_(?:pos|neg|neu|opinv|op))?$/;function Z(t){if(null==t)return;const e=t.indexOf("@"),n=(e<0?t:t.slice(0,e)).trim().toLowerCase(),r=e<0?void 0:t.slice(e+1).trim();if(""===r)return;const s=_[n.toUpperCase()];if(null!=s&&z.includes(s))return void 0===r?{kind:"dim",column:s}:void 0;if(K.test(n))return{kind:"scenario",column:n,bucket:r};const a=Q.exec(n);if(null!=a){const[,t,e,n]=a;return{kind:"variance",column:`${t}${e}_${n}`,type:t,base:e,delta:n,bucket:r}}}function B(t){const e=Z(t);if(null!=e)return void 0===e.bucket?e.column:`${e.column}@${e.bucket}`}class H{constructor(t,e=!1){this.stringAdapter=t,this.allowMeasures=e}adapt(t){var e;const n=C.adaptArray(t.hierarchy,this.stringAdapter),r=W[null===(e=t.direction)||void 0===e?void 0:e.toUpperCase()]||W.ASC;return new G(n.map((t=>(this.allowMeasures?B(t):_[t.toUpperCase()])||_.CATEGORY)),r)}default(){return new G(["category"],W.ASC)}}const P="n/a";function R(t,e){if(!(Math.abs(e)<=1e-9*Math.abs(t)))return t/Math.abs(e)}const Y=/^(dr|d)((?:ac|pp|fc|pl)[1-4])_((?:ac|pp|fc|pl)[1-4])(?:_(pos|neg|neu|op|opinv))?$/;class U{constructor(t,e,n){this.type=t,this.base=e,this.delta=n}static parse(t){const e=Y.exec(t);return null===e?null:new U(e[1],e[2],e[3])}compute(t,e){var n;return null==t||null==e?null:"dr"===this.type?0===e?null:null!==(n=R(t-e,e))&&void 0!==n?n:null:t-e}}function V(t){const e=t.trim();if(Object.values(h).includes(e))return{kind:"scenario",slot:e};const n=U.parse(e);return null!==n?{kind:"variance",measure:n}:null}function X(t){return t.replace(/\d+$/,"")}function tt(t){return t.replace(/^[a-z]+/,"")}function et(t){var e;return"dr"===(null===(e=U.parse(t.trim()))||void 0===e?void 0:e.type)}function nt(t){if(!et(t.measure))return t;const e=t=>void 0===t?void 0:t/100;return Object.assign(Object.assign({},t),{min:e(t.min),max:e(t.max),refLine:e(t.refLine),highlight:t.highlight&&{from:e(t.highlight.from),to:e(t.highlight.to)}})}function rt(t){return null==t||""===t||"null"===t}function st(t){return rt(t)||"auto"===t.trim().toLowerCase()?[]:at((null==t?void 0:t.split(",").filter((t=>!(t.toUpperCase().trim()in h)))).toString())}function at(t){return rt(t)?[]:t.replace(";",",").split(",").filter((t=>{var e,n,r;const s=t.split("_"),a=null===(e=s[0])||void 0===e?void 0:e.replace(/^dr|^d/,"").toUpperCase().trim(),i=null===(n=s[1])||void 0===n?void 0:n.toUpperCase().trim(),o=null===(r=s[2])||void 0===r?void 0:r.toUpperCase().trim();return 3!==s.length||!(a in h)||!(i in h)||!(o in m)}))}function it(t){return rt(t)?[]:at(t.split(",").filter((t=>!(t.toUpperCase().trim()in h))).toString())}function ot(t){return rt(t)||"auto"===t.trim().toLowerCase()?[]:at(t.split(",").filter((t=>!(t.toUpperCase()in _))).toString())}function ct(t){return rt(t)||"auto"===t.trim().toLowerCase()?[]:t.split(",").filter((t=>void 0===Z(t)))}function ut(t){return!rt(t)&&Number.isInteger(Number(t))}function lt(t){return!rt(t)&&!Number.isNaN(Number(t))}function ft(t){return!rt(t)&&(null==t?void 0:t.toUpperCase())in W}function dt(t){return"auto"===(null==t?void 0:t.toLowerCase())||(null==t?void 0:t.toUpperCase())in w}function ht(t){if(rt(t))return[];try{const e=JSON.parse(t);if(e instanceof Array)return e.filter((t=>!(t.hasOwnProperty("name")&&t.hasOwnProperty("unit"))))}catch(t){console.error("validateMeasureList: failed to parse JSON",t)}return["Invalid JSON structure"]}function mt(t){const e=Date.parse(t);return Number.isInteger(e)}function yt(t){return(null==t?void 0:t.toUpperCase())in I}function pt(t){return(null==t?void 0:t.toUpperCase())in L}function bt(t){return(null==t?void 0:t.toUpperCase())in N}function vt(t){return!rt(t)&&(null==t?void 0:t.toUpperCase())in y}function gt(t){return!rt(t)&&(null==t?void 0:t.toUpperCase())in p}function wt(t){if(rt(t))return[];try{const e=JSON.parse(t);if(e instanceof Array)return e.filter((t=>!(t.hasOwnProperty("rowGroup")&&t.hasOwnProperty("category")&&t.hasOwnProperty("subCategory"))))}catch(t){console.error("validateThereOfJsonStr: failed to parse JSON",t)}return["Invalid JSON structure"]}function Nt(t){if(rt(t))return[];try{const e=JSON.parse(t);if(null!==e&&"object"==typeof e&&!(e instanceof Array))return Object.entries(e).filter((([,t])=>"string"!=typeof t||!F(t))).map((([t,e])=>`${t}: ${e}`))}catch(t){console.error("validateAttributesJsonStr: failed to parse JSON",t)}return["Invalid JSON structure"]}function kt(t){if(rt(t))return[];try{const e=JSON.parse(t);if(e instanceof Array)return e.filter((t=>!(t.hasOwnProperty("rowGroup")&&t.hasOwnProperty("category"))))}catch(t){console.error("validatePartOfJsonStr: failed to parse JSON",t)}return["Invalid JSON structure"]}function St(t){return(null==t?void 0:t.trim().toUpperCase())in d}function Ot(t){return["_","k","M","G","T","P","E","Z","Y","m","my","μ","n","p","f","a","z","y"].includes(null==t?void 0:t.trim())||["GREATEST","LEAST"].includes(null==t?void 0:t.trim().toUpperCase())}function Dt(t){return(null==t?void 0:t.toUpperCase().trim())in b}function Tt(t){return(null==t?void 0:t.toUpperCase().trim())in v}function At(t){if(rt(t))return[];try{return JSON.parse(t).filter((t=>!(t.hasOwnProperty("scenario")&&t.hasOwnProperty("name")&&t.hasOwnProperty("subGroups"))))}catch(t){console.error("validateColumnThereOfJsonStr: failed to parse JSON",t)}return["Invalid JSON structure"]}function Mt(t){if(rt(t))return[];try{const e=JSON.parse(t);if("object"!=typeof e||null===e||Array.isArray(e))return["stack: must be a JSON object"];const n=[];if(e.hasOwnProperty("by")){const t=["scenarios","dimensions"];t.includes(e.by)||n.push(`stack: 'by' must be one of: ${t.join(", ")}`)}else n.push("stack: 'by' is required");if(e.hasOwnProperty("mode")){const t=["absolute","relative","absolute-relative"];t.includes(e.mode)||n.push(`stack: 'mode' must be one of: ${t.join(", ")}`)}if(e.hasOwnProperty("order")){const t=["asc","desc","dataset"];t.includes(e.order)||n.push(`stack: 'order' must be one of: ${t.join(", ")}`)}return n}catch(t){return["stack: invalid JSON"]}}function jt(t){return!rt(t)&&null!==V(t)}class $t{constructor(){this.cache=new Map,this.tag=$t.makeStyleTag()}static makeStyleTag(){const t=document.createElement("style");return t.type="text/css",t.setAttribute("data-bn-computed-style",""),t.append(document.createTextNode("")),(document.head||document.querySelector("head")).append(t),t}apply(t){t.forEach((t=>this.cache.set(t.className,t.style))),this.tag.textContent=Array.from(this.cache.values()).map((t=>t)).join("\n")}}const Jt=new $t;function Ft(t){for(var e,n=0,r=0,s=t.length;s>=4;++r,s-=4)e=1540483477*(65535&(e=255&t.charCodeAt(r)|(255&t.charCodeAt(++r))<<8|(255&t.charCodeAt(++r))<<16|(255&t.charCodeAt(++r))<<24))+(59797*(e>>>16)<<16),n=1540483477*(65535&(e^=e>>>24))+(59797*(e>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(s){case 3:n^=(255&t.charCodeAt(r+2))<<16;case 2:n^=(255&t.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}const Et=t=>lt(t)?`${t}px`:t,Lt={width:{className:"w",cssName:"width",attrName:"width",transform:Et},height:{className:"h",cssName:"height",attrName:"height",transform:Et},position:{className:"pst",cssName:"position",attrName:"position"},top:{className:"top",cssName:"top",attrName:"top",transform:Et},right:{className:"rgt",cssName:"right",attrName:"right",transform:Et},bottom:{className:"btm",cssName:"bottom",attrName:"bottom",transform:Et},left:{className:"lft",cssName:"left",attrName:"left",transform:Et},"font-size":{className:"fts",cssName:"font-size",attrName:"font-size",transform:Et},"grid-column":{className:"gdc",cssName:"grid-column",attrName:"grid-column"},"grid-row":{className:"gdr",cssName:"grid-row",attrName:"grid-row"}},It=Object.keys(Lt);function Wt(t,e,n){return`.${e} {${t.cssName}: ${n};}`}function _t(t,e){const n=document.createElement("div").style;n.setProperty(t.cssName,e);const r=n.getPropertyValue(t.cssName);if(n.cssText=`${t.cssName}:${r};--bn-end:1`,!r||r.includes("<")||"1"!==n.getPropertyValue("--bn-end"))return;const s=function(t,e){const n=Ft(e);return`bn-c-${t.className}_${n}`}(t,e);return{className:s,style:Wt(t,s,r)}}const xt=t=>{const e=new Map;return It.forEach((n=>{const r=t.getAttribute(n);if(r){["top","left","right","bottom"].includes(n)&&e.set("position",_t(Lt.position,"absolute"));const t=_t(Lt[n],(Lt[n].transform||function(t){return t})(r));t&&e.set(n,t)}})),e},qt=new MutationObserver((t=>{for(const n of t){const t=n.target,r=xt(t);Jt.apply(r);const s=Array.from(r.values()).map((t=>t.className));t.className=t.className.split(" ").filter((t=>!t.startsWith("bn-c-"))).concat(...s).join(" "),e(t)}})),Ct=e=>{const n=e.connectedCallback,s=e.disconnectedCallback;e.connectedCallback=()=>{const s=t(e);if(!s)throw new Error("Can't find element field in component undefined");(t=>{const e=xt(t);Jt.apply(e);const n=Array.from(e.values()).map((t=>t.className));t.className=t.className.split(" ").filter((t=>!t.startsWith("bn-c-"))).concat(...n).join(" "),qt.observe(t,{attributes:!0,attributeFilter:It,childList:!1,subtree:!1})})(s),r(n,e)},e.disconnectedCallback=()=>{r(s,e)}};export{b as $,w as A,pt as B,q as C,bt as D,L as E,N as F,S as G,x as H,Ft as I,it as J,Tt as K,vt as L,gt as M,P as N,W as O,wt as P,kt as Q,T as R,O as S,ct as T,St as U,Dt as V,At as W,Nt as X,y as Y,B as Z,f as _,l as a,d as a0,E as a1,g as a2,v as a3,j as a4,Z as a5,h as a6,ht as a7,mt as a8,yt as a9,I as aa,ut as b,jt as c,tt as d,nt as e,et as f,ft as g,G as h,rt as i,_ as j,st as k,at as l,u as m,dt as n,Ot as o,Mt as p,A as q,V as r,X as s,D as t,C as u,ot as v,Ct as w,H as x,R as y,lt as z}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p as t,H as s,h as i,a as e,t as n}from"./p-D6YGOYV1.js";import{r as h,m as o,g as r,d as a}from"./p-DDvWTgk1.js";import{C as l,I as d}from"./p-CniN8ALm.js";import{w as c}from"./p-Dq9dG0Kr.js";import{e as u,r as m}from"./p-ClruFZD_.js";import{S as v,F as f,a as p,P as w}from"./p-eWxolPDU.js";import{d as g,S as y}from"./p-BzjGUtYh.js";import{X as x,r as b,a as M,x as $,f as L,b as j,c as P,P as S,F as W,d as k,S as D}from"./p-Cyf5ZEXs.js";import{N as C}from"./p-BJmwHV0a.js";import{a as T,r as N,i as z}from"./p-BXXjh6We.js";import{s as E}from"./p-Xb6Ilq8u.js";class X{constructor(t,s){this.xScale=t,this.yScale=s}isPositiveDomain(){return this.xScale.domainMin>0&&this.yScale.domainMin>0}static autoK(t){const s=t.filter((t=>t>0)).sort(((t,s)=>t-s));if(0===s.length)return[];const i=t=>s[Math.min(s.length-1,Math.floor(t*s.length))];let e=X.ladderValues(i(.25),i(.75));if(e.length<2&&(e=X.ladderValues(s[0],s[s.length-1])),0===e.length)return[];if(1===e.length)return e;if(e.length<=4)return e;const n=[];for(let t=0;t<4;t++)n.push(e[Math.round(t*(e.length-1)/3)]);return[...new Set(n)]}static ladderValues(t,s){if(t<=0||s<t)return[];const i=[];for(let e=Math.floor(Math.log10(t))-1;e<=Math.ceil(Math.log10(s));e++)for(const n of[1,2,5]){const h=n*Math.pow(10,e);h>=t&&h<=s&&i.push(h)}return i}visibleRange(t){if(!this.isPositiveDomain()||t<=0)return null;const s=Math.max(this.xScale.domainMin,t/this.yScale.domainMax),i=Math.min(this.xScale.domainMax,t/this.yScale.domainMin);return s>=i?null:[s,i]}samples(t){const s=this.visibleRange(t);if(null===s)return null;const[i,e]=s,n=[];for(let s=0;s<64;s++){const h=i*Math.pow(e/i,s/63);n.push({x:this.xScale.scale(h),y:this.yScale.scale(t/h)})}return n}path(t){const s=this.samples(t);return null===s?null:s.map(((t,s)=>`${0===s?"M":"L"} ${t.x} ${t.y}`)).join(" ")}exitPoint(t){const s=this.visibleRange(t);if(null===s)return null;const i=s[1],e=i>=this.xScale.domainMax-1e-9*Math.abs(this.xScale.domainMax);return{x:this.xScale.scale(i),y:this.yScale.scale(t/i),edge:e?"right":"bottom"}}regionPath(t){if(!this.isPositiveDomain()||t<=0)return null;const s=this.xScale.domainMin,i=this.xScale.domainMax,e=this.yScale.domainMin,n=this.yScale.domainMax,h=this.xScale.scale(s),o=this.xScale.scale(i),r=this.yScale.scale(n),a=this.yScale.scale(e);if(t>=i*n)return null;if(t<=s*e)return`M ${h} ${r} L ${o} ${r} L ${o} ${a} L ${h} ${a} Z`;const l=this.samples(t),[d,c]=this.visibleRange(t),u=d>s,m=c>=i-1e-9*Math.abs(i),v=l.map(((t,s)=>`${0===s?"M":"L"} ${t.x} ${t.y}`));return m||v.push(`L ${o} ${a}`),v.push(`L ${o} ${r}`),u||v.push(`L ${h} ${r}`),v.push("Z"),v.join(" ")}}class V{constructor(t,s,i,e,n,h){var o,r;this.ruleSet=t,this.config=e,this.styles=n,this.availableWidth=h,this.warnings=[],this.canvasHeight=0,this.i18nMap=new Map,this.config=Object.assign(Object.assign({},e),{x:T(e.x),y:T(e.y)});const a=new x;let l=[];try{""!==i&&(l=s.exec(`SELECT * FROM ${i}`))}catch(t){this.queryError=u(t)}const d=(null!=l?l:[]).map((t=>a.adapt(t)));this.data=b(d,{pointLevel:e.pointLevel,seriesLevel:e.seriesLevel,facetLevel:null!==e.facet?"rowgroup"===e.facet.level?"rowGroup":"category":null,measures:{x:null!==(o=N(e.x.measure))&&void 0!==o?o:{kind:"scenario",slot:"ac1"},y:null!==(r=N(e.y.measure))&&void 0!==r?r:{kind:"scenario",slot:"ac2"}},domains:{x:{min:this.config.x.min,max:this.config.x.max},y:{min:this.config.y.min,max:this.config.y.max}},limit:e.limit,limitBy:"order"}),this.warnings.push(...this.data.warnings)}get em(){return this.styles.fontStyles.size}get xPercent(){return z(this.config.x.measure)}get yPercent(){return z(this.config.y.measure)}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}textWidth(t,s=!1){const i=l(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:s?"bold":"normal"}).width;return Number.isFinite(i)&&i>0?i:.6*t.length*this.em}drawText(t,s,i,e,n={}){var h,o,r;return t.text(s).font({size:null!==(h=n.size)&&void 0!==h?h:this.styles.fontStyles.size,weight:n.bold?"bold":"normal",anchor:null!==(o=n.anchor)&&void 0!==o?o:"start"}).fill(null!==(r=n.color)&&void 0!==r?r:this.styles.fontStyles.color).attr({x:i,y:e,"font-family":this.fontFamily()})}hasNoData(){return 0===this.data.totalPoints}getWarnings(){return this.warnings}getQueryError(){return this.queryError}getAllocatedCanvasWidth(){return this.availableWidth}getAllocatedCanvasHeight(){return this.canvasHeight}axisTitle(t,s){var i;const e=null!==(i=t.label)&&void 0!==i?i:"";return""===e?"":void 0===t.unit||""===t.unit?e:`${e} ${s} ${t.unit}`}setI18n(t){this.i18nMap=t}legendModel(){const t=this.data.series.map((t=>{var s;return{label:""===t.key?null!==(s=this.ruleSet.getScenario("").name)&&void 0!==s?s:"Series":t.key,treatment:this.seriesTreatment(t.index)}}));return{sizeCaption:[],title:this.i18nMap.get("legend.title")||null,compareEntries:[],entries:t}}primaryColorIndex(){const t=N(this.config.x.measure);return null===t||"variance"===t.kind?10:this.ruleSet.getScenarioColorIndex(t.slot)}seriesTreatment(t){const{color:s,overflowed:i}=h(t,this.styles.seriesColors);return i&&this.addWarningOnce("xy-series-overflow",{}),o(this.primaryColorIndex(),s,"dot")}addWarningOnce(t,s){this.warnings.some((s=>s.code===t))||this.warnings.push({code:t,data:s})}toString(){const t=new v;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}draw(t){var s,i,e,n,h,o,r,a,l,d;this.warnings=this.data.warnings.slice();const c=this.em,u=this.styles.padding,m=this.i18nMap.get("axis.in")||"in",v=t.group(),f=new M(this.styles),p=this.legendModel(),w=this.config.legend.show&&p.entries.length>0,g=w?f.measure(p,this.config.legend.position):{width:0,height:0},y=null!==this.config.iso,x=y?Math.max(3*c,...this.isoValueLabels().map((t=>this.textWidth(t)+c)),this.textWidth(null!==(s=this.config.iso.label)&&void 0!==s?s:"",!0)+c,this.textWidth(void 0!==this.config.iso.unit&&""!==this.config.iso.unit?`${m} ${this.config.iso.unit}`:"")+c):0,b="right"===this.config.legend.position?Math.max(w?g.width+c:0,x):x,j=""!==this.config.chartTitle?1.6*c:0,P=this.axisTitle(this.config.y,m),S=this.axisTitle(this.config.x,m),k=""!==P?1.4*c:.4*c,D=1.4*c+(""!==S?1.3*c:0);let T,N=3*c,z={x:0,y:0,width:0,height:0},E=[];const X=Math.max(1,this.data.facets.length),V=null===(i=this.config.facet)||void 0===i?void 0:i.columns,A=C.domain(null!==(n=null===(e=this.data.extents)||void 0===e?void 0:e.xMin)&&void 0!==n?n:0,null!==(o=null===(h=this.data.extents)||void 0===h?void 0:h.xMax)&&void 0!==o?o:1,{min:this.config.x.min,max:this.config.x.max}),B=C.domain(null!==(a=null===(r=this.data.extents)||void 0===r?void 0:r.yMin)&&void 0!==a?a:0,null!==(d=null===(l=this.data.extents)||void 0===l?void 0:l.yMax)&&void 0!==d?d:1,{min:this.config.y.min,max:this.config.y.max});for(let t=0;t<2;t++){const t=Math.max(10,this.availableWidth-u.left-u.right-N-b);z={x:u.left+N,y:u.top+j+k,width:t,height:t/this.config.aspect},T=new W(X,V,z,this.styles.scaleFactors.panelGap*c);const s=T.panelRect(0).height,i=Math.max(4,Math.min(8,Math.round(s/(4*c)))),e=new C(B[0],B[1],s,0);E=e.ticks(i);const n=$(E,this.yPercent);N=Math.max(...E.map((t=>this.textWidth(L(t,n,this.styles.locale,this.yPercent)))),c)+this.styles.scaleFactors.axisTickLength*c+.4*c}this.canvasHeight=z.y+z.height+D+("bottom"===this.config.legend.position&&w?g.height+c:0)+u.bottom,""!==this.config.chartTitle&&this.drawText(v,this.config.chartTitle,u.left,u.top+c,{bold:!0}),""!==P&&this.drawAxisTitleText(v,this.config.y,m,u.left,z.y-.6*c,"start");const F=this.buildPanels(T,A,B),I=F[0].xScale.ticks(Math.max(3,Math.min(8,Math.round(F[0].rect.width/(7*c))))),O=$(I,this.xPercent),Y=$(E,this.yPercent);let G=!1;y&&(A[0]>0&&B[0]>0?G=!0:this.addWarningOnce("xy-iso-domain",{})),0===this.data.facets.length?this.drawPanel(v,F[0],{key:"",points:[]},I,E,O,Y,!0,!0,G):this.data.facets.forEach(((t,s)=>{this.drawPanel(v,F[s],t,I,E,O,Y,T.isOuterLeft(s),T.isOuterBottom(s),G,this.data.facets.length>1?t.key:"")})),""!==S&&this.drawAxisTitleText(v,this.config.x,m,z.x+z.width,z.y+z.height+2.6*c,"end"),w&&("right"===this.config.legend.position?f.draw(v,p,z.x+z.width+c,z.y,"right"):f.draw(v,p,z.x,z.y+z.height+D,"bottom")),t.group().addClass("annotations")}drawAxisTitleText(t,s,i,e,n,h){var o;const r=null!==(o=s.label)&&void 0!==o?o:"",a=void 0!==s.unit&&""!==s.unit?`${i} ${s.unit}`:"",l=.3*this.em;"start"===h?(this.drawText(t,r,e,n,{bold:!0}),""!==a&&this.drawText(t,a,e+this.textWidth(r,!0)+l,n,{})):""!==a?(this.drawText(t,a,e,n,{anchor:"end"}),this.drawText(t,r,e-this.textWidth(a)-l,n,{anchor:"end",bold:!0})):this.drawText(t,r,e,n,{anchor:"end",bold:!0})}buildPanels(t,s,i){const e=[];for(let n=0;n<t.count;n++){const h=t.panelRect(n),o=new C(s[0],s[1],h.x,h.x+h.width),r=new C(i[0],i[1],h.y+h.height,h.y);e.push({rect:h,xScale:o,yScale:r,frame:new j(o,r,h,this.styles)})}return e}drawPanel(t,s,i,e,n,h,o,r,a,l,d=""){var c,u;const m=t.group(),v=this.em;s.frame.drawBands(m,this.config.x.highlight,this.config.y.highlight),s.frame.drawGrid(m,n,void 0===this.config.x.refLine&&void 0===this.config.y.refLine&&s.rect.width>30*v?e:void 0),l&&null!==this.config.iso&&this.drawIso(m,s),s.frame.drawRefLines(m,this.config.x.refLine,this.config.y.refLine),s.frame.drawFrame(m);const f=this.styles.scaleFactors.pointRadius*v,p=new S(s.rect,this.styles.scaleFactors.labelToMark*v),w=[];for(const t of i.points){const e=null!==(u=null===(c=this.data.series.find((s=>s.key===t.seriesKey)))||void 0===c?void 0:c.index)&&void 0!==u?u:0,n=this.seriesTreatment(e),h=s.xScale.scale(t.x),o=s.yScale.scale(t.y);w.push({point:t,cx:h,cy:o,treatment:n});const r=m.circle(2*f).center(h,o).fill(n.fill).stroke({color:n.stroke,width:n.strokeWidth}).attr(g(P(t,i.key,this.config),"element"));void 0!==n.dasharray&&r.attr("stroke-dasharray",n.dasharray),p.registerMark(h,o,f)}this.drawPointLabels(m,p,w,f,i.key),s.frame.drawTickLabels(m,{ticksX:e,ticksY:n,xDecimals:h,yDecimals:o,xPercent:this.xPercent,yPercent:this.yPercent,showXLabels:a,showYLabels:r}),""!==d&&s.frame.drawPanelTitle(m,d)}drawPointLabels(t,s,i,e,n){const h=i.reduce(((t,s)=>t+s.cx),0)/Math.max(1,i.length),o=i.reduce(((t,s)=>t+s.cy),0)/Math.max(1,i.length),r=[...i].sort(((t,s)=>Math.hypot(s.cx-h,s.cy-o)-Math.hypot(t.cx-h,t.cy-o))),{selected:a,unknownNames:l}=s.selectCandidates(r,this.config.labels.points,this.config.labels.max,(t=>t.point.name));l.length>0&&this.addWarningOnce("xy-label-unknown",{names:l.join(", ")});const d=new Map,c=a.map((t=>{const s={name:t.point.name,cx:t.cx,cy:t.cy,r:e,width:this.textWidth(t.point.name),height:1.1*this.em};return d.set(s,t.point),s}));for(const i of s.place(c))this.drawText(t,i.candidate.name,i.x,i.y+.9*i.candidate.height,{}).attr(g(P(d.get(i.candidate),n,this.config),"label"))}drawIso(t,s){const i=this.config.iso,e=new X(s.xScale,s.yScale),n=this.i18nMap.get("axis.in")||"in",h=this.isoValues(),o=this.isoValueLabels();if(void 0!==i.highlight){const s=e.regionPath(i.highlight.from);null!==s&&t.path(s).fill(this.styles.axisStyles.pl.fill).stroke("none")}const r={color:this.styles.axisStyles.fc.stroke,width:E(this.styles.scaleFactors.gridLineWidth,this.em)};let a=null;for(const[s,i]of h.entries()){const n=e.path(i);if(null===n)continue;t.path(n).fill("none").stroke(r);const h=e.exitPoint(i);null!==h&&(this.drawText(t,o[s],h.x+.4*this.em,"right"===h.edge?h.y+.35*this.em:h.y-.5*this.em,{}),(null===a||h.y<a.y)&&(a=h))}if(null!==a&&void 0!==i.label&&""!==i.label){const s=void 0!==i.unit&&""!==i.unit?`${n} ${i.unit}`:"";this.drawText(t,i.label,a.x+.4*this.em,a.y-1.6*this.em,{bold:!0}),""!==s&&this.drawText(t,s,a.x+.4*this.em,a.y-.5*this.em,{})}}isoValues(){const t=this.config.iso;return"auto"!==t.values?t.values:X.autoK(this.data.facets.flatMap((t=>t.points.map((t=>t.x*t.y)))))}isoValueLabels(){const t=this.isoValues(),s=Math.max(0,...t.map((t=>C.stepDecimals(Math.abs(t)))));return t.map((t=>L(t,s,this.styles.locale)))}}const A=["xy-duplicate-point","xy-point-clipped","xy-variance-nodata","xy-iso-domain","xy-label-unknown","xy-series-overflow","xy-point-budget"],B=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.chartTitle="",this.iso=null,this.facet=null,this.pointLevel="category",this.seriesLevel=null,this.aspect=16/9,this.limit=0,this.filter="",this.i18n=new Map,this.containerWidth=0,this.svgMarkup="",c(this)}getDb(){return this.stores||(this.stores=r(this.element)),this.stores.db.db}componentWillLoad(){this.rebuild()}componentWillUpdate(){this.rebuild()}rebuild(){const t=this.prepareStyle(),s=a(this.getDb(),this.tableName,this.filter);this.chart=new V(new d(this.ruleSetConfig),this.getDb(),s,{chartTitle:this.chartTitle,x:this.x,y:this.y,iso:this.iso,labels:this.labels,legend:this.legend,facet:this.facet,pointLevel:this.pointLevel,seriesLevel:this.seriesLevel,aspect:this.aspect,limit:this.limit},t,this.containerWidth||0),this.chart.setI18n(this.i18n),this.svgMarkup=this.chart.hasNoData()?"":this.chart.toString(),this.syncWarnings(this.chart.getWarnings()),m(this.errors,this.chart.getQueryError())}syncWarnings(t){if(void 0===this.errors)return;const s=new Map(t.map((t=>[t.code,t.data])));for(const t of A){const i=`WARN_${t.replace(/-/g,"_")}`;if(s.has(t)){const e=void 0!==this.translator?this.translator(`.${t}`,s.get(t)):t;this.errors.addOrReplace({id:i,type:"warning",message:e})}else this.errors.remove(i)}}prepareStyle(){var t,s;const i=new k(new D,new f,new p(new y),new w).adapt(this.styles);return i.locale=(null===(s=null===(t=r(this.element).context)||void 0===t?void 0:t.state)||void 0===s?void 0:s.locale)||"de",i}render(){var t;if(void 0===this.chart||void 0!==this.chart.getQueryError())return i(e,null);if(this.chart.hasNoData()){const s=null!==(t=this.i18n.get("no-data"))&&void 0!==t?t:"No Data";return i(e,{class:"no-data"},i("div",{class:"empty-state"},s))}return i(e,null,i("div",{innerHTML:this.svgMarkup}))}get element(){return this}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{position:relative;display:inline-block}'}},[1,"bn-chart-scatter-renderer",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],chartTitle:[1,"chart-title"],x:[16],y:[16],iso:[16],labels:[16],legend:[16],facet:[16],pointLevel:[1,"point-level"],seriesLevel:[1,"series-level"],aspect:[2],limit:[2],filter:[1],styles:[16],i18n:[16],containerWidth:[2,"container-width"],ruleSetConfig:[16],errors:[16],translator:[16]}]);function F(){"undefined"!=typeof customElements&&["bn-chart-scatter-renderer"].forEach((t=>{"bn-chart-scatter-renderer"===t&&(customElements.get(n(t))||customElements.define(n(t),B))}))}export{B,F as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const t=/^\s*(set|first|last|min|max|avg|sum|lit)\(\s*(.*?)\s*\)\s*$/,s=/^[A-Za-z_][A-Za-z0-9_]*$/,n=["min","max","avg","sum"];class i{constructor(t,s,n,i){this.label=t,this.alias=s,this.fn=n,this.arg=i}get isNumeric(){return n.includes(this.fn)}}function r(n){if("string"!=typeof n)return!1;const i=t.exec(n);if(!i)return!1;const[,r,u]=i;return"lit"===r?u.length>0:s.test(u)}function u(s,n,u){if(!r(u))return null;const[,e,a]=t.exec(u);return new i(s,n,e,a)}export{s as F,r as i,u as p}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as n,a as t,A as r,b as o,T as u,D as e,c as i,M as a,d as s}from"./p-B5tixDPM.js";import{i as c}from"./p-DCPLGEs_.js";import{D as l,a as f}from"./p-sLbQ7yZ1.js";import{O as d,a as v,p as m}from"./p-16rjcQ0t.js";import{r as p}from"./p-BXXjh6We.js";function S(n){return null==n||""===n||"null"===n}function b(t){return S(t)||"auto"===t.trim().toLowerCase()?[]:y((null==t?void 0:t.split(",").filter((t=>!(t.toUpperCase().trim()in n)))).toString())}function y(r){return S(r)?[]:r.replace(";",",").split(",").filter((r=>{var o,u,e;const i=r.split("_"),a=null===(o=i[0])||void 0===o?void 0:o.replace(/^dr|^d/,"").toUpperCase().trim(),s=null===(u=i[1])||void 0===u?void 0:u.toUpperCase().trim(),c=null===(e=i[2])||void 0===e?void 0:e.toUpperCase().trim();return 3!==i.length||!(a in n)||!(s in n)||!(c in t)}))}function N(t){return S(t)?[]:y(t.split(",").filter((t=>!(t.toUpperCase().trim()in n))).toString())}function O(n){return S(n)||"auto"===n.trim().toLowerCase()?[]:y(n.split(",").filter((n=>!(n.toUpperCase()in d))).toString())}function J(n){return S(n)||"auto"===n.trim().toLowerCase()?[]:n.split(",").filter((n=>void 0===m(n)))}function j(n){return!S(n)&&Number.isInteger(Number(n))}function h(n){return!S(n)&&!Number.isNaN(Number(n))}function A(n){return!S(n)&&(null==n?void 0:n.toUpperCase())in v}function k(n){return"auto"===(null==n?void 0:n.toLowerCase())||(null==n?void 0:n.toUpperCase())in r}function T(n){if(S(n))return[];try{const t=JSON.parse(n);if(t instanceof Array)return t.filter((n=>!(n.hasOwnProperty("name")&&n.hasOwnProperty("unit"))))}catch(n){console.error("validateMeasureList: failed to parse JSON",n)}return["Invalid JSON structure"]}function G(n){const t=Date.parse(n);return Number.isInteger(t)}function g(n){return(null==n?void 0:n.toUpperCase())in f}function D(n){return(null==n?void 0:n.toUpperCase())in l}function E(n){return(null==n?void 0:n.toUpperCase())in o}function I(n){return!S(n)&&(null==n?void 0:n.toUpperCase())in e}function $(n){return!S(n)&&(null==n?void 0:n.toUpperCase())in i}function L(n){if(S(n))return[];try{const t=JSON.parse(n);if(t instanceof Array)return t.filter((n=>!(n.hasOwnProperty("rowGroup")&&n.hasOwnProperty("category")&&n.hasOwnProperty("subCategory"))))}catch(n){console.error("validateThereOfJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function M(n){if(S(n))return[];try{const t=JSON.parse(n);if(null!==t&&"object"==typeof t&&!(t instanceof Array))return Object.entries(t).filter((([,n])=>"string"!=typeof n||!c(n))).map((([n,t])=>`${n}: ${t}`))}catch(n){console.error("validateAttributesJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function P(n){if(S(n))return[];try{const t=JSON.parse(n);if(t instanceof Array)return t.filter((n=>!(n.hasOwnProperty("rowGroup")&&n.hasOwnProperty("category"))))}catch(n){console.error("validatePartOfJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function w(n){return(null==n?void 0:n.trim().toUpperCase())in a}function x(n){return["_","k","M","G","T","P","E","Z","Y","m","my","μ","n","p","f","a","z","y"].includes(null==n?void 0:n.trim())||["GREATEST","LEAST"].includes(null==n?void 0:n.trim().toUpperCase())}function C(n){return(null==n?void 0:n.toUpperCase().trim())in s}function _(n){return(null==n?void 0:n.toUpperCase().trim())in u}function q(n){if(S(n))return[];try{return JSON.parse(n).filter((n=>!(n.hasOwnProperty("scenario")&&n.hasOwnProperty("name")&&n.hasOwnProperty("subGroups"))))}catch(n){console.error("validateColumnThereOfJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function z(n){if(S(n))return[];try{const t=JSON.parse(n);if("object"!=typeof t||null===t||Array.isArray(t))return["stack: must be a JSON object"];const r=[];if(t.hasOwnProperty("by")){const n=["scenarios","dimensions"];n.includes(t.by)||r.push(`stack: 'by' must be one of: ${n.join(", ")}`)}else r.push("stack: 'by' is required");if(t.hasOwnProperty("mode")){const n=["absolute","relative","absolute-relative"];n.includes(t.mode)||r.push(`stack: 'mode' must be one of: ${n.join(", ")}`)}if(t.hasOwnProperty("order")){const n=["asc","desc","dataset"];n.includes(t.order)||r.push(`stack: 'order' must be one of: ${n.join(", ")}`)}return r}catch(n){return["stack: invalid JSON"]}}function B(n){return!S(n)&&null!==p(n)}export{M as A,y as a,O as b,A as c,T as d,G as e,D as f,g,j as h,S as i,B as j,k,x as l,z as m,h as n,E as o,N as p,_ as q,I as r,$ as s,L as t,P as u,b as v,J as w,w as x,C as y,q as z}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as t}from"./p-CeE4_3wQ.js";import{F as s}from"./p-CniN8ALm.js";import"./p-B5tixDPM.js";import{g as i}from"./p-4q8nRcWC.js";import{d as e}from"./p-BzjGUtYh.js";var r;!function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right",t[t.Top=3]="Top",t[t.Bottom=4]="Bottom"}(r||(r={}));class h{constructor(t,s,i,e,h,n,o,a){this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.isRelativeLabel=!1,this.segmentFillColor=null,this.pointPart="label",this.x=s,this.y=i,this.value=h,this.group=t.group().id(this.createElementID(t.toString(),e)),this.styles=n,this.isVarianceLabel=!1,this.verticalHookLocation=o||r.Top,this.horizontalHookLocation=a||r.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}setPoint(t,s="label"){return this.pointKey=t,this.pointPart=s,this}updateGroup(t){return this.group=t,this}draw(i=!0,r={percent:2,decimal:1},h=new t){if(this.isEmpty())return this;const n=this.group;let o,a="";if(!1===Number.isNaN(Number(this.value))){let t="percent",i=r.percent,e=r.percent,n=1;!1===this.isRelativeLabel&&(i=r.decimal,e=r.decimal,n=h.value,t="decimal"),o=s.number(Number(this.value),t,i,e,n,this.styles.locale),this.isVarianceLabel&&Number(this.value)>=0&&(a="+")}else o=""+this.value;const l=this.drawLabel(n,a+o);return!1===i?(l.addClass("hide"),n.addClass("hide")):this.pointKey&&n.attr(e(this.pointKey,this.pointPart)),this}isEmpty(){return null==this.value||""===this.value}setPos(t,s){return this.x=t,this.y=s,this}forceStringTypeDraw(){const t=this.group;return this.drawLabel(t,""+this.value),this.pointKey&&t.attr(e(this.pointKey,this.pointPart)),this}drawLabel(t,s){const e=this.styles.fontStyles.background||"#ffffff";let h="start";const n=t.text(s);n.move(this.x,this.y);const o=n.bbox(),a=o.w,l=o.h;let c=0,u=0;const f=n.x();let p=n.y();return this.horizontalHookLocation===r.Left?(h="left",c=n.x()):this.horizontalHookLocation===r.Center?(h="middle",c=n.x()-(a+2)/2):this.horizontalHookLocation===r.Right&&(h="end",c=n.x()-a),this.verticalHookLocation===r.Center?(p=n.y()-1.2*l/2,u=p+.2*l):this.verticalHookLocation===r.Top?(p-=l/4,u=p+.2*l):this.verticalHookLocation===r.Bottom&&(p-=l,u=p+.2*l),n.move(f,p),n.font({anchor:h}),null!=this.segmentFillColor?n.fill(i(this.segmentFillColor)):t.rect(a+2,.8*l).stroke(e).fill(e).opacity(.9).move(c-1,u).insertBefore(n),n}createElementID(t,s){return t+"_"+s+"_"+this.ID_SCENARIOLABEL}}const n={ac:1,pp:2,fc:3,pl:4};var o;!function(t){t[t.Above=0]="Above",t[t.Below=1]="Below",t[t.Left=2]="Left",t[t.Right=3]="Right"}(o||(o={}));class a{constructor(){this.labels=[],this.scenarioLabels=[]}clear(){this.labels=[],this.scenarioLabels=[]}register(t){this.labels.push(t)}hasCollision(t){return this.labels.some((s=>this.intersects(t,s)))}getOptimalPlacement(t,s,i,e,r,h,o,a){const l=n[o]||99,c=h/2;for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.hasCollision(n.bounds))return n}for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.collidesWithHigherPriority(n.bounds,l))return n}return null}calculatePlacementForDirection(t,s,i,e,h,n,a,l){let c,u,f,p,m,b;switch(l){case o.Above:c=t,u=s-n-a,f=r.Bottom,p=r.Center,m=t-i/2,b=s-n-a-e;break;case o.Below:c=t,u=s+n+a,f=r.Top,p=r.Center,m=t-i/2,b=s+n+a-e/4;break;case o.Left:c=t-n-a,u=s,f=r.Center,p=r.Right,m=t-n-a-i,b=s-.6*e;break;case o.Right:c=t+n+a,u=s,f=r.Center,p=r.Left,m=t+n+a,b=s-.6*e}return{labelX:c,labelY:u,verticalHook:f,horizontalHook:p,bounds:{x:m,y:b,width:i,height:e,pointIndex:h,preferredHook:f}}}collidesWithHigherPriority(t,s){return this.labels.some((i=>!!i.scenarioType&&((n[i.scenarioType]||99)<s&&this.intersects(t,i))))}shouldHideScenarioLabel(t,s,i,e=20){const r=n[i]||99;return!(r<=1)&&this.scenarioLabels.some((i=>{if((n[i.scenarioType]||99)>=r)return!1;const h=Math.abs(s-i.y),o=Math.abs(t-i.x);return h<e&&o<e}))}registerScenarioLabel(t,s,i){this.scenarioLabels.push({x:t,y:s,scenarioType:i})}intersects(t,s){return!(t.x+t.width<s.x||s.x+s.width<t.x||t.y+t.height<s.y||s.y+s.height<t.y)}getLabelCount(){return this.labels.length}}export{r as H,a as L,n as S,h as a,o as b}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as t,p as e,H as i,f as n,a as o,t as s}from"./p-D6YGOYV1.js";import{m as r,a as l,b as a}from"./p-DaOm9YwQ.js";import{p as c,n as h,r as u,d}from"./p-BzjGUtYh.js";import{F as f,V as p,Q as v,s as $,a as m,I as g,b}from"./p-CniN8ALm.js";import{S as w,I as E,D as y,C as S,d as R,M}from"./p-B5tixDPM.js";import{N as O,r as N}from"./p-fCjsrD7I.js";import{D as _,w as U}from"./p-Dq9dG0Kr.js";import{D as G,b as T}from"./p-sLbQ7yZ1.js";import{F as L}from"./p-DCPLGEs_.js";import{p as x,c as C}from"./p-16rjcQ0t.js";import{d as k,g as P}from"./p-DDvWTgk1.js";import{D as A,a as D,b as W}from"./p-7ieJFBUk.js";import{A as B}from"./p-BXg3v5AO.js";import{S as F}from"./p-BPGLOHUe.js";import{S as I}from"./p-CeE4_3wQ.js";import{w as H}from"./p-DjPWZfry.js";var Y,j,z,Q,V;!function(t){t[t.ALL=-1]="ALL"}(Y||(Y={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(j||(j={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(z||(z={})),function(t){t.ASC="asc",t.DESC="desc"}(Q||(Q={})),function(t){t.HEADER="HEADER",t.GROUPHEAD="GROUPHEAD",t.SEPERATORLINE="SEPERATORLINE",t.SUM="SUM",t.GROUPSUM="GROUP_SUM",t.DRILLELEMENT="DRILLELEMENT",t.STANDARD="STANDARD",t.PARTELEMENT="PARTELEMENT",t.ENTRY="ENTRY"}(V||(V={}));const X="none",q="setname";function K(t){return t===q?"COALESCE([setname],[setName])":`normalizeDate([date], '${t}')`}function Z(t){if("string"==typeof t?""===t.trim():"number"!=typeof t)return;const e=Number(t);return Number.isFinite(e)?e:void 0}function J(t){if(null==t)return"";if("string"==typeof t)return t.trim();const e=tt(t);return e?e.toISO():String(t)}function tt(t){if(null!=t){if("string"==typeof t){const e=_.fromISO(t,{zone:"utc"});return e.isValid?e:void 0}if("number"==typeof t){const e=_.fromMillis(t,{zone:"utc"});return e.isValid?e:void 0}if("boolean"==typeof t.isValid)return t.isValid?t:void 0}}const et=/[\s\u200e\u200f\u061c]*[%\u066a][\s\u200e\u200f\u061c]*/;class it{constructor(t,e,i,n,o,s,r,l,a){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=e,this.value=i,this.prefix=s||"",this.cssStyle=n||"",this.prefixStyle=r||"prefix",this.type=o,this.mark=void 0,this.colSpan=l||1,this.measureScale=a||1}getAsHeaderList(){if(null==this.value)return[""];const t=[];for(const e of this.value.toString().split("<br/>"))t.push(e);return t}draw(t,e){let i=this.value;if("undefined"===i||void 0===i||null==i)return"";if(Number.isNaN(Number(i)))return i;if(""===this.type||void 0===this.type||null==this.type)return i;let n=t.percent,o=t.percent;return"percentpoint"===this.type?f.number(Number(i),"percent",n,o,1,e).replace(et,""):("decimal"===this.type&&(i=+i/this.measureScale,n=t.decimal,o=t.decimal),f.number(Number(i),this.type,n,o,1,e))}drawPrefix(){return null==this.prefix?"":this.prefix}}class nt{constructor(t,e,i){this.index=t,this.groupindex=e,this.type=i,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case V.HEADER:return"groupheader";case V.SEPERATORLINE:return"";case V.DRILLELEMENT:return"ofit";case V.PARTELEMENT:return"partof";case V.STANDARD:return"";case V.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,e,i,n,o,s,r,l,a,c=!1,h,u=1,d){let f=s;"category"===e&&null!=l&&(f=`category-${l.toString()}`),this.type===V.HEADER?f="headerlabel":this.type===V.SEPERATORLINE&&(f=null!=s?s:e),this.type===V.PARTELEMENT&&("percent"===n&&(t="-"),"category"!==e&&"operation"!==e&&(n="percent",f="")),("-"===t||t===O&&"percent"===n)&&(f="");let p="prefix-first";r&&(p="prefix-second"),i&&(f=`${f} ${i}`);const v=new it(e,this.elements.length,t,f,n,o,p,u,a);v.isBarChart=c,v.columnStats=h,v.waterfall=d,this.elements.push(v)}}const ot=.85,st=.3,rt=.25,lt={".":.28,",":.28,"-":.34,"%":.89," ":.28," ":.28," ":.28,M:.9};function at(t,e){var i;let n=0;for(const e of t)n+=null!==(i=lt[e])&&void 0!==i?i:/[0-9+]/.test(e)?.59:.72;return n*e*1.1}let ct;function ht(t,e,i,n){const o=function(){var t,e,i;if(void 0===ct)try{ct="undefined"==typeof document?null:null!==(i=null===(e=(t=document.createElement("canvas")).getContext)||void 0===e?void 0:e.call(t,"2d"))&&void 0!==i?i:null}catch(t){ct=null}return ct}();if(o){o.font="1px __bn_font_sentinel__";const s=o.font;if(o.font=`${n?"italic ":""}${e}px ${i}`,o.font===s)return at(t,e);const r=o.measureText(t).width;if(Number.isFinite(r)&&(r>0||""===t))return r+.15*e}return at(t,e)}function ut(t,e){return Math.max(0,(t-.5)*e)}function dt(t,e,i){const n=void 0!==t.neg,o=void 0!==t.pos||!n,s=(t,n)=>t?e+i+(null!=n?n:0):0;return{sides:(n?1:0)+(o?1:0),neg:s(n,t.neg),pos:s(o,t.pos)}}function ft(t,e,i,n){const{sides:o,neg:s,pos:r}=dt(e,i,n),l=s+r>0?Math.min(1,t/(s+r)):1,a=Math.max(0,(t-(s+r)*l)/o);return{extent:a,axisX:void 0!==e.neg?s*l+a:0}}function pt(t,e,i,n){const o=ut(t,e),{sides:s,neg:r,pos:l}=dt(i,n/2,st*e);return r+l+s*function(t,e,i){return Math.min(1*e,t/(2*i))}(o,e,s)<=o+1e-6}function vt(t,e){const i=.15*t;return{maxBarWidth:t,breakGap:e,overdriveZoneWidth:i,cutWidth:Math.max(0,t-e-i)}}function $t(t,e,i,n){var o,s;const r=ut(t,e),l=st*e,{extent:a,axisX:c}=ft(r,i,rt*e/2,l),h=Math.min(.3*e,.2*a),u=void 0!==i.neg,d=void 0!==i.pos||!u;let f=u?a:0;const p=Math.max(0,null!==(o=null==n?void 0:n.neg)&&void 0!==o?o:0),v=Math.max(0,null!==(s=null==n?void 0:n.pos)&&void 0!==s?s:0);u&&d&&p+v>0&&(f=(h+(2*a*.85-2*h)*p/(p+v))/.85);const $=d?u?2*a-f:a:0;return{totalWidth:r,neg:vt(f,h),pos:vt($,h),axisX:u?c-a+f:0,labelGap:l}}function mt(t,e,i,n,o){var s,r;const l=ut(t,e),a=st*e,{extent:c,axisX:h}=ft(l,i,n/2,a),u=void 0!==i.neg,d=void 0!==i.pos||!u;let f=u?c:0,p=d?c:0;if(o&&u&&d){const t=2*c,e=Math.max(0,null!==(s=o.neg)&&void 0!==s?s:0),i=Math.max(0,null!==(r=o.pos)&&void 0!==r?r:0);e+i<=t+1e-6?(f=e+(t-e-i)/2,p=t-f):e<c?(f=e,p=t-f):i<c&&(p=i,f=t-p)}return{totalWidth:l,maxPinLength:Math.max(f,p),negPinLength:f,posPinLength:p,axisX:u?h-c+f:0,labelGap:a}}const gt={positive:{stroke:"#008f96",fill:"#008f96",fillpattern:"solid"},negative:{stroke:"#ff0000",fill:"#ff0000",fillpattern:"solid"},neutral:{stroke:"#808080",fill:"#808080",fillpattern:"outlined"},scenarios:{ac:{stroke:"#404040",fill:"#404040",fillpattern:"solid"},pp:{stroke:"#A6A6A6",fill:"#A6A6A6",fillpattern:"solid"},fc:{stroke:"#404040",fill:"#ffffff",fillpattern:"hatched"},pl:{stroke:"#404040",fill:"#ffffff",fillpattern:"outlined"}},fontColor:"#000000",fontSize:11.333305,emPx:13.3333,fontFamily:"'Noto Sans', sans-serif",unitScaling:.01,percentageScaling:.5,scaleFactor:1},bt="#666666";function wt(t,e){return`pattern-${t}-${e.replace("#","")}`}const Et=({styles:e})=>{const i=e.scaleFactor,n=6*i,o=[{id:wt("pos",e.positive.stroke),stroke:e.positive.stroke,fill:e.positive.fill},{id:wt("neg",e.negative.stroke),stroke:e.negative.stroke,fill:e.negative.fill},{id:wt("neu",e.neutral.stroke),stroke:e.neutral.stroke,fill:e.neutral.fill},...["ac","pp","fc","pl"].map((t=>({id:wt(t,e.scenarios[t].stroke),stroke:e.scenarios[t].stroke,fill:e.scenarios[t].fill})))];return t("defs",null,o.map((e=>t("pattern",{id:e.id,patternUnits:"userSpaceOnUse",width:n,height:n},t("rect",{width:n,height:n,fill:"#ffffff"}),t("line",{x1:"0",y1:n,x2:n,y2:"0",stroke:e.stroke,"stroke-width":1.5*i})))))};function yt(t,e,i=1,n,o=0,s=!0,r){const l=(e,i)=>(t>0&&e!==i?"+":"")+e;if(e){const e=(t,e)=>s?f.number(t,"percent",e,e,1,n):f.number(100*t,"decimal",e,e,1,n),i=i=>l(e(t,i),e(0,i));let r=Math.min(20,Math.max(0,Math.trunc(o)||0));for(;r>0&&i(r).length>7;)r--;return i(r)}const a=t/i;if(void 0!==r){const t=t=>f.number(t,"decimal",r,r,1,n);return l(t(a),t(0))}const c=Math.abs(a);let h=1,u="";c>=9995e5?(h=1e9,u="B"):c>=999500?(h=1e6,u="M"):c>=999.5&&(h=1e3,u="K");const d=c>=10*h?0:1;return l(f.number(a/h,"decimal",d,0,1,n),f.number(0,"decimal",d,0,1,n))+u}function St(t){const e=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(e)}function Rt(t){const e=t.slice(0,2).toLowerCase();return"pp"===e?"pp":"fc"===e?"fc":"pl"===e?"pl":"ac"}function Mt(t,e){if(St(t))return null;const i=new p(t);if(!i.isValid)return null;const n=Rt(i.base),o=Rt(i.delta);return{minuend:e.scenarios[n],minuendSlot:n,reference:e.scenarios[o],referenceSlot:o}}const Ot=({x:e,height:i,look:n,styles:o})=>{const s=o.scaleFactor,r=rt*o.emPx,{reference:l,referenceSlot:a}=n;let c;if("outlined"===l.fillpattern){const n=r/2-.5*s;c=[e-n,e+n].map((e=>t("line",{x1:e,y1:0,x2:e,y2:i,stroke:l.stroke,"stroke-width":1*s})))}else c=t("line","hatched"===l.fillpattern?{x1:e,y1:0,x2:e,y2:i,stroke:l.stroke,"stroke-width":r,"stroke-dasharray":""+2*s}:{x1:e,y1:0,x2:e,y2:i,stroke:l.fill,"stroke-width":r});return t("g",{class:`variance-axis axis-${a}`},c)};function Nt(t){return void 0!==t.pos||void 0===t.neg}function _t(t,e){return{neg:t.min<0?e:void 0,pos:t.max>0?e:void 0}}function Ut(t,e,i,n){return St(t)?function(t,e){const i=Rt(t);return e.scenarios[i]}(t,n):function(t,e,i){const n=t>=0;return e?n?i.positive:i.negative:n?i.negative:i.positive}(e,i,n)}function Gt(t,e){const i=t.fillpattern;return"hatched"===i?`url(#${wt(e,t.stroke)})`:"outlined"===i?"transparent":t.fill}function Tt(t){return"outlined"===t.fillpattern?{stroke:t.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0}}const Lt=e=>{const{value:i,scenario:n,columnStats:o,height:s,isPositiveGood:r,formattedValue:l,measureScale:a,locale:c,decimalDigits:h,columnWidthEm:u=10,labelWidths:d,sideMax:f,styles:p=gt}=e,v=p.scaleFactor,$=p.fontSize,m=l||yt(i,!1,a,c,0,!0,h),g=null!=d?d:_t(o,ht(m,$,p.fontFamily,!1)),b=i>0||0===i&&Nt(g),{neg:w=Math.max(0,-o.min),pos:E=Math.max(0,o.max)}=null!=f?f:{},y=$t(u,p.emPx,g,{neg:w,pos:E}),{totalWidth:S,axisX:R,labelGap:M}=y,{breakGap:O,overdriveZoneWidth:N,cutWidth:_}=b?y.pos:y.neg,U=Math.abs(i)*p.unitScaling*$,G=U-_>1e-6,T=Math.max(0,(b?E:w)*p.unitScaling*$-_),L=Math.max(0,U-_),x=T>0?L/T*N:0,C=2*v,k=s-2*C,P=C,A=Mt(n,p),D=Ut(n,i,r,p),W=null==A?void 0:A.minuend.fillpattern,B="hatched"===W||"outlined"===W?Object.assign(Object.assign({},D),{fillpattern:W}):D,F=Gt(B,St(n)?Rt(n):r?b?"pos":"neg":b?"neg":"pos"),{stroke:I,strokeWidth:H}=A&&"hatched"===B.fillpattern?{stroke:B.stroke,strokeWidth:1}:Tt(B),Y=A?rt*p.emPx/2:0,j=b?R+Y:R-Y,z=G?_:U,Q=G?_+O+x:U,V=b?j+Q+M:j-Q-M,X=b?"start":"end";return t("svg",{width:S,height:s,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},t(Et,{styles:p}),!A&&t("line",{x1:R,y1:0,x2:R,y2:s,stroke:bt,"stroke-width":1*v}),z>0&&t("rect",{x:b?j:j-z,y:P,width:z,height:k,fill:F,stroke:I,"stroke-width":H*v}),G&&x>0&&t("rect",{x:b?j+_+O:j-_-O-x,y:P,width:x,height:k,fill:F,stroke:I,"stroke-width":H*v}),G&&function(e,i,n,o,s){const r=e+i/2,l=.35*i,a=o/3,c=.3*i;let h=`M ${r-l} ${n}`;for(let t=0;t<3;t++)h+=` L ${r-l-c} ${n+a*(t+.5)} L ${r-l} ${n+a*(t+1)}`;let u=`M ${r+l} ${n}`;for(let t=0;t<3;t++)u+=` L ${r+l+c} ${n+a*(t+.5)} L ${r+l} ${n+a*(t+1)}`;return[t("rect",{x:e,y:n-1,width:i,height:o+2,fill:"#ffffff"}),t("path",{d:h,fill:"none",stroke:"#000000","stroke-width":1*s}),t("path",{d:u,fill:"none",stroke:"#000000","stroke-width":1*s})]}(b?j+_:j-_-O,O,P,k,v),A&&t(Ot,{x:R,height:s,look:A,styles:p}),t("text",{x:V,y:s/2,dy:"0.35em","text-anchor":X,fill:p.fontColor,"font-size":$,"font-family":p.fontFamily},m))},xt=e=>{var i,n;const{value:o,scenario:s,columnStats:r,height:l,isPositiveGood:a,formattedValue:c,measureScale:h,locale:u,percentDigits:d,percentSign:f,columnWidthEm:p=10,labelWidths:v,sideMax:$,styles:m=gt}=e,g=m.scaleFactor,b=m.fontSize,w=10*g,E=100*m.percentageScaling*b,y=c||yt(o,!0,h,u,d,f),S=null!=v?v:_t(r,ht(y,b,m.fontFamily,!0)),{neg:R=Math.max(0,-r.min),pos:M=Math.max(0,r.max)}=null!=$?$:{},{totalWidth:O,negPinLength:N,posPinLength:_,axisX:U,labelGap:G}=mt(p,m.emPx,S,w,{neg:R*E,pos:M*E}),T=l/2,L=Math.abs(o)*E,x=o>0||0===o&&Nt(S),C=x?_:N,k=L-C>1e-6,P=x?1:-1,A=U+P*Math.min(L,C),D=Ut(s,o,a,m),W=Mt(s,m),B=null!==(i=null==W?void 0:W.minuend)&&void 0!==i?i:m.scenarios.ac,F=U+P*(C+w/2),I=F-P*w,H=(k?F:A+P*(w/2))+P*G;return t("svg",{width:O,height:l,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},t(Et,{styles:m}),W?t(Ot,{x:U,height:l,look:W,styles:m}):t("line",{x1:U,y1:0,x2:U,y2:l,stroke:bt,"stroke-width":1*g}),t("line",{x1:U,y1:T,x2:k?I:A,y2:T,stroke:D.fill,"stroke-width":3*g}),k?t("polygon",{points:`${F},${T} ${I},${T-w/2} ${I},${T+w/2}`,fill:D.fill}):t("rect",{x:A-w/2,y:T-w/2,width:w,height:w,fill:"outlined"===B.fillpattern?"#ffffff":Gt(B,null!==(n=null==W?void 0:W.minuendSlot)&&void 0!==n?n:"ac"),stroke:B.stroke,"stroke-width":1*g}),t("text",{x:H,y:l/2,dy:"0.35em","text-anchor":x?"start":"end",fill:m.fontColor,"font-size":b,"font-style":"italic","font-family":m.fontFamily},y))},Ct=e=>{const{value:i,columnStats:n,isRelative:o,styles:s=gt}=e;return null==i||isNaN(i)||!n||0===n.absMax?t("span",{class:"bar-chart-empty",style:{color:s.fontColor,fontStyle:"italic"}},"-"):t(o?xt:Lt,Object.assign({},e))},kt=e=>{const{value:i,scenario:n,height:o,measureScale:s,locale:r,decimalDigits:l,columnWidthEm:a=10,styles:c=gt,waterfall:h}=e,u=c.scaleFactor,d=c.fontSize,f=h.max-h.min;if(null==i||isNaN(i)||f<=0)return t("span",{class:"bar-chart-empty",style:{color:c.fontColor,fontStyle:"italic"}},"-");const{totalWidth:p,labelAreaWidth:v,barAreaWidth:$,labelGap:m}=function(t,e){const i=ut(t,e),n=Math.min(2.85*e,i/4);return{totalWidth:i,labelAreaWidth:n,barAreaWidth:i-2*n,labelGap:st*e}}(a,c.emPx),g=$/f,b=t=>v+(t-h.min)*g,w=2*u,E=o-2*w,y=w,S=b(0),R=b(h.start),M=b(h.end),O=Math.min(R,M),N=Math.abs(M-R),_=Ut(n,i,!1,c),U=Gt(_,Rt(n)),{stroke:G,strokeWidth:T}=Tt(_),L=yt(i,"partof"===h.kind,s,r,0,!0,l).replace(/^\+/,""),x=M<R,C=x?O-m:O+N+m,k=x?"end":"start";return t("svg",{width:p,height:o,class:"cell-bar-chart waterfall-bar",style:{overflow:"visible"}},t(Et,{styles:c}),t("line",{x1:S,y1:0,x2:S,y2:o,stroke:bt,"stroke-width":1*u}),void 0!==h.parentStart&&void 0!==h.parentEnd&&t("line",{x1:b(h.parentStart),y1:0,x2:b(h.parentStart),y2:o,stroke:bt,"stroke-width":1*u,"stroke-dasharray":`${2*u},${2*u}`}),void 0!==h.parentStart&&void 0!==h.parentEnd&&t("line",{x1:b(h.parentEnd),y1:0,x2:b(h.parentEnd),y2:o,stroke:bt,"stroke-width":1*u,"stroke-dasharray":`${2*u},${2*u}`}),N>0&&t("rect",{x:O,y,width:N,height:E,fill:U,stroke:G,"stroke-width":T*u}),t("text",{x:C,y:o/2,dy:"0.35em","text-anchor":k,fill:c.fontColor,"font-size":d,"font-family":c.fontFamily},L))},Pt=`IFNULL(${v.ROWGROUP}, '')`;class At{constructor(t){this.groups=[v.CATEGORY,v.CATEGORYINDEX],z.OPT!==t.type&&z.OPTNOTOTAL!==t.type||this.groups.unshift(v.OPERATION),t.grouped&&(this.groups.push(v.ROWGROUP),this.groups.push(v.ROWGROUPINDEX))}toString(){return this.groups.map((t=>t===v.ROWGROUP?Pt:t)).toString()}select(){return this.groups.map((t=>t===v.ROWGROUP?`${Pt} as ${t}`:t)).toString()}noCategory(){return this.groups.filter((t=>t!==v.CATEGORY))}toArray(){return this.groups}}class Dt{constructor(t,e){this.hasPartOf=!1,this.params=[],this.sortSelect="",this.hasBlankRowGroup=!1,this.config=t,this.i18n=e}execute(t,e){var i;this.db=t,this.fromExpr=e;for(const t of[...this.config.scenarios,...this.config.categoryThereOf.keys()])if(!L.test(t))throw new Error(`invalid identifier "${t}"`);const n=[],o=[],s=[],r=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),l=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),a=this.getRelativeScenarios(),c=this.config.attributes.map((t=>this.translateAttributeSQL(t))).toString(),h=new At(this.config),u=this.config.interval===q?this.config.sortOrder:{hierarchy:this.config.sortOrder.hierarchy.map((t=>{var e,i;return null!==(i=null===(e=x(t))||void 0===e?void 0:e.column)&&void 0!==i?i:t})),direction:this.config.sortOrder.direction};let d=["",""];u.hierarchy.length>0&&(d=this.createOrderString(u)),this.hasPartOf=this.checkConfigForPartOf();const{hierarchy:f,direction:p}=u,$=f.filter((t=>t===v.ROWGROUP||t===v.ROWGROUPINDEX||t.toUpperCase()in w)),m=$.filter((t=>t.toUpperCase()in w)).map((t=>`, SUM(${t} * transformOperator(operation)) as ${t}`)).join(""),g=$.length>0?$.map((t=>`${t} ${p}`)).toString():`${v.ROWGROUPINDEX} asc`,b=t.exec(`SELECT COUNT(DISTINCT ${v.CATEGORY}) as ${v.TOTALROWCOUNT} ${this.config.grouped?`, ${Pt} as ${v.ROWGROUP}, FIRST(${v.ROWGROUPINDEX}) as ${v.ROWGROUPINDEX}${m}`:""}\n FROM ${e} ${this.config.grouped?`GROUP BY ${Pt} ORDER BY ${g}`:""}`);return 0===b.length||1===b.length&&0===(null!==(i=b[0][v.TOTALROWCOUNT])&&void 0!==i?i:0)&&!this.config.grouped?[]:(this.hasBlankRowGroup=this.config.grouped&&b.some((t=>""===t.rowGroup)),b.forEach((t=>{const e=this.config.grouped?""===t.rowGroup?`WHERE (${v.ROWGROUP} IS NULL OR ${v.ROWGROUP} = '')`:`WHERE ${v.ROWGROUP} = ${this.bind(t.rowGroup)}`:"";let i="";this.config.limit&&(i=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,n),this.createDataRow(n,t,h,r,c,e,d,i),this.createRestRow(t,n,h,r,e,d),this.createGroupSumRow(n,o,t,l,e,d)})),this.createTotalSumRow(n,o,l),n.forEach((t=>s.push(this.exec(t)))),this.detectNaNCells(this.config.scenarios,s),this.createThereOfDrillRows(r,c,d,s),this.createPartOfDrillRows(r,d,o,s),this.createIntervalColumns(s),this.createThereOfDrillColumns(this.config.categoryThereOf,s),this.calculateColumnGroupRest(s,this.config.categoryThereOf),this.calculateRelativeVariances(s,a),s)}detectNaNCells(t,e){e.forEach((e=>{e.map((e=>(t.forEach((t=>{const i=new p(t);!0===i.isValid?0!==e[i.base+"_cnt"]&&0!==e[i.delta+"_cnt"]||(e[t]=Number.NaN):0===e[t+"_cnt"]&&(e[t]=Number.NaN)})),e)))}))}createPartOfDrillRows(t,e,i,n){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===z.LIST)return;const o=this.createPartOfQuery(t,e);let s=[];const r=this.db,l=this.params;o.forEach((t=>{s.push(...this.exec(t))}));const a=this.exctractScenarioNames(t),c=[];i.forEach((function(t){c.push(...r.exec(t,l))}));const h=new Map;c.forEach((t=>h.set(t[v.ROWGROUP],t))),s=this.reduceResDrillByCategoryGroups(s,a),s.forEach((function(t){a.forEach((e=>{try{t[e]=t[e]/h.get(t[v.ROWGROUP])[e]}catch(i){console.error("DataQuery: partOf drill row calculation failed",e,i),t[e]=Number.NaN}}))})),this.injectDrillRowsToResultRows(s,n)}createRestRow(t,e,i,n,o,s){var r;if(t.totalRowCnt-this.config.limit>0&&0!==this.config.limit){const l=this.exctractScenarioNames(n).map((t=>`SUM(${t}) as ${t}`)).join(", "),a=z.OPT===this.config.type||z.OPTNOTOTAL===this.config.type?", CASE WHEN MAX(transformOperator(operation)) = -1 THEN '-' ELSE '+' END as restOperation":"";e.push(`SELECT ${v.ROWNR}, 1 as ${v.ROWGROUPINDEX} , 'ENTRY' as ${v.TYPE}, 'NO_GROUP' as ${v.ROWGROUP}, ${this.bind(String(null!==(r=t.rowGroup)&&void 0!==r?r:""))} as restRowGroup, 'REST' as ${v.CATEGORY}${a} ${l.length>0?", "+l:""} FROM (SELECT ROWNUM() AS ${v.ROWNR}, ${e.length} as ${v.ROWGROUPINDEX} , 'ENTRY' as ${v.TYPE}, ${this.bind(String(t.rowGroup||"NO_GROUP"))} as ${v.ROWGROUP}, ${i.select()} ${n.length>0?",".concat(n):""}${this.sortSelect} FROM ${this.fromExpr} ${o} GROUP BY ${i} ORDER BY ${s[0]}) t WHERE t.rowNr > ${this.config.limit}`)}}createDataRow(t,e,i,n,o,s,r,l){t.push(`SELECT ROWNUM() AS ${v.ROWNR},\n ${t.length} as ${v.ROWGROUPINDEX},\n 'ENTRY' as ${v.TYPE},\n ${this.bind(String(e.rowGroup||"NO_GROUP"))} as ${v.ROWGROUP},\n '${v.CATEGORYINDEX}',\n ${i.select()} ${n.length>0?",".concat(n):""} ${o.length>0?",".concat(o):""}${this.sortSelect}\n FROM ${this.fromExpr} ${s}\n GROUP BY ${i}\n ORDER BY ${r[0]} ${l}`)}createGroupHeaderRow(t,e){if(!0===this.config.grouped&&(this.config.showGroupTitle||!this.hasGroupSum())){const i=this.bind(String(t.rowGroup)),n=""===t.rowGroup?this.bind("-"):i;e.push(`SELECT ROWNUM() AS ${v.ROWNR},\n ${e.length} as ${v.ROWGROUPINDEX},\n 'GROUPHEAD' as ${v.TYPE},\n ${i} as ${v.ROWGROUP} ${this.config.showGroupTitle?`,${n} as ${v.CATEGORY}`:""}\n FROM ${this.fromExpr}\n GROUP BY '1'`)}}hasGroupSum(){return z.SUM===this.config.type||z.SUMNOTOTAL===this.config.type||z.OPT===this.config.type||z.OPTNOTOTAL===this.config.type}createGroupSumRow(t,e,i,n,o,s){if(!0===this.config.grouped&&this.hasGroupSum()){const r=this.bind(String(i.rowGroup));t.push(`SELECT ${t.length} as ${v.ROWGROUPINDEX},\n '=' as ${v.OPERATION},\n ${r} as ${v.ROWGROUP},\n ROWNUM() AS ${v.ROWNR},\n 'GROUP_SUM' as ${v.TYPE} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr} ${o}\n ORDER BY ${s[0]} `),e.push(`SELECT ${t.length} as ${v.ROWGROUPINDEX},\n '=' as ${v.OPERATION},\n ${r} as ${v.ROWGROUP},\n ROWNUM() AS ${v.ROWNR},\n 'GROUP_SUM' as ${v.TYPE} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr} ${o}\n ORDER BY ${s[0]} `)}}createTotalSumRow(t,e,i){var n;if(z.SUM===this.config.type||z.OPT===this.config.type){const e=(null===(n=this.config.title)||void 0===n?void 0:n.trim())||"SUM_TOTAL",o=this.hasPartOf&&!1===this.config.grouped&&"SUM_TOTAL"!==e?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} ${e}`:e;t.push(`SELECT ${t.length} as ${v.ROWGROUPINDEX},\n ${this.bind(o)} as ${v.ROWGROUP},\n '=' as ${v.OPERATION},\n 'SUM' as ${v.TYPE} ${i.length>0?",".concat(i):""}\n FROM ${this.fromExpr} `)}e.push(`SELECT ${t.length} as ${v.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${v.ROWGROUP},\n '=' as ${v.OPERATION},\n 'SUM' as ${v.TYPE} ${i.length>0?",".concat(i):""}\n FROM ${this.fromExpr} `)}reduceResDrillByCategoryGroups(t,e){const i=new Map;return t.forEach((function(t){const n=t.rowNr+t.rowGroup+t.type+t.category;if(i.has(n)){const o=i.get(n);e.forEach((e=>{try{o[e]+=t[e]}catch(t){console.error("DataQuery: drill row aggregation failed",e,t)}}))}else i.set(n,t)})),[...i.values()]}injectDrillRowsToResultRows(t,e){const i=new Map;if(!0===this.config.grouped)t.forEach((function(t){e.forEach((function(e){const n=e.findIndex((e=>e.category===t.category&&e.rowGroup===t.rowGroup));if(n>=0){if(i.has(`${t.category}_${t.rowGroup}`)){const e=i.get(`${t.category}_${t.rowGroup}`)||0;i.set(`${t.category}_${t.rowGroup}`,e+1)}else i.set(`${t.category}_${t.rowGroup}`,1);t[v.ROWNR]=i.get(`${t.category}_${t.rowGroup}`),e.splice(n+t[v.ROWNR],0,t)}}))}));else{const n=this.findDuplicateSubCategories(t);t.forEach((function(t){e.forEach((function(e){const o=e.findIndex((e=>null!=e.category&&e.category===t.category));if(o>=0){if(i.has(`${t.category}`)){const e=i.get(`${t.category}`)||0;i.set(`${t.category}`,e+1)}else i.set(`${t.category}`,1);null!=t.rowGroup&&""!==t.rowGroup&&n.includes(`${t.category}##${t.subCategory}`)&&(t.rawSubCategory=t.subCategory,t.subCategory=`${t.subCategory} (${t.rowGroup})`),e.splice(o+t[v.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,e,i,n){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const o=[],s=[];this.config.thereOf.forEach((n=>{let s=!0,r="1 <> 1 OR ( ";null!=n.category&&0!==n.category.length&&n.category.trim()&&(r+=` ${v.CATEGORY} = ${this.bind(n.category)}`,s=!1),null!=n.rowGroup&&0!==n.rowGroup.length&&n.rowGroup.trim()&&(r+=` ${s?"":"AND"} ${v.ROWGROUP} = ${this.bind(n.rowGroup)}`,s=!1),null!=n.subCategory&&0!==n.subCategory.length&&n.subCategory.trim()&&(r+=` ${s?"":"AND"} ${v.SUBCATEGORY} = ${this.bind(n.subCategory)}`),r+=")",o.push(`SELECT ROWNUM() AS ${v.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${v.TYPE},\n ${v.CATEGORY},\n ${v.SUBCATEGORY},\n ${this.drillRowGroup} as ${v.ROWGROUP},\n ${t} ${e.length>0?",".concat(e):""}${this.sortSelect}\n FROM ${this.fromExpr}\n WHERE ${r}\n GROUP BY ${this.drillRowGroup}, ${v.CATEGORY}, ${v.SUBCATEGORY}\n ORDER BY ${i[1]}`)})),o.forEach((t=>{s.push(...this.exec(t))})),this.injectDrillRowsToResultRows(s,n)}calculateRelativeVariances(t,e){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[v.TYPE]&&e.forEach(((e,i)=>{var n;t[i]=null!==(n=N(t[i],t[e]))&&void 0!==n?n:O}))}))}))}calculateColumnGroupRest(t,e){if(null==e||0===e.size)return;const i=new Map,n=new Map;e.forEach(((t,e)=>{const o=t,s=[];for(const t of o)s.push(`${e}##${t.name}`);i.set(e,s),n.set(`${e}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[v.TYPE]&&i.forEach(((e,i)=>{let o=0;e.forEach((e=>{void 0!==t[e]&&(o+=t[e])})),t[`${i}##REST`]=t[i]-o,0!==t[`${i}##REST`]&&n.set(`${i}##REST`,!0)}))}))}));const o=Array.from(n.entries()).filter((([t,e])=>!e)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const e of o)delete t[e]}))}))}createIntervalColumns(t){var e,i,n,o,s;if(this.config.interval===X||this.config.categoryThereOf.size>0||0===this.config.scenarios.length)return;const r="##",l=`(SELECT *, ${K(this.config.interval)} as __interval FROM ${this.fromExpr}) as p`,a=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),c=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),h=[...new Set(this.exctractScenarioNames(a))],u=this.getRelativeScenarios(),d=new At(this.config),f=z.OPT===this.config.type||z.OPTNOTOTAL===this.config.type,$=this.config.grouped&&(z.SUM===this.config.type||z.SUMNOTOTAL===this.config.type||z.OPT===this.config.type||z.OPTNOTOTAL===this.config.type),m=this.checkConfigForPartOf()&&this.config.type!==z.LIST,g=t=>this.exec(t),b=t=>(this.config.scenarios.forEach((e=>{const i=new p(e);!0===i.isValid?0!==t[i.base+"_cnt"]&&0!==t[i.delta+"_cnt"]||(t[e]=Number.NaN):0===t[e+"_cnt"]&&(t[e]=Number.NaN)})),u.forEach(((e,i)=>{var n;t[i]=null!==(n=N(t[i],t[e]))&&void 0!==n?n:O})),t),w=(t,e,i)=>{for(const n of this.config.scenarios)t[n+r+i]=e[n]},E=g(`SELECT ${d.select()}, __interval ${a.length>0?",".concat(a):""}\n FROM ${l}\n GROUP BY ${d}, __interval`),y=t=>"ENTRY"===t.type&&null!=t.restRowGroup;if(this.config.limit>0)for(let n=0;n<t.length;n++){const o=t[n].find(y);if(!o)continue;let s;for(let e=n-1;e>=0&&!s;e--){const i=t[e].filter((t=>"ENTRY"===t.type&&!y(t)));i.length>0&&(s=i)}if(!s)continue;const r=new Set(s.map((t=>t.category))),l=s[0].rowGroup,a=new Map;for(const t of E){if(this.config.grouped&&t.rowGroup!==l)continue;if(r.has(t.category))continue;const n=J(t.__interval);let o=a.get(n);o||(o={},a.set(n,o));for(const n of h)o[n]=(null!==(e=o[n])&&void 0!==e?e:0)+(null!==(i=t[n])&&void 0!==i?i:0)}a.forEach(((t,e)=>{w(o,b(t),e)}))}for(const e of E){const i=J(e.__interval);b(e);for(const n of t)for(const t of n)"ENTRY"!==t.type||y(t)||t.category!==e.category||this.config.grouped&&t.rowGroup!==e.rowGroup||f&&t.operation!==e.operation||w(t,e,i)}const S=$||m&&this.config.grouped?g(`SELECT ${Pt} as ${v.ROWGROUP}, __interval ${c.length>0?",".concat(c):""}\n FROM ${l}\n GROUP BY ${Pt}, __interval`):[],R=new Map;if(S.forEach((t=>R.set(`${t.rowGroup}${r}${J(t.__interval)}`,t))),$)for(const e of S){const i=J(e.__interval),n=b(Object.assign({},e));for(const o of t)for(const t of o)"GROUP_SUM"===t.type&&t.rowGroup===e.rowGroup&&w(t,n,i)}const M=z.SUM===this.config.type||z.OPT===this.config.type,_=M||m&&!this.config.grouped?g(`SELECT __interval ${c.length>0?",".concat(c):""}\n FROM ${l}\n GROUP BY __interval`):[],U=new Map;if(_.forEach((t=>U.set(J(t.__interval),t))),M)for(const e of _){const i=J(e.__interval),n=b(Object.assign({},e));for(const e of t)for(const t of e)"SUM"===t.type&&w(t,n,i)}if(null!=this.config.thereOf&&this.config.thereOf.length>0){const e=[];this.config.thereOf.forEach((t=>{e.push(...g(`SELECT ${this.drillRowGroup} as ${v.ROWGROUP}, ${v.CATEGORY}, ${v.SUBCATEGORY}, __interval ${a.length>0?",".concat(a):""}\n FROM ${l}\n WHERE ${this.createThereOfWhereClause(t)}\n GROUP BY ${this.drillRowGroup}, ${v.CATEGORY}, ${v.SUBCATEGORY}, __interval`))}));for(const i of e){const e=J(i.__interval);b(i);for(const n of t)for(const t of n)"DRILLELEMENT"===t.type&&t.category===i.category&&t.rowGroup===i.rowGroup&&(t.subCategory!==i.subCategory&&t.subCategory!==`${i.subCategory} (${i.rowGroup})`||w(t,i,e))}}if(m){let e="1 <> 1 ";null===(n=this.config.partOf)||void 0===n||n.forEach((t=>{e+=`OR (${v.CATEGORY} = ${this.bind(t.category)}`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(e+=`and ${v.ROWGROUP} = ${this.bind(t.rowGroup)}`),e+=")"}));const i=g(`SELECT ${v.CATEGORY}, ${this.config.grouped?`${v.ROWGROUP}`:`'SUM_TOTAL' as ${v.ROWGROUP}`}, __interval ${a.length>0?",".concat(a):""}\n FROM ${l}\n WHERE ${e}\n GROUP BY ${v.ROWGROUP}, ${v.CATEGORY}, __interval`),c=new Map;for(const t of i){const e=`${t.rowGroup}${r}${t.category}${r}${J(t.__interval)}`,i=c.get(e);if(i)for(const e of h)i[e]=(null!==(o=i[e])&&void 0!==o?o:0)+(null!==(s=t[e])&&void 0!==s?s:0);else c.set(e,t)}c.forEach((e=>{const i=J(e.__interval),n=this.config.grouped?R.get(`${e.rowGroup}${r}${i}`):U.get(i);for(const t of h)e[t]=e[t]/(n?n[t]:Number.NaN);b(e);for(const n of t)for(const t of n)"PARTELEMENT"===t.type&&t.category===e.category&&t.rowGroup===e.rowGroup&&w(t,e,i)}))}}createThereOfWhereClause(t){let e=!0,i="1 <> 1 OR ( ";return null!=t.category&&0!==t.category.length&&t.category.trim()&&(i+=` ${v.CATEGORY} = ${this.bind(t.category)}`,e=!1),null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(i+=` ${e?"":"AND"} ${v.ROWGROUP} = ${this.bind(t.rowGroup)}`,e=!1),null!=t.subCategory&&0!==t.subCategory.length&&t.subCategory.trim()&&(i+=` ${e?"":"AND"} ${v.SUBCATEGORY} = ${this.bind(t.subCategory)}`),i+")"}getRelativeScenarios(){const t=new Map;return this.config.scenarios.forEach((e=>{const i=this.createRelativeScenario(e);null!=i&&t.set(i.key,i.value)})),t}translateScenarioSQL(t,e,i){const n=new p(t);if(z.OPT===i||z.OPTNOTOTAL===i){if(n.isValid){const i=e?" * transformOperator(operation)":"",o=e?`SUM((${n.base} - ${n.delta})${i}) as ${t}`:`SUM(${n.base} - ${n.delta}) as ${t}`;return"dr"===n.type?`${o}, SUM(${n.delta}${i}) as dr_${n.delta}`:o}return e?`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:`SUM(${t}) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}return n.isValid?"dr"===n.type?`SUM((${n.base} * transformOperator(operation)) - (${n.delta} * transformOperator(operation))) as ${t}, SUM(${n.delta} * transformOperator(operation)) as dr_${n.delta}`:`SUM((${n.base} * transformOperator(operation))- (${n.delta} * transformOperator(operation))) as ${t}`:`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}translateAttributeSQL(t){const e=`[${t.arg}]`,i=/^(ac|pp|fc|pl)[1-4]$/.test(t.arg)&&this.config.type!==z.OPT&&this.config.type!==z.OPTNOTOTAL;switch(t.fn){case"set":return`SETAGG(${e}) as ${t.alias}`;case"first":return`FIRST(${e}) as ${t.alias}`;case"last":return`LAST(${e}) as ${t.alias}`;case"min":return`MIN(${e}) as ${t.alias}`;case"max":return`MAX(${e}) as ${t.alias}`;case"avg":return i?`AVG(${e} * transformOperator(operation)) as ${t.alias}`:`AVG(${e}) as ${t.alias}`;case"sum":return i?`SUM(${e} * transformOperator(operation)) as ${t.alias}`:`SUM(${e}) as ${t.alias}`;case"lit":{const e=t.arg;return`${this.bind(""===e||Number.isNaN(Number(e))?e:Number(e))} as ${t.alias}`}}}get drillRowGroup(){return this.config.grouped?Pt:v.ROWGROUP}exec(t){const e=this.db.exec(t,this.params);return this.config.grouped&&e.forEach((t=>t.rowGroup=null==t.rowGroup?"":String(t.rowGroup))),e}bind(t){return`$${this.params.push(t)-1} `}createOrderString(t){const e=Q.ASC===t.direction?Q.DESC:Q.ASC,i=new Map;t.hierarchy.forEach(((t,e)=>{const n=x(t),o=null==n?void 0:n.bucket;("variance"===(null==n?void 0:n.kind)||"scenario"===(null==n?void 0:n.kind)&&void 0!==o)&&i.set(e,this.translateSortKeySQL(n,o,e))})),this.sortSelect=[...i.values()].map((t=>`, ${t}`)).join("");const n=t.hierarchy.some((t=>{var e;const i=null===(e=x(t))||void 0===e?void 0:e.kind;return"scenario"===i||"variance"===i}));n&&(this.sortSelect+=`, CASE WHEN ${v.CATEGORY} = 'REST' THEN 1 ELSE 0 END as __sortrest`);const o=(t,e,n)=>i.has(e)?`__sortnull${e} asc, __sort${e} ${n}`:`${t} ${n}`,s=t.hierarchy.map(((e,i)=>o(e,i,t.direction))).toString(),r=t.hierarchy.map(((t,i)=>o(t,i,e))).toString();return n?[`__sortrest asc, ${s}`,`__sortrest desc, ${r}`]:[s,r]}translateSortKeySQL(t,e,i){const n=z.OPT===this.config.type||z.OPTNOTOTAL===this.config.type?"":" * transformOperator(operation)",o=void 0===e?"":`TRIM(CAST(${K(q)} AS STRING)) = ${this.bind(e)}`,s=t=>`SUM(${o?`(CASE WHEN ${o} THEN ${t} ELSE 0 END)`:t}${n})`,r=t=>`SUM(CASE WHEN ${o?`${o} AND `:""}${t} IS NOT NULL THEN 1 ELSE 0 END) = 0`;if("scenario"===t.kind)return`${s(t.column)} as __sort${i}, CASE WHEN ${r(t.column)} THEN 1 ELSE 0 END as __sortnull${i}`;const l=`(${s(t.base)} - ${s(t.delta)})`;let a=l,c=`${r(t.base)} OR ${r(t.delta)}`;if("dr"===t.type){const e=s(t.delta),i=`ABS(${e}) <= ABS(${l}) * 0.000000001`;a=`CASE WHEN ${i} THEN 0 ELSE ${l} / ABS(${e}) END`,c+=` OR ${i}`}return`${a} as __sort${i}, CASE WHEN ${c} THEN 1 ELSE 0 END as __sortnull${i}`}createRelativeScenario(t){const e=new p(t);return e.isValid&&"dr"===e.type?{key:`${t}`,value:`dr_${e.delta}`}:null}exctractScenarioNames(t){const e=[];return t.split(",").forEach((t=>t.length>=2?e.push(t.split("as")[1].trim()):null)),e}findDuplicateSubCategories(t){const e=t.map((t=>({count:1,subCategory:`${t.category}##${t.subCategory}`}))).reduce(((t,e)=>(t[e.subCategory]=(t[e.subCategory]||0)+e.count,t)),{});return Object.keys(e).filter((t=>e[t]>1))}createPartOfQuery(t,e){var i;const n=[];let o="1 <> 1 ",s=` ${this.drillRowGroup} as ${v.ROWGROUP}`,r="ROWNUM()";return null===(i=this.config.partOf)||void 0===i||i.forEach((t=>{o+=`OR (${v.CATEGORY} = ${this.bind(t.category)}`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(o+=`and ${v.ROWGROUP} = ${this.bind(t.rowGroup)}`),!1===this.config.grouped&&(s=` 'SUM_TOTAL' as ${v.ROWGROUP} `,r="1"),o+=")"})),n.push(`SELECT ${r} AS ${v.ROWNR},\n 'PARTELEMENT' as ${v.TYPE},\n ${v.CATEGORY},\n ${s},\n ${t}${this.sortSelect}\n FROM ${this.fromExpr}\n WHERE ${o}\n GROUP BY ${this.drillRowGroup}, ${v.CATEGORY}, ${v.TYPE}\n ORDER BY ${e[1]}`),n}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,e){if(null==t||0===t.size)return;const i=[],n=[],o=this.fromExpr;t.forEach(((t,e)=>{let n="1 <> 1 ";t.forEach((t=>{n+=` or columnGroup = ${this.bind(String(t.name))} `})),i.push(`SELECT 'ENTRY' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),i.push(`SELECT 'ENTRY' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),i.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),i.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),i.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),i.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),i.push(`SELECT 'SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, columnGroup, scenario`),i.push(`SELECT 'SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${o}\n WHERE ${n}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of i)n.push(...this.db.exec(t,this.params));this.injectDrillColumnsToResultRows(n,e)}injectDrillColumnsToResultRows(t,e){const i="##";for(const n of t)for(const t of e)for(const e of t)if(e.type===n.rowlevel)if("ENTRY"===n.rowlevel)"COLUMNGROUP"===n.columnlevel&&e.category===n.category?e[n.scenario+i+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&(e[n.scenario+i+n.columnGroup+i+n.columnSubGroup]=n.val);else if("DRILLELEMENT"===n.rowlevel){if(!this.config.grouped&&e.rowGroup!==n.rowGroup)continue;"COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory?e[n.scenario+i+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory?e[n.scenario+i+n.columnGroup+i+n.columnSubGroup]=n.val:"COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===`${n.subCategory} (${n.rowGroup})`?e[n.scenario+i+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===`${n.subCategory} (${n.rowGroup})`&&(e[n.scenario+i+n.columnGroup+i+n.columnSubGroup]=n.val)}else("SUM"===n.rowlevel||"GROUP_SUM"===n.rowlevel)&&("COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory&&(e[n.scenario+i+n.columnGroup]=n.val),"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory&&(e[n.scenario+i+n.columnGroup+i+n.columnSubGroup]=n.val))}}class Wt{constructor(){this.geometry=new Map}set(t,e,i){let n=this.geometry.get(t);n||(n=new Map,this.geometry.set(t,n)),n.set(e,i)}get(t,e){var i;return null===(i=this.geometry.get(t))||void 0===i?void 0:i.get(e)}}function Bt(t,e,i){const n=t[e];if(null==n)return null;const o=Number(n);return isNaN(o)?null:i!==z.OPT&&i!==z.OPTNOTOTAL||t[v.TYPE]!==V.ENTRY||"-"!==t[v.OPERATION]?o:-o}class Ft{constructor(t){this.ruleSet=t,this.normalizedHeader=[],this.attributesByAlias=new Map,this.hasBlankRowGroup=!1,this.dateBuckets=!1,this.unsignedEntries=!1}underlineClass(t){return this.ruleSet&&/^(ac|pp|fc|pl)[1-4]$/.test(t)?$(this.ruleSet.getScenarioColorIndex(t))+t.slice(2):null}getNormalizedHeader(){return this.normalizedHeader}createHeader(t,e,i,n,o,s,r=[],l=0){const a=[];this.attributesByAlias=new Map(r.map((t=>[t.alias,t]))),this.normalizedHeader=this.normalizeHeader(t,e,r,l);const c=this.normalizedHeader.some((t=>void 0!==t.bucket));c&&a.push(this.createIntervalBandRow());const h=new nt(c?1:0,0,V.HEADER),u=new nt(c?2:1,0,V.SEPERATORLINE);for(const t of this.normalizedHeader){const e=this.attributesByAlias.get(t.name);h.createElement(e?i.get(e.label)||e.label:f.translateScenarioLabel(t.name,i),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,i,n,o,s),null,null,null,null),u.createElement(null,t.type,this.createColumnType(t),null,null,this.underlineClass(t.type),null,null,null)}return a.push(h),a.push(u),a}createIntervalBandRow(){const t=new nt(0,0,V.HEADER);let e=0;for(;e<this.normalizedHeader.length;){const i=this.normalizedHeader[e];if(void 0===i.bucket){t.createElement(null,i.type,"filler",null,null,null,null,null,null),e+=1;continue}let n=1;for(;e+n<this.normalizedHeader.length&&this.normalizedHeader[e+n].bucket===i.bucket;)n+=1;t.createElement(i.bucketLabel,i.type,"intervalGroup",null,null,null,null,null,null,!1,void 0,n),e+=n}return t}setHeaderPrefix(t,e,i,n,o){let s="";return"category"===t.name&&o&&(0===i.prefix.length&&0===n.length||(s=f.translateScenarioLabel("in",e)+" "+i.prefix+n)),t.order&&(s+=f.translateScenarioLabel("ORDER_"+t.order,e)),s}normalizeHeader(t,e,i,n=0){let o=[{name:v.CATEGORY,group:v.CATEGORY,type:v.CATEGORY,order:void 0}];z.OPT!==t&&z.OPTNOTOTAL!==t||(o=[{name:v.OPERATION,group:v.OPERATION,type:v.OPERATION,order:void 0},{name:v.CATEGORY,group:v.CATEGORY,type:v.CATEGORY,order:void 0}]);const s=i.map((t=>({name:t.alias,group:t.alias,type:t.alias,order:void 0})));return[...e.slice(0,n),...o,...s,...e.slice(n)]}createBodyRows(t,e,i,n){var o;const s=[];let r=-1;const l=new Dt(t,e);var a;this.dateBuckets=(a=t.interval)!==X&&a!==q,this.unsignedEntries=z.OPT===t.type||z.OPTNOTOTAL===t.type;const c=l.execute(i,n);this.hasBlankRowGroup=l.hasBlankRowGroup;const h=this.calculateColumnStatistics(c,t.barColumns,t.interval!==X),u=(null!==(o=t.barColumns)&&void 0!==o?o:[]).filter((t=>t.toUpperCase().trim()in w)),d=u.length>0&&t.interval===X&&0===t.categoryThereOf.size&&function(t){for(const e of t)for(const t of e){const e=t[v.TYPE];if(e===V.SUM||e===V.GROUPSUM||e===V.DRILLELEMENT||e===V.PARTELEMENT)return!0}return!1}(c)?function(t,e,i){const n=new Wt;for(const o of e){let e,s=0,r=0;const l=[],a=(t,e)=>{l.push(e),n.set(t,o,e)};for(const n of t)for(const t of n){const n=t[v.TYPE];if(n===V.GROUPHEAD){s=0,e=void 0;continue}const l=Bt(t,o,i);if(n===V.ENTRY){if(null===l){e=void 0;continue}a(t,{start:s,end:s+l,min:0,max:0,kind:"cascade"}),e={start:s,end:s+l},r=e.start,s+=l}else if(n===V.SUM||n===V.GROUPSUM){if(null===l){e=void 0;continue}a(t,{start:0,end:l,min:0,max:0,kind:"anchor"}),e={start:0,end:l},r=0,s=n===V.GROUPSUM?0:l}else if(n===V.DRILLELEMENT){if(null===l||void 0===e)continue;const i=r+(Math.sign(e.end-e.start)||1)*Math.abs(l);a(t,{start:r,end:i,min:0,max:0,kind:"thereof",parentStart:e.start,parentEnd:e.end}),r=i}else if(n===V.PARTELEMENT){if(null===l||void 0===e)continue;const i=r+l*(e.end-e.start);a(t,{start:r,end:i,min:0,max:0,kind:"partof",parentStart:e.start,parentEnd:e.end}),r=i}}let c=0,h=0;for(const t of l)c=Math.min(c,t.start,t.end),h=Math.max(h,t.start,t.end);for(const t of l)t.min=c,t.max=h}return n}(c,u,t.type):void 0;for(const i of c)r+=1,s.push(...this.createRow(t.i18n,e,t.scenariosUnitType,i,r,-1,t.categoryWidth,t.measureScale,t.barColumns,h,d));return s}calculateColumnStatistics(t,e,i=!1){const n=new Map;if(!e||0===e.length)return n;const o=new Map;for(const t of e)n.set(t,{min:1/0,max:-1/0,absMax:0,median:0}),o.set(t,[]);for(const s of t)for(const t of s){const s=t[v.TYPE];if(s!==V.SUM&&s!==V.GROUPSUM)for(const s of e){const e=i?this.extractIntervalColumnValues(t,s):[this.extractColumnValue(t,s)];for(const t of e)if(null!==t&&!isNaN(t)){const e=n.get(s);e.min=Math.min(e.min,t),e.max=Math.max(e.max,t),o.get(s).push(Math.abs(t))}}}for(const[t,e]of n){e.min!==1/0&&e.max!==-1/0||(e.min=0,e.max=0),e.absMax=Math.max(Math.abs(e.min),Math.abs(e.max));const i=o.get(t);if(i.length>0){i.sort(((t,e)=>t-e));const t=Math.floor(i.length/2);e.median=i.length%2==0?(i[t-1]+i[t])/2:i[t]}n.set(t,e)}return n}extractIntervalColumnValues(t,e){const i=e+"##",n=[];for(const e of Object.keys(t))if(e.startsWith(i)){const i=Number(t[e]);n.push(isNaN(i)?null:i)}return n}extractColumnValue(t,e){if(void 0!==t[e]){const i=Number(t[e]);return isNaN(i)?null:i}for(const i of Object.keys(t))if(i===e||i.endsWith("##"+e)||i===e+"##"+e){const e=Number(t[i]);if(!isNaN(e))return e}return null}createRow(t,e,i,n,o,s,r,l,a,h,u){var d,f,$;const m=[];let g;for(const b of n){const w=b[v.ROWGROUP],E=""===w?"-":w,y=b[v.SUBCATEGORY],S=b[v.TYPE],R=b[v.ROWNR]>=2;g=null!==(f=null!==(d=b.operation)&&void 0!==d?d:b.restOperation)&&void 0!==f?f:g;const M=this.createDetailRow(S,s+=1,o,n.length);M.key=this.rowKey(b);for(const n of this.normalizedHeader){const o=this.getRawDataRowElement(b,n),s=null!==($=null==a?void 0:a.includes(n.type))&&void 0!==$&&$,d=s?null==h?void 0:h.get(n.type):void 0,f=s&&void 0===n.bucket&&n.name===n.group&&n.name===n.type?null==u?void 0:u.get(b,n.type):void 0;M.createElement(this.translateSumCellLabel(t,e,o,E,y,S,n.type),n.type,this.createColumnType(n),this.setCellType(n.type,i),this.translateCellPrefix(e,S,n.type),this.translateScenarioCSS(n.type,o,g),R,r,null==l?void 0:l.value,s,d,1,f);const v=M.elements[M.elements.length-1];this.dateBuckets&&void 0!==n.bucket&&(v.date=c(n.bucket));const m=new p(n.type);m.isValid&&(v.direction=this.resolveDirection(m,g))}m.push(M)}return m}rowKey(t){var e;const i=null!=t.restRowGroup?t.restRowGroup:"NO_GROUP"===t.rowGroup?void 0:t.rowGroup;switch(t.type){case V.ENTRY:return{rowGroup:i,category:t.category,subCategory:t.subCategory};case V.DRILLELEMENT:return{rowGroup:i,category:t.category,subCategory:null!==(e=t.rawSubCategory)&&void 0!==e?e:t.subCategory};case V.GROUPSUM:return{rowGroup:i,row:"subtotal"};case V.SUM:return{row:"total"};default:return}}getRawDataRowElement(t,e){return void 0!==e.bucket?t[e.type+"##"+e.bucket]:e.name===e.group&&e.name===e.type?t[e.name]:e.name===e.group&&e.name!==e.type?t[e.type+"##"+e.name]:t[e.type+"##"+e.group+"##"+e.name]}createDetailRow(t,e,i,n){switch(t){case V.GROUPHEAD:return new nt(e,i,V.HEADER);case V.SUM:case V.GROUPSUM:return new nt(n+2,i,V.SUM);case V.DRILLELEMENT:return new nt(n+2,i,V.DRILLELEMENT);case V.PARTELEMENT:return new nt(n+2,i,V.PARTELEMENT);default:return new nt(e,i,V.STANDARD)}}translateSumCellLabel(t,e,i,n,o,s,r){return this.attributesByAlias.has(r)||!1===Number.isNaN(Number(i))||this.isOperationColumn(r)?i:this.isGroupHeadCategory(s,r)?t===E.ALL?`${e.get(i)||i}`:i:this.isEntryCategory(s,r)?t===E.ALL||"REST"===i?`${e.get(i)||i}`:i:this.isDrillElementCategory(s,r)?t===E.ALL?`${e.get(o)||o}`:`${o}`:this.isPartElementCategory(s,r)?t===E.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:`${n}`:this.isSumElementCategory(s,r)?t===E.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:n:"GROUPHEAD"===s&&null==i||i===O?i:Number.isNaN(Number(i))?"-":Number(i)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,e,i){if(this.attributesByAlias.has(t))return"attribute";const n=new p(t);let o="pos";return e<0&&(o="neg"),n.isValid?o+"_"+this.resolveDirection(n,i)+("dr"===n.type?" relative_variance":""):t}resolveDirection(t,e){return m(t.direction,e,!this.unsignedEntries)}setCellType(t,e){if("category"===t)return"";const i=this.attributesByAlias.get(t);if(i)return i.isNumeric?"decimal":"";let n;const o=new p(t);return e===y.PERCENT?(n="percent",o.isValid&&"d"===o.type&&(n="percentpoint")):(n="decimal",o.isValid&&"dr"===o.type&&(n="percent")),n}isDrillElementCategory(t,e){return"DRILLELEMENT"===t&&"category"===e}isPartElementCategory(t,e){return"PARTELEMENT"===t&&"category"===e}isSumElementCategory(t,e){return("GROUP_SUM"===t||"SUM"===t)&&"category"===e}isEntryCategory(t,e){return"ENTRY"===t&&"category"===e}isGroupHeadCategory(t,e){return"GROUPHEAD"===t&&"category"===e}translateCellPrefix(t,e,i){return this.isOperationColumn(i)||this.isGroupHeadCategory(e,i)||this.isEntryCategory(e,i)?null:this.isDrillElementCategory(e,i)?`${t.get("thereof")} `:this.isPartElementCategory(e,i)?`${t.get("part_of")} `:null}createColumnType(t){return t.name===t.group&&t.name===t.type?"base":t.name===t.group?"columnGroup":"columnSubGroup"}}class It{constructor(t,e,i,n){this.fromExpr="",this.rowCount=0,this.headerRows=[],this.bodyRows=[],this.intervalBuckets=[],this.ruleSet=t||new g,this.db=e,this.dataSetFactory=new Ft(this.ruleSet),this.config=this.initConfig(n),this.i18n=this.initI18n(new Map),this.setSource(i,n.filter)}setI18n(t){this.i18n=this.initI18n(t)}initI18n(t){const e=new Map([["",""],["SEPARATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["category"," "],["operation"," "],["thereof","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"]]);return this.state=j.DIRTY,new Map([...e,...t||new Map])}initConfig(t){this.state=j.DIRTY;const e=t,i=this;return t.scenarios.sort(((t,e)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(e))),e}setConfig(t){this.config=this.initConfig(t)}setSource(t,e){var i,n;if(this.state=j.DIRTY,this.fromExpr=k(this.db,t,e),!this.fromExpr)return void(this.rowCount=0);const o=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(n=null===(i=o[0])||void 0===i?void 0:i.cnt)&&void 0!==n?n:0}update(){this.prepareIntervalBuckets();const t=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder,this.intervalBuckets);this.headerRows=this.dataSetFactory.createHeader(this.config.type,t,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale,this.config.attributes,Math.min(this.categoryIntervalPosition(),this.intervalBuckets.length)*this.config.scenarios.length),this.bodyRows=0!==this.rowCount&&this.fromExpr?this.dataSetFactory.createBodyRows(this.config,this.i18n,this.db,this.fromExpr):[],this.state=j.UP_TO_DATE}getHeader(){return this.state===j.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===j.DIRTY&&this.update(),this.bodyRows}getColumns(){return this.state===j.DIRTY&&this.update(),this.dataSetFactory.getNormalizedHeader()}prepareIntervalBuckets(){this.intervalBuckets=[],this.config.interval===X||!this.fromExpr||this.config.categoryThereOf.size>0?this.config.interval=X:(this.config.interval=function(t,e,i){var n;if(i!==G.AUTO)return i;const o=t.exec(`SELECT [date] as d FROM ${e}`);let s,r;for(const t of o){const e=null===(n=tt(t.d))||void 0===n?void 0:n.toMillis();void 0!==e&&(s=void 0===s?e:Math.min(s,e),r=void 0===r?e:Math.max(r,e))}return void 0===s||void 0===r?G.DAY:(new T).calculateDistanceType(_.fromMillis(s),_.fromMillis(r))}(this.db,this.fromExpr,this.config.interval),this.intervalBuckets=function(t,e,i,n){if(i===q){const n=t.exec(`SELECT ${K(i)} as __interval, COALESCE([setnameIndex],[setNameIndex]) as __index FROM ${e}`),o=new Set,s=new Map,r=[];for(const t of n){const e=J(t.__interval);o.has(e)||(o.add(e),r.push({key:e,label:0===e.length?"-":e}));const i=Z(t.__index),n=s.get(e);void 0!==i&&(void 0===n||i<n)&&s.set(e,i)}if(s.size>0){const t=t=>{var e;return null!==(e=s.get(t.key))&&void 0!==e?e:Number.POSITIVE_INFINITY};r.sort(((e,i)=>t(e)===t(i)?0:t(e)<t(i)?-1:1))}return r}const o=t.exec(`SELECT ${K(i)} as __interval FROM ${e}`),s=new Set,r=[];for(const t of o){const e=tt(t.__interval);if(!e)continue;const i=e.toISO();s.has(i)||(s.add(i),r.push(e))}r.sort(((t,e)=>t.toMillis()-e.toMillis()));const l=new T;return l.setLocale(n),r.map((t=>({key:t.toISO(),label:l.getDateString(t,i)})))}(this.db,this.fromExpr,this.config.interval,this.config.locale),0===this.intervalBuckets.length&&(this.config.interval=X))}normalizeScenarios(t,e,i,n=[]){var o;const s=[],r=null===(o=null==i?void 0:i.hierarchy)||void 0===o?void 0:o.map((t=>x(t))).find((t=>"dim"!==(null==t?void 0:t.kind))),l=this.config.interval===q?null==r?void 0:r.bucket:void 0,a=(t,e)=>{var n;return null==r||(null===(n=x(t))||void 0===n?void 0:n.column)!==r.column||void 0!==l&&l!==e?void 0:i.direction};if(n.length>0){for(const e of n)for(const i of t)s.push({name:i,group:i,type:i,order:a(i,e.key),bucket:e.key,bucketLabel:e.label});return s}for(const i of t){if(null==e?void 0:e.has(i)){const t=e.get(i);for(const e of t){s.push({name:e.name,group:e.name,type:i,order:void 0});for(const t of e.subGroups)s.push({name:t,group:e.name,type:i,order:void 0})}s.push({name:"REST",group:"REST",type:i,order:void 0})}s.push({name:i,group:i,type:i,order:a(i)})}return s}hasNoData(){return 0===this.rowCount}orderBucketWarning(){var t,e;if(this.hasNoData()||this.state!==j.UP_TO_DATE)return;const i=(null!==(e=null===(t=this.config.sortOrder)||void 0===t?void 0:t.hierarchy)&&void 0!==e?e:[]).map((t=>{var e;return null===(e=x(t))||void 0===e?void 0:e.bucket})).filter((t=>void 0!==t));if(0===i.length)return;if(this.config.interval!==q)return`order: '@${i[0]}' needs interval setname, the bucket is ignored.`;const n=i.find((t=>!this.intervalBuckets.some((e=>e.key===t))));return void 0===n?void 0:`order: setname '${n}' not found, the rows are not sorted by it.`}categoryIntervalPosition(){const t=this.config.categoryIntervalPosition;return Number.isInteger(t)&&t>0?t:0}categoryIntervalPositionWarning(){const t=this.categoryIntervalPosition();if(t<=0||this.hasNoData()||this.state!==j.UP_TO_DATE)return;const e=this.intervalBuckets.length;return 0===e?{id:"WARN_categoryIntervalPositionNoInterval",message:"categoryIntervalPosition: needs an active interval, the value is ignored."}:t>e?{id:"WARN_categoryIntervalPositionRange",message:`categoryIntervalPosition: '${t}' is greater than the number of interval groups, ${e} is used.`}:void 0}hasBlankRowGroup(){return this.dataSetFactory.hasBlankRowGroup}}class Ht{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=y.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.attributes=[],this.sortOrder=new C(new F).default(),this.type=z.LIST,this.limit=0,this.i18n=E.ALL,this.categoryWidth=R.W25,this.measureScale=new I,this.measureUnit="",this.measureType=M.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[],this.interval="none",this.categoryIntervalPosition=0,this.locale="de"}}class Yt{constructor(t,e,i,n,o,s){this.tableDrillGroupAdapter=t,this.stringAdapter=e,this.orderAdapter=i,this.db=n,this.fromExpr=o,this.onQueryError=s}adapt(t){const e=new Ht;return S.isString(t.title)&&(e.title=t.title),S.isArray(t.scenarios)&&(e.scenarios=B.adaptArray(t.scenarios,this.stringAdapter)),S.isExisting(t.scenariosUnitType)&&(e.scenariosUnitType=t.scenariosUnitType),S.isBoolean(t.grouped)&&(e.grouped=t.grouped),S.isBoolean(t.showGroupTitle)&&(e.showGroupTitle=t.showGroupTitle),S.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),S.isArray(t.thereOf)&&(e.thereOf=B.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),S.isExisting(t.categoryThereOf)&&(e.categoryThereOf=t.categoryThereOf),S.isArray(t.partOf)&&(e.partOf=B.adaptArray(t.partOf,this.tableDrillGroupAdapter)),S.isArray(t.attributes)&&(e.attributes=t.attributes),S.isExisting(t.order)&&(e.sortOrder=this.orderAdapter.adapt(t.order)),S.isExisting(t.type)&&(e.type=t.type),S.isNumber(t.limit)&&(e.limit=t.limit),S.isExisting(t.i18n)&&(e.i18n=t.i18n),S.isExisting(t.categoryWidth)&&(e.categoryWidth=t.categoryWidth),S.isExisting(t.measureScale)&&(e.measureScale=A.calculateMeasureScale(this.db,this.fromExpr,e.scenarios,t.measureScale,this.onQueryError)),S.isExisting(t.measureType)&&(e.measureType=t.measureType),S.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),S.isString(t.filter)&&(e.filter=t.filter.trim()),S.isArray(t.barColumns)&&(e.barColumns=t.barColumns),S.isString(t.interval)&&(e.interval=t.interval),S.isNumber(t.categoryIntervalPosition)&&(e.categoryIntervalPosition=t.categoryIntervalPosition),S.isString(t.locale)&&(e.locale=t.locale),e}default(){return new Ht}}class jt{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class zt{constructor(){}adapt(t){const e=new jt;return S.isString(t.rowGroup)&&(e.rowGroup=t.rowGroup),S.isString(t.category)&&(e.category=t.category),S.isString(t.subCategory)&&(e.subCategory=t.subCategory),S.isString(t.partOf)&&(e.partOf=t.partOf),e}default(){return new jt}}const Qt=e(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.sumTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=y.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.thereof=[],this.partof=[],this.order={hierarchy:[],direction:Q.ASC},this.categorythereof=new Map,this.attributeColumns=[],this.type=z.LIST,this.categoryWidth=R.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=E.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=M.VOLUME,this.filter="",this.barColumns=[],this.interval="none",this.categoryIntervalPosition=0,this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new D,this.barColumnLayouts=new Map,this.relayout=()=>{this.barColumnLayouts.size>0&&n(this)},U(this),this.componentStyle=H(this)}connectedCallback(){var t;null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.relayout)}disconnectedCallback(){var t;null===(t=document.fonts)||void 0===t||t.removeEventListener("loadingdone",this.relayout)}async getLayoutDetail(t,e){var i,n,o;const s={regions:[],metadata:{},diagnostics:[]},c=null===(i=this.element.shadowRoot)||void 0===i?void 0:i.querySelector("table");if(s.metadata.hasNoData=null===(o=null===(n=this.table)||void 0===n?void 0:n.hasNoData())||void 0===o||o,!this.table||!c)return s;const h=c.querySelector("thead"),d=c.querySelector("tbody");h&&s.regions.push({id:"header",rect:r(h,t)}),d&&s.regions.push({id:"body",rect:r(d,t)});const f=this.table.getHeader(),p=this.table.getBody(),v=this.table.getColumns();if(s.metadata.headerRowCount=f.length,s.metadata.rowCount=p.length,s.metadata.columnCount=v.length,s.metadata.cellCount=p.reduce(((t,e)=>t+e.getCells().length),0),"full"!==e)return s;const $=[],m=[],g=(e,i,n)=>{const o=n?Array.from(n.children).filter((t=>"tr"===t.localName)):[];i.forEach(((i,n)=>{const c=o[n];if(!c)return;$.push({section:e,index:n,type:i.type,rect:r(c,t),point:u(c)});const h=i.getCells(),d=Array.from(c.children);h.length===d.length?h.forEach(((i,o)=>{var s,c;const h=d[o],f={kind:"header"===e?"headerCell":"cell",row:n,column:i.index,key:i.key||void 0,colSpan:i.colSpan,value:null!==(s=i.value)&&void 0!==s?s:void 0,text:(null===(c=h.textContent)||void 0===c?void 0:c.trim())||void 0,type:i.type||void 0,rect:r(h,t),point:u(h)};f.point&&(f.content=l(h,t),f.contentSign=a(h)||void 0);const p=h.querySelector("svg.cell-bar-chart");p&&(f.bar={variant:p.classList.contains("waterfall-bar")?"waterfall":p.classList.contains("relative-variance")?"relative":"absolute",rect:r(p,t)}),m.push(f)})):s.diagnostics.push({id:`WARN_layout_cell_pairing_${e}_${n}`,type:"warning",message:`layout-state: model/DOM cell count mismatch in ${e} row ${n} (${h.length} vs ${d.length}); cell details skipped for this row.`})}))};return g("header",f,h),g("body",p,d),s.elements=m,s.table={rows:$,columns:v.map(((t,e)=>({index:e,key:t.name,group:t.group,type:t.type,bucket:t.bucket})))},s}render(){var e;return t(o,{class:{"no-data":!0===(null===(e=this.table)||void 0===e?void 0:e.hasNoData())}},(()=>{var e,i,n,o;if(void 0===this.table)return;if(this.table.hasNoData()){const i=null!==(e=this.i18n.get("no-data"))&&void 0!==e?e:"No Data";return t("div",{class:"empty-state"},i)}const s=null===(o=null===(n=null===(i=this.stores)||void 0===i?void 0:i.context)||void 0===n?void 0:n.state)||void 0===o?void 0:o.locale;return t("table",null,t("thead",null,this.table.getHeader().map((e=>t("tr",{class:e.cssStyle},e.getCells().map((e=>t("th",{colSpan:e.colSpan,class:e.cssStyle},e.getAsHeaderList().map(((i,n,o)=>t("span",null,n===o.length-1?t("span",{class:" "===i?"table-footer":""},i,e.drawPrefix()," "):t("span",null,i,e.drawPrefix(),t("br",null)))))))))))),t("tbody",null,this.table.getBody().map((e=>t("tr",Object.assign({class:e.cssStyle},d(e.key,"element")),null==e?void 0:e.getCells().map((i=>{var n,o,r,l,a;return t("td",Object.assign({colSpan:i.colSpan,class:i.type?`${i.cssStyle} ${i.type}`:i.cssStyle},e.key&&null!=i.value&&""!==i.value&&"-"!==i.value?d(Object.assign(Object.assign({},e.key),{date:i.date,scenario:i.key}),"element"):{}),null!=i.prefix?t("span",{class:i.cssStyle+" "+i.prefixStyle},i.drawPrefix()):"",!i.isBarChart||!i.columnStats||i.value===O||!this.showGroupTitle&&e.type===V.HEADER||void 0===i.waterfall&&e.type===V.SUM?i.draw(this.componentDataFormatDigits,s):void 0!==i.waterfall?t(kt,{value:i.value,scenario:i.key,columnStats:i.columnStats,height:18*this.scaleFactor,isRelative:!1,isPositiveGood:"pos"===i.direction,measureScale:i.measureScale,locale:s,decimalDigits:Xt(i,this.componentDataFormatDigits),columnWidthEm:this.barColumnMaxWidth,styles:this.barChartStyles,waterfall:i.waterfall}):t(Ct,{value:i.value,scenario:i.key,columnStats:i.columnStats,height:18*this.scaleFactor,isRelative:i.key.startsWith("dr"),isPositiveGood:"pos"===i.direction,measureScale:Vt(i),locale:s,decimalDigits:Xt(i,this.componentDataFormatDigits),percentDigits:null!==(o=null===(n=this.barColumnLayouts.get(i.key))||void 0===n?void 0:n.percentDigits)&&void 0!==o?o:this.componentDataFormatDigits.percent,percentSign:null===(r=this.barColumnLayouts.get(i.key))||void 0===r?void 0:r.percentSign,columnWidthEm:this.barColumnMaxWidth,labelWidths:null===(l=this.barColumnLayouts.get(i.key))||void 0===l?void 0:l.labels,sideMax:null===(a=this.barColumnLayouts.get(i.key))||void 0===a?void 0:a.sideMax,styles:this.barChartStyles}))})))))))})())}componentWillRender(){var t,e,i,n,o,s,r,l,a,c,h;this.stores||(this.stores=P(this.element));const u=this.stores.db.db;this.componentDataFormatDigits=(new W).adapt(this.dataFormatDigits);try{const e=this.prepareConfig(u);this.table=new It(new g(this.ruleSetConfig),u,this.tableName,e),this.table.setI18n(this.i18n),this.table.hasNoData()||this.table.getBody(),null===(t=this.errors)||void 0===t||t.remove("ERR_sql")}catch(t){console.error("bn-table-renderer: query failed",t),this.table=void 0,null===(e=this.errors)||void 0===e||e.addOrReplace({id:"ERR_sql",type:"error",message:`Query failed: ${t instanceof Error?t.message:t}`})}(null===(i=this.table)||void 0===i?void 0:i.hasBlankRowGroup())?null===(n=this.errors)||void 0===n||n.addOrReplace({id:"WARN_blankRowGroup",type:"warning",message:"grouped: rows with blank rowGroup found, they are grouped under '-'."}):null===(o=this.errors)||void 0===o||o.remove("WARN_blankRowGroup");const d=null===(s=this.table)||void 0===s?void 0:s.orderBucketWarning();d?null===(r=this.errors)||void 0===r||r.addOrReplace({id:"WARN_orderBucket",type:"warning",message:d}):null===(l=this.errors)||void 0===l||l.remove("WARN_orderBucket");const f=null===(a=this.table)||void 0===a?void 0:a.categoryIntervalPositionWarning();for(const t of["WARN_categoryIntervalPositionNoInterval","WARN_categoryIntervalPositionRange"])(null==f?void 0:f.id)===t?null===(c=this.errors)||void 0===c||c.addOrReplace({id:t,type:"warning",message:f.message}):null===(h=this.errors)||void 0===h||h.remove(t);this.barColumnLayouts=this.collectBarColumnLayouts(),this.barChartStyles=this.prepareBarChartStyles()}prepareConfig(t){var e,i,n;const o=k(t,this.tableName,this.filter);return new Yt(new zt,new F,new C(new F,!0),t,o,(t=>{throw t})).adapt({title:this.sumTitle,scenarios:this.scenarios,scenariosUnitType:this.scenariosDataFormat,grouped:this.grouped,showGroupTitle:this.showGroupTitle,thereOf:this.thereof,partOf:this.partof,categoryThereOf:this.categorythereof,attributes:this.attributeColumns,order:this.order,type:this.type,limit:this.limit,i18n:this.i18nMode,categoryWidth:this.categoryWidth,measureScale:this.measureScale,measureUnit:this.measureUnit,measureType:this.measureType,showMeasureScale:this.showMeasureScale,filter:this.filter,barColumns:this.barColumns,interval:this.interval,categoryIntervalPosition:this.categoryIntervalPosition,locale:(null===(n=null===(i=null===(e=this.stores)||void 0===e?void 0:e.context)||void 0===i?void 0:i.state)||void 0===n?void 0:n.locale)||"de"})}prepareBarChartStyles(){var t;const e=!(this.unitScaling>0),i=!(this.percentageScaling>0),n=e?this.autoUnitScaling():this.unitScaling,o=i?this.autoPercentageScaling():this.percentageScaling;return(e||i)&&(null===(t=this.reportAutoScaling)||void 0===t||t.call(this,{unit:e?n:void 0,percentage:i?o:void 0})),this.componentStyle((t=>{var e,i,s,r,l,a,c,u,d,f,p,v,$,m,w,E,y,S,R,M,O,N,_,U,G,T;const L=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.varianceStyles,x=null===(i=t["bn-chart-time"])||void 0===i?void 0:i.barStyles;return{positive:{stroke:(null===(s=null==L?void 0:L.pos)||void 0===s?void 0:s.stroke)||"#008f96",fill:(null===(r=null==L?void 0:L.pos)||void 0===r?void 0:r.fill)||"#008f96",fillpattern:h(null===(l=null==L?void 0:L.pos)||void 0===l?void 0:l.fillpattern)||"solid"},negative:{stroke:(null===(a=null==L?void 0:L.neg)||void 0===a?void 0:a.stroke)||"#ff0000",fill:(null===(c=null==L?void 0:L.neg)||void 0===c?void 0:c.fill)||"#ff0000",fillpattern:h(null===(u=null==L?void 0:L.neg)||void 0===u?void 0:u.fillpattern)||"solid"},neutral:{stroke:(null===(d=null==L?void 0:L.neu)||void 0===d?void 0:d.stroke)||"#808080",fill:(null===(f=null==L?void 0:L.neu)||void 0===f?void 0:f.fill)||"#808080",fillpattern:h(null===(p=null==L?void 0:L.neu)||void 0===p?void 0:p.fillpattern)||"outlined"},scenarios:b({ac:{stroke:(null===(v=null==x?void 0:x.ac)||void 0===v?void 0:v.stroke)||"#404040",fill:(null===($=null==x?void 0:x.ac)||void 0===$?void 0:$.fill)||"#404040",fillpattern:h(null===(m=null==x?void 0:x.ac)||void 0===m?void 0:m.fillpattern)||"solid"},pp:{stroke:(null===(w=null==x?void 0:x.pp)||void 0===w?void 0:w.stroke)||"#A6A6A6",fill:(null===(E=null==x?void 0:x.pp)||void 0===E?void 0:E.fill)||"#A6A6A6",fillpattern:h(null===(y=null==x?void 0:x.pp)||void 0===y?void 0:y.fillpattern)||"solid"},fc:{stroke:(null===(S=null==x?void 0:x.fc)||void 0===S?void 0:S.stroke)||"#404040",fill:(null===(R=null==x?void 0:x.fc)||void 0===R?void 0:R.fill)||"#ffffff",fillpattern:h(null===(M=null==x?void 0:x.fc)||void 0===M?void 0:M.fillpattern)||"hatched"},pl:{stroke:(null===(O=null==x?void 0:x.pl)||void 0===O?void 0:O.stroke)||"#404040",fill:(null===(N=null==x?void 0:x.pl)||void 0===N?void 0:N.fill)||"#ffffff",fillpattern:h(null===(_=null==x?void 0:x.pl)||void 0===_?void 0:_.fillpattern)||"outlined"}},new g(this.ruleSetConfig)),fontColor:(null===(U=t.global)||void 0===U?void 0:U.fontColor)||"#000000",fontSize:((null===(G=t.global)||void 0===G?void 0:G.fontSizePx)||13.3333)*ot*this.scaleFactor,emPx:((null===(T=t.global)||void 0===T?void 0:T.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:this.labelFontFamily(),unitScaling:n,percentageScaling:o,scaleFactor:this.scaleFactor}}))}labelFontFamily(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif"}))}emPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.scaleFactor}autoUnitScaling(){var t;const e=this.emPx(),i=e*ot;let n=1/0;for(const{isRelative:o,absMax:s,labels:r,sideMax:l}of this.barColumnLayouts.values()){if(o||s<=0)continue;const a=$t(this.barColumnMaxWidth,e,r,l);for(const e of["neg","pos"]){const o=null!==(t=l[e])&&void 0!==t?t:0;if(o<=0)continue;const{maxBarWidth:s,cutWidth:r}=a[e];n=Math.min(n,Math.min(.8*s,r)/(o*i))}}return Number.isFinite(n)&&i>0?n:.01}autoPercentageScaling(){var t,e;const i=this.emPx(),n=i*ot;let o=1/0;for(const{isRelative:s,absMax:r,labels:l,sideMax:a}of this.barColumnLayouts.values()){if(!s||r<=0)continue;const c=10*this.scaleFactor,{negPinLength:h,posPinLength:u}=mt(this.barColumnMaxWidth,i,l,c),d=100*((null!==(t=a.neg)&&void 0!==t?t:0)+(null!==(e=a.pos)&&void 0!==e?e:0));o=Math.min(o,(h+u)/(d*n))}return Number.isFinite(o)&&n>0?o:.5}collectBarColumnLayouts(){var t,e,i,n;const o=new Map;if(!this.table||this.table.hasNoData())return o;const s=new Map;for(const e of this.table.getBody())if(e.type!==V.SUM)for(const i of e.getCells())i.isBarChart&&i.columnStats&&void 0===i.waterfall&&("number"!=typeof i.value||isNaN(i.value)||s.set(i.key,[...null!==(t=s.get(i.key))&&void 0!==t?t:[],i]));const r=this.emPx(),l=r*ot,a=10*this.scaleFactor,c=null===(n=null===(i=null===(e=this.stores)||void 0===e?void 0:e.context)||void 0===i?void 0:i.state)||void 0===n?void 0:n.locale,h=this.labelFontFamily();for(const[t,e]of s){const i=t.startsWith("dr"),n=e.map((t=>t.value)),s=(t,o)=>{var s;const r={neg:n.some((t=>t<0))?0:void 0,pos:n.some((t=>t>0))?0:void 0},a=Nt(r);for(const n of e){const e=n.value,u=e>0||0===e&&a?"pos":"neg",d=yt(e,i,Vt(n),c,t,o,Xt(n,this.componentDataFormatDigits));r[u]=Math.max(null!==(s=r[u])&&void 0!==s?s:0,ht(d,l,h,i))}return r};let u=Math.min(20,Math.max(0,Math.trunc(this.componentDataFormatDigits.percent)||0)),d=!0,f=s(u,d);for(;i&&(u>0||d)&&!pt(this.barColumnMaxWidth,r,f,a);)u>0?u--:d=!1,f=s(u,d);const p=Math.max(...n.map(Math.abs))*(i?100:1),v={neg:void 0===f.neg?void 0:Math.max(0,...n.map((t=>-t))),pos:void 0===f.pos?void 0:Math.max(0,...n)};o.set(t,{isRelative:i,absMax:p,labels:f,sideMax:v,percentDigits:u,percentSign:d})}return o}get element(){return this}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{position:relative;display:inline-block}table{background-color:var(--bn-font-background, white);font-size:var(--bn-font-size, 1em);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);border-spacing:0.3em 0}thead{border-style:none}tr:first-child td{border-top:none;padding-top:0.5em}td.ac1,td.ac2,td.ac3,td.ac4,td.pp1,td.pp2,td.pp3,td.pp4,td.pl1,td.pl2,td.pl3,td.pl4,td.fc1,td.fc2,td.fc3,td.fc4,td.share,td.variance,td.pos_pos,td.pos_neg,td.neg_pos,td.neg_neg,td.pos_neutral,td.neg_neutral{text-align:right}.category-w100{min-width:100em;max-width:100em}.category-w50{min-width:50em;max-width:50em}.category-w25{min-width:25em;max-width:25em}.category-w20{min-width:20em;max-width:20em}.category-w15{min-width:15em;max-width:15em}.category-w10{min-width:10em;max-width:10em}.category-w5{min-width:5em;max-width:5em}.prefix-second{color:transparent;font-style:normal}.prefix-first{font-style:normal}th{border-bottom:0.1em solid black;text-align:right;font-weight:normal;vertical-align:text-top}td.columnGroup,th.columnGroup{font-size:0.6em}td.columnSubGroup,th.columnSubGroup{font-size:0.6em;border-spacing:0em 0;font-style:italic}td.base,th.base{font-style:normal}th.ofit,td.ofit,tr.ofit,th.partof,td.partof,tr.partof{font-size:0.6em;font-style:italic}td.ofit,td.partof{font-size:0.6em;font-style:italic}th.ofit td,tr.ofit td,th.partof td,tr.partof td{border-top:0em solid black;padding-left:1em}th.ofit share,th.partof share,tr.share td{border-top:0em solid black}th.share,tr.share,td.share{font-size:0.6em;font-style:italic}th.filler{border-bottom:0em solid black;text-align:right}td.filler{border-top:0em none !important;border-bottom:0em none;text-align:right}th.group{text-align:center;border-spacing:1em 0}th.headerlabel{border-bottom:0em none black;padding-bottom:0em}th.intervalGroup{border-bottom:0.1em solid black;text-align:center;font-weight:bold}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal,td.percentpoint{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em dashed #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}'}},[1,"bn-table-renderer",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],selectedStyle:[513,"selected-style"],sumTitle:[1,"sum-title"],scenarios:[16],scenariosDataFormat:[1,"scenarios-data-format"],grouped:[4],limit:[2],showGroupTitle:[4,"show-group-title"],thereof:[16],partof:[16],order:[16],categorythereof:[16],attributeColumns:[16],type:[1],categoryWidth:[1,"category-width"],dataFormatDigits:[16],ruleSetConfig:[16],i18n:[1040],i18nMode:[1,"i18n-mode"],measureScale:[1,"measure-scale"],measureUnit:[1,"measure-unit"],showMeasureScale:[4,"show-measure-scale"],measureType:[1,"measure-type"],filter:[1],barColumns:[16],interval:[1],categoryIntervalPosition:[2,"category-interval-position"],barColumnMaxWidth:[2,"bar-column-max-width"],unitScaling:[2,"unit-scaling"],percentageScaling:[2,"percentage-scaling"],reportAutoScaling:[16],errors:[16],scaleFactor:[2,"scale-factor"],getLayoutDetail:[64]}]);function Vt(t){return"percentpoint"===t.type?.01:t.measureScale}function Xt(t,e){return"percentpoint"===t.type?e.percent:"decimal"===t.type?e.decimal:void 0}function qt(){"undefined"!=typeof customElements&&["bn-table-renderer"].forEach((t=>{"bn-table-renderer"===t&&(customElements.get(s(t))||customElements.define(s(t),Qt))}))}export{Qt as B,X as I,z as T,q as a,Z as c,qt as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p as t,H as i,h as s,a as h,t as e}from"./p-D6YGOYV1.js";import{S as n,F as r,a as o,P as a}from"./p-eWxolPDU.js";import{C as l,A as c,g as u,e as d}from"./p-B5tixDPM.js";import{D as f,b as v}from"./p-7ieJFBUk.js";import{c as p,O as g,a as b}from"./p-16rjcQ0t.js";import{S as m}from"./p-CeE4_3wQ.js";import{a as w,F as P,I as y,C as S,b as L,V as x,s as k}from"./p-CniN8ALm.js";import{g as M,a as C,I as T}from"./p-4q8nRcWC.js";import{d as O,l as A,S as $}from"./p-BzjGUtYh.js";import{N,r as _}from"./p-fCjsrD7I.js";import{s as D,c as E,a as W,l as B,b as R,d as j,M as Y}from"./p-BTnRaHPb.js";import{d as X,g as V}from"./p-DDvWTgk1.js";import{e as G,r as F}from"./p-ClruFZD_.js";import{S as U}from"./p-BPGLOHUe.js";import{w as z}from"./p-Dq9dG0Kr.js";import{S as H}from"./p-NBaq67dL.js";import{A as I}from"./p-BXg3v5AO.js";class q{constructor(t,i,s,h,e,n,r,o,a=!1){this.categoryPosition={x:0,y:0},this.spacings={scenarioOffset:0,markerOffset:0,scenarioLabelToBar:0,labelToBar:0,labelToAxis:0,needleWidth:0,needleHeadWidth:0,barWidth:0,varianceAxisLineWidth:0,axisLineWidth:0,auxiliaryLineWidth:0,scenarioLineWidth:0,markerWidth:0,categoryWidth:0,axisTickLength:0},this.categoriesBoxOffset={width:0,height:0},this.padding=t,this.scaleFactors=i,this.fontSize=s,this.axisPosition={x:0,y:0},this.numberOfColumns=h,this.leftSideLengthSync=e,this.topSideLabelHeight=n>0?this.fontSize:0,this.hasStackedHeaders=a,this.leftSideLabelLength=this.calculateSideLabelLength(n,r,o),this.calculateSpacings(),this.calculateCategoryPosition(),this.calculateAxisPosition()}getBarPositionX(){return this.axisPosition.x}getBarCenterPositionY(t){return this.categoryPosition.y+this.spacings.scenarioOffset+t*this.spacings.categoryWidth}getBarPositionY(t,i){return i?this.getBarCenterPositionY(t):this.getBarCenterPositionY(t)-this.spacings.scenarioOffset}getCategoryPositionX(t){let i=this.spacings.labelToAxis;return t&&(i=-this.spacings.labelToAxis),this.getAxisPositionX()+i}getAxisTitlePositionX(){return this.axisPosition.x}getAxisTitlePositionY(){return this.axisPosition.y-this.spacings.labelToAxis-this.getTopLabelOverhang()}getStackedHeaderPositionY(){return this.getBarCenterPositionY(0)-.5*this.spacings.barWidth-this.spacings.scenarioLabelToBar}getNeedleWidth(){return this.spacings.needleWidth}getAxisPositionX(){return this.leftSideLabelLength+this.padding.left+this.spacings.labelToAxis}getAxisPositionY(){return this.padding.top+this.getAxisTitleOffset()}loadCategoriesBox(t){this.categoriesBoxOffset=t,this.calculateAxisPosition()}addOffsetByNegativeDataPoints(t,i,s,h){null!=t&&null!=t.value&&t.value<0&&(s&&t.isClipped()?this.axisPosition.x+=Math.abs(t.getClippedValue()*t.pixelPerUnit):this.axisPosition.x+=Math.abs(t.value*t.pixelPerUnit),this.axisPosition.x+=i,this.axisPosition.x+=this.spacings.labelToBar),this.axisPosition.x<h/2&&(this.axisPosition.x=h/2+this.spacings.labelToBar)}getLabelPositionX(t){let i=this.spacings.labelToBar;return t<0&&(i*=-1),this.axisPosition.x+t+i}getLabelPositionY(t){return this.axisPosition.y+t+this.spacings.labelToBar}getCategoryToAxisSpaceing(){return this.spacings.labelToAxis}getCategoryToTopSpaceing(){return this.spacings.scenarioOffset}getCategoryToBottomSpaceing(){return this.spacings.scenarioOffset}getAxisEndPositionY(){return this.getAxisPositionY()+(this.numberOfColumns+.5)*this.spacings.categoryWidth}getScenarioLabelPositionOffsetY(t){if(t){const t=.5*this.getBarWidth()+this.spacings.scenarioLabelToBar;return Math.max(t,this.spacings.categoryWidth-this.spacings.scenarioOffset+this.spacings.labelToAxis)}return-(.5*this.getBarWidth()+this.spacings.scenarioLabelToBar)}getBarWidth(){return this.spacings.barWidth}getMarkerPositionY(t,i){return i?this.getBarCenterPositionY(t)-this.spacings.markerOffset-.5*this.getBarWidth():this.getBarCenterPositionY(t)+this.spacings.markerOffset+.5*this.getBarWidth()}getMarkerPositionX(){return this.getBarPositionX()}getMarkerScenarioLabelPositionOffsetY(t){return t?-(.5*this.spacings.markerWidth+this.spacings.scenarioLabelToBar):this.spacings.scenarioLabelToBar+.5*this.spacings.markerWidth}getAxisEndPositionX(){return this.getAxisPositionX()}calculateSpacings(){this.spacings={scenarioOffset:this.fontSize*this.scaleFactors.scenarioOffset,markerOffset:this.fontSize*this.scaleFactors.markerOffset,scenarioLabelToBar:this.fontSize*this.scaleFactors.scenarioLabelToBar,labelToBar:this.fontSize*this.scaleFactors.labelToBar,labelToAxis:this.fontSize*this.scaleFactors.labelToAxis,needleWidth:this.fontSize*this.scaleFactors.needleWidth,needleHeadWidth:this.fontSize*this.scaleFactors.needleHeadWidth,barWidth:this.fontSize*this.scaleFactors.barWidth,varianceAxisLineWidth:this.fontSize*this.scaleFactors.varianceAxisLineWidth,axisLineWidth:this.fontSize*this.scaleFactors.axisLineWidth,auxiliaryLineWidth:this.fontSize*this.scaleFactors.auxiliaryLineWidth,scenarioLineWidth:this.fontSize*this.scaleFactors.scenarioLineWidth,markerWidth:this.fontSize*this.scaleFactors.markerWidth,categoryWidth:this.fontSize*this.scaleFactors.categoryWidth,axisTickLength:this.fontSize*this.scaleFactors.axisTickLength}}calculateCategoryPosition(){this.categoryPosition={x:this.padding.left,y:this.getAxisPositionY()+.5*this.spacings.categoryWidth}}calculateAxisPosition(){this.axisPosition={x:this.getAxisPositionX(),y:this.getAxisPositionY()}}recalculatePositions(){this.calculateCategoryPosition(),this.calculateAxisPosition()}getAxisTitleOffset(){return this.topSideLabelHeight+this.spacings.labelToAxis+this.getTopLabelOverhang()}getTopLabelOverhang(){return this.hasStackedHeaders?this.getStackedHeaderOverhang():this.getTopScenarioLabelOverhang()}getStackedHeaderOverhang(){return Math.max(0,this.fontSize+this.spacings.scenarioLabelToBar+.5*this.spacings.barWidth-(.5*this.spacings.categoryWidth+this.spacings.scenarioOffset))}getTopScenarioLabelOverhang(){return Math.max(0,this.fontSize+.5*this.spacings.barWidth+this.spacings.scenarioLabelToBar-.5*this.spacings.categoryWidth,this.fontSize+.5*this.spacings.markerWidth+this.spacings.scenarioLabelToBar+this.spacings.markerOffset+.5*this.spacings.barWidth-(.5*this.spacings.categoryWidth+this.spacings.scenarioOffset))}calculateSideLabelLength(t,i,s){if(this.leftSideLengthSync)return this.leftSideLengthSync;const h=t/2;let e=i;return h>e&&(e=h),s>e&&(e=s),e}}class K{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 Q{constructor(t){const i=1*t,s=.7*t;this.bgOffset=(i-s)/2,this.markerUp={top:s/2+",0",left:"0,"+s,right:s+","+s},this.markerUpBackground={top:i/2+",0",left:"0,"+i,right:i+","+i},this.markerDown={bottom:s/2+","+s,left:"0,0",right:s+",0"},this.markerDownBackground={bottom:i/2+","+i,left:"0,0",right:i+",0"}}upMarkerPatternStrings(){return{background:this.markerUpBackground.left+" "+this.markerUpBackground.right+" "+this.markerUpBackground.top+" "+this.markerUpBackground.left,foreground:this.markerUp.left+" "+this.markerUp.right+" "+this.markerUp.top+" "+this.markerUp.left,bgOffset:this.bgOffset}}downMarkerPatternStrings(){return{background:this.markerDownBackground.left+" "+this.markerDownBackground.right+" "+this.markerDownBackground.bottom+" "+this.markerDownBackground.left,foreground:this.markerDown.left+" "+this.markerDown.right+" "+this.markerDown.bottom+" "+this.markerDown.left,bgOffset:this.bgOffset}}createPatternMapForStructureBar(){const t=new Map;return t.set("marker-up",this.upMarkerPatternStrings()),t.set("marker-down",this.downMarkerPatternStrings()),t}}class Z{constructor(t){this.container=new n,this.pattern=this.createFCPattern(this.container.group(),t),this.styles=t;let i=10;null!=t&&null!=t.fontStyles&&t.fontStyles.size&&(i=t.fontStyles.size),this.bgOffset=(1*i-.7*i)/2}createFCPattern(t,i){const s=i;return t.pattern(10,10,(function(t){t.rect(10,10).fill(s.barStyles.fc.fill),t.line(0,5,5,0).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"}),t.line(5,10,10,5).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"})})).id("pattern-structure-fc")}getFCPolygonPattern(){return{background:"",foreground:"",bgOffset:0,pattern:this.pattern}}toString(){return this.container.svg()}}var J,tt,it,st,ht;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(J||(J={})),function(t){t.RELATIVE="dr",t.ABSOLUTE="d",t.NONE=""}(tt||(tt={}));class et{constructor(t,i){this.data=t,this.scenarios=i,this.variances=[],this.title="",this.hideCategories=!1,this.pixelPerUnit=10,this.pixelPerPercentage=50,this.limit=0,this.sortOrder=new p(new U).default(),this.level=c.CATEGORY,this.filter="",this.measureScale=new m,this.measureUnit="",this.showMeasureScale=!0,this.dataFormatDigits={decimal:1,percent:2},this.stackConfig=null}}class nt{constructor(t,i,s,h,e,n,r){this.dataRowAdapter=t,this.orderAdapter=i,this.stringAdapter=s,this.dataFormatDigitsAdapter=h,this.db=e,this.fromExpr=n,this.onQueryError=r}adapt(t){const i=I.adaptArray(t.data,this.dataRowAdapter),s=I.adaptArray(t.scenarios,this.stringAdapter),h=new et(i,s);return l.isArray(t.variances)&&(h.variances=I.adaptArray(t.variances,this.stringAdapter)),l.isString(t.title)&&(h.title=t.title),l.isBoolean(t.hideCategories)&&(h.hideCategories=t.hideCategories),l.isNumber(t.pixelPerUnit)&&(h.pixelPerUnit=t.pixelPerUnit),l.isNumber(t.pixelPerPercentage)&&(h.pixelPerPercentage=t.pixelPerPercentage),l.isNumber(t.limit)&&(h.limit=t.limit),l.isExisting(t.sortOrder)&&(h.sortOrder=this.orderAdapter.adapt(t.sortOrder)),l.isExisting(t.level)&&(h.level=t.level),l.isString(t.filter)&&(h.filter=t.filter.trim()),l.isExisting(t.measureScale)&&(h.measureScale=f.calculateMeasureScale(this.db,this.fromExpr,h.scenarios,t.measureScale,this.onQueryError)),l.isString(t.measureUnit)&&(h.measureUnit=t.measureUnit),l.isBoolean(t.showMeasureScale)&&(h.showMeasureScale=t.showMeasureScale),l.isExisting(t.dataFormatDigits)&&(h.dataFormatDigits=this.dataFormatDigitsAdapter.adapt(t.dataFormatDigits)),l.isExisting(t.stackConfig)&&(h.stackConfig=t.stackConfig),h}default(){return new et([],[])}}class rt{constructor(t,i,s,h){this.value=t,this.scenario=i,this.pixelPerUnit=s||1;const e="string"==typeof h?w(h,null,!0):h;this.variance="neg"===e||e===it.NEG?it.NEG:"pos"===e||e===it.POS?it.POS:it.NEU}isEmpty(){return null==this.value||null==this.scenario}getScaledUnit(){return null==this.value?0:this.value*this.pixelPerUnit}getScaledPercentUnit(){return null==this.value?0:Math.abs(this.value)>1.45?this.value>=0?1.45*this.pixelPerUnit:-1.45*this.pixelPerUnit:this.value*this.pixelPerUnit}getVarianceStyle(){return null==this.value||this.value>=0?this.variance:it.NEU===this.variance?it.NEU:it.POS===this.variance?it.NEG:it.POS}isClipped(){return null!=this.value&&Math.abs(this.value)>1.45}getClippedValue(){return 145}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}class ot{constructor(){this.operation="+"}addRowGroup(t,i){this.rowGroup=t,this.rowGroupIndex=i}addCategory(t,i){this.category=t,this.categoryIndex=i}addSubCategory(t,i){this.subCategory=t,this.subCategoryIndex=i}addColumnGroup(t,i){this.columnGroup=t,this.columnGroupIndex=i}addSubColumnGroup(t,i){this.columnSubGroup=t,this.columnSubGroupIndex=i}}class at{constructor(){}adapt(t){const i=new ot;return l.isOperator(t.operation)&&(i.operation=t.operation),l.isNumber(t.rowGroupIndex)&&l.isString(t.rowGroup)&&i.addRowGroup(t.rowGroup,t.rowGroupIndex),l.isNumber(t.categoryIndex)&&l.isString(t.category)&&i.addCategory(t.category,t.categoryIndex),l.isNumber(t.subCategoryIndex)&&l.isString(t.subCategory)&&i.addSubCategory(t.subCategory,t.subCategoryIndex),l.isNumber(t.columnGroupIndex)&&l.isString(t.columnGroup)&&i.addColumnGroup(t.columnGroup,t.columnGroupIndex),l.isNumber(t.columnSubGroupIndex)&&l.isString(t.columnSubGroup)&&i.addSubColumnGroup(t.columnSubGroup,t.columnSubGroupIndex),this.setActualValues(t,i),this.setPlanValues(t,i),this.setPreviousPeriodValues(t,i),this.setForecastValues(t,i),i}default(){return new ot}setActualValues(t,i){l.isNumber(t.ac1)&&(i.ac1=t.ac1),l.isNumber(t.ac2)&&(i.ac2=t.ac2),l.isNumber(t.ac3)&&(i.ac3=t.ac3),l.isNumber(t.ac4)&&(i.ac4=t.ac4)}setPlanValues(t,i){l.isNumber(t.pl1)&&(i.pl1=t.pl1),l.isNumber(t.pl2)&&(i.pl2=t.pl2),l.isNumber(t.pl3)&&(i.pl3=t.pl3),l.isNumber(t.pl4)&&(i.pl4=t.pl4)}setPreviousPeriodValues(t,i){l.isNumber(t.pp1)&&(i.pp1=t.pp1),l.isNumber(t.pp2)&&(i.pp2=t.pp2),l.isNumber(t.pp3)&&(i.pp3=t.pp3),l.isNumber(t.pp4)&&(i.pp4=t.pp4)}setForecastValues(t,i){l.isNumber(t.fc1)&&(i.fc1=t.fc1),l.isNumber(t.fc2)&&(i.fc2=t.fc2),l.isNumber(t.fc3)&&(i.fc3=t.fc3),l.isNumber(t.fc4)&&(i.fc4=t.fc4)}}class lt{constructor(t,i,s,h,e,n){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=s,this.barStyles=h,this.varianceStyles=e,this.padding=n,this.pattern=new Map,this.stackColors=["#000000","#c0c0c0","#808080"],this.locale="de"}}class ct{constructor(t,i,s,h,e){this.scaleFactorsStructureChartAdapter=t,this.fontStyleAdapter=i,this.svgStyleGroupAdapter=s,this.svgVariancesStyleGroupAdapter=h,this.paddingadapter=e}adapt(t){const i=new lt(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default());return l.isExisting(t)&&(l.isExisting(t.scaleFactors)&&(i.scaleFactors=this.scaleFactorsStructureChartAdapter.adapt(t.scaleFactors)),l.isExisting(t.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(t.fontStyles)),l.isExisting(t.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(t.axisStyles)),l.isExisting(t.barStyles)&&(i.barStyles=this.svgStyleGroupAdapter.adapt(t.barStyles)),l.isExisting(t.varianceStyles)&&(i.varianceStyles=this.svgVariancesStyleGroupAdapter.adapt(t.varianceStyles)),l.isExisting(t.padding)&&(i.padding=this.paddingadapter.adapt(t.padding)),Array.isArray(t.stackColors)&&t.stackColors.length>0&&(i.stackColors=t.stackColors),i.pattern=new Q(i.fontStyles.size).createPatternMapForStructureBar()),i}default(){return new lt(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default())}}class ut{constructor(){this.scenarioOffset=.3,this.scenarioLabelToBar=.1,this.labelToBar=.3,this.labelToAxis=.3,this.needleWidth=.3,this.needleHeadWidth=.6,this.barWidth=1.2,this.varianceAxisLineWidth=.3,this.axisLineWidth=.1,this.auxiliaryLineWidth=.1,this.scenarioLineWidth=.2,this.markerWidth=.7,this.markerOffset=0,this.categoryWidth=1.9,this.axisTickLength=.3}}class dt{adapt(t){const i=new ut;return l.isNumber(t.scenarioOffset)&&(i.scenarioOffset=t.scenarioOffset),l.isNumber(t.scenarioLabelToBar)&&(i.scenarioLabelToBar=t.scenarioLabelToBar),l.isNumber(t.labelToBar)&&(i.labelToBar=t.labelToBar),l.isNumber(t.labelToAxis)&&(i.labelToAxis=t.labelToAxis),l.isNumber(t.needleWidth)&&(i.needleWidth=t.needleWidth),l.isNumber(t.needleHeadWidth)&&(i.needleHeadWidth=t.needleHeadWidth),l.isNumber(t.barWidth)&&(i.barWidth=t.barWidth),l.isNumber(t.varianceAxisLineWidth)&&(i.varianceAxisLineWidth=t.varianceAxisLineWidth),l.isNumber(t.axisLineWidth)&&(i.axisLineWidth=t.axisLineWidth),l.isNumber(t.auxiliaryLineWidth)&&(i.auxiliaryLineWidth=t.auxiliaryLineWidth),l.isNumber(t.scenarioLineWidth)&&(i.scenarioLineWidth=t.scenarioLineWidth),l.isNumber(t.markerWidth)&&(i.markerWidth=t.markerWidth),l.isNumber(t.markerOffset)&&(i.markerOffset=t.markerOffset),l.isNumber(t.categoryWidth)&&(i.categoryWidth=t.categoryWidth),l.isNumber(t.axisTickLength)&&(i.axisTickLength=t.axisTickLength),i}default(){return new ut}}!function(t){t.AC1="ac1",t.PP1="pp1",t.FC1="fc1",t.PL1="pl1",t.AC2="ac2",t.PP2="pp2",t.FC2="fc2",t.PL2="pl2",t.AC3="ac3",t.PP3="pp3",t.FC3="fc3",t.PL3="pl3",t.AC4="ac4",t.PP4="pp4",t.FC4="fc4",t.PL4="pl4",t.POS="pos",t.NEG="neg",t.NEU="neu"}(it||(it={})),function(t){t.LIST="LIST",t.SUM="SUM",t.OPT="OPT"}(st||(st={})),function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right",t[t.Top=3]="Top",t[t.Bottom=4]="Bottom"}(ht||(ht={}));class ft{constructor(t,i,s,h,e,n,r,o){this.group=null,this.segmentFillColor=null,this.maxWidth=null,this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.pointPart="label",this.x=i,this.y=s,this.value=e,null!=t&&(this.group=t.group().id(this.createElementID(t.toString(),h))),this.styles=n,this.isVarianceLabel=!1,this.isRelativeLabel=!1,this.verticalHookLocation=r||ht.Top,this.horizontalHookLocation=o||ht.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}setMaxWidth(t){return this.maxWidth=t,this}setPoint(t,i="label"){return this.pointKey=t,this.pointPart=i,this}updateGroup(t){return this.group=t,this}createElementID(t,i){return t+"_"+i+"_"+this.ID_SCENARIOLABEL}draw(t={percent:2,decimal:1},i=new m){var s;if(this.isEmpty())return this;const h=this.group;let e;const n=this.styles.fontStyles.background||"#ffffff";let r="",o="start";if(!1===Number.isNaN(Number(this.value))){let s=t.percent,h=t.percent,n=1,a="percent";!1===this.isRelativeLabel&&(s=t.decimal,h=t.decimal,n=i.value,a="decimal"),e=P.number(Number(this.value),a,s,h,n,this.styles.locale),Number(this.value)<0&&(o="end"),this.isVarianceLabel&&Number(this.value)>=0&&(r="+")}else e=""+this.value,o="start";const a=h.text(r+e);a.move(this.x,this.y);const l=a.bbox(),c=l.w,u=l.h;return null!=this.maxWidth&&c>this.maxWidth?(null===(s=this.group)||void 0===s||s.remove(),this.group=null,this):(this.horizontalHookLocation===ht.Right?(o="end",a.move(a.x()-a.length(),a.y())):this.horizontalHookLocation===ht.Center&&(o="middle",a.move(a.x()-a.length()/2,a.y())),this.verticalHookLocation===ht.Center?a.move(a.x(),a.y()-u/2):this.verticalHookLocation===ht.Bottom&&a.move(a.x(),a.y()-u),a.font({anchor:o}),null!=this.segmentFillColor?a.fill(M(this.segmentFillColor)):null==h||h.rect(c,.9*u).stroke(n).fill(n).opacity(.7).move(a.x(),a.y()+.1*u).insertBefore(a),this.pointKey&&(null==h||h.attr(O(this.pointKey,this.pointPart))),this)}isEmpty(){return null==this.value||""===this.value}setPos(t,i){return this.x=t,this.y=i,this}}class vt{constructor(t,i,s,h){this.height=0,this.ID_AXIS="axis",this.ID_AXIS_TITLE="axis-title",this.CSS_AXIS_TITLE="categories",this.scenarioType=t.scenarioType,this.labelText=t.labelText||null,this.position=i,this.style=h,this.label=new ft(s,this.position.getAxisTitlePositionX(),this.position.getAxisTitlePositionY(),this.ID_AXIS_TITLE,this.labelText,this.style,ht.Bottom,ht.Center),this.svgGroup=s.group().id(this.ID_AXIS)}draw(){return this.labelText&&this.label.draw(),this.svgGroup.line(this.position.getAxisPositionX(),this.position.getAxisPositionY(),this.position.getAxisEndPositionX(),this.position.getAxisEndPositionY()).addClass(this.ID_AXIS+"-"+this.convertScenarioType()),this.height=this.svgGroup.height(),this}convertScenarioType(){return void 0===this.scenarioType||null==this.scenarioType?"default":`${this.scenarioType}`.slice(0,2)}}class pt{constructor(t,i,s,h,e,n,r,o=null){if(this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.scenarioLabel=null,this.barGroup=null,this.isVarianceBar=!1,this.overflowConfig=null,this.isOverflowing=!1,this.overdriveWidth=0,this.dimensions={barLength:0,xPos:0,yPos:0,labelXPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=h,this.isPrimaryBar=e,this.position=t,this.barStyles=i.barStyles,this.overflowConfig=o,this.scenarioGroup=n,this.styles=i,null!=n&&(this.barGroup=n.group().id(n.toString()+"_"+this.ID_RECT)),!0!==(null==s?void 0:s.isEmpty())&&null!=s.value){this.hasData=!0;let i=ht.Left;s.value<0&&(i=ht.Right),this.dimensions=this.createDimensions(t,s,h,e),this.label=new ft(this.scenarioGroup,this.dimensions.labelXPos,this.dimensions.yPos,this.ID_DATA_PREFIX,s.value,this.styles,ht.Center,i).setPoint(s.key),this.scenarioLabel=this.getScenarioLabel(r)}}setAsVariance(){var t;return this.isVarianceBar=!0,null===(t=this.label)||void 0===t||t.setToVarianceLabel(),this}isRelativeVariance(){var t;return this.isVarianceBar=!0,null===(t=this.label)||void 0===t||t.setToRelativeVarianceLabel(),this}updateLabelGroup(t){var i;return this.isEmpty()||null==t||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(t={percent:2,decimal:1},i=new m){var s,h;if(this.isEmpty()||null==this.dataPoint.getScenario())return this;let e=this.barStyles.getSVGStyle(this.dataPoint.getScenario());this.isVarianceBar&&(e=this.styles.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()));const n=this.convertToSVGStyle(e,"stroke");let r=this.convertToSVGStyle(e,"fill");const o=this.barStyles.getSVGStyle(this.dataPoint.getScenario()).fillpattern;if(null!=o){const t=this.styles.pattern.get(o);null!=t&&(r=t.pattern)}null===(s=this.scenarioGroup)||void 0===s||s.attr(O(this.dataPoint.key)),null===(h=this.barGroup)||void 0===h||h.attr(O(this.dataPoint.key,"element")),null!=this.barGroup&&(this.isOverflowing&&this.overflowConfig?this.drawOverdriveBar(r,n):this.barGroup.rect(this.dimensions.barLength,this.position.getBarWidth()).fill(r).stroke(n).cy(this.dimensions.yPos).x(this.dimensions.xPos)),this.drawBarDataLabel(t,i),this.drawScenarioLabel()}drawOverdriveBar(t,i){if(!this.barGroup||!this.overflowConfig)return;const s=this.position.getBarPositionX(),h=this.position.getBarWidth(),e=this.dimensions.barLength,{breakGap:n}=this.overflowConfig;this.dataPoint.getScaledUnit()<0?(this.barGroup.rect(e,h).fill(t).stroke(i).x(s-e).cy(this.dimensions.yPos),this.barGroup.rect(this.overdriveWidth,h).fill(t).stroke(i).x(s-e-n-this.overdriveWidth).cy(this.dimensions.yPos),this.drawBreakIndicator(s-e-n,n)):(this.barGroup.rect(e,h).fill(t).stroke(i).x(s).cy(this.dimensions.yPos),this.barGroup.rect(this.overdriveWidth,h).fill(t).stroke(i).x(s+e+n).cy(this.dimensions.yPos),this.drawBreakIndicator(s+e,n))}drawBreakIndicator(t,i){if(!this.barGroup)return;const s=this.position.getBarWidth(),h=this.dimensions.yPos-s/2,e=t+i/2,n=.35*i,r=s/3;let o=`M ${e-n} ${h}`;for(let t=0;t<3;t++)o+=` L ${e-n-.3*i} ${h+r*(t+.5)} L ${e-n} ${h+r*(t+1)}`;let a=`M ${e+n} ${h}`;for(let t=0;t<3;t++)a+=` L ${e+n+.3*i} ${h+r*(t+.5)} L ${e+n} ${h+r*(t+1)}`;this.barGroup.rect(i,s+2).fill("#ffffff").stroke("none").x(t).cy(this.dimensions.yPos),this.barGroup.path(o).fill("none").stroke({color:"#000000",width:1}),this.barGroup.path(a).fill("none").stroke({color:"#000000",width:1})}createDimensions(t,i,s,h){const e=i.getScaledUnit(),n=Math.abs(e);if(this.overflowConfig&&n>0){const r="ac"===i.getScenario()?this.overflowConfig.cutWidth:this.overflowConfig.cutWidth-this.overflowConfig.scenarioCutOffset;if(n>r){this.isOverflowing=!0;const{breakGap:i,overdriveZoneWidth:o,maxOverflow:a}=this.overflowConfig;this.overdriveWidth=a>0?(n-r)/a*o:0;const l=r+i+this.overdriveWidth;return e<0?{clipped:!1,barLength:r,xPos:t.getBarPositionX()-r,yPos:t.getBarPositionY(s,h),labelXPos:t.getLabelPositionX(-l),scenarioLabelXPos:t.getBarPositionX()-.5*r,scenarioLabelYPos:t.getBarPositionY(s,h)+t.getScenarioLabelPositionOffsetY(h)}:{clipped:!1,barLength:r,xPos:t.getBarPositionX(),yPos:t.getBarPositionY(s,h),labelXPos:t.getLabelPositionX(l),scenarioLabelXPos:t.getBarPositionX()+.5*r,scenarioLabelYPos:t.getBarPositionY(s,h)+t.getScenarioLabelPositionOffsetY(h)}}}return e<0?{clipped:!1,barLength:n,xPos:t.getBarPositionX()+e,yPos:t.getBarPositionY(s,h),labelXPos:this.position.getLabelPositionX(e),scenarioLabelXPos:this.position.getBarPositionX()-.5*n,scenarioLabelYPos:this.position.getBarPositionY(s,h)+this.position.getScenarioLabelPositionOffsetY(h)}:{clipped:!1,barLength:e,xPos:t.getBarPositionX(),yPos:t.getBarPositionY(s,h),labelXPos:this.position.getLabelPositionX(e),scenarioLabelXPos:this.position.getBarPositionX()+.5*n,scenarioLabelYPos:this.position.getBarPositionY(s,h)+this.position.getScenarioLabelPositionOffsetY(h)}}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}drawScenarioLabel(){null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.isVarianceBar||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw()}drawBarDataLabel(t,i=new m){var s;this.isPrimaryBar&&(null===(s=this.label)||void 0===s||s.draw(t,i))}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}getScenarioLabel(t){return new ft(this.scenarioGroup,-1,-1,this.ID_SCENARIO_PREFIX,t,this.styles,this.isPrimaryBar?ht.Top:ht.Bottom,ht.Center)}}class gt{constructor(t,i,s,h,e,n,r,o,a){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.FALLBACK_COLOUR="#000000",this.scenarioLabel=null,this._defaultMarkerPattern=null,this.dimensions={barLength:0,xPos:0,yPos:0,labelXPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.position=t,this.markerGroup=i||null,this.markerPattern=s||this._defaultMarkerPattern,this.styles=e,this.barStyles=e?e.barStyles:null,this.scenario=h,!0!==(null==n?void 0:n.isEmpty())&&(this.hasData=!0,this.pointKey=n.key,this.dimensions=this.createMarkerDimensions(n,r,a),this.scenarioLabel=this.getScenarioLabel(o,e,a))}createMarkerDimensions(t,i,s){return t.getScaledUnit()<0?{clipped:!1,labelXPos:0,barLength:Math.abs(t.getScaledUnit()),xPos:this.position.getMarkerPositionX()-Math.abs(t.getScaledUnit()),yPos:this.position.getMarkerPositionY(i,s),scenarioLabelXPos:this.position.getMarkerPositionX()-Math.abs(t.getScaledUnit()),scenarioLabelYPos:this.position.getMarkerPositionY(i,s)+this.position.getMarkerScenarioLabelPositionOffsetY(s)}:{clipped:!1,labelXPos:0,barLength:t.getScaledUnit(),xPos:this.position.getMarkerPositionX()+t.getScaledUnit(),yPos:this.position.getMarkerPositionY(i,s),scenarioLabelXPos:this.position.getMarkerPositionX()+t.getScaledUnit(),scenarioLabelYPos:this.position.getMarkerPositionY(i,s)+this.position.getMarkerScenarioLabelPositionOffsetY(s)}}getScenarioLabel(t,i,s){return null==this.markerGroup?null:new ft(this.markerGroup,-1,-1,this.ID_DATA_PREFIX,t,i,s?ht.Bottom:ht.Top,ht.Center)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}draw(){if(this.isEmpty())return this;const t=this.convertToSVGStyle(this.barStyles[this.getScenario()],"stroke");let i=this.convertToSVGStyle(this.barStyles[this.getScenario()],"fill");const s=this.barStyles[this.getScenario()];if(null!=s&&s.fillpattern){const t=this.styles.pattern.get(s.fillpattern);null!=t&&(i=t.pattern)}return this.markerGroup.attr(O(this.pointKey)),this.markerGroup.polygon(this.markerPattern.background).fill("#ffffff").cy(this.dimensions.yPos).cx(this.dimensions.xPos),this.markerGroup.polygon(this.markerPattern.foreground).fill(i).stroke(t).cy(this.dimensions.yPos).cx(this.dimensions.xPos).attr(O(this.pointKey,"element")),null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(),this}isEmpty(){return!1===this.hasData}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}class bt{constructor(t,i,s,h,e){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.dimensions={barLength:0,xPos:0,yPos:0,labelXPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=h,this.position=t,this.barStyles=i.barStyles,this.scenarioGroup=e,this.styles=i,this.barGroup=e.group().id(e.toString()+"_"+this.ID_RECT);const n=void 0===(null==s?void 0:s.value)&&null!=(null==s?void 0:s.scenario);if(!0!==(null==s?void 0:s.isEmpty())&&null!=s.value||n){this.hasData=!0,this.dimensions=this.createDimensions(t,s,h);let i=ht.Left;s.value<0&&(i=ht.Right),this.label=new ft(this.scenarioGroup,this.dimensions.labelXPos,this.dimensions.yPos,this.ID_DATA_PREFIX,n?N:s.value,this.styles,ht.Center,i),this.label.setToRelativeVarianceLabel().setPoint(s.key)}}updateLabelGroup(t){var i;return this.isEmpty()||null==t||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(){var t,i,s;if(void 0===(null===(t=this.dataPoint)||void 0===t?void 0:t.value))return null===(i=this.label)||void 0===i||i.draw(),this;if(this.isEmpty())return this;if(null==this.dimensions)return this;this.scenarioGroup.attr(O(this.dataPoint.key)),this.barGroup.attr(O(this.dataPoint.key,"element"));const h=this.styles.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()),e=h.stroke;let n=h.fill;const r=this.barStyles[this.dataPoint.getScenario()];if(null!=r&&r.fillpattern){const t=this.styles.pattern.get(r.fillpattern);null!=t&&null!=t.pattern&&(n=t.pattern)}this.drawNeedleHead(n,e),this.barGroup.rect(this.dimensions.barLength,this.position.getNeedleWidth()).fill(n).stroke(e).cy(this.dimensions.yPos).x(this.dimensions.xPos),null===(s=this.label)||void 0===s||s.draw()}createDimensions(t,i,s){return i.getScaledPercentUnit()<0?{barLength:Math.abs(i.getScaledPercentUnit()),xPos:t.getBarPositionX()+i.getScaledPercentUnit(),yPos:t.getBarCenterPositionY(s),labelXPos:this.position.getLabelPositionX(i.getScaledPercentUnit()-this.position.getNeedleWidth()),clipped:i.isClipped(),scenarioLabelXPos:0,scenarioLabelYPos:0}:{barLength:i.getScaledPercentUnit(),xPos:t.getBarPositionX(),yPos:t.getBarCenterPositionY(s),labelXPos:this.position.getLabelPositionX(i.getScaledPercentUnit()+this.position.getNeedleWidth()),clipped:i.isClipped(),scenarioLabelXPos:0,scenarioLabelYPos:0}}drawNeedleHead(t,i){if(null===this.dimensions)return;const s=this.styles.varianceStyles.needleHeadColour,h=this.styles.varianceStyles.needleHeadColour;if(this.dimensions.clipped){let s="13,0 4,-5 4,5 13,0 8,0 0,-5 0,5 8,0";null!=this.dataPoint.value&&this.dataPoint.value<0&&(s="0,0 9,-5 9,5 0,0 5,0 13,-5 13,5 5,0"),this.barGroup.polygon(s).fill(t).cx(this.getHeadXPosition()).cy(this.dimensions.yPos).fill(t).stroke(i)}else this.barGroup.rect(2*this.position.getNeedleWidth(),2*this.position.getNeedleWidth()).cx(this.getHeadXPosition()).cy(this.dimensions.yPos).fill(s).stroke(h)}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}getHeadXPosition(){let t=this.dimensions.xPos;return null!=this.dataPoint.value&&this.dataPoint.value>0&&(t+=this.dimensions.barLength),t}}class mt{constructor(t,i,s,h,e,n,r,o,a,l,c){this.hasData=!1,this.position=t,this.styles=i,this.dataPoint=s,this.index=h,this.segment=e,this.segmentIndex=r,this.stackMode=o,this.stack=a,this.group=c,this.barGroup=c.group().id(`stacked_bar_${h}_seg_${r}`),!0!==(null==s?void 0:s.isEmpty())&&null!=s.value&&(this.hasData=!0)}draw(t={percent:2,decimal:1},i=new m){if(!this.hasData||!Number.isFinite(this.dataPoint.value))return;const s=this.dataPoint.value,h=this.dataPoint.pixelPerUnit,e=this.position.getBarPositionX(),n=this.position.getBarWidth(),r=Math.abs(this.segment.end-this.segment.start)*h,o=e+Math.min(this.segment.start,this.segment.end)*h,a=this.position.getBarPositionY(this.index,!0),l=this.styles.stackColors,c=l[this.segmentIndex%l.length],d={color:c},f={color:c,width:.5};this.barGroup.attr(O(this.dataPoint.key,"element")),this.barGroup.rect(Math.max(r,.5),n).fill(d).stroke(f).cy(a).x(o);const v=r-6;if(v>0){const h=o+r/2;if(this.stackMode===u.RELATIVE||this.stackMode===u.ABSOLUTE_RELATIVE){const i=P.number(this.segment.share,"percent",t.percent,t.percent,1,this.styles.locale);new ft(this.group,h,a,"STACK_SEG",i,this.styles,ht.Center,ht.Center).setSegmentFill(c).setMaxWidth(v).setPoint(this.dataPoint.key).draw()}else new ft(this.group,h,a,"STACK_SEG",s,this.styles,ht.Center,ht.Center).setSegmentFill(c).setMaxWidth(v).setPoint(this.dataPoint.key).draw(t,i)}}drawTotalLabel(t={percent:2,decimal:1},i=new m,s){if(this.stackMode===u.RELATIVE)return;const h=this.stack.total<0,e=this.position.getLabelPositionX((h?0-this.stack.negative:this.stack.positive)*this.dataPoint.pixelPerUnit),n=this.position.getBarPositionY(this.index,!0);new ft(this.group,e,n,"STACK_TOTAL",this.stack.total,this.styles,ht.Center,h?ht.Right:ht.Left).setPoint(s,"total").draw(t,i)}}class wt{constructor(t,i,s,h,e){this.overflowConfig=null,this.i18n=e;const n=i.group().id("Scenario1"),r=i.group().id("Scenario2").insertBefore(n);this.svgGroups={parent:i,scenario1:n,scenario2:r,scenario3:i.group().id("Scenario3"),scenario4:i.group().id("Scenario4"),scenario1Label:i.group().id("label")},this.styles=s,this.position=t,this.elementCnt=h}setOverflowConfig(t){this.overflowConfig=t}isLastDataPoint(t){return this.elementCnt-1===t}isFirsttDataPoint(t){return 0===t}createPrimaryBar(t,i){var s,h,e,n;const r=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario1)||void 0===h?void 0:h.group().id(""+i),o=null===(n=null===(e=this.svgGroups)||void 0===e?void 0:e.scenario1Label)||void 0===n?void 0:n.group().id(""+i);let a=null;return this.isLastDataPoint(i)&&(a=`${this.i18n.get(t.scenario)||t.scenario}`),new pt(this.position,this.styles,t,i,!0,r,a,this.overflowConfig).updateLabelGroup(o)}createVarianceBar(t,i){var s,h,e,n;const r=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario1)||void 0===h?void 0:h.group().id(""+i),o=null===(n=null===(e=this.svgGroups)||void 0===e?void 0:e.scenario1Label)||void 0===n?void 0:n.group().id(""+i);let a=null;return this.isLastDataPoint(i)&&(a=`${this.i18n.get(t.scenario)||t.scenario}`),new pt(this.position,this.styles,t,i,!0,r,a,this.overflowConfig).updateLabelGroup(o).setAsVariance()}createRelativeVarianceBar(t,i){var s,h,e,n;const r=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario1)||void 0===h?void 0:h.group().id(""+i),o=null===(n=null===(e=this.svgGroups)||void 0===e?void 0:e.scenario1Label)||void 0===n?void 0:n.group().id(""+i);return new bt(this.position,this.styles,t,i,r).updateLabelGroup(o)}createSecondaryBar(t,i){var s,h;const e=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario2)||void 0===h?void 0:h.group().id(""+i);let n=null;return this.isFirsttDataPoint(i)&&(n=`${this.i18n.get(t.scenario)||t.scenario}`),new pt(this.position,this.styles,t,i,!1,e,n,this.overflowConfig)}createPrimaryMarker(t,i){var s,h;const e=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario3)||void 0===h?void 0:h.group().id(""+i),n=this.styles.pattern.get("marker-down")||{foreground:"0,0 1,0 1,1 0,1",background:"0,0 1,0 1,1 0,1",bgOffset:0};let r=null;return this.isFirstDataPoint(i)&&(r=`${this.i18n.get(t.scenario)||t.scenario}`),new gt(this.position,e,n,t.scenario,this.styles,t,i,r,!0)}createSecondaryMarker(t,i){var s,h;const e=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario4)||void 0===h?void 0:h.group().id(""+i),n=this.styles.pattern.get("marker-up")||{foreground:"0,0 1,0 1,1 0,1",background:"0,0 1,0 1,1 0,1",bgOffset:0};let r=null;return this.isLastDataPoint(i)&&(r=`${this.i18n.get(t.scenario)||t.scenario}`),new gt(this.position,e,n,t.scenario,this.styles,t,i,r,!1)}isFirstDataPoint(t){return 0===t}}class Pt{constructor(t,i,s,h,e){this.dataModel=[],this.variancesDataModel=[],this.title="",this.configTitle="",this.configVariances=[],this.smallestDataPointValue=new rt(0,it.AC1,1,it.NEU),this.highestDataPointValue=new rt(0,it.AC1,1,it.NEU),this.smallestVarianceDataPointValue=new rt(0,it.AC1,1,it.NEU),this.highestVarianceDataPointValue=new rt(0,it.AC1,1,it.NEU),this.pixelPerUnit=1,this.pixelPerPercentage=1,this.level=c.CATEGORY,this.hideCategories=!1,this.axisScenario=it.AC1,this.CSS_CATEGORIES="categories",this.state=J.DIRTY,this.titleLength=0,this.leftSideOffsetForHorizontalSync=0,this.limit=0,this.measureScale=new m,this.measureUnit="",this.dataFormatDigits={percent:2,decimal:1},this.stackConfig=null,this.scenarioPropOrder=[],this.overflowConfig=null,this.stackSides=D([]),this.stackLabelClearance={left:0,right:0},this.fromExpr="",this.rowCount=0,this.db=i,this.tableName=s,this.ruleSet=t||new y,this.i18n=this.createI18n(new Map),this.styles=e,this.setConfig(h),this.position=this.createElementPosition()}updatePosition(){this.position=this.createElementPosition()}createElementPosition(){this.titleLength=this.calculateTitleLength(0);let t=this.calculateLeftSideWidth(this.getVarianceType());const i=this.calculateCategoryWidth();return this.titleLength>t&&(t=this.titleLength),new q(new K(this.styles.padding),this.styles.scaleFactors,this.styles.fontStyles.size,this.dataModel.length,this.leftSideOffsetForHorizontalSync,this.titleLength,t,i,!!this.stackConfig&&0===this.variancesDataModel.length)}setStyles(t){this.styles=t}setRuleSet(t){this.ruleSet=t||new y}setConfig(t){var i,s;this.state=J.DIRTY,this.scenarioPropOrder=[...t.scenarios];const h=this.sortScenariosbyVisualisationRules(t.scenarios);this.hideCategories=t.hideCategories||!1,this.limit=t.limit,this.pixelPerUnit=t.pixelPerUnit||1,this.pixelPerPercentage=t.pixelPerPercentage||100,this.setSource(t.filter),this.level=t.level,this.dataModel=this.populateModel(h,t.level,t.sortOrder);for(const t of this.dataModel)for(const s of[t.scenario1,t.scenario2,t.scenario3,t.scenario4])null==s.value||Number.isNaN(s.value)||(s.key=Object.assign(Object.assign({},A(this.level,t.category)),{scenario:null!==(i=s.scenario)&&void 0!==i?i:void 0}));t.stackConfig&&t.stackConfig.by!==d.SCENARIOS&&this.populateDimensionStackSegments(h,t.stackConfig,t.level),this.variancesDataModel=this.populateVarianceModel(t.variances,this.dataModel),this.configTitle=t.title,this.configVariances=null!==(s=null==t?void 0:t.variances)&&void 0!==s?s:[],this.updateTitle(),this.smallestDataPointValue=this.findSmallestDataPointValue(this.dataModel),this.smallestVarianceDataPointValue=this.findSmallestDataPointValue(this.variancesDataModel),this.highestDataPointValue=this.findHighestDataPointValue(this.dataModel),this.highestVarianceDataPointValue=this.findHighestDataPointValue(this.variancesDataModel),this.axisScenario=this.setAxisScenario(t.variances),this.measureScale=t.measureScale,this.measureUnit=t.measureUnit,this.dataFormatDigits=t.dataFormatDigits,this.stackConfig=t.stackConfig,this.measureStacks(),this.updatePosition()}sortScenariosbyVisualisationRules(t){const i=this;return[...t].sort(((t,s)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(s))).reverse()}setI18n(t){this.i18n=this.createI18n(t),this.updateTitle()}updateTitle(){var t;this.title=this.configTitle||P.translateScenarioLabel(null===(t=this.configVariances)||void 0===t?void 0:t.toString(),this.i18n)}createI18n(t){this.state=J.DIRTY;const i=new Map([["SEPARATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["category"," "],["operation"," "],["thereof","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"]]);return new Map([...i,...t])}setSource(t){var i,s;if(this.state=J.DIRTY,this.queryError=void 0,this.fromExpr=X(this.db,this.tableName,t),this.fromExpr)try{const t=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(s=null===(i=t[0])||void 0===i?void 0:i.cnt)&&void 0!==s?s:0}catch(t){this.rowCount=0,this.failQuery(t)}else this.rowCount=0}getQueryError(){return this.queryError}failQuery(t){var i;null!==(i=this.queryError)&&void 0!==i||(this.queryError=G(t))}getUnitBarExtent(){var t,i;const s=this.isStacked(),h=this.getVarianceType(),e=h!==tt.NONE,n=e?this.highestVarianceDataPointValue:this.highestDataPointValue,r=e?this.smallestVarianceDataPointValue:this.smallestDataPointValue;return E({fixedDomain:s?this.stackSides.positive+this.stackSides.negative:void 0,relativeVariance:h===tt.RELATIVE,maxPositive:null!==(t=null==n?void 0:n.value)&&void 0!==t?t:0,minNegative:null!==(i=null==r?void 0:r.value)&&void 0!==i?i:0})}getPercentBarExtent(){var t,i,s,h;return W({relativeVariance:this.getVarianceType()===tt.RELATIVE,maxPositive:null!==(i=null===(t=this.highestVarianceDataPointValue)||void 0===t?void 0:t.value)&&void 0!==i?i:0,minNegative:null!==(h=null===(s=this.smallestVarianceDataPointValue)||void 0===s?void 0:s.value)&&void 0!==h?h:0})}getAllocatedCanvasWidth(){const t=this.position.getAxisPositionX(),i=this.calculateRightSideWidth(this.getVarianceType());let s=t+i+ +this.styles.padding.left+this.styles.padding.right;return i<this.titleLength/2&&(s+=this.titleLength/2),t<this.titleLength/2&&(s+=this.titleLength/2),s}getAllocatedCanvasHeight(){return this.position.getAxisEndPositionY()+this.position.spacings.labelToAxis+this.position.fontSize+this.styles.padding.bottom}patternToString(){return"<svg></svg>"}layout(){this.draw(new n)}toString(){const t=new n;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.svg()}applyFontToContainer(t){t.attr({"font-size":this.styles.fontStyles.size,"font-family":this.styles.fontStyles.family})}draw(t){this.cleanSVGforRedraw(t),this.applyFontToContainer(t),this.state===J.DIRTY&&(this.state=J.UP_TO_DATE),this.variancesDataModel&&this.variancesDataModel.length>0?(this.drawVarianceScenario(this.variancesDataModel,t),this.drawAxisAndLabels(this.variancesDataModel,t)):null!=this.stackConfig?(this.drawStackedScenarios(this.dataModel,t),this.drawStackedHeaders(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t,!0)):(this.drawScenarios(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t))}setPattern(t,i){this.styles.pattern.set(t,i)}calculateTitleLength(t){const i=S(this.title.length>7?this.title:"_______",{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width;return i<t?t:i/2}getFooter(){return 1===this.measureScale.value&&""===this.measureUnit?" ":P.translateScenarioLabel("in",this.i18n)+" "+this.measureScale.prefix+this.measureUnit}scenarioStyles(){const t=L(this.styles.barStyles,this.ruleSet);return t===this.styles.barStyles?this.styles:Object.assign(Object.create(Object.getPrototypeOf(this.styles)),this.styles,{barStyles:t})}setAxisScenario(t){let i=it.AC1;if(null!=t&&t.length>0){const s=new x(t.toString());s.isValid&&(i=k(this.ruleSet.getScenarioColorIndex(s.delta))+s.delta.slice(2))}return null===i&&(i=it.AC1),i}populateModel(t,i,s){if(0===this.rowCount||!this.fromExpr)return[];const h=[],e=this.createOrderStr(i,s),n=this.createSelectString(i,s),r=this.createGroupByStr(i,s);let o;try{o=this.db.exec(`SELECT ${n} ${t.length>0?","+t.map((t=>`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`)).join(","):""}\n FROM ${this.fromExpr}\n GROUP BY ${r}\n ORDER BY ${e}`)}catch(t){return this.failQuery(t),[]}return this.detectNaNCells(t,o),this.createDataRows(this.limit>0?o.slice(0,this.limit):o,h,t),this.crateRESTRow(o,t,h),h}detectNaNCells(t,i){i.forEach((i=>(t.forEach((t=>{const s=new x(t);!0===s.isValid?0!==i[s.base+"_cnt"]&&0!==i[s.delta+"_cnt"]||(i[t]=Number.NaN):0===i[t+"_cnt"]&&(i[t]=Number.NaN)})),i)))}crateRESTRow(t,i,s){if(this.limit<=0||this.limit>=t.length)return;const h=[];this.createDataRows(t.slice(this.limit),h,i);const e=(t,i)=>Number.isFinite(i)?(Number.isFinite(t)?t:0)+i:t,n=h.reduce((function(t,s){return{id:t.id,category:t.category,type:t.type,scenario1:new rt(e(t.scenario1.value,s.scenario1.value),i[0],t.scenario1.pixelPerUnit,it.NEU),scenario2:new rt(e(t.scenario2.value,s.scenario2.value),i[1],t.scenario2.pixelPerUnit,it.NEU),scenario3:new rt(e(t.scenario3.value,s.scenario3.value),i[2],t.scenario3.pixelPerUnit,it.NEU),scenario4:new rt(e(t.scenario4.value,s.scenario4.value),i[3],t.scenario4.pixelPerUnit,it.NEU)}}),{id:9999,category:"REST",type:tt.NONE,scenario1:new rt(NaN,i[0],this.pixelPerUnit,it.NEU),scenario2:new rt(NaN,i[1],this.pixelPerUnit,it.NEU),scenario3:new rt(NaN,i[2],this.pixelPerUnit,it.NEU),scenario4:new rt(NaN,i[3],this.pixelPerUnit,it.NEU)});s.push(n)}createDataRows(t,i,s){t.forEach(((t,h)=>{i.push({id:h,category:t.category,type:tt.NONE,scenario1:new rt(t[s[0]],s[0],this.pixelPerUnit,it.NEU),scenario2:new rt(t[s[1]],s[1],this.pixelPerUnit,it.NEU),scenario3:new rt(t[s[2]],s[2],this.pixelPerUnit,it.NEU),scenario4:new rt(t[s[3]],s[3],this.pixelPerUnit,it.NEU)})}))}createOrderStr(t,i){let s=`${t.toLowerCase()}`;return i.hierarchy.length>=1&&(s=i.hierarchy.map((t=>`${t} ${i.direction}`)).toString()),s}createSelectString(t,i){return t===c.CATEGORY&&i.hierarchy.includes(g.CATEGORYINDEX)?`${g.CATEGORYINDEX}, ${c.CATEGORY} as category`:t===c.ROWGROUP&&i.hierarchy.includes(g.ROWGROUPINDEX)?`${g.ROWGROUPINDEX}, ${c.ROWGROUP} as category`:t===c.SUBCATEGORY&&i.hierarchy.includes(g.SUBCATEGORYINDEX)?`${g.SUBCATEGORYINDEX}, ${c.SUBCATEGORY} as category`:`${t.toString()} as category`}createGroupByStr(t,i){return t===c.CATEGORY&&i.hierarchy.includes(g.CATEGORYINDEX)?`${g.CATEGORYINDEX}, ${c.CATEGORY}`:t===c.ROWGROUP&&i.hierarchy.includes(g.ROWGROUPINDEX)?`${g.ROWGROUPINDEX}, ${c.ROWGROUP}`:t===c.SUBCATEGORY&&i.hierarchy.includes(g.SUBCATEGORYINDEX)?`${g.SUBCATEGORYINDEX}, ${c.SUBCATEGORY}`:`${t.toString()}`}calculateCategoryWidth(){if(this.hideCategories)return 5;let t=0;for(const i of this.dataModel){const s=S(i.category,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"});s.width>t&&(t=s.width)}return 1.1125*t}findSmallestDataPointValue(t){let i=new rt(0,"default",this.pixelPerUnit,null);for(const s of t)for(const t of[s.scenario1,s.scenario2,s.scenario3,s.scenario4])null!=t&&null!=i.value&&t.value<i.value&&(i=t);return i}findHighestDataPointValue(t){let i=new rt(0,"default",this.pixelPerUnit,null);for(const s of t)for(const t of[s.scenario1,s.scenario2,s.scenario3,s.scenario4])null!=t&&null!=i.value&&t.value>i.value&&(i=t);return i}stackGroups(t){if(!this.stackConfig)return[];const i=this.stackConfig.by===d.SCENARIOS;let s=[];for(const h of i?["scenario1","scenario2","scenario3","scenario4"]:["scenario1"]){const i=t[h];i&&!i.isEmpty()&&null!=i.value&&s.push({value:i.value,scenario:i.scenario,dataPoint:i})}if(0===s.length)return[];const h=this.stackConfig.mode===u.RELATIVE?1:0,e=(t,i)=>({prefix:t,segments:i,layout:B(i.map((t=>t.value)),h),hasValue:i.some((t=>Number.isFinite(t.value)))});if(i){this.sortSegmentsByPropOrder(s);const t=new Map;for(const i of s){const s=C(i.scenario);t.has(s)||t.set(s,[]),t.get(s).push(i)}if(t.size>1){const i=[];for(const s of T)t.has(s)&&(i.push(e(s,t.get(s))),t.delete(s));for(const[s,h]of t)i.push(e(s,h));return i}}else t.stackSegments&&t.stackSegments.length>0&&(s=t.stackSegments.map((t=>({value:t.value,scenario:t.label,dataPoint:t.dataPoint}))));const n=t=>Number.isFinite(t.value)?t.value:0;return"asc"===this.stackConfig.order?s.sort(((t,i)=>n(t)-n(i))):"desc"===this.stackConfig.order&&s.sort(((t,i)=>n(i)-n(t))),[e("",s)]}measureStacks(){const t=[];this.stackLabelClearance={left:0,right:0};for(const i of this.dataModel){const{flipped:s,clearance:h}=this.stackLabelPlace(i),e=this.drawnStackLayouts(i),n=s?"right":"left";this.stackLabelClearance[n]=Math.max(this.stackLabelClearance[n],h),t.push(...e)}this.stackSides=D(t)}stackLabelPlace(t){const i=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;return R(this.drawnStackLayouts(t),(t=>{var s;return(null===(s=this.stackConfig)||void 0===s?void 0:s.mode)===u.RELATIVE?0:(i+this.calculateTotalLabelWidth(t.total))/this.pixelPerUnit}))}drawnStackLayouts(t){return this.stackGroups(t).filter((t=>t.hasValue)).map((t=>t.layout))}calculateTotalLabelWidth(t){const i=this.dataFormatDigits.decimal;return S(P.number(t,"decimal",i,i,this.measureScale.value,this.styles.locale),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width}isStacked(){return null!=this.stackConfig&&this.stackSides.positive+this.stackSides.negative>0}populateVarianceModel(t,i){const s=[];if(0===t.length)return s;let h=null;null!=i&&i.length>0&&(h=i[0]);for(const e in t){const n=new x(t[e]);if(n.isValid){const r=this.mapScenarios(n,h),o=n.direction;let a=this.pixelPerUnit;"dr"===n.type&&(a=this.pixelPerPercentage);for(const h in i){const l=new rt(this.calculateVariance(n,i[h],r),n.base,a,o);null===l.value||Number.isNaN(l.value)||(l.key=Object.assign(Object.assign({},A(this.level,i[h].category)),{scenario:t[e]})),s.push({id:Number(h),category:i[h].category,type:"dr"===n.type?tt.RELATIVE:tt.ABSOLUTE,scenario1:l,scenario2:new rt(null,null,null,null),scenario3:new rt(null,null,null,null),scenario4:new rt(null,null,null,null)})}}}return s}calculateVariance(t,i,s){const h=s.get(t.base),e=s.get(t.delta);return null==h||null==e?null:t.type===tt.RELATIVE?_(i[h].value-i[e].value,i[e].value):i[h].value-i[e].value}mapScenarios(t,i){const s=new Map;return null==i||["scenario1","scenario2","scenario3","scenario4"].forEach((h=>{i[h].scenario===t.delta?s.set(t.delta,h):i[h].scenario===t.base&&s.set(t.base,h)})),s}calculateTextBoxWidth(t){return S(P.number(t,"decimal",1,0,1,this.styles.locale),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width}calculatePercentageTextBoxWidth(t){let i=0;return t>=0&&(i+=S("+",{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width),i+=S(" %",{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width,S(P.number(t,"decimal",1,1,1,this.styles.locale),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width+i+i}cleanSVGforRedraw(t){t.clear()}drawAxisAndLabels(t,i,s=!1){const h=i.group().id("AxisAndDateLables");let e=!1;this.hideCategories||t.forEach(((t,i)=>{t.type===tt.RELATIVE&&(e=!0);let n=ht.Right,r=!0,o=0;if(s){const i=this.stackLabelPlace(t);r=!i.flipped,o=i.clearance*this.pixelPerUnit*(i.flipped?1:-1)}else t.scenario1.value<0&&(r=!1);r||(n=ht.Left),new ft(h,this.position.getCategoryPositionX(r)+o,this.position.getBarCenterPositionY(i),"",this.i18n.get(t.category)||t.category,this.styles,ht.Center,n).draw()})),new vt({scenarioType:this.axisScenario,labelText:this.title,isRelative:e},this.position,h,this.styles).draw()}drawScenarios(t,i){const s=i.group().id("Scenarios"),h=new wt(this.position,s,this.scenarioStyles(),t.length,this.i18n);h.setOverflowConfig(this.overflowConfig),t.forEach(((t,i)=>{h.createPrimaryBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale),h.createSecondaryBar(t.scenario2,i).draw(),h.createPrimaryMarker(t.scenario3,i).draw(),h.createSecondaryMarker(t.scenario4,i).draw()}))}drawVarianceScenario(t,i){const s=i.group().id("Scenarios"),h=new wt(this.position,s,this.scenarioStyles(),t.length,this.i18n);return h.setOverflowConfig(this.overflowConfig),t.forEach(((t,i)=>{t.type===tt.RELATIVE?h.createRelativeVarianceBar(t.scenario1,i).draw():h.createVarianceBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale)})),s}sortSegmentsByPropOrder(t){if(0===this.scenarioPropOrder.length)return;const i=this.scenarioPropOrder;t.sort(((t,s)=>{const h=i.indexOf(t.scenario),e=i.indexOf(s.scenario);return(-1===h?i.length:h)-(-1===e?i.length:e)}))}drawStackedScenarios(t,i){if(!this.stackConfig)return;const s=i.group().id("StackedScenarios"),h=this.stackConfig.by===d.SCENARIOS;t.forEach(((t,i)=>{const e=this.stackGroups(t);e.forEach(((n,r)=>{let o=null;n.segments.forEach(((t,a)=>{const l=new mt(this.position,this.styles,t.dataPoint,i,n.layout.segments[a],t.scenario,e.length>1?e.length-1-r:a,this.stackConfig.mode,n.layout,h,s);l.draw(this.dataFormatDigits,this.measureScale),o=l})),o&&n.hasValue&&o.drawTotalLabel(this.dataFormatDigits,this.measureScale,Object.assign(Object.assign({},A(this.level,t.category)),{scenario:e.length>1?n.prefix:void 0}))}))}))}drawStackedHeaders(t,i){if(!this.stackConfig||0===t.length)return;const s=t[0];if(this.stackConfig.by!==d.SCENARIOS&&(!s.stackSegments||0===s.stackSegments.length))return;const h=this.stackGroups(s);if(0===h.length)return;const e=i.group().id("StackedHeaders"),n=this.position.getBarPositionX(),r=this.position.getStackedHeaderPositionY(),o=(t,i)=>{new ft(e,t,r,"STACK_HEADER",i,this.styles,ht.Bottom,ht.Center).draw()};if(h.length>1)return void h.forEach((t=>{o(n+(t.layout.positive-t.layout.negative)/2*t.segments[0].dataPoint.pixelPerUnit,this.i18n.get(t.prefix+"1")||t.prefix.toUpperCase())}));const[a]=h;a.segments.forEach(((t,i)=>{const{start:s,end:h}=a.layout.segments[i];o(n+(s+h)/2*t.dataPoint.pixelPerUnit,this.i18n.get(t.scenario)||t.scenario)}))}getVarianceType(){return this.variancesDataModel.length>0?this.variancesDataModel[0].type:tt.NONE}calculateLeftSideWidth(t){var i,s,h;let e=0;const n=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;if(tt.NONE===t&&this.isStacked())this.stackSides.negative>0&&(e=this.stackSides.negative*this.pixelPerUnit,this.stackSides.minTotal<0&&(e+=n+this.calculateTotalLabelWidth(this.stackSides.minTotal))),this.stackLabelClearance.left>0&&(e=Math.max(e,this.stackLabelClearance.left*this.pixelPerUnit+this.calculateCategoryWidth()));else if(tt.NONE===t&&null!=(null===(i=this.smallestDataPointValue)||void 0===i?void 0:i.value)&&this.smallestDataPointValue.value<0){const t=this.calculateTextBoxWidth(this.smallestDataPointValue.value);e=Math.abs(this.smallestDataPointValue.getScaledUnit())+n+t}else if(tt.RELATIVE===t&&null!=(null===(s=this.smallestVarianceDataPointValue)||void 0===s?void 0:s.value)&&this.smallestVarianceDataPointValue.value<0){const t=this.calculatePercentageTextBoxWidth(this.smallestVarianceDataPointValue.value);e=Math.abs(this.smallestVarianceDataPointValue.getScaledPercentUnit())+n+t}else if(tt.ABSOLUTE===t&&null!=(null===(h=this.smallestVarianceDataPointValue)||void 0===h?void 0:h.value)&&this.smallestVarianceDataPointValue.value<0){const t=this.calculateTextBoxWidth(this.smallestVarianceDataPointValue.value);e=Math.abs(this.smallestVarianceDataPointValue.getScaledUnit())+n+t}return e<=this.titleLength?this.titleLength:e}calculateRightSideWidth(t){var i,s,h;if(this.isStacked()){const t=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar,i=this.calculateTextBoxWidth(this.stackSides.maxTotal);let s=this.stackSides.positive*this.pixelPerUnit+t+i;return this.stackSides.minTotal<0&&(s=Math.max(s,this.stackLabelClearance.right*this.pixelPerUnit+this.position.getCategoryToAxisSpaceing()+this.calculateCategoryWidth())),Math.max(s,this.titleLength)}let e=0;const n=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;if(tt.NONE===t&&null!=(null===(i=this.highestDataPointValue)||void 0===i?void 0:i.value)&&this.highestDataPointValue.value>=0){const t=this.calculateTextBoxWidth(this.highestDataPointValue.value);e=Math.abs(this.highestDataPointValue.getScaledUnit())+n+t}else if(tt.RELATIVE===t&&null!=(null===(s=this.highestVarianceDataPointValue)||void 0===s?void 0:s.value)&&this.highestVarianceDataPointValue.value>=0){const t=this.calculatePercentageTextBoxWidth(this.highestVarianceDataPointValue.value);e=Math.abs(this.highestVarianceDataPointValue.getScaledPercentUnit())+n+t}else if(tt.ABSOLUTE===t&&null!=(null===(h=this.highestVarianceDataPointValue)||void 0===h?void 0:h.value)&&this.highestVarianceDataPointValue.value>=0){const t=this.calculateTextBoxWidth(this.highestVarianceDataPointValue.value);e=Math.abs(this.highestVarianceDataPointValue.getScaledUnit())+n+t}return e<=this.titleLength?this.titleLength:e}populateDimensionStackSegments(t,i,s){if(0===this.rowCount||!this.fromExpr||0===t.length)return;const h={[c.ROWGROUP]:"category",[c.ROWGROUPINDEX]:"category",[c.CATEGORY]:"subCategory",[c.CATEGORYINDEX]:"subCategory"}[s];if(!h)return;const e=s.toString(),n=t[0];let r;try{r=this.db.exec(`SELECT [${e}] as displayGroup, [${h}] as stackLabel, SUM([${n}] * transformOperator(operation)) as stackValue FROM ${this.fromExpr} GROUP BY [${e}], [${h}]`)}catch(t){return void this.failQuery(t)}const o=new Map;for(const t of r){const i=t.displayGroup;o.has(i)||o.set(i,[]),null!=t.stackValue&&null!=t.stackLabel&&o.get(i).push({label:t.stackLabel,value:t.stackValue})}for(const t of this.dataModel){const i=o.get(t.category);t.stackSegments=i&&i.length>0?i.map((i=>{const s=new rt(i.value,n,this.pixelPerUnit,it.NEU);return s.key=Object.assign(Object.assign({},A(this.level,t.category)),{[h]:i.label,scenario:n}),{label:i.label,value:i.value,dataPoint:s}})):[]}}hasNoData(){return 0===this.dataModel.length}setAvailableWidth(t){if(this.pixelPerUnit<=0||t<=0)this.overflowConfig=null;else if(null==this.stackConfig){if(this.overflowConfig=this.calculateOverflowConfig(t),this.overflowConfig){const{cutWidth:t,overdriveZoneWidth:i,breakGap:s}=this.overflowConfig,h=t+i+s;this.variancesDataModel&&this.variancesDataModel.length>0?(this.highestVarianceDataPointValue.getScaledUnit()>t&&(this.highestVarianceDataPointValue=new rt(h,this.highestVarianceDataPointValue.scenario,1,this.highestVarianceDataPointValue.variance)),null!=this.smallestVarianceDataPointValue.value&&Math.abs(this.smallestVarianceDataPointValue.getScaledUnit())>t&&(this.smallestVarianceDataPointValue=new rt(-h,this.smallestVarianceDataPointValue.scenario,1,this.smallestVarianceDataPointValue.variance))):(this.highestDataPointValue.getScaledUnit()>t&&(this.highestDataPointValue=new rt(h,this.highestDataPointValue.scenario,1,this.highestDataPointValue.variance)),null!=this.smallestDataPointValue.value&&Math.abs(this.smallestDataPointValue.getScaledUnit())>t&&(this.smallestDataPointValue=new rt(-h,this.smallestDataPointValue.scenario,1,this.smallestDataPointValue.variance))),this.updatePosition()}}else this.overflowConfig=null}calculateOverflowConfig(t){const i=this.variancesDataModel&&this.variancesDataModel.length>0;if(this.getVarianceType()===tt.RELATIVE)return null;const s=i?this.highestVarianceDataPointValue:this.highestDataPointValue,h=i?this.smallestVarianceDataPointValue:this.smallestDataPointValue,e=s.getScaledUnit(),n=null!=h.value?Math.abs(h.getScaledUnit()):0,r=Math.max(e,n);if(r<=0)return null;const o=this.styles.fontStyles.size,a=o*this.styles.scaleFactors.labelToBar,l=1.5*o,c=.3*o,u=.8*o,d=t-this.position.getAxisPositionX()-this.styles.padding.left-this.styles.padding.right-a-this.calculateTextBoxWidth(s.value||0)-l-c;if(d<=u)return null;const f=d-u;return r<=f?null:{cutWidth:d,overdriveZoneWidth:l,breakGap:c,maxOverflow:r-f,scenarioCutOffset:u}}}const yt=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.chartTitle="",this.scenarios=[],this.variances=[],this.hideCategories=!1,this.pixelPerUnit=10,this.pixelPerPercentage=50,this.limit=0,this.i18n=new Map,this.order={hierarchy:[],direction:b.ASC},this.level=c.CATEGORY,this.filter="",this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.dataFormatDigits={percent:2,decimal:1},this.stackConfig=null,this.parentDimensions={width:0,height:0},z(this)}getDb(){return this.stores||(this.stores=V(this.element)),this.stores.db.db}render(){var t,i,e,n;if(void 0===this.chart||void 0!==this.queryError)return s(h,null);if(this.chart.hasNoData()){const i=null!==(t=this.i18n.get("no-data"))&&void 0!==t?t:"No Data";return s(h,{class:"no-data"},s("div",{class:"empty-state"},i))}return s(h,null,s("div",{innerHTML:null===(i=this.pattern)||void 0===i?void 0:i.toString(),class:"hidePatternContainer",style:{width:"0",height:"0",overflow:"hidden"}}),s("div",{class:this.showMeasureScale?"footer":"footer-hide"},null===(e=this.chart)||void 0===e?void 0:e.getFooter()),s("div",{innerHTML:null===(n=this.chart)||void 0===n?void 0:n.toString()}))}syncQueryError(){var t,i;this.queryError=null!==(t=this.measureScaleError)&&void 0!==t?t:null===(i=this.chart)||void 0===i?void 0:i.getQueryError(),F(this.errors,this.queryError)}async componentWillLoad(){var t;const i=this.getDb(),s=this.prepareConfig(),h=this.prepareStyle();this.chart=new Pt(new y(this.ruleSetConfig),i,this.tableName,s,h),this.chart.setI18n(this.i18n);const e=s.pixelPerUnit<=0;this.autoFitScaling(s,h),this.chart.setAvailableWidth(e?0:(null===(t=this.parentDimensions)||void 0===t?void 0:t.width)||0),this.pattern=new Z(this.chart.styles),this.chart.setPattern("hatched",this.pattern.getFCPolygonPattern()),this.syncQueryError()}async componentWillUpdate(){var t;if(null==this.chart)return;const i=this.prepareConfig(),s=this.prepareStyle();this.chart.setI18n(this.i18n),this.chart.setStyles(s),this.chart.setRuleSet(new y(this.ruleSetConfig)),this.chart.setConfig(i);const h=i.pixelPerUnit<=0;this.autoFitScaling(i,s),this.chart.setAvailableWidth(h?0:(null===(t=this.parentDimensions)||void 0===t?void 0:t.width)||0),this.pattern=new Z(this.chart.styles),this.chart.setPattern("hatched",this.pattern.getFCPolygonPattern()),this.syncQueryError()}autoFitScaling(t,i){var s;const h=t.pixelPerUnit<=0,e=t.pixelPerPercentage<=0;if(!h&&!e)return;const n=()=>{var i;null===(i=this.reportAutoScaling)||void 0===i||i.call(this,{unit:h?t.pixelPerUnit:void 0,percentage:e?t.pixelPerPercentage:void 0})},r=null===(s=this.parentDimensions)||void 0===s?void 0:s.width,o=this.getDb(),a=()=>{this.chart=new Pt(new y(this.ruleSetConfig),o,this.tableName,t,i),this.chart.setI18n(this.i18n)},l=()=>(this.chart.layout(),this.chart.getAllocatedCanvasWidth());if(!r||r<=0)return h&&(t.pixelPerUnit=1),e&&(t.pixelPerPercentage=50),a(),void n();h&&(t.pixelPerUnit=1),e&&(t.pixelPerPercentage=1),a();let c=l();if(c<=0)return void n();const u=Math.max(Y,.9*r/c);let d=!1,f=!1,v=null;for(let i=0;i<=3;i++){const i=j({target:r,measured:c,unitExtent:h?this.chart.getUnitBarExtent():0,pctExtent:e?this.chart.getPercentBarExtent():0,currentPpu:t.pixelPerUnit,currentPpp:t.pixelPerPercentage});if(void 0===i.ppu&&void 0===i.ppp)break;if(h&&void 0!==i.ppu&&(t.pixelPerUnit=i.ppu,d=!0),e&&void 0!==i.ppp&&(t.pixelPerPercentage=i.ppp,f=!0),a(),c=l(),c<=r+.5&&(v={ppu:t.pixelPerUnit,ppp:t.pixelPerPercentage},c>=.98*r))break}let p=!1;if(h&&!d&&(t.pixelPerUnit=u,p=!0),e&&!f&&(t.pixelPerPercentage=u,p=!0),c>r+.5){if(v)d&&(t.pixelPerUnit=v.ppu),f&&(t.pixelPerPercentage=v.ppp);else{const i=r/c;h&&(t.pixelPerUnit=Math.max(Y,t.pixelPerUnit*i)),e&&(t.pixelPerPercentage=Math.max(Y,t.pixelPerPercentage*i))}p=!0}p&&a(),n()}async componentWillRender(){}componentDidLoad(){}componentDidUpdate(){}prepareConfig(){const t=this.getDb(),i=X(t,this.tableName,this.filter);return this.measureScaleError=void 0,new nt(new at,new p(new U),new U,new v,t,i,(t=>{this.measureScaleError=G(t)})).adapt({scenarios:this.scenarios,variances:this.variances,title:this.chartTitle,hideCategories:this.hideCategories,pixelPerUnit:this.pixelPerUnit,pixelPerPercentage:this.pixelPerPercentage,level:this.level,limit:this.limit,sortOrder:this.order,filter:this.filter,measureScale:this.measureScale,measureUnit:this.measureUnit,showMeasureScale:this.showMeasureScale,dataFormatDigits:this.dataFormatDigits,stackConfig:this.stackConfig})}prepareStyle(){var t,i;const s=new ct(new dt,new r,new o(new $),new H(new $),new a).adapt(this.styles);return s.locale=(null===(i=null===(t=V(this.element).context)||void 0===t?void 0:t.state)||void 0===i?void 0:i.locale)||"de",s}get element(){return this}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}svg#drawCanvas{display:block}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure-renderer",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],chartTitle:[1,"chart-title"],scenarios:[16],variances:[16],hideCategories:[4,"hide-categories"],pixelPerUnit:[2,"pixel-per-unit"],pixelPerPercentage:[2,"pixel-per-percentage"],reportAutoScaling:[16],errors:[16],limit:[2],styles:[1040],i18n:[1040],order:[16],level:[1],filter:[1],measureScale:[1,"measure-scale"],measureUnit:[1,"measure-unit"],showMeasureScale:[4,"show-measure-scale"],dataFormatDigits:[16],stackConfig:[16],parentDimensions:[16],ruleSetConfig:[16]}]);function St(){"undefined"!=typeof customElements&&["bn-chart-structure-renderer"].forEach((t=>{"bn-chart-structure-renderer"===t&&(customElements.get(e(t))||customElements.define(e(t),yt))}))}export{yt as B,St as d}
|