import { asciiControl as e, markdownLineEnding as t, markdownLineEndingOrSpace as n } from "../micromark-util-character/index.js";
//#region ../../node_modules/micromark-factory-destination/index.js
function r(r, i, a, o, s, c, l, u, d) {
	let f = d || Infinity, p = 0;
	return m;
	function m(t) {
		return t === 60 ? (r.enter(o), r.enter(s), r.enter(c), r.consume(t), r.exit(c), h) : t === null || t === 32 || t === 41 || e(t) ? a(t) : (r.enter(o), r.enter(l), r.enter(u), r.enter("chunkString", { contentType: "string" }), v(t));
	}
	function h(e) {
		return e === 62 ? (r.enter(c), r.consume(e), r.exit(c), r.exit(s), r.exit(o), i) : (r.enter(u), r.enter("chunkString", { contentType: "string" }), g(e));
	}
	function g(e) {
		return e === 62 ? (r.exit("chunkString"), r.exit(u), h(e)) : e === null || e === 60 || t(e) ? a(e) : (r.consume(e), e === 92 ? _ : g);
	}
	function _(e) {
		return e === 60 || e === 62 || e === 92 ? (r.consume(e), g) : g(e);
	}
	function v(t) {
		return !p && (t === null || t === 41 || n(t)) ? (r.exit("chunkString"), r.exit(u), r.exit(l), r.exit(o), i(t)) : p < f && t === 40 ? (r.consume(t), p++, v) : t === 41 ? (r.consume(t), p--, v) : t === null || t === 32 || t === 40 || e(t) ? a(t) : (r.consume(t), t === 92 ? y : v);
	}
	function y(e) {
		return e === 40 || e === 41 || e === 92 ? (r.consume(e), v) : v(e);
	}
}
//#endregion
export { r as factoryDestination };
