import { durationSecond as a, durationMinute as d, durationHour as u, durationDay as g, durationWeek as D, durationMonth as y, durationYear as p } from "./duration.js";
import { millisecond as H } from "./millisecond.js";
import { second as k } from "./second.js";
import { timeMinute as T } from "./minute.js";
import { timeHour as Y } from "./hour.js";
import { timeDay as W } from "./day.js";
import { timeSunday as j } from "./week.js";
import { timeMonth as q } from "./month.js";
import { timeYear as w } from "./year.js";
import z from "../../../../d3-array@3.2.4/node_modules/d3-array/src/bisector.js";
import { tickStep as I } from "../../../../d3-array@3.2.4/node_modules/d3-array/src/ticks.js";
function A(v, l, S, s, m, c) {
  const n = [
    [k, 1, a],
    [k, 5, 5 * a],
    [k, 15, 15 * a],
    [k, 30, 30 * a],
    [c, 1, d],
    [c, 5, 5 * d],
    [c, 15, 15 * d],
    [c, 30, 30 * d],
    [m, 1, u],
    [m, 3, 3 * u],
    [m, 6, 6 * u],
    [m, 12, 12 * u],
    [s, 1, g],
    [s, 2, 2 * g],
    [S, 1, D],
    [l, 1, y],
    [l, 3, 3 * y],
    [v, 1, p]
  ];
  function b(r, i, t) {
    const o = i < r;
    o && ([r, i] = [i, r]);
    const e = t && typeof t.range == "function" ? t : M(r, i, t), f = e ? e.range(r, +i + 1) : [];
    return o ? f.reverse() : f;
  }
  function M(r, i, t) {
    const o = Math.abs(i - r) / t, e = z(([, , x]) => x).right(n, o);
    if (e === n.length) return v.every(I(r / p, i / p, t));
    if (e === 0) return H.every(Math.max(I(r, i, t), 1));
    const [f, h] = n[o / n[e - 1][2] < n[e][2] / o ? e - 1 : e];
    return f.every(h);
  }
  return [b, M];
}
const [Q, R] = A(w, q, j, W, Y, T);
export {
  R as timeTickInterval,
  Q as timeTicks
};
