"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("./Colors.js");class j extends I.default{constructor(s,o,a,C,p,n,c,v,_,l={},f,y,d,i){if(super(a,C,p,v,_),this._manualColor={},this._manualColor[y]=l?l.Overall:null,s!="csv"){const b=e=>{h=[...n][e]?[...n][e].items:[],l!=null&&l!=null&&Object.keys(l).forEach(u=>{const t=h.filter(r=>r.code===u);if(t.length>0&&t[0].labels){let r;f&&(r=t[0].labels[f.toUpperCase()]),r?this._manualColor[r]=l[u]:this._manualColor[t[0].value]=l[u]}})},O=e=>e==null?void 0:e.map(t=>{const r=t.group.label;return t.label.includes(r)?t:{...t,label:`${r} - ${t.label}`}}),x=()=>{var e;return c&&c.size>0?c:((e=i==null?void 0:i.metadata)==null?void 0:e.measures.length)>0?(i.metadata.measures=O(i.metadata.measures),i.metadata.measures):[]},g=()=>{h=x(),Object.keys(l).forEach(e=>{const u=[...h].filter(t=>t.value===e);if(u.length>0&&u[0].labels){const t=d[e];d&&t&&(this._manualColor[t]=l[e]);let r;f&&(r=u[0].labels[f.toUpperCase()]),r?this._manualColor[r]=l[e]:this._manualColor[u[0].label]=l[e]}})};let h=[];const m=o==="line"?1:a==="index"?0:1;n?n.size==1&&m==1?_=="measure"?b(0):g():b(m):g()}else this._manualColor=l&&l[a]?l[a]:{}}getColor(s,o){if(this.colorBy==="index"){const a=this._manualColor[s]||this._manualColor[o[this.indexBy]];return a||"#555555"}return this.colorBy==="id"&&this._manualColor[s]?this._manualColor[s]:"#555555"}getColorByIndex(s){}getColorByKey(s){return this._manualColor[s]?this._manualColor[s]:"#555555"}}exports.default=j;
