import { InternMap } from "../../internmap/src/index.js";
import { initRange } from "./init.js";
const implicit = Symbol("implicit");
function ordinal() {
	var i = new InternMap(), a = [], o = [], s = implicit;
	function c(e) {
		let r = i.get(e);
		if (r === void 0) {
			if (s !== implicit) return s;
			i.set(e, r = a.push(e) - 1);
		}
		return o[r % o.length];
	}
	return c.domain = function(r) {
		if (!arguments.length) return a.slice();
		a = [], i = new InternMap();
		for (let e of r) i.has(e) || i.set(e, a.push(e) - 1);
		return c;
	}, c.range = function(e) {
		return arguments.length ? (o = Array.from(e), c) : o.slice();
	}, c.unknown = function(e) {
		return arguments.length ? (s = e, c) : s;
	}, c.copy = function() {
		return ordinal(a, o).unknown(s);
	}, initRange.apply(c, arguments), c;
}
export { ordinal as default, implicit };
