import { checkBullet } from "../util/check-bullet.js";
import { checkListItemIndent } from "../util/check-list-item-indent.js";
function listItem(n, r, i, a) {
	let o = checkListItemIndent(i), s = i.bulletCurrent || checkBullet(i);
	r && r.type === "list" && r.ordered && (s = (typeof r.start == "number" && r.start > -1 ? r.start : 1) + (i.options.incrementListMarker === !1 ? 0 : r.children.indexOf(n)) + s);
	let c = s.length + 1;
	(o === "tab" || o === "mixed" && (r && r.type === "list" && r.spread || n.spread)) && (c = Math.ceil(c / 4) * 4);
	let l = i.createTracker(a);
	l.move(s + " ".repeat(c - s.length)), l.shift(c);
	let u = i.enter("listItem"), d = i.indentLines(i.containerFlow(n, l.current()), f);
	return u(), d;
	function f(e, t, n) {
		return t ? (n ? "" : " ".repeat(c)) + e : (n ? s : s + " ".repeat(c - s.length)) + e;
	}
}
export { listItem };
