"use client";
import { identity as u } from "./continuous.js";
import { initInterpolator as a } from "./init.js";
import l from "../../d3-array/src/ascending.js";
import f from "../../d3-array/src/quantile.js";
import { bisectRight as m } from "../../d3-array/src/bisect.js";
function s() {
  var n = [], i = u;
  function r(t) {
    if (t != null && !isNaN(t = +t)) return i((m(n, t, 1) - 1) / (n.length - 1));
  }
  return r.domain = function(t) {
    if (!arguments.length) return n.slice();
    n = [];
    for (let e of t) e != null && !isNaN(e = +e) && n.push(e);
    return n.sort(l), r;
  }, r.interpolator = function(t) {
    return arguments.length ? (i = t, r) : i;
  }, r.range = function() {
    return n.map((t, e) => i(e / (n.length - 1)));
  }, r.quantiles = function(t) {
    return Array.from({ length: t + 1 }, (e, o) => f(n, o / t));
  }, r.copy = function() {
    return s(i).domain(n);
  }, a.apply(r, arguments);
}
export {
  s as default
};
