"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@nivo/colors"),u=require("d3"),h=require("./Colors.js");function f(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const m=f(u);class p extends h.default{constructor(e,t,i,n,l){if(super(e,t,i,n,l),e==="index"&&(this._domain=[0,this.data.length]),e==="id"&&(this._domain=[0,this.keys.length]),e==="values"){const r=i.map(s=>n.map(c=>s[c])).flatMap(s=>s).filter(s=>s!=null);this._domain=[Math.min(...r),Math.max(...r)]}const a=d.sequentialColorInterpolators[this.scheme];this._color=m.scaleSequential(a),this._color.domain(this._domain)}getColor(e,t){if(this.colorBy==="index"){const i=this.data.map(n=>n[this.indexBy]);return this.color(i.indexOf(t[this.indexBy]))}if(this.colorBy==="id")return this.color(this.keys.indexOf(e));if(this.colorBy==="values")return this.color(t[e])}getColorByIndex(e){const t=this.data.map(i=>i[this.indexBy]);return this.color(t.indexOf(e))}getColorByKey(e){return this.color(this.keys.indexOf(e))}}exports.default=p;
