import { colorSchemes as n } from "@nivo/colors";
import * as h from "d3";
import u from "./Colors.js";
class f extends u {
  constructor(r, t, e, s, a) {
    if (super(r, t, e, s, a), r === "index" && (this._domain = this.data.map((o) => o[this.indexBy])), r === "id" && (this._domain = this.keys), r === "values") {
      const o = e.map((i) => s.map((l) => i[l])).flatMap((i) => i).filter((i) => i != null);
      this._domain = [Math.min(...o), Math.max(...o)];
    }
    this._color = h.scaleOrdinal(n[this.scheme]), this._color.domain(this._domain);
  }
  getColorByValue(r) {
    return this.colorBy === "values" ? "gray" : this.color(r);
  }
  getColor(r, t) {
    return this.colorBy === "index" ? this.color(t[this.indexBy]) : this.colorBy === "id" ? this.color(r) : "gray";
  }
  getColorByIndex(r) {
    return this.colorBy === "values" ? "gray" : this.color(r);
  }
  getColorByKey(r) {
    return this.colorBy === "values" ? "gray" : this.color(r);
  }
}
export {
  f as default
};
